Skip to content

Commit

Permalink
Work around type assignment error
Browse files Browse the repository at this point in the history
Add a mypy ignore directive to TallyDoc.
Document all uses of this directive in a new issue.
  • Loading branch information
felddy committed Oct 15, 2024
1 parent 0f917ae commit fd82fe9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cyhy_db/models/cve_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CVEDoc(Document):

cvss_score: float = Field(ge=0.0, le=10.0)
cvss_version: CVSSVersion = Field(default=CVSSVersion.V3_1)
# See: https://github.com/cisagov/cyhy-db/issues/7
# CVE ID as a string
id: str = Indexed(primary_field=True) # type: ignore[assignment]
severity: int = Field(ge=1, le=4, default=1)
Expand Down
1 change: 1 addition & 0 deletions src/cyhy_db/models/host_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class HostDoc(Document):

model_config = ConfigDict(extra="forbid")

# See: https://github.com/cisagov/cyhy-db/issues/7
# IP address as an integer
id: int = Field(default_factory=int) # type: ignore[assignment]
ip: IPv4Address = Field(...)
Expand Down
1 change: 1 addition & 0 deletions src/cyhy_db/models/kev_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class KEVDoc(Document):

model_config = ConfigDict(extra="forbid")

# See: https://github.com/cisagov/cyhy-db/issues/7
id: str = Field(default_factory=str) # type: ignore[assignment]
known_ransomware: bool

Expand Down
1 change: 1 addition & 0 deletions src/cyhy_db/models/place_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PlaceDoc(Document):
county: Optional[str] = None
elevation_feet: Optional[int] = None
elevation_meters: Optional[int] = None
# See: https://github.com/cisagov/cyhy-db/issues/7
# GNIS FEATURE_ID (INCITS 446-2008) - https://geonames.usgs.gov/domestic/index.html
id: int = Field(default_factory=int) # type: ignore[assignment]
latitude_dec: float
Expand Down
1 change: 1 addition & 0 deletions src/cyhy_db/models/request_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class RequestDoc(Document):
agency: Agency
children: List[Link["RequestDoc"]] = Field(default=[])
enrolled: datetime = Field(default_factory=utcnow)
# See: https://github.com/cisagov/cyhy-db/issues/7
id: str = Field(default=BOGUS_ID) # type: ignore[assignment]
init_stage: Stage = Field(default=Stage.NETSCAN1)
key: Optional[str] = Field(default=None)
Expand Down
4 changes: 3 additions & 1 deletion src/cyhy_db/models/tally_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class TallyDoc(Document):
model_config = ConfigDict(extra="forbid")

counts: Counts = Field(default_factory=Counts)
id: str # owner_id
# See: https://github.com/cisagov/cyhy-db/issues/7
# Owner ID string
id: str # type: ignore[assignment]
last_change: datetime = Field(default_factory=utcnow)

@before_event(Insert, Replace, ValidateOnSave)
Expand Down

0 comments on commit fd82fe9

Please sign in to comment.