Skip to content

Conversation

@Grufoony
Copy link
Collaborator

No description provided.

@Grufoony Grufoony self-assigned this Dec 23, 2024
or graph.in_degree(node) > 2
):
continue
u, v = neighbours

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Variable name "u" doesn't conform to snake_case naming style Warning

Variable name "u" doesn't conform to snake_case naming style
or graph.in_degree(node) > 2
):
continue
u, v = neighbours

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Variable name "v" doesn't conform to snake_case naming style Warning

Variable name "v" doesn't conform to snake_case naming style


def merge_edges(
graph: nx.DiGraph, previous_node: int, successive_node: int, node: int

Check warning

Code scanning / Pylint (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). Warning

Wrong hanging indentation before block (add 4 spaces).
data_u.setdefault("lanes", 1)
data_v.setdefault("lanes", 1)
if (
not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"])

Check warning

Code scanning / Pylint (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). Warning

Wrong hanging indentation before block (add 4 spaces).
data_v.setdefault("lanes", 1)
if (
not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"])
or data_u["lanes"] != data_v["lanes"]

Check warning

Code scanning / Pylint (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). Warning

Wrong hanging indentation before block (add 4 spaces).
# define neighborus as list of predecessors and successors
neighbours = list(graph.predecessors(node)) + list(graph.successors(node))
if (
len(neighbours) != 2

Check warning

Code scanning / Pylint (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). Warning

Wrong hanging indentation before block (add 4 spaces).
neighbours = list(graph.predecessors(node)) + list(graph.successors(node))
if (
len(neighbours) != 2
or graph.in_degree(node) != graph.out_degree(node)

Check warning

Code scanning / Pylint (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). Warning

Wrong hanging indentation before block (add 4 spaces).
if (
len(neighbours) != 2
or graph.in_degree(node) != graph.out_degree(node)
or graph.in_degree(node) > 2

Check warning

Code scanning / Pylint (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). Warning

Wrong hanging indentation before block (add 4 spaces).
or graph.in_degree(node) > 2
):
continue
u, v = neighbours

Check warning

Code scanning / Pylint (reported by Codacy)

Variable name "v" doesn't conform to snake_case naming style Warning

Variable name "v" doesn't conform to snake_case naming style
or graph.in_degree(node) > 2
):
continue
u, v = neighbours

Check warning

Code scanning / Pylint (reported by Codacy)

Variable name "u" doesn't conform to snake_case naming style Warning

Variable name "u" doesn't conform to snake_case naming style

gdf_nodes, gdf_edges = ox.graph_to_gdfs(G)
# Plot resulting graph
fig, ax = ox.plot_graph(G, show=False, close=False)

Check warning

Code scanning / Pylint (reported by Codacy)

Constant name "fig" doesn't conform to UPPER_CASE naming style Warning

Constant name "fig" doesn't conform to UPPER_CASE naming style

gdf_nodes, gdf_edges = ox.graph_to_gdfs(G)
# Plot resulting graph
fig, ax = ox.plot_graph(G, show=False, close=False)

Check warning

Code scanning / Pylint (reported by Codacy)

Constant name "ax" doesn't conform to UPPER_CASE naming style Warning

Constant name "ax" doesn't conform to UPPER_CASE naming style
import networkx as nx
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import pandas as pd

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'pandas' (import-error) Warning

Unable to import 'pandas' (import-error)
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import pandas as pd
from shapely.geometry import MultiLineString, LineString

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'shapely.geometry' (import-error) Warning

Unable to import 'shapely.geometry' (import-error)
import matplotlib.pyplot as plt
import pandas as pd
from shapely.geometry import MultiLineString, LineString
from shapely.ops import linemerge

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'shapely.ops' (import-error) Warning

Unable to import 'shapely.ops' (import-error)


def merge_edges(
graph: nx.DiGraph, previous_node: int, successive_node: int, node: int

Check warning

Code scanning / Prospector (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). graph: nx.DiGraph, previous_node: int, successive_node: int, node: int ^ | (bad-continuation) Warning

Wrong hanging indentation before block (add 4 spaces).
graph: nx.DiGraph, previous_node: int, successive_node: int, node: int
^ | (bad-continuation)
data_u.setdefault("lanes", 1)
data_v.setdefault("lanes", 1)
if (
not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"])

Check warning

Code scanning / Prospector (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"]) ^ | (bad-continuation) Warning

Wrong hanging indentation before block (add 4 spaces).
not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"])
^ | (bad-continuation)
data_v.setdefault("lanes", 1)
if (
not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"])
or data_u["lanes"] != data_v["lanes"]

Check warning

Code scanning / Prospector (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). or data_u["lanes"] != data_v["lanes"] ^ | (bad-continuation) Warning

Wrong hanging indentation before block (add 4 spaces).
or data_u["lanes"] != data_v["lanes"]
^ | (bad-continuation)
# define neighborus as list of predecessors and successors
neighbours = list(graph.predecessors(node)) + list(graph.successors(node))
if (
len(neighbours) != 2

Check warning

Code scanning / Prospector (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). len(neighbours) != 2 ^ | (bad-continuation) Warning

Wrong hanging indentation before block (add 4 spaces).
len(neighbours) != 2
^ | (bad-continuation)
neighbours = list(graph.predecessors(node)) + list(graph.successors(node))
if (
len(neighbours) != 2
or graph.in_degree(node) != graph.out_degree(node)

Check warning

Code scanning / Prospector (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). or graph.in_degree(node) != graph.out_degree(node) ^ | (bad-continuation) Warning

Wrong hanging indentation before block (add 4 spaces).
or graph.in_degree(node) != graph.out_degree(node)
^ | (bad-continuation)
if (
len(neighbours) != 2
or graph.in_degree(node) != graph.out_degree(node)
or graph.in_degree(node) > 2

Check warning

Code scanning / Prospector (reported by Codacy)

Wrong hanging indentation before block (add 4 spaces). or graph.in_degree(node) > 2 ^ | (bad-continuation) Warning

Wrong hanging indentation before block (add 4 spaces).
or graph.in_degree(node) > 2
^ | (bad-continuation)
or graph.in_degree(node) > 2
):
continue
u, v = neighbours

Check warning

Code scanning / Prospector (reported by Codacy)

Variable name "u" doesn't conform to snake_case naming style (invalid-name) Warning

Variable name "u" doesn't conform to snake_case naming style (invalid-name)
coords = []
for line in edge_uv["geometry"]:
coords.extend(
list(line.coords)

Check warning

Code scanning / Pylint (reported by Codacy)

Constant name "gdf_nodes" doesn't conform to UPPER_CASE naming style Warning

Constant name "gdf_nodes" doesn't conform to UPPER_CASE naming style
coords = []
for line in edge_uv["geometry"]:
coords.extend(
list(line.coords)

Check warning

Code scanning / Pylint (reported by Codacy)

Constant name "gdf_edges" doesn't conform to UPPER_CASE naming style Warning

Constant name "gdf_edges" doesn't conform to UPPER_CASE naming style
len(G.edges),
)
# assert that graph has not isolated nodes
assert not list(nx.isolates(G))

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# assert that graph has not isolated nodes
assert not list(nx.isolates(G))
# assert that graph has not self-loops
assert not list(nx.selfloop_edges(G))

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
gdf_edges.reset_index(inplace=True)

# assert that there are no edges with the same u and v
assert not gdf_edges.duplicated(subset=["u", "v"]).any()

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
edges_to_remove = []
seen_edges = {}

for u, v, data in graph.edges(data=True):

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Variable name "v" doesn't conform to snake_case naming style Warning

Variable name "v" doesn't conform to snake_case naming style
edges_to_remove = []
seen_edges = {}

for u, v, data in graph.edges(data=True):

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Variable name "u" doesn't conform to snake_case naming style Warning

Variable name "u" doesn't conform to snake_case naming style
edges_to_remove = []
seen_edges = {}

for u, v, data in graph.edges(data=True):

Check warning

Code scanning / Prospector (reported by Codacy)

Variable name "u" doesn't conform to snake_case naming style (invalid-name) Warning

Variable name "u" doesn't conform to snake_case naming style (invalid-name)
edges_to_remove = []
seen_edges = {}

for u, v, data in graph.edges(data=True):

Check warning

Code scanning / Pylint (reported by Codacy)

Variable name "v" doesn't conform to snake_case naming style Warning

Variable name "v" doesn't conform to snake_case naming style
edges_to_remove = []
seen_edges = {}

for u, v, data in graph.edges(data=True):

Check warning

Code scanning / Pylint (reported by Codacy)

Variable name "u" doesn't conform to snake_case naming style Warning

Variable name "u" doesn't conform to snake_case naming style
@Grufoony Grufoony merged commit 5e7c43f into main Dec 28, 2024
25 checks passed
@Grufoony Grufoony deleted the enhance_osmfilter branch December 28, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants