ontolutils 0.4.0__tar.gz → 0.4.2__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.
Files changed (40) hide show
  1. {ontolutils-0.4.0 → ontolutils-0.4.2}/PKG-INFO +1 -1
  2. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/classes/thing.py +4 -1
  3. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/utils/qudt_units.py +10 -3
  4. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils.egg-info/PKG-INFO +1 -1
  5. {ontolutils-0.4.0 → ontolutils-0.4.2}/setup.cfg +1 -1
  6. {ontolutils-0.4.0 → ontolutils-0.4.2}/LICENSE +0 -0
  7. {ontolutils-0.4.0 → ontolutils-0.4.2}/README.md +0 -0
  8. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/__init__.py +0 -0
  9. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/_version.py +0 -0
  10. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/cache.py +0 -0
  11. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/classes/__init__.py +0 -0
  12. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/classes/decorator.py +0 -0
  13. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/classes/query_util.py +0 -0
  14. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/classes/typing.py +0 -0
  15. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/classes/utils.py +0 -0
  16. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/__dev.py +0 -0
  17. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/__init__.py +0 -0
  18. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/_iana_utils.py +0 -0
  19. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/codemeta.py +0 -0
  20. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/m4i.py +0 -0
  21. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/obo.py +0 -0
  22. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/qudt_kind.py +0 -0
  23. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/qudt_unit.py +0 -0
  24. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/schema.py +0 -0
  25. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/namespacelib/ssno.py +0 -0
  26. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils/utils/__init__.py +0 -0
  27. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils.egg-info/SOURCES.txt +0 -0
  28. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils.egg-info/dependency_links.txt +0 -0
  29. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils.egg-info/requires.txt +0 -0
  30. {ontolutils-0.4.0 → ontolutils-0.4.2}/ontolutils.egg-info/top_level.txt +0 -0
  31. {ontolutils-0.4.0 → ontolutils-0.4.2}/pyproject.toml +0 -0
  32. {ontolutils-0.4.0 → ontolutils-0.4.2}/setup.py +0 -0
  33. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_classes.py +0 -0
  34. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_decorator.py +0 -0
  35. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_namespaces.py +0 -0
  36. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_query.py +0 -0
  37. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_readme.py +0 -0
  38. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_typing.py +0 -0
  39. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_utils.py +0 -0
  40. {ontolutils-0.4.0 → ontolutils-0.4.2}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ontolutils
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Utility library for the work with ontologies.
5
5
  Home-page: https://github.com/matthiasprobst/ontology-utils
6
6
  Author: Matthias Probst
@@ -347,7 +347,10 @@ class Thing(ThingModel):
347
347
 
348
348
  def __repr__(self, limit: Optional[int] = None):
349
349
  _fields = {k: getattr(self, k) for k in self.model_fields if getattr(self, k) is not None}
350
- repr_extra = ", ".join([f"{k}={v}" for k, v in {**_fields, **self.model_extra}.items()])
350
+ if self.model_extra:
351
+ repr_extra = ", ".join([f"{k}={v}" for k, v in {**_fields, **self.model_extra}.items()])
352
+ else:
353
+ repr_extra = ", ".join([f"{k}={v}" for k, v in {**_fields}.items()])
351
354
  if limit is None or len(repr_extra) < limit:
352
355
  return f"{self.__class__.__name__}({repr_extra})"
353
356
  return f"{self.__class__.__name__}({repr_extra[0:limit]}...)"
@@ -1,6 +1,7 @@
1
1
  import rdflib
2
2
 
3
3
  from ontolutils import QUDT_UNIT
4
+ from typing import Optional
4
5
 
5
6
  qudt_lookup = {
6
7
  's': QUDT_UNIT.SEC, # time
@@ -61,7 +62,11 @@ qudt_lookup = {
61
62
  'mm**3': QUDT_UNIT.MilliM3,
62
63
  # volume flow rate
63
64
  'm3/s': QUDT_UNIT.M3_PER_SEC,
65
+ 'm^3/s': QUDT_UNIT.M3_PER_SEC,
64
66
  'm3 s-1': QUDT_UNIT.M3_PER_SEC,
67
+ 'm3 s^-1': QUDT_UNIT.M3_PER_SEC,
68
+ 'm^3 s-1': QUDT_UNIT.M3_PER_SEC,
69
+ 'm^3 s^-1': QUDT_UNIT.M3_PER_SEC,
65
70
  'm3*s-1': QUDT_UNIT.M3_PER_SEC,
66
71
  'm3*s^-1': QUDT_UNIT.M3_PER_SEC,
67
72
  'm3*s**-1': QUDT_UNIT.M3_PER_SEC,
@@ -169,7 +174,7 @@ qudt_lookup = {
169
174
  'mol': QUDT_UNIT.MOL,
170
175
  'mol s-1': QUDT_UNIT.MOL_PER_SEC,
171
176
  'mol m-2': QUDT_UNIT.MOL_PER_M2,
172
- 'g kg-1:': QUDT_UNIT.GM_PER_KiloGM,
177
+ 'g kg-1': QUDT_UNIT.GM_PER_KiloGM,
173
178
  'Pa m': QUDT_UNIT.PA_M,
174
179
  'K m s-1': QUDT_UNIT.K_M_PER_SEC,
175
180
  's-1 m-3': QUDT_UNIT.PER_M3_SEC,
@@ -214,7 +219,7 @@ qudt_lookup = {
214
219
  }
215
220
 
216
221
 
217
- def parse_unit(unit_str: str) -> rdflib.URIRef:
222
+ def parse_unit(unit_str: str) -> Optional[rdflib.URIRef]:
218
223
  """Return IRI for a unit str. E.g. 'm/s' returns QUDT_UNIT.M_PER_SEC.
219
224
 
220
225
  Parameters
@@ -232,4 +237,6 @@ def parse_unit(unit_str: str) -> rdflib.URIRef:
232
237
  KeyError
233
238
  If the unit string is not in the lookup table
234
239
  """
235
- return qudt_lookup[unit_str]
240
+ if unit_str == '1e-3':
241
+ return qudt_lookup['dimensionless']
242
+ return qudt_lookup.get(unit_str, None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ontolutils
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Utility library for the work with ontologies.
5
5
  Home-page: https://github.com/matthiasprobst/ontology-utils
6
6
  Author: Matthias Probst
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ontolutils
3
- version = 0.4.0
3
+ version = 0.4.2
4
4
  author = Matthias Probst
5
5
  author_email = matthias.probst@kit.edu
6
6
  description = Utility library for the work with ontologies.
File without changes
File without changes
File without changes
File without changes