Skip to content

Commit

Permalink
Merge pull request #378 from qstokkink/undeprecate_components
Browse files Browse the repository at this point in the history
Undeprecated various components
  • Loading branch information
qstokkink authored Nov 22, 2018
2 parents 00e8700 + b69c099 commit 39a0232
Show file tree
Hide file tree
Showing 32 changed files with 50 additions and 57 deletions.
10 changes: 5 additions & 5 deletions doc/overlay_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ To do this, fill your `main.py` file with the following code:
```python
from twisted.internet import reactor

from pyipv8.ipv8.deprecated.community import Community
from pyipv8.ipv8.community import Community
from pyipv8.ipv8_service import IPv8
from pyipv8.ipv8.configuration import get_default_configuration
from pyipv8.ipv8.keyvault.crypto import ECCrypto
Expand Down Expand Up @@ -141,7 +141,7 @@ We will now modify `main.py` again to print the current amount of peers:
from twisted.internet import reactor
from twisted.internet.task import LoopingCall

from pyipv8.ipv8.deprecated.community import Community
from pyipv8.ipv8.community import Community
from pyipv8.ipv8_service import IPv8
from pyipv8.ipv8.configuration import get_default_configuration
from pyipv8.ipv8.keyvault.crypto import ECCrypto
Expand Down Expand Up @@ -209,9 +209,9 @@ Update your `main.py` once again to contain the following code:
from twisted.internet import reactor
from twisted.internet.task import LoopingCall

from pyipv8.ipv8.deprecated.community import Community
from pyipv8.ipv8.deprecated.payload import Payload
from pyipv8.ipv8.deprecated.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from pyipv8.ipv8.community import Community
from pyipv8.ipv8.messaging.payload import Payload
from pyipv8.ipv8.messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from pyipv8.ipv8_service import IPv8
from pyipv8.ipv8.configuration import get_default_configuration
from pyipv8.ipv8.keyvault.crypto import ECCrypto
Expand Down
1 change: 0 additions & 1 deletion ipv8/REST/attestation_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from twisted.web import resource

from ..attestation.identity.community import IdentityCommunity
from ..attestation.trustchain.block import UNKNOWN_SEQ
from ..attestation.wallet.community import AttestationCommunity
from ..attestation.wallet.primitives.attestation import binary_relativity_sha256_4
from ..attestation.wallet.primitives.cryptosystem.boneh import generate_keypair
Expand Down
7 changes: 3 additions & 4 deletions ipv8/attestation/trustchain/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
from .block import TrustChainBlock, ValidationResult, EMPTY_PK, GENESIS_SEQ, UNKNOWN_SEQ, ANY_COUNTERPARTY_PK
from .caches import CrawlRequestCache, HalfBlockSignCache, IntroCrawlTimeout, ChainCrawlCache
from .database import TrustChainDB
from ...deprecated.community import Community
from ...deprecated.lazy_community import lazy_wrapper, lazy_wrapper_unsigned, lazy_wrapper_unsigned_wd, lazy_wrapper_wd
from ...deprecated.payload import IntroductionResponsePayload
from ...deprecated.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from ...community import Community
from ...lazy_community import lazy_wrapper, lazy_wrapper_unsigned, lazy_wrapper_unsigned_wd
from ...messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from .payload import *
from ...peer import Peer
from ...requestcache import RandomNumberCache, RequestCache
Expand Down
2 changes: 1 addition & 1 deletion ipv8/attestation/trustchain/payload.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import

from ...deprecated.payload import Payload
from ...messaging.payload import Payload


class CrawlRequestPayload(Payload):
Expand Down
6 changes: 3 additions & 3 deletions ipv8/attestation/wallet/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

from .caches import *
from .database import AttestationsDB
from ...deprecated.community import Community
from ...deprecated.lazy_community import lazy_wrapper
from ...deprecated.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from ...community import Community
from ...lazy_community import lazy_wrapper
from ...messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from .payload import *
from .primitives.attestation import (attest_sha256_4, binary_relativity_certainty, create_challenge,
create_challenge_response_from_pair, create_empty_relativity_map,
Expand Down
2 changes: 1 addition & 1 deletion ipv8/attestation/wallet/payload.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import

from ...deprecated.payload import Payload
from ...messaging.payload import Payload


class RequestAttestationPayload(Payload):
Expand Down
7 changes: 4 additions & 3 deletions ipv8/deprecated/community.py → ipv8/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
from time import time
from traceback import format_exception

from .lazy_community import lazy_wrapper, lazy_wrapper_unsigned, EZPackOverlay, lazy_wrapper_wd
from .payload import IntroductionRequestPayload, IntroductionResponsePayload, PuncturePayload, PunctureRequestPayload
from .payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from .lazy_community import lazy_wrapper, lazy_wrapper_unsigned, EZPackOverlay
from .messaging.payload import (IntroductionRequestPayload, IntroductionResponsePayload, PuncturePayload,
PunctureRequestPayload)
from .messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload


_DEFAULT_ADDRESSES = [
Expand Down
3 changes: 0 additions & 3 deletions ipv8/deprecated/__init__.py

This file was deleted.

9 changes: 4 additions & 5 deletions ipv8/dht/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

from ..peer import Peer
from ..requestcache import RandomNumberCache, RequestCache
from ..deprecated.payload_headers import BinMemberAuthenticationPayload
from ..deprecated.payload_headers import GlobalTimeDistributionPayload
from ..deprecated.community import Community
from ..deprecated.lazy_community import lazy_wrapper, lazy_wrapper_wd
from ..deprecated.payload import PuncturePayload
from ..messaging.payload import PuncturePayload
from ..messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from ..community import Community
from ..lazy_community import lazy_wrapper, lazy_wrapper_wd

from .storage import Storage
from .routing import RoutingTable, Node, distance, calc_node_id
Expand Down
4 changes: 2 additions & 2 deletions ipv8/dht/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from twisted.internet.task import LoopingCall
from twisted.python.failure import Failure

from ..deprecated.lazy_community import lazy_wrapper, lazy_wrapper_wd
from ..deprecated.payload_headers import GlobalTimeDistributionPayload
from ..lazy_community import lazy_wrapper, lazy_wrapper_wd
from ..messaging.payload_headers import GlobalTimeDistributionPayload
from .community import DHTCommunity, Request, PING_INTERVAL, TARGET_NODES, \
gatherResponses, MAX_NODES_IN_FIND
from .routing import NODE_STATUS_BAD, Node
Expand Down
2 changes: 1 addition & 1 deletion ipv8/dht/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from struct import pack, unpack, unpack_from, calcsize
from socket import inet_aton, inet_ntoa

from ..deprecated.payload import Payload
from ..messaging.payload import Payload
from .routing import Node


Expand Down
10 changes: 5 additions & 5 deletions ipv8/deprecated/lazy_community.py → ipv8/lazy_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from binascii import hexlify
from functools import wraps

from .payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from ..keyvault.crypto import default_eccrypto
from ..overlay import Overlay
from ..peer import Peer
from ..util import cast_to_bin
from .messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from .keyvault.crypto import default_eccrypto
from .overlay import Overlay
from .peer import Peer
from .util import cast_to_bin


def lazy_wrapper(*payloads):
Expand Down
6 changes: 3 additions & 3 deletions ipv8/messaging/anonymization/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from twisted.internet.task import LoopingCall

from .caches import *
from ...deprecated.community import Community
from ...deprecated.lazy_community import lazy_wrapper, lazy_wrapper_unsigned, lazy_wrapper_unsigned_wd
from ...deprecated.payload_headers import BinMemberAuthenticationPayload
from ...community import Community
from ...lazy_community import lazy_wrapper, lazy_wrapper_unsigned, lazy_wrapper_unsigned_wd
from ...messaging.payload_headers import BinMemberAuthenticationPayload
from ...messaging.deprecated.encoding import encode, decode
from .payload import *
from ...peer import Peer
Expand Down
2 changes: 1 addition & 1 deletion ipv8/messaging/anonymization/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import socket
from struct import pack, unpack_from

from ...deprecated.payload import Payload
from ...messaging.payload import Payload
from ...util import cast_to_bin, cast_to_chr

ADDRESS_TYPE_IPV4 = 0x01
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ipv8/messaging/interfaces/statistics_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time

from ...messaging.interfaces.endpoint import EndpointListener
from ...deprecated.network_stats import NetworkStat
from .network_stats import NetworkStat


class StatisticsEndpoint(EndpointListener):
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions ipv8/peerdiscovery/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from .churn import RandomChurn
from ..peer import Peer
from ..deprecated.community import Community
from ..deprecated.lazy_community import lazy_wrapper, lazy_wrapper_unsigned, PacketDecodingError
from ..deprecated.payload import IntroductionRequestPayload
from ..deprecated.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from ..community import Community
from ..lazy_community import lazy_wrapper, lazy_wrapper_unsigned, PacketDecodingError
from ..messaging.payload import IntroductionRequestPayload
from ..messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from .payload import PingPayload, PongPayload, SimilarityRequestPayload, SimilarityResponsePayload, \
DiscoveryIntroductionRequestPayload
from ..messaging.serialization import PackError
Expand Down
2 changes: 1 addition & 1 deletion ipv8/peerdiscovery/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from socket import inet_ntoa, inet_aton
from struct import pack, unpack

from ..deprecated.payload import decode_connection_type, encode_connection_type, IntroductionRequestPayload, Payload
from ..messaging.payload import decode_connection_type, encode_connection_type, IntroductionRequestPayload, Payload


class SimilarityRequestPayload(Payload):
Expand Down
Empty file removed ipv8/test/deprecated/__init__.py
Empty file.
1 change: 0 additions & 1 deletion ipv8/test/dht/test_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from ...dht.community import DHTCommunity
from ...dht.provider import DHTCommunityProvider
from ...dht.routing import Node, distance, NODE_LIMIT_QUERIES
from ...util import maximum_integer


class TestDHTCommunity(TestBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from unittest import TestCase

from ...deprecated.bloomfilter import BloomFilter
from ...messaging.bloomfilter import BloomFilter
from ...util import grange


Expand Down
2 changes: 1 addition & 1 deletion ipv8/test/peerdiscovery/test_churn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from twisted.internet.defer import inlineCallbacks

from ...peerdiscovery.churn import RandomChurn
from ...deprecated.community import _DEFAULT_ADDRESSES
from ...community import _DEFAULT_ADDRESSES
from ..base import TestBase
from ..mocking.community import MockCommunity
from ..mocking.endpoint import MockEndpointListener
Expand Down
4 changes: 2 additions & 2 deletions ipv8/test/peerdiscovery/test_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from twisted.internet.defer import inlineCallbacks

from ...deprecated.community import _DEFAULT_ADDRESSES
from ...deprecated.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from ...community import _DEFAULT_ADDRESSES
from ...messaging.payload_headers import BinMemberAuthenticationPayload, GlobalTimeDistributionPayload
from ..base import TestBase
from ..mocking.community import MockCommunity
from ...keyvault.crypto import default_eccrypto
Expand Down
2 changes: 1 addition & 1 deletion ipv8/test/peerdiscovery/test_edge_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from twisted.internet.defer import inlineCallbacks

from ...peerdiscovery.discovery import EdgeWalk
from ...deprecated.community import _DEFAULT_ADDRESSES
from ...community import _DEFAULT_ADDRESSES
from ..base import TestBase
from ..mocking.community import MockCommunity

Expand Down
2 changes: 1 addition & 1 deletion ipv8/test/peerdiscovery/test_random_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from twisted.internet.defer import inlineCallbacks

from ...peerdiscovery.discovery import RandomWalk
from ...deprecated.community import _DEFAULT_ADDRESSES
from ...community import _DEFAULT_ADDRESSES
from ..base import TestBase
from ..mocking.community import MockCommunity

Expand Down
2 changes: 1 addition & 1 deletion stresstest/bootstrap_rtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from ipv8_service import _COMMUNITIES, IPv8
from ipv8.configuration import get_default_configuration
from ipv8.deprecated.community import _DEFAULT_ADDRESSES, _DNS_ADDRESSES, Community
from ipv8.community import _DEFAULT_ADDRESSES, _DNS_ADDRESSES, Community
from ipv8.keyvault.crypto import ECCrypto
from ipv8.peer import Peer
from ipv8.requestcache import NumberCache, RequestCache
Expand Down
2 changes: 1 addition & 1 deletion stresstest/peer_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from ipv8_service import _COMMUNITIES, IPv8
from ipv8.configuration import get_default_configuration
from ipv8.deprecated.community import Community
from ipv8.community import Community
from ipv8.keyvault.crypto import ECCrypto
from ipv8.peer import Peer

Expand Down
3 changes: 1 addition & 2 deletions test_classes_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ ipv8/test/messaging/deprecated/test_encoding.py:TestEncoding
ipv8/test/messaging/interfaces/udp/test_endpoint.py:TestUDPEndpoint
ipv8/test/messaging/anonymization/test_community.py:TestTunnelCommunity
ipv8/test/messaging/anonymization/test_hiddenservices.py:TestHiddenServices

ipv8/test/deprecated/test_bloomfilter.py:TestBloomFilter
ipv8/test/messaging/test_bloomfilter.py:TestBloomFilter

ipv8/test/dht/test_community.py:TestDHTCommunity
ipv8/test/dht/test_discovery.py:TestDHTDiscoveryCommunity
Expand Down
4 changes: 2 additions & 2 deletions twisted/plugins/tracker_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from twisted.python.log import msg
from zope.interface import implements

from ipv8.deprecated.community import Community
from ipv8.deprecated.payload import IntroductionRequestPayload
from ipv8.community import Community
from ipv8.messaging.payload import IntroductionRequestPayload
from ipv8.keyvault.crypto import default_eccrypto
from ipv8.messaging.interfaces.udp.endpoint import UDPEndpoint
from ipv8.peer import Peer
Expand Down

0 comments on commit 39a0232

Please sign in to comment.