From 880cecda6797bd153f0680094dc4490bacbc9ad1 Mon Sep 17 00:00:00 2001
From: Holger Nahrstaedt <holgernahrstaedt@gmx.de>
Date: Sat, 20 Mar 2021 23:05:57 +0100
Subject: [PATCH] Fix some small code issues

---
 CHANGELOG.rst                | 1 +
 beem/account.py              | 6 +-----
 beem/cli.py                  | 2 +-
 beem/discussions.py          | 4 ++--
 beemapi/graphenerpc.py       | 4 ++--
 beemapi/noderpc.py           | 2 --
 beemgraphenebase/__init__.py | 3 +--
 7 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 4bf55759..e591fbac 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -5,6 +5,7 @@ Changelog
 * Fix to parameter in transfer_to_vesting
 * Improve hybrid operation in operations (pre / post HF 24 operation are supported)
 * UpdateProposalExtensions has been added to Update_proposal as preperation for the next HF (thanks to @drov0)
+* Fix some small code issues
 
 0.24.21
 -------
diff --git a/beem/account.py b/beem/account.py
index 7606b3ad..7257827a 100644
--- a/beem/account.py
+++ b/beem/account.py
@@ -1354,11 +1354,7 @@ class Account(BlockchainObject):
         if not self.blockchain.is_connected():
             raise OfflineHasNoRPCException("No RPC available in offline mode!")
         self.blockchain.rpc.set_next_node_on_empty_reply(False)
-        if self.blockchain.rpc.get_use_appbase():
-            # return self.blockchain.rpc.get_account_bandwidth({'account': account, 'type': 'post'}, api="witness")
-            return self.blockchain.rpc.get_account_bandwidth(account, bandwidth_type)
-        else:
-            return self.blockchain.rpc.get_account_bandwidth(account, bandwidth_type)
+        return self.blockchain.rpc.get_account_bandwidth(account, bandwidth_type)
 
     def get_bandwidth(self):
         """ Returns used and allocated bandwidth
diff --git a/beem/cli.py b/beem/cli.py
index e0236436..cf81d075 100644
--- a/beem/cli.py
+++ b/beem/cli.py
@@ -198,7 +198,7 @@ def unlock_token_wallet(stm, sc2, password=None):
             print("Wallet could not be unlocked with %s!" % password_storage)
             password = click.prompt("Password to unlock wallet", confirmation_prompt=False, hide_input=True)
             if bool(password):
-                unlock_token_wallet(stm, password=password)
+                unlock_token_wallet(stm, sc2, password=password)
                 if not sc2.locked():
                     return True
         else:
diff --git a/beem/discussions.py b/beem/discussions.py
index 1a4f196e..d9598c3c 100644
--- a/beem/discussions.py
+++ b/beem/discussions.py
@@ -587,7 +587,7 @@ class Discussions_by_votes(list):
         if raw_data:
             super(Discussions_by_votes, self).__init__(
                 [
-                    Comment(x, lazy=lazy, blockchain_instance=self.blockchain)
+                    x
                     for x in posts
                 ]
             )
@@ -854,7 +854,7 @@ class Discussions_by_comments(list):
         if raw_data:
             super(Discussions_by_comments, self).__init__(
                 [
-                    Comment(x, lazy=lazy, blockchain_instance=self.blockchain)
+                    x
                     for x in posts
                 ]
             )            
diff --git a/beemapi/graphenerpc.py b/beemapi/graphenerpc.py
index 8035189b..48f1f56f 100644
--- a/beemapi/graphenerpc.py
+++ b/beemapi/graphenerpc.py
@@ -335,7 +335,7 @@ class GrapheneRPC(object):
             chain_config = {"prefix": prefix, "chain_id": chain_id, "min_version": network_version, "chain_assets": chain_assets}
 
         if chain_id is None:
-            raise("Connecting to unknown network!")
+            raise RPCError("Connecting to unknown network!")
         highest_version_chain = None
         for k, v in list(self.known_chains.items()):
             if blockchain_name is not None and blockchain_name not in k and blockchain_name != "STEEMIT" and blockchain_name != "CHAIN":
@@ -348,7 +348,7 @@ class GrapheneRPC(object):
         if highest_version_chain is None and chain_config is not None:
             return chain_config
         elif highest_version_chain is None:
-            raise("Connecting to unknown network!")
+            raise RPCError("Connecting to unknown network!")
         else:
             return highest_version_chain
 
diff --git a/beemapi/noderpc.py b/beemapi/noderpc.py
index a87cccf0..f455f56b 100644
--- a/beemapi/noderpc.py
+++ b/beemapi/noderpc.py
@@ -107,8 +107,6 @@ class NodeRPC(GrapheneRPC):
         msg = exceptions.decodeRPCErrorMsg(e).strip()
         if re.search("missing required active authority", msg):
             raise exceptions.MissingRequiredActiveAuthority
-        elif re.search("missing required active authority", msg):
-            raise exceptions.MissingRequiredActiveAuthority
         elif re.match("^no method with name.*", msg):
             raise exceptions.NoMethodWithName(msg)
         elif re.search("Could not find method", msg):
diff --git a/beemgraphenebase/__init__.py b/beemgraphenebase/__init__.py
index 22f84273..5ba45f90 100644
--- a/beemgraphenebase/__init__.py
+++ b/beemgraphenebase/__init__.py
@@ -10,9 +10,8 @@ from .version import version as __version__
 __all__ = ['account',
            'aes',
            'base58',
-           'bip32'
+           'bip32',
            'bip38',
-           'transactions',
            'types',
            'ecdasig',
            'chains',
-- 
GitLab