本文整理汇总了Python中grid_control.parameters.psource_base.ParameterSource.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterSource.__init__方法的具体用法?Python ParameterSource.__init__怎么用?Python ParameterSource.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grid_control.parameters.psource_base.ParameterSource
的用法示例。
在下文中一共展示了ParameterSource.__init__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, fn):
ParameterSource.__init__(self)
fp = gzip.open(fn, 'rb')
keyline = fp.readline().lstrip('#').strip()
self.keys = []
if keyline:
self.keys = eval(keyline)
def parseLine(line):
if not line.startswith('#'):
pNumStr, stored = map(str.strip, line.split('\t', 1))
return ('!' in pNumStr, int(pNumStr.rstrip('!')), map(eval, stored.split('\t')))
self.values = map(parseLine, fp.readlines())
示例2: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, dataDir, srcName, dataProvider, dataSplitter, dataProc, keepOld = True):
ParameterSource.__init__(self)
(self._dataDir, self._srcName, self._dataProvider, self._dataSplitter, self._part_proc) = \
(dataDir, srcName, dataProvider, dataSplitter, dataProc)
if not dataProvider:
pass # debug mode - used by scripts - disables resync
elif os.path.exists(self.getDataPath('cache.dat') and self.getDataPath('map.tar')):
self._dataSplitter.importPartitions(self.getDataPath('map.tar'))
else:
DataProvider.saveToFile(self.getDataPath('cache.dat'), self._dataProvider.getBlocks(silent = False))
self._dataSplitter.splitDataset(self.getDataPath('map.tar'), self._dataProvider.getBlocks())
self._maxN = self._dataSplitter.getMaxJobs()
self._keepOld = keepOld
示例3: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, fn):
ParameterSource.__init__(self)
fp = ZipFile(fn, 'r')
try:
keyline = fp.readline().lstrip('#').strip()
self._keys = []
if keyline:
self._keys = parseJSON(keyline)
def parseLine(line):
if not line.startswith('#'):
pNumStr, stored = lmap(str.strip, line.split('\t', 1))
return ('!' in pNumStr, int(pNumStr.rstrip('!')), lmap(parseJSON, stored.split('\t')))
self._values = lmap(parseLine, fp.readlines())
finally:
fp.close()
示例4: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, dataDir, srcName, dataProvider, dataSplitter, dataProc):
ParameterSource.__init__(self)
(self.dataDir, self.srcName, self.dataProvider, self.dataSplitter, self.dataProc) = \
(dataDir, srcName, dataProvider, dataSplitter, dataProc)
if not dataProvider:
pass # debug mode - used by scripts - disables resync
elif os.path.exists(self.getDataPath('cache.dat') and self.getDataPath('map.tar')):
self.dataSplitter.importState(self.getDataPath('map.tar'))
else:
self.dataProvider.saveState(self.getDataPath('cache.dat'))
self.dataSplitter.splitDataset(self.getDataPath('map.tar'), self.dataProvider.getBlocks())
self.maxN = self.dataSplitter.getMaxJobs()
self.keepOld = True
示例5: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, fn):
ParameterSource.__init__(self)
fp = GZipTextFile(fn, 'r')
try:
header = fp.readline().lstrip('#').strip()
self._output_vn_list = []
if header:
self._output_vn_list = parse_json(header)
def _parse_line(line):
if not line.startswith('#'):
pnum_str, stored_json = line.split('\t', 1)
is_invalid = '!' in pnum_str
pnum = int(pnum_str.replace('!', ' '))
return (is_invalid, pnum, lmap(parse_json, stored_json.strip().split('\t')))
self._values = lmap(_parse_line, fp.readlines())
finally:
fp.close()
示例6: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, *psources):
ParameterSource.__init__(self)
self._psourceList = psources
self._psourceMaxList = lmap(lambda p: p.getMaxParameters(), self._psourceList)
self._maxParameters = self.initMaxParameters()
示例7: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, *keys):
ParameterSource.__init__(self)
self.keys = map(lambda key: key.lstrip('!'), keys)
self.meta = map(lambda key: ParameterMetadata(key.lstrip('!'), untracked = '!' in key), keys)
示例8: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, *psources):
ParameterSource.__init__(self)
self._psourceList = strip_null_sources(psources)
self._psourceMaxList = lmap(lambda p: p.getMaxParameters(), self._psourceList)
self._maxParameters = self._initMaxParameters()
示例9: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, hash_src_list):
ParameterSource.__init__(self)
self._hash = md5_hex(repr(hash_src_list))
示例10: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, *psrc_list):
ParameterSource.__init__(self)
self._psrc_list = list(_sort_deps(_strip_null_sources(psrc_list)))
self._psrc_max_list = lmap(lambda psrc: psrc.get_parameter_len(), self._psrc_list)
self._psrc_max = self._init_psrc_max()
示例11: __init__
# 需要导入模块: from grid_control.parameters.psource_base import ParameterSource [as 别名]
# 或者: from grid_control.parameters.psource_base.ParameterSource import __init__ [as 别名]
def __init__(self, *args, **kwargs):
ParameterSource.__init__(self)
raise APIError('Redirector class initialized')