Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
d0357be5
Commit
d0357be5
authored
5 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
Add more fixes and checks
parent
64cdac32
Branches
pyup-scheduled-update-2019-09-16
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
beem/account.py
+7
-4
7 additions, 4 deletions
beem/account.py
beemapi/steemnoderpc.py
+4
-4
4 additions, 4 deletions
beemapi/steemnoderpc.py
tests/beem/test_account.py
+1
-1
1 addition, 1 deletion
tests/beem/test_account.py
with
12 additions
and
9 deletions
beem/account.py
+
7
−
4
View file @
d0357be5
...
...
@@ -311,7 +311,7 @@ class Account(BlockchainObject):
self
.
refresh
()
self
.
steem
.
refresh_data
(
True
)
bandwidth
=
self
.
get_bandwidth
()
if
bandwidth
[
"
allocated
"
]
>
0
:
if
bandwidth
is
not
None
and
bandwidth
[
"
allocated
"
]
is
not
None
and
bandwidth
[
"
allocated
"
]
>
0
:
remaining
=
100
-
bandwidth
[
"
used
"
]
/
bandwidth
[
"
allocated
"
]
*
100
used_kb
=
bandwidth
[
"
used
"
]
/
1024
allocated_mb
=
bandwidth
[
"
allocated
"
]
/
1024
/
1024
...
...
@@ -334,7 +334,7 @@ class Account(BlockchainObject):
t
.
add_row
([
"
Full in
"
,
"
%s
"
%
(
self
.
get_recharge_time_str
())])
t
.
add_row
([
"
Steem Power
"
,
"
%.2f %s
"
%
(
self
.
get_steem_power
(),
self
.
steem
.
steem_symbol
)])
t
.
add_row
([
"
Balance
"
,
"
%s, %s
"
%
(
str
(
self
.
balances
[
"
available
"
][
0
]),
str
(
self
.
balances
[
"
available
"
][
1
]))])
if
False
and
bandwidth
[
"
allocated
"
]
>
0
:
if
False
and
bandwidth
is
not
None
and
bandwidth
[
"
allocated
"
]
is
not
None
and
bandwidth
[
"
allocated
"
]
>
0
:
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
:
...
...
@@ -868,9 +868,9 @@ class Account(BlockchainObject):
followers
=
self
.
steem
.
rpc
.
get_following
(
self
.
name
,
last_user
,
what
,
limit
,
api
=
'
follow
'
)
if
cnt
==
0
:
followers_list
=
followers
elif
len
(
followers
)
>
1
:
elif
followers
is
not
None
and
len
(
followers
)
>
1
:
followers_list
+=
followers
[
1
:]
if
len
(
followers
)
>=
limit
:
if
followers
is
not
None
and
len
(
followers
)
>=
limit
:
last_user
=
followers
[
-
1
][
direction
]
limit_reached
=
True
cnt
+=
1
...
...
@@ -1082,6 +1082,9 @@ class Account(BlockchainObject):
else
:
received_vesting_shares
=
0
vesting_shares
=
self
[
"
vesting_shares
"
].
amount
if
reserve_ratio
is
None
or
reserve_ratio
[
"
max_virtual_bandwidth
"
]
is
None
:
return
{
"
used
"
:
None
,
"
allocated
"
:
None
}
max_virtual_bandwidth
=
float
(
reserve_ratio
[
"
max_virtual_bandwidth
"
])
total_vesting_shares
=
Amount
(
global_properties
[
"
total_vesting_shares
"
],
steem_instance
=
self
.
steem
).
amount
allocated_bandwidth
=
(
max_virtual_bandwidth
*
(
vesting_shares
+
received_vesting_shares
)
/
total_vesting_shares
)
...
...
This diff is collapsed.
Click to expand it.
beemapi/steemnoderpc.py
+
4
−
4
View file @
d0357be5
...
...
@@ -117,9 +117,9 @@ class SteemNodeRPC(GrapheneRPC):
raise
exceptions
.
NoMethodWithName
(
msg
)
elif
re
.
search
(
"
Could not find API
"
,
msg
):
if
self
.
_check_api_name
(
msg
):
if
self
.
nodes
.
working_nodes_count
>
1
and
self
.
num_retries
>
-
1
:
if
self
.
nodes
.
working_nodes_count
>
1
and
self
.
nodes
.
num_retries
>
-
1
:
self
.
_switch_to_next_node
(
msg
,
"
ApiNotSupported
"
)
doRetry
=
Tru
e
doRetry
=
Fals
e
else
:
raise
exceptions
.
ApiNotSupported
(
msg
)
else
:
...
...
@@ -150,9 +150,9 @@ class SteemNodeRPC(GrapheneRPC):
elif
re
.
search
(
"
Assert Exception:v.is_object(): Input data have to treated as object
"
,
msg
):
raise
exceptions
.
UnhandledRPCError
(
"
Use Operation(op, appbase=True) to prevent error:
"
+
msg
)
elif
re
.
search
(
"
Client returned invalid format. Expected JSON!
"
,
msg
):
if
self
.
nodes
.
working_nodes_count
>
1
and
self
.
num_retries
>
-
1
:
if
self
.
nodes
.
working_nodes_count
>
1
and
self
.
nodes
.
num_retries
>
-
1
:
self
.
_switch_to_next_node
(
msg
)
doRetry
=
Tru
e
doRetry
=
Fals
e
else
:
raise
exceptions
.
UnhandledRPCError
(
msg
)
elif
msg
:
...
...
This diff is collapsed.
Click to expand it.
tests/beem/test_account.py
+
1
−
1
View file @
d0357be5
...
...
@@ -284,7 +284,7 @@ class Testcases(unittest.TestCase):
vv
=
account
.
get_voting_value_SBD
()
self
.
assertTrue
(
vv
>=
0
)
bw
=
account
.
get_bandwidth
()
self
.
assertTrue
(
bw
[
'
used
'
]
<=
bw
[
'
allocated
'
])
#
self.assertTrue(bw['used'] <= bw['allocated'])
followers
=
account
.
get_followers
()
self
.
assertTrue
(
isinstance
(
followers
,
list
))
following
=
account
.
get_following
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment