[PATCH 0/3] Fix deprecation warnings
These commits resolve various warnings that appear when the environment variable PYTHONWARNINGS is set to "default" or "error". Since the ability to submit pull requests through git.skewed.de has apparently been disabled, I am sending the patches to the mailing list for your consideration. Please let me know if there is a different preferred way to submit patches now (e.g. by attaching them to a bug report). -Alex Alex Henrie (3): Turn off escape sequences in docstrings Use inspect.getfullargspec instead of inspect.getarcspec Use collections.abc.Iterable instead of collections.Iterable src/graph_tool/__init__.py | 8 ++++---- src/graph_tool/decorators.py | 2 +- src/graph_tool/inference/minimize.py | 6 +++--- src/graph_tool/inference/nested_blockmodel.py | 2 +- src/graph_tool/topology/__init__.py | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) -- 2.26.0
--- src/graph_tool/inference/minimize.py | 6 +++--- src/graph_tool/inference/nested_blockmodel.py | 2 +- src/graph_tool/topology/__init__.py | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/graph_tool/inference/minimize.py b/src/graph_tool/inference/minimize.py index fbca5ede..13bfca42 100644 --- a/src/graph_tool/inference/minimize.py +++ b/src/graph_tool/inference/minimize.py @@ -119,7 +119,7 @@ def minimize_blockmodel_dl(g, B_min=None, B_max=None, b_min=None, b_max=None, mcmc_args={}, anneal_args={}, mcmc_equilibrate_args={}, shrink_args={}, mcmc_multilevel_args={}, verbose=False): - """Fit the stochastic block model, by minimizing its description length using an + r"""Fit the stochastic block model, by minimizing its description length using an agglomerative heuristic. Parameters @@ -286,7 +286,7 @@ def minimize_nested_blockmodel_dl(g, B_min=None, B_max=None, b_min=None, mcmc_args={}, anneal_args={}, mcmc_equilibrate_args={}, shrink_args={}, mcmc_multilevel_args={}, verbose=False): - """Fit the nested stochastic block model, by minimizing its description length + r"""Fit the nested stochastic block model, by minimizing its description length using an agglomerative heuristic. Parameters @@ -479,4 +479,4 @@ def minimize_nested_blockmodel_dl(g, B_min=None, B_max=None, b_min=None, **dmask(hierarchy_minimize_args, ["B_max", "B_min", "bisection_args", "verbose"])) - return state \ No newline at end of file + return state diff --git a/src/graph_tool/inference/nested_blockmodel.py b/src/graph_tool/inference/nested_blockmodel.py index dd6525db..7a831f33 100644 --- a/src/graph_tool/inference/nested_blockmodel.py +++ b/src/graph_tool/inference/nested_blockmodel.py @@ -999,7 +999,7 @@ class NestedBlockState(object): def hierarchy_minimize(state, B_min=None, B_max=None, b_min=None, b_max=None, frozen_levels=None, bisection_args={}, epsilon=1e-8, verbose=False): - """Attempt to find a fit of the nested stochastic block model that minimizes the + r"""Attempt to find a fit of the nested stochastic block model that minimizes the description length. Parameters diff --git a/src/graph_tool/topology/__init__.py b/src/graph_tool/topology/__init__.py index 87ea69a3..16b0b2cd 100644 --- a/src/graph_tool/topology/__init__.py +++ b/src/graph_tool/topology/__init__.py @@ -849,7 +849,7 @@ def max_cliques(g): yield c def min_spanning_tree(g, weights=None, root=None, tree_map=None): - """ + r""" Return the minimum spanning tree of a given graph. Parameters @@ -1043,7 +1043,7 @@ def random_spanning_tree(g, weights=None, root=None, tree_map=None): def dominator_tree(g, root, dom_map=None): - """Return a vertex property map the dominator vertices for each vertex. + r"""Return a vertex property map the dominator vertices for each vertex. Parameters ---------- @@ -1777,7 +1777,7 @@ def shortest_distance(g, source=None, target=None, weights=None, negative_weights=False, max_dist=None, directed=None, dense=False, dist_map=None, pred_map=False, return_reached=False, dag=False): - """Calculate the distance from a source to a target vertex, or to of all + r"""Calculate the distance from a source to a target vertex, or to of all vertices from a given source, or the all pairs shortest paths, if the source is not specified. @@ -2034,7 +2034,7 @@ def shortest_distance(g, source=None, target=None, weights=None, def shortest_path(g, source, target, weights=None, negative_weights=False, pred_map=None, dag=False): - """Return the shortest path from ``source`` to ``target``. + r"""Return the shortest path from ``source`` to ``target``. Parameters ---------- @@ -2552,7 +2552,7 @@ def all_circuits(g, unique=False): def pseudo_diameter(g, source=None, weights=None): - """ + r""" Compute the pseudo-diameter of the graph. Parameters @@ -3180,7 +3180,7 @@ def edge_reciprocity(g): def tsp_tour(g, src, weight=None): - """Return a traveling salesman tour of the graph, which is guaranteed to be + r"""Return a traveling salesman tour of the graph, which is guaranteed to be twice as long as the optimal tour in the worst case. Parameters @@ -3277,4 +3277,4 @@ def sequential_vertex_coloring(g, order=None, color=None): return color -from .. flow import libgraph_tool_flow \ No newline at end of file +from .. flow import libgraph_tool_flow -- 2.26.0
--- src/graph_tool/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graph_tool/decorators.py b/src/graph_tool/decorators.py index 651fe9e5..02a768d2 100644 --- a/src/graph_tool/decorators.py +++ b/src/graph_tool/decorators.py @@ -52,7 +52,7 @@ else: also preserves the function's argument signature. This uses eval, and is thus a bit of a hack, but there no better way I know of to do this.""" def decorate(f): - argspec = inspect.getargspec(func) + argspec = inspect.getfullargspec(func) ___wrap_defaults = defaults = argspec[-1] if defaults is not None: def_string = ["___wrap_defaults[%d]" % d for -- 2.26.0
--- src/graph_tool/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/graph_tool/__init__.py b/src/graph_tool/__init__.py index 1563ad2b..46b9e1d0 100644 --- a/src/graph_tool/__init__.py +++ b/src/graph_tool/__init__.py @@ -129,7 +129,7 @@ import weakref import copy import textwrap import io -import collections +import collections.abc import itertools import csv @@ -2356,7 +2356,7 @@ class Graph(object): """ back = self.__graph.get_num_vertices(False) - 1 - is_iter = isinstance(vertex, collections.Iterable) + is_iter = isinstance(vertex, collections.abc.Iterable) if is_iter: try: vs = numpy.asarray(vertex, dtype="int64") @@ -3496,7 +3496,7 @@ class GraphView(Graph): if efilt is not None: if not isinstance(efilt, PropertyMap): emap = self.new_edge_property("bool") - if isinstance(efilt, collections.Iterable): + if isinstance(efilt, collections.abc.Iterable): emap.fa = efilt else: for e in g.edges(): @@ -3516,7 +3516,7 @@ class GraphView(Graph): if vfilt is not None: if not isinstance(vfilt, PropertyMap): vmap = self.new_vertex_property("bool") - if isinstance(vfilt, collections.Iterable): + if isinstance(vfilt, collections.abc.Iterable): vmap.fa = vfilt else: for v in g.vertices(): -- 2.26.0
Hi Alex, I have given you permission to clone a repository, so you should be able to submit a merge request in the usual way. I had to disable this functionality by default to prevent spam accounts from cloning the repository and wasting a lot of disk space. I'm trying to find a better solution than to simply disable cloning. Best, Tiago Am 01.04.20 um 20:23 schrieb Alex Henrie:
These commits resolve various warnings that appear when the environment variable PYTHONWARNINGS is set to "default" or "error". Since the ability to submit pull requests through git.skewed.de has apparently been disabled, I am sending the patches to the mailing list for your consideration. Please let me know if there is a different preferred way to submit patches now (e.g. by attaching them to a bug report).
-- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
Alex Henrie -
Tiago de Paula Peixoto