Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Will using "Ids" and "ids" be confusing ( "I" vs "i") ? "Ids" superclass will be defined for internal purposes only....

...

IDS names

To avoid any mistakes, db_entry.get method argument describing IDS should not be a string (ida name - 'equilibrium', 'wall' etc) but a constant value.

It can be implemented using enum or class attribute

Enum

class IDSNamesclass IdsNames(enum):  #any better name?

...

     WALL = 'wall' 

etc etc


e.g. IDSNames.WALL

Given IDS class attribute

e.g. wall.__name__



Importing IDS classes

  • IDSes are defined in modules (files) corresponding to their names (e.g.  class wall defined in wall.py)
  • A correct usage is
    • from imas import wall;   ids_wall = wall.wall()
    • from imas.wall import wal; ids_wall = wall()
  • lt could be make easier for user adding import in imas __init__.py  (from wall import wall)
    • __init__.py has to be generated based on IDSDef.xml to add from <ids> import <ids>
    • user can use simpler form: "ids_wall = wall()" without doing any explicit imports



Code Block
Suggestion from Olivier:

...



could all specific IDS type modules be imported to a front end 'ids' module? so users would do:

...


wall = ids.wall()

...


instead of proposed

...


wall = wall.wall()

...

also this would allow for 'exploring' the available IDS types, while is users need to import module per IDS type user need to know the exact list of types available for a given version


Answer: Requested schema cannot be implemented without breaking backward compatibility due to name clash

Explanation:

  • existing imas.ids is a class (container keeping all IDSes as attributes)
    • it will be not used in new 'scenario' but
    • it should be kept for backward compatibility
    • BTW the issue results from bad decisions took at design time
      • ids class is container for IDSes so its name doesn't correspond to its role
      • according to Py naming convention ids class should be named using capital letters - so IDS 
  • proposed - imas/ids is a package (module/directory) keeping all IDS classes ( <ids>.py)
  • once initialised ids object cannot be both: class and module at the same time


Proposed solution - to change ids package/directory to other name (idses?)