moleg-api 0.1.0__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.
- moleg_api/__init__.py +133 -0
- moleg_api/errors.py +49 -0
- moleg_api/laws.py +7030 -0
- moleg_api/models.py +740 -0
- moleg_api/normalization.py +1688 -0
- moleg_api/py.typed +1 -0
- moleg_api/source.py +271 -0
- moleg_api-0.1.0.dist-info/METADATA +137 -0
- moleg_api-0.1.0.dist-info/RECORD +12 -0
- moleg_api-0.1.0.dist-info/WHEEL +5 -0
- moleg_api-0.1.0.dist-info/licenses/LICENSE +21 -0
- moleg_api-0.1.0.dist-info/top_level.txt +1 -0
moleg_api/__init__.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"""Public MOLEG-API interface."""
|
|
2
|
+
|
|
3
|
+
from .errors import (
|
|
4
|
+
AmbiguousLawError,
|
|
5
|
+
MolegApiError,
|
|
6
|
+
NoResultError,
|
|
7
|
+
ParseFailureError,
|
|
8
|
+
RateLimitError,
|
|
9
|
+
RetryExhaustedError,
|
|
10
|
+
SourceApiError,
|
|
11
|
+
UnsupportedFormatError,
|
|
12
|
+
)
|
|
13
|
+
from .laws import MolegApi
|
|
14
|
+
from .models import (
|
|
15
|
+
AdministrativeRuleArticleText,
|
|
16
|
+
AdministrativeRuleContext,
|
|
17
|
+
AdministrativeRuleHit,
|
|
18
|
+
AdministrativeRuleIdentity,
|
|
19
|
+
AdministrativeRuleText,
|
|
20
|
+
Ambiguity,
|
|
21
|
+
AnnexFormSource,
|
|
22
|
+
AnnexFormHit,
|
|
23
|
+
AnnexFormIdentity,
|
|
24
|
+
AnnexFormText,
|
|
25
|
+
AnnexSearchScope,
|
|
26
|
+
AnnexType,
|
|
27
|
+
ArticleContext,
|
|
28
|
+
ArticleReference,
|
|
29
|
+
ArticleText,
|
|
30
|
+
AuthorityContext,
|
|
31
|
+
Basis,
|
|
32
|
+
BundleBudget,
|
|
33
|
+
BundleMode,
|
|
34
|
+
BundleRequestMode,
|
|
35
|
+
BundleRequest,
|
|
36
|
+
CandidateContext,
|
|
37
|
+
CaseCourt,
|
|
38
|
+
ContextGap,
|
|
39
|
+
DeferredLookup,
|
|
40
|
+
DelegatedRule,
|
|
41
|
+
DelegationGraph,
|
|
42
|
+
HistoryEvent,
|
|
43
|
+
InterpretationHit,
|
|
44
|
+
InterpretationIdentity,
|
|
45
|
+
InterpretationSearchSource,
|
|
46
|
+
InterpretationText,
|
|
47
|
+
JudicialDecisionHit,
|
|
48
|
+
JudicialDecisionIdentity,
|
|
49
|
+
JudicialDecisionText,
|
|
50
|
+
FollowUpSearch,
|
|
51
|
+
LegalArticleCandidate,
|
|
52
|
+
LegalContextBundle,
|
|
53
|
+
LegalLawCandidate,
|
|
54
|
+
LegalQueryExpansion,
|
|
55
|
+
LegalTermCandidate,
|
|
56
|
+
LoadedContext,
|
|
57
|
+
LawDiff,
|
|
58
|
+
LawDiffChange,
|
|
59
|
+
LawHit,
|
|
60
|
+
LawHistory,
|
|
61
|
+
LawIdentity,
|
|
62
|
+
LawStructure,
|
|
63
|
+
LawStructureNode,
|
|
64
|
+
LawText,
|
|
65
|
+
SupplementaryProvision,
|
|
66
|
+
StructuredTableData,
|
|
67
|
+
)
|
|
68
|
+
from .source import LawGoKrClient
|
|
69
|
+
|
|
70
|
+
__all__ = [
|
|
71
|
+
"AmbiguousLawError",
|
|
72
|
+
"AdministrativeRuleArticleText",
|
|
73
|
+
"AdministrativeRuleContext",
|
|
74
|
+
"AdministrativeRuleHit",
|
|
75
|
+
"AdministrativeRuleIdentity",
|
|
76
|
+
"AdministrativeRuleText",
|
|
77
|
+
"Ambiguity",
|
|
78
|
+
"AnnexFormSource",
|
|
79
|
+
"AnnexFormHit",
|
|
80
|
+
"AnnexFormIdentity",
|
|
81
|
+
"AnnexFormText",
|
|
82
|
+
"AnnexSearchScope",
|
|
83
|
+
"AnnexType",
|
|
84
|
+
"ArticleContext",
|
|
85
|
+
"ArticleReference",
|
|
86
|
+
"ArticleText",
|
|
87
|
+
"AuthorityContext",
|
|
88
|
+
"Basis",
|
|
89
|
+
"BundleBudget",
|
|
90
|
+
"BundleMode",
|
|
91
|
+
"BundleRequestMode",
|
|
92
|
+
"BundleRequest",
|
|
93
|
+
"CandidateContext",
|
|
94
|
+
"CaseCourt",
|
|
95
|
+
"ContextGap",
|
|
96
|
+
"DeferredLookup",
|
|
97
|
+
"DelegatedRule",
|
|
98
|
+
"DelegationGraph",
|
|
99
|
+
"HistoryEvent",
|
|
100
|
+
"InterpretationHit",
|
|
101
|
+
"InterpretationIdentity",
|
|
102
|
+
"InterpretationSearchSource",
|
|
103
|
+
"InterpretationText",
|
|
104
|
+
"JudicialDecisionHit",
|
|
105
|
+
"JudicialDecisionIdentity",
|
|
106
|
+
"JudicialDecisionText",
|
|
107
|
+
"FollowUpSearch",
|
|
108
|
+
"LegalArticleCandidate",
|
|
109
|
+
"LegalContextBundle",
|
|
110
|
+
"LegalLawCandidate",
|
|
111
|
+
"LegalQueryExpansion",
|
|
112
|
+
"LegalTermCandidate",
|
|
113
|
+
"LoadedContext",
|
|
114
|
+
"LawGoKrClient",
|
|
115
|
+
"LawDiff",
|
|
116
|
+
"LawDiffChange",
|
|
117
|
+
"LawHit",
|
|
118
|
+
"LawHistory",
|
|
119
|
+
"LawIdentity",
|
|
120
|
+
"LawStructure",
|
|
121
|
+
"LawStructureNode",
|
|
122
|
+
"LawText",
|
|
123
|
+
"MolegApi",
|
|
124
|
+
"MolegApiError",
|
|
125
|
+
"NoResultError",
|
|
126
|
+
"ParseFailureError",
|
|
127
|
+
"RateLimitError",
|
|
128
|
+
"RetryExhaustedError",
|
|
129
|
+
"SourceApiError",
|
|
130
|
+
"SupplementaryProvision",
|
|
131
|
+
"StructuredTableData",
|
|
132
|
+
"UnsupportedFormatError",
|
|
133
|
+
]
|
moleg_api/errors.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""MOLEG-API error model."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class MolegApiError(Exception):
|
|
9
|
+
"""Base error for MOLEG-API public-interface failures."""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class NoResultError(MolegApiError):
|
|
13
|
+
"""The source API returned no usable result for the requested legal task."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AmbiguousLawError(MolegApiError):
|
|
17
|
+
"""The request matched multiple plausible law identities."""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
message: str,
|
|
22
|
+
*,
|
|
23
|
+
kind: str | None = None,
|
|
24
|
+
candidates: list[Any] | None = None,
|
|
25
|
+
) -> None:
|
|
26
|
+
super().__init__(message)
|
|
27
|
+
self.message = message
|
|
28
|
+
self.kind = kind
|
|
29
|
+
self.candidates = list(candidates or [])
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class UnsupportedFormatError(MolegApiError):
|
|
33
|
+
"""The source endpoint cannot provide a supported response format."""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class SourceApiError(MolegApiError):
|
|
37
|
+
"""The source law.go.kr API failed or returned an invalid response."""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class RateLimitError(SourceApiError):
|
|
41
|
+
"""The source law.go.kr API rate limited the request."""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class RetryExhaustedError(SourceApiError):
|
|
45
|
+
"""Retryable source failures continued through all allowed attempts."""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ParseFailureError(MolegApiError):
|
|
49
|
+
"""A source response could not be normalized into the public model."""
|