Skip to content

Commit

Permalink
repo flake8 compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
TehmoorG committed Aug 29, 2024
1 parent 2558024 commit 8e6316f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[flake8]
max-line-length = 200
ignore =
E402,
8 changes: 4 additions & 4 deletions src/advanced_route_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
3 changes: 1 addition & 2 deletions src/common_route_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions src/simple_route_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
2 changes: 2 additions & 0 deletions src/zone_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_common_route_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 0 additions & 1 deletion tests/test_generate_route.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down

0 comments on commit 8e6316f

Please sign in to comment.