From 20070c22268606503bc297f243be02d761a732fc Mon Sep 17 00:00:00 2001
From: roadscape <roadscape@users.noreply.github.com>
Date: Mon, 4 Jun 2018 13:43:17 -0500
Subject: [PATCH] lint

---
 hive/community/roles.py    | 2 ++
 hive/db/query_stats.py     | 2 ++
 hive/indexer/follow.py     | 1 +
 hive/steem/client_stats.py | 2 ++
 hive/steem/http_client.py  | 1 -
 hive/steem/steem_client.py | 7 +++++++
 hive/utils/system.py       | 2 ++
 pylintrc                   | 2 +-
 8 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/hive/community/roles.py b/hive/community/roles.py
index 1eda73405..824533934 100644
--- a/hive/community/roles.py
+++ b/hive/community/roles.py
@@ -52,6 +52,7 @@ def is_permitted(account: str, community: str, action: str) -> bool:
 
 
 def get_user_role(account: str, community: str) -> str:
+    """Get user role within a specific community."""
     if account == community:
         return 'owner'
 
@@ -76,6 +77,7 @@ def get_user_role(account: str, community: str) -> str:
 
 
 def get_community_privacy(community: str) -> str:
+    """Load community privacy level"""
     type_id = query_one('SELECT type_id from hive_communities WHERE name = "%s"' % community)
     return PRIVACY_MAP.get(type_id)
 
diff --git a/hive/db/query_stats.py b/hive/db/query_stats.py
index 134e562b4..c9531fe54 100644
--- a/hive/db/query_stats.py
+++ b/hive/db/query_stats.py
@@ -5,6 +5,8 @@ import re
 import atexit
 from hive.utils.system import colorize, peak_usage_mb
 
+# pylint: disable=missing-docstring
+
 class QueryStats:
     SLOW_QUERY_MS = 250
 
diff --git a/hive/indexer/follow.py b/hive/indexer/follow.py
index 3e6156bee..23345546d 100644
--- a/hive/indexer/follow.py
+++ b/hive/indexer/follow.py
@@ -11,6 +11,7 @@ FOLLOWERS = 'followers'
 FOLLOWING = 'following'
 
 class Follow:
+    """Handles processing of incoming follow ups and flushing to db."""
 
     @classmethod
     def follow_op(cls, account, op_json, date):
diff --git a/hive/steem/client_stats.py b/hive/steem/client_stats.py
index 466e416ea..7164075fb 100644
--- a/hive/steem/client_stats.py
+++ b/hive/steem/client_stats.py
@@ -3,6 +3,8 @@
 import atexit
 from hive.utils.system import colorize, peak_usage_mb
 
+# pylint: disable=missing-docstring
+
 class ClientStats:
     """Collects steemd API timing data."""
 
diff --git a/hive/steem/http_client.py b/hive/steem/http_client.py
index 92ee74f31..6957262e3 100644
--- a/hive/steem/http_client.py
+++ b/hive/steem/http_client.py
@@ -109,7 +109,6 @@ class HttpClient(object):
         get_order_book='condenser_api',
         get_feed_history='condenser_api',
         get_dynamic_global_properties='database_api',
-        broadcast_transaction_synchronous='network_broadcast_api', # temporary; for testing condenser_api
     )
 
     def __init__(self, nodes, **kwargs):
diff --git a/hive/steem/steem_client.py b/hive/steem/steem_client.py
index c549392dd..46a0e8aae 100644
--- a/hive/steem/steem_client.py
+++ b/hive/steem/steem_client.py
@@ -15,6 +15,7 @@ class SteemClient:
 
     @classmethod
     def instance(cls):
+        """Get a singleton, lazily initialized"""
         if not cls._instance:
             cls._instance = SteemClient(
                 url=Conf.get('steemd_url'),
@@ -35,13 +36,16 @@ class SteemClient:
               % (url, max_batch, max_workers))
 
     def get_accounts(self, accounts):
+        """Fetch multiple accounts by name."""
         assert accounts, "no accounts passed to get_accounts"
+        assert len(accounts) <= 1000, "max 1000 accounts"
         ret = self.__exec('get_accounts', [accounts])
         assert len(accounts) == len(ret), ("requested %d accounts got %d"
                                            % (len(accounts), len(ret)))
         return ret
 
     def get_content_batch(self, tuples):
+        """Fetch multiple comment objects."""
         posts = self.__exec_batch('get_content', tuples)
         # TODO: how are we ensuring sequential results? need to set and sort id.
         for post in posts: # sanity-checking jussi responses
@@ -141,12 +145,15 @@ class SteemClient:
         return ret
 
     def head_time(self):
+        """Get timestamp of head block"""
         return self._gdgp()['time']
 
     def head_block(self):
+        """Get head block number"""
         return self._gdgp()['head_block_number']
 
     def last_irreversible(self):
+        """Get last irreversible block"""
         return self._gdgp()['last_irreversible_block_num']
 
     def gdgp_extended(self):
diff --git a/hive/utils/system.py b/hive/utils/system.py
index 0f021553d..d6eed13f2 100644
--- a/hive/utils/system.py
+++ b/hive/utils/system.py
@@ -6,11 +6,13 @@ import resource
 USE_COLOR = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
 
 def colorize(string, color='93'):
+    """Colorizes a string for stdout, if attached to terminal"""
     if not USE_COLOR:
         return string
     return "\033[%sm%s\033[0m" % (color, string)
 
 def peak_usage_mb():
+    """Get peak memory usage of hive process."""
     mem_denom = (1024 * 1024) if sys.platform == 'darwin' else 1024
     max_mem = int(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
     return max_mem / mem_denom
diff --git a/pylintrc b/pylintrc
index affde1ca7..864ff9fbe 100644
--- a/pylintrc
+++ b/pylintrc
@@ -260,7 +260,7 @@ single-line-if-stmt=no
 no-space-check=trailing-comma,dict-separator
 
 # Maximum number of lines in a module
-max-module-lines=1000
+max-module-lines=250
 
 # String used as indentation unit. This is usually "    " (4 spaces) or "\t" (1
 # tab).
-- 
GitLab