Skip to content
Snippets Groups Projects
Commit 0a44e576 authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

fix flake8

parent 20f306fc
No related branches found
No related tags found
No related merge requests found
......@@ -12,12 +12,14 @@ import sys
import string
import logging
log = logging.getLogger(__name__)
_bchr = chr
_bord = ord
if sys.version > '3':
long = int
_bchr = lambda x: bytes([x])
_bord = lambda x: x
def _bchr(x):
return bytes([x])
""" Default Prefix """
PREFIX = "GPH"
......@@ -106,8 +108,6 @@ class Base58(object):
"""
return gphBase58CheckEncode(self._hex)
def __bytes__(self):
assert False
def to_bytes(self):
""" Return raw bytes
......
......@@ -4,6 +4,7 @@ from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes, int, str
from builtins import super
import six
import sys
import logging
import hashlib
......@@ -62,7 +63,7 @@ def encrypt(privkey, passphrase):
a = bytes(addr, 'ascii')
salt = hashlib.sha256(hashlib.sha256(a).digest()).digest()[0:4]
if sys.version < '3':
if isinstance(passphrase, unicode):
if isinstance(passphrase, six.text_type):
passphrase = passphrase.encode("utf-8")
if SCRYPT_MODULE == "scrypt":
......@@ -103,8 +104,8 @@ def decrypt(encrypted_privkey, passphrase):
salt = d[0:4]
d = d[4:-4]
if sys.version < '3':
if isinstance(passphrase, unicode):
passphrase = passphrase.encode("utf-8")
if isinstance(passphrase, six.text_type):
passphrase = passphrase.encode("utf-8")
if SCRYPT_MODULE == "scrypt":
key = scrypt.hash(passphrase, salt, 16384, 8, 8)
elif SCRYPT_MODULE == "pylibscrypt":
......
......@@ -97,7 +97,6 @@ def sign_message(message, wif, hashfn=hashlib.sha256):
digest = hashfn(message).digest()
p = PrivateKey(wif).to_bytes()
if USE_SECP256K1:
ndata = secp256k1.ffi.new("const int *ndata")
......
......@@ -225,6 +225,7 @@ class PointInTime(object):
return struct.pack("<I", timegm(time.strptime((self.data + "UTC"), timeformat)))
else:
return struct.pack("<I", timegm(time.strptime((self.data + "UTC"), timeformat.encode("utf-8"))))
def __str__(self):
return self.data
......
......@@ -15,8 +15,6 @@ from beem.instance import set_shared_steem_instance
# Py3 compatibility
import sys
wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
core_unit = "STM"
nodes = ["wss://steemd.pevo.science", "wss://gtg.steem.house:8090", "wss://rpc.steemliberator.com", "wss://rpc.buildteam.io",
......@@ -186,7 +184,7 @@ class Testcases(unittest.TestCase):
if sys.version > '3':
_assertRaisesRegex = self.assertRaisesRegex
else:
_assertRaisesRegex = self.assertRaisesRegexp
_assertRaisesRegex = self.assertRaisesRegexp
with _assertRaisesRegex(ValueError, ".*Changes nothing.*"):
bts.disallow(
"STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment