Module Expr Str Assign NameStore ListLoad Str Str Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Call NameLoad ListLoad Str Expr Str Assign NameStore BinOpMult BinOpMult BinOpMult Num Num Num Num FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str FunctionDef arguments args NameParam NameParam defaults body If CompareIs NameLoad NameLoad body Assert CompareIs NameLoad NameLoad NameLoad Return Num Assign NameStore Call AttributeLoad NameLoad attr BinOpDiv BinOpMult UnaryOpUSub Call AttributeLoad NameLoad attr Num BinOpSub NameLoad NameLoad AttributeLoad NameLoad attr Return BinOpMult NameLoad NameLoad decorator_list Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd AttributeStore NameLoad attr IfExp NameLoad Num Num If NameLoad body AugAssignAdd AttributeStore NameLoad attr IfExp NameLoad Num Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str ImportFrom alias Assign TupleStore NameStore NameStore Yield ListLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad keyword NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad keyword NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call NameLoad TupleLoad NameLoad NameLoad decorator_list NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Expr Yield ListComp Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad comprehension NameStore SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num CompareNotEq NameLoad NameLoad Expr Call NameLoad decorator_list NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str ImportFrom alias Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad NameLoad Index Str NameLoad keyword NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str NameLoad keyword NameLoad If CompareIs NameLoad NameLoad body Raise Call NameLoad BinOpMod Str SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword SubscriptLoad NameLoad Index Str keyword AttributeLoad NameLoad attr Assert CompareEq SubscriptLoad NameLoad Index Str AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body If CompareNotEq NameLoad Str body Assert CompareIn NameLoad AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call NameLoad decorator_list NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Yield Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad decorator_list NameLoad AttributeLoad NameLoad attr decorator_list AttributeLoad NameLoad attr
N/A N/A Friend relation.

Viewfinder friends define a relationship between two users predicated on confirmation of photo
sharing permission. Each friend has an associated 'status', which can be:

  - 'friend':  user has been marked as a friend; however, that user may not have the reverse
               friendship object.
  - 'muted':   a friend who has attained special status as an unwanted irritant. Content shared
               from these friends is not shown, though still received and can be retrieved.
  - 'blocked': a friend who has attained special status as an unwanted irritant. These users will
               not show up in suggestions lists and cannot be contacted for sharing.

Friends are different than contacts. Contacts are the full spectrum of social connections. A
contact doesn't become a viewfinder friend until a share has been completed.

NOTE: Next comment is outdated, but we may re-enable something similar in future.
The 'colocated_shares', 'total_shares', 'last_colocated' and 'last_share' values are used to
quantify the strength of the sharing relationship. Each time the users in a friend relationship
are co-located, 'colocated_shares' is decayed based on 'last_colocated' and the current time
and updated either with a +1 if the sharing occurs or a -1 if not. 'total_shares' is similarly
updated, though not just when the users are co-located, but on every share that a user initiates.

  Friend: viewfinder friend information
 N/A __authors__ N/A spencer@emailscrubbed.com (Spencer Kimball) andy@emailscrubbed.com (Andy Kimball) N/A logging N/A math functools partial tornado gen viewfinder.backend.base util viewfinder.backend.base.exceptions NotFoundError viewfinder.backend.db db_client vf_schema viewfinder.backend.db.base DBObject viewfinder.backend.db.range_base DBRangeObject viewfinder.backend.op.notification_manager NotificationManager Friend N/A DBRangeObject N/A N/A Viewfinder friend data object. N/A __slots__ N/A N/A _table N/A N/A N/A DBObject _schema GetTable N/A vf_schema FRIEND N/A FRIEND friend N/A MUTED muted N/A BLOCKED blocked N/A FRIEND_ATTRIBUTES N/A set N/A nickname N/A Subset of friend attributes that should be projected to the user. N/A _SHARE_HALF_LIFE N/A N/A N/A 60 60 24 30 __init__ N/A N/A self user_id friend_id N/A None None N/A N/A N/A N/A N/A super Friend self __init__ N/A N/A self user_id user_id N/A N/A self friend_id friend_id N/A N/A self status N/A Friend FRIEND N/A IsBlocked N/A N/A self N/A N/A N/A Returns true if the "friend" identified by self.friend_id is blocked. N/A N/A N/A self status N/A Friend BLOCKED N/A DecayShares N/A N/A self timestamp N/A N/A N/A Decays 'total_shares' and 'colocated_shares' based on 'timestamp'. Updates 'last_share'
    and 'last_colocated' to 'timestamp'.
     _ComputeDecay N/A N/A shares last_time N/A N/A N/A N/A last_time None N/A N/A N/A shares None shares N/A 0 N/A decay N/A N/A math exp N/A N/A N/A N/A N/A math log 2 N/A timestamp last_time N/A Friend _SHARE_HALF_LIFE N/A N/A shares decay N/A N/A N/A self total_shares N/A _ComputeDecay N/A self total_shares N/A self last_share N/A N/A self last_share timestamp N/A N/A self colocated_shares N/A _ComputeDecay N/A self colocated_shares N/A self last_colocated N/A N/A self last_colocated timestamp N/A IncrementShares N/A N/A self timestamp shared colocated N/A N/A N/A Decays and updates 'total_shares' and 'last_share' based on whether sharing occurred
    ('shared'==True). If 'colocated', the 'colocated_shares' and 'last_colocated' are updated
    similarly.
     N/A N/A N/A self DecayShares timestamp N/A N/A self total_shares N/A shared 1.0 -1.0 N/A colocated N/A N/A N/A self colocated_shares N/A shared 1.0 -1.0 N/A MakeFriends N/A N/A cls client user_id friend_id callback N/A N/A N/A Creates a bi-directional friendship between user_id and friend_id if it does not already
    exist. Invokes the callback with the pair of friendship objects:
      [(user_id=>friend_id), (friend_id=>user_id)]
     viewfinder.backend.db.user User N/A N/A forward_friend reverse_friend N/A N/A N/A N/A gen Task N/A Friend Query client user_id friend_id None must_exist False N/A N/A gen Task N/A Friend Query client friend_id user_id None must_exist False N/A N/A forward_friend None N/A N/A forward_friend N/A N/A Friend CreateFromKeywords user_id user_id friend_id friend_id status N/A Friend FRIEND N/A N/A N/A N/A gen Task N/A forward_friend Update client N/A N/A reverse_friend None N/A N/A reverse_friend N/A N/A Friend CreateFromKeywords user_id friend_id friend_id user_id status N/A Friend FRIEND N/A N/A N/A N/A gen Task N/A reverse_friend Update client N/A N/A callback N/A forward_friend reverse_friend N/A classmethod N/A gen engine MakeFriendsWithGroup N/A N/A cls client user_ids callback N/A N/A N/A Creates bi-directional friendships between all the specified users. Each user will be
    friends with every other user.
     N/A N/A N/A N/A N/A gen Task N/A Friend MakeFriends client user_id friend_id N/A N/A index user_id N/A enumerate user_ids N/A friend_id N/A user_ids N/A N/A index 1 N/A user_id friend_id N/A N/A callback N/A classmethod N/A gen engine MakeFriendAndUpdate N/A N/A cls client user_id friend_dict callback N/A N/A N/A Ensures that the given user has at least a one-way friend relationship with the given
    friend. Updates the friend relationship attributes with those given in "friend_dict".
     viewfinder.backend.db.user User N/A friend N/A N/A N/A gen Task N/A Friend Query client user_id N/A friend_dict N/A user_id None must_exist False N/A N/A friend None N/A N/A friend_user N/A N/A N/A gen Task N/A User Query client N/A friend_dict N/A user_id None must_exist False N/A N/A friend_user None N/A N/A N/A NotFoundError N/A User %d does not exist. N/A friend_dict N/A user_id N/A friend N/A N/A Friend CreateFromKeywords user_id user_id friend_id N/A friend_dict N/A user_id status N/A Friend FRIEND N/A N/A N/A friend_dict N/A user_id N/A friend friend_id N/A friend_dict friend N/A N/A key value N/A N/A friend_dict iteritems N/A N/A N/A key user_id N/A N/A N/A key N/A Friend FRIEND_ATTRIBUTES friend_dict N/A N/A setattr friend key value N/A N/A N/A N/A gen Task N/A friend Update client N/A N/A callback N/A classmethod N/A gen engine UpdateOperation N/A N/A cls client callback user_id friend N/A N/A N/A Updates friend metadata for the relationship between the given user and friend. N/A N/A N/A N/A gen Task N/A Friend MakeFriendAndUpdate client user_id friend N/A N/A N/A N/A NotificationManager NotifyUpdateFriend client friend N/A N/A callback N/A classmethod N/A gen engine N/A N/A DBObject map_table_attributes