Skip to content

Commit

Permalink
Apply pycodestyles autofixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Nov 10, 2024
1 parent c7c8e26 commit 057c01d
Show file tree
Hide file tree
Showing 747 changed files with 126 additions and 2,158 deletions.
30 changes: 29 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,36 @@ line-length = 130
target-version = "py39"

[tool.ruff.lint]
select = [
extend-select = [
"FA", # flake8-future-annotations
"I", # isort
"W", # pycodestyle Warning
]
ignore= [
###
# Rules we don't want or don't agree with
###
# Used for direct, non-subclass type comparison, for example: `type(val) is str`
# see https://github.com/astral-sh/ruff/issues/6465
"E721", # Do not compare types, use `isinstance()`

# TODO: Investigate and fix or configure
"E402",
"E722",
"E743",
"F811",
"F822",
"F841",
"F842",
]
[tool.ruff.lint.per-file-ignores]
"*.pyi" = [
# Rules that are out of the control of stub authors:
"E741", # ambiguous variable name
"F403", # `from . import *` used; unable to detect undefined names
# Stubs can sometimes re-export entire modules.
# Issues with using a star-imported name will be caught by type-checkers.
"F405", # may be undefined, or defined from star imports
]

[tool.ruff.lint.isort]
Expand Down
5 changes: 1 addition & 4 deletions stubs/matplotlib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import contextlib
from typing import Generator, Literal

import numpy as np
from packaging.version import parse as parse_version

from . import _docstring, _version, cbook, colors as colors, rcsetup
from . import colors as colors
from ._typing import *

class __getattr__:
Expand Down
1 change: 0 additions & 1 deletion stubs/matplotlib/_afm.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import numpy as np

from ._typing import *

Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/_api/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import functools
from typing import Any, Callable, Generator, Iterable, Type
from typing import Callable, Generator, Iterable, Type

from .deprecation import MatplotlibDeprecationWarning

Expand Down
1 change: 0 additions & 1 deletion stubs/matplotlib/_mathtext.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import enum
import functools
from sre_parse import State
from tkinter.tix import HList
from typing import Literal

Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/_pylab_helpers.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, OrderedDict
from typing import OrderedDict

from .backend_bases import FigureManagerBase
from .figure import Figure
Expand Down
4 changes: 1 addition & 3 deletions stubs/matplotlib/animation.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import abc
import contextlib
from itertools import count
from typing import Callable, Generator, Iterable, Iterator, List

from matplotlib.backend_bases import NonGuiException
from typing import Callable, Generator, Iterable, Iterator

from .figure import Figure

Expand Down
1 change: 0 additions & 1 deletion stubs/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import datetime
from re import L
from typing import Callable, Literal, Sequence, overload

import matplotlib.tri as mtri
Expand Down
1 change: 0 additions & 1 deletion stubs/matplotlib/axes/_secondary_axes.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Callable, Literal

import numpy as np
from matplotlib._typing import *
from matplotlib.axes._base import _AxesBase
from matplotlib.transforms import Transform
Expand Down
1 change: 0 additions & 1 deletion stubs/matplotlib/axis.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import datetime
from datetime import timezone
from typing import Any, Callable, Literal, Type

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/backends/backend_agg.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import threading
from io import BufferedWriter, BytesIO
from typing import Any, Tuple
from typing import Any

import numpy as np
from matplotlib._typing import *
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/backends/backend_pdf.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import Enum
from functools import total_ordering
from io import BytesIO
from typing import Any, Callable, Optional, Set
from typing import Any, Optional, Set

import numpy as np
from matplotlib._enums import CapStyle, JoinStyle
Expand Down
2 changes: 0 additions & 2 deletions stubs/matplotlib/backends/backend_pgf.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Any, Callable

import numpy as np
from matplotlib import _api
from matplotlib._typing import *
from matplotlib.backend_bases import FigureCanvasBase, FigureManagerBase, GraphicsContextBase, RendererBase, _Backend
from matplotlib.figure import Figure
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/category.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Iterable
from typing import Iterable

import numpy as np

Expand Down
1 change: 0 additions & 1 deletion stubs/matplotlib/collections.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from tkinter.messagebox import NO
from typing import Callable, Literal, Sequence

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/figure.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import numpy as np
from mpl_toolkits.mplot3d import Axes3D

from ._typing import *
from .artist import Artist, _finalize_rasterization, allow_rasterization
from .artist import Artist, allow_rasterization
from .axes import Axes
from .backend_bases import FigureCanvasBase, MouseButton, MouseEvent, RendererBase
from .colorbar import Colorbar
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/offsetbox.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Literal, Sequence
from typing import Callable, Literal, Sequence

from ._typing import *
from .artist import Artist
Expand Down
7 changes: 1 addition & 6 deletions stubs/matplotlib/pyplot.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import datetime
from array import array
from typing import Callable, ContextManager, Literal, Sequence, overload

import matplotlib
import matplotlib.image
import numpy as np
from matplotlib import rcParams as rcParams, style as style
from matplotlib.contour import QuadContourSet

from . import rcParams
from ._typing import *
from .artist import Artist
from .axes import Axes as Axes
from .backend_bases import FigureCanvasBase, FigureManagerBase, MouseButton, _Backend
from .backend_bases import FigureManagerBase, MouseButton, _Backend
from .collections import BrokenBarHCollection, Collection, LineCollection, PathCollection, PolyCollection, QuadMesh
from .colors import Colormap, Normalize
from .container import BarContainer, ErrorbarContainer, StemContainer
Expand All @@ -23,7 +19,6 @@ from .lines import Line2D
from .markers import MarkerStyle
from .patches import FancyArrow, Polygon
from .quiver import Quiver
from .rcsetup import interactive_bk as _interactive_bk
from .scale import ScaleBase
from .streamplot import StreamplotSet
from .table import Table
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/quiver.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from typing import Literal
from ._typing import *
from .artist import Artist, allow_rasterization
from .axes import Axes
from .backend_bases import Event, MouseEvent, RendererBase
from .backend_bases import MouseEvent, RendererBase
from .collections import PolyCollection
from .figure import Figure

Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/scale.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Literal, Sequence
from typing import Callable, Literal, Sequence

from ._typing import *
from .axis import Axis
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/spines.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from typing import Sequence
from ._typing import *
from .artist import allow_rasterization
from .axes import Axes
from .axis import Axis, XAxis, YAxis
from .axis import Axis
from .backend_bases import RendererBase
from .patches import Patch
from .path import Path
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/ticker.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from functools import partial
from typing import Any, Callable, Literal, Sequence
from typing import Callable, Literal, Sequence

from ._typing import *
from .axis import Axis
Expand Down
13 changes: 3 additions & 10 deletions stubs/matplotlib/widgets.pyi
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
import copy
from contextlib import ExitStack
from numbers import Integral, Number
from typing import Any, Callable, Dict, List, Literal, Mapping, Optional, Sequence, Tuple, Union
from typing import Callable, Literal, Mapping, Sequence

import matplotlib as mpl
import numpy as np
from matplotlib.axes._axes import Axes
from matplotlib.backend_bases import DrawEvent, Event, FigureCanvasBase, KeyEvent, MouseButton, MouseEvent
from matplotlib.figure import Figure
from matplotlib.lines import Line2D
from matplotlib.patches import Ellipse, Rectangle
from matplotlib.transforms import Affine2D
from numpy import float64, ndarray
from numpy import ndarray
from numpy.typing import ArrayLike
from PIL.Image import Image

from ._typing import Color
from .artist import Artist
from .lines import Line2D
from .patches import Circle, Ellipse, Polygon, Rectangle
from .patches import Circle
from .text import Text
from .transforms import Affine2D, TransformedPatchPath

class LockDraw:
def __init__(self) -> None: ...
Expand Down
1 change: 0 additions & 1 deletion stubs/networkx/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ from .generators import *
from .linalg import *
from .readwrite import *
from .relabel import convert_node_labels_to_integers as convert_node_labels_to_integers, relabel_nodes as relabel_nodes
from .testing.test import run as test
1 change: 0 additions & 1 deletion stubs/networkx/algorithms/approximation/clique.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ...classes.graph import Graph
from ...utils import not_implemented_for

__all__ = [
"clique_removal",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ...classes.graph import Graph
from ...utils import not_implemented_for, py_random_state
from ...utils import py_random_state

__all__ = ["average_clustering"]

Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/algorithms/approximation/connectivity.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import itertools
from operator import itemgetter
from typing import Mapping

from ...classes.graph import Graph
Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/algorithms/approximation/dominating_set.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from ...classes.graph import Graph
from ...utils import not_implemented_for
from ..matching import maximal_matching

__all__ = ["min_weighted_dominating_set", "min_edge_dominating_set"]

Expand Down
5 changes: 0 additions & 5 deletions stubs/networkx/algorithms/approximation/kcomponents.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import itertools
from collections import defaultdict
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...classes.graph import Graph
from ...exception import NetworkXError
from ...utils import not_implemented_for
from . import local_node_connectivity

__all__ = ["k_components"]

Expand Down
2 changes: 1 addition & 1 deletion stubs/networkx/algorithms/approximation/maxcut.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from typing import Any

from ..._typing import Scalar
from ...classes.graph import Graph
from ...utils.decorators import not_implemented_for, py_random_state
from ...utils.decorators import py_random_state

__all__ = ["randomized_partitioning", "one_exchange"]

Expand Down
1 change: 0 additions & 1 deletion stubs/networkx/algorithms/approximation/ramsey.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ...classes.graph import Graph
from ...utils import arbitrary_element, not_implemented_for

__all__ = ["ramsey_R2"]

Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/algorithms/approximation/steinertree.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from itertools import chain

from numpy.typing import ArrayLike

from ...classes.graph import Graph
from ...utils import not_implemented_for, pairwise

__all__ = ["metric_closure", "steiner_tree"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import math
from typing import Literal, Mapping

from numpy.typing import ArrayLike

from ...algorithms.tree.mst import random_spanning_tree
from ...classes.graph import Graph
from ...utils import not_implemented_for, pairwise, py_random_state
from ...utils import py_random_state

__all__ = [
"traveling_salesman_problem",
Expand Down
4 changes: 0 additions & 4 deletions stubs/networkx/algorithms/approximation/treewidth.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import itertools
import sys
from heapq import heapify, heappop, heappush

from ...classes.graph import Graph
from ...utils import not_implemented_for

__all__ = ["treewidth_min_degree", "treewidth_min_fill_in"]

Expand Down
1 change: 0 additions & 1 deletion stubs/networkx/algorithms/assortativity/connectivity.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from collections import defaultdict
from typing import Literal, Mapping

from ...classes.graph import Graph
Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/algorithms/assortativity/correlation.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from ...classes.graph import Graph
from .mixing import attribute_mixing_matrix, degree_mixing_matrix
from .pairs import node_degree_xy

__all__ = [
"degree_pearson_correlation_coefficient",
Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/algorithms/assortativity/mixing.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing import Mapping

from ...classes.graph import Graph
from ...utils import dict_to_numpy_array
from .pairs import node_attribute_xy, node_degree_xy

__all__ = [
"attribute_mixing_matrix",
Expand Down
1 change: 0 additions & 1 deletion stubs/networkx/algorithms/asteroidal.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Mapping

from ..classes.graph import Graph
from ..utils import not_implemented_for

__all__ = ["is_at_free", "find_asteroidal_triple"]

Expand Down
2 changes: 0 additions & 2 deletions stubs/networkx/algorithms/bipartite/basic.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing import Mapping

from ...algorithms.components import connected_components
from ...classes.graph import Graph
from ...exception import AmbiguousSolution

__all__ = [
"is_bipartite",
Expand Down
1 change: 0 additions & 1 deletion stubs/networkx/algorithms/bipartite/cluster.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import itertools
from collections.abc import Iterable
from typing import Mapping

Expand Down
3 changes: 0 additions & 3 deletions stubs/networkx/algorithms/bipartite/covering.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from ...algorithms.covering import min_edge_cover as _min_edge_cover
from ...classes.graph import Graph
from ...utils import not_implemented_for
from .matching import hopcroft_karp_matching

__all__ = ["min_edge_cover"]

Expand Down
1 change: 0 additions & 1 deletion stubs/networkx/algorithms/bipartite/edgelist.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ from ...classes.graph import Graph

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

from ...utils import not_implemented_for, open_file

def write_edgelist(
G: Graph,
Expand Down
Loading

0 comments on commit 057c01d

Please sign in to comment.