Skip to content

Commit 2168deb

Browse files
deploy stub files [ci skip]
1 parent ffa9ff7 commit 2168deb

6 files changed

Lines changed: 38 additions & 31 deletions

File tree

template/utils/_checks.pyi

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from _typeshed import Incomplete
55

66
from ._docs import fill_doc as fill_doc
77

8-
def ensure_int(item: Any, item_name: Optional[str]=None) -> int:
8+
def ensure_int(item: Any, item_name: Optional[str] = None) -> int:
99
"""Ensure a variable is an integer.
1010
1111
Parameters
@@ -22,19 +22,16 @@ def ensure_int(item: Any, item_name: Optional[str]=None) -> int:
2222
"""
2323

2424
class _IntLike:
25-
2625
@classmethod
27-
def __instancecheck__(cls, other: Any) -> bool:
28-
...
26+
def __instancecheck__(cls, other: Any) -> bool: ...
2927

3028
class _Callable:
31-
3229
@classmethod
33-
def __instancecheck__(cls, other: Any) -> bool:
34-
...
30+
def __instancecheck__(cls, other: Any) -> bool: ...
31+
3532
_types: Incomplete
3633

37-
def check_type(item: Any, types: tuple, item_name: Optional[str]=None) -> None:
34+
def check_type(item: Any, types: tuple, item_name: Optional[str] = None) -> None:
3835
"""Check that item is an instance of types.
3936
4037
Parameters
@@ -54,7 +51,12 @@ def check_type(item: Any, types: tuple, item_name: Optional[str]=None) -> None:
5451
When the type of the item is not one of the valid options.
5552
"""
5653

57-
def check_value(item: Any, allowed_values: Union[tuple, dict[Any, Any]], item_name: Optional[str]=None, extra: Optional[str]=None) -> None:
54+
def check_value(
55+
item: Any,
56+
allowed_values: Union[tuple, dict[Any, Any]],
57+
item_name: Optional[str] = None,
58+
extra: Optional[str] = None,
59+
) -> None:
5860
"""Check the value of a parameter against a list of valid options.
5961
6062
Parameters
@@ -105,4 +107,4 @@ def ensure_path(item: Any, must_exist: bool) -> Path:
105107
-------
106108
path : Path
107109
Path validated and converted to a pathlib.Path object.
108-
"""
110+
"""

template/utils/_docs.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ def copy_doc(source: Callable[..., Any]) -> Callable[..., Any]:
6565
... pass
6666
>>> print(B.m1.__doc__)
6767
Docstring for m1 this gets appended
68-
"""
68+
"""

template/utils/_fixes.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ class WrapStdOut:
77
properly.
88
"""
99

10-
def __getattr__(self, name: str) -> Any:
11-
...
10+
def __getattr__(self, name: str) -> Any: ...

template/utils/_imports.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ from typing import Optional
33

44
_INSTALL_MAPPING: dict[str, str]
55

6-
def import_optional_dependency(name: str, extra: str='', raise_error: bool=True) -> Optional[ModuleType]:
6+
def import_optional_dependency(
7+
name: str, extra: str = "", raise_error: bool = True
8+
) -> Optional[ModuleType]:
79
"""Import an optional dependency.
810
911
By default, if a dependency is missing an ImportError with a nice message will be
@@ -25,4 +27,4 @@ def import_optional_dependency(name: str, extra: str='', raise_error: bool=True)
2527
module : Module | None
2628
The imported module when found.
2729
None is returned when the package is not found and raise_error is False.
28-
"""
30+
"""

template/utils/config.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from packaging.requirements import Requirement
44

55
from ._checks import check_type as check_type
66

7-
def sys_info(fid: Optional[IO]=None, developer: bool=False):
7+
def sys_info(fid: Optional[IO] = None, developer: bool = False):
88
"""Print the system information for debugging.
99
1010
Parameters
@@ -16,5 +16,7 @@ def sys_info(fid: Optional[IO]=None, developer: bool=False):
1616
If True, display information about optional dependencies.
1717
"""
1818

19-
def _list_dependencies_info(out: Callable, ljust: int, package: str, dependencies: list[Requirement]) -> None:
20-
"""List dependencies names and versions."""
19+
def _list_dependencies_info(
20+
out: Callable, ljust: int, package: str, dependencies: list[Requirement]
21+
) -> None:
22+
"""List dependencies names and versions."""

template/utils/logs.pyi

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ from ._checks import check_verbose as check_verbose
88
from ._docs import fill_doc as fill_doc
99
from ._fixes import WrapStdOut as WrapStdOut
1010

11-
def _init_logger(*, verbose: Optional[Union[bool, str, int]]=None) -> logging.Logger:
11+
def _init_logger(*, verbose: Optional[Union[bool, str, int]] = None) -> logging.Logger:
1212
"""Initialize a logger.
1313
1414
Assigns sys.stdout as the first handler of the logger.
@@ -27,7 +27,13 @@ def _init_logger(*, verbose: Optional[Union[bool, str, int]]=None) -> logging.Lo
2727
The initialized logger.
2828
"""
2929

30-
def add_file_handler(fname: Union[str, Path], mode: str='a', encoding: Optional[str]=None, *, verbose: Optional[Union[bool, str, int]]=None) -> None:
30+
def add_file_handler(
31+
fname: Union[str, Path],
32+
mode: str = "a",
33+
encoding: Optional[str] = None,
34+
*,
35+
verbose: Optional[Union[bool, str, int]] = None,
36+
) -> None:
3137
"""Add a file handler to the logger.
3238
3339
Parameters
@@ -59,11 +65,10 @@ def set_log_level(verbose: Optional[Union[bool, str, int]]) -> None:
5965

6066
class _LoggerFormatter(logging.Formatter):
6167
"""Format string syntax."""
62-
_formatters: Incomplete
6368

64-
def __init__(self) -> None:
65-
...
69+
_formatters: Incomplete
6670

71+
def __init__(self) -> None: ...
6772
def format(self, record: logging.LogRecord):
6873
"""Format the received log record.
6974
@@ -97,15 +102,12 @@ class _use_log_level:
97102
verbosity is set to ``"WARNING"``. If a bool is provided, the verbosity is set to
98103
``"WARNING"`` for False and to ``"INFO"`` for True.
99104
"""
105+
100106
_old_level: Incomplete
101107
_level: Incomplete
102108

103-
def __init__(self, verbose: Optional[Union[bool, str, int]]=None) -> None:
104-
...
105-
106-
def __enter__(self) -> None:
107-
...
109+
def __init__(self, verbose: Optional[Union[bool, str, int]] = None) -> None: ...
110+
def __enter__(self) -> None: ...
111+
def __exit__(self, *args) -> None: ...
108112

109-
def __exit__(self, *args) -> None:
110-
...
111-
logger: Incomplete
113+
logger: Incomplete

0 commit comments

Comments
 (0)