コード例 #1
0
def intern_cell_word(word: str):
    word = pu.ensure_upper(word)
    word, res = pu.internalize(word, CELL_WORDS)
    if not res:
        raise pu.ParseError(
            f"'{word}' is not a valid word for cell specification")
    return word
コード例 #2
0
ファイル: material_parser.py プロジェクト: MC-kit/mckit
 def option(self, p):
     text: str = p.OPTION
     if "=" in text:
         text = text.replace("=", " ", 1)
     option, value = text.split()
     option = cmn.ensure_upper(option)
     if option in ("GAS", "ESTEP", "COND"):
         value = int(value)
     return option, value
コード例 #3
0
def intern_surface_type(word: str):
    word = pu.ensure_upper(word)
    word, res = pu.internalize(word, SURFACE_TYPES)
    if not res:
        raise pu.ParseError(f"{word} is not a valid surface type")
    return word
コード例 #4
0
 def particle(self, p):
     result = pu.ensure_upper(p[0])
     return result