type_from_type

Full name: ase2sprkkr.common.grammar_types.type_from_type

ase2sprkkr.common.grammar_types.type_from_type(type, format='', format_all=False, type_map={})[source]

Guess and return the grammar element (GrammarType class descendatnt) from a python type. E.g. int => Integer.

The given format can be optionally set to the returned grammar element.

Parameters
  • type (A python type or GrammarType) – A type to be converted to a grammar type (GrammarType class descendant)

  • format (Union[str, Dict]) – The format to be applied to the resulting class. If dict is given, see format_for_type() for the way how the format is determined

  • format_all (bool) – If False (default), the format is not applied, if instance of GrammarType is given as the type parameter. Otherwise, a copy of the input type with the applied format is returned

  • type_map (Dict) –