diff --git a/aiida/cmdline/commands/cmd_import.py b/aiida/cmdline/commands/cmd_import.py index 46396a40d8..73054b182e 100644 --- a/aiida/cmdline/commands/cmd_import.py +++ b/aiida/cmdline/commands/cmd_import.py @@ -11,7 +11,7 @@ # pylint: disable=broad-except,too-many-arguments,too-many-locals,too-many-branches from enum import Enum import traceback -import urllib +import urllib.request import click from aiida.cmdline.commands.cmd_verdi import verdi diff --git a/aiida/cmdline/params/types/path.py b/aiida/cmdline/params/types/path.py index 3a597e816a..20a96cd436 100644 --- a/aiida/cmdline/params/types/path.py +++ b/aiida/cmdline/params/types/path.py @@ -9,7 +9,9 @@ ########################################################################### """Click parameter types for paths.""" import os -import urllib +# See https://stackoverflow.com/a/41217363/1069467 +import urllib.request +import urllib.error import click @@ -53,10 +55,11 @@ def __repr__(self): class ImportPath(click.Path): """AiiDA extension of Click's Path-type to include URLs An ImportPath can either be a `click.Path`-type or a URL. + :param timeout_seconds: Timeout time in seconds that a URL response is expected. :value timeout_seconds: Must be an int in the range [0;60], extrema included. - If an int outside the range [0;60] is given, the value will be set to the respective extremum value. - If any other type than int is given a TypeError will be raised. + If an int outside the range [0;60] is given, the value will be set to the respective extremum value. + If any other type than int is given a TypeError will be raised. """ # pylint: disable=protected-access diff --git a/aiida/manage/configuration/setup.py b/aiida/manage/configuration/setup.py index 51659aab8d..b84ce7d71b 100644 --- a/aiida/manage/configuration/setup.py +++ b/aiida/manage/configuration/setup.py @@ -9,7 +9,7 @@ ########################################################################### """Module that defines methods required to setup a new AiiDA instance.""" import os -import urllib +import urllib.parse import click diff --git a/aiida/restapi/common/utils.py b/aiida/restapi/common/utils.py index a29e131c12..4abc4dd873 100644 --- a/aiida/restapi/common/utils.py +++ b/aiida/restapi/common/utils.py @@ -8,7 +8,7 @@ # For further information please visit http://www.aiida.net # ########################################################################### """ Util methods """ -import urllib +import urllib.parse from datetime import datetime, timedelta from flask import jsonify diff --git a/aiida/tools/importexport/common/utils.py b/aiida/tools/importexport/common/utils.py index 3a2453b4cf..ae4843677f 100644 --- a/aiida/tools/importexport/common/utils.py +++ b/aiida/tools/importexport/common/utils.py @@ -10,7 +10,8 @@ """ Utility functions for import/export of AiiDA entities """ # pylint: disable=inconsistent-return-statements,too-many-branches,too-many-return-statements # pylint: disable=too-many-nested-blocks,too-many-locals -import urllib +import urllib.request +import urllib.parse from html.parser import HTMLParser from aiida.tools.importexport.common.config import ( diff --git a/tests/tools/dbimporters/test_icsd.py b/tests/tools/dbimporters/test_icsd.py index cea1f27c95..0cd2cd7248 100644 --- a/tests/tools/dbimporters/test_icsd.py +++ b/tests/tools/dbimporters/test_icsd.py @@ -10,12 +10,10 @@ """ Tests for IcsdDbImporter """ -import urllib - +import urllib.request import pytest from aiida.backends.testbase import AiidaTestCase - from aiida.tools.dbimporters.plugins import icsd