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
filepath (
Union
[str
,Path
]) – the name of the file in theexample_data/codes
folder where the XML version of the code can be found.
Set
filepath
parameter as attribute.
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 identifier for the
Enactment
type found in thisCode
.- Return type
- Returns
“constitution”, “statute”, or “regulation”
Provide “title” identifier for the
Code
’s XML.- Return type
- Returns
the contents of an XML
title
element that describes theCode
, if any. Otherwise returns a descriptive name that may not exactly appear in the XML.
Build a URI for the
Code
based on its XML metadata.Note
This handles California state statutes only with a mockup, which can only refer to the Penal and Evidence Codes.
- Return type
- Returns
The United States Legislative Markup (USLM) identifier that describes the document as a whole, if available in the XML. Otherwise returns a pseudo-USLM identifier.
Get XML tree of legislative provisions.
- Returns
A BeautifulSoup object created by parsing the
Code
’s XML file
Convert
uri
to identifier for constitution sections.Although the US Constitution is published in a format described as USML, its section identifier strings differ from those in USC USML documents in that they skip the jurisdiction and code fields, skip the initial slash character, start with the section field, and convert all remaining slashes to hyphens.
This will only remove the path to the current code if the current code is the same one referenced in the URI. So the example below assumes the current
Code
object hasself.uri == "/us/const"
Give effective date for a provision within the
Code
.So far this method only covers the US Constitution and it assumes that the XML format is United States Legislative Markup (USLM).
- Parameters
cite (
Union
[TextQuoteSelector
,str
]) – a string or selector representing the XML element name for the the legislative provision within thisCode
.- Return type
- Returns
the effective date of the cited provision
Get a section from a USLM identifier if
self
is the US Constitution.
Get the text of the section identified by a path.
- Parameters
path (
str
) – a path string, in the format used forTextQuoteSelector
objects, to the section with the text to be returned.- Return type
- Returns
the text of a section of the
Code
.
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 (
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 (TextQuoteSelector) – identifier for the place in the
Code
where the text can be found.code (Optional[Code]) – the
Code
where this legislative text appears.regime (Optional[Regime]) – a
Regime
with aJurisdiction
that has enacted theCode
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.
Find integer indices for the quoted text.
Give effective date for the
Enactment
.- Returns
the effective date of the text in this passage. Currently works only for the US Constitution.
Get a passage from
self
’sCode
withself
’sTextQuoteSelector
.- 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)