Legislation¶
Codes¶
A code of legislation.
Could be a constitution, code of statutes, code of regulations, or collection of court rules.
Each instance of this class depends on an XML file containing the code, so every new XML format will require adding a method to this class to ingest it.
- Parameters
xml – A BeautifulSoup object created by parsing the
Code
’s XML filetitle (
str
) – A name for theCode
that may have been found in an XMLtitle
element. For larger codes like the United States Code, this should identify the title number, and theCode
object will contain text only from that title.uri (
str
) – The United States Legislative Markup (USLM) identifier that describes the document as a whole, if available. Otherwise, should be a pseudo-USLM identifier.
Link an entire XML tree to the Code.
Get string representing the jurisdiction from within
uri
.- Return type
- Returns
The abbreviation for the jurisdiction that enacted the
Code
, in USLM-like format.e.g.
us
for U.S. federal laws,us-ca
for California state laws.
Get level of legislation for this Code, e.g. “statute”.
- Return type
- Returns
“constitution”, “statute”, or “regulation”
Find integer indices for the quoted text.
- Return type
Optional
[TextPositionSelector
]- Returns
A
TextPositionSelector
containing the lower and upper bounds of the text passage quoted inself.selector.exact
within the XML section referenced inself.selector.path
.
Give effective date for a provision within the Code.
- Return type
Use
source
to find text forexact
parameter.
Remove Code identifier from path to get a path relative to the document.
- Return type
Get sections identified by a path, if present in the
Code
.
Get the text of legislative sections from XML elements.
Get the text of legislative sections from a path identifier.
Select text as interval of section identified by path.
If
path
parameter is not given, selects an interval from the wholeCode
.
Get text from the
Code
using aTextQuoteSelector
.- Parameters
selector (
Optional
[TextQuoteSelector
]) – a selector referencing a text passage in theCode
.
Note
When handling Code of Federal Regulation (CFR)
Enactment
s, this can only select from the whole document or from Sections, not Subsections or any other level. Still hoping to be able to switch to a United States Legislative Markup (USLM)-like XML format for CFR.
Return repr(self).
Return str(self).
list of weak references to the object (if defined)
Enactments¶
A passage of legislative text.
May be used as support for a
Rule
. To retrieve the text, there needs to be an available method for identifying the correct XML element based on the section and subsection names, and each XML format used for anyCode
will require a different method.- Parameters
selector (Optional[Union[TextQuoteSelector, TextPositionSelector]]) – identifier for the section of a
Code
where the text can be found.selector – identifier for the part of the section being cited
code (Optional[Code]) – the
Code
where this legislative text appears.name (Optional[str]) – an identifier for this object, often used if the object needs to be referred to multiple times in the process of composing other
Factor
objects.
Give effective date for the
Enactment
.- Returns
the effective date of the text in this passage. Currently works only for the US Constitution.
Return
TextPositionSelector
for cited part of the Enactment section.
Get passage from self’s Code with self’s TextQuoteSelector.
- Returns
the full text of the cited passage from the XML.
Find whether meaning of
self
is equivalent to that ofother
.Self
must be neither broader nor narrower thanother
, which means it must contain the same legislative text in the sameCode
from the sameJurisdiction
Note
You could always make the result
False
by comparing longer passages of text until you found a difference between the two sites in the text. Does this undercut the usefulness of themeans
method?
Return str(self).
Tells whether
self
impliesother
.Note
Why does this method not require the same
code.sovereign
andcode.level
, especially considering thatmeans()
does?- Returns
Whether
self
“implies”other
, which in this context means whetherself
contains at least all the same text asother
.
Test whether
self
impliesother
without having same meaning.- Return type
list of weak references to the object (if defined)