diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f42f1a34d66b541e449b9c48fc61cd4971b7a162..a6bca6e25c08ab173a6332a786f6206546f232ff 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,7 @@ Changelog ========= 0.23.0 ------ +* new chain ID for HF24 on HIVE has been added * set hive as default for default_chain * get_steem_nodes added to NodeList * Prepared for Hive HF 24 @@ -16,6 +17,8 @@ Changelog * Rshares, vote percentage and SBD/HBD calculation has been fixed for votes * post_rshares parameter added to all vote calculations * Account class has now get_token_power(), get_voting_value() and get_vote_pct_for_vote_value() +* HF 23 and HF24 operations were added thanks to @flugschwein +* Downvote power was added to Snapshot thanks to @flugschwein 0.22.14 ------- diff --git a/beem/blockchaininstance.py b/beem/blockchaininstance.py index 0754188c84093cf81658d1ee918bbab82f088b16..0c8c90f450c9cef23ae2902f4642279f36fd0ca5 100644 --- a/beem/blockchaininstance.py +++ b/beem/blockchaininstance.py @@ -1670,17 +1670,17 @@ class BlockChainInstance(object): if parse_body: def get_urls(mdstring): - return list(set(re.findall('http[s]*://[^\s"><\)\(]+', mdstring))) + return list(set(re.findall(r'http[s]*://[^\s"><\)\(]+', mdstring))) def get_users(mdstring): users = [] - for u in re.findall('(^|[^a-zA-Z0-9_!#$%&*@ï¼ \/]|(^|[^a-zA-Z0-9_+~.-\/#]))[@ï¼ ]([a-z][-\.a-z\d]+[a-z\d])', mdstring): + for u in re.findall(r'(^|[^a-zA-Z0-9_!#$%&*@ï¼ \/]|(^|[^a-zA-Z0-9_+~.-\/#]))[@ï¼ ]([a-z][-\.a-z\d]+[a-z\d])', mdstring): users.append(list(u)[-1]) return users def get_hashtags(mdstring): hashtags = [] - for t in re.findall('(^|\s)(#[-a-z\d]+)', mdstring): + for t in re.findall(r'(^|\s)(#[-a-z\d]+)', mdstring): hashtags.append(list(t)[-1]) return hashtags diff --git a/beem/cli.py b/beem/cli.py index d3b86b519be4950eade20f67d132068c8a0dca82..475e4326ef6f129ac58931eba0cb2e970b8be347 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -3590,9 +3590,9 @@ def info(objects): print(t.get_string(sortby="Key")) # Block for obj in objects: - if re.match("^[0-9-]*$", obj) or re.match("^-[0-9]*$", obj) or re.match("^[0-9-]*:[0-9]", obj) or re.match("^[0-9-]*:-[0-9]", obj): + if re.match(r"^[0-9-]*$", obj) or re.match(r"^-[0-9]*$", obj) or re.match(r"^[0-9-]*:[0-9]", obj) or re.match(r"^[0-9-]*:-[0-9]", obj): tran_nr = '' - if re.match("^[0-9-]*:[0-9-]", obj): + if re.match(r"^[0-9-]*:[0-9-]", obj): obj, tran_nr = obj.split(":") if int(obj) < 1: b = Blockchain(blockchain_instance=stm) @@ -3630,7 +3630,7 @@ def info(objects): print(t) else: print("Block number %s unknown" % obj) - elif re.match("^[a-zA-Z0-9\-\._]{2,16}$", obj): + elif re.match(r"^[a-zA-Z0-9\-\._]{2,16}$", obj): account = Account(obj, blockchain_instance=stm) t = PrettyTable(["Key", "Value"]) t.align = "l" @@ -3665,7 +3665,7 @@ def info(objects): except exceptions.WitnessDoesNotExistsException as e: print(str(e)) # Public Key - elif re.match("^" + stm.prefix + ".{48,55}$", obj): + elif re.match(r"^" + stm.prefix + ".{48,55}$", obj): account = stm.wallet.getAccountFromPublicKey(obj) if account: account = Account(account, blockchain_instance=stm) @@ -3677,7 +3677,7 @@ def info(objects): else: print("Public Key %s not known" % obj) # Post identifier - elif re.match(".*@.{3,16}/.*$", obj): + elif re.match(r".*@.{3,16}/.*$", obj): post = Comment(obj, blockchain_instance=stm) post_json = post.json() if post_json: diff --git a/beem/hive.py b/beem/hive.py index 6726e4e52f9b7ff1b7efefb7f79e56d7d11f8e6b..8868b74a24271941ccb3e6d9c313e1c1b706ea33 100644 --- a/beem/hive.py +++ b/beem/hive.py @@ -435,4 +435,4 @@ class Hive(BlockChainInstance): @property def vests_symbol(self): """ get the current chains symbol for VESTS """ - return self.vests_token_symbol + return self.vest_token_symbol diff --git a/beem/utils.py b/beem/utils.py index 6b27e701051c8093fd4078a200d533f975f5fade..5c410cdbea5d52f5b26a36b2f75a85ac33b5097f 100644 --- a/beem/utils.py +++ b/beem/utils.py @@ -98,14 +98,14 @@ def assets_from_string(text): Splits the string into two assets with the separator being on of the following: ``:``, ``/``, or ``-``. """ - return re.split(r"[\-:/]", text) + return re.split(r"[\-:\/]", text) def sanitize_permlink(permlink): permlink = permlink.strip() - permlink = re.sub("_|\s|\.", "-", permlink) - permlink = re.sub("[^\w-]", "", permlink) - permlink = re.sub("[^a-zA-Z0-9-]", "", permlink) + permlink = re.sub(r"_|\s|\.", "-", permlink) + permlink = re.sub(r"[^\w-]", "", permlink) + permlink = re.sub(r"[^a-zA-Z0-9-]", "", permlink) permlink = permlink.lower() return permlink @@ -154,15 +154,15 @@ def resolve_authorperm(identifier): """ # without any http(s) - match = re.match("@?([\w\-\.]*)/([\w\-]*)", identifier) + match = re.match(r"@?([\w\-\.]*)/([\w\-]*)", identifier) if hasattr(match, "group"): return match.group(1), match.group(2) # dtube url - match = re.match("([\w\-\.]+[^#?\s]+)/#!/v/?([\w\-\.]*)/([\w\-]*)", identifier) + match = re.match(r"([\w\-\.]+[^#?\s]+)/#!/v/?([\w\-\.]*)/([\w\-]*)", identifier) if hasattr(match, "group"): return match.group(2), match.group(3) # url - match = re.match("([\w\-\.]+[^#?\s]+)/@?([\w\-\.]*)/([\w\-]*)", identifier) + match = re.match(r"([\w\-\.]+[^#?\s]+)/@?([\w\-\.]*)/([\w\-]*)", identifier) if not hasattr(match, "group"): raise ValueError("Invalid identifier") return match.group(2), match.group(3) @@ -195,7 +195,7 @@ def construct_authorperm(*args): def resolve_root_identifier(url): - m = re.match("/([^/]*)/@([^/]*)/([^#]*).*", url) + m = re.match(r"/([^/]*)/@([^/]*)/([^#]*).*", url) if not m: return "", "" else: diff --git a/beemapi/graphenerpc.py b/beemapi/graphenerpc.py index 84dffaa282e2665fd0d7e98b10be5c7113426456..61ef1cdfefbf8b4f18881a9fe8c08dc50cf28a42 100644 --- a/beemapi/graphenerpc.py +++ b/beemapi/graphenerpc.py @@ -304,10 +304,12 @@ class GrapheneRPC(object): chain_id = None network_version = None is_hive = False + is_steem = False for key in props: if key[-8:] == "CHAIN_ID": chain_id = props[key] is_hive = key[:4] == "HIVE" + is_steem = key[:5] == "STEEM" elif key[-18:] == "BLOCKCHAIN_VERSION": network_version = props[key] diff --git a/setup.py b/setup.py index b2c8e48287b06cb01e165bb0c35eeb4c2381c6e9..11e1a410b83fc08bf04957caec8387193be80573 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ except LookupError: ascii = codecs.lookup('ascii') codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs')) -VERSION = '0.23.0' +VERSION = '0.23.1' tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized'] diff --git a/tests/beem/test_cli.py b/tests/beem/test_cli.py index ed01740f165e5426860ce61a384e599a124f6d40..8514c081511d160185e1c224ebfc633b2a729402 100644 --- a/tests/beem/test_cli.py +++ b/tests/beem/test_cli.py @@ -131,8 +131,10 @@ class Testcases(unittest.TestCase): def test_info2(self): runner = CliRunner() - result = runner.invoke(cli, ['info', '--', '-1:1']) + result = runner.invoke(cli, ['info', '--', '42725832:-1']) self.assertEqual(result.exit_code, 0) + result = runner.invoke(cli, ['info', '--', '42725832:1']) + self.assertEqual(result.exit_code, 0) result = runner.invoke(cli, ['info', 'gtg']) self.assertEqual(result.exit_code, 0) result = runner.invoke(cli, ['info', "@gtg/witness-gtg-log"])