partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
parse_watermark_notification
Return WatermarkNotification from hangouts_pb2.WatermarkNotification.
hangups/parsers.py
def parse_watermark_notification(p): """Return WatermarkNotification from hangouts_pb2.WatermarkNotification.""" return WatermarkNotification( conv_id=p.conversation_id.id, user_id=from_participantid(p.sender_id), read_timestamp=from_timestamp( p.latest_read_timestamp ...
def parse_watermark_notification(p): """Return WatermarkNotification from hangouts_pb2.WatermarkNotification.""" return WatermarkNotification( conv_id=p.conversation_id.id, user_id=from_participantid(p.sender_id), read_timestamp=from_timestamp( p.latest_read_timestamp ...
[ "Return", "WatermarkNotification", "from", "hangouts_pb2", ".", "WatermarkNotification", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/parsers.py#L94-L102
[ "def", "parse_watermark_notification", "(", "p", ")", ":", "return", "WatermarkNotification", "(", "conv_id", "=", "p", ".", "conversation_id", ".", "id", ",", "user_id", "=", "from_participantid", "(", "p", ".", "sender_id", ")", ",", "read_timestamp", "=", "...
85c0bf0a57698d077461283895707260f9dbf931
valid
_get_authorization_headers
Return authorization headers for API request.
hangups/http_utils.py
def _get_authorization_headers(sapisid_cookie): """Return authorization headers for API request.""" # It doesn't seem to matter what the url and time are as long as they are # consistent. time_msec = int(time.time() * 1000) auth_string = '{} {} {}'.format(time_msec, sapisid_cookie, ORIGIN_URL) a...
def _get_authorization_headers(sapisid_cookie): """Return authorization headers for API request.""" # It doesn't seem to matter what the url and time are as long as they are # consistent. time_msec = int(time.time() * 1000) auth_string = '{} {} {}'.format(time_msec, sapisid_cookie, ORIGIN_URL) a...
[ "Return", "authorization", "headers", "for", "API", "request", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/http_utils.py#L129-L141
[ "def", "_get_authorization_headers", "(", "sapisid_cookie", ")", ":", "# It doesn't seem to matter what the url and time are as long as they are", "# consistent.", "time_msec", "=", "int", "(", "time", ".", "time", "(", ")", "*", "1000", ")", "auth_string", "=", "'{} {} {...
85c0bf0a57698d077461283895707260f9dbf931
valid
Session.fetch
Make an HTTP request. Automatically uses configured HTTP proxy, and adds Google authorization header and cookies. Failures will be retried MAX_RETRIES times before raising NetworkError. Args: method (str): Request method. url (str): Request URL. par...
hangups/http_utils.py
async def fetch(self, method, url, params=None, headers=None, data=None): """Make an HTTP request. Automatically uses configured HTTP proxy, and adds Google authorization header and cookies. Failures will be retried MAX_RETRIES times before raising NetworkError. Args: ...
async def fetch(self, method, url, params=None, headers=None, data=None): """Make an HTTP request. Automatically uses configured HTTP proxy, and adds Google authorization header and cookies. Failures will be retried MAX_RETRIES times before raising NetworkError. Args: ...
[ "Make", "an", "HTTP", "request", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/http_utils.py#L40-L91
[ "async", "def", "fetch", "(", "self", ",", "method", ",", "url", ",", "params", "=", "None", ",", "headers", "=", "None", ",", "data", "=", "None", ")", ":", "logger", ".", "debug", "(", "'Sending request %s %s:\\n%r'", ",", "method", ",", "url", ",", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
Session.fetch_raw
Make an HTTP request using aiohttp directly. Automatically uses configured HTTP proxy, and adds Google authorization header and cookies. Args: method (str): Request method. url (str): Request URL. params (dict): (optional) Request query string parameters. ...
hangups/http_utils.py
def fetch_raw(self, method, url, params=None, headers=None, data=None): """Make an HTTP request using aiohttp directly. Automatically uses configured HTTP proxy, and adds Google authorization header and cookies. Args: method (str): Request method. url (str): Req...
def fetch_raw(self, method, url, params=None, headers=None, data=None): """Make an HTTP request using aiohttp directly. Automatically uses configured HTTP proxy, and adds Google authorization header and cookies. Args: method (str): Request method. url (str): Req...
[ "Make", "an", "HTTP", "request", "using", "aiohttp", "directly", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/http_utils.py#L93-L122
[ "def", "fetch_raw", "(", "self", ",", "method", ",", "url", ",", "params", "=", "None", ",", "headers", "=", "None", ",", "data", "=", "None", ")", ":", "# Ensure we don't accidentally send the authorization header to a", "# non-Google domain:", "if", "not", "urll...
85c0bf0a57698d077461283895707260f9dbf931
valid
lookup_entities
Search for entities by phone number, email, or gaia_id.
examples/lookup_entities.py
async def lookup_entities(client, args): """Search for entities by phone number, email, or gaia_id.""" lookup_spec = _get_lookup_spec(args.entity_identifier) request = hangups.hangouts_pb2.GetEntityByIdRequest( request_header=client.get_request_header(), batch_lookup_spec=[lookup_spec], ...
async def lookup_entities(client, args): """Search for entities by phone number, email, or gaia_id.""" lookup_spec = _get_lookup_spec(args.entity_identifier) request = hangups.hangouts_pb2.GetEntityByIdRequest( request_header=client.get_request_header(), batch_lookup_spec=[lookup_spec], ...
[ "Search", "for", "entities", "by", "phone", "number", "email", "or", "gaia_id", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/examples/lookup_entities.py#L8-L20
[ "async", "def", "lookup_entities", "(", "client", ",", "args", ")", ":", "lookup_spec", "=", "_get_lookup_spec", "(", "args", ".", "entity_identifier", ")", "request", "=", "hangups", ".", "hangouts_pb2", ".", "GetEntityByIdRequest", "(", "request_header", "=", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
_get_lookup_spec
Return EntityLookupSpec from phone number, email address, or gaia ID.
examples/lookup_entities.py
def _get_lookup_spec(identifier): """Return EntityLookupSpec from phone number, email address, or gaia ID.""" if identifier.startswith('+'): return hangups.hangouts_pb2.EntityLookupSpec( phone=identifier, create_offnetwork_gaia=True ) elif '@' in identifier: return hangup...
def _get_lookup_spec(identifier): """Return EntityLookupSpec from phone number, email address, or gaia ID.""" if identifier.startswith('+'): return hangups.hangouts_pb2.EntityLookupSpec( phone=identifier, create_offnetwork_gaia=True ) elif '@' in identifier: return hangup...
[ "Return", "EntityLookupSpec", "from", "phone", "number", "email", "address", "or", "gaia", "ID", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/examples/lookup_entities.py#L23-L34
[ "def", "_get_lookup_spec", "(", "identifier", ")", ":", "if", "identifier", ".", "startswith", "(", "'+'", ")", ":", "return", "hangups", ".", "hangouts_pb2", ".", "EntityLookupSpec", "(", "phone", "=", "identifier", ",", "create_offnetwork_gaia", "=", "True", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
get_conv_name
Return a readable name for a conversation. If the conversation has a custom name, use the custom name. Otherwise, for one-to-one conversations, the name is the full name of the other user. For group conversations, the name is a comma-separated list of first names. If the group conversation is empty, th...
hangups/ui/utils.py
def get_conv_name(conv, truncate=False, show_unread=False): """Return a readable name for a conversation. If the conversation has a custom name, use the custom name. Otherwise, for one-to-one conversations, the name is the full name of the other user. For group conversations, the name is a comma-separa...
def get_conv_name(conv, truncate=False, show_unread=False): """Return a readable name for a conversation. If the conversation has a custom name, use the custom name. Otherwise, for one-to-one conversations, the name is the full name of the other user. For group conversations, the name is a comma-separa...
[ "Return", "a", "readable", "name", "for", "a", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/utils.py#L6-L42
[ "def", "get_conv_name", "(", "conv", ",", "truncate", "=", "False", ",", "show_unread", "=", "False", ")", ":", "num_unread", "=", "len", "(", "[", "conv_event", "for", "conv_event", "in", "conv", ".", "unread_events", "if", "isinstance", "(", "conv_event", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
add_color_to_scheme
Add foreground and background colours to a color scheme
hangups/ui/utils.py
def add_color_to_scheme(scheme, name, foreground, background, palette_colors): """Add foreground and background colours to a color scheme""" if foreground is None and background is None: return scheme new_scheme = [] for item in scheme: if item[0] == name: if foreground is N...
def add_color_to_scheme(scheme, name, foreground, background, palette_colors): """Add foreground and background colours to a color scheme""" if foreground is None and background is None: return scheme new_scheme = [] for item in scheme: if item[0] == name: if foreground is N...
[ "Add", "foreground", "and", "background", "colours", "to", "a", "color", "scheme" ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/utils.py#L45-L63
[ "def", "add_color_to_scheme", "(", "scheme", ",", "name", ",", "foreground", ",", "background", ",", "palette_colors", ")", ":", "if", "foreground", "is", "None", "and", "background", "is", "None", ":", "return", "scheme", "new_scheme", "=", "[", "]", "for",...
85c0bf0a57698d077461283895707260f9dbf931
valid
build_user_conversation_list
Build :class:`.UserList` and :class:`.ConversationList`. This method requests data necessary to build the list of conversations and users. Users that are not in the contact list but are participating in a conversation will also be retrieved. Args: client (Client): Connected client. Return...
hangups/conversation.py
async def build_user_conversation_list(client): """Build :class:`.UserList` and :class:`.ConversationList`. This method requests data necessary to build the list of conversations and users. Users that are not in the contact list but are participating in a conversation will also be retrieved. Args:...
async def build_user_conversation_list(client): """Build :class:`.UserList` and :class:`.ConversationList`. This method requests data necessary to build the list of conversations and users. Users that are not in the contact list but are participating in a conversation will also be retrieved. Args:...
[ "Build", ":", "class", ":", ".", "UserList", "and", ":", "class", ":", ".", "ConversationList", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L16-L78
[ "async", "def", "build_user_conversation_list", "(", "client", ")", ":", "conv_states", ",", "sync_timestamp", "=", "await", "_sync_all_conversations", "(", "client", ")", "# Retrieve entities participating in all conversations.", "required_user_ids", "=", "set", "(", ")", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
_sync_all_conversations
Sync all conversations by making paginated requests. Conversations are ordered by ascending sort timestamp. Args: client (Client): Connected client. Raises: NetworkError: If the requests fail. Returns: tuple of list of ``ConversationState`` messages and sync timestamp
hangups/conversation.py
async def _sync_all_conversations(client): """Sync all conversations by making paginated requests. Conversations are ordered by ascending sort timestamp. Args: client (Client): Connected client. Raises: NetworkError: If the requests fail. Returns: tuple of list of ``Conve...
async def _sync_all_conversations(client): """Sync all conversations by making paginated requests. Conversations are ordered by ascending sort timestamp. Args: client (Client): Connected client. Raises: NetworkError: If the requests fail. Returns: tuple of list of ``Conve...
[ "Sync", "all", "conversations", "by", "making", "paginated", "requests", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L81-L127
[ "async", "def", "_sync_all_conversations", "(", "client", ")", ":", "conv_states", "=", "[", "]", "sync_timestamp", "=", "None", "request", "=", "hangouts_pb2", ".", "SyncRecentConversationsRequest", "(", "request_header", "=", "client", ".", "get_request_header", "...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.users
List of conversation participants (:class:`~hangups.user.User`).
hangups/conversation.py
def users(self): """List of conversation participants (:class:`~hangups.user.User`).""" return [self._user_list.get_user(user.UserID(chat_id=part.id.chat_id, gaia_id=part.id.gaia_id)) for part in self._conversation.participant_data]
def users(self): """List of conversation participants (:class:`~hangups.user.User`).""" return [self._user_list.get_user(user.UserID(chat_id=part.id.chat_id, gaia_id=part.id.gaia_id)) for part in self._conversation.participant_data]
[ "List", "of", "conversation", "participants", "(", ":", "class", ":", "~hangups", ".", "user", ".", "User", ")", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L193-L197
[ "def", "users", "(", "self", ")", ":", "return", "[", "self", ".", "_user_list", ".", "get_user", "(", "user", ".", "UserID", "(", "chat_id", "=", "part", ".", "id", ".", "chat_id", ",", "gaia_id", "=", "part", ".", "id", ".", "gaia_id", ")", ")", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.last_modified
When conversation was last modified (:class:`datetime.datetime`).
hangups/conversation.py
def last_modified(self): """When conversation was last modified (:class:`datetime.datetime`).""" timestamp = self._conversation.self_conversation_state.sort_timestamp # timestamp can be None for some reason when there is an ongoing video # hangout if timestamp is None: ...
def last_modified(self): """When conversation was last modified (:class:`datetime.datetime`).""" timestamp = self._conversation.self_conversation_state.sort_timestamp # timestamp can be None for some reason when there is an ongoing video # hangout if timestamp is None: ...
[ "When", "conversation", "was", "last", "modified", "(", ":", "class", ":", "datetime", ".", "datetime", ")", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L209-L216
[ "def", "last_modified", "(", "self", ")", ":", "timestamp", "=", "self", ".", "_conversation", ".", "self_conversation_state", ".", "sort_timestamp", "# timestamp can be None for some reason when there is an ongoing video", "# hangout", "if", "timestamp", "is", "None", ":",...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.unread_events
Loaded events which are unread sorted oldest to newest. Some Hangouts clients don't update the read timestamp for certain event types, such as membership changes, so this may return more unread events than these clients will show. There's also a delay between sending a message and the u...
hangups/conversation.py
def unread_events(self): """Loaded events which are unread sorted oldest to newest. Some Hangouts clients don't update the read timestamp for certain event types, such as membership changes, so this may return more unread events than these clients will show. There's also a delay between...
def unread_events(self): """Loaded events which are unread sorted oldest to newest. Some Hangouts clients don't update the read timestamp for certain event types, such as membership changes, so this may return more unread events than these clients will show. There's also a delay between...
[ "Loaded", "events", "which", "are", "unread", "sorted", "oldest", "to", "newest", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L242-L253
[ "def", "unread_events", "(", "self", ")", ":", "return", "[", "conv_event", "for", "conv_event", "in", "self", ".", "_events", "if", "conv_event", ".", "timestamp", ">", "self", ".", "latest_read_timestamp", "]" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.is_quiet
``True`` if notification level for this conversation is quiet.
hangups/conversation.py
def is_quiet(self): """``True`` if notification level for this conversation is quiet.""" level = self._conversation.self_conversation_state.notification_level return level == hangouts_pb2.NOTIFICATION_LEVEL_QUIET
def is_quiet(self): """``True`` if notification level for this conversation is quiet.""" level = self._conversation.self_conversation_state.notification_level return level == hangouts_pb2.NOTIFICATION_LEVEL_QUIET
[ "True", "if", "notification", "level", "for", "this", "conversation", "is", "quiet", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L262-L265
[ "def", "is_quiet", "(", "self", ")", ":", "level", "=", "self", ".", "_conversation", ".", "self_conversation_state", ".", "notification_level", "return", "level", "==", "hangouts_pb2", ".", "NOTIFICATION_LEVEL_QUIET" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation._on_watermark_notification
Handle a watermark notification.
hangups/conversation.py
def _on_watermark_notification(self, notif): """Handle a watermark notification.""" # Update the conversation: if self.get_user(notif.user_id).is_self: logger.info('latest_read_timestamp for {} updated to {}' .format(self.id_, notif.read_timestamp)) ...
def _on_watermark_notification(self, notif): """Handle a watermark notification.""" # Update the conversation: if self.get_user(notif.user_id).is_self: logger.info('latest_read_timestamp for {} updated to {}' .format(self.id_, notif.read_timestamp)) ...
[ "Handle", "a", "watermark", "notification", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L273-L295
[ "def", "_on_watermark_notification", "(", "self", ",", "notif", ")", ":", "# Update the conversation:", "if", "self", ".", "get_user", "(", "notif", ".", "user_id", ")", ".", "is_self", ":", "logger", ".", "info", "(", "'latest_read_timestamp for {} updated to {}'",...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.update_conversation
Update the internal state of the conversation. This method is used by :class:`.ConversationList` to maintain this instance. Args: conversation: ``Conversation`` message.
hangups/conversation.py
def update_conversation(self, conversation): """Update the internal state of the conversation. This method is used by :class:`.ConversationList` to maintain this instance. Args: conversation: ``Conversation`` message. """ # StateUpdate.conversation is actual...
def update_conversation(self, conversation): """Update the internal state of the conversation. This method is used by :class:`.ConversationList` to maintain this instance. Args: conversation: ``Conversation`` message. """ # StateUpdate.conversation is actual...
[ "Update", "the", "internal", "state", "of", "the", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L297-L334
[ "def", "update_conversation", "(", "self", ",", "conversation", ")", ":", "# StateUpdate.conversation is actually a delta; fields that aren't", "# specified are assumed to be unchanged. Until this class is", "# refactored, hide this by saving and restoring previous values where", "# necessary....
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation._wrap_event
Wrap hangouts_pb2.Event in ConversationEvent subclass.
hangups/conversation.py
def _wrap_event(event_): """Wrap hangouts_pb2.Event in ConversationEvent subclass.""" cls = conversation_event.ConversationEvent if event_.HasField('chat_message'): cls = conversation_event.ChatMessageEvent elif event_.HasField('otr_modification'): cls = conversat...
def _wrap_event(event_): """Wrap hangouts_pb2.Event in ConversationEvent subclass.""" cls = conversation_event.ConversationEvent if event_.HasField('chat_message'): cls = conversation_event.ChatMessageEvent elif event_.HasField('otr_modification'): cls = conversat...
[ "Wrap", "hangouts_pb2", ".", "Event", "in", "ConversationEvent", "subclass", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L337-L352
[ "def", "_wrap_event", "(", "event_", ")", ":", "cls", "=", "conversation_event", ".", "ConversationEvent", "if", "event_", ".", "HasField", "(", "'chat_message'", ")", ":", "cls", "=", "conversation_event", ".", "ChatMessageEvent", "elif", "event_", ".", "HasFie...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.add_event
Add an event to the conversation. This method is used by :class:`.ConversationList` to maintain this instance. Args: event_: ``Event`` message. Returns: :class:`.ConversationEvent` representing the event.
hangups/conversation.py
def add_event(self, event_): """Add an event to the conversation. This method is used by :class:`.ConversationList` to maintain this instance. Args: event_: ``Event`` message. Returns: :class:`.ConversationEvent` representing the event. """ ...
def add_event(self, event_): """Add an event to the conversation. This method is used by :class:`.ConversationList` to maintain this instance. Args: event_: ``Event`` message. Returns: :class:`.ConversationEvent` representing the event. """ ...
[ "Add", "an", "event", "to", "the", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L354-L375
[ "def", "add_event", "(", "self", ",", "event_", ")", ":", "conv_event", "=", "self", ".", "_wrap_event", "(", "event_", ")", "if", "conv_event", ".", "id_", "not", "in", "self", ".", "_events_dict", ":", "self", ".", "_events", ".", "append", "(", "con...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation._get_default_delivery_medium
Return default DeliveryMedium to use for sending messages. Use the first option, or an option that's marked as the current default.
hangups/conversation.py
def _get_default_delivery_medium(self): """Return default DeliveryMedium to use for sending messages. Use the first option, or an option that's marked as the current default. """ medium_options = ( self._conversation.self_conversation_state.delivery_medium_option ...
def _get_default_delivery_medium(self): """Return default DeliveryMedium to use for sending messages. Use the first option, or an option that's marked as the current default. """ medium_options = ( self._conversation.self_conversation_state.delivery_medium_option ...
[ "Return", "default", "DeliveryMedium", "to", "use", "for", "sending", "messages", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L391-L410
[ "def", "_get_default_delivery_medium", "(", "self", ")", ":", "medium_options", "=", "(", "self", ".", "_conversation", ".", "self_conversation_state", ".", "delivery_medium_option", ")", "try", ":", "default_medium", "=", "medium_options", "[", "0", "]", ".", "de...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation._get_event_request_header
Return EventRequestHeader for conversation.
hangups/conversation.py
def _get_event_request_header(self): """Return EventRequestHeader for conversation.""" otr_status = (hangouts_pb2.OFF_THE_RECORD_STATUS_OFF_THE_RECORD if self.is_off_the_record else hangouts_pb2.OFF_THE_RECORD_STATUS_ON_THE_RECORD) return hangouts_pb2....
def _get_event_request_header(self): """Return EventRequestHeader for conversation.""" otr_status = (hangouts_pb2.OFF_THE_RECORD_STATUS_OFF_THE_RECORD if self.is_off_the_record else hangouts_pb2.OFF_THE_RECORD_STATUS_ON_THE_RECORD) return hangouts_pb2....
[ "Return", "EventRequestHeader", "for", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L412-L422
[ "def", "_get_event_request_header", "(", "self", ")", ":", "otr_status", "=", "(", "hangouts_pb2", ".", "OFF_THE_RECORD_STATUS_OFF_THE_RECORD", "if", "self", ".", "is_off_the_record", "else", "hangouts_pb2", ".", "OFF_THE_RECORD_STATUS_ON_THE_RECORD", ")", "return", "hang...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.send_message
Send a message to this conversation. A per-conversation lock is acquired to ensure that messages are sent in the correct order when this method is called multiple times asynchronously. Args: segments: List of :class:`.ChatMessageSegment` objects to include i...
hangups/conversation.py
async def send_message(self, segments, image_file=None, image_id=None, image_user_id=None): """Send a message to this conversation. A per-conversation lock is acquired to ensure that messages are sent in the correct order when this method is called multiple times ...
async def send_message(self, segments, image_file=None, image_id=None, image_user_id=None): """Send a message to this conversation. A per-conversation lock is acquired to ensure that messages are sent in the correct order when this method is called multiple times ...
[ "Send", "a", "message", "to", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L424-L474
[ "async", "def", "send_message", "(", "self", ",", "segments", ",", "image_file", "=", "None", ",", "image_id", "=", "None", ",", "image_user_id", "=", "None", ")", ":", "async", "with", "self", ".", "_send_message_lock", ":", "if", "image_file", ":", "try"...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.leave
Leave this conversation. Raises: .NetworkError: If conversation cannot be left.
hangups/conversation.py
async def leave(self): """Leave this conversation. Raises: .NetworkError: If conversation cannot be left. """ is_group_conversation = (self._conversation.type == hangouts_pb2.CONVERSATION_TYPE_GROUP) try: if is_group_conve...
async def leave(self): """Leave this conversation. Raises: .NetworkError: If conversation cannot be left. """ is_group_conversation = (self._conversation.type == hangouts_pb2.CONVERSATION_TYPE_GROUP) try: if is_group_conve...
[ "Leave", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L476-L506
[ "async", "def", "leave", "(", "self", ")", ":", "is_group_conversation", "=", "(", "self", ".", "_conversation", ".", "type", "==", "hangouts_pb2", ".", "CONVERSATION_TYPE_GROUP", ")", "try", ":", "if", "is_group_conversation", ":", "await", "self", ".", "_cli...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.rename
Rename this conversation. Hangouts only officially supports renaming group conversations, so custom names for one-to-one conversations may or may not appear in all first party clients. Args: name (str): New name. Raises: .NetworkError: If conversation c...
hangups/conversation.py
async def rename(self, name): """Rename this conversation. Hangouts only officially supports renaming group conversations, so custom names for one-to-one conversations may or may not appear in all first party clients. Args: name (str): New name. Raises: ...
async def rename(self, name): """Rename this conversation. Hangouts only officially supports renaming group conversations, so custom names for one-to-one conversations may or may not appear in all first party clients. Args: name (str): New name. Raises: ...
[ "Rename", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L508-L527
[ "async", "def", "rename", "(", "self", ",", "name", ")", ":", "await", "self", ".", "_client", ".", "rename_conversation", "(", "hangouts_pb2", ".", "RenameConversationRequest", "(", "request_header", "=", "self", ".", "_client", ".", "get_request_header", "(", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.set_notification_level
Set the notification level of this conversation. Args: level: ``NOTIFICATION_LEVEL_QUIET`` to disable notifications, or ``NOTIFICATION_LEVEL_RING`` to enable them. Raises: .NetworkError: If the request fails.
hangups/conversation.py
async def set_notification_level(self, level): """Set the notification level of this conversation. Args: level: ``NOTIFICATION_LEVEL_QUIET`` to disable notifications, or ``NOTIFICATION_LEVEL_RING`` to enable them. Raises: .NetworkError: If the request fa...
async def set_notification_level(self, level): """Set the notification level of this conversation. Args: level: ``NOTIFICATION_LEVEL_QUIET`` to disable notifications, or ``NOTIFICATION_LEVEL_RING`` to enable them. Raises: .NetworkError: If the request fa...
[ "Set", "the", "notification", "level", "of", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L529-L545
[ "async", "def", "set_notification_level", "(", "self", ",", "level", ")", ":", "await", "self", ".", "_client", ".", "set_conversation_notification_level", "(", "hangouts_pb2", ".", "SetConversationNotificationLevelRequest", "(", "request_header", "=", "self", ".", "_...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.set_typing
Set your typing status in this conversation. Args: typing: (optional) ``TYPING_TYPE_STARTED``, ``TYPING_TYPE_PAUSED``, or ``TYPING_TYPE_STOPPED`` to start, pause, or stop typing, respectively. Defaults to ``TYPING_TYPE_STARTED``. Raises: .Network...
hangups/conversation.py
async def set_typing(self, typing=hangouts_pb2.TYPING_TYPE_STARTED): """Set your typing status in this conversation. Args: typing: (optional) ``TYPING_TYPE_STARTED``, ``TYPING_TYPE_PAUSED``, or ``TYPING_TYPE_STOPPED`` to start, pause, or stop typing, respecti...
async def set_typing(self, typing=hangouts_pb2.TYPING_TYPE_STARTED): """Set your typing status in this conversation. Args: typing: (optional) ``TYPING_TYPE_STARTED``, ``TYPING_TYPE_PAUSED``, or ``TYPING_TYPE_STOPPED`` to start, pause, or stop typing, respecti...
[ "Set", "your", "typing", "status", "in", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L547-L569
[ "async", "def", "set_typing", "(", "self", ",", "typing", "=", "hangouts_pb2", ".", "TYPING_TYPE_STARTED", ")", ":", "# TODO: Add rate-limiting to avoid unnecessary requests.", "try", ":", "await", "self", ".", "_client", ".", "set_typing", "(", "hangouts_pb2", ".", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.update_read_timestamp
Update the timestamp of the latest event which has been read. This method will avoid making an API request if it will have no effect. Args: read_timestamp (datetime.datetime): (optional) Timestamp to set. Defaults to the timestamp of the newest event. Raises: ...
hangups/conversation.py
async def update_read_timestamp(self, read_timestamp=None): """Update the timestamp of the latest event which has been read. This method will avoid making an API request if it will have no effect. Args: read_timestamp (datetime.datetime): (optional) Timestamp to set. ...
async def update_read_timestamp(self, read_timestamp=None): """Update the timestamp of the latest event which has been read. This method will avoid making an API request if it will have no effect. Args: read_timestamp (datetime.datetime): (optional) Timestamp to set. ...
[ "Update", "the", "timestamp", "of", "the", "latest", "event", "which", "has", "been", "read", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L571-L610
[ "async", "def", "update_read_timestamp", "(", "self", ",", "read_timestamp", "=", "None", ")", ":", "if", "read_timestamp", "is", "None", ":", "read_timestamp", "=", "(", "self", ".", "events", "[", "-", "1", "]", ".", "timestamp", "if", "self", ".", "ev...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.get_events
Get events from this conversation. Makes a request to load historical events if necessary. Args: event_id (str): (optional) If provided, return events preceding this event, otherwise return the newest events. max_events (int): Maximum number of events to return....
hangups/conversation.py
async def get_events(self, event_id=None, max_events=50): """Get events from this conversation. Makes a request to load historical events if necessary. Args: event_id (str): (optional) If provided, return events preceding this event, otherwise return the newest even...
async def get_events(self, event_id=None, max_events=50): """Get events from this conversation. Makes a request to load historical events if necessary. Args: event_id (str): (optional) If provided, return events preceding this event, otherwise return the newest even...
[ "Get", "events", "from", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L612-L687
[ "async", "def", "get_events", "(", "self", ",", "event_id", "=", "None", ",", "max_events", "=", "50", ")", ":", "if", "event_id", "is", "None", ":", "# If no event_id is provided, return the newest events in this", "# conversation.", "conv_events", "=", "self", "."...
85c0bf0a57698d077461283895707260f9dbf931
valid
Conversation.next_event
Get the event following another event in this conversation. Args: event_id (str): ID of the event. prev (bool): If ``True``, return the previous event rather than the next event. Defaults to ``False``. Raises: KeyError: If no such :class:`.Conversati...
hangups/conversation.py
def next_event(self, event_id, prev=False): """Get the event following another event in this conversation. Args: event_id (str): ID of the event. prev (bool): If ``True``, return the previous event rather than the next event. Defaults to ``False``. Raise...
def next_event(self, event_id, prev=False): """Get the event following another event in this conversation. Args: event_id (str): ID of the event. prev (bool): If ``True``, return the previous event rather than the next event. Defaults to ``False``. Raise...
[ "Get", "the", "event", "following", "another", "event", "in", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L689-L710
[ "def", "next_event", "(", "self", ",", "event_id", ",", "prev", "=", "False", ")", ":", "i", "=", "self", ".", "events", ".", "index", "(", "self", ".", "_events_dict", "[", "event_id", "]", ")", "if", "prev", "and", "i", ">", "0", ":", "return", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList.get_all
Get all the conversations. Args: include_archived (bool): (optional) Whether to include archived conversations. Defaults to ``False``. Returns: List of all :class:`.Conversation` objects.
hangups/conversation.py
def get_all(self, include_archived=False): """Get all the conversations. Args: include_archived (bool): (optional) Whether to include archived conversations. Defaults to ``False``. Returns: List of all :class:`.Conversation` objects. """ ...
def get_all(self, include_archived=False): """Get all the conversations. Args: include_archived (bool): (optional) Whether to include archived conversations. Defaults to ``False``. Returns: List of all :class:`.Conversation` objects. """ ...
[ "Get", "all", "the", "conversations", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L788-L799
[ "def", "get_all", "(", "self", ",", "include_archived", "=", "False", ")", ":", "return", "[", "conv", "for", "conv", "in", "self", ".", "_conv_dict", ".", "values", "(", ")", "if", "not", "conv", ".", "is_archived", "or", "include_archived", "]" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList.leave_conversation
Leave a conversation. Args: conv_id (str): ID of conversation to leave.
hangups/conversation.py
async def leave_conversation(self, conv_id): """Leave a conversation. Args: conv_id (str): ID of conversation to leave. """ logger.info('Leaving conversation: {}'.format(conv_id)) await self._conv_dict[conv_id].leave() del self._conv_dict[conv_id]
async def leave_conversation(self, conv_id): """Leave a conversation. Args: conv_id (str): ID of conversation to leave. """ logger.info('Leaving conversation: {}'.format(conv_id)) await self._conv_dict[conv_id].leave() del self._conv_dict[conv_id]
[ "Leave", "a", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L815-L823
[ "async", "def", "leave_conversation", "(", "self", ",", "conv_id", ")", ":", "logger", ".", "info", "(", "'Leaving conversation: {}'", ".", "format", "(", "conv_id", ")", ")", "await", "self", ".", "_conv_dict", "[", "conv_id", "]", ".", "leave", "(", ")",...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._add_conversation
Add new conversation from hangouts_pb2.Conversation
hangups/conversation.py
def _add_conversation(self, conversation, events=[], event_cont_token=None): """Add new conversation from hangouts_pb2.Conversation""" # pylint: disable=dangerous-default-value conv_id = conversation.conversation_id.id logger.debug('Adding new conversation: {}'....
def _add_conversation(self, conversation, events=[], event_cont_token=None): """Add new conversation from hangouts_pb2.Conversation""" # pylint: disable=dangerous-default-value conv_id = conversation.conversation_id.id logger.debug('Adding new conversation: {}'....
[ "Add", "new", "conversation", "from", "hangouts_pb2", ".", "Conversation" ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L825-L834
[ "def", "_add_conversation", "(", "self", ",", "conversation", ",", "events", "=", "[", "]", ",", "event_cont_token", "=", "None", ")", ":", "# pylint: disable=dangerous-default-value", "conv_id", "=", "conversation", ".", "conversation_id", ".", "id", "logger", "....
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._on_state_update
Receive a StateUpdate and fan out to Conversations. Args: state_update: hangouts_pb2.StateUpdate instance
hangups/conversation.py
async def _on_state_update(self, state_update): """Receive a StateUpdate and fan out to Conversations. Args: state_update: hangouts_pb2.StateUpdate instance """ # The state update will include some type of notification: notification_type = state_update.WhichOneof('st...
async def _on_state_update(self, state_update): """Receive a StateUpdate and fan out to Conversations. Args: state_update: hangouts_pb2.StateUpdate instance """ # The state update will include some type of notification: notification_type = state_update.WhichOneof('st...
[ "Receive", "a", "StateUpdate", "and", "fan", "out", "to", "Conversations", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L836-L872
[ "async", "def", "_on_state_update", "(", "self", ",", "state_update", ")", ":", "# The state update will include some type of notification:", "notification_type", "=", "state_update", ".", "WhichOneof", "(", "'state_update'", ")", "# If conversation fields have been updated, the ...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._get_or_fetch_conversation
Get a cached conversation or fetch a missing conversation. Args: conv_id: string, conversation identifier Raises: NetworkError: If the request to fetch the conversation fails. Returns: :class:`.Conversation` with matching ID.
hangups/conversation.py
async def _get_or_fetch_conversation(self, conv_id): """Get a cached conversation or fetch a missing conversation. Args: conv_id: string, conversation identifier Raises: NetworkError: If the request to fetch the conversation fails. Returns: :class:`...
async def _get_or_fetch_conversation(self, conv_id): """Get a cached conversation or fetch a missing conversation. Args: conv_id: string, conversation identifier Raises: NetworkError: If the request to fetch the conversation fails. Returns: :class:`...
[ "Get", "a", "cached", "conversation", "or", "fetch", "a", "missing", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L874-L906
[ "async", "def", "_get_or_fetch_conversation", "(", "self", ",", "conv_id", ")", ":", "conv", "=", "self", ".", "_conv_dict", ".", "get", "(", "conv_id", ",", "None", ")", "if", "conv", "is", "None", ":", "logger", ".", "info", "(", "'Fetching unknown conve...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._on_event
Receive a hangouts_pb2.Event and fan out to Conversations. Args: event_: hangouts_pb2.Event instance
hangups/conversation.py
async def _on_event(self, event_): """Receive a hangouts_pb2.Event and fan out to Conversations. Args: event_: hangouts_pb2.Event instance """ conv_id = event_.conversation_id.id try: conv = await self._get_or_fetch_conversation(conv_id) except ex...
async def _on_event(self, event_): """Receive a hangouts_pb2.Event and fan out to Conversations. Args: event_: hangouts_pb2.Event instance """ conv_id = event_.conversation_id.id try: conv = await self._get_or_fetch_conversation(conv_id) except ex...
[ "Receive", "a", "hangouts_pb2", ".", "Event", "and", "fan", "out", "to", "Conversations", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L908-L928
[ "async", "def", "_on_event", "(", "self", ",", "event_", ")", ":", "conv_id", "=", "event_", ".", "conversation_id", ".", "id", "try", ":", "conv", "=", "await", "self", ".", "_get_or_fetch_conversation", "(", "conv_id", ")", "except", "exceptions", ".", "...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._handle_conversation_delta
Receive Conversation delta and create or update the conversation. Args: conversation: hangouts_pb2.Conversation instance Raises: NetworkError: A request to fetch the complete conversation failed.
hangups/conversation.py
async def _handle_conversation_delta(self, conversation): """Receive Conversation delta and create or update the conversation. Args: conversation: hangouts_pb2.Conversation instance Raises: NetworkError: A request to fetch the complete conversation failed. """ ...
async def _handle_conversation_delta(self, conversation): """Receive Conversation delta and create or update the conversation. Args: conversation: hangouts_pb2.Conversation instance Raises: NetworkError: A request to fetch the complete conversation failed. """ ...
[ "Receive", "Conversation", "delta", "and", "create", "or", "update", "the", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L930-L946
[ "async", "def", "_handle_conversation_delta", "(", "self", ",", "conversation", ")", ":", "conv_id", "=", "conversation", ".", "conversation_id", ".", "id", "conv", "=", "self", ".", "_conv_dict", ".", "get", "(", "conv_id", ",", "None", ")", "if", "conv", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._handle_set_typing_notification
Receive SetTypingNotification and update the conversation. Args: set_typing_notification: hangouts_pb2.SetTypingNotification instance
hangups/conversation.py
async def _handle_set_typing_notification(self, set_typing_notification): """Receive SetTypingNotification and update the conversation. Args: set_typing_notification: hangouts_pb2.SetTypingNotification instance """ conv_id = set_typing_notification.conversati...
async def _handle_set_typing_notification(self, set_typing_notification): """Receive SetTypingNotification and update the conversation. Args: set_typing_notification: hangouts_pb2.SetTypingNotification instance """ conv_id = set_typing_notification.conversati...
[ "Receive", "SetTypingNotification", "and", "update", "the", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L948-L966
[ "async", "def", "_handle_set_typing_notification", "(", "self", ",", "set_typing_notification", ")", ":", "conv_id", "=", "set_typing_notification", ".", "conversation_id", ".", "id", "res", "=", "parsers", ".", "parse_typing_status_message", "(", "set_typing_notification...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._handle_watermark_notification
Receive WatermarkNotification and update the conversation. Args: watermark_notification: hangouts_pb2.WatermarkNotification instance
hangups/conversation.py
async def _handle_watermark_notification(self, watermark_notification): """Receive WatermarkNotification and update the conversation. Args: watermark_notification: hangouts_pb2.WatermarkNotification instance """ conv_id = watermark_notification.conversation_id.id res...
async def _handle_watermark_notification(self, watermark_notification): """Receive WatermarkNotification and update the conversation. Args: watermark_notification: hangouts_pb2.WatermarkNotification instance """ conv_id = watermark_notification.conversation_id.id res...
[ "Receive", "WatermarkNotification", "and", "update", "the", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L968-L985
[ "async", "def", "_handle_watermark_notification", "(", "self", ",", "watermark_notification", ")", ":", "conv_id", "=", "watermark_notification", ".", "conversation_id", ".", "id", "res", "=", "parsers", ".", "parse_watermark_notification", "(", "watermark_notification", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationList._sync
Sync conversation state and events that could have been missed.
hangups/conversation.py
async def _sync(self): """Sync conversation state and events that could have been missed.""" logger.info('Syncing events since {}'.format(self._sync_timestamp)) try: res = await self._client.sync_all_new_events( hangouts_pb2.SyncAllNewEventsRequest( ...
async def _sync(self): """Sync conversation state and events that could have been missed.""" logger.info('Syncing events since {}'.format(self._sync_timestamp)) try: res = await self._client.sync_all_new_events( hangouts_pb2.SyncAllNewEventsRequest( ...
[ "Sync", "conversation", "state", "and", "events", "that", "could", "have", "been", "missed", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation.py#L987-L1020
[ "async", "def", "_sync", "(", "self", ")", ":", "logger", ".", "info", "(", "'Syncing events since {}'", ".", "format", "(", "self", ".", "_sync_timestamp", ")", ")", "try", ":", "res", "=", "await", "self", ".", "_client", ".", "sync_all_new_events", "(",...
85c0bf0a57698d077461283895707260f9dbf931
valid
User.upgrade_name
Upgrade name type of this user. Google Voice participants often first appear with no name at all, and then get upgraded unpredictably to numbers ("+12125551212") or names. Args: user_ (~hangups.user.User): User to upgrade with.
hangups/user.py
def upgrade_name(self, user_): """Upgrade name type of this user. Google Voice participants often first appear with no name at all, and then get upgraded unpredictably to numbers ("+12125551212") or names. Args: user_ (~hangups.user.User): User to upgrade with. """ ...
def upgrade_name(self, user_): """Upgrade name type of this user. Google Voice participants often first appear with no name at all, and then get upgraded unpredictably to numbers ("+12125551212") or names. Args: user_ (~hangups.user.User): User to upgrade with. """ ...
[ "Upgrade", "name", "type", "of", "this", "user", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/user.py#L67-L81
[ "def", "upgrade_name", "(", "self", ",", "user_", ")", ":", "if", "user_", ".", "name_type", ">", "self", ".", "name_type", ":", "self", ".", "full_name", "=", "user_", ".", "full_name", "self", ".", "first_name", "=", "user_", ".", "first_name", "self",...
85c0bf0a57698d077461283895707260f9dbf931
valid
User.from_entity
Construct user from ``Entity`` message. Args: entity: ``Entity`` message. self_user_id (~hangups.user.UserID or None): The ID of the current user. If ``None``, assume ``entity`` is the current user. Returns: :class:`~hangups.user.User` object.
hangups/user.py
def from_entity(entity, self_user_id): """Construct user from ``Entity`` message. Args: entity: ``Entity`` message. self_user_id (~hangups.user.UserID or None): The ID of the current user. If ``None``, assume ``entity`` is the current user. Returns: ...
def from_entity(entity, self_user_id): """Construct user from ``Entity`` message. Args: entity: ``Entity`` message. self_user_id (~hangups.user.UserID or None): The ID of the current user. If ``None``, assume ``entity`` is the current user. Returns: ...
[ "Construct", "user", "from", "Entity", "message", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/user.py#L84-L101
[ "def", "from_entity", "(", "entity", ",", "self_user_id", ")", ":", "user_id", "=", "UserID", "(", "chat_id", "=", "entity", ".", "id", ".", "chat_id", ",", "gaia_id", "=", "entity", ".", "id", ".", "gaia_id", ")", "return", "User", "(", "user_id", ","...
85c0bf0a57698d077461283895707260f9dbf931
valid
User.from_conv_part_data
Construct user from ``ConversationParticipantData`` message. Args: conv_part_id: ``ConversationParticipantData`` message. self_user_id (~hangups.user.UserID or None): The ID of the current user. If ``None``, assume ``conv_part_id`` is the current user. Returns: ...
hangups/user.py
def from_conv_part_data(conv_part_data, self_user_id): """Construct user from ``ConversationParticipantData`` message. Args: conv_part_id: ``ConversationParticipantData`` message. self_user_id (~hangups.user.UserID or None): The ID of the current user. If ``None`...
def from_conv_part_data(conv_part_data, self_user_id): """Construct user from ``ConversationParticipantData`` message. Args: conv_part_id: ``ConversationParticipantData`` message. self_user_id (~hangups.user.UserID or None): The ID of the current user. If ``None`...
[ "Construct", "user", "from", "ConversationParticipantData", "message", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/user.py#L104-L118
[ "def", "from_conv_part_data", "(", "conv_part_data", ",", "self_user_id", ")", ":", "user_id", "=", "UserID", "(", "chat_id", "=", "conv_part_data", ".", "id", ".", "chat_id", ",", "gaia_id", "=", "conv_part_data", ".", "id", ".", "gaia_id", ")", "return", "...
85c0bf0a57698d077461283895707260f9dbf931
valid
UserList.get_user
Get a user by its ID. Args: user_id (~hangups.user.UserID): The ID of the user. Raises: KeyError: If no such user is known. Returns: :class:`~hangups.user.User` with the given ID.
hangups/user.py
def get_user(self, user_id): """Get a user by its ID. Args: user_id (~hangups.user.UserID): The ID of the user. Raises: KeyError: If no such user is known. Returns: :class:`~hangups.user.User` with the given ID. """ try: ...
def get_user(self, user_id): """Get a user by its ID. Args: user_id (~hangups.user.UserID): The ID of the user. Raises: KeyError: If no such user is known. Returns: :class:`~hangups.user.User` with the given ID. """ try: ...
[ "Get", "a", "user", "by", "its", "ID", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/user.py#L155-L172
[ "def", "get_user", "(", "self", ",", "user_id", ")", ":", "try", ":", "return", "self", ".", "_user_dict", "[", "user_id", "]", "except", "KeyError", ":", "logger", ".", "warning", "(", "'UserList returning unknown User for UserID %s'", ",", "user_id", ")", "r...
85c0bf0a57698d077461283895707260f9dbf931
valid
UserList._add_user_from_conv_part
Add or upgrade User from ConversationParticipantData.
hangups/user.py
def _add_user_from_conv_part(self, conv_part): """Add or upgrade User from ConversationParticipantData.""" user_ = User.from_conv_part_data(conv_part, self._self_user.id_) existing = self._user_dict.get(user_.id_) if existing is None: logger.warning('Adding fallback User wit...
def _add_user_from_conv_part(self, conv_part): """Add or upgrade User from ConversationParticipantData.""" user_ = User.from_conv_part_data(conv_part, self._self_user.id_) existing = self._user_dict.get(user_.id_) if existing is None: logger.warning('Adding fallback User wit...
[ "Add", "or", "upgrade", "User", "from", "ConversationParticipantData", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/user.py#L182-L194
[ "def", "_add_user_from_conv_part", "(", "self", ",", "conv_part", ")", ":", "user_", "=", "User", ".", "from_conv_part_data", "(", "conv_part", ",", "self", ".", "_self_user", ".", "id_", ")", "existing", "=", "self", ".", "_user_dict", ".", "get", "(", "u...
85c0bf0a57698d077461283895707260f9dbf931
valid
Event.add_observer
Add an observer to this event. Args: callback: A function or coroutine callback to call when the event is fired. Raises: ValueError: If the callback has already been added.
hangups/event.py
def add_observer(self, callback): """Add an observer to this event. Args: callback: A function or coroutine callback to call when the event is fired. Raises: ValueError: If the callback has already been added. """ if callback in self._obs...
def add_observer(self, callback): """Add an observer to this event. Args: callback: A function or coroutine callback to call when the event is fired. Raises: ValueError: If the callback has already been added. """ if callback in self._obs...
[ "Add", "an", "observer", "to", "this", "event", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/event.py#L23-L36
[ "def", "add_observer", "(", "self", ",", "callback", ")", ":", "if", "callback", "in", "self", ".", "_observers", ":", "raise", "ValueError", "(", "'{} is already an observer of {}'", ".", "format", "(", "callback", ",", "self", ")", ")", "self", ".", "_obse...
85c0bf0a57698d077461283895707260f9dbf931
valid
Event.remove_observer
Remove an observer from this event. Args: callback: A function or coroutine callback to remove from this event. Raises: ValueError: If the callback is not an observer of this event.
hangups/event.py
def remove_observer(self, callback): """Remove an observer from this event. Args: callback: A function or coroutine callback to remove from this event. Raises: ValueError: If the callback is not an observer of this event. """ if callback ...
def remove_observer(self, callback): """Remove an observer from this event. Args: callback: A function or coroutine callback to remove from this event. Raises: ValueError: If the callback is not an observer of this event. """ if callback ...
[ "Remove", "an", "observer", "from", "this", "event", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/event.py#L38-L51
[ "def", "remove_observer", "(", "self", ",", "callback", ")", ":", "if", "callback", "not", "in", "self", ".", "_observers", ":", "raise", "ValueError", "(", "'{} is not an observer of {}'", ".", "format", "(", "callback", ",", "self", ")", ")", "self", ".", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
Event.fire
Fire this event, calling all observers with the same arguments.
hangups/event.py
async def fire(self, *args, **kwargs): """Fire this event, calling all observers with the same arguments.""" logger.debug('Fired {}'.format(self)) for observer in self._observers: gen = observer(*args, **kwargs) if asyncio.iscoroutinefunction(observer): aw...
async def fire(self, *args, **kwargs): """Fire this event, calling all observers with the same arguments.""" logger.debug('Fired {}'.format(self)) for observer in self._observers: gen = observer(*args, **kwargs) if asyncio.iscoroutinefunction(observer): aw...
[ "Fire", "this", "event", "calling", "all", "observers", "with", "the", "same", "arguments", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/event.py#L53-L59
[ "async", "def", "fire", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "debug", "(", "'Fired {}'", ".", "format", "(", "self", ")", ")", "for", "observer", "in", "self", ".", "_observers", ":", "gen", "=", "observe...
85c0bf0a57698d077461283895707260f9dbf931
valid
markdown
Return start and end regex pattern sequences for simple Markdown tag.
hangups/message_parser.py
def markdown(tag): """Return start and end regex pattern sequences for simple Markdown tag.""" return (MARKDOWN_START.format(tag=tag), MARKDOWN_END.format(tag=tag))
def markdown(tag): """Return start and end regex pattern sequences for simple Markdown tag.""" return (MARKDOWN_START.format(tag=tag), MARKDOWN_END.format(tag=tag))
[ "Return", "start", "and", "end", "regex", "pattern", "sequences", "for", "simple", "Markdown", "tag", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/message_parser.py#L87-L89
[ "def", "markdown", "(", "tag", ")", ":", "return", "(", "MARKDOWN_START", ".", "format", "(", "tag", "=", "tag", ")", ",", "MARKDOWN_END", ".", "format", "(", "tag", "=", "tag", ")", ")" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
html
Return sequence of start and end regex patterns for simple HTML tag
hangups/message_parser.py
def html(tag): """Return sequence of start and end regex patterns for simple HTML tag""" return (HTML_START.format(tag=tag), HTML_END.format(tag=tag))
def html(tag): """Return sequence of start and end regex patterns for simple HTML tag""" return (HTML_START.format(tag=tag), HTML_END.format(tag=tag))
[ "Return", "sequence", "of", "start", "and", "end", "regex", "patterns", "for", "simple", "HTML", "tag" ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/message_parser.py#L92-L94
[ "def", "html", "(", "tag", ")", ":", "return", "(", "HTML_START", ".", "format", "(", "tag", "=", "tag", ")", ",", "HTML_END", ".", "format", "(", "tag", "=", "tag", ")", ")" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
run_example
Run a hangups example coroutine. Args: example_coroutine (coroutine): Coroutine to run with a connected hangups client and arguments namespace as arguments. extra_args (str): Any extra command line arguments required by the example.
examples/common.py
def run_example(example_coroutine, *extra_args): """Run a hangups example coroutine. Args: example_coroutine (coroutine): Coroutine to run with a connected hangups client and arguments namespace as arguments. extra_args (str): Any extra command line arguments required by the ...
def run_example(example_coroutine, *extra_args): """Run a hangups example coroutine. Args: example_coroutine (coroutine): Coroutine to run with a connected hangups client and arguments namespace as arguments. extra_args (str): Any extra command line arguments required by the ...
[ "Run", "a", "hangups", "example", "coroutine", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/examples/common.py#L12-L37
[ "def", "run_example", "(", "example_coroutine", ",", "*", "extra_args", ")", ":", "args", "=", "_get_parser", "(", "extra_args", ")", ".", "parse_args", "(", ")", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", "if", "args", ".",...
85c0bf0a57698d077461283895707260f9dbf931
valid
_get_parser
Return ArgumentParser with any extra arguments.
examples/common.py
def _get_parser(extra_args): """Return ArgumentParser with any extra arguments.""" parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) dirs = appdirs.AppDirs('hangups', 'hangups') default_token_path = os.path.join(dirs.user_cache_dir, 'refresh_token.tx...
def _get_parser(extra_args): """Return ArgumentParser with any extra arguments.""" parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) dirs = appdirs.AppDirs('hangups', 'hangups') default_token_path = os.path.join(dirs.user_cache_dir, 'refresh_token.tx...
[ "Return", "ArgumentParser", "with", "any", "extra", "arguments", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/examples/common.py#L40-L57
[ "def", "_get_parser", "(", "extra_args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ",", ")", "dirs", "=", "appdirs", ".", "AppDirs", "(", "'hangups'", ",", "'hangups...
85c0bf0a57698d077461283895707260f9dbf931
valid
_async_main
Run the example coroutine.
examples/common.py
async def _async_main(example_coroutine, client, args): """Run the example coroutine.""" # Spawn a task for hangups to run in parallel with the example coroutine. task = asyncio.ensure_future(client.connect()) # Wait for hangups to either finish connecting or raise an exception. on_connect = asynci...
async def _async_main(example_coroutine, client, args): """Run the example coroutine.""" # Spawn a task for hangups to run in parallel with the example coroutine. task = asyncio.ensure_future(client.connect()) # Wait for hangups to either finish connecting or raise an exception. on_connect = asynci...
[ "Run", "the", "example", "coroutine", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/examples/common.py#L60-L81
[ "async", "def", "_async_main", "(", "example_coroutine", ",", "client", ",", "args", ")", ":", "# Spawn a task for hangups to run in parallel with the example coroutine.", "task", "=", "asyncio", ".", "ensure_future", "(", "client", ".", "connect", "(", ")", ")", "# W...
85c0bf0a57698d077461283895707260f9dbf931
valid
print_table
Print column headers and rows as a reStructuredText table. Args: col_tuple: Tuple of column name strings. row_tuples: List of tuples containing row data.
docs/generate_proto_docs.py
def print_table(col_tuple, row_tuples): """Print column headers and rows as a reStructuredText table. Args: col_tuple: Tuple of column name strings. row_tuples: List of tuples containing row data. """ col_widths = [max(len(str(row[col])) for row in [col_tuple] + row_tuples) ...
def print_table(col_tuple, row_tuples): """Print column headers and rows as a reStructuredText table. Args: col_tuple: Tuple of column name strings. row_tuples: List of tuples containing row data. """ col_widths = [max(len(str(row[col])) for row in [col_tuple] + row_tuples) ...
[ "Print", "column", "headers", "and", "rows", "as", "a", "reStructuredText", "table", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L21-L39
[ "def", "print_table", "(", "col_tuple", ",", "row_tuples", ")", ":", "col_widths", "=", "[", "max", "(", "len", "(", "str", "(", "row", "[", "col", "]", ")", ")", "for", "row", "in", "[", "col_tuple", "]", "+", "row_tuples", ")", "for", "col", "in"...
85c0bf0a57698d077461283895707260f9dbf931
valid
generate_enum_doc
Generate doc for an enum. Args: enum_descriptor: descriptor_pb2.EnumDescriptorProto instance for enum to generate docs for. locations: Dictionary of location paths tuples to descriptor_pb2.SourceCodeInfo.Location instances. path: Path tuple to the enum definition. ...
docs/generate_proto_docs.py
def generate_enum_doc(enum_descriptor, locations, path, name_prefix=''): """Generate doc for an enum. Args: enum_descriptor: descriptor_pb2.EnumDescriptorProto instance for enum to generate docs for. locations: Dictionary of location paths tuples to descriptor_pb2.Source...
def generate_enum_doc(enum_descriptor, locations, path, name_prefix=''): """Generate doc for an enum. Args: enum_descriptor: descriptor_pb2.EnumDescriptorProto instance for enum to generate docs for. locations: Dictionary of location paths tuples to descriptor_pb2.Source...
[ "Generate", "doc", "for", "an", "enum", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L105-L129
[ "def", "generate_enum_doc", "(", "enum_descriptor", ",", "locations", ",", "path", ",", "name_prefix", "=", "''", ")", ":", "print", "(", "make_subsection", "(", "name_prefix", "+", "enum_descriptor", ".", "name", ")", ")", "location", "=", "locations", "[", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
generate_message_doc
Generate docs for message and nested messages and enums. Args: message_descriptor: descriptor_pb2.DescriptorProto instance for message to generate docs for. locations: Dictionary of location paths tuples to descriptor_pb2.SourceCodeInfo.Location instances. path: Path...
docs/generate_proto_docs.py
def generate_message_doc(message_descriptor, locations, path, name_prefix=''): """Generate docs for message and nested messages and enums. Args: message_descriptor: descriptor_pb2.DescriptorProto instance for message to generate docs for. locations: Dictionary of location paths tupl...
def generate_message_doc(message_descriptor, locations, path, name_prefix=''): """Generate docs for message and nested messages and enums. Args: message_descriptor: descriptor_pb2.DescriptorProto instance for message to generate docs for. locations: Dictionary of location paths tupl...
[ "Generate", "docs", "for", "message", "and", "nested", "messages", "and", "enums", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L132-L177
[ "def", "generate_message_doc", "(", "message_descriptor", ",", "locations", ",", "path", ",", "name_prefix", "=", "''", ")", ":", "# message_type is 4", "prefixed_name", "=", "name_prefix", "+", "message_descriptor", ".", "name", "print", "(", "make_subsection", "("...
85c0bf0a57698d077461283895707260f9dbf931
valid
compile_protofile
Compile proto file to descriptor set. Args: proto_file_path: Path to proto file to compile. Returns: Path to file containing compiled descriptor set. Raises: SystemExit if the compilation fails.
docs/generate_proto_docs.py
def compile_protofile(proto_file_path): """Compile proto file to descriptor set. Args: proto_file_path: Path to proto file to compile. Returns: Path to file containing compiled descriptor set. Raises: SystemExit if the compilation fails. """ out_file = tempfile.mkstemp...
def compile_protofile(proto_file_path): """Compile proto file to descriptor set. Args: proto_file_path: Path to proto file to compile. Returns: Path to file containing compiled descriptor set. Raises: SystemExit if the compilation fails. """ out_file = tempfile.mkstemp...
[ "Compile", "proto", "file", "to", "descriptor", "set", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L180-L199
[ "def", "compile_protofile", "(", "proto_file_path", ")", ":", "out_file", "=", "tempfile", ".", "mkstemp", "(", ")", "[", "1", "]", "try", ":", "subprocess", ".", "check_output", "(", "[", "'protoc'", ",", "'--include_source_info'", ",", "'--descriptor_set_out'"...
85c0bf0a57698d077461283895707260f9dbf931
valid
main
Parse arguments and print generated documentation to stdout.
docs/generate_proto_docs.py
def main(): """Parse arguments and print generated documentation to stdout.""" parser = argparse.ArgumentParser() parser.add_argument('protofilepath') args = parser.parse_args() out_file = compile_protofile(args.protofilepath) with open(out_file, 'rb') as proto_file: # pylint: disable=n...
def main(): """Parse arguments and print generated documentation to stdout.""" parser = argparse.ArgumentParser() parser.add_argument('protofilepath') args = parser.parse_args() out_file = compile_protofile(args.protofilepath) with open(out_file, 'rb') as proto_file: # pylint: disable=n...
[ "Parse", "arguments", "and", "print", "generated", "documentation", "to", "stdout", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/docs/generate_proto_docs.py#L202-L229
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'protofilepath'", ")", "args", "=", "parser", ".", "parse_args", "(", ")", "out_file", "=", "compile_protofile", "(", "args", "."...
85c0bf0a57698d077461283895707260f9dbf931
valid
dir_maker
Create a directory if it does not exist.
hangups/ui/__main__.py
def dir_maker(path): """Create a directory if it does not exist.""" directory = os.path.dirname(path) if directory != '' and not os.path.isdir(directory): try: os.makedirs(directory) except OSError as e: sys.exit('Failed to create directory: {}'.format(e))
def dir_maker(path): """Create a directory if it does not exist.""" directory = os.path.dirname(path) if directory != '' and not os.path.isdir(directory): try: os.makedirs(directory) except OSError as e: sys.exit('Failed to create directory: {}'.format(e))
[ "Create", "a", "directory", "if", "it", "does", "not", "exist", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L1053-L1060
[ "def", "dir_maker", "(", "path", ")", ":", "directory", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", "if", "directory", "!=", "''", "and", "not", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "try", ":", "os", ".", "ma...
85c0bf0a57698d077461283895707260f9dbf931
valid
main
Main entry point.
hangups/ui/__main__.py
def main(): """Main entry point.""" # Build default paths for files. dirs = appdirs.AppDirs('hangups', 'hangups') default_log_path = os.path.join(dirs.user_log_dir, 'hangups.log') default_token_path = os.path.join(dirs.user_cache_dir, 'refresh_token.txt') default_config_path = 'hangups.conf' ...
def main(): """Main entry point.""" # Build default paths for files. dirs = appdirs.AppDirs('hangups', 'hangups') default_log_path = os.path.join(dirs.user_log_dir, 'hangups.log') default_token_path = os.path.join(dirs.user_cache_dir, 'refresh_token.txt') default_config_path = 'hangups.conf' ...
[ "Main", "entry", "point", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L1079-L1210
[ "def", "main", "(", ")", ":", "# Build default paths for files.", "dirs", "=", "appdirs", ".", "AppDirs", "(", "'hangups'", ",", "'hangups'", ")", "default_log_path", "=", "os", ".", "path", ".", "join", "(", "dirs", ".", "user_log_dir", ",", "'hangups.log'", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
ChatUI._exception_handler
Handle exceptions from the asyncio loop.
hangups/ui/__main__.py
def _exception_handler(self, _loop, context): """Handle exceptions from the asyncio loop.""" # Start a graceful shutdown. self._coroutine_queue.put(self._client.disconnect()) # Store the exception to be re-raised later. If the context doesn't # contain an exception, create one c...
def _exception_handler(self, _loop, context): """Handle exceptions from the asyncio loop.""" # Start a graceful shutdown. self._coroutine_queue.put(self._client.disconnect()) # Store the exception to be re-raised later. If the context doesn't # contain an exception, create one c...
[ "Handle", "exceptions", "from", "the", "asyncio", "loop", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L158-L166
[ "def", "_exception_handler", "(", "self", ",", "_loop", ",", "context", ")", ":", "# Start a graceful shutdown.", "self", ".", "_coroutine_queue", ".", "put", "(", "self", ".", "_client", ".", "disconnect", "(", ")", ")", "# Store the exception to be re-raised later...
85c0bf0a57698d077461283895707260f9dbf931
valid
ChatUI._input_filter
Handle global keybindings.
hangups/ui/__main__.py
def _input_filter(self, keys, _): """Handle global keybindings.""" if keys == [self._keys['menu']]: if self._urwid_loop.widget == self._tabbed_window: self._show_menu() else: self._hide_menu() elif keys == [self._keys['quit']]: ...
def _input_filter(self, keys, _): """Handle global keybindings.""" if keys == [self._keys['menu']]: if self._urwid_loop.widget == self._tabbed_window: self._show_menu() else: self._hide_menu() elif keys == [self._keys['quit']]: ...
[ "Handle", "global", "keybindings", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L168-L178
[ "def", "_input_filter", "(", "self", ",", "keys", ",", "_", ")", ":", "if", "keys", "==", "[", "self", ".", "_keys", "[", "'menu'", "]", "]", ":", "if", "self", ".", "_urwid_loop", ".", "widget", "==", "self", ".", "_tabbed_window", ":", "self", "....
85c0bf0a57698d077461283895707260f9dbf931
valid
ChatUI._show_menu
Show the overlay menu.
hangups/ui/__main__.py
def _show_menu(self): """Show the overlay menu.""" # If the current widget in the TabbedWindowWidget has a menu, # overlay it on the TabbedWindowWidget. current_widget = self._tabbed_window.get_current_widget() if hasattr(current_widget, 'get_menu_widget'): menu_widge...
def _show_menu(self): """Show the overlay menu.""" # If the current widget in the TabbedWindowWidget has a menu, # overlay it on the TabbedWindowWidget. current_widget = self._tabbed_window.get_current_widget() if hasattr(current_widget, 'get_menu_widget'): menu_widge...
[ "Show", "the", "overlay", "menu", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L180-L190
[ "def", "_show_menu", "(", "self", ")", ":", "# If the current widget in the TabbedWindowWidget has a menu,", "# overlay it on the TabbedWindowWidget.", "current_widget", "=", "self", ".", "_tabbed_window", ".", "get_current_widget", "(", ")", "if", "hasattr", "(", "current_wi...
85c0bf0a57698d077461283895707260f9dbf931
valid
ChatUI.get_conv_widget
Return an existing or new ConversationWidget.
hangups/ui/__main__.py
def get_conv_widget(self, conv_id): """Return an existing or new ConversationWidget.""" if conv_id not in self._conv_widgets: set_title_cb = (lambda widget, title: self._tabbed_window.set_tab(widget, title=title)) widget = ConversationWidget( ...
def get_conv_widget(self, conv_id): """Return an existing or new ConversationWidget.""" if conv_id not in self._conv_widgets: set_title_cb = (lambda widget, title: self._tabbed_window.set_tab(widget, title=title)) widget = ConversationWidget( ...
[ "Return", "an", "existing", "or", "new", "ConversationWidget", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L196-L207
[ "def", "get_conv_widget", "(", "self", ",", "conv_id", ")", ":", "if", "conv_id", "not", "in", "self", ".", "_conv_widgets", ":", "set_title_cb", "=", "(", "lambda", "widget", ",", "title", ":", "self", ".", "_tabbed_window", ".", "set_tab", "(", "widget",...
85c0bf0a57698d077461283895707260f9dbf931
valid
ChatUI.add_conversation_tab
Add conversation tab if not present, and optionally switch to it.
hangups/ui/__main__.py
def add_conversation_tab(self, conv_id, switch=False): """Add conversation tab if not present, and optionally switch to it.""" conv_widget = self.get_conv_widget(conv_id) self._tabbed_window.set_tab(conv_widget, switch=switch, title=conv_widget.title)
def add_conversation_tab(self, conv_id, switch=False): """Add conversation tab if not present, and optionally switch to it.""" conv_widget = self.get_conv_widget(conv_id) self._tabbed_window.set_tab(conv_widget, switch=switch, title=conv_widget.title)
[ "Add", "conversation", "tab", "if", "not", "present", "and", "optionally", "switch", "to", "it", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L209-L213
[ "def", "add_conversation_tab", "(", "self", ",", "conv_id", ",", "switch", "=", "False", ")", ":", "conv_widget", "=", "self", ".", "get_conv_widget", "(", "conv_id", ")", "self", ".", "_tabbed_window", ".", "set_tab", "(", "conv_widget", ",", "switch", "=",...
85c0bf0a57698d077461283895707260f9dbf931
valid
ChatUI._on_connect
Handle connecting for the first time.
hangups/ui/__main__.py
async def _on_connect(self): """Handle connecting for the first time.""" self._user_list, self._conv_list = ( await hangups.build_user_conversation_list(self._client) ) self._conv_list.on_event.add_observer(self._on_event) # show the conversation menu conv_pi...
async def _on_connect(self): """Handle connecting for the first time.""" self._user_list, self._conv_list = ( await hangups.build_user_conversation_list(self._client) ) self._conv_list.on_event.add_observer(self._on_event) # show the conversation menu conv_pi...
[ "Handle", "connecting", "for", "the", "first", "time", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L220-L234
[ "async", "def", "_on_connect", "(", "self", ")", ":", "self", ".", "_user_list", ",", "self", ".", "_conv_list", "=", "(", "await", "hangups", ".", "build_user_conversation_list", "(", "self", ".", "_client", ")", ")", "self", ".", "_conv_list", ".", "on_e...
85c0bf0a57698d077461283895707260f9dbf931
valid
ChatUI._on_event
Open conversation tab for new messages & pass events to notifier.
hangups/ui/__main__.py
def _on_event(self, conv_event): """Open conversation tab for new messages & pass events to notifier.""" conv = self._conv_list.get(conv_event.conversation_id) user = conv.get_user(conv_event.user_id) show_notification = all(( isinstance(conv_event, hangups.ChatMessageEvent),...
def _on_event(self, conv_event): """Open conversation tab for new messages & pass events to notifier.""" conv = self._conv_list.get(conv_event.conversation_id) user = conv.get_user(conv_event.user_id) show_notification = all(( isinstance(conv_event, hangups.ChatMessageEvent),...
[ "Open", "conversation", "tab", "for", "new", "messages", "&", "pass", "events", "to", "notifier", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L236-L253
[ "def", "_on_event", "(", "self", ",", "conv_event", ")", ":", "conv", "=", "self", ".", "_conv_list", ".", "get", "(", "conv_event", ".", "conversation_id", ")", "user", "=", "conv", ".", "get_user", "(", "conv_event", ".", "user_id", ")", "show_notificati...
85c0bf0a57698d077461283895707260f9dbf931
valid
CoroutineQueue.put
Put a coroutine in the queue to be executed.
hangups/ui/__main__.py
def put(self, coro): """Put a coroutine in the queue to be executed.""" # Avoid logging when a coroutine is queued or executed to avoid log # spam from coroutines that are started on every keypress. assert asyncio.iscoroutine(coro) self._queue.put_nowait(coro)
def put(self, coro): """Put a coroutine in the queue to be executed.""" # Avoid logging when a coroutine is queued or executed to avoid log # spam from coroutines that are started on every keypress. assert asyncio.iscoroutine(coro) self._queue.put_nowait(coro)
[ "Put", "a", "coroutine", "in", "the", "queue", "to", "be", "executed", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L275-L280
[ "def", "put", "(", "self", ",", "coro", ")", ":", "# Avoid logging when a coroutine is queued or executed to avoid log", "# spam from coroutines that are started on every keypress.", "assert", "asyncio", ".", "iscoroutine", "(", "coro", ")", "self", ".", "_queue", ".", "put...
85c0bf0a57698d077461283895707260f9dbf931
valid
CoroutineQueue.consume
Consume coroutines from the queue by executing them.
hangups/ui/__main__.py
async def consume(self): """Consume coroutines from the queue by executing them.""" while True: coro = await self._queue.get() assert asyncio.iscoroutine(coro) await coro
async def consume(self): """Consume coroutines from the queue by executing them.""" while True: coro = await self._queue.get() assert asyncio.iscoroutine(coro) await coro
[ "Consume", "coroutines", "from", "the", "queue", "by", "executing", "them", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L282-L287
[ "async", "def", "consume", "(", "self", ")", ":", "while", "True", ":", "coro", "=", "await", "self", ".", "_queue", ".", "get", "(", ")", "assert", "asyncio", ".", "iscoroutine", "(", "coro", ")", "await", "coro" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
RenameConversationDialog._rename
Rename conversation and call callback.
hangups/ui/__main__.py
def _rename(self, name, callback): """Rename conversation and call callback.""" self._coroutine_queue.put(self._conversation.rename(name)) callback()
def _rename(self, name, callback): """Rename conversation and call callback.""" self._coroutine_queue.put(self._conversation.rename(name)) callback()
[ "Rename", "conversation", "and", "call", "callback", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L337-L340
[ "def", "_rename", "(", "self", ",", "name", ",", "callback", ")", ":", "self", ".", "_coroutine_queue", ".", "put", "(", "self", ".", "_conversation", ".", "rename", "(", "name", ")", ")", "callback", "(", ")" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationListWalker._on_event
Re-order the conversations when an event occurs.
hangups/ui/__main__.py
def _on_event(self, _): """Re-order the conversations when an event occurs.""" # TODO: handle adding new conversations self.sort(key=lambda conv_button: conv_button.last_modified, reverse=True)
def _on_event(self, _): """Re-order the conversations when an event occurs.""" # TODO: handle adding new conversations self.sort(key=lambda conv_button: conv_button.last_modified, reverse=True)
[ "Re", "-", "order", "the", "conversations", "when", "an", "event", "occurs", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L419-L423
[ "def", "_on_event", "(", "self", ",", "_", ")", ":", "# TODO: handle adding new conversations", "self", ".", "sort", "(", "key", "=", "lambda", "conv_button", ":", "conv_button", ".", "last_modified", ",", "reverse", "=", "True", ")" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
StatusLineWidget.show_message
Show a temporary message.
hangups/ui/__main__.py
def show_message(self, message_str): """Show a temporary message.""" if self._message_handle is not None: self._message_handle.cancel() self._message_handle = asyncio.get_event_loop().call_later( self._MESSAGE_DELAY_SECS, self._clear_message ) self._messag...
def show_message(self, message_str): """Show a temporary message.""" if self._message_handle is not None: self._message_handle.cancel() self._message_handle = asyncio.get_event_loop().call_later( self._MESSAGE_DELAY_SECS, self._clear_message ) self._messag...
[ "Show", "a", "temporary", "message", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L506-L514
[ "def", "show_message", "(", "self", ",", "message_str", ")", ":", "if", "self", ".", "_message_handle", "is", "not", "None", ":", "self", ".", "_message_handle", ".", "cancel", "(", ")", "self", ".", "_message_handle", "=", "asyncio", ".", "get_event_loop", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
StatusLineWidget._on_event
Make users stop typing when they send a message.
hangups/ui/__main__.py
def _on_event(self, conv_event): """Make users stop typing when they send a message.""" if isinstance(conv_event, hangups.ChatMessageEvent): self._typing_statuses[conv_event.user_id] = ( hangups.TYPING_TYPE_STOPPED ) self._update()
def _on_event(self, conv_event): """Make users stop typing when they send a message.""" if isinstance(conv_event, hangups.ChatMessageEvent): self._typing_statuses[conv_event.user_id] = ( hangups.TYPING_TYPE_STOPPED ) self._update()
[ "Make", "users", "stop", "typing", "when", "they", "send", "a", "message", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L532-L538
[ "def", "_on_event", "(", "self", ",", "conv_event", ")", ":", "if", "isinstance", "(", "conv_event", ",", "hangups", ".", "ChatMessageEvent", ")", ":", "self", ".", "_typing_statuses", "[", "conv_event", ".", "user_id", "]", "=", "(", "hangups", ".", "TYPI...
85c0bf0a57698d077461283895707260f9dbf931
valid
StatusLineWidget._on_typing
Handle typing updates.
hangups/ui/__main__.py
def _on_typing(self, typing_message): """Handle typing updates.""" self._typing_statuses[typing_message.user_id] = typing_message.status self._update()
def _on_typing(self, typing_message): """Handle typing updates.""" self._typing_statuses[typing_message.user_id] = typing_message.status self._update()
[ "Handle", "typing", "updates", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L540-L543
[ "def", "_on_typing", "(", "self", ",", "typing_message", ")", ":", "self", ".", "_typing_statuses", "[", "typing_message", ".", "user_id", "]", "=", "typing_message", ".", "status", "self", ".", "_update", "(", ")" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
StatusLineWidget._update
Update status text.
hangups/ui/__main__.py
def _update(self): """Update status text.""" typing_users = [self._conversation.get_user(user_id) for user_id, status in self._typing_statuses.items() if status == hangups.TYPING_TYPE_STARTED] displayed_names = [user.first_name for user in typing_u...
def _update(self): """Update status text.""" typing_users = [self._conversation.get_user(user_id) for user_id, status in self._typing_statuses.items() if status == hangups.TYPING_TYPE_STARTED] displayed_names = [user.first_name for user in typing_u...
[ "Update", "status", "text", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L545-L565
[ "def", "_update", "(", "self", ")", ":", "typing_users", "=", "[", "self", ".", "_conversation", ".", "get_user", "(", "user_id", ")", "for", "user_id", ",", "status", "in", "self", ".", "_typing_statuses", ".", "items", "(", ")", "if", "status", "==", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
MessageWidget._get_date_str
Convert UTC datetime into user interface string.
hangups/ui/__main__.py
def _get_date_str(timestamp, datetimefmt, show_date=False): """Convert UTC datetime into user interface string.""" fmt = '' if show_date: fmt += '\n'+datetimefmt.get('date', '')+'\n' fmt += datetimefmt.get('time', '') return timestamp.astimezone(tz=None).strftime(fmt)
def _get_date_str(timestamp, datetimefmt, show_date=False): """Convert UTC datetime into user interface string.""" fmt = '' if show_date: fmt += '\n'+datetimefmt.get('date', '')+'\n' fmt += datetimefmt.get('time', '') return timestamp.astimezone(tz=None).strftime(fmt)
[ "Convert", "UTC", "datetime", "into", "user", "interface", "string", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L607-L613
[ "def", "_get_date_str", "(", "timestamp", ",", "datetimefmt", ",", "show_date", "=", "False", ")", ":", "fmt", "=", "''", "if", "show_date", ":", "fmt", "+=", "'\\n'", "+", "datetimefmt", ".", "get", "(", "'date'", ",", "''", ")", "+", "'\\n'", "fmt", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
MessageWidget.from_conversation_event
Return MessageWidget representing a ConversationEvent. Returns None if the ConversationEvent does not have a widget representation.
hangups/ui/__main__.py
def from_conversation_event(conversation, conv_event, prev_conv_event, datetimefmt, watermark_users=None): """Return MessageWidget representing a ConversationEvent. Returns None if the ConversationEvent does not have a widget representation. """ u...
def from_conversation_event(conversation, conv_event, prev_conv_event, datetimefmt, watermark_users=None): """Return MessageWidget representing a ConversationEvent. Returns None if the ConversationEvent does not have a widget representation. """ u...
[ "Return", "MessageWidget", "representing", "a", "ConversationEvent", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L619-L689
[ "def", "from_conversation_event", "(", "conversation", ",", "conv_event", ",", "prev_conv_event", ",", "datetimefmt", ",", "watermark_users", "=", "None", ")", ":", "user", "=", "conversation", ".", "get_user", "(", "conv_event", ".", "user_id", ")", "# Check whet...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationEventListWalker._handle_event
Handle updating and scrolling when a new event is added. Automatically scroll down to show the new text if the bottom is showing. This allows the user to scroll up to read previous messages while new messages are arriving.
hangups/ui/__main__.py
def _handle_event(self, conv_event): """Handle updating and scrolling when a new event is added. Automatically scroll down to show the new text if the bottom is showing. This allows the user to scroll up to read previous messages while new messages are arriving. """ if n...
def _handle_event(self, conv_event): """Handle updating and scrolling when a new event is added. Automatically scroll down to show the new text if the bottom is showing. This allows the user to scroll up to read previous messages while new messages are arriving. """ if n...
[ "Handle", "updating", "and", "scrolling", "when", "a", "new", "event", "is", "added", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L720-L730
[ "def", "_handle_event", "(", "self", ",", "conv_event", ")", ":", "if", "not", "self", ".", "_is_scrolling", ":", "self", ".", "set_focus", "(", "conv_event", ".", "id_", ")", "else", ":", "self", ".", "_modified", "(", ")" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationEventListWalker._load
Load more events for this conversation.
hangups/ui/__main__.py
async def _load(self): """Load more events for this conversation.""" try: conv_events = await self._conversation.get_events( self._conversation.events[0].id_ ) except (IndexError, hangups.NetworkError): conv_events = [] if not conv_even...
async def _load(self): """Load more events for this conversation.""" try: conv_events = await self._conversation.get_events( self._conversation.events[0].id_ ) except (IndexError, hangups.NetworkError): conv_events = [] if not conv_even...
[ "Load", "more", "events", "for", "this", "conversation", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L732-L753
[ "async", "def", "_load", "(", "self", ")", ":", "try", ":", "conv_events", "=", "await", "self", ".", "_conversation", ".", "get_events", "(", "self", ".", "_conversation", ".", "events", "[", "0", "]", ".", "id_", ")", "except", "(", "IndexError", ","...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationEventListWalker._get_position
Return the next/previous position or raise IndexError.
hangups/ui/__main__.py
def _get_position(self, position, prev=False): """Return the next/previous position or raise IndexError.""" if position == self.POSITION_LOADING: if prev: raise IndexError('Reached last position') else: return self._conversation.events[0].id_ ...
def _get_position(self, position, prev=False): """Return the next/previous position or raise IndexError.""" if position == self.POSITION_LOADING: if prev: raise IndexError('Reached last position') else: return self._conversation.events[0].id_ ...
[ "Return", "the", "next", "/", "previous", "position", "or", "raise", "IndexError", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L823-L838
[ "def", "_get_position", "(", "self", ",", "position", ",", "prev", "=", "False", ")", ":", "if", "position", "==", "self", ".", "POSITION_LOADING", ":", "if", "prev", ":", "raise", "IndexError", "(", "'Reached last position'", ")", "else", ":", "return", "...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationEventListWalker.set_focus
Set the focus to position or raise IndexError.
hangups/ui/__main__.py
def set_focus(self, position): """Set the focus to position or raise IndexError.""" self._focus_position = position self._modified() # If we set focus to anywhere but the last position, the user if # scrolling up: try: self.next_position(position) exce...
def set_focus(self, position): """Set the focus to position or raise IndexError.""" self._focus_position = position self._modified() # If we set focus to anywhere but the last position, the user if # scrolling up: try: self.next_position(position) exce...
[ "Set", "the", "focus", "to", "position", "or", "raise", "IndexError", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L848-L859
[ "def", "set_focus", "(", "self", ",", "position", ")", ":", "self", ".", "_focus_position", "=", "position", "self", ".", "_modified", "(", ")", "# If we set focus to anywhere but the last position, the user if", "# scrolling up:", "try", ":", "self", ".", "next_posit...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationWidget.get_menu_widget
Return the menu widget associated with this widget.
hangups/ui/__main__.py
def get_menu_widget(self, close_callback): """Return the menu widget associated with this widget.""" return ConversationMenu( self._coroutine_queue, self._conversation, close_callback, self._keys )
def get_menu_widget(self, close_callback): """Return the menu widget associated with this widget.""" return ConversationMenu( self._coroutine_queue, self._conversation, close_callback, self._keys )
[ "Return", "the", "menu", "widget", "associated", "with", "this", "widget", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L905-L910
[ "def", "get_menu_widget", "(", "self", ",", "close_callback", ")", ":", "return", "ConversationMenu", "(", "self", ".", "_coroutine_queue", ",", "self", ".", "_conversation", ",", "close_callback", ",", "self", ".", "_keys", ")" ]
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationWidget.keypress
Handle marking messages as read and keeping client active.
hangups/ui/__main__.py
def keypress(self, size, key): """Handle marking messages as read and keeping client active.""" # Set the client as active. self._coroutine_queue.put(self._client.set_active()) # Mark the newest event as read. self._coroutine_queue.put(self._conversation.update_read_timestamp())...
def keypress(self, size, key): """Handle marking messages as read and keeping client active.""" # Set the client as active. self._coroutine_queue.put(self._client.set_active()) # Mark the newest event as read. self._coroutine_queue.put(self._conversation.update_read_timestamp())...
[ "Handle", "marking", "messages", "as", "read", "and", "keeping", "client", "active", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L912-L920
[ "def", "keypress", "(", "self", ",", "size", ",", "key", ")", ":", "# Set the client as active.", "self", ".", "_coroutine_queue", ".", "put", "(", "self", ".", "_client", ".", "set_active", "(", ")", ")", "# Mark the newest event as read.", "self", ".", "_cor...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationWidget._set_title
Update this conversation's tab title.
hangups/ui/__main__.py
def _set_title(self): """Update this conversation's tab title.""" self.title = get_conv_name(self._conversation, show_unread=True, truncate=True) self._set_title_cb(self, self.title)
def _set_title(self): """Update this conversation's tab title.""" self.title = get_conv_name(self._conversation, show_unread=True, truncate=True) self._set_title_cb(self, self.title)
[ "Update", "this", "conversation", "s", "tab", "title", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L922-L926
[ "def", "_set_title", "(", "self", ")", ":", "self", ".", "title", "=", "get_conv_name", "(", "self", ".", "_conversation", ",", "show_unread", "=", "True", ",", "truncate", "=", "True", ")", "self", ".", "_set_title_cb", "(", "self", ",", "self", ".", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
ConversationWidget._on_return
Called when the user presses return on the send message widget.
hangups/ui/__main__.py
def _on_return(self, text): """Called when the user presses return on the send message widget.""" # Ignore if the user hasn't typed a message. if not text: return elif text.startswith('/image') and len(text.split(' ')) == 2: # Temporary UI for testing image upload...
def _on_return(self, text): """Called when the user presses return on the send message widget.""" # Ignore if the user hasn't typed a message. if not text: return elif text.startswith('/image') and len(text.split(' ')) == 2: # Temporary UI for testing image upload...
[ "Called", "when", "the", "user", "presses", "return", "on", "the", "send", "message", "widget", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L928-L948
[ "def", "_on_return", "(", "self", ",", "text", ")", ":", "# Ignore if the user hasn't typed a message.", "if", "not", "text", ":", "return", "elif", "text", ".", "startswith", "(", "'/image'", ")", "and", "len", "(", "text", ".", "split", "(", "' '", ")", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
TabbedWindowWidget._update_tabs
Update tab display.
hangups/ui/__main__.py
def _update_tabs(self): """Update tab display.""" text = [] for num, widget in enumerate(self._widgets): palette = ('active_tab' if num == self._tab_index else 'inactive_tab') text += [ (palette, ' {} '.format(self._widget_title[widg...
def _update_tabs(self): """Update tab display.""" text = [] for num, widget in enumerate(self._widgets): palette = ('active_tab' if num == self._tab_index else 'inactive_tab') text += [ (palette, ' {} '.format(self._widget_title[widg...
[ "Update", "tab", "display", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L988-L999
[ "def", "_update_tabs", "(", "self", ")", ":", "text", "=", "[", "]", "for", "num", ",", "widget", "in", "enumerate", "(", "self", ".", "_widgets", ")", ":", "palette", "=", "(", "'active_tab'", "if", "num", "==", "self", ".", "_tab_index", "else", "'...
85c0bf0a57698d077461283895707260f9dbf931
valid
TabbedWindowWidget.keypress
Handle keypresses for changing tabs.
hangups/ui/__main__.py
def keypress(self, size, key): """Handle keypresses for changing tabs.""" key = super().keypress(size, key) num_tabs = len(self._widgets) if key == self._keys['prev_tab']: self._tab_index = (self._tab_index - 1) % num_tabs self._update_tabs() elif key == s...
def keypress(self, size, key): """Handle keypresses for changing tabs.""" key = super().keypress(size, key) num_tabs = len(self._widgets) if key == self._keys['prev_tab']: self._tab_index = (self._tab_index - 1) % num_tabs self._update_tabs() elif key == s...
[ "Handle", "keypresses", "for", "changing", "tabs", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L1001-L1020
[ "def", "keypress", "(", "self", ",", "size", ",", "key", ")", ":", "key", "=", "super", "(", ")", ".", "keypress", "(", "size", ",", "key", ")", "num_tabs", "=", "len", "(", "self", ".", "_widgets", ")", "if", "key", "==", "self", ".", "_keys", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
TabbedWindowWidget.set_tab
Add or modify a tab. If widget is not a tab, it will be added. If switch is True, switch to this tab. If title is given, set the tab's title.
hangups/ui/__main__.py
def set_tab(self, widget, switch=False, title=None): """Add or modify a tab. If widget is not a tab, it will be added. If switch is True, switch to this tab. If title is given, set the tab's title. """ if widget not in self._widgets: self._widgets.append(widget) ...
def set_tab(self, widget, switch=False, title=None): """Add or modify a tab. If widget is not a tab, it will be added. If switch is True, switch to this tab. If title is given, set the tab's title. """ if widget not in self._widgets: self._widgets.append(widget) ...
[ "Add", "or", "modify", "a", "tab", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/__main__.py#L1022-L1035
[ "def", "set_tab", "(", "self", ",", "widget", ",", "switch", "=", "False", ",", "title", "=", "None", ")", ":", "if", "widget", "not", "in", "self", ".", "_widgets", ":", "self", ".", "_widgets", ".", "append", "(", "widget", ")", "self", ".", "_wi...
85c0bf0a57698d077461283895707260f9dbf931
valid
_replace_words
Replace words with corresponding values in replacements dict. Words must be separated by spaces or newlines.
hangups/ui/emoticon.py
def _replace_words(replacements, string): """Replace words with corresponding values in replacements dict. Words must be separated by spaces or newlines. """ output_lines = [] for line in string.split('\n'): output_words = [] for word in line.split(' '): new_word = repla...
def _replace_words(replacements, string): """Replace words with corresponding values in replacements dict. Words must be separated by spaces or newlines. """ output_lines = [] for line in string.split('\n'): output_words = [] for word in line.split(' '): new_word = repla...
[ "Replace", "words", "with", "corresponding", "values", "in", "replacements", "dict", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/ui/emoticon.py#L9-L21
[ "def", "_replace_words", "(", "replacements", ",", "string", ")", ":", "output_lines", "=", "[", "]", "for", "line", "in", "string", ".", "split", "(", "'\\n'", ")", ":", "output_words", "=", "[", "]", "for", "word", "in", "line", ".", "split", "(", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
get_auth
Authenticate with Google. Args: refresh_token_cache (RefreshTokenCache): Cache to use so subsequent logins may not require credentials. credentials_prompt (CredentialsPrompt): Prompt to use if credentials are required to log in. manual_login (bool): If true, prompt u...
hangups/auth.py
def get_auth(credentials_prompt, refresh_token_cache, manual_login=False): """Authenticate with Google. Args: refresh_token_cache (RefreshTokenCache): Cache to use so subsequent logins may not require credentials. credentials_prompt (CredentialsPrompt): Prompt to use if credentials ...
def get_auth(credentials_prompt, refresh_token_cache, manual_login=False): """Authenticate with Google. Args: refresh_token_cache (RefreshTokenCache): Cache to use so subsequent logins may not require credentials. credentials_prompt (CredentialsPrompt): Prompt to use if credentials ...
[ "Authenticate", "with", "Google", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L174-L217
[ "def", "get_auth", "(", "credentials_prompt", ",", "refresh_token_cache", ",", "manual_login", "=", "False", ")", ":", "with", "requests", ".", "Session", "(", ")", "as", "session", ":", "session", ".", "headers", "=", "{", "'user-agent'", ":", "USER_AGENT", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
get_auth_stdin
Simple wrapper for :func:`get_auth` that prompts the user using stdin. Args: refresh_token_filename (str): Path to file where refresh token will be cached. manual_login (bool): If true, prompt user to log in through a browser and enter authorization code manually. Defaults t...
hangups/auth.py
def get_auth_stdin(refresh_token_filename, manual_login=False): """Simple wrapper for :func:`get_auth` that prompts the user using stdin. Args: refresh_token_filename (str): Path to file where refresh token will be cached. manual_login (bool): If true, prompt user to log in through ...
def get_auth_stdin(refresh_token_filename, manual_login=False): """Simple wrapper for :func:`get_auth` that prompts the user using stdin. Args: refresh_token_filename (str): Path to file where refresh token will be cached. manual_login (bool): If true, prompt user to log in through ...
[ "Simple", "wrapper", "for", ":", "func", ":", "get_auth", "that", "prompts", "the", "user", "using", "stdin", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L220-L235
[ "def", "get_auth_stdin", "(", "refresh_token_filename", ",", "manual_login", "=", "False", ")", ":", "refresh_token_cache", "=", "RefreshTokenCache", "(", "refresh_token_filename", ")", "return", "get_auth", "(", "CredentialsPrompt", "(", ")", ",", "refresh_token_cache"...
85c0bf0a57698d077461283895707260f9dbf931
valid
_get_authorization_code
Get authorization code using Google account credentials. Because hangups can't use a real embedded browser, it has to use the Browser class to enter the user's credentials and retrieve the authorization code, which is placed in a cookie. This is the most fragile part of the authentication process, beca...
hangups/auth.py
def _get_authorization_code(session, credentials_prompt): """Get authorization code using Google account credentials. Because hangups can't use a real embedded browser, it has to use the Browser class to enter the user's credentials and retrieve the authorization code, which is placed in a cookie. This...
def _get_authorization_code(session, credentials_prompt): """Get authorization code using Google account credentials. Because hangups can't use a real embedded browser, it has to use the Browser class to enter the user's credentials and retrieve the authorization code, which is placed in a cookie. This...
[ "Get", "authorization", "code", "using", "Google", "account", "credentials", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L302-L343
[ "def", "_get_authorization_code", "(", "session", ",", "credentials_prompt", ")", ":", "browser", "=", "Browser", "(", "session", ",", "OAUTH2_LOGIN_URL", ")", "email", "=", "credentials_prompt", ".", "get_email", "(", ")", "browser", ".", "submit_form", "(", "F...
85c0bf0a57698d077461283895707260f9dbf931
valid
_auth_with_refresh_token
Authenticate using OAuth refresh token. Raises GoogleAuthError if authentication fails. Returns access token string.
hangups/auth.py
def _auth_with_refresh_token(session, refresh_token): """Authenticate using OAuth refresh token. Raises GoogleAuthError if authentication fails. Returns access token string. """ # Make a token request. token_request_data = { 'client_id': OAUTH2_CLIENT_ID, 'client_secret': OAUTH...
def _auth_with_refresh_token(session, refresh_token): """Authenticate using OAuth refresh token. Raises GoogleAuthError if authentication fails. Returns access token string. """ # Make a token request. token_request_data = { 'client_id': OAUTH2_CLIENT_ID, 'client_secret': OAUTH...
[ "Authenticate", "using", "OAuth", "refresh", "token", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L346-L361
[ "def", "_auth_with_refresh_token", "(", "session", ",", "refresh_token", ")", ":", "# Make a token request.", "token_request_data", "=", "{", "'client_id'", ":", "OAUTH2_CLIENT_ID", ",", "'client_secret'", ":", "OAUTH2_CLIENT_SECRET", ",", "'grant_type'", ":", "'refresh_t...
85c0bf0a57698d077461283895707260f9dbf931
valid
_auth_with_code
Authenticate using OAuth authorization code. Raises GoogleAuthError if authentication fails. Returns access token string and refresh token string.
hangups/auth.py
def _auth_with_code(session, authorization_code): """Authenticate using OAuth authorization code. Raises GoogleAuthError if authentication fails. Returns access token string and refresh token string. """ # Make a token request. token_request_data = { 'client_id': OAUTH2_CLIENT_ID, ...
def _auth_with_code(session, authorization_code): """Authenticate using OAuth authorization code. Raises GoogleAuthError if authentication fails. Returns access token string and refresh token string. """ # Make a token request. token_request_data = { 'client_id': OAUTH2_CLIENT_ID, ...
[ "Authenticate", "using", "OAuth", "authorization", "code", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L364-L380
[ "def", "_auth_with_code", "(", "session", ",", "authorization_code", ")", ":", "# Make a token request.", "token_request_data", "=", "{", "'client_id'", ":", "OAUTH2_CLIENT_ID", ",", "'client_secret'", ":", "OAUTH2_CLIENT_SECRET", ",", "'code'", ":", "authorization_code",...
85c0bf0a57698d077461283895707260f9dbf931
valid
_make_token_request
Make OAuth token request. Raises GoogleAuthError if authentication fails. Returns dict response.
hangups/auth.py
def _make_token_request(session, token_request_data): """Make OAuth token request. Raises GoogleAuthError if authentication fails. Returns dict response. """ try: r = session.post(OAUTH2_TOKEN_REQUEST_URL, data=token_request_data) r.raise_for_status() except requests.RequestExc...
def _make_token_request(session, token_request_data): """Make OAuth token request. Raises GoogleAuthError if authentication fails. Returns dict response. """ try: r = session.post(OAUTH2_TOKEN_REQUEST_URL, data=token_request_data) r.raise_for_status() except requests.RequestExc...
[ "Make", "OAuth", "token", "request", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L383-L402
[ "def", "_make_token_request", "(", "session", ",", "token_request_data", ")", ":", "try", ":", "r", "=", "session", ".", "post", "(", "OAUTH2_TOKEN_REQUEST_URL", ",", "data", "=", "token_request_data", ")", "r", ".", "raise_for_status", "(", ")", "except", "re...
85c0bf0a57698d077461283895707260f9dbf931
valid
_get_session_cookies
Use the access token to get session cookies. Raises GoogleAuthError if session cookies could not be loaded. Returns dict of cookies.
hangups/auth.py
def _get_session_cookies(session, access_token): """Use the access token to get session cookies. Raises GoogleAuthError if session cookies could not be loaded. Returns dict of cookies. """ headers = {'Authorization': 'Bearer {}'.format(access_token)} try: r = session.get(('https://acc...
def _get_session_cookies(session, access_token): """Use the access token to get session cookies. Raises GoogleAuthError if session cookies could not be loaded. Returns dict of cookies. """ headers = {'Authorization': 'Bearer {}'.format(access_token)} try: r = session.get(('https://acc...
[ "Use", "the", "access", "token", "to", "get", "session", "cookies", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L405-L434
[ "def", "_get_session_cookies", "(", "session", ",", "access_token", ")", ":", "headers", "=", "{", "'Authorization'", ":", "'Bearer {}'", ".", "format", "(", "access_token", ")", "}", "try", ":", "r", "=", "session", ".", "get", "(", "(", "'https://accounts....
85c0bf0a57698d077461283895707260f9dbf931
valid
RefreshTokenCache.get
Get cached refresh token. Returns: Cached refresh token, or ``None`` on failure.
hangups/auth.py
def get(self): """Get cached refresh token. Returns: Cached refresh token, or ``None`` on failure. """ logger.info( 'Loading refresh_token from %s', repr(self._filename) ) try: with open(self._filename) as f: return f.r...
def get(self): """Get cached refresh token. Returns: Cached refresh token, or ``None`` on failure. """ logger.info( 'Loading refresh_token from %s', repr(self._filename) ) try: with open(self._filename) as f: return f.r...
[ "Get", "cached", "refresh", "token", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L145-L158
[ "def", "get", "(", "self", ")", ":", "logger", ".", "info", "(", "'Loading refresh_token from %s'", ",", "repr", "(", "self", ".", "_filename", ")", ")", "try", ":", "with", "open", "(", "self", ".", "_filename", ")", "as", "f", ":", "return", "f", "...
85c0bf0a57698d077461283895707260f9dbf931
valid
RefreshTokenCache.set
Cache a refresh token, ignoring any failure. Args: refresh_token (str): Refresh token to cache.
hangups/auth.py
def set(self, refresh_token): """Cache a refresh token, ignoring any failure. Args: refresh_token (str): Refresh token to cache. """ logger.info('Saving refresh_token to %s', repr(self._filename)) try: with open(self._filename, 'w') as f: ...
def set(self, refresh_token): """Cache a refresh token, ignoring any failure. Args: refresh_token (str): Refresh token to cache. """ logger.info('Saving refresh_token to %s', repr(self._filename)) try: with open(self._filename, 'w') as f: ...
[ "Cache", "a", "refresh", "token", "ignoring", "any", "failure", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L160-L171
[ "def", "set", "(", "self", ",", "refresh_token", ")", ":", "logger", ".", "info", "(", "'Saving refresh_token to %s'", ",", "repr", "(", "self", ".", "_filename", ")", ")", "try", ":", "with", "open", "(", "self", ".", "_filename", ",", "'w'", ")", "as...
85c0bf0a57698d077461283895707260f9dbf931
valid
Browser.submit_form
Populate and submit a form on the current page. Raises GoogleAuthError if form can not be submitted.
hangups/auth.py
def submit_form(self, form_selector, input_dict): """Populate and submit a form on the current page. Raises GoogleAuthError if form can not be submitted. """ logger.info( 'Submitting form on page %r', self._page.url.split('?')[0] ) logger.info( 'P...
def submit_form(self, form_selector, input_dict): """Populate and submit a form on the current page. Raises GoogleAuthError if form can not be submitted. """ logger.info( 'Submitting form on page %r', self._page.url.split('?')[0] ) logger.info( 'P...
[ "Populate", "and", "submit", "a", "form", "on", "the", "current", "page", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/auth.py#L259-L292
[ "def", "submit_form", "(", "self", ",", "form_selector", ",", "input_dict", ")", ":", "logger", ".", "info", "(", "'Submitting form on page %r'", ",", "self", ".", "_page", ".", "url", ".", "split", "(", "'?'", ")", "[", "0", "]", ")", "logger", ".", "...
85c0bf0a57698d077461283895707260f9dbf931
valid
_parse_sid_response
Parse response format for request for new channel SID. Example format (after parsing JS): [ [0,["c","SID_HERE","",8]], [1,[{"gsid":"GSESSIONID_HERE"}]]] Returns (SID, gsessionid) tuple.
hangups/channel.py
def _parse_sid_response(res): """Parse response format for request for new channel SID. Example format (after parsing JS): [ [0,["c","SID_HERE","",8]], [1,[{"gsid":"GSESSIONID_HERE"}]]] Returns (SID, gsessionid) tuple. """ res = json.loads(list(ChunkParser().get_chunks(res))[0]) ...
def _parse_sid_response(res): """Parse response format for request for new channel SID. Example format (after parsing JS): [ [0,["c","SID_HERE","",8]], [1,[{"gsid":"GSESSIONID_HERE"}]]] Returns (SID, gsessionid) tuple. """ res = json.loads(list(ChunkParser().get_chunks(res))[0]) ...
[ "Parse", "response", "format", "for", "request", "for", "new", "channel", "SID", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L106-L118
[ "def", "_parse_sid_response", "(", "res", ")", ":", "res", "=", "json", ".", "loads", "(", "list", "(", "ChunkParser", "(", ")", ".", "get_chunks", "(", "res", ")", ")", "[", "0", "]", ")", "sid", "=", "res", "[", "0", "]", "[", "1", "]", "[", ...
85c0bf0a57698d077461283895707260f9dbf931
valid
ChunkParser.get_chunks
Yield chunks generated from received data. The buffer may not be decodable as UTF-8 if there's a split multi-byte character at the end. To handle this, do a "best effort" decode of the buffer to decode as much of it as possible. The length is actually the length of the string as report...
hangups/channel.py
def get_chunks(self, new_data_bytes): """Yield chunks generated from received data. The buffer may not be decodable as UTF-8 if there's a split multi-byte character at the end. To handle this, do a "best effort" decode of the buffer to decode as much of it as possible. The leng...
def get_chunks(self, new_data_bytes): """Yield chunks generated from received data. The buffer may not be decodable as UTF-8 if there's a split multi-byte character at the end. To handle this, do a "best effort" decode of the buffer to decode as much of it as possible. The leng...
[ "Yield", "chunks", "generated", "from", "received", "data", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L62-L103
[ "def", "get_chunks", "(", "self", ",", "new_data_bytes", ")", ":", "self", ".", "_buf", "+=", "new_data_bytes", "while", "True", ":", "buf_decoded", "=", "_best_effort_decode", "(", "self", ".", "_buf", ")", "buf_utf16", "=", "buf_decoded", ".", "encode", "(...
85c0bf0a57698d077461283895707260f9dbf931
valid
Channel.listen
Listen for messages on the backwards channel. This method only returns when the connection has been closed due to an error.
hangups/channel.py
async def listen(self): """Listen for messages on the backwards channel. This method only returns when the connection has been closed due to an error. """ retries = 0 # Number of retries attempted so far need_new_sid = True # whether a new SID is needed while ...
async def listen(self): """Listen for messages on the backwards channel. This method only returns when the connection has been closed due to an error. """ retries = 0 # Number of retries attempted so far need_new_sid = True # whether a new SID is needed while ...
[ "Listen", "for", "messages", "on", "the", "backwards", "channel", "." ]
tdryer/hangups
python
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/channel.py#L168-L215
[ "async", "def", "listen", "(", "self", ")", ":", "retries", "=", "0", "# Number of retries attempted so far", "need_new_sid", "=", "True", "# whether a new SID is needed", "while", "retries", "<=", "self", ".", "_max_retries", ":", "# After the first failed retry, back of...
85c0bf0a57698d077461283895707260f9dbf931