Skip to content

Commit

Permalink
Add mypy configuration for Pydantic plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
gabino committed Jan 17, 2025
1 parent ebf585d commit f72b315
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 15 deletions.
5 changes: 2 additions & 3 deletions cuenca/resources/arpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import ClassVar, Optional

from cuenca_validations.types.requests import ARPCRequest
from pydantic_extra_types.payment import PaymentCardNumber

from ..http import Session, session as global_session
from .base import Creatable
Expand Down Expand Up @@ -30,7 +29,7 @@ class Arpc(Creatable):
@classmethod
def create(
cls,
number: PaymentCardNumber,
number: str,
arqc: str,
arpc_method: str,
transaction_data: str,
Expand All @@ -51,6 +50,6 @@ def create(
transaction_counter=transaction_counter,
pan_sequence=pan_sequence,
unique_number=unique_number,
track_data_method=track_data_method, # type: ignore
track_data_method=track_data_method,
)
return cls._create(session=session, **req.model_dump())
3 changes: 1 addition & 2 deletions cuenca/resources/card_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import ClassVar, Optional, cast

from cuenca_validations.types.requests import CardActivationRequest
from pydantic_extra_types.payment import PaymentCardNumber

from ..http import Session, session as global_session
from .base import Creatable
Expand All @@ -22,7 +21,7 @@ class CardActivation(Creatable):
@classmethod
def create(
cls,
number: PaymentCardNumber,
number: str,
exp_month: int,
exp_year: int,
cvv2: str,
Expand Down
3 changes: 1 addition & 2 deletions cuenca/resources/card_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from cuenca_validations.types import CardStatus, CardType
from cuenca_validations.types.requests import CardValidationRequest
from pydantic_extra_types.payment import PaymentCardNumber

from ..http import Session, session as global_session
from .base import Creatable
Expand Down Expand Up @@ -31,7 +30,7 @@ class CardValidation(Creatable):
@classmethod
def create(
cls,
number: PaymentCardNumber,
number: str,
cvv: Optional[str] = None,
cvv2: Optional[str] = None,
icvv: Optional[str] = None,
Expand Down
2 changes: 1 addition & 1 deletion cuenca/resources/curp_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create(
second_surname=second_surname,
date_of_birth=date_of_birth,
state_of_birth=state_of_birth,
country_of_birth=country_of_birth, # type: ignore
country_of_birth=country_of_birth,
gender=gender,
manual_curp=manual_curp,
)
Expand Down
8 changes: 6 additions & 2 deletions cuenca/resources/file_batches.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from typing import ClassVar

from cuenca_validations.types import BatchFileMetadata, FileBatchUploadRequest
from cuenca_validations.types import (
BatchFileMetadata,
FileBatchUploadRequest,
FileRequest,
)

from ..http import Session, session as global_session
from .base import Creatable, Queryable
Expand All @@ -22,7 +26,7 @@ def create(
session: Session = global_session,
) -> 'FileBatch':
req = FileBatchUploadRequest(
files=files, # type: ignore
files=[FileRequest(**f) for f in files],
user_id=user_id,
)
return cls._create(session=session, **req.model_dump())
2 changes: 1 addition & 1 deletion cuenca/resources/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def upload(
req = FileUploadRequest(
file=file.read(),
type=file_type,
extension=extension, # type: ignore
extension=extension,
is_back=is_back,
user_id=user_id,
)
Expand Down
4 changes: 2 additions & 2 deletions cuenca/resources/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create(
req = SessionRequest(
user_id=user_id,
type=type,
success_url=success_url, # type: ignore
failure_url=failure_url, # type: ignore
success_url=success_url,
failure_url=failure_url,
)
return cls._create(session=session, **req.model_dump())
2 changes: 1 addition & 1 deletion cuenca/resources/transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create(
if not idempotency_key:
idempotency_key = cls._gen_idempotency_key(account_number, amount)
req = TransferRequest(
account_number=account_number, # type: ignore
account_number=account_number,
amount=amount,
descriptor=descriptor,
recipient_name=recipient_name,
Expand Down
2 changes: 1 addition & 1 deletion cuenca/resources/user_lists_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ def create(
first_surname=first_surname,
second_surname=second_surname,
curp=curp,
account_number=account_number, # type: ignore
account_number=account_number,
)
return cls._create(session=session, **req.model_dump())
2 changes: 2 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
plugins = pydantic.mypy

0 comments on commit f72b315

Please sign in to comment.