Skip to main content

Tools to manipulate the IDSPy Dictionaries

Project description

This module contains a serie of function to help mange and manipulate IDSPy dataclasses

  • fill_missing_values

  • ids_to_hdf5

  • hdf5_to_ids

  • get_ids_value_from_string

  • set_ids_value_from_string

  • list_ids_members

  • copy_ids

Please note that this work is still under progress/heavy development and as experimental status. This means that functions arguments/signatures as long as HDF5 structure might be totally redesigned in the next updates.

## Quick example

 1  import pprint
 2  import dataclasses
 3 
 4  import idspy_toolkit
 5  from idspy_dictionaries import ids_gyrokinetics
 6 
 7  pp = pprint.PrettyPrinter(indent=2)
 8 
 9  ids_test = ids_gyrokinetics.Gyrokinetics()
10  # you can directly print the class to see what it looks like  :
11  pp.pprint(ids_test)
12 
13  # if you want to see all the available classes in the current module :
14  ids_dict = idspy_toolkit.list_ids_members(gkids)
15  pp.pprint(ids_dict)
16 
17  #to fill an IDS with default values
18  idspy_toolkit.fill_missing_values(ids_test)
19 
20  # you can use the . to access ids members :
21  pp.pprint(ids_test.ids_properties)
22 
23  # and to set a value :
24  ids_test.ids_properties.comment="a comment"
25 
26  # if in a script you want to reach a "deeper" value, you can use the function *get_ids_value_from_string*
27  idspy_toolkit.get_ids_value_from_string(ids_test, "ids_properties/comment")
28  # and for list element, put the element index after an #
29  idspy_toolkit.get_ids_value_from_string(ids_test, "tag#0/name")
30 
31  # same kind of function exist to set a value :
32  idspy_toolkit.set_ids_value_from_string(ids_test, "tag#0/name", "a new tag name")
33 
34  # pour afficher la classe sous forme de dictionnaire (conseil mettez l'ecran en vertical ;)):
35  ids_dict = dataclasses.asdict(ids_test)
36  pp.pprint(ids_dict)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

idspy_toolkit-0.7.0.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

idspy_toolkit-0.7.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file idspy_toolkit-0.7.0.tar.gz.

File metadata

  • Download URL: idspy_toolkit-0.7.0.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for idspy_toolkit-0.7.0.tar.gz
Algorithm Hash digest
SHA256 7830ea52c4a1c08f2e9043b3eddc4492cdee7ab927853ba321ca00f7cd31a687
MD5 1a1468c895aa8377876b2e00f953f2f5
BLAKE2b-256 22a76849435aa1b19384e45c4bb4979a30dfebb1892f92017f9e581ed2aeb446

See more details on using hashes here.

File details

Details for the file idspy_toolkit-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for idspy_toolkit-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0933cab6384d0e3e8e4430bc0fe5470c92be7efec7702635a095180848ce8bf
MD5 6e55e49c28e05c5034ac9adc9cc13845
BLAKE2b-256 f658189c63da1c2c3be6c479920b707b707793ebd29e74db7ec63aff400424c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page