wizata-dsapi 2.2.0.dev8__tar.gz → 2.2.0.dev9__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.
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/PKG-INFO +1 -1
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/inventory.py +13 -4
- wizata_dsapi-2.2.0.dev9/wizata_dsapi/version.py +1 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/wizata_dsapi_client.py +34 -12
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi.egg-info/PKG-INFO +1 -1
- wizata_dsapi-2.2.0.dev8/wizata_dsapi/version.py +0 -1
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/LICENSE.txt +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/README.rst +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/setup.cfg +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/setup.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/__init__.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/api_config.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/api_dto.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/api_interface.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/bucket.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/business_label.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/connection.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/connection_types.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/context.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/dashboard.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/dataframe_toolkit.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/datapoint.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/datastore.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/deployment.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/ds_dataframe.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/dsapi_json_encoder.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/edge_config.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/edge_device.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/edge_module.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/evaluation.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/execution.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/execution_log.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/experiment.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/graylog_log.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/group_system.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/ilogger.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/insight.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/mlmodel.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/mobile_asset.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/model_toolkit.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/models/__init__.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/models/common.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/notification.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/paged_query_result.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/pipeline.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/pipeline_image.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/plot.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/plots/__init__.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/plots/common.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/plots/theme.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/product.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/request.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/script.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/scripts/__init__.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/scripts/common.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/search.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/solution_component.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/streamlit_utils.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/template.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/template_config.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/trigger.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/twin.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/twinregistration.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/user.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/wizard_function.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/wizard_request.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi/words.py +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi.egg-info/requires.txt +0 -0
- {wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi.egg-info/top_level.txt +0 -0
|
@@ -83,8 +83,9 @@ class InventoryBalance:
|
|
|
83
83
|
DataPoint ``datapoint`` (a hardware id), true at ``timestamp`` (when it was
|
|
84
84
|
counted, not when it was recorded: that is ``created_at``).
|
|
85
85
|
|
|
86
|
-
PostgreSQL ``"InventoryBalance"``, PK (``datapoint``, ``product``,
|
|
87
|
-
|
|
86
|
+
PostgreSQL ``"InventoryBalance"``, PK ``id`` (DEV-6085); (``datapoint``, ``product``,
|
|
87
|
+
``timestamp``) is unique, and writing the same key again replaces the quantity.
|
|
88
|
+
``count`` is the key shared by every balance written in one call (one count).
|
|
88
89
|
|
|
89
90
|
On write only:
|
|
90
91
|
|
|
@@ -99,7 +100,9 @@ class InventoryBalance:
|
|
|
99
100
|
return "planner/inventory/balances"
|
|
100
101
|
|
|
101
102
|
def __init__(self, datapoint: str = None, product: str = None, timestamp=None,
|
|
102
|
-
quantity: float = None, unit=None, twin: str = None):
|
|
103
|
+
quantity: float = None, unit=None, twin: str = None, balance_id=None, count=None):
|
|
104
|
+
self.id: Optional[str] = _uuid_str(balance_id)
|
|
105
|
+
self.count: Optional[str] = _uuid_str(count)
|
|
103
106
|
self.datapoint: Optional[str] = datapoint
|
|
104
107
|
self.product: Optional[str] = product
|
|
105
108
|
self.timestamp: Optional[datetime] = _ts_in(timestamp)
|
|
@@ -113,7 +116,8 @@ class InventoryBalance:
|
|
|
113
116
|
|
|
114
117
|
def to_dict(self) -> dict:
|
|
115
118
|
obj = {}
|
|
116
|
-
for name, value in (("
|
|
119
|
+
for name, value in (("id", self.id), ("count", self.count),
|
|
120
|
+
("datapoint", self.datapoint), ("product", self.product),
|
|
117
121
|
("quantity", self.quantity), ("unit", self.unit),
|
|
118
122
|
("twin", self.twin), ("createdBy", self.created_by),
|
|
119
123
|
("updatedBy", self.updated_by)):
|
|
@@ -128,6 +132,8 @@ class InventoryBalance:
|
|
|
128
132
|
@classmethod
|
|
129
133
|
def from_dict(cls, data: dict) -> "InventoryBalance":
|
|
130
134
|
obj = cls()
|
|
135
|
+
obj.id = _uuid_str(data.get("id"))
|
|
136
|
+
obj.count = _uuid_str(data.get("count"))
|
|
131
137
|
obj.datapoint = data.get("datapoint")
|
|
132
138
|
obj.product = data.get("product")
|
|
133
139
|
obj.timestamp = _ts_in(data.get("timestamp"))
|
|
@@ -140,6 +146,9 @@ class InventoryBalance:
|
|
|
140
146
|
obj.updated_by = data.get("updatedBy") or data.get("updated_by")
|
|
141
147
|
return obj
|
|
142
148
|
|
|
149
|
+
def api_id(self) -> str:
|
|
150
|
+
return self.id
|
|
151
|
+
|
|
143
152
|
def key(self) -> tuple:
|
|
144
153
|
return self.datapoint, self.product, self.timestamp
|
|
145
154
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.0.dev9"
|
|
@@ -2886,7 +2886,8 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
|
|
|
2886
2886
|
inventoryMovement DataPoint by ``datapoint``, or by ``twin`` (the DataPoint
|
|
2887
2887
|
of the product's category on that Twin). ``unit`` converts the quantity to
|
|
2888
2888
|
the DataPoint's unit.
|
|
2889
|
-
:return: the stored balances, quantities in the DataPoint's unit
|
|
2889
|
+
:return: the stored balances, quantities in the DataPoint's unit, each with its
|
|
2890
|
+
``id`` and the ``count`` key the call created.
|
|
2890
2891
|
"""
|
|
2891
2892
|
body = [b.to_dict() if isinstance(b, InventoryBalance) else b for b in balances]
|
|
2892
2893
|
response = self._planner_request("POST", "planner/inventory/balances/", body=body)
|
|
@@ -2896,8 +2897,8 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
|
|
|
2896
2897
|
"""
|
|
2897
2898
|
List recorded balances, newest first by default.
|
|
2898
2899
|
|
|
2899
|
-
:param search_query: SearchQuery or dict; filters on ``datapoint``
|
|
2900
|
-
``
|
|
2900
|
+
:param search_query: SearchQuery or dict; filters on ``datapoint``, ``product``,
|
|
2901
|
+
``twin``, ``count``, ``id`` (eq / in) and ``timestamp`` (eq / gte / gt / lt / lte).
|
|
2901
2902
|
:return: PagedQueryResult with InventoryBalance results.
|
|
2902
2903
|
"""
|
|
2903
2904
|
if search_query is None:
|
|
@@ -2908,19 +2909,40 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
|
|
|
2908
2909
|
body=search_query.to_dict())
|
|
2909
2910
|
return PagedQueryResult.from_dict(response.json(), dto_class=InventoryBalance)
|
|
2910
2911
|
|
|
2911
|
-
|
|
2912
|
+
@staticmethod
|
|
2913
|
+
def _balance_id(value) -> str:
|
|
2914
|
+
balance_id = value.id if isinstance(value, InventoryBalance) else value
|
|
2915
|
+
if not balance_id:
|
|
2916
|
+
raise ValueError("please provide a balance or its id")
|
|
2917
|
+
return urllib.parse.quote(str(balance_id), safe="")
|
|
2918
|
+
|
|
2919
|
+
def get_inventory_balance(self, balance_id):
|
|
2920
|
+
"""
|
|
2921
|
+
:param balance_id: the balance's id.
|
|
2922
|
+
:return: InventoryBalance, or None when it does not exist.
|
|
2923
|
+
"""
|
|
2924
|
+
response = self._planner_request("GET", f"planner/inventory/balances/{self._balance_id(balance_id)}/",
|
|
2925
|
+
expected=(200, 404))
|
|
2926
|
+
return InventoryBalance.from_dict(response.json()) if response.status_code == 200 else None
|
|
2927
|
+
|
|
2928
|
+
def update_inventory_balance(self, balance: InventoryBalance) -> InventoryBalance:
|
|
2929
|
+
"""
|
|
2930
|
+
Change one balance's quantity and/or time (its datapoint and product never change).
|
|
2931
|
+
``unit`` converts the quantity to the datapoint's unit. 409 when another balance
|
|
2932
|
+
already holds the new time.
|
|
2933
|
+
"""
|
|
2934
|
+
body = {k: v for k, v in balance.to_dict().items() if k in ("quantity", "timestamp", "unit")}
|
|
2935
|
+
response = self._planner_request("PUT", f"planner/inventory/balances/{self._balance_id(balance)}/",
|
|
2936
|
+
body=body)
|
|
2937
|
+
return InventoryBalance.from_dict(response.json())
|
|
2938
|
+
|
|
2939
|
+
def delete_inventory_balance(self, balance):
|
|
2912
2940
|
"""
|
|
2913
2941
|
Delete one recorded balance (a count entered by mistake).
|
|
2914
2942
|
|
|
2915
|
-
:param
|
|
2943
|
+
:param balance: InventoryBalance or its id.
|
|
2916
2944
|
"""
|
|
2917
|
-
|
|
2918
|
-
if timestamp.tzinfo is None:
|
|
2919
|
-
timestamp = timestamp.replace(tzinfo=datetime.timezone.utc)
|
|
2920
|
-
timestamp = timestamp.isoformat()
|
|
2921
|
-
self._planner_request("DELETE", "planner/inventory/balances/",
|
|
2922
|
-
params={"datapoint": datapoint, "product": product,
|
|
2923
|
-
"timestamp": timestamp},
|
|
2945
|
+
self._planner_request("DELETE", f"planner/inventory/balances/{self._balance_id(balance)}/",
|
|
2924
2946
|
expected=(204,))
|
|
2925
2947
|
|
|
2926
2948
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.0.dev8"
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
{wizata_dsapi-2.2.0.dev8 → wizata_dsapi-2.2.0.dev9}/wizata_dsapi.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|