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

as_citation()

Create Citation Style Language markup for the Enactment.

Return type

Citation

property code

Get “code” part of node identifier.

property content: str

Get text for this version of the Enactment.

Return type

str

convert_quotes_to_position(quotes)

Convert quote selector to the corresponding position selector for this Enactment.

Return type

TextPositionSet

convert_selection_to_set(selection)

Create a TextPositionSet from a different selection method.

Return type

TextPositionSet

cross_references()

Return all cross-references from this node and subnodes.

Return type

List[CrossReference]

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

str

get_identifier_part(index)

Get a part of the split node identifier, by number.

Return type

Optional[str]

get_string(selection)

Use text selector to get corresponding string from Enactment.

Return type

str

implies(other)

Test whether self has all the text passages of other.

Return type

bool

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

bool

property level: legislice.citations.CodeLevel

Get level of code for this Enactment, e.g. “statute” or “regulation”.

Return type

CodeLevel

limit_selection(selection, start=0, end=None)

Limit selection to the range defined by start and end points.

Return type

TextPositionSet

limit_selection_to_current_node(selection)

Limit selection to the current node.

Return type

TextPositionSet

make_selection(selection=True, start=0, end=None)

Make a TextPositionSet for specified text in this Enactment.

Return type

TextPositionSet

make_selection_of_all_text()

Return a TextPositionSet of all text in this Enactment.

Return type

TextPositionSet

make_selection_of_this_node()

Return a TextPositionSet of the text at this node, not child nodes.

Return type

TextPositionSet

classmethod make_text_version_from_str(value)

Allow content to be used to populate text_version.

Return type

Optional[TextVersion]

means(other)

Determine if self and other have identical text.

Return type

bool

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

None

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

EnactmentPassage

select_all()

Return a passage for this Enactment, including all subnodes.

Return type

EnactmentPassage

property sovereign

Get “sovereign” part of node identifier.

property span_length: int

Return the length of the span of this Enactment.

Return type

int

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

TextSequence

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

TextPositionSet

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

List[TextQuoteSelector]

property child_passages: List[legislice.enactments.EnactmentPassage]

Return a list of EnactmentPassages for this Enactment’s children.

Return type

List[EnactmentPassage]

clear_selection()

Deselect any Enactment text, including in child nodes.

Return type

None

property code

Get “code” part of node identifier.

property end_date

Get the earliest end date of any provision version included in the passage.

implies(other)

Test whether self has all the text passages of other.

Return type

bool

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

CodeLevel

limit_selection(start=0, end=None)

Limit selection to the range defined by start and end points.

Return type

None

means(other)

Find whether meaning of self is equivalent to that of other.

Self must be neither broader nor narrower than other to return True.

Return type

bool

Returns

whether self and other represent the same text issued by the same sovereign in the same level of Enactment.

property node

Get the node that this Enactment is from.

property section

Get “section” part of node identifier.

select(selection=True, start=0, end=None)

Select text from Enactment.

Return type

None

select_all()

Select all text of Enactment.

Return type

None

select_more(selection)

Select text, in addition to any previous selection.

Return type

None

select_more_text_at_current_node(added_selection)

Select more text at this Enactment’s node, not in child nodes.

Return type

None

select_more_text_from_changed_version(other)

Select more text from a different text version at the same citation path.

Parameters

other (EnactmentPassage) – An Enactment representing different text enacted at a different time, at the same node (or USLM path citation) as self. This Element’s node 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

None

select_more_text_in_current_branch(added_selection)

Select more text within this Enactment’s tree_selection, including child nodes.

Return type

None

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

str

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

TextSequence

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

CitingProvisionLocation

classmethod search_citations_for_reference_text(values)

Get reference_text field from nested “citations” model.

Return type

InboundReferenceDict

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)

Consolidate any overlapping Enactments in a list.

Parameters

enactments (Sequence[Union[Enactment, EnactmentPassage]]) – a list of Enactments that may include overlapping legislative text within the same section

Return type

List[EnactmentPassage]

Returns

a list of Enactments without overlapping text