pyetp 0.0.39__py3-none-any.whl → 0.0.43a0__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.
@@ -0,0 +1,46 @@
1
+ import resqml_objects.v201 as ro
2
+
3
+ resqml_schema_version = "2.0.1"
4
+ common_schema_version = "2.0"
5
+
6
+
7
+ def get_content_type_string(
8
+ obj: ro.AbstractObject,
9
+ resqml_schema_version: str = resqml_schema_version,
10
+ common_schema_version: str = common_schema_version,
11
+ ) -> str:
12
+ # See Energistics Identifier Specification 4.0 (it is downloaded alongside
13
+ # the RESQML v2.0.1 standard) section 4.1 for an explanation on the format
14
+ # of content_type.
15
+
16
+ namespace = getattr(obj.Meta, "namespace", None) or getattr(
17
+ obj.Meta, "target_namespace"
18
+ )
19
+
20
+ if namespace == "http://www.energistics.org/energyml/data/resqmlv2":
21
+ return (
22
+ f"application/x-resqml+xml;version={resqml_schema_version};"
23
+ f"type={obj.__class__.__name__}"
24
+ )
25
+ elif namespace == "http://www.energistics.org/energyml/data/commonv2":
26
+ return (
27
+ f"application/x-eml+xml;version={common_schema_version};"
28
+ f"type={obj.__class__.__name__}"
29
+ )
30
+
31
+ raise NotImplementedError(
32
+ f"Namespace {namespace} from object {obj} is not supported"
33
+ )
34
+
35
+
36
+ def get_data_object_reference(
37
+ obj: ro.AbstractCitedDataObject,
38
+ ) -> ro.DataObjectReference:
39
+ content_type = get_content_type_string(obj)
40
+
41
+ return ro.DataObjectReference(
42
+ content_type=content_type,
43
+ title=obj.citation.title,
44
+ uuid=obj.uuid,
45
+ version_string=obj.citation.version_string,
46
+ )
pyetp/utils.py DELETED
@@ -1,15 +0,0 @@
1
- import random
2
- import string
3
- from itertools import islice
4
- from typing import Iterable
5
- def short_id(length=8):
6
- return ''.join([random.choice(string.ascii_letters + string.digits + '-_') for _ in range(length)])
7
-
8
- def batched(iterable:Iterable, n: int):
9
- "Batch data into tuples of length n. The last batch may be shorter."
10
- # batched('ABCDEFG', 3) --> ABC DEF G
11
- if n < 1:
12
- raise ValueError('n must be at least one')
13
- it = iter(iterable)
14
- while batch := tuple(islice(it, n)):
15
- yield batch
@@ -1,56 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: pyetp
3
- Version: 0.0.39
4
- Summary: Interface with OSDU RDDMS using ETP protocol
5
- Author: Adam Cheng
6
- Author-email: 52572642+adamchengtkc@users.noreply.github.com
7
- Requires-Python: >=3.10,<3.13
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Dist: async-lru (>=2.0.4,<3.0.0)
15
- Requires-Dist: async-timeout (>=5.0,<6.0) ; python_version < "3.11"
16
- Requires-Dist: etpproto (>=1.0.7,<2.0.0)
17
- Requires-Dist: lxml (>=4.9.4,<6.0)
18
- Requires-Dist: numpy (>=1.26.3,<2.0.0)
19
- Requires-Dist: pyarrow (>=15.0.0,<16.0.0)
20
- Requires-Dist: pydantic (>=1.10,<2.0)
21
- Requires-Dist: redis (>=5.0.1,<6.0.0)
22
- Requires-Dist: resqpy (>=5.1.10,<6.0.0)
23
- Requires-Dist: websockets (>=12.0,<13.0)
24
- Requires-Dist: xsdata (>=24.3.1,<25.0.0)
25
- Requires-Dist: xtgeo (>=3.8.0,<4.0.0)
26
- Project-URL: Homepage, https://github.com/equinor/pyetp
27
- Description-Content-Type: text/markdown
28
-
29
- ![Build Status](https://github.com/equinor/pyetp/actions/workflows/ci.yml/badge.svg?branch=main)
30
- ![Build Status](https://github.com/equinor/pyetp/actions/workflows/snyk.yml/badge.svg?branch=main)
31
- ![codecov](https://codecov.io/gh/equinor/pyetp/graph/badge.svg?token=S2XDDKKI8U)
32
- ![Python](https://img.shields.io/pypi/pyversions/pyetp)
33
- [![PyPI version](https://badge.fury.io/py/pyetp.svg)](https://badge.fury.io/py/pyetp)
34
- ![License](https://img.shields.io/github/license/equinor/pyetp)
35
- # Install
36
- `pip install pyetp`
37
-
38
- # RESQML versions
39
- The library is build and tested against RESQML v2.2. Spec can be downloaded [here](https://publications.opengroup.org/standards/energistics-standards/v231)
40
-
41
- # Generated Python objects from RESQML spec
42
- Under `resqml_objects` you will find Pythons objects generated from RESQML xml spec. It is used to ensure consistence data type is used in RESQML.
43
-
44
- # Documentation
45
- See `/examples` for 2D grid usage
46
-
47
- `tests/test_mesh.py` for Unstructured/structured mesh
48
-
49
- # Tests
50
- ### Starting etp-test server
51
- `docker compose -f tests/compose.yml up --detach`
52
- ### Running pytest from root folder
53
- `poetry run python -m pytest -rs -v`
54
-
55
- # This library is under active development and subject to breaking changes
56
-
@@ -1,14 +0,0 @@
1
- pyetp/__init__.py,sha256=FSlPJ3AXoMe3vDQ0z8k417aKJWwt7sxbNPsLgdc21tI,123
2
- pyetp/client.py,sha256=H2fSpR4tNM4dfXvldlmI4VxemepOTarNGKkCuQos108,47173
3
- pyetp/config.py,sha256=eKSpS7EXOYchZPoh0bHsNTQIAcipG-nFYKpfdtEz3g8,868
4
- pyetp/resqml_objects/__init__.py,sha256=Sr_1bktzS8JMmE9oi6pcW6BuERm7gH0u50rBs58zI7Q,50492
5
- pyetp/resqml_objects/generated.py,sha256=P-hfL8btOE6uAmtaGXbSdWMl8Z9iJx-r6FRzSvmzHvU,783914
6
- pyetp/types.py,sha256=k3lvtgYmLO5aZGkQE2CChQ0RO-fB-Bkc9AC9uCrAC94,6458
7
- pyetp/uri.py,sha256=6NE_-QvtaL_z5NCUbxehc28ul-70DgXpMiEGaIJPqNc,2996
8
- pyetp/utils.py,sha256=4U_9ndZGzN3B0xMoeSglmxdg7jgfYP5v_mE6tF2Lqmc,518
9
- pyetp/utils_arrays.py,sha256=HHhw23La4SG7UJyd5Q_OJ5WlMq98QpwHBk553YyyYOk,4331
10
- pyetp/utils_xml.py,sha256=OLGKPxFsz2OzsJOEJDgQXIZ9wwvanlOr6jD3i3KHVZI,33861
11
- pyetp-0.0.39.dist-info/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- pyetp-0.0.39.dist-info/METADATA,sha256=YQbDM2BM20w8fUdyz6NVIyU8e8-aZxSA-JOg9aMD8IA,2347
13
- pyetp-0.0.39.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
- pyetp-0.0.39.dist-info/RECORD,,