Enactments¶
- class legislice.enactments.Enactment(**data)¶
Base class for Enactments.
Whether connected to subnodes by linking, or nesting.
- Parameters
node – identifier for the site where the provision is codified
heading – full heading of the provision
text_version – full text content at this node, even if not all of it is cited
start_date – date when the text was enacted at the cited location
known_revision_date – whether the “start_date” field is known to be a date when the provision was revised in the code where it was publised. If False, then the Enactment refers to a time range when the text was codified, without asserting that the Enactment was not codified at earlier dates. This field is useful when working from incomplete legislative records.
end_date – date when the text was removed from the cited location
first_published – date when this Enactment’s code was first published.
earliest_in_db – date of the earliest version of this Enactment in the database. Used to determine whether the start_date of the Enactment is a date when the Enactment was amended or first published.
anchors – a list of selectors representing the part of some other document (e.g. an Opinion) that references the Enactment. Unlike the selection field, it doesn’t reference part of the Enactment itself. For use as a temporary place to store the anchors until they can be moved over to the citing document.
name – a user-assigned label for the object
- property code¶
Get “code” part of node identifier.
- convert_quotes_to_position(quotes)¶
Convert quote selector to the corresponding position selector for this Enactment.
- Return type
- convert_selection_to_set(selection)¶
Create a TextPositionSet from a different selection method.
- Return type
- cross_references()¶
Return all cross-references from this node and subnodes.
- Return type
- csl_json()¶
Serialize a citation to this provision in Citation Style Language JSON.
Experimental feature. This CSL-JSON format currently only identifies the cited provision down to the section level. A citation to a subsection or deeper nested provision will be the same as a citation to its parent section.
See https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html for a guide to this CSL-JSON format.
- Return type
- get_identifier_part(index)¶
Get a part of the split node identifier, by number.
- get_string(selection)¶
Use text selector to get corresponding string from Enactment.
- Return type
- property is_federal¶
Check if self is from a federal jurisdiction.
- property jurisdiction¶
Get “sovereign” part of node identifier.
- property known_revision_date: bool¶
Determine if Enactment’s start_date reflects its last revision date.
If not, then the start_date merely reflects the earliest date that versions of the
Enactment
's code exist in the database.- Return type
- property level: legislice.citations.CodeLevel¶
Get level of code for this Enactment, e.g. “statute” or “regulation”.
- Return type
- limit_selection(selection, start=0, end=None)¶
Limit selection to the range defined by start and end points.
- Return type
- limit_selection_to_current_node(selection)¶
Limit selection to the current node.
- Return type
- make_selection(selection=True, start=0, end=None)¶
Make a TextPositionSet for specified text in this Enactment.
- Return type
- make_selection_of_all_text()¶
Return a TextPositionSet of all text in this Enactment.
- Return type
- make_selection_of_this_node()¶
Return a TextPositionSet of the text at this node, not child nodes.
- Return type
- classmethod make_text_version_from_str(value)¶
Allow content to be used to populate text_version.
- Return type
Optional
[TextVersion
]
- property nested_children¶
Get nested children attribute.
- property padded_length¶
Get length of self’s content plus one character for space before next section.
- raise_error_for_extra_selector(selection)¶
Raise an error if any passed selectors begin after the end of the text passage.
- Return type
- rangedict()¶
Return a RangeDict matching text spans to Enactment attributes.
- Return type
RangeDict
- property section¶
Get “section” part of node identifier.
- select(selection=True, start=0, end=None)¶
Select text from Enactment.
- Return type
- select_all()¶
Return a passage for this Enactment, including all subnodes.
- Return type
- property sovereign¶
Get “sovereign” part of node identifier.
- property text¶
Get all text including subnodes, regardless of which text is “selected”.
- text_sequence(include_nones=True)¶
Get a sequence of text passages for this provision and its subnodes.
- Return type
- property title¶
Get “title” part of node identifier.
- tree_selection()¶
Return set of selectors for selected text in this provision and its children.
- Return type
- class legislice.enactments.EnactmentPassage(**data)¶
An Enactment with selectors indicating which text is being referenced.
- as_quotes()¶
Return quote selectors for the selected text.
- Return type
- property child_passages: List[legislice.enactments.EnactmentPassage]¶
Return a list of EnactmentPassages for this Enactment’s children.
- Return type
- property code¶
Get “code” part of node identifier.
- property end_date¶
Get the earliest end date of any provision version included in the passage.
- property is_federal¶
Check if self is from a federal jurisdiction.
- property jurisdiction¶
Get “sovereign” part of node identifier.
- property level: legislice.citations.CodeLevel¶
Get level of code for this Enactment, e.g. “statute” or “regulation”.
- Return type
- limit_selection(start=0, end=None)¶
Limit selection to the range defined by start and end points.
- Return type
- means(other)¶
Find whether meaning of
self
is equivalent to that ofother
.Self
must be neither broader nor narrower thanother
to return True.
- property node¶
Get the node that this Enactment is from.
- property section¶
Get “section” part of node identifier.
- select_more_text_at_current_node(added_selection)¶
Select more text at this Enactment’s node, not in child nodes.
- Return type
- select_more_text_from_changed_version(other)¶
Select more text from a different text version at the same citation path.
- Parameters
other (
EnactmentPassage
) – AnEnactment
representing different text enacted at a different time, at the same node (or USLM path citation) as self. This Element’snode
attribute must be the same string as self’s node attribute. It’s not sufficient for other to have an Enactment listed in its_children
attribute with the same node attribute, or for other to have the same node attribute as an ancestor of self.- Return type
- select_more_text_in_current_branch(added_selection)¶
Select more text within this Enactment’s tree_selection, including child nodes.
- Return type
- selected_text()¶
Return this provision’s text that is within the ranges described by self.selection.
Based on creating an
anchorpoint.textsequences.TextSequence
from this Enactment’s text content and the ranges in its selection attribute.- Return type
- property sovereign¶
Get “sovereign” part of node identifier.
- property start_date¶
Get the latest start date of any provision version included in the passage.
- property text¶
Get all text including subnodes, regardless of which text is “selected”.
- text_sequence(include_nones=True)¶
List the phrases in the Enactment selected by TextPositionSelectors.
- Parameters
include_nones (
bool
) – Whether the list of phrases should include None to indicate a block of unselected text- Return type
- property title¶
Get “title” part of node identifier.
- class legislice.enactments.CrossReference(**data)¶
A legislative provision’s citation to another provision.
- Parameters
target_uri – the path to the target provision from the document root.
target_url – the URL to fetch the target provision from an API.
reference_text – The text in the citing provision that represents the cross-reference. Generally, this text identifies the target provision.
target_node – an identifier for the target URI in the API.
- class legislice.enactments.InboundReference(**data)¶
A memo that a TextVersion has a citation to a specified target provision.
- latest_location()¶
Get most recent location where the citing text has been enacted.
- Return type
- classmethod search_citations_for_reference_text(values)¶
Get reference_text field from nested “citations” model.
- Return type
- class legislice.enactments.CitingProvisionLocation(**data)¶
Memo indicating where an Enactment can be downloaded.
- Parameters
node – location of the citing provision in a legislative code
start_date – start date of the citing version of the provision
heading – heading text for the citing provision
- legislice.enactments.consolidate_enactments(enactments)¶