diff options
Diffstat (limited to 'networkx')
18 files changed, 33 insertions, 33 deletions
diff --git a/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py b/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py index 166df59a..69b06cb9 100644 --- a/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +++ b/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py @@ -59,7 +59,7 @@ class TestFlowBetweennessCentrality: assert almost_equal(b[n], b_answer[n]) def test_star(self): - """Betweenness centrality: star """ + """Betweenness centrality: star""" G = nx.Graph() nx.add_star(G, ["a", "b", "c", "d"]) b = nx.current_flow_betweenness_centrality(G, normalized=True) diff --git a/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py b/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py index 15b0773b..47e41b3f 100644 --- a/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +++ b/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py @@ -76,7 +76,7 @@ class TestFlowBetweennessCentrality: assert almost_equal(b[n], b_answer[n]) def test_star(self): - """Betweenness centrality: star """ + """Betweenness centrality: star""" G = nx.Graph() nx.add_star(G, ["a", "b", "c", "d"]) b = nx.current_flow_betweenness_centrality_subset( diff --git a/networkx/algorithms/centrality/tests/test_current_flow_closeness.py b/networkx/algorithms/centrality/tests/test_current_flow_closeness.py index 338c9613..c2fa4ec0 100644 --- a/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +++ b/networkx/algorithms/centrality/tests/test_current_flow_closeness.py @@ -25,7 +25,7 @@ class TestFlowClosenessCentrality: assert almost_equal(b[n], b_answer[n]) def test_star(self): - """Closeness centrality: star """ + """Closeness centrality: star""" G = nx.Graph() nx.add_star(G, ["a", "b", "c", "d"]) b = nx.current_flow_closeness_centrality(G) diff --git a/networkx/algorithms/chordal.py b/networkx/algorithms/chordal.py index 19447486..7c7177af 100644 --- a/networkx/algorithms/chordal.py +++ b/networkx/algorithms/chordal.py @@ -274,7 +274,7 @@ def _is_complete_graph(G): def _find_missing_edge(G): - """ Given a non-complete graph G, returns a missing edge.""" + """Given a non-complete graph G, returns a missing edge.""" nodes = set(G) for u in G: missing = nodes - set(list(G[u].keys()) + [u]) diff --git a/networkx/algorithms/connectivity/edge_augmentation.py b/networkx/algorithms/connectivity/edge_augmentation.py index ff2c44c9..b78cec11 100644 --- a/networkx/algorithms/connectivity/edge_augmentation.py +++ b/networkx/algorithms/connectivity/edge_augmentation.py @@ -334,7 +334,7 @@ def partial_k_edge_augmentation(G, k, avail, weight=None): """ def _edges_between_disjoint(H, only1, only2): - """ finds edges between disjoint nodes """ + """finds edges between disjoint nodes""" only1_adj = {u: set(H.adj[u]) for u in only1} for u, neighbs in only1_adj.items(): # Find the neighbors of u in only1 that are also in only2 diff --git a/networkx/algorithms/connectivity/tests/test_edge_augmentation.py b/networkx/algorithms/connectivity/tests/test_edge_augmentation.py index dfef3635..600ab13e 100644 --- a/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +++ b/networkx/algorithms/connectivity/tests/test_edge_augmentation.py @@ -249,7 +249,7 @@ def test_gnp_augmentation(): def _assert_solution_properties(G, aug_edges, avail_dict=None): - """ Checks that aug_edges are consistently formatted """ + """Checks that aug_edges are consistently formatted""" if avail_dict is not None: assert all( e in avail_dict for e in aug_edges @@ -392,7 +392,7 @@ def _augment_and_check( def _check_augmentations(G, avail=None, max_k=None, weight=None, verbose=False): - """ Helper to check weighted/unweighted cases with multiple values of k """ + """Helper to check weighted/unweighted cases with multiple values of k""" # Using all available edges, find the maximum edge-connectivity try: orig_k = nx.edge_connectivity(G) diff --git a/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py b/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py index f62807a1..08aa3232 100644 --- a/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +++ b/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py @@ -12,7 +12,7 @@ from networkx.algorithms.connectivity.edge_kcomponents import general_k_edge_sub def fset(list_of_sets): - """ allows == to be used for list of sets """ + """allows == to be used for list of sets""" return set(map(frozenset, list_of_sets)) diff --git a/networkx/algorithms/isomorphism/vf2userfunc.py b/networkx/algorithms/isomorphism/vf2userfunc.py index 6cd7bde1..349129ee 100644 --- a/networkx/algorithms/isomorphism/vf2userfunc.py +++ b/networkx/algorithms/isomorphism/vf2userfunc.py @@ -186,12 +186,12 @@ class DiGraphMatcher(vf2.DiGraphMatcher): class MultiGraphMatcher(GraphMatcher): - """VF2 isomorphism checker for undirected multigraphs. """ + """VF2 isomorphism checker for undirected multigraphs.""" pass class MultiDiGraphMatcher(DiGraphMatcher): - """VF2 isomorphism checker for directed multigraphs. """ + """VF2 isomorphism checker for directed multigraphs.""" pass diff --git a/networkx/algorithms/tests/test_simple_paths.py b/networkx/algorithms/tests/test_simple_paths.py index 57e9d82f..aaf9a051 100644 --- a/networkx/algorithms/tests/test_simple_paths.py +++ b/networkx/algorithms/tests/test_simple_paths.py @@ -148,7 +148,7 @@ def test_all_simple_paths_cutoff(): def test_all_simple_paths_on_non_trivial_graph(): - """ you may need to draw this graph to make sure it is reasonable """ + """you may need to draw this graph to make sure it is reasonable""" G = nx.path_graph(5, create_using=nx.DiGraph()) G.add_edges_from([(0, 5), (1, 5), (1, 3), (5, 4), (4, 2), (4, 3)]) paths = nx.all_simple_paths(G, 1, [2, 3]) @@ -334,7 +334,7 @@ def test_all_simple_edge_paths_cutoff(): def test_all_simple_edge_paths_on_non_trivial_graph(): - """ you may need to draw this graph to make sure it is reasonable """ + """you may need to draw this graph to make sure it is reasonable""" G = nx.path_graph(5, create_using=nx.DiGraph()) G.add_edges_from([(0, 5), (1, 5), (1, 3), (5, 4), (4, 2), (4, 3)]) paths = nx.all_simple_edge_paths(G, 1, [2, 3]) diff --git a/networkx/classes/function.py b/networkx/classes/function.py index 1d2f2866..4f44b12e 100644 --- a/networkx/classes/function.py +++ b/networkx/classes/function.py @@ -76,7 +76,7 @@ def degree(G, nbunch=None, weight=None): def neighbors(G, n): - """Returns a list of nodes connected to node n. """ + """Returns a list of nodes connected to node n.""" return G.neighbors(n) @@ -86,7 +86,7 @@ def number_of_nodes(G): def number_of_edges(G): - """Returns the number of edges in the graph. """ + """Returns the number of edges in the graph.""" return G.number_of_edges() @@ -149,7 +149,7 @@ def degree_histogram(G): def is_directed(G): - """ Return True if graph is directed.""" + """Return True if graph is directed.""" return G.is_directed() diff --git a/networkx/classes/tests/test_graph.py b/networkx/classes/tests/test_graph.py index 41de0ce9..476f5e14 100644 --- a/networkx/classes/tests/test_graph.py +++ b/networkx/classes/tests/test_graph.py @@ -13,7 +13,7 @@ import pytest class BaseGraphTester: - """ Tests for data-structure independent graph class features.""" + """Tests for data-structure independent graph class features.""" def test_contains(self): G = self.K3 @@ -160,7 +160,7 @@ class BaseGraphTester: class BaseAttrGraphTester(BaseGraphTester): - """ Tests of graph class attribute features.""" + """Tests of graph class attribute features.""" def test_weighted_degree(self): G = self.Graph() diff --git a/networkx/generators/line.py b/networkx/generators/line.py index 49132eff..55954c74 100644 --- a/networkx/generators/line.py +++ b/networkx/generators/line.py @@ -324,7 +324,7 @@ def inverse_line_graph(G): def _triangles(G, e): - """ Return list of all triangles containing edge e""" + """Return list of all triangles containing edge e""" u, v = e if u not in G: raise nx.NetworkXError(f"Vertex {u} not in graph") diff --git a/networkx/generators/small.py b/networkx/generators/small.py index bcfb741b..a5449c78 100644 --- a/networkx/generators/small.py +++ b/networkx/generators/small.py @@ -181,7 +181,7 @@ def LCF_graph(n, shift_list, repeats, create_using=None): def bull_graph(create_using=None): - """Returns the Bull graph. """ + """Returns the Bull graph.""" description = [ "adjacencylist", "Bull Graph", @@ -239,14 +239,14 @@ def cubical_graph(create_using=None): def desargues_graph(create_using=None): - """ Return the Desargues graph.""" + """Return the Desargues graph.""" G = LCF_graph(20, [5, -5, 9, -9], 5, create_using) G.name = "Desargues Graph" return G def diamond_graph(create_using=None): - """Returns the Diamond graph. """ + """Returns the Diamond graph.""" description = [ "adjacencylist", "Diamond Graph", @@ -258,7 +258,7 @@ def diamond_graph(create_using=None): def dodecahedral_graph(create_using=None): - """ Return the Platonic Dodecahedral graph. """ + """Return the Platonic Dodecahedral graph.""" G = LCF_graph(20, [10, 7, 4, -4, -7, 10, -4, 7, -7, 4], 2, create_using) G.name = "Dodecahedral Graph" return G @@ -293,7 +293,7 @@ def frucht_graph(create_using=None): def heawood_graph(create_using=None): - """ Return the Heawood graph, a (3,6) cage. """ + """Return the Heawood graph, a (3,6) cage.""" G = LCF_graph(14, [5, -5], 7, create_using) G.name = "Heawood Graph" return G @@ -416,7 +416,7 @@ def octahedral_graph(create_using=None): def pappus_graph(): - """ Return the Pappus graph.""" + """Return the Pappus graph.""" G = LCF_graph(18, [5, 7, -7, 7, -7, -5], 3) G.name = "Pappus Graph" return G @@ -464,7 +464,7 @@ def sedgewick_maze_graph(create_using=None): def tetrahedral_graph(create_using=None): - """ Return the 3-regular Platonic Tetrahedral graph.""" + """Return the 3-regular Platonic Tetrahedral graph.""" G = complete_graph(4, create_using) G.name = "Platonic Tetrahedral graph" return G diff --git a/networkx/generators/tests/test_interval_graph.py b/networkx/generators/tests/test_interval_graph.py index ec442b81..0c7b4292 100644 --- a/networkx/generators/tests/test_interval_graph.py +++ b/networkx/generators/tests/test_interval_graph.py @@ -13,11 +13,11 @@ class TestIntervalGraph: """Unit tests for :func:`networkx.generators.interval_graph.interval_graph`""" def test_empty(self): - """ Tests for trivial case of empty input""" + """Tests for trivial case of empty input""" assert len(interval_graph([])) == 0 def test_interval_graph_check_invalid(self): - """ Tests for conditions that raise Exceptions """ + """Tests for conditions that raise Exceptions""" invalids_having_none = [None, (1, 2)] with pytest.raises(TypeError): @@ -92,7 +92,7 @@ class TestIntervalGraph: assert_edges_equal(expected_graph, actual_g) def test_interval_graph_4(self): - """ test all possible overlaps """ + """test all possible overlaps""" intervals = [ (0, 2), (-2, -1), @@ -129,7 +129,7 @@ class TestIntervalGraph: assert set(actual_nbrs) == expected_nbrs def test_interval_graph_5(self): - """ this test is to see that an interval supports infinite number""" + """this test is to see that an interval supports infinite number""" intervals = {(-math.inf, 0), (-1, -1), (0.5, 0.5), (1, 1), (1, math.inf)} expected_graph = nx.Graph() diff --git a/networkx/generators/tests/test_joint_degree_seq.py b/networkx/generators/tests/test_joint_degree_seq.py index dd898d31..346ebefc 100644 --- a/networkx/generators/tests/test_joint_degree_seq.py +++ b/networkx/generators/tests/test_joint_degree_seq.py @@ -10,7 +10,7 @@ from networkx.generators.joint_degree_seq import ( def test_is_valid_joint_degree(): - """ Tests for conditions that invalidate a joint degree dict """ + """Tests for conditions that invalidate a joint degree dict""" # valid joint degree that satisfies all five conditions joint_degrees = { diff --git a/networkx/readwrite/gml.py b/networkx/readwrite/gml.py index 03c7139b..bc3ef710 100644 --- a/networkx/readwrite/gml.py +++ b/networkx/readwrite/gml.py @@ -260,7 +260,7 @@ def parse_gml(lines, label="label", destringizer=None): class Pattern(Enum): - """ encodes the index of each token-matching pattern in `tokenize`. """ + """encodes the index of each token-matching pattern in `tokenize`.""" KEYS = 0 REALS = 1 diff --git a/networkx/readwrite/graphml.py b/networkx/readwrite/graphml.py index cd8fcbc1..1ecaebdd 100644 --- a/networkx/readwrite/graphml.py +++ b/networkx/readwrite/graphml.py @@ -588,7 +588,7 @@ class GraphMLWriter(GraphML): self.xml.append(graph_element) def add_graphs(self, graph_list): - """ Add many graphs to this GraphML document. """ + """Add many graphs to this GraphML document.""" for G in graph_list: self.add_graph_element(G) diff --git a/networkx/utils/misc.py b/networkx/utils/misc.py index bd58a4ed..2df5f48b 100644 --- a/networkx/utils/misc.py +++ b/networkx/utils/misc.py @@ -96,7 +96,7 @@ def empty_generator(): def flatten(obj, result=None): - """ Return flattened version of (possibly nested) iterable object. """ + """Return flattened version of (possibly nested) iterable object.""" if not isinstance(obj, (Iterable, Sized)) or isinstance(obj, str): return obj if result is None: |