repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LonamiWebs/Telethon | telethon/client/users.py | UserMethods.get_me | async def get_me(self, input_peer=False):
"""
Gets "me" (the self user) which is currently authenticated,
or None if the request fails (hence, not authenticated).
Args:
input_peer (`bool`, optional):
Whether to return the :tl:`InputPeerUser` version or the no... | python | async def get_me(self, input_peer=False):
"""
Gets "me" (the self user) which is currently authenticated,
or None if the request fails (hence, not authenticated).
Args:
input_peer (`bool`, optional):
Whether to return the :tl:`InputPeerUser` version or the no... | [
"async",
"def",
"get_me",
"(",
"self",
",",
"input_peer",
"=",
"False",
")",
":",
"if",
"input_peer",
"and",
"self",
".",
"_self_input_peer",
":",
"return",
"self",
".",
"_self_input_peer",
"try",
":",
"me",
"=",
"(",
"await",
"self",
"(",
"functions",
"... | Gets "me" (the self user) which is currently authenticated,
or None if the request fails (hence, not authenticated).
Args:
input_peer (`bool`, optional):
Whether to return the :tl:`InputPeerUser` version or the normal
:tl:`User`. This can be useful if you jus... | [
"Gets",
"me",
"(",
"the",
"self",
"user",
")",
"which",
"is",
"currently",
"authenticated",
"or",
"None",
"if",
"the",
"request",
"fails",
"(",
"hence",
"not",
"authenticated",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L100-L129 | train | Gets the ID of the current user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods.is_bot | async def is_bot(self):
"""
Return ``True`` if the signed-in user is a bot, ``False`` otherwise.
"""
if self._bot is None:
self._bot = (await self.get_me()).bot
return self._bot | python | async def is_bot(self):
"""
Return ``True`` if the signed-in user is a bot, ``False`` otherwise.
"""
if self._bot is None:
self._bot = (await self.get_me()).bot
return self._bot | [
"async",
"def",
"is_bot",
"(",
"self",
")",
":",
"if",
"self",
".",
"_bot",
"is",
"None",
":",
"self",
".",
"_bot",
"=",
"(",
"await",
"self",
".",
"get_me",
"(",
")",
")",
".",
"bot",
"return",
"self",
".",
"_bot"
] | Return ``True`` if the signed-in user is a bot, ``False`` otherwise. | [
"Return",
"True",
"if",
"the",
"signed",
"-",
"in",
"user",
"is",
"a",
"bot",
"False",
"otherwise",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L131-L138 | train | Return True if the signed - in user is a bot False otherwise. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods.is_user_authorized | async def is_user_authorized(self):
"""
Returns ``True`` if the user is authorized.
"""
if self._authorized is None:
try:
# Any request that requires authorization will work
await self(functions.updates.GetStateRequest())
self._... | python | async def is_user_authorized(self):
"""
Returns ``True`` if the user is authorized.
"""
if self._authorized is None:
try:
# Any request that requires authorization will work
await self(functions.updates.GetStateRequest())
self._... | [
"async",
"def",
"is_user_authorized",
"(",
"self",
")",
":",
"if",
"self",
".",
"_authorized",
"is",
"None",
":",
"try",
":",
"# Any request that requires authorization will work",
"await",
"self",
"(",
"functions",
".",
"updates",
".",
"GetStateRequest",
"(",
")"... | Returns ``True`` if the user is authorized. | [
"Returns",
"True",
"if",
"the",
"user",
"is",
"authorized",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L140-L152 | train | Returns True if the user is authorized. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods.get_entity | async def get_entity(self, entity):
"""
Turns the given entity into a valid Telegram :tl:`User`, :tl:`Chat`
or :tl:`Channel`. You can also pass a list or iterable of entities,
and they will be efficiently fetched from the network.
entity (`str` | `int` | :tl:`Peer` | :tl:`InputP... | python | async def get_entity(self, entity):
"""
Turns the given entity into a valid Telegram :tl:`User`, :tl:`Chat`
or :tl:`Channel`. You can also pass a list or iterable of entities,
and they will be efficiently fetched from the network.
entity (`str` | `int` | :tl:`Peer` | :tl:`InputP... | [
"async",
"def",
"get_entity",
"(",
"self",
",",
"entity",
")",
":",
"single",
"=",
"not",
"utils",
".",
"is_list_like",
"(",
"entity",
")",
"if",
"single",
":",
"entity",
"=",
"(",
"entity",
",",
")",
"# Group input entities by string (resolve username),",
"# ... | Turns the given entity into a valid Telegram :tl:`User`, :tl:`Chat`
or :tl:`Channel`. You can also pass a list or iterable of entities,
and they will be efficiently fetched from the network.
entity (`str` | `int` | :tl:`Peer` | :tl:`InputPeer`):
If a username is given, **the usernam... | [
"Turns",
"the",
"given",
"entity",
"into",
"a",
"valid",
"Telegram",
":",
"tl",
":",
"User",
":",
"tl",
":",
"Chat",
"or",
":",
"tl",
":",
"Channel",
".",
"You",
"can",
"also",
"pass",
"a",
"list",
"or",
"iterable",
"of",
"entities",
"and",
"they",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L154-L244 | train | Get the most recent Telegram entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods.get_input_entity | async def get_input_entity(self, peer):
"""
Turns the given peer into its input entity version. Most requests
use this kind of :tl:`InputPeer`, so this is the most suitable call
to make for those cases. **Generally you should let the library do
its job** and don't worry about get... | python | async def get_input_entity(self, peer):
"""
Turns the given peer into its input entity version. Most requests
use this kind of :tl:`InputPeer`, so this is the most suitable call
to make for those cases. **Generally you should let the library do
its job** and don't worry about get... | [
"async",
"def",
"get_input_entity",
"(",
"self",
",",
"peer",
")",
":",
"# Short-circuit if the input parameter directly maps to an InputPeer",
"try",
":",
"return",
"utils",
".",
"get_input_peer",
"(",
"peer",
")",
"except",
"TypeError",
":",
"pass",
"# Next in priorit... | Turns the given peer into its input entity version. Most requests
use this kind of :tl:`InputPeer`, so this is the most suitable call
to make for those cases. **Generally you should let the library do
its job** and don't worry about getting the input entity first, but
if you're going to ... | [
"Turns",
"the",
"given",
"peer",
"into",
"its",
"input",
"entity",
"version",
".",
"Most",
"requests",
"use",
"this",
"kind",
"of",
":",
"tl",
":",
"InputPeer",
"so",
"this",
"is",
"the",
"most",
"suitable",
"call",
"to",
"make",
"for",
"those",
"cases",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L246-L367 | train | Get the input entity for a given peer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods.get_peer_id | async def get_peer_id(self, peer, add_mark=True):
"""
Gets the ID for the given peer, which may be anything entity-like.
This method needs to be ``async`` because `peer` supports usernames,
invite-links, phone numbers (from people in your contact list), etc.
If ``add_mark is Fa... | python | async def get_peer_id(self, peer, add_mark=True):
"""
Gets the ID for the given peer, which may be anything entity-like.
This method needs to be ``async`` because `peer` supports usernames,
invite-links, phone numbers (from people in your contact list), etc.
If ``add_mark is Fa... | [
"async",
"def",
"get_peer_id",
"(",
"self",
",",
"peer",
",",
"add_mark",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"peer",
",",
"int",
")",
":",
"return",
"utils",
".",
"get_peer_id",
"(",
"peer",
",",
"add_mark",
"=",
"add_mark",
")",
"try",
... | Gets the ID for the given peer, which may be anything entity-like.
This method needs to be ``async`` because `peer` supports usernames,
invite-links, phone numbers (from people in your contact list), etc.
If ``add_mark is False``, then a positive ID will be returned
instead. By default... | [
"Gets",
"the",
"ID",
"for",
"the",
"given",
"peer",
"which",
"may",
"be",
"anything",
"entity",
"-",
"like",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L369-L392 | train | Get the ID for the given peer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods._get_entity_from_string | async def _get_entity_from_string(self, string):
"""
Gets a full entity from the given string, which may be a phone or
a username, and processes all the found entities on the session.
The string may also be a user link, or a channel/chat invite link.
This method has the side eff... | python | async def _get_entity_from_string(self, string):
"""
Gets a full entity from the given string, which may be a phone or
a username, and processes all the found entities on the session.
The string may also be a user link, or a channel/chat invite link.
This method has the side eff... | [
"async",
"def",
"_get_entity_from_string",
"(",
"self",
",",
"string",
")",
":",
"phone",
"=",
"utils",
".",
"parse_phone",
"(",
"string",
")",
"if",
"phone",
":",
"try",
":",
"for",
"user",
"in",
"(",
"await",
"self",
"(",
"functions",
".",
"contacts",
... | Gets a full entity from the given string, which may be a phone or
a username, and processes all the found entities on the session.
The string may also be a user link, or a channel/chat invite link.
This method has the side effect of adding the found users to the
session database, so it ... | [
"Gets",
"a",
"full",
"entity",
"from",
"the",
"given",
"string",
"which",
"may",
"be",
"a",
"phone",
"or",
"a",
"username",
"and",
"processes",
"all",
"the",
"found",
"entities",
"on",
"the",
"session",
".",
"The",
"string",
"may",
"also",
"be",
"a",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L398-L460 | train | Gets a full entity from a given string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods._get_input_dialog | async def _get_input_dialog(self, dialog):
"""
Returns a :tl:`InputDialogPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if dialog.SUBCLASS_OF_ID == 0xa21c9795: # crc32(b'Input... | python | async def _get_input_dialog(self, dialog):
"""
Returns a :tl:`InputDialogPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if dialog.SUBCLASS_OF_ID == 0xa21c9795: # crc32(b'Input... | [
"async",
"def",
"_get_input_dialog",
"(",
"self",
",",
"dialog",
")",
":",
"try",
":",
"if",
"dialog",
".",
"SUBCLASS_OF_ID",
"==",
"0xa21c9795",
":",
"# crc32(b'InputDialogPeer')",
"dialog",
".",
"peer",
"=",
"await",
"self",
".",
"get_input_entity",
"(",
"di... | Returns a :tl:`InputDialogPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity. | [
"Returns",
"a",
":",
"tl",
":",
"InputDialogPeer",
".",
"This",
"is",
"a",
"bit",
"tricky",
"because",
"it",
"may",
"or",
"not",
"need",
"access",
"to",
"the",
"client",
"to",
"convert",
"what",
"s",
"given",
"into",
"an",
"input",
"entity",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L462-L477 | train | Returns a : tl. InputDialogPeer or types. InputDialogPeer depending on the dialog s SUBCLASS_OF_ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/users.py | UserMethods._get_input_notify | async def _get_input_notify(self, notify):
"""
Returns a :tl:`InputNotifyPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if notify.SUBCLASS_OF_ID == 0x58981615:
... | python | async def _get_input_notify(self, notify):
"""
Returns a :tl:`InputNotifyPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if notify.SUBCLASS_OF_ID == 0x58981615:
... | [
"async",
"def",
"_get_input_notify",
"(",
"self",
",",
"notify",
")",
":",
"try",
":",
"if",
"notify",
".",
"SUBCLASS_OF_ID",
"==",
"0x58981615",
":",
"if",
"isinstance",
"(",
"notify",
",",
"types",
".",
"InputNotifyPeer",
")",
":",
"notify",
".",
"peer",... | Returns a :tl:`InputNotifyPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity. | [
"Returns",
"a",
":",
"tl",
":",
"InputNotifyPeer",
".",
"This",
"is",
"a",
"bit",
"tricky",
"because",
"it",
"may",
"or",
"not",
"need",
"access",
"to",
"the",
"client",
"to",
"convert",
"what",
"s",
"given",
"into",
"an",
"input",
"entity",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L479-L491 | train | Returns a : tl : InputNotifyPeer or None if the given notify is not an input entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/draft.py | Draft.input_entity | def input_entity(self):
"""
Input version of the entity.
"""
if not self._input_entity:
try:
self._input_entity = self._client._entity_cache[self._peer]
except KeyError:
pass
return self._input_entity | python | def input_entity(self):
"""
Input version of the entity.
"""
if not self._input_entity:
try:
self._input_entity = self._client._entity_cache[self._peer]
except KeyError:
pass
return self._input_entity | [
"def",
"input_entity",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_input_entity",
":",
"try",
":",
"self",
".",
"_input_entity",
"=",
"self",
".",
"_client",
".",
"_entity_cache",
"[",
"self",
".",
"_peer",
"]",
"except",
"KeyError",
":",
"pass",
... | Input version of the entity. | [
"Input",
"version",
"of",
"the",
"entity",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L61-L71 | train | Returns the input version of the entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/draft.py | Draft.get_entity | async def get_entity(self):
"""
Returns `entity` but will make an API call if necessary.
"""
if not self.entity and await self.get_input_entity():
try:
self._entity =\
await self._client.get_entity(self._input_entity)
except Val... | python | async def get_entity(self):
"""
Returns `entity` but will make an API call if necessary.
"""
if not self.entity and await self.get_input_entity():
try:
self._entity =\
await self._client.get_entity(self._input_entity)
except Val... | [
"async",
"def",
"get_entity",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"entity",
"and",
"await",
"self",
".",
"get_input_entity",
"(",
")",
":",
"try",
":",
"self",
".",
"_entity",
"=",
"await",
"self",
".",
"_client",
".",
"get_entity",
"(",
... | Returns `entity` but will make an API call if necessary. | [
"Returns",
"entity",
"but",
"will",
"make",
"an",
"API",
"call",
"if",
"necessary",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L73-L84 | train | Returns the entity if it is not yet set. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/draft.py | Draft.set_message | async def set_message(
self, text=None, reply_to=0, parse_mode=(),
link_preview=None):
"""
Changes the draft message on the Telegram servers. The changes are
reflected in this object.
:param str text: New text of the draft.
Preserved if l... | python | async def set_message(
self, text=None, reply_to=0, parse_mode=(),
link_preview=None):
"""
Changes the draft message on the Telegram servers. The changes are
reflected in this object.
:param str text: New text of the draft.
Preserved if l... | [
"async",
"def",
"set_message",
"(",
"self",
",",
"text",
"=",
"None",
",",
"reply_to",
"=",
"0",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"None",
")",
":",
"if",
"text",
"is",
"None",
":",
"text",
"=",
"self",
".",
"_text",
"if",... | Changes the draft message on the Telegram servers. The changes are
reflected in this object.
:param str text: New text of the draft.
Preserved if left as None.
:param int reply_to: Message ID to reply to.
Preserved if left as 0, erased if s... | [
"Changes",
"the",
"draft",
"message",
"on",
"the",
"Telegram",
"servers",
".",
"The",
"changes",
"are",
"reflected",
"in",
"this",
"object",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L117-L163 | train | Changes the draft message on the Telegram servers. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/draft.py | Draft.send | async def send(self, clear=True, parse_mode=()):
"""
Sends the contents of this draft to the dialog. This is just a
wrapper around ``send_message(dialog.input_entity, *args, **kwargs)``.
"""
await self._client.send_message(
self._peer, self.text, reply_to=self.reply_t... | python | async def send(self, clear=True, parse_mode=()):
"""
Sends the contents of this draft to the dialog. This is just a
wrapper around ``send_message(dialog.input_entity, *args, **kwargs)``.
"""
await self._client.send_message(
self._peer, self.text, reply_to=self.reply_t... | [
"async",
"def",
"send",
"(",
"self",
",",
"clear",
"=",
"True",
",",
"parse_mode",
"=",
"(",
")",
")",
":",
"await",
"self",
".",
"_client",
".",
"send_message",
"(",
"self",
".",
"_peer",
",",
"self",
".",
"text",
",",
"reply_to",
"=",
"self",
"."... | Sends the contents of this draft to the dialog. This is just a
wrapper around ``send_message(dialog.input_entity, *args, **kwargs)``. | [
"Sends",
"the",
"contents",
"of",
"this",
"draft",
"to",
"the",
"dialog",
".",
"This",
"is",
"just",
"a",
"wrapper",
"around",
"send_message",
"(",
"dialog",
".",
"input_entity",
"*",
"args",
"**",
"kwargs",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L165-L174 | train | Sends the contents of this draft to the dialog. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods.download_profile_photo | async def download_profile_photo(
self, entity, file=None, *, download_big=True):
"""
Downloads the profile photo of the given entity (user/chat/channel).
Args:
entity (`entity`):
From who the photo will be downloaded.
.. note::
... | python | async def download_profile_photo(
self, entity, file=None, *, download_big=True):
"""
Downloads the profile photo of the given entity (user/chat/channel).
Args:
entity (`entity`):
From who the photo will be downloaded.
.. note::
... | [
"async",
"def",
"download_profile_photo",
"(",
"self",
",",
"entity",
",",
"file",
"=",
"None",
",",
"*",
",",
"download_big",
"=",
"True",
")",
":",
"# hex(crc32(x.encode('ascii'))) for x in",
"# ('User', 'Chat', 'UserFull', 'ChatFull')",
"ENTITIES",
"=",
"(",
"0x2da... | Downloads the profile photo of the given entity (user/chat/channel).
Args:
entity (`entity`):
From who the photo will be downloaded.
.. note::
This method expects the full entity (which has the data
to download the photo), no... | [
"Downloads",
"the",
"profile",
"photo",
"of",
"the",
"given",
"entity",
"(",
"user",
"/",
"chat",
"/",
"channel",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L20-L115 | train | Downloads the profile photo of the given entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods.download_media | async def download_media(self, message, file=None,
*, thumb=None, progress_callback=None):
"""
Downloads the given media, or the media from a specified Message.
Note that if the download is too slow, you should consider installing
``cryptg`` (through ``pip i... | python | async def download_media(self, message, file=None,
*, thumb=None, progress_callback=None):
"""
Downloads the given media, or the media from a specified Message.
Note that if the download is too slow, you should consider installing
``cryptg`` (through ``pip i... | [
"async",
"def",
"download_media",
"(",
"self",
",",
"message",
",",
"file",
"=",
"None",
",",
"*",
",",
"thumb",
"=",
"None",
",",
"progress_callback",
"=",
"None",
")",
":",
"# TODO This won't work for messageService",
"if",
"isinstance",
"(",
"message",
",",... | Downloads the given media, or the media from a specified Message.
Note that if the download is too slow, you should consider installing
``cryptg`` (through ``pip install cryptg``) so that decrypting the
received data is done in C instead of Python (much faster).
message (`Message <tele... | [
"Downloads",
"the",
"given",
"media",
"or",
"the",
"media",
"from",
"a",
"specified",
"Message",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L117-L190 | train | Downloads the given media or the media from a specified Message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods.download_file | async def download_file(
self, input_location, file=None, *, part_size_kb=None,
file_size=None, progress_callback=None, dc_id=None):
"""
Downloads the given input location to a file.
Args:
input_location (:tl:`InputFileLocation`):
The file loc... | python | async def download_file(
self, input_location, file=None, *, part_size_kb=None,
file_size=None, progress_callback=None, dc_id=None):
"""
Downloads the given input location to a file.
Args:
input_location (:tl:`InputFileLocation`):
The file loc... | [
"async",
"def",
"download_file",
"(",
"self",
",",
"input_location",
",",
"file",
"=",
"None",
",",
"*",
",",
"part_size_kb",
"=",
"None",
",",
"file_size",
"=",
"None",
",",
"progress_callback",
"=",
"None",
",",
"dc_id",
"=",
"None",
")",
":",
"if",
... | Downloads the given input location to a file.
Args:
input_location (:tl:`InputFileLocation`):
The file location from which the file will be downloaded.
See `telethon.utils.get_input_location` source for a complete
list of supported types.
... | [
"Downloads",
"the",
"given",
"input",
"location",
"to",
"a",
"file",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L192-L318 | train | Downloads the given input location to a file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods._download_photo | async def _download_photo(self, photo, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for photos"""
# Determine the photo and its largest size
if isinstance(photo, types.MessageMediaPhoto):
photo = photo.photo
if not isinstance(photo, types... | python | async def _download_photo(self, photo, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for photos"""
# Determine the photo and its largest size
if isinstance(photo, types.MessageMediaPhoto):
photo = photo.photo
if not isinstance(photo, types... | [
"async",
"def",
"_download_photo",
"(",
"self",
",",
"photo",
",",
"file",
",",
"date",
",",
"thumb",
",",
"progress_callback",
")",
":",
"# Determine the photo and its largest size",
"if",
"isinstance",
"(",
"photo",
",",
"types",
".",
"MessageMediaPhoto",
")",
... | Specialized version of .download_media() for photos | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"photos"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L355-L382 | train | Download a photo and return the file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods._get_kind_and_names | def _get_kind_and_names(attributes):
"""Gets kind and possible names for :tl:`DocumentAttribute`."""
kind = 'document'
possible_names = []
for attr in attributes:
if isinstance(attr, types.DocumentAttributeFilename):
possible_names.insert(0, attr.file_name)
... | python | def _get_kind_and_names(attributes):
"""Gets kind and possible names for :tl:`DocumentAttribute`."""
kind = 'document'
possible_names = []
for attr in attributes:
if isinstance(attr, types.DocumentAttributeFilename):
possible_names.insert(0, attr.file_name)
... | [
"def",
"_get_kind_and_names",
"(",
"attributes",
")",
":",
"kind",
"=",
"'document'",
"possible_names",
"=",
"[",
"]",
"for",
"attr",
"in",
"attributes",
":",
"if",
"isinstance",
"(",
"attr",
",",
"types",
".",
"DocumentAttributeFilename",
")",
":",
"possible_... | Gets kind and possible names for :tl:`DocumentAttribute`. | [
"Gets",
"kind",
"and",
"possible",
"names",
"for",
":",
"tl",
":",
"DocumentAttribute",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L385-L406 | train | Gets kind and possible names for a given set of attributes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods._download_document | async def _download_document(
self, document, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for documents."""
if isinstance(document, types.MessageMediaDocument):
document = document.document
if not isinstance(document, types.Document)... | python | async def _download_document(
self, document, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for documents."""
if isinstance(document, types.MessageMediaDocument):
document = document.document
if not isinstance(document, types.Document)... | [
"async",
"def",
"_download_document",
"(",
"self",
",",
"document",
",",
"file",
",",
"date",
",",
"thumb",
",",
"progress_callback",
")",
":",
"if",
"isinstance",
"(",
"document",
",",
"types",
".",
"MessageMediaDocument",
")",
":",
"document",
"=",
"docume... | Specialized version of .download_media() for documents. | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"documents",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L408-L441 | train | Specialized version of. download_media() for documents. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods._download_contact | def _download_contact(cls, mm_contact, file):
"""
Specialized version of .download_media() for contacts.
Will make use of the vCard 4.0 format.
"""
first_name = mm_contact.first_name
last_name = mm_contact.last_name
phone_number = mm_contact.phone_number
... | python | def _download_contact(cls, mm_contact, file):
"""
Specialized version of .download_media() for contacts.
Will make use of the vCard 4.0 format.
"""
first_name = mm_contact.first_name
last_name = mm_contact.last_name
phone_number = mm_contact.phone_number
... | [
"def",
"_download_contact",
"(",
"cls",
",",
"mm_contact",
",",
"file",
")",
":",
"first_name",
"=",
"mm_contact",
".",
"first_name",
"last_name",
"=",
"mm_contact",
".",
"last_name",
"phone_number",
"=",
"mm_contact",
".",
"phone_number",
"# Remove these pesky char... | Specialized version of .download_media() for contacts.
Will make use of the vCard 4.0 format. | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"contacts",
".",
"Will",
"make",
"use",
"of",
"the",
"vCard",
"4",
".",
"0",
"format",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L444-L483 | train | Download the vCard contact from the specified file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods._download_web_document | async def _download_web_document(cls, web, file, progress_callback):
"""
Specialized version of .download_media() for web documents.
"""
if not aiohttp:
raise ValueError(
'Cannot download web documents without the aiohttp '
'dependency install ... | python | async def _download_web_document(cls, web, file, progress_callback):
"""
Specialized version of .download_media() for web documents.
"""
if not aiohttp:
raise ValueError(
'Cannot download web documents without the aiohttp '
'dependency install ... | [
"async",
"def",
"_download_web_document",
"(",
"cls",
",",
"web",
",",
"file",
",",
"progress_callback",
")",
":",
"if",
"not",
"aiohttp",
":",
"raise",
"ValueError",
"(",
"'Cannot download web documents without the aiohttp '",
"'dependency install it (pip install aiohttp)'... | Specialized version of .download_media() for web documents. | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"web",
"documents",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L486-L524 | train | Download a web document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/downloads.py | DownloadMethods._get_proper_filename | def _get_proper_filename(file, kind, extension,
date=None, possible_names=None):
"""Gets a proper filename for 'file', if this is a path.
'kind' should be the kind of the output file (photo, document...)
'extension' should be the extension to be added to the f... | python | def _get_proper_filename(file, kind, extension,
date=None, possible_names=None):
"""Gets a proper filename for 'file', if this is a path.
'kind' should be the kind of the output file (photo, document...)
'extension' should be the extension to be added to the f... | [
"def",
"_get_proper_filename",
"(",
"file",
",",
"kind",
",",
"extension",
",",
"date",
"=",
"None",
",",
"possible_names",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"file",
",",
"pathlib",
".",
"Path",
")",
":",
"file",
"=",
"str",
"(",
"file",
... | Gets a proper filename for 'file', if this is a path.
'kind' should be the kind of the output file (photo, document...)
'extension' should be the extension to be added to the file if
the filename doesn't have any yet
'date' should be when this file was originally... | [
"Gets",
"a",
"proper",
"filename",
"for",
"file",
"if",
"this",
"is",
"a",
"path",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L527-L587 | train | Gets a proper filename for file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | _MessagesIter._message_in_range | def _message_in_range(self, message):
"""
Determine whether the given message is in the range or
it should be ignored (and avoid loading more chunks).
"""
# No entity means message IDs between chats may vary
if self.entity:
if self.reverse:
if ... | python | def _message_in_range(self, message):
"""
Determine whether the given message is in the range or
it should be ignored (and avoid loading more chunks).
"""
# No entity means message IDs between chats may vary
if self.entity:
if self.reverse:
if ... | [
"def",
"_message_in_range",
"(",
"self",
",",
"message",
")",
":",
"# No entity means message IDs between chats may vary",
"if",
"self",
".",
"entity",
":",
"if",
"self",
".",
"reverse",
":",
"if",
"message",
".",
"id",
"<=",
"self",
".",
"last_id",
"or",
"mes... | Determine whether the given message is in the range or
it should be ignored (and avoid loading more chunks). | [
"Determine",
"whether",
"the",
"given",
"message",
"is",
"in",
"the",
"range",
"or",
"it",
"should",
"be",
"ignored",
"(",
"and",
"avoid",
"loading",
"more",
"chunks",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L193-L207 | train | Determine whether the given message is in the range or not. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | _MessagesIter._update_offset | def _update_offset(self, last_message):
"""
After making the request, update its offset with the last message.
"""
self.request.offset_id = last_message.id
if self.reverse:
# We want to skip the one we already have
self.request.offset_id += 1
if i... | python | def _update_offset(self, last_message):
"""
After making the request, update its offset with the last message.
"""
self.request.offset_id = last_message.id
if self.reverse:
# We want to skip the one we already have
self.request.offset_id += 1
if i... | [
"def",
"_update_offset",
"(",
"self",
",",
"last_message",
")",
":",
"self",
".",
"request",
".",
"offset_id",
"=",
"last_message",
".",
"id",
"if",
"self",
".",
"reverse",
":",
"# We want to skip the one we already have",
"self",
".",
"request",
".",
"offset_id... | After making the request, update its offset with the last message. | [
"After",
"making",
"the",
"request",
"update",
"its",
"offset",
"with",
"the",
"last",
"message",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L209-L229 | train | Update the offset of the request based on the last message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | MessageMethods.iter_messages | def iter_messages(
self, entity, limit=None, *, offset_date=None, offset_id=0,
max_id=0, min_id=0, add_offset=0, search=None, filter=None,
from_user=None, wait_time=None, ids=None, reverse=False
):
"""
Iterator over the message history for the specified entity.
... | python | def iter_messages(
self, entity, limit=None, *, offset_date=None, offset_id=0,
max_id=0, min_id=0, add_offset=0, search=None, filter=None,
from_user=None, wait_time=None, ids=None, reverse=False
):
"""
Iterator over the message history for the specified entity.
... | [
"def",
"iter_messages",
"(",
"self",
",",
"entity",
",",
"limit",
"=",
"None",
",",
"*",
",",
"offset_date",
"=",
"None",
",",
"offset_id",
"=",
"0",
",",
"max_id",
"=",
"0",
",",
"min_id",
"=",
"0",
",",
"add_offset",
"=",
"0",
",",
"search",
"=",... | Iterator over the message history for the specified entity.
If either `search`, `filter` or `from_user` are provided,
:tl:`messages.Search` will be used instead of :tl:`messages.getHistory`.
Args:
entity (`entity`):
The entity from whom to retrieve the message histor... | [
"Iterator",
"over",
"the",
"message",
"history",
"for",
"the",
"specified",
"entity",
".",
"If",
"either",
"search",
"filter",
"or",
"from_user",
"are",
"provided",
":",
"tl",
":",
"messages",
".",
"Search",
"will",
"be",
"used",
"instead",
"of",
":",
"tl"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L295-L418 | train | This function returns an iterator over the message history for the specified entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | MessageMethods.get_messages | async def get_messages(self, *args, **kwargs):
"""
Same as `iter_messages`, but returns a
`TotalList <telethon.helpers.TotalList>` instead.
If the `limit` is not set, it will be 1 by default unless both
`min_id` **and** `max_id` are set (as *named* arguments), in
which c... | python | async def get_messages(self, *args, **kwargs):
"""
Same as `iter_messages`, but returns a
`TotalList <telethon.helpers.TotalList>` instead.
If the `limit` is not set, it will be 1 by default unless both
`min_id` **and** `max_id` are set (as *named* arguments), in
which c... | [
"async",
"def",
"get_messages",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"'limit'",
"not",
"in",
"kwargs",
":",
"if",
"'min_id'",
"in",
"kwargs",
"and",
"'max_id'",
"in",
"kw... | Same as `iter_messages`, but returns a
`TotalList <telethon.helpers.TotalList>` instead.
If the `limit` is not set, it will be 1 by default unless both
`min_id` **and** `max_id` are set (as *named* arguments), in
which case the entire range will be returned.
This is so because ... | [
"Same",
"as",
"iter_messages",
"but",
"returns",
"a",
"TotalList",
"<telethon",
".",
"helpers",
".",
"TotalList",
">",
"instead",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L420-L453 | train | Same as iter_messages but returns a list of messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | MessageMethods.send_message | async def send_message(
self, entity, message='', *, reply_to=None,
parse_mode=(), link_preview=True, file=None,
force_document=False, clear_draft=False, buttons=None,
silent=None):
"""
Sends the given message to the specified entity (user/chat/channel).
... | python | async def send_message(
self, entity, message='', *, reply_to=None,
parse_mode=(), link_preview=True, file=None,
force_document=False, clear_draft=False, buttons=None,
silent=None):
"""
Sends the given message to the specified entity (user/chat/channel).
... | [
"async",
"def",
"send_message",
"(",
"self",
",",
"entity",
",",
"message",
"=",
"''",
",",
"*",
",",
"reply_to",
"=",
"None",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"True",
",",
"file",
"=",
"None",
",",
"force_document",
"=",
"... | Sends the given message to the specified entity (user/chat/channel).
The default parse mode is the same as the official applications
(a custom flavour of markdown). ``**bold**, `code` or __italic__``
are available. In addition you can send ``[links](https://example.com)``
and ``[mention... | [
"Sends",
"the",
"given",
"message",
"to",
"the",
"specified",
"entity",
"(",
"user",
"/",
"chat",
"/",
"channel",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L459-L610 | train | Send a message to the specified entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | MessageMethods.forward_messages | async def forward_messages(self, entity, messages, from_peer=None,
*, silent=None, as_album=None):
"""
Forwards the given message(s) to the specified entity.
Args:
entity (`entity`):
To which entity the message(s) will be forwarded.
... | python | async def forward_messages(self, entity, messages, from_peer=None,
*, silent=None, as_album=None):
"""
Forwards the given message(s) to the specified entity.
Args:
entity (`entity`):
To which entity the message(s) will be forwarded.
... | [
"async",
"def",
"forward_messages",
"(",
"self",
",",
"entity",
",",
"messages",
",",
"from_peer",
"=",
"None",
",",
"*",
",",
"silent",
"=",
"None",
",",
"as_album",
"=",
"None",
")",
":",
"single",
"=",
"not",
"utils",
".",
"is_list_like",
"(",
"mess... | Forwards the given message(s) to the specified entity.
Args:
entity (`entity`):
To which entity the message(s) will be forwarded.
messages (`list` | `int` | `Message <telethon.tl.custom.message.Message>`):
The message(s) to forward, or their integer IDs.... | [
"Forwards",
"the",
"given",
"message",
"(",
"s",
")",
"to",
"the",
"specified",
"entity",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L612-L719 | train | Forwards the given list of messages to the specified entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | MessageMethods.edit_message | async def edit_message(
self, entity, message=None, text=None,
*, parse_mode=(), link_preview=True, file=None,
buttons=None):
"""
Edits the given message ID (to change its contents or disable preview).
Args:
entity (`entity` | `Message <telethon.t... | python | async def edit_message(
self, entity, message=None, text=None,
*, parse_mode=(), link_preview=True, file=None,
buttons=None):
"""
Edits the given message ID (to change its contents or disable preview).
Args:
entity (`entity` | `Message <telethon.t... | [
"async",
"def",
"edit_message",
"(",
"self",
",",
"entity",
",",
"message",
"=",
"None",
",",
"text",
"=",
"None",
",",
"*",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"True",
",",
"file",
"=",
"None",
",",
"buttons",
"=",
"None",
... | Edits the given message ID (to change its contents or disable preview).
Args:
entity (`entity` | `Message <telethon.tl.custom.message.Message>`):
From which chat to edit the message. This can also be
the message to be edited, and the entity will be inferred
... | [
"Edits",
"the",
"given",
"message",
"ID",
"(",
"to",
"change",
"its",
"contents",
"or",
"disable",
"preview",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L721-L825 | train | Edits the given message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | MessageMethods.delete_messages | async def delete_messages(self, entity, message_ids, *, revoke=True):
"""
Deletes a message from a chat, optionally "for everyone".
Args:
entity (`entity`):
From who the message will be deleted. This can actually
be ``None`` for normal chats, but **mu... | python | async def delete_messages(self, entity, message_ids, *, revoke=True):
"""
Deletes a message from a chat, optionally "for everyone".
Args:
entity (`entity`):
From who the message will be deleted. This can actually
be ``None`` for normal chats, but **mu... | [
"async",
"def",
"delete_messages",
"(",
"self",
",",
"entity",
",",
"message_ids",
",",
"*",
",",
"revoke",
"=",
"True",
")",
":",
"if",
"not",
"utils",
".",
"is_list_like",
"(",
"message_ids",
")",
":",
"message_ids",
"=",
"(",
"message_ids",
",",
")",
... | Deletes a message from a chat, optionally "for everyone".
Args:
entity (`entity`):
From who the message will be deleted. This can actually
be ``None`` for normal chats, but **must** be present
for channels and megagroups.
message_ids (`li... | [
"Deletes",
"a",
"message",
"from",
"a",
"chat",
"optionally",
"for",
"everyone",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L827-L873 | train | Deletes a message from a chat optionally for everyone. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/messages.py | MessageMethods.send_read_acknowledge | async def send_read_acknowledge(
self, entity, message=None, *, max_id=None, clear_mentions=False):
"""
Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check").
This effectively marks a message as read (or ... | python | async def send_read_acknowledge(
self, entity, message=None, *, max_id=None, clear_mentions=False):
"""
Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check").
This effectively marks a message as read (or ... | [
"async",
"def",
"send_read_acknowledge",
"(",
"self",
",",
"entity",
",",
"message",
"=",
"None",
",",
"*",
",",
"max_id",
"=",
"None",
",",
"clear_mentions",
"=",
"False",
")",
":",
"if",
"max_id",
"is",
"None",
":",
"if",
"not",
"message",
":",
"max_... | Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check").
This effectively marks a message as read (or more than one) in the
given conversation.
If neither message nor maximum ID are provided, all messages will be
... | [
"Sends",
"a",
"read",
"acknowledge",
"(",
"i",
".",
"e",
".",
"notifying",
"the",
"given",
"peer",
"that",
"we",
"ve",
"read",
"their",
"messages",
"also",
"known",
"as",
"the",
"double",
"check",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L879-L932 | train | Sends a read acknowledge to the given entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/uploads.py | UploadMethods.send_file | async def send_file(
self, entity, file, *, caption=None, force_document=False,
progress_callback=None, reply_to=None, attributes=None,
thumb=None, allow_cache=True, parse_mode=(),
voice_note=False, video_note=False, buttons=None, silent=None,
supports_streami... | python | async def send_file(
self, entity, file, *, caption=None, force_document=False,
progress_callback=None, reply_to=None, attributes=None,
thumb=None, allow_cache=True, parse_mode=(),
voice_note=False, video_note=False, buttons=None, silent=None,
supports_streami... | [
"async",
"def",
"send_file",
"(",
"self",
",",
"entity",
",",
"file",
",",
"*",
",",
"caption",
"=",
"None",
",",
"force_document",
"=",
"False",
",",
"progress_callback",
"=",
"None",
",",
"reply_to",
"=",
"None",
",",
"attributes",
"=",
"None",
",",
... | Sends a file to the specified entity.
Args:
entity (`entity`):
Who will receive the file.
file (`str` | `bytes` | `file` | `media`):
The file to send, which can be one of:
* A local file path to an in-disk file. The file name
... | [
"Sends",
"a",
"file",
"to",
"the",
"specified",
"entity",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/uploads.py#L85-L293 | train | Sends a file to the specified entity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/uploads.py | UploadMethods._send_album | async def _send_album(self, entity, files, caption='',
progress_callback=None, reply_to=None,
parse_mode=(), silent=None):
"""Specialized version of .send_file for albums"""
# We don't care if the user wants to avoid cache, we will use it
# any... | python | async def _send_album(self, entity, files, caption='',
progress_callback=None, reply_to=None,
parse_mode=(), silent=None):
"""Specialized version of .send_file for albums"""
# We don't care if the user wants to avoid cache, we will use it
# any... | [
"async",
"def",
"_send_album",
"(",
"self",
",",
"entity",
",",
"files",
",",
"caption",
"=",
"''",
",",
"progress_callback",
"=",
"None",
",",
"reply_to",
"=",
"None",
",",
"parse_mode",
"=",
"(",
")",
",",
"silent",
"=",
"None",
")",
":",
"# We don't... | Specialized version of .send_file for albums | [
"Specialized",
"version",
"of",
".",
"send_file",
"for",
"albums"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/uploads.py#L295-L360 | train | Send albums. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/uploads.py | UploadMethods.upload_file | async def upload_file(
self, file, *, part_size_kb=None, file_name=None, use_cache=None,
progress_callback=None):
"""
Uploads the specified file and returns a handle (an instance of
:tl:`InputFile` or :tl:`InputFileBig`, as required) which can be
later used before... | python | async def upload_file(
self, file, *, part_size_kb=None, file_name=None, use_cache=None,
progress_callback=None):
"""
Uploads the specified file and returns a handle (an instance of
:tl:`InputFile` or :tl:`InputFileBig`, as required) which can be
later used before... | [
"async",
"def",
"upload_file",
"(",
"self",
",",
"file",
",",
"*",
",",
"part_size_kb",
"=",
"None",
",",
"file_name",
"=",
"None",
",",
"use_cache",
"=",
"None",
",",
"progress_callback",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"file",
",",
"(... | Uploads the specified file and returns a handle (an instance of
:tl:`InputFile` or :tl:`InputFileBig`, as required) which can be
later used before it expires (they are usable during less than a day).
Uploading a file will simply return a "handle" to the file stored
remotely in the Teleg... | [
"Uploads",
"the",
"specified",
"file",
"and",
"returns",
"a",
"handle",
"(",
"an",
"instance",
"of",
":",
"tl",
":",
"InputFile",
"or",
":",
"tl",
":",
"InputFileBig",
"as",
"required",
")",
"which",
"can",
"be",
"later",
"used",
"before",
"it",
"expires... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/uploads.py#L362-L510 | train | Uploads a file to the specified TeleBot server and returns a handle to the file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/entitycache.py | EntityCache.add | def add(self, entities):
"""
Adds the given entities to the cache, if they weren't saved before.
"""
if not utils.is_list_like(entities):
# Invariant: all "chats" and "users" are always iterables,
# and "user" never is (so we wrap it inside a list).
en... | python | def add(self, entities):
"""
Adds the given entities to the cache, if they weren't saved before.
"""
if not utils.is_list_like(entities):
# Invariant: all "chats" and "users" are always iterables,
# and "user" never is (so we wrap it inside a list).
en... | [
"def",
"add",
"(",
"self",
",",
"entities",
")",
":",
"if",
"not",
"utils",
".",
"is_list_like",
"(",
"entities",
")",
":",
"# Invariant: all \"chats\" and \"users\" are always iterables,",
"# and \"user\" never is (so we wrap it inside a list).",
"entities",
"=",
"itertool... | Adds the given entities to the cache, if they weren't saved before. | [
"Adds",
"the",
"given",
"entities",
"to",
"the",
"cache",
"if",
"they",
"weren",
"t",
"saved",
"before",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/entitycache.py#L10-L30 | train | Adds the given entities to the cache if they weren t saved before. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/updates.py | UpdateMethods.run_until_disconnected | def run_until_disconnected(self):
"""
Runs the event loop until `disconnect` is called or if an error
while connecting/sending/receiving occurs in the background. In
the latter case, said error will ``raise`` so you have a chance
to ``except`` it on your own code.
If the... | python | def run_until_disconnected(self):
"""
Runs the event loop until `disconnect` is called or if an error
while connecting/sending/receiving occurs in the background. In
the latter case, said error will ``raise`` so you have a chance
to ``except`` it on your own code.
If the... | [
"def",
"run_until_disconnected",
"(",
"self",
")",
":",
"if",
"self",
".",
"loop",
".",
"is_running",
"(",
")",
":",
"return",
"self",
".",
"_run_until_disconnected",
"(",
")",
"try",
":",
"return",
"self",
".",
"loop",
".",
"run_until_complete",
"(",
"sel... | Runs the event loop until `disconnect` is called or if an error
while connecting/sending/receiving occurs in the background. In
the latter case, said error will ``raise`` so you have a chance
to ``except`` it on your own code.
If the loop is already running, this method returns a corout... | [
"Runs",
"the",
"event",
"loop",
"until",
"disconnect",
"is",
"called",
"or",
"if",
"an",
"error",
"while",
"connecting",
"/",
"sending",
"/",
"receiving",
"occurs",
"in",
"the",
"background",
".",
"In",
"the",
"latter",
"case",
"said",
"error",
"will",
"ra... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L26-L44 | train | Runs the event loop until the connection is disconnected. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/updates.py | UpdateMethods.on | def on(self, event):
"""
Decorator helper method around `add_event_handler`. Example:
>>> from telethon import TelegramClient, events
>>> client = TelegramClient(...)
>>>
>>> @client.on(events.NewMessage)
... async def handler(event):
... ...
... | python | def on(self, event):
"""
Decorator helper method around `add_event_handler`. Example:
>>> from telethon import TelegramClient, events
>>> client = TelegramClient(...)
>>>
>>> @client.on(events.NewMessage)
... async def handler(event):
... ...
... | [
"def",
"on",
"(",
"self",
",",
"event",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"add_event_handler",
"(",
"f",
",",
"event",
")",
"return",
"f",
"return",
"decorator"
] | Decorator helper method around `add_event_handler`. Example:
>>> from telethon import TelegramClient, events
>>> client = TelegramClient(...)
>>>
>>> @client.on(events.NewMessage)
... async def handler(event):
... ...
...
>>>
Args:
... | [
"Decorator",
"helper",
"method",
"around",
"add_event_handler",
".",
"Example",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L46-L68 | train | Decorator for adding event handlers to the internal cache. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/updates.py | UpdateMethods.add_event_handler | def add_event_handler(self, callback, event=None):
"""
Registers the given callback to be called on the specified event.
Args:
callback (`callable`):
The callable function accepting one parameter to be used.
Note that if you have used `telethon.event... | python | def add_event_handler(self, callback, event=None):
"""
Registers the given callback to be called on the specified event.
Args:
callback (`callable`):
The callable function accepting one parameter to be used.
Note that if you have used `telethon.event... | [
"def",
"add_event_handler",
"(",
"self",
",",
"callback",
",",
"event",
"=",
"None",
")",
":",
"builders",
"=",
"events",
".",
"_get_handlers",
"(",
"callback",
")",
"if",
"builders",
"is",
"not",
"None",
":",
"for",
"event",
"in",
"builders",
":",
"self... | Registers the given callback to be called on the specified event.
Args:
callback (`callable`):
The callable function accepting one parameter to be used.
Note that if you have used `telethon.events.register` in
the callback, ``event`` will be ignored,... | [
"Registers",
"the",
"given",
"callback",
"to",
"be",
"called",
"on",
"the",
"specified",
"event",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L70-L101 | train | Adds a callback to be called on the specified event. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/updates.py | UpdateMethods.remove_event_handler | def remove_event_handler(self, callback, event=None):
"""
Inverse operation of :meth:`add_event_handler`.
If no event is given, all events for this callback are removed.
Returns how many callbacks were removed.
"""
found = 0
if event and not isinstance(event, typ... | python | def remove_event_handler(self, callback, event=None):
"""
Inverse operation of :meth:`add_event_handler`.
If no event is given, all events for this callback are removed.
Returns how many callbacks were removed.
"""
found = 0
if event and not isinstance(event, typ... | [
"def",
"remove_event_handler",
"(",
"self",
",",
"callback",
",",
"event",
"=",
"None",
")",
":",
"found",
"=",
"0",
"if",
"event",
"and",
"not",
"isinstance",
"(",
"event",
",",
"type",
")",
":",
"event",
"=",
"type",
"(",
"event",
")",
"i",
"=",
... | Inverse operation of :meth:`add_event_handler`.
If no event is given, all events for this callback are removed.
Returns how many callbacks were removed. | [
"Inverse",
"operation",
"of",
":",
"meth",
":",
"add_event_handler",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L103-L122 | train | Removes a callback from the event handlers list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/updates.py | UpdateMethods.catch_up | async def catch_up(self):
"""
"Catches up" on the missed updates while the client was offline.
You should call this method after registering the event handlers
so that the updates it loads can by processed by your script.
This can also be used to forcibly fetch new updates if th... | python | async def catch_up(self):
"""
"Catches up" on the missed updates while the client was offline.
You should call this method after registering the event handlers
so that the updates it loads can by processed by your script.
This can also be used to forcibly fetch new updates if th... | [
"async",
"def",
"catch_up",
"(",
"self",
")",
":",
"pts",
",",
"date",
"=",
"self",
".",
"_state_cache",
"[",
"None",
"]",
"self",
".",
"session",
".",
"catching_up",
"=",
"True",
"try",
":",
"while",
"True",
":",
"d",
"=",
"await",
"self",
"(",
"f... | "Catches up" on the missed updates while the client was offline.
You should call this method after registering the event handlers
so that the updates it loads can by processed by your script.
This can also be used to forcibly fetch new updates if there are any. | [
"Catches",
"up",
"on",
"the",
"missed",
"updates",
"while",
"the",
"client",
"was",
"offline",
".",
"You",
"should",
"call",
"this",
"method",
"after",
"registering",
"the",
"event",
"handlers",
"so",
"that",
"the",
"updates",
"it",
"loads",
"can",
"by",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L131-L190 | train | Catches up on the missed updates while the client was offline. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState.reset | def reset(self):
"""
Resets the state.
"""
# Session IDs can be random on every connection
self.id = struct.unpack('q', os.urandom(8))[0]
self._sequence = 0
self._last_msg_id = 0 | python | def reset(self):
"""
Resets the state.
"""
# Session IDs can be random on every connection
self.id = struct.unpack('q', os.urandom(8))[0]
self._sequence = 0
self._last_msg_id = 0 | [
"def",
"reset",
"(",
"self",
")",
":",
"# Session IDs can be random on every connection",
"self",
".",
"id",
"=",
"struct",
".",
"unpack",
"(",
"'q'",
",",
"os",
".",
"urandom",
"(",
"8",
")",
")",
"[",
"0",
"]",
"self",
".",
"_sequence",
"=",
"0",
"se... | Resets the state. | [
"Resets",
"the",
"state",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L44-L51 | train | Resets the state of the object to its initial state. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState._calc_key | def _calc_key(auth_key, msg_key, client):
"""
Calculate the key based on Telegram guidelines for MTProto 2,
specifying whether it's the client or not. See
https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector
"""
x = 0 if client else 8
... | python | def _calc_key(auth_key, msg_key, client):
"""
Calculate the key based on Telegram guidelines for MTProto 2,
specifying whether it's the client or not. See
https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector
"""
x = 0 if client else 8
... | [
"def",
"_calc_key",
"(",
"auth_key",
",",
"msg_key",
",",
"client",
")",
":",
"x",
"=",
"0",
"if",
"client",
"else",
"8",
"sha256a",
"=",
"sha256",
"(",
"msg_key",
"+",
"auth_key",
"[",
"x",
":",
"x",
"+",
"36",
"]",
")",
".",
"digest",
"(",
")",... | Calculate the key based on Telegram guidelines for MTProto 2,
specifying whether it's the client or not. See
https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector | [
"Calculate",
"the",
"key",
"based",
"on",
"Telegram",
"guidelines",
"for",
"MTProto",
"2",
"specifying",
"whether",
"it",
"s",
"the",
"client",
"or",
"not",
".",
"See",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"mtproto",
"/",
"descri... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L61-L74 | train | Calculate the key based on the guidelines for MTProto 2 and MTProto 3. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState.write_data_as_message | def write_data_as_message(self, buffer, data, content_related,
*, after_id=None):
"""
Writes a message containing the given data into buffer.
Returns the message id.
"""
msg_id = self._get_new_msg_id()
seq_no = self._get_seq_no(content_relat... | python | def write_data_as_message(self, buffer, data, content_related,
*, after_id=None):
"""
Writes a message containing the given data into buffer.
Returns the message id.
"""
msg_id = self._get_new_msg_id()
seq_no = self._get_seq_no(content_relat... | [
"def",
"write_data_as_message",
"(",
"self",
",",
"buffer",
",",
"data",
",",
"content_related",
",",
"*",
",",
"after_id",
"=",
"None",
")",
":",
"msg_id",
"=",
"self",
".",
"_get_new_msg_id",
"(",
")",
"seq_no",
"=",
"self",
".",
"_get_seq_no",
"(",
"c... | Writes a message containing the given data into buffer.
Returns the message id. | [
"Writes",
"a",
"message",
"containing",
"the",
"given",
"data",
"into",
"buffer",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L76-L93 | train | Writes a message containing the given data into buffer. Returns the message id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState.encrypt_message_data | def encrypt_message_data(self, data):
"""
Encrypts the given message data using the current authorization key
following MTProto 2.0 guidelines core.telegram.org/mtproto/description.
"""
data = struct.pack('<qq', self.salt, self.id) + data
padding = os.urandom(-(len(data) ... | python | def encrypt_message_data(self, data):
"""
Encrypts the given message data using the current authorization key
following MTProto 2.0 guidelines core.telegram.org/mtproto/description.
"""
data = struct.pack('<qq', self.salt, self.id) + data
padding = os.urandom(-(len(data) ... | [
"def",
"encrypt_message_data",
"(",
"self",
",",
"data",
")",
":",
"data",
"=",
"struct",
".",
"pack",
"(",
"'<qq'",
",",
"self",
".",
"salt",
",",
"self",
".",
"id",
")",
"+",
"data",
"padding",
"=",
"os",
".",
"urandom",
"(",
"-",
"(",
"len",
"... | Encrypts the given message data using the current authorization key
following MTProto 2.0 guidelines core.telegram.org/mtproto/description. | [
"Encrypts",
"the",
"given",
"message",
"data",
"using",
"the",
"current",
"authorization",
"key",
"following",
"MTProto",
"2",
".",
"0",
"guidelines",
"core",
".",
"telegram",
".",
"org",
"/",
"mtproto",
"/",
"description",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L95-L114 | train | Encrypts the given message data using the current authorization key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState.decrypt_message_data | def decrypt_message_data(self, body):
"""
Inverse of `encrypt_message_data` for incoming server messages.
"""
if len(body) < 8:
raise InvalidBufferError(body)
# TODO Check salt, session_id and sequence_number
key_id = struct.unpack('<Q', body[:8])[0]
... | python | def decrypt_message_data(self, body):
"""
Inverse of `encrypt_message_data` for incoming server messages.
"""
if len(body) < 8:
raise InvalidBufferError(body)
# TODO Check salt, session_id and sequence_number
key_id = struct.unpack('<Q', body[:8])[0]
... | [
"def",
"decrypt_message_data",
"(",
"self",
",",
"body",
")",
":",
"if",
"len",
"(",
"body",
")",
"<",
"8",
":",
"raise",
"InvalidBufferError",
"(",
"body",
")",
"# TODO Check salt, session_id and sequence_number",
"key_id",
"=",
"struct",
".",
"unpack",
"(",
... | Inverse of `encrypt_message_data` for incoming server messages. | [
"Inverse",
"of",
"encrypt_message_data",
"for",
"incoming",
"server",
"messages",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L116-L153 | train | Decrypt a message body. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState._get_new_msg_id | def _get_new_msg_id(self):
"""
Generates a new unique message ID based on the current
time (in ms) since epoch, applying a known time offset.
"""
now = time.time() + self.time_offset
nanoseconds = int((now - int(now)) * 1e+9)
new_msg_id = (int(now) << 32) | (nanos... | python | def _get_new_msg_id(self):
"""
Generates a new unique message ID based on the current
time (in ms) since epoch, applying a known time offset.
"""
now = time.time() + self.time_offset
nanoseconds = int((now - int(now)) * 1e+9)
new_msg_id = (int(now) << 32) | (nanos... | [
"def",
"_get_new_msg_id",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"time_offset",
"nanoseconds",
"=",
"int",
"(",
"(",
"now",
"-",
"int",
"(",
"now",
")",
")",
"*",
"1e+9",
")",
"new_msg_id",
"=",
"(",
"... | Generates a new unique message ID based on the current
time (in ms) since epoch, applying a known time offset. | [
"Generates",
"a",
"new",
"unique",
"message",
"ID",
"based",
"on",
"the",
"current",
"time",
"(",
"in",
"ms",
")",
"since",
"epoch",
"applying",
"a",
"known",
"time",
"offset",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L155-L168 | train | Generates a new unique message ID based on the current time since epoch. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState.update_time_offset | def update_time_offset(self, correct_msg_id):
"""
Updates the time offset to the correct
one given a known valid message ID.
"""
bad = self._get_new_msg_id()
old = self.time_offset
now = int(time.time())
correct = correct_msg_id >> 32
self.time_of... | python | def update_time_offset(self, correct_msg_id):
"""
Updates the time offset to the correct
one given a known valid message ID.
"""
bad = self._get_new_msg_id()
old = self.time_offset
now = int(time.time())
correct = correct_msg_id >> 32
self.time_of... | [
"def",
"update_time_offset",
"(",
"self",
",",
"correct_msg_id",
")",
":",
"bad",
"=",
"self",
".",
"_get_new_msg_id",
"(",
")",
"old",
"=",
"self",
".",
"time_offset",
"now",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"correct",
"=",
"correc... | Updates the time offset to the correct
one given a known valid message ID. | [
"Updates",
"the",
"time",
"offset",
"to",
"the",
"correct",
"one",
"given",
"a",
"known",
"valid",
"message",
"ID",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L170-L189 | train | Updates the time offset to the correct message ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotostate.py | MTProtoState._get_seq_no | def _get_seq_no(self, content_related):
"""
Generates the next sequence number depending on whether
it should be for a content-related query or not.
"""
if content_related:
result = self._sequence * 2 + 1
self._sequence += 1
return result
... | python | def _get_seq_no(self, content_related):
"""
Generates the next sequence number depending on whether
it should be for a content-related query or not.
"""
if content_related:
result = self._sequence * 2 + 1
self._sequence += 1
return result
... | [
"def",
"_get_seq_no",
"(",
"self",
",",
"content_related",
")",
":",
"if",
"content_related",
":",
"result",
"=",
"self",
".",
"_sequence",
"*",
"2",
"+",
"1",
"self",
".",
"_sequence",
"+=",
"1",
"return",
"result",
"else",
":",
"return",
"self",
".",
... | Generates the next sequence number depending on whether
it should be for a content-related query or not. | [
"Generates",
"the",
"next",
"sequence",
"number",
"depending",
"on",
"whether",
"it",
"should",
"be",
"for",
"a",
"content",
"-",
"related",
"query",
"or",
"not",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L191-L201 | train | Generates the next sequence number depending on whether the current sequence number should be for a content - related query. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon_generator/parsers/tlobject/parser.py | parse_tl | def parse_tl(file_path, layer, methods=None, ignored_ids=CORE_TYPES):
"""
This method yields TLObjects from a given .tl file.
Note that the file is parsed completely before the function yields
because references to other objects may appear later in the file.
"""
method_info = {m.name: m for m i... | python | def parse_tl(file_path, layer, methods=None, ignored_ids=CORE_TYPES):
"""
This method yields TLObjects from a given .tl file.
Note that the file is parsed completely before the function yields
because references to other objects may appear later in the file.
"""
method_info = {m.name: m for m i... | [
"def",
"parse_tl",
"(",
"file_path",
",",
"layer",
",",
"methods",
"=",
"None",
",",
"ignored_ids",
"=",
"CORE_TYPES",
")",
":",
"method_info",
"=",
"{",
"m",
".",
"name",
":",
"m",
"for",
"m",
"in",
"(",
"methods",
"or",
"[",
"]",
")",
"}",
"obj_a... | This method yields TLObjects from a given .tl file.
Note that the file is parsed completely before the function yields
because references to other objects may appear later in the file. | [
"This",
"method",
"yields",
"TLObjects",
"from",
"a",
"given",
".",
"tl",
"file",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_generator/parsers/tlobject/parser.py#L78-L134 | train | This method parses a. tl file and yields TLObjects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon_generator/parsers/tlobject/parser.py | find_layer | def find_layer(file_path):
"""Finds the layer used on the specified scheme.tl file."""
layer_regex = re.compile(r'^//\s*LAYER\s*(\d+)$')
with file_path.open('r') as file:
for line in file:
match = layer_regex.match(line)
if match:
return int(match.group(1)) | python | def find_layer(file_path):
"""Finds the layer used on the specified scheme.tl file."""
layer_regex = re.compile(r'^//\s*LAYER\s*(\d+)$')
with file_path.open('r') as file:
for line in file:
match = layer_regex.match(line)
if match:
return int(match.group(1)) | [
"def",
"find_layer",
"(",
"file_path",
")",
":",
"layer_regex",
"=",
"re",
".",
"compile",
"(",
"r'^//\\s*LAYER\\s*(\\d+)$'",
")",
"with",
"file_path",
".",
"open",
"(",
"'r'",
")",
"as",
"file",
":",
"for",
"line",
"in",
"file",
":",
"match",
"=",
"laye... | Finds the layer used on the specified scheme.tl file. | [
"Finds",
"the",
"layer",
"used",
"on",
"the",
"specified",
"scheme",
".",
"tl",
"file",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_generator/parsers/tlobject/parser.py#L137-L144 | train | Finds the layer used on the specified scheme. tl file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlineresult.py | InlineResult.url | def url(self):
"""
The URL present in this inline results. If you want to "click"
this URL to open it in your browser, you should use Python's
`webbrowser.open(url)` for such task.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.url | python | def url(self):
"""
The URL present in this inline results. If you want to "click"
this URL to open it in your browser, you should use Python's
`webbrowser.open(url)` for such task.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.url | [
"def",
"url",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
"BotInlineResult",
")",
":",
"return",
"self",
".",
"result",
".",
"url"
] | The URL present in this inline results. If you want to "click"
this URL to open it in your browser, you should use Python's
`webbrowser.open(url)` for such task. | [
"The",
"URL",
"present",
"in",
"this",
"inline",
"results",
".",
"If",
"you",
"want",
"to",
"click",
"this",
"URL",
"to",
"open",
"it",
"in",
"your",
"browser",
"you",
"should",
"use",
"Python",
"s",
"webbrowser",
".",
"open",
"(",
"url",
")",
"for",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L69-L76 | train | The URL of the current task. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlineresult.py | InlineResult.photo | def photo(self):
"""
Returns either the :tl:`WebDocument` thumbnail for
normal results or the :tl:`Photo` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.thumb
elif isinstance(self.result, types.BotInlineMediaResult... | python | def photo(self):
"""
Returns either the :tl:`WebDocument` thumbnail for
normal results or the :tl:`Photo` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.thumb
elif isinstance(self.result, types.BotInlineMediaResult... | [
"def",
"photo",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
"BotInlineResult",
")",
":",
"return",
"self",
".",
"result",
".",
"thumb",
"elif",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
... | Returns either the :tl:`WebDocument` thumbnail for
normal results or the :tl:`Photo` for media results. | [
"Returns",
"either",
"the",
":",
"tl",
":",
"WebDocument",
"thumbnail",
"for",
"normal",
"results",
"or",
"the",
":",
"tl",
":",
"Photo",
"for",
"media",
"results",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L79-L87 | train | Returns either the WebDocument thumbnail for the current result or the Photo for the current result. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlineresult.py | InlineResult.document | def document(self):
"""
Returns either the :tl:`WebDocument` content for
normal results or the :tl:`Document` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.content
elif isinstance(self.result, types.BotInlineMedia... | python | def document(self):
"""
Returns either the :tl:`WebDocument` content for
normal results or the :tl:`Document` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.content
elif isinstance(self.result, types.BotInlineMedia... | [
"def",
"document",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
"BotInlineResult",
")",
":",
"return",
"self",
".",
"result",
".",
"content",
"elif",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
"... | Returns either the :tl:`WebDocument` content for
normal results or the :tl:`Document` for media results. | [
"Returns",
"either",
"the",
":",
"tl",
":",
"WebDocument",
"content",
"for",
"normal",
"results",
"or",
"the",
":",
"tl",
":",
"Document",
"for",
"media",
"results",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L90-L98 | train | Returns either the WebDocument content for the current result or the Document for media results. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlineresult.py | InlineResult.click | async def click(self, entity, reply_to=None,
silent=False, clear_draft=False, hide_via=False):
"""
Clicks this result and sends the associated `message`.
Args:
entity (`entity`):
The entity to which the message of this result should be sent.
... | python | async def click(self, entity, reply_to=None,
silent=False, clear_draft=False, hide_via=False):
"""
Clicks this result and sends the associated `message`.
Args:
entity (`entity`):
The entity to which the message of this result should be sent.
... | [
"async",
"def",
"click",
"(",
"self",
",",
"entity",
",",
"reply_to",
"=",
"None",
",",
"silent",
"=",
"False",
",",
"clear_draft",
"=",
"False",
",",
"hide_via",
"=",
"False",
")",
":",
"entity",
"=",
"await",
"self",
".",
"_client",
".",
"get_input_e... | Clicks this result and sends the associated `message`.
Args:
entity (`entity`):
The entity to which the message of this result should be sent.
reply_to (`int` | `Message <telethon.tl.custom.message.Message>`, optional):
If present, the sent message will ... | [
"Clicks",
"this",
"result",
"and",
"sends",
"the",
"associated",
"message",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L100-L135 | train | Clicks this result and sends the associated message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlineresult.py | InlineResult.download_media | async def download_media(self, *args, **kwargs):
"""
Downloads the media in this result (if there is a document, the
document will be downloaded; otherwise, the photo will if present).
This is a wrapper around `client.download_media
<telethon.client.downloads.DownloadMethods.dow... | python | async def download_media(self, *args, **kwargs):
"""
Downloads the media in this result (if there is a document, the
document will be downloaded; otherwise, the photo will if present).
This is a wrapper around `client.download_media
<telethon.client.downloads.DownloadMethods.dow... | [
"async",
"def",
"download_media",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"document",
"or",
"self",
".",
"photo",
":",
"return",
"await",
"self",
".",
"_client",
".",
"download_media",
"(",
"self",
".",
"d... | Downloads the media in this result (if there is a document, the
document will be downloaded; otherwise, the photo will if present).
This is a wrapper around `client.download_media
<telethon.client.downloads.DownloadMethods.download_media>`. | [
"Downloads",
"the",
"media",
"in",
"this",
"result",
"(",
"if",
"there",
"is",
"a",
"document",
"the",
"document",
"will",
"be",
"downloaded",
";",
"otherwise",
"the",
"photo",
"will",
"if",
"present",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L137-L147 | train | Downloads the media in this result. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/statecache.py | StateCache.update | def update(
self,
update,
*,
channel_id=None,
has_pts=(
types.UpdateNewMessage,
types.UpdateDeleteMessages,
types.UpdateReadHistoryInbox,
types.UpdateReadHistoryOutbox,
types.Updat... | python | def update(
self,
update,
*,
channel_id=None,
has_pts=(
types.UpdateNewMessage,
types.UpdateDeleteMessages,
types.UpdateReadHistoryInbox,
types.UpdateReadHistoryOutbox,
types.Updat... | [
"def",
"update",
"(",
"self",
",",
"update",
",",
"*",
",",
"channel_id",
"=",
"None",
",",
"has_pts",
"=",
"(",
"types",
".",
"UpdateNewMessage",
",",
"types",
".",
"UpdateDeleteMessages",
",",
"types",
".",
"UpdateReadHistoryInbox",
",",
"types",
".",
"U... | Update the state with the given update. | [
"Update",
"the",
"state",
"with",
"the",
"given",
"update",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/statecache.py#L25-L89 | train | Updates the state of the given object with the given update. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/dialogs.py | DialogMethods.iter_dialogs | def iter_dialogs(
self, limit=None, *, offset_date=None, offset_id=0,
offset_peer=types.InputPeerEmpty(), ignore_migrated=False
):
"""
Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people,
... | python | def iter_dialogs(
self, limit=None, *, offset_date=None, offset_id=0,
offset_peer=types.InputPeerEmpty(), ignore_migrated=False
):
"""
Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people,
... | [
"def",
"iter_dialogs",
"(",
"self",
",",
"limit",
"=",
"None",
",",
"*",
",",
"offset_date",
"=",
"None",
",",
"offset_id",
"=",
"0",
",",
"offset_peer",
"=",
"types",
".",
"InputPeerEmpty",
"(",
")",
",",
"ignore_migrated",
"=",
"False",
")",
":",
"re... | Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people,
groups you have joined, or channels you are subscribed to.
Args:
limit (`int` | `None`):
How many dialogs to be retrieved as maximum. Can ... | [
"Returns",
"an",
"iterator",
"over",
"the",
"dialogs",
"yielding",
"limit",
"at",
"most",
".",
"Dialogs",
"are",
"the",
"open",
"chats",
"or",
"conversations",
"with",
"other",
"people",
"groups",
"you",
"have",
"joined",
"or",
"channels",
"you",
"are",
"sub... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/dialogs.py#L100-L142 | train | Returns an iterator over the dialogs in the system. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/dialogs.py | DialogMethods.conversation | def conversation(
self, entity,
*, timeout=60, total_timeout=None, max_messages=100,
exclusive=True, replies_are_responses=True):
"""
Creates a `Conversation <telethon.tl.custom.conversation.Conversation>`
with the given entity so you can easily send messages ... | python | def conversation(
self, entity,
*, timeout=60, total_timeout=None, max_messages=100,
exclusive=True, replies_are_responses=True):
"""
Creates a `Conversation <telethon.tl.custom.conversation.Conversation>`
with the given entity so you can easily send messages ... | [
"def",
"conversation",
"(",
"self",
",",
"entity",
",",
"*",
",",
"timeout",
"=",
"60",
",",
"total_timeout",
"=",
"None",
",",
"max_messages",
"=",
"100",
",",
"exclusive",
"=",
"True",
",",
"replies_are_responses",
"=",
"True",
")",
":",
"return",
"cus... | Creates a `Conversation <telethon.tl.custom.conversation.Conversation>`
with the given entity so you can easily send messages and await for
responses or other reactions. Refer to its documentation for more.
Args:
entity (`entity`):
The entity with which a new convers... | [
"Creates",
"a",
"Conversation",
"<telethon",
".",
"tl",
".",
"custom",
".",
"conversation",
".",
"Conversation",
">",
"with",
"the",
"given",
"entity",
"so",
"you",
"can",
"easily",
"send",
"messages",
"and",
"await",
"for",
"responses",
"or",
"other",
"reac... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/dialogs.py#L169-L255 | train | Creates a new conversation with the given entity and returns the messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender.connect | async def connect(self, connection):
"""
Connects to the specified given connection using the given auth key.
"""
if self._user_connected:
self._log.info('User is already connected!')
return
self._connection = connection
await self._connect()
... | python | async def connect(self, connection):
"""
Connects to the specified given connection using the given auth key.
"""
if self._user_connected:
self._log.info('User is already connected!')
return
self._connection = connection
await self._connect()
... | [
"async",
"def",
"connect",
"(",
"self",
",",
"connection",
")",
":",
"if",
"self",
".",
"_user_connected",
":",
"self",
".",
"_log",
".",
"info",
"(",
"'User is already connected!'",
")",
"return",
"self",
".",
"_connection",
"=",
"connection",
"await",
"sel... | Connects to the specified given connection using the given auth key. | [
"Connects",
"to",
"the",
"specified",
"given",
"connection",
"using",
"the",
"given",
"auth",
"key",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L113-L123 | train | Connects to the specified connection using the given auth key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender.send | def send(self, request, ordered=False):
"""
This method enqueues the given request to be sent. Its send
state will be saved until a response arrives, and a ``Future``
that will be resolved when the response arrives will be returned:
.. code-block:: python
async def ... | python | def send(self, request, ordered=False):
"""
This method enqueues the given request to be sent. Its send
state will be saved until a response arrives, and a ``Future``
that will be resolved when the response arrives will be returned:
.. code-block:: python
async def ... | [
"def",
"send",
"(",
"self",
",",
"request",
",",
"ordered",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_user_connected",
":",
"raise",
"ConnectionError",
"(",
"'Cannot send requests while disconnected'",
")",
"if",
"not",
"utils",
".",
"is_list_like",
... | This method enqueues the given request to be sent. Its send
state will be saved until a response arrives, and a ``Future``
that will be resolved when the response arrives will be returned:
.. code-block:: python
async def method():
# Sending (enqueued for the send l... | [
"This",
"method",
"enqueues",
"the",
"given",
"request",
"to",
"be",
"sent",
".",
"Its",
"send",
"state",
"will",
"be",
"saved",
"until",
"a",
"response",
"arrives",
"and",
"a",
"Future",
"that",
"will",
"be",
"resolved",
"when",
"the",
"response",
"arrive... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L135-L175 | train | This method sends a request to the Telegram server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._connect | async def _connect(self):
"""
Performs the actual connection, retrying, generating the
authorization key if necessary, and starting the send and
receive loops.
"""
self._log.info('Connecting to %s...', self._connection)
for attempt in retry_range(self._retries):
... | python | async def _connect(self):
"""
Performs the actual connection, retrying, generating the
authorization key if necessary, and starting the send and
receive loops.
"""
self._log.info('Connecting to %s...', self._connection)
for attempt in retry_range(self._retries):
... | [
"async",
"def",
"_connect",
"(",
"self",
")",
":",
"self",
".",
"_log",
".",
"info",
"(",
"'Connecting to %s...'",
",",
"self",
".",
"_connection",
")",
"for",
"attempt",
"in",
"retry_range",
"(",
"self",
".",
"_retries",
")",
":",
"try",
":",
"self",
... | Performs the actual connection, retrying, generating the
authorization key if necessary, and starting the send and
receive loops. | [
"Performs",
"the",
"actual",
"connection",
"retrying",
"generating",
"the",
"authorization",
"key",
"if",
"necessary",
"and",
"starting",
"the",
"send",
"and",
"receive",
"loops",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L190-L251 | train | Connects to the Telegram server and generates the authorization key if necessary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._reconnect | async def _reconnect(self, last_error):
"""
Cleanly disconnects and then reconnects.
"""
self._log.debug('Closing current connection...')
await self._connection.disconnect()
await helpers._cancel(
self._log,
send_loop_handle=self._send_loop_handle... | python | async def _reconnect(self, last_error):
"""
Cleanly disconnects and then reconnects.
"""
self._log.debug('Closing current connection...')
await self._connection.disconnect()
await helpers._cancel(
self._log,
send_loop_handle=self._send_loop_handle... | [
"async",
"def",
"_reconnect",
"(",
"self",
",",
"last_error",
")",
":",
"self",
".",
"_log",
".",
"debug",
"(",
"'Closing current connection...'",
")",
"await",
"self",
".",
"_connection",
".",
"disconnect",
"(",
")",
"await",
"helpers",
".",
"_cancel",
"(",... | Cleanly disconnects and then reconnects. | [
"Cleanly",
"disconnects",
"and",
"then",
"reconnects",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L282-L332 | train | Reconnects to the current connection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._start_reconnect | def _start_reconnect(self, error):
"""Starts a reconnection in the background."""
if self._user_connected and not self._reconnecting:
# We set reconnecting to True here and not inside the new task
# because it may happen that send/recv loop calls this again
# while th... | python | def _start_reconnect(self, error):
"""Starts a reconnection in the background."""
if self._user_connected and not self._reconnecting:
# We set reconnecting to True here and not inside the new task
# because it may happen that send/recv loop calls this again
# while th... | [
"def",
"_start_reconnect",
"(",
"self",
",",
"error",
")",
":",
"if",
"self",
".",
"_user_connected",
"and",
"not",
"self",
".",
"_reconnecting",
":",
"# We set reconnecting to True here and not inside the new task",
"# because it may happen that send/recv loop calls this again... | Starts a reconnection in the background. | [
"Starts",
"a",
"reconnection",
"in",
"the",
"background",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L334-L347 | train | Starts a reconnection in the background. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._send_loop | async def _send_loop(self):
"""
This loop is responsible for popping items off the send
queue, encrypting them, and sending them over the network.
Besides `connect`, only this method ever sends data.
"""
while self._user_connected and not self._reconnecting:
... | python | async def _send_loop(self):
"""
This loop is responsible for popping items off the send
queue, encrypting them, and sending them over the network.
Besides `connect`, only this method ever sends data.
"""
while self._user_connected and not self._reconnecting:
... | [
"async",
"def",
"_send_loop",
"(",
"self",
")",
":",
"while",
"self",
".",
"_user_connected",
"and",
"not",
"self",
".",
"_reconnecting",
":",
"if",
"self",
".",
"_pending_ack",
":",
"ack",
"=",
"RequestState",
"(",
"MsgsAck",
"(",
"list",
"(",
"self",
"... | This loop is responsible for popping items off the send
queue, encrypting them, and sending them over the network.
Besides `connect`, only this method ever sends data. | [
"This",
"loop",
"is",
"responsible",
"for",
"popping",
"items",
"off",
"the",
"send",
"queue",
"encrypting",
"them",
"and",
"sending",
"them",
"over",
"the",
"network",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L351-L394 | train | This method is responsible for sending messages over the network. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._recv_loop | async def _recv_loop(self):
"""
This loop is responsible for reading all incoming responses
from the network, decrypting and handling or dispatching them.
Besides `connect`, only this method ever receives data.
"""
while self._user_connected and not self._reconnecting:
... | python | async def _recv_loop(self):
"""
This loop is responsible for reading all incoming responses
from the network, decrypting and handling or dispatching them.
Besides `connect`, only this method ever receives data.
"""
while self._user_connected and not self._reconnecting:
... | [
"async",
"def",
"_recv_loop",
"(",
"self",
")",
":",
"while",
"self",
".",
"_user_connected",
"and",
"not",
"self",
".",
"_reconnecting",
":",
"self",
".",
"_log",
".",
"debug",
"(",
"'Receiving items from the network...'",
")",
"try",
":",
"body",
"=",
"awa... | This loop is responsible for reading all incoming responses
from the network, decrypting and handling or dispatching them.
Besides `connect`, only this method ever receives data. | [
"This",
"loop",
"is",
"responsible",
"for",
"reading",
"all",
"incoming",
"responses",
"from",
"the",
"network",
"decrypting",
"and",
"handling",
"or",
"dispatching",
"them",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L396-L445 | train | This loop is responsible for reading all incoming responses from the network and handling and dispatching the messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._process_message | async def _process_message(self, message):
"""
Adds the given message to the list of messages that must be
acknowledged and dispatches control to different ``_handle_*``
method based on its type.
"""
self._pending_ack.add(message.msg_id)
handler = self._handlers.g... | python | async def _process_message(self, message):
"""
Adds the given message to the list of messages that must be
acknowledged and dispatches control to different ``_handle_*``
method based on its type.
"""
self._pending_ack.add(message.msg_id)
handler = self._handlers.g... | [
"async",
"def",
"_process_message",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"_pending_ack",
".",
"add",
"(",
"message",
".",
"msg_id",
")",
"handler",
"=",
"self",
".",
"_handlers",
".",
"get",
"(",
"message",
".",
"obj",
".",
"CONSTRUCTOR_ID... | Adds the given message to the list of messages that must be
acknowledged and dispatches control to different ``_handle_*``
method based on its type. | [
"Adds",
"the",
"given",
"message",
"to",
"the",
"list",
"of",
"messages",
"that",
"must",
"be",
"acknowledged",
"and",
"dispatches",
"control",
"to",
"different",
"_handle_",
"*",
"method",
"based",
"on",
"its",
"type",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L449-L458 | train | Process a message received from the broker. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._pop_states | def _pop_states(self, msg_id):
"""
Pops the states known to match the given ID from pending messages.
This method should be used when the response isn't specific.
"""
state = self._pending_state.pop(msg_id, None)
if state:
return [state]
to_pop = []
... | python | def _pop_states(self, msg_id):
"""
Pops the states known to match the given ID from pending messages.
This method should be used when the response isn't specific.
"""
state = self._pending_state.pop(msg_id, None)
if state:
return [state]
to_pop = []
... | [
"def",
"_pop_states",
"(",
"self",
",",
"msg_id",
")",
":",
"state",
"=",
"self",
".",
"_pending_state",
".",
"pop",
"(",
"msg_id",
",",
"None",
")",
"if",
"state",
":",
"return",
"[",
"state",
"]",
"to_pop",
"=",
"[",
"]",
"for",
"state",
"in",
"s... | Pops the states known to match the given ID from pending messages.
This method should be used when the response isn't specific. | [
"Pops",
"the",
"states",
"known",
"to",
"match",
"the",
"given",
"ID",
"from",
"pending",
"messages",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L460-L482 | train | Pops the states known to match the given ID from pending messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_rpc_result | async def _handle_rpc_result(self, message):
"""
Handles the result for Remote Procedure Calls:
rpc_result#f35c6d01 req_msg_id:long result:bytes = RpcResult;
This is where the future results for sent requests are set.
"""
rpc_result = message.obj
state = sel... | python | async def _handle_rpc_result(self, message):
"""
Handles the result for Remote Procedure Calls:
rpc_result#f35c6d01 req_msg_id:long result:bytes = RpcResult;
This is where the future results for sent requests are set.
"""
rpc_result = message.obj
state = sel... | [
"async",
"def",
"_handle_rpc_result",
"(",
"self",
",",
"message",
")",
":",
"rpc_result",
"=",
"message",
".",
"obj",
"state",
"=",
"self",
".",
"_pending_state",
".",
"pop",
"(",
"rpc_result",
".",
"req_msg_id",
",",
"None",
")",
"self",
".",
"_log",
"... | Handles the result for Remote Procedure Calls:
rpc_result#f35c6d01 req_msg_id:long result:bytes = RpcResult;
This is where the future results for sent requests are set. | [
"Handles",
"the",
"result",
"for",
"Remote",
"Procedure",
"Calls",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L484-L523 | train | Handle the result of a remote procedure call. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_container | async def _handle_container(self, message):
"""
Processes the inner messages of a container with many of them:
msg_container#73f1f8dc messages:vector<%Message> = MessageContainer;
"""
self._log.debug('Handling container')
for inner_message in message.obj.messages:
... | python | async def _handle_container(self, message):
"""
Processes the inner messages of a container with many of them:
msg_container#73f1f8dc messages:vector<%Message> = MessageContainer;
"""
self._log.debug('Handling container')
for inner_message in message.obj.messages:
... | [
"async",
"def",
"_handle_container",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling container'",
")",
"for",
"inner_message",
"in",
"message",
".",
"obj",
".",
"messages",
":",
"await",
"self",
".",
"_process_messag... | Processes the inner messages of a container with many of them:
msg_container#73f1f8dc messages:vector<%Message> = MessageContainer; | [
"Processes",
"the",
"inner",
"messages",
"of",
"a",
"container",
"with",
"many",
"of",
"them",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L525-L533 | train | Processes the inner messages of a container. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_gzip_packed | async def _handle_gzip_packed(self, message):
"""
Unpacks the data from a gzipped object and processes it:
gzip_packed#3072cfa1 packed_data:bytes = Object;
"""
self._log.debug('Handling gzipped data')
with BinaryReader(message.obj.data) as reader:
message... | python | async def _handle_gzip_packed(self, message):
"""
Unpacks the data from a gzipped object and processes it:
gzip_packed#3072cfa1 packed_data:bytes = Object;
"""
self._log.debug('Handling gzipped data')
with BinaryReader(message.obj.data) as reader:
message... | [
"async",
"def",
"_handle_gzip_packed",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling gzipped data'",
")",
"with",
"BinaryReader",
"(",
"message",
".",
"obj",
".",
"data",
")",
"as",
"reader",
":",
"message",
".",... | Unpacks the data from a gzipped object and processes it:
gzip_packed#3072cfa1 packed_data:bytes = Object; | [
"Unpacks",
"the",
"data",
"from",
"a",
"gzipped",
"object",
"and",
"processes",
"it",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L535-L544 | train | Handle a gzipped message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_pong | async def _handle_pong(self, message):
"""
Handles pong results, which don't come inside a ``rpc_result``
but are still sent through a request:
pong#347773c5 msg_id:long ping_id:long = Pong;
"""
pong = message.obj
self._log.debug('Handling pong for message %d... | python | async def _handle_pong(self, message):
"""
Handles pong results, which don't come inside a ``rpc_result``
but are still sent through a request:
pong#347773c5 msg_id:long ping_id:long = Pong;
"""
pong = message.obj
self._log.debug('Handling pong for message %d... | [
"async",
"def",
"_handle_pong",
"(",
"self",
",",
"message",
")",
":",
"pong",
"=",
"message",
".",
"obj",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling pong for message %d'",
",",
"pong",
".",
"msg_id",
")",
"state",
"=",
"self",
".",
"_pending_state... | Handles pong results, which don't come inside a ``rpc_result``
but are still sent through a request:
pong#347773c5 msg_id:long ping_id:long = Pong; | [
"Handles",
"pong",
"results",
"which",
"don",
"t",
"come",
"inside",
"a",
"rpc_result",
"but",
"are",
"still",
"sent",
"through",
"a",
"request",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L552-L563 | train | Handle Pong messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_bad_server_salt | async def _handle_bad_server_salt(self, message):
"""
Corrects the currently used server salt to use the right value
before enqueuing the rejected message to be re-sent:
bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int
error_code:int new_server_salt:long = BadM... | python | async def _handle_bad_server_salt(self, message):
"""
Corrects the currently used server salt to use the right value
before enqueuing the rejected message to be re-sent:
bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int
error_code:int new_server_salt:long = BadM... | [
"async",
"def",
"_handle_bad_server_salt",
"(",
"self",
",",
"message",
")",
":",
"bad_salt",
"=",
"message",
".",
"obj",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling bad salt for message %d'",
",",
"bad_salt",
".",
"bad_msg_id",
")",
"self",
".",
"_stat... | Corrects the currently used server salt to use the right value
before enqueuing the rejected message to be re-sent:
bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int
error_code:int new_server_salt:long = BadMsgNotification; | [
"Corrects",
"the",
"currently",
"used",
"server",
"salt",
"to",
"use",
"the",
"right",
"value",
"before",
"enqueuing",
"the",
"rejected",
"message",
"to",
"be",
"re",
"-",
"sent",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L565-L579 | train | Handle a bad server salt message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_bad_notification | async def _handle_bad_notification(self, message):
"""
Adjusts the current state to be correct based on the
received bad message notification whenever possible:
bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int
error_code:int = BadMsgNotification;
"... | python | async def _handle_bad_notification(self, message):
"""
Adjusts the current state to be correct based on the
received bad message notification whenever possible:
bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int
error_code:int = BadMsgNotification;
"... | [
"async",
"def",
"_handle_bad_notification",
"(",
"self",
",",
"message",
")",
":",
"bad_msg",
"=",
"message",
".",
"obj",
"states",
"=",
"self",
".",
"_pop_states",
"(",
"bad_msg",
".",
"bad_msg_id",
")",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling ... | Adjusts the current state to be correct based on the
received bad message notification whenever possible:
bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int
error_code:int = BadMsgNotification; | [
"Adjusts",
"the",
"current",
"state",
"to",
"be",
"correct",
"based",
"on",
"the",
"received",
"bad",
"message",
"notification",
"whenever",
"possible",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L581-L615 | train | Handle a bad message notification. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_detailed_info | async def _handle_detailed_info(self, message):
"""
Updates the current status with the received detailed information:
msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long
bytes:int status:int = MsgDetailedInfo;
"""
# TODO https://goo.gl/VvpCC6
msg_i... | python | async def _handle_detailed_info(self, message):
"""
Updates the current status with the received detailed information:
msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long
bytes:int status:int = MsgDetailedInfo;
"""
# TODO https://goo.gl/VvpCC6
msg_i... | [
"async",
"def",
"_handle_detailed_info",
"(",
"self",
",",
"message",
")",
":",
"# TODO https://goo.gl/VvpCC6",
"msg_id",
"=",
"message",
".",
"obj",
".",
"answer_msg_id",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling detailed info for message %d'",
",",
"msg_i... | Updates the current status with the received detailed information:
msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long
bytes:int status:int = MsgDetailedInfo; | [
"Updates",
"the",
"current",
"status",
"with",
"the",
"received",
"detailed",
"information",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L617-L627 | train | Handle a detailed info message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_new_session_created | async def _handle_new_session_created(self, message):
"""
Updates the current status with the received session information:
new_session_created#9ec20908 first_msg_id:long unique_id:long
server_salt:long = NewSession;
"""
# TODO https://goo.gl/LMyN7A
self.... | python | async def _handle_new_session_created(self, message):
"""
Updates the current status with the received session information:
new_session_created#9ec20908 first_msg_id:long unique_id:long
server_salt:long = NewSession;
"""
# TODO https://goo.gl/LMyN7A
self.... | [
"async",
"def",
"_handle_new_session_created",
"(",
"self",
",",
"message",
")",
":",
"# TODO https://goo.gl/LMyN7A",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling new session created'",
")",
"self",
".",
"_state",
".",
"salt",
"=",
"message",
".",
"obj",
"... | Updates the current status with the received session information:
new_session_created#9ec20908 first_msg_id:long unique_id:long
server_salt:long = NewSession; | [
"Updates",
"the",
"current",
"status",
"with",
"the",
"received",
"session",
"information",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L641-L650 | train | Handle a NewSessionCreated message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_ack | async def _handle_ack(self, message):
"""
Handles a server acknowledge about our messages. Normally
these can be ignored except in the case of ``auth.logOut``:
auth.logOut#5717da40 = Bool;
Telegram doesn't seem to send its result so we need to confirm
it manually. N... | python | async def _handle_ack(self, message):
"""
Handles a server acknowledge about our messages. Normally
these can be ignored except in the case of ``auth.logOut``:
auth.logOut#5717da40 = Bool;
Telegram doesn't seem to send its result so we need to confirm
it manually. N... | [
"async",
"def",
"_handle_ack",
"(",
"self",
",",
"message",
")",
":",
"ack",
"=",
"message",
".",
"obj",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling acknowledge for %s'",
",",
"str",
"(",
"ack",
".",
"msg_ids",
")",
")",
"for",
"msg_id",
"in",
"... | Handles a server acknowledge about our messages. Normally
these can be ignored except in the case of ``auth.logOut``:
auth.logOut#5717da40 = Bool;
Telegram doesn't seem to send its result so we need to confirm
it manually. No other request is known to have this behaviour.
... | [
"Handles",
"a",
"server",
"acknowledge",
"about",
"our",
"messages",
".",
"Normally",
"these",
"can",
"be",
"ignored",
"except",
"in",
"the",
"case",
"of",
"auth",
".",
"logOut",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L652-L673 | train | Handle an ack from the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_future_salts | async def _handle_future_salts(self, message):
"""
Handles future salt results, which don't come inside a
``rpc_result`` but are still sent through a request:
future_salts#ae500895 req_msg_id:long now:int
salts:vector<future_salt> = FutureSalts;
"""
# TOD... | python | async def _handle_future_salts(self, message):
"""
Handles future salt results, which don't come inside a
``rpc_result`` but are still sent through a request:
future_salts#ae500895 req_msg_id:long now:int
salts:vector<future_salt> = FutureSalts;
"""
# TOD... | [
"async",
"def",
"_handle_future_salts",
"(",
"self",
",",
"message",
")",
":",
"# TODO save these salts and automatically adjust to the",
"# correct one whenever the salt in use expires.",
"self",
".",
"_log",
".",
"debug",
"(",
"'Handling future salts for message %d'",
",",
"m... | Handles future salt results, which don't come inside a
``rpc_result`` but are still sent through a request:
future_salts#ae500895 req_msg_id:long now:int
salts:vector<future_salt> = FutureSalts; | [
"Handles",
"future",
"salt",
"results",
"which",
"don",
"t",
"come",
"inside",
"a",
"rpc_result",
"but",
"are",
"still",
"sent",
"through",
"a",
"request",
":"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L675-L688 | train | Handles future salts from the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/mtprotosender.py | MTProtoSender._handle_state_forgotten | async def _handle_state_forgotten(self, message):
"""
Handles both :tl:`MsgsStateReq` and :tl:`MsgResendReq` by
enqueuing a :tl:`MsgsStateInfo` to be sent at a later point.
"""
self._send_queue.append(RequestState(MsgsStateInfo(
req_msg_id=message.msg_id, info=chr(1) ... | python | async def _handle_state_forgotten(self, message):
"""
Handles both :tl:`MsgsStateReq` and :tl:`MsgResendReq` by
enqueuing a :tl:`MsgsStateInfo` to be sent at a later point.
"""
self._send_queue.append(RequestState(MsgsStateInfo(
req_msg_id=message.msg_id, info=chr(1) ... | [
"async",
"def",
"_handle_state_forgotten",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"_send_queue",
".",
"append",
"(",
"RequestState",
"(",
"MsgsStateInfo",
"(",
"req_msg_id",
"=",
"message",
".",
"msg_id",
",",
"info",
"=",
"chr",
"(",
"1",
")"... | Handles both :tl:`MsgsStateReq` and :tl:`MsgResendReq` by
enqueuing a :tl:`MsgsStateInfo` to be sent at a later point. | [
"Handles",
"both",
":",
"tl",
":",
"MsgsStateReq",
"and",
":",
"tl",
":",
"MsgResendReq",
"by",
"enqueuing",
"a",
":",
"tl",
":",
"MsgsStateInfo",
"to",
"be",
"sent",
"at",
"a",
"later",
"point",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L690-L697 | train | Handle a state forgotten message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlinebuilder.py | InlineBuilder.article | async def article(
self, title, description=None,
*, url=None, thumb=None, content=None,
id=None, text=None, parse_mode=(), link_preview=True,
geo=None, period=60, contact=None, game=False, buttons=None
):
"""
Creates new inline result of article type.... | python | async def article(
self, title, description=None,
*, url=None, thumb=None, content=None,
id=None, text=None, parse_mode=(), link_preview=True,
geo=None, period=60, contact=None, game=False, buttons=None
):
"""
Creates new inline result of article type.... | [
"async",
"def",
"article",
"(",
"self",
",",
"title",
",",
"description",
"=",
"None",
",",
"*",
",",
"url",
"=",
"None",
",",
"thumb",
"=",
"None",
",",
"content",
"=",
"None",
",",
"id",
"=",
"None",
",",
"text",
"=",
"None",
",",
"parse_mode",
... | Creates new inline result of article type.
Args:
title (`str`):
The title to be shown for this result.
description (`str`, optional):
Further explanation of what this result means.
url (`str`, optional):
The URL to be shown f... | [
"Creates",
"new",
"inline",
"result",
"of",
"article",
"type",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlinebuilder.py#L59-L108 | train | Create an inline result of article type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlinebuilder.py | InlineBuilder.photo | async def photo(
self, file, *, id=None,
text=None, parse_mode=(), link_preview=True,
geo=None, period=60, contact=None, game=False, buttons=None
):
"""
Creates a new inline result of photo type.
Args:
file (`obj`, optional):
S... | python | async def photo(
self, file, *, id=None,
text=None, parse_mode=(), link_preview=True,
geo=None, period=60, contact=None, game=False, buttons=None
):
"""
Creates a new inline result of photo type.
Args:
file (`obj`, optional):
S... | [
"async",
"def",
"photo",
"(",
"self",
",",
"file",
",",
"*",
",",
"id",
"=",
"None",
",",
"text",
"=",
"None",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"True",
",",
"geo",
"=",
"None",
",",
"period",
"=",
"60",
",",
"contact",
... | Creates a new inline result of photo type.
Args:
file (`obj`, optional):
Same as ``file`` for `client.send_file
<telethon.client.uploads.UploadMethods.send_file>`. | [
"Creates",
"a",
"new",
"inline",
"result",
"of",
"photo",
"type",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlinebuilder.py#L110-L152 | train | Creates a new inline result of photo type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlinebuilder.py | InlineBuilder.document | async def document(
self, file, title=None, *, description=None, type=None,
mime_type=None, attributes=None, force_document=False,
voice_note=False, video_note=False, use_cache=True, id=None,
text=None, parse_mode=(), link_preview=True,
geo=None, period=60, co... | python | async def document(
self, file, title=None, *, description=None, type=None,
mime_type=None, attributes=None, force_document=False,
voice_note=False, video_note=False, use_cache=True, id=None,
text=None, parse_mode=(), link_preview=True,
geo=None, period=60, co... | [
"async",
"def",
"document",
"(",
"self",
",",
"file",
",",
"title",
"=",
"None",
",",
"*",
",",
"description",
"=",
"None",
",",
"type",
"=",
"None",
",",
"mime_type",
"=",
"None",
",",
"attributes",
"=",
"None",
",",
"force_document",
"=",
"False",
... | Creates a new inline result of document type.
`use_cache`, `mime_type`, `attributes`, `force_document`,
`voice_note` and `video_note` are described in `client.send_file
<telethon.client.uploads.UploadMethods.send_file>`.
Args:
file (`obj`):
Same as ``file`` ... | [
"Creates",
"a",
"new",
"inline",
"result",
"of",
"document",
"type",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlinebuilder.py#L154-L239 | train | Creates a new inline result of a document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/inlinebuilder.py | InlineBuilder.game | async def game(
self, short_name, *, id=None,
text=None, parse_mode=(), link_preview=True,
geo=None, period=60, contact=None, game=False, buttons=None
):
"""
Creates a new inline result of game type.
Args:
short_name (`str`):
T... | python | async def game(
self, short_name, *, id=None,
text=None, parse_mode=(), link_preview=True,
geo=None, period=60, contact=None, game=False, buttons=None
):
"""
Creates a new inline result of game type.
Args:
short_name (`str`):
T... | [
"async",
"def",
"game",
"(",
"self",
",",
"short_name",
",",
"*",
",",
"id",
"=",
"None",
",",
"text",
"=",
"None",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"True",
",",
"geo",
"=",
"None",
",",
"period",
"=",
"60",
",",
"conta... | Creates a new inline result of game type.
Args:
short_name (`str`):
The short name of the game to use. | [
"Creates",
"a",
"new",
"inline",
"result",
"of",
"game",
"type",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlinebuilder.py#L241-L267 | train | Create a new inline result of game type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/dialog.py | Dialog.send_message | async def send_message(self, *args, **kwargs):
"""
Sends a message to this dialog. This is just a wrapper around
``client.send_message(dialog.input_entity, *args, **kwargs)``.
"""
return await self._client.send_message(
self.input_entity, *args, **kwargs) | python | async def send_message(self, *args, **kwargs):
"""
Sends a message to this dialog. This is just a wrapper around
``client.send_message(dialog.input_entity, *args, **kwargs)``.
"""
return await self._client.send_message(
self.input_entity, *args, **kwargs) | [
"async",
"def",
"send_message",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"await",
"self",
".",
"_client",
".",
"send_message",
"(",
"self",
".",
"input_entity",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Sends a message to this dialog. This is just a wrapper around
``client.send_message(dialog.input_entity, *args, **kwargs)``. | [
"Sends",
"a",
"message",
"to",
"this",
"dialog",
".",
"This",
"is",
"just",
"a",
"wrapper",
"around",
"client",
".",
"send_message",
"(",
"dialog",
".",
"input_entity",
"*",
"args",
"**",
"kwargs",
")",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/dialog.py#L91-L97 | train | Sends a message to this dialog. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/tl/custom/dialog.py | Dialog.delete | async def delete(self):
"""
Deletes the dialog from your dialog list. If you own the
channel this won't destroy it, only delete it from the list.
"""
if self.is_channel:
await self._client(functions.channels.LeaveChannelRequest(
self.input_entity))
... | python | async def delete(self):
"""
Deletes the dialog from your dialog list. If you own the
channel this won't destroy it, only delete it from the list.
"""
if self.is_channel:
await self._client(functions.channels.LeaveChannelRequest(
self.input_entity))
... | [
"async",
"def",
"delete",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_channel",
":",
"await",
"self",
".",
"_client",
"(",
"functions",
".",
"channels",
".",
"LeaveChannelRequest",
"(",
"self",
".",
"input_entity",
")",
")",
"else",
":",
"if",
"self",
... | Deletes the dialog from your dialog list. If you own the
channel this won't destroy it, only delete it from the list. | [
"Deletes",
"the",
"dialog",
"from",
"your",
"dialog",
"list",
".",
"If",
"you",
"own",
"the",
"channel",
"this",
"won",
"t",
"destroy",
"it",
"only",
"delete",
"it",
"from",
"the",
"list",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/dialog.py#L99-L112 | train | Deletes the dialog from the dialog list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.read_int | def read_int(self, signed=True):
"""Reads an integer (4 bytes) value."""
return int.from_bytes(self.read(4), byteorder='little', signed=signed) | python | def read_int(self, signed=True):
"""Reads an integer (4 bytes) value."""
return int.from_bytes(self.read(4), byteorder='little', signed=signed) | [
"def",
"read_int",
"(",
"self",
",",
"signed",
"=",
"True",
")",
":",
"return",
"int",
".",
"from_bytes",
"(",
"self",
".",
"read",
"(",
"4",
")",
",",
"byteorder",
"=",
"'little'",
",",
"signed",
"=",
"signed",
")"
] | Reads an integer (4 bytes) value. | [
"Reads",
"an",
"integer",
"(",
"4",
"bytes",
")",
"value",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L39-L41 | train | Reads an integer ( 4 bytes ) value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.read_long | def read_long(self, signed=True):
"""Reads a long integer (8 bytes) value."""
return int.from_bytes(self.read(8), byteorder='little', signed=signed) | python | def read_long(self, signed=True):
"""Reads a long integer (8 bytes) value."""
return int.from_bytes(self.read(8), byteorder='little', signed=signed) | [
"def",
"read_long",
"(",
"self",
",",
"signed",
"=",
"True",
")",
":",
"return",
"int",
".",
"from_bytes",
"(",
"self",
".",
"read",
"(",
"8",
")",
",",
"byteorder",
"=",
"'little'",
",",
"signed",
"=",
"signed",
")"
] | Reads a long integer (8 bytes) value. | [
"Reads",
"a",
"long",
"integer",
"(",
"8",
"bytes",
")",
"value",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L43-L45 | train | Reads a long integer ( 8 bytes ) value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.read_large_int | def read_large_int(self, bits, signed=True):
"""Reads a n-bits long integer value."""
return int.from_bytes(
self.read(bits // 8), byteorder='little', signed=signed) | python | def read_large_int(self, bits, signed=True):
"""Reads a n-bits long integer value."""
return int.from_bytes(
self.read(bits // 8), byteorder='little', signed=signed) | [
"def",
"read_large_int",
"(",
"self",
",",
"bits",
",",
"signed",
"=",
"True",
")",
":",
"return",
"int",
".",
"from_bytes",
"(",
"self",
".",
"read",
"(",
"bits",
"//",
"8",
")",
",",
"byteorder",
"=",
"'little'",
",",
"signed",
"=",
"signed",
")"
] | Reads a n-bits long integer value. | [
"Reads",
"a",
"n",
"-",
"bits",
"long",
"integer",
"value",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L55-L58 | train | Reads a n - bits long integer value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.read | def read(self, length=None):
"""Read the given amount of bytes."""
if length is None:
return self.reader.read()
result = self.reader.read(length)
if len(result) != length:
raise BufferError(
'No more data left to read (need {}, got {}: {}); last r... | python | def read(self, length=None):
"""Read the given amount of bytes."""
if length is None:
return self.reader.read()
result = self.reader.read(length)
if len(result) != length:
raise BufferError(
'No more data left to read (need {}, got {}: {}); last r... | [
"def",
"read",
"(",
"self",
",",
"length",
"=",
"None",
")",
":",
"if",
"length",
"is",
"None",
":",
"return",
"self",
".",
"reader",
".",
"read",
"(",
")",
"result",
"=",
"self",
".",
"reader",
".",
"read",
"(",
"length",
")",
"if",
"len",
"(",
... | Read the given amount of bytes. | [
"Read",
"the",
"given",
"amount",
"of",
"bytes",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L60-L73 | train | Read the given amount of bytes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.tgread_bytes | def tgread_bytes(self):
"""
Reads a Telegram-encoded byte array, without the need of
specifying its length.
"""
first_byte = self.read_byte()
if first_byte == 254:
length = self.read_byte() | (self.read_byte() << 8) | (
self.read_byte() << 16)
... | python | def tgread_bytes(self):
"""
Reads a Telegram-encoded byte array, without the need of
specifying its length.
"""
first_byte = self.read_byte()
if first_byte == 254:
length = self.read_byte() | (self.read_byte() << 8) | (
self.read_byte() << 16)
... | [
"def",
"tgread_bytes",
"(",
"self",
")",
":",
"first_byte",
"=",
"self",
".",
"read_byte",
"(",
")",
"if",
"first_byte",
"==",
"254",
":",
"length",
"=",
"self",
".",
"read_byte",
"(",
")",
"|",
"(",
"self",
".",
"read_byte",
"(",
")",
"<<",
"8",
"... | Reads a Telegram-encoded byte array, without the need of
specifying its length. | [
"Reads",
"a",
"Telegram",
"-",
"encoded",
"byte",
"array",
"without",
"the",
"need",
"of",
"specifying",
"its",
"length",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L83-L102 | train | Reads a Telegram - encoded byte array without the need of the need of the need of the need of the of
specifying its length. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.tgread_bool | def tgread_bool(self):
"""Reads a Telegram boolean value."""
value = self.read_int(signed=False)
if value == 0x997275b5: # boolTrue
return True
elif value == 0xbc799737: # boolFalse
return False
else:
raise RuntimeError('Invalid boolean code ... | python | def tgread_bool(self):
"""Reads a Telegram boolean value."""
value = self.read_int(signed=False)
if value == 0x997275b5: # boolTrue
return True
elif value == 0xbc799737: # boolFalse
return False
else:
raise RuntimeError('Invalid boolean code ... | [
"def",
"tgread_bool",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"read_int",
"(",
"signed",
"=",
"False",
")",
"if",
"value",
"==",
"0x997275b5",
":",
"# boolTrue",
"return",
"True",
"elif",
"value",
"==",
"0xbc799737",
":",
"# boolFalse",
"return",... | Reads a Telegram boolean value. | [
"Reads",
"a",
"Telegram",
"boolean",
"value",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L108-L116 | train | Reads a Telegram boolean value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.tgread_date | def tgread_date(self):
"""Reads and converts Unix time (used by Telegram)
into a Python datetime object.
"""
value = self.read_int()
if value == 0:
return None
else:
return datetime.fromtimestamp(value, tz=timezone.utc) | python | def tgread_date(self):
"""Reads and converts Unix time (used by Telegram)
into a Python datetime object.
"""
value = self.read_int()
if value == 0:
return None
else:
return datetime.fromtimestamp(value, tz=timezone.utc) | [
"def",
"tgread_date",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"read_int",
"(",
")",
"if",
"value",
"==",
"0",
":",
"return",
"None",
"else",
":",
"return",
"datetime",
".",
"fromtimestamp",
"(",
"value",
",",
"tz",
"=",
"timezone",
".",
"ut... | Reads and converts Unix time (used by Telegram)
into a Python datetime object. | [
"Reads",
"and",
"converts",
"Unix",
"time",
"(",
"used",
"by",
"Telegram",
")",
"into",
"a",
"Python",
"datetime",
"object",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L118-L126 | train | Reads and converts Unix time to Python datetime object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.tgread_object | def tgread_object(self):
"""Reads a Telegram object."""
constructor_id = self.read_int(signed=False)
clazz = tlobjects.get(constructor_id, None)
if clazz is None:
# The class was None, but there's still a
# chance of it being a manually parsed value like bool!
... | python | def tgread_object(self):
"""Reads a Telegram object."""
constructor_id = self.read_int(signed=False)
clazz = tlobjects.get(constructor_id, None)
if clazz is None:
# The class was None, but there's still a
# chance of it being a manually parsed value like bool!
... | [
"def",
"tgread_object",
"(",
"self",
")",
":",
"constructor_id",
"=",
"self",
".",
"read_int",
"(",
"signed",
"=",
"False",
")",
"clazz",
"=",
"tlobjects",
".",
"get",
"(",
"constructor_id",
",",
"None",
")",
"if",
"clazz",
"is",
"None",
":",
"# The clas... | Reads a Telegram object. | [
"Reads",
"a",
"Telegram",
"object",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L128-L152 | train | Reads a Telegram object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/binaryreader.py | BinaryReader.tgread_vector | def tgread_vector(self):
"""Reads a vector (a list) of Telegram objects."""
if 0x1cb5c415 != self.read_int(signed=False):
raise RuntimeError('Invalid constructor code, vector was expected')
count = self.read_int()
return [self.tgread_object() for _ in range(count)] | python | def tgread_vector(self):
"""Reads a vector (a list) of Telegram objects."""
if 0x1cb5c415 != self.read_int(signed=False):
raise RuntimeError('Invalid constructor code, vector was expected')
count = self.read_int()
return [self.tgread_object() for _ in range(count)] | [
"def",
"tgread_vector",
"(",
"self",
")",
":",
"if",
"0x1cb5c415",
"!=",
"self",
".",
"read_int",
"(",
"signed",
"=",
"False",
")",
":",
"raise",
"RuntimeError",
"(",
"'Invalid constructor code, vector was expected'",
")",
"count",
"=",
"self",
".",
"read_int",
... | Reads a vector (a list) of Telegram objects. | [
"Reads",
"a",
"vector",
"(",
"a",
"list",
")",
"of",
"Telegram",
"objects",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/binaryreader.py#L154-L160 | train | Reads a list of Telegram objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/crypto/factorization.py | Factorization.factorize | def factorize(cls, pq):
"""
Factorizes the given large integer.
:param pq: the prime pair pq.
:return: a tuple containing the two factors p and q.
"""
if pq % 2 == 0:
return 2, pq // 2
y, c, m = randint(1, pq - 1), randint(1, pq - 1), randint(1, pq -... | python | def factorize(cls, pq):
"""
Factorizes the given large integer.
:param pq: the prime pair pq.
:return: a tuple containing the two factors p and q.
"""
if pq % 2 == 0:
return 2, pq // 2
y, c, m = randint(1, pq - 1), randint(1, pq - 1), randint(1, pq -... | [
"def",
"factorize",
"(",
"cls",
",",
"pq",
")",
":",
"if",
"pq",
"%",
"2",
"==",
"0",
":",
"return",
"2",
",",
"pq",
"//",
"2",
"y",
",",
"c",
",",
"m",
"=",
"randint",
"(",
"1",
",",
"pq",
"-",
"1",
")",
",",
"randint",
"(",
"1",
",",
... | Factorizes the given large integer.
:param pq: the prime pair pq.
:return: a tuple containing the two factors p and q. | [
"Factorizes",
"the",
"given",
"large",
"integer",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/factorization.py#L12-L51 | train | Factorizes the given large integer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/crypto/factorization.py | Factorization.gcd | def gcd(a, b):
"""
Calculates the Greatest Common Divisor.
:param a: the first number.
:param b: the second number.
:return: GCD(a, b)
"""
while b:
a, b = b, a % b
return a | python | def gcd(a, b):
"""
Calculates the Greatest Common Divisor.
:param a: the first number.
:param b: the second number.
:return: GCD(a, b)
"""
while b:
a, b = b, a % b
return a | [
"def",
"gcd",
"(",
"a",
",",
"b",
")",
":",
"while",
"b",
":",
"a",
",",
"b",
"=",
"b",
",",
"a",
"%",
"b",
"return",
"a"
] | Calculates the Greatest Common Divisor.
:param a: the first number.
:param b: the second number.
:return: GCD(a, b) | [
"Calculates",
"the",
"Greatest",
"Common",
"Divisor",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/factorization.py#L54-L65 | train | Calculates the Greatest Common Divisor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/account.py | AccountMethods.takeout | def takeout(
self, finalize=True, *, contacts=None, users=None, chats=None,
megagroups=None, channels=None, files=None, max_file_size=None):
"""
Creates a proxy object over the current :ref:`TelegramClient` through
which making requests will use :tl:`InvokeWithTakeoutRequ... | python | def takeout(
self, finalize=True, *, contacts=None, users=None, chats=None,
megagroups=None, channels=None, files=None, max_file_size=None):
"""
Creates a proxy object over the current :ref:`TelegramClient` through
which making requests will use :tl:`InvokeWithTakeoutRequ... | [
"def",
"takeout",
"(",
"self",
",",
"finalize",
"=",
"True",
",",
"*",
",",
"contacts",
"=",
"None",
",",
"users",
"=",
"None",
",",
"chats",
"=",
"None",
",",
"megagroups",
"=",
"None",
",",
"channels",
"=",
"None",
",",
"files",
"=",
"None",
",",... | Creates a proxy object over the current :ref:`TelegramClient` through
which making requests will use :tl:`InvokeWithTakeoutRequest` to wrap
them. In other words, returns the current client modified so that
requests are done as a takeout:
>>> from telethon.sync import TelegramClient
... | [
"Creates",
"a",
"proxy",
"object",
"over",
"the",
"current",
":",
"ref",
":",
"TelegramClient",
"through",
"which",
"making",
"requests",
"will",
"use",
":",
"tl",
":",
"InvokeWithTakeoutRequest",
"to",
"wrap",
"them",
".",
"In",
"other",
"words",
"returns",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/account.py#L107-L193 | train | This method takesout the current client and returns the new object with the result of the takeout. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/client/account.py | AccountMethods.end_takeout | async def end_takeout(self, success):
"""
Finishes a takeout, with specified result sent back to Telegram.
Returns:
``True`` if the operation was successful, ``False`` otherwise.
"""
try:
async with _TakeoutClient(True, self, None) as takeout:
... | python | async def end_takeout(self, success):
"""
Finishes a takeout, with specified result sent back to Telegram.
Returns:
``True`` if the operation was successful, ``False`` otherwise.
"""
try:
async with _TakeoutClient(True, self, None) as takeout:
... | [
"async",
"def",
"end_takeout",
"(",
"self",
",",
"success",
")",
":",
"try",
":",
"async",
"with",
"_TakeoutClient",
"(",
"True",
",",
"self",
",",
"None",
")",
"as",
"takeout",
":",
"takeout",
".",
"success",
"=",
"success",
"except",
"ValueError",
":",... | Finishes a takeout, with specified result sent back to Telegram.
Returns:
``True`` if the operation was successful, ``False`` otherwise. | [
"Finishes",
"a",
"takeout",
"with",
"specified",
"result",
"sent",
"back",
"to",
"Telegram",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/account.py#L195-L207 | train | Ends a takeout with specified result sent back to Telegram. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/sync.py | syncify | def syncify(*types):
"""
Converts all the methods in the given types (class definitions)
into synchronous, which return either the coroutine or the result
based on whether ``asyncio's`` event loop is running.
"""
# Our asynchronous generators all are `RequestIter`, which already
# provide a ... | python | def syncify(*types):
"""
Converts all the methods in the given types (class definitions)
into synchronous, which return either the coroutine or the result
based on whether ``asyncio's`` event loop is running.
"""
# Our asynchronous generators all are `RequestIter`, which already
# provide a ... | [
"def",
"syncify",
"(",
"*",
"types",
")",
":",
"# Our asynchronous generators all are `RequestIter`, which already",
"# provide a synchronous iterator variant, so we don't need to worry",
"# about asyncgenfunction's here.",
"for",
"t",
"in",
"types",
":",
"for",
"name",
"in",
"di... | Converts all the methods in the given types (class definitions)
into synchronous, which return either the coroutine or the result
based on whether ``asyncio's`` event loop is running. | [
"Converts",
"all",
"the",
"methods",
"in",
"the",
"given",
"types",
"(",
"class",
"definitions",
")",
"into",
"synchronous",
"which",
"return",
"either",
"the",
"coroutine",
"or",
"the",
"result",
"based",
"on",
"whether",
"asyncio",
"s",
"event",
"loop",
"i... | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/sync.py#L43-L56 | train | Convert all the methods in the given types into synchronous. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/extensions/messagepacker.py | MessagePacker.get | async def get(self):
"""
Returns (batch, data) if one or more items could be retrieved.
If the cancellation occurs or only invalid items were in the
queue, (None, None) will be returned instead.
"""
if not self._deque:
self._ready.clear()
await se... | python | async def get(self):
"""
Returns (batch, data) if one or more items could be retrieved.
If the cancellation occurs or only invalid items were in the
queue, (None, None) will be returned instead.
"""
if not self._deque:
self._ready.clear()
await se... | [
"async",
"def",
"get",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_deque",
":",
"self",
".",
"_ready",
".",
"clear",
"(",
")",
"await",
"self",
".",
"_ready",
".",
"wait",
"(",
")",
"buffer",
"=",
"io",
".",
"BytesIO",
"(",
")",
"batch",
... | Returns (batch, data) if one or more items could be retrieved.
If the cancellation occurs or only invalid items were in the
queue, (None, None) will be returned instead. | [
"Returns",
"(",
"batch",
"data",
")",
"if",
"one",
"or",
"more",
"items",
"could",
"be",
"retrieved",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/messagepacker.py#L40-L112 | train | Get the next available item from the queue. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
LonamiWebs/Telethon | telethon/network/connection/connection.py | Connection.connect | async def connect(self, timeout=None, ssl=None):
"""
Establishes a connection with the server.
"""
await self._connect(timeout=timeout, ssl=ssl)
self._connected = True
self._send_task = self._loop.create_task(self._send_loop())
self._recv_task = self._loop.create... | python | async def connect(self, timeout=None, ssl=None):
"""
Establishes a connection with the server.
"""
await self._connect(timeout=timeout, ssl=ssl)
self._connected = True
self._send_task = self._loop.create_task(self._send_loop())
self._recv_task = self._loop.create... | [
"async",
"def",
"connect",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"ssl",
"=",
"None",
")",
":",
"await",
"self",
".",
"_connect",
"(",
"timeout",
"=",
"timeout",
",",
"ssl",
"=",
"ssl",
")",
"self",
".",
"_connected",
"=",
"True",
"self",
"... | Establishes a connection with the server. | [
"Establishes",
"a",
"connection",
"with",
"the",
"server",
"."
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/connection/connection.py#L87-L95 | train | Establishes a connection with the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.