This commit is contained in:
mm 2023-05-05 05:43:15 +00:00
parent 9083e9d6e1
commit 4e2e160072
2 changed files with 3 additions and 2 deletions

View File

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

View File

@ -105,6 +105,7 @@ def calculate_distance(pair):
distance = get_distance(city1["name"], city2["name"])
return city1["name"], city2["name"], distance
def main():
cities = list(us_cities.values())
print(f"Num cities: {len(cities)}")
@ -121,7 +122,7 @@ def main():
try:
executor = concurrent.futures.ProcessPoolExecutor(max_workers=args.workers)
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 = {
executor.submit(calculate_distance, pair): pair for pair in chunk
}