Browse Source

linting

main
mm 2 years ago
parent
commit
4e2e160072
  1. 2
      Makefile
  2. 3
      generate_data.py

2
Makefile

@ -18,7 +18,7 @@ lint:
@echo "Auto-linting files and performing final style checks..." @echo "Auto-linting files and performing final style checks..."
@isort --profile=black . @isort --profile=black .
@black . @black .
@flake8 --max-line-length=88 . @flake8 --max-line-length=88 --ignore E203 .
check: lint check: lint
@echo "Checking for unstaged or untracked changes..." @echo "Checking for unstaged or untracked changes..."

3
generate_data.py

@ -105,6 +105,7 @@ def calculate_distance(pair):
distance = get_distance(city1["name"], city2["name"]) distance = get_distance(city1["name"], city2["name"])
return city1["name"], city2["name"], distance return city1["name"], city2["name"], distance
def main(): def main():
cities = list(us_cities.values()) cities = list(us_cities.values())
print(f"Num cities: {len(cities)}") print(f"Num cities: {len(cities)}")
@ -121,7 +122,7 @@ def main():
try: try:
executor = concurrent.futures.ProcessPoolExecutor(max_workers=args.workers) executor = concurrent.futures.ProcessPoolExecutor(max_workers=args.workers)
for i in range(num_chunks): for i in range(num_chunks):
chunk = city_combinations[i * chunk_size : (i + 1) * chunk_size] chunk = city_combinations[(i * chunk_size) : (i + 1) * chunk_size]
futures = { futures = {
executor.submit(calculate_distance, pair): pair for pair in chunk executor.submit(calculate_distance, pair): pair for pair in chunk
} }

Loading…
Cancel
Save