From 3ba1b97ba0f29ac2c12064f70502cb6364702994 Mon Sep 17 00:00:00 2001 From: Holger <holger@nahrstaedt.de> Date: Wed, 26 Sep 2018 12:07:32 +0200 Subject: [PATCH] release of 0.20.2 * estimated_mana is now capped by estimated_max * print_info fixed() * get_api_methods() and get_apis() added to Steem --- beem/account.py | 8 ++++++-- beem/steem.py | 14 ++++++++++++++ beem/version.py | 2 +- beemapi/version.py | 2 +- beembase/version.py | 2 +- beemgraphenebase/version.py | 2 +- docs/conf.py | 4 ++-- setup.py | 2 +- 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/beem/account.py b/beem/account.py index df835c01..a63c69b4 100644 --- a/beem/account.py +++ b/beem/account.py @@ -235,6 +235,8 @@ class Account(BlockchainObject): last_update = datetime.utcfromtimestamp(last_update_time) diff_in_seconds = (addTzInfo(datetime.utcnow()) - addTzInfo(last_update)).total_seconds() estimated_mana = int(current_mana + diff_in_seconds * estimated_max / STEEM_VOTING_MANA_REGENERATION_SECONDS) + if estimated_mana > estimated_max: + estimated_mana = estimated_max estimated_pct = estimated_mana / estimated_max * 100 return {"current_mana": current_mana, "last_update_time": last_update_time, "estimated_mana": estimated_mana, "estimated_max": estimated_max, "estimated_pct": estimated_pct} @@ -328,7 +330,7 @@ class Account(BlockchainObject): t.add_row(["Remaining Bandwidth", "%.2f %%" % (remaining)]) t.add_row(["used/allocated Bandwidth", "(%.0f kb of %.0f mb)" % (used_kb, allocated_mb)]) if rc_mana is not None: - t.add_row(["Remaining RC", "%.2f %%" % (rc_mana["current_mana"] / rc_mana["max_mana"] * 100)]) + t.add_row(["Remaining RC", "%.2f %%" % (rc_mana["estimated_pct"])]) t.add_row(["used/allocated RC", "(%.0f of %.0f)" % (int(rc["max_rc"]) * rc_mana["estimated_pct"], int(rc["max_rc"]))]) t.add_row(["Full in ", "%s" % (self.get_manabar_recharge_time_str(rc_mana))]) if return_str: @@ -350,7 +352,7 @@ class Account(BlockchainObject): ret += " (%.0f kb of %.0f mb)\n" % (used_kb, allocated_mb) if rc_mana is not None: ret += "--- RC manabar ---\n" - ret += "Remaining: %.2f %%" % (rc_mana["current_mana"] / rc_mana["estimated_max"] * 100) + ret += "Remaining: %.2f %%" % (rc_mana["estimated_pct"]) ret += " (%.0f of %.0f)\n" % (int(rc["max_rc"]) * rc_mana["estimated_pct"], int(rc["max_rc"])) ret += "full in %s \n" % (self.get_manabar_recharge_time_str(rc_mana)) if return_str: @@ -379,6 +381,8 @@ class Account(BlockchainObject): last_update = datetime.utcfromtimestamp(last_update_time) diff_in_seconds = (addTzInfo(datetime.utcnow()) - addTzInfo(last_update)).total_seconds() estimated_mana = int(current_mana + diff_in_seconds * estimated_max / STEEM_VOTING_MANA_REGENERATION_SECONDS) + if estimated_mana > estimated_max: + estimated_mana = estimated_max estimated_pct = estimated_mana / estimated_max * 100 return {"current_mana": current_mana, "last_update_time": last_update_time, "estimated_mana": estimated_mana, "estimated_max": estimated_max, "estimated_pct": estimated_pct} diff --git a/beem/steem.py b/beem/steem.py index 91ea0a48..94f5603e 100644 --- a/beem/steem.py +++ b/beem/steem.py @@ -1840,3 +1840,17 @@ class Steem(object): options.get("beneficiaries", []), }) return comment_op + + def get_api_methods(self): + """Returns all supported api methods""" + return self.rpc.get_methods(api="jsonrpc") + + def get_apis(self): + """Returns all enabled apis""" + api_methods = self.get_api_methods() + api_list = [] + for a in api_methods: + api = a.split(".")[0] + if api not in api_list: + api_list.append(api) + return api_list diff --git a/beem/version.py b/beem/version.py index e567c425..cfc91a71 100644 --- a/beem/version.py +++ b/beem/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.20.1' +version = '0.20.2' diff --git a/beemapi/version.py b/beemapi/version.py index e567c425..cfc91a71 100644 --- a/beemapi/version.py +++ b/beemapi/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.20.1' +version = '0.20.2' diff --git a/beembase/version.py b/beembase/version.py index e567c425..cfc91a71 100644 --- a/beembase/version.py +++ b/beembase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.20.1' +version = '0.20.2' diff --git a/beemgraphenebase/version.py b/beemgraphenebase/version.py index e567c425..cfc91a71 100644 --- a/beemgraphenebase/version.py +++ b/beemgraphenebase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.20.1' +version = '0.20.2' diff --git a/docs/conf.py b/docs/conf.py index bced78f7..fec76c24 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -57,9 +57,9 @@ author = 'Holger Nahrstaedt' # built documents. # # The short X.Y version. -version = '0.19' +version = '0.20' # The full version, including alpha/beta/rc tags. -release = '0.19.45' +release = '0.20.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 3797a987..c1e59765 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.20.1' +VERSION = '0.20.2' tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized'] -- GitLab