qrotor 4.4.0__tar.gz → 4.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of qrotor might be problematic. Click here for more details.
- {qrotor-4.4.0 → qrotor-4.4.1}/PKG-INFO +1 -1
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/_version.py +1 -1
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/systems.py +15 -9
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor.egg-info/PKG-INFO +1 -1
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor.egg-info/SOURCES.txt +3 -1
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor.egg-info/top_level.txt +1 -0
- qrotor-4.4.1/tests/__init__.py +0 -0
- qrotor-4.4.1/tests/test_systems.py +30 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/LICENSE +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/README.md +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/__init__.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/constants.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/plot.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/potential.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/rotate.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/solve.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor/system.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor.egg-info/dependency_links.txt +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/qrotor.egg-info/requires.txt +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/setup.cfg +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/setup.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/tests/test_constants.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/tests/test_potential.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/tests/test_rotate.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/tests/test_solve.py +0 -0
- {qrotor-4.4.0 → qrotor-4.4.1}/tests/test_system.py +0 -0
|
@@ -324,11 +324,13 @@ def filter_tags(
|
|
|
324
324
|
systems:list,
|
|
325
325
|
include:str='',
|
|
326
326
|
exclude:str='',
|
|
327
|
+
strict:bool=False,
|
|
327
328
|
) -> list:
|
|
328
329
|
"""Returns a filtered list of systems with or without specific tags.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
|
|
331
|
+
You can `include` or `exclude` any number of tags, separated by blank spaces.
|
|
332
|
+
By default, the filters are triggered if any tag is found, i.e. *tag1 OR tag2*.
|
|
333
|
+
Set `strict=True` to require all tags to match, i.e. *tag1 AND tag2*.
|
|
332
334
|
"""
|
|
333
335
|
systems = as_list(systems)
|
|
334
336
|
included_tags = include.split()
|
|
@@ -336,12 +338,16 @@ def filter_tags(
|
|
|
336
338
|
filtered_systems = []
|
|
337
339
|
for i in systems:
|
|
338
340
|
tags_found = list_tags(i)
|
|
339
|
-
if excluded_tags
|
|
340
|
-
|
|
341
|
+
if excluded_tags:
|
|
342
|
+
if strict and all(tag in tags_found for tag in excluded_tags):
|
|
343
|
+
continue
|
|
344
|
+
elif not strict and any(tag in tags_found for tag in excluded_tags):
|
|
345
|
+
continue
|
|
341
346
|
if included_tags:
|
|
342
|
-
if
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
if strict and not all(tag in tags_found for tag in included_tags):
|
|
348
|
+
continue
|
|
349
|
+
elif not strict and not any(tag in tags_found for tag in included_tags):
|
|
350
|
+
continue
|
|
351
|
+
filtered_systems.append(i)
|
|
346
352
|
return filtered_systems
|
|
347
353
|
|
|
@@ -15,8 +15,10 @@ qrotor.egg-info/SOURCES.txt
|
|
|
15
15
|
qrotor.egg-info/dependency_links.txt
|
|
16
16
|
qrotor.egg-info/requires.txt
|
|
17
17
|
qrotor.egg-info/top_level.txt
|
|
18
|
+
tests/__init__.py
|
|
18
19
|
tests/test_constants.py
|
|
19
20
|
tests/test_potential.py
|
|
20
21
|
tests/test_rotate.py
|
|
21
22
|
tests/test_solve.py
|
|
22
|
-
tests/test_system.py
|
|
23
|
+
tests/test_system.py
|
|
24
|
+
tests/test_systems.py
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import qrotor as qr
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_tags():
|
|
5
|
+
sys1 = qr.System(tags='tag1 tag2 tag3', comment='sys1', potential_name='zero')
|
|
6
|
+
sys2 = qr.System(tags='tag2 tag3 tag4', comment='sys2')
|
|
7
|
+
sys3 = qr.System(tags='tag4 tag5 tag6', comment='sys3')
|
|
8
|
+
sys1.solve(100)
|
|
9
|
+
test1 = qr.systems.filter_tags(sys1, include='tag4')
|
|
10
|
+
assert test1 == []
|
|
11
|
+
test2 = qr.systems.filter_tags([sys1, sys2], include='tag4 tag5', strict=False)
|
|
12
|
+
assert len(test2) == 1
|
|
13
|
+
assert test2[0].comment == 'sys2'
|
|
14
|
+
test3 = qr.systems.filter_tags([sys1, sys2], include='tag4 tag5', strict=True)
|
|
15
|
+
assert test3 == []
|
|
16
|
+
test4 = qr.systems.filter_tags([sys1, sys2, sys3], include='tag3 tag4', strict=False)
|
|
17
|
+
assert len(test4) == 3
|
|
18
|
+
test5 = qr.systems.filter_tags([sys1, sys2, sys3], include='tag3 tag4', strict=True)
|
|
19
|
+
assert len(test5) == 1
|
|
20
|
+
assert test5[0].comment == 'sys2'
|
|
21
|
+
test6 = qr.systems.filter_tags([sys1, sys2, sys3], include='tag3 tag4', exclude='tag6', strict=False)
|
|
22
|
+
assert len(test6) == 2
|
|
23
|
+
test7 = qr.systems.filter_tags([sys1, sys2, sys3], include='tag4', exclude='tag5 tag6', strict=True)
|
|
24
|
+
assert len(test7) == 1
|
|
25
|
+
assert test7[0].comment == 'sys2'
|
|
26
|
+
test8 = qr.systems.filter_tags([sys1, sys2, sys3], include='', exclude='tag1 tag2', strict=True)
|
|
27
|
+
assert len(test8) == 2
|
|
28
|
+
test9 = qr.systems.filter_tags([sys1, sys2, sys3], include='', exclude='tag1 tag2', strict=False)
|
|
29
|
+
assert test9[0].comment == 'sys3'
|
|
30
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|