diff --git a/.pylintrc b/.pylintrc index 6f8436f030..1c11f0da54 100644 --- a/.pylintrc +++ b/.pylintrc @@ -50,7 +50,7 @@ confidence= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=bad-continuation,locally-disabled,useless-suppression,django-not-available +disable=bad-continuation,locally-disabled,useless-suppression,django-not-available,bad-option-value # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/aiida/backends/djsite/db/migrations/0020_provenance_redesign.py b/aiida/backends/djsite/db/migrations/0020_provenance_redesign.py index e4fb24a806..54f6d62376 100644 --- a/aiida/backends/djsite/db/migrations/0020_provenance_redesign.py +++ b/aiida/backends/djsite/db/migrations/0020_provenance_redesign.py @@ -75,7 +75,6 @@ def detect_unexpected_links(apps, schema_editor): def reverse_code(apps, schema_editor): """Reversing the inference of the process type is not possible and not necessary.""" - pass class Migration(migrations.Migration): diff --git a/aiida/backends/djsite/utils.py b/aiida/backends/djsite/utils.py index 6fb31963fd..63d15e5740 100644 --- a/aiida/backends/djsite/utils.py +++ b/aiida/backends/djsite/utils.py @@ -75,6 +75,7 @@ def check_schema_version(profile_name=None): :raise ConfigurationError: if the two schema versions do not match. Otherwise, just return. """ + # pylint: disable=duplicate-string-formatting-argument from django.db import connection import aiida.backends.djsite.db.models diff --git a/aiida/backends/tests/common/test_hashing.py b/aiida/backends/tests/common/test_hashing.py index 3ac5ec80c3..7510717097 100644 --- a/aiida/backends/tests/common/test_hashing.py +++ b/aiida/backends/tests/common/test_hashing.py @@ -193,7 +193,7 @@ def test_numpy_arrays(self): def test_unhashable_type(self): - class MadeupClass(object): + class MadeupClass(object): # pylint: disable=useless-object-inheritance pass with self.assertRaises(ValueError): diff --git a/aiida/backends/tests/orm/node/test_node.py b/aiida/backends/tests/orm/node/test_node.py index fcac2c39ff..810c5d4103 100644 --- a/aiida/backends/tests/orm/node/test_node.py +++ b/aiida/backends/tests/orm/node/test_node.py @@ -213,7 +213,7 @@ def test_node_indegree_unique_pair(self): called.add_incoming(data, link_type=LinkType.INPUT_CALC, link_label='call') called.store() - uuids_incoming = set([node.uuid for node in called.get_incoming().all_nodes()]) + uuids_incoming = set(node.uuid for node in called.get_incoming().all_nodes()) uuids_expected = set([caller.uuid, data.uuid]) self.assertEqual(uuids_incoming, uuids_expected) @@ -232,7 +232,7 @@ def test_node_indegree_unique_triple(self): data.add_incoming(return_two, link_type=LinkType.RETURN, link_label='return') data.store() - uuids_incoming = set([node.uuid for node in data.get_incoming().all_nodes()]) + uuids_incoming = set(node.uuid for node in data.get_incoming().all_nodes()) uuids_expected = set([return_one.uuid, return_two.uuid]) self.assertEqual(uuids_incoming, uuids_expected) @@ -253,6 +253,6 @@ def test_node_outdegree_unique_triple(self): data_one.store() data_two.store() - uuids_outgoing = set([node.uuid for node in creator.get_outgoing().all_nodes()]) + uuids_outgoing = set(node.uuid for node in creator.get_outgoing().all_nodes()) uuids_expected = set([data_one.uuid, data_two.uuid]) self.assertEqual(uuids_outgoing, uuids_expected) diff --git a/aiida/backends/tests/restapi.py b/aiida/backends/tests/restapi.py index 6b6e1cb469..9d0f44bed0 100644 --- a/aiida/backends/tests/restapi.py +++ b/aiida/backends/tests/restapi.py @@ -612,7 +612,6 @@ def test_computers_orderby_mixed3(self): -hostname", expected_list_ids=[1,0,4,3,2]) """ - pass ############### list filter combinations ####################### def test_computers_filter_mixed1(self): @@ -675,7 +674,6 @@ def test_computers_unknown_param(self): from aiida.common.exceptions import InputValidationError RESTApiTestCase.node_exception(self, "/computers?aa=bb&id=2", InputValidationError) """ - pass ############### single calculation ######################## def test_calculations_details(self): diff --git a/aiida/calculations/plugins/arithmetic/add.py b/aiida/calculations/plugins/arithmetic/add.py index 5d00afdea2..c4eac729dc 100644 --- a/aiida/calculations/plugins/arithmetic/add.py +++ b/aiida/calculations/plugins/arithmetic/add.py @@ -66,7 +66,7 @@ def _use_methods(cls): def _get_input_valid_types(self, key): """Return the valid input types for the given key.""" - return self._use_methods[key]['valid_types'] + return self._use_methods[key]['valid_types'] # pylint: disable=unsubscriptable-object def _get_input_valid_type(self, key): """Return the valid input type for the given key.""" diff --git a/aiida/calculations/plugins/templatereplacer.py b/aiida/calculations/plugins/templatereplacer.py index 7b89ef80f2..121006e753 100644 --- a/aiida/calculations/plugins/templatereplacer.py +++ b/aiida/calculations/plugins/templatereplacer.py @@ -94,7 +94,7 @@ def _prepare_for_submission(self, tempfolder, inputdict): :param inputdict: a dictionary with the input nodes e.g. {label1: node1, ...} (with the Code!) """ # pylint: disable=too-many-locals,too-many-statements,too-many-branches - from six.moves import StringIO as StringIO + from six.moves import StringIO from aiida.orm.data.singlefile import SinglefileData from aiida.orm.data.remote import RemoteData diff --git a/aiida/cmdline/commands/cmd_calcjob.py b/aiida/cmdline/commands/cmd_calcjob.py index 7b0673cb93..5d842fbeaa 100644 --- a/aiida/cmdline/commands/cmd_calcjob.py +++ b/aiida/cmdline/commands/cmd_calcjob.py @@ -25,7 +25,6 @@ @verdi.group('calcjob') def verdi_calcjob(): """Inspect and manage calcjobs.""" - pass @verdi_calcjob.command('gotocomputer') diff --git a/aiida/cmdline/commands/cmd_calculation.py b/aiida/cmdline/commands/cmd_calculation.py index bd9d2a0326..8cbee9ae96 100644 --- a/aiida/cmdline/commands/cmd_calculation.py +++ b/aiida/cmdline/commands/cmd_calculation.py @@ -31,7 +31,6 @@ @verdi.group('calculation') def verdi_calculation(): """Inspect and manage calculations.""" - pass @verdi_calculation.command('gotocomputer') diff --git a/aiida/cmdline/commands/cmd_code.py b/aiida/cmdline/commands/cmd_code.py index 986c22668a..c8b6f655cb 100644 --- a/aiida/cmdline/commands/cmd_code.py +++ b/aiida/cmdline/commands/cmd_code.py @@ -27,7 +27,6 @@ @verdi.group('code') def verdi_code(): """Setup and manage codes.""" - pass def get_default(key, ctx): @@ -215,7 +214,6 @@ def reveal(codes): # pylint: disable=unused-argument def update(code): """Update an existing code.""" - pass @verdi_code.command() diff --git a/aiida/cmdline/commands/cmd_comment.py b/aiida/cmdline/commands/cmd_comment.py index 55a99a2751..8f9c0e2a81 100644 --- a/aiida/cmdline/commands/cmd_comment.py +++ b/aiida/cmdline/commands/cmd_comment.py @@ -23,7 +23,6 @@ @verdi.group('comment') def verdi_comment(): """Inspect, create and manage node comments.""" - pass @verdi_comment.command() @@ -76,7 +75,7 @@ def show(user, nodes): comments = [comment for comment in all_comments if comment.user.email == user.email] if not comments: - valid_users = ', '.join(set([comment.user.email for comment in all_comments])) + valid_users = ', '.join(set(comment.user.email for comment in all_comments)) echo.echo_warning('no comments found for user {}'.format(user)) echo.echo_info('valid users found for Node<{}>: {}'.format(node.pk, valid_users)) diff --git a/aiida/cmdline/commands/cmd_computer.py b/aiida/cmdline/commands/cmd_computer.py index 7410198062..34a0c2689b 100644 --- a/aiida/cmdline/commands/cmd_computer.py +++ b/aiida/cmdline/commands/cmd_computer.py @@ -33,7 +33,6 @@ @verdi.group('computer') def verdi_computer(): """Setup and manage computers.""" - pass def get_computer_names(): @@ -161,8 +160,8 @@ def _computer_create_temp_file(transport, scheduler, authinfo): # pylint: disab if not transport.path_exists(remote_file_path): echo.echo_error("* ERROR! The file was not found!") return False - else: - echo.echo(" [OK]") + + echo.echo(" [OK]") echo.echo(" `-> Retrieving the file and checking its content...") handle, destfile = tempfile.mkstemp() @@ -179,8 +178,8 @@ def _computer_create_temp_file(transport, scheduler, authinfo): # pylint: disab echo.echo("** Found:") echo.echo(read_string) return False - else: - echo.echo(" [Content OK]") + + echo.echo(" [Content OK]") finally: os.remove(destfile) @@ -621,7 +620,6 @@ def computer_delete(computer): @verdi_computer.group('configure') def computer_configure(): """Configure a computer with one of the available transport types.""" - pass @computer_configure.command('show') diff --git a/aiida/cmdline/commands/cmd_daemon.py b/aiida/cmdline/commands/cmd_daemon.py index 1bb504c5e6..acce9ea2e5 100644 --- a/aiida/cmdline/commands/cmd_daemon.py +++ b/aiida/cmdline/commands/cmd_daemon.py @@ -29,7 +29,6 @@ @verdi.group('daemon') def verdi_daemon(): """Inspect and manage the daemon.""" - pass @verdi_daemon.command() diff --git a/aiida/cmdline/commands/cmd_data/__init__.py b/aiida/cmdline/commands/cmd_data/__init__.py index 36fc238e33..77c8be76a1 100644 --- a/aiida/cmdline/commands/cmd_data/__init__.py +++ b/aiida/cmdline/commands/cmd_data/__init__.py @@ -15,14 +15,13 @@ from aiida.cmdline.commands.cmd_verdi import verdi from aiida.cmdline.commands.cmd_plugin import verdi_plugin -from aiida.cmdline.utils import decorators, echo +from aiida.cmdline.utils import decorators from aiida.cmdline.utils.pluginable import Pluginable @verdi.group('data', entry_point_group='aiida.cmdline.data', cls=Pluginable) def verdi_data(): """Inspect, create and manage data nodes.""" - pass @verdi_data.command('plugins') diff --git a/aiida/cmdline/commands/cmd_data/cmd_array.py b/aiida/cmdline/commands/cmd_data/cmd_array.py index 0c90761f89..142b48061a 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_array.py +++ b/aiida/cmdline/commands/cmd_data/cmd_array.py @@ -19,7 +19,6 @@ @verdi_data.group('array') def array(): """Manipulate ArrayData objects.""" - pass @array.command('show') diff --git a/aiida/cmdline/commands/cmd_data/cmd_bands.py b/aiida/cmdline/commands/cmd_data/cmd_bands.py index e251d3b7b3..70c3bd6a4f 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_bands.py +++ b/aiida/cmdline/commands/cmd_data/cmd_bands.py @@ -34,7 +34,6 @@ @verdi_data.group('bands') def bands(): """Manipulate BandsData objects.""" - pass # pylint: disable=too-many-arguments diff --git a/aiida/cmdline/commands/cmd_data/cmd_cif.py b/aiida/cmdline/commands/cmd_data/cmd_cif.py index bd3db07f59..777298e9c7 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_cif.py +++ b/aiida/cmdline/commands/cmd_data/cmd_cif.py @@ -31,7 +31,6 @@ @verdi_data.group('cif') def cif(): """Manipulation of CIF data objects.""" - pass @cif.command('list') diff --git a/aiida/cmdline/commands/cmd_data/cmd_parameter.py b/aiida/cmdline/commands/cmd_data/cmd_parameter.py index b905f5022c..2007c433f2 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_parameter.py +++ b/aiida/cmdline/commands/cmd_data/cmd_parameter.py @@ -19,7 +19,6 @@ @verdi_data.group('parameter') def parameter(): """View and manipulate ParameterData objects.""" - pass @parameter.command('show') diff --git a/aiida/cmdline/commands/cmd_data/cmd_remote.py b/aiida/cmdline/commands/cmd_data/cmd_remote.py index 065d83222a..6cb205f564 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_remote.py +++ b/aiida/cmdline/commands/cmd_data/cmd_remote.py @@ -24,7 +24,6 @@ @verdi_data.group('remote') def remote(): """Managing RemoteData objects.""" - pass @remote.command('ls') diff --git a/aiida/cmdline/commands/cmd_data/cmd_show.py b/aiida/cmdline/commands/cmd_data/cmd_show.py index 682ef721e6..57e9142c89 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_show.py +++ b/aiida/cmdline/commands/cmd_data/cmd_show.py @@ -132,7 +132,7 @@ def _show_ase(exec_name, structure_list): from ase.visualize import view for structure in structure_list: view(structure.get_ase()) - except ImportError: + except ImportError: # pylint: disable=try-except-raise raise diff --git a/aiida/cmdline/commands/cmd_data/cmd_structure.py b/aiida/cmdline/commands/cmd_data/cmd_structure.py index da2b4a1901..e764c564c9 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_structure.py +++ b/aiida/cmdline/commands/cmd_data/cmd_structure.py @@ -32,7 +32,6 @@ @verdi_data.group('structure') def structure(): """Manipulation of StructureData objects.""" - pass # pylint: disable=too-many-locals,too-many-branches diff --git a/aiida/cmdline/commands/cmd_data/cmd_trajectory.py b/aiida/cmdline/commands/cmd_data/cmd_trajectory.py index 0b682c3eca..0cbeedc44d 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_trajectory.py +++ b/aiida/cmdline/commands/cmd_data/cmd_trajectory.py @@ -32,7 +32,6 @@ @verdi_data.group('trajectory') def trajectory(): """View and manipulate TrajectoryData instances.""" - pass @trajectory.command('list') diff --git a/aiida/cmdline/commands/cmd_data/cmd_upf.py b/aiida/cmdline/commands/cmd_data/cmd_upf.py index 3f91d4881b..ee72617d3d 100644 --- a/aiida/cmdline/commands/cmd_data/cmd_upf.py +++ b/aiida/cmdline/commands/cmd_data/cmd_upf.py @@ -23,7 +23,6 @@ @verdi_data.group('upf') def upf(): """Manipulation of the upf families.""" - pass @upf.command('uploadfamily') diff --git a/aiida/cmdline/commands/cmd_database.py b/aiida/cmdline/commands/cmd_database.py index 2bc1c707d6..dcc74a1ed2 100644 --- a/aiida/cmdline/commands/cmd_database.py +++ b/aiida/cmdline/commands/cmd_database.py @@ -22,7 +22,6 @@ @verdi.group('database') def verdi_database(): """Inspect and manage the database.""" - pass @verdi_database.command('migrate') @@ -48,7 +47,6 @@ def database_migrate(force): @verdi_database.group('integrity') def verdi_database_integrity(): """Various commands that will check the integrity of the database and fix potential issues when asked.""" - pass @verdi_database_integrity.command('detect-duplicate-node-uuid') diff --git a/aiida/cmdline/commands/cmd_devel.py b/aiida/cmdline/commands/cmd_devel.py index d488710b4d..6a1677e308 100644 --- a/aiida/cmdline/commands/cmd_devel.py +++ b/aiida/cmdline/commands/cmd_devel.py @@ -23,7 +23,6 @@ @verdi.group('devel') def verdi_devel(): """Commands for developers.""" - pass def get_valid_test_paths(): @@ -156,7 +155,7 @@ def devel_tests(paths, verbose): # pylint: disable=too-many-locals,too-many-sta echo.echo('* Tests skipped: {}'.format(len(test_skipped))) if test_skipped: echo.echo(' Reasons for skipping:') - for reason in sorted(set([_[1] for _ in test_skipped])): + for reason in sorted(set(_[1] for _ in test_skipped)): echo.echo(' - {}'.format(reason)) echo.echo('* Tests run: {}'.format(tot_num_tests)) diff --git a/aiida/cmdline/commands/cmd_export.py b/aiida/cmdline/commands/cmd_export.py index 0cfa4901fd..2b4c031f4b 100644 --- a/aiida/cmdline/commands/cmd_export.py +++ b/aiida/cmdline/commands/cmd_export.py @@ -29,7 +29,6 @@ @verdi.group('export') def verdi_export(): """Create and manage export archives.""" - pass @verdi_export.command('inspect') @@ -202,7 +201,7 @@ def migrate(input_file, output_file, force, silent, archive_format): with io.open(folder.get_abs_path('metadata.json'), 'wb') as fhandle: json.dump(metadata, fhandle) - if archive_format == 'zip' or archive_format == 'zip-uncompressed': + if archive_format in ['zip', 'zip-uncompressed']: compression = zipfile.ZIP_DEFLATED if archive_format == 'zip' else zipfile.ZIP_STORED with zipfile.ZipFile(output_file, mode='w', compression=compression, allowZip64=True) as archive: src = folder.abspath @@ -280,7 +279,7 @@ def migrate_v1_to_v2(metadata, data): try: verify_metadata_version(metadata, old_version) update_metadata(metadata, new_version) - except ValueError: + except ValueError: # pylint: disable=try-except-raise raise def get_new_string(old_string): @@ -364,7 +363,7 @@ class NodeType(enum.Enum): # pylint: disable=too-few-public-methods try: verify_metadata_version(metadata, old_version) update_metadata(metadata, new_version) - except ValueError: + except ValueError: # pylint: disable=try-except-raise raise # Create a mapping from node uuid to node type @@ -407,15 +406,13 @@ class NodeType(enum.Enum): # pylint: disable=too-few-public-methods # (CALC) -> (DATA) : CREATE # (WORK) -> (DATA) : RETURN # (WORK) -> (CALC, WORK) : CALL - if (input_type == NodeType.CODE or input_type == NodeType.DATA) \ - and (output_type == NodeType.CALC or output_type == NodeType.WORK): + if input_type in [NodeType.CODE, NodeType.DATA] and output_type in [NodeType.CALC, NodeType.WORK]: link['type'] = LinkType.INPUT.value elif input_type == NodeType.CALC and output_type == NodeType.DATA: link['type'] = LinkType.CREATE.value elif input_type == NodeType.WORK and output_type == NodeType.DATA: link['type'] = LinkType.RETURN.value - elif input_type == NodeType.WORK \ - and (output_type == NodeType.CALC or output_type == NodeType.WORK): + elif input_type == NodeType.WORK and output_type in [NodeType.CALC, NodeType.WORK]: link['type'] = LinkType.CALL.value else: link['type'] = LinkType.UNSPECIFIED.value diff --git a/aiida/cmdline/commands/cmd_graph.py b/aiida/cmdline/commands/cmd_graph.py index aeb0560803..55f7dfd6f8 100644 --- a/aiida/cmdline/commands/cmd_graph.py +++ b/aiida/cmdline/commands/cmd_graph.py @@ -24,7 +24,6 @@ def verdi_graph(): Create visual representations of part of the provenance graph. Requires that `graphviz` be installed. """ - pass @verdi_graph.command('generate') diff --git a/aiida/cmdline/commands/cmd_group.py b/aiida/cmdline/commands/cmd_group.py index 052af6b864..3067d6395f 100644 --- a/aiida/cmdline/commands/cmd_group.py +++ b/aiida/cmdline/commands/cmd_group.py @@ -25,7 +25,6 @@ @verdi.group('group') def verdi_group(): """Inspect, create and manage groups.""" - pass @verdi_group.command("removenodes") @@ -332,9 +331,5 @@ def group_copy(source_group, destination_group): dest_group = orm.Group.objects.get_or_create( label=destination_group, type_string=GroupTypeString(source_group.type_string))[0] - try: - dest_group.add_nodes(source_group.nodes) - echo.echo_success("Nodes were succesfully copied from the group <{}> to the group " - "<{}>".format(source_group, destination_group)) - except: - raise + dest_group.add_nodes(source_group.nodes) + echo.echo_success("Nodes copied from group<{}> to group<{}>".format(source_group, destination_group)) diff --git a/aiida/cmdline/commands/cmd_node.py b/aiida/cmdline/commands/cmd_node.py index b8ac01dbdb..38e5d6e8d8 100644 --- a/aiida/cmdline/commands/cmd_node.py +++ b/aiida/cmdline/commands/cmd_node.py @@ -23,7 +23,6 @@ @verdi.group('node') def verdi_node(): """Inspect, create and manage nodes.""" - pass @verdi_node.group('repo') @@ -185,7 +184,7 @@ def tree(nodes, depth): echo.echo("") -class NodeTreePrinter(object): +class NodeTreePrinter(object): # pylint: disable=useless-object-inheritance """Utility functions for printing node trees.""" @classmethod diff --git a/aiida/cmdline/commands/cmd_plugin.py b/aiida/cmdline/commands/cmd_plugin.py index c8c6cb4b7b..7f43060c7f 100644 --- a/aiida/cmdline/commands/cmd_plugin.py +++ b/aiida/cmdline/commands/cmd_plugin.py @@ -21,7 +21,6 @@ @verdi.group('plugin') def verdi_plugin(): """Inspect installed plugins for various entry point categories.""" - pass @verdi_plugin.command('list') diff --git a/aiida/cmdline/commands/cmd_process.py b/aiida/cmdline/commands/cmd_process.py index 3d9c1f0c66..fad9bdb275 100644 --- a/aiida/cmdline/commands/cmd_process.py +++ b/aiida/cmdline/commands/cmd_process.py @@ -24,7 +24,6 @@ @verdi.group('process') def verdi_process(): """Inspect and manage processes.""" - pass @verdi_process.command('list') diff --git a/aiida/cmdline/commands/cmd_profile.py b/aiida/cmdline/commands/cmd_profile.py index 74a06a87d7..1936f9f565 100644 --- a/aiida/cmdline/commands/cmd_profile.py +++ b/aiida/cmdline/commands/cmd_profile.py @@ -26,7 +26,6 @@ @verdi.group('profile') def verdi_profile(): """Inspect and manage the configured profiles.""" - pass @verdi_profile.command('list') diff --git a/aiida/cmdline/commands/cmd_run.py b/aiida/cmdline/commands/cmd_run.py index 3ddba27b14..53ce45e4c0 100644 --- a/aiida/cmdline/commands/cmd_run.py +++ b/aiida/cmdline/commands/cmd_run.py @@ -110,7 +110,7 @@ def run(scriptname, varargs, group, group_name, exclude, excludesubclasses, incl sys.path.insert(0, os.path.abspath(os.curdir)) # Compile the script for execution and pass it to exec with the globals_dict exec(compile(handle.read(), scriptname, 'exec', dont_inherit=True), globals_dict) # yapf: disable # pylint: disable=exec-used - except SystemExit: + except SystemExit: # pylint: disable=try-except-raise # Script called sys.exit() # Re-raise the exception to have the error code properly returned at the end raise diff --git a/aiida/cmdline/commands/cmd_user.py b/aiida/cmdline/commands/cmd_user.py index 43628ac0e8..bd3ef339c1 100644 --- a/aiida/cmdline/commands/cmd_user.py +++ b/aiida/cmdline/commands/cmd_user.py @@ -25,7 +25,6 @@ @verdi.group('user') def verdi_user(): """Inspect and manage users.""" - pass def get_default(value, ctx): @@ -81,7 +80,7 @@ def configure(user, first_name, last_name, institution, password, non_interactiv """ Create or update a user. Email address us taken as the user identiier. """ - # pylint: disable=W0612,W0613 + # pylint: disable=unused-argument,unused-variable if first_name is not None: user.first_name = first_name diff --git a/aiida/cmdline/commands/cmd_work.py b/aiida/cmdline/commands/cmd_work.py index 4802c56189..1a8f56c044 100644 --- a/aiida/cmdline/commands/cmd_work.py +++ b/aiida/cmdline/commands/cmd_work.py @@ -26,7 +26,6 @@ @verdi.group('work') def verdi_work(): """Inspect and manage work calculations.""" - pass @verdi_work.command('list') diff --git a/aiida/cmdline/commands/cmd_workflow.py b/aiida/cmdline/commands/cmd_workflow.py index 8997294aa9..bb5673bb8f 100644 --- a/aiida/cmdline/commands/cmd_workflow.py +++ b/aiida/cmdline/commands/cmd_workflow.py @@ -26,7 +26,6 @@ @verdi.group('workflow') def verdi_workflow(): """Inspect and manage legacy workflows.""" - pass def format_pk(workflow): diff --git a/aiida/cmdline/params/arguments/overridable.py b/aiida/cmdline/params/arguments/overridable.py index 3089c3f22f..6efe8f23c6 100644 --- a/aiida/cmdline/params/arguments/overridable.py +++ b/aiida/cmdline/params/arguments/overridable.py @@ -18,7 +18,7 @@ import click -class OverridableArgument(object): +class OverridableArgument(object): # pylint: disable=useless-object-inheritance """ Wrapper around click.argument that increases reusability diff --git a/aiida/cmdline/params/options/overridable.py b/aiida/cmdline/params/options/overridable.py index 040d4242de..b3e8de3cfc 100644 --- a/aiida/cmdline/params/options/overridable.py +++ b/aiida/cmdline/params/options/overridable.py @@ -19,7 +19,7 @@ import click -class OverridableOption(object): +class OverridableOption(object): # pylint: disable=useless-object-inheritance """ Wrapper around click option that increases reusability diff --git a/aiida/cmdline/params/options/test_conditional.py b/aiida/cmdline/params/options/test_conditional.py index 8a5fb11922..54a508930d 100644 --- a/aiida/cmdline/params/options/test_conditional.py +++ b/aiida/cmdline/params/options/test_conditional.py @@ -170,10 +170,11 @@ def user_callback(_ctx, param, value): """ if not value: return -1 - elif value != 42: + + if value != 42: raise click.BadParameter('invalid', param=param) - else: - return value + + return value @staticmethod def setup_flag_cond(**kwargs): diff --git a/aiida/cmdline/params/options/test_interactive.py b/aiida/cmdline/params/options/test_interactive.py index 71966c9c8e..63b3c23069 100644 --- a/aiida/cmdline/params/options/test_interactive.py +++ b/aiida/cmdline/params/options/test_interactive.py @@ -252,10 +252,11 @@ def user_callback(_ctx, param, value): """ if not value: return -1 - elif value != 42: + + if value != 42: raise click.BadParameter('invalid', param=param) - else: - return value + + return value def test_after_callback_valid(self): """ diff --git a/aiida/cmdline/params/types/identifier.py b/aiida/cmdline/params/types/identifier.py index 0f23005f40..b52823d22c 100644 --- a/aiida/cmdline/params/types/identifier.py +++ b/aiida/cmdline/params/types/identifier.py @@ -77,7 +77,6 @@ def orm_class_loader(self): :return: the orm entity loader class for this ParamType """ - pass @with_dbenv() def convert(self, value, param, ctx): diff --git a/aiida/cmdline/params/types/user.py b/aiida/cmdline/params/types/user.py index 572f721da2..8f61f7d15e 100644 --- a/aiida/cmdline/params/types/user.py +++ b/aiida/cmdline/params/types/user.py @@ -37,9 +37,10 @@ def convert(self, value, param, ctx): if not results: if self._create: return orm.User(email=value) - else: - self.fail("User '{}' not found".format(value), param, ctx) - elif len(results) > 1: + + self.fail("User '{}' not found".format(value), param, ctx) + + if len(results) > 1: self.fail("Multiple users found with email '{}': {}".format(value, results)) return results[0] diff --git a/aiida/cmdline/utils/ascii_vis.py b/aiida/cmdline/utils/ascii_vis.py index efeb221eb7..58f8690c9d 100644 --- a/aiida/cmdline/utils/ascii_vis.py +++ b/aiida/cmdline/utils/ascii_vis.py @@ -246,7 +246,7 @@ def format_tree_descending(tree, prefix=u"", pos=-1): if isinstance(tree, tuple): _, value = tree num_entries = len(value) - if pos == -1 or pos == 2: + if pos in [-1, 2]: new_prefix = u'{} '.format(prefix) else: new_prefix = u'{}\u2502 '.format(prefix) diff --git a/aiida/cmdline/utils/daemon.py b/aiida/cmdline/utils/daemon.py index df5c11b480..5edc74d256 100644 --- a/aiida/cmdline/utils/daemon.py +++ b/aiida/cmdline/utils/daemon.py @@ -54,9 +54,11 @@ def get_daemon_status(client): if status_response['status'] == 'stopped': return 'The daemon is paused' - elif status_response['status'] == 'error': + + if status_response['status'] == 'error': return 'The daemon is in an unexpected state, try verdi daemon restart --reset' - elif status_response['status'] == 'timeout': + + if status_response['status'] == 'timeout': return 'The daemon is running but the call to the circus controller timed out' worker_response = client.get_worker_info() diff --git a/aiida/cmdline/utils/query/calculation.py b/aiida/cmdline/utils/query/calculation.py index 59053f21a2..bb25103a64 100644 --- a/aiida/cmdline/utils/query/calculation.py +++ b/aiida/cmdline/utils/query/calculation.py @@ -15,7 +15,7 @@ from aiida.cmdline.utils.query.mapping import CalculationProjectionMapper -class CalculationQueryBuilder(object): +class CalculationQueryBuilder(object): # pylint: disable=useless-object-inheritance """Utility class to construct a QueryBuilder instance for Calculation nodes and project the query set.""" _default_projections = ('pk', 'ctime', 'process_state', 'process_label', 'process_status') diff --git a/aiida/cmdline/utils/query/mapping.py b/aiida/cmdline/utils/query/mapping.py index 48c041f9d0..37861eae75 100644 --- a/aiida/cmdline/utils/query/mapping.py +++ b/aiida/cmdline/utils/query/mapping.py @@ -14,7 +14,7 @@ from aiida.cmdline.utils.query import formatting -class ProjectionMapper(object): +class ProjectionMapper(object): # pylint: disable=useless-object-inheritance """ Class to map projection names from the CLI to entity labels, attributes and formatters. diff --git a/aiida/common/archive.py b/aiida/common/archive.py index 80bc12c0c7..593c752e86 100644 --- a/aiida/common/archive.py +++ b/aiida/common/archive.py @@ -26,7 +26,7 @@ import aiida.common.json as json -class Archive(object): +class Archive(object): # pylint: disable=useless-object-inheritance """ Utility class to operate on exported archive files or directories. @@ -382,7 +382,7 @@ def extract_cif(infile, folder, nodes_export_subfolder="nodes", aiida_export_sub folder.get_subfolder(folder.get_abs_path(dest_path), create=True) continue contents = values['_tcod_file_contents'][i] - if contents == '?' or contents == '.': + if contents in ['?', '.']: uri = values['_tcod_file_uri'][i] if uri is not None and uri != '?' and uri != '.': contents = urllib.request.urlopen(uri).read() diff --git a/aiida/common/exceptions.py b/aiida/common/exceptions.py index 2725647cb7..11b09072dd 100644 --- a/aiida/common/exceptions.py +++ b/aiida/common/exceptions.py @@ -20,14 +20,12 @@ class AiidaException(Exception): Each module will have its own subclass, inherited from this (e.g. ExecManagerException, TransportException, ...) """ - pass class NotExistent(AiidaException): """ Raised when the required entity does not exist. """ - pass class MultipleObjectsError(AiidaException): @@ -35,7 +33,6 @@ class MultipleObjectsError(AiidaException): Raised when more than one entity is found in the DB, but only one was expected. """ - pass class RemoteOperationError(AiidaException): @@ -43,7 +40,6 @@ class RemoteOperationError(AiidaException): Raised when an error in a remote operation occurs, as in a failed kill() of a scheduler job. """ - pass class ContentNotExistent(NotExistent): @@ -51,21 +47,18 @@ class ContentNotExistent(NotExistent): Raised when trying to access an attribute, a key or a file in the result nodes that is not present """ - pass class FailedError(AiidaException): """ Raised when accessing a calculation that is in the FAILED status """ - pass class StoringNotAllowed(AiidaException): """ Raised when the user tries to store an unstorable node (e.g. a base Node class) """ - pass class ModificationNotAllowed(AiidaException): @@ -73,7 +66,6 @@ class ModificationNotAllowed(AiidaException): Raised when the user tries to modify a field, object, property, ... that should not be modified. """ - pass class IntegrityError(AiidaException): @@ -82,7 +74,6 @@ class IntegrityError(AiidaException): or a general data integrity error. This can happen if, e.g., a foreign key check fails. See PEP 249 for details. """ - pass class UniquenessError(AiidaException): @@ -90,42 +81,36 @@ class UniquenessError(AiidaException): Raised when the user tries to violate a uniqueness constraint (on the DB, for instance). """ - pass class MissingEntryPointError(AiidaException): """ Raised when the requested entry point is not registered with the entry point manager """ - pass class MultipleEntryPointError(AiidaException): """ Raised when the requested entry point cannot uniquely be resolved by the entry point manager """ - pass class LoadingEntryPointError(AiidaException): """ Raised when the class corresponding to requested entry point cannot be loaded """ - pass class MissingPluginError(AiidaException): """ Raised when the user tries to use a plugin that is not available or does not exist. """ - pass class LoadingPluginFailed(AiidaException): """ Raised when loading a plugin through the plugin loader fails """ - pass class InvalidOperation(AiidaException): @@ -134,21 +119,18 @@ class InvalidOperation(AiidaException): before saving the entry), or deleting an entry that is protected (e.g., because it is referenced by foreign keys) """ - pass class ParsingError(AiidaException): """ Generic error raised when there is a parsing error """ - pass class InternalError(AiidaException): """ Error raised when there is an internal error of AiiDA. """ - pass class PluginInternalError(InternalError): @@ -156,7 +138,6 @@ class PluginInternalError(InternalError): Error raised when there is an internal error which is due to a plugin and not to the AiiDA infrastructure. """ - pass class ValidationError(AiidaException): @@ -164,28 +145,24 @@ class ValidationError(AiidaException): Error raised when there is an error during the validation phase of a property. """ - pass class ConfigurationError(AiidaException): """ Error raised when there is a configuration error in AiiDA. """ - pass class ProfileConfigurationError(ConfigurationError): """ Configuration error raised when a wrong/inexistent profile is requested. """ - pass class MissingConfigurationError(ConfigurationError): """ Configuration error raised when the configuration file is missing. """ - pass class ConfigurationVersionError(ConfigurationError): @@ -193,7 +170,6 @@ class ConfigurationVersionError(ConfigurationError): Configuration error raised when the configuration file version is not compatible with the current version. """ - pass class DbContentError(AiidaException): @@ -202,7 +178,6 @@ class DbContentError(AiidaException): This should never happen if the user does not play directly with the DB. """ - pass class InputValidationError(ValidationError): @@ -210,7 +185,6 @@ class InputValidationError(ValidationError): The input data for a calculation did not validate (e.g., missing required input data, wrong data, ...) """ - pass class WorkflowInputValidationError(ValidationError): @@ -218,14 +192,12 @@ class WorkflowInputValidationError(ValidationError): The input data for a workflow did not validate (e.g., missing required input data, wrong data, ...) """ - pass class FeatureNotAvailable(AiidaException): """ Raised when a feature is requested from a plugin, that is not available. """ - pass class FeatureDisabled(AiidaException): @@ -233,14 +205,12 @@ class FeatureDisabled(AiidaException): Raised when a feature is requested, but the user has chosen to disable it (e.g., for submissions on disabled computers). """ - pass class LicensingException(AiidaException): """ Raised when requirements for data licensing are not met. """ - pass class TestsNotAllowedError(AiidaException): @@ -249,32 +219,27 @@ class TestsNotAllowedError(AiidaException): This is to prevent data loss. """ - pass class UnsupportedSpeciesError(ValueError): """ Raised when StructureData operations are fed species that are not supported by AiiDA such as Deuterium """ - pass class DanglingLinkError(Exception): """ Raised when an export archive is detected to contain dangling links when importing """ - pass class TransportTaskException(Exception): """ Raised when a TransportTask, an task to be completed by the engine that requires transport, fails """ - pass class IncompatibleArchiveVersionError(Exception): """ Raised when trying to import an export archive with an incompatible schema version. """ - pass diff --git a/aiida/common/extendeddicts.py b/aiida/common/extendeddicts.py index 34a97cdd83..d12557aaac 100644 --- a/aiida/common/extendeddicts.py +++ b/aiida/common/extendeddicts.py @@ -255,8 +255,7 @@ def __getitem__(self, key): except KeyError: if key in self._default_fields: return None - else: - raise + raise @classmethod def get_default_fields(cls): diff --git a/aiida/common/folders.py b/aiida/common/folders.py index c1e30babf9..2b0c01b3f6 100644 --- a/aiida/common/folders.py +++ b/aiida/common/folders.py @@ -51,7 +51,7 @@ def find_path(root, dir_name): raise OSError('No directory found') -class Folder(object): +class Folder(object): # pylint: disable=useless-object-inheritance """ A class to manage generic folders, avoiding to get out of specific given folder borders. diff --git a/aiida/common/hashing.py b/aiida/common/hashing.py index 50ec95572e..6c1f4af409 100644 --- a/aiida/common/hashing.py +++ b/aiida/common/hashing.py @@ -356,7 +356,7 @@ def truncate_float64(value, num_bits=4): possible truncation in float->str->float roundtrips """ mask = ~(2**num_bits - 1) - int_repr = np.float64(value).view(np.int64) # pylint: disable=no-member + int_repr = np.float64(value).view(np.int64) # pylint: disable=no-member,too-many-function-args,assignment-from-no-return masked_int = int_repr & mask truncated_value = masked_int.view(np.float64) return truncated_value diff --git a/aiida/common/lang.py b/aiida/common/lang.py index ab33624c55..f609b54279 100644 --- a/aiida/common/lang.py +++ b/aiida/common/lang.py @@ -20,7 +20,7 @@ protected = plumpy.lang.protected(check=False) # pylint: disable=invalid-name -class classproperty(object): # pylint: disable=too-few-public-methods, invalid-name +class classproperty(object): # pylint: disable=too-few-public-methods,invalid-name,useless-object-inheritance """ A class that, when used as a decorator, works as if the two decorators @property and @classmethod where applied together @@ -64,7 +64,7 @@ def __init__(self, callable): # pylint: disable=redefined-builtin super(abstractstaticmethod, self).__init__(callable) -class combomethod(object): # pylint: disable=invalid-name,too-few-public-methods +class combomethod(object): # pylint: disable=invalid-name,too-few-public-methods,useless-object-inheritance """ A decorator that wraps a function that can be both a classmethod or instancemethod and behaves accordingly:: @@ -106,7 +106,7 @@ def _wrapper(*args, **kwargs): # pylint: disable=missing-docstring return _wrapper -class EmptyContextManager(object): # pylint: disable=too-few-public-methods +class EmptyContextManager(object): # pylint: disable=too-few-public-methods,useless-object-inheritance """ A dummy/no-op context manager. """ diff --git a/aiida/common/serialize.py b/aiida/common/serialize.py index 8e1ed4b093..9098b1d770 100644 --- a/aiida/common/serialize.py +++ b/aiida/common/serialize.py @@ -134,7 +134,6 @@ def represent_data(self, data): class AiiDALoader(yaml.Loader): """AiiDA specific YAML loader""" - pass def represent_mapping(tag, dumper, mapping): diff --git a/aiida/common/setup.py b/aiida/common/setup.py index 15889b2f34..91108199b5 100644 --- a/aiida/common/setup.py +++ b/aiida/common/setup.py @@ -161,9 +161,9 @@ def create_profile(config, profile_name='default'): # If the user doesn't want to change it, we abandon if not click.prompt('Would you like to change it?'): return profile + # Otherwise, we continue. - else: - updating_existing_prof = True + updating_existing_prof = True this_new_confs = {} diff --git a/aiida/common/timezone.py b/aiida/common/timezone.py index d0aebc26dd..a346ea79f9 100644 --- a/aiida/common/timezone.py +++ b/aiida/common/timezone.py @@ -70,11 +70,11 @@ def make_aware(value, timezone=None, is_dst=None): timezone = get_current_timezone() if hasattr(timezone, 'localize'): return timezone.localize(value, is_dst=is_dst) - else: - if is_aware(value): - raise ValueError("make_aware expects a naive datetime, got %s" % value) - # This may be wrong around DST changes! - return value.replace(tzinfo=timezone) + + if is_aware(value): + raise ValueError("make_aware expects a naive datetime, got %s" % value) + # This may be wrong around DST changes! + return value.replace(tzinfo=timezone) def localtime(value, timezone=None): diff --git a/aiida/common/utils.py b/aiida/common/utils.py index e638d116b7..484de70e1f 100644 --- a/aiida/common/utils.py +++ b/aiida/common/utils.py @@ -252,7 +252,7 @@ def grouper(n, iterable): # pylint: disable=invalid-name yield chunk -class ArrayCounter(object): +class ArrayCounter(object): # pylint: disable=useless-object-inheritance """ A counter & a method that increments it and returns its value. It is used in various tests. @@ -307,7 +307,7 @@ def are_dir_trees_equal(dir1, dir2): return True, "The given directories ({} and {}) are equal".format(dir1, dir2) -class Prettifier(object): +class Prettifier(object): # pylint: disable=useless-object-inheritance """ Class to manage prettifiers (typically for labels of kpoints in band plots) @@ -514,7 +514,7 @@ def join_labels(labels, join_symbol="|", threshold=1.e-6): return new_labels -class Capturing(object): +class Capturing(object): # pylint: disable=useless-object-inheritance """ This class captures stdout and returns it (as a list, split by lines). @@ -575,7 +575,7 @@ def __iter__(self): return iter(self.stdout_lines) -class ErrorAccumulator(object): +class ErrorAccumulator(object): # pylint: disable=useless-object-inheritance """ Allows to run a number of functions and collect all the errors they raise diff --git a/aiida/common/warnings.py b/aiida/common/warnings.py index 7226edc7be..9f1a159c33 100644 --- a/aiida/common/warnings.py +++ b/aiida/common/warnings.py @@ -23,4 +23,3 @@ class AiidaDeprecationWarning(Warning): verdi config warnings.showdeprecations False """ - pass diff --git a/aiida/daemon/client.py b/aiida/daemon/client.py index aa9ec073c2..895863ab9b 100644 --- a/aiida/daemon/client.py +++ b/aiida/daemon/client.py @@ -60,7 +60,7 @@ def get_daemon_client(profile_name=None): return DaemonClient(profile) -class DaemonClient(object): # pylint: disable=too-many-public-methods +class DaemonClient(object): # pylint: disable=too-many-public-methods,useless-object-inheritance """ Extension of the Profile which also provides handles to retrieve profile specific properties related to the daemon client diff --git a/aiida/manage/backup/backup_setup.py b/aiida/manage/backup/backup_setup.py index e9daac34c3..1c37997612 100644 --- a/aiida/manage/backup/backup_setup.py +++ b/aiida/manage/backup/backup_setup.py @@ -35,7 +35,7 @@ from aiida.backends.settings import BACKEND, AIIDADB_PROFILE # pylint: disable=wrong-import-order,wrong-import-position -class BackupSetup(object): +class BackupSetup(object): # pylint: disable=useless-object-inheritance """ This class setups the main backup script related information & files like:: @@ -187,8 +187,8 @@ def run(self): try: shutil.copy(template_conf_path, conf_backup_folder_abs) except Exception: - self._logger.error("Error copying the file {} ".format(template_conf_path) + - "to the directory {}.".format(conf_backup_folder_abs)) + self._logger.error("Error copying the file %s to the directory %s", template_conf_path, + conf_backup_folder_abs) raise if utils.query_yes_no( diff --git a/aiida/manage/backup/backup_utils.py b/aiida/manage/backup/backup_utils.py index 7711ffec84..dc4b72bc28 100644 --- a/aiida/manage/backup/backup_utils.py +++ b/aiida/manage/backup/backup_utils.py @@ -86,10 +86,11 @@ def query_yes_no(question, default="yes"): choice = input(question + prompt).lower() if default is not None and not choice: return valid[default] - elif choice in valid: + + if choice in valid: return valid[choice] - else: - sys.stdout.write("Please respond with 'yes' or 'no' (or 'y' or 'n').\n") + + sys.stdout.write("Please respond with 'yes' or 'no' (or 'y' or 'n').\n") def query_string(question, default): @@ -122,7 +123,8 @@ def query_string(question, default): return None return default - elif reply: + + if reply: return reply sys.stdout.write("Please provide a non empty answer.\n") diff --git a/aiida/manage/configuration/config.py b/aiida/manage/configuration/config.py index e90195a337..bfe740c053 100644 --- a/aiida/manage/configuration/config.py +++ b/aiida/manage/configuration/config.py @@ -17,7 +17,7 @@ __all__ = ('Config',) -class Config(object): +class Config(object): # pylint: disable=useless-object-inheritance """Object that represents the configuration file of an AiiDA instance.""" KEY_VERSION = 'CONFIG_VERSION' diff --git a/aiida/manage/configuration/migrations/migrations.py b/aiida/manage/configuration/migrations/migrations.py index 1befc8c741..bb192c6eee 100644 --- a/aiida/manage/configuration/migrations/migrations.py +++ b/aiida/manage/configuration/migrations/migrations.py @@ -22,7 +22,7 @@ OLDEST_COMPATIBLE_CONFIG_VERSION = 3 -class ConfigMigration(object): +class ConfigMigration(object): # pylint: disable=useless-object-inheritance """Defines a config migration.""" def __init__(self, migrate_function, version, version_oldest_compatible): diff --git a/aiida/manage/configuration/options.py b/aiida/manage/configuration/options.py index 9e7c31ffe8..1b331d31d9 100644 --- a/aiida/manage/configuration/options.py +++ b/aiida/manage/configuration/options.py @@ -8,10 +8,8 @@ __all__ = ('get_option', 'get_option_names', 'parse_option') -class NO_DEFAULT_PLACEHOLDER(object): +class NO_DEFAULT_PLACEHOLDER(object): # pylint: disable=too-few-public-methods,invalid-name,useless-object-inheritance """A dummy class to serve as a marker for no default being specified in the `get_option` function.""" - # pylint: disable=too-few-public-methods,invalid-name - pass NO_DEFAULT = NO_DEFAULT_PLACEHOLDER() diff --git a/aiida/manage/configuration/profile.py b/aiida/manage/configuration/profile.py index 27c6a5d135..5ab342399b 100644 --- a/aiida/manage/configuration/profile.py +++ b/aiida/manage/configuration/profile.py @@ -31,7 +31,7 @@ CIRCUS_STATS_SOCKET_TEMPLATE = 'circus.s.sock' -class Profile(object): +class Profile(object): # pylint: disable=useless-object-inheritance """ Convenience class that loads the current profile name and corresponding configuration and can subsequently provide profile specific information diff --git a/aiida/manage/database/delete/nodes.py b/aiida/manage/database/delete/nodes.py index d59dbcaff2..751644e76b 100644 --- a/aiida/manage/database/delete/nodes.py +++ b/aiida/manage/database/delete/nodes.py @@ -80,13 +80,11 @@ def delete_nodes(pks, while operational_set: # new_pks_set are the the pks of all nodes that are connected to the operational node set # with the links specified. - new_pks_set = set([ - i for i, in QueryBuilder().append(Node, filters={ - 'id': { - 'in': operational_set - } - }).append(Node, project='id', edge_filters=edge_filters).iterall() - ]) + new_pks_set = set(i for i, in QueryBuilder().append(Node, filters={ + 'id': { + 'in': operational_set + } + }).append(Node, project='id', edge_filters=edge_filters).iterall()) # The operational set is only those pks that haven't been yet put into the pks_set_to_delete. operational_set = new_pks_set.difference(pks_set_to_delete) diff --git a/aiida/manage/database/integrity/__init__.py b/aiida/manage/database/integrity/__init__.py index 13f8566ec3..2d7b0870d7 100644 --- a/aiida/manage/database/integrity/__init__.py +++ b/aiida/manage/database/integrity/__init__.py @@ -24,6 +24,7 @@ def write_database_integrity_violation(results, headers, reason_message, action_ :param reason_message: a human readable message detailing the reason of the integrity violation :param action_message: an optional human readable message detailing a performed action, if any """ + # pylint: disable=duplicate-string-formatting-argument from datetime import datetime from tabulate import tabulate from tempfile import NamedTemporaryFile diff --git a/aiida/manage/external/postgres.py b/aiida/manage/external/postgres.py index 75ec8bd2e8..fa0d77e3f6 100644 --- a/aiida/manage/external/postgres.py +++ b/aiida/manage/external/postgres.py @@ -39,7 +39,7 @@ _COPY_DB_COMMAND = 'CREATE DATABASE "{}" WITH TEMPLATE "{}" OWNER "{}"' -class Postgres(object): +class Postgres(object): # pylint: disable=useless-object-inheritance """ Provides postgres database manipulation assuming no prior setup @@ -121,7 +121,7 @@ def determine_setup(self): break # This will work for the default Debian postgres setup, assuming that sudo is available to the user - if self.pg_execute == _pg_execute_not_connected: + if self.pg_execute == _pg_execute_not_connected: # pylint: disable=comparison-with-callable # Check if the user can find the sudo command if _sudo_exists(): dbinfo['user'] = 'postgres' @@ -132,7 +132,7 @@ def determine_setup(self): echo.echo_warning('Could not find `sudo`. No way of connecting to the database could be found.') # This is to allow for any other setup - if self.pg_execute == _pg_execute_not_connected: + if self.pg_execute == _pg_execute_not_connected: # pylint: disable=comparison-with-callable self.setup_fail_counter += 1 self._no_setup_detected() elif not self.interactive and not self.quiet: @@ -140,7 +140,7 @@ def determine_setup(self): 'This may cause problems if the current user is not ' 'allowed to create databases.')) - return bool(self.pg_execute != _pg_execute_not_connected) + return bool(self.pg_execute != _pg_execute_not_connected) # pylint: disable=comparison-with-callable def create_dbuser(self, dbuser, dbpass): """ diff --git a/aiida/manage/fixtures.py b/aiida/manage/fixtures.py index f033992d4b..e094fab0bd 100644 --- a/aiida/manage/fixtures.py +++ b/aiida/manage/fixtures.py @@ -62,8 +62,7 @@ def __str__(self): return repr(self.msg) -# pylint: disable=too-many-public-methods -class FixtureManager(object): +class FixtureManager(object): # pylint: disable=too-many-public-methods,useless-object-inheritance """ Manage the life cycle of a completely separated and temporary AiiDA environment diff --git a/aiida/manage/manager.py b/aiida/manage/manager.py index 5ae59d199c..2459d861d9 100644 --- a/aiida/manage/manager.py +++ b/aiida/manage/manager.py @@ -21,7 +21,7 @@ MANAGER = None -class Manager(object): +class Manager(object): # pylint: disable=useless-object-inheritance """ Manager singleton to provide global versions of commonly used profile/settings related objects and methods to facilitate their construction. diff --git a/aiida/orm/computers.py b/aiida/orm/computers.py index 9b4da0fda8..28485fce65 100644 --- a/aiida/orm/computers.py +++ b/aiida/orm/computers.py @@ -272,7 +272,6 @@ def _description_validator(cls, description): Validates the description. """ # The description is always valid - pass @classmethod def _transport_type_validator(cls, transport_type): @@ -296,7 +295,6 @@ def _prepend_text_validator(cls, prepend_text): Validates the prepend text string. """ # no validation done - pass @classmethod def _append_text_validator(cls, append_text): @@ -304,7 +302,6 @@ def _append_text_validator(cls, append_text): Validates the append text string. """ # no validation done - pass @classmethod def _workdir_validator(cls, workdir): @@ -653,7 +650,6 @@ def get_description(self): :return: the description :rtype: str """ - pass def set_description(self, val): """ diff --git a/aiida/orm/data/array/__init__.py b/aiida/orm/data/array/__init__.py index c403f3eba7..511fa23efe 100644 --- a/aiida/orm/data/array/__init__.py +++ b/aiida/orm/data/array/__init__.py @@ -122,10 +122,10 @@ def get_array_from_file(self, name): # always re-read from disk if not self.is_stored: return get_array_from_file(self, name) - else: - if name not in self._cached_arrays: - self._cached_arrays[name] = get_array_from_file(self, name) - return self._cached_arrays[name] + + if name not in self._cached_arrays: + self._cached_arrays[name] = get_array_from_file(self, name) + return self._cached_arrays[name] def clear_internal_cache(self): """ diff --git a/aiida/orm/data/cif.py b/aiida/orm/data/cif.py index ebb307a884..f722fd3c3c 100644 --- a/aiida/orm/data/cif.py +++ b/aiida/orm/data/cif.py @@ -67,7 +67,7 @@ def has_pycifrw(): """ :return: True if the PyCifRW module can be imported, False otherwise. """ - # pylint: disable=unused-variable + # pylint: disable=unused-variable,unused-import try: import CifFile from CifFile import CifBlock @@ -119,10 +119,7 @@ def _get_aiida_structure_ase_inline(cif, **kwargs): from aiida.orm.data.parameter import ParameterData from aiida.orm.data.structure import StructureData - if 'parameters' in kwargs: - parameters = kwargs['parameters'] - else: - parameters = {} + parameters = kwargs.get('parameters', {}) if isinstance(parameters, ParameterData): parameters = parameters.get_dict() @@ -149,10 +146,7 @@ def _get_aiida_structure_pymatgen_inline(cif, **kwargs): from aiida.orm.data.parameter import ParameterData from aiida.orm.data.structure import StructureData - if 'parameters' in kwargs: - parameters = kwargs['parameters'] - else: - parameters = {} + parameters = kwargs.get('parameters', {}) if isinstance(parameters, ParameterData): parameters = parameters.get_dict() @@ -512,16 +506,16 @@ def get_or_create(cls, filename, use_first=False, store_cif=True): return (instance, True) instance = cls(file=filename) return (instance, True) - else: - if len(cifs) > 1: - if use_first: - return (cifs[0], False) - else: - raise ValueError("More than one copy of a CIF file " - "with the same MD5 has been found in " - "the DB. pks={}".format(",".join([str(i.pk) for i in cifs]))) - else: - return cifs[0], False + + if len(cifs) > 1: + if use_first: + return (cifs[0], False) + + raise ValueError("More than one copy of a CIF file " + "with the same MD5 has been found in " + "the DB. pks={}".format(",".join([str(i.pk) for i in cifs]))) + + return cifs[0], False # pylint: disable=attribute-defined-outside-init @property @@ -766,7 +760,7 @@ def has_attached_hydrogens(self): for datablock in self.values.keys(): if tag in self.values[datablock].keys(): for value in self.values[datablock][tag]: - if value != '.' and value != '?' and value != '0': + if value not in ['.', '?', '0']: return True return False diff --git a/aiida/orm/entities.py b/aiida/orm/entities.py index 51c661d66c..2877770e49 100644 --- a/aiida/orm/entities.py +++ b/aiida/orm/entities.py @@ -130,7 +130,7 @@ def all(self): return [_[0] for _ in self.query().all()] -class Entity(object): +class Entity(object): # pylint: disable=useless-object-inheritance """An AiiDA entity""" _objects = None diff --git a/aiida/orm/groups.py b/aiida/orm/groups.py index 7e5e5bbfe4..18a8f7c4d9 100644 --- a/aiida/orm/groups.py +++ b/aiida/orm/groups.py @@ -81,10 +81,11 @@ def get_or_create(self, label=None, **kwargs): if not res: return Group(label, backend=self.backend, **kwargs).store(), True - elif len(res) > 1: + + if len(res) > 1: raise exceptions.MultipleObjectsError("More than one groups found in the database") - else: - return res[0], False + + return res[0], False def delete(self, id): # pylint: disable=invalid-name, redefined-builtin """ diff --git a/aiida/orm/implementation/authinfos.py b/aiida/orm/implementation/authinfos.py index 7c14480b69..328f1d29b4 100644 --- a/aiida/orm/implementation/authinfos.py +++ b/aiida/orm/implementation/authinfos.py @@ -43,7 +43,6 @@ def id(self): # pylint: disable=invalid-name """ Return the ID in the DB. """ - pass @abc.abstractproperty def enabled(self): @@ -52,7 +51,6 @@ def enabled(self): :rtype: bool """ - pass @enabled.setter def enabled(self, value): @@ -61,7 +59,6 @@ def enabled(self, value): :return: Boolean """ - pass @abc.abstractproperty def computer(self): @@ -71,7 +68,6 @@ def computer(self): :return: The corresponding computer :rtype: :class:`aiida.orm.Computer` """ - pass @abc.abstractproperty def user(self): @@ -81,7 +77,6 @@ def user(self): :return: The corresponding user :rtype: :class:`aiida.orm.User` """ - pass @abc.abstractproperty def is_stored(self): @@ -91,7 +86,6 @@ def is_stored(self): :return: Boolean :rtype: bool """ - pass @abc.abstractmethod def get_auth_params(self): @@ -100,7 +94,6 @@ def get_auth_params(self): :return: a dictionary """ - pass @abc.abstractmethod def set_auth_params(self, auth_params): @@ -109,7 +102,6 @@ def set_auth_params(self, auth_params): :param auth_params: a dictionary with the new auth_params """ - pass @abc.abstractmethod def _get_metadata(self): @@ -118,14 +110,12 @@ def _get_metadata(self): :return: a dictionary """ - pass @abc.abstractmethod def _set_metadata(self, metadata): """ Replace the metadata dictionary in the DB with the provided dictionary """ - pass def get_property(self, name): try: @@ -154,7 +144,6 @@ def create(self, computer, user): :param user: a User instance :return: a AuthInfo object associated to the given computer and user """ - pass @abc.abstractmethod def delete(self, authinfo_id): @@ -162,7 +151,6 @@ def delete(self, authinfo_id): Remove an AuthInfo from the collection with the given id :param authinfo_id: The ID of the authinfo to delete """ - pass @abc.abstractmethod def get(self, computer, user): @@ -176,4 +164,3 @@ def get(self, computer, user): :raise sqlalchemy.orm.exc.MultipleResultsFound: if the user is configured more than once to use the computer! Should never happen """ - pass diff --git a/aiida/orm/implementation/backends.py b/aiida/orm/implementation/backends.py index 564789f719..b8d5659c77 100644 --- a/aiida/orm/implementation/backends.py +++ b/aiida/orm/implementation/backends.py @@ -25,6 +25,8 @@ class Backend(object): """The public interface that defines a backend factory that creates backend specific concrete objects.""" + # pylint: disable=useless-object-inheritance + @abc.abstractmethod def migrate(self): """Migrate the database to the latest schema version.""" @@ -106,6 +108,8 @@ def users(self): class BackendEntity(object): """An first-class entity in the backend""" + # pylint: disable=useless-object-inheritance + def __init__(self, backend): self._backend = backend @@ -117,7 +121,6 @@ def id(self): # pylint: disable=invalid-name :return: the entity id """ - pass @property def backend(self): @@ -135,7 +138,6 @@ def store(self): Whether it is possible to call store more than once is delegated to the object itself """ - pass @abc.abstractmethod def is_stored(self): @@ -145,7 +147,6 @@ def is_stored(self): :return: True if stored, False otherwise :rtype: bool """ - pass class BackendCollection(typing.Generic[EntityType]): diff --git a/aiida/orm/implementation/comments.py b/aiida/orm/implementation/comments.py index 3993f95c9b..207b872489 100644 --- a/aiida/orm/implementation/comments.py +++ b/aiida/orm/implementation/comments.py @@ -77,7 +77,6 @@ def create(self, node, user, content=None): :param content: the comment content :return: a Comment object associated to the given node and user """ - pass @abc.abstractmethod def delete(self, comment): @@ -86,4 +85,3 @@ def delete(self, comment): :param comment: the id of the comment to delete """ - pass diff --git a/aiida/orm/implementation/computers.py b/aiida/orm/implementation/computers.py index 568e0929e4..b5176a8c30 100644 --- a/aiida/orm/implementation/computers.py +++ b/aiida/orm/implementation/computers.py @@ -73,7 +73,6 @@ def set_metadata(self, metadata_dict): data to the database! (The store method can be called multiple times, differently from AiiDA Node objects). """ - pass @abc.abstractmethod def get_transport_params(self): @@ -96,7 +95,6 @@ def get_hostname(self): Get this computer hostname :rtype: str """ - pass @abc.abstractmethod def set_hostname(self, val): @@ -105,7 +103,6 @@ def set_hostname(self, val): :param val: The new hostname :type val: str """ - pass @abc.abstractmethod def get_description(self): diff --git a/aiida/orm/implementation/django/logs.py b/aiida/orm/implementation/django/logs.py index e033a3c2cc..5e36f6429f 100644 --- a/aiida/orm/implementation/django/logs.py +++ b/aiida/orm/implementation/django/logs.py @@ -97,5 +97,4 @@ def delete_many(self, filters): if not filters: models.DbLog.objects.all().delete() else: - raise NotImplementedError("Only deleting all by passing an empty filer dictionary is " - "currently supported") + raise NotImplementedError("Only deleting all by passing an empty filer dictionary is currently supported") diff --git a/aiida/orm/implementation/django/querybuilder.py b/aiida/orm/implementation/django/querybuilder.py index 8611c9e1b2..5af04f97a4 100644 --- a/aiida/orm/implementation/django/querybuilder.py +++ b/aiida/orm/implementation/django/querybuilder.py @@ -169,7 +169,7 @@ def get_filter_expr(self, operator, value, attr_key, is_attribute, alias=None, c raise InputValidationError("Value for operator {} has to be a string (you gave {})" "".format(operator, value)) elif operator == 'in': - value_type_set = set([type(i) for i in value]) + value_type_set = set(type(i) for i in value) if len(value_type_set) > 1: raise InputValidationError('{} contains more than one type'.format(value)) elif not value_type_set: @@ -277,7 +277,7 @@ def get_attribute_db_column(mapped_class, dtype, castas=None): # If the user specified in what to cast, he wants an operation to # be performed to cast the value to a different type if isinstance(value, (list, tuple)): - value_type_set = set([type(i) for i in value]) + value_type_set = set(type(i) for i in value) if len(value_type_set) > 1: raise InputValidationError('{} contains more than one type'.format(value)) elif not value_type_set: diff --git a/aiida/orm/implementation/groups.py b/aiida/orm/implementation/groups.py index 31acb5e24b..048aefee14 100644 --- a/aiida/orm/implementation/groups.py +++ b/aiida/orm/implementation/groups.py @@ -32,7 +32,6 @@ def label(self): """ :return: the name of the group as a string """ - pass @abc.abstractproperty @label.setter @@ -45,14 +44,12 @@ def label(self, name): :param name: the new group name :raises UniquenessError: if another group of same type and name already exists """ - pass @abc.abstractproperty def description(self): """ :return: the description of the group as a string """ - pass @description.setter @abc.abstractmethod @@ -60,14 +57,12 @@ def description(self, value): """ :return: the description of the group as a string """ - pass @abc.abstractproperty def type_string(self): """ :return: the string defining the type of the group """ - pass @abc.abstractproperty def user(self): @@ -75,21 +70,18 @@ def user(self): :return: a backend user object, representing the user associated to this group. :rtype: :class:`aiida.orm.implementation.BackendUser` """ - pass @abc.abstractproperty def id(self): # pylint: disable=invalid-name """ :return: the principal key (the ID) as an integer, or None if the node was not stored yet """ - pass @abc.abstractproperty def uuid(self): """ :return: a string with the uuid """ - pass @classmethod def create(cls, *args, **kwargs): @@ -116,10 +108,11 @@ def get_or_create(cls, *args, **kwargs): if not res: return cls.create(*args, **kwargs), True - elif len(res) > 1: + + if len(res) > 1: raise exceptions.MultipleObjectsError("More than one groups found in the database") - else: - return res[0], False + + return res[0], False @abc.abstractmethod def __int__(self): @@ -130,14 +123,12 @@ def __int__(self): :return: the integer pk of the node or None if not stored. """ - pass @abc.abstractproperty def is_stored(self): """ :return: True if the respective DbNode has been already saved in the DB, False otherwise """ - pass @abc.abstractmethod def store(self): @@ -150,7 +141,6 @@ def nodes(self): the respective AiiDA subclasses of Node, and also allows to ask for the number of nodes in the group using len(). """ - pass @abc.abstractmethod def add_nodes(self, nodes): @@ -164,7 +154,6 @@ def add_nodes(self, nodes): :param nodes: a Node or DbNode object to add to the group, or a list of Nodes or DbNodes to add. """ - pass @abc.abstractmethod def remove_nodes(self, nodes): @@ -178,7 +167,6 @@ def remove_nodes(self, nodes): :param nodes: a Node or DbNode object to add to the group, or a list of Nodes or DbNodes to add. """ - pass def __repr__(self): return '<{}: {}>'.format(self.__class__.__name__, str(self)) @@ -197,6 +185,7 @@ class BackendGroupCollection(backends.BackendCollection[BackendGroup]): ENTITY_CLASS = BackendGroup @abc.abstractmethod + # pylint: disable=too-many-arguments def query(self, label=None, type_string=None, @@ -207,7 +196,7 @@ def query(self, node_attributes=None, past_days=None, label_filters=None, - **kwargs): # pylint: disable=too-many-arguments + **kwargs): """ Query for groups. @@ -244,7 +233,6 @@ def query(self, contain at least one node for element 'Ba' and one node for element 'Ti'. """ - pass def get(self, **filters): """ @@ -268,4 +256,3 @@ def delete(self, id): # pylint: disable=redefined-builtin, invalid-name :param id: the id of the group to delete """ - pass diff --git a/aiida/orm/implementation/logs.py b/aiida/orm/implementation/logs.py index 0c827d6d76..1dd081fb26 100644 --- a/aiida/orm/implementation/logs.py +++ b/aiida/orm/implementation/logs.py @@ -34,7 +34,6 @@ def time(self): :return: The entry timestamp :rtype: :class:`!datetime.datetime` """ - pass @abc.abstractproperty def loggername(self): @@ -44,7 +43,6 @@ def loggername(self): :return: The entry loggername :rtype: basestring """ - pass @abc.abstractproperty def levelname(self): @@ -54,7 +52,6 @@ def levelname(self): :return: The entry log level name :rtype: basestring """ - pass @abc.abstractproperty def objpk(self): @@ -64,7 +61,6 @@ def objpk(self): :return: The entry timestamp :rtype: int """ - pass @abc.abstractproperty def objname(self): @@ -74,7 +70,6 @@ def objname(self): :return: The entry object name :rtype: basestring """ - pass @abc.abstractproperty def message(self): @@ -84,7 +79,6 @@ def message(self): :return: The entry message :rtype: basestring """ - pass @abc.abstractproperty def metadata(self): @@ -94,7 +88,6 @@ def metadata(self): :return: The entry metadata :rtype: :class:`!json.json` """ - pass @six.add_metaclass(abc.ABCMeta) diff --git a/aiida/orm/implementation/querybuilder.py b/aiida/orm/implementation/querybuilder.py index f128aa5fbf..3c4543b118 100644 --- a/aiida/orm/implementation/querybuilder.py +++ b/aiida/orm/implementation/querybuilder.py @@ -25,7 +25,7 @@ class BackendQueryBuilder(object): """Backend query builder interface""" - # pylint: disable=invalid-name, too-many-public-methods + # pylint: disable=invalid-name,too-many-public-methods,useless-object-inheritance def __init__(self, backend): """ @@ -42,56 +42,48 @@ def Node(self): It needs to return a subclass of sqlalchemy.Base, which means that for different ORM's a corresponding dummy-model must be written. """ - pass @abc.abstractmethod def Link(self): """ A property, decorated with @property. Returns the implementation for the DbLink """ - pass @abc.abstractmethod def Computer(self): """ A property, decorated with @property. Returns the implementation for the Computer """ - pass @abc.abstractmethod def User(self): """ A property, decorated with @property. Returns the implementation for the User """ - pass @abc.abstractmethod def Group(self): """ A property, decorated with @property. Returns the implementation for the Group """ - pass @abc.abstractmethod def AuthInfo(self): """ A property, decorated with @property. Returns the implementation for the Group """ - pass @abc.abstractmethod def Comment(self): """ A property, decorated with @property. Returns the implementation for the Comment """ - pass @abc.abstractmethod def log_model_class(self): """ A property, decorated with @property. Returns the implementation for the Log """ - pass @abc.abstractmethod def table_groups_nodes(self): @@ -99,21 +91,18 @@ def table_groups_nodes(self): A property, decorated with @property. Returns the implementation for the many-to-many relationship between group and nodes. """ - pass @abc.abstractmethod def AiidaNode(self): """ A property, decorated with @property. Returns the implementation for the AiiDA-class for Node """ - pass @abc.abstractmethod def get_session(self): """ :returns: a valid session, an instance of sqlalchemy.orm.session.Session """ - pass @abc.abstractmethod def modify_expansions(self, alias, expansions): @@ -121,7 +110,6 @@ def modify_expansions(self, alias, expansions): Modify names of projections if ** was specified. This is important for the schema having attributes in a different table. """ - pass @abstractclassmethod def get_filter_expr_from_attributes(cls, operator, value, attr_key, column=None, column_name=None, alias=None): # pylint: disable=too-many-arguments @@ -140,7 +128,6 @@ def get_filter_expr_from_attributes(cls, operator, value, attr_key, column=None, :returns: An instance of sqlalchemy.sql.elements.BinaryExpression """ - pass @classmethod def get_filter_expr_from_column(cls, operator, value, column): @@ -203,7 +190,6 @@ def get_aiida_res(self, key, res): :returns: an aiida-compatible instance """ - pass @abc.abstractmethod def yield_per(self, query, batch_size): @@ -214,14 +200,12 @@ def yield_per(self, query, batch_size): :returns: a generator """ - pass @abc.abstractmethod def count(self, query): """ :returns: the number of results """ - pass @abc.abstractmethod def first(self, query): @@ -231,21 +215,17 @@ def first(self, query): :returns: One row of aiida results """ - pass - @abc.abstractmethod def iterall(self, query, batch_size, tag_to_index_dict): """ :return: An iterator over all the results of a list of lists. """ - pass @abc.abstractmethod def iterdict(self, query, batch_size, tag_to_projected_entity_dict): """ :returns: An iterator over all the results of a list of dictionaries. """ - pass def get_column(self, colname, alias): # pylint: disable=no-self-use """ diff --git a/aiida/orm/implementation/sqlalchemy/groups.py b/aiida/orm/implementation/sqlalchemy/groups.py index d1e3db9012..d4aaf88169 100644 --- a/aiida/orm/implementation/sqlalchemy/groups.py +++ b/aiida/orm/implementation/sqlalchemy/groups.py @@ -174,7 +174,7 @@ def add_nodes(self, nodes): def nodes(self): """Get an iterator to all the nodes in the group""" - class Iterator(object): + class Iterator(object): # pylint: disable=useless-object-inheritance """Nodes iterator""" def __init__(self, dbnodes, backend): diff --git a/aiida/orm/implementation/sqlalchemy/querybuilder.py b/aiida/orm/implementation/sqlalchemy/querybuilder.py index b84d94e592..08be0c035e 100644 --- a/aiida/orm/implementation/sqlalchemy/querybuilder.py +++ b/aiida/orm/implementation/sqlalchemy/querybuilder.py @@ -236,7 +236,7 @@ def get_filter_expr(self, operator, value, attr_key, is_attribute, alias=None, c "".format(operator, value)) elif operator == 'in': - value_type_set = set([type(i) for i in value]) + value_type_set = set(type(i) for i in value) if len(value_type_set) > 1: raise InputValidationError('{} contains more than one type'.format(value)) elif not value_type_set: diff --git a/aiida/orm/implementation/users.py b/aiida/orm/implementation/users.py index e258ae037a..0e2d914c7f 100644 --- a/aiida/orm/implementation/users.py +++ b/aiida/orm/implementation/users.py @@ -43,7 +43,6 @@ def email(self): :return: the email address """ - pass @abc.abstractmethod @email.setter @@ -53,7 +52,6 @@ def email(self, val): :param val: the new email address """ - pass @abc.abstractmethod def get_password(self): @@ -62,7 +60,6 @@ def get_password(self): :return: the password """ - pass @abc.abstractmethod def set_password(self, new_pass): @@ -71,7 +68,6 @@ def set_password(self, new_pass): :param new_pass: the new password """ - pass @abc.abstractproperty def first_name(self): @@ -81,7 +77,6 @@ def first_name(self): :return: the first name :rtype: str """ - pass @abc.abstractmethod @first_name.setter @@ -91,7 +86,6 @@ def first_name(self, val): :param val: the new first name """ - pass @abc.abstractproperty def last_name(self): @@ -101,7 +95,6 @@ def last_name(self): :return: the last name :rtype: str """ - pass @abc.abstractmethod @last_name.setter @@ -121,7 +114,6 @@ def institution(self): :return: the institution :rtype: str """ - pass @abc.abstractmethod @institution.setter @@ -131,7 +123,6 @@ def institution(self, val): :param val: the new institution """ - pass @abc.abstractproperty def is_active(self): diff --git a/aiida/orm/mixins.py b/aiida/orm/mixins.py index cf7e27ee03..cae8174e5d 100644 --- a/aiida/orm/mixins.py +++ b/aiida/orm/mixins.py @@ -20,7 +20,7 @@ from aiida.common.lang import classproperty -class FunctionCalculationMixin(object): +class FunctionCalculationMixin(object): # pylint: disable=useless-object-inheritance """ This mixin should be used for ProcessNode subclasses that are used to record the execution of a python function. For example the process nodes that are used for a function that @@ -136,7 +136,7 @@ def _set_source_file(self, source_file_handle): self.folder.create_file_from_filelike(source_file_handle, self.FUNCTION_SOURCE_FILE_PATH) -class Sealable(object): +class Sealable(object): # pylint: disable=useless-object-inheritance """Mixin to mark a Node as `sealable`.""" # pylint: disable=no-member,unsupported-membership-test diff --git a/aiida/orm/node/process/__init__.py b/aiida/orm/node/process/__init__.py index 1e9fdc720d..30193073ea 100644 --- a/aiida/orm/node/process/__init__.py +++ b/aiida/orm/node/process/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# pylint: disable=wildcard-import +# pylint: disable=wildcard-import,cyclic-import """Package for process node ORM classes.""" from __future__ import absolute_import diff --git a/aiida/orm/node/process/calculation/__init__.py b/aiida/orm/node/process/calculation/__init__.py index 224ea1583e..4c68f7fe75 100644 --- a/aiida/orm/node/process/calculation/__init__.py +++ b/aiida/orm/node/process/calculation/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# pylint: disable=cyclic-import """Package for calculation process node ORM classes.""" from __future__ import absolute_import diff --git a/aiida/orm/node/process/calculation/calcfunction.py b/aiida/orm/node/process/calculation/calcfunction.py index 4d5e7f1d82..6540b68443 100644 --- a/aiida/orm/node/process/calculation/calcfunction.py +++ b/aiida/orm/node/process/calculation/calcfunction.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# pylint: disable=cyclic-import """ORM class for CalcFunctionNode.""" from __future__ import absolute_import diff --git a/aiida/orm/node/process/calculation/calcjob.py b/aiida/orm/node/process/calculation/calcjob.py index c13fefa148..fad01373a5 100644 --- a/aiida/orm/node/process/calculation/calcjob.py +++ b/aiida/orm/node/process/calculation/calcjob.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# pylint: disable=cyclic-import """ORM class for CalcJobNode.""" from __future__ import absolute_import from __future__ import print_function diff --git a/aiida/orm/node/process/calculation/calculation.py b/aiida/orm/node/process/calculation/calculation.py index a37554799c..951b9b19fd 100644 --- a/aiida/orm/node/process/calculation/calculation.py +++ b/aiida/orm/node/process/calculation/calculation.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# pylint: disable=cyclic-import """ORM class for CalculationNode.""" from __future__ import absolute_import diff --git a/aiida/orm/node/process/workflow/__init__.py b/aiida/orm/node/process/workflow/__init__.py index 4182f485ca..cc5771208b 100644 --- a/aiida/orm/node/process/workflow/__init__.py +++ b/aiida/orm/node/process/workflow/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# pylint: disable=cyclic-import """Package for workflow process node ORM classes.""" from __future__ import absolute_import diff --git a/aiida/orm/node/process/workflow/workchain.py b/aiida/orm/node/process/workflow/workchain.py index 85403bc353..e709916326 100644 --- a/aiida/orm/node/process/workflow/workchain.py +++ b/aiida/orm/node/process/workflow/workchain.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# pylint: disable=abstract-method,no-self-argument +# pylint: disable=abstract-method,no-self-argument,cyclic-import """ORM class for WorkChainNode.""" from __future__ import absolute_import diff --git a/aiida/orm/node/process/workflow/workflow.py b/aiida/orm/node/process/workflow/workflow.py index c8d6e575b0..d5dff0fbb2 100644 --- a/aiida/orm/node/process/workflow/workflow.py +++ b/aiida/orm/node/process/workflow/workflow.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# pylint: disable=cyclic-import """ORM class for WorkflowNode.""" from __future__ import absolute_import diff --git a/aiida/orm/node/process/workflow/workfunction.py b/aiida/orm/node/process/workflow/workfunction.py index c00487d2bd..9d4532d3d9 100644 --- a/aiida/orm/node/process/workflow/workfunction.py +++ b/aiida/orm/node/process/workflow/workfunction.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# pylint: disable=cyclic-import """ORM class for WorkFunctionNode.""" from __future__ import absolute_import diff --git a/aiida/orm/users.py b/aiida/orm/users.py index fdcd76eedf..c6fec34652 100644 --- a/aiida/orm/users.py +++ b/aiida/orm/users.py @@ -183,13 +183,15 @@ def get_full_name(self): :return: the user full name """ if self.first_name and self.last_name: - return "{} {} ({})".format(self.first_name, self.last_name, self.email) + full_name = "{} {} ({})".format(self.first_name, self.last_name, self.email) elif self.first_name: - return "{} ({})".format(self.first_name, self.email) + full_name = "{} ({})".format(self.first_name, self.email) elif self.last_name: - return "{} ({})".format(self.last_name, self.email) + full_name = "{} ({})".format(self.last_name, self.email) + else: + full_name = "{}".format(self.email) - return "{}".format(self.email) + return full_name def get_short_name(self): """ diff --git a/aiida/orm/utils/builders/code.py b/aiida/orm/utils/builders/code.py index a1f33c2c9c..4f2b6c4cc8 100644 --- a/aiida/orm/utils/builders/code.py +++ b/aiida/orm/utils/builders/code.py @@ -20,7 +20,7 @@ from aiida.common.utils import ErrorAccumulator -class CodeBuilder(object): +class CodeBuilder(object): # pylint: disable=useless-object-inheritance """Build a code with validation of attribute combinations""" def __init__(self, **kwargs): @@ -49,7 +49,7 @@ def new(self): from aiida.orm import Code # Will be used at the end to check if all keys are known (those that are not None) - passed_keys = set([k for k in self._code_spec.keys() if self._code_spec[k] is not None]) + passed_keys = set(k for k in self._code_spec.keys() if self._code_spec[k] is not None) used = set() if self._get_and_count('code_type', used) == self.CodeType.STORE_AND_UPLOAD: diff --git a/aiida/orm/utils/builders/computer.py b/aiida/orm/utils/builders/computer.py index 70977b18fc..e49f95b94c 100644 --- a/aiida/orm/utils/builders/computer.py +++ b/aiida/orm/utils/builders/computer.py @@ -16,7 +16,7 @@ from aiida.common.utils import ErrorAccumulator -class ComputerBuilder(object): +class ComputerBuilder(object): # pylint: disable=useless-object-inheritance """Build a computer with validation of attribute combinations""" @staticmethod diff --git a/aiida/orm/utils/links.py b/aiida/orm/utils/links.py index 6682f42dcf..ababaf8684 100644 --- a/aiida/orm/utils/links.py +++ b/aiida/orm/utils/links.py @@ -145,7 +145,7 @@ def validate_link(source, target, link_type, link_label): target.uuid, link_type, link_label, source.uuid)) -class LinkManager(object): +class LinkManager(object): # pylint: disable=useless-object-inheritance """ Class to convert a list of LinkTriple tuples into an iterator. diff --git a/aiida/restapi/common/exceptions.py b/aiida/restapi/common/exceptions.py index b51a13dea7..ddea10f5af 100644 --- a/aiida/restapi/common/exceptions.py +++ b/aiida/restapi/common/exceptions.py @@ -32,14 +32,12 @@ class RestValidationError(ValidationError): """ document with an example """ - pass class RestInputValidationError(InputValidationError): """ document with an example """ - pass class RestFeatureNotAvailable(FeatureNotAvailable): diff --git a/aiida/restapi/common/utils.py b/aiida/restapi/common/utils.py index 05f6470c09..43bd9bae0d 100644 --- a/aiida/restapi/common/utils.py +++ b/aiida/restapi/common/utils.py @@ -64,7 +64,7 @@ def default(self, o): class DatetimePrecision(object): - # pylint: disable=too-few-public-methods + # pylint: disable=too-few-public-methods,useless-object-inheritance """ A simple class which stores a datetime object with its precision. No internal check is done (cause itis not possible). @@ -88,7 +88,7 @@ def __init__(self, dtobj, precision): self.precision = precision -class Utils(object): +class Utils(object): # pylint: disable=useless-object-inheritance """ A class that gathers all the utility functions for parsing URI, validating request, pass it to the translator, and building HTTP response @@ -139,8 +139,8 @@ def strip_prefix(self, path): if path.startswith(self.prefix): return path[len(self.prefix):] - else: - raise ValidationError('path has to start with {}'.format(self.prefix)) + + raise ValidationError('path has to start with {}'.format(self.prefix)) @staticmethod def split_path(path): @@ -148,8 +148,6 @@ def split_path(path): :param path: entire path contained in flask request :return: list of each element separated by '/' """ - - # type: (string) -> (list_of_strings). return [f for f in path.split('/') if f] def parse_path(self, path_string, parse_pk_uuid=None): diff --git a/aiida/restapi/resources.py b/aiida/restapi/resources.py index 739a4b72d6..d0f4ba87b6 100644 --- a/aiida/restapi/resources.py +++ b/aiida/restapi/resources.py @@ -298,8 +298,7 @@ def get(self, id=None, page=None): # pylint: disable=redefined-builtin,invalid- results["download"]["filename"]) return response - else: - results = results["download"]["data"] + results = results["download"]["data"] if query_type in ["retrieved_inputs", "retrieved_outputs"] and results: try: @@ -317,8 +316,7 @@ def get(self, id=None, page=None): # pylint: disable=redefined-builtin,invalid- results[query_type]["filename"]) return response - elif status == 500: - results = results[query_type]["data"] + results = results[query_type]["data"] headers = self.utils.build_headers(url=request.url, total_count=total_count) diff --git a/aiida/restapi/translator/base.py b/aiida/restapi/translator/base.py index fbbe7ce0fd..9048982e86 100644 --- a/aiida/restapi/translator/base.py +++ b/aiida/restapi/translator/base.py @@ -25,11 +25,11 @@ class BaseTranslator(object): - # pylint: disable=too-many-instance-attributes,fixme """ Generic class for translator. It contains the methods required to build a related QueryBuilder object """ + # pylint: disable=useless-object-inheritance,too-many-instance-attributes,fixme # A label associated to the present class __label__ = None @@ -463,11 +463,13 @@ def get_formatted_result(self, label): # TODO think how to make it less hardcoded if self._result_type == 'with_outgoing': - return {'inputs': results} + result = {'inputs': results} elif self._result_type == 'with_incoming': - return {'outputs': results} + result = {'outputs': results} + else: + result = {self.__label__: results} - return {self.__label__: results} + return result def get_results(self): """ diff --git a/aiida/tools/calculations/base.py b/aiida/tools/calculations/base.py index 9e75623293..5d8c72a380 100644 --- a/aiida/tools/calculations/base.py +++ b/aiida/tools/calculations/base.py @@ -11,7 +11,7 @@ class CalculationTools(object): """Base class for CalculationTools.""" - # pylint: disable=too-few-public-methods + # pylint: disable=too-few-public-methods,useless-object-inheritance def __init__(self, node): self._node = node diff --git a/aiida/tools/dbimporters/plugins/materialsproject.py b/aiida/tools/dbimporters/plugins/materialsproject.py index 427378c512..b0736da72f 100644 --- a/aiida/tools/dbimporters/plugins/materialsproject.py +++ b/aiida/tools/dbimporters/plugins/materialsproject.py @@ -201,4 +201,4 @@ def _get_url(self, result_dict): :param result_dict: query result entry dictionary """ - return self._material_base_url + result_dict['material_id'], + return self._material_base_url + result_dict['material_id'] diff --git a/aiida/tools/dbimporters/plugins/test_icsd.py b/aiida/tools/dbimporters/plugins/test_icsd.py index 02f1853bee..435b90d125 100644 --- a/aiida/tools/dbimporters/plugins/test_icsd.py +++ b/aiida/tools/dbimporters/plugins/test_icsd.py @@ -26,8 +26,9 @@ def has_mysqldb(): """ :return: True if the ase module can be imported, False otherwise. """ + # pylint: disable=unused-import,unused-variable try: - import MySQLdb # pylint: disable=unused-variable + import MySQLdb except ImportError: try: import pymysql as MySQLdb diff --git a/aiida/transport/plugins/local.py b/aiida/transport/plugins/local.py index c42b7f0f5d..3aad975bbd 100644 --- a/aiida/transport/plugins/local.py +++ b/aiida/transport/plugins/local.py @@ -112,9 +112,8 @@ def curdir(self): """ if self._is_open: return os.path.realpath(self._internal_dir) - else: - raise TransportInternalError("Error, local method called for LocalTransport " - "without opening the channel first") + + raise TransportInternalError("Error, local method called for LocalTransport without opening the channel first") def chdir(self, path): """ @@ -676,20 +675,20 @@ def get_attribute(self, path): def _local_listdir(self, path, pattern=None): # pylint: disable=no-self-use """Act on the local folder, for the rest, same as listdir.""" + import re + if not pattern: return os.listdir(path) - else: - import re - if path.startswith('/'): # always this is the case in the local plugin - base_dir = path - else: - base_dir = os.path.join(os.getcwd(), path) + if path.startswith('/'): # always this is the case in the local plugin + base_dir = path + else: + base_dir = os.path.join(os.getcwd(), path) - filtered_list = glob.glob(os.path.join(base_dir, pattern)) - if not base_dir.endswith(os.sep): - base_dir += os.sep - return [re.sub(base_dir, '', i) for i in filtered_list] + filtered_list = glob.glob(os.path.join(base_dir, pattern)) + if not base_dir.endswith(os.sep): + base_dir += os.sep + return [re.sub(base_dir, '', i) for i in filtered_list] def listdir(self, path='.', pattern=None): """ @@ -751,6 +750,7 @@ def _exec_command_internal(self, command, **kwargs): # pylint: disable=unused-a proc is the process object as returned by the subprocess.Popen() class. """ + # pylint: disable=subprocess-popen-preexec-fn from aiida.common.escaping import escape_for_bash # Note: The outer shell will eat one level of escaping, while diff --git a/aiida/transport/transport.py b/aiida/transport/transport.py index b8669b582f..fac67fe25d 100644 --- a/aiida/transport/transport.py +++ b/aiida/transport/transport.py @@ -25,13 +25,13 @@ DEFAULT_TRANSPORT_INTERVAL = 30. -# pylint: disable=too-many-public-methods @six.add_metaclass(ABCMeta) class Transport(object): """ Abstract class for a generic transport (ssh, local, ...) Contains the set of minimal methods """ + # pylint: disable=too-many-public-methods,useless-object-inheritance,bad-option-value # To be defined in the subclass # See the ssh or local plugin to see the format @@ -658,10 +658,10 @@ def whoami(self): if stderr.strip(): self.logger.warning("There was nonempty stderr in the whoami command: {}".format(stderr)) return username.strip() - else: - self.logger.error("Problem executing whoami. Exit code: {}, stdout: '{}', " - "stderr: '{}'".format(retval, username, stderr)) - raise IOError("Error while executing whoami. Exit code: {}".format(retval)) + + self.logger.error("Problem executing whoami. Exit code: {}, stdout: '{}', " + "stderr: '{}'".format(retval, username, stderr)) + raise IOError("Error while executing whoami. Exit code: {}".format(retval)) def path_exists(self, path): """ @@ -751,4 +751,3 @@ class TransportInternalError(InternalError): Raised if there is a transport error that is raised to an internal error (e.g. a transport method called without opening the channel first). """ - pass diff --git a/aiida/transport/util.py b/aiida/transport/util.py index 1a5bd9c252..145fa3a605 100644 --- a/aiida/transport/util.py +++ b/aiida/transport/util.py @@ -47,7 +47,7 @@ def __init__(self, command_line): # pylint: disable=super-init-not-called from shlex import split as shlsplit self.cmd = shlsplit(command_line) - self.process = Popen(self.cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=0, preexec_fn=os.setsid) + self.process = Popen(self.cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=0, preexec_fn=os.setsid) # pylint: disable=subprocess-popen-preexec-fn self.timeout = None def close(self): diff --git a/aiida/work/awaitable.py b/aiida/work/awaitable.py index b2b442258b..fd25972d02 100644 --- a/aiida/work/awaitable.py +++ b/aiida/work/awaitable.py @@ -24,7 +24,6 @@ class Awaitable(AttributesDict): """ An attribute dictionary that represents an action that a Process could be waiting for to finish """ - pass class AwaitableTarget(Enum): diff --git a/aiida/work/exceptions.py b/aiida/work/exceptions.py index 4bca5c6ada..40c350e981 100644 --- a/aiida/work/exceptions.py +++ b/aiida/work/exceptions.py @@ -20,4 +20,3 @@ class PastException(AiidaException): """ Raised when an attempt is made to continue a Process that has already excepted before """ - pass diff --git a/aiida/work/job_calcs.py b/aiida/work/job_calcs.py index e899b910b8..345fa241b6 100644 --- a/aiida/work/job_calcs.py +++ b/aiida/work/job_calcs.py @@ -28,7 +28,7 @@ __all__ = tuple() -class JobsList(object): +class JobsList(object): # pylint: disable=useless-object-inheritance """ A list of submitted jobs on a machine connected to by transport based on the authorisation information. @@ -180,12 +180,12 @@ def _has_job_state_changed(old, new): """ if old is None and new is None: return False - elif old is None or new is None: + + if old is None or new is None: # One is None and the other isn't return True - return old.job_state != new.job_state or \ - old.job_substate != new.job_substate + return old.job_state != new.job_state or old.job_substate != new.job_substate def _get_next_update_delay(self): """ @@ -220,7 +220,7 @@ def _get_jobs_with_scheduler(self): return [str(job_id) for job_id, _ in self._job_update_requests.items()] -class JobManager(object): +class JobManager(object): # pylint: disable=useless-object-inheritance """ A manager for jobs on a (usually) remote resource such as a supercomputer """ diff --git a/aiida/work/persistence.py b/aiida/work/persistence.py index 3aff9b8b08..4a926e48d7 100644 --- a/aiida/work/persistence.py +++ b/aiida/work/persistence.py @@ -114,7 +114,6 @@ def get_checkpoints(self): :return: list of PersistedCheckpoint tuples """ - pass def get_process_checkpoints(self, pid): """ @@ -125,7 +124,6 @@ def get_process_checkpoints(self, pid): :param pid: the process pid :return: list of PersistedCheckpoint tuples """ - pass def delete_checkpoint(self, pid, tag=None): """ @@ -145,7 +143,6 @@ def delete_process_checkpoints(self, pid): :param pid: the process id of the :class:`aiida.work.processes.Process` """ - pass class ObjectLoader(plumpy.DefaultObjectLoader): diff --git a/aiida/work/ports.py b/aiida/work/ports.py index 072c500483..244e8b7a16 100644 --- a/aiida/work/ports.py +++ b/aiida/work/ports.py @@ -14,7 +14,7 @@ from plumpy import ports -class WithNonDb(object): +class WithNonDb(object): # pylint: disable=useless-object-inheritance """ A mixin that adds support to a port to flag a that should not be stored in the database using the non_db=True flag. @@ -33,7 +33,7 @@ def non_db(self): return self._non_db -class WithSerialize(object): +class WithSerialize(object): # pylint: disable=useless-object-inheritance """ A mixin that adds support for a serialization function which is automatically applied on inputs that are not AiiDA data types. diff --git a/aiida/work/processes.py b/aiida/work/processes.py index db8735e5f4..a6e29c341d 100644 --- a/aiida/work/processes.py +++ b/aiida/work/processes.py @@ -661,9 +661,9 @@ def _get_namespace_list(namespace=None, agglomerate=True): """Get the list of namespaces in a given namespace""" if not agglomerate: return [namespace] - else: - namespace_list = [None] - if namespace is not None: - split_ns = namespace.split('.') - namespace_list.extend(['.'.join(split_ns[:i]) for i in range(1, len(split_ns) + 1)]) - return namespace_list + + namespace_list = [None] + if namespace is not None: + split_ns = namespace.split('.') + namespace_list.extend(['.'.join(split_ns[:i]) for i in range(1, len(split_ns) + 1)]) + return namespace_list diff --git a/aiida/work/runners.py b/aiida/work/runners.py index 0920bec4df..9d2d3f034a 100644 --- a/aiida/work/runners.py +++ b/aiida/work/runners.py @@ -32,7 +32,7 @@ ResultAndPid = namedtuple('ResultAndPid', ['result', 'pid']) -class Runner(object): +class Runner(object): # pylint: disable=useless-object-inheritance """Class that can launch processes by running in the current interpreter or by submitting them to the daemon.""" _persister = None diff --git a/aiida/work/transports.py b/aiida/work/transports.py index 6cea62faf4..8b74a99d2d 100644 --- a/aiida/work/transports.py +++ b/aiida/work/transports.py @@ -23,14 +23,14 @@ class TransportRequest(object): """ Information kept about request for a transport object """ - # pylint: disable=too-few-public-methods + # pylint: disable=too-few-public-methods,useless-object-inheritance def __init__(self): super(TransportRequest, self).__init__() self.future = concurrent.Future() self.count = 0 -class TransportQueue(object): +class TransportQueue(object): # pylint: disable=useless-object-inheritance """ A queue to get transport objects from authinfo. This class allows clients to register their interest in a transport object which will be provided at diff --git a/aiida/work/utils.py b/aiida/work/utils.py index 526bc44bff..90a4c312b4 100644 --- a/aiida/work/utils.py +++ b/aiida/work/utils.py @@ -275,7 +275,7 @@ def get_process_state_change_timestamp(process_type=None): return max(timestamps) -class RefObjectStore(object): +class RefObjectStore(object): # pylint: disable=useless-object-inheritance """ An object store that has a reference count based on a context manager. Basic usage:: @@ -292,11 +292,8 @@ class RefObjectStore(object): store (and therefore eventually garbage collected). """ - class Reference(object): - """ - A reference to store the context reference count and the object - itself. - """ + class Reference(object): # pylint: disable=useless-object-inheritance + """A reference to store the context reference count and the object itself.""" def __init__(self, obj): self._count = 0 @@ -306,6 +303,7 @@ def __init__(self, obj): def count(self): """ Get the reference count for the object + :return: The reference count :rtype: int """ @@ -314,8 +312,8 @@ def count(self): @contextlib.contextmanager def get(self): """ - Get the object itself. This will up the reference count for the duration of - the context. + Get the object itself, which will up the reference count for the duration of the context. + :return: The object """ self._count += 1 diff --git a/aiida/work/workchain.py b/aiida/work/workchain.py index 2bc5d03863..9ed4a27a72 100644 --- a/aiida/work/workchain.py +++ b/aiida/work/workchain.py @@ -173,14 +173,14 @@ def _do_step(self): # If the stepper said we are finished or the result is an ExitCode, we exit by returning if finished or isinstance(result, ExitCode): return result - else: - if isinstance(stepper_result, ToContext): - self.to_context(**stepper_result) - if self._awaitables: - return Wait(self._do_step, 'Waiting before next step') + if isinstance(stepper_result, ToContext): + self.to_context(**stepper_result) + + if self._awaitables: + return Wait(self._do_step, 'Waiting before next step') - return Continue(self._do_step) + return Continue(self._do_step) def _store_nodes(self, data): """ diff --git a/docs/requirements_for_rtd.txt b/docs/requirements_for_rtd.txt index 2b1c4938ef..e5403fa794 100644 --- a/docs/requirements_for_rtd.txt +++ b/docs/requirements_for_rtd.txt @@ -18,7 +18,7 @@ aldjemy==0.8.0 alembic==0.9.9 anyjson==0.3.3 ase==3.12.0 -chainmap; python_version<"3.5" +chainmap; python_version<'3.5' circus==0.14.0 click-completion==0.3.1 click-plugins==1.0.3 @@ -29,10 +29,10 @@ coverage==4.5.1 django==1.11.16 docutils==0.14 ecdsa==0.13 -enum34==1.1.6; python_version<"3.5" +enum34==1.1.6; python_version<'3.5' ete3==3.1.1 flask-marshmallow==0.9.0 -futures; python_version=="2.7" +futures; python_version=='2.7' ipython>=4.0,<6.0 itsdangerous==0.24 kiwipy[rmq]==0.4.2 @@ -42,11 +42,11 @@ mock==2.0.0 numpy==1.14.3 paramiko==2.4.2 passlib==1.7.1 -pathlib2; python_version<"3.5" +pathlib2; python_version<'3.5' pgtest==1.1.0 plumpy==0.12.1 psutil==5.4.5 -pyblake2==1.1.2; python_version<"3.6" +pyblake2==1.1.2; python_version<'3.6' pymatgen==2018.4.20 pyparsing==2.2.0 pytest-cov==2.5.1 @@ -59,7 +59,7 @@ qe-tools==1.1.0 reentry==1.2.1 seekpath==1.8.1 simplejson==3.16.0 -singledispatch>=3.4.0.3; python_version<"3.5" +singledispatch>=3.4.0.3; python_version<'3.5' six==1.11.0 spglib==1.10.3.65 sphinx-rtd-theme==0.4.2 @@ -68,8 +68,8 @@ sqlalchemy-diff==0.1.3 sqlalchemy-migrate==0.11.0 tabulate==0.8.2 tornado==4.5.3 -typing==3.6.6; python_version<"3.5" +typing==3.6.6; python_version<'3.5' tzlocal==1.5.1 ujson==1.35 -unittest2==1.1.0; python_version<"3.5" +unittest2==1.1.0; python_version<'3.5' uritools==2.1.0 \ No newline at end of file diff --git a/setup.json b/setup.json index c948024250..6e404d9b2d 100644 --- a/setup.json +++ b/setup.json @@ -51,13 +51,13 @@ "kiwipy[rmq]==0.4.2", "circus==0.14.0", "tornado==4.5.3", - "pyblake2==1.1.2; python_version<\"3.6\"", - "chainmap; python_version<\"3.5\"", - "pathlib2; python_version<\"3.5\"", - "singledispatch>=3.4.0.3; python_version<\"3.5\"", - "enum34==1.1.6; python_version<\"3.5\"", + "pyblake2==1.1.2; python_version<'3.6'", + "chainmap; python_version<'3.5'", + "pathlib2; python_version<'3.5'", + "singledispatch>=3.4.0.3; python_version<'3.5'", + "enum34==1.1.6; python_version<'3.5'", "simplejson==3.16.0", - "typing==3.6.6; python_version<\"3.5\"" + "typing==3.6.6; python_version<'3.5'" ], "extras_require": { "ssh_kerberos": [ @@ -101,12 +101,12 @@ "jupyter==1.0.0" ], "testing": [ - "unittest2==1.1.0; python_version<\"3.5\"", + "unittest2==1.1.0; python_version<'3.5'", "pgtest==1.1.0", "sqlalchemy-diff==0.1.3", "coverage==4.5.1", "codecov==2.0.15", - "futures; python_version==\"2.7\"", + "futures; python_version=='2.7'", "pytest==3.6.3", "pytest-cov==2.5.1" ], @@ -114,7 +114,8 @@ "pre-commit==1.13.0", "yapf==0.23.0", "prospector==1.1.5", - "pylint-django==0.11.1", + "pylint-django==0.11.1; python_version<'3.0'", + "pylint-django==2.0.5; python_version>='3.0'", "pep8-naming==0.3.3", "toml==0.9.4" ],