def __markdown(informations: _Dict[int, ErrorInfo]) -> str: """制作 markdown 格式的表格""" content_list = list() informations = _ODict(sorted(informations.items())) for key, value in informations.items(): content_list.append(__makeline(key, value)) return '\n'.join(content_list)
def __init__(self, *param_names): self._store = _ODict() self._paramnames = param_names _vld.pass_if( len(param_names) <= self._MAX_PARAMS, IndexError, 'There can be no more than {} custom parameters'.format( self._MAX_PARAMS)) if self._paramnames: # Declare a new ScriptParameters named tuple type and override its str() behavior typename = self._get_typename(self._PARAM_CONST) self._paramtuple = _ntuple(typename, field_names=param_names) self._paramtuple.__str__ = lambda x: repr(x).replace( typename, _const.CHAR_EMPTY) else: # Use a regular tuple type if no parameter names have been set self._paramtuple = tuple
def saveConfig(): """Write config and PSE to json-file""" with open(_expanduser('~/.vipster.json'), 'w') as f: _dump(_ODict([('PSE', pse), ('General', config), ('Parameters', _paramdict)]), f, indent=2)
# -*- coding: utf-8 -*- from copy import deepcopy as _deepcopy from collections import OrderedDict as _ODict from importlib import import_module as _import from os import remove from shutil import move from vipster.settings import _paramdict _formats = ["xyz", "pwInput", "pwOutput", "lammpsData", "lammpsCustom", "cube", "empire", "aimall", "cpmd", "turbomole", "xsf", "mol2"] _plugins = [] for i in _formats: _plugins.append(_import(".ioplugins." + i, package="vipster")) _indict = _ODict([(i.argument, i.parser) for i in _plugins]) _outdict = _ODict([(i.argument, i.writer) for i in _plugins if i.writer]) _guiInNames = _ODict([(i.name, i.argument) for i in _plugins]) _guiOutNames = _ODict([(i.name, i.argument) for i in _plugins if i.writer]) _defaultParams = _ODict([(i.argument, i.param) for i in _plugins if i.param]) for i in _defaultParams: for j in _defaultParams[i]: if j not in _paramdict[i]: _paramdict[i][j] = _defaultParams[i][j] inFormats = _indict.keys() outFormats = _outdict.keys() def readFile(filename, fmt): """ Read and parse a given file