pythermodb-settings 0.1.8__tar.gz → 0.1.9__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 (23) hide show
  1. {pythermodb_settings-0.1.8/pythermodb_settings.egg-info → pythermodb_settings-0.1.9}/PKG-INFO +1 -1
  2. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pyproject.toml +1 -1
  3. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/configs/about.py +1 -1
  4. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/utils/component_utils.py +29 -8
  5. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9/pythermodb_settings.egg-info}/PKG-INFO +1 -1
  6. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/LICENSE +0 -0
  7. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/README.md +0 -0
  8. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/__init__.py +0 -0
  9. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/app.py +0 -0
  10. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/configs/__init__.py +0 -0
  11. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/models/__init__.py +0 -0
  12. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/models/components.py +0 -0
  13. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/models/conditions.py +0 -0
  14. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/models/configs.py +0 -0
  15. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/models/references.py +0 -0
  16. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/models/rules.py +0 -0
  17. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/models/source.py +0 -0
  18. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings/utils/__init__.py +0 -0
  19. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings.egg-info/SOURCES.txt +0 -0
  20. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings.egg-info/dependency_links.txt +0 -0
  21. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings.egg-info/requires.txt +0 -0
  22. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/pythermodb_settings.egg-info/top_level.txt +0 -0
  23. {pythermodb_settings-0.1.8 → pythermodb_settings-0.1.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythermodb-settings
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Add your description here
5
5
  Author-email: Sina Gilassi <sina.gilassi@gmail.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pythermodb-settings"
7
- version = "0.1.8"
7
+ version = "0.1.9"
8
8
  description = "Add your description here"
9
9
  authors = [
10
10
  { name = "Sina Gilassi", email = "sina.gilassi@gmail.com" }
@@ -1,5 +1,5 @@
1
1
  # NOTE: app info
2
- __version__ = "0.1.8"
2
+ __version__ = "0.1.9"
3
3
  __description__ = """PyThermoDB Settings is a Python package that acts as an interface between pythermdb and other applications, providing robust, Pydantic-based data models and configuration structures for managing thermodynamic database (ThermoDB) settings."""
4
4
  __author__ = "Sina Gilassi"
5
5
  __author_email__ = "sina.gilassi@gmail.com"
@@ -231,9 +231,15 @@ def create_binary_mixture_id(
231
231
  def create_mixture_id(
232
232
  components: list[Component],
233
233
  mixture_key: Literal[
234
- 'Name', 'Formula', 'Name-State', 'Formula-State',
234
+ 'Name',
235
+ 'Formula',
236
+ 'Name-State',
237
+ 'Formula-State',
238
+ 'Name-Formula-State',
239
+ 'Formula-Name-State'
235
240
  ] = 'Name',
236
- delimiter: str = "|"
241
+ delimiter: str = "|",
242
+ case: Literal['lower', 'upper', None] = None
237
243
  ) -> str:
238
244
  """Create a unique mixture ID based on a list of components (sorted alphabetically).
239
245
 
@@ -241,10 +247,12 @@ def create_mixture_id(
241
247
  ----------
242
248
  components : list[Component]
243
249
  List of components in the mixture.
244
- component_key : Literal['Name', 'Formula', 'Name-State', 'Formula-State'], optional
250
+ component_key : Literal['Name', 'Formula', 'Name-State', 'Formula-State', 'Name-Formula-State', 'Formula-Name-State'], optional
245
251
  The key to use for identifying the components, by default 'Name'.
246
252
  delimiter : str, optional
247
253
  Delimiter to separate the components in the ID, by default "|".
254
+ case : Literal['lower', 'upper', None], optional
255
+ Convert the identifier to lower or upper case, by default 'lower'.
248
256
 
249
257
  Returns
250
258
  -------
@@ -287,25 +295,38 @@ def create_mixture_id(
287
295
  component_ids = []
288
296
  for comp in components:
289
297
  if mixture_key == 'Name':
290
- comp_id = comp.name.strip().lower()
298
+ comp_id = comp.name.strip()
291
299
  elif mixture_key == 'Formula':
292
- comp_id = comp.formula.strip().lower()
300
+ comp_id = comp.formula.strip()
293
301
  elif mixture_key == 'Name-State':
294
- comp_id = f"{comp.name.strip().lower()}-{comp.state.strip().lower()}"
302
+ comp_id = f"{comp.name.strip()}-{comp.state.strip()}"
295
303
  elif mixture_key == 'Formula-State':
296
- comp_id = f"{comp.formula.strip().lower()}-{comp.state.strip().lower()}"
304
+ comp_id = f"{comp.formula.strip()}-{comp.state.strip()}"
305
+ elif mixture_key == 'Name-Formula-State':
306
+ comp_id = f"{comp.name.strip()}-{comp.formula.strip()}-{comp.state.strip()}"
307
+ elif mixture_key == 'Formula-Name-State':
308
+ comp_id = f"{comp.formula.strip()}-{comp.name.strip()}-{comp.state.strip()}"
297
309
  else:
298
310
  raise ValueError(
299
- "component_key must be either 'Name' or 'Formula'"
311
+ "component_key must be one of the following: Name, Formula, Name-State, Formula-State, Name-Formula-State, Formula-Name-State"
300
312
  )
301
313
  component_ids.append(comp_id)
302
314
 
303
315
  # SECTION: create unique mixture ID (sorted to ensure uniqueness)
316
+ # ! sorted alphabetically
304
317
  mixture_id = delimiter.join(sorted(component_ids))
305
318
 
306
319
  # strip
307
320
  mixture_id = mixture_id.strip()
308
321
 
322
+ # NOTE: apply conversion
323
+ if case == 'lower':
324
+ mixture_id = mixture_id.lower()
325
+ elif case == 'upper':
326
+ mixture_id = mixture_id.upper()
327
+ elif case is None:
328
+ pass
329
+
309
330
  # return
310
331
  return mixture_id
311
332
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythermodb-settings
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Add your description here
5
5
  Author-email: Sina Gilassi <sina.gilassi@gmail.com>
6
6
  License-Expression: MIT