diff --git a/examples/config/phase/mechanical/elastic/Hooke_Al.yaml b/examples/config/phase/mechanical/elastic/Hooke_Al.yaml index fd3a5ddc2..3a6f06a23 100644 --- a/examples/config/phase/mechanical/elastic/Hooke_Al.yaml +++ b/examples/config/phase/mechanical/elastic/Hooke_Al.yaml @@ -3,7 +3,7 @@ Al: mechanical: elastic: type: Hooke - references: + references: - J. Vallin et al., Journal of Applied Physics 35(6), 1825-1826, 1964, https://doi.org/10.1063/1.1713749 diff --git a/examples/config/phase/mechanical/elastic/Hooke_Au.yaml b/examples/config/phase/mechanical/elastic/Hooke_Au.yaml index 8a3249e15..b2d6cde08 100644 --- a/examples/config/phase/mechanical/elastic/Hooke_Au.yaml +++ b/examples/config/phase/mechanical/elastic/Hooke_Au.yaml @@ -3,7 +3,7 @@ Au: mechanical: elastic: type: Hooke - references: + references: - J.P. Hirth and J. Lothe, Theory of Dislocations, 1982, John Wiley & Sons diff --git a/examples/config/phase/mechanical/elastic/Hooke_Ni.yaml b/examples/config/phase/mechanical/elastic/Hooke_Ni.yaml index bbfd867e5..0b032c350 100644 --- a/examples/config/phase/mechanical/elastic/Hooke_Ni.yaml +++ b/examples/config/phase/mechanical/elastic/Hooke_Ni.yaml @@ -3,7 +3,7 @@ Ni: mechanical: elastic: type: Hooke - references: + references: - J.P. Hirth and J. Lothe, Theory of Dislocations, 1982, John Wiley & Sons diff --git a/examples/config/phase/mechanical/elastic/Hooke_cpTi.yaml b/examples/config/phase/mechanical/elastic/Hooke_cpTi.yaml index f2936d390..2c2e3261d 100644 --- a/examples/config/phase/mechanical/elastic/Hooke_cpTi.yaml +++ b/examples/config/phase/mechanical/elastic/Hooke_cpTi.yaml @@ -2,9 +2,9 @@ cpTi: lattice: hP c/a: 1.587 mechanical: - elastic: + elastic: type: Hooke - references: + references: - L. Wang et al., Acta Materialia 132, 598-610, 2017, https://doi.org/10.1016/j.actamat.2017.05.015 diff --git a/processing/pre/mentat_pbcOnBoxMesh.py b/processing/pre/mentat_pbcOnBoxMesh.py index 4a4f3d642..5a4891002 100755 --- a/processing/pre/mentat_pbcOnBoxMesh.py +++ b/processing/pre/mentat_pbcOnBoxMesh.py @@ -76,10 +76,10 @@ def asMFD(mfd_data): elif type(num) == float: result += '{:20.12e}'.format(num) else: - damask.util.croak('WARNING: encountered unknown type: ' + str(type(el))) + print(f'WARNING: encountered unknown type: {type(el)}') result += '\n' else: - damask.util.croak('WARNING: encountered unknown type: ' + str(type(el))) + print(f'WARNING: encountered unknown type: {type(el)}') if section['uid'] > 0: result += '=end=\n' return result.strip() @@ -244,9 +244,9 @@ if remote: py_mentat.py_send('*save_as_model "{}" yes'.format(filenames[0])) py_mentat.py_get_int("nnodes()") except py_mentat.InputError as err: - damask.util.croak('{}. Try Tools/Python/"Run as Separate Process" & "Initiate".'.format(err)) + print(f'{err}. Try Tools/Python/"Run as Separate Process" & "Initiate".') sys.exit(-1) - damask.util.croak( 'connected...') + print( 'connected...') for name in filenames: while remote and not os.path.exists(name): time.sleep(0.5) diff --git a/python/damask/__init__.py b/python/damask/__init__.py index e356d0bc4..a421e29c4 100644 --- a/python/damask/__init__.py +++ b/python/damask/__init__.py @@ -33,9 +33,6 @@ from ._configmaterial import ConfigMaterial # noqa from ._grid import Grid # noqa from ._result import Result # noqa - - # deprecated from ._asciitable import ASCIItable # noqa from ._test import Test # noqa -from .util import extendableOption # noqa diff --git a/python/damask/_test.py b/python/damask/_test.py index f8fb24cca..e62b9e8cc 100644 --- a/python/damask/_test.py +++ b/python/damask/_test.py @@ -53,8 +53,7 @@ class Test: self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__)) - self.parser = OptionParser(option_class=damask.extendableOption, - description = f'{self.description} (Test class version: {damask.version})', + self.parser = OptionParser(description = f'{self.description} (Test class version: {damask.version})', usage = './test.py [options]') self.parser.add_option("-k", "--keep", action = "store_true", @@ -70,7 +69,6 @@ class Test: help = "show all test variants without actual calculation") self.parser.add_option("-s", "--select", dest = "select", - action = 'extend', metavar = '', help = "run test(s) of given name only") self.parser.set_defaults(keep = self.keep, accept = self.accept, diff --git a/python/damask/util.py b/python/damask/util.py index 56143cc5e..cdedd73ed 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -6,7 +6,6 @@ import shlex import re import fractions from functools import reduce -from optparse import Option import numpy as np import h5py @@ -16,7 +15,6 @@ from . import version # limit visibility __all__=[ 'srepr', - 'croak', 'report', 'emph','deemph','warn','strikeout', 'execute', @@ -25,7 +23,6 @@ __all__=[ 'project_stereographic', 'hybrid_IA', 'return_message', - 'extendableOption', 'execution_stamp', 'shapeshifter', 'shapeblender', 'extend_docstring', 'extended_docstring', @@ -54,25 +51,6 @@ def srepr(arg,glue = '\n'): return arg if isinstance(arg,str) else repr(arg) -def croak(what, newline = True): - """ - Write formated to stderr. - - DEPRECATED - - Parameters - ---------- - what : str or iterable - Content to be displayed. - newline : bool, optional - Separate items of what by newline. Defaults to True. - - """ - if what is not None: - sys.stderr.write(srepr(what,glue = '\n') + ('\n' if newline else '')) - sys.stderr.flush() - - def report(who = None, what = None): """ @@ -81,7 +59,7 @@ def report(who = None, DEPRECATED """ - croak( (emph(who)+': ' if who is not None else '') + (what if what is not None else '') + '\n' ) + print( (emph(who)+': ' if who is not None else '') + (what if what is not None else '') + '\n' ) def emph(what): @@ -428,27 +406,6 @@ def DREAM3D_cell_data_group(fname): #################################################################################################### # Classes #################################################################################################### -class extendableOption(Option): - """ - Used for definition of new option parser action 'extend', which enables to take multiple option arguments. - - Adopted from online tutorial http://docs.python.org/library/optparse.html - DEPRECATED - """ - - ACTIONS = Option.ACTIONS + ("extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) - TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) - ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) - - def take_action(self, action, dest, opt, value, values, parser): - if action == "extend": - lvalue = value.split(",") - values.ensure_value(dest, []).extend(lvalue) - else: - Option.take_action(self, action, dest, opt, value, values, parser) - - class _ProgressBar: """ Report progress of an interation as a status bar. diff --git a/python/tests/test_util.py b/python/tests/test_util.py index 93044b31d..b96908a9a 100644 --- a/python/tests/test_util.py +++ b/python/tests/test_util.py @@ -23,9 +23,6 @@ class TestUtil: with pytest.raises(RuntimeError): util.execute('/bin/false') - def test_croak(self): - util.croak('Burp!') - @pytest.mark.parametrize('input,output', [ ([0,-2],[0,-1]),