async version of tiramisu
This commit is contained in:
@ -191,8 +191,9 @@ def _getproperties(multi, isfollower, kwargs):
|
||||
# define properties
|
||||
properties = copy(PROPERTIES_LIST)
|
||||
if multi and not isfollower:
|
||||
default_props = ['empty']
|
||||
default_props = ['empty', 'unique']
|
||||
properties.append('empty')
|
||||
properties.append('unique')
|
||||
else:
|
||||
default_props = []
|
||||
extra_properties = kwargs.get('extra_properties')
|
||||
@ -248,8 +249,9 @@ def _property_permissive(cfg, mcfg, pathread, pathwrite, confread, confwrite, **
|
||||
# define properties
|
||||
properties = copy(PROPERTIES_LIST)
|
||||
if multi and not isfollower:
|
||||
default_props = ['empty']
|
||||
default_props = ['empty', 'unique']
|
||||
properties.append('empty')
|
||||
properties.append('unique')
|
||||
else:
|
||||
default_props = []
|
||||
extra_properties = kwargs.get('extra_properties')
|
||||
@ -662,8 +664,11 @@ def autocheck_append_value(cfg, mcfg, pathread, pathwrite, confread, confwrite,
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
if not kwargs.get('propertyerror', False):
|
||||
leader_value = cfg_.forcepermissive.option(pathread).value.get()
|
||||
v3 = cfg_.forcepermissive.option(pathread).value.get()
|
||||
len_value = len(leader_value)
|
||||
leader_value.append(undefined)
|
||||
print('debut', leader_value, cfg_._config_bag.context._impl_values_cache._cache['odleader.first'][None][0])
|
||||
print(id(leader_value), id(cfg_._config_bag.context._impl_values_cache._cache['odleader.first'][None][0]))
|
||||
assert len(cfg_.forcepermissive.option(pathread).value.get()) == len_value
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
cfg2_.forcepermissive.option(pathread).value.set(leader_value)
|
||||
@ -683,7 +688,12 @@ def autocheck_append_value(cfg, mcfg, pathread, pathwrite, confread, confwrite,
|
||||
value = 'value'
|
||||
else:
|
||||
value = ['value']
|
||||
print('==>>>')
|
||||
print(leader_value, cfg_._config_bag.context._impl_values_cache._cache['odleader.first'][None][0])
|
||||
print(id(leader_value), id(cfg_._config_bag.context._impl_values_cache._cache['odleader.first'][None][0]))
|
||||
leader_value.append(value)
|
||||
print(leader_value, cfg_._config_bag.context._impl_values_cache._cache['odleader.first'][None][0])
|
||||
print(id(leader_value), id(cfg_._config_bag.context._impl_values_cache._cache['odleader.first'][None][0]))
|
||||
assert len(cfg_.forcepermissive.option(pathread).value.get()) == len(new_leader_value)
|
||||
cfg2_.forcepermissive.option(pathread).value.set(leader_value)
|
||||
assert cfg_.forcepermissive.option(pathread).value.get()[-1] == value
|
||||
@ -1192,7 +1202,7 @@ def autocheck_find(cfg, mcfg, pathread, pathwrite, confread, confwrite, **kwargs
|
||||
do(confwrite)
|
||||
|
||||
|
||||
def check_all(cfg, paths_, path, meta, multi, default, default_multi, require, consistency, callback, symlink, weakrefs, **kwargs):
|
||||
def check_all(cfg, paths_, path, meta, multi, default, default_multi, require, callback, symlink, weakrefs, **kwargs):
|
||||
def _build_make_dict():
|
||||
dico = {}
|
||||
dico_value = {}
|
||||
@ -1284,31 +1294,6 @@ def check_all(cfg, paths_, path, meta, multi, default, default_multi, require, c
|
||||
if symlink:
|
||||
dico['extraoptrequirelink'] = 'value'
|
||||
dico_value['extraoptrequirelink'] = 'value'
|
||||
if consistency and has_value:
|
||||
cpath = list(dico.keys())[0]
|
||||
if "." in cpath:
|
||||
cpath = cpath.rsplit('.', 1)[0] + '.'
|
||||
else:
|
||||
cpath = ''
|
||||
if multi:
|
||||
value = []
|
||||
else:
|
||||
value = None
|
||||
if is_dyn:
|
||||
dico[cpath + 'extraoptconsistencyval1'] = value
|
||||
dico_value[cpath + 'extraoptconsistencyval1'] = value
|
||||
if is_leader:
|
||||
spath = cpath.split('.')
|
||||
spath[-2] = spath[-2][:-1] + '2'
|
||||
spath[-3] = spath[-3][:-1] + '2'
|
||||
npath = '.'.join(spath) + 'extraoptconsistencyval2'
|
||||
else:
|
||||
npath = cpath[:-2] + '2.' + 'extraoptconsistencyval2'
|
||||
dico[npath] = value
|
||||
dico_value[npath] = value
|
||||
else:
|
||||
dico[cpath + 'extraoptconsistency'] = value
|
||||
dico_value[cpath + 'extraoptconsistency'] = value
|
||||
if is_leader:
|
||||
for cpath in list(paths_.keys())[len(dyns):]:
|
||||
if cpath.endswith('.first') or cpath.endswith('.firstval1') or cpath.endswith('.firstval2'):
|
||||
@ -1372,8 +1357,6 @@ def check_all(cfg, paths_, path, meta, multi, default, default_multi, require, c
|
||||
text += u' with default multi'
|
||||
if require:
|
||||
text += u' with requirement'
|
||||
if consistency:
|
||||
text += u' with consistency'
|
||||
text += u', kwargs: {}'.format(kwargs)
|
||||
print(text)
|
||||
if not require:
|
||||
@ -1528,7 +1511,7 @@ def check_deref(weakrefs):
|
||||
assert wrf() is None
|
||||
|
||||
|
||||
def make_conf(options, multi, default, default_multi, require, consistency, callback, symlink):
|
||||
def make_conf(options, multi, default, default_multi, require, callback, symlink):
|
||||
weakrefs = []
|
||||
dyn = []
|
||||
goptions = []
|
||||
@ -1591,7 +1574,8 @@ def make_conf(options, multi, default, default_multi, require, consistency, call
|
||||
if callback:
|
||||
largs = [path + 'call', "{}'s callback option".format(path)]
|
||||
objcall = tiramisu_option(*largs, **call_kwargs)
|
||||
kwargs['callback_params'] = Params(ParamOption(objcall))
|
||||
kwargs['default'] = Calculation(kwargs['callback'], Params(ParamOption(objcall)))
|
||||
del kwargs['callback']
|
||||
else:
|
||||
objcall = None
|
||||
if symlink and not path.endswith('extraoptconsistency'):
|
||||
@ -1601,16 +1585,8 @@ def make_conf(options, multi, default, default_multi, require, consistency, call
|
||||
tiramisu_option = SymLinkOption
|
||||
else:
|
||||
sobj = None
|
||||
print(args, kwargs)
|
||||
obj = tiramisu_option(*args, **kwargs)
|
||||
if not 'extraopt' in path and consistency:
|
||||
if require:
|
||||
if symlink:
|
||||
gopt = goptions[2]
|
||||
else:
|
||||
gopt = goptions[1]
|
||||
else:
|
||||
gopt = goptions[0]
|
||||
obj.impl_add_consistency('not_equal', gopt, warnings_only=True, transitive=False)
|
||||
return obj, objcall, sobj
|
||||
|
||||
def make_optiondescriptions(path, collected):
|
||||
@ -1649,17 +1625,10 @@ def make_conf(options, multi, default, default_multi, require, consistency, call
|
||||
return obj
|
||||
|
||||
collect_options = {}
|
||||
if require or consistency:
|
||||
if require:
|
||||
noptions = OrderedDict()
|
||||
if require:
|
||||
noptions['extraoptrequire'] = {}
|
||||
if consistency:
|
||||
subpath = list(options.keys())[0]
|
||||
if '.' in subpath:
|
||||
subpath = subpath.rsplit('.', 1)[0] + '.'
|
||||
else:
|
||||
subpath = ''
|
||||
noptions[subpath + 'extraoptconsistency'] = {}
|
||||
noptions.update(options)
|
||||
else:
|
||||
noptions = options
|
||||
@ -1810,53 +1779,48 @@ def test_options(paths):
|
||||
|
||||
lpaths = list(paths.keys())
|
||||
|
||||
for meta in (False, True):
|
||||
for callback in (False, True):
|
||||
for consistency in (False, True):
|
||||
for require in (False, True):
|
||||
for default_multi in (False, True):
|
||||
for symlink in (False, True):
|
||||
if callback and default_multi:
|
||||
continue
|
||||
for default in (False, True):
|
||||
for multi in (False, True, submulti):
|
||||
pass
|
||||
# for meta in (True,):
|
||||
# for callback in (False,):
|
||||
# for consistency in (True,):
|
||||
# for require in (True,):
|
||||
# for default_multi in (True,):
|
||||
# for symlink in (False,):
|
||||
# if callback and default_multi:
|
||||
# continue
|
||||
# for default in (True,):
|
||||
# for multi in (submulti,):
|
||||
if multi is submulti and default:
|
||||
continue
|
||||
if multi is submulti and consistency:
|
||||
continue
|
||||
if multi is False and default_multi:
|
||||
continue
|
||||
cfg, weakrefs, dyn = make_conf(paths, multi, default, default_multi, require, consistency, callback, symlink)
|
||||
if cfg is None:
|
||||
continue
|
||||
if dyn:
|
||||
cnt = 0
|
||||
idx = 0
|
||||
for index, lpath in enumerate(lpaths):
|
||||
if paths[lpath]:
|
||||
cnt += 1
|
||||
else:
|
||||
check_all(cfg, paths, lpaths[index], meta, multi, default,
|
||||
default_multi, require, consistency, callback, symlink,
|
||||
weakrefs, **get_kwargs(lpaths[idx]))
|
||||
idx += 1
|
||||
if idx == cnt:
|
||||
idx = 0
|
||||
else:
|
||||
for lpath in lpaths:
|
||||
check_all(cfg, paths, lpath, meta, multi, default,
|
||||
default_multi, require, consistency, callback, symlink,
|
||||
weakrefs, **get_kwargs(lpath))
|
||||
del cfg
|
||||
check_deref(weakrefs)
|
||||
# for meta in (False, True):
|
||||
# for callback in (False, True):
|
||||
# for require in (False, True):
|
||||
# for default_multi in (False, True):
|
||||
# for symlink in (False, True):
|
||||
# if callback and default_multi:
|
||||
# continue
|
||||
# for default in (False, True):
|
||||
# for multi in (False, True, submulti):
|
||||
for meta in (False,):
|
||||
for callback in (False,):
|
||||
for require in (False,):
|
||||
for default_multi in (False,):
|
||||
for symlink in (False,):
|
||||
if callback and default_multi:
|
||||
continue
|
||||
for default in (False,):
|
||||
for multi in (True,):
|
||||
if multi is submulti and default:
|
||||
continue
|
||||
if multi is False and default_multi:
|
||||
continue
|
||||
cfg, weakrefs, dyn = make_conf(paths, multi, default, default_multi, require, callback, symlink)
|
||||
if cfg is None:
|
||||
continue
|
||||
if dyn:
|
||||
cnt = 0
|
||||
idx = 0
|
||||
for index, lpath in enumerate(lpaths):
|
||||
if paths[lpath]:
|
||||
cnt += 1
|
||||
else:
|
||||
check_all(cfg, paths, lpaths[index], meta, multi, default,
|
||||
default_multi, require, callback, symlink,
|
||||
weakrefs, **get_kwargs(lpaths[idx]))
|
||||
idx += 1
|
||||
if idx == cnt:
|
||||
idx = 0
|
||||
else:
|
||||
for lpath in lpaths:
|
||||
check_all(cfg, paths, lpath, meta, multi, default,
|
||||
default_multi, require, callback, symlink,
|
||||
weakrefs, **get_kwargs(lpath))
|
||||
del cfg
|
||||
check_deref(weakrefs)
|
||||
|
Reference in New Issue
Block a user