From 7b846efe4ac2145363e24b78ac4f4a9a8b2dc949 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 30 Mar 2021 19:57:49 +0200 Subject: [PATCH] arguments can be int, bool, str --- python/.gitignore | 1 + python/damask/_result.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/.gitignore b/python/.gitignore index 7c60e1af8..89d206b99 100644 --- a/python/.gitignore +++ b/python/.gitignore @@ -2,3 +2,4 @@ dist damask.egg-info .coverage +.coverage.* diff --git a/python/damask/_result.py b/python/damask/_result.py index ba726d4d3..b2a0dd4a1 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -125,7 +125,7 @@ class Result: Select from 'set', 'add', and 'del'. what : str 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. True is equivalent to [*], False is equivalent to []. @@ -139,7 +139,8 @@ class Result: datasets = ['*'] elif datasets is False: 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 if what == 'increments':