Skip to content

Commit ecf4f0e

Browse files
committed
Moved protocol to network module
1 parent e578759 commit ecf4f0e

11 files changed

+20
-14
lines changed

src/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@
7373

7474
import helper_inbox
7575
import helper_sent
76-
import protocol
7776
import proofofwork
7877
import queues
7978
import shared
8079

8180
import shutdown
8281
import state
82+
import network.protocol as protocol
8383
from addresses import (
8484
addBMIfNotPresent,
8585
decodeAddress,

src/class_objectProcessor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import helper_sent
2020
import highlevelcrypto
2121
import l10n
22-
import protocol
2322
import queues
2423
import shared
2524
import state
25+
import network.protocol as protocol
2626
from addresses import (
2727
decodeAddress, decodeVarint,
2828
encodeAddress, encodeVarint, varintDecodeError

src/class_singleWorker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import highlevelcrypto
2121
import l10n
2222
import proofofwork
23-
import protocol
2423
import queues
2524
import shared
2625
import state
2726
import tr
27+
import network.protocol as protocol
2828
from addresses import decodeAddress, decodeVarint, encodeVarint
2929
from bmconfigparser import config
3030
from helper_sql import sqlExecute, sqlQuery

src/network/bmobject.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import logging
55
import time
66

7-
import protocol
87
import state
8+
import protocol
99
import connectionpool
1010
from network import dandelion_ins
1111
from highlevelcrypto import calculateInventoryHash

src/network/bmproto.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# magic imports!
1414
import addresses
1515
import knownnodes
16-
import protocol
1716
import state
1817
import connectionpool
18+
import protocol
1919
from bmconfigparser import config
2020
from queues import invQueue, objectProcessorQueue, portCheckerQueue
2121
from randomtrackingdict import RandomTrackingDict

src/network/connectionchooser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import random
77

88
import knownnodes
9-
import protocol
109
import state
10+
import protocol
1111
from bmconfigparser import config
1212
from queues import queue, portCheckerQueue
1313

src/protocol.py renamed to src/network/protocol.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
from binascii import hexlify
1414
from struct import Struct, pack, unpack
1515

16-
import defaults
17-
import highlevelcrypto
18-
import state
16+
try:
17+
import defaults
18+
import highlevelcrypto
19+
import state
20+
except ImportError:
21+
from pybitmessage import defaults, highlevelcrypto, state
22+
1923
from addresses import (
2024
encodeVarint, decodeVarint, decodeAddress, varintDecodeError)
2125
from bmconfigparser import config

src/tests/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
import time
1717
import unittest
1818

19-
import protocol
2019
import state
2120
import helper_sent
2221
import helper_addressbook
22+
import network.protocol as protocol
2323

2424
from bmconfigparser import config
2525
from helper_msgcoding import MsgEncode, MsgDecode

src/tests/test_api_thread.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from six.moves import queue, xmlrpc_client
99

10-
from pybitmessage import protocol
10+
from pybitmessage.network import protocol
1111
from pybitmessage.highlevelcrypto import calculateInventoryHash
1212

1313
from .partial import TestPartialRun

src/tests/test_packets.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from binascii import unhexlify
44
from struct import pack
55

6-
from pybitmessage import addresses, protocol
6+
import addresses
7+
from network import protocol
78

89
from .samples import (
910
sample_addr_data, sample_object_data, sample_object_expires)

src/tests/test_protocol.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import sys
66
import unittest
77

8-
from pybitmessage import protocol, state
9-
from pybitmessage.helper_startup import fixSocket
8+
import state
9+
from network import protocol
10+
from helper_startup import fixSocket
1011

1112

1213
class TestSocketInet(unittest.TestCase):

0 commit comments

Comments
 (0)