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
4 changes: 2 additions & 2 deletions cl_sii/libs/csv_utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import csv
from typing import IO, Sequence, Type, Union
from typing import IO, Optional, Sequence, Type, Union


def create_csv_dict_reader(
text_stream: IO[str],
csv_dialect: Type[csv.Dialect],
row_dict_extra_fields_key: Union[str, None] = None,
expected_fields_strict: bool = True,
expected_field_names: Sequence[str] = None,
expected_field_names: Optional[Sequence[str]] = None,
) -> csv.DictReader:
"""
Create a CSV dict reader with custom options.
Expand Down
4 changes: 2 additions & 2 deletions cl_sii/libs/mm_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import date, datetime
from typing import Any, Union
from typing import Any, Optional, Union

import marshmallow
import marshmallow.fields
Expand Down Expand Up @@ -83,7 +83,7 @@ class CustomMarshmallowDateField(marshmallow.fields.Field):
'format': '"{input}" cannot be formatted as a date.',
}

def __init__(self, format: str = None, **kwargs: Any) -> None:
def __init__(self, format: Optional[str] = None, **kwargs: Any) -> None:
"""Constructor.

:param format: Either ``"iso"`` (for ISO-8601) or a date format str.
Expand Down
10 changes: 5 additions & 5 deletions cl_sii/libs/rows_processing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csv
import logging
from typing import Dict, Iterable, Sequence, Tuple
from typing import Dict, Iterable, Optional, Sequence, Tuple

import marshmallow

Expand All @@ -24,8 +24,8 @@ def csv_rows_mm_deserialization_iterator(
csv_reader: csv.DictReader,
row_schema: marshmallow.Schema,
n_rows_offset: int = 0,
max_n_rows: int = None,
fields_to_remove_names: Sequence[str] = None,
max_n_rows: Optional[int] = None,
fields_to_remove_names: Optional[Sequence[str]] = None,
) -> Iterable[Tuple[int, Dict[str, object], Dict[str, object], dict]]:
"""
Marshmallow deserialization iterator over CSV rows.
Expand Down Expand Up @@ -78,8 +78,8 @@ def rows_mm_deserialization_iterator(
rows_iterator: Iterable[Dict[str, object]],
row_schema: marshmallow.Schema,
n_rows_offset: int = 0,
max_n_rows: int = None,
fields_to_remove_names: Sequence[str] = None,
max_n_rows: Optional[int] = None,
fields_to_remove_names: Optional[Sequence[str]] = None,
) -> Iterable[Tuple[int, Dict[str, object], Dict[str, object], dict]]:
"""
Marshmallow deserialization iterator.
Expand Down
12 changes: 6 additions & 6 deletions cl_sii/rcv/parse_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def parse_rcv_venta_csv_file(
rut: Rut,
input_file_path: str,
n_rows_offset: int = 0,
max_n_rows: int = None,
max_n_rows: Optional[int] = None,
) -> Iterable[Tuple[Optional[RvDetalleEntry], int, Dict[str, object], Dict[str, object]]]:
"""
Parse entries from an RV ("Registro de Ventas") (CSV file).
Expand Down Expand Up @@ -199,7 +199,7 @@ def parse_rcv_compra_registro_csv_file(
rut: Rut,
input_file_path: str,
n_rows_offset: int = 0,
max_n_rows: int = None,
max_n_rows: Optional[int] = None,
) -> Iterable[Tuple[Optional[RcRegistroDetalleEntry], int, Dict[str, object], Dict[str, object]]]:
"""
Parse entries from an RC ("Registro de Compras") / "registro" (CSV file).
Expand Down Expand Up @@ -280,7 +280,7 @@ def parse_rcv_compra_no_incluir_csv_file(
rut: Rut,
input_file_path: str,
n_rows_offset: int = 0,
max_n_rows: int = None,
max_n_rows: Optional[int] = None,
) -> Iterable[Tuple[Optional[RcNoIncluirDetalleEntry], int, Dict[str, object], Dict[str, object]]]:
"""
Parse entries from an RC ("Registro de Compras") / "no incluir" (CSV file).
Expand Down Expand Up @@ -355,7 +355,7 @@ def parse_rcv_compra_reclamado_csv_file(
rut: Rut,
input_file_path: str,
n_rows_offset: int = 0,
max_n_rows: int = None,
max_n_rows: Optional[int] = None,
) -> Iterable[Tuple[Optional[RcReclamadoDetalleEntry], int, Dict[str, object], Dict[str, object]]]:
"""
Parse entries from an RC ("Registro de Compras") / "reclamado" (CSV file).
Expand Down Expand Up @@ -430,7 +430,7 @@ def parse_rcv_compra_pendiente_csv_file(
rut: Rut,
input_file_path: str,
n_rows_offset: int = 0,
max_n_rows: int = None,
max_n_rows: Optional[int] = None,
) -> Iterable[Tuple[Optional[RcPendienteDetalleEntry], int, Dict[str, object], Dict[str, object]]]:
"""
Parse entries from an RC ("Registro de Compras") / "pendiente" (CSV file).
Expand Down Expand Up @@ -1131,7 +1131,7 @@ def _parse_rcv_csv_file(
fields_to_remove_names: Sequence[str],
input_file_path: str,
n_rows_offset: int,
max_n_rows: int = None,
max_n_rows: Optional[int] = None,
) -> Iterable[Tuple[Optional[RcvDetalleEntry], int, Dict[str, object], Dict[str, object]]]:
"""
Parse entries from an RC or RV (CSV file).
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ codecov==2.1.12
coverage==6.5.0
flake8==4.0.1
isort==5.10.1
mypy==0.982
mypy==0.991
tox==3.25.1
twine==3.1.1
wheel==0.38.4
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ keyring==21.4.0
# via twine
mccabe==0.6.1
# via flake8
mypy==0.982
mypy==0.991
# via -r requirements-dev.in
mypy-extensions==0.4.3
# via
Expand Down