Skip to content

Commit

Permalink
Update mypy and pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhcc committed Jan 28, 2025
1 parent 4f3e272 commit fed7a58
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/beancount-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- run: pip install -r requirements_dev.txt
- run: pylint beanprice
- run: pytest beanprice
- run: mypy beanprice --ignore-missing-imports
- run: mypy beanprice
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pylint beanprice
Type checker:

```
mypy beanprice --ignore-missing-imports
mypy beanprice
```

## Copyright and License
Expand Down
12 changes: 9 additions & 3 deletions beanprice/price.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def import_source(module_name: str):


def find_currencies_declared(
entries: data.Entries, date: datetime.date = None
entries: data.Entries,
date: Optional[datetime.date] = None,
) -> List[Tuple[str, str, List[PriceSource]]]:
"""Return currencies declared in Commodity directives.
Expand Down Expand Up @@ -564,7 +565,7 @@ def setup_cache(cache_filename: Optional[str], clear_cache: bool):
flag = "n"

global _CACHE
_CACHE = shelve.open(cache_filename, flag=flag)
_CACHE = shelve.open(cache_filename, flag=flag) # type: ignore
_CACHE.expiration = DEFAULT_EXPIRATION # type: ignore


Expand Down Expand Up @@ -671,7 +672,12 @@ def filter_redundant_prices(
return filtered_prices, ignored_prices


def process_args() -> Tuple[Any, List[DatedPrice], List[data.Price], Any]:
def process_args() -> Tuple[
argparse.Namespace,
List[DatedPrice],
data.Directives,
Any | None,
]:
"""Process the arguments. This also initializes the logging module.
Returns:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ ignore = [
'UP007',
'UP032',
]

[tool.mypy]
disable_error_code = ["import-untyped"]
4 changes: 2 additions & 2 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r requirements.txt
pylint==2.7.2
pylint==3.3.3
pytest==5.4.2
mypy==0.812
mypy==1.14.1

0 comments on commit fed7a58

Please sign in to comment.