From 379009351f27a9af86c51afe17f9617b9068e008 Mon Sep 17 00:00:00 2001 From: David Hunt-Mateo Date: Wed, 18 May 2022 14:40:15 -0400 Subject: [PATCH] =?UTF-8?q?Bump=20version:=200.8.5=20=E2=86=92=200.8.6=20(?= =?UTF-8?q?#822)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump version from 0.8.5 to 0.8 6 - Fix black CI check by backporting #691 - Update .pre-commit-config.yaml using `pre-commit autoupdate` - Bind `black`, `isort`, `flake8`, and `licenseheaders` versions in `setup.py` to match `.pre-commit-config.yaml` - Update licenseheaders template to 2022 - Run pre-commit checks on all files using `pre-commit run --all-files` - Fix tox CI check by using v3 barge --- .bumpversion.cfg | 2 +- .copyright.tmpl | 2 +- .github/workflows/black.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/tox.yml | 3 ++- .pre-commit-config.yaml | 10 +++++----- .prospector.yml | 2 +- CHANGELOG.md | 2 +- README.md | 2 +- READMEs/ALG_ddo.md | 4 ++++ READMEs/DATA_ddo.md | 4 ++++ READMEs/c2d-flow.md | 2 +- READMEs/datatokens-flow.md | 2 +- READMEs/developers.md | 2 +- READMEs/dispenser-flow.md | 2 +- READMEs/fixed-rate-exchange-flow.md | 2 +- READMEs/get-test-OCEAN.md | 2 +- READMEs/marketplace-flow.md | 2 +- READMEs/overview.md | 2 +- READMEs/parameters.md | 2 +- READMEs/release-process.md | 2 +- READMEs/services.md | 2 +- READMEs/wallets.md | 2 +- bumpversion.sh | 2 +- conftest.py | 3 ++- ocean_lib/__init__.py | 4 ++-- ocean_lib/assets/__init__.py | 2 +- ocean_lib/assets/asset.py | 3 ++- ocean_lib/assets/asset_downloader.py | 3 ++- ocean_lib/assets/asset_resolver.py | 5 +++-- ocean_lib/assets/credentials.py | 3 ++- ocean_lib/assets/did.py | 5 +++-- ocean_lib/assets/test/__init__.py | 2 +- ocean_lib/assets/test/test_asset.py | 2 +- .../assets/test/test_asset_downloader.py | 3 ++- ocean_lib/assets/test/test_asset_resolver.py | 3 ++- ocean_lib/assets/test/test_did.py | 5 +++-- ocean_lib/assets/test/test_utils.py | 3 ++- ocean_lib/assets/trusted_algorithms.py | 3 ++- ocean_lib/common/__init__.py | 2 +- ocean_lib/common/agreements/__init__.py | 2 +- ocean_lib/common/agreements/consumable.py | 2 +- ocean_lib/common/agreements/service_types.py | 2 +- ocean_lib/common/aquarius/__init__.py | 2 +- ocean_lib/common/aquarius/aquarius.py | 3 ++- .../common/aquarius/aquarius_provider.py | 2 +- .../common/aquarius/test/test_aquarius.py | 3 ++- ocean_lib/common/http_requests/__init__.py | 2 +- .../common/http_requests/requests_session.py | 2 +- ocean_lib/config.py | 5 +++-- ocean_lib/data_provider/__init__.py | 2 +- .../data_provider/data_service_provider.py | 10 +++++----- ocean_lib/data_provider/test/__init__.py | 2 +- .../test/test_data_service_provider.py | 7 ++++--- ocean_lib/example_config.py | 3 ++- ocean_lib/exceptions.py | 2 +- ocean_lib/integer.py | 2 +- ocean_lib/models/__init__.py | 2 +- ocean_lib/models/algorithm_metadata.py | 2 +- ocean_lib/models/balancer_constants.py | 6 +++--- ocean_lib/models/bfactory.py | 5 +++-- ocean_lib/models/bpool.py | 7 ++++--- ocean_lib/models/btoken.py | 3 ++- ocean_lib/models/compute_input.py | 2 +- ocean_lib/models/data_token.py | 13 +++++++------ ocean_lib/models/dispenser.py | 3 ++- ocean_lib/models/dtfactory.py | 7 ++++--- ocean_lib/models/fixed_rate_exchange.py | 3 ++- ocean_lib/models/metadata.py | 5 +++-- ocean_lib/models/order.py | 2 +- ocean_lib/models/test/conftest.py | 7 ++++--- .../models/test/test_algorithm_metadata.py | 2 +- .../test/test_balancer_core_direct_flow.py | 6 +++--- .../test_balancer_simple_for_users_flow.py | 3 ++- ocean_lib/models/test/test_bfactory.py | 2 +- ocean_lib/models/test/test_bpool.py | 7 ++++--- ocean_lib/models/test/test_btoken.py | 2 +- ocean_lib/models/test/test_compute_input.py | 3 ++- ocean_lib/models/test/test_datatoken.py | 5 +++-- ocean_lib/models/test/test_ddo.py | 7 ++++--- ocean_lib/models/test/test_dispenser.py | 3 ++- ocean_lib/models/test/test_dtfactory.py | 5 +++-- .../models/test/test_fixed_rate_exchange.py | 5 +++-- ocean_lib/models/test/test_metadata.py | 2 +- ocean_lib/models/test/test_order.py | 3 ++- ocean_lib/ocean/__init__.py | 2 +- ocean_lib/ocean/env_constants.py | 2 +- ocean_lib/ocean/mint_fake_ocean.py | 2 +- ocean_lib/ocean/ocean.py | 5 +++-- ocean_lib/ocean/ocean_assets.py | 5 +++-- ocean_lib/ocean/ocean_compute.py | 3 ++- ocean_lib/ocean/ocean_exchange.py | 10 +++++----- ocean_lib/ocean/ocean_pool.py | 11 ++++++----- ocean_lib/ocean/test/test_ocean_assets.py | 3 ++- ocean_lib/ocean/test/test_ocean_compute.py | 2 +- ocean_lib/ocean/test/test_ocean_exchange.py | 4 ++-- ocean_lib/ocean/test/test_ocean_pool.py | 2 +- ocean_lib/ocean/test/test_util.py | 3 ++- ocean_lib/ocean/util.py | 9 +++++---- ocean_lib/services/service.py | 3 ++- ocean_lib/services/test/test_service.py | 2 +- ocean_lib/test/__init__.py | 2 +- ocean_lib/test/test_config.py | 5 +++-- ocean_lib/test/test_example_config.py | 4 ++-- ocean_lib/test/test_exceptions.py | 3 ++- ocean_lib/utils/__init__.py | 2 +- ocean_lib/utils/test/test_utilities.py | 2 +- ocean_lib/utils/utilities.py | 2 +- ocean_lib/web3_internal/__init__.py | 2 +- ocean_lib/web3_internal/constants.py | 8 ++++---- ocean_lib/web3_internal/contract_base.py | 19 ++++++++++--------- ocean_lib/web3_internal/contract_utils.py | 5 +++-- ocean_lib/web3_internal/currency.py | 5 +++-- ocean_lib/web3_internal/event_filter.py | 2 +- ocean_lib/web3_internal/event_listener.py | 5 +++-- ocean_lib/web3_internal/test/__init__.py | 2 +- ocean_lib/web3_internal/test/conftest.py | 3 ++- .../web3_internal/test/test_contract_base.py | 5 +++-- ocean_lib/web3_internal/test/test_currency.py | 3 ++- .../web3_internal/test/test_event_filter.py | 2 +- .../web3_internal/test/test_transactions.py | 2 +- ocean_lib/web3_internal/test/test_utils.py | 3 ++- ocean_lib/web3_internal/test/test_wallet.py | 3 ++- ocean_lib/web3_internal/transactions.py | 7 ++++--- ocean_lib/web3_internal/utils.py | 7 ++++--- ocean_lib/web3_internal/wallet.py | 5 +++-- .../web3_internal/web3_overrides/__init__.py | 2 +- .../web3_internal/web3_overrides/contract.py | 7 ++++--- .../web3_overrides/http_provider.py | 5 +++-- .../web3_internal/web3_overrides/request.py | 2 +- .../web3_internal/web3_overrides/signature.py | 2 +- .../web3_overrides/test/__init__.py | 2 +- .../web3_overrides/test/test_contract.py | 3 ++- .../web3_overrides/test/test_utils.py | 2 +- .../web3_internal/web3_overrides/utils.py | 2 +- setup.py | 13 ++++++------- tests/__init__.py | 2 +- tests/integration/test_compute_flow.py | 5 +++-- tests/integration/test_market_flow.py | 4 ++-- tests/resources/__init__.py | 2 +- tests/resources/ddo_helpers.py | 2 +- tests/resources/helper_functions.py | 3 ++- tests/resources/mocks/__init__.py | 2 +- tests/resources/mocks/data_provider_mock.py | 5 +++-- tests/resources/mocks/http_client_mock.py | 2 +- 145 files changed, 300 insertions(+), 230 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 8fb9eb191..f3dd56ce9 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.8.5 +current_version = 0.8.6 commit = True tag = True diff --git a/.copyright.tmpl b/.copyright.tmpl index fa166a212..97bbded05 100644 --- a/.copyright.tmpl +++ b/.copyright.tmpl @@ -1,2 +1,2 @@ -Copyright 2021 Ocean Protocol Foundation +Copyright 2022 Ocean Protocol Foundation SPDX-License-Identifier: Apache-2.0 diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 10d013456..e7fb92bc8 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -1,5 +1,5 @@ ## -## Copyright 2021 Ocean Protocol Foundation +## Copyright 2022 Ocean Protocol Foundation ## SPDX-License-Identifier: Apache-2.0 ## name: black diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42da02e72..2a7c73f3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ ## -## Copyright 2021 Ocean Protocol Foundation +## Copyright 2022 Ocean Protocol Foundation ## SPDX-License-Identifier: Apache-2.0 ## name: Ocean.py release diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 2913bd8b5..7abc36336 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -1,5 +1,5 @@ ## -## Copyright 2021 Ocean Protocol Foundation +## Copyright 2022 Ocean Protocol Foundation ## SPDX-License-Identifier: Apache-2.0 ## name: Ocean.py tests @@ -24,6 +24,7 @@ jobs: with: repository: "oceanprotocol/barge" path: 'barge' + ref: v3 - name: Run Barge working-directory: ${{ github.workspace }}/barge env: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d23f202c5..b512dd957 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,18 @@ ## -## Copyright 2021 Ocean Protocol Foundation +## Copyright 2022 Ocean Protocol Foundation ## SPDX-License-Identifier: Apache-2.0 ## repos: -- repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.21 +- repo: https://github.com/PyCQA/isort + rev: 5.10.1 hooks: - id: isort - repo: https://github.com/psf/black - rev: 19.3b0 + rev: 22.1.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.9 + rev: 3.9.2 hooks: - id: flake8 - repo: https://github.com/johann-petrak/licenseheaders.git diff --git a/.prospector.yml b/.prospector.yml index 667d99e81..cf004aaff 100644 --- a/.prospector.yml +++ b/.prospector.yml @@ -1,5 +1,5 @@ ## -## Copyright 2021 Ocean Protocol Foundation +## Copyright 2022 Ocean Protocol Foundation ## SPDX-License-Identifier: Apache-2.0 ## pep257: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f6227c39..2f5a7e70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ See [`releases`](https://github.com/oceanprotocol/ocean.py/releases). diff --git a/README.md b/README.md index 288e26f0a..aa2772e6a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ diff --git a/READMEs/ALG_ddo.md b/READMEs/ALG_ddo.md index 7ef1c4f5d..a295ac7d5 100644 --- a/READMEs/ALG_ddo.md +++ b/READMEs/ALG_ddo.md @@ -1,3 +1,7 @@ + (HACK to help debugging. Remove later) In Python console: diff --git a/READMEs/DATA_ddo.md b/READMEs/DATA_ddo.md index a63c9f01b..721d72272 100644 --- a/READMEs/DATA_ddo.md +++ b/READMEs/DATA_ddo.md @@ -1,3 +1,7 @@ + (HACK to help debugging. Remove later) In Python console: diff --git a/READMEs/c2d-flow.md b/READMEs/c2d-flow.md index e92c8c5b4..3a07bc95f 100644 --- a/READMEs/c2d-flow.md +++ b/READMEs/c2d-flow.md @@ -1,5 +1,5 @@ diff --git a/READMEs/datatokens-flow.md b/READMEs/datatokens-flow.md index 44ddf47e1..388508bd1 100644 --- a/READMEs/datatokens-flow.md +++ b/READMEs/datatokens-flow.md @@ -1,5 +1,5 @@ diff --git a/READMEs/developers.md b/READMEs/developers.md index 241830ea3..7efd7b8c6 100644 --- a/READMEs/developers.md +++ b/READMEs/developers.md @@ -1,5 +1,5 @@ diff --git a/READMEs/dispenser-flow.md b/READMEs/dispenser-flow.md index e02ccaee1..eaca36ca0 100644 --- a/READMEs/dispenser-flow.md +++ b/READMEs/dispenser-flow.md @@ -1,5 +1,5 @@ diff --git a/READMEs/fixed-rate-exchange-flow.md b/READMEs/fixed-rate-exchange-flow.md index 0ebf3b28e..9fb151f86 100644 --- a/READMEs/fixed-rate-exchange-flow.md +++ b/READMEs/fixed-rate-exchange-flow.md @@ -1,5 +1,5 @@ diff --git a/READMEs/get-test-OCEAN.md b/READMEs/get-test-OCEAN.md index 0a8d6b005..2b83b8363 100644 --- a/READMEs/get-test-OCEAN.md +++ b/READMEs/get-test-OCEAN.md @@ -1,5 +1,5 @@ diff --git a/READMEs/marketplace-flow.md b/READMEs/marketplace-flow.md index 6341a6583..eaabe96e9 100644 --- a/READMEs/marketplace-flow.md +++ b/READMEs/marketplace-flow.md @@ -1,5 +1,5 @@ diff --git a/READMEs/overview.md b/READMEs/overview.md index e92c31047..731c9bd3b 100644 --- a/READMEs/overview.md +++ b/READMEs/overview.md @@ -1,5 +1,5 @@ diff --git a/READMEs/parameters.md b/READMEs/parameters.md index 3686efa96..4c3538a4c 100644 --- a/READMEs/parameters.md +++ b/READMEs/parameters.md @@ -1,5 +1,5 @@ diff --git a/READMEs/release-process.md b/READMEs/release-process.md index a5cece508..0938fc1c4 100644 --- a/READMEs/release-process.md +++ b/READMEs/release-process.md @@ -1,5 +1,5 @@ diff --git a/READMEs/services.md b/READMEs/services.md index 92042d7de..e438a5a31 100644 --- a/READMEs/services.md +++ b/READMEs/services.md @@ -1,5 +1,5 @@ diff --git a/READMEs/wallets.md b/READMEs/wallets.md index 5e420f0b8..8fdeca303 100644 --- a/READMEs/wallets.md +++ b/READMEs/wallets.md @@ -1,5 +1,5 @@ diff --git a/bumpversion.sh b/bumpversion.sh index 5e9039bf9..5f2697f66 100755 --- a/bumpversion.sh +++ b/bumpversion.sh @@ -1,6 +1,6 @@ #!/bin/bash ## -## Copyright 2021 Ocean Protocol Foundation +## Copyright 2022 Ocean Protocol Foundation ## SPDX-License-Identifier: Apache-2.0 ## diff --git a/conftest.py b/conftest.py index b8386c734..e6d2f5bdd 100644 --- a/conftest.py +++ b/conftest.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json @@ -7,6 +7,7 @@ import uuid import pytest + from ocean_lib.common.aquarius.aquarius_provider import AquariusProvider from ocean_lib.web3_internal.currency import from_wei, to_wei from ocean_lib.web3_internal.transactions import send_ether diff --git a/ocean_lib/__init__.py b/ocean_lib/__init__.py index 4d5fe0d16..3de0ee8f5 100644 --- a/ocean_lib/__init__.py +++ b/ocean_lib/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -7,5 +7,5 @@ __author__ = """OceanProtocol""" # fmt: off -__version__ = '0.8.5' +__version__ = '0.8.6' # fmt: on diff --git a/ocean_lib/assets/__init__.py b/ocean_lib/assets/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/assets/__init__.py +++ b/ocean_lib/assets/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/assets/asset.py b/ocean_lib/assets/asset.py index d8fb3208f..31f29a8e9 100644 --- a/ocean_lib/assets/asset.py +++ b/ocean_lib/assets/asset.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import copy @@ -11,6 +11,7 @@ from enforce_typing import enforce_types from eth_account.account import Account from eth_utils import add_0x_prefix + from ocean_lib.assets.credentials import AddressCredential from ocean_lib.assets.did import did_to_id from ocean_lib.common.agreements.consumable import ConsumableCodes diff --git a/ocean_lib/assets/asset_downloader.py b/ocean_lib/assets/asset_downloader.py index 6f89dfcf4..d92d5b06c 100644 --- a/ocean_lib/assets/asset_downloader.py +++ b/ocean_lib/assets/asset_downloader.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -8,6 +8,7 @@ from typing import Optional, Type from enforce_typing import enforce_types + from ocean_lib.assets.asset import V3Asset from ocean_lib.common.agreements.service_types import ServiceTypes from ocean_lib.data_provider.data_service_provider import DataServiceProvider diff --git a/ocean_lib/assets/asset_resolver.py b/ocean_lib/assets/asset_resolver.py index 071ef00d1..09178172b 100644 --- a/ocean_lib/assets/asset_resolver.py +++ b/ocean_lib/assets/asset_resolver.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """DID Resolver module.""" @@ -10,10 +10,11 @@ from typing import Optional from enforce_typing import enforce_types +from web3.main import Web3 + from ocean_lib.assets.asset import V3Asset from ocean_lib.common.aquarius.aquarius_provider import AquariusProvider from ocean_lib.models.data_token import DataToken -from web3.main import Web3 logger = logging.getLogger("keeper") diff --git a/ocean_lib/assets/credentials.py b/ocean_lib/assets/credentials.py index d40570a4b..067e16413 100644 --- a/ocean_lib/assets/credentials.py +++ b/ocean_lib/assets/credentials.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from typing import Optional from enforce_typing import enforce_types + from ocean_lib.common.agreements.consumable import ConsumableCodes, MalformedCredential diff --git a/ocean_lib/assets/did.py b/ocean_lib/assets/did.py index 9f7af4b89..a894a6317 100644 --- a/ocean_lib/assets/did.py +++ b/ocean_lib/assets/did.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """DID Lib to do DID's and DDO's.""" @@ -8,9 +8,10 @@ from enforce_typing import enforce_types from eth_utils import remove_0x_prefix -from ocean_lib.utils.utilities import checksum from web3 import Web3 +from ocean_lib.utils.utilities import checksum + OCEAN_PREFIX = "did:op:" diff --git a/ocean_lib/assets/test/__init__.py b/ocean_lib/assets/test/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/assets/test/__init__.py +++ b/ocean_lib/assets/test/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/assets/test/test_asset.py b/ocean_lib/assets/test/test_asset.py index 07b735f04..d74bad086 100644 --- a/ocean_lib/assets/test/test_asset.py +++ b/ocean_lib/assets/test/test_asset.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.assets.asset import V3Asset diff --git a/ocean_lib/assets/test/test_asset_downloader.py b/ocean_lib/assets/test/test_asset_downloader.py index 77c568541..59e4b036c 100644 --- a/ocean_lib/assets/test/test_asset_downloader.py +++ b/ocean_lib/assets/test/test_asset_downloader.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import os import pytest + from ocean_lib.assets.asset_downloader import download_asset_files from ocean_lib.common.agreements.service_types import ServiceTypes from ocean_lib.data_provider.data_service_provider import DataServiceProvider diff --git a/ocean_lib/assets/test/test_asset_resolver.py b/ocean_lib/assets/test/test_asset_resolver.py index 3149056de..eecc31276 100644 --- a/ocean_lib/assets/test/test_asset_resolver.py +++ b/ocean_lib/assets/test/test_asset_resolver.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json import pytest + from ocean_lib.assets.asset import V3Asset from ocean_lib.assets.asset_resolver import resolve_asset from tests.resources.ddo_helpers import wait_for_ddo diff --git a/ocean_lib/assets/test/test_did.py b/ocean_lib/assets/test/test_did.py index 1e236e4f2..35ee41e1f 100644 --- a/ocean_lib/assets/test/test_did.py +++ b/ocean_lib/assets/test/test_did.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """ @@ -11,6 +11,8 @@ import secrets import pytest +from web3 import Web3 + from ocean_lib.assets.did import ( DID, OCEAN_PREFIX, @@ -19,7 +21,6 @@ did_to_id_bytes, id_to_did, ) -from web3 import Web3 TEST_SERVICE_TYPE = "ocean-meta-storage" TEST_SERVICE_URL = "http://localhost:8005" diff --git a/ocean_lib/assets/test/test_utils.py b/ocean_lib/assets/test/test_utils.py index 621eb5e29..82e93b105 100644 --- a/ocean_lib/assets/test/test_utils.py +++ b/ocean_lib/assets/test/test_utils.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from unittest.mock import patch import pytest + from ocean_lib.assets.did import DID from ocean_lib.assets.trusted_algorithms import ( add_publisher_trusted_algorithm, diff --git a/ocean_lib/assets/trusted_algorithms.py b/ocean_lib/assets/trusted_algorithms.py index 2a9dfa00c..bbbfcd9b0 100644 --- a/ocean_lib/assets/trusted_algorithms.py +++ b/ocean_lib/assets/trusted_algorithms.py @@ -1,11 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json from typing import Optional, Union from enforce_typing import enforce_types + from ocean_lib.assets.asset import V3Asset from ocean_lib.assets.asset_resolver import resolve_asset from ocean_lib.common.agreements.service_types import ServiceTypes diff --git a/ocean_lib/common/__init__.py b/ocean_lib/common/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/common/__init__.py +++ b/ocean_lib/common/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/common/agreements/__init__.py b/ocean_lib/common/agreements/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/common/agreements/__init__.py +++ b/ocean_lib/common/agreements/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/common/agreements/consumable.py b/ocean_lib/common/agreements/consumable.py index 4046764e4..3ccd25a94 100644 --- a/ocean_lib/common/agreements/consumable.py +++ b/ocean_lib/common/agreements/consumable.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from enforce_typing import enforce_types diff --git a/ocean_lib/common/agreements/service_types.py b/ocean_lib/common/agreements/service_types.py index 91eacedb2..9e9b53678 100644 --- a/ocean_lib/common/agreements/service_types.py +++ b/ocean_lib/common/agreements/service_types.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """Agreements module.""" diff --git a/ocean_lib/common/aquarius/__init__.py b/ocean_lib/common/aquarius/__init__.py index 7c88d111c..13c4b8e53 100644 --- a/ocean_lib/common/aquarius/__init__.py +++ b/ocean_lib/common/aquarius/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """Ocean Aquarius module.""" diff --git a/ocean_lib/common/aquarius/aquarius.py b/ocean_lib/common/aquarius/aquarius.py index 49e4e1321..944ceb60c 100644 --- a/ocean_lib/common/aquarius/aquarius.py +++ b/ocean_lib/common/aquarius/aquarius.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """ @@ -12,6 +12,7 @@ from typing import Optional, Tuple, Union from enforce_typing import enforce_types + from ocean_lib.assets.asset import V3Asset from ocean_lib.common.http_requests.requests_session import get_requests_session diff --git a/ocean_lib/common/aquarius/aquarius_provider.py b/ocean_lib/common/aquarius/aquarius_provider.py index 251f28475..43bbc84c2 100644 --- a/ocean_lib/common/aquarius/aquarius_provider.py +++ b/ocean_lib/common/aquarius/aquarius_provider.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from typing import Any diff --git a/ocean_lib/common/aquarius/test/test_aquarius.py b/ocean_lib/common/aquarius/test/test_aquarius.py index f533a8663..64c31b617 100644 --- a/ocean_lib/common/aquarius/test/test_aquarius.py +++ b/ocean_lib/common/aquarius/test/test_aquarius.py @@ -1,8 +1,9 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest + from ocean_lib.common.aquarius.aquarius import Aquarius from tests.resources.ddo_helpers import wait_for_ddo from tests.resources.helper_functions import get_publisher_wallet diff --git a/ocean_lib/common/http_requests/__init__.py b/ocean_lib/common/http_requests/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/common/http_requests/__init__.py +++ b/ocean_lib/common/http_requests/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/common/http_requests/requests_session.py b/ocean_lib/common/http_requests/requests_session.py index 393a34fc7..5932c09da 100644 --- a/ocean_lib/common/http_requests/requests_session.py +++ b/ocean_lib/common/http_requests/requests_session.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from enforce_typing import enforce_types diff --git a/ocean_lib/config.py b/ocean_lib/config.py index c0666c4a9..760da3cb9 100644 --- a/ocean_lib/config.py +++ b/ocean_lib/config.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -9,8 +9,9 @@ from pathlib import Path from typing import Any, Dict, Optional, Union -import artifacts from enforce_typing import enforce_types + +import artifacts from ocean_lib.integer import Integer from ocean_lib.ocean.env_constants import ENV_CONFIG_FILE from ocean_lib.web3_internal.constants import GAS_LIMIT_DEFAULT diff --git a/ocean_lib/data_provider/__init__.py b/ocean_lib/data_provider/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/data_provider/__init__.py +++ b/ocean_lib/data_provider/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/data_provider/data_service_provider.py b/ocean_lib/data_provider/data_service_provider.py index 2d22da7be..6cd9d7c94 100644 --- a/ocean_lib/data_provider/data_service_provider.py +++ b/ocean_lib/data_provider/data_service_provider.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -10,7 +10,6 @@ import re from collections import namedtuple from decimal import Decimal -from datetime import datetime from json import JSONDecodeError from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union @@ -19,6 +18,10 @@ import requests from enforce_typing import enforce_types from eth_account.messages import encode_defunct +from requests.exceptions import InvalidURL +from requests.models import PreparedRequest, Response +from requests.sessions import Session + from ocean_lib.common.agreements.service_types import ServiceTypes from ocean_lib.common.http_requests.requests_session import get_requests_session from ocean_lib.config import Config @@ -28,9 +31,6 @@ from ocean_lib.web3_internal.currency import to_wei from ocean_lib.web3_internal.transactions import sign_hash from ocean_lib.web3_internal.wallet import Wallet -from requests.exceptions import InvalidURL -from requests.models import PreparedRequest, Response -from requests.sessions import Session logger = logging.getLogger(__name__) diff --git a/ocean_lib/data_provider/test/__init__.py b/ocean_lib/data_provider/test/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/data_provider/test/__init__.py +++ b/ocean_lib/data_provider/test/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/data_provider/test/test_data_service_provider.py b/ocean_lib/data_provider/test/test_data_service_provider.py index c4c3574fb..6f0ad8f78 100644 --- a/ocean_lib/data_provider/test/test_data_service_provider.py +++ b/ocean_lib/data_provider/test/test_data_service_provider.py @@ -1,17 +1,18 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from unittest.mock import Mock import pytest +from requests.exceptions import InvalidURL +from requests.models import Response + from ocean_lib.common.http_requests.requests_session import get_requests_session from ocean_lib.data_provider.data_service_provider import DataServiceProvider as DataSP from ocean_lib.data_provider.data_service_provider import urljoin from ocean_lib.exceptions import OceanEncryptAssetUrlsError -from requests.exceptions import InvalidURL -from requests.models import Response from tests.resources.helper_functions import get_publisher_ocean_instance from tests.resources.mocks.http_client_mock import ( HttpClientEmptyMock, diff --git a/ocean_lib/example_config.py b/ocean_lib/example_config.py index c583c64e1..b989312f3 100644 --- a/ocean_lib/example_config.py +++ b/ocean_lib/example_config.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -8,6 +8,7 @@ import os from enforce_typing import enforce_types + from ocean_lib.config import ( DEFAULT_METADATA_CACHE_URI, DEFAULT_PROVIDER_URL, diff --git a/ocean_lib/exceptions.py b/ocean_lib/exceptions.py index 71c820780..57a1acad9 100644 --- a/ocean_lib/exceptions.py +++ b/ocean_lib/exceptions.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/integer.py b/ocean_lib/integer.py index 3f8ec1e08..5d69d7bf6 100644 --- a/ocean_lib/integer.py +++ b/ocean_lib/integer.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from enforce_typing.decorator import enforce_types diff --git a/ocean_lib/models/__init__.py b/ocean_lib/models/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/models/__init__.py +++ b/ocean_lib/models/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/models/algorithm_metadata.py b/ocean_lib/models/algorithm_metadata.py index a536fef04..2f2be7984 100644 --- a/ocean_lib/models/algorithm_metadata.py +++ b/ocean_lib/models/algorithm_metadata.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json diff --git a/ocean_lib/models/balancer_constants.py b/ocean_lib/models/balancer_constants.py index 2cf69dc75..c9510887c 100644 --- a/ocean_lib/models/balancer_constants.py +++ b/ocean_lib/models/balancer_constants.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """ @@ -22,11 +22,11 @@ # from contracts/BConst.sol # FIXME: grab info directly from contract -BCONST_BONE = 10 ** 18 +BCONST_BONE = 10**18 BCONST_MIN_WEIGHT = BCONST_BONE # Enforced in BPool.sol BCONST_MAX_WEIGHT = BCONST_BONE * 50 # "" BCONST_MAX_TOTAL_WEIGHT = BCONST_BONE * 50 # "" -BCONST_MIN_BALANCE = int(BCONST_BONE / 10 ** 12) # "". value is 10**6 +BCONST_MIN_BALANCE = int(BCONST_BONE / 10**12) # "". value is 10**6 INIT_WEIGHT_DT = to_wei(9) INIT_WEIGHT_OCEAN = to_wei(1) diff --git a/ocean_lib/models/bfactory.py b/ocean_lib/models/bfactory.py index 061e173d0..feb802184 100644 --- a/ocean_lib/models/bfactory.py +++ b/ocean_lib/models/bfactory.py @@ -1,11 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from enforce_typing import enforce_types +from web3.logs import DISCARD + from ocean_lib.web3_internal.contract_base import ContractBase from ocean_lib.web3_internal.wallet import Wallet -from web3.logs import DISCARD from . import balancer_constants diff --git a/ocean_lib/models/bpool.py b/ocean_lib/models/bpool.py index b7aa35ff8..cf3a0e008 100644 --- a/ocean_lib/models/bpool.py +++ b/ocean_lib/models/bpool.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging @@ -8,12 +8,13 @@ from enforce_typing import enforce_types from eth_utils import remove_0x_prefix +from web3.datastructures import AttributeDict +from web3.main import Web3 + from ocean_lib.models import balancer_constants from ocean_lib.models.btoken import BToken from ocean_lib.web3_internal.currency import from_wei from ocean_lib.web3_internal.wallet import Wallet -from web3.datastructures import AttributeDict -from web3.main import Web3 logger = logging.getLogger(__name__) diff --git a/ocean_lib/models/btoken.py b/ocean_lib/models/btoken.py index ea5abe06e..a7e3e9847 100644 --- a/ocean_lib/models/btoken.py +++ b/ocean_lib/models/btoken.py @@ -1,8 +1,9 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from enforce_typing import enforce_types + from ocean_lib.web3_internal.contract_base import ContractBase from ocean_lib.web3_internal.wallet import Wallet diff --git a/ocean_lib/models/compute_input.py b/ocean_lib/models/compute_input.py index 04954f990..9159bf108 100644 --- a/ocean_lib/models/compute_input.py +++ b/ocean_lib/models/compute_input.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/models/data_token.py b/ocean_lib/models/data_token.py index 52d017a3f..d89ef3cc1 100644 --- a/ocean_lib/models/data_token.py +++ b/ocean_lib/models/data_token.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json @@ -12,17 +12,18 @@ import requests from enforce_typing import enforce_types from eth_utils import remove_0x_prefix -from ocean_lib.common.http_requests.requests_session import get_requests_session -from ocean_lib.data_provider.data_service_provider import DataServiceProvider -from ocean_lib.web3_internal.contract_base import ContractBase -from ocean_lib.web3_internal.currency import from_wei, pretty_ether_and_wei, to_wei -from ocean_lib.web3_internal.wallet import Wallet from web3 import Web3 from web3.datastructures import AttributeDict from web3.exceptions import MismatchedABI from web3.logs import DISCARD from websockets import ConnectionClosed +from ocean_lib.common.http_requests.requests_session import get_requests_session +from ocean_lib.data_provider.data_service_provider import DataServiceProvider +from ocean_lib.web3_internal.contract_base import ContractBase +from ocean_lib.web3_internal.currency import from_wei, pretty_ether_and_wei, to_wei +from ocean_lib.web3_internal.wallet import Wallet + OrderValues = namedtuple( "OrderValues", ("consumer", "amount", "serviceId", "startedAt", "marketFeeCollector", "marketFee"), diff --git a/ocean_lib/models/dispenser.py b/ocean_lib/models/dispenser.py index b7fb8620f..4c925dcf0 100644 --- a/ocean_lib/models/dispenser.py +++ b/ocean_lib/models/dispenser.py @@ -1,8 +1,9 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from enforce_typing import enforce_types + from ocean_lib.models.data_token import DataToken from ocean_lib.web3_internal.contract_base import ContractBase from ocean_lib.web3_internal.wallet import Wallet diff --git a/ocean_lib/models/dtfactory.py b/ocean_lib/models/dtfactory.py index d2e72b0fb..ffceb57eb 100644 --- a/ocean_lib/models/dtfactory.py +++ b/ocean_lib/models/dtfactory.py @@ -1,15 +1,16 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging from enforce_typing import enforce_types -from ocean_lib.web3_internal.contract_base import ContractBase -from ocean_lib.web3_internal.wallet import Wallet from web3.datastructures import AttributeDict from web3.logs import DISCARD +from ocean_lib.web3_internal.contract_base import ContractBase +from ocean_lib.web3_internal.wallet import Wallet + class DTFactory(ContractBase): CONTRACT_NAME = "DTFactory" diff --git a/ocean_lib/models/fixed_rate_exchange.py b/ocean_lib/models/fixed_rate_exchange.py index 39e8caac4..17561d1de 100644 --- a/ocean_lib/models/fixed_rate_exchange.py +++ b/ocean_lib/models/fixed_rate_exchange.py @@ -1,11 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from collections import namedtuple from typing import Optional, Union from enforce_typing import enforce_types + from ocean_lib.web3_internal.contract_base import ContractBase from ocean_lib.web3_internal.currency import to_wei from ocean_lib.web3_internal.wallet import Wallet diff --git a/ocean_lib/models/metadata.py b/ocean_lib/models/metadata.py index 0d0aee93b..1311148a5 100644 --- a/ocean_lib/models/metadata.py +++ b/ocean_lib/models/metadata.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import time @@ -7,9 +7,10 @@ from enforce_typing import enforce_types from eth_utils import remove_0x_prefix +from web3.datastructures import AttributeDict + from ocean_lib.web3_internal.contract_base import ContractBase from ocean_lib.web3_internal.wallet import Wallet -from web3.datastructures import AttributeDict class MetadataContract(ContractBase): diff --git a/ocean_lib/models/order.py b/ocean_lib/models/order.py index ff50631f5..d9505dff9 100644 --- a/ocean_lib/models/order.py +++ b/ocean_lib/models/order.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/models/test/conftest.py b/ocean_lib/models/test/conftest.py index 920d612c1..4d92178ef 100644 --- a/ocean_lib/models/test/conftest.py +++ b/ocean_lib/models/test/conftest.py @@ -1,11 +1,13 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import os import pytest from enforce_typing import enforce_types +from web3.main import Web3 + from ocean_lib.example_config import ExampleConfig from ocean_lib.models import btoken from ocean_lib.models.bfactory import BFactory @@ -22,10 +24,9 @@ get_ganache_wallet, get_web3, ) -from web3.main import Web3 _NETWORK = "ganache" -HUGEINT = 2 ** 255 +HUGEINT = 2**255 BobInfo = None AliceInfo = None diff --git a/ocean_lib/models/test/test_algorithm_metadata.py b/ocean_lib/models/test/test_algorithm_metadata.py index 3ffeba8b1..dc348efa7 100644 --- a/ocean_lib/models/test/test_algorithm_metadata.py +++ b/ocean_lib/models/test/test_algorithm_metadata.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json diff --git a/ocean_lib/models/test/test_balancer_core_direct_flow.py b/ocean_lib/models/test/test_balancer_core_direct_flow.py index 62287a166..b77dde66b 100644 --- a/ocean_lib/models/test/test_balancer_core_direct_flow.py +++ b/ocean_lib/models/test/test_balancer_core_direct_flow.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.models import balancer_constants @@ -90,7 +90,7 @@ def test_complete_flow( maxAmountIn=to_wei(2), tokenOut_address=DT_address, tokenAmountOut=to_wei(1), - maxPrice=2 ** 255, + maxPrice=2**255, from_wallet=bob_wallet, ) @@ -121,7 +121,7 @@ def test_complete_flow( tokenAmountIn=to_wei(1), tokenOut_address=OCEAN_address, minAmountOut=to_wei("0.0001"), - maxPrice=2 ** 255, + maxPrice=2**255, from_wallet=alice_wallet, ) diff --git a/ocean_lib/models/test/test_balancer_simple_for_users_flow.py b/ocean_lib/models/test/test_balancer_simple_for_users_flow.py index 952dac575..fa3b017ca 100644 --- a/ocean_lib/models/test/test_balancer_simple_for_users_flow.py +++ b/ocean_lib/models/test/test_balancer_simple_for_users_flow.py @@ -1,8 +1,9 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest + from ocean_lib.web3_internal.currency import to_wei diff --git a/ocean_lib/models/test/test_bfactory.py b/ocean_lib/models/test/test_bfactory.py index 77f58d074..fc887db1b 100644 --- a/ocean_lib/models/test/test_bfactory.py +++ b/ocean_lib/models/test/test_bfactory.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.models.bfactory import BFactory diff --git a/ocean_lib/models/test/test_bpool.py b/ocean_lib/models/test/test_bpool.py index 1a4a3b54e..a5b9e46a8 100644 --- a/ocean_lib/models/test/test_bpool.py +++ b/ocean_lib/models/test/test_bpool.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from decimal import Decimal @@ -7,6 +7,8 @@ import pytest from enforce_typing import enforce_types +from web3.main import Web3 + from ocean_lib.config import Config from ocean_lib.models.bfactory import BFactory from ocean_lib.models.bpool import BPool @@ -15,9 +17,8 @@ from ocean_lib.ocean.util import get_bfactory_address from ocean_lib.web3_internal.currency import to_wei from ocean_lib.web3_internal.wallet import Wallet -from web3.main import Web3 -HUGEINT = 2 ** 255 +HUGEINT = 2**255 def test_notokens_basic( diff --git a/ocean_lib/models/test/test_btoken.py b/ocean_lib/models/test/test_btoken.py index f6b1623c7..d810bb6f8 100644 --- a/ocean_lib/models/test/test_btoken.py +++ b/ocean_lib/models/test/test_btoken.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.models.btoken import BToken diff --git a/ocean_lib/models/test/test_compute_input.py b/ocean_lib/models/test/test_compute_input.py index 41ac6b54c..b0c34be41 100644 --- a/ocean_lib/models/test/test_compute_input.py +++ b/ocean_lib/models/test/test_compute_input.py @@ -1,8 +1,9 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest + from ocean_lib.models.compute_input import ComputeInput diff --git a/ocean_lib/models/test/test_datatoken.py b/ocean_lib/models/test/test_datatoken.py index ee50b7ef8..7ed27fc0d 100644 --- a/ocean_lib/models/test/test_datatoken.py +++ b/ocean_lib/models/test/test_datatoken.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json @@ -8,12 +8,13 @@ from unittest.mock import patch import pytest +from web3.exceptions import TimeExhausted, TransactionNotFound + from ocean_lib.assets.asset import V3Asset from ocean_lib.models.data_token import DataToken from ocean_lib.web3_internal.constants import ZERO_ADDRESS from ocean_lib.web3_internal.currency import to_wei from tests.resources.ddo_helpers import get_resource_path -from web3.exceptions import TimeExhausted, TransactionNotFound def test_ERC20(alice_ocean, alice_wallet, alice_address, bob_wallet, bob_address): diff --git a/ocean_lib/models/test/test_ddo.py b/ocean_lib/models/test/test_ddo.py index af1788948..ea935624a 100644 --- a/ocean_lib/models/test/test_ddo.py +++ b/ocean_lib/models/test/test_ddo.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import lzma @@ -7,6 +7,9 @@ import pytest from eth_utils import add_0x_prefix, remove_0x_prefix +from web3.logs import DISCARD +from web3.main import Web3 + from ocean_lib.assets.asset import V3Asset from ocean_lib.assets.credentials import AddressCredential from ocean_lib.common.agreements.consumable import ConsumableCodes, MalformedCredential @@ -17,8 +20,6 @@ from ocean_lib.utils.utilities import checksum from tests.resources.ddo_helpers import get_resource_path from tests.resources.helper_functions import get_consumer_wallet, get_publisher_wallet -from web3.logs import DISCARD -from web3.main import Web3 def get_ddo_sample(datatoken_address): diff --git a/ocean_lib/models/test/test_dispenser.py b/ocean_lib/models/test/test_dispenser.py index 11345d381..2fcbdbc78 100644 --- a/ocean_lib/models/test/test_dispenser.py +++ b/ocean_lib/models/test/test_dispenser.py @@ -1,9 +1,10 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest + from ocean_lib.models.dispenser import DispenserContract diff --git a/ocean_lib/models/test/test_dtfactory.py b/ocean_lib/models/test/test_dtfactory.py index d9d3cd0be..a61daab28 100644 --- a/ocean_lib/models/test/test_dtfactory.py +++ b/ocean_lib/models/test/test_dtfactory.py @@ -1,14 +1,15 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from unittest.mock import patch import pytest +from web3.exceptions import TimeExhausted + from ocean_lib.models.data_token import DataToken from ocean_lib.models.dtfactory import DTFactory from ocean_lib.web3_internal.currency import to_wei -from web3.exceptions import TimeExhausted def test_data_token_creation(web3, alice_wallet, dtfactory_address): diff --git a/ocean_lib/models/test/test_fixed_rate_exchange.py b/ocean_lib/models/test/test_fixed_rate_exchange.py index f58ebabad..eb810addd 100644 --- a/ocean_lib/models/test/test_fixed_rate_exchange.py +++ b/ocean_lib/models/test/test_fixed_rate_exchange.py @@ -1,11 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # +from web3.exceptions import ValidationError + from ocean_lib.models.data_token import DataToken from ocean_lib.models.fixed_rate_exchange import FixedRateExchange from ocean_lib.web3_internal.currency import from_wei, to_wei -from web3.exceptions import ValidationError def run_failing_tx(contract, fn, *args): diff --git a/ocean_lib/models/test/test_metadata.py b/ocean_lib/models/test/test_metadata.py index a66b2ef72..6043e544c 100644 --- a/ocean_lib/models/test/test_metadata.py +++ b/ocean_lib/models/test/test_metadata.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/models/test/test_order.py b/ocean_lib/models/test/test_order.py index d66e65630..0e03c09bf 100644 --- a/ocean_lib/models/test/test_order.py +++ b/ocean_lib/models/test/test_order.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import os from eth_utils import remove_0x_prefix + from ocean_lib.common.agreements.service_types import ServiceTypes from ocean_lib.models.data_token import DataToken from ocean_lib.models.order import Order diff --git a/ocean_lib/ocean/__init__.py b/ocean_lib/ocean/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/ocean/__init__.py +++ b/ocean_lib/ocean/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/ocean/env_constants.py b/ocean_lib/ocean/env_constants.py index 6e486ae62..c6ab4c562 100644 --- a/ocean_lib/ocean/env_constants.py +++ b/ocean_lib/ocean/env_constants.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """ diff --git a/ocean_lib/ocean/mint_fake_ocean.py b/ocean_lib/ocean/mint_fake_ocean.py index 4f8eba961..2e95bfbff 100644 --- a/ocean_lib/ocean/mint_fake_ocean.py +++ b/ocean_lib/ocean/mint_fake_ocean.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json diff --git a/ocean_lib/ocean/ocean.py b/ocean_lib/ocean/ocean.py index 6e8d68c9d..22aec42bf 100644 --- a/ocean_lib/ocean/ocean.py +++ b/ocean_lib/ocean/ocean.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -9,6 +9,8 @@ from enforce_typing import enforce_types from eth_utils import remove_0x_prefix +from web3.datastructures import AttributeDict + from ocean_lib.config import Config from ocean_lib.data_provider.data_service_provider import DataServiceProvider from ocean_lib.models.data_token import DataToken @@ -29,7 +31,6 @@ ) from ocean_lib.web3_internal.utils import get_network_name from ocean_lib.web3_internal.wallet import Wallet -from web3.datastructures import AttributeDict logger = logging.getLogger("ocean") diff --git a/ocean_lib/ocean/ocean_assets.py b/ocean_lib/ocean/ocean_assets.py index fbe8cc6f8..5c8ba9037 100644 --- a/ocean_lib/ocean/ocean_assets.py +++ b/ocean_lib/ocean/ocean_assets.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -14,6 +14,8 @@ from enforce_typing import enforce_types from eth_account.messages import encode_defunct from eth_utils import add_0x_prefix, remove_0x_prefix +from web3.main import Web3 + from ocean_lib.assets.asset import V3Asset from ocean_lib.assets.asset_downloader import download_asset_files from ocean_lib.assets.asset_resolver import resolve_asset @@ -43,7 +45,6 @@ from ocean_lib.web3_internal.transactions import sign_hash from ocean_lib.web3_internal.utils import get_network_name from ocean_lib.web3_internal.wallet import Wallet -from web3.main import Web3 logger = logging.getLogger("ocean") diff --git a/ocean_lib/ocean/ocean_compute.py b/ocean_lib/ocean/ocean_compute.py index d202709d7..3134d80db 100644 --- a/ocean_lib/ocean/ocean_compute.py +++ b/ocean_lib/ocean/ocean_compute.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging @@ -7,6 +7,7 @@ from enforce_typing import enforce_types from eth_account.messages import encode_defunct + from ocean_lib.assets.asset import V3Asset from ocean_lib.assets.asset_resolver import resolve_asset from ocean_lib.assets.trusted_algorithms import create_publisher_trusted_algorithms diff --git a/ocean_lib/ocean/ocean_exchange.py b/ocean_lib/ocean/ocean_exchange.py index 040da7146..21e55872d 100644 --- a/ocean_lib/ocean/ocean_exchange.py +++ b/ocean_lib/ocean/ocean_exchange.py @@ -1,12 +1,15 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # -from typing import Optional, Tuple, Union, List +from typing import List, Optional, Tuple, Union from enforce_typing import enforce_types from web3.datastructures import AttributeDict +from web3.exceptions import ValidationError +from web3.logs import DISCARD +from web3.main import Web3 from ocean_lib.config import Config from ocean_lib.exceptions import InsufficientBalance, VerifyTxFailed @@ -16,9 +19,6 @@ from ocean_lib.ocean.util import get_dtfactory_address from ocean_lib.web3_internal.currency import pretty_ether_and_wei from ocean_lib.web3_internal.wallet import Wallet -from web3.exceptions import ValidationError -from web3.logs import DISCARD -from web3.main import Web3 class OceanExchange: diff --git a/ocean_lib/ocean/ocean_pool.py b/ocean_lib/ocean/ocean_pool.py index 31ed9fe9d..6d8e16426 100644 --- a/ocean_lib/ocean/ocean_pool.py +++ b/ocean_lib/ocean/ocean_pool.py @@ -1,11 +1,14 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging from decimal import Decimal from enforce_typing import enforce_types +from scipy.interpolate import interp1d +from web3.main import Web3 + from ocean_lib.exceptions import InsufficientBalance, VerifyTxFailed from ocean_lib.models import balancer_constants from ocean_lib.models.bfactory import BFactory @@ -15,8 +18,6 @@ from ocean_lib.models.dtfactory import DTFactory from ocean_lib.web3_internal.currency import from_wei, to_wei from ocean_lib.web3_internal.wallet import Wallet -from scipy.interpolate import interp1d -from web3.main import Web3 logger = logging.getLogger(__name__) @@ -321,7 +322,7 @@ def buy_data_tokens( maxAmountIn=max_OCEAN_amount, # "" tokenOut_address=dtoken_address, # leaving pool tokenAmountOut=amount, # "" - maxPrice=2 ** 255, # here we limit by max_num_OCEAN, not price + maxPrice=2**255, # here we limit by max_num_OCEAN, not price from_wallet=from_wallet, ) @@ -356,7 +357,7 @@ def sell_data_tokens( tokenAmountIn=amount, # "" tokenOut_address=self.ocean_address, # leaving pool minAmountOut=min_OCEAN_amount, # "" - maxPrice=2 ** 255, # here we limit by max_num_OCEAN, not price + maxPrice=2**255, # here we limit by max_num_OCEAN, not price from_wallet=from_wallet, ) diff --git a/ocean_lib/ocean/test/test_ocean_assets.py b/ocean_lib/ocean/test/test_ocean_assets.py index 78d1d899d..667a3347c 100644 --- a/ocean_lib/ocean/test/test_ocean_assets.py +++ b/ocean_lib/ocean/test/test_ocean_assets.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import time @@ -8,6 +8,7 @@ import pytest from eth_utils import add_0x_prefix + from ocean_lib.assets.asset import V3Asset from ocean_lib.assets.did import DID, did_to_id from ocean_lib.common.agreements.consumable import ConsumableCodes diff --git a/ocean_lib/ocean/test/test_ocean_compute.py b/ocean_lib/ocean/test/test_ocean_compute.py index a3647e826..36d96e6b9 100644 --- a/ocean_lib/ocean/test/test_ocean_compute.py +++ b/ocean_lib/ocean/test/test_ocean_compute.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from datetime import datetime diff --git a/ocean_lib/ocean/test/test_ocean_exchange.py b/ocean_lib/ocean/test/test_ocean_exchange.py index f04c8f46a..9d4f97d24 100644 --- a/ocean_lib/ocean/test/test_ocean_exchange.py +++ b/ocean_lib/ocean/test/test_ocean_exchange.py @@ -1,12 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest + from ocean_lib.models.fixed_rate_exchange import FixedRateExchange from ocean_lib.ocean.ocean_exchange import OceanExchange - from ocean_lib.ocean.util import get_contracts_addresses from ocean_lib.web3_internal.currency import pretty_ether_and_wei, to_wei from tests.resources.helper_functions import get_consumer_wallet, get_publisher_wallet diff --git a/ocean_lib/ocean/test/test_ocean_pool.py b/ocean_lib/ocean/test/test_ocean_pool.py index 8c5c668ee..57caccdba 100644 --- a/ocean_lib/ocean/test/test_ocean_pool.py +++ b/ocean_lib/ocean/test/test_ocean_pool.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.ocean.util import get_ocean_token_address diff --git a/ocean_lib/ocean/test/test_util.py b/ocean_lib/ocean/test/test_util.py index c58047d64..7569095d6 100644 --- a/ocean_lib/ocean/test/test_util.py +++ b/ocean_lib/ocean/test/test_util.py @@ -1,9 +1,10 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest + from ocean_lib.ocean import util from ocean_lib.ocean.util import ( get_bfactory_address, diff --git a/ocean_lib/ocean/util.py b/ocean_lib/ocean/util.py index 4a84fa9c8..a2c2ffffb 100644 --- a/ocean_lib/ocean/util.py +++ b/ocean_lib/ocean/util.py @@ -1,10 +1,14 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from typing import Dict, Optional, Union from enforce_typing import enforce_types +from web3 import WebsocketProvider +from web3.main import Web3 +from web3.middleware import geth_poa_middleware + from ocean_lib.models.bfactory import BFactory from ocean_lib.models.dtfactory import DTFactory from ocean_lib.web3_internal.contract_utils import ( @@ -12,9 +16,6 @@ ) from ocean_lib.web3_internal.utils import get_network_name from ocean_lib.web3_internal.web3_overrides.http_provider import CustomHTTPProvider -from web3 import WebsocketProvider -from web3.main import Web3 -from web3.middleware import geth_poa_middleware GANACHE_URL = "http://127.0.0.1:8545" diff --git a/ocean_lib/services/service.py b/ocean_lib/services/service.py index a0b4e82a1..a77215671 100644 --- a/ocean_lib/services/service.py +++ b/ocean_lib/services/service.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """ @@ -12,6 +12,7 @@ from urllib.parse import urlparse from enforce_typing import enforce_types + from ocean_lib.common.agreements.service_types import ServiceTypes, ServiceTypesIndices from ocean_lib.data_provider.data_service_provider import DataServiceProvider diff --git a/ocean_lib/services/test/test_service.py b/ocean_lib/services/test/test_service.py index c36af48eb..8e61e2b45 100644 --- a/ocean_lib/services/test/test_service.py +++ b/ocean_lib/services/test/test_service.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.common.agreements.service_types import ServiceTypes diff --git a/ocean_lib/test/__init__.py b/ocean_lib/test/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/test/__init__.py +++ b/ocean_lib/test/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/test/test_config.py b/ocean_lib/test/test_config.py index 2dbda17f2..42f399846 100644 --- a/ocean_lib/test/test_config.py +++ b/ocean_lib/test/test_config.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import os.path import pytest + from ocean_lib.config import ( NAME_ADDRESS_FILE, NAME_AQUARIUS_URL, @@ -13,9 +14,9 @@ deprecated_environ_names, environ_names_and_sections, ) -from ocean_lib.ocean.util import GANACHE_URL from ocean_lib.ocean.env_constants import ENV_CONFIG_FILE from ocean_lib.ocean.ocean import Ocean +from ocean_lib.ocean.util import GANACHE_URL from tests.resources.ddo_helpers import get_resource_path diff --git a/ocean_lib/test/test_example_config.py b/ocean_lib/test/test_example_config.py index 4619ccf4d..0ab12a2d9 100644 --- a/ocean_lib/test/test_example_config.py +++ b/ocean_lib/test/test_example_config.py @@ -1,13 +1,13 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.config import ( DEFAULT_METADATA_CACHE_URI, DEFAULT_PROVIDER_URL, - SECTION_ETH_NETWORK, METADATA_CACHE_URI, + SECTION_ETH_NETWORK, ) from ocean_lib.example_config import NETWORK_NAME, ExampleConfig diff --git a/ocean_lib/test/test_exceptions.py b/ocean_lib/test/test_exceptions.py index 656357595..10a873591 100644 --- a/ocean_lib/test/test_exceptions.py +++ b/ocean_lib/test/test_exceptions.py @@ -1,11 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import uuid from unittest.mock import patch import pytest + from ocean_lib.assets.asset import V3Asset from ocean_lib.exceptions import AquariusError, ContractNotFound, InsufficientBalance from ocean_lib.web3_internal.constants import ZERO_ADDRESS diff --git a/ocean_lib/utils/__init__.py b/ocean_lib/utils/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/utils/__init__.py +++ b/ocean_lib/utils/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/utils/test/test_utilities.py b/ocean_lib/utils/test/test_utilities.py index 7c98ed774..c5b3e8ca5 100644 --- a/ocean_lib/utils/test/test_utilities.py +++ b/ocean_lib/utils/test/test_utilities.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.utils import utilities diff --git a/ocean_lib/utils/utilities.py b/ocean_lib/utils/utilities.py index 08d042d3a..bfc63dd6e 100644 --- a/ocean_lib/utils/utilities.py +++ b/ocean_lib/utils/utilities.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # """Utilities class""" diff --git a/ocean_lib/web3_internal/__init__.py b/ocean_lib/web3_internal/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/web3_internal/__init__.py +++ b/ocean_lib/web3_internal/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/web3_internal/constants.py b/ocean_lib/web3_internal/constants.py index 1cdf1ac36..15e16caef 100644 --- a/ocean_lib/web3_internal/constants.py +++ b/ocean_lib/web3_internal/constants.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -16,10 +16,10 @@ ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" -MAX_UINT256 = 2 ** 256 - 1 +MAX_UINT256 = 2**256 - 1 -MAX_INT256 = 2 ** 255 - 1 -MIN_INT256 = 2 ** 255 * -1 +MAX_INT256 = 2**255 - 1 +MIN_INT256 = 2**255 * -1 DEFAULT_NETWORK_NAME = "ganache" NETWORK_NAME_MAP = { diff --git a/ocean_lib/web3_internal/contract_base.py b/ocean_lib/web3_internal/contract_base.py index 98caedae8..65ce388bf 100644 --- a/ocean_lib/web3_internal/contract_base.py +++ b/ocean_lib/web3_internal/contract_base.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -12,14 +12,6 @@ from enforce_typing import enforce_types from eth_typing import ChecksumAddress from hexbytes import HexBytes -from ocean_lib.web3_internal.constants import ENV_GAS_PRICE -from ocean_lib.web3_internal.contract_utils import ( - get_contract_definition, - get_contracts_addresses, - load_contract, -) -from ocean_lib.web3_internal.wallet import Wallet -from ocean_lib.web3_internal.web3_overrides.contract import CustomContractFunction from web3 import Web3 from web3._utils.events import get_event_data from web3._utils.filters import construct_event_filter_params @@ -29,6 +21,15 @@ from web3.exceptions import MismatchedABI, ValidationError from websockets import ConnectionClosed +from ocean_lib.web3_internal.constants import ENV_GAS_PRICE +from ocean_lib.web3_internal.contract_utils import ( + get_contract_definition, + get_contracts_addresses, + load_contract, +) +from ocean_lib.web3_internal.wallet import Wallet +from ocean_lib.web3_internal.web3_overrides.contract import CustomContractFunction + logger = logging.getLogger(__name__) diff --git a/ocean_lib/web3_internal/contract_utils.py b/ocean_lib/web3_internal/contract_utils.py index d79e9e3a7..7ca44766c 100644 --- a/ocean_lib/web3_internal/contract_utils.py +++ b/ocean_lib/web3_internal/contract_utils.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import importlib @@ -8,12 +8,13 @@ import os from typing import Any, Dict, Optional -import artifacts # noqa from enforce_typing import enforce_types from jsonsempai import magic # noqa: F401 from web3.contract import Contract from web3.main import Web3 +import artifacts # noqa + logger = logging.getLogger(__name__) diff --git a/ocean_lib/web3_internal/currency.py b/ocean_lib/web3_internal/currency.py index e1870bd1c..1c20572f3 100644 --- a/ocean_lib/web3_internal/currency.py +++ b/ocean_lib/web3_internal/currency.py @@ -1,14 +1,15 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from decimal import ROUND_DOWN, Context, Decimal, localcontext from typing import Union from enforce_typing import enforce_types -from ocean_lib.web3_internal.constants import MAX_UINT256 from web3.main import Web3 +from ocean_lib.web3_internal.constants import MAX_UINT256 + """decimal.Context tuned to accomadate MAX_WEI. * precision=78 because there are 78 digits in MAX_WEI (MAX_UINT256). diff --git a/ocean_lib/web3_internal/event_filter.py b/ocean_lib/web3_internal/event_filter.py index 16def919c..4f1ca81ac 100644 --- a/ocean_lib/web3_internal/event_filter.py +++ b/ocean_lib/web3_internal/event_filter.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging diff --git a/ocean_lib/web3_internal/event_listener.py b/ocean_lib/web3_internal/event_listener.py index a264e44e1..b2068e35c 100644 --- a/ocean_lib/web3_internal/event_listener.py +++ b/ocean_lib/web3_internal/event_listener.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -10,9 +10,10 @@ from typing import Callable, Optional, Union from enforce_typing import enforce_types +from web3.main import Web3 + from ocean_lib.web3_internal.contract_utils import load_contract from ocean_lib.web3_internal.event_filter import EventFilter -from web3.main import Web3 logger = logging.getLogger(__name__) diff --git a/ocean_lib/web3_internal/test/__init__.py b/ocean_lib/web3_internal/test/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/web3_internal/test/__init__.py +++ b/ocean_lib/web3_internal/test/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/web3_internal/test/conftest.py b/ocean_lib/web3_internal/test/conftest.py index 6e5a346ad..99f25a344 100644 --- a/ocean_lib/web3_internal/test/conftest.py +++ b/ocean_lib/web3_internal/test/conftest.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -10,6 +10,7 @@ # here we simply import that conftest's contents. import pytest + from ocean_lib.example_config import ExampleConfig from ocean_lib.models.test.conftest import * # noqa: F401 F403 diff --git a/ocean_lib/web3_internal/test/test_contract_base.py b/ocean_lib/web3_internal/test/test_contract_base.py index 27e972bec..2fa3bafc1 100644 --- a/ocean_lib/web3_internal/test/test_contract_base.py +++ b/ocean_lib/web3_internal/test/test_contract_base.py @@ -1,14 +1,15 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest from enforce_typing import enforce_types +from web3.contract import ContractCaller + from ocean_lib.web3_internal.contract_base import ContractBase from ocean_lib.web3_internal.currency import to_wei from ocean_lib.web3_internal.wallet import Wallet -from web3.contract import ContractCaller @enforce_types diff --git a/ocean_lib/web3_internal/test/test_currency.py b/ocean_lib/web3_internal/test/test_currency.py index bbd12ca78..16bb97ed0 100644 --- a/ocean_lib/web3_internal/test/test_currency.py +++ b/ocean_lib/web3_internal/test/test_currency.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from decimal import Decimal, localcontext import pytest + from ocean_lib.web3_internal.currency import ( ETHEREUM_DECIMAL_CONTEXT, MAX_ETHER, diff --git a/ocean_lib/web3_internal/test/test_event_filter.py b/ocean_lib/web3_internal/test/test_event_filter.py index 29a3e87cb..7df5ad267 100644 --- a/ocean_lib/web3_internal/test/test_event_filter.py +++ b/ocean_lib/web3_internal/test/test_event_filter.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/web3_internal/test/test_transactions.py b/ocean_lib/web3_internal/test/test_transactions.py index eb9ce1baf..10ce8d4c4 100644 --- a/ocean_lib/web3_internal/test/test_transactions.py +++ b/ocean_lib/web3_internal/test/test_transactions.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.web3_internal.currency import to_wei diff --git a/ocean_lib/web3_internal/test/test_utils.py b/ocean_lib/web3_internal/test/test_utils.py index b79e92a1b..c4488a88c 100644 --- a/ocean_lib/web3_internal/test/test_utils.py +++ b/ocean_lib/web3_internal/test/test_utils.py @@ -1,10 +1,11 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import os import pytest + from ocean_lib.web3_internal.utils import ( generate_multi_value_hash, get_chain_id, diff --git a/ocean_lib/web3_internal/test/test_wallet.py b/ocean_lib/web3_internal/test/test_wallet.py index cf875b720..1740ea27e 100644 --- a/ocean_lib/web3_internal/test/test_wallet.py +++ b/ocean_lib/web3_internal/test/test_wallet.py @@ -1,11 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import os import pytest from eth_account.messages import encode_defunct + from ocean_lib.web3_internal.wallet import Wallet diff --git a/ocean_lib/web3_internal/transactions.py b/ocean_lib/web3_internal/transactions.py index 658abc8e8..9f8f271d8 100644 --- a/ocean_lib/web3_internal/transactions.py +++ b/ocean_lib/web3_internal/transactions.py @@ -1,18 +1,19 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from typing import Optional, Union from enforce_typing import enforce_types from eth_account.messages import SignableMessage +from web3.datastructures import AttributeDict +from web3.main import Web3 + from ocean_lib.web3_internal.constants import BLOCK_NUMBER_POLL_INTERVAL from ocean_lib.web3_internal.wallet import Wallet from ocean_lib.web3_internal.web3_overrides.utils import ( wait_for_transaction_receipt_and_block_confirmations, ) -from web3.datastructures import AttributeDict -from web3.main import Web3 @enforce_types diff --git a/ocean_lib/web3_internal/utils.py b/ocean_lib/web3_internal/utils.py index b9a1e4d3b..1cbff4244 100644 --- a/ocean_lib/web3_internal/utils.py +++ b/ocean_lib/web3_internal/utils.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging @@ -7,16 +7,17 @@ from pathlib import Path from typing import Any, List, Optional -import artifacts from enforce_typing import enforce_types from eth_account.account import Account from eth_account.messages import encode_defunct from eth_keys import keys from eth_utils import big_endian_to_int, decode_hex from hexbytes.main import HexBytes +from web3.main import Web3 + +import artifacts from ocean_lib.web3_internal.constants import DEFAULT_NETWORK_NAME, NETWORK_NAME_MAP from ocean_lib.web3_internal.web3_overrides.signature import SignatureFix -from web3.main import Web3 Signature = namedtuple("Signature", ("v", "r", "s")) diff --git a/ocean_lib/web3_internal/wallet.py b/ocean_lib/web3_internal/wallet.py index b3b473b45..2e05c8ab9 100644 --- a/ocean_lib/web3_internal/wallet.py +++ b/ocean_lib/web3_internal/wallet.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging @@ -10,13 +10,14 @@ from eth_account.datastructures import SignedMessage from eth_account.messages import SignableMessage from hexbytes.main import HexBytes +from web3.main import Web3 + from ocean_lib.integer import Integer from ocean_lib.web3_internal.constants import ENV_MAX_GAS_PRICE, MIN_GAS_PRICE from ocean_lib.web3_internal.utils import ( private_key_to_address, private_key_to_public_key, ) -from web3.main import Web3 logger = logging.getLogger(__name__) diff --git a/ocean_lib/web3_internal/web3_overrides/__init__.py b/ocean_lib/web3_internal/web3_overrides/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/web3_internal/web3_overrides/__init__.py +++ b/ocean_lib/web3_internal/web3_overrides/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/web3_internal/web3_overrides/contract.py b/ocean_lib/web3_internal/web3_overrides/contract.py index 46b651cbf..7db36a7fb 100644 --- a/ocean_lib/web3_internal/web3_overrides/contract.py +++ b/ocean_lib/web3_internal/web3_overrides/contract.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import logging @@ -7,6 +7,9 @@ from enforce_typing import enforce_types from hexbytes.main import HexBytes +from web3.contract import prepare_transaction +from web3.main import Web3 + from ocean_lib.integer import Integer from ocean_lib.web3_internal.constants import BLOCK_NUMBER_POLL_INTERVAL from ocean_lib.web3_internal.utils import get_chain_id @@ -14,8 +17,6 @@ from ocean_lib.web3_internal.web3_overrides.utils import ( wait_for_transaction_receipt_and_block_confirmations, ) -from web3.contract import prepare_transaction -from web3.main import Web3 @enforce_types diff --git a/ocean_lib/web3_internal/web3_overrides/http_provider.py b/ocean_lib/web3_internal/web3_overrides/http_provider.py index a85721ac8..53c29c7a9 100644 --- a/ocean_lib/web3_internal/web3_overrides/http_provider.py +++ b/ocean_lib/web3_internal/web3_overrides/http_provider.py @@ -1,13 +1,14 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from typing import Any, Dict from enforce_typing import enforce_types -from ocean_lib.web3_internal.web3_overrides.request import make_post_request from web3 import HTTPProvider +from ocean_lib.web3_internal.web3_overrides.request import make_post_request + class CustomHTTPProvider(HTTPProvider): """Override requests to control the connection pool to make it blocking.""" diff --git a/ocean_lib/web3_internal/web3_overrides/request.py b/ocean_lib/web3_internal/web3_overrides/request.py index 1f1be344b..1b5b09e08 100644 --- a/ocean_lib/web3_internal/web3_overrides/request.py +++ b/ocean_lib/web3_internal/web3_overrides/request.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/web3_internal/web3_overrides/signature.py b/ocean_lib/web3_internal/web3_overrides/signature.py index 2bb22e721..38d0b7d6a 100644 --- a/ocean_lib/web3_internal/web3_overrides/signature.py +++ b/ocean_lib/web3_internal/web3_overrides/signature.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import codecs diff --git a/ocean_lib/web3_internal/web3_overrides/test/__init__.py b/ocean_lib/web3_internal/web3_overrides/test/__init__.py index f0bf09531..b07ba3365 100644 --- a/ocean_lib/web3_internal/web3_overrides/test/__init__.py +++ b/ocean_lib/web3_internal/web3_overrides/test/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/ocean_lib/web3_internal/web3_overrides/test/test_contract.py b/ocean_lib/web3_internal/web3_overrides/test/test_contract.py index 7c126f5a0..eeb97ffaf 100644 --- a/ocean_lib/web3_internal/web3_overrides/test/test_contract.py +++ b/ocean_lib/web3_internal/web3_overrides/test/test_contract.py @@ -1,8 +1,9 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import pytest + from ocean_lib.models.test.conftest import * # noqa from ocean_lib.web3_internal.currency import to_wei from ocean_lib.web3_internal.test.test_contract_base import MyFactory diff --git a/ocean_lib/web3_internal/web3_overrides/test/test_utils.py b/ocean_lib/web3_internal/web3_overrides/test/test_utils.py index d24e00000..4fd34ec32 100644 --- a/ocean_lib/web3_internal/web3_overrides/test/test_utils.py +++ b/ocean_lib/web3_internal/web3_overrides/test/test_utils.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from threading import Event, Thread, current_thread diff --git a/ocean_lib/web3_internal/web3_overrides/utils.py b/ocean_lib/web3_internal/web3_overrides/utils.py index f2c4d439c..10eefe92e 100644 --- a/ocean_lib/web3_internal/web3_overrides/utils.py +++ b/ocean_lib/web3_internal/web3_overrides/utils.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import time diff --git a/setup.py b/setup.py index 7cca7eef6..9638a815c 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -58,13 +58,12 @@ "pkginfo", "twine", "watchdog", - "flake8", - "isort", - "black==21.4b0", + "flake8==3.9.2", + "isort==5.10.1", + "black==22.1.0", + "licenseheaders==v0.8.8", "pre-commit", - # for the following: maybe needed, maybe not "pytest", - "licenseheaders", "pytest-env", ] @@ -99,7 +98,7 @@ url="https://github.com/oceanprotocol/ocean.py", # fmt: off # bumpversion.sh needs single-quotes - version='0.8.5', + version='0.8.6', # fmt: on zip_safe=False, ) diff --git a/tests/__init__.py b/tests/__init__.py index f0bf09531..b07ba3365 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/tests/integration/test_compute_flow.py b/tests/integration/test_compute_flow.py index c781389d3..d8aaadcec 100644 --- a/tests/integration/test_compute_flow.py +++ b/tests/integration/test_compute_flow.py @@ -1,10 +1,12 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import time import pytest +from web3.logs import DISCARD + from ocean_lib.assets.trusted_algorithms import create_publisher_trusted_algorithms from ocean_lib.common.agreements.service_types import ServiceTypes from ocean_lib.models.compute_input import ComputeInput @@ -27,7 +29,6 @@ get_publisher_ocean_instance, get_publisher_wallet, ) -from web3.logs import DISCARD class Setup: diff --git a/tests/integration/test_market_flow.py b/tests/integration/test_market_flow.py index fb4c0aeac..dd95ff9f4 100644 --- a/tests/integration/test_market_flow.py +++ b/tests/integration/test_market_flow.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -7,6 +7,7 @@ from ocean_lib.assets.asset import V3Asset from ocean_lib.common.agreements.service_types import ServiceTypes +from ocean_lib.data_provider.data_service_provider import DataServiceProvider from ocean_lib.services.service import Service from ocean_lib.web3_internal.currency import to_wei from tests.resources.ddo_helpers import get_metadata, get_registered_ddo @@ -19,7 +20,6 @@ get_publisher_wallet, mint_tokens_and_wait, ) -from ocean_lib.data_provider.data_service_provider import DataServiceProvider def test_market_flow(): diff --git a/tests/resources/__init__.py b/tests/resources/__init__.py index f0bf09531..b07ba3365 100644 --- a/tests/resources/__init__.py +++ b/tests/resources/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/tests/resources/ddo_helpers.py b/tests/resources/ddo_helpers.py index 9f95412cb..da9f9d8d0 100644 --- a/tests/resources/ddo_helpers.py +++ b/tests/resources/ddo_helpers.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json diff --git a/tests/resources/helper_functions.py b/tests/resources/helper_functions.py index 8b0f305ea..0ca386a2b 100644 --- a/tests/resources/helper_functions.py +++ b/tests/resources/helper_functions.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # @@ -11,6 +11,7 @@ import coloredlogs import yaml from enforce_typing import enforce_types + from ocean_lib.example_config import ExampleConfig from ocean_lib.models.data_token import DataToken from ocean_lib.ocean.ocean import Ocean diff --git a/tests/resources/mocks/__init__.py b/tests/resources/mocks/__init__.py index f0bf09531..b07ba3365 100644 --- a/tests/resources/mocks/__init__.py +++ b/tests/resources/mocks/__init__.py @@ -1,4 +1,4 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # diff --git a/tests/resources/mocks/data_provider_mock.py b/tests/resources/mocks/data_provider_mock.py index cc714592b..d7dea5b61 100644 --- a/tests/resources/mocks/data_provider_mock.py +++ b/tests/resources/mocks/data_provider_mock.py @@ -1,15 +1,16 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import json import os +from requests.models import PreparedRequest + from ocean_lib.common.agreements.service_types import ServiceTypes from ocean_lib.common.http_requests.requests_session import get_requests_session from ocean_lib.data_provider.data_service_provider import DataServiceProvider, logger -from requests.models import PreparedRequest class DataProviderMock(DataServiceProvider): diff --git a/tests/resources/mocks/http_client_mock.py b/tests/resources/mocks/http_client_mock.py index 3f877ed1a..125a0c7f6 100644 --- a/tests/resources/mocks/http_client_mock.py +++ b/tests/resources/mocks/http_client_mock.py @@ -1,5 +1,5 @@ # -# Copyright 2021 Ocean Protocol Foundation +# Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import inspect