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
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ strict_optional = True
disallow_untyped_defs = True
check_untyped_defs = True
warn_return_any = True
warn_unused_ignores = True

show_column_numbers = True
show_error_codes = True
Expand Down
2 changes: 1 addition & 1 deletion src/cl_sii/extras/mm_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,6 @@ def _validated(self, value: Optional[object]) -> Optional[RcvPeriodoTributario]:
except TypeError as exc:
raise self.make_error('type') from exc

validated = RcvPeriodoTributario.from_date(value) # type: ignore
validated = RcvPeriodoTributario.from_date(value)

return validated
6 changes: 1 addition & 5 deletions src/cl_sii/libs/rows_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ def csv_rows_mm_deserialization_iterator(
on CSV error when iterating over ``csv_reader``

"""
# note: mypy complaint is wrong because a 'csv.DictReader' object can be iterated over
# and yields instances of 'Dict[str, object]'.
# > Incompatible types in assignment (expression has type "DictReader", variable has type
# > "Iterable[Dict[str, object]]")
rows_iterator: Iterable[Dict[str, object]] = csv_reader # type: ignore
rows_iterator: Iterable[Dict[str, object]] = csv_reader
iterator = rows_mm_deserialization_iterator(
rows_iterator, row_schema, n_rows_offset, max_n_rows, fields_to_remove_names
)
Expand Down
2 changes: 1 addition & 1 deletion src/cl_sii/libs/tz_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
pytz.tzinfo.BaseTzInfo,
pytz.tzinfo.StaticTzInfo,
pytz.tzinfo.DstTzInfo,
pytz._FixedOffset, # type: ignore
pytz._FixedOffset,
]


Expand Down
90 changes: 45 additions & 45 deletions src/cl_sii/rcv/parse_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,16 +633,16 @@ def postprocess(self, data: dict, **kwargs: Any) -> dict:

def to_detalle_entry(self, data: dict) -> RvDetalleEntry:
try:
emisor_rut: Rut = data['emisor_rut'] # type: ignore
tipo_docto = data['tipo_docto'] # type: ignore
folio: int = data['folio'] # type: ignore
fecha_emision_date: date = data['fecha_emision_date'] # type: ignore
receptor_rut: Rut = data['receptor_rut'] # type: ignore
monto_total: int = data['monto_total'] # type: ignore
receptor_razon_social: str = data['receptor_razon_social'] # type: ignore
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt'] # type: ignore
fecha_acuse_dt: Optional[datetime] = data['fecha_acuse_dt'] # type: ignore
fecha_reclamo_dt: Optional[datetime] = data['fecha_reclamo_dt'] # type: ignore
emisor_rut: Rut = data['emisor_rut']
tipo_docto = data['tipo_docto']
folio: int = data['folio']
fecha_emision_date: date = data['fecha_emision_date']
receptor_rut: Rut = data['receptor_rut']
monto_total: int = data['monto_total']
receptor_razon_social: str = data['receptor_razon_social']
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt']
fecha_acuse_dt: Optional[datetime] = data['fecha_acuse_dt']
fecha_reclamo_dt: Optional[datetime] = data['fecha_reclamo_dt']
except KeyError as exc:
raise ValueError("Programming error: a referenced field is missing.") from exc

Expand Down Expand Up @@ -765,15 +765,15 @@ def postprocess(self, data: dict, **kwargs: Any) -> dict:

def to_detalle_entry(self, data: dict) -> RcRegistroDetalleEntry:
try:
emisor_rut: Rut = data['emisor_rut'] # type: ignore
tipo_docto = data['tipo_docto'] # type: ignore
folio: int = data['folio'] # type: ignore
fecha_emision_date: date = data['fecha_emision_date'] # type: ignore
receptor_rut: Rut = data['receptor_rut'] # type: ignore
monto_total: int = data['monto_total'] # type: ignore
emisor_razon_social: str = data['emisor_razon_social'] # type: ignore
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt'] # type: ignore
fecha_acuse_dt: Optional[datetime] = data['fecha_acuse_dt'] # type: ignore
emisor_rut: Rut = data['emisor_rut']
tipo_docto = data['tipo_docto']
folio: int = data['folio']
fecha_emision_date: date = data['fecha_emision_date']
receptor_rut: Rut = data['receptor_rut']
monto_total: int = data['monto_total']
emisor_razon_social: str = data['emisor_razon_social']
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt']
fecha_acuse_dt: Optional[datetime] = data['fecha_acuse_dt']
except KeyError as exc:
raise ValueError("Programming error: a referenced field is missing.") from exc

Expand All @@ -798,15 +798,15 @@ def to_detalle_entry(self, data: dict) -> RcRegistroDetalleEntry:
class RcvCompraNoIncluirCsvRowSchema(RcvCompraRegistroCsvRowSchema):
def to_detalle_entry(self, data: dict) -> RcNoIncluirDetalleEntry:
try:
emisor_rut: Rut = data['emisor_rut'] # type: ignore
tipo_docto = data['tipo_docto'] # type: ignore
folio: int = data['folio'] # type: ignore
fecha_emision_date: date = data['fecha_emision_date'] # type: ignore
receptor_rut: Rut = data['receptor_rut'] # type: ignore
monto_total: int = data['monto_total'] # type: ignore
emisor_razon_social: str = data['emisor_razon_social'] # type: ignore
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt'] # type: ignore
fecha_acuse_dt: Optional[datetime] = data['fecha_acuse_dt'] # type: ignore
emisor_rut: Rut = data['emisor_rut']
tipo_docto = data['tipo_docto']
folio: int = data['folio']
fecha_emision_date: date = data['fecha_emision_date']
receptor_rut: Rut = data['receptor_rut']
monto_total: int = data['monto_total']
emisor_razon_social: str = data['emisor_razon_social']
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt']
fecha_acuse_dt: Optional[datetime] = data['fecha_acuse_dt']
except KeyError as exc:
raise ValueError("Programming error: a referenced field is missing.") from exc

Expand Down Expand Up @@ -934,15 +934,15 @@ def postprocess(self, data: dict, **kwargs: Any) -> dict:

def to_detalle_entry(self, data: dict) -> RcReclamadoDetalleEntry:
try:
emisor_rut: Rut = data['emisor_rut'] # type: ignore
tipo_docto = data['tipo_docto'] # type: ignore
folio: int = data['folio'] # type: ignore
fecha_emision_date: date = data['fecha_emision_date'] # type: ignore
receptor_rut: Rut = data['receptor_rut'] # type: ignore
monto_total: int = data['monto_total'] # type: ignore
emisor_razon_social: str = data['emisor_razon_social'] # type: ignore
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt'] # type: ignore
fecha_reclamo_dt: Optional[datetime] = data['fecha_reclamo_dt'] # type: ignore
emisor_rut: Rut = data['emisor_rut']
tipo_docto = data['tipo_docto']
folio: int = data['folio']
fecha_emision_date: date = data['fecha_emision_date']
receptor_rut: Rut = data['receptor_rut']
monto_total: int = data['monto_total']
emisor_razon_social: str = data['emisor_razon_social']
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt']
fecha_reclamo_dt: Optional[datetime] = data['fecha_reclamo_dt']
except KeyError as exc:
raise ValueError("Programming error: a referenced field is missing.") from exc

Expand Down Expand Up @@ -1053,14 +1053,14 @@ def postprocess(self, data: dict, **kwargs: Any) -> dict:

def to_detalle_entry(self, data: dict) -> RcPendienteDetalleEntry:
try:
emisor_rut: Rut = data['emisor_rut'] # type: ignore
tipo_docto = data['tipo_docto'] # type: ignore
folio: int = data['folio'] # type: ignore
fecha_emision_date: date = data['fecha_emision_date'] # type: ignore
receptor_rut: Rut = data['receptor_rut'] # type: ignore
monto_total: int = data['monto_total'] # type: ignore
emisor_razon_social: str = data['emisor_razon_social'] # type: ignore
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt'] # type: ignore
emisor_rut: Rut = data['emisor_rut']
tipo_docto = data['tipo_docto']
folio: int = data['folio']
fecha_emision_date: date = data['fecha_emision_date']
receptor_rut: Rut = data['receptor_rut']
monto_total: int = data['monto_total']
emisor_razon_social: str = data['emisor_razon_social']
fecha_recepcion_dt: datetime = data['fecha_recepcion_dt']
except KeyError as exc:
raise ValueError("Programming error: a referenced field is missing.") from exc

Expand Down
16 changes: 8 additions & 8 deletions src/cl_sii/rtc/parse_aec.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def parse_xml_to_dict(xml_em: XmlElement) -> Mapping[str, object]:
# Validators
###########################################################################

_validate_rut = pydantic.field_validator( # type: ignore[pydantic-field]
_validate_rut = pydantic.field_validator(
'rut',
mode='before',
)(_validate_rut)
Expand Down Expand Up @@ -281,12 +281,12 @@ def parse_xml_to_dict(xml_em: XmlElement) -> Mapping[str, object]:
# Validators
###########################################################################

_empty_str_to_none = pydantic.field_validator( # type: ignore[pydantic-field]
_empty_str_to_none = pydantic.field_validator(
'nombre',
mode='before',
)(_empty_str_to_none)

_validate_rut = pydantic.field_validator( # type: ignore[pydantic-field]
_validate_rut = pydantic.field_validator(
'rut',
mode='before',
)(_validate_rut)
Expand Down Expand Up @@ -425,12 +425,12 @@ def as_dte_data_l1(self) -> cl_sii.dte.data_models.DteDataL1:
# Validators
###########################################################################

_validate_rut_emisor = pydantic.field_validator( # type: ignore[pydantic-field]
_validate_rut_emisor = pydantic.field_validator(
'rut_emisor',
mode='before',
)(_validate_rut)

_validate_rut_receptor = pydantic.field_validator( # type: ignore[pydantic-field]
_validate_rut_receptor = pydantic.field_validator(
'rut_receptor',
mode='before',
)(_validate_rut)
Expand Down Expand Up @@ -776,19 +776,19 @@ def parse_xml_to_dict(xml_em: XmlElement) -> Mapping[str, object]:
# Validators
###########################################################################

_empty_str_to_none = pydantic.field_validator( # type: ignore[pydantic-field]
_empty_str_to_none = pydantic.field_validator(
'nmb_contacto',
'fono_contacto',
'mail_contacto',
mode='before',
)(_empty_str_to_none)

_validate_rut_cedente = pydantic.field_validator( # type: ignore[pydantic-field]
_validate_rut_cedente = pydantic.field_validator(
'rut_cedente',
mode='before',
)(_validate_rut)

_validate_rut_cesionario = pydantic.field_validator( # type: ignore[pydantic-field]
_validate_rut_cesionario = pydantic.field_validator(
'rut_cesionario',
mode='before',
)(_validate_rut)
Expand Down
Loading