Module Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareNotEq AttributeLoad NameLoad attr Num body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Str handlers ExceptHandler body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr orelse Raise Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad NameLoad Str Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If BoolOpAnd CompareGt Call NameLoad NameLoad Num UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body TryExcept body With Call NameLoad NameLoad Str NameStore body Return Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad name NameStore body Raise Call NameLoad Call AttributeLoad Str attr NameLoad Call NameLoad NameLoad orelse Return Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str For NameStore ListLoad Str Str Str Str Str Str Str Str body If CompareLt Call NameLoad NameLoad Num body Return BinOpMod Str TupleLoad NameLoad NameLoad NameLoad AugAssignDiv NameStore Num Return BinOpMod Str TupleLoad NameLoad Str NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad TupleLoad Dict body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr For NameStore AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad TupleLoad Dict body TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr Call AttributeLoad NameLoad attr handlers ExceptHandler body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad Call AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad TupleLoad Dict body Assign NameStore Call NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr keyword TupleLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str While AttributeLoad NameLoad attr body TryExcept body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num handlers ExceptHandler body Pass Expr Call AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad ListLoad Dict Num body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return CompareLt AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr While AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr TryExcept body Expr Call NameLoad handlers ExceptHandler body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword AttributeLoad NameLoad attr For NameStore Call NameLoad Num NameLoad body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If CompareLt Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad With AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Num Assign NameStore Num With AttributeLoad NameLoad attr body For NameStore AttributeLoad NameLoad attr body AugAssignAdd NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AugAssignAdd NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareGt NameLoad Num body Assign NameStore BinOpDiv Call NameLoad NameLoad Call NameLoad NameLoad orelse Assign NameStore Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Num With AttributeLoad NameLoad attr body For NameStore AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareGt NameLoad NameLoad body Assign NameStore NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str While AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr If CompareGt NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr orelse If CompareLt NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults ListLoad Dict Num body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str With AttributeLoad NameLoad attr body For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad For NameStore ListLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body With AttributeLoad NameLoad attr body AugAssignAdd AttributeStore NameLoad attr NameLoad If BoolOpAnd CompareIsNot AttributeLoad NameLoad attr NameLoad CompareEq AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Return Call NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr UnaryOpUSub AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpSub AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareLt AttributeLoad NameLoad attr NameLoad body Return BinOpSub AttributeLoad NameLoad attr NameLoad orelse Return AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults Num body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpSub Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareLt NameLoad AttributeLoad NameLoad attr body Assign NameStore AttributeLoad NameLoad attr Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body While BoolOpAnd CompareGt Call NameLoad AttributeLoad NameLoad attr Num CompareLt AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body If CompareIs AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore Num For NameStore AttributeLoad NameLoad attr body AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIsNot AttributeLoad NameLoad attr NameLoad body AugAssignAdd NameStore Call AttributeLoad Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpSub Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr If CompareGt NameLoad Num body Return BinOpDiv Call NameLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad orelse Return Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return CompareLt AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Return NameLoad Return CompareLt AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr Call NameLoad keyword NameLoad Assign AttributeStore NameLoad attr BinOpSub Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If BoolOpOr CompareIs AttributeLoad NameLoad attr NameLoad CompareGt BinOpSub Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Return NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BoolOpOr CompareIs AttributeLoad NameLoad attr NameLoad CompareGt BinOpSub Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr orelse Return BinOpAdd AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr BoolOpAnd CompareIsNot NameLoad NameLoad CompareIsNot NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body With AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad NameLoad NameLoad NameLoad If BoolOpAnd AttributeLoad NameLoad attr CompareGtE Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr body With AttributeLoad NameLoad attr body Assign NameStore Call NameLoad Assign NameStore Call NameLoad For NameStore AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Return NameLoad orelse Return Call NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore NameLoad With AttributeLoad NameLoad attr body For NameStore AttributeLoad NameLoad attr body If BoolOpOr CompareIs NameLoad NameLoad CompareLt AttributeLoad NameLoad attr NameLoad body Assign NameStore AttributeLoad NameLoad attr If CompareIsNot NameLoad NameLoad body Return Call NameLoad NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr orelse Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str With AttributeLoad NameLoad attr body If BoolOpAnd AttributeLoad NameLoad attr CompareGt Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return NameLoad For NameStore AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr body Return NameLoad Return NameLoad decorator_list decorator_list
N/A N/A six N/A os N/A sys N/A traceback N/A signal N/A json N/A threading N/A time N/A logging collections deque six.moves.queue PriorityQueue datetime datetime timedelta exc DownstreamError cli_stats Stats N/A logger N/A N/A logging getLogger storj.downstream_farmer.utils urlify N/A N/A string N/A N/A N/A  You might be wondering: why is this here at all, since it's basically
    doing exactly what the quote_plus function in urllib does. Well, to keep
    the 2 & 3 stuff all in one place, meaning rather than try to import the
    urllib stuff twice in each file where url-safe strings are needed, we keep
    it all in one file: here.

    Supporting multiple Pythons is hard.

    :param string: String to URLify
    :return: URLified string
     N/A N/A N/A N/A N/A N/A six moves urllib parse quote string N/A handle_json_response N/A N/A resp N/A N/A N/A This function handles a response from the downstream-node server.
    If the server responds with an error, we attempt to get the json item
    'message' from the body.  if that fails, we just raise a regular http
    error.
    otherwise, if the server responds with a 200 'ok' message, we parse the
    json.

    :param resp: the flask request response to handle
    :returns: the parsed json as an object
     N/A N/A N/A resp status_code 200 N/A N/A N/A N/A r_json N/A N/A resp json N/A message N/A r_json N/A message N/A N/A N/A N/A N/A N/A logger debug resp N/A N/A N/A resp raise_for_status N/A N/A N/A DownstreamError message N/A r_json N/A N/A resp json N/A r_json N/A resource_path N/A N/A relative N/A N/A N/A N/A N/A N/A os path join N/A getattr sys _MEIPASS N/A N/A N/A os path join N/A N/A N/A os path dirname __file__ data relative N/A save N/A N/A path obj N/A N/A N/A saves the farmer state to disk

    :param path: the path to save to
    :param obj: the object to save (must be json serializable)
     N/A N/A head tail N/A N/A N/A os path split path N/A N/A N/A N/A len head 0 N/A N/A N/A N/A os path isdir head N/A N/A N/A N/A os mkdir head N/A N/A open path w+ f N/A N/A N/A N/A json dump obj f N/A restore N/A N/A path N/A N/A N/A restores state from disk

    :param path: the path to restore from
    :returns: the object restored, or an empty dict(), if the file doesn't
        exist
     N/A N/A N/A N/A os path exists path N/A N/A N/A N/A N/A open path r f N/A N/A N/A N/A json load f N/A N/A N/A Exception N/A ex N/A N/A N/A DownstreamError N/A N/A Couldn't parse '{0}': {1} format path N/A str ex N/A N/A N/A dict N/A sizeof_fmt N/A N/A num suffix N/A B N/A N/A 
    From: http://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size  # NOQA
    Written by Fred Cirera
     N/A unit N/A Ki Mi Gi Ti Pi Ei Zi N/A N/A N/A N/A abs num 1024.0 N/A N/A N/A %3.1f%s%s N/A num unit suffix N/A num 1024.0 N/A N/A %.1f%s%s N/A num Yi suffix N/A ManagedThread N/A N/A threading Thread N/A __init__ N/A N/A self target name args kwargs N/A None None N/A N/A N/A N/A Initializes the managed thread

        A managed thread basically has an attached event which can awake
        that thread from sleeping.
         N/A N/A N/A N/A threading Thread __init__ self None target name args kwargs N/A N/A self daemon True N/A N/A self attached_event N/A N/A threading Event N/A wait N/A N/A self timeout N/A None N/A N/A This will wait until wake is called but no longer than the specified
        timeout.
         N/A N/A N/A N/A self attached_event wait timeout N/A N/A N/A N/A self attached_event clear N/A wake N/A N/A self N/A N/A N/A N/A N/A N/A self attached_event set N/A N/A ThreadManager N/A object N/A __init__ N/A N/A self N/A N/A N/A N/A self threads N/A list N/A N/A self shutting_down N/A N/A threading Event N/A N/A self logger N/A N/A logging getLogger storj.downstream_farmer.utils.ThreadManager N/A signal_shutdown N/A N/A self N/A N/A N/A Can be called from any thread, signals for a shutdown to occur.
         N/A N/A self running N/A N/A N/A N/A N/A self logger info Shutting down... N/A N/A N/A N/A self shutting_down set N/A t N/A self threads N/A N/A N/A N/A t wake N/A sleep N/A N/A self timeout N/A None N/A N/A Calls the wait function on the current ManagedThread
        Should be called from within a managed thread.
        Use this instead of time.sleep() so that the managed thread
        can be awoken and shutdown
        :param timeout: the timeout for the sleep.  If none, will sleep
        indefinitely
         N/A N/A self running N/A N/A N/A N/A N/A N/A threading current_thread wait timeout N/A running N/A N/A self N/A N/A N/A N/A N/A N/A N/A self shutting_down is_set N/A property finish N/A N/A self N/A N/A N/A Signals for a shutdown and waits for child
        threads to exit
        Should be called from the main thread
         N/A N/A N/A self signal_shutdown N/A t N/A self threads N/A N/A N/A N/A t is_alive N/A N/A N/A N/A t join N/A N/A self threads N/A list N/A _child_wrapper N/A N/A self target args kwargs N/A None N/A N/A N/A N/A N/A N/A N/A N/A N/A self logger debug N/A N/A Starting {0} format N/A N/A threading current_thread N/A N/A target args kwargs N/A N/A N/A N/A self logger debug N/A N/A {0} finished format N/A N/A threading current_thread N/A N/A N/A N/A N/A N/A N/A self logger debug N/A N/A traceback format_exc N/A N/A N/A N/A self logger info N/A N/A N/A sys exc_info N/A 1 N/A N/A N/A self signal_shutdown N/A create_thread N/A N/A self name target args kwargs N/A None None N/A N/A N/A N/A thread N/A ManagedThread name name target N/A self _child_wrapper args N/A target args kwargs N/A N/A N/A N/A self threads append thread N/A thread N/A called_every_second N/A N/A self N/A N/A N/A This function is called every second the thread manager is running.
         N/A wait_for_shutdown N/A N/A self N/A N/A N/A Waits for a shutdown signal from the child threads
        Should be run from the main thread
         N/A N/A self running N/A N/A N/A N/A N/A N/A self called_every_second N/A N/A N/A time sleep 1 N/A N/A N/A N/A N/A N/A N/A self finish N/A N/A WorkItem N/A object N/A __init__ N/A N/A self target args kwargs priority N/A None N/A N/A 50 N/A N/A N/A self target target N/A N/A self args args N/A N/A self kwargs kwargs N/A N/A self priority priority N/A __call__ N/A N/A self N/A N/A N/A N/A N/A self target N/A self args N/A self kwargs N/A __lt__ N/A N/A self other N/A N/A N/A N/A N/A self priority N/A other priority N/A N/A WorkerThread N/A N/A threading Thread N/A __init__ N/A N/A self thread_pool N/A None N/A N/A Initializes the worker thread

        A worker thread has an attached load tracker
         N/A N/A N/A N/A threading Thread __init__ self target N/A self _run N/A N/A self logger N/A N/A logging getLogger storj.downstream_farmer.utils.WorkerThread N/A N/A self daemon True N/A N/A self load_tracker N/A LoadTracker N/A N/A self thread_pool thread_pool N/A N/A self running True N/A stop N/A N/A self N/A N/A N/A Stops the worker thread after it finishes it's next batch of work
        It will zombify this thread.
         N/A N/A self running False N/A _run N/A N/A self N/A N/A N/A this thread will run unmanaged, and so will die dirty when program
        closes.  therefore we use a monitor thread to make sure any
        unfinished work is done before the program shuts down
         N/A N/A N/A N/A self load_tracker start_work N/A N/A self running N/A N/A N/A N/A N/A self load_tracker finish_work N/A work N/A N/A N/A N/A self thread_pool tasks get N/A N/A N/A N/A self load_tracker start_work N/A N/A N/A N/A work N/A N/A N/A N/A N/A N/A N/A self logger debug N/A N/A traceback format_exc N/A N/A N/A N/A N/A self thread_pool thread_manager signal_shutdown N/A N/A N/A N/A N/A self thread_pool tasks task_done N/A N/A ThreadPool N/A object N/A __init__ N/A N/A self thread_manager thread_count N/A 10 N/A N/A Initialization method

        :param thread_manager: the thread manager to use
        :param thread_count: the number of workers to instantiate
         N/A N/A self logger N/A N/A logging getLogger storj.downstream_farmer.utils.ThreadPool N/A N/A self tasks N/A PriorityQueue N/A N/A self thread_manager thread_manager N/A N/A self workers N/A list N/A N/A self workers_lock N/A N/A threading Lock N/A N/A self max_thread_count 50 N/A N/A self load_minimum 0.01 N/A N/A self load_maximum 0.5 N/A N/A self monitor_thread N/A N/A N/A self thread_manager create_thread name MonitorThread target N/A self _monitor N/A i N/A range 0 thread_count N/A N/A N/A N/A self _add_thread N/A thread_count N/A N/A self N/A N/A N/A N/A self workers_lock N/A N/A N/A len N/A self workers N/A _add_thread N/A N/A self N/A N/A N/A N/A N/A len N/A self workers N/A self max_thread_count N/A N/A N/A N/A N/A self logger debug N/A N/A {0} : adding worker format N/A N/A threading current_thread N/A worker N/A WorkerThread self N/A N/A self workers_lock N/A N/A N/A N/A N/A self workers append worker N/A worker N/A N/A None N/A _remove_thread N/A N/A self N/A N/A N/A N/A self workers_lock N/A N/A N/A N/A len N/A self workers 1 N/A N/A N/A N/A N/A self logger debug N/A N/A {0} : removing worker format N/A N/A threading current_thread N/A thread N/A N/A N/A self workers pop N/A N/A N/A thread stop N/A calculate_loading N/A N/A self N/A N/A N/A total_time 0 N/A work_time 0 N/A N/A self workers_lock N/A N/A w N/A self workers N/A N/A total_time N/A N/A N/A w load_tracker total_time N/A work_time N/A N/A N/A w load_tracker work_time N/A N/A total_time 0 N/A N/A load N/A N/A float work_time N/A float total_time N/A N/A load 0 N/A load N/A max_load N/A N/A self N/A N/A N/A max 0 N/A N/A self workers_lock N/A N/A w N/A self workers N/A N/A load N/A N/A N/A w load_tracker load N/A N/A load max N/A N/A max load N/A max N/A check_loading N/A N/A self N/A N/A N/A N/A N/A N/A self monitor_thread wake N/A _monitor N/A N/A self N/A N/A N/A This runs until the thread manager wakes it up during
        shutdown, at which time it will wait for any unfinished work in the
        queue, and then finish, allowing the program to exit
         N/A N/A N/A self thread_manager running N/A N/A load N/A N/A self calculate_loading N/A N/A load N/A self load_maximum N/A N/A worker N/A N/A self _add_thread N/A N/A worker None N/A N/A N/A N/A worker start N/A N/A N/A load N/A self load_minimum N/A N/A N/A N/A self _remove_thread N/A N/A N/A N/A self thread_manager sleep 10 N/A N/A N/A N/A self logger debug MonitorThread waiting for tasks to finish N/A N/A N/A N/A self tasks join N/A N/A N/A N/A self logger debug MonitorThread finishing N/A put_work N/A N/A self target args kwargs priority N/A N/A N/A 50 N/A N/A Puts work in the work queue.
        :param work: callable work object
         N/A N/A N/A N/A self tasks put N/A WorkItem target args kwargs priority N/A start N/A N/A self N/A N/A N/A Starts the thread pool and all its workers and the monitor thread
         N/A N/A self workers_lock N/A N/A worker N/A self workers N/A N/A N/A N/A worker start N/A N/A N/A N/A self monitor_thread start N/A N/A ShellApplication N/A ThreadManager N/A __init__ N/A N/A self N/A N/A N/A Initializes the shell application by registering some signals
        Must be called from the main thread
         N/A N/A N/A ThreadManager __init__ self N/A sig N/A N/A signal SIGTERM N/A signal SIGINT N/A N/A N/A N/A signal signal sig N/A self signal_handler N/A N/A self stats N/A Stats N/A signal_handler N/A N/A self signum frame N/A None None N/A N/A When called, exits the shell application.  Calls the shutdown
        function
         N/A N/A N/A self signal_shutdown N/A N/A Counter N/A object N/A __init__ N/A N/A self zero_callback N/A None N/A N/A N/A self count 0 N/A N/A self lock N/A N/A threading Lock N/A N/A self zero_callback zero_callback N/A add N/A N/A self number N/A N/A N/A N/A self lock N/A N/A N/A self count number N/A N/A N/A N/A self zero_callback None N/A N/A self count 0 N/A N/A N/A N/A self zero_callback N/A __call__ N/A N/A self number N/A 1 N/A N/A N/A CounterContext self number N/A N/A CounterContext N/A object N/A __init__ N/A N/A self counter increment N/A N/A N/A N/A self counter counter N/A N/A self increment increment N/A __enter__ N/A N/A self N/A N/A N/A N/A N/A N/A self counter add N/A self increment N/A __exit__ N/A N/A self type value traceback N/A N/A N/A N/A N/A N/A self counter add N/A N/A self increment N/A N/A WorkChunk N/A object N/A N/A Encapsulates a chunk of work for the load tracker
     __init__ N/A N/A self start end N/A N/A N/A N/A self start start N/A N/A self end end N/A elapsed N/A N/A self N/A N/A N/A The elapsed time for the chunk
         N/A N/A N/A self end N/A self start N/A property elapsed_from_start N/A N/A self start N/A N/A N/A Time elapsed in the work chunk, given a start time
        Ensures that the chunk work cannot start any earlier than
        the specified start time.
        :param start: the earliest time to calculate the elapsed time from
         N/A N/A N/A self start start N/A N/A N/A N/A self end start N/A N/A N/A self elapsed N/A N/A LoadTracker N/A object N/A __init__ N/A N/A self sample_time N/A 60 N/A N/A N/A self lock N/A N/A threading RLock N/A N/A self work_chunks N/A deque N/A N/A self current_work_start None N/A N/A self sample_time sample_time N/A N/A self start N/A N/A time clock N/A sample_start N/A N/A self N/A N/A N/A sample_start N/A N/A N/A time clock N/A self sample_time N/A N/A sample_start N/A self start N/A N/A sample_start N/A self start N/A sample_start N/A property _trim N/A N/A self N/A N/A N/A N/A self lock N/A N/A N/A N/A N/A len N/A self work_chunks 0 N/A N/A N/A N/A self work_chunks N/A 0 end N/A self sample_start N/A N/A N/A N/A N/A self work_chunks popleft N/A start_work N/A N/A self N/A N/A N/A N/A self lock N/A N/A N/A self current_work_start N/A N/A time clock N/A finish_work N/A N/A self N/A N/A N/A N/A self lock N/A N/A N/A N/A self current_work_start None N/A N/A N/A RuntimeError Load tracker work chunk must be started before it can be finished. N/A N/A N/A N/A self work_chunks append N/A WorkChunk N/A self current_work_start N/A N/A time clock N/A N/A self current_work_start None N/A N/A N/A self _trim N/A work_time N/A N/A self N/A N/A N/A N/A self lock N/A N/A N/A N/A self _trim N/A sample_start N/A self sample_start N/A work_total 0 N/A c N/A self work_chunks N/A N/A work_total N/A N/A c elapsed_from_start sample_start N/A N/A N/A self current_work_start None N/A N/A work_total N/A N/A N/A WorkChunk N/A self current_work_start N/A N/A time clock elapsed_from_start sample_start N/A work_total N/A total_time N/A N/A self N/A N/A N/A N/A N/A N/A time clock N/A self sample_start N/A load N/A N/A self N/A N/A N/A total N/A N/A self total_time N/A N/A total 0 N/A N/A N/A N/A float N/A N/A self work_time N/A float total N/A N/A 0 N/A N/A BurstQueueItem N/A object N/A N/A This class encapsulates an item that has a due date where where an
    activity must be performed on the item before that due date, but after
    the earliest time specified.

    The due date indicates that the action must be performed as soon as
    possible, while ready indicates whether the action can be performed.
    basically, it can be performed any time between earliest and the due
    date, but must be performed soon after the due date
     __init__ N/A N/A self item due earliest N/A None N/A N/A N/A self item item N/A N/A self due due N/A N/A self earliest earliest N/A is_due N/A N/A self N/A N/A N/A N/A N/A self due N/A N/A datetime utcnow N/A is_ready N/A N/A self N/A N/A N/A N/A N/A self earliest None N/A N/A True N/A N/A N/A self earliest N/A N/A datetime utcnow N/A N/A RateLimit N/A object N/A N/A Simple rate limiter with no bursting
    :param rate: in seconds per request
     __init__ N/A N/A self rate N/A None N/A N/A N/A self rate N/A timedelta seconds rate N/A N/A self last N/A N/A N/A datetime utcnow N/A self rate N/A ping N/A N/A self N/A N/A N/A N/A N/A N/A self rate None N/A N/A N/A N/A datetime utcnow N/A self last N/A self rate N/A N/A N/A self last N/A N/A datetime utcnow N/A True N/A N/A False N/A peek N/A N/A self N/A N/A N/A N/A N/A N/A self rate None N/A N/A N/A N/A datetime utcnow N/A self last N/A self rate N/A next N/A N/A self N/A N/A N/A Returns the number of seconds until the next event can occur
         N/A N/A N/A self peek N/A N/A N/A N/A datetime utcnow N/A N/A N/A N/A self last N/A self rate N/A N/A BurstQueue N/A object N/A N/A 
    This class will help us perform heartbeats in a timely manner.

    Items can be placed in this queue.  Items have a 'due date'
    When `get` is called, it either returns an empty list if there are
    no due items, or if there are any due items, it will return
    all the items in the queue that are ready.
    Optionally it can have a rate limit to the number of time
    items can be retrieved, and also a full callback that occurs
    when the number of items exceeds a specified number
     __init__ N/A N/A self rate full_size full_callback N/A None None None N/A N/A N/A self queue N/A deque N/A N/A self queue_lock N/A N/A threading Lock N/A N/A self rate_limit N/A RateLimit rate N/A N/A N/A self set_full_callback full_size full_callback N/A set_full_callback N/A N/A self full_size full_callback N/A N/A N/A N/A self full_size full_size N/A N/A self full_callback full_callback N/A N/A self callback N/A N/A full_size None N/A full_callback None N/A put N/A N/A self item due earliest N/A None N/A N/A N/A self queue_lock N/A N/A N/A N/A N/A self queue append N/A BurstQueueItem item due earliest N/A N/A N/A self callback N/A N/A len N/A self queue N/A self full_size N/A N/A N/A N/A self full_callback N/A get N/A N/A self N/A N/A N/A Gets the list of ready items if any items are due N/A N/A N/A N/A self _any_due N/A N/A N/A self rate_limit peek N/A N/A N/A self queue_lock N/A N/A ready_items N/A list N/A unready_items N/A deque N/A i N/A self queue N/A N/A N/A N/A i is_ready N/A N/A N/A N/A ready_items append N/A i item N/A N/A N/A N/A unready_items append i N/A N/A self queue unready_items N/A N/A N/A N/A self rate_limit ping N/A ready_items N/A N/A N/A list N/A next_due N/A N/A self N/A N/A N/A Gets the next due time
         N/A earliest None N/A N/A self queue_lock N/A N/A queue_item N/A self queue N/A N/A N/A N/A earliest None N/A N/A queue_item due earliest N/A N/A earliest N/A queue_item due N/A N/A earliest None N/A N/A N/A max earliest N/A N/A N/A self rate_limit next N/A N/A None N/A _any_due N/A N/A self N/A N/A N/A Returns whether any items are due
         N/A N/A self queue_lock N/A N/A N/A N/A self callback N/A N/A len N/A self queue N/A self full_size N/A N/A True N/A queue_item N/A self queue N/A N/A N/A N/A queue_item is_due N/A N/A True N/A False N/A N/A