Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lint:
flake8 $(PROJECT) tests setup.py
$(isort) --check-only
$(black) --check
# mypy $(PROJECT) tests
mypy $(PROJECT) tests

clean:
rm -rf `find . -name __pycache__`
Expand Down
6 changes: 3 additions & 3 deletions cuenca/resources/api_keys.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime as dt
from typing import ClassVar, Optional
from typing import ClassVar, Optional, cast

from pydantic.dataclasses import dataclass

Expand Down Expand Up @@ -27,7 +27,7 @@ def active(self) -> bool:

@classmethod
def create(cls) -> 'ApiKey':
return cls._create()
return cast('ApiKey', cls._create())

@classmethod
def deactivate(cls, api_key_id: str, minutes: int = 0) -> 'ApiKey':
Expand All @@ -40,4 +40,4 @@ def deactivate(cls, api_key_id: str, minutes: int = 0) -> 'ApiKey':
"""
url = cls._endpoint + f'/{api_key_id}'
resp = session.delete(url, dict(minutes=minutes))
return cls._from_dict(resp)
return cast('ApiKey', cls._from_dict(resp))
4 changes: 4 additions & 0 deletions cuenca/resources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
class Resource:
_endpoint: ClassVar[str]

def __init__(self, **kwargs): # pragma no cover
for attr, value in kwargs.items():
setattr(self, attr, value)

@classmethod
def _from_dict(cls, obj_dict: Dict[str, Union[str, int]]) -> 'Resource':
cls._filter_excess_fields(obj_dict)
Expand Down
4 changes: 2 additions & 2 deletions cuenca/resources/transfers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime as dt
from typing import ClassVar, Optional
from typing import ClassVar, Optional, cast

from clabe import Clabe
from pydantic import BaseModel, StrictStr
Expand Down Expand Up @@ -70,7 +70,7 @@ def create(
recipient_name=recipient_name,
idempotency_key=idempotency_key,
)
return cls._create(**req.dict())
return cast('Transfer', cls._create(**req.dict()))

@staticmethod
def _gen_idempotency_key(account_number: str, amount: int) -> str:
Expand Down
2 changes: 1 addition & 1 deletion cuenca/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.1.3'
__version__ = '0.1.4'
CLIENT_VERSION = __version__
API_VERSION = '2020-03-19'
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ force_grid_wrap=0
combine_as_imports=True

[mypy-pytest]
ignore_missing_imports = true
ignore_missing_imports = True