diff --git a/.flake8 b/.flake8 index b68fdd0..faa6026 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,4 @@ [flake8] max-line-length = 200 +ignore = + E402, \ No newline at end of file diff --git a/src/advanced_route_utils.py b/src/advanced_route_utils.py index 957b5a1..cea2c75 100644 --- a/src/advanced_route_utils.py +++ b/src/advanced_route_utils.py @@ -7,13 +7,13 @@ Functions: - segment_edge(line, segment_length): Segments a line into smaller segments of specified length. -- calculate_segment_weight(segment, roads_gdf, buildings_gdf, open_space_gdf, avoidance_zones_gdf): +- calculate_segment_weight(segment, roads_gdf, buildings_gdf, open_space_gdf, avoidance_zones_gdf): Calculates the weight of a segment based on intersection with roads, buildings, open spaces, and avoidance zones. -- calculate_edge_weight(line, roads_gdf, buildings_gdf, open_space_gdf, avoidance_zones_gdf): +- calculate_edge_weight(line, roads_gdf, buildings_gdf, open_space_gdf, avoidance_zones_gdf): Calculates the total weight of an edge by summing the weights of its segments. -- create_and_save_graph(health_facilities_gdf, roads_gdf, buildings_gdf, open_space_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km, output_path): +- create_and_save_graph(health_facilities_gdf, roads_gdf, buildings_gdf, open_space_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km, output_path): Creates a network graph with advanced constraints and saves it to a file. -- add_node_to_graph(G, lat, lon, node_name, health_facilities_gdf, roads_gdf, buildings_gdf, open_space_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km): +- add_node_to_graph(G, lat, lon, node_name, health_facilities_gdf, roads_gdf, buildings_gdf, open_space_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km): Adds a new node to the existing graph, considering advanced constraints. - download_land_use_data(place_name): Downloads land use data (roads, buildings, open spaces) for a specified place using OSMnx. """ diff --git a/src/common_route_utils.py b/src/common_route_utils.py index 0840dee..45bef16 100644 --- a/src/common_route_utils.py +++ b/src/common_route_utils.py @@ -36,8 +36,7 @@ def get_coordinates(lat_range, lon_range): # Validate if the coordinates are within the specified bounds if ( - lat_range[0] <= latitude <= lat_range[1] - and lon_range[0] <= longitude <= lon_range[1] + lat_range[0] <= latitude <= lat_range[1] and lon_range[0] <= longitude <= lon_range[1] ): print( f"Coordinates ({latitude}, {longitude}) are valid within the specified range." diff --git a/src/simple_route_utils.py b/src/simple_route_utils.py index 6519b64..86a7796 100644 --- a/src/simple_route_utils.py +++ b/src/simple_route_utils.py @@ -6,9 +6,9 @@ as well as adding new nodes (locations) to the graph while considering no-fly zones and avoidance areas. Functions: -- create_and_save_graph(health_facilities_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km, output_path): +- create_and_save_graph(health_facilities_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km, output_path): Creates a network graph based on healthcare facilities and saves it to a file. -- add_node_to_graph(G, lat, lon, node_name, health_facilities_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km): +- add_node_to_graph(G, lat, lon, node_name, health_facilities_gdf, no_fly_zones_gdf, avoidance_zones_gdf, drone_range_km): Adds a new node to the existing graph, connecting it to other nodes based on proximity and constraints. """ diff --git a/src/zone_utils.py b/src/zone_utils.py index 5d1ac39..0fb4990 100644 --- a/src/zone_utils.py +++ b/src/zone_utils.py @@ -2,6 +2,8 @@ import geopandas as gpd from shapely.geometry import Point import matplotlib.pyplot as plt +import os +import glob def create_circular_zone(lat, lon, radius): diff --git a/tests/test_common_route_utils.py b/tests/test_common_route_utils.py index d35b78c..8f208b6 100644 --- a/tests/test_common_route_utils.py +++ b/tests/test_common_route_utils.py @@ -8,11 +8,10 @@ sys.path.append(os.path.abspath(os.path.join(current_dir, ".."))) -import pytest import networkx as nx import pandas as pd import pickle -from src.common_route_utils import get_coordinates, load_graph, save_route_to_csv +from src.common_route_utils import save_route_to_csv from tests.utils import create_test_graph diff --git a/tests/test_generate_route.py b/tests/test_generate_route.py index f809654..4358103 100644 --- a/tests/test_generate_route.py +++ b/tests/test_generate_route.py @@ -1,5 +1,4 @@ from unittest.mock import patch -import pytest import os import pandas as pd from scripts.generate_simple_route import main as simple_route_main diff --git a/tests/utils.py b/tests/utils.py index dc5c87b..bb39ec9 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,9 +1,8 @@ # tests/utils.py -import os import pandas as pd import geopandas as gpd import networkx as nx -from shapely.geometry import Point, Polygon +from shapely.geometry import Polygon def mock_healthcare_facilities():