contracts-hj3415 0.5.0__tar.gz → 0.5.1__tar.gz
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.
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/PKG-INFO +1 -1
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/pyproject.toml +1 -1
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/analysis/features.py +1 -0
- contracts_hj3415-0.5.1/src/contracts_hj3415/common/__init__.py +7 -0
- contracts_hj3415-0.5.1/src/contracts_hj3415/common/envelope.py +92 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/common/types.py +3 -1
- contracts_hj3415-0.5.0/src/contracts_hj3415/common/envelope.py +0 -46
- contracts_hj3415-0.5.0/src/contracts_hj3415/universe/__init__.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/LICENSE +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/README.md +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/__init__.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/analysis/__init__.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/analysis/payloads.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/analysis/types.py +0 -0
- {contracts_hj3415-0.5.0/src/contracts_hj3415/common → contracts_hj3415-0.5.1/src/contracts_hj3415/nfs}/__init__.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/nfs/c101.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/nfs/c103.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/nfs/c104.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/nfs/c106.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/nfs/c108.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/nfs/payloads.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/nfs/types.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/py.typed +0 -0
- {contracts_hj3415-0.5.0/src/contracts_hj3415/nfs → contracts_hj3415-0.5.1/src/contracts_hj3415/universe}/__init__.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/universe/krx300.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/universe/payloads.py +0 -0
- {contracts_hj3415-0.5.0 → contracts_hj3415-0.5.1}/src/contracts_hj3415/universe/types.py +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# contracts_hj3415/common/envelope.py
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing import Literal, TypedDict
|
|
6
|
+
|
|
7
|
+
from contracts_hj3415.analysis.payloads import AnalysisPayloadDTO
|
|
8
|
+
from contracts_hj3415.common.types import CodeKey, EnvelopeMeta, Source
|
|
9
|
+
|
|
10
|
+
# topic별 payload 유니온
|
|
11
|
+
from contracts_hj3415.nfs.payloads import NfsPayloadDTO
|
|
12
|
+
from contracts_hj3415.universe.payloads import UniversePayloadDTO
|
|
13
|
+
from contracts_hj3415.universe.types import Universe
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class NfsEnvelopeDTO(TypedDict):
|
|
17
|
+
topic: Literal["nfs"]
|
|
18
|
+
key: CodeKey
|
|
19
|
+
asof: datetime
|
|
20
|
+
payload: NfsPayloadDTO
|
|
21
|
+
meta: EnvelopeMeta
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class UniverseEnvelopeDTO(TypedDict):
|
|
25
|
+
topic: Literal["universe"]
|
|
26
|
+
key: Universe
|
|
27
|
+
asof: datetime
|
|
28
|
+
payload: UniversePayloadDTO
|
|
29
|
+
meta: EnvelopeMeta
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class AnalysisEnvelopeDTO(TypedDict):
|
|
33
|
+
topic: Literal["analysis"]
|
|
34
|
+
key: CodeKey
|
|
35
|
+
asof: datetime
|
|
36
|
+
payload: AnalysisPayloadDTO
|
|
37
|
+
meta: EnvelopeMeta
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _make_empty_envelope_meta(source: Source = "") -> EnvelopeMeta:
|
|
41
|
+
return {"source": source, "trace_id": "", "note": "", "tags": []}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# ---------- topic별 convenience wrappers ----------
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def make_nfs_envelope(
|
|
48
|
+
*,
|
|
49
|
+
key: CodeKey,
|
|
50
|
+
asof: datetime,
|
|
51
|
+
payload: NfsPayloadDTO,
|
|
52
|
+
meta: EnvelopeMeta | None = None,
|
|
53
|
+
) -> NfsEnvelopeDTO:
|
|
54
|
+
return {
|
|
55
|
+
"topic": "nfs",
|
|
56
|
+
"key": key,
|
|
57
|
+
"asof": asof,
|
|
58
|
+
"payload": payload,
|
|
59
|
+
"meta": meta or _make_empty_envelope_meta("scraper2"),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def make_universe_envelope(
|
|
64
|
+
*,
|
|
65
|
+
key: Universe,
|
|
66
|
+
asof: datetime,
|
|
67
|
+
payload: UniversePayloadDTO,
|
|
68
|
+
meta: EnvelopeMeta | None = None,
|
|
69
|
+
) -> UniverseEnvelopeDTO:
|
|
70
|
+
return {
|
|
71
|
+
"topic": "universe",
|
|
72
|
+
"key": key,
|
|
73
|
+
"asof": asof,
|
|
74
|
+
"payload": payload,
|
|
75
|
+
"meta": meta or _make_empty_envelope_meta("krx"),
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def make_analysis_envelope(
|
|
80
|
+
*,
|
|
81
|
+
key: str,
|
|
82
|
+
asof: datetime,
|
|
83
|
+
payload: AnalysisPayloadDTO,
|
|
84
|
+
meta: EnvelopeMeta | None = None,
|
|
85
|
+
) -> AnalysisEnvelopeDTO:
|
|
86
|
+
return {
|
|
87
|
+
"topic": "analysis",
|
|
88
|
+
"key": key,
|
|
89
|
+
"asof": asof,
|
|
90
|
+
"payload": payload,
|
|
91
|
+
"meta": meta or _make_empty_envelope_meta("analyser2"),
|
|
92
|
+
}
|
|
@@ -9,9 +9,11 @@ CodeKey: TypeAlias = str
|
|
|
9
9
|
|
|
10
10
|
Num: TypeAlias = float | int | None
|
|
11
11
|
|
|
12
|
+
Source: TypeAlias = Literal["", "scraper2", "krx", "analyser2"]
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
class EnvelopeMeta(TypedDict, total=False):
|
|
14
|
-
source:
|
|
16
|
+
source: Source
|
|
15
17
|
trace_id: str
|
|
16
18
|
note: str
|
|
17
19
|
tags: list[str]
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# contracts_hj3415/common/envelope.py
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
from typing import TypedDict
|
|
6
|
-
|
|
7
|
-
from contracts_hj3415.analysis.payloads import AnalysisPayloadDTO
|
|
8
|
-
from contracts_hj3415.common.types import EnvelopeMeta, Topic
|
|
9
|
-
|
|
10
|
-
# topic별 payload 유니온
|
|
11
|
-
from contracts_hj3415.nfs.payloads import NfsPayloadDTO
|
|
12
|
-
from contracts_hj3415.universe.payloads import UniversePayloadDTO
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class EnvelopeDTO(TypedDict):
|
|
16
|
-
"""
|
|
17
|
-
모노레포 공통 운반 상자 DTO
|
|
18
|
-
|
|
19
|
-
- key: topic별 식별자(문자열). 예)
|
|
20
|
-
- nfs: "005930"
|
|
21
|
-
- universe: "krx300"
|
|
22
|
-
- analysis: "red:005930"
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
topic: Topic
|
|
26
|
-
key: str
|
|
27
|
-
asof: datetime
|
|
28
|
-
payload: NfsPayloadDTO | UniversePayloadDTO | AnalysisPayloadDTO
|
|
29
|
-
meta: EnvelopeMeta
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def make_envelope(
|
|
33
|
-
*,
|
|
34
|
-
topic: Topic,
|
|
35
|
-
key: str,
|
|
36
|
-
asof: datetime,
|
|
37
|
-
payload: NfsPayloadDTO | UniversePayloadDTO | AnalysisPayloadDTO,
|
|
38
|
-
meta: EnvelopeMeta | None = None,
|
|
39
|
-
) -> EnvelopeDTO:
|
|
40
|
-
return {
|
|
41
|
-
"topic": topic,
|
|
42
|
-
"key": key,
|
|
43
|
-
"asof": asof,
|
|
44
|
-
"payload": payload,
|
|
45
|
-
"meta": meta or EnvelopeMeta(),
|
|
46
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|