diff --git a/examples/00-mwe.py b/examples/00-mwe.py index b4d2533..a141d4b 100644 --- a/examples/00-mwe.py +++ b/examples/00-mwe.py @@ -1,6 +1,6 @@ """Minimum working example for superblockify.""" -# While this script is running, figures will be generated on screen. +# While this script is running, figures will be generated on screen. # Close the figure windows to proceed with the script execution. @@ -12,10 +12,11 @@ name="Scheveningen_test", city_name="Scheveningen", search_str="Scheveningen, NL", - unit="time", # "time", "distance", any other edge attribute, or None to count edges + unit="time", + # "time", "distance", any other edge attribute, or None to count edges ) # If you want to select a different city, find the corresponding search string - # (`search_str`) at https://nominatim.openstreetmap.org/. + # (`search_str`) at https://nominatim.openstreetmap.org/. # The smaller the place, the quicker the partitioning. # For large places sufficient memory is required. diff --git a/pyproject.toml b/pyproject.toml index 1007913..ce293ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,7 +91,7 @@ suggestion-mode = true [tool.pylint.basic] # Regular expression matching correct module names. Overrides module-naming- # style. Additionally to snake case allows for a prepended 'yyyymmdd-' string. -module-rgx = "(\\d{4}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])-)?(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$" +module-rgx = "(0*\\d+-)?(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$" [tool.pylint.format] # Maximum number of characters on a single line. diff --git a/superblockify/metrics/measures.py b/superblockify/metrics/measures.py index 8d0589b..2c75200 100644 --- a/superblockify/metrics/measures.py +++ b/superblockify/metrics/measures.py @@ -795,8 +795,8 @@ def add_relative_changes(components, attr_pairs): :func:`superblockify.utils.percentual_increase`. Write the relative percentual change of the specified edge attribute(s) to each - Superblock in the list of components. The relative change is the percentual change of - the first to the second attribute. + Superblock in the list of components. + The relative change is the percentual change of the first to the second attribute. Works in-place and adds `change_{attr1}` to each Superblock. If `attr1` has a value of 2 and `attr2` has a value of 1, the relative change is -0.5, a 50% decrease. If `attr1` has a value of 4 and `attr2` has a value of 6, diff --git a/superblockify/partitioning/approaches/attribute.py b/superblockify/partitioning/approaches/attribute.py index d2f6373..6e63d43 100644 --- a/superblockify/partitioning/approaches/attribute.py +++ b/superblockify/partitioning/approaches/attribute.py @@ -34,8 +34,8 @@ def write_attribute(self, **kwargs): def partition_graph(self, make_plots=False, **kwargs): """Group by boolean attribute and remove small components. - Construct sparsified graph from boolean attribute and Superblock subgraphs for the - components that fall apart. + Construct sparsified graph from boolean attribute and Superblock subgraphs + for the components that fall apart. Parameters ---------- diff --git a/superblockify/partitioning/approaches/steiner_tree.py b/superblockify/partitioning/approaches/steiner_tree.py index 0cadb27..065a050 100644 --- a/superblockify/partitioning/approaches/steiner_tree.py +++ b/superblockify/partitioning/approaches/steiner_tree.py @@ -33,10 +33,10 @@ def write_attribute( into which the residual graph decomposes. Edges that are `oneway` can be excluded with `remove_oneway_edges`. - The idea is so this approach can produce Superblocks that are reachable from every - other Superblock, as Steiner trees are calculated on undirected graphs. But htis - highly depends on how the place was mapped. If arterial roads in two directions - are mapped as two separate ways, this is not the way out. + The idea is so this approach can produce Superblocks that are reachable from + every other Superblock, as Steiner trees are calculated on undirected graphs. + But this highly depends on how the place was mapped. If arterial roads in two + directions are mapped as two separate ways, this is not the way out. Normally, the sampling probability is uniform, but if `low_betweenness_mode` is set, the sampling probability is inversely proportional to the betweenness diff --git a/superblockify/partitioning/utils.py b/superblockify/partitioning/utils.py index 15c87cc..ff871c4 100644 --- a/superblockify/partitioning/utils.py +++ b/superblockify/partitioning/utils.py @@ -37,8 +37,9 @@ def save_to_gpkg( The path to save the geodatapackage to. If None, it will be saved to the partitioners folder at (part.results_dir, part.name + ".gpkg") ltn_boundary : bool, optional - If True, the boundary of the Superblocks will be saved as a polygon into the `cell` - attribute of the Superblocks layer. For this, the tessellation needs to be calculated. + If True, the boundary of the Superblocks will be saved as a polygon into the + `cell` attribute of the Superblocks layer. For this, the tessellation needs + to be calculated. Raises ------ @@ -98,12 +99,14 @@ def save_to_gpkg( if partitioner.components: parts = partitioner.components logger.info( - "Using components attribute to save Superblocks to geodatapackage %s", filepath + "Using components attribute to save Superblocks to geodatapackage %s", + filepath, ) elif partitioner.partitions: parts = partitioner.partitions logger.info( - "Using partitions attribute to save Superblocks to geodatapackage %s", filepath + "Using partitions attribute to save Superblocks to geodatapackage %s", + filepath, ) if not isinstance(parts, list):