-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: stricter linting rules (#230)
- Loading branch information
1 parent
a183c40
commit 75c7550
Showing
37 changed files
with
2,176 additions
and
2,374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"""Example module with docstrings for the developer guide.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union | ||
|
||
|
||
def example_function_args( | ||
param1: int, | ||
param2: Union[str, int], | ||
optional_param: Optional[List[str]] = None, | ||
*args: Union[float, str], | ||
**kwargs: Dict[str, Any], | ||
) -> Tuple[bool, List[str]]: | ||
"""Example function with PEP 484 type annotations and PEP 563 future annotations. | ||
This function shows how to define and document typing for different kinds of | ||
arguments, including positional, optional, variable-length args, and keyword args. | ||
Args: | ||
param1 (int): A required integer parameter. | ||
param2 (Union[str, int]): A parameter that can be either a string or an integer. | ||
optional_param (Optional[List[str]], optional): An optional parameter that | ||
accepts a list of strings. Defaults to None if not provided. | ||
*args (Union[float, str]): Variable length argument list that accepts floats or | ||
strings. | ||
**kwargs (Dict[str, Any]): Arbitrary keyword arguments as a dictionary of string | ||
keys and values of any type. | ||
Returns: | ||
Tuple[bool, List[str]]: A tuple containing: | ||
- bool: Always True for this example. | ||
- List[str]: A list with a single string describing the received arguments. | ||
""" | ||
result = ( | ||
f"Received: param1={param1}, param2={param2}, optional_param={optional_param}, " | ||
f"args={args}, kwargs={kwargs}" | ||
) | ||
|
||
return True, [result] | ||
|
||
|
||
def example_generator(n: int) -> Iterator[int]: | ||
"""Generators have a ``Yields`` section instead of a ``Returns`` section. | ||
Args: | ||
n (int): The upper limit of the range to generate, from 0 to `n` - 1. | ||
Yields: | ||
int: The next number in the range of 0 to `n` - 1. | ||
Examples: | ||
Examples should be written in doctest format, and should illustrate how | ||
to use the function. | ||
>>> print([i for i in example_generator(4)]) | ||
[0, 1, 2, 3] | ||
""" | ||
yield from range(n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.