Skip to content

Commit 048bd2f

Browse files
deploy stub files [ci skip]
1 parent 81f773e commit 048bd2f

6 files changed

Lines changed: 31 additions & 38 deletions

File tree

template/utils/_checks.pyi

Lines changed: 10 additions & 12 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,16 +22,19 @@ def ensure_int(item: Any, item_name: Optional[str] = None) -> int:
2222
"""
2323

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

2830
class _Callable:
29-
@classmethod
30-
def __instancecheck__(cls, other: Any) -> bool: ...
3131

32+
@classmethod
33+
def __instancecheck__(cls, other: Any) -> bool:
34+
...
3235
_types: Incomplete
3336

34-
def check_type(item: Any, types: tuple, item_name: Optional[str] = None) -> None:
37+
def check_type(item: Any, types: tuple, item_name: Optional[str]=None) -> None:
3538
"""Check that item is an instance of types.
3639
3740
Parameters
@@ -51,12 +54,7 @@ def check_type(item: Any, types: tuple, item_name: Optional[str] = None) -> None
5154
When the type of the item is not one of the valid options.
5255
"""
5356

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:
57+
def check_value(item: Any, allowed_values: Union[tuple, dict[Any, Any]], item_name: Optional[str]=None, extra: Optional[str]=None) -> None:
6058
"""Check the value of a parameter against a list of valid options.
6159
6260
Parameters
@@ -107,4 +105,4 @@ def ensure_path(item: Any, must_exist: bool) -> Path:
107105
-------
108106
path : Path
109107
Path validated and converted to a pathlib.Path object.
110-
"""
108+
"""

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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ class WrapStdOut:
77
properly.
88
"""
99

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

template/utils/_imports.pyi

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

44
_INSTALL_MAPPING: dict[str, str]
55

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

template/utils/config.pyi

Lines changed: 3 additions & 5 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,7 +16,5 @@ 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(
20-
out: Callable, ljust: int, package: str, dependencies: list[Requirement]
21-
) -> None:
22-
"""List dependencies names and versions."""
19+
def _list_dependencies_info(out: Callable, ljust: int, package: str, dependencies: list[Requirement]) -> None:
20+
"""List dependencies names and versions."""

template/utils/logs.pyi

Lines changed: 13 additions & 15 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,13 +27,7 @@ def _init_logger(*, verbose: Optional[Union[bool, str, int]] = None) -> logging.
2727
The initialized logger.
2828
"""
2929

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:
30+
def add_file_handler(fname: Union[str, Path], mode: str='a', encoding: Optional[str]=None, *, verbose: Optional[Union[bool, str, int]]=None) -> None:
3731
"""Add a file handler to the logger.
3832
3933
Parameters
@@ -65,10 +59,11 @@ def set_log_level(verbose: Optional[Union[bool, str, int]]) -> None:
6559

6660
class _LoggerFormatter(logging.Formatter):
6761
"""Format string syntax."""
68-
6962
_formatters: Incomplete
7063

71-
def __init__(self) -> None: ...
64+
def __init__(self) -> None:
65+
...
66+
7267
def format(self, record: logging.LogRecord):
7368
"""Format the received log record.
7469
@@ -102,12 +97,15 @@ class _use_log_level:
10297
verbosity is set to ``"WARNING"``. If a bool is provided, the verbosity is set to
10398
``"WARNING"`` for False and to ``"INFO"`` for True.
10499
"""
105-
106100
_old_level: Incomplete
107101
_level: Incomplete
108102

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

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

0 commit comments

Comments
 (0)