ds-caselaw-marklogic-api-client 37.3.0__py3-none-any.whl → 37.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -229,7 +229,7 @@ class Document:
229
229
  return []
230
230
 
231
231
  @cached_property
232
- def versions_as_documents(self) -> list[Any]:
232
+ def versions_as_documents(self) -> list["Document"]:
233
233
  """
234
234
  Returns a list of `Document` subclasses corresponding to the versions of the document. The first entry is:
235
235
  * the most recent
@@ -3,23 +3,22 @@ from typing import TypedDict
3
3
 
4
4
  from requests_toolbelt.multipart.decoder import BodyPart
5
5
 
6
- VERSION_REGEX = r"xml_versions/(\d{1,10})-(\d{1,10}|TDR)"
7
- # Here we limit the number of digits in the version and document reference to 10 on purpose, see
8
- # https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS for an explanation of why.
6
+ from caselawclient.types import DocumentURIString, MarkLogicDocumentURIString
9
7
 
10
- akn_namespace = {"akn": "http://docs.oasis-open.org/legaldocml/ns/akn/3.0"}
11
- uk_namespace = {"uk": "https://caselaw.nationalarchives.gov.uk/akn"}
8
+ VERSION_REGEX = r"xml_versions/(\d{1,10})-"
9
+ # Here we limit the number of digits in the version to 10 on purpose, see
10
+ # https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS for an explanation of why.
12
11
 
13
12
 
14
13
  class VersionsDict(TypedDict):
15
- uri: str ## TODO: This should be either a MarkLogicDocumentURIString (raw from ML) or a DocumentURIString (and we parse it out). Just a str is too vague.
14
+ uri: DocumentURIString
16
15
  version: int
17
16
 
18
17
 
19
18
  def render_versions(decoded_versions: list[BodyPart]) -> list[VersionsDict]:
20
19
  versions: list[VersionsDict] = [
21
20
  {
22
- "uri": part.text.strip("/").rstrip(".xml"),
21
+ "uri": MarkLogicDocumentURIString(part.text).as_document_uri(),
23
22
  "version": extract_version(part.text),
24
23
  }
25
24
  for part in decoded_versions
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ds-caselaw-marklogic-api-client
3
- Version: 37.3.0
3
+ Version: 37.3.1
4
4
  Summary: An API client for interacting with the underlying data in Find Caselaw.
5
5
  Home-page: https://github.com/nationalarchives/ds-caselaw-custom-api-client
6
6
  Keywords: national archives,caselaw
@@ -7,7 +7,7 @@ caselawclient/errors.py,sha256=JC16fEGq_MRJX-_KFzfINCV2Cqx8o6OWOt3C16rQd84,3142
7
7
  caselawclient/factories.py,sha256=XgrnG61hAJ-ty61DLv2qNEAo9ITuDZowZ4MRmPrf2Bg,7109
8
8
  caselawclient/identifier_resolution.py,sha256=B5I1sD7o7YjzsXMECjbKjgiGLDda5bGhejsJ-lYpTIg,2429
9
9
  caselawclient/models/__init__.py,sha256=kd23EUpvaC7aLHdgk8farqKAQEx3lf7RvNT2jEatvlg,68
10
- caselawclient/models/documents/__init__.py,sha256=4o6-8Iy5ZA8KEaqOt8xkpbqc7vwOzm8IoHvI8897mPk,19460
10
+ caselawclient/models/documents/__init__.py,sha256=zDrR6XniqB6S2BkNJH8KfvPz-RCBjPVG_N6eJkJiIlA,19467
11
11
  caselawclient/models/documents/body.py,sha256=IVcuSbgA7SvCvii_VE8MZy_54enDZY8VPoESkUDgfKU,6114
12
12
  caselawclient/models/documents/exceptions.py,sha256=Mz1P8uNqf5w6uLnRwJt6xK7efsVqtd5VA-WXUUH7QLk,285
13
13
  caselawclient/models/documents/statuses.py,sha256=Cp4dTQmJOtsU41EJcxy5dV1841pGD2PNWH0VrkDEv4Q,579
@@ -23,7 +23,7 @@ caselawclient/models/judgments.py,sha256=r40irgdEID-NeSNLm3OUdUBznMpRSwjD2SJrGlB
23
23
  caselawclient/models/neutral_citation_mixin.py,sha256=jAac3PPuWyPdj9N-n-U_JfwkbgbSIXaqFVQahfu95do,2086
24
24
  caselawclient/models/parser_logs.py,sha256=30kF4w0GcowiMIFtymUkl7ZARanNh_PjDpJZezn-cA8,315
25
25
  caselawclient/models/press_summaries.py,sha256=PIq9RceZ7n7Z079tESfxhQbfxCmtTc2V2OeFtcn594s,2144
26
- caselawclient/models/utilities/__init__.py,sha256=u3yIhbTjFQ1JJyAm5wsMEBswWl4t6Z7UMORF5FqC2xQ,1257
26
+ caselawclient/models/utilities/__init__.py,sha256=LPhyrQwLKc5tIJUO8Bysn9wCiR6Z6jMMTksjOV4JH9U,1041
27
27
  caselawclient/models/utilities/aws.py,sha256=NTF2W2aNgbO72e5WklXZC2U2_GPbVeynjTS1Nqu6DcE,8561
28
28
  caselawclient/models/utilities/dates.py,sha256=WwORxVjUHM1ZFcBF6Qtwo3Cj0sATsnSECkUZ6ls1N1Q,492
29
29
  caselawclient/models/utilities/move.py,sha256=MXdUqkSiyqRb8YKs_66B6ICWn8EWM6DiJV95fuJO1Us,3610
@@ -83,7 +83,7 @@ caselawclient/xquery/validate_document.xqy,sha256=PgaDcnqCRJPIVqfmWsNlXmCLNKd21q
83
83
  caselawclient/xquery/xslt.xqy,sha256=w57wNijH3dkwHkpKeAxqjlghVflQwo8cq6jS_sm-erM,199
84
84
  caselawclient/xquery/xslt_transform.xqy,sha256=cccaFiGkCcvSfDv007UriZ3I4ak2nTLP1trRZdbOoS8,2462
85
85
  caselawclient/xquery_type_dicts.py,sha256=zuyDGTkcN6voOXCm3APXItZ-Ey6tZ2hdZummZWzjl50,6489
86
- ds_caselaw_marklogic_api_client-37.3.0.dist-info/LICENSE.md,sha256=fGMzyyLuQW-IAXUeDSCrRdsYW536aEWThdbpCjo6ZKg,1108
87
- ds_caselaw_marklogic_api_client-37.3.0.dist-info/METADATA,sha256=SBFGKzyXMVM2TbhCofHTIMGJ5O9MLDHjfh-3V4aupk4,4206
88
- ds_caselaw_marklogic_api_client-37.3.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
89
- ds_caselaw_marklogic_api_client-37.3.0.dist-info/RECORD,,
86
+ ds_caselaw_marklogic_api_client-37.3.1.dist-info/LICENSE.md,sha256=fGMzyyLuQW-IAXUeDSCrRdsYW536aEWThdbpCjo6ZKg,1108
87
+ ds_caselaw_marklogic_api_client-37.3.1.dist-info/METADATA,sha256=RzqWJC6SHrgrCLLOl4aRL8Th3lhaycwYMR8uATPDZeg,4206
88
+ ds_caselaw_marklogic_api_client-37.3.1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
89
+ ds_caselaw_marklogic_api_client-37.3.1.dist-info/RECORD,,