Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-dxw committed Sep 26, 2024
1 parent 53008e9 commit eece465
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/ds_caselaw_utils/courts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,27 @@

class Jurisdiction:
def __init__(self, data):
self.code = data["code"]
self.code: JurisdictionCode = data["code"]
self.name = data["name"]
self.prefix = data.get("prefix")
self.prefix: str = data.get("prefix")


class Court:
def __init__(self, data) -> None:
self.code: CourtCode = CourtCode(data["code"])
self.name: str = data["name"]
self.grouped_name = data.get("grouped_name") or data["name"]
self.grouped_name: str = data.get("grouped_name") or data["name"]
self.link: str = data["link"]
self.ncn = data.get("ncn")
self.ncn: Optional[str] = data.get("ncn")
self.canonical_param: CourtParam = CourtParam(data.get("param"))
self.param_aliases: list[CourtParam] = [CourtParam(data.get("param"))] + (
[CourtParam(extra_param) for extra_param in data.get("extra_params")] or []
)
self.start_year = data.get("start_year")
self.end_year = data.get("end_year") or date.today().year
self.jurisdictions = [Jurisdiction(jurisdiction_data) for jurisdiction_data in data.get("jurisdictions", [])]
self.start_year: Optional[int] = data.get("start_year")
self.end_year: int = data.get("end_year") or date.today().year
self.jurisdictions: list[Jurisdiction] = [
Jurisdiction(jurisdiction_data) for jurisdiction_data in data.get("jurisdictions", [])
]

def get_jurisdiction(self, code: str) -> Optional[Jurisdiction]:
return next((j for j in self.jurisdictions if j.code == code), None)
Expand Down Expand Up @@ -70,7 +72,7 @@ def link(self) -> str:
return self.court.link

@property
def ncn(self):
def ncn(self) -> Optional[str]:
return self.court.ncn

@property
Expand All @@ -82,15 +84,15 @@ def param_aliases(self) -> list[CourtParam]:
return self.court.param_aliases

@property
def start_year(self) -> int:
def start_year(self) -> Optional[int]:
return self.court.start_year

@property
def end_year(self) -> int:
return self.court.end_year

@property
def jurisdiction_prefix(self):
def jurisdiction_prefix(self) -> Optional[str]:
return self.jurisdiction.prefix


Expand Down

0 comments on commit eece465

Please sign in to comment.