Skip to content

Commit

Permalink
Revert "Update to Pydantic 2.0; temporarily disable rstcheck."
Browse files Browse the repository at this point in the history
This reverts commit bb67741.
  • Loading branch information
zschira committed Aug 17, 2023
1 parent 7188fad commit c8a888a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/ferc_xbrl_extractor/arelle_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
9 changes: 4 additions & 5 deletions src/ferc_xbrl_extractor/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -20,7 +20,7 @@ class Period(BaseModel):
"""

instant: bool
start_date: str | None = None
start_date: str | None
end_date: str

@classmethod
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion src/ferc_xbrl_extractor/taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}

#######################################################################################
Expand All @@ -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

#######################################################################################
Expand Down

0 comments on commit c8a888a

Please sign in to comment.