Skip to content

Commit

Permalink
Merge pull request #189 from nationalarchives/chore/more-typing
Browse files Browse the repository at this point in the history
fix(courts): add additional type statements for stricter behaviour of courts repository
  • Loading branch information
jacksonj04 authored Oct 1, 2024
2 parents 7771f37 + 2b777e4 commit a38448d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ds_caselaw_utils/courts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class Jurisdiction:
def __init__(self, data: RawJurisdiction):
self.code: JurisdictionCode = JurisdictionCode(data["code"])
self.name = data["name"]
self.name: str = data["name"]
self.prefix: Optional[str] = data.get("prefix")


Expand Down Expand Up @@ -126,15 +126,15 @@ class CourtNotFoundException(Exception):

class CourtsRepository:
def __init__(self, data: RawCourtRepository):
self._data = data
self._byParam = {}
self._byCode = {}
self._data: RawCourtRepository = data
self._byParam: dict[CourtParam, Court] = {}
self._byCode: dict[CourtCode, Court] = {}
for group in self._data:
for courtData in group.get("courts", []):
court = Court(courtData)
if "param" in courtData:
self._byParam[courtData.get("param")] = court
self._byCode[courtData["code"]] = court
self._byParam[CourtParam(courtData["param"])] = court
self._byCode[CourtCode(courtData["code"])] = court

def get_by_param(self, param: CourtParam) -> Court:
try:
Expand Down

0 comments on commit a38448d

Please sign in to comment.