|
10 | 10 | import time
|
11 | 11 | from distutils.version import StrictVersion
|
12 | 12 |
|
13 |
| -import sys |
14 |
| -if sys.version_info[0] == 3: |
15 |
| - from . import defaults |
16 |
| - from . import helper_random |
17 |
| - from . import paths |
18 |
| - from . import state |
19 |
| - from .bmconfigparser import BMConfigParser |
20 |
| -else: |
| 13 | +try: |
21 | 14 | import defaults
|
22 | 15 | import helper_random
|
23 | 16 | import paths
|
24 | 17 | import state
|
25 | 18 | from bmconfigparser import BMConfigParser
|
| 19 | +except ImportError: |
| 20 | + from . import defaults, helper_random, paths, state |
| 21 | + from .bmconfigparser import BMConfigParser |
26 | 22 |
|
27 | 23 | try:
|
28 | 24 | from plugins.plugin import get_plugin
|
@@ -180,9 +176,9 @@ def updateConfig():
|
180 | 176 | # acts as a salt
|
181 | 177 | config.set(
|
182 | 178 | 'bitmessagesettings', 'identiconsuffix', ''.join(
|
183 |
| - helper_random.randomchoice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") |
184 |
| - for x in range(12) |
185 |
| - ) |
| 179 | + helper_random.randomchoice( |
| 180 | + "123456789ABCDEFGHJKLMNPQRSTUVWXYZ" |
| 181 | + "abcdefghijkmnopqrstuvwxyz") for x in range(12)) |
186 | 182 | ) # a twelve character pseudo-password to salt the identicons
|
187 | 183 |
|
188 | 184 | # Add settings to support no longer resending messages after
|
@@ -249,14 +245,15 @@ def updateConfig():
|
249 | 245 | 'bitmessagesettings', 'maxacceptablenoncetrialsperbyte') == 0:
|
250 | 246 | config.set(
|
251 | 247 | 'bitmessagesettings', 'maxacceptablenoncetrialsperbyte',
|
252 |
| - str(defaults.ridiculousDifficulty * |
253 |
| - defaults.networkDefaultProofOfWorkNonceTrialsPerByte) |
| 248 | + str(defaults.ridiculousDifficulty |
| 249 | + * defaults.networkDefaultProofOfWorkNonceTrialsPerByte) |
254 | 250 | )
|
255 |
| - if config.safeGetInt('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') == 0: |
| 251 | + if config.safeGetInt( |
| 252 | + 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') == 0: |
256 | 253 | config.set(
|
257 | 254 | 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes',
|
258 |
| - str(defaults.ridiculousDifficulty * |
259 |
| - defaults.networkDefaultPayloadLengthExtraBytes) |
| 255 | + str(defaults.ridiculousDifficulty |
| 256 | + * defaults.networkDefaultPayloadLengthExtraBytes) |
260 | 257 | )
|
261 | 258 |
|
262 | 259 | if not config.has_option('bitmessagesettings', 'onionhostname'):
|
@@ -298,8 +295,8 @@ def adjustHalfOpenConnectionsLimit():
|
298 | 295 | # connections at a time.
|
299 | 296 | VER_THIS = StrictVersion(platform.version())
|
300 | 297 | is_limited = (
|
301 |
| - StrictVersion("5.1.2600") <= VER_THIS and |
302 |
| - StrictVersion("6.0.6000") >= VER_THIS |
| 298 | + StrictVersion("5.1.2600") <= VER_THIS |
| 299 | + and StrictVersion("6.0.6000") >= VER_THIS |
303 | 300 | )
|
304 | 301 | except ValueError:
|
305 | 302 | pass
|
|
0 commit comments