From 0644e7d9ff492fdb2c94d608c575c697daee6d32 Mon Sep 17 00:00:00 2001 From: Sebastiaan Huber Date: Fri, 29 Nov 2019 17:55:01 +0100 Subject: [PATCH] Drop Python 2: remove arguments from `super` calls This is no longer necesary in python 3. To remove all the occurrences of this usage, the following command was used: find . -type f -not -path './.git*' -exec \ sed -i 's/super([^)]*,[^)]*)/super()/g' {} + The regex tries to find all instances of `super()` where there is content between the parentheses. The search for `[^)]*` means to look for all characters except a closing parens, which essentially makes the search non-greedy. Having just that would not be enough and we have to explicitly add another such clause separated by a comma. This is the exact format required by python 2 where the `super` call expects two arguments, first being the class itself and the second the reference, typically `self` or `cls. By making the regex more specific we avoid matching cases like: def test_without_super(self): which would be replaced to def test_without_super(): if we don't include the explicit comma in the regex between the parens. --- .ci/polish/lib/template/workchain.tpl | 2 +- .ci/test_plugin_testcase.py | 6 +- .ci/workchains.py | 18 ++-- aiida/backends/djsite/db/models.py | 6 +- ...ns_0037_attributes_extras_settings_json.py | 2 +- .../migrations/test_migrations_many.py | 2 +- aiida/backends/djsite/queries.py | 2 +- aiida/backends/sqlalchemy/models/authinfo.py | 2 +- aiida/backends/sqlalchemy/models/base.py | 4 +- aiida/backends/sqlalchemy/models/comment.py | 2 +- aiida/backends/sqlalchemy/models/computer.py | 2 +- aiida/backends/sqlalchemy/models/node.py | 2 +- aiida/backends/sqlalchemy/models/user.py | 2 +- aiida/backends/sqlalchemy/queries.py | 2 +- .../backends/sqlalchemy/tests/test_generic.py | 2 +- .../sqlalchemy/tests/test_migrations.py | 8 +- aiida/backends/testbase.py | 4 +- .../tests/cmdline/commands/test_calcjob.py | 2 +- .../tests/cmdline/commands/test_code.py | 4 +- .../tests/cmdline/commands/test_computer.py | 2 +- .../tests/cmdline/commands/test_daemon.py | 2 +- .../tests/cmdline/commands/test_data.py | 24 ++--- .../tests/cmdline/commands/test_export.py | 2 +- .../tests/cmdline/commands/test_graph.py | 2 +- .../tests/cmdline/commands/test_group.py | 2 +- .../tests/cmdline/commands/test_help.py | 2 +- .../tests/cmdline/commands/test_import.py | 2 +- .../tests/cmdline/commands/test_node.py | 6 +- .../tests/cmdline/commands/test_process.py | 16 +-- .../tests/cmdline/commands/test_profile.py | 2 +- .../tests/cmdline/commands/test_rehash.py | 2 +- .../tests/cmdline/commands/test_restapi.py | 2 +- .../tests/cmdline/commands/test_run.py | 2 +- .../tests/cmdline/commands/test_setup.py | 2 +- .../tests/cmdline/commands/test_user.py | 2 +- .../tests/cmdline/commands/test_verdi.py | 2 +- .../cmdline/params/types/test_calculation.py | 2 +- .../tests/cmdline/params/types/test_code.py | 2 +- .../cmdline/params/types/test_computer.py | 2 +- .../tests/cmdline/params/types/test_data.py | 2 +- .../tests/cmdline/params/types/test_group.py | 2 +- .../tests/cmdline/params/types/test_node.py | 2 +- .../tests/cmdline/utils/test_common.py | 4 +- aiida/backends/tests/engine/test_calc_job.py | 8 +- .../tests/engine/test_calcfunctions.py | 4 +- .../tests/engine/test_class_loader.py | 4 +- aiida/backends/tests/engine/test_launch.py | 12 +-- aiida/backends/tests/engine/test_manager.py | 8 +- .../backends/tests/engine/test_persistence.py | 6 +- aiida/backends/tests/engine/test_process.py | 18 ++-- .../tests/engine/test_process_builder.py | 10 +- .../tests/engine/test_process_function.py | 4 +- .../tests/engine/test_process_spec.py | 4 +- aiida/backends/tests/engine/test_rmq.py | 4 +- aiida/backends/tests/engine/test_runners.py | 4 +- aiida/backends/tests/engine/test_transport.py | 4 +- aiida/backends/tests/engine/test_utils.py | 2 +- .../backends/tests/engine/test_work_chain.py | 102 +++++++++--------- .../tests/engine/test_workfunctions.py | 4 +- .../tests/manage/backup/test_backup_script.py | 4 +- .../migrations/test_migrations.py | 2 +- .../tests/manage/configuration/test_config.py | 8 +- .../manage/configuration/test_profile.py | 2 +- aiida/backends/tests/orm/data/test_dict.py | 2 +- aiida/backends/tests/orm/data/test_folder.py | 2 +- aiida/backends/tests/orm/data/test_kpoints.py | 2 +- aiida/backends/tests/orm/data/test_orbital.py | 2 +- aiida/backends/tests/orm/data/test_remote.py | 2 +- aiida/backends/tests/orm/data/test_upf.py | 2 +- .../tests/orm/implementation/test_comments.py | 4 +- .../tests/orm/implementation/test_logs.py | 4 +- .../tests/orm/implementation/test_nodes.py | 4 +- aiida/backends/tests/orm/node/test_node.py | 6 +- aiida/backends/tests/orm/test_authinfos.py | 2 +- aiida/backends/tests/orm/test_comments.py | 4 +- aiida/backends/tests/orm/test_logs.py | 4 +- aiida/backends/tests/orm/test_querybuilder.py | 4 +- .../backends/tests/orm/utils/test_calcjob.py | 2 +- aiida/backends/tests/parsers/test_parser.py | 2 +- aiida/backends/tests/plugins/test_utils.py | 2 +- aiida/backends/tests/test_base_dataclasses.py | 2 +- aiida/backends/tests/test_calculation_node.py | 2 +- aiida/backends/tests/test_restapi.py | 2 +- .../importexport/migration/test_migration.py | 4 +- .../importexport/migration/test_v02_to_v03.py | 2 +- .../importexport/migration/test_v03_to_v04.py | 2 +- .../importexport/migration/test_v04_to_v05.py | 2 +- .../importexport/migration/test_v05_to_v06.py | 2 +- .../importexport/migration/test_v06_to_v07.py | 2 +- .../importexport/migration/test_v07_to_v08.py | 2 +- .../tools/importexport/orm/test_comments.py | 4 +- .../tools/importexport/orm/test_extras.py | 4 +- .../tools/importexport/orm/test_links.py | 4 +- .../tests/tools/importexport/orm/test_logs.py | 4 +- .../importexport/test_specific_import.py | 2 +- aiida/backends/tests/utils/processes.py | 6 +- aiida/calculations/plugins/arithmetic/add.py | 2 +- .../calculations/plugins/templatereplacer.py | 2 +- aiida/cmdline/params/options/conditional.py | 4 +- aiida/cmdline/params/options/config.py | 2 +- aiida/cmdline/params/options/interactive.py | 6 +- aiida/cmdline/params/options/multivalue.py | 4 +- .../params/options/test_interactive.py | 2 +- aiida/cmdline/params/types/choice.py | 2 +- aiida/cmdline/params/types/code.py | 4 +- aiida/cmdline/params/types/computer.py | 4 +- aiida/cmdline/params/types/group.py | 4 +- aiida/cmdline/params/types/multiple.py | 2 +- aiida/cmdline/params/types/nonemptystring.py | 2 +- aiida/cmdline/params/types/path.py | 6 +- aiida/cmdline/params/types/plugin.py | 2 +- aiida/cmdline/params/types/profile.py | 2 +- aiida/cmdline/utils/pluginable.py | 8 +- aiida/cmdline/utils/query/mapping.py | 2 +- aiida/common/extendeddicts.py | 12 +-- aiida/common/folders.py | 6 +- aiida/common/lang.py | 6 +- aiida/common/utils.py | 2 +- aiida/engine/processes/builder.py | 2 +- aiida/engine/processes/calcjobs/calcjob.py | 8 +- aiida/engine/processes/calcjobs/tasks.py | 4 +- aiida/engine/processes/functions.py | 10 +- aiida/engine/processes/futures.py | 2 +- aiida/engine/processes/ports.py | 10 +- aiida/engine/processes/process.py | 34 +++--- aiida/engine/processes/process_spec.py | 4 +- .../engine/processes/workchains/workchain.py | 12 +-- aiida/engine/transports.py | 2 +- aiida/manage/backup/backup_base.py | 2 +- aiida/manage/external/rmq.py | 2 +- aiida/manage/manager.py | 2 +- aiida/manage/tests/__init__.py | 2 +- aiida/manage/tests/unittest_classes.py | 2 +- aiida/orm/authinfos.py | 2 +- aiida/orm/comments.py | 2 +- aiida/orm/computers.py | 4 +- aiida/orm/convert.py | 2 +- aiida/orm/groups.py | 2 +- aiida/orm/implementation/django/authinfos.py | 2 +- aiida/orm/implementation/django/comments.py | 4 +- aiida/orm/implementation/django/computers.py | 2 +- aiida/orm/implementation/django/entities.py | 2 +- aiida/orm/implementation/django/groups.py | 8 +- aiida/orm/implementation/django/logs.py | 2 +- aiida/orm/implementation/django/nodes.py | 2 +- aiida/orm/implementation/django/users.py | 2 +- aiida/orm/implementation/django/utils.py | 2 +- .../implementation/sqlalchemy/authinfos.py | 2 +- .../orm/implementation/sqlalchemy/comments.py | 4 +- .../implementation/sqlalchemy/computers.py | 2 +- .../orm/implementation/sqlalchemy/entities.py | 2 +- aiida/orm/implementation/sqlalchemy/groups.py | 6 +- aiida/orm/implementation/sqlalchemy/logs.py | 2 +- aiida/orm/implementation/sqlalchemy/nodes.py | 2 +- aiida/orm/implementation/sqlalchemy/users.py | 2 +- aiida/orm/implementation/sqlalchemy/utils.py | 2 +- aiida/orm/logs.py | 2 +- aiida/orm/nodes/data/array/array.py | 4 +- aiida/orm/nodes/data/array/trajectory.py | 2 +- aiida/orm/nodes/data/base.py | 4 +- aiida/orm/nodes/data/cif.py | 8 +- aiida/orm/nodes/data/code.py | 4 +- aiida/orm/nodes/data/data.py | 2 +- aiida/orm/nodes/data/dict.py | 2 +- aiida/orm/nodes/data/folder.py | 2 +- aiida/orm/nodes/data/list.py | 4 +- aiida/orm/nodes/data/remote.py | 4 +- aiida/orm/nodes/data/singlefile.py | 4 +- aiida/orm/nodes/data/structure.py | 4 +- aiida/orm/nodes/data/upf.py | 8 +- aiida/orm/nodes/node.py | 6 +- .../nodes/process/calculation/calcfunction.py | 2 +- .../orm/nodes/process/calculation/calcjob.py | 6 +- aiida/orm/nodes/process/process.py | 10 +- aiida/orm/nodes/process/workflow/workchain.py | 2 +- aiida/orm/nodes/process/workflow/workflow.py | 2 +- .../nodes/process/workflow/workfunction.py | 2 +- aiida/orm/users.py | 4 +- aiida/orm/utils/builders/code.py | 4 +- aiida/orm/utils/builders/computer.py | 4 +- aiida/orm/utils/mixins.py | 4 +- aiida/orm/utils/serialize.py | 2 +- aiida/restapi/api.py | 4 +- aiida/restapi/resources.py | 2 +- aiida/restapi/translator/nodes/node.py | 8 +- aiida/schedulers/datastructures.py | 6 +- aiida/schedulers/plugins/direct.py | 2 +- aiida/schedulers/plugins/lsf.py | 2 +- aiida/schedulers/plugins/pbsbaseclasses.py | 2 +- aiida/schedulers/plugins/slurm.py | 2 +- aiida/sphinxext/tests/demo_workchain.py | 2 +- aiida/tools/data/orbital/realhydrogen.py | 2 +- aiida/tools/dbimporters/plugins/cod.py | 4 +- aiida/tools/dbimporters/plugins/icsd.py | 2 +- .../dbimporters/plugins/materialsproject.py | 4 +- aiida/tools/dbimporters/plugins/mpds.py | 6 +- aiida/tools/dbimporters/plugins/mpod.py | 4 +- aiida/tools/dbimporters/plugins/nninc.py | 4 +- aiida/tools/dbimporters/plugins/oqmd.py | 4 +- aiida/tools/dbimporters/plugins/pcod.py | 22 ++-- aiida/tools/dbimporters/plugins/tcod.py | 6 +- aiida/tools/importexport/common/utils.py | 2 +- aiida/transports/plugins/local.py | 2 +- aiida/transports/plugins/ssh.py | 2 +- ...multiply_workchain_external_computation.py | 2 +- ..._multiply_workchain_outline_computation.py | 2 +- .../developer_guide/core/extend_restapi.rst | 6 +- docs/source/working/calculations.rst | 2 +- docs/source/working/data.rst | 4 +- .../calcjobs/arithmetic_add_spec_inputs.py | 2 +- .../calcjobs/arithmetic_add_spec_outputs.py | 2 +- ...thmetic_add_spec_prepare_for_submission.py | 2 +- .../snippets/workflows/expose_inputs/child.py | 2 +- .../workflows/expose_inputs/complex_parent.py | 2 +- .../workflows/expose_inputs/simple_parent.py | 2 +- .../workchains/run_workchain_submit_append.py | 2 +- .../run_workchain_submit_complete.py | 2 +- .../run_workchain_submit_parallel.py | 2 +- .../workchains/workchain_serialize.py | 2 +- docs/source/working/workflows.rst | 2 +- examples/work/workchain.py | 6 +- examples/work/workchain_outline.py | 2 +- utils/plugin_tpl/calculation.tpl | 4 +- 223 files changed, 483 insertions(+), 483 deletions(-) diff --git a/.ci/polish/lib/template/workchain.tpl b/.ci/polish/lib/template/workchain.tpl index 693d3548d2..64b021e257 100644 --- a/.ci/polish/lib/template/workchain.tpl +++ b/.ci/polish/lib/template/workchain.tpl @@ -6,7 +6,7 @@ class ${class_name}(WorkChain): @classmethod def define(cls, spec): - super(${class_name}, cls).define(spec) + super().define(spec) spec.input('code', valid_type=Code, required=False) spec.input('operands', valid_type=Str) spec.input('modulo', valid_type=Int) diff --git a/.ci/test_plugin_testcase.py b/.ci/test_plugin_testcase.py index 60aff51545..838f03f2f4 100644 --- a/.ci/test_plugin_testcase.py +++ b/.ci/test_plugin_testcase.py @@ -34,7 +34,7 @@ def setUp(self): self.computer = self.get_computer(temp_dir=self.temp_dir) def tearDown(self): - super(PluginTestCase1, self).tearDown() + super().tearDown() shutil.rmtree(self.temp_dir) @staticmethod @@ -88,7 +88,7 @@ def test_tear_down(self): are not there anymore. """ from aiida.orm import load_node - super(PluginTestCase1, self).tearDown() # reset DB + super().tearDown() # reset DB with self.assertRaises(Exception): load_node(self.data_pk) @@ -105,7 +105,7 @@ def test_dummy(self): Just making sure that setup/teardown is safe for multiple testcase classes (this was broken in #1425). """ - super(PluginTestCase2, self).tearDown() + super().tearDown() if __name__ == '__main__': diff --git a/.ci/workchains.py b/.ci/workchains.py index 89e124002f..c667894750 100644 --- a/.ci/workchains.py +++ b/.ci/workchains.py @@ -19,7 +19,7 @@ class NestedWorkChain(WorkChain): """ @classmethod def define(cls, spec): - super(NestedWorkChain, cls).define(spec) + super().define(spec) spec.input('inp', valid_type=Int) spec.outline( cls.do_submit, @@ -53,7 +53,7 @@ def finalize(self): class SerializeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SerializeWorkChain, cls).define(spec) + super().define(spec) spec.input( 'test', @@ -71,7 +71,7 @@ def echo(self): class NestedInputNamespace(WorkChain): @classmethod def define(cls, spec): - super(NestedInputNamespace, cls).define(spec) + super().define(spec) spec.input('foo.bar.baz', valid_type=Int) spec.output('output', valid_type=Int) @@ -84,7 +84,7 @@ def do_echo(self): class ListEcho(WorkChain): @classmethod def define(cls, spec): - super(ListEcho, cls).define(spec) + super().define(spec) spec.input('list', valid_type=List) spec.output('output', valid_type=List) @@ -98,7 +98,7 @@ def do_echo(self): class DynamicNonDbInput(WorkChain): @classmethod def define(cls, spec): - super(DynamicNonDbInput, cls).define(spec) + super().define(spec) spec.input_namespace('namespace', dynamic=True) spec.output('output', valid_type=List) spec.outline(cls.do_test) @@ -113,7 +113,7 @@ def do_test(self): class DynamicDbInput(WorkChain): @classmethod def define(cls, spec): - super(DynamicDbInput, cls).define(spec) + super().define(spec) spec.input_namespace('namespace', dynamic=True) spec.output('output', valid_type=Int) spec.outline(cls.do_test) @@ -127,7 +127,7 @@ def do_test(self): class DynamicMixedInput(WorkChain): @classmethod def define(cls, spec): - super(DynamicMixedInput, cls).define(spec) + super().define(spec) spec.input_namespace('namespace', dynamic=True) spec.output('output', valid_type=Int) spec.outline(cls.do_test) @@ -147,7 +147,7 @@ class CalcFunctionRunnerWorkChain(WorkChain): """ @classmethod def define(cls, spec): - super(CalcFunctionRunnerWorkChain, cls).define(spec) + super().define(spec) spec.input('input', valid_type=Int) spec.output('output', valid_type=Int) @@ -164,7 +164,7 @@ class WorkFunctionRunnerWorkChain(WorkChain): """ @classmethod def define(cls, spec): - super(WorkFunctionRunnerWorkChain, cls).define(spec) + super().define(spec) spec.input('input', valid_type=Str) spec.output('output', valid_type=Str) diff --git a/aiida/backends/djsite/db/models.py b/aiida/backends/djsite/db/models.py index 9565910fde..0ff1360a74 100644 --- a/aiida/backends/djsite/db/models.py +++ b/aiida/backends/djsite/db/models.py @@ -37,7 +37,7 @@ class AiidaQuerySet(QuerySet): def iterator(self): from aiida.orm.implementation.django import convert - for obj in super(AiidaQuerySet, self).iterator(): + for obj in super().iterator(): yield convert.get_backend_entity(obj, None) def __iter__(self): @@ -46,7 +46,7 @@ def __iter__(self): Note: used to rely on the iterator in django 1.8 but does no longer in django 1.11. """ from aiida.orm.implementation.django import convert - return (convert.get_backend_entity(model, None) for model in super(AiidaQuerySet, self).__iter__()) + return (convert.get_backend_entity(model, None) for model in super().__iter__()) def __getitem__(self, key): """Get item for [] operator @@ -54,7 +54,7 @@ def __getitem__(self, key): Note: used to rely on the iterator in django 1.8 but does no longer in django 1.11. """ from aiida.orm.implementation.django import convert - res = super(AiidaQuerySet, self).__getitem__(key) + res = super().__getitem__(key) return convert.get_backend_entity(res, None) diff --git a/aiida/backends/djsite/db/subtests/migrations/test_migrations_0037_attributes_extras_settings_json.py b/aiida/backends/djsite/db/subtests/migrations/test_migrations_0037_attributes_extras_settings_json.py index 5bdd6bb1e8..6dd582faf4 100644 --- a/aiida/backends/djsite/db/subtests/migrations/test_migrations_0037_attributes_extras_settings_json.py +++ b/aiida/backends/djsite/db/subtests/migrations/test_migrations_0037_attributes_extras_settings_json.py @@ -244,7 +244,7 @@ def tearDown(self): """ db_setting_model = self.apps.get_model('db', 'DbSetting') db_setting_model.objects.filter(key__in=self.settings_info.keys()).delete() - super(TestSettingsToJSONMigration, self).tearDown() + super().tearDown() # pylint: disable=no-init, old-style-class, too-few-public-methods, dangerous-default-value, too-many-statements diff --git a/aiida/backends/djsite/db/subtests/migrations/test_migrations_many.py b/aiida/backends/djsite/db/subtests/migrations/test_migrations_many.py index 82a5fa0c66..706a32df6f 100644 --- a/aiida/backends/djsite/db/subtests/migrations/test_migrations_many.py +++ b/aiida/backends/djsite/db/subtests/migrations/test_migrations_many.py @@ -458,7 +458,7 @@ def tearDown(self): DbNode.objects.all().delete() # pylint: disable=no-member DbWorkflow.objects.all().delete() # pylint: disable=no-member DbUser.objects.all().delete() # pylint: disable=no-member - super(TestDbLogMigrationRecordCleaning, self).tearDown() + super().tearDown() def test_dblog_calculation_node(self): """ diff --git a/aiida/backends/djsite/queries.py b/aiida/backends/djsite/queries.py index 752d4f5ad1..ce3bf39a34 100644 --- a/aiida/backends/djsite/queries.py +++ b/aiida/backends/djsite/queries.py @@ -14,7 +14,7 @@ class DjangoQueryManager(AbstractQueryManager): def __init__(self, backend): - super(DjangoQueryManager, self).__init__(backend) + super().__init__(backend) def get_creation_statistics( self, diff --git a/aiida/backends/sqlalchemy/models/authinfo.py b/aiida/backends/sqlalchemy/models/authinfo.py index bdbe71b2ae..ef2085f2be 100644 --- a/aiida/backends/sqlalchemy/models/authinfo.py +++ b/aiida/backends/sqlalchemy/models/authinfo.py @@ -42,7 +42,7 @@ class DbAuthInfo(Base): def __init__(self, *args, **kwargs): self._metadata = dict() self.auth_params = dict() - super(DbAuthInfo, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def __str__(self): if self.enabled: diff --git a/aiida/backends/sqlalchemy/models/base.py b/aiida/backends/sqlalchemy/models/base.py index f386627234..368f993016 100644 --- a/aiida/backends/sqlalchemy/models/base.py +++ b/aiida/backends/sqlalchemy/models/base.py @@ -47,12 +47,12 @@ class _AiidaQuery(orm.Query): def __init__(self, *args, **kwargs): """Constructor""" - super(_AiidaQuery, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def __iter__(self): from aiida.orm.implementation.sqlalchemy import convert - iterator = super(_AiidaQuery, self).__iter__() + iterator = super().__iter__() for result in iterator: # Allow the use of with_entities if issubclass(type(result), Model): diff --git a/aiida/backends/sqlalchemy/models/comment.py b/aiida/backends/sqlalchemy/models/comment.py index adbb7ee0ba..f2128a83c5 100644 --- a/aiida/backends/sqlalchemy/models/comment.py +++ b/aiida/backends/sqlalchemy/models/comment.py @@ -55,7 +55,7 @@ def __str__(self): ) def __init__(self, *args, **kwargs): - super(DbComment, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # The behavior of an unstored Comment instance should be that all its attributes should be initialized in # accordance with the defaults specified on the collums, i.e. if a default is specified for the `uuid` column, # then an unstored `DbComment` instance should have a default value for the `uuid` attribute. The exception here diff --git a/aiida/backends/sqlalchemy/models/computer.py b/aiida/backends/sqlalchemy/models/computer.py index 252e6c0ee0..5aa83cc78e 100644 --- a/aiida/backends/sqlalchemy/models/computer.py +++ b/aiida/backends/sqlalchemy/models/computer.py @@ -38,7 +38,7 @@ def __init__(self, *args, **kwargs): if 'metadata' in kwargs.keys(): kwargs['_metadata'] = kwargs.pop('metadata') - super(DbComputer, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @property def pk(self): diff --git a/aiida/backends/sqlalchemy/models/node.py b/aiida/backends/sqlalchemy/models/node.py index 1faa77330d..4fd1b5513f 100644 --- a/aiida/backends/sqlalchemy/models/node.py +++ b/aiida/backends/sqlalchemy/models/node.py @@ -79,7 +79,7 @@ class DbNode(Base): ) def __init__(self, *args, **kwargs): - super(DbNode, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # The behavior of an unstored Node instance should be that all its attributes should be initialized in # accordance with the defaults specified on the colums, i.e. if a default is specified for the `uuid` column, # then an unstored `DbNode` instance should have a default value for the `uuid` attribute. The exception here diff --git a/aiida/backends/sqlalchemy/models/user.py b/aiida/backends/sqlalchemy/models/user.py index d48e6d219d..565e50875c 100644 --- a/aiida/backends/sqlalchemy/models/user.py +++ b/aiida/backends/sqlalchemy/models/user.py @@ -29,7 +29,7 @@ def __init__(self, email, first_name='', last_name='', institution='', **kwargs) self.first_name = first_name self.last_name = last_name self.institution = institution - super(DbUser, self).__init__(**kwargs) + super().__init__(**kwargs) def __str__(self): return self.email diff --git a/aiida/backends/sqlalchemy/queries.py b/aiida/backends/sqlalchemy/queries.py index 4ff631abd9..868638eb9a 100644 --- a/aiida/backends/sqlalchemy/queries.py +++ b/aiida/backends/sqlalchemy/queries.py @@ -17,7 +17,7 @@ class SqlaQueryManager(AbstractQueryManager): """ def __init__(self, backend): - super(SqlaQueryManager, self).__init__(backend) + super().__init__(backend) def get_creation_statistics( self, diff --git a/aiida/backends/sqlalchemy/tests/test_generic.py b/aiida/backends/sqlalchemy/tests/test_generic.py index b128b490a7..1815fec98b 100644 --- a/aiida/backends/sqlalchemy/tests/test_generic.py +++ b/aiida/backends/sqlalchemy/tests/test_generic.py @@ -60,7 +60,7 @@ class TestGroupsSqla(AiidaTestCase): def setUp(self): from aiida.orm.implementation import sqlalchemy as sqla - super(TestGroupsSqla, self).setUp() + super().setUp() self.assertIsInstance(self.backend, sqla.backend.SqlaBackend) def test_query(self): diff --git a/aiida/backends/sqlalchemy/tests/test_migrations.py b/aiida/backends/sqlalchemy/tests/test_migrations.py index 2831a2f698..46e69d3da6 100644 --- a/aiida/backends/sqlalchemy/tests/test_migrations.py +++ b/aiida/backends/sqlalchemy/tests/test_migrations.py @@ -46,7 +46,7 @@ def setUpClass(cls, *args, **kwargs): """ Prepare the test class with the alembivc configuration """ - super(TestMigrationsSQLA, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.manager = manager.SqlaBackendManager() def setUp(self): @@ -54,7 +54,7 @@ def setUp(self): Go to the migrate_from revision, apply setUpBeforeMigration, then run the migration. """ - super(TestMigrationsSQLA, self).setUp() + super().setUp() from aiida.orm import autogroup self.current_autogroup = autogroup.current_autogroup @@ -100,7 +100,7 @@ def tearDown(self): from aiida.orm import autogroup self._reset_database_and_schema() autogroup.current_autogroup = self.current_autogroup - super(TestMigrationsSQLA, self).tearDown() + super().tearDown() def setUpBeforeMigration(self): # pylint: disable=invalid-name """ @@ -649,7 +649,7 @@ def tearDown(self): finally: session.close() - super(TestDbLogMigrationRecordCleaning, self).tearDown() + super().tearDown() def setUpBeforeMigration(self): # pylint: disable=too-many-locals,too-many-statements diff --git a/aiida/backends/testbase.py b/aiida/backends/testbase.py index d61a72e1b4..b94f10823f 100644 --- a/aiida/backends/testbase.py +++ b/aiida/backends/testbase.py @@ -205,12 +205,12 @@ def setUpClass(cls, *args, **kwargs): """Setup the PGTest postgres test cluster.""" from pgtest.pgtest import PGTest cls.pg_test = PGTest() - super(AiidaPostgresTestCase, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) @classmethod def tearDownClass(cls, *args, **kwargs): """Close the PGTest postgres test cluster.""" - super(AiidaPostgresTestCase, cls).tearDownClass(*args, **kwargs) + super().tearDownClass(*args, **kwargs) cls.pg_test.close() diff --git a/aiida/backends/tests/cmdline/commands/test_calcjob.py b/aiida/backends/tests/cmdline/commands/test_calcjob.py index 81583227bb..7c05c81b35 100644 --- a/aiida/backends/tests/cmdline/commands/test_calcjob.py +++ b/aiida/backends/tests/cmdline/commands/test_calcjob.py @@ -30,7 +30,7 @@ class TestVerdiCalculation(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiCalculation, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) from aiida.common.links import LinkType from aiida.engine import ProcessState diff --git a/aiida/backends/tests/cmdline/commands/test_code.py b/aiida/backends/tests/cmdline/commands/test_code.py index 71be160f05..d28246533c 100644 --- a/aiida/backends/tests/cmdline/commands/test_code.py +++ b/aiida/backends/tests/cmdline/commands/test_code.py @@ -25,7 +25,7 @@ class TestVerdiCodeSetup(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiCodeSetup, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) orm.Computer( name='comp', hostname='localhost', @@ -134,7 +134,7 @@ class TestVerdiCodeCommands(AiidaTestCase): def setUpClass(cls, *args, **kwargs): from aiida import orm - super(TestVerdiCodeCommands, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) orm.Computer( name='comp', hostname='localhost', diff --git a/aiida/backends/tests/cmdline/commands/test_computer.py b/aiida/backends/tests/cmdline/commands/test_computer.py index fc9b610fb5..5170f42819 100644 --- a/aiida/backends/tests/cmdline/commands/test_computer.py +++ b/aiida/backends/tests/cmdline/commands/test_computer.py @@ -492,7 +492,7 @@ class TestVerdiComputerCommands(AiidaTestCase): def setUpClass(cls, *args, **kwargs): """Create a new computer> I create a new one because I want to configure it and I don't want to interfere with other tests""" - super(TestVerdiComputerCommands, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.computer_name = 'comp_cli_test_computer' cls.comp = orm.Computer( name=cls.computer_name, diff --git a/aiida/backends/tests/cmdline/commands/test_daemon.py b/aiida/backends/tests/cmdline/commands/test_daemon.py index 62665edc85..034cc7e1b6 100644 --- a/aiida/backends/tests/cmdline/commands/test_daemon.py +++ b/aiida/backends/tests/cmdline/commands/test_daemon.py @@ -21,7 +21,7 @@ class TestVerdiDaemon(AiidaTestCase): """Tests for `verdi daemon` commands.""" def setUp(self): - super(TestVerdiDaemon, self).setUp() + super().setUp() self.daemon_client = DaemonClient(get_config().current_profile) self.cli_runner = CliRunner() diff --git a/aiida/backends/tests/cmdline/commands/test_data.py b/aiida/backends/tests/cmdline/commands/test_data.py index fd7be96e80..ecf7c5a162 100644 --- a/aiida/backends/tests/cmdline/commands/test_data.py +++ b/aiida/backends/tests/cmdline/commands/test_data.py @@ -196,7 +196,7 @@ class TestVerdiData(AiidaTestCase): @classmethod def setUpClass(cls): - super(TestVerdiData, cls).setUpClass() + super().setUpClass() def setUp(self): pass @@ -226,7 +226,7 @@ class TestVerdiDataArray(AiidaTestCase): @classmethod def setUpClass(cls): - super(TestVerdiDataArray, cls).setUpClass() + super().setUpClass() def setUp(self): self.a = ArrayData() @@ -312,7 +312,7 @@ def connect_structure_bands(structure): @classmethod def setUpClass(cls): - super(TestVerdiDataBands, cls).setUpClass() + super().setUpClass() cls.ids = cls.create_structure_bands() def setUp(self): @@ -349,7 +349,7 @@ class TestVerdiDataDict(AiidaTestCase): @classmethod def setUpClass(cls): - super(TestVerdiDataDict, cls).setUpClass() + super().setUpClass() def setUp(self): self.p = Dict() @@ -379,7 +379,7 @@ class TestVerdiDataRemote(AiidaTestCase): @classmethod def setUpClass(cls): - super(TestVerdiDataRemote, cls).setUpClass() + super().setUpClass() user = orm.User.objects.get_default() orm.AuthInfo(cls.computer, user).store() @@ -498,7 +498,7 @@ def create_trajectory_data(): @classmethod def setUpClass(cls): - super(TestVerdiDataTrajectory, cls).setUpClass() + super().setUpClass() orm.Computer( name='comp', hostname='localhost', @@ -578,7 +578,7 @@ def create_structure_data(): @classmethod def setUpClass(cls): - super(TestVerdiDataStructure, cls).setUpClass() + super().setUpClass() orm.Computer(name='comp', hostname='localhost', transport_type='local', @@ -741,7 +741,7 @@ def create_cif_data(cls): @classmethod def setUpClass(cls): - super(TestVerdiDataCif, cls).setUpClass() + super().setUpClass() orm.Computer( name='comp', hostname='localhost', @@ -752,7 +752,7 @@ def setUpClass(cls): cls.ids = cls.create_cif_data() def setUp(self): - super(TestVerdiDataCif, self).setUp() + super().setUp() self.comp = self.computer self.runner = CliRunner() self.this_folder = os.path.dirname(__file__) @@ -812,10 +812,10 @@ class TestVerdiDataSinglefile(AiidaTestCase, TestVerdiDataListable, TestVerdiDat @classmethod def setUpClass(cls): - super(TestVerdiDataSinglefile, cls).setUpClass() + super().setUpClass() def setUp(self): - super(TestVerdiDataSinglefile, self).setUp() + super().setUp() self.comp = self.computer self.runner = CliRunner() self.this_folder = os.path.dirname(__file__) @@ -844,7 +844,7 @@ class TestVerdiDataUpf(AiidaTestCase): @classmethod def setUpClass(cls): - super(TestVerdiDataUpf, cls).setUpClass() + super().setUpClass() def setUp(self): self.filepath_pseudos = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'fixtures', 'pseudos') diff --git a/aiida/backends/tests/cmdline/commands/test_export.py b/aiida/backends/tests/cmdline/commands/test_export.py index 6007e8a399..13be629279 100644 --- a/aiida/backends/tests/cmdline/commands/test_export.py +++ b/aiida/backends/tests/cmdline/commands/test_export.py @@ -45,7 +45,7 @@ class TestVerdiExport(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiExport, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) from aiida import orm cls.computer = orm.Computer( diff --git a/aiida/backends/tests/cmdline/commands/test_graph.py b/aiida/backends/tests/cmdline/commands/test_graph.py index 9170ed00a6..82c07d565c 100644 --- a/aiida/backends/tests/cmdline/commands/test_graph.py +++ b/aiida/backends/tests/cmdline/commands/test_graph.py @@ -40,7 +40,7 @@ class TestVerdiGraph(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiGraph, cls).setUpClass() + super().setUpClass() from aiida.orm import Data cls.node = Data().store() diff --git a/aiida/backends/tests/cmdline/commands/test_group.py b/aiida/backends/tests/cmdline/commands/test_group.py index 1ea6d90d37..394860b4a2 100644 --- a/aiida/backends/tests/cmdline/commands/test_group.py +++ b/aiida/backends/tests/cmdline/commands/test_group.py @@ -21,7 +21,7 @@ class TestVerdiGroup(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiGroup, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) for group in ['dummygroup1', 'dummygroup2', 'dummygroup3', 'dummygroup4']: orm.Group(label=group).store() diff --git a/aiida/backends/tests/cmdline/commands/test_help.py b/aiida/backends/tests/cmdline/commands/test_help.py index 6b1fe6b116..03f92936cd 100644 --- a/aiida/backends/tests/cmdline/commands/test_help.py +++ b/aiida/backends/tests/cmdline/commands/test_help.py @@ -20,7 +20,7 @@ class TestVerdiHelpCommand(AiidaTestCase): """Tests for `verdi help`.""" def setUp(self): - super(TestVerdiHelpCommand, self).setUp() + super().setUp() self.cli_runner = CliRunner() @with_temporary_config_instance diff --git a/aiida/backends/tests/cmdline/commands/test_import.py b/aiida/backends/tests/cmdline/commands/test_import.py index dc62ef264f..c37553fc6d 100644 --- a/aiida/backends/tests/cmdline/commands/test_import.py +++ b/aiida/backends/tests/cmdline/commands/test_import.py @@ -24,7 +24,7 @@ class TestVerdiImport(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiImport, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Helper variables cls.url_path = 'https://raw.githubusercontent.com/aiidateam/aiida-core/' \ diff --git a/aiida/backends/tests/cmdline/commands/test_node.py b/aiida/backends/tests/cmdline/commands/test_node.py index 1a806bd495..4eea564acb 100644 --- a/aiida/backends/tests/cmdline/commands/test_node.py +++ b/aiida/backends/tests/cmdline/commands/test_node.py @@ -30,7 +30,7 @@ class TestVerdiNode(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiNode, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) node = orm.Data() @@ -193,7 +193,7 @@ class TestVerdiGraph(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiGraph, cls).setUpClass() + super().setUpClass() from aiida.orm import Data cls.node = Data().store() @@ -414,7 +414,7 @@ class TestVerdiRehash(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiRehash, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) from aiida.orm import Data, Bool, Float, Int cls.node_base = Data().store() diff --git a/aiida/backends/tests/cmdline/commands/test_process.py b/aiida/backends/tests/cmdline/commands/test_process.py index b96b5c570c..7da35f2618 100644 --- a/aiida/backends/tests/cmdline/commands/test_process.py +++ b/aiida/backends/tests/cmdline/commands/test_process.py @@ -39,7 +39,7 @@ class TestVerdiProcessDaemon(AiidaTestCase): TEST_TIMEOUT = 5. def setUp(self): - super(TestVerdiProcessDaemon, self).setUp() + super().setUp() from aiida.manage.configuration import get_config from aiida.engine.daemon.client import DaemonClient @@ -56,7 +56,7 @@ def tearDown(self): import signal os.kill(self.daemon_pid, signal.SIGTERM) - super(TestVerdiProcessDaemon, self).tearDown() + super().tearDown() def test_pause_play_kill(self): """ @@ -126,7 +126,7 @@ class TestVerdiProcess(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiProcess, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) from aiida.engine import ProcessState from aiida.orm.groups import Group @@ -163,7 +163,7 @@ def setUpClass(cls, *args, **kwargs): cls.group.add_nodes(cls.calcs[0]) def setUp(self): - super(TestVerdiProcess, self).setUp() + super().setUp() self.cli_runner = CliRunner() def test_list(self): @@ -373,7 +373,7 @@ class TestVerdiProcessListWarning(AiidaTestCase): """Tests for the `verdi process list` active slots warning.""" def setUp(self): - super(TestVerdiProcessListWarning, self).setUp() + super().setUp() self.cli_runner = CliRunner() # Override the call to the circus client to retrieve the number of workers # As we don't have a running circus client, this will normally fail, so here we simulate the @@ -386,7 +386,7 @@ def tearDown(self): # Reset the redifined function import aiida.cmdline.utils.common aiida.cmdline.utils.common.get_num_workers = self.real_get_num_workers - super(TestVerdiProcessListWarning, self).tearDown() + super().tearDown() def test_list_worker_slot_warning(self): """ @@ -428,7 +428,7 @@ class TestVerdiProcessCallRoot(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiProcessCallRoot, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.node_root = WorkflowNode() cls.node_middle = WorkflowNode() cls.node_terminal = WorkflowNode() @@ -442,7 +442,7 @@ def setUpClass(cls, *args, **kwargs): cls.node_terminal.store() def setUp(self): - super(TestVerdiProcessCallRoot, self).setUp() + super().setUp() self.cli_runner = CliRunner() def test_no_caller(self): diff --git a/aiida/backends/tests/cmdline/commands/test_profile.py b/aiida/backends/tests/cmdline/commands/test_profile.py index c054a314e1..fba89feeca 100644 --- a/aiida/backends/tests/cmdline/commands/test_profile.py +++ b/aiida/backends/tests/cmdline/commands/test_profile.py @@ -22,7 +22,7 @@ class TestVerdiProfileSetup(AiidaPostgresTestCase): def setUp(self): """Create a CLI runner to invoke the CLI commands.""" - super(TestVerdiProfileSetup, self).setUp() + super().setUp() self.cli_runner = CliRunner() self.config = None self.profile_list = [] diff --git a/aiida/backends/tests/cmdline/commands/test_rehash.py b/aiida/backends/tests/cmdline/commands/test_rehash.py index 1fa5154c4a..0a89c1708d 100644 --- a/aiida/backends/tests/cmdline/commands/test_rehash.py +++ b/aiida/backends/tests/cmdline/commands/test_rehash.py @@ -20,7 +20,7 @@ class TestVerdiRehash(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestVerdiRehash, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) from aiida.orm import Data, Bool, Float, Int cls.node_base = Data().store() diff --git a/aiida/backends/tests/cmdline/commands/test_restapi.py b/aiida/backends/tests/cmdline/commands/test_restapi.py index c12d6b517a..ab3d54eca0 100644 --- a/aiida/backends/tests/cmdline/commands/test_restapi.py +++ b/aiida/backends/tests/cmdline/commands/test_restapi.py @@ -19,7 +19,7 @@ class TestVerdiRestapiCommand(AiidaTestCase): """tests for verdi restapi command""" def setUp(self): - super(TestVerdiRestapiCommand, self).setUp() + super().setUp() self.cli_runner = CliRunner() def test_run_restapi(self): diff --git a/aiida/backends/tests/cmdline/commands/test_run.py b/aiida/backends/tests/cmdline/commands/test_run.py index 9085f939a1..3cae78fb70 100644 --- a/aiida/backends/tests/cmdline/commands/test_run.py +++ b/aiida/backends/tests/cmdline/commands/test_run.py @@ -18,7 +18,7 @@ class TestVerdiRun(AiidaTestCase): """Tests for `verdi run`.""" def setUp(self): - super(TestVerdiRun, self).setUp() + super().setUp() self.cli_runner = CliRunner() def test_run_workfunction(self): diff --git a/aiida/backends/tests/cmdline/commands/test_setup.py b/aiida/backends/tests/cmdline/commands/test_setup.py index 1967d2c52d..18eb052f95 100644 --- a/aiida/backends/tests/cmdline/commands/test_setup.py +++ b/aiida/backends/tests/cmdline/commands/test_setup.py @@ -29,7 +29,7 @@ class TestVerdiSetup(AiidaPostgresTestCase): def setUp(self): """Create a CLI runner to invoke the CLI commands.""" - super(TestVerdiSetup, self).setUp() + super().setUp() self.backend = configuration.PROFILE.database_backend self.cli_runner = CliRunner() diff --git a/aiida/backends/tests/cmdline/commands/test_user.py b/aiida/backends/tests/cmdline/commands/test_user.py index f5803a2eec..f5647e953e 100644 --- a/aiida/backends/tests/cmdline/commands/test_user.py +++ b/aiida/backends/tests/cmdline/commands/test_user.py @@ -32,7 +32,7 @@ class TestVerdiUserCommand(AiidaTestCase): def setUp(self): - super(TestVerdiUserCommand, self).setUp() + super().setUp() created, user = orm.User.objects.get_or_create(email=user_1['email']) for key, value in user_1.items(): diff --git a/aiida/backends/tests/cmdline/commands/test_verdi.py b/aiida/backends/tests/cmdline/commands/test_verdi.py index 7cd34bdb8c..6579785734 100644 --- a/aiida/backends/tests/cmdline/commands/test_verdi.py +++ b/aiida/backends/tests/cmdline/commands/test_verdi.py @@ -20,7 +20,7 @@ class TestVerdi(AiidaTestCase): """Tests for `verdi`.""" def setUp(self): - super(TestVerdi, self).setUp() + super().setUp() self.cli_runner = CliRunner() def test_verdi_version(self): diff --git a/aiida/backends/tests/cmdline/params/types/test_calculation.py b/aiida/backends/tests/cmdline/params/types/test_calculation.py index 7abd622f1f..d91950a779 100644 --- a/aiida/backends/tests/cmdline/params/types/test_calculation.py +++ b/aiida/backends/tests/cmdline/params/types/test_calculation.py @@ -26,7 +26,7 @@ def setUpClass(cls, *args, **kwargs): that matches exactly the ID and UUID, respectively, of the first one. This allows us to test the rules implemented to solve ambiguities that arise when determing the identifier type """ - super(TestCalculationParamType, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.param = CalculationParamType() cls.entity_01 = CalculationNode().store() diff --git a/aiida/backends/tests/cmdline/params/types/test_code.py b/aiida/backends/tests/cmdline/params/types/test_code.py index a4fa9707a1..f96d9ecf05 100644 --- a/aiida/backends/tests/cmdline/params/types/test_code.py +++ b/aiida/backends/tests/cmdline/params/types/test_code.py @@ -28,7 +28,7 @@ def setUpClass(cls, *args, **kwargs): that matches exactly the ID and UUID, respectively, of the first one. This allows us to test the rules implemented to solve ambiguities that arise when determing the identifier type """ - super(TestCodeParamType, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.param_base = CodeParamType() cls.param_entry_point = CodeParamType(entry_point='arithmetic.add') diff --git a/aiida/backends/tests/cmdline/params/types/test_computer.py b/aiida/backends/tests/cmdline/params/types/test_computer.py index 1cde31560a..b6523a52c8 100644 --- a/aiida/backends/tests/cmdline/params/types/test_computer.py +++ b/aiida/backends/tests/cmdline/params/types/test_computer.py @@ -26,7 +26,7 @@ def setUpClass(cls, *args, **kwargs): that matches exactly the ID and UUID, respectively, of the first one. This allows us to test the rules implemented to solve ambiguities that arise when determing the identifier type """ - super(TestComputerParamType, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) kwargs = { 'hostname': 'localhost', diff --git a/aiida/backends/tests/cmdline/params/types/test_data.py b/aiida/backends/tests/cmdline/params/types/test_data.py index d1649c3fc7..a1f469e092 100644 --- a/aiida/backends/tests/cmdline/params/types/test_data.py +++ b/aiida/backends/tests/cmdline/params/types/test_data.py @@ -26,7 +26,7 @@ def setUpClass(cls, *args, **kwargs): that matches exactly the ID and UUID, respectively, of the first one. This allows us to test the rules implemented to solve ambiguities that arise when determing the identifier type """ - super(TestDataParamType, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.param = DataParamType() cls.entity_01 = Data().store() diff --git a/aiida/backends/tests/cmdline/params/types/test_group.py b/aiida/backends/tests/cmdline/params/types/test_group.py index ffa617ea45..d40385682a 100644 --- a/aiida/backends/tests/cmdline/params/types/test_group.py +++ b/aiida/backends/tests/cmdline/params/types/test_group.py @@ -25,7 +25,7 @@ def setUpClass(cls, *args, **kwargs): that matches exactly the ID and UUID, respectively, of the first one. This allows us to test the rules implemented to solve ambiguities that arise when determing the identifier type """ - super(TestGroupParamType, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.param = GroupParamType() cls.entity_01 = Group(label='group_01').store() diff --git a/aiida/backends/tests/cmdline/params/types/test_node.py b/aiida/backends/tests/cmdline/params/types/test_node.py index 4da7446c6f..91e33527a1 100644 --- a/aiida/backends/tests/cmdline/params/types/test_node.py +++ b/aiida/backends/tests/cmdline/params/types/test_node.py @@ -25,7 +25,7 @@ def setUpClass(cls, *args, **kwargs): that matches exactly the ID and UUID, respectively, of the first one. This allows us to test the rules implemented to solve ambiguities that arise when determing the identifier type """ - super(TestNodeParamType, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.param = NodeParamType() cls.entity_01 = Data().store() diff --git a/aiida/backends/tests/cmdline/utils/test_common.py b/aiida/backends/tests/cmdline/utils/test_common.py index 0bb9783d22..dea9f7ac1c 100644 --- a/aiida/backends/tests/cmdline/utils/test_common.py +++ b/aiida/backends/tests/cmdline/utils/test_common.py @@ -85,7 +85,7 @@ class TestProcessWithoutDocstring(Process): @classmethod def define(cls, spec): - super(TestProcessWithoutDocstring, cls).define(spec) + super().define(spec) spec.input('some_input') class TestProcessWithDocstring(Process): @@ -93,7 +93,7 @@ class TestProcessWithDocstring(Process): @classmethod def define(cls, spec): - super(TestProcessWithDocstring, cls).define(spec) + super().define(spec) spec.input('some_input') # We are just checking that the command does not except diff --git a/aiida/backends/tests/engine/test_calc_job.py b/aiida/backends/tests/engine/test_calc_job.py index 3eea911f9a..daccb98f07 100644 --- a/aiida/backends/tests/engine/test_calc_job.py +++ b/aiida/backends/tests/engine/test_calc_job.py @@ -26,7 +26,7 @@ class TestCalcJob(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestCalcJob, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.remote_code = orm.Code(remote_computer_exec=(cls.computer, '/bin/true')).store() cls.local_code = orm.Code(local_executable='true', files=['/bin/true']).store() cls.inputs = { @@ -43,11 +43,11 @@ def setUpClass(cls, *args, **kwargs): } def setUp(self): - super(TestCalcJob, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestCalcJob, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_run_base_class(self): @@ -96,7 +96,7 @@ class SimpleCalcJob(CalcJob): @classmethod def define(cls, spec): - super(SimpleCalcJob, cls).define(spec) + super().define(spec) def prepare_for_submission(self, folder): pass diff --git a/aiida/backends/tests/engine/test_calcfunctions.py b/aiida/backends/tests/engine/test_calcfunctions.py index 6b4aa9b4b7..0cac84bd55 100644 --- a/aiida/backends/tests/engine/test_calcfunctions.py +++ b/aiida/backends/tests/engine/test_calcfunctions.py @@ -27,7 +27,7 @@ class TestCalcFunction(AiidaTestCase): """ def setUp(self): - super(TestCalcFunction, self).setUp() + super().setUp() self.assertIsNone(Process.current()) self.default_int = Int(256) @@ -38,7 +38,7 @@ def test_calcfunction(data): self.test_calcfunction = test_calcfunction def tearDown(self): - super(TestCalcFunction, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_calcfunction_node_type(self): diff --git a/aiida/backends/tests/engine/test_class_loader.py b/aiida/backends/tests/engine/test_class_loader.py index 8150f9ba32..dac3dce60d 100644 --- a/aiida/backends/tests/engine/test_class_loader.py +++ b/aiida/backends/tests/engine/test_class_loader.py @@ -18,11 +18,11 @@ class TestCalcJob(AiidaTestCase): def setUp(self): - super(TestCalcJob, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestCalcJob, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_class_loader(self): diff --git a/aiida/backends/tests/engine/test_launch.py b/aiida/backends/tests/engine/test_launch.py index ad09806145..df8fc0b03e 100644 --- a/aiida/backends/tests/engine/test_launch.py +++ b/aiida/backends/tests/engine/test_launch.py @@ -23,7 +23,7 @@ class FileCalcJob(CalcJob): @classmethod def define(cls, spec): - super(FileCalcJob, cls).define(spec) + super().define(spec) spec.input('single_file', valid_type=orm.SinglefileData) spec.input_namespace('files', valid_type=orm.SinglefileData, dynamic=True) @@ -48,7 +48,7 @@ class AddWorkChain(WorkChain): @classmethod def define(cls, spec): - super(AddWorkChain, cls).define(spec) + super().define(spec) spec.input('a', valid_type=orm.Int) spec.input('b', valid_type=orm.Int) spec.outline(cls.add) @@ -61,14 +61,14 @@ def add(self): class TestLaunchers(AiidaTestCase): def setUp(self): - super(TestLaunchers, self).setUp() + super().setUp() self.assertIsNone(Process.current()) self.a = orm.Int(1) self.b = orm.Int(2) self.result = 3 def tearDown(self): - super(TestLaunchers, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_calcfunction_run(self): @@ -132,7 +132,7 @@ class TestLaunchersDryRun(AiidaTestCase): """Test the launchers when performing a dry-run.""" def setUp(self): - super(TestLaunchersDryRun, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): @@ -140,7 +140,7 @@ def tearDown(self): import shutil from aiida.common.folders import CALC_JOB_DRY_RUN_BASE_PATH - super(TestLaunchersDryRun, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) # Make sure to clean the test directory that will be generated by the dry-run diff --git a/aiida/backends/tests/engine/test_manager.py b/aiida/backends/tests/engine/test_manager.py index 1a684ac591..4e2748e901 100644 --- a/aiida/backends/tests/engine/test_manager.py +++ b/aiida/backends/tests/engine/test_manager.py @@ -23,7 +23,7 @@ class TestJobManager(AiidaTestCase): """Test the `aiida.engine.processes.calcjobs.manager.JobManager` class.""" def setUp(self): - super(TestJobManager, self).setUp() + super().setUp() self.loop = tornado.ioloop.IOLoop() self.transport_queue = TransportQueue(self.loop) self.user = User.objects.get_default() @@ -31,7 +31,7 @@ def setUp(self): self.manager = JobManager(self.transport_queue) def tearDown(self): - super(TestJobManager, self).tearDown() + super().tearDown() AuthInfo.objects.delete(self.auth_info.pk) def test_get_jobs_list(self): @@ -52,7 +52,7 @@ class TestJobsList(AiidaTestCase): """Test the `aiida.engine.processes.calcjobs.manager.JobsList` class.""" def setUp(self): - super(TestJobsList, self).setUp() + super().setUp() self.loop = tornado.ioloop.IOLoop() self.transport_queue = TransportQueue(self.loop) self.user = User.objects.get_default() @@ -60,7 +60,7 @@ def setUp(self): self.jobs_list = JobsList(self.auth_info, self.transport_queue) def tearDown(self): - super(TestJobsList, self).tearDown() + super().tearDown() AuthInfo.objects.delete(self.auth_info.pk) def test_get_minimum_update_interval(self): diff --git a/aiida/backends/tests/engine/test_persistence.py b/aiida/backends/tests/engine/test_persistence.py index 26551a9c69..7402f31951 100644 --- a/aiida/backends/tests/engine/test_persistence.py +++ b/aiida/backends/tests/engine/test_persistence.py @@ -20,11 +20,11 @@ class TestProcess(AiidaTestCase): """Test the basic saving and loading of process states.""" def setUp(self): - super(TestProcess, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestProcess, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_save_load(self): @@ -43,7 +43,7 @@ class TestAiiDAPersister(AiidaTestCase): maxDiff = 1024 def setUp(self): - super(TestAiiDAPersister, self).setUp() + super().setUp() self.persister = AiiDAPersister() def test_save_load_checkpoint(self): diff --git a/aiida/backends/tests/engine/test_process.py b/aiida/backends/tests/engine/test_process.py index f5bf55aafc..f16d6be3b2 100644 --- a/aiida/backends/tests/engine/test_process.py +++ b/aiida/backends/tests/engine/test_process.py @@ -28,18 +28,18 @@ class NameSpacedProcess(Process): @classmethod def define(cls, spec): - super(NameSpacedProcess, cls).define(spec) + super().define(spec) spec.input('some.name.space.a', valid_type=orm.Int) class TestProcessNamespace(AiidaTestCase): def setUp(self): - super(TestProcessNamespace, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestProcessNamespace, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_namespaced_process(self): @@ -75,25 +75,25 @@ def run(self): @override def on_create(self): - super(ProcessStackTest, self).on_create() + super().on_create() self._thread_id = threading.current_thread().ident @override def on_stop(self): # The therad must match the one used in on_create because process # stack is using thread local storage to keep track of who called who - super(ProcessStackTest, self).on_stop() + super().on_stop() assert self._thread_id is threading.current_thread().ident class TestProcess(AiidaTestCase): def setUp(self): - super(TestProcess, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestProcess, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_process_stack(self): @@ -246,7 +246,7 @@ class TestProcess(Process): @classmethod def define(cls, spec): - super(TestProcess, cls).define(spec) + super().define(spec) spec.input_namespace('namespace', valid_type=orm.Int, dynamic=True) spec.output_namespace('namespace', valid_type=orm.Int, dynamic=True) @@ -268,7 +268,7 @@ class TestProcess(Process): @classmethod def define(cls, spec): - super(TestProcess, cls).define(spec) + super().define(spec) spec.input('add_outputs', valid_type=orm.Bool, default=orm.Bool(False)) spec.output_namespace('integer.namespace', valid_type=orm.Int, dynamic=True) spec.output('required_string', valid_type=orm.Str, required=True) diff --git a/aiida/backends/tests/engine/test_process_builder.py b/aiida/backends/tests/engine/test_process_builder.py index cf82529ec2..74b5af2e60 100644 --- a/aiida/backends/tests/engine/test_process_builder.py +++ b/aiida/backends/tests/engine/test_process_builder.py @@ -23,7 +23,7 @@ class TestWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChain, cls).define(spec) + super().define(spec) spec.input_namespace('dynamic.namespace', dynamic=True) spec.input('values', valid_type=orm.Int, help='Port name that overlaps with method of mutable mapping') spec.input('name.spaced', valid_type=orm.Int, help='Namespaced port') @@ -37,7 +37,7 @@ class TestLazyProcessNamespace(Process): @classmethod def define(cls, spec): - super(TestLazyProcessNamespace, cls).define(spec) + super().define(spec) spec.input_namespace('namespace') spec.input_namespace('namespace.nested') spec.input('namespace.nested.bird') @@ -49,7 +49,7 @@ class MappingData(Mapping, orm.Data): """Data sub class that is also a `Mapping`.""" def __init__(self, data=None): - super(MappingData, self).__init__() + super().__init__() if data is None: data = {} self._data = data @@ -67,7 +67,7 @@ def __len__(self): class TestProcessBuilder(AiidaTestCase): def setUp(self): - super(TestProcessBuilder, self).setUp() + super().setUp() self.assertIsNone(Process.current()) self.process_class = CalculationFactory('templatereplacer') self.builder = self.process_class.get_builder() @@ -87,7 +87,7 @@ def setUp(self): } def tearDown(self): - super(TestProcessBuilder, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_builder_inputs(self): diff --git a/aiida/backends/tests/engine/test_process_function.py b/aiida/backends/tests/engine/test_process_function.py index cfa3f8b793..fefcd22a83 100644 --- a/aiida/backends/tests/engine/test_process_function.py +++ b/aiida/backends/tests/engine/test_process_function.py @@ -36,7 +36,7 @@ class TestProcessFunction(AiidaTestCase): # pylint: disable=too-many-public-methods,too-many-instance-attributes def setUp(self): - super(TestProcessFunction, self).setUp() + super().setUp() self.assertIsNone(Process.current()) @workfunction @@ -115,7 +115,7 @@ def function_out_unstored(): self.function_out_unstored = function_out_unstored def tearDown(self): - super(TestProcessFunction, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_properties(self): diff --git a/aiida/backends/tests/engine/test_process_spec.py b/aiida/backends/tests/engine/test_process_spec.py index 7403837140..c645ca3c61 100644 --- a/aiida/backends/tests/engine/test_process_spec.py +++ b/aiida/backends/tests/engine/test_process_spec.py @@ -18,14 +18,14 @@ class TestProcessSpec(AiidaTestCase): """Tests for the `ProcessSpec` class.""" def setUp(self): - super(TestProcessSpec, self).setUp() + super().setUp() self.assertIsNone(Process.current()) self.spec = Process.spec() self.spec.inputs.valid_type = Data self.spec.outputs.valid_type = Data def tearDown(self): - super(TestProcessSpec, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_dynamic_input(self): diff --git a/aiida/backends/tests/engine/test_rmq.py b/aiida/backends/tests/engine/test_rmq.py index 685ea2ced9..78813b019f 100644 --- a/aiida/backends/tests/engine/test_rmq.py +++ b/aiida/backends/tests/engine/test_rmq.py @@ -27,7 +27,7 @@ class TestProcessControl(AiidaTestCase): TIMEOUT = 2. def setUp(self): - super(TestProcessControl, self).setUp() + super().setUp() # These two need to share a common event loop otherwise the first will never send # the message while the daemon is running listening to intercept @@ -37,7 +37,7 @@ def setUp(self): def tearDown(self): self.daemon_runner.close() - super(TestProcessControl, self).tearDown() + super().tearDown() def test_submit_simple(self): # Launch the process diff --git a/aiida/backends/tests/engine/test_runners.py b/aiida/backends/tests/engine/test_runners.py index 16c7282e7b..e0f38cb707 100644 --- a/aiida/backends/tests/engine/test_runners.py +++ b/aiida/backends/tests/engine/test_runners.py @@ -31,11 +31,11 @@ def the_hans_klok_comeback(loop): class TestWorkchain(AiidaTestCase): def setUp(self): - super(TestWorkchain, self).setUp() + super().setUp() self.runner = get_manager().get_runner() def tearDown(self): - super(TestWorkchain, self).tearDown() + super().tearDown() def test_call_on_calculation_finish(self): loop = self.runner.loop diff --git a/aiida/backends/tests/engine/test_transport.py b/aiida/backends/tests/engine/test_transport.py index cd3d72433a..7e066c36f5 100644 --- a/aiida/backends/tests/engine/test_transport.py +++ b/aiida/backends/tests/engine/test_transport.py @@ -20,12 +20,12 @@ class TestTransportQueue(AiidaTestCase): def setUp(self, *args, **kwargs): """ Set up a simple authinfo and for later use """ - super(TestTransportQueue, self).setUp(*args, **kwargs) + super().setUp(*args, **kwargs) self.authinfo = orm.AuthInfo(computer=self.computer, user=orm.User.objects.get_default()).store() def tearDown(self, *args, **kwargs): orm.AuthInfo.objects.delete(self.authinfo.id) - super(TestTransportQueue, self).tearDown(*args, **kwargs) + super().tearDown(*args, **kwargs) def test_simple_request(self): """ Test a simple transport request """ diff --git a/aiida/backends/tests/engine/test_utils.py b/aiida/backends/tests/engine/test_utils.py index 5d592bd8d0..6e899ad3ea 100644 --- a/aiida/backends/tests/engine/test_utils.py +++ b/aiida/backends/tests/engine/test_utils.py @@ -26,7 +26,7 @@ class TestExponentialBackoffRetry(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): """Set up a simple authinfo and for later use.""" - super(TestExponentialBackoffRetry, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.authinfo = orm.AuthInfo(computer=cls.computer, user=orm.User.objects.get_default()) cls.authinfo.store() diff --git a/aiida/backends/tests/engine/test_work_chain.py b/aiida/backends/tests/engine/test_work_chain.py index 4dec10935d..e656ae310b 100644 --- a/aiida/backends/tests/engine/test_work_chain.py +++ b/aiida/backends/tests/engine/test_work_chain.py @@ -86,7 +86,7 @@ class Wf(WorkChain): @classmethod def define(cls, spec): - super(Wf, cls).define(spec) + super().define(spec) spec.input('value', default=Str('A')) spec.input('n', default=Int(3)) spec.outputs.dynamic = True @@ -98,7 +98,7 @@ def define(cls, spec): ) def on_create(self): - super(Wf, self).on_create() + super().on_create() # Reset the finished step self.finished_steps = { k: False for k in [ @@ -153,7 +153,7 @@ class PotentialFailureWorkChain(WorkChain): @classmethod def define(cls, spec): - super(PotentialFailureWorkChain, cls).define(spec) + super().define(spec) spec.input('success', valid_type=Bool) spec.input('through_return', valid_type=Bool, default=Bool(False)) spec.input('through_exit_code', valid_type=Bool, default=Bool(False)) @@ -241,11 +241,11 @@ class IfTest(WorkChain): @classmethod def define(cls, spec): - super(IfTest, cls).define(spec) + super().define(spec) spec.outline(if_(cls.condition)(cls.step1, cls.step2)) def on_create(self, *args, **kwargs): - super(IfTest, self).on_create(*args, **kwargs) + super().on_create(*args, **kwargs) self.ctx.s1 = False self.ctx.s2 = False @@ -284,11 +284,11 @@ def test_dict(self): class TestWorkchain(AiidaTestCase): def setUp(self): - super(TestWorkchain, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestWorkchain, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_run_base_class(self): @@ -341,7 +341,7 @@ class Wf(WorkChain): @classmethod def define(cls, spec): - super(Wf, cls).define(spec) + super().define(spec) # Try defining an invalid outline spec.outline(5) @@ -370,7 +370,7 @@ class IllegalWorkChain(WorkChain): @classmethod def define(cls, spec): - super(IllegalWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.illegal) spec.outputs.dynamic = True @@ -386,7 +386,7 @@ class Wf(WorkChain): @classmethod def define(cls, spec): - super(Wf, cls).define(spec) + super().define(spec) spec.input('a', valid_type=Int) spec.input('b', valid_type=Int) # Try defining an invalid outline @@ -409,7 +409,7 @@ class ReturnA(WorkChain): @classmethod def define(cls, spec): - super(ReturnA, cls).define(spec) + super().define(spec) spec.outline(cls.result) spec.outputs.dynamic = True @@ -420,7 +420,7 @@ class ReturnB(WorkChain): @classmethod def define(cls, spec): - super(ReturnB, cls).define(spec) + super().define(spec) spec.outline(cls.result) spec.outputs.dynamic = True @@ -431,7 +431,7 @@ class Wf(WorkChain): @classmethod def define(cls, spec): - super(Wf, cls).define(spec) + super().define(spec) spec.outline(cls.s1, cls.s2, cls.s3) def s1(self): @@ -456,7 +456,7 @@ class TestWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.setup_context, cls.read_context) def setup_context(self): @@ -519,7 +519,7 @@ class WcWithReturn(WorkChain): @classmethod def define(cls, spec): - super(WcWithReturn, cls).define(spec) + super().define(spec) spec.outline(cls.s1, if_(cls.isA)(return_), cls.after) def s1(self): @@ -547,7 +547,7 @@ class MainWorkChain(WorkChain): @classmethod def define(cls, spec): - super(MainWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.launch) def launch(self): @@ -578,7 +578,7 @@ class MainWorkChain(WorkChain): @classmethod def define(cls, spec): - super(MainWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.do_run, cls.check) spec.outputs.dynamic = True @@ -592,7 +592,7 @@ class SubWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SubWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.do_run) spec.outputs.dynamic = True @@ -609,7 +609,7 @@ class MainWorkChain(WorkChain): @classmethod def define(cls, spec): - super(MainWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.do_run, cls.check) spec.outputs.dynamic = True @@ -623,7 +623,7 @@ class SubWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SubWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.do_run) spec.outputs.dynamic = True @@ -639,7 +639,7 @@ class MainWorkChain(WorkChain): @classmethod def define(cls, spec): - super(MainWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.do_run) def do_run(self): @@ -657,7 +657,7 @@ class SubWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SubWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.do_run) def do_run(self): @@ -711,7 +711,7 @@ class TestWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.run, cls.check) spec.outputs.dynamic = True @@ -735,7 +735,7 @@ class SimpleWc(WorkChain): @classmethod def define(cls, spec): - super(SimpleWc, cls).define(spec) + super().define(spec) spec.outline(cls.result) spec.outputs.dynamic = True @@ -746,7 +746,7 @@ class Workchain(WorkChain): @classmethod def define(cls, spec): - super(Workchain, cls).define(spec) + super().define(spec) spec.outline(cls.begin, cls.result) def begin(self): @@ -775,7 +775,7 @@ class TestWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChain, cls).define(spec) + super().define(spec) spec.input('namespace.sub', non_db=True) spec.outline(cls.check_input) @@ -795,7 +795,7 @@ class TestWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChain, cls).define(spec) + super().define(spec) spec.input_namespace('namespace', dynamic=True) spec.outline(cls.check_input) @@ -813,7 +813,7 @@ class ExitCodeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(ExitCodeWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.run) spec.exit_code(status, label, message) @@ -852,18 +852,18 @@ class TestWorkChainAbort(AiidaTestCase): """ def setUp(self): - super(TestWorkChainAbort, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestWorkChainAbort, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) class AbortableWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChainAbort.AbortableWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.begin, cls.check) def begin(self): @@ -931,18 +931,18 @@ class TestWorkChainAbortChildren(AiidaTestCase): """ def setUp(self): - super(TestWorkChainAbortChildren, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestWorkChainAbortChildren, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) class SubWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChainAbortChildren.SubWorkChain, cls).define(spec) + super().define(spec) spec.input('kill', default=Bool(False)) spec.outline(cls.begin, cls.check) @@ -960,7 +960,7 @@ class MainWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChainAbortChildren.MainWorkChain, cls).define(spec) + super().define(spec) spec.input('kill', default=Bool(False)) spec.outline(cls.submit_child, cls.check) @@ -1021,11 +1021,11 @@ class TestImmutableInputWorkchain(AiidaTestCase): """ def setUp(self): - super(TestImmutableInputWorkchain, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestImmutableInputWorkchain, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_immutable_input(self): @@ -1038,7 +1038,7 @@ class Wf(WorkChain): @classmethod def define(cls, spec): - super(Wf, cls).define(spec) + super().define(spec) spec.input('a', valid_type=Int) spec.input('b', valid_type=Int) spec.outline( @@ -1074,7 +1074,7 @@ class Wf(WorkChain): @classmethod def define(cls, spec): - super(Wf, cls).define(spec) + super().define(spec) spec.input_namespace('subspace', dynamic=True) spec.outline( cls.step_one, @@ -1104,7 +1104,7 @@ class SerializeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SerializeWorkChain, cls).define(spec) + super().define(spec) spec.input( 'test', @@ -1126,11 +1126,11 @@ class TestSerializeWorkChain(AiidaTestCase): """ def setUp(self): - super(TestSerializeWorkChain, self).setUp() + super().setUp() self.assertIsNone(Process.current()) def tearDown(self): - super(TestSerializeWorkChain, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_serialize(self): @@ -1153,7 +1153,7 @@ class GrandParentExposeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(GrandParentExposeWorkChain, cls).define(spec) + super().define(spec) spec.expose_inputs(ParentExposeWorkChain, namespace='sub.sub') spec.expose_outputs(ParentExposeWorkChain, namespace='sub.sub') @@ -1172,7 +1172,7 @@ class ParentExposeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(ParentExposeWorkChain, cls).define(spec) + super().define(spec) spec.expose_inputs(ChildExposeWorkChain, include=['a']) spec.expose_inputs( @@ -1220,7 +1220,7 @@ class ChildExposeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(ChildExposeWorkChain, cls).define(spec) + super().define(spec) spec.input('a', valid_type=Int) spec.input('b', valid_type=Float) @@ -1321,7 +1321,7 @@ class Parent(WorkChain): @classmethod def define(cls, spec): - super(Parent, cls).define(spec) + super().define(spec) spec.input('a', default=stored_a) spec.outline(cls.step1) @@ -1332,7 +1332,7 @@ class Child(WorkChain): @classmethod def define(cls, spec): - super(Child, cls).define(spec) + super().define(spec) spec.expose_inputs(Parent) spec.outline(cls.step1) @@ -1348,7 +1348,7 @@ class PointlessWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChainMisc.PointlessWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.return_dict) def return_dict(self): @@ -1359,7 +1359,7 @@ class IllegalSubmitWorkChain(WorkChain): @classmethod def define(cls, spec): - super(TestWorkChainMisc.IllegalSubmitWorkChain, cls).define(spec) + super().define(spec) spec.outline(cls.illegal_submit) def illegal_submit(self): @@ -1384,7 +1384,7 @@ class Parent(WorkChain): @classmethod def define(cls, spec): - super(TestDefaultUniqueness.Parent, cls).define(spec) + super().define(spec) spec.expose_inputs(TestDefaultUniqueness.Child, namespace='child_one') spec.expose_inputs(TestDefaultUniqueness.Child, namespace='child_two') spec.outline(cls.do_run) @@ -1400,7 +1400,7 @@ class Child(WorkChain): @classmethod def define(cls, spec): - super(TestDefaultUniqueness.Child, cls).define(spec) + super().define(spec) spec.input('a', valid_type=Bool, default=Bool(True)) def run(self): diff --git a/aiida/backends/tests/engine/test_workfunctions.py b/aiida/backends/tests/engine/test_workfunctions.py index 783d7a9e74..ac95c3cc1d 100644 --- a/aiida/backends/tests/engine/test_workfunctions.py +++ b/aiida/backends/tests/engine/test_workfunctions.py @@ -23,7 +23,7 @@ class TestWorkFunction(AiidaTestCase): """ def setUp(self): - super(TestWorkFunction, self).setUp() + super().setUp() self.assertIsNone(Process.current()) self.default_int = Int(256) @@ -34,7 +34,7 @@ def test_workfunction(data): self.test_workfunction = test_workfunction def tearDown(self): - super(TestWorkFunction, self).tearDown() + super().tearDown() self.assertIsNone(Process.current()) def test_workfunction_node_type(self): diff --git a/aiida/backends/tests/manage/backup/test_backup_script.py b/aiida/backends/tests/manage/backup/test_backup_script.py index e3152378ef..646576911f 100644 --- a/aiida/backends/tests/manage/backup/test_backup_script.py +++ b/aiida/backends/tests/manage/backup/test_backup_script.py @@ -59,11 +59,11 @@ class TestBackupScriptUnit(AiidaTestCase): '"backup_dir": "/scratch/./aiida_user////backup//"}' def setUp(self): - super(TestBackupScriptUnit, self).setUp() + super().setUp() self._backup_setup_inst = Backup('', 2) def tearDown(self): - super(TestBackupScriptUnit, self).tearDown() + super().tearDown() self._backup_setup_inst = None def test_loading_basic_params_from_file(self): diff --git a/aiida/backends/tests/manage/configuration/migrations/test_migrations.py b/aiida/backends/tests/manage/configuration/migrations/test_migrations.py index 1821a2bd7e..3b9269fc4e 100644 --- a/aiida/backends/tests/manage/configuration/migrations/test_migrations.py +++ b/aiida/backends/tests/manage/configuration/migrations/test_migrations.py @@ -37,7 +37,7 @@ def load_config_sample(filename): return json.load(handle) def setUp(self): - super(TestConfigMigration, self).setUp() + super().setUp() self.maxDiff = None # pylint: disable=invalid-name def test_check_and_migrate(self): diff --git a/aiida/backends/tests/manage/configuration/test_config.py b/aiida/backends/tests/manage/configuration/test_config.py index c766b475eb..3622365b94 100644 --- a/aiida/backends/tests/manage/configuration/test_config.py +++ b/aiida/backends/tests/manage/configuration/test_config.py @@ -27,13 +27,13 @@ class TestConfigDirectory(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): """Save the current environment variable settings.""" - super(TestConfigDirectory, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.aiida_path_original = os.environ.get(settings.DEFAULT_AIIDA_PATH_VARIABLE, None) @classmethod def tearDownClass(cls, *args, **kwargs): """Restore the original environment variable settings.""" - super(TestConfigDirectory, cls).tearDownClass(*args, **kwargs) + super().tearDownClass(*args, **kwargs) if cls.aiida_path_original is not None: os.environ[settings.DEFAULT_AIIDA_PATH_VARIABLE] = cls.aiida_path_original else: @@ -155,7 +155,7 @@ class TestConfig(AiidaTestCase): def setUp(self): """Setup a mock config.""" - super(TestConfig, self).setUp() + super().setUp() self.profile_name = 'test_profile' self.profile = create_mock_profile(self.profile_name) self.config_filebase = tempfile.mkdtemp() @@ -173,7 +173,7 @@ def setUp(self): def tearDown(self): """Clean the temporary folder.""" - super(TestConfig, self).tearDown() + super().tearDown() if self.config_filebase and os.path.isdir(self.config_filebase): shutil.rmtree(self.config_filebase) diff --git a/aiida/backends/tests/manage/configuration/test_profile.py b/aiida/backends/tests/manage/configuration/test_profile.py index 8c6e531547..befb20a54a 100644 --- a/aiida/backends/tests/manage/configuration/test_profile.py +++ b/aiida/backends/tests/manage/configuration/test_profile.py @@ -23,7 +23,7 @@ class TestProfile(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): """Setup a mock profile.""" - super(TestProfile, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.profile_name = 'test_profile' cls.profile_dictionary = { 'default_user': 'dummy@localhost', diff --git a/aiida/backends/tests/orm/data/test_dict.py b/aiida/backends/tests/orm/data/test_dict.py index 985b3d968d..4172f04741 100644 --- a/aiida/backends/tests/orm/data/test_dict.py +++ b/aiida/backends/tests/orm/data/test_dict.py @@ -18,7 +18,7 @@ class TestDict(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestDict, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.dictionary = {'value': 1, 'nested': {'dict': 'ionary'}} cls.node = Dict(dict=cls.dictionary) diff --git a/aiida/backends/tests/orm/data/test_folder.py b/aiida/backends/tests/orm/data/test_folder.py index f7887874cd..cb61239486 100644 --- a/aiida/backends/tests/orm/data/test_folder.py +++ b/aiida/backends/tests/orm/data/test_folder.py @@ -23,7 +23,7 @@ class TestFolderData(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestFolderData, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.tempdir = tempfile.mkdtemp() cls.tree = { 'a.txt': 'Content of file A\nWith some newlines', diff --git a/aiida/backends/tests/orm/data/test_kpoints.py b/aiida/backends/tests/orm/data/test_kpoints.py index 2a6dd788fd..b844b2f6dd 100644 --- a/aiida/backends/tests/orm/data/test_kpoints.py +++ b/aiida/backends/tests/orm/data/test_kpoints.py @@ -20,7 +20,7 @@ class TestKpoints(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestKpoints, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) alat = 5.430 # angstrom cell = [[ diff --git a/aiida/backends/tests/orm/data/test_orbital.py b/aiida/backends/tests/orm/data/test_orbital.py index bc35ccdfe6..4d39e5f21c 100644 --- a/aiida/backends/tests/orm/data/test_orbital.py +++ b/aiida/backends/tests/orm/data/test_orbital.py @@ -21,7 +21,7 @@ class TestOrbitalData(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestOrbitalData, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.my_real_hydrogen_dict = { 'angular_momentum': -3, diff --git a/aiida/backends/tests/orm/data/test_remote.py b/aiida/backends/tests/orm/data/test_remote.py index a48bec1e71..426c164cb4 100644 --- a/aiida/backends/tests/orm/data/test_remote.py +++ b/aiida/backends/tests/orm/data/test_remote.py @@ -23,7 +23,7 @@ class TestRemoteData(AiidaTestCase): @classmethod def setUpClass(cls): - super(TestRemoteData, cls).setUpClass() + super().setUpClass() user = User.objects.get_default() authinfo = AuthInfo(cls.computer, user) authinfo.store() diff --git a/aiida/backends/tests/orm/data/test_upf.py b/aiida/backends/tests/orm/data/test_upf.py index 5e3f811de5..94a4357c3b 100644 --- a/aiida/backends/tests/orm/data/test_upf.py +++ b/aiida/backends/tests/orm/data/test_upf.py @@ -80,7 +80,7 @@ class TestUpfParser(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestUpfParser, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) filepath_base = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir, 'fixtures', 'pseudos')) cls.filepath_barium = os.path.join(filepath_base, 'Ba.pbesol-spn-rrkjus_psl.0.2.3-tot-pslib030.UPF') cls.filepath_oxygen = os.path.join(filepath_base, 'O.pbesol-n-rrkjus_psl.0.1-tested-pslib030.UPF') diff --git a/aiida/backends/tests/orm/implementation/test_comments.py b/aiida/backends/tests/orm/implementation/test_comments.py index 6a5a6e99a4..5203a958e8 100644 --- a/aiida/backends/tests/orm/implementation/test_comments.py +++ b/aiida/backends/tests/orm/implementation/test_comments.py @@ -23,12 +23,12 @@ class TestBackendComment(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestBackendComment, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.computer = cls.computer.backend_entity # Unwrap the `Computer` instance to `BackendComputer` cls.user = cls.backend.users.create(email='tester@localhost').store() def setUp(self): - super(TestBackendComment, self).setUp() + super().setUp() self.node = self.backend.nodes.create( node_type='', user=self.user, computer=self.computer, label='label', description='description' ).store() diff --git a/aiida/backends/tests/orm/implementation/test_logs.py b/aiida/backends/tests/orm/implementation/test_logs.py index 2ab7609cae..d27f2a71d9 100644 --- a/aiida/backends/tests/orm/implementation/test_logs.py +++ b/aiida/backends/tests/orm/implementation/test_logs.py @@ -25,12 +25,12 @@ class TestBackendLog(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestBackendLog, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.computer = cls.computer.backend_entity # Unwrap the `Computer` instance to `BackendComputer` cls.user = cls.backend.users.create(email='tester@localhost').store() def setUp(self): - super(TestBackendLog, self).setUp() + super().setUp() self.node = self.backend.nodes.create( node_type='', user=self.user, computer=self.computer, label='label', description='description' ).store() diff --git a/aiida/backends/tests/orm/implementation/test_nodes.py b/aiida/backends/tests/orm/implementation/test_nodes.py index bc594e1fe2..87f629b08f 100644 --- a/aiida/backends/tests/orm/implementation/test_nodes.py +++ b/aiida/backends/tests/orm/implementation/test_nodes.py @@ -24,12 +24,12 @@ class TestBackendNode(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestBackendNode, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.computer = cls.computer.backend_entity # Unwrap the `Computer` instance to `BackendComputer` cls.user = cls.backend.users.create(email='tester@localhost').store() def setUp(self): - super(TestBackendNode, self).setUp() + super().setUp() self.node_type = '' self.node_label = 'label' self.node_description = 'description' diff --git a/aiida/backends/tests/orm/node/test_node.py b/aiida/backends/tests/orm/node/test_node.py index bd1669dbdd..ddfedf594c 100644 --- a/aiida/backends/tests/orm/node/test_node.py +++ b/aiida/backends/tests/orm/node/test_node.py @@ -22,7 +22,7 @@ class TestNode(AiidaTestCase): """Tests for generic node functionality.""" def setUp(self): - super(TestNode, self).setUp() + super().setUp() self.user = User.objects.get_default() def test_repository_garbage_collection(self): @@ -49,7 +49,7 @@ class TestNodeAttributesExtras(AiidaTestCase): """Test for node attributes and extras.""" def setUp(self): - super(TestNodeAttributesExtras, self).setUp() + super().setUp() self.node = Data() def test_attributes(self): @@ -366,7 +366,7 @@ class TestNodeLinks(AiidaTestCase): """Test for linking from and to Node.""" def setUp(self): - super(TestNodeLinks, self).setUp() + super().setUp() self.node_source = CalculationNode() self.node_target = Data() diff --git a/aiida/backends/tests/orm/test_authinfos.py b/aiida/backends/tests/orm/test_authinfos.py index d82b8a2912..07051662d4 100644 --- a/aiida/backends/tests/orm/test_authinfos.py +++ b/aiida/backends/tests/orm/test_authinfos.py @@ -18,7 +18,7 @@ class TestAuthinfo(AiidaTestCase): """Unit tests for the AuthInfo ORM class.""" def setUp(self): - super(TestAuthinfo, self).setUp() + super().setUp() for auth_info in authinfos.AuthInfo.objects.all(): authinfos.AuthInfo.objects.delete(auth_info.pk) diff --git a/aiida/backends/tests/orm/test_comments.py b/aiida/backends/tests/orm/test_comments.py index 2acc26dfa9..ea45c80915 100644 --- a/aiida/backends/tests/orm/test_comments.py +++ b/aiida/backends/tests/orm/test_comments.py @@ -19,14 +19,14 @@ class TestComment(AiidaTestCase): """Unit tests for the Comment ORM class.""" def setUp(self): - super(TestComment, self).setUp() + super().setUp() self.node = orm.Data().store() self.user = orm.User.objects.get_default() self.content = 'Sometimes when I am freestyling, I lose confidence' self.comment = Comment(self.node, self.user, self.content).store() def tearDown(self): - super(TestComment, self).tearDown() + super().tearDown() Comment.objects.delete_all() def test_comment_content(self): diff --git a/aiida/backends/tests/orm/test_logs.py b/aiida/backends/tests/orm/test_logs.py index f08ed18e6b..a668caf1de 100644 --- a/aiida/backends/tests/orm/test_logs.py +++ b/aiida/backends/tests/orm/test_logs.py @@ -23,7 +23,7 @@ class TestBackendLog(AiidaTestCase): """Test the Log entity""" def setUp(self): - super(TestBackendLog, self).setUp() + super().setUp() self.log_record = { 'time': now(), 'loggername': 'loggername', @@ -39,7 +39,7 @@ def tearDown(self): """ Delete all the created log entries """ - super(TestBackendLog, self).tearDown() + super().tearDown() Log.objects.delete_all() def create_log(self): diff --git a/aiida/backends/tests/orm/test_querybuilder.py b/aiida/backends/tests/orm/test_querybuilder.py index 295801f8de..3c7d12c7a5 100644 --- a/aiida/backends/tests/orm/test_querybuilder.py +++ b/aiida/backends/tests/orm/test_querybuilder.py @@ -20,7 +20,7 @@ class TestQueryBuilder(AiidaTestCase): def setUp(self): - super(TestQueryBuilder, self).setUp() + super().setUp() self.clean_db() self.insert_data() @@ -119,7 +119,7 @@ class PotentialFailureWorkChain(WorkChain): @classmethod def define(cls, spec): - super(PotentialFailureWorkChain, cls).define(spec) + super().define(spec) spec.input('success', valid_type=orm.Bool) spec.input('through_return', valid_type=orm.Bool, default=orm.Bool(False)) spec.input('through_exit_code', valid_type=orm.Bool, default=orm.Bool(False)) diff --git a/aiida/backends/tests/orm/utils/test_calcjob.py b/aiida/backends/tests/orm/utils/test_calcjob.py index 6bf97e28a6..01e5674708 100644 --- a/aiida/backends/tests/orm/utils/test_calcjob.py +++ b/aiida/backends/tests/orm/utils/test_calcjob.py @@ -27,7 +27,7 @@ def setUpClass(cls, *args, **kwargs): We emulate a node for the `TemplateReplacer` calculation job class. To do this we have to make sure the process type is set correctly and an output parameter node is created. """ - super(TestCalcJobResultManager, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.process_class = CalculationFactory('templatereplacer') cls.process_type = get_entry_point_string_from_class(cls.process_class.__module__, cls.process_class.__name__) cls.node = CalcJobNode(computer=cls.computer, process_type=cls.process_type) diff --git a/aiida/backends/tests/parsers/test_parser.py b/aiida/backends/tests/parsers/test_parser.py index 8e565c7726..54388d51f8 100644 --- a/aiida/backends/tests/parsers/test_parser.py +++ b/aiida/backends/tests/parsers/test_parser.py @@ -27,7 +27,7 @@ class CustomCalcJob(CalcJob): @classmethod def define(cls, spec): - super(CustomCalcJob, cls).define(spec) + super().define(spec) spec.input('inp', valid_type=orm.Data) spec.output('output', pass_to_parser=True) spec.output_namespace('out.space', dynamic=True) diff --git a/aiida/backends/tests/plugins/test_utils.py b/aiida/backends/tests/plugins/test_utils.py index 924f9361c0..c4f44dbdf1 100644 --- a/aiida/backends/tests/plugins/test_utils.py +++ b/aiida/backends/tests/plugins/test_utils.py @@ -22,7 +22,7 @@ class TestPluginVersionProvider(AiidaTestCase): # pylint: disable=no-init,old-style-class,too-few-public-methods,no-member def setUp(self): - super(TestPluginVersionProvider, self).setUp() + super().setUp() self.provider = PluginVersionProvider() @staticmethod diff --git a/aiida/backends/tests/test_base_dataclasses.py b/aiida/backends/tests/test_base_dataclasses.py index 5f53d3276e..6375538970 100644 --- a/aiida/backends/tests/test_base_dataclasses.py +++ b/aiida/backends/tests/test_base_dataclasses.py @@ -99,7 +99,7 @@ def test_store_load(self): class TestFloat(AiidaTestCase): def setUp(self): - super(TestFloat, self).setUp() + super().setUp() self.value = Float() self.all_types = [Int, Float, Bool, Str] diff --git a/aiida/backends/tests/test_calculation_node.py b/aiida/backends/tests/test_calculation_node.py index fe95e60e62..7fd83e89e6 100644 --- a/aiida/backends/tests/test_calculation_node.py +++ b/aiida/backends/tests/test_calculation_node.py @@ -46,7 +46,7 @@ class TestProcessNode(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestProcessNode, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) cls.computer.configure() # pylint: disable=no-member cls.construction_options = {'resources': {'num_machines': 1, 'num_mpiprocs_per_machine': 1}} diff --git a/aiida/backends/tests/test_restapi.py b/aiida/backends/tests/test_restapi.py index d2319586d9..56895a08a0 100644 --- a/aiida/backends/tests/test_restapi.py +++ b/aiida/backends/tests/test_restapi.py @@ -35,7 +35,7 @@ def setUpClass(cls, *args, **kwargs): # pylint: disable=too-many-locals, too-ma database to be able to explore different requests/filters/orderings etc. """ # call parent setUpClass method - super(RESTApiTestCase, cls).setUpClass() + super().setUpClass() # connect the app and the api # Init the api by connecting it the the app (N.B. respect the following diff --git a/aiida/backends/tests/tools/importexport/migration/test_migration.py b/aiida/backends/tests/tools/importexport/migration/test_migration.py index 9f3854f424..f63a953e8b 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_migration.py +++ b/aiida/backends/tests/tools/importexport/migration/test_migration.py @@ -26,7 +26,7 @@ class TestExportFileMigration(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): """Add variables (once) to be used by all tests""" - super(TestExportFileMigration, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Known export file content used for checks cls.node_count = 25 @@ -60,7 +60,7 @@ def setUpClass(cls, *args, **kwargs): def setUp(self): """Reset database before each test""" - super(TestExportFileMigration, self).setUp() + super().setUp() self.reset_database() def test_migrate_recursively(self): diff --git a/aiida/backends/tests/tools/importexport/migration/test_v02_to_v03.py b/aiida/backends/tests/tools/importexport/migration/test_v02_to_v03.py index 117e574b3e..26e6f37802 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_v02_to_v03.py +++ b/aiida/backends/tests/tools/importexport/migration/test_v02_to_v03.py @@ -21,7 +21,7 @@ class TestMigrateV02toV03(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestMigrateV02toV03, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Utility helpers cls.external_archive = {'filepath': 'archives', 'external_module': 'aiida-export-migration-tests'} diff --git a/aiida/backends/tests/tools/importexport/migration/test_v03_to_v04.py b/aiida/backends/tests/tools/importexport/migration/test_v03_to_v04.py index 5d0df76f93..4ed4be483c 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_v03_to_v04.py +++ b/aiida/backends/tests/tools/importexport/migration/test_v03_to_v04.py @@ -29,7 +29,7 @@ class TestMigrateV03toV04(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestMigrateV03toV04, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Utility helpers cls.external_archive = {'filepath': 'archives', 'external_module': 'aiida-export-migration-tests'} diff --git a/aiida/backends/tests/tools/importexport/migration/test_v04_to_v05.py b/aiida/backends/tests/tools/importexport/migration/test_v04_to_v05.py index d2af5d62b1..611af17ac2 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_v04_to_v05.py +++ b/aiida/backends/tests/tools/importexport/migration/test_v04_to_v05.py @@ -28,7 +28,7 @@ class TestMigrateV04toV05(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestMigrateV04toV05, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Utility helpers cls.external_archive = {'filepath': 'archives', 'external_module': 'aiida-export-migration-tests'} diff --git a/aiida/backends/tests/tools/importexport/migration/test_v05_to_v06.py b/aiida/backends/tests/tools/importexport/migration/test_v05_to_v06.py index 8bf923b27a..5c4d4371b5 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_v05_to_v06.py +++ b/aiida/backends/tests/tools/importexport/migration/test_v05_to_v06.py @@ -21,7 +21,7 @@ class TestMigrateV05toV06(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestMigrateV05toV06, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Utility helpers cls.external_archive = {'filepath': 'archives', 'external_module': 'aiida-export-migration-tests'} diff --git a/aiida/backends/tests/tools/importexport/migration/test_v06_to_v07.py b/aiida/backends/tests/tools/importexport/migration/test_v06_to_v07.py index c423b4f346..e29949ac51 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_v06_to_v07.py +++ b/aiida/backends/tests/tools/importexport/migration/test_v06_to_v07.py @@ -22,7 +22,7 @@ class TestMigrateV06toV07(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestMigrateV06toV07, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Utility helpers cls.external_archive = {'filepath': 'archives', 'external_module': 'aiida-export-migration-tests'} diff --git a/aiida/backends/tests/tools/importexport/migration/test_v07_to_v08.py b/aiida/backends/tests/tools/importexport/migration/test_v07_to_v08.py index 584c2af721..a3877bb234 100644 --- a/aiida/backends/tests/tools/importexport/migration/test_v07_to_v08.py +++ b/aiida/backends/tests/tools/importexport/migration/test_v07_to_v08.py @@ -20,7 +20,7 @@ class TestMigrateV07toV08(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): - super(TestMigrateV07toV08, cls).setUpClass(*args, **kwargs) + super().setUpClass(*args, **kwargs) # Utility helpers cls.external_archive = {'filepath': 'archives', 'external_module': 'aiida-export-migration-tests'} diff --git a/aiida/backends/tests/tools/importexport/orm/test_comments.py b/aiida/backends/tests/tools/importexport/orm/test_comments.py index 4ed81460e0..660e62a6d5 100644 --- a/aiida/backends/tests/tools/importexport/orm/test_comments.py +++ b/aiida/backends/tests/tools/importexport/orm/test_comments.py @@ -22,7 +22,7 @@ class TestComments(AiidaTestCase): """Test ex-/import cases related to Comments""" def setUp(self): - super(TestComments, self).setUp() + super().setUp() self.reset_database() self.comments = [ "We're no strangers to love", 'You know the rules and so do I', "A full commitment's what I'm thinking of", @@ -30,7 +30,7 @@ def setUp(self): ] def tearDown(self): - super(TestComments, self).tearDown() + super().tearDown() self.reset_database() @with_temp_dir diff --git a/aiida/backends/tests/tools/importexport/orm/test_extras.py b/aiida/backends/tests/tools/importexport/orm/test_extras.py index 7c1b51e3c5..5da3a532ea 100644 --- a/aiida/backends/tests/tools/importexport/orm/test_extras.py +++ b/aiida/backends/tests/tools/importexport/orm/test_extras.py @@ -25,7 +25,7 @@ class TestExtras(AiidaTestCase): @classmethod def setUpClass(cls, *args, **kwargs): """Only run to prepare an export file""" - super(TestExtras, cls).setUpClass() + super().setUpClass() data = orm.Data() data.label = 'my_test_data_node' @@ -38,7 +38,7 @@ def setUpClass(cls, *args, **kwargs): @classmethod def tearDownClass(cls, *args, **kwargs): """Remove tmp_folder""" - super(TestExtras, cls).tearDownClass() + super().tearDownClass() shutil.rmtree(cls.tmp_folder, ignore_errors=True) diff --git a/aiida/backends/tests/tools/importexport/orm/test_links.py b/aiida/backends/tests/tools/importexport/orm/test_links.py index da78dd52a8..42758b4ea9 100644 --- a/aiida/backends/tests/tools/importexport/orm/test_links.py +++ b/aiida/backends/tests/tools/importexport/orm/test_links.py @@ -30,11 +30,11 @@ class TestLinks(AiidaTestCase): def setUp(self): self.reset_database() - super(TestLinks, self).setUp() + super().setUp() def tearDown(self): self.reset_database() - super(TestLinks, self).tearDown() + super().tearDown() @with_temp_dir def test_links_to_unknown_nodes(self, temp_dir): diff --git a/aiida/backends/tests/tools/importexport/orm/test_logs.py b/aiida/backends/tests/tools/importexport/orm/test_logs.py index 7f3e8364e1..3e909355eb 100644 --- a/aiida/backends/tests/tools/importexport/orm/test_logs.py +++ b/aiida/backends/tests/tools/importexport/orm/test_logs.py @@ -23,14 +23,14 @@ class TestLogs(AiidaTestCase): def setUp(self): """Reset database prior to all tests""" - super(TestLogs, self).setUp() + super().setUp() self.reset_database() def tearDown(self): """ Delete all the created log entries """ - super(TestLogs, self).tearDown() + super().tearDown() orm.Log.objects.delete_all() @with_temp_dir diff --git a/aiida/backends/tests/tools/importexport/test_specific_import.py b/aiida/backends/tests/tools/importexport/test_specific_import.py index 940553abba..c548f20327 100644 --- a/aiida/backends/tests/tools/importexport/test_specific_import.py +++ b/aiida/backends/tests/tools/importexport/test_specific_import.py @@ -30,7 +30,7 @@ class TestSpecificImport(AiidaTestCase): """Test specific ex-/import cases""" def setUp(self): - super(TestSpecificImport, self).setUp() + super().setUp() self.reset_database() def tearDown(self): diff --git a/aiida/backends/tests/utils/processes.py b/aiida/backends/tests/utils/processes.py index 931502b154..9a3a29be93 100644 --- a/aiida/backends/tests/utils/processes.py +++ b/aiida/backends/tests/utils/processes.py @@ -22,7 +22,7 @@ class DummyProcess(Process): @classmethod def define(cls, spec): - super(DummyProcess, cls).define(spec) + super().define(spec) spec.inputs.valid_type = Data spec.outputs.valid_type = Data @@ -37,7 +37,7 @@ class AddProcess(Process): @classmethod def define(cls, spec): - super(AddProcess, cls).define(spec) + super().define(spec) spec.input('a', required=True) spec.input('b', required=True) spec.output('result', required=True) @@ -54,7 +54,7 @@ class BadOutput(Process): @classmethod def define(cls, spec): - super(BadOutput, cls).define(spec) + super().define(spec) spec.outputs.valid_type = Data def run(self): diff --git a/aiida/calculations/plugins/arithmetic/add.py b/aiida/calculations/plugins/arithmetic/add.py index 3f2d5b140e..b5706db8c1 100644 --- a/aiida/calculations/plugins/arithmetic/add.py +++ b/aiida/calculations/plugins/arithmetic/add.py @@ -19,7 +19,7 @@ class ArithmeticAddCalculation(CalcJob): @classmethod def define(cls, spec): - super(ArithmeticAddCalculation, cls).define(spec) + super().define(spec) spec.input('metadata.options.input_filename', valid_type=str, default='aiida.in', non_db=True) spec.input('metadata.options.output_filename', valid_type=str, default='aiida.out', non_db=True) spec.input('metadata.options.parser_name', valid_type=str, default='arithmetic.add', non_db=True) diff --git a/aiida/calculations/plugins/templatereplacer.py b/aiida/calculations/plugins/templatereplacer.py index 4e33a07334..a5fc8c33ab 100644 --- a/aiida/calculations/plugins/templatereplacer.py +++ b/aiida/calculations/plugins/templatereplacer.py @@ -62,7 +62,7 @@ class TemplatereplacerCalculation(CalcJob): @classmethod def define(cls, spec): # yapf: disable - super(TemplatereplacerCalculation, cls).define(spec) + super().define(spec) spec.input('metadata.options.parser_name', valid_type=str, default='templatereplacer.doubler', non_db=True) spec.input('template', valid_type=orm.Dict, diff --git a/aiida/cmdline/params/options/conditional.py b/aiida/cmdline/params/options/conditional.py index f9ccef9f1f..869e55e8e3 100644 --- a/aiida/cmdline/params/options/conditional.py +++ b/aiida/cmdline/params/options/conditional.py @@ -41,11 +41,11 @@ def __init__(self, param_decls=None, required_fn=None, **kwargs): # There is a required_fn self.required = False # So it does not show up as 'required' - super(ConditionalOption, self).__init__(param_decls=param_decls, **kwargs) + super().__init__(param_decls=param_decls, **kwargs) def full_process_value(self, ctx, value): try: - value = super(ConditionalOption, self).full_process_value(ctx, value) + value = super().full_process_value(ctx, value) if self.required_fn and self.value_is_missing(value): if self.is_required(ctx): raise click.MissingParameter(ctx=ctx, param=self) diff --git a/aiida/cmdline/params/options/config.py b/aiida/cmdline/params/options/config.py index 0d2b387f18..3aaa43b641 100644 --- a/aiida/cmdline/params/options/config.py +++ b/aiida/cmdline/params/options/config.py @@ -56,7 +56,7 @@ def __init__(self, *args, **kwargs): :param kwargs: default keyword arguments to be used that can be overridden in the call """ kwargs.update({'provider': yaml_config_file_provider, 'implicit': False}) - super(ConfigFileOption, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def __call__(self, **kwargs): """ diff --git a/aiida/cmdline/params/options/interactive.py b/aiida/cmdline/params/options/interactive.py index f1a21ca1b8..7579884cf9 100644 --- a/aiida/cmdline/params/options/interactive.py +++ b/aiida/cmdline/params/options/interactive.py @@ -64,7 +64,7 @@ def __init__(self, param_decls=None, switch=None, prompt_fn=None, contextual_def self._prompt = kwargs.pop('prompt', None) # call super class here, after removing `prompt` from the kwargs. - super(InteractiveOption, self).__init__(param_decls=param_decls, **kwargs) + super().__init__(param_decls=param_decls, **kwargs) self.prompt_fn = prompt_fn @@ -110,7 +110,7 @@ def _get_default(self, ctx): if self._contextual_default is not None: default = self._contextual_default(ctx) else: - default = super(InteractiveOption, self).get_default(ctx) + default = super().get_default(ctx) try: default = self.type.deconvert_default(default) @@ -171,7 +171,7 @@ def full_process_value(self, ctx, value): the callback """ try: - value = super(InteractiveOption, self).full_process_value(ctx, value) + value = super().full_process_value(ctx, value) except click.MissingParameter: pass return value diff --git a/aiida/cmdline/params/options/multivalue.py b/aiida/cmdline/params/options/multivalue.py index a6028fddc9..b3051478cd 100644 --- a/aiida/cmdline/params/options/multivalue.py +++ b/aiida/cmdline/params/options/multivalue.py @@ -55,7 +55,7 @@ def __init__(self, *args, **kwargs): if param_type is not None: kwargs['type'] = types.MultipleValueParamType(param_type) - super(MultipleValueOption, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._previous_parser_process = None self._eat_all_parser = None @@ -66,7 +66,7 @@ def add_to_parser(self, parser, ctx): """ # pylint: disable=protected-access - result = super(MultipleValueOption, self).add_to_parser(parser, ctx) + result = super().add_to_parser(parser, ctx) def parser_process(value, state): """ diff --git a/aiida/cmdline/params/options/test_interactive.py b/aiida/cmdline/params/options/test_interactive.py index aa4f649af8..92256451a8 100644 --- a/aiida/cmdline/params/options/test_interactive.py +++ b/aiida/cmdline/params/options/test_interactive.py @@ -25,7 +25,7 @@ class Only42IntParamType(IntParamType): name = 'only42int' def convert(self, value, param, ctx): - newval = super(Only42IntParamType, self).convert(value, param, ctx) + newval = super().convert(value, param, ctx) if newval != 42: self.fail('Type validation: invalid, should be 42') return newval diff --git a/aiida/cmdline/params/types/choice.py b/aiida/cmdline/params/types/choice.py index 89f578ad48..47cc63b06f 100644 --- a/aiida/cmdline/params/types/choice.py +++ b/aiida/cmdline/params/types/choice.py @@ -28,7 +28,7 @@ def __init__(self, get_choices): if not callable(get_choices): raise TypeError("Must pass a callable, got '{}'".format(get_choices)) - super(LazyChoice, self).__init__() + super().__init__() self._get_choices = get_choices self.__click_choice = None diff --git a/aiida/cmdline/params/types/code.py b/aiida/cmdline/params/types/code.py index 45cb94d96a..1266d96b6c 100644 --- a/aiida/cmdline/params/types/code.py +++ b/aiida/cmdline/params/types/code.py @@ -26,7 +26,7 @@ def __init__(self, sub_classes=None, entry_point=None): :param sub_classes: specify a tuple of Code sub classes to narrow the query set :param entry_point: specify an optional calculation entry point that the Code's input plugin should match """ - super(CodeParamType, self).__init__(sub_classes) + super().__init__(sub_classes) self._entry_point = entry_point @property @@ -41,7 +41,7 @@ def orm_class_loader(self): return CodeEntityLoader def convert(self, value, param, ctx): - code = super(CodeParamType, self).convert(value, param, ctx) + code = super().convert(value, param, ctx) if code and self._entry_point is not None: entry_point = code.get_input_plugin_name() diff --git a/aiida/cmdline/params/types/computer.py b/aiida/cmdline/params/types/computer.py index 388b5841f2..bd41a03cd3 100644 --- a/aiida/cmdline/params/types/computer.py +++ b/aiida/cmdline/params/types/computer.py @@ -51,7 +51,7 @@ class ShebangParamType(StringParamType): name = 'shebangline' def convert(self, value, param, ctx): - newval = super(ShebangParamType, self).convert(value, param, ctx) + newval = super().convert(value, param, ctx) if newval is None: return None if not newval.startswith('#!'): @@ -80,7 +80,7 @@ def __repr__(self): return 'MPIRUNCOMMANDSTRING' def convert(self, value, param, ctx): - newval = super(MpirunCommandParamType, self).convert(value, param, ctx) + newval = super().convert(value, param, ctx) scheduler_ep = ctx.params['scheduler'] if scheduler_ep is not None: diff --git a/aiida/cmdline/params/types/group.py b/aiida/cmdline/params/types/group.py index 0e17812b9a..ef216044e7 100644 --- a/aiida/cmdline/params/types/group.py +++ b/aiida/cmdline/params/types/group.py @@ -25,7 +25,7 @@ class GroupParamType(IdentifierParamType): def __init__(self, create_if_not_exist=False): self._create_if_not_exist = create_if_not_exist - super(GroupParamType, self).__init__() + super().__init__() @property def orm_class_loader(self): @@ -42,7 +42,7 @@ def orm_class_loader(self): def convert(self, value, param, ctx): from aiida.orm import Group, GroupTypeString try: - group = super(GroupParamType, self).convert(value, param, ctx) + group = super().convert(value, param, ctx) except click.BadParameter: if self._create_if_not_exist: group = Group(label=value, type_string=GroupTypeString.USER.value) diff --git a/aiida/cmdline/params/types/multiple.py b/aiida/cmdline/params/types/multiple.py index c998aecc21..9e959bcf9a 100644 --- a/aiida/cmdline/params/types/multiple.py +++ b/aiida/cmdline/params/types/multiple.py @@ -19,7 +19,7 @@ class MultipleValueParamType(click.ParamType): """ def __init__(self, param_type): - super(MultipleValueParamType, self).__init__() + super().__init__() self._param_type = param_type if hasattr(param_type, 'name'): diff --git a/aiida/cmdline/params/types/nonemptystring.py b/aiida/cmdline/params/types/nonemptystring.py index a669a225d2..295bd29bf3 100644 --- a/aiida/cmdline/params/types/nonemptystring.py +++ b/aiida/cmdline/params/types/nonemptystring.py @@ -21,7 +21,7 @@ class NonEmptyStringParamType(StringParamType): name = 'nonemptystring' def convert(self, value, param, ctx): - newval = super(NonEmptyStringParamType, self).convert(value, param, ctx) + newval = super().convert(value, param, ctx) if not newval: # None or empty string self.fail('Empty string is not valid!') diff --git a/aiida/cmdline/params/types/path.py b/aiida/cmdline/params/types/path.py index dbecc35c74..504728fa57 100644 --- a/aiida/cmdline/params/types/path.py +++ b/aiida/cmdline/params/types/path.py @@ -25,7 +25,7 @@ class AbsolutePathParamType(click.Path): def convert(self, value, param, ctx): value = os.path.expanduser(value) - newval = super(AbsolutePathParamType, self).convert(value, param, ctx) + newval = super().convert(value, param, ctx) if not os.path.isabs(newval): raise click.BadParameter('path must be absolute') return newval @@ -46,7 +46,7 @@ class ImportPath(click.Path): # pylint: disable=protected-access def __init__(self, timeout_seconds=URL_TIMEOUT_SECONDS, **kwargs): - super(ImportPath, self).__init__(**kwargs) + super().__init__(**kwargs) self.timeout_seconds = timeout_seconds @@ -56,7 +56,7 @@ def convert(self, value, param, ctx): """ try: # Check if `click.Path`-type - return super(ImportPath, self).convert(value, param, ctx) + return super().convert(value, param, ctx) except click.exceptions.BadParameter: # Check if URL return self.checks_url(value, param, ctx) diff --git a/aiida/cmdline/params/types/plugin.py b/aiida/cmdline/params/types/plugin.py index 281c25b837..a4a6077554 100644 --- a/aiida/cmdline/params/types/plugin.py +++ b/aiida/cmdline/params/types/plugin.py @@ -72,7 +72,7 @@ def __init__(self, group=None, load=False, *args, **kwargs): self._init_entry_points() self.load = load - super(PluginParamType, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def _init_entry_points(self): """ diff --git a/aiida/cmdline/params/types/profile.py b/aiida/cmdline/params/types/profile.py index 14bd23e03c..b89cacdaf7 100644 --- a/aiida/cmdline/params/types/profile.py +++ b/aiida/cmdline/params/types/profile.py @@ -20,7 +20,7 @@ class ProfileParamType(click.ParamType): def __init__(self, *args, **kwargs): self._cannot_exist = kwargs.pop('cannot_exist', False) self._load_profile = kwargs.pop('load_profile', False) # If True, will load the profile converted from value - super(ProfileParamType, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @staticmethod def deconvert_default(value): diff --git a/aiida/cmdline/utils/pluginable.py b/aiida/cmdline/utils/pluginable.py index ceeebb24ca..1d0879f9ec 100644 --- a/aiida/cmdline/utils/pluginable.py +++ b/aiida/cmdline/utils/pluginable.py @@ -21,11 +21,11 @@ def __init__(self, *args, **kwargs): """Initialize with entry point group.""" self._exclude_external_plugins = False # Default behavior is of course to include external plugins self._entry_point_group = kwargs.pop('entry_point_group') - super(Pluginable, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def list_commands(self, ctx): """Add entry point names of available plugins to the command list.""" - subcommands = super(Pluginable, self).list_commands(ctx) + subcommands = super().list_commands(ctx) if not self._exclude_external_plugins: subcommands.extend(get_entry_point_names(self._entry_point_group)) @@ -39,9 +39,9 @@ def get_command(self, ctx, name): # pylint: disable=arguments-differ try: command = load_entry_point(self._entry_point_group, name) except exceptions.EntryPointError: - command = super(Pluginable, self).get_command(ctx, name) + command = super().get_command(ctx, name) else: - command = super(Pluginable, self).get_command(ctx, name) + command = super().get_command(ctx, name) return command def set_exclude_external_plugins(self, exclude_external_plugins): diff --git a/aiida/cmdline/utils/query/mapping.py b/aiida/cmdline/utils/query/mapping.py index e45e9f3e5f..ffed7028ad 100644 --- a/aiida/cmdline/utils/query/mapping.py +++ b/aiida/cmdline/utils/query/mapping.py @@ -144,4 +144,4 @@ def __init__(self, projections, projection_labels=None, projection_attributes=No else: default_formatters[projection] = formatter - super(CalculationProjectionMapper, self).__init__(default_labels, default_attributes, default_formatters) + super().__init__(default_labels, default_attributes, default_formatters) diff --git a/aiida/common/extendeddicts.py b/aiida/common/extendeddicts.py index 55d288ed10..b916cb873d 100644 --- a/aiida/common/extendeddicts.py +++ b/aiida/common/extendeddicts.py @@ -28,7 +28,7 @@ class AttributeDict(dict): def __init__(self, dictionary=None): """Recursively turn the `dict` and all its nested dictionaries into `AttributeDict` instance.""" - super(AttributeDict, self).__init__() + super().__init__() if dictionary is None: dictionary = {} @@ -116,7 +116,7 @@ def __init__(self, init=None): if key not in self._valid_fields: errmsg = "'{}' is not a valid key for object '{}'".format(key, self.__class__.__name__) raise KeyError(errmsg) - super(FixedFieldsAttributeDict, self).__init__(init) + super().__init__(init) def __setitem__(self, item, value): """ @@ -125,7 +125,7 @@ def __setitem__(self, item, value): if item not in self._valid_fields: errmsg = "'{}' is not a valid key for object '{}'".format(item, self.__class__.__name__) raise KeyError(errmsg) - super(FixedFieldsAttributeDict, self).__setitem__(item, value) + super().__setitem__(item, value) def __setattr__(self, attr, value): """ @@ -134,7 +134,7 @@ def __setattr__(self, attr, value): if attr.startswith('_'): object.__setattr__(self, attr, value) else: - super(FixedFieldsAttributeDict, self).__setattr__(attr, value) + super().__setattr__(attr, value) @classmethod def get_valid_fields(cls): @@ -226,7 +226,7 @@ def __setattr__(self, attr, value): if attr.startswith('_'): object.__setattr__(self, attr, value) else: - super(DefaultFieldsAttributeDict, self).__setattr__(attr, value) + super().__setattr__(attr, value) def __getitem__(self, key): """ @@ -234,7 +234,7 @@ def __getitem__(self, key): but is in the list of default fields. """ try: - return super(DefaultFieldsAttributeDict, self).__getitem__(key) + return super().__getitem__(key) except KeyError: if key in self._default_fields: return None diff --git a/aiida/common/folders.py b/aiida/common/folders.py index 3c6c559a81..0eae11c5d3 100644 --- a/aiida/common/folders.py +++ b/aiida/common/folders.py @@ -436,7 +436,7 @@ def __init__(self, sandbox_in_repo=True): abspath = tempfile.mkdtemp(dir=sandbox) else: abspath = tempfile.mkdtemp() - super(SandboxFolder, self).__init__(abspath=abspath) + super().__init__(abspath=abspath) def __enter__(self): """ @@ -470,7 +470,7 @@ def __init__(self, basepath=CALC_JOB_DRY_RUN_BASE_PATH): :param basepath: name of the base directory that will be created in the current working directory """ - super(SubmitTestFolder, self).__init__(abspath=os.path.abspath(basepath)) + super().__init__(abspath=os.path.abspath(basepath)) self.create() @@ -544,7 +544,7 @@ def __init__(self, section, uuid, subfolder=os.curdir): self._subfolder = subfolder # This will also do checks on the folder limits - super(RepositoryFolder, self).__init__(abspath=dest, folder_limit=entity_dir) + super().__init__(abspath=dest, folder_limit=entity_dir) @property def section(self): diff --git a/aiida/common/lang.py b/aiida/common/lang.py index 81cfb9282d..d85ce10b35 100644 --- a/aiida/common/lang.py +++ b/aiida/common/lang.py @@ -91,7 +91,7 @@ def wrap(func): # pylint: disable=missing-docstring @functools.wraps(func) def wrapped_fn(self, *args, **kwargs): # pylint: disable=missing-docstring try: - getattr(super(self.__class__, self), func.__name__) + getattr(super(), func.__name__) except AttributeError: raise RuntimeError('Function {} does not override a superclass method'.format(func)) @@ -134,7 +134,7 @@ class abstractclassmethod(classmethod): # pylint: disable=too-few-public-method def __init__(self, callable): # pylint: disable=redefined-builtin callable.__isabstractmethod__ = True - super(abstractclassmethod, self).__init__(callable) + super().__init__(callable) class abstractstaticmethod(staticmethod): # pylint: disable=too-few-public-methods, invalid-name @@ -149,7 +149,7 @@ class abstractstaticmethod(staticmethod): # pylint: disable=too-few-public-meth def __init__(self, callable): # pylint: disable=redefined-builtin callable.__isabstractmethod__ = True # pylint: disable=redefined-builtin - super(abstractstaticmethod, self).__init__(callable) + super().__init__(callable) class combomethod: # pylint: disable=invalid-name,too-few-public-methods diff --git a/aiida/common/utils.py b/aiida/common/utils.py index 331785f9ba..0500ec08d6 100644 --- a/aiida/common/utils.py +++ b/aiida/common/utils.py @@ -543,7 +543,7 @@ class Capturing: def __init__(self, capture_stderr=False): self.stdout_lines = list() - super(Capturing, self).__init__() + super().__init__() self._capture_stderr = capture_stderr if self._capture_stderr: diff --git a/aiida/engine/processes/builder.py b/aiida/engine/processes/builder.py index a78de30eaf..c29d63a5ee 100644 --- a/aiida/engine/processes/builder.py +++ b/aiida/engine/processes/builder.py @@ -184,7 +184,7 @@ def __init__(self, process_class): """ self._process_class = process_class self._process_spec = self._process_class.spec() - super(ProcessBuilder, self).__init__(self._process_spec.inputs) + super().__init__(self._process_spec.inputs) @property def process_class(self): diff --git a/aiida/engine/processes/calcjobs/calcjob.py b/aiida/engine/processes/calcjobs/calcjob.py index a17302d751..469e3121c5 100644 --- a/aiida/engine/processes/calcjobs/calcjob.py +++ b/aiida/engine/processes/calcjobs/calcjob.py @@ -104,12 +104,12 @@ def __init__(self, *args, **kwargs): if self.__class__ == CalcJob: raise exceptions.InvalidOperation('cannot construct or launch a base `CalcJob` class.') - super(CalcJob, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @classmethod def define(cls, spec): # yapf: disable - super(CalcJob, cls).define(spec) + super().define(spec) spec.inputs.validator = validate_calc_job spec.input('code', valid_type=orm.Code, help='The `Code` to use for this job.') spec.input('metadata.dry_run', valid_type=bool, default=False, @@ -194,7 +194,7 @@ def options(self): @classmethod def get_state_classes(cls): # Overwrite the waiting state - states_map = super(CalcJob, cls).get_state_classes() + states_map = super().get_state_classes() states_map[ProcessState.WAITING] = Waiting return states_map @@ -205,7 +205,7 @@ def on_terminated(self): .. note:: This has to be done before calling the super because that will seal the node after we cannot change it """ self.node.delete_state() - super(CalcJob, self).on_terminated() + super().on_terminated() @override def run(self): diff --git a/aiida/engine/processes/calcjobs/tasks.py b/aiida/engine/processes/calcjobs/tasks.py index a3e34a7e7e..0f8abf1178 100644 --- a/aiida/engine/processes/calcjobs/tasks.py +++ b/aiida/engine/processes/calcjobs/tasks.py @@ -293,12 +293,12 @@ class Waiting(plumpy.Waiting): """The waiting state for the `CalcJob` process.""" def __init__(self, process, done_callback, msg=None, data=None): - super(Waiting, self).__init__(process, done_callback, msg, data) + super().__init__(process, done_callback, msg, data) self._task = None self._killing = None def load_instance_state(self, saved_state, load_context): - super(Waiting, self).load_instance_state(saved_state, load_context) + super().load_instance_state(saved_state, load_context) self._task = None self._killing = None diff --git a/aiida/engine/processes/functions.py b/aiida/engine/processes/functions.py index 668340df14..f23a5cbdee 100644 --- a/aiida/engine/processes/functions.py +++ b/aiida/engine/processes/functions.py @@ -237,9 +237,9 @@ def build(func, node_class): if varargs is not None: raise ValueError('variadic arguments are not supported') - def _define(cls, spec): + def _define(cls, spec): # pylint: disable=unused-argument """Define the spec dynamically""" - super(FunctionProcess, cls).define(spec) + super().define(spec) for i, arg in enumerate(args): default = () @@ -339,7 +339,7 @@ def get_or_create_db_record(cls): def __init__(self, *args, **kwargs): if kwargs.get('enable_persistence', False): raise RuntimeError('Cannot persist a function process') - super(FunctionProcess, self).__init__(enable_persistence=False, *args, **kwargs) + super().__init__(enable_persistence=False, *args, **kwargs) @property def process_class(self): @@ -357,7 +357,7 @@ class that really represents what was being executed. def execute(self): """Execute the process.""" - result = super(FunctionProcess, self).execute() + result = super().execute() # FunctionProcesses can return a single value as output, and not a dictionary, so we should also return that if len(result) == 1 and self.SINGLE_OUTPUT_LINKNAME in result: @@ -368,7 +368,7 @@ def execute(self): @override def _setup_db_record(self): """Set up the database record for the process.""" - super(FunctionProcess, self)._setup_db_record() + super()._setup_db_record() self.node.store_source_info(self._func) @override diff --git a/aiida/engine/processes/futures.py b/aiida/engine/processes/futures.py index be911afdf1..a23656c98c 100644 --- a/aiida/engine/processes/futures.py +++ b/aiida/engine/processes/futures.py @@ -38,7 +38,7 @@ def __init__(self, pk, loop=None, poll_interval=None, communicator=None): from aiida.orm import load_node from .process import ProcessState - super(CalculationFuture, self).__init__() + super().__init__() assert not (poll_interval is None and communicator is None), 'Must poll or have a communicator to use' calc_node = load_node(pk=pk) diff --git a/aiida/engine/processes/ports.py b/aiida/engine/processes/ports.py index 7ad99f384e..725da48032 100644 --- a/aiida/engine/processes/ports.py +++ b/aiida/engine/processes/ports.py @@ -36,7 +36,7 @@ class WithNonDb: def __init__(self, *args, **kwargs): self._non_db_explicitly_set = bool('non_db' in kwargs) non_db = kwargs.pop('non_db', False) - super(WithNonDb, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._non_db = non_db @property @@ -73,7 +73,7 @@ class WithSerialize: def __init__(self, *args, **kwargs): serializer = kwargs.pop('serializer', None) - super(WithSerialize, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._serializer = serializer def serialize(self, value): @@ -102,7 +102,7 @@ def get_description(self): :returns: a dictionary of the stringified InputPort attributes """ - description = super(InputPort, self).get_description() + description = super().get_description() description['non_db'] = '{}'.format(self.non_db) return description @@ -113,7 +113,7 @@ class CalcJobOutputPort(ports.OutputPort): def __init__(self, *args, **kwargs): pass_to_parser = kwargs.pop('pass_to_parser', False) - super(CalcJobOutputPort, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._pass_to_parser = pass_to_parser @property @@ -144,7 +144,7 @@ def __setitem__(self, key, port): if hasattr(port, 'non_db_explicitly_set') and not port.non_db_explicitly_set: port.non_db = self.non_db - super(PortNamespace, self).__setitem__(key, port) + super().__setitem__(key, port) @staticmethod def validate_port_name(port_name): diff --git a/aiida/engine/processes/process.py b/aiida/engine/processes/process.py index 7efe663c03..0c877bc850 100644 --- a/aiida/engine/processes/process.py +++ b/aiida/engine/processes/process.py @@ -58,7 +58,7 @@ class SaveKeys(enum.Enum): @classmethod def define(cls, spec): # yapf: disable - super(Process, cls).define(spec) + super().define(spec) spec.input_namespace(spec.metadata_key, required=False, non_db=True) spec.input('{}.store_provenance'.format(spec.metadata_key), valid_type=bool, default=True, help='If set to `False` provenance will not be stored in the database.') @@ -109,7 +109,7 @@ def __init__(self, inputs=None, logger=None, runner=None, parent_pid=None, enabl self._runner = runner if runner is not None else manager.get_manager().get_runner() - super(Process, self).__init__( + super().__init__( inputs=self.spec().inputs.serialize(inputs), logger=logger, loop=self._runner.loop, @@ -123,7 +123,7 @@ def __init__(self, inputs=None, logger=None, runner=None, parent_pid=None, enabl self._enable_persistence = False def init(self): - super(Process, self).init() + super().init() if self._logger is None: self.set_logger(self.node.logger) @@ -207,7 +207,7 @@ def save_instance_state(self, out_state, save_context): See documentation of :meth:`!plumpy.processes.Process.save_instance_state`. """ - super(Process, self).save_instance_state(out_state, save_context) + super().save_instance_state(out_state, save_context) if self.metadata.store_provenance: assert self.node.is_stored @@ -238,7 +238,7 @@ def load_instance_state(self, saved_state, load_context): self._runner = manager.get_manager().get_runner() load_context = load_context.copyextend(loop=self._runner.loop, communicator=self._runner.communicator) - super(Process, self).load_instance_state(saved_state, load_context) + super().load_instance_state(saved_state, load_context) if self.SaveKeys.CALC_ID.value in saved_state: self._node = orm.load_node(saved_state[self.SaveKeys.CALC_ID.value]) @@ -261,7 +261,7 @@ def kill(self, msg=None): had_been_terminated = self.has_terminated() - result = super(Process, self).kill(msg) + result = super().kill(msg) # Only kill children if we could be killed ourselves if result is not False and not had_been_terminated: @@ -302,7 +302,7 @@ def out(self, output_port, value=None): value = output_port output_port = self.SINGLE_OUTPUT_LINKNAME - return super(Process, self).out(output_port, value) + return super().out(output_port, value) def out_many(self, out_dict): """Attach outputs to multiple output ports. @@ -317,7 +317,7 @@ def out_many(self, out_dict): def on_create(self): """Called when a Process is created.""" - super(Process, self).on_create() + super().on_create() # If parent PID hasn't been supplied try to get it from the stack if self._parent_pid is None and Process.current(): current = Process.current() @@ -327,7 +327,7 @@ def on_create(self): @override def on_entering(self, state): - super(Process, self).on_entering(state) + super().on_entering(state) # Update the node attributes every time we enter a new state def on_entered(self, from_state): @@ -337,12 +337,12 @@ def on_entered(self, from_state): self._save_checkpoint() # Update the latest process state change timestamp set_process_state_change_timestamp(self) - super(Process, self).on_entered(from_state) + super().on_entered(from_state) @override def on_terminated(self): """Called when a Process enters a terminal state.""" - super(Process, self).on_terminated() + super().on_terminated() if self._enable_persistence: try: self.runner.persister.delete_checkpoint(self.pid) @@ -362,7 +362,7 @@ def on_except(self, exc_info): :param exc_info: the sys.exc_info() object (type, value, traceback) """ - super(Process, self).on_except(exc_info) + super().on_except(exc_info) self.node.set_exception(''.join(traceback.format_exception(exc_info[0], exc_info[1], None))) self.report(''.join(traceback.format_exception(*exc_info))) @@ -376,7 +376,7 @@ def on_finish(self, result, successful): :param successful: whether execution was successful :type successful: bool """ - super(Process, self).on_finish(result, successful) + super().on_finish(result, successful) if result is None: if not successful: @@ -401,7 +401,7 @@ def on_paused(self, msg=None): :param msg: message :type msg: str """ - super(Process, self).on_paused(msg) + super().on_paused(msg) self._save_checkpoint() self.node.pause() @@ -410,7 +410,7 @@ def on_playing(self): """ The Process was unpaused so remove the paused attribute on the process node """ - super(Process, self).on_playing() + super().on_playing() self.node.unpause() @override @@ -423,7 +423,7 @@ def on_output_emitting(self, output_port, value): :param value: The value emitted """ - super(Process, self).on_output_emitting(output_port, value) + super().on_output_emitting(output_port, value) # Note that `PortNamespaces` should be able to receive non `Data` types such as a normal dictionary if isinstance(output_port, OutputPort) and not isinstance(value, orm.Data): @@ -436,7 +436,7 @@ def set_status(self, status): :param status: the status message :type status: str """ - super(Process, self).set_status(status) + super().set_status(status) self.node.set_process_status(status) def submit(self, process, *args, **kwargs): diff --git a/aiida/engine/processes/process_spec.py b/aiida/engine/processes/process_spec.py index aaa829863d..a3d7ba7a91 100644 --- a/aiida/engine/processes/process_spec.py +++ b/aiida/engine/processes/process_spec.py @@ -28,7 +28,7 @@ class ProcessSpec(plumpy.ProcessSpec): PORT_NAMESPACE_TYPE = PortNamespace def __init__(self): - super(ProcessSpec, self).__init__() + super().__init__() self._exit_codes = ExitCodesNamespace() @property @@ -77,7 +77,7 @@ class CalcJobProcessSpec(ProcessSpec): OUTPUT_PORT_TYPE = CalcJobOutputPort def __init__(self): - super(CalcJobProcessSpec, self).__init__() + super().__init__() self._default_output_node = None @property diff --git a/aiida/engine/processes/workchains/workchain.py b/aiida/engine/processes/workchains/workchain.py index abedea3830..9ad070400c 100644 --- a/aiida/engine/processes/workchains/workchain.py +++ b/aiida/engine/processes/workchains/workchain.py @@ -64,7 +64,7 @@ def __init__(self, inputs=None, logger=None, runner=None, enable_persistence=Tru if self.__class__ == WorkChain: raise exceptions.InvalidOperation('cannot construct or launch a base `WorkChain` class.') - super(WorkChain, self).__init__(inputs, logger, runner, enable_persistence=enable_persistence) + super().__init__(inputs, logger, runner, enable_persistence=enable_persistence) self._stepper = None self._awaitables = [] @@ -88,7 +88,7 @@ def save_instance_state(self, out_state, save_context): :type save_context: :class:`!plumpy.persistence.LoadSaveContext` """ - super(WorkChain, self).save_instance_state(out_state, save_context) + super().save_instance_state(out_state, save_context) # Save the context out_state[self._CONTEXT] = self.ctx @@ -98,7 +98,7 @@ def save_instance_state(self, out_state, save_context): @override def load_instance_state(self, saved_state, load_context): - super(WorkChain, self).load_instance_state(saved_state, load_context) + super().load_instance_state(saved_state, load_context) # Load the context self._context = saved_state[self._CONTEXT] @@ -114,7 +114,7 @@ def load_instance_state(self, saved_state, load_context): self.action_awaitables() def on_run(self): - super(WorkChain, self).on_run() + super().on_run() self.node.set_stepper_state_info(str(self._stepper)) def insert_awaitable(self, awaitable): @@ -219,7 +219,7 @@ def on_exiting(self): After the state is exited the next state will be entered and if persistence is enabled, a checkpoint will be saved. If the context contains unstored nodes, the serialization necessary for checkpointing will fail. """ - super(WorkChain, self).on_exiting() + super().on_exiting() try: self._store_nodes(self.ctx) except Exception: # pylint: disable=broad-except @@ -227,7 +227,7 @@ def on_exiting(self): self.logger.exception('exception in _store_nodes called in on_exiting') def on_wait(self, awaitables): - super(WorkChain, self).on_wait(awaitables) + super().on_wait(awaitables) if self._awaitables: self.action_awaitables() else: diff --git a/aiida/engine/transports.py b/aiida/engine/transports.py index d9fa85eec6..0f6192f8aa 100644 --- a/aiida/engine/transports.py +++ b/aiida/engine/transports.py @@ -22,7 +22,7 @@ class TransportRequest: # pylint: disable=too-few-public-methods def __init__(self): - super(TransportRequest, self).__init__() + super().__init__() self.future = concurrent.Future() self.count = 0 diff --git a/aiida/manage/backup/backup_base.py b/aiida/manage/backup/backup_base.py index 2522b32a95..4a80a23b20 100644 --- a/aiida/manage/backup/backup_base.py +++ b/aiida/manage/backup/backup_base.py @@ -417,7 +417,7 @@ class BackupError(Exception): """General backup error""" def __init__(self, value, *args, **kwargs): - super(BackupError, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._value = value def __str__(self): diff --git a/aiida/manage/external/rmq.py b/aiida/manage/external/rmq.py index 7f1ed2ca31..ff7693940a 100644 --- a/aiida/manage/external/rmq.py +++ b/aiida/manage/external/rmq.py @@ -184,7 +184,7 @@ def _continue(self, communicator, pid, nowait, tag=None): raise gen.Return(future.result()) try: - result = yield super(ProcessLauncher, self)._continue(communicator, pid, nowait, tag) + result = yield super()._continue(communicator, pid, nowait, tag) except ImportError as exception: message = 'the class of the process could not be imported.' self.handle_continue_exception(node, exception, message) diff --git a/aiida/manage/manager.py b/aiida/manage/manager.py index c4e6c423b5..9929c84777 100644 --- a/aiida/manage/manager.py +++ b/aiida/manage/manager.py @@ -328,7 +328,7 @@ def close(self): self._runner = None def __init__(self): - super(Manager, self).__init__() + super().__init__() self._backend = None # type: aiida.orm.implementation.Backend self._backend_manager = None # type: aiida.backend.manager.BackendManager self._config = None # type: aiida.manage.configuration.config.Config diff --git a/aiida/manage/tests/__init__.py b/aiida/manage/tests/__init__.py index 5cc05902dd..6ffd5e8481 100644 --- a/aiida/manage/tests/__init__.py +++ b/aiida/manage/tests/__init__.py @@ -46,7 +46,7 @@ class TestManagerError(Exception): """Raised by TestManager in situations that may lead to inconsistent behaviour.""" def __init__(self, msg): - super(TestManagerError, self).__init__() + super().__init__() self.msg = msg def __str__(self): diff --git a/aiida/manage/tests/unittest_classes.py b/aiida/manage/tests/unittest_classes.py index b2f45c88c9..bb747c7666 100644 --- a/aiida/manage/tests/unittest_classes.py +++ b/aiida/manage/tests/unittest_classes.py @@ -89,4 +89,4 @@ def run(self, suite, backend=None, profile_name=None): with test_manager( backend=backend or get_test_backend_name(), profile_name=profile_name or get_test_profile_name() ): - return super(TestRunner, self).run(suite) + return super().run(suite) diff --git a/aiida/orm/authinfos.py b/aiida/orm/authinfos.py index c5500393a7..d1bf0e8dcb 100644 --- a/aiida/orm/authinfos.py +++ b/aiida/orm/authinfos.py @@ -46,7 +46,7 @@ def __init__(self, computer, user, backend=None): """ backend = backend or get_manager().get_backend() model = backend.authinfos.create(computer=computer.backend_entity, user=user.backend_entity) - super(AuthInfo, self).__init__(model) + super().__init__(model) def __str__(self): if self.enabled: diff --git a/aiida/orm/comments.py b/aiida/orm/comments.py index 61a15d8b72..53805a8824 100644 --- a/aiida/orm/comments.py +++ b/aiida/orm/comments.py @@ -75,7 +75,7 @@ def __init__(self, node, user, content=None, backend=None): """ backend = backend or get_manager().get_backend() model = backend.comments.create(node=node.backend_entity, user=user.backend_entity, content=content) - super(Comment, self).__init__(model) + super().__init__(model) def __str__(self): arguments = [self.uuid, self.node.pk, self.user.email, self.content] diff --git a/aiida/orm/computers.py b/aiida/orm/computers.py index a31202006f..2832733fa0 100644 --- a/aiida/orm/computers.py +++ b/aiida/orm/computers.py @@ -83,7 +83,7 @@ def __init__( transport_type=transport_type, scheduler_type=scheduler_type ) - super(Computer, self).__init__(model) + super().__init__(model) if workdir is not None: self.set_workdir(workdir) @@ -294,7 +294,7 @@ def store(self): are to be changed (e.g. a new mpirun command, etc.) """ self.validate() - return super(Computer, self).store() + return super().store() @property def name(self): diff --git a/aiida/orm/convert.py b/aiida/orm/convert.py index 5e924a40f8..2aa287b421 100644 --- a/aiida/orm/convert.py +++ b/aiida/orm/convert.py @@ -80,7 +80,7 @@ class ConvertIterator(Iterator, Sized): """ def __init__(self, backend_iterator): - super(ConvertIterator, self).__init__() + super().__init__() self._backend_iterator = backend_iterator self.generator = self._genfunction() diff --git a/aiida/orm/groups.py b/aiida/orm/groups.py index 34ed549563..cb7b4af801 100644 --- a/aiida/orm/groups.py +++ b/aiida/orm/groups.py @@ -119,7 +119,7 @@ def __init__(self, label=None, user=None, description='', type_string=GroupTypeS model = backend.groups.create( label=label, user=user.backend_entity, description=description, type_string=type_string ) - super(Group, self).__init__(model) + super().__init__(model) def __repr__(self): return '<{}: {}>'.format(self.__class__.__name__, str(self)) diff --git a/aiida/orm/implementation/django/authinfos.py b/aiida/orm/implementation/django/authinfos.py index b068506380..87e0ff6910 100644 --- a/aiida/orm/implementation/django/authinfos.py +++ b/aiida/orm/implementation/django/authinfos.py @@ -32,7 +32,7 @@ def __init__(self, backend, computer, user): """ from . import computers from . import users - super(DjangoAuthInfo, self).__init__(backend) + super().__init__(backend) type_check(user, users.DjangoUser) type_check(computer, computers.DjangoComputer) self._dbmodel = utils.ModelWrapper(DbAuthInfo(dbcomputer=computer.dbmodel, aiidauser=user.dbmodel)) diff --git a/aiida/orm/implementation/django/comments.py b/aiida/orm/implementation/django/comments.py index 52ab54f929..b90a833898 100644 --- a/aiida/orm/implementation/django/comments.py +++ b/aiida/orm/implementation/django/comments.py @@ -40,7 +40,7 @@ def __init__(self, backend, node, user, content=None, ctime=None, mtime=None): :param mtime: The modification time as datetime object :return: a Comment object associated to the given node and user """ - super(DjangoComment, self).__init__(backend) + super().__init__(backend) lang.type_check(user, users.DjangoUser) # pylint: disable=no-member arguments = { @@ -68,7 +68,7 @@ def store(self): raise exceptions.ModificationNotAllowed('The corresponding node and/or user are not stored') with suppress_auto_now([(models.DbComment, ['mtime'])]) if self.mtime else EmptyContextManager(): - super(DjangoComment, self).store() + super().store() @property def ctime(self): diff --git a/aiida/orm/implementation/django/computers.py b/aiida/orm/implementation/django/computers.py index e444afaaf0..cf52380f47 100644 --- a/aiida/orm/implementation/django/computers.py +++ b/aiida/orm/implementation/django/computers.py @@ -29,7 +29,7 @@ class DjangoComputer(entities.DjangoModelEntity[models.DbComputer], BackendCompu def __init__(self, backend, **kwargs): """Construct a new `DjangoComputer` instance.""" - super(DjangoComputer, self).__init__(backend) + super().__init__(backend) self._dbmodel = utils.ModelWrapper(models.DbComputer(**kwargs)) @property diff --git a/aiida/orm/implementation/django/entities.py b/aiida/orm/implementation/django/entities.py index 65f7c1969b..2bdfeff83d 100644 --- a/aiida/orm/implementation/django/entities.py +++ b/aiida/orm/implementation/django/entities.py @@ -65,7 +65,7 @@ def get_dbmodel_attribute_name(cls, attr_name): raise ValueError("Unknown attribute '{}'".format(attr_name)) def __init__(self, *args, **kwargs): - super(DjangoModelEntity, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._class_check() @property diff --git a/aiida/orm/implementation/django/groups.py b/aiida/orm/implementation/django/groups.py index 58f5818076..a5658b80a7 100644 --- a/aiida/orm/implementation/django/groups.py +++ b/aiida/orm/implementation/django/groups.py @@ -33,7 +33,7 @@ class DjangoGroup(entities.DjangoModelEntity[models.DbGroup], BackendGroup): # def __init__(self, backend, label, user, description='', type_string=''): """Construct a new Django group""" type_check(user, users.DjangoUser) - super(DjangoGroup, self).__init__(backend) + super().__init__(backend) self._dbmodel = utils.ModelWrapper( models.DbGroup(label=label, description=description, user=user.dbmodel, type_string=type_string) @@ -120,7 +120,7 @@ class NodesIterator(Iterator, Sized): """The nodes iterator""" def __init__(self, dbnodes, backend): - super(NodesIterator, self).__init__() + super().__init__() self._backend = backend self._dbnodes = dbnodes self.generator = self._genfunction() @@ -151,7 +151,7 @@ def __next__(self): def add_nodes(self, nodes, **kwargs): from .nodes import DjangoNode - super(DjangoGroup, self).add_nodes(nodes) + super().add_nodes(nodes) node_pks = [] @@ -170,7 +170,7 @@ def add_nodes(self, nodes, **kwargs): def remove_nodes(self, nodes): from .nodes import DjangoNode - super(DjangoGroup, self).remove_nodes(nodes) + super().remove_nodes(nodes) node_pks = [] diff --git a/aiida/orm/implementation/django/logs.py b/aiida/orm/implementation/django/logs.py index 7bb72cebca..890c30dbd9 100644 --- a/aiida/orm/implementation/django/logs.py +++ b/aiida/orm/implementation/django/logs.py @@ -26,7 +26,7 @@ class DjangoLog(entities.DjangoModelEntity[models.DbLog], BackendLog): def __init__(self, backend, time, loggername, levelname, dbnode_id, message='', metadata=None): # pylint: disable=too-many-arguments - super(DjangoLog, self).__init__(backend) + super().__init__(backend) self._dbmodel = models.DbLog( time=time, loggername=loggername, diff --git a/aiida/orm/implementation/django/nodes.py b/aiida/orm/implementation/django/nodes.py index 12a69e9568..039a4c2025 100644 --- a/aiida/orm/implementation/django/nodes.py +++ b/aiida/orm/implementation/django/nodes.py @@ -58,7 +58,7 @@ def __init__( :param mtime: The modification time as datetime object """ # pylint: disable=too-many-arguments - super(DjangoNode, self).__init__(backend) + super().__init__(backend) arguments = { 'user': user.dbmodel, diff --git a/aiida/orm/implementation/django/users.py b/aiida/orm/implementation/django/users.py index 0eb2faff7a..db3f663a2d 100644 --- a/aiida/orm/implementation/django/users.py +++ b/aiida/orm/implementation/django/users.py @@ -27,7 +27,7 @@ class DjangoUser(entities.DjangoModelEntity[models.DbUser], BackendUser): def __init__(self, backend, email, first_name, last_name, institution): # pylint: disable=too-many-arguments - super(DjangoUser, self).__init__(backend) + super().__init__(backend) self._dbmodel = utils.ModelWrapper( DbUser(email=email, first_name=first_name, last_name=last_name, institution=institution) ) diff --git a/aiida/orm/implementation/django/utils.py b/aiida/orm/implementation/django/utils.py index 27b5d053f4..7d379ff0f8 100644 --- a/aiida/orm/implementation/django/utils.py +++ b/aiida/orm/implementation/django/utils.py @@ -37,7 +37,7 @@ def __init__(self, model, auto_flush=()): :param auto_flush: an optional tuple of database model fields that are always to be flushed, in addition to the field that corresponds to the attribute being set through `__setattr__`. """ - super(ModelWrapper, self).__init__() + super().__init__() # Have to do it this way because we overwrite __setattr__ object.__setattr__(self, '_model', model) object.__setattr__(self, '_auto_flush', auto_flush) diff --git a/aiida/orm/implementation/sqlalchemy/authinfos.py b/aiida/orm/implementation/sqlalchemy/authinfos.py index e221b7ada2..c68b0e03f0 100644 --- a/aiida/orm/implementation/sqlalchemy/authinfos.py +++ b/aiida/orm/implementation/sqlalchemy/authinfos.py @@ -33,7 +33,7 @@ def __init__(self, backend, computer, user): """ from . import computers from . import users - super(SqlaAuthInfo, self).__init__(backend) + super().__init__(backend) type_check(user, users.SqlaUser) type_check(computer, computers.SqlaComputer) self._dbmodel = utils.ModelWrapper(DbAuthInfo(dbcomputer=computer.dbmodel, aiidauser=user.dbmodel)) diff --git a/aiida/orm/implementation/sqlalchemy/comments.py b/aiida/orm/implementation/sqlalchemy/comments.py index 0282c81109..52557f66cd 100644 --- a/aiida/orm/implementation/sqlalchemy/comments.py +++ b/aiida/orm/implementation/sqlalchemy/comments.py @@ -41,7 +41,7 @@ def __init__(self, backend, node, user, content=None, ctime=None, mtime=None): :param mtime: The modification time as datetime object :return: a Comment object associated to the given node and user """ - super(SqlaComment, self).__init__(backend) + super().__init__(backend) lang.type_check(user, users.SqlaUser) # pylint: disable=no-member arguments = { @@ -66,7 +66,7 @@ def store(self): self._dbmodel.dbnode = None raise exceptions.ModificationNotAllowed('The corresponding node and/or user are not stored') - super(SqlaComment, self).store() + super().store() @property def ctime(self): diff --git a/aiida/orm/implementation/sqlalchemy/computers.py b/aiida/orm/implementation/sqlalchemy/computers.py index 53887d6b33..8c33d23180 100644 --- a/aiida/orm/implementation/sqlalchemy/computers.py +++ b/aiida/orm/implementation/sqlalchemy/computers.py @@ -32,7 +32,7 @@ class SqlaComputer(entities.SqlaModelEntity[DbComputer], BackendComputer): MODEL_CLASS = DbComputer def __init__(self, backend, **kwargs): - super(SqlaComputer, self).__init__(backend) + super().__init__(backend) self._dbmodel = utils.ModelWrapper(DbComputer(**kwargs)) @property diff --git a/aiida/orm/implementation/sqlalchemy/entities.py b/aiida/orm/implementation/sqlalchemy/entities.py index 431b1fcbaa..5dcbc0139c 100644 --- a/aiida/orm/implementation/sqlalchemy/entities.py +++ b/aiida/orm/implementation/sqlalchemy/entities.py @@ -63,7 +63,7 @@ def get_dbmodel_attribute_name(cls, attr_name): raise ValueError("Unknown attribute '{}'".format(attr_name)) def __init__(self, *args, **kwargs): - super(SqlaModelEntity, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._class_check() @property diff --git a/aiida/orm/implementation/sqlalchemy/groups.py b/aiida/orm/implementation/sqlalchemy/groups.py index 594cfb1f45..f5d13078d0 100644 --- a/aiida/orm/implementation/sqlalchemy/groups.py +++ b/aiida/orm/implementation/sqlalchemy/groups.py @@ -45,7 +45,7 @@ def __init__(self, backend, label, user, description='', type_string=''): :param type_string: an optional type for the group to contain """ type_check(user, users.SqlaUser) - super(SqlaGroup, self).__init__(backend) + super().__init__(backend) dbgroup = DbGroup(label=label, description=description, user=user.dbmodel, type_string=type_string) self._dbmodel = utils.ModelWrapper(dbgroup) @@ -188,7 +188,7 @@ def add_nodes(self, nodes, **kwargs): from aiida.backends.sqlalchemy import get_scoped_session from aiida.backends.sqlalchemy.models.base import Base - super(SqlaGroup, self).add_nodes(nodes) + super().add_nodes(nodes) skip_orm = kwargs.get('skip_orm', False) def check_node(given_node): @@ -238,7 +238,7 @@ def remove_nodes(self, nodes): """ from aiida.orm.implementation.sqlalchemy.nodes import SqlaNode - super(SqlaGroup, self).remove_nodes(nodes) + super().remove_nodes(nodes) # Get dbnodes here ONCE, otherwise each call to dbnodes will re-read the current value in the database dbnodes = self._dbmodel.dbnodes diff --git a/aiida/orm/implementation/sqlalchemy/logs.py b/aiida/orm/implementation/sqlalchemy/logs.py index 9b0872b1de..867f4a2e09 100644 --- a/aiida/orm/implementation/sqlalchemy/logs.py +++ b/aiida/orm/implementation/sqlalchemy/logs.py @@ -28,7 +28,7 @@ class SqlaLog(entities.SqlaModelEntity[models.DbLog], BackendLog): def __init__(self, backend, time, loggername, levelname, dbnode_id, message='', metadata=None): # pylint: disable=too-many-arguments - super(SqlaLog, self).__init__(backend) + super().__init__(backend) self._dbmodel = utils.ModelWrapper( models.DbLog( time=time, diff --git a/aiida/orm/implementation/sqlalchemy/nodes.py b/aiida/orm/implementation/sqlalchemy/nodes.py index 830d6def97..6f0372646e 100644 --- a/aiida/orm/implementation/sqlalchemy/nodes.py +++ b/aiida/orm/implementation/sqlalchemy/nodes.py @@ -58,7 +58,7 @@ def __init__( :param mtime: The modification time as datetime object """ # pylint: disable=too-many-arguments - super(SqlaNode, self).__init__(backend) + super().__init__(backend) arguments = { 'node_type': node_type, diff --git a/aiida/orm/implementation/sqlalchemy/users.py b/aiida/orm/implementation/sqlalchemy/users.py index 9ea2314cc7..8a6c8909b1 100644 --- a/aiida/orm/implementation/sqlalchemy/users.py +++ b/aiida/orm/implementation/sqlalchemy/users.py @@ -23,7 +23,7 @@ class SqlaUser(entities.SqlaModelEntity[DbUser], BackendUser): def __init__(self, backend, email, first_name, last_name, institution): # pylint: disable=too-many-arguments - super(SqlaUser, self).__init__(backend) + super().__init__(backend) self._dbmodel = utils.ModelWrapper( DbUser(email=email, first_name=first_name, last_name=last_name, institution=institution) ) diff --git a/aiida/orm/implementation/sqlalchemy/utils.py b/aiida/orm/implementation/sqlalchemy/utils.py index 0cb3476ccc..9552e62f3a 100644 --- a/aiida/orm/implementation/sqlalchemy/utils.py +++ b/aiida/orm/implementation/sqlalchemy/utils.py @@ -41,7 +41,7 @@ def __init__(self, model, auto_flush=()): :param auto_flush: an optional tuple of database model fields that are always to be flushed, in addition to the field that corresponds to the attribute being set through `__setattr__`. """ - super(ModelWrapper, self).__init__() + super().__init__() # Have to do it this way because we overwrite __setattr__ object.__setattr__(self, '_model', model) object.__setattr__(self, '_auto_flush', auto_flush) diff --git a/aiida/orm/logs.py b/aiida/orm/logs.py index e71e59f418..ca83ddfdad 100644 --- a/aiida/orm/logs.py +++ b/aiida/orm/logs.py @@ -175,7 +175,7 @@ def __init__(self, time, loggername, levelname, dbnode_id, message='', metadata= message=message, metadata=metadata ) - super(Log, self).__init__(model) + super().__init__(model) self.store() # Logs are immutable and automatically stored @property diff --git a/aiida/orm/nodes/data/array/array.py b/aiida/orm/nodes/data/array/array.py index 7a746e761e..5e933f761c 100644 --- a/aiida/orm/nodes/data/array/array.py +++ b/aiida/orm/nodes/data/array/array.py @@ -34,7 +34,7 @@ class ArrayData(Data): _cached_arrays = None def initialize(self): - super(ArrayData, self).initialize() + super().initialize() self._cached_arrays = {} def delete_array(self, name): @@ -191,4 +191,4 @@ def _validate(self): 'Mismatch of files and properties for ArrayData' ' node (pk= {}): {} vs. {}'.format(self.pk, files, properties) ) - super(ArrayData, self)._validate() + super()._validate() diff --git a/aiida/orm/nodes/data/array/trajectory.py b/aiida/orm/nodes/data/array/trajectory.py index c77bf2e2c2..4ef6903351 100644 --- a/aiida/orm/nodes/data/array/trajectory.py +++ b/aiida/orm/nodes/data/array/trajectory.py @@ -23,7 +23,7 @@ class TrajectoryData(ArrayData): """ def __init__(self, structurelist=None, **kwargs): - super(TrajectoryData, self).__init__(**kwargs) + super().__init__(**kwargs) if structurelist is not None: self.set_structurelist(structurelist) diff --git a/aiida/orm/nodes/data/base.py b/aiida/orm/nodes/data/base.py index 7b058ae9d6..001fb306fc 100644 --- a/aiida/orm/nodes/data/base.py +++ b/aiida/orm/nodes/data/base.py @@ -30,7 +30,7 @@ def __init__(self, *args, **kwargs): except AttributeError: raise RuntimeError('Derived class must define the `_type` class member') - super(BaseType, self).__init__(**kwargs) + super().__init__(**kwargs) try: value = args[0] @@ -48,7 +48,7 @@ def value(self, value): self.set_attribute('value', self._type(value)) # pylint: disable=no-member def __str__(self): - return super(BaseType, self).__str__() + ' value: {}'.format(self.value) + return super().__str__() + ' value: {}'.format(self.value) def __eq__(self, other): if isinstance(other, BaseType): diff --git a/aiida/orm/nodes/data/cif.py b/aiida/orm/nodes/data/cif.py index c061ca2bb0..207f9f79e4 100644 --- a/aiida/orm/nodes/data/cif.py +++ b/aiida/orm/nodes/data/cif.py @@ -268,7 +268,7 @@ def __init__( if args[left] is not None and args[right] is not None: raise ValueError('cannot pass {} and {} at the same time'.format(left, right)) - super(CifData, self).__init__(file, filename=filename, **kwargs) + super().__init__(file, filename=filename, **kwargs) self.set_scan_type(scan_type or CifData._SCAN_TYPE_DEFAULT) self.set_parse_policy(parse_policy or CifData._PARSE_POLICY_DEFAULT) @@ -473,7 +473,7 @@ def store(self, *args, **kwargs): if not self.is_stored: self.set_attribute('md5', self.generate_md5()) - return super(CifData, self).store(*args, **kwargs) + return super().store(*args, **kwargs) def set_file(self, file, filename=None): """ @@ -487,7 +487,7 @@ def set_file(self, file, filename=None): :param filename: specify filename to use (defaults to name of provided file). """ # pylint: disable=redefined-builtin - super(CifData, self).set_file(file, filename=filename) + super().set_file(file, filename=filename) md5sum = self.generate_md5() if isinstance(self.source, dict) and \ self.source.get('source_md5', None) is not None and \ @@ -783,7 +783,7 @@ def _validate(self): """ from aiida.common.exceptions import ValidationError - super(CifData, self)._validate() + super()._validate() try: attr_md5 = self.get_attribute('md5') diff --git a/aiida/orm/nodes/data/code.py b/aiida/orm/nodes/data/code.py index 8f8865741f..cbed0dfbb8 100644 --- a/aiida/orm/nodes/data/code.py +++ b/aiida/orm/nodes/data/code.py @@ -38,7 +38,7 @@ class Code(Data): """ def __init__(self, remote_computer_exec=None, local_executable=None, input_plugin_name=None, files=None, **kwargs): - super(Code, self).__init__(**kwargs) + super().__init__(**kwargs) if remote_computer_exec and local_executable: raise ValueError('cannot set `remote_computer_exec` and `local_executable` at the same time') @@ -269,7 +269,7 @@ def list_for_plugin(cls, plugin, labels=True): return [c.pk for c in valid_codes] def _validate(self): - super(Code, self)._validate() + super()._validate() if self.is_local() is None: raise ValidationError('You did not set whether the code is local or remote') diff --git a/aiida/orm/nodes/data/data.py b/aiida/orm/nodes/data/data.py index 52f62f84a8..4f33d90ca5 100644 --- a/aiida/orm/nodes/data/data.py +++ b/aiida/orm/nodes/data/data.py @@ -369,7 +369,7 @@ def _validate(self): """ # Validation of ``source`` is commented out due to Issue #9 # (https://bitbucket.org/epfl_theos/aiida_epfl/issues/9/) - # super(Data, self)._validate() + # super()._validate() # if self.source is not None and \ # self.source.get('license', None) and \ # self.source['license'].startswith('CC-BY') and \ diff --git a/aiida/orm/nodes/data/dict.py b/aiida/orm/nodes/data/dict.py index 76f77ed539..9006e606b1 100644 --- a/aiida/orm/nodes/data/dict.py +++ b/aiida/orm/nodes/data/dict.py @@ -32,7 +32,7 @@ def __init__(self, **kwargs): :param dict: the dictionary to set """ dictionary = kwargs.pop('dict', None) - super(Dict, self).__init__(**kwargs) + super().__init__(**kwargs) if dictionary: self.set_dict(dictionary) diff --git a/aiida/orm/nodes/data/folder.py b/aiida/orm/nodes/data/folder.py index bf01e8cd60..e85a4235f6 100644 --- a/aiida/orm/nodes/data/folder.py +++ b/aiida/orm/nodes/data/folder.py @@ -35,6 +35,6 @@ def __init__(self, **kwargs): :type tree: str """ tree = kwargs.pop('tree', None) - super(FolderData, self).__init__(**kwargs) + super().__init__(**kwargs) if tree: self.put_object_from_tree(tree) diff --git a/aiida/orm/nodes/data/list.py b/aiida/orm/nodes/data/list.py index 5d8771ceea..5f656d4930 100644 --- a/aiida/orm/nodes/data/list.py +++ b/aiida/orm/nodes/data/list.py @@ -22,7 +22,7 @@ class List(Data, MutableSequence): def __init__(self, **kwargs): data = kwargs.pop('list', list()) - super(List, self).__init__(**kwargs) + super().__init__(**kwargs) self.set_list(data) def __getitem__(self, item): @@ -44,7 +44,7 @@ def __len__(self): return len(self.get_list()) def __str__(self): - return super(List, self).__str__() + ' value: {}'.format(self.get_list()) + return super().__str__() + ' value: {}'.format(self.get_list()) def __eq__(self, other): try: diff --git a/aiida/orm/nodes/data/remote.py b/aiida/orm/nodes/data/remote.py index 292a8bac8c..03a089e515 100644 --- a/aiida/orm/nodes/data/remote.py +++ b/aiida/orm/nodes/data/remote.py @@ -23,7 +23,7 @@ class RemoteData(Data): """ def __init__(self, remote_path=None, **kwargs): - super(RemoteData, self).__init__(**kwargs) + super().__init__(**kwargs) if remote_path is not None: self.set_remote_path(remote_path) @@ -170,7 +170,7 @@ def _clean(self): def _validate(self): from aiida.common.exceptions import ValidationError - super(RemoteData, self)._validate() + super()._validate() try: self.get_remote_path() diff --git a/aiida/orm/nodes/data/singlefile.py b/aiida/orm/nodes/data/singlefile.py index 174af7159b..9c7c8eb61e 100644 --- a/aiida/orm/nodes/data/singlefile.py +++ b/aiida/orm/nodes/data/singlefile.py @@ -32,7 +32,7 @@ def __init__(self, file, filename=None, **kwargs): :param filename: specify filename to use (defaults to name of provided file). """ # pylint: disable=redefined-builtin - super(SinglefileData, self).__init__(**kwargs) + super().__init__(**kwargs) # 'filename' argument was added to 'set_file' after 1.0.0. if 'filename' not in inspect.getfullargspec(self.set_file)[0]: @@ -124,7 +124,7 @@ def set_file(self, file, filename=None): def _validate(self): """Ensure that there is one object stored in the repository, whose key matches value set for `filename` attr.""" - super(SinglefileData, self)._validate() + super()._validate() try: filename = self.filename diff --git a/aiida/orm/nodes/data/structure.py b/aiida/orm/nodes/data/structure.py index f691b774b5..50d199c6ef 100644 --- a/aiida/orm/nodes/data/structure.py +++ b/aiida/orm/nodes/data/structure.py @@ -732,7 +732,7 @@ def __init__(self, cell=None, pbc=None, ase=None, pymatgen=None, pymatgen_struct if args[left] is not None and args[right] is not None: raise ValueError('cannot pass {} and {} at the same time'.format(left, right)) - super(StructureData, self).__init__(**kwargs) + super().__init__(**kwargs) if any([ext is not None for ext in [ase, pymatgen, pymatgen_structure, pymatgen_molecule]]): @@ -926,7 +926,7 @@ def _validate(self): from aiida.common.exceptions import ValidationError - super(StructureData, self)._validate() + super()._validate() try: _get_valid_cell(self.cell) diff --git a/aiida/orm/nodes/data/upf.py b/aiida/orm/nodes/data/upf.py index 771b201616..fa80ab92ee 100644 --- a/aiida/orm/nodes/data/upf.py +++ b/aiida/orm/nodes/data/upf.py @@ -273,7 +273,7 @@ def __init__(self, file=None, filename=None, source=None, **kwargs): :param source: Dictionary with information on source of the potential (see ".source" property). """ # pylint: disable=redefined-builtin - super(UpfData, self).__init__(file, filename=filename, **kwargs) + super().__init__(file, filename=filename, **kwargs) if source is not None: self.set_source(source) @@ -343,7 +343,7 @@ def store(self, *args, **kwargs): self.set_attribute('element', str(element)) self.set_attribute('md5', md5) - return super(UpfData, self).store(*args, **kwargs) + return super().store(*args, **kwargs) @classmethod def from_md5(cls, md5): @@ -382,7 +382,7 @@ def set_file(self, file, filename=None): except KeyError: raise ParsingError("No 'element' parsed in the UPF file {}; unable to store".format(self.filename)) - super(UpfData, self).set_file(file, filename=filename) + super().set_file(file, filename=filename) self.set_attribute('element', str(element)) self.set_attribute('md5', md5sum) @@ -418,7 +418,7 @@ def _validate(self): from aiida.common.exceptions import ValidationError from aiida.common.files import md5_from_filelike - super(UpfData, self)._validate() + super()._validate() with self.open(mode='r') as handle: parsed_data = parse_upf(handle) diff --git a/aiida/orm/nodes/node.py b/aiida/orm/nodes/node.py index 9347680424..06237738e2 100644 --- a/aiida/orm/nodes/node.py +++ b/aiida/orm/nodes/node.py @@ -100,7 +100,7 @@ def delete(self, node_id): @classmethod def from_backend_entity(cls, backend_entity): - entity = super(Node, cls).from_backend_entity(backend_entity) + entity = super().from_backend_entity(backend_entity) return entity def __init__(self, backend=None, user=None, computer=None, **kwargs): @@ -118,7 +118,7 @@ def __init__(self, backend=None, user=None, computer=None, **kwargs): backend_entity = backend.nodes.create( node_type=self.class_node_type, user=user.backend_entity, computer=computer, **kwargs ) - super(Node, self).__init__(backend_entity) + super().__init__(backend_entity) def __repr__(self): return '<{}: {}>'.format(self.__class__.__name__, str(self)) @@ -143,7 +143,7 @@ def initialize(self): This needs to be called explicitly in each specific subclass implementation of the init. """ - super(Node, self).initialize() + super().initialize() # A cache of incoming links represented as a list of LinkTriples instances self._incoming_cache = list() diff --git a/aiida/orm/nodes/process/calculation/calcfunction.py b/aiida/orm/nodes/process/calculation/calcfunction.py index c4a9dc50d6..28a732a129 100644 --- a/aiida/orm/nodes/process/calculation/calcfunction.py +++ b/aiida/orm/nodes/process/calculation/calcfunction.py @@ -36,7 +36,7 @@ def validate_outgoing(self, target, link_type, link_label): :raise TypeError: if `target` is not a Node instance or `link_type` is not a `LinkType` enum :raise ValueError: if the proposed link is invalid """ - super(CalcFunctionNode, self).validate_outgoing(target, link_type, link_label) + super().validate_outgoing(target, link_type, link_label) if link_type is LinkType.CREATE and target.is_stored: raise ValueError( 'trying to return an already stored Data node from a @calcfunction, however, @calcfunctions cannot ' diff --git a/aiida/orm/nodes/process/calculation/calcjob.py b/aiida/orm/nodes/process/calculation/calcjob.py index 761b5b2ebd..027669d3b7 100644 --- a/aiida/orm/nodes/process/calculation/calcjob.py +++ b/aiida/orm/nodes/process/calculation/calcjob.py @@ -76,7 +76,7 @@ def tools(self): @classproperty def _updatable_attributes(cls): # pylint: disable=no-self-argument - return super(CalcJobNode, cls)._updatable_attributes + ( + return super()._updatable_attributes + ( cls.CALC_JOB_STATE_KEY, cls.REMOTE_WORKDIR_KEY, cls.RETRIEVE_LIST_KEY, @@ -90,7 +90,7 @@ def _updatable_attributes(cls): # pylint: disable=no-self-argument @classproperty def _hash_ignored_attributes(cls): # pylint: disable=no-self-argument - return super(CalcJobNode, cls)._hash_ignored_attributes + ( + return super()._hash_ignored_attributes + ( 'queue_name', 'account', 'qos', @@ -137,7 +137,7 @@ def get_builder_restart(self): :return: `~aiida.engine.processes.builder.ProcessBuilder` instance """ - builder = super(CalcJobNode, self).get_builder_restart() + builder = super().get_builder_restart() builder.metadata.options = self.get_options() return builder diff --git a/aiida/orm/nodes/process/process.py b/aiida/orm/nodes/process/process.py index 897dfb2ccb..f18df995e6 100644 --- a/aiida/orm/nodes/process/process.py +++ b/aiida/orm/nodes/process/process.py @@ -52,7 +52,7 @@ class ProcessNode(Sealable, Node): _unstorable_message = 'only Data, WorkflowNode, CalculationNode or their subclasses can be stored' def __str__(self): - base = super(ProcessNode, self).__str__() + base = super().__str__() if self.process_type: return '{} ({})'.format(base, self.process_type) @@ -61,7 +61,7 @@ def __str__(self): @classproperty def _updatable_attributes(cls): # pylint: disable=no-self-argument - return super(ProcessNode, cls)._updatable_attributes + ( + return super()._updatable_attributes + ( cls.PROCESS_PAUSED_KEY, cls.CHECKPOINT_KEY, cls.EXCEPTION_KEY, @@ -468,7 +468,7 @@ def validate_incoming(self, source, link_type, link_label): :raise TypeError: if `source` is not a Node instance or `link_type` is not a `LinkType` enum :raise ValueError: if the proposed link is invalid """ - super(ProcessNode, self).validate_incoming(source, link_type, link_label) + super().validate_incoming(source, link_type, link_label) if self.is_stored: raise ValueError('attempted to add an input link after the process node was already stored.') @@ -479,13 +479,13 @@ def is_valid_cache(self): :returns: True if this process node is valid to be used for caching, False otherwise """ - return super(ProcessNode, self).is_valid_cache and self.is_finished + return super().is_valid_cache and self.is_finished def _get_objects_to_hash(self): """ Return a list of objects which should be included in the hash. """ - res = super(ProcessNode, self)._get_objects_to_hash() + res = super()._get_objects_to_hash() res.append({ entry.link_label: entry.node.get_hash() for entry in self.get_incoming(link_type=(LinkType.INPUT_CALC, LinkType.INPUT_WORK)) diff --git a/aiida/orm/nodes/process/workflow/workchain.py b/aiida/orm/nodes/process/workflow/workchain.py index 5577f58d5b..6cceeb14e4 100644 --- a/aiida/orm/nodes/process/workflow/workchain.py +++ b/aiida/orm/nodes/process/workflow/workchain.py @@ -26,7 +26,7 @@ class WorkChainNode(WorkflowNode): @classproperty def _updatable_attributes(cls): # pylint: disable=no-self-argument - return super(WorkChainNode, cls)._updatable_attributes + (cls.STEPPER_STATE_INFO_KEY,) + return super()._updatable_attributes + (cls.STEPPER_STATE_INFO_KEY,) @property def stepper_state_info(self): diff --git a/aiida/orm/nodes/process/workflow/workflow.py b/aiida/orm/nodes/process/workflow/workflow.py index 3b78d2023f..1ccd20141a 100644 --- a/aiida/orm/nodes/process/workflow/workflow.py +++ b/aiida/orm/nodes/process/workflow/workflow.py @@ -61,7 +61,7 @@ def validate_outgoing(self, target, link_type, link_label): :raise TypeError: if `target` is not a Node instance or `link_type` is not a `LinkType` enum :raise ValueError: if the proposed link is invalid """ - super(WorkflowNode, self).validate_outgoing(target, link_type, link_label) + super().validate_outgoing(target, link_type, link_label) if link_type is LinkType.RETURN and not target.is_stored: raise ValueError( 'Workflow<{}> tried returning an unstored `Data` node. This likely means new `Data` is being created ' diff --git a/aiida/orm/nodes/process/workflow/workfunction.py b/aiida/orm/nodes/process/workflow/workfunction.py index c12285476d..79a2dfdc54 100644 --- a/aiida/orm/nodes/process/workflow/workfunction.py +++ b/aiida/orm/nodes/process/workflow/workfunction.py @@ -36,7 +36,7 @@ def validate_outgoing(self, target, link_type, link_label): :raise TypeError: if `target` is not a Node instance or `link_type` is not a `LinkType` enum :raise ValueError: if the proposed link is invalid """ - super(WorkFunctionNode, self).validate_outgoing(target, link_type, link_label) + super().validate_outgoing(target, link_type, link_label) if link_type is LinkType.RETURN and not target.is_stored: raise ValueError( 'trying to return an unstored Data node from a @workfunction, however, @workfunctions cannot create ' diff --git a/aiida/orm/users.py b/aiida/orm/users.py index cf4e3a67c0..47d714bb62 100644 --- a/aiida/orm/users.py +++ b/aiida/orm/users.py @@ -30,7 +30,7 @@ class Collection(entities.Collection): _default_user = None # type: aiida.orm.User def __init__(self, *args, **kwargs): - super(User.Collection, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._default_user = self.UNDEFINED def get_or_create(self, email, **kwargs): @@ -83,7 +83,7 @@ def __init__(self, email, first_name='', last_name='', institution='', backend=N backend = backend or get_manager().get_backend() email = self.normalize_email(email) backend_entity = backend.users.create(email, first_name, last_name, institution) - super(User, self).__init__(backend_entity) + super().__init__(backend_entity) def __str__(self): return self.email diff --git a/aiida/orm/utils/builders/code.py b/aiida/orm/utils/builders/code.py index c5938cb355..75a9266438 100644 --- a/aiida/orm/utils/builders/code.py +++ b/aiida/orm/utils/builders/code.py @@ -148,7 +148,7 @@ def _get_and_count(self, key, used): def __setattr__(self, key, value): if not key.startswith('_'): self._set_code_attr(key, value) - super(CodeBuilder, self).__setattr__(key, value) + super().__setattr__(key, value) def _set_code_attr(self, key, value): """Set a code attribute, if it passes validation. @@ -204,7 +204,7 @@ class CodeValidationError(Exception): """ def __init__(self, msg): - super(CodeBuilder.CodeValidationError, self).__init__() + super().__init__() self.msg = msg def __str__(self): diff --git a/aiida/orm/utils/builders/computer.py b/aiida/orm/utils/builders/computer.py index 8c332855dd..04fe730cf2 100644 --- a/aiida/orm/utils/builders/computer.py +++ b/aiida/orm/utils/builders/computer.py @@ -152,7 +152,7 @@ def _get_and_count(self, key, used): def __setattr__(self, key, value): if not key.startswith('_'): self._set_computer_attr(key, value) - super(ComputerBuilder, self).__setattr__(key, value) + super().__setattr__(key, value) def _set_computer_attr(self, key, value): """Set a computer attribute if it passes validation.""" @@ -172,7 +172,7 @@ class ComputerValidationError(Exception): """ def __init__(self, msg): - super(ComputerBuilder.ComputerValidationError, self).__init__() + super().__init__() self.msg = msg def __str__(self): diff --git a/aiida/orm/utils/mixins.py b/aiida/orm/utils/mixins.py index bbabd89c20..35707825da 100644 --- a/aiida/orm/utils/mixins.py +++ b/aiida/orm/utils/mixins.py @@ -137,7 +137,7 @@ def validate_incoming(self, source, link_type, link_label): if self.is_sealed: raise exceptions.ModificationNotAllowed('Cannot add a link to a sealed node') - super(Sealable, self).validate_incoming(source, link_type=link_type, link_label=link_label) + super().validate_incoming(source, link_type=link_type, link_label=link_label) def validate_outgoing(self, target, link_type, link_label): """Validate adding a link of the given type from ourself to a given node. @@ -152,7 +152,7 @@ def validate_outgoing(self, target, link_type, link_label): if self.is_sealed: raise exceptions.ModificationNotAllowed('Cannot add a link from a sealed node') - super(Sealable, self).validate_outgoing(target, link_type=link_type, link_label=link_label) + super().validate_outgoing(target, link_type=link_type, link_label=link_label) @property def is_sealed(self): diff --git a/aiida/orm/utils/serialize.py b/aiida/orm/utils/serialize.py index 5d43ce727d..a662a888d8 100644 --- a/aiida/orm/utils/serialize.py +++ b/aiida/orm/utils/serialize.py @@ -174,7 +174,7 @@ def represent_data(self, data): if isinstance(data, orm.Group): return represent_group(self, data) - return super(AiiDADumper, self).represent_data(data) + return super().represent_data(data) class AiiDALoader(yaml.Loader): diff --git a/aiida/restapi/api.py b/aiida/restapi/api.py index 7d8cd30614..18c5d876fe 100644 --- a/aiida/restapi/api.py +++ b/aiida/restapi/api.py @@ -35,7 +35,7 @@ def __init__(self, *args, **kwargs): pass # Basic initialization - super(App, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Error handler from aiida.restapi.common.exceptions import RestInputValidationError, \ @@ -100,7 +100,7 @@ def __init__(self, app=None, **kwargs): self.app = app - super(AiidaApi, self).__init__(app=app, prefix=kwargs['PREFIX'], catch_all_404s=True) + super().__init__(app=app, prefix=kwargs['PREFIX'], catch_all_404s=True) self.add_resource( ServerInfo, diff --git a/aiida/restapi/resources.py b/aiida/restapi/resources.py index 0ab36b3aae..c746169681 100644 --- a/aiida/restapi/resources.py +++ b/aiida/restapi/resources.py @@ -213,7 +213,7 @@ class Node(BaseResource): _parse_pk_uuid = 'uuid' # Parse a uuid pattern in the URL path (not a pk) def __init__(self, **kwargs): - super(Node, self).__init__(**kwargs) + super().__init__(**kwargs) from aiida.orm import Node as tNode self.tclass = tNode diff --git a/aiida/restapi/translator/nodes/node.py b/aiida/restapi/translator/nodes/node.py index 1bfab6aa2b..b0ea257ac1 100644 --- a/aiida/restapi/translator/nodes/node.py +++ b/aiida/restapi/translator/nodes/node.py @@ -52,7 +52,7 @@ def __init__(self, **kwargs): """ # basic initialization - super(NodeTranslator, self).__init__(**kwargs) + super().__init__(**kwargs) self._default_projections = ['id', 'label', 'node_type', 'process_type', 'ctime', 'mtime', 'uuid', 'user_id'] @@ -204,7 +204,7 @@ def set_query( full_type_filter = get_full_type_filters(full_type) filters.update(full_type_filter) - super(NodeTranslator, self).set_query( + super().set_query( filters=filters, orders=orders, projections=projections, @@ -550,7 +550,7 @@ def get_results(self): if self._content_type is not None: return self._get_content() - return super(NodeTranslator, self).get_results() + return super().get_results() def get_formatted_result(self, label): """ @@ -562,7 +562,7 @@ def get_formatted_result(self, label): :return: a list of the query results """ - results = super(NodeTranslator, self).get_formatted_result(label) + results = super().get_formatted_result(label) if self._result_type == 'with_outgoing': result_name = 'incoming' diff --git a/aiida/schedulers/datastructures.py b/aiida/schedulers/datastructures.py index 402ae80c61..4e1c4a3c0f 100644 --- a/aiida/schedulers/datastructures.py +++ b/aiida/schedulers/datastructures.py @@ -105,7 +105,7 @@ def get_valid_keys(cls): """ Return a list of valid keys to be passed to the __init__ """ - return super(NodeNumberJobResource, cls).get_valid_keys() + ['tot_num_mpiprocs', 'default_mpiprocs_per_machine'] + return super().get_valid_keys() + ['tot_num_mpiprocs', 'default_mpiprocs_per_machine'] @classmethod def accepts_default_mpiprocs_per_machine(cls): @@ -122,7 +122,7 @@ def __init__(self, **kwargs): Should raise only ValueError or TypeError on invalid parameters. """ - super(NodeNumberJobResource, self).__init__() + super().__init__() try: num_machines = int(kwargs.pop('num_machines')) @@ -248,7 +248,7 @@ def __init__(self, **kwargs): computer, since ParEnvJobResource cannot accept this parameter. """ from aiida.common.exceptions import ConfigurationError - super(ParEnvJobResource, self).__init__() + super().__init__() try: self.parallel_env = str(kwargs.pop('parallel_env')) diff --git a/aiida/schedulers/plugins/direct.py b/aiida/schedulers/plugins/direct.py index b81060c90f..d9c484e3e4 100644 --- a/aiida/schedulers/plugins/direct.py +++ b/aiida/schedulers/plugins/direct.py @@ -284,7 +284,7 @@ def get_jobs(self, jobs=None, user=None, as_dict=False): Overrides original method from DirectScheduler in order to list missing processes as DONE. """ - job_stats = super(DirectScheduler, self).get_jobs(jobs=jobs, user=user, as_dict=as_dict) + job_stats = super().get_jobs(jobs=jobs, user=user, as_dict=as_dict) found_jobs = [] # Get the list of known jobs diff --git a/aiida/schedulers/plugins/lsf.py b/aiida/schedulers/plugins/lsf.py index b27b1e12a0..9b5ee6368e 100644 --- a/aiida/schedulers/plugins/lsf.py +++ b/aiida/schedulers/plugins/lsf.py @@ -116,7 +116,7 @@ def __init__(self, **kwargs): computer, since LsfJobResource cannot accept this parameter. """ from aiida.common.exceptions import ConfigurationError - super(LsfJobResource, self).__init__() + super().__init__() try: self.parallel_env = str(kwargs.pop('parallel_env', '')) diff --git a/aiida/schedulers/plugins/pbsbaseclasses.py b/aiida/schedulers/plugins/pbsbaseclasses.py index 1c355ef8d5..ac03bc4426 100644 --- a/aiida/schedulers/plugins/pbsbaseclasses.py +++ b/aiida/schedulers/plugins/pbsbaseclasses.py @@ -87,7 +87,7 @@ def __init__(self, **kwargs): num_cores_per_machine 3. If only num_cores_per_machine is passed, use it """ - super(PbsJobResource, self).__init__(**kwargs) + super().__init__(**kwargs) value_error = ('num_cores_per_machine must be equal to ' 'num_cores_per_mpiproc * num_mpiprocs_per_machine, ' diff --git a/aiida/schedulers/plugins/slurm.py b/aiida/schedulers/plugins/slurm.py index 948e018b1f..71c888e40d 100644 --- a/aiida/schedulers/plugins/slurm.py +++ b/aiida/schedulers/plugins/slurm.py @@ -123,7 +123,7 @@ def __init__(self, *args, **kwargs): num_cores_per_mpiproc which should always be an integer value 3. If only num_cores_per_mpiproc is passed, use it """ - super(SlurmJobResource, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) value_error = ('num_cores_per_machine must be equal to ' 'num_cores_per_mpiproc * num_mpiprocs_per_machine, ' diff --git a/aiida/sphinxext/tests/demo_workchain.py b/aiida/sphinxext/tests/demo_workchain.py index 66ea65080a..75de96b6ce 100644 --- a/aiida/sphinxext/tests/demo_workchain.py +++ b/aiida/sphinxext/tests/demo_workchain.py @@ -23,7 +23,7 @@ class DemoWorkChain(WorkChain): # pylint: disable=abstract-method @classmethod def define(cls, spec): - super(DemoWorkChain, cls).define(spec) + super().define(spec) spec.input('x', valid_type=Float, help='First input argument.') spec.input('y.z', valid_type=Int, help='Input in a separate namespace.') diff --git a/aiida/tools/data/orbital/realhydrogen.py b/aiida/tools/data/orbital/realhydrogen.py index 8ad6b1b5b1..ede67e9cde 100644 --- a/aiida/tools/data/orbital/realhydrogen.py +++ b/aiida/tools/data/orbital/realhydrogen.py @@ -318,7 +318,7 @@ def _validate_keys(self, input_dict): :param input_dict: the dictionary of keys to be validated :return validated_dict: a validated dictionary """ - validated_dict = super(RealhydrogenOrbital, self)._validate_keys(input_dict) + validated_dict = super()._validate_keys(input_dict) # Validate m knowing the value of l angular_momentum = validated_dict['angular_momentum'] # l quantum number, must be there diff --git a/aiida/tools/dbimporters/plugins/cod.py b/aiida/tools/dbimporters/plugins/cod.py index 4e418db7c0..f549bfb54a 100644 --- a/aiida/tools/dbimporters/plugins/cod.py +++ b/aiida/tools/dbimporters/plugins/cod.py @@ -287,7 +287,7 @@ class CodSearchResults(DbSearchResults): _base_url = 'http://www.crystallography.net/cod/' def __init__(self, results): - super(CodSearchResults, self).__init__(results) + super().__init__(results) self._return_class = CodEntry def __len__(self): @@ -333,5 +333,5 @@ def __init__(self, uri, db_name='Crystallography Open Database', :py:class:`aiida.tools.dbimporters.plugins.cod.CodEntry`, related to the supplied URI. """ - super(CodEntry, self).__init__(db_name=db_name, db_uri=db_uri, + super().__init__(db_name=db_name, db_uri=db_uri, uri=uri, **kwargs) diff --git a/aiida/tools/dbimporters/plugins/icsd.py b/aiida/tools/dbimporters/plugins/icsd.py index 4bccce0dbe..344fcd6b10 100644 --- a/aiida/tools/dbimporters/plugins/icsd.py +++ b/aiida/tools/dbimporters/plugins/icsd.py @@ -650,7 +650,7 @@ def __init__(self, uri, **kwargs): """ Create an instance of IcsdEntry, related to the supplied URI. """ - super(IcsdEntry, self).__init__(**kwargs) + super().__init__(**kwargs) self.source = { 'db_name': kwargs.get('db_name','Icsd'), 'db_uri': None, diff --git a/aiida/tools/dbimporters/plugins/materialsproject.py b/aiida/tools/dbimporters/plugins/materialsproject.py index 3d31f8d2ea..f05b0e39e1 100644 --- a/aiida/tools/dbimporters/plugins/materialsproject.py +++ b/aiida/tools/dbimporters/plugins/materialsproject.py @@ -152,7 +152,7 @@ def __init__(self, url, **kwargs): """ cif = kwargs.pop('cif', None) kwargs['uri'] = url - super(MaterialsProjectCifEntry, self).__init__(**kwargs) + super().__init__(**kwargs) if cif is not None: self.cif = cif @@ -173,7 +173,7 @@ class MaterialsProjectSearchResults(DbSearchResults): # pylint: disable=abstrac def __init__(self, results, return_class): self._return_class = return_class - super(MaterialsProjectSearchResults, self).__init__(results) + super().__init__(results) def _get_source_dict(self, result_dict): """ diff --git a/aiida/tools/dbimporters/plugins/mpds.py b/aiida/tools/dbimporters/plugins/mpds.py index b513a292b4..00984b92b1 100644 --- a/aiida/tools/dbimporters/plugins/mpds.py +++ b/aiida/tools/dbimporters/plugins/mpds.py @@ -314,7 +314,7 @@ def __init__(self, url, **kwargs): if license is not None: self._license = license - super(MpdsEntry, self).__init__(**kwargs) + super().__init__(**kwargs) class MpdsCifEntry(CifEntry, MpdsEntry): @@ -331,7 +331,7 @@ def __init__(self, url, **kwargs): """ cif = kwargs.pop('cif', None) kwargs['uri'] = url - super(MpdsCifEntry, self).__init__(url, **kwargs) + super().__init__(url, **kwargs) if cif is not None: self.cif = cif @@ -349,7 +349,7 @@ class MpdsSearchResults(DbSearchResults): def __init__(self, results, return_class=None): if return_class is not None: self._return_class = return_class - super(MpdsSearchResults, self).__init__(results) + super().__init__(results) def _get_source_dict(self, result_dict): """ diff --git a/aiida/tools/dbimporters/plugins/mpod.py b/aiida/tools/dbimporters/plugins/mpod.py index 89cf52a3dc..68582d32cf 100644 --- a/aiida/tools/dbimporters/plugins/mpod.py +++ b/aiida/tools/dbimporters/plugins/mpod.py @@ -131,7 +131,7 @@ class MpodSearchResults(DbSearchResults): _base_url = 'http://mpod.cimav.edu.mx/datafiles/' def __init__(self, results): - super(MpodSearchResults, self).__init__(results) + super().__init__(results) self._return_class = MpodEntry def __len__(self): @@ -166,7 +166,7 @@ def __init__(self, uri, **kwargs): :py:class:`aiida.tools.dbimporters.plugins.mpod.MpodEntry`, related to the supplied URI. """ - super(MpodEntry, self).__init__(db_name='Material Properties Open Database', + super().__init__(db_name='Material Properties Open Database', db_uri='http://mpod.cimav.edu.mx', uri=uri, **kwargs) diff --git a/aiida/tools/dbimporters/plugins/nninc.py b/aiida/tools/dbimporters/plugins/nninc.py index 744ba189a1..68774071d6 100644 --- a/aiida/tools/dbimporters/plugins/nninc.py +++ b/aiida/tools/dbimporters/plugins/nninc.py @@ -120,7 +120,7 @@ class NnincSearchResults(DbSearchResults): _base_url = 'http://nninc.cnf.cornell.edu/psp_files/' def __init__(self, results): - super(NnincSearchResults, self).__init__(results) + super().__init__(results) self._return_class = NnincEntry def __len__(self): @@ -155,7 +155,7 @@ def __init__(self, uri, **kwargs): :py:class:`aiida.tools.dbimporters.plugins.nninc.NnincEntry`, related to the supplied URI. """ - super(NnincEntry, self).__init__(db_name='NNIN/C Pseudopotential Virtual Vault', + super().__init__(db_name='NNIN/C Pseudopotential Virtual Vault', db_uri='http://nninc.cnf.cornell.edu', uri=uri, **kwargs) diff --git a/aiida/tools/dbimporters/plugins/oqmd.py b/aiida/tools/dbimporters/plugins/oqmd.py index acec1a38ba..f3b8eb4a39 100644 --- a/aiida/tools/dbimporters/plugins/oqmd.py +++ b/aiida/tools/dbimporters/plugins/oqmd.py @@ -102,7 +102,7 @@ class OqmdSearchResults(DbSearchResults): _base_url = 'http://oqmd.org/materials/export/conventional/cif/' def __init__(self, results): - super(OqmdSearchResults, self).__init__(results) + super().__init__(results) self._return_class = OqmdEntry def __len__(self): @@ -137,7 +137,7 @@ def __init__(self, uri, **kwargs): :py:class:`aiida.tools.dbimporters.plugins.oqmd.OqmdEntry`, related to the supplied URI. """ - super(OqmdEntry, self).__init__(db_name='Open Quantum Materials Database', + super().__init__(db_name='Open Quantum Materials Database', db_uri='http://oqmd.org', uri=uri, **kwargs) diff --git a/aiida/tools/dbimporters/plugins/pcod.py b/aiida/tools/dbimporters/plugins/pcod.py index 6fa5e1c0dd..7a7595c66c 100644 --- a/aiida/tools/dbimporters/plugins/pcod.py +++ b/aiida/tools/dbimporters/plugins/pcod.py @@ -19,28 +19,28 @@ class PcodDbImporter(CodDbImporter): """ def _int_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._int_clause(*args, **kwargs) + return super()._int_clause(*args, **kwargs) def _composition_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._composition_clause(*args, **kwargs) + return super()._composition_clause(*args, **kwargs) def _formula_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._formula_clause(*args, **kwargs) + return super()._formula_clause(*args, **kwargs) def _volume_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._volume_clause(*args, **kwargs) + return super()._volume_clause(*args, **kwargs) def _str_exact_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._str_exact_clause(*args, **kwargs) + return super()._str_exact_clause(*args, **kwargs) def _length_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._length_clause(*args, **kwargs) + return super()._length_clause(*args, **kwargs) def _angle_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._angle_clause(*args, **kwargs) + return super()._angle_clause(*args, **kwargs) def _str_fuzzy_clause(self, *args, **kwargs): - return super(PcodDbImporter, self)._str_fuzzy_clause(*args, **kwargs) + return super()._str_fuzzy_clause(*args, **kwargs) _keywords = {'id': ['file', _int_clause], 'element': ['element', _composition_clause], @@ -57,7 +57,7 @@ def _str_fuzzy_clause(self, *args, **kwargs): 'text': ['text', _str_fuzzy_clause]} def __init__(self, **kwargs): - super(PcodDbImporter, self).__init__(**kwargs) + super().__init__(**kwargs) self._db_parameters = {'host': 'www.crystallography.net', 'user': 'pcod_reader', 'passwd': '', @@ -120,7 +120,7 @@ class PcodSearchResults(CodSearchResults): _base_url = 'http://www.crystallography.net/pcod/cif/' def __init__(self, results): - super(PcodSearchResults, self).__init__(results) + super().__init__(results) self._return_class = PcodEntry def _get_url(self, result_dict): @@ -149,7 +149,7 @@ def __init__(self, uri, :py:class:`aiida.tools.dbimporters.plugins.pcod.PcodEntry`, related to the supplied URI. """ - super(PcodEntry, self).__init__(db_name=db_name, + super().__init__(db_name=db_name, db_uri=db_uri, uri=uri, **kwargs) diff --git a/aiida/tools/dbimporters/plugins/tcod.py b/aiida/tools/dbimporters/plugins/tcod.py index 8f1dd881b5..70cf74e37e 100644 --- a/aiida/tools/dbimporters/plugins/tcod.py +++ b/aiida/tools/dbimporters/plugins/tcod.py @@ -17,7 +17,7 @@ class TcodDbImporter(CodDbImporter): """ def __init__(self, **kwargs): - super(TcodDbImporter, self).__init__(**kwargs) + super().__init__(**kwargs) self._db_parameters = {'host': 'www.crystallography.net', 'user': 'cod_reader', 'passwd': '', 'db': 'tcod'} self.setup_db(**kwargs) @@ -53,7 +53,7 @@ class TcodSearchResults(CodSearchResults): _base_url = 'http://www.crystallography.net/tcod/' def __init__(self, results): - super(TcodSearchResults, self).__init__(results) + super().__init__(results) self._return_class = TcodEntry @@ -78,4 +78,4 @@ def __init__( :py:class:`aiida.tools.dbimporters.plugins.tcod.TcodEntry`, related to the supplied URI. """ - super(TcodEntry, self).__init__(db_name=db_name, db_uri=db_uri, uri=uri, **kwargs) + super().__init__(db_name=db_name, db_uri=db_uri, uri=uri, **kwargs) diff --git a/aiida/tools/importexport/common/utils.py b/aiida/tools/importexport/common/utils.py index 4b07db7e2b..3a2453b4cf 100644 --- a/aiida/tools/importexport/common/utils.py +++ b/aiida/tools/importexport/common/utils.py @@ -61,7 +61,7 @@ class HTMLGetLinksParser(HTMLParser): def __init__(self, filter_extension=None): # pylint: disable=super-on-old-class self.filter_extension = filter_extension self.links = [] - super(HTMLGetLinksParser, self).__init__() + super().__init__() def handle_starttag(self, tag, attrs): """ diff --git a/aiida/transports/plugins/local.py b/aiida/transports/plugins/local.py index d5e5bea54c..8d752f8b0f 100644 --- a/aiida/transports/plugins/local.py +++ b/aiida/transports/plugins/local.py @@ -50,7 +50,7 @@ class LocalTransport(Transport): _DEFAULT_SAFE_OPEN_INTERVAL = 0.0 def __init__(self, *args, **kwargs): - super(LocalTransport, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # The `_internal_dir` will emulate the concept of working directory, as the real current working directory is # not to be changed to prevent bug-prone situations self._internal_dir = None diff --git a/aiida/transports/plugins/ssh.py b/aiida/transports/plugins/ssh.py index c416a4c9f2..4759d9e9f6 100644 --- a/aiida/transports/plugins/ssh.py +++ b/aiida/transports/plugins/ssh.py @@ -258,7 +258,7 @@ def __init__(self, *args, **kwargs): accepted paramiko.SSHClient.connect() params. """ import paramiko - super(SshTransport, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._sftp = None self._proxy = None diff --git a/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_external_computation.py b/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_external_computation.py index 2bc7108f16..fd968c4423 100644 --- a/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_external_computation.py +++ b/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_external_computation.py @@ -13,7 +13,7 @@ class AddAndMultiplyWorkChain(WorkChain): @classmethod def define(cls, spec): - super(AddAndMultiplyWorkChain, cls).define(spec) + super().define(spec) spec.input('x') spec.input('y') spec.input('z') diff --git a/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_outline_computation.py b/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_outline_computation.py index 7c1d298a49..af5ddadb90 100644 --- a/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_outline_computation.py +++ b/docs/source/concepts/include/snippets/workflows/workchains/add_multiply_workchain_outline_computation.py @@ -6,7 +6,7 @@ class AddAndMultiplyWorkChain(WorkChain): @classmethod def define(cls, spec): - super(AddAndMultiplyWorkChain, cls).define(spec) + super().define(spec) spec.input('x') spec.input('y') spec.input('z') diff --git a/docs/source/developer_guide/core/extend_restapi.rst b/docs/source/developer_guide/core/extend_restapi.rst index d2bdd31efc..05b8d3f9f4 100644 --- a/docs/source/developer_guide/core/extend_restapi.rst +++ b/docs/source/developer_guide/core/extend_restapi.rst @@ -85,7 +85,7 @@ Let's assume you've put the code in the file ``example.py``, reading: This init serves to add new endpoints to the basic AiiDA Api """ - super(NewApi, self).__init__(app=app, **kwargs) + super().__init__(app=app, **kwargs) self.add_resource(NewResource, '/new-endpoint/', strict_slashes=False) @@ -216,7 +216,7 @@ This is done in the ``__init__()`` of ``NewApi`` by means of the method ``add_re This init serves to add new endpoints to the basic AiiDA Api """ - super(NewApi, self).__init__(app=app, **kwargs) + super().__init__(app=app, **kwargs) self.add_resource(NewResource, '/new-endpoint/', strict_slashes=False) @@ -230,7 +230,7 @@ In fact, the general form of ``__init__()`` is meant to be: def __init__(self, app=None, **kwargs): - super(NewApi, self.__init__(app=app, *kwargs)) + super()) self.add_resource( ... ) self.add_resource( ... ) diff --git a/docs/source/working/calculations.rst b/docs/source/working/calculations.rst index 9de8b8e997..2e198e4535 100644 --- a/docs/source/working/calculations.rst +++ b/docs/source/working/calculations.rst @@ -89,7 +89,7 @@ As the snippet above demonstrates, the class method takes two arguments: * ``spec`` which is the 'specification' .. warning:: - Do not forget to add the line ``super(ArithmeticAddCalculation, self).define(spec)`` as the first line of the ``define`` method, where you replace the class name with the name of your calculation job. + Do not forget to add the line ``super().define(spec)`` as the first line of the ``define`` method, where you replace the class name with the name of your calculation job. This will call the ``define`` method of the parent class, which is necessary for the calculation job to work properly As the name suggests, the ``spec`` can be used to specify the properties of the calculation job. diff --git a/docs/source/working/data.rst b/docs/source/working/data.rst index 77179c7590..31c542550f 100644 --- a/docs/source/working/data.rst +++ b/docs/source/working/data.rst @@ -46,7 +46,7 @@ Therefore, we have to override the constructor :meth:`~aiida.orm.nodes.node.Node def __init__(self, **kwargs) value = kwargs.pop('value') - super(NewData, self).__init__(**kwargs) + super().__init__(**kwargs) self.set_attribute('value', value) .. warning:: @@ -123,7 +123,7 @@ Imagine a data type that needs to wrap a single text file. :param file: an absolute filepath of the file to wrap """ - super(TextFileData, self).__init__(**kwargs) + super().__init__(**kwargs) filename = os.path.basename(filepath) # Get the filename from the absolute path self.put_object_from_file(filepath, filename) # Store the file in the repository under the given filename diff --git a/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_inputs.py b/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_inputs.py index b284150430..363bcd99e6 100644 --- a/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_inputs.py +++ b/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_inputs.py @@ -5,6 +5,6 @@ class ArithmeticAddCalculation(CalcJob): @classmethod def define(cls, spec): - super(ArithmeticAddCalculation, cls).define(spec) + super().define(spec) spec.input('x', valid_type=orm.Int, help='The left operand.') spec.input('y', valid_type=orm.Int, help='The right operand.') diff --git a/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_outputs.py b/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_outputs.py index ff29469487..73072ca3dc 100644 --- a/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_outputs.py +++ b/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_outputs.py @@ -5,7 +5,7 @@ class ArithmeticAddCalculation(CalcJob): @classmethod def define(cls, spec): - super(ArithmeticAddCalculation, cls).define(spec) + super().define(spec) spec.input('x', valid_type=orm.Int, help='The left operand.') spec.input('y', valid_type=orm.Int, help='The right operand.') spec.output('sum', valid_type=orm.Int, help='The sum of the left and right operand.') diff --git a/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_prepare_for_submission.py b/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_prepare_for_submission.py index ca752992f7..e7c727da46 100644 --- a/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_prepare_for_submission.py +++ b/docs/source/working/include/snippets/calculations/calcjobs/arithmetic_add_spec_prepare_for_submission.py @@ -6,7 +6,7 @@ class ArithmeticAddCalculation(CalcJob): @classmethod def define(cls, spec): - super(ArithmeticAddCalculation, cls).define(spec) + super().define(spec) spec.input('x', valid_type=orm.Int, help='The left operand.') spec.input('y', valid_type=orm.Int, help='The right operand.') spec.output('sum', valid_type=orm.Int, help='The sum of the left and right operand.') diff --git a/docs/source/working/include/snippets/workflows/expose_inputs/child.py b/docs/source/working/include/snippets/workflows/expose_inputs/child.py index 06deb3ca8d..d0732330dc 100644 --- a/docs/source/working/include/snippets/workflows/expose_inputs/child.py +++ b/docs/source/working/include/snippets/workflows/expose_inputs/child.py @@ -7,7 +7,7 @@ class ChildWorkChain(WorkChain): @classmethod def define(cls, spec): - super(ChildWorkChain, cls).define(spec) + super().define(spec) spec.input('a', valid_type=Int) spec.input('b', valid_type=Float) spec.input('c', valid_type=Bool) diff --git a/docs/source/working/include/snippets/workflows/expose_inputs/complex_parent.py b/docs/source/working/include/snippets/workflows/expose_inputs/complex_parent.py index f818d8a902..819bb2d489 100644 --- a/docs/source/working/include/snippets/workflows/expose_inputs/complex_parent.py +++ b/docs/source/working/include/snippets/workflows/expose_inputs/complex_parent.py @@ -6,7 +6,7 @@ class ComplexParentWorkChain(WorkChain): @classmethod def define(cls, spec): - super(ComplexParentWorkChain, cls).define(spec) + super().define(spec) spec.expose_inputs(ChildWorkChain, include=['a']) spec.expose_inputs(ChildWorkChain, namespace='child_1', exclude=['a']) spec.expose_inputs(ChildWorkChain, namespace='child_2', exclude=['a']) diff --git a/docs/source/working/include/snippets/workflows/expose_inputs/simple_parent.py b/docs/source/working/include/snippets/workflows/expose_inputs/simple_parent.py index 302ebb9966..5b2ab24ea1 100644 --- a/docs/source/working/include/snippets/workflows/expose_inputs/simple_parent.py +++ b/docs/source/working/include/snippets/workflows/expose_inputs/simple_parent.py @@ -7,7 +7,7 @@ class SimpleParentWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SimpleParentWorkChain, cls).define(spec) + super().define(spec) spec.expose_inputs(ChildWorkChain) spec.expose_outputs(ChildWorkChain) spec.outline(cls.run_child, cls.finalize) diff --git a/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_append.py b/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_append.py index b1fe7378ec..188e482883 100644 --- a/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_append.py +++ b/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_append.py @@ -5,7 +5,7 @@ class SomeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SomeWorkChain, cls).define(spec) + super().define(spec) spec.outline( cls.submit_workchains, cls.inspect_workchains, diff --git a/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_complete.py b/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_complete.py index 96a5db0d87..e8a219157b 100644 --- a/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_complete.py +++ b/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_complete.py @@ -5,7 +5,7 @@ class SomeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SomeWorkChain, cls).define(spec) + super().define(spec) spec.outline( cls.submit_workchain, cls.inspect_workchain, diff --git a/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_parallel.py b/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_parallel.py index 5ecb1da9bf..61d2c9cb55 100644 --- a/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_parallel.py +++ b/docs/source/working/include/snippets/workflows/workchains/run_workchain_submit_parallel.py @@ -5,7 +5,7 @@ class SomeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SomeWorkChain, cls).define(spec) + super().define(spec) spec.outline( cls.submit_workchains, cls.inspect_workchains, diff --git a/docs/source/working/include/snippets/workflows/workchains/workchain_serialize.py b/docs/source/working/include/snippets/workflows/workchains/workchain_serialize.py index e3ee05ca25..c8ce2b81dd 100644 --- a/docs/source/working/include/snippets/workflows/workchains/workchain_serialize.py +++ b/docs/source/working/include/snippets/workflows/workchains/workchain_serialize.py @@ -10,7 +10,7 @@ class SerializeWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SerializeWorkChain, cls).define(spec) + super().define(spec) spec.input('a', serializer=to_aiida_type) spec.input('b', serializer=to_aiida_type) diff --git a/docs/source/working/workflows.rst b/docs/source/working/workflows.rst index eab394c076..4f7166e530 100644 --- a/docs/source/working/workflows.rst +++ b/docs/source/working/workflows.rst @@ -160,7 +160,7 @@ To implement the ``define`` method, you have to start with the following three l @classmethod def define(cls, spec): - super(AddAndMultiplyWorkChain, cls).define(spec) + super().define(spec) where you replace ``AddAndMultiplyWorkChain`` with the actual name of your work chain. The ``@classmethod`` decorator indicates that this method is a class method [#f1]_ and not an instance method. diff --git a/examples/work/workchain.py b/examples/work/workchain.py index 997364a3a9..6894ef3876 100755 --- a/examples/work/workchain.py +++ b/examples/work/workchain.py @@ -21,7 +21,7 @@ class SumWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SumWorkChain, cls).define(spec) + super().define(spec) spec.input('a', valid_type=NumericType) spec.input('b', valid_type=NumericType) spec.outline( @@ -37,7 +37,7 @@ class ProductWorkChain(WorkChain): @classmethod def define(cls, spec): - super(ProductWorkChain, cls).define(spec) + super().define(spec) spec.input('a', valid_type=NumericType) spec.input('b', valid_type=NumericType) spec.outline( @@ -53,7 +53,7 @@ class SumProductWorkChain(WorkChain): @classmethod def define(cls, spec): - super(SumProductWorkChain, cls).define(spec) + super().define(spec) spec.input('a', valid_type=NumericType) spec.input('b', valid_type=NumericType) spec.input('c', valid_type=NumericType) diff --git a/examples/work/workchain_outline.py b/examples/work/workchain_outline.py index e8462d9e08..d82a6cca43 100755 --- a/examples/work/workchain_outline.py +++ b/examples/work/workchain_outline.py @@ -21,7 +21,7 @@ class OutlineWorkChain(WorkChain): @classmethod def define(cls, spec): - super(OutlineWorkChain, cls).define(spec) + super().define(spec) spec.input('a', valid_type=Int) spec.outline( cls.setup, diff --git a/utils/plugin_tpl/calculation.tpl b/utils/plugin_tpl/calculation.tpl index c39676de17..5cab031e0f 100644 --- a/utils/plugin_tpl/calculation.tpl +++ b/utils/plugin_tpl/calculation.tpl @@ -10,7 +10,7 @@ class {{classname}}(JobCalculation): def _init_internal_params(self): """Initialize internal parameters""" - super({{classname}}, self)._init_internal_params() + super()._init_internal_params() self._INPUT_FILE_NAME = '{{ifilename}}' self._OUTPUT_FILE_NAME = '{{ofilename}}' @@ -38,7 +38,7 @@ class {{classname}}(JobCalculation): 'docstring': } ''' - retdict = super({{classname}}, self)._use_methods + retdict = super()._use_methods retdict.update({ {% for item in inputs %} '{{item.name}}: {