meshtrade 0.0.7__tar.gz → 0.0.8__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.
Potentially problematic release.
This version of meshtrade might be problematic. Click here for more details.
- {meshtrade-0.0.7 → meshtrade-0.0.8}/PKG-INFO +1 -1
- {meshtrade-0.0.7 → meshtrade-0.0.8}/pyproject.toml +4 -4
- meshtrade-0.0.8/src/meshtrade/compliance/client/v1/__init__.py +31 -0
- meshtrade-0.0.8/src/meshtrade/iam/group/v1/__init__.py +5 -0
- meshtrade-0.0.8/src/meshtrade/issuance_hub/instrument/v1/__init__.py +11 -0
- meshtrade-0.0.8/src/meshtrade/ledger/transaction/v1/__init__.py +7 -0
- meshtrade-0.0.8/src/meshtrade/option/v1/__init__.py +7 -0
- meshtrade-0.0.8/src/meshtrade/trading/direct_order/v1/__init__.py +7 -0
- meshtrade-0.0.8/src/meshtrade/trading/limit_order/v1/__init__.py +7 -0
- meshtrade-0.0.8/src/meshtrade/trading/spot/v1/__init__.py +7 -0
- meshtrade-0.0.8/src/meshtrade/type/v1/__init__.py +84 -0
- meshtrade-0.0.8/src/meshtrade/type/v1/date.py +201 -0
- meshtrade-0.0.8/src/meshtrade/type/v1/date_pb2.py +37 -0
- meshtrade-0.0.8/src/meshtrade/type/v1/date_pb2.pyi +15 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/ledger.py +1 -2
- meshtrade-0.0.8/src/meshtrade/type/v1/time_of_day.py +300 -0
- meshtrade-0.0.8/src/meshtrade/type/v1/time_of_day_pb2.py +37 -0
- meshtrade-0.0.8/src/meshtrade/type/v1/time_of_day_pb2.pyi +17 -0
- meshtrade-0.0.8/src/meshtrade/wallet/account/v1/__init__.py +19 -0
- meshtrade-0.0.8/src/meshtrade/wallet/account/v1/service_pb2.py +61 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/wallet/account/v1/service_pb2.pyi +0 -1
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade.egg-info/PKG-INFO +1 -1
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade.egg-info/SOURCES.txt +13 -2
- meshtrade-0.0.7/src/meshtrade/trading/spot/v1/__init__.py +0 -0
- meshtrade-0.0.7/src/meshtrade/type/__init__.py +0 -0
- meshtrade-0.0.7/src/meshtrade/type/v1/__init__.py +0 -7
- meshtrade-0.0.7/src/meshtrade/wallet/__init__.py +0 -0
- meshtrade-0.0.7/src/meshtrade/wallet/account/v1/__init__.py +0 -0
- meshtrade-0.0.7/src/meshtrade/wallet/account/v1/service_pb2.py +0 -70
- {meshtrade-0.0.7 → meshtrade-0.0.8}/LICENSE +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/README.md +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/setup.cfg +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/client_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/client_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/company_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/company_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/company_representative_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/company_representative_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/company_representative_role_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/company_representative_role_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/fund_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/fund_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/identification_document_type_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/identification_document_type_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/industry_classification_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/industry_classification_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/natural_person_connection_type_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/natural_person_connection_type_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/natural_person_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/natural_person_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/pep_status_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/pep_status_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/service_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/tax_residency_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/tax_residency_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/trust_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/trust_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/verification_status_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/compliance/client/v1/verification_status_pb2.pyi +0 -0
- {meshtrade-0.0.7/src/meshtrade/compliance/client/v1 → meshtrade-0.0.8/src/meshtrade/iam}/__init__.py +0 -0
- {meshtrade-0.0.7/src/meshtrade/iam → meshtrade-0.0.8/src/meshtrade/iam/group}/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/iam/group/v1/group_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/iam/group/v1/group_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/iam/group/v1/service_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/iam/group/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.7/src/meshtrade/iam/group → meshtrade-0.0.8/src/meshtrade/issuance_hub}/__init__.py +0 -0
- {meshtrade-0.0.7/src/meshtrade/iam/group/v1 → meshtrade-0.0.8/src/meshtrade/issuance_hub/instrument}/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/issuance_hub/instrument/v1/instrument_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/issuance_hub/instrument/v1/instrument_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/issuance_hub/instrument/v1/service_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/issuance_hub/instrument/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.7/src/meshtrade/iam/role → meshtrade-0.0.8/src/meshtrade/ledger}/__init__.py +0 -0
- {meshtrade-0.0.7/src/meshtrade/iam/role/v1 → meshtrade-0.0.8/src/meshtrade/ledger/transaction}/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/ledger/transaction/v1/transaction_action_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/ledger/transaction/v1/transaction_action_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/ledger/transaction/v1/transaction_state_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/ledger/transaction/v1/transaction_state_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/option/v1/auth_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/option/v1/auth_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/option/v1/service_type_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/option/v1/service_type_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/direct_order/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/direct_order/v1/direct_order_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/direct_order/v1/direct_order_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/direct_order/v1/service_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/direct_order/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.7/src/meshtrade/trading/direct_order/v1 → meshtrade-0.0.8/src/meshtrade/trading/limit_order}/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/limit_order/v1/limit_order_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/limit_order/v1/limit_order_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/limit_order/v1/service_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/limit_order/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.7/src/meshtrade/trading/limit_order → meshtrade-0.0.8/src/meshtrade/trading/spot}/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/spot/v1/service_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/spot/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/spot/v1/spot_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/trading/spot/v1/spot_pb2.pyi +0 -0
- {meshtrade-0.0.7/src/meshtrade/trading/limit_order/v1 → meshtrade-0.0.8/src/meshtrade/type}/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/address_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/address_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/amount.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/amount_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/amount_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/contact_details_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/contact_details_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/decimal_built_in_conversions.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/decimal_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/decimal_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/ledger_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/ledger_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/token_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/type/v1/token_pb2.pyi +0 -0
- {meshtrade-0.0.7/src/meshtrade/trading/spot → meshtrade-0.0.8/src/meshtrade/wallet}/__init__.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/wallet/account/v1/account_pb2.py +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade/wallet/account/v1/account_pb2.pyi +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade.egg-info/dependency_links.txt +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade.egg-info/requires.txt +0 -0
- {meshtrade-0.0.7 → meshtrade-0.0.8}/src/meshtrade.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "meshtrade"
|
|
7
|
-
version = "v0.0.
|
|
7
|
+
version = "v0.0.8"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "Bernard Bussy", email = "bernard@meshtrade.co" },
|
|
10
10
|
]
|
|
@@ -52,9 +52,9 @@ where = ["src"]
|
|
|
52
52
|
|
|
53
53
|
# --- Ruff Configuration (Linter and Formatter) ---
|
|
54
54
|
[tool.ruff]
|
|
55
|
-
target-version = "
|
|
56
|
-
line-length =
|
|
57
|
-
exclude = ["*_pb2.py", "*_pb2.pyi"]
|
|
55
|
+
target-version = "py312"
|
|
56
|
+
line-length = 150
|
|
57
|
+
exclude = ["*_pb2.py", "*_pb2.pyi", "*_pb2_grpc.py", "*_pb2_grpc.pyi", "tests/**"]
|
|
58
58
|
|
|
59
59
|
[tool.ruff.lint]
|
|
60
60
|
# E/W: flake8 errors/warnings | F: Pyflakes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from .client_pb2 import Client
|
|
2
|
+
from .company_pb2 import Company
|
|
3
|
+
from .company_representative_pb2 import CompanyRepresentative
|
|
4
|
+
from .company_representative_role_pb2 import CompanyRepresentativeRole
|
|
5
|
+
from .fund_pb2 import Fund
|
|
6
|
+
from .identification_document_type_pb2 import IdentificationDocumentType
|
|
7
|
+
from .industry_classification_pb2 import IndustryClassification
|
|
8
|
+
from .natural_person_connection_type_pb2 import NaturalPersonConnectionType
|
|
9
|
+
from .natural_person_pb2 import NaturalPerson
|
|
10
|
+
from .pep_status_pb2 import PepStatus
|
|
11
|
+
from .source_of_income_and_wealth_pb2 import SourceOfIncomeAndWealth
|
|
12
|
+
from .tax_residency_pb2 import TaxResidency
|
|
13
|
+
from .trust_pb2 import Trust
|
|
14
|
+
from .verification_status_pb2 import VerificationStatus
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"Client",
|
|
18
|
+
"Company",
|
|
19
|
+
"CompanyRepresentative",
|
|
20
|
+
"CompanyRepresentativeRole",
|
|
21
|
+
"Fund",
|
|
22
|
+
"IdentificationDocumentType",
|
|
23
|
+
"IndustryClassification",
|
|
24
|
+
"NaturalPerson",
|
|
25
|
+
"NaturalPersonConnectionType",
|
|
26
|
+
"PepStatus",
|
|
27
|
+
"SourceOfIncomeAndWealth",
|
|
28
|
+
"TaxResidency",
|
|
29
|
+
"Trust",
|
|
30
|
+
"VerificationStatus",
|
|
31
|
+
]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .instrument_pb2 import Instrument
|
|
2
|
+
from .service_pb2 import BurnInstrumentRequest, BurnInstrumentResponse, GetInstrumentRequest, MintInstrumentRequest, MintInstrumentResponse
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"Instrument",
|
|
6
|
+
"GetInstrumentRequest",
|
|
7
|
+
"MintInstrumentRequest",
|
|
8
|
+
"MintInstrumentResponse",
|
|
9
|
+
"BurnInstrumentRequest",
|
|
10
|
+
"BurnInstrumentResponse",
|
|
11
|
+
]
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from .address_pb2 import Address
|
|
2
|
+
from .amount import new_amount
|
|
3
|
+
from .amount_pb2 import Amount
|
|
4
|
+
from .contact_details_pb2 import ContactDetails
|
|
5
|
+
from .date import (
|
|
6
|
+
date_to_python_date,
|
|
7
|
+
date_to_string,
|
|
8
|
+
new_date,
|
|
9
|
+
new_date_from_python_date,
|
|
10
|
+
)
|
|
11
|
+
from .date import (
|
|
12
|
+
is_complete as date_is_complete,
|
|
13
|
+
)
|
|
14
|
+
from .date import (
|
|
15
|
+
is_month_day as date_is_month_day,
|
|
16
|
+
)
|
|
17
|
+
from .date import (
|
|
18
|
+
is_valid as date_is_valid,
|
|
19
|
+
)
|
|
20
|
+
from .date import (
|
|
21
|
+
is_year_month as date_is_year_month,
|
|
22
|
+
)
|
|
23
|
+
from .date import (
|
|
24
|
+
is_year_only as date_is_year_only,
|
|
25
|
+
)
|
|
26
|
+
from .date_pb2 import Date
|
|
27
|
+
from .decimal_built_in_conversions import built_in_to_decimal, decimal_to_built_in
|
|
28
|
+
from .decimal_pb2 import Decimal
|
|
29
|
+
from .ledger import get_ledger_no_decimal_places
|
|
30
|
+
from .ledger_pb2 import Ledger
|
|
31
|
+
from .time_of_day import (
|
|
32
|
+
is_end_of_day,
|
|
33
|
+
is_midnight,
|
|
34
|
+
new_time_of_day,
|
|
35
|
+
new_time_of_day_from_datetime,
|
|
36
|
+
new_time_of_day_from_python_time,
|
|
37
|
+
new_time_of_day_from_timedelta,
|
|
38
|
+
time_of_day_to_datetime_with_date,
|
|
39
|
+
time_of_day_to_python_time,
|
|
40
|
+
time_of_day_to_string,
|
|
41
|
+
time_of_day_to_timedelta,
|
|
42
|
+
total_seconds,
|
|
43
|
+
)
|
|
44
|
+
from .time_of_day import (
|
|
45
|
+
is_valid as time_of_day_is_valid,
|
|
46
|
+
)
|
|
47
|
+
from .time_of_day_pb2 import TimeOfDay
|
|
48
|
+
from .token_pb2 import Token
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
"Address",
|
|
52
|
+
"new_amount",
|
|
53
|
+
"Amount",
|
|
54
|
+
"ContactDetails",
|
|
55
|
+
"new_date",
|
|
56
|
+
"new_date_from_python_date",
|
|
57
|
+
"date_to_python_date",
|
|
58
|
+
"date_is_valid",
|
|
59
|
+
"date_is_complete",
|
|
60
|
+
"date_is_year_only",
|
|
61
|
+
"date_is_year_month",
|
|
62
|
+
"date_is_month_day",
|
|
63
|
+
"date_to_string",
|
|
64
|
+
"Date",
|
|
65
|
+
"built_in_to_decimal",
|
|
66
|
+
"decimal_to_built_in",
|
|
67
|
+
"Decimal",
|
|
68
|
+
"get_ledger_no_decimal_places",
|
|
69
|
+
"Ledger",
|
|
70
|
+
"new_time_of_day",
|
|
71
|
+
"new_time_of_day_from_python_time",
|
|
72
|
+
"new_time_of_day_from_datetime",
|
|
73
|
+
"new_time_of_day_from_timedelta",
|
|
74
|
+
"time_of_day_to_python_time",
|
|
75
|
+
"time_of_day_to_timedelta",
|
|
76
|
+
"time_of_day_to_datetime_with_date",
|
|
77
|
+
"time_of_day_is_valid",
|
|
78
|
+
"is_midnight",
|
|
79
|
+
"is_end_of_day",
|
|
80
|
+
"time_of_day_to_string",
|
|
81
|
+
"total_seconds",
|
|
82
|
+
"TimeOfDay",
|
|
83
|
+
"Token",
|
|
84
|
+
]
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides helper functions for working with Date protobuf messages.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from datetime import date as python_date
|
|
6
|
+
|
|
7
|
+
from .date_pb2 import Date
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def new_date(year: int, month: int, day: int) -> Date:
|
|
11
|
+
"""Creates a new Date from year, month, and day values.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
year: Year value (1-9999, or 0 for partial dates)
|
|
15
|
+
month: Month value (1-12, or 0 for partial dates)
|
|
16
|
+
day: Day value (1-31, or 0 for partial dates)
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
A Date protobuf message
|
|
20
|
+
|
|
21
|
+
Raises:
|
|
22
|
+
ValueError: If the date values are invalid
|
|
23
|
+
"""
|
|
24
|
+
_validate_date(year, month, day)
|
|
25
|
+
return Date(year=year, month=month, day=day)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def new_date_from_python_date(python_date_obj: python_date) -> Date:
|
|
29
|
+
"""Creates a Date from a Python date object.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
python_date_obj: A Python datetime.date object
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
A Date protobuf message
|
|
36
|
+
"""
|
|
37
|
+
return Date(
|
|
38
|
+
year=python_date_obj.year,
|
|
39
|
+
month=python_date_obj.month,
|
|
40
|
+
day=python_date_obj.day
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def date_to_python_date(date_obj: Date) -> python_date:
|
|
45
|
+
"""Converts a Date protobuf message to a Python date object.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
date_obj: A Date protobuf message
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
A Python datetime.date object
|
|
52
|
+
|
|
53
|
+
Raises:
|
|
54
|
+
ValueError: If the date is incomplete or invalid
|
|
55
|
+
"""
|
|
56
|
+
if not date_obj:
|
|
57
|
+
raise ValueError("Date object is None")
|
|
58
|
+
|
|
59
|
+
if not is_complete(date_obj):
|
|
60
|
+
raise ValueError(f"Incomplete date: year={date_obj.year}, month={date_obj.month}, day={date_obj.day}")
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
return python_date(date_obj.year, date_obj.month, date_obj.day)
|
|
64
|
+
except ValueError as e:
|
|
65
|
+
raise ValueError(f"Invalid date values: {e}")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def is_valid(date_obj: Date | None) -> bool:
|
|
69
|
+
"""Checks if a Date has valid values according to the protobuf constraints.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
date_obj: A Date protobuf message or None
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
True if the date is valid, False otherwise
|
|
76
|
+
"""
|
|
77
|
+
if not date_obj:
|
|
78
|
+
return False
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
_validate_date(date_obj.year, date_obj.month, date_obj.day)
|
|
82
|
+
return True
|
|
83
|
+
except ValueError:
|
|
84
|
+
return False
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def is_complete(date_obj: Date | None) -> bool:
|
|
88
|
+
"""Returns True if the date has non-zero year, month, and day values.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
date_obj: A Date protobuf message or None
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
True if the date is complete, False otherwise
|
|
95
|
+
"""
|
|
96
|
+
if not date_obj:
|
|
97
|
+
return False
|
|
98
|
+
return date_obj.year != 0 and date_obj.month != 0 and date_obj.day != 0
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def is_year_only(date_obj: Date | None) -> bool:
|
|
102
|
+
"""Returns True if only the year is specified (month and day are 0).
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
date_obj: A Date protobuf message or None
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
True if only year is specified, False otherwise
|
|
109
|
+
"""
|
|
110
|
+
if not date_obj:
|
|
111
|
+
return False
|
|
112
|
+
return date_obj.year != 0 and date_obj.month == 0 and date_obj.day == 0
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def is_year_month(date_obj: Date | None) -> bool:
|
|
116
|
+
"""Returns True if year and month are specified but day is 0.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
date_obj: A Date protobuf message or None
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
True if year and month are specified but day is 0, False otherwise
|
|
123
|
+
"""
|
|
124
|
+
if not date_obj:
|
|
125
|
+
return False
|
|
126
|
+
return date_obj.year != 0 and date_obj.month != 0 and date_obj.day == 0
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def is_month_day(date_obj: Date | None) -> bool:
|
|
130
|
+
"""Returns True if month and day are specified but year is 0.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
date_obj: A Date protobuf message or None
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
True if month and day are specified but year is 0, False otherwise
|
|
137
|
+
"""
|
|
138
|
+
if not date_obj:
|
|
139
|
+
return False
|
|
140
|
+
return date_obj.year == 0 and date_obj.month != 0 and date_obj.day != 0
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def date_to_string(date_obj: Date | None) -> str:
|
|
144
|
+
"""Returns a string representation of the date.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
date_obj: A Date protobuf message or None
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
String representation of the date
|
|
151
|
+
"""
|
|
152
|
+
if not date_obj:
|
|
153
|
+
return "<None>"
|
|
154
|
+
|
|
155
|
+
if is_complete(date_obj):
|
|
156
|
+
return f"{date_obj.year:04d}-{date_obj.month:02d}-{date_obj.day:02d}"
|
|
157
|
+
elif is_year_only(date_obj):
|
|
158
|
+
return f"{date_obj.year:04d}"
|
|
159
|
+
elif is_year_month(date_obj):
|
|
160
|
+
return f"{date_obj.year:04d}-{date_obj.month:02d}"
|
|
161
|
+
elif is_month_day(date_obj):
|
|
162
|
+
return f"--{date_obj.month:02d}-{date_obj.day:02d}"
|
|
163
|
+
else:
|
|
164
|
+
return f"Date(year={date_obj.year}, month={date_obj.month}, day={date_obj.day})"
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _validate_date(year: int, month: int, day: int) -> None:
|
|
168
|
+
"""Validates the year, month, and day values according to Date constraints.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
year: Year value
|
|
172
|
+
month: Month value
|
|
173
|
+
day: Day value
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
ValueError: If the date values are invalid
|
|
177
|
+
"""
|
|
178
|
+
# Year validation
|
|
179
|
+
if year != 0 and (year < 1 or year > 9999):
|
|
180
|
+
raise ValueError(f"Year must be 0 or between 1 and 9999, got {year}")
|
|
181
|
+
|
|
182
|
+
# Month validation
|
|
183
|
+
if month != 0 and (month < 1 or month > 12):
|
|
184
|
+
raise ValueError(f"Month must be 0 or between 1 and 12, got {month}")
|
|
185
|
+
|
|
186
|
+
# Day validation
|
|
187
|
+
if day != 0 and (day < 1 or day > 31):
|
|
188
|
+
raise ValueError(f"Day must be 0 or between 1 and 31, got {day}")
|
|
189
|
+
|
|
190
|
+
# Additional validation for complete dates
|
|
191
|
+
if year != 0 and month != 0 and day != 0:
|
|
192
|
+
try:
|
|
193
|
+
python_date(year, month, day)
|
|
194
|
+
except ValueError as e:
|
|
195
|
+
raise ValueError(f"Invalid date: {year}-{month:02d}-{day:02d}: {e}")
|
|
196
|
+
|
|
197
|
+
# Validate partial date combinations
|
|
198
|
+
if year == 0 and month != 0 and day == 0:
|
|
199
|
+
raise ValueError("Month cannot be specified without year")
|
|
200
|
+
if year == 0 and month == 0 and day != 0:
|
|
201
|
+
raise ValueError("Day cannot be specified without month")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: meshtrade/type/v1/date.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'meshtrade/type/v1/date.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cmeshtrade/type/v1/date.proto\x12\x11meshtrade.type.v1\"B\n\x04\x44\x61te\x12\x12\n\x04year\x18\x01 \x01(\x05R\x04year\x12\x14\n\x05month\x18\x02 \x01(\x05R\x05month\x12\x10\n\x03\x64\x61y\x18\x03 \x01(\x05R\x03\x64\x61yB,Z*github.com/meshtrade/api/go/type/v1;typev1b\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'meshtrade.type.v1.date_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'Z*github.com/meshtrade/api/go/type/v1;typev1'
|
|
35
|
+
_globals['_DATE']._serialized_start=51
|
|
36
|
+
_globals['_DATE']._serialized_end=117
|
|
37
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from google.protobuf import descriptor as _descriptor
|
|
2
|
+
from google.protobuf import message as _message
|
|
3
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional
|
|
4
|
+
|
|
5
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
6
|
+
|
|
7
|
+
class Date(_message.Message):
|
|
8
|
+
__slots__ = ("year", "month", "day")
|
|
9
|
+
YEAR_FIELD_NUMBER: _ClassVar[int]
|
|
10
|
+
MONTH_FIELD_NUMBER: _ClassVar[int]
|
|
11
|
+
DAY_FIELD_NUMBER: _ClassVar[int]
|
|
12
|
+
year: int
|
|
13
|
+
month: int
|
|
14
|
+
day: int
|
|
15
|
+
def __init__(self, year: _Optional[int] = ..., month: _Optional[int] = ..., day: _Optional[int] = ...) -> None: ...
|