Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyright to project. Fix errors reported by pyright. #29

Merged
merged 50 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6c6692d
style: Adjust pyproject.toml formatting
Jun 13, 2023
29a153a
build: Add pyright settings
Jun 13, 2023
1d04231
fix: Add default value for header
Jun 13, 2023
874e04c
docs: Fix Seekable protocol
Jun 13, 2023
daa1c7f
docs: Remove unnecessary TypeVars
Jun 13, 2023
1e1df1e
chore: Pycharm: Make project request a venv by default
Jun 14, 2023
8c12105
Merge branch 'master' into add_pyright
Jun 15, 2023
fe096ad
build: Add pyright to project dev dependencies
Jun 15, 2023
585c43d
docs: Remove usage of cast for type hints
Jun 16, 2023
ad1f7b5
docs: Add missing type hints
Jun 16, 2023
be7058a
docs: Add missing type hints to propagate_warnings
Jun 17, 2023
956c7ec
refactor: Remove propagate_warnings_yield
Jun 17, 2023
9994697
build: Add pyright settings comment
Jun 17, 2023
7527f76
docs: Specify writerow parameter type hint
Jun 17, 2023
1bc2ff0
style: Yapf formatting
Jun 17, 2023
cb0a2a5
Revert "refactor: Remove propagate_warnings_yield"
Jun 17, 2023
291179c
feat: Remove yields parameter from propagate_warnings
Jun 17, 2023
bb6245c
docs: Add type hinting to _initialise_decks
Jun 18, 2023
1a9e5de
fix: Correct incorrect return value of _generate_unique_file_path
Jun 18, 2023
47808e1
docs: Update type hint of _initialise_decks
Jun 18, 2023
f6e3ad7
docs: Add type hint to _generate_unique_file_path
Jun 18, 2023
4c3fd35
docs: Fix type hint for generate_flattened_kwargs_fill_missing
Jun 18, 2023
7316519
docs: Denote positional arguments in write_deck_to_file
Jun 18, 2023
afd254b
docs: Update type hints for generate_flattened_kwargs_remove_falsy
Jun 18, 2023
452b858
docs: Update type hints for generate_flattened_kwargs_remove_sentinel
Jun 18, 2023
fad2dbf
docs: Add type hints to from_file
Jun 18, 2023
ef2179d
docs: Add type hints to add_deck
Jun 18, 2023
d62ebcb
docs: Add type hints to write_deck_to_file
Jun 18, 2023
829be50
refactor: Remove unused function _get_num_decks
Jun 18, 2023
0b2589d
docs: Add type hint to get_deck
Jun 18, 2023
0983086
refactor: Remove unused function _get_decks
Jun 18, 2023
552fc45
docs: Add explicit type hint for Gaggle.decks
Jun 18, 2023
d7a44ff
docs: Add type hint to transform_integer_value
Jun 18, 2023
0bbe52e
docs: Update type hint for transform_integer_value
Jun 18, 2023
73eeab5
docs: Add type hint to _copy_and_reformat
Jun 18, 2023
7aa8268
style: yapf formatting
Jun 18, 2023
25dc389
docs: Switch to builtin typing classes
Jun 18, 2023
683b4b1
build: Remove pyright suppression comments
Jun 18, 2023
c12d97c
feat: Use assert for internal consistence
Jun 18, 2023
4d806f6
docs: Fix AnkiHeader type hint
Jun 18, 2023
4f821bb
docs: Add explicit type hint for deck in create_cards_from_tsv
Jun 18, 2023
580c6eb
docs: Add type hint to get_field()
Jun 18, 2023
dab8236
docs: Add explicit type hint to str_list
Jun 18, 2023
b8483d6
docs: Fix type hint for _copy_and_reformat
Jun 18, 2023
17a95f9
docs: Type hint decorator functions
Jun 19, 2023
86aa29f
docs: Add type hint for write_all_decks_to_file
Jun 19, 2023
dff8d32
docs: Remove unnecessary overload declarations
Jun 19, 2023
172e8fe
docs: Add stub files for gaggle
Jun 19, 2023
e6e4169
build: pyright: Update pyproject.toml
Jun 19, 2023
b4ee376
style: yapf formatting
Jun 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/Gaggle.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 50 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ python = "^3.11"
pylint = "^2.17.4"
pytest = "^7.3.1"
yapf = "^0.33.0"
pyright = "^1.1.314"

[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
]
addopts = ["--import-mode=importlib"]
pythonpath = "src"

[tool.yapfignore]
Expand All @@ -43,6 +42,14 @@ ignore_patterns = [
[tool.yapf]
based_on_style = "yapf"

[tool.pyright]
include = ["src"]
exclude = ["dev_files/*.py"]
strict = ["src/gaggle"]
reportMissingImports = true
reportUntypedFunctionDecorator = true
reportUntypedClassDecorator = true

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
5 changes: 3 additions & 2 deletions src/gaggle/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class LeftoverArgumentWarning(Warning):
"""Gaggle warning when extra arguments remain after a function call. The extra
arguments were not necessary to successfully complete the function call."""

def __init__(self, context_message, leftovers, leftover_name):
def __init__(self, context_message: Any, leftovers: Iterable[Any],
leftover_name: Any):
self.leftovers = leftovers
self.message = self._create_message(context_message, leftover_name)

Expand Down Expand Up @@ -157,7 +158,7 @@ def from_values(cls, *values: Iterable[Any], **kwargs: str) -> Self:
iterator = itertools.chain(*values)
return cls.from_iterator(iterator=iterator, **kwargs)

def _create_message(self, context_message, leftover_name):
def _create_message(self, context_message: Any, leftover_name: Any) -> str:
"""Creates value of LeftoverArgumentWarning.message

Args:
Expand Down
Loading