Skip to content

Commit

Permalink
cleanup: more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kmike committed Jul 2, 2016
1 parent 948177b commit fb63ef7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions arachnado/rpc/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class Pages(object):
""" Pages (scraped items) object exposed via JSON RPC """
handler_id = None

def __init__(self, handler, item_storage, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion arachnado/rpc/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Sites(object):

""" 'Known sites' object exposed via JSON-RPC """
logger = logging.getLogger(__name__)

def __init__(self, handler, site_storage, **kwargs):
Expand Down
3 changes: 3 additions & 0 deletions arachnado/rpc/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def on_close(self):
self._pinger.stop()

def _resources(self):
# FIXME: remove it, make explicit. This code helps to call _on_close
# methods of rpc.Jobs, rpc.Pages and rpc.Sites when ws connection
# is closed.
for resource_name, resource in self.__dict__.items():
if hasattr(RequestHandler, resource_name):
continue
Expand Down
12 changes: 7 additions & 5 deletions arachnado/storages/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@ class MongoStorage(object):
"""
def __init__(self, mongo_uri, cache=False):
self.mongo_uri = mongo_uri
self.cache_flag = cache
_, _, _, _, self.col = motor_from_uri(mongo_uri)
self.signal_manager = SignalManager()
# Used for unsubscribe
# disconnect() requires reference to original callback
self._callbacks = {}
if cache:
self.cache = defaultdict(dict)
else:
self.cache = None
self.fetching = False
self.signals = {
'created': object(),
'updated': object(),
'deleted': object(),
}
# XXX: cache is used in arachnado.cron and arachnado.site_checker.
# Is it needed?
self.cache_flag = cache
if cache:
self.cache = defaultdict(dict)
else:
self.cache = None

def subscribe(self, events=None, callback=None):
if events is None:
Expand Down

0 comments on commit fb63ef7

Please sign in to comment.