From dfc72519444f992a2116c77be3e48ffe5cfa2df1 Mon Sep 17 00:00:00 2001 From: Marko Kosmerl Date: Sat, 28 Jul 2018 20:15:56 +0200 Subject: [PATCH 1/2] Removing transaction symbols from package namespace --- docs/types.rst | 7 +++++-- examples/mam_js_send.py | 3 ++- examples/multisig.py | 7 +++++-- iota/__init__.py | 1 - iota/api.py | 9 +++++---- iota/commands/core/attach_to_tangle.py | 2 +- iota/commands/core/broadcast_transactions.py | 2 +- iota/commands/core/check_consistency.py | 2 +- iota/commands/core/find_transactions.py | 3 ++- iota/commands/core/get_inclusion_states.py | 2 +- iota/commands/core/get_node_info.py | 2 +- iota/commands/core/get_transactions_to_approve.py | 2 +- iota/commands/core/get_trytes.py | 2 +- iota/commands/core/store_transactions.py | 2 +- iota/commands/extended/get_account_data.py | 3 ++- iota/commands/extended/get_bundles.py | 5 +++-- iota/commands/extended/get_latest_inclusion.py | 2 +- iota/commands/extended/prepare_transfer.py | 4 ++-- iota/commands/extended/promote_transaction.py | 4 +++- iota/commands/extended/replay_bundle.py | 3 ++- iota/commands/extended/send_transfer.py | 5 ++++- iota/commands/extended/send_trytes.py | 3 ++- iota/commands/extended/utils.py | 5 +++-- iota/multisig/api.py | 3 ++- iota/multisig/commands/prepare_multisig_transfer.py | 3 ++- iota/multisig/transaction.py | 2 +- iota/transaction/__init__.py | 10 +--------- test/commands/core/attach_to_tangle_test.py | 5 +++-- test/commands/core/broadcast_transactions_test.py | 3 ++- test/commands/core/check_consistency_test.py | 3 ++- test/commands/core/find_transactions_test.py | 3 ++- test/commands/core/get_inclusion_states_test.py | 4 ++-- test/commands/core/get_node_info_test.py | 3 ++- test/commands/core/get_transactions_to_approve_test.py | 3 ++- test/commands/core/get_trytes_test.py | 3 ++- test/commands/core/store_transactions_test.py | 3 ++- test/commands/extended/broadcast_and_store_test.py | 3 ++- test/commands/extended/get_account_data_test.py | 4 +++- test/commands/extended/get_bundles_test.py | 6 ++++-- test/commands/extended/get_inputs_test.py | 3 ++- test/commands/extended/get_latest_inclusion_test.py | 3 ++- test/commands/extended/get_transfers_test.py | 3 ++- test/commands/extended/helpers_test.py | 2 +- test/commands/extended/prepare_transfer_test.py | 6 ++++-- test/commands/extended/promote_transaction_test.py | 4 +++- test/commands/extended/replay_bundle_test.py | 6 ++++-- test/commands/extended/send_transfer_test.py | 6 ++++-- test/commands/extended/send_trytes_test.py | 3 ++- test/filters_test.py | 3 ++- .../commands/prepare_multisig_transfer_test.py | 5 ++++- test/multisig/transaction_test.py | 3 ++- test/transaction/base_test.py | 6 ++++-- test/transaction/creation_test.py | 6 +++--- test/transaction/types_test.py | 2 +- test/transaction/utils_test.py | 2 +- test/transaction/validator_test.py | 5 ++++- 56 files changed, 128 insertions(+), 81 deletions(-) diff --git a/docs/types.rst b/docs/types.rst index 559b531..261d208 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -101,7 +101,9 @@ Transaction .. code:: python - from iota import Address, ProposedTransaction, Tag, Transaction + from iota import Address, Tag + from iota.transaction.base import Transaction + from iota.transaction.creation import ProposedTransaction txn_1 =\ Transaction.from_tryte_string( @@ -293,7 +295,8 @@ ProposedBundle .. code:: python - from iota import Address, ProposedBundle, ProposedTransaction + from iota import Address + from iota.transaction.creation import ProposedBundle, ProposedTransaction from iota.crypto.signing import KeyGenerator bundle = ProposedBundle() diff --git a/examples/mam_js_send.py b/examples/mam_js_send.py index 23039eb..4472608 100644 --- a/examples/mam_js_send.py +++ b/examples/mam_js_send.py @@ -12,11 +12,12 @@ import filters as f from six import binary_type, text_type -from iota import Bundle, Iota, TransactionTrytes +from iota import Bundle, Iota from iota.bin import IotaCommandLineApp from iota.crypto.addresses import AddressGenerator from iota.filters import Trytes from iota.json import JsonEncoder +from iota.transaction.types import TransactionTrytes class IotaMamExample(IotaCommandLineApp): diff --git a/examples/multisig.py b/examples/multisig.py index ac1baba..09505ca 100644 --- a/examples/multisig.py +++ b/examples/multisig.py @@ -15,11 +15,14 @@ from typing import List -from iota import Address, Bundle, BundleValidator, ProposedTransaction, Tag, \ - TransactionTrytes, TryteString +from iota import Address, Tag, TryteString from iota.crypto.types import Digest, PrivateKey, Seed from iota.multisig import MultisigIota from iota.multisig.types import MultisigAddress +from iota.transaction.base import Bundle +from iota.transaction.creation import ProposedTransaction +from iota.transaction.types import TransactionTrytes +from iota.transaction.validator import BundleValidator """ Step 1: Each participant generates one or more digests that will be diff --git a/iota/__init__.py b/iota/__init__.py index 6a48287..d2dac83 100644 --- a/iota/__init__.py +++ b/iota/__init__.py @@ -33,7 +33,6 @@ # Make some imports accessible from the top level of the package. # Note that order is important, to prevent circular imports. from .types import * -from .transaction import * from .adapter import * from .api import * from .trits import * diff --git a/iota/api.py b/iota/api.py index c7e3c4c..2e419d3 100644 --- a/iota/api.py +++ b/iota/api.py @@ -2,18 +2,19 @@ from __future__ import absolute_import, division, print_function, \ unicode_literals -from typing import Dict, Iterable, Optional, Text - from six import with_metaclass +from typing import Dict, Iterable, Optional, Text -from iota import AdapterSpec, Address, BundleHash, ProposedTransaction, Tag, \ - TransactionHash, TransactionTrytes, TryteString, TrytesCompatible +from iota import AdapterSpec, Address, Tag, TryteString, TrytesCompatible from iota.adapter import BaseAdapter, resolve_adapter from iota.commands import BaseCommand, CustomCommand, core, \ discover_commands, extended from iota.commands.extended.helpers import Helpers from iota.crypto.addresses import AddressGenerator from iota.crypto.types import Seed +from iota.transaction.creation import ProposedTransaction +from iota.transaction.types import BundleHash, TransactionHash, \ + TransactionTrytes __all__ = [ 'InvalidCommand', diff --git a/iota/commands/core/attach_to_tangle.py b/iota/commands/core/attach_to_tangle.py index daefec5..358839c 100644 --- a/iota/commands/core/attach_to_tangle.py +++ b/iota/commands/core/attach_to_tangle.py @@ -4,8 +4,8 @@ import filters as f -from iota import TransactionHash, TransactionTrytes from iota.commands import FilterCommand, RequestFilter, ResponseFilter +from iota.transaction.types import TransactionHash, TransactionTrytes from iota.filters import Trytes __all__ = [ diff --git a/iota/commands/core/broadcast_transactions.py b/iota/commands/core/broadcast_transactions.py index 77625c7..16d31d1 100644 --- a/iota/commands/core/broadcast_transactions.py +++ b/iota/commands/core/broadcast_transactions.py @@ -4,9 +4,9 @@ import filters as f -from iota import TransactionTrytes from iota.commands import FilterCommand, RequestFilter from iota.filters import Trytes +from iota.transaction.types import TransactionTrytes __all__ = [ 'BroadcastTransactionsCommand', diff --git a/iota/commands/core/check_consistency.py b/iota/commands/core/check_consistency.py index 598322e..cddf62c 100644 --- a/iota/commands/core/check_consistency.py +++ b/iota/commands/core/check_consistency.py @@ -4,9 +4,9 @@ import filters as f -from iota import TransactionHash from iota.commands import FilterCommand, RequestFilter from iota.filters import Trytes +from iota.transaction.types import TransactionHash __all__ = [ 'CheckConsistencyCommand', diff --git a/iota/commands/core/find_transactions.py b/iota/commands/core/find_transactions.py index d2fe266..308fb75 100644 --- a/iota/commands/core/find_transactions.py +++ b/iota/commands/core/find_transactions.py @@ -5,9 +5,10 @@ import filters as f from six import iteritems -from iota import BundleHash, Tag, TransactionHash +from iota import Tag from iota.commands import FilterCommand, RequestFilter, ResponseFilter from iota.filters import AddressNoChecksum, Trytes +from iota.transaction.types import BundleHash, TransactionHash __all__ = [ 'FindTransactionsCommand', diff --git a/iota/commands/core/get_inclusion_states.py b/iota/commands/core/get_inclusion_states.py index bc3066e..6b1f8eb 100644 --- a/iota/commands/core/get_inclusion_states.py +++ b/iota/commands/core/get_inclusion_states.py @@ -4,9 +4,9 @@ import filters as f -from iota import TransactionHash from iota.commands import FilterCommand, RequestFilter from iota.filters import Trytes +from iota.transaction.types import TransactionHash __all__ = [ 'GetInclusionStatesCommand', diff --git a/iota/commands/core/get_node_info.py b/iota/commands/core/get_node_info.py index 85d4386..4bbb6e2 100644 --- a/iota/commands/core/get_node_info.py +++ b/iota/commands/core/get_node_info.py @@ -4,9 +4,9 @@ import filters as f -from iota import TransactionHash from iota.commands import FilterCommand, RequestFilter, ResponseFilter from iota.filters import Trytes +from iota.transaction.types import TransactionHash __all__ = [ 'GetNodeInfoCommand', diff --git a/iota/commands/core/get_transactions_to_approve.py b/iota/commands/core/get_transactions_to_approve.py index d9f9ac5..7c854f9 100644 --- a/iota/commands/core/get_transactions_to_approve.py +++ b/iota/commands/core/get_transactions_to_approve.py @@ -4,9 +4,9 @@ import filters as f -from iota import TransactionHash from iota.commands import FilterCommand, RequestFilter, ResponseFilter from iota.filters import Trytes +from iota.transaction.types import TransactionHash __all__ = [ 'GetTransactionsToApproveCommand', diff --git a/iota/commands/core/get_trytes.py b/iota/commands/core/get_trytes.py index 3915b59..af8c650 100644 --- a/iota/commands/core/get_trytes.py +++ b/iota/commands/core/get_trytes.py @@ -4,9 +4,9 @@ import filters as f -from iota import TransactionHash from iota.commands import FilterCommand, RequestFilter, ResponseFilter from iota.filters import Trytes +from iota.transaction.types import TransactionHash __all__ = [ 'GetTrytesCommand', diff --git a/iota/commands/core/store_transactions.py b/iota/commands/core/store_transactions.py index 0412eec..20d61d0 100644 --- a/iota/commands/core/store_transactions.py +++ b/iota/commands/core/store_transactions.py @@ -4,9 +4,9 @@ import filters as f -from iota import TransactionTrytes from iota.commands import FilterCommand, RequestFilter from iota.filters import Trytes +from iota.transaction.types import TransactionTrytes __all__ = [ 'StoreTransactionsCommand', diff --git a/iota/commands/extended/get_account_data.py b/iota/commands/extended/get_account_data.py index 7235d10..c182095 100644 --- a/iota/commands/extended/get_account_data.py +++ b/iota/commands/extended/get_account_data.py @@ -7,7 +7,7 @@ import filters as f -from iota import Address, TransactionHash +from iota import Address from iota.commands import FilterCommand, RequestFilter from iota.commands.core.find_transactions import FindTransactionsCommand from iota.commands.core.get_balances import GetBalancesCommand @@ -16,6 +16,7 @@ from iota.crypto.addresses import AddressGenerator from iota.crypto.types import Seed from iota.filters import Trytes, SecurityLevel +from iota.transaction.types import TransactionHash __all__ = [ 'GetAccountDataCommand', diff --git a/iota/commands/extended/get_bundles.py b/iota/commands/extended/get_bundles.py index bec1efc..b082f1f 100644 --- a/iota/commands/extended/get_bundles.py +++ b/iota/commands/extended/get_bundles.py @@ -6,12 +6,13 @@ import filters as f -from iota import BadApiResponse, Bundle, BundleHash, Transaction, \ - TransactionHash, TryteString +from iota import BadApiResponse, TryteString from iota.commands import FilterCommand, RequestFilter from iota.commands.core.get_trytes import GetTrytesCommand from iota.exceptions import with_context from iota.filters import Trytes +from iota.transaction.base import Bundle, Transaction +from iota.transaction.types import BundleHash, TransactionHash from iota.transaction.validator import BundleValidator __all__ = [ diff --git a/iota/commands/extended/get_latest_inclusion.py b/iota/commands/extended/get_latest_inclusion.py index cf96bbf..a40f387 100644 --- a/iota/commands/extended/get_latest_inclusion.py +++ b/iota/commands/extended/get_latest_inclusion.py @@ -6,11 +6,11 @@ import filters as f -from iota import TransactionHash from iota.commands import FilterCommand, RequestFilter from iota.commands.core.get_inclusion_states import GetInclusionStatesCommand from iota.commands.core.get_node_info import GetNodeInfoCommand from iota.filters import Trytes +from iota.transaction.types import TransactionHash __all__ = [ 'GetLatestInclusionCommand', diff --git a/iota/commands/extended/prepare_transfer.py b/iota/commands/extended/prepare_transfer.py index dd725b8..1cde797 100644 --- a/iota/commands/extended/prepare_transfer.py +++ b/iota/commands/extended/prepare_transfer.py @@ -6,8 +6,7 @@ import filters as f -from iota import Address, BadApiResponse, ProposedBundle, \ - ProposedTransaction +from iota import Address, BadApiResponse from iota.commands import FilterCommand, RequestFilter from iota.commands.core.get_balances import GetBalancesCommand from iota.commands.extended.get_inputs import GetInputsCommand @@ -16,6 +15,7 @@ from iota.crypto.types import Seed from iota.exceptions import with_context from iota.filters import GeneratedAddress, SecurityLevel, Trytes +from iota.transaction.creation import ProposedBundle, ProposedTransaction __all__ = [ 'PrepareTransferCommand', diff --git a/iota/commands/extended/promote_transaction.py b/iota/commands/extended/promote_transaction.py index 3bcbd1a..a6c4f4a 100644 --- a/iota/commands/extended/promote_transaction.py +++ b/iota/commands/extended/promote_transaction.py @@ -4,11 +4,13 @@ import filters as f -from iota import Address, BadApiResponse, ProposedTransaction, TransactionHash +from iota import Address, BadApiResponse from iota.commands import FilterCommand, RequestFilter from iota.commands.core.check_consistency import CheckConsistencyCommand from iota.commands.extended.send_transfer import SendTransferCommand from iota.filters import Trytes +from iota.transaction.creation import ProposedTransaction +from iota.transaction.types import TransactionHash __all__ = [ 'PromoteTransactionCommand', diff --git a/iota/commands/extended/replay_bundle.py b/iota/commands/extended/replay_bundle.py index aff8e1e..4344105 100644 --- a/iota/commands/extended/replay_bundle.py +++ b/iota/commands/extended/replay_bundle.py @@ -4,11 +4,12 @@ import filters as f -from iota import Bundle, TransactionHash from iota.commands import FilterCommand, RequestFilter from iota.commands.extended.get_bundles import GetBundlesCommand from iota.commands.extended.send_trytes import SendTrytesCommand from iota.filters import Trytes +from iota.transaction.base import Bundle +from iota.transaction.types import TransactionHash __all__ = [ 'ReplayBundleCommand', diff --git a/iota/commands/extended/send_transfer.py b/iota/commands/extended/send_transfer.py index ada6607..c772754 100644 --- a/iota/commands/extended/send_transfer.py +++ b/iota/commands/extended/send_transfer.py @@ -6,12 +6,15 @@ import filters as f -from iota import Address, Bundle, ProposedTransaction, TransactionHash +from iota import Address from iota.commands import FilterCommand, RequestFilter from iota.commands.extended.prepare_transfer import PrepareTransferCommand from iota.commands.extended.send_trytes import SendTrytesCommand from iota.crypto.types import Seed from iota.filters import SecurityLevel, Trytes +from iota.transaction.base import Bundle +from iota.transaction.creation import ProposedTransaction +from iota.transaction.types import TransactionHash __all__ = [ 'SendTransferCommand', diff --git a/iota/commands/extended/send_trytes.py b/iota/commands/extended/send_trytes.py index 7e54d38..fb2fc7b 100644 --- a/iota/commands/extended/send_trytes.py +++ b/iota/commands/extended/send_trytes.py @@ -6,13 +6,14 @@ import filters as f -from iota import TransactionHash, TransactionTrytes, TryteString +from iota import TryteString from iota.commands import FilterCommand, RequestFilter from iota.commands.core.attach_to_tangle import AttachToTangleCommand from iota.commands.core.get_transactions_to_approve import \ GetTransactionsToApproveCommand from iota.commands.extended.broadcast_and_store import BroadcastAndStoreCommand from iota.filters import Trytes +from iota.transaction.types import TransactionTrytes, TransactionHash __all__ = [ 'SendTrytesCommand', diff --git a/iota/commands/extended/utils.py b/iota/commands/extended/utils.py index 740ec43..0af7904 100644 --- a/iota/commands/extended/utils.py +++ b/iota/commands/extended/utils.py @@ -4,8 +4,7 @@ from typing import Generator, Iterable, List, Optional, Tuple -from iota import Address, Bundle, Transaction, \ - TransactionHash +from iota import Address from iota.adapter import BaseAdapter from iota.commands.core.find_transactions import FindTransactionsCommand from iota.commands.core.get_trytes import GetTrytesCommand @@ -14,6 +13,8 @@ GetLatestInclusionCommand from iota.crypto.addresses import AddressGenerator from iota.crypto.types import Seed +from iota.transaction.base import Bundle, Transaction +from iota.transaction.types import TransactionHash def find_transaction_objects(adapter, **kwargs): diff --git a/iota/multisig/api.py b/iota/multisig/api.py index 563f7ca..c801a52 100644 --- a/iota/multisig/api.py +++ b/iota/multisig/api.py @@ -4,12 +4,13 @@ from typing import Iterable, Optional -from iota import Address, Iota, ProposedTransaction +from iota import Address, Iota from iota.commands import discover_commands from iota.crypto.addresses import AddressGenerator from iota.crypto.types import Digest from iota.multisig import commands from iota.multisig.types import MultisigAddress +from iota.transaction.creation import ProposedTransaction __all__ = [ 'MultisigIota', diff --git a/iota/multisig/commands/prepare_multisig_transfer.py b/iota/multisig/commands/prepare_multisig_transfer.py index 7d43c2c..e523b42 100644 --- a/iota/multisig/commands/prepare_multisig_transfer.py +++ b/iota/multisig/commands/prepare_multisig_transfer.py @@ -6,13 +6,14 @@ import filters as f -from iota import Address, ProposedTransaction +from iota import Address from iota.commands import FilterCommand, RequestFilter from iota.commands.core import GetBalancesCommand from iota.exceptions import with_context from iota.filters import Trytes from iota.multisig.transaction import ProposedMultisigBundle from iota.multisig.types import MultisigAddress +from iota.transaction.creation import ProposedTransaction __all__ = [ 'PrepareMultisigTransferCommand', diff --git a/iota/multisig/transaction.py b/iota/multisig/transaction.py index 42e3d9d..c7297d3 100644 --- a/iota/multisig/transaction.py +++ b/iota/multisig/transaction.py @@ -4,9 +4,9 @@ from typing import Iterable -from iota import ProposedBundle from iota.exceptions import with_context from iota.multisig.types import MultisigAddress +from iota.transaction.creation import ProposedBundle __all__ = [ 'ProposedMultisigBundle', diff --git a/iota/transaction/__init__.py b/iota/transaction/__init__.py index 2414a61..3f3d02d 100644 --- a/iota/transaction/__init__.py +++ b/iota/transaction/__init__.py @@ -1,11 +1,3 @@ # coding=utf-8 from __future__ import absolute_import, division, print_function, \ - unicode_literals - -# Import symbols to package namespace, for backwards-compatibility with -# PyOTA 1.1.x. -from .base import * -from .creation import * -from .types import * -from .utils import * -from .validator import * + unicode_literals diff --git a/test/commands/core/attach_to_tangle_test.py b/test/commands/core/attach_to_tangle_test.py index 787a0ed..a82a8b6 100644 --- a/test/commands/core/attach_to_tangle_test.py +++ b/test/commands/core/attach_to_tangle_test.py @@ -2,15 +2,16 @@ from __future__ import absolute_import, division, print_function, \ unicode_literals +from six import binary_type, text_type from unittest import TestCase import filters as f from filters.test import BaseFilterTestCase -from iota import Iota, TransactionHash, TransactionTrytes, TryteString +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.core.attach_to_tangle import AttachToTangleCommand from iota.filters import Trytes -from six import binary_type, text_type +from iota.transaction.types import TransactionHash, TransactionTrytes class AttachToTangleRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/broadcast_transactions_test.py b/test/commands/core/broadcast_transactions_test.py index 17c104d..147b67b 100644 --- a/test/commands/core/broadcast_transactions_test.py +++ b/test/commands/core/broadcast_transactions_test.py @@ -8,11 +8,12 @@ from filters.test import BaseFilterTestCase from six import binary_type, text_type -from iota import Iota, TransactionTrytes, TryteString +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.core.broadcast_transactions import \ BroadcastTransactionsCommand from iota.filters import Trytes +from iota.transaction.types import TransactionTrytes class BroadcastTransactionsRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/check_consistency_test.py b/test/commands/core/check_consistency_test.py index 3b684b5..13cc796 100644 --- a/test/commands/core/check_consistency_test.py +++ b/test/commands/core/check_consistency_test.py @@ -7,10 +7,11 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Iota, TransactionHash, TryteString +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.core.check_consistency import CheckConsistencyCommand from iota.filters import Trytes +from iota.transaction.types import TransactionHash class CheckConsistencyRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/find_transactions_test.py b/test/commands/core/find_transactions_test.py index 960b72b..d5408b3 100644 --- a/test/commands/core/find_transactions_test.py +++ b/test/commands/core/find_transactions_test.py @@ -8,11 +8,12 @@ from filters.test import BaseFilterTestCase from six import text_type -from iota import Address, Iota, Tag, BundleHash, TransactionHash, TryteString +from iota import Address, Iota, Tag, TryteString from iota.adapter import MockAdapter from iota.commands.core.find_transactions import FindTransactionsCommand, \ FindTransactionsRequestFilter from iota.filters import Trytes +from iota.transaction.types import BundleHash, TransactionHash class FindTransactionsRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/get_inclusion_states_test.py b/test/commands/core/get_inclusion_states_test.py index 3a63c75..aea5b8f 100644 --- a/test/commands/core/get_inclusion_states_test.py +++ b/test/commands/core/get_inclusion_states_test.py @@ -6,11 +6,11 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Iota, TransactionHash, TryteString +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.core.get_inclusion_states import GetInclusionStatesCommand from iota.filters import Trytes -from six import binary_type, text_type +from iota.transaction.types import TransactionHash class GetInclusionStatesRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/get_node_info_test.py b/test/commands/core/get_node_info_test.py index 3c98afa..06273f5 100644 --- a/test/commands/core/get_node_info_test.py +++ b/test/commands/core/get_node_info_test.py @@ -6,9 +6,10 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Iota, TransactionHash +from iota import Iota from iota.adapter import MockAdapter from iota.commands.core.get_node_info import GetNodeInfoCommand +from iota.transaction.types import TransactionHash class GetNodeInfoRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/get_transactions_to_approve_test.py b/test/commands/core/get_transactions_to_approve_test.py index 5875fdc..a5e5dfc 100644 --- a/test/commands/core/get_transactions_to_approve_test.py +++ b/test/commands/core/get_transactions_to_approve_test.py @@ -6,11 +6,12 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Iota, TransactionHash +from iota import Iota from iota.adapter import MockAdapter from iota.commands.core.get_transactions_to_approve import \ GetTransactionsToApproveCommand from iota.filters import Trytes +from iota.transaction.types import TransactionHash class GetTransactionsToApproveRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/get_trytes_test.py b/test/commands/core/get_trytes_test.py index 7d6c284..843a884 100644 --- a/test/commands/core/get_trytes_test.py +++ b/test/commands/core/get_trytes_test.py @@ -7,10 +7,11 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Iota, TransactionHash, TryteString +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.core.get_trytes import GetTrytesCommand from iota.filters import Trytes +from iota.transaction.types import TransactionHash class GetTrytesRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/core/store_transactions_test.py b/test/commands/core/store_transactions_test.py index 57e2045..6f56373 100644 --- a/test/commands/core/store_transactions_test.py +++ b/test/commands/core/store_transactions_test.py @@ -8,10 +8,11 @@ from filters.test import BaseFilterTestCase from six import text_type -from iota import Iota, TransactionTrytes, TryteString +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.core.store_transactions import StoreTransactionsCommand from iota.filters import Trytes +from iota.transaction.types import TransactionTrytes class StoreTransactionsRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/extended/broadcast_and_store_test.py b/test/commands/extended/broadcast_and_store_test.py index 6e02dd2..93e18f3 100644 --- a/test/commands/extended/broadcast_and_store_test.py +++ b/test/commands/extended/broadcast_and_store_test.py @@ -6,9 +6,10 @@ from six import text_type -from iota import Iota, TransactionTrytes +from iota import Iota from iota.adapter import MockAdapter from iota.commands.extended.broadcast_and_store import BroadcastAndStoreCommand +from iota.transaction.types import TransactionTrytes class BroadcastAndStoreCommandTestCase(TestCase): diff --git a/test/commands/extended/get_account_data_test.py b/test/commands/extended/get_account_data_test.py index fd743f7..5a876a2 100644 --- a/test/commands/extended/get_account_data_test.py +++ b/test/commands/extended/get_account_data_test.py @@ -8,12 +8,14 @@ from filters.test import BaseFilterTestCase from six import binary_type -from iota import Address, Bundle, Iota, TransactionHash +from iota import Address, Iota from iota.adapter import MockAdapter from iota.commands.extended.get_account_data import GetAccountDataCommand, \ GetAccountDataRequestFilter from iota.crypto.types import Seed from iota.filters import Trytes +from iota.transaction.base import Bundle +from iota.transaction.types import TransactionHash from test import mock diff --git a/test/commands/extended/get_bundles_test.py b/test/commands/extended/get_bundles_test.py index 633dee9..e5a2abd 100644 --- a/test/commands/extended/get_bundles_test.py +++ b/test/commands/extended/get_bundles_test.py @@ -7,11 +7,13 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Address, BadApiResponse, Bundle, BundleHash, Fragment, Hash, \ - Iota, Tag, Transaction, TransactionHash, TransactionTrytes, Nonce +from iota import Address, BadApiResponse, Iota, Tag from iota.adapter import MockAdapter from iota.commands.extended.get_bundles import GetBundlesCommand from iota.filters import Trytes +from iota.transaction.base import Bundle, Transaction +from iota.transaction.types import BundleHash, Fragment, \ + Nonce, TransactionHash, TransactionTrytes class GetBundlesRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/extended/get_inputs_test.py b/test/commands/extended/get_inputs_test.py index de62d9f..6107fca 100644 --- a/test/commands/extended/get_inputs_test.py +++ b/test/commands/extended/get_inputs_test.py @@ -7,12 +7,13 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Address, BadApiResponse, Iota, TransactionHash +from iota import Address, BadApiResponse, Iota from iota.adapter import MockAdapter from iota.commands.extended.get_inputs import GetInputsCommand, GetInputsRequestFilter from iota.crypto.addresses import AddressGenerator from iota.crypto.types import Seed from iota.filters import Trytes +from iota.transaction.types import TransactionHash from test import mock diff --git a/test/commands/extended/get_latest_inclusion_test.py b/test/commands/extended/get_latest_inclusion_test.py index 375f631..e3f5297 100644 --- a/test/commands/extended/get_latest_inclusion_test.py +++ b/test/commands/extended/get_latest_inclusion_test.py @@ -7,11 +7,12 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Iota, TransactionHash, TryteString +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.extended.get_latest_inclusion import \ GetLatestInclusionCommand from iota.filters import Trytes +from iota.transaction.types import TransactionHash class GetLatestInclusionRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/commands/extended/get_transfers_test.py b/test/commands/extended/get_transfers_test.py index ff2f4f6..8c8f149 100644 --- a/test/commands/extended/get_transfers_test.py +++ b/test/commands/extended/get_transfers_test.py @@ -8,12 +8,13 @@ from filters.test import BaseFilterTestCase from six import binary_type -from iota import Address, Bundle, Iota, Tag, Transaction, TryteString +from iota import Address, Iota, Tag, TryteString from iota.adapter import MockAdapter from iota.commands.extended.get_transfers import GetTransfersCommand, \ GetTransfersRequestFilter from iota.crypto.types import Seed from iota.filters import Trytes +from iota.transaction.base import Bundle, Transaction from test import mock diff --git a/test/commands/extended/helpers_test.py b/test/commands/extended/helpers_test.py index 65059ab..7e5425c 100644 --- a/test/commands/extended/helpers_test.py +++ b/test/commands/extended/helpers_test.py @@ -4,7 +4,7 @@ from unittest import TestCase -from iota import Iota, TransactionHash +from iota import Iota from iota.adapter import MockAdapter diff --git a/test/commands/extended/prepare_transfer_test.py b/test/commands/extended/prepare_transfer_test.py index 91f3544..0a14d59 100644 --- a/test/commands/extended/prepare_transfer_test.py +++ b/test/commands/extended/prepare_transfer_test.py @@ -8,13 +8,15 @@ from filters.test import BaseFilterTestCase from six import binary_type, iterkeys -from iota import Address, BadApiResponse, Iota, ProposedTransaction, Tag, \ - TryteString, Transaction, TransactionHash +from iota import Address, BadApiResponse, Iota, Tag, TryteString from iota.adapter import MockAdapter from iota.commands.extended.prepare_transfer import PrepareTransferCommand from iota.crypto.addresses import AddressGenerator from iota.crypto.types import Seed from iota.filters import GeneratedAddress, Trytes +from iota.transaction.base import Transaction +from iota.transaction.creation import ProposedTransaction +from iota.transaction.types import TransactionHash from test import mock diff --git a/test/commands/extended/promote_transaction_test.py b/test/commands/extended/promote_transaction_test.py index 21f5b81..cf56ee4 100644 --- a/test/commands/extended/promote_transaction_test.py +++ b/test/commands/extended/promote_transaction_test.py @@ -8,10 +8,12 @@ from filters.test import BaseFilterTestCase from six import binary_type -from iota import Bundle, Iota, TransactionHash, TransactionTrytes, BadApiResponse +from iota import Iota, BadApiResponse from iota.adapter import MockAdapter from iota.commands.extended.promote_transaction import PromoteTransactionCommand from iota.filters import Trytes +from iota.transaction.base import Bundle +from iota.transaction.types import TransactionHash, TransactionTrytes from test import mock diff --git a/test/commands/extended/replay_bundle_test.py b/test/commands/extended/replay_bundle_test.py index 27e14a8..fc772a4 100644 --- a/test/commands/extended/replay_bundle_test.py +++ b/test/commands/extended/replay_bundle_test.py @@ -8,11 +8,13 @@ from filters.test import BaseFilterTestCase from six import binary_type -from iota import Address, Bundle, BundleHash, Fragment, Iota, Nonce, Tag, \ - Transaction, TransactionHash +from iota import Address, Iota, Tag from iota.adapter import MockAdapter from iota.commands.extended.replay_bundle import ReplayBundleCommand from iota.filters import Trytes +from iota.transaction.base import Bundle, Transaction +from iota.transaction.types import BundleHash, Fragment, \ + Nonce, TransactionHash from test import mock diff --git a/test/commands/extended/send_transfer_test.py b/test/commands/extended/send_transfer_test.py index aaedac8..6ca5aef 100644 --- a/test/commands/extended/send_transfer_test.py +++ b/test/commands/extended/send_transfer_test.py @@ -8,13 +8,15 @@ from filters.test import BaseFilterTestCase from six import binary_type -from iota import Address, Bundle, Iota, ProposedTransaction, TransactionHash, \ - TransactionTrytes, TryteString +from iota import Address, Iota, TryteString from iota.adapter import MockAdapter from iota.commands.extended.send_transfer import SendTransferCommand from iota.crypto.addresses import AddressGenerator from iota.crypto.types import Seed from iota.filters import Trytes +from iota.transaction.base import Bundle +from iota.transaction.creation import ProposedTransaction +from iota.transaction.types import TransactionHash, TransactionTrytes from test import mock diff --git a/test/commands/extended/send_trytes_test.py b/test/commands/extended/send_trytes_test.py index b2d4d02..1c92ad7 100644 --- a/test/commands/extended/send_trytes_test.py +++ b/test/commands/extended/send_trytes_test.py @@ -8,10 +8,11 @@ from filters.test import BaseFilterTestCase from six import binary_type, text_type -from iota import Iota, TransactionTrytes, TryteString, TransactionHash +from iota import Iota, TryteString from iota.adapter import MockAdapter from iota.commands.extended.send_trytes import SendTrytesCommand from iota.filters import Trytes +from iota.transaction.types import TransactionHash, TransactionTrytes class SendTrytesRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/filters_test.py b/test/filters_test.py index 40182d0..aa0c511 100644 --- a/test/filters_test.py +++ b/test/filters_test.py @@ -5,8 +5,9 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Address, TransactionHash, TryteString +from iota import Address, TryteString from iota.filters import AddressNoChecksum, GeneratedAddress, NodeUri, Trytes +from iota.transaction.types import TransactionHash class GeneratedAddressTestCase(BaseFilterTestCase): diff --git a/test/multisig/commands/prepare_multisig_transfer_test.py b/test/multisig/commands/prepare_multisig_transfer_test.py index 9cb0199..b72bd98 100644 --- a/test/multisig/commands/prepare_multisig_transfer_test.py +++ b/test/multisig/commands/prepare_multisig_transfer_test.py @@ -7,13 +7,16 @@ import filters as f from filters.test import BaseFilterTestCase -from iota import Address, Bundle, Fragment, ProposedTransaction +from iota import Address from iota.adapter import MockAdapter from iota.commands.core import GetBalancesCommand from iota.crypto.types import Digest from iota.multisig import MultisigIota from iota.multisig.commands import PrepareMultisigTransferCommand from iota.multisig.types import MultisigAddress +from iota.transaction.base import Bundle +from iota.transaction.creation import ProposedTransaction +from iota.transaction.types import Fragment class PrepareMultisigTransferRequestFilterTestCase(BaseFilterTestCase): diff --git a/test/multisig/transaction_test.py b/test/multisig/transaction_test.py index 3c1fecd..4b480cb 100644 --- a/test/multisig/transaction_test.py +++ b/test/multisig/transaction_test.py @@ -4,10 +4,11 @@ from unittest import TestCase -from iota import Address, ProposedTransaction +from iota import Address from iota.crypto.types import Digest from iota.multisig.transaction import ProposedMultisigBundle from iota.multisig.types import MultisigAddress +from iota.transaction.creation import ProposedTransaction class ProposedMultisigBundleTestCase(TestCase): diff --git a/test/transaction/base_test.py b/test/transaction/base_test.py index 092a479..16668da 100644 --- a/test/transaction/base_test.py +++ b/test/transaction/base_test.py @@ -4,8 +4,10 @@ from unittest import TestCase -from iota import Address, Bundle, BundleHash, Fragment, Hash, Nonce, Tag, \ - Transaction, TransactionHash, TransactionTrytes +from iota import Address, Hash, Tag +from iota.transaction.base import Bundle, Transaction +from iota.transaction.types import BundleHash, Fragment, Nonce, \ + TransactionHash, TransactionTrytes class BundleTestCase(TestCase): diff --git a/test/transaction/creation_test.py b/test/transaction/creation_test.py index f648e99..33b770b 100644 --- a/test/transaction/creation_test.py +++ b/test/transaction/creation_test.py @@ -4,11 +4,11 @@ from unittest import TestCase -from iota import Address, Fragment, ProposedBundle, ProposedTransaction, Tag, \ - TryteString +from iota import Address, Tag, TryteString from iota.crypto.signing import KeyGenerator from iota.crypto.types import Seed -from iota.transaction.types import BundleHash +from iota.transaction.types import BundleHash, Fragment +from iota.transaction.creation import ProposedBundle, ProposedTransaction class ProposedBundleTestCase(TestCase): diff --git a/test/transaction/types_test.py b/test/transaction/types_test.py index 6cbf1bf..148fb02 100644 --- a/test/transaction/types_test.py +++ b/test/transaction/types_test.py @@ -6,7 +6,7 @@ from six import binary_type -from iota import TransactionHash +from iota.transaction.types import TransactionHash class TransactionHashTestCase(TestCase): diff --git a/test/transaction/utils_test.py b/test/transaction/utils_test.py index 6fd09e8..1c8babc 100644 --- a/test/transaction/utils_test.py +++ b/test/transaction/utils_test.py @@ -4,7 +4,7 @@ from unittest import TestCase -from iota import convert_value_to_standard_unit +from iota.transaction.utils import convert_value_to_standard_unit class ConvertValueToStandardUnitTestCase(TestCase): diff --git a/test/transaction/validator_test.py b/test/transaction/validator_test.py index e88c2a9..9114b67 100644 --- a/test/transaction/validator_test.py +++ b/test/transaction/validator_test.py @@ -4,7 +4,10 @@ from unittest import TestCase -from iota import Address, Bundle, BundleHash, BundleValidator, TransactionTrytes +from iota import Address +from iota.transaction.base import Bundle +from iota.transaction.types import BundleHash, TransactionTrytes +from iota.transaction.validator import BundleValidator class BundleValidatorTestCase(TestCase): From febb05a9e5d33969d2203679bebb9e11dd600d66 Mon Sep 17 00:00:00 2001 From: Marko Kosmerl Date: Sat, 28 Jul 2018 20:20:29 +0200 Subject: [PATCH 2/2] Removing transaction symbols from package namespace - missed part --- docs/types.rst | 2 +- examples/mam_js_send.py | 3 ++- examples/routingwrapper_pow.py | 3 ++- examples/sandbox.py | 3 ++- examples/send_transfer.py | 7 ++++--- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/types.rst b/docs/types.rst index 261d208..edbc3bf 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -265,7 +265,7 @@ Bundle .. code:: python - from iota import Bundle + from iota.transaction.base import Bundle bundle = Bundle.from_tryte_strings([ b'GYPRVHBEZOOFXSHQBLCYW9ICTCISLHDBNMMVYD9JJHQMPQCTIQAQTJNNNJ9IDXLRCC...', diff --git a/examples/mam_js_send.py b/examples/mam_js_send.py index 4472608..47ef074 100644 --- a/examples/mam_js_send.py +++ b/examples/mam_js_send.py @@ -12,11 +12,12 @@ import filters as f from six import binary_type, text_type -from iota import Bundle, Iota +from iota import Iota from iota.bin import IotaCommandLineApp from iota.crypto.addresses import AddressGenerator from iota.filters import Trytes from iota.json import JsonEncoder +from iota.transaction.base import Bundle from iota.transaction.types import TransactionTrytes diff --git a/examples/routingwrapper_pow.py b/examples/routingwrapper_pow.py index 62da190..3426e6a 100644 --- a/examples/routingwrapper_pow.py +++ b/examples/routingwrapper_pow.py @@ -7,8 +7,9 @@ - https://pyota.readthedocs.io/en/develop/adapters.html#routingwrapper """ -from iota import Address, Iota, ProposedTransaction, Tag, TryteString +from iota import Address, Iota, Tag, TryteString from iota.adapter.wrappers import RoutingWrapper +from iota.transaction.creation import ProposedTransaction # Send PoW requests to local node. # All other requests go to light wallet node. diff --git a/examples/sandbox.py b/examples/sandbox.py index bbaac85..ac673b7 100644 --- a/examples/sandbox.py +++ b/examples/sandbox.py @@ -2,8 +2,9 @@ from __future__ import absolute_import, division, print_function, \ unicode_literals -from iota import Address, Iota, ProposedTransaction, Tag, TryteString +from iota import Address, Iota, Tag, TryteString from iota.adapter.sandbox import SandboxAdapter +from iota.transaction.creation import ProposedTransaction # Create the API client. api = Iota( diff --git a/examples/send_transfer.py b/examples/send_transfer.py index 22487da..d1199c3 100644 --- a/examples/send_transfer.py +++ b/examples/send_transfer.py @@ -2,19 +2,20 @@ """ Example script that shows how to use PyOTA to send a transfer to an address. """ + from argparse import ArgumentParser +from six import text_type from sys import argv +from address_generator import get_seed, output_seed from iota import ( __version__, Address, Iota, - ProposedTransaction, Tag, TryteString, ) -from six import text_type -from address_generator import get_seed, output_seed +from iota.transaction.creation import ProposedTransaction def main(address, depth, message, tag, uri, value):