diff --git a/pyproject.toml b/pyproject.toml index 0c01071..cd7e0d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ requires-python = ">=3.10,<3.12" dynamic = ["version"] license = {file = "LICENSE.txt"} dependencies = [ - "pydantic>=1,<2", + "pydantic>=1.9,<3", "coloredlogs>=14.0,<15.1", "arelle-release>=2.3,<2.13", "frictionless>=4.4,<5", @@ -84,8 +84,8 @@ tests = [ "pytest>=6.2,<7.5", # Our testing framework "pytest-console-scripts>=1.1,<1.5", # Allow automatic testing of scripts "pytest-cov>=2.10,<4.2", # Pytest plugin for working with coverage - #"rstcheck[sphinx]>=5.0,<6.2", # ReStructuredText linter - "tox>=4.0,<4.9", # Python test environment manager + "rstcheck[sphinx]>=5.0,<6.2", # ReStructuredText linter + "tox>=4.0,<4.7", # Python test environment manager ] types = [ "types-setuptools", diff --git a/src/ferc_xbrl_extractor/arelle_interface.py b/src/ferc_xbrl_extractor/arelle_interface.py index dcc97ec..473d7ce 100644 --- a/src/ferc_xbrl_extractor/arelle_interface.py +++ b/src/ferc_xbrl_extractor/arelle_interface.py @@ -88,7 +88,7 @@ class Metadata(BaseModel): name: str references: References calculations: list[Calculation] - balance: Literal["credit", "debit"] | None = None + balance: Literal["credit", "debit"] | None @classmethod def from_concept(cls, concept: ModelConcept) -> "Metadata": diff --git a/src/ferc_xbrl_extractor/instance.py b/src/ferc_xbrl_extractor/instance.py index ab91b8d..a318d48 100644 --- a/src/ferc_xbrl_extractor/instance.py +++ b/src/ferc_xbrl_extractor/instance.py @@ -6,7 +6,7 @@ import stringcase from lxml import etree # nosec: B410 from lxml.etree import _Element as Element # nosec: B410 -from pydantic import BaseModel, field_validator +from pydantic import BaseModel, validator XBRL_INSTANCE = "http://www.xbrl.org/2003/instance" @@ -20,7 +20,7 @@ class Period(BaseModel): """ instant: bool - start_date: str | None = None + start_date: str | None end_date: str @classmethod @@ -61,8 +61,7 @@ class Axis(BaseModel): value: str = "" dimension_type: DimensionType - @field_validator("name", mode="before") # type: ignore - @classmethod + @validator("name", pre=True) # type: ignore def strip_prefix(cls, name: str): # noqa: N805 """Strip XML prefix from name.""" return name.split(":")[1] if ":" in name else name @@ -195,7 +194,7 @@ class Fact(BaseModel): name: str c_id: str - value: str | None = None + value: str | None @classmethod def from_xml(cls, elem: Element) -> "Fact": diff --git a/src/ferc_xbrl_extractor/taxonomy.py b/src/ferc_xbrl_extractor/taxonomy.py index 901ceef..ba4f598 100644 --- a/src/ferc_xbrl_extractor/taxonomy.py +++ b/src/ferc_xbrl_extractor/taxonomy.py @@ -80,7 +80,7 @@ class Concept(BaseModel): type_: XBRLType = pydantic.Field(alias="type") period_type: Literal["duration", "instant"] child_concepts: "list[Concept]" - metadata: Metadata | None = None + metadata: Metadata | None @classmethod def from_list(cls, concept_list: list, concept_dict: ConceptDict) -> "Concept": diff --git a/tox.ini b/tox.ini index 9355080..1cb09bd 100644 --- a/tox.ini +++ b/tox.ini @@ -67,12 +67,12 @@ skip_install = false extras = {[testenv:pre_commit]extras} {[testenv:bandit]extras} -# {[testenv:rstcheck]extras} + {[testenv:rstcheck]extras} {[testenv:flake8]extras} commands = {[testenv:pre_commit]commands} {[testenv:bandit]commands} -# {[testenv:rstcheck]commands} + {[testenv:rstcheck]commands} {[testenv:flake8]commands} ####################################################################################### @@ -91,11 +91,11 @@ description = Build the HTML docs from scratch using Sphinx. skip_install = false extras = {[testenv:doc8]extras} -# {[testenv:rstcheck]extras} + {[testenv:rstcheck]extras} commands = bash -c 'rm -rf docs/_build' {[testenv:doc8]commands} -# {[testenv:rstcheck]commands} + {[testenv:rstcheck]commands} sphinx-build -W -b html docs docs/_build/html #######################################################################################