Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
roefem committed Jul 5, 2024
1 parent 61daf08 commit 7946aaf
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
18 changes: 9 additions & 9 deletions brdr/aligner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,46 +1151,46 @@ def load_thematic_data(self, loader: Loader):

# Deprecated loader methods
def load_thematic_data_geojson(self, thematic_input, name_thematic_id):
logging.warning('deprecated method, use load_thematic_data instead')
logging.warning("deprecated method, use load_thematic_data instead")
loader = GeoJsonLoader(thematic_input, name_thematic_id)
self.load_thematic_data(loader)

def load_thematic_data_file(self, path_to_file, name_thematic_id):
logging.warning('deprecated method, use load_thematic_data instead')
logging.warning("deprecated method, use load_thematic_data instead")
loader = GeoJsonFileLoader(path_to_file, name_thematic_id)
self.load_thematic_data(loader)

def load_thematic_data_dict(self, dict_theme):
logging.warning('deprecated method, use load_thematic_data instead')
logging.warning("deprecated method, use load_thematic_data instead")
loader = DictLoader(dict_theme)
self.load_thematic_data(loader)

def load_thematic_data_url(self, url, name_thematic_id):
logging.warning('deprecated method, use load_thematic_data instead')
logging.warning("deprecated method, use load_thematic_data instead")
loader = GeoJsonUrlLoader(url, name_thematic_id)
self.load_thematic_data(loader)

def load_reference_data_dict(self, dict_ref):
logging.warning('deprecated method, use load_reference_data instead')
logging.warning("deprecated method, use load_reference_data instead")
loader = DictLoader(dict_ref)
self.load_reference_data(loader)

def load_reference_data_geojson(self, reference_input, name_reference_id):
logging.warning('deprecated method, use load_reference_data instead')
logging.warning("deprecated method, use load_reference_data instead")
loader = GeoJsonLoader(reference_input, name_reference_id)
self.load_reference_data(loader)

def load_reference_data_file(self, path_to_file, name_reference_id):
logging.warning('deprecated method, use load_reference_data instead')
logging.warning("deprecated method, use load_reference_data instead")
loader = GeoJsonFileLoader(path_to_file, name_reference_id)
self.load_reference_data(loader)

def load_reference_data_url(self, url, name_reference_id):
logging.warning('deprecated method, use load_reference_data instead')
logging.warning("deprecated method, use load_reference_data instead")
loader = GeoJsonUrlLoader(url, name_reference_id)
self.load_reference_data(loader)

def load_reference_data_grb_actual(self, *, grb_type=GRBType.ADP, partition=0):
logging.warning('deprecated method, use load_reference_data instead')
logging.warning("deprecated method, use load_reference_data instead")
loader = GRBActualLoader(grb_type, partition, self)
self.load_reference_data(loader)
2 changes: 1 addition & 1 deletion brdr/geometry_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def grid_bounds(geom: BaseGeometry, delta: float):
return grid


def get_relevant_polygons_from_geom( geometry: BaseGeometry, buffer_distance: float ):
def get_relevant_polygons_from_geom(geometry: BaseGeometry, buffer_distance: float):
"""
Get only the relevant parts (polygon) from a geometry.
Points, Lines and Polygons smaller than relevant distance are excluded from the result
Expand Down
2 changes: 1 addition & 1 deletion brdr/typings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class GeoJSONGeometry(TypedDict):
type: str
coordinates: List[float] | List[List[float]] | List[List[List[float]]] | List[List[List[List[float]]]]
coordinates: List


class Crs(TypedDict):
Expand Down
14 changes: 10 additions & 4 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ def test_example_combined_borders_adp_gbg(self):
aligner = Aligner()
dict_theme = get_oe_dict_by_ids([131635])
aligner.load_thematic_data_dict(dict_theme)
adp_loader = GRBActualLoader(grb_type=GRBType.ADP, partition=1000, aligner=aligner)
gbg_loader = GRBActualLoader(grb_type=GRBType.GBG, partition=1000, aligner=aligner)
adp_loader = GRBActualLoader(
grb_type=GRBType.ADP, partition=1000, aligner=aligner
)
gbg_loader = GRBActualLoader(
grb_type=GRBType.GBG, partition=1000, aligner=aligner
)
dict_ref = adp_loader.load_data()
dict_ref.update(gbg_loader.load_data()) # combine 2 dictionaries
dict_ref.update(gbg_loader.load_data()) # combine 2 dictionaries
# make a polygonized version of the reference data with non-overlapping polygons
aligner.load_reference_data_dict(dict_ref)

rel_dist = 2
dict_results_by_distance = {rel_dist: aligner.process_dict_thematic(rel_dist, 4)}
dict_results_by_distance = {
rel_dist: aligner.process_dict_thematic(rel_dist, 4)
}
results = dict_results_by_distance[rel_dist][0]
for key in results:
aligner.get_formula(results[key])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ def test_partition(self):
# Check if the result is a list of Polygon objects
self.assertIsInstance(filtered_partitions, list)
for partition in filtered_partitions:
self.assertIsInstance(partition, Polygon)
self.assertIsInstance(partition, Polygon)

0 comments on commit 7946aaf

Please sign in to comment.