# holgern/beem

beem/hive.py

### Summary

F
2 wks
C
75%

#### File `hive.py` has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open

``````# -*- coding: utf-8 -*-
import json
import logging
import re
import os``````
Found in beem/hive.py - About 4 hrs to fix

#### Cyclomatic complexity is too high in method rshares_to_vote_pct. (15) Open

``````    def rshares_to_vote_pct(self, rshares, post_rshares=0, hive_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):
""" Obtain the voting percentage for a desired rshares value
for a given Hive Power or vesting shares and voting_power
Give either hive_power or vests, not both.
When the output is greater than 10000 or less than -10000,``````
Found in beem/hive.py by radon

## Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

#### `Hive` has 24 functions (exceeds 20 allowed). Consider refactoring. Open

``````class Hive(BlockChainInstance):
""" Connect to the Hive network.

:param str node: Node to connect to *(optional)*
:param str rpcuser: RPC user *(optional)*``````
Found in beem/hive.py - About 2 hrs to fix

#### Cyclomatic complexity is too high in method hbd_to_rshares. (6) Open

``````    def hbd_to_rshares(self, hbd, not_broadcasted_vote=False, use_stored_data=True):
""" Obtain the r-shares from HBD

:param hbd: HBD
:type hbd: str, int, amount.Amount``````
Found in beem/hive.py by radon

## Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

#### Cyclomatic complexity is too high in method get_hive_per_mvest. (6) Open

``````    def get_hive_per_mvest(self, time_stamp=None, use_stored_data=True):
""" Returns the MVEST to HIVE ratio

:param int time_stamp: (optional) if set, return an estimated
HIVE per MVEST ratio for the given time stamp. If unset the``````
Found in beem/hive.py by radon

## Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

#### Function `rshares_to_vote_pct` has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open

``````    def rshares_to_vote_pct(self, rshares, post_rshares=0, hive_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):
""" Obtain the voting percentage for a desired rshares value
for a given Hive Power or vesting shares and voting_power
Give either hive_power or vests, not both.
When the output is greater than 10000 or less than -10000,``````
Found in beem/hive.py - About 55 mins to fix

# Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

### A method's cognitive complexity is based on a few simple rules:

• Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
• Code is considered more complex for each "break in the linear flow of the code"
• Code is considered more complex when "flow breaking structures are nested"

#### Function `hbd_to_vote_pct` has 7 arguments (exceeds 4 allowed). Consider refactoring. Open

``    def hbd_to_vote_pct(self, hbd, post_rshares=0, hive_power=None, vests=None, voting_power=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):``
Found in beem/hive.py - About 50 mins to fix

#### Function `vests_to_hbd` has 6 arguments (exceeds 4 allowed). Consider refactoring. Open

``    def vests_to_hbd(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):``
Found in beem/hive.py - About 45 mins to fix

#### Function `rshares_to_vote_pct` has 6 arguments (exceeds 4 allowed). Consider refactoring. Open

``    def rshares_to_vote_pct(self, rshares, post_rshares=0, hive_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):``
Found in beem/hive.py - About 45 mins to fix

#### Function `get_hive_per_mvest` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````    def get_hive_per_mvest(self, time_stamp=None, use_stored_data=True):
""" Returns the MVEST to HIVE ratio

:param int time_stamp: (optional) if set, return an estimated
HIVE per MVEST ratio for the given time stamp. If unset the``````
Found in beem/hive.py - About 45 mins to fix

# Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

### A method's cognitive complexity is based on a few simple rules:

• Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
• Code is considered more complex for each "break in the linear flow of the code"
• Code is considered more complex when "flow breaking structures are nested"

#### Function `token_power_to_token_backed_dollar` has 6 arguments (exceeds 4 allowed). Consider refactoring. Open

``    def token_power_to_token_backed_dollar(self, token_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):``
Found in beem/hive.py - About 45 mins to fix

#### Function `hp_to_hbd` has 6 arguments (exceeds 4 allowed). Consider refactoring. Open

``    def hp_to_hbd(self, hp, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):``
Found in beem/hive.py - About 45 mins to fix

#### Function `vests_to_rshares` has 6 arguments (exceeds 4 allowed). Consider refactoring. Open

``    def vests_to_rshares(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, subtract_dust_threshold=True, use_stored_data=True):``
Found in beem/hive.py - About 45 mins to fix

#### Function `hp_to_rshares` has 5 arguments (exceeds 4 allowed). Consider refactoring. Open

``    def hp_to_rshares(self, hive_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, use_stored_data=True):``
Found in beem/hive.py - About 35 mins to fix

#### Function `hbd_to_rshares` has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open

``````    def hbd_to_rshares(self, hbd, not_broadcasted_vote=False, use_stored_data=True):
""" Obtain the r-shares from HBD

:param hbd: HBD
:type hbd: str, int, amount.Amount``````
Found in beem/hive.py - About 25 mins to fix

# Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

### A method's cognitive complexity is based on a few simple rules:

• Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
• Code is considered more complex for each "break in the linear flow of the code"
• Code is considered more complex when "flow breaking structures are nested"

#### Method "hbd_to_vote_pct" has 8 parameters, which is greater than the 7 authorized. Open

``    def hbd_to_vote_pct(self, hbd, post_rshares=0, hive_power=None, vests=None, voting_power=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):``
Found in beem/hive.py by sonar-python

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

## Noncompliant Code Example

With a maximum number of 4 parameters:

```def do_something(param1, param2, param3, param4, param5):
...
```

## Compliant Solution

```def do_something(param1, param2, param3, param4):
...
```

#### Either merge this branch with the identical one on line "390" or change one of the implementations. Open

``            hbd = Amount(hbd, blockchain_instance=self)``
Found in beem/hive.py by sonar-python

Having two branches in the same `if` structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

## Noncompliant Code Example

```if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_thing()  # Noncompliant; duplicates first condition
else:
do_the_rest()

b = 4 if a > 12 else 4
```

## Compliant Solution

```if (0 <= a < 10) or (20 <= a < 50):
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
else:
do_the_rest()

b = 4
```

or

```if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_third_thing()
else:
do_the_rest()

b = 8 if a > 12 else 4
```

#### Either merge this branch with the identical one on line "355" or change one of the implementations. Open

``            rshares = math.copysign(self._calc_revert_vote_claim(abs(rshares), post_rshares), rshares)``
Found in beem/hive.py by sonar-python

Having two branches in the same `if` structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

## Noncompliant Code Example

```if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_thing()  # Noncompliant; duplicates first condition
else:
do_the_rest()

b = 4 if a > 12 else 4
```

## Compliant Solution

```if (0 <= a < 10) or (20 <= a < 50):
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
else:
do_the_rest()

b = 4
```

or

```if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_third_thing()
else:
do_the_rest()

b = 8 if a > 12 else 4
```

#### Either merge this branch with the identical one on line "295" or change one of the implementations. Open

``            hbd = Amount(hbd, blockchain_instance=self)``
Found in beem/hive.py by sonar-python

Having two branches in the same `if` structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

## Noncompliant Code Example

```if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_thing()  # Noncompliant; duplicates first condition
else:
do_the_rest()

b = 4 if a > 12 else 4
```

## Compliant Solution

```if (0 <= a < 10) or (20 <= a < 50):
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
else:
do_the_rest()

b = 4
```

or

```if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_third_thing()
else:
do_the_rest()

b = 8 if a > 12 else 4
```

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def rshares_to_vote_pct(self, rshares, post_rshares=0, hive_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):
""" Obtain the voting percentage for a desired rshares value
for a given Hive Power or vesting shares and voting_power
Give either hive_power or vests, not both.
When the output is greater than 10000 or less than -10000,``````
Found in beem/hive.py and 2 other locations - About 4 days to fix
beem/blurt.py on lines 338..378
beem/steem.py on lines 348..388

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 433.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def hbd_to_rshares(self, hbd, not_broadcasted_vote=False, use_stored_data=True):
""" Obtain the r-shares from HBD

:param hbd: HBD
:type hbd: str, int, amount.Amount``````
Found in beem/hive.py and 2 other locations - About 2 days to fix
beem/blurt.py on lines 293..336
beem/steem.py on lines 303..346

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 275.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 2 locations. Consider refactoring. Open

``````    def get_hive_per_mvest(self, time_stamp=None, use_stored_data=True):
""" Returns the MVEST to HIVE ratio

:param int time_stamp: (optional) if set, return an estimated
HIVE per MVEST ratio for the given time stamp. If unset the``````
Found in beem/hive.py and 1 other location - About 1 day to fix
beem/blurt.py on lines 155..181

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 214.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 2 locations. Consider refactoring. Open

``````    def get_hbd_per_rshares(self, not_broadcasted_vote_rshares=0, use_stored_data=True):
""" Returns the current rshares to HBD ratio
"""
reward_fund = self.get_reward_funds(use_stored_data=use_stored_data)
reward_balance = float(Amount(reward_fund["reward_balance"], blockchain_instance=self))``````
Found in beem/hive.py and 1 other location - About 1 day to fix
beem/steem.py on lines 142..155

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 156.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def hbd_to_vote_pct(self, hbd, post_rshares=0, hive_power=None, vests=None, voting_power=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
""" Obtain the voting percentage for a desired HBD value
for a given Hive Power or vesting shares and voting power
Give either Hive Power or vests, not both.
When the output is greater than 10000 or smaller than -10000,``````
Found in beem/hive.py and 2 other locations - About 1 day to fix
beem/blurt.py on lines 380..407
beem/steem.py on lines 390..417

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 151.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Identical blocks of code found in 3 locations. Consider refactoring. Open

``````    def vests_to_rshares(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, subtract_dust_threshold=True, use_stored_data=True):
""" Obtain the r-shares from vests

:param number vests: vesting shares
:param int post_rshares: rshares of post which is voted``````
Found in beem/hive.py and 2 other locations - About 1 day to fix
beem/blurt.py on lines 274..291
beem/steem.py on lines 284..301

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 140.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 4 locations. Consider refactoring. Open

``````    @property
def hardfork(self):
if self.offline or self.rpc is None:
versions = known_chains['HIVE']['min_version']
else:``````
Found in beem/hive.py and 3 other locations - About 6 hrs to fix
beem/blockchaininstance.py on lines 753..763
beem/blurt.py on lines 416..426
beem/steem.py on lines 426..436

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 104.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def get_network(self, use_stored_data=True, config=None):
""" Identify the network

:param bool use_stored_data: if True, stored data will be returned. If stored data are
empty or old, refresh_data() is used.``````
Found in beem/hive.py and 2 other locations - About 5 hrs to fix
beem/blurt.py on lines 112..130
beem/steem.py on lines 112..130

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 86.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def hp_to_hbd(self, hp, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
""" Obtain the resulting HBD vote value from Hive power

:param number hive_power: Hive Power
:param int post_rshares: rshares of post which is voted``````
Found in beem/hive.py and 2 other locations - About 3 hrs to fix
beem/blurt.py on lines 217..230
beem/steem.py on lines 227..240

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def vests_to_hp(self, vests, timestamp=None, use_stored_data=True):
""" Converts vests to HP

:param amount.Amount vests/float vests: Vests to convert
:param int timestamp: (Optional) Can be used to calculate``````
Found in beem/hive.py and 2 other locations - About 3 hrs to fix
beem/blurt.py on lines 184..194
beem/steem.py on lines 194..204

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def vests_to_hbd(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
""" Obtain the resulting HBD vote value from vests

:param number vests: vesting shares
:param int post_rshares: rshares of post which is voted``````
Found in beem/hive.py and 2 other locations - About 2 hrs to fix
beem/blurt.py on lines 232..245
beem/steem.py on lines 242..255

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def rshares_to_hbd(self, rshares, not_broadcasted_vote=False, use_stored_data=True):
""" Calculates the current HBD value of a vote
"""
payout = float(rshares) * self.get_hbd_per_rshares(use_stored_data=use_stored_data,
Found in beem/hive.py and 2 other locations - About 2 hrs to fix
beem/blurt.py on lines 135..140
beem/steem.py on lines 135..140

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 4 locations. Consider refactoring. Open

``````    @property
def chain_params(self):
if self.offline or self.rpc is None:
return known_chains["HIVE"]
else:``````
Found in beem/hive.py and 3 other locations - About 1 hr to fix
beem/blockchaininstance.py on lines 746..751
beem/blurt.py on lines 409..414
beem/steem.py on lines 419..424

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 44.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def token_power_to_token_backed_dollar(self, token_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
return self.hp_to_hbd(token_power, post_rshares=post_rshares, voting_power=voting_power, vote_pct=vote_pct, not_broadcasted_vote=not_broadcasted_vote, use_stored_data=use_stored_data)``````
Found in beem/hive.py and 2 other locations - About 1 hr to fix
beem/blurt.py on lines 214..215
beem/steem.py on lines 224..225

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    @property
def is_hive(self):
config = self.get_config()
if config is None:
return True``````
Found in beem/hive.py and 2 other locations - About 1 hr to fix
beem/blurt.py on lines 428..433
beem/steem.py on lines 438..443

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

#### Similar blocks of code found in 3 locations. Consider refactoring. Open

``````    def hp_to_vests(self, hp, timestamp=None, use_stored_data=True):
""" Converts HP to vests

:param float hp: Hive power to convert
:param datetime timestamp: (Optional) Can be used to calculate``````
Found in beem/hive.py and 2 other locations - About 1 hr to fix
beem/blurt.py on lines 196..203
beem/steem.py on lines 206..213

## Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See `codeclimate-duplication`'s documentation for more information about tuning the mass threshold in your `.codeclimate.yml`.