Skip to content

Commit bc6d7f6

Browse files
Merge pull request #53 from JuDFTteam/release-0.4.8
Release 0.4.8
2 parents 291bbbd + 6d4f872 commit bc6d7f6

File tree

621 files changed

+66779
-4131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

621 files changed

+66779
-4131
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.4.7
2+
current_version = 0.4.8
33
commit = True
44
tag = True
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?

.github/workflows/cd.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v2
1919

20-
- name: Set up Python 3.7
20+
- name: Set up Python 3.8
2121
uses: actions/setup-python@v2
2222
with:
23-
python-version: 3.7
23+
python-version: 3.8
2424

2525
- name: Cache python dependencies
2626
id: cache-pip
@@ -45,11 +45,23 @@ jobs:
4545
run: |
4646
SPHINXOPTS='-nW' make -C docs html
4747
48-
4948
pre-commit:
5049
runs-on: ubuntu-latest
5150
timeout-minutes: 30
5251

52+
strategy:
53+
matrix:
54+
include:
55+
- name: pre-commit-errors
56+
skip-hooks: pylint-warnings
57+
strict: false
58+
- name: pre-commit-warnings
59+
skip-hooks: pylint-errors
60+
strict: true
61+
62+
name: ${{ matrix.name }}
63+
continue-on-error: ${{ matrix.strict }}
64+
5365
steps:
5466
- uses: actions/checkout@v2
5567

@@ -74,7 +86,7 @@ jobs:
7486
7587
- name: Run pre-commit
7688
run: |
77-
pre-commit run --all-files || (git status --short; git diff ; exit 1)
89+
SKIP=${{ matrix.skip-hooks }} pre-commit run --all-files || (git status --short; git diff ; exit 1)
7890
7991
tests:
8092

@@ -109,7 +121,7 @@ jobs:
109121
110122
- name: Run pytest
111123
run: |
112-
cd masci_tools/tests/ && ./run_all_cov.sh
124+
cd tests/ && ./run_all_cov.sh
113125
114126
- name: Upload code coverage report
115127
run: |
@@ -118,7 +130,7 @@ jobs:
118130
119131
publish:
120132
name: Publish to PyPi
121-
needs: [docs, tests] # pre-commit is not yet ready (so we cannot depend on it)
133+
needs: [docs, tests, pre-commit] #pylint-warnings could be added at some later point
122134
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
123135
runs-on: ubuntu-latest
124136
steps:

.github/workflows/ci.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313

14-
- name: Set up Python 3.7
14+
- name: Set up Python 3.8
1515
uses: actions/setup-python@v2
1616
with:
17-
python-version: 3.7
17+
python-version: 3.8
1818

1919
- name: Cache python dependencies
2020
id: cache-pip
@@ -40,10 +40,22 @@ jobs:
4040
SPHINXOPTS='-nW' make -C docs html
4141
4242
pre-commit:
43-
4443
runs-on: ubuntu-latest
4544
timeout-minutes: 30
4645

46+
strategy:
47+
matrix:
48+
include:
49+
- name: pre-commit-errors
50+
skip-hooks: pylint-warnings
51+
strict: false
52+
- name: pre-commit-warnings
53+
skip-hooks: pylint-errors
54+
strict: true
55+
56+
name: ${{ matrix.name }}
57+
continue-on-error: ${{ matrix.strict }}
58+
4759
steps:
4860
- uses: actions/checkout@v2
4961

@@ -56,10 +68,10 @@ jobs:
5668
restore-keys: |
5769
pip-pre-commit-
5870
59-
- name: Set up Python 3.7
71+
- name: Set up Python 3.8
6072
uses: actions/setup-python@v2
6173
with:
62-
python-version: 3.7
74+
python-version: 3.8
6375

6476
- name: Install python dependencies
6577
run: |
@@ -68,7 +80,8 @@ jobs:
6880
6981
- name: Run pre-commit
7082
run: |
71-
pre-commit run --all-files || (git status --short; git diff ; exit 1)
83+
SKIP=${{ matrix.skip-hooks }} pre-commit run --all-files || (git status --short; git diff ; exit 1)
84+
7285
7386
tests:
7487

@@ -103,7 +116,7 @@ jobs:
103116
104117
- name: Run pytest
105118
run: |
106-
cd masci_tools/tests/ && ./run_all_cov.sh
119+
cd tests/ && ./run_all_cov.sh
107120
108121
- name: Upload code coverage report
109122
run: |

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ publish_to_pypi.sh
2121
__pycache__/
2222
*.py[cod]
2323
*$py.class
24+
*.py.bak
2425

2526
# C extensions
2627
*.so

.pre-commit-config.yaml

+25-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ repos:
1010
types: [python]
1111
- id: trailing-whitespace
1212
types: [python]
13+
- id: check-yaml
14+
- id: check-added-large-files
15+
- id: forbid-new-submodules
1316

1417
- repo: git://github.com/pre-commit/mirrors-yapf
15-
rev: v0.30.0
18+
rev: v0.31.0
1619
hooks:
1720
- id: yapf
1821
name: yapf
@@ -23,12 +26,31 @@ repos:
2326
)$
2427
args: ['-i']
2528

29+
- repo: https://github.com/ikamensh/flynt/
30+
rev: '0.55'
31+
hooks:
32+
- id: flynt
33+
args: [
34+
'--line-length=120',
35+
'--fail-on-change',
36+
]
37+
2638
- repo: local
2739
hooks:
2840

29-
- id: pylint
30-
name: pylint
41+
- id: pylint-errors
42+
name: pylint-errors
43+
entry: pylint
44+
args: [-d, W, -d, R, -d, C]
45+
verbose: true
46+
types: [python]
47+
language: system
48+
exclude: '^(docs/)|(examples/)'
49+
50+
- id: pylint-warnings
51+
name: pylint-warnings
3152
entry: pylint
53+
verbose: true
3254
types: [python]
3355
language: system
3456
exclude: '^(docs/)|(examples/)'

.readthedocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ formats:
55
- pdf
66

77
python:
8-
version: 3.7
8+
version: 3.8
99
install:
1010
- method: pip
1111
path: .

.travis.yml

-44
This file was deleted.

docs/source/module_guide/code.rst

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Calculation tools
5252
.. automodule:: masci_tools.tools.cf_calculation
5353
:members:
5454

55+
.. automodule:: masci_tools.tools.greensfunction
56+
:members:
57+
5558
IO helper functions and file parsers
5659
+++++++++++++++++++++++++++++++++++++
5760

docs/source/user_guide/fleurxmlmodifier.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ On the other hand, there are shortcut methods that already know some paths:
8181
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.set_attrib_value()`: user-friendly method for setting attributes in the xml file by specifying their name
8282
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.set_first_attrib_value()`: user-friendly method for setting the first occurrence of an attribute in the xml file by specifying its name
8383
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.add_number_to_attrib()`: user-friendly method for adding to or multiplying values of attributes in the xml file by specifying their name
84-
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.set_first_attrib_value()`: user-friendly method for adding to or multiplying values of the first occurrence of an attribute in the xml file by specifying its name
84+
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.add_number_to_first_attrib()`: user-friendly method for adding to or multiplying values of the first occurrence of the attribute in the xml file by specifying their name
8585
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.set_text()`: user-friendly method for setting text on xml elements in the xml file by specifying their name
8686
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.set_first_text()`: user-friendly method for setting the text on the first occurrence of an xml element in the xml file by specifying its name
8787
* :py:func:`~masci_tools.io.fleurxmlmodifier.FleurXMLModifier.set_simple_tag()`: user-friendly method for creating and setting attributes on simple xml elements (only attributes) in the xml file by specifying its name

masci_tools/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
'''
1414
import logging
1515

16-
__version__ = '0.4.7'
16+
__version__ = '0.4.8'
1717

1818
logging.getLogger(__name__).addHandler(logging.NullHandler())

masci_tools/io/common_functions.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,7 @@ def get_ef_from_potfile(potfile):
353353
"""
354354
extract fermi energy from potfile
355355
"""
356-
f = open_general(potfile)
357-
with f:
356+
with open_general(potfile) as f:
358357
txt = f.readlines()
359358
ef = float(txt[3].split()[1])
360359
return ef
@@ -411,14 +410,14 @@ def convert_to_fortran(val, quote_strings=True):
411410
else:
412411
val_str = '.false.'
413412
elif isinstance(val, numbers.Integral):
414-
val_str = '{:d}'.format(val)
413+
val_str = f'{val:d}'
415414
elif isinstance(val, numbers.Real):
416-
val_str = ('{:18.10e}'.format(val)).replace('e', 'd')
415+
val_str = f'{val:18.10e}'.replace('e', 'd')
417416
elif isinstance(val, str):
418417
if quote_strings:
419-
val_str = "'{!s}'".format(val)
418+
val_str = f"'{val!s}'"
420419
else:
421-
val_str = '{!s}'.format(val)
420+
val_str = f'{val!s}'
422421
else:
423422
raise ValueError(f"Invalid value '{val}' of type '{type(val)}' passed, accepts only booleans, ints, "
424423
'floats and strings')

masci_tools/io/fleurxmlmodifier.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""
1919
from collections import namedtuple
2020
from lxml import etree
21-
import copy
21+
2222
from masci_tools.util.xml.collect_xml_setters import XPATH_SETTERS, SCHEMA_DICT_SETTERS, NMMPMAT_SETTERS
2323
#Enable warnings for missing docstrings
2424
#pylint: enable=missing-function-docstring
@@ -83,7 +83,6 @@ def __init__(self, validate_signatures=True):
8383
self._tasks = []
8484
self.validate_signatures = validate_signatures
8585

86-
8786
@classmethod
8887
def fromList(cls, task_list, *args, **kwargs):
8988
"""
@@ -98,17 +97,25 @@ def fromList(cls, task_list, *args, **kwargs):
9897
"""
9998

10099
fm = cls(*args, **kwargs)
100+
fm.add_task_list(task_list)
101+
return fm
102+
103+
def add_task_list(self, task_list):
104+
"""
105+
Add a list of tasks to be added
106+
107+
:param task_list: list of tuples first index is the name of the method
108+
second is defining the arguments by keyword in a dict
109+
"""
101110

102-
facade_methods = fm.get_avail_actions()
111+
facade_methods = self.get_avail_actions()
103112

104113
for name, kwargs in task_list:
105114
try:
106115
facade_methods[name](**kwargs)
107116
except KeyError as exc:
108117
raise ValueError(f"Unknown modification method '{name}'") from exc
109118

110-
return fm
111-
112119
def _validate_signature(self, name, *args, **kwargs):
113120
"""
114121
Validate that the given arguments to the registration
@@ -139,7 +146,7 @@ def _validate_signature(self, name, *args, **kwargs):
139146
except TypeError as exc:
140147
raise TypeError(
141148
f"The given arguments for the registration method '{name}' are not valid for the XML modifying function"
142-
) from exc
149+
f'The following error was raised: {exc}') from exc
143150

144151
@classmethod
145152
def apply_modifications(cls, xmltree, nmmp_lines, modification_tasks, validate_changes=True):
@@ -180,10 +187,6 @@ def apply_modifications(cls, xmltree, nmmp_lines, modification_tasks, validate_c
180187
action = cls.nmmpmat_functions[task.name]
181188
nmmp_lines = action(xmltree, nmmp_lines, schema_dict, *task.args, **task.kwargs)
182189

183-
elif task.name in cls.no_xmltree_functions:
184-
action = cls.nmmpmat_functions[task.name]
185-
nmmp_lines = action(xmltree, nmmp_lines, schema_dict, *task.args, **task.kwargs)
186-
187190
else:
188191
raise ValueError(f'Unknown task {task.name}')
189192

0 commit comments

Comments
 (0)