Skip to content

Commit 057c01d

Browse files
committed
Apply pycodestyles autofixes
1 parent c7c8e26 commit 057c01d

File tree

747 files changed

+126
-2158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

747 files changed

+126
-2158
lines changed

pyproject.toml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,36 @@ line-length = 130
2727
target-version = "py39"
2828

2929
[tool.ruff.lint]
30-
select = [
30+
extend-select = [
31+
"FA", # flake8-future-annotations
3132
"I", # isort
33+
"W", # pycodestyle Warning
34+
]
35+
ignore= [
36+
###
37+
# Rules we don't want or don't agree with
38+
###
39+
# Used for direct, non-subclass type comparison, for example: `type(val) is str`
40+
# see https://github.com/astral-sh/ruff/issues/6465
41+
"E721", # Do not compare types, use `isinstance()`
42+
43+
# TODO: Investigate and fix or configure
44+
"E402",
45+
"E722",
46+
"E743",
47+
"F811",
48+
"F822",
49+
"F841",
50+
"F842",
51+
]
52+
[tool.ruff.lint.per-file-ignores]
53+
"*.pyi" = [
54+
# Rules that are out of the control of stub authors:
55+
"E741", # ambiguous variable name
56+
"F403", # `from . import *` used; unable to detect undefined names
57+
# Stubs can sometimes re-export entire modules.
58+
# Issues with using a star-imported name will be caught by type-checkers.
59+
"F405", # may be undefined, or defined from star imports
3260
]
3361

3462
[tool.ruff.lint.isort]

stubs/matplotlib/__init__.pyi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import contextlib
22
from typing import Generator, Literal
33

4-
import numpy as np
5-
from packaging.version import parse as parse_version
6-
7-
from . import _docstring, _version, cbook, colors as colors, rcsetup
4+
from . import colors as colors
85
from ._typing import *
96

107
class __getattr__:

stubs/matplotlib/_afm.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy as np
21

32
from ._typing import *
43

stubs/matplotlib/_api/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import functools
2-
from typing import Any, Callable, Generator, Iterable, Type
2+
from typing import Callable, Generator, Iterable, Type
33

44
from .deprecation import MatplotlibDeprecationWarning
55

stubs/matplotlib/_mathtext.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import enum
22
import functools
3-
from sre_parse import State
43
from tkinter.tix import HList
54
from typing import Literal
65

stubs/matplotlib/_pylab_helpers.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, List, OrderedDict
1+
from typing import OrderedDict
22

33
from .backend_bases import FigureManagerBase
44
from .figure import Figure

stubs/matplotlib/animation.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import abc
22
import contextlib
33
from itertools import count
4-
from typing import Callable, Generator, Iterable, Iterator, List
5-
6-
from matplotlib.backend_bases import NonGuiException
4+
from typing import Callable, Generator, Iterable, Iterator
75

86
from .figure import Figure
97

stubs/matplotlib/axes/_axes.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import datetime
2-
from re import L
32
from typing import Callable, Literal, Sequence, overload
43

54
import matplotlib.tri as mtri

stubs/matplotlib/axes/_secondary_axes.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Callable, Literal
22

3-
import numpy as np
43
from matplotlib._typing import *
54
from matplotlib.axes._base import _AxesBase
65
from matplotlib.transforms import Transform

stubs/matplotlib/axis.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import datetime
2-
from datetime import timezone
32
from typing import Any, Callable, Literal, Type
43

54
import numpy as np

stubs/matplotlib/backends/backend_agg.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import threading
22
from io import BufferedWriter, BytesIO
3-
from typing import Any, Tuple
3+
from typing import Any
44

55
import numpy as np
66
from matplotlib._typing import *

stubs/matplotlib/backends/backend_pdf.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from enum import Enum
22
from functools import total_ordering
33
from io import BytesIO
4-
from typing import Any, Callable, Optional, Set
4+
from typing import Any, Optional, Set
55

66
import numpy as np
77
from matplotlib._enums import CapStyle, JoinStyle

stubs/matplotlib/backends/backend_pgf.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from typing import Any, Callable
22

3-
import numpy as np
4-
from matplotlib import _api
53
from matplotlib._typing import *
64
from matplotlib.backend_bases import FigureCanvasBase, FigureManagerBase, GraphicsContextBase, RendererBase, _Backend
75
from matplotlib.figure import Figure

stubs/matplotlib/category.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Iterable
1+
from typing import Iterable
22

33
import numpy as np
44

stubs/matplotlib/collections.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from tkinter.messagebox import NO
21
from typing import Callable, Literal, Sequence
32

43
import numpy as np

stubs/matplotlib/figure.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import numpy as np
55
from mpl_toolkits.mplot3d import Axes3D
66

77
from ._typing import *
8-
from .artist import Artist, _finalize_rasterization, allow_rasterization
8+
from .artist import Artist, allow_rasterization
99
from .axes import Axes
1010
from .backend_bases import FigureCanvasBase, MouseButton, MouseEvent, RendererBase
1111
from .colorbar import Colorbar

stubs/matplotlib/offsetbox.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Callable, Literal, Sequence
1+
from typing import Callable, Literal, Sequence
22

33
from ._typing import *
44
from .artist import Artist

stubs/matplotlib/pyplot.pyi

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import datetime
2-
from array import array
32
from typing import Callable, ContextManager, Literal, Sequence, overload
43

5-
import matplotlib
6-
import matplotlib.image
74
import numpy as np
85
from matplotlib import rcParams as rcParams, style as style
96
from matplotlib.contour import QuadContourSet
107

11-
from . import rcParams
128
from ._typing import *
139
from .artist import Artist
1410
from .axes import Axes as Axes
15-
from .backend_bases import FigureCanvasBase, FigureManagerBase, MouseButton, _Backend
11+
from .backend_bases import FigureManagerBase, MouseButton, _Backend
1612
from .collections import BrokenBarHCollection, Collection, LineCollection, PathCollection, PolyCollection, QuadMesh
1713
from .colors import Colormap, Normalize
1814
from .container import BarContainer, ErrorbarContainer, StemContainer
@@ -23,7 +19,6 @@ from .lines import Line2D
2319
from .markers import MarkerStyle
2420
from .patches import FancyArrow, Polygon
2521
from .quiver import Quiver
26-
from .rcsetup import interactive_bk as _interactive_bk
2722
from .scale import ScaleBase
2823
from .streamplot import StreamplotSet
2924
from .table import Table

stubs/matplotlib/quiver.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from typing import Literal
33
from ._typing import *
44
from .artist import Artist, allow_rasterization
55
from .axes import Axes
6-
from .backend_bases import Event, MouseEvent, RendererBase
6+
from .backend_bases import MouseEvent, RendererBase
77
from .collections import PolyCollection
88
from .figure import Figure
99

stubs/matplotlib/scale.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Callable, Literal, Sequence
1+
from typing import Callable, Literal, Sequence
22

33
from ._typing import *
44
from .axis import Axis

stubs/matplotlib/spines.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from typing import Sequence
66
from ._typing import *
77
from .artist import allow_rasterization
88
from .axes import Axes
9-
from .axis import Axis, XAxis, YAxis
9+
from .axis import Axis
1010
from .backend_bases import RendererBase
1111
from .patches import Patch
1212
from .path import Path

stubs/matplotlib/ticker.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from functools import partial
2-
from typing import Any, Callable, Literal, Sequence
2+
from typing import Callable, Literal, Sequence
33

44
from ._typing import *
55
from .axis import Axis

stubs/matplotlib/widgets.pyi

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
import copy
2-
from contextlib import ExitStack
3-
from numbers import Integral, Number
4-
from typing import Any, Callable, Dict, List, Literal, Mapping, Optional, Sequence, Tuple, Union
1+
from typing import Callable, Literal, Mapping, Sequence
52

6-
import matplotlib as mpl
73
import numpy as np
84
from matplotlib.axes._axes import Axes
95
from matplotlib.backend_bases import DrawEvent, Event, FigureCanvasBase, KeyEvent, MouseButton, MouseEvent
106
from matplotlib.figure import Figure
117
from matplotlib.lines import Line2D
12-
from matplotlib.patches import Ellipse, Rectangle
13-
from matplotlib.transforms import Affine2D
14-
from numpy import float64, ndarray
8+
from numpy import ndarray
159
from numpy.typing import ArrayLike
1610
from PIL.Image import Image
1711

1812
from ._typing import Color
1913
from .artist import Artist
2014
from .lines import Line2D
21-
from .patches import Circle, Ellipse, Polygon, Rectangle
15+
from .patches import Circle
2216
from .text import Text
23-
from .transforms import Affine2D, TransformedPatchPath
2417

2518
class LockDraw:
2619
def __init__(self) -> None: ...

stubs/networkx/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,3 @@ from .generators import *
6363
from .linalg import *
6464
from .readwrite import *
6565
from .relabel import convert_node_labels_to_integers as convert_node_labels_to_integers, relabel_nodes as relabel_nodes
66-
from .testing.test import run as test

stubs/networkx/algorithms/approximation/clique.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from ...classes.graph import Graph
2-
from ...utils import not_implemented_for
32

43
__all__ = [
54
"clique_removal",

stubs/networkx/algorithms/approximation/clustering_coefficient.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from ...classes.graph import Graph
2-
from ...utils import not_implemented_for, py_random_state
2+
from ...utils import py_random_state
33

44
__all__ = ["average_clustering"]
55

stubs/networkx/algorithms/approximation/connectivity.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import itertools
2-
from operator import itemgetter
31
from typing import Mapping
42

53
from ...classes.graph import Graph

stubs/networkx/algorithms/approximation/dominating_set.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
from ...classes.graph import Graph
2-
from ...utils import not_implemented_for
3-
from ..matching import maximal_matching
42

53
__all__ = ["min_weighted_dominating_set", "min_edge_dominating_set"]
64

stubs/networkx/algorithms/approximation/kcomponents.pyi

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import itertools
2-
from collections import defaultdict
31
from collections.abc import Mapping
42
from functools import cached_property
53
from typing import Mapping
64

75
from ...classes.graph import Graph
8-
from ...exception import NetworkXError
9-
from ...utils import not_implemented_for
10-
from . import local_node_connectivity
116

127
__all__ = ["k_components"]
138

stubs/networkx/algorithms/approximation/maxcut.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from typing import Any
22

33
from ..._typing import Scalar
44
from ...classes.graph import Graph
5-
from ...utils.decorators import not_implemented_for, py_random_state
5+
from ...utils.decorators import py_random_state
66

77
__all__ = ["randomized_partitioning", "one_exchange"]
88

stubs/networkx/algorithms/approximation/ramsey.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from ...classes.graph import Graph
2-
from ...utils import arbitrary_element, not_implemented_for
32

43
__all__ = ["ramsey_R2"]
54

stubs/networkx/algorithms/approximation/steinertree.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
from itertools import chain
21

32
from numpy.typing import ArrayLike
43

54
from ...classes.graph import Graph
6-
from ...utils import not_implemented_for, pairwise
75

86
__all__ = ["metric_closure", "steiner_tree"]
97

stubs/networkx/algorithms/approximation/traveling_salesman.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import math
21
from typing import Literal, Mapping
32

43
from numpy.typing import ArrayLike
54

6-
from ...algorithms.tree.mst import random_spanning_tree
75
from ...classes.graph import Graph
8-
from ...utils import not_implemented_for, pairwise, py_random_state
6+
from ...utils import py_random_state
97

108
__all__ = [
119
"traveling_salesman_problem",

stubs/networkx/algorithms/approximation/treewidth.pyi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import itertools
2-
import sys
3-
from heapq import heapify, heappop, heappush
41

52
from ...classes.graph import Graph
6-
from ...utils import not_implemented_for
73

84
__all__ = ["treewidth_min_degree", "treewidth_min_fill_in"]
95

stubs/networkx/algorithms/assortativity/connectivity.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from collections import defaultdict
21
from typing import Literal, Mapping
32

43
from ...classes.graph import Graph

stubs/networkx/algorithms/assortativity/correlation.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
from ...classes.graph import Graph
2-
from .mixing import attribute_mixing_matrix, degree_mixing_matrix
3-
from .pairs import node_degree_xy
42

53
__all__ = [
64
"degree_pearson_correlation_coefficient",

stubs/networkx/algorithms/assortativity/mixing.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from typing import Mapping
22

33
from ...classes.graph import Graph
4-
from ...utils import dict_to_numpy_array
5-
from .pairs import node_attribute_xy, node_degree_xy
64

75
__all__ = [
86
"attribute_mixing_matrix",

stubs/networkx/algorithms/asteroidal.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import Mapping
22

33
from ..classes.graph import Graph
4-
from ..utils import not_implemented_for
54

65
__all__ = ["is_at_free", "find_asteroidal_triple"]
76

stubs/networkx/algorithms/bipartite/basic.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from typing import Mapping
22

3-
from ...algorithms.components import connected_components
43
from ...classes.graph import Graph
5-
from ...exception import AmbiguousSolution
64

75
__all__ = [
86
"is_bipartite",

stubs/networkx/algorithms/bipartite/cluster.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import itertools
21
from collections.abc import Iterable
32
from typing import Mapping
43

stubs/networkx/algorithms/bipartite/covering.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from ...algorithms.covering import min_edge_cover as _min_edge_cover
21
from ...classes.graph import Graph
3-
from ...utils import not_implemented_for
4-
from .matching import hopcroft_karp_matching
52

63
__all__ = ["min_edge_cover"]
74

stubs/networkx/algorithms/bipartite/edgelist.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ from ...classes.graph import Graph
44

55
__all__ = ["generate_edgelist", "write_edgelist", "parse_edgelist", "read_edgelist"]
66

7-
from ...utils import not_implemented_for, open_file
87

98
def write_edgelist(
109
G: Graph,

0 commit comments

Comments
 (0)