Readers¶
Converting simple structured data from XML or JSON into authorityspoke objects.
These functions will usually be called by functions from the io.loaders module after they import some data from a file.
Lists
Holding
objects with corresponding text selectors.Alias for field number 0
Alias for field number 1
Alias for field number 2
Get text anchors out of an index of terms or enactments.
Load a list of Holdings from JSON, with text links.
- Parameters
record (
Dict
[str
,Union
[List
[Dict
[str
,Union
[Dict
[str
,Union
[Dict
[str
,Sequence
[Dict
[str
,Union
[Dict
[str
,Union
[str
,bool
]],Sequence
[Any
],str
,bool
]]]],Sequence
[RawEnactment
],str
,bool
]],str
,bool
]]],List
[Union
[str
,Dict
[str
,str
]]]]]) – a list of dicts representing holdings, in the JSON input formatclient (
Optional
[Client
]) – Legislice client for downloading missing fields from record
- Return type
- Returns
a namedtuple listing
Holding
objects with a list matchingHolding
s to selectors and an index matchingFactor
s to selectors.
Expand fields of Factor from index of mentioned factors.
Expand a list of names into a list of factors.
Expand a list of enactments into a list of dicts.
- Parameters
record (
List
[Union
[str
,RawEnactment
]]) – a list of enactments, either as strings or dictsenactment_index (
Mentioned
) – a dict of names to enactments
- Return type
- Returns
a list of dicts representing enactments
Traverse tree of dicts and lists, and modify each node.
Expand one holding from index of expanded terms and enactments.
Expand holdings from index of expanded terms and enactments.
Load a list of Holdings from JSON, with text links.
- Parameters
record (
List
[Dict
[str
,Union
[Dict
[str
,Union
[Dict
[str
,Sequence
[Dict
[str
,Union
[Dict
[str
,Union
[str
,bool
]],Sequence
[Any
],str
,bool
]]]],Sequence
[RawEnactment
],str
,bool
]],str
,bool
]]]) – a list of dicts representing holdings, in the JSON input formatclient (
Optional
[Client
]) – Legislice client for downloading missing fields from record
- Return type
Tuple
[List
[Holding
],List
[EnactmentWithAnchors
],List
[TermWithAnchors
],List
[Dict
[str
,str
]]]- Returns
a tuple of four objects containing holdings, terms, enactments, and anchors.
Load a list of
Holdings
s from JSON.- Parameters
record (
List
[Dict
[str
,Union
[Dict
[str
,Union
[Dict
[str
,Sequence
[Dict
[str
,Union
[Dict
[str
,Union
[str
,bool
]],Sequence
[Any
],str
,bool
]]]],Sequence
[RawEnactment
],str
,bool
]],str
,bool
]]]) – a list of dicts representing holdings, in the JSON input format- Parame regime
A collection of
Jurisdiction
s and theCode
s that have been enacted in each. Used for constructingEnactment
s referenced byHolding
s.- Return type
- Returns
a list of
Holding
objects
Create and return a
Decision
from a dict API response.Relies on the JSON format from the Caselaw Access Project API.
- Parameters
decision_dict – A dict created from a Caselaw Access Project API response.
- Return type