Skip to content

Commit 458264b

Browse files
Avasamdebonte
andauthored
Run isort & black, automaticly check in CI (#302)
* Run isort & black * Automate on CI * Address PR comments * PR comments * Keep scripts untouched * Create extensions.json * Black 2024 style * isort on sympy-stubs * black on sympy-stubs --------- Co-authored-by: Erik De Bonte <[email protected]>
1 parent 2651abf commit 458264b

File tree

1,500 files changed

+31348
-53417
lines changed

Some content is hidden

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

1,500 files changed

+31348
-53417
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@ jobs:
3333
with:
3434
project: tests/pyrighttestconfig.json
3535
warn-partial: true
36+
37+
hygiene:
38+
runs-on: ubuntu-latest
39+
timeout-minutes: 10
40+
41+
steps:
42+
- name: Check out code
43+
uses: actions/checkout@v2
44+
45+
- name: Run isort
46+
uses: isort/isort-action@v1
47+
48+
- name: Run Black
49+
uses: psf/black@stable
50+
with:
51+
options: "--check --verbose"

.vscode/extensions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"ms-python.black-formatter",
6+
"ms-python.isort",
7+
"ms-python.mypy-type-checker",
8+
"ms-python.python",
9+
"ms-python.vscode-pylance",
10+
]
11+
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ strict_equality = true
8585
# Configuring error messages
8686
show_error_context = false
8787
show_column_numbers = false
88-
show_error_codes = true
88+
show_error_codes = true

stubs/matplotlib/__init__.pyi

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
1-
import numpy as np
2-
from typing import Generator, Literal
3-
from ._typing import *
41
import contextlib
2+
from typing import Generator, Literal
3+
4+
import numpy as np
55
from packaging.version import parse as parse_version
6-
from . import _docstring, _version, cbook, rcsetup
7-
from . import colors as colors
86

9-
class __getattr__:
7+
from . import _docstring, _version, cbook, colors as colors, rcsetup
8+
from ._typing import *
109

10+
class __getattr__:
1111
URL_REGEX = ...
1212

13-
def set_loglevel(
14-
level: Literal["notset", "debug", "info", "warning", "error", "critical"]
15-
)-> None: ...
13+
def set_loglevel(level: Literal["notset", "debug", "info", "warning", "error", "critical"]) -> None: ...
1614

17-
class ExecutableNotFoundError(FileNotFoundError):
18-
...
15+
class ExecutableNotFoundError(FileNotFoundError): ...
1916

20-
def checkdep_usetex(s)-> bool: ...
17+
def checkdep_usetex(s) -> bool: ...
2118
def get_configdir() -> str: ...
2219
def get_cachedir() -> str: ...
2320
def get_data_path() -> str: ...
2421
def matplotlib_fname() -> str: ...
2522

2623
class RcParams(dict):
27-
2824
validate = ...
2925
def __init__(self, *args, **kwargs) -> None: ...
30-
def find_all(self, pattern)-> RcParams: ...
31-
def copy(self)-> RcParams: ...
26+
def find_all(self, pattern) -> RcParams: ...
27+
def copy(self) -> RcParams: ...
3228

3329
def rc_params(fail_on_error: bool = ...) -> RcParams: ...
3430
def is_url(filename: str) -> bool: ...
35-
def rc_params_from_file(
36-
fname: str | PathLike, fail_on_error: bool = ..., use_default_template: bool = ...
37-
) -> RcParams: ...
31+
def rc_params_from_file(fname: str | PathLike, fail_on_error: bool = ..., use_default_template: bool = ...) -> RcParams: ...
3832

3933
rcParamsDefault: RcParams = ...
4034
rcParams: RcParams = ...
4135
rcParamsOrig: RcParams = ...
4236

43-
def rc(group, **kwargs)-> None: ...
44-
def rcdefaults()-> None: ...
45-
def rc_file_defaults()-> None: ...
46-
def rc_file(fname: str | PathLike, *, use_default_template: bool = ...)-> None: ...
37+
def rc(group, **kwargs) -> None: ...
38+
def rcdefaults() -> None: ...
39+
def rc_file_defaults() -> None: ...
40+
def rc_file(fname: str | PathLike, *, use_default_template: bool = ...) -> None: ...
4741
@contextlib.contextmanager
48-
def rc_context(rc: dict = ..., fname: str | PathLike = ...)-> Generator: ...
49-
def use(backend: str, *, force: bool = True)-> None: ...
42+
def rc_context(rc: dict = ..., fname: str | PathLike = ...) -> Generator: ...
43+
def use(backend: str, *, force: bool = True) -> None: ...
5044
def get_backend() -> str: ...
5145
def interactive(b) -> bool: ...
5246
def is_interactive() -> bool: ...
5347

5448
default_test_modules: list[str] = ...
5549

56-
def test(verbosity=..., coverage=..., **kwargs): int: ...
50+
def test(verbosity=..., coverage=..., **kwargs):
51+
int: ...

stubs/matplotlib/_afm.pyi

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import numpy as np
2+
23
from ._typing import *
34

45
CharMetrics = ...
@@ -9,16 +10,16 @@ class AFM:
910
def get_bbox_char(self, c: str, isord: bool = False): ...
1011
def string_width_height(self, s: str) -> tuple[float, float]: ...
1112
def get_str_bbox_and_descent(self, s: str) -> tuple[float, ...]: ...
12-
def get_str_bbox(self, s: str)-> tuple[float, ...]: ...
13-
def get_name_char(self, c: str, isord: bool = False)-> str: ...
14-
def get_width_char(self, c: str, isord: bool =False)-> float: ...
15-
def get_width_from_char_name(self, name: str)-> float: ...
16-
def get_height_char(self, c: str, isord: bool = False)-> float: ...
17-
def get_kern_dist(self, c1: str, c2: str)-> float: ...
18-
def get_kern_dist_from_name(self, name1: str, name2: str)-> float: ...
13+
def get_str_bbox(self, s: str) -> tuple[float, ...]: ...
14+
def get_name_char(self, c: str, isord: bool = False) -> str: ...
15+
def get_width_char(self, c: str, isord: bool = False) -> float: ...
16+
def get_width_from_char_name(self, name: str) -> float: ...
17+
def get_height_char(self, c: str, isord: bool = False) -> float: ...
18+
def get_kern_dist(self, c1: str, c2: str) -> float: ...
19+
def get_kern_dist_from_name(self, name1: str, name2: str) -> float: ...
1920
def get_fontname(self) -> str: ...
2021
@property
21-
def postscript_name(self)-> str: ...
22+
def postscript_name(self) -> str: ...
2223
def get_fullname(self) -> str: ...
2324
def get_familyname(self) -> str: ...
2425
@property

stubs/matplotlib/_api/__init__.pyi

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1+
import functools
12
from typing import Any, Callable, Generator, Iterable, Type
23

3-
import functools
4-
from .deprecation import (
5-
MatplotlibDeprecationWarning,
6-
)
4+
from .deprecation import MatplotlibDeprecationWarning
75

86
class classproperty:
9-
def __init__(
10-
self, fget: Callable, fset: None = ..., fdel: None = ..., doc: None = ...
11-
) -> None: ...
7+
def __init__(self, fget: Callable, fset: None = ..., fdel: None = ..., doc: None = ...) -> None: ...
128
def __get__(self, instance, owner): ...
139
@property
1410
def fget(self): ...
1511

1612
def check_isinstance(**kwargs) -> None: ...
17-
def check_in_list(
18-
_values: Iterable, *, _print_supported_values: bool = True, **kwargs
19-
) -> None: ...
13+
def check_in_list(_values: Iterable, *, _print_supported_values: bool = True, **kwargs) -> None: ...
2014
def check_shape(**kwargs) -> None: ...
2115
def check_getitem(_mapping: dict, **kwargs): ...
2216
def caching_module_getattr(cls) -> functools._lru_cache_wrapper: ...
23-
def define_aliases(
24-
alias_d: dict[str, list[str]], cls: None = ...
25-
) -> functools.partial: ...
17+
def define_aliases(alias_d: dict[str, list[str]], cls: None = ...) -> functools.partial: ...
2618
def select_matching_signature(funcs: list[Callable], *args, **kwargs): ...
2719
def recursive_subclasses(cls) -> Generator: ...
2820
def warn_external(

stubs/matplotlib/_api/deprecation.pyi

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from functools import partial
21
import contextlib
2+
from functools import partial
33
from typing import Callable, Iterator
44

55
class MatplotlibDeprecationWarning(DeprecationWarning): ...
@@ -13,7 +13,7 @@ def warn_deprecated(
1313
pending: bool = ...,
1414
obj_type: str = ...,
1515
addendum: str = ...,
16-
removal: str = ...
16+
removal: str = ...,
1717
) -> None: ...
1818
def deprecated(
1919
since: str,
@@ -24,7 +24,7 @@ def deprecated(
2424
pending: bool = ...,
2525
obj_type: str = ...,
2626
addendum: str = ...,
27-
removal: str = ...
27+
removal: str = ...,
2828
) -> Callable: ...
2929

3030
class deprecate_privatize_attribute:
@@ -33,19 +33,13 @@ class deprecate_privatize_attribute:
3333

3434
DECORATORS: dict = ...
3535

36-
def rename_parameter(
37-
since: str, old: str, new: str, func: None | Callable = ...
38-
) -> partial | Callable: ...
36+
def rename_parameter(since: str, old: str, new: str, func: None | Callable = ...) -> partial | Callable: ...
3937

4038
class _deprecated_parameter_class:
4139
def __repr__(self): ...
4240

43-
def delete_parameter(
44-
since: str, name: str, func: None | Callable = ..., **kwargs
45-
) -> partial | Callable: ...
46-
def make_keyword_only(
47-
since: str, name: str, func: None | Callable = ...
48-
) -> partial | Callable: ...
41+
def delete_parameter(since: str, name: str, func: None | Callable = ..., **kwargs) -> partial | Callable: ...
42+
def make_keyword_only(since: str, name: str, func: None | Callable = ...) -> partial | Callable: ...
4943
def deprecate_method_override(method, obj, *, allow_empty: bool = ..., **kwargs): ...
5044
@contextlib.contextmanager
5145
def suppress_matplotlib_deprecation_warning() -> Iterator[None]: ...

stubs/matplotlib/_cm.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from functools import partial
22
from typing import Any
33

4-
def cubehelix(
5-
gamma: float = 1, s: float = 0.5, r: float = -1.5, h: float = 1
6-
) -> dict[str, partial]: ...
4+
def cubehelix(gamma: float = 1, s: float = 0.5, r: float = -1.5, h: float = 1) -> dict[str, partial]: ...
75

86
gfunc: dict[int, Any] = ...
97

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
11
from matplotlib.backend_bases import RendererBase
2-
from .figure import Figure
2+
33
from .axes import Axes
4+
from .figure import Figure
45
from .transforms import Bbox
56

67
def do_constrained_layout(
7-
fig: Figure,
8-
h_pad: float,
9-
w_pad: float,
10-
hspace: float|None = None,
11-
wspace: float|None = None,
12-
rect: tuple = ...
13-
)-> dict: ...
14-
def make_layoutgrids(fig, layoutgrids:dict, rect=...)-> dict: ...
15-
def make_layoutgrids_gs(layoutgrids: dict, gs)-> dict: ...
16-
def check_no_collapsed_axes(layoutgrids, fig: Figure)-> bool: ...
8+
fig: Figure, h_pad: float, w_pad: float, hspace: float | None = None, wspace: float | None = None, rect: tuple = ...
9+
) -> dict: ...
10+
def make_layoutgrids(fig, layoutgrids: dict, rect=...) -> dict: ...
11+
def make_layoutgrids_gs(layoutgrids: dict, gs) -> dict: ...
12+
def check_no_collapsed_axes(layoutgrids, fig: Figure) -> bool: ...
1713
def compress_fixed_aspect(layoutgrids, fig: Figure): ...
18-
def get_margin_from_padding(obj, *, w_pad: float=0, h_pad: float=0, hspace: float=0, wspace: float=0)-> dict: ...
14+
def get_margin_from_padding(obj, *, w_pad: float = 0, h_pad: float = 0, hspace: float = 0, wspace: float = 0) -> dict: ...
1915
def make_layout_margins(
20-
layoutgrids: dict, fig: Figure, renderer: RendererBase, *, w_pad: float=0, h_pad: float=0, hspace: float=0, wspace: float=0
21-
)-> dict: ...
22-
def make_margin_suptitles(layoutgrids: dict, fig: Figure, renderer: RendererBase, *, w_pad: float=0, h_pad: float=0)-> None: ...
23-
def match_submerged_margins(layoutgrids: dict, fig: Figure)-> None: ...
24-
def get_cb_parent_spans(cbax)-> tuple[range, range]: ...
16+
layoutgrids: dict,
17+
fig: Figure,
18+
renderer: RendererBase,
19+
*,
20+
w_pad: float = 0,
21+
h_pad: float = 0,
22+
hspace: float = 0,
23+
wspace: float = 0,
24+
) -> dict: ...
25+
def make_margin_suptitles(
26+
layoutgrids: dict, fig: Figure, renderer: RendererBase, *, w_pad: float = 0, h_pad: float = 0
27+
) -> None: ...
28+
def match_submerged_margins(layoutgrids: dict, fig: Figure) -> None: ...
29+
def get_cb_parent_spans(cbax) -> tuple[range, range]: ...
2530
def get_pos_and_bbox(ax: Axes, renderer: RendererBase) -> tuple[Bbox, Bbox]: ...
2631
def reposition_axes(
27-
layoutgrids: dict, fig: Figure, renderer: RendererBase, *, w_pad: float=0, h_pad: float=0, hspace: float=0, wspace: float=0
28-
)-> None: ...
29-
def reposition_colorbar(layoutgrids: dict, cbax: Axes, renderer: RendererBase, *, offset: float|None=None)-> dict: ...
30-
def reset_margins(layoutgrids: dict, fig: Figure)-> None: ...
31-
def colorbar_get_pad(layoutgrids: dict, cax: Axes)-> float: ...
32+
layoutgrids: dict,
33+
fig: Figure,
34+
renderer: RendererBase,
35+
*,
36+
w_pad: float = 0,
37+
h_pad: float = 0,
38+
hspace: float = 0,
39+
wspace: float = 0,
40+
) -> None: ...
41+
def reposition_colorbar(layoutgrids: dict, cbax: Axes, renderer: RendererBase, *, offset: float | None = None) -> dict: ...
42+
def reset_margins(layoutgrids: dict, fig: Figure) -> None: ...
43+
def colorbar_get_pad(layoutgrids: dict, cax: Axes) -> float: ...

stubs/matplotlib/_enums.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ class _AutoStringNameEnum(Enum):
44
def __hash__(self) -> int: ...
55

66
class JoinStyle(str, _AutoStringNameEnum):
7-
8-
miter: JoinStyle
9-
round: JoinStyle
10-
bevel: JoinStyle
7+
miter: JoinStyle
8+
round: JoinStyle
9+
bevel: JoinStyle
1110
@staticmethod
1211
def demo() -> None: ...
1312

stubs/matplotlib/_layoutgrid.pyi

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
from typing import Literal
2+
3+
from .figure import Figure
24
from .gridspec import SubplotSpec
35
from .transforms import Bbox
4-
from .figure import Figure
56

67
class LayoutGrid:
78
def __init__(
89
self,
9-
parent: LayoutGrid | tuple[int, int, int, int]|None = None,
10+
parent: LayoutGrid | tuple[int, int, int, int] | None = None,
1011
parent_pos: tuple[range, range] | tuple[int, int] = (0, 0),
1112
parent_inner: bool = False,
12-
name: str = '',
13+
name: str = "",
1314
ncols: int = 1,
1415
nrows: int = 1,
15-
h_pad: float|None = None,
16-
w_pad: float|None = None,
16+
h_pad: float | None = None,
17+
w_pad: float | None = None,
1718
width_ratios: None | list[float] = None,
1819
height_ratios: None | list[float] = None,
1920
) -> None: ...
@@ -29,22 +30,16 @@ class LayoutGrid:
2930
) -> None: ...
3031
def parent_constraints(self) -> None: ...
3132
def grid_constraints(self) -> None: ...
32-
def edit_margin(
33-
self, todo: Literal["left", "right", "bottom", "top"], size: float, cell: int
34-
) -> None: ...
33+
def edit_margin(self, todo: Literal["left", "right", "bottom", "top"], size: float, cell: int) -> None: ...
3534
def edit_margin_min(
3635
self,
3736
todo: Literal["left", "right", "bottom", "top"],
3837
size: float,
3938
cell: int = 0,
4039
) -> None: ...
41-
def edit_margins(
42-
self, todo: Literal["left", "right", "bottom", "top"], size: float
43-
) -> None: ...
44-
def edit_all_margins_min(
45-
self, todo: Literal["left", "right", "bottom", "top"], size: float
46-
): ...
47-
def edit_outer_margin_mins(self, margin: dict, ss: SubplotSpec)-> None: ...
40+
def edit_margins(self, todo: Literal["left", "right", "bottom", "top"], size: float) -> None: ...
41+
def edit_all_margins_min(self, todo: Literal["left", "right", "bottom", "top"], size: float): ...
42+
def edit_outer_margin_mins(self, margin: dict, ss: SubplotSpec) -> None: ...
4843
def get_margins(self, todo, col) -> Bbox: ...
4944
def get_outer_bbox(self, rows=0, cols=0) -> Bbox: ...
5045
def get_inner_bbox(self, rows=0, cols=0) -> Bbox: ...
@@ -57,4 +52,4 @@ class LayoutGrid:
5752

5853
def seq_id() -> str: ...
5954
def print_children(lb) -> None: ...
60-
def plot_children(fig: Figure, lg=None, level: int=0, printit: bool=False)->None: ...
55+
def plot_children(fig: Figure, lg=None, level: int = 0, printit: bool = False) -> None: ...

0 commit comments

Comments
 (0)