arguments can be int, bool, str

This commit is contained in:
Martin Diehl 2021-03-30 19:57:49 +02:00
parent c43dc0cb95
commit 7b846efe4a
2 changed files with 4 additions and 2 deletions

1
python/.gitignore vendored
View File

@ -2,3 +2,4 @@
dist dist
damask.egg-info damask.egg-info
.coverage .coverage
.coverage.*

View File

@ -125,7 +125,7 @@ class Result:
Select from 'set', 'add', and 'del'. Select from 'set', 'add', and 'del'.
what : str what : str
Attribute to change (must be from self.visible). Attribute to change (must be from self.visible).
datasets : list of str or bool datasets : str, int, list of str, list of int, or bool
Name of datasets as list; supports ? and * wildcards. Name of datasets as list; supports ? and * wildcards.
True is equivalent to [*], False is equivalent to []. True is equivalent to [*], False is equivalent to [].
@ -139,7 +139,8 @@ class Result:
datasets = ['*'] datasets = ['*']
elif datasets is False: elif datasets is False:
datasets = [] datasets = []
choice = [datasets] if isinstance(datasets,str) else datasets.copy() choice = list(datasets).copy() if hasattr(datasets,'__iter__') and not isinstance(datasets,str) else \
[datasets]
inc = 'inc' if self.version_minor < 12 else 'increment_' # compatibility hack inc = 'inc' if self.version_minor < 12 else 'increment_' # compatibility hack
if what == 'increments': if what == 'increments':