partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | IterDialogs.iter_dialogs | Use this method to iterate through a user's dialogs sequentially.
This convenience method does the same as repeatedly calling :meth:`get_dialogs` in a loop, thus saving you from
the hassle of setting up boilerplate code. It is useful for getting the whole dialogs list with a single call.
Args:... | pyrogram/client/methods/chats/iter_dialogs.py | def iter_dialogs(
self,
offset_date: int = 0,
limit: int = 0
) -> Generator["pyrogram.Dialog", None, None]:
"""Use this method to iterate through a user's dialogs sequentially.
This convenience method does the same as repeatedly calling :meth:`get_dialogs` in a loop, thus sa... | def iter_dialogs(
self,
offset_date: int = 0,
limit: int = 0
) -> Generator["pyrogram.Dialog", None, None]:
"""Use this method to iterate through a user's dialogs sequentially.
This convenience method does the same as repeatedly calling :meth:`get_dialogs` in a loop, thus sa... | [
"Use",
"this",
"method",
"to",
"iterate",
"through",
"a",
"user",
"s",
"dialogs",
"sequentially",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/iter_dialogs.py#L26-L84 | [
"def",
"iter_dialogs",
"(",
"self",
",",
"offset_date",
":",
"int",
"=",
"0",
",",
"limit",
":",
"int",
"=",
"0",
")",
"->",
"Generator",
"[",
"\"pyrogram.Dialog\"",
",",
"None",
",",
"None",
"]",
":",
"current",
"=",
"0",
"total",
"=",
"limit",
"or"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetMe.get_me | A simple method for testing your authorization. Requires no parameters.
Returns:
Basic information about the user or bot in form of a :obj:`User` object
Raises:
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error. | pyrogram/client/methods/users/get_me.py | def get_me(self) -> "pyrogram.User":
"""A simple method for testing your authorization. Requires no parameters.
Returns:
Basic information about the user or bot in form of a :obj:`User` object
Raises:
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error... | def get_me(self) -> "pyrogram.User":
"""A simple method for testing your authorization. Requires no parameters.
Returns:
Basic information about the user or bot in form of a :obj:`User` object
Raises:
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error... | [
"A",
"simple",
"method",
"for",
"testing",
"your",
"authorization",
".",
"Requires",
"no",
"parameters",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/users/get_me.py#L25-L41 | [
"def",
"get_me",
"(",
"self",
")",
"->",
"\"pyrogram.User\"",
":",
"return",
"pyrogram",
".",
"User",
".",
"_parse",
"(",
"self",
",",
"self",
".",
"send",
"(",
"functions",
".",
"users",
".",
"GetFullUser",
"(",
"id",
"=",
"types",
".",
"InputPeerSelf",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | ExportChatInviteLink.export_chat_invite_link | Use this method to generate a new invite link for a chat; any previously generated link is revoked.
You must be an administrator in the chat for this to work and have the appropriate admin rights.
Args:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or u... | pyrogram/client/methods/chats/export_chat_invite_link.py | def export_chat_invite_link(
self,
chat_id: Union[int, str]
) -> str:
"""Use this method to generate a new invite link for a chat; any previously generated link is revoked.
You must be an administrator in the chat for this to work and have the appropriate admin rights.
Args... | def export_chat_invite_link(
self,
chat_id: Union[int, str]
) -> str:
"""Use this method to generate a new invite link for a chat; any previously generated link is revoked.
You must be an administrator in the chat for this to work and have the appropriate admin rights.
Args... | [
"Use",
"this",
"method",
"to",
"generate",
"a",
"new",
"invite",
"link",
"for",
"a",
"chat",
";",
"any",
"previously",
"generated",
"link",
"is",
"revoked",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/export_chat_invite_link.py#L26-L58 | [
"def",
"export_chat_invite_link",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
")",
"->",
"str",
":",
"peer",
"=",
"self",
".",
"resolve_peer",
"(",
"chat_id",
")",
"if",
"isinstance",
"(",
"peer",
",",
"types",
".",
"InputPe... | e7258a341ba905cfa86264c22040654db732ec1c |
train | RemoveCloudPassword.remove_cloud_password | Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account.
Args:
password (``str``):
Your current password.
Returns:
True on success.
Raises:
:class:`RPCError <pyrogram.RPCError>` in case of a Te... | pyrogram/client/methods/password/remove_cloud_password.py | def remove_cloud_password(
self,
password: str
) -> bool:
"""Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account.
Args:
password (``str``):
Your current password.
Returns:
True on su... | def remove_cloud_password(
self,
password: str
) -> bool:
"""Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account.
Args:
password (``str``):
Your current password.
Returns:
True on su... | [
"Use",
"this",
"method",
"to",
"turn",
"off",
"the",
"Two",
"-",
"Step",
"Verification",
"security",
"feature",
"(",
"Cloud",
"Password",
")",
"on",
"your",
"account",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/password/remove_cloud_password.py#L25-L58 | [
"def",
"remove_cloud_password",
"(",
"self",
",",
"password",
":",
"str",
")",
"->",
"bool",
":",
"r",
"=",
"self",
".",
"send",
"(",
"functions",
".",
"account",
".",
"GetPassword",
"(",
")",
")",
"if",
"not",
"r",
".",
"has_password",
":",
"raise",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SendPoll.send_poll | Use this method to send a new poll.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists in your Telegram... | pyrogram/client/methods/messages/send_poll.py | def send_poll(
self,
chat_id: Union[int, str],
question: str,
options: List[str],
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
"pyrogram.InlineKeyboardMarkup",
"pyrogram.ReplyKeyboardMarkup",
... | def send_poll(
self,
chat_id: Union[int, str],
question: str,
options: List[str],
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
"pyrogram.InlineKeyboardMarkup",
"pyrogram.ReplyKeyboardMarkup",
... | [
"Use",
"this",
"method",
"to",
"send",
"a",
"new",
"poll",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/send_poll.py#L27-L99 | [
"def",
"send_poll",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"question",
":",
"str",
",",
"options",
":",
"List",
"[",
"str",
"]",
",",
"disable_notification",
":",
"bool",
"=",
"None",
",",
"reply_to_message_id",
":... | e7258a341ba905cfa86264c22040654db732ec1c |
train | DeleteContacts.delete_contacts | Use this method to delete contacts from your Telegram address book.
Args:
ids (List of ``int``):
A list of unique identifiers for the target users.
Can be an ID (int), a username (string) or phone number (string).
Returns:
True on success.
... | pyrogram/client/methods/contacts/delete_contacts.py | def delete_contacts(
self,
ids: List[int]
):
"""Use this method to delete contacts from your Telegram address book.
Args:
ids (List of ``int``):
A list of unique identifiers for the target users.
Can be an ID (int), a username (string) or ... | def delete_contacts(
self,
ids: List[int]
):
"""Use this method to delete contacts from your Telegram address book.
Args:
ids (List of ``int``):
A list of unique identifiers for the target users.
Can be an ID (int), a username (string) or ... | [
"Use",
"this",
"method",
"to",
"delete",
"contacts",
"from",
"your",
"Telegram",
"address",
"book",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/contacts/delete_contacts.py#L27-L59 | [
"def",
"delete_contacts",
"(",
"self",
",",
"ids",
":",
"List",
"[",
"int",
"]",
")",
":",
"contacts",
"=",
"[",
"]",
"for",
"i",
"in",
"ids",
":",
"try",
":",
"input_user",
"=",
"self",
".",
"resolve_peer",
"(",
"i",
")",
"except",
"PeerIdInvalid",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SendMediaGroup.send_media_group | Use this method to send a group of photos or videos as an album.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact... | pyrogram/client/methods/messages/send_media_group.py | def send_media_group(
self,
chat_id: Union[int, str],
media: List[Union["pyrogram.InputMediaPhoto", "pyrogram.InputMediaVideo"]],
disable_notification: bool = None,
reply_to_message_id: int = None
):
"""Use this method to send a group of photos or videos as an album.
... | def send_media_group(
self,
chat_id: Union[int, str],
media: List[Union["pyrogram.InputMediaPhoto", "pyrogram.InputMediaVideo"]],
disable_notification: bool = None,
reply_to_message_id: int = None
):
"""Use this method to send a group of photos or videos as an album.
... | [
"Use",
"this",
"method",
"to",
"send",
"a",
"group",
"of",
"photos",
"or",
"videos",
"as",
"an",
"album",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/send_media_group.py#L37-L216 | [
"def",
"send_media_group",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"media",
":",
"List",
"[",
"Union",
"[",
"\"pyrogram.InputMediaPhoto\"",
",",
"\"pyrogram.InputMediaVideo\"",
"]",
"]",
",",
"disable_notification",
":",
"b... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SetGameScore.set_game_score | Use this method to set the score of the specified user in a game.
Args:
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contac... | pyrogram/client/methods/bots/set_game_score.py | def set_game_score(
self,
user_id: Union[int, str],
score: int,
force: bool = None,
disable_edit_message: bool = None,
chat_id: Union[int, str] = None,
message_id: int = None
):
# inline_message_id: str = None): TODO Add inline_message_id
"""U... | def set_game_score(
self,
user_id: Union[int, str],
score: int,
force: bool = None,
disable_edit_message: bool = None,
chat_id: Union[int, str] = None,
message_id: int = None
):
# inline_message_id: str = None): TODO Add inline_message_id
"""U... | [
"Use",
"this",
"method",
"to",
"set",
"the",
"score",
"of",
"the",
"specified",
"user",
"in",
"a",
"game",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/bots/set_game_score.py#L27-L92 | [
"def",
"set_game_score",
"(",
"self",
",",
"user_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"score",
":",
"int",
",",
"force",
":",
"bool",
"=",
"None",
",",
"disable_edit_message",
":",
"bool",
"=",
"None",
",",
"chat_id",
":",
"Union",
"[... | e7258a341ba905cfa86264c22040654db732ec1c |
train | PinChatMessage.pin_chat_message | Use this method to pin a message in a group, channel or your own chat.
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in
the supergroup or "can_edit_messages" admin right in the channel.
Args:
chat_id (``int`` | ``str``):
... | pyrogram/client/methods/chats/pin_chat_message.py | def pin_chat_message(
self,
chat_id: Union[int, str],
message_id: int,
disable_notification: bool = None
) -> bool:
"""Use this method to pin a message in a group, channel or your own chat.
You must be an administrator in the chat for this to work and must have the "c... | def pin_chat_message(
self,
chat_id: Union[int, str],
message_id: int,
disable_notification: bool = None
) -> bool:
"""Use this method to pin a message in a group, channel or your own chat.
You must be an administrator in the chat for this to work and must have the "c... | [
"Use",
"this",
"method",
"to",
"pin",
"a",
"message",
"in",
"a",
"group",
"channel",
"or",
"your",
"own",
"chat",
".",
"You",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"can_pin_... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/pin_chat_message.py#L26-L61 | [
"def",
"pin_chat_message",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"message_id",
":",
"int",
",",
"disable_notification",
":",
"bool",
"=",
"None",
")",
"->",
"bool",
":",
"self",
".",
"send",
"(",
"functions",
".",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | KickChatMember.kick_chat_member | Use this method to kick a user from a group, a supergroup or a channel.
In the case of supergroups and channels, the user will not be able to return to the group on their own using
invite links, etc., unless unbanned first. You must be an administrator in the chat for this to work and must
have ... | pyrogram/client/methods/chats/kick_chat_member.py | def kick_chat_member(
self,
chat_id: Union[int, str],
user_id: Union[int, str],
until_date: int = 0
) -> Union["pyrogram.Message", bool]:
"""Use this method to kick a user from a group, a supergroup or a channel.
In the case of supergroups and channels, the user will ... | def kick_chat_member(
self,
chat_id: Union[int, str],
user_id: Union[int, str],
until_date: int = 0
) -> Union["pyrogram.Message", bool]:
"""Use this method to kick a user from a group, a supergroup or a channel.
In the case of supergroups and channels, the user will ... | [
"Use",
"this",
"method",
"to",
"kick",
"a",
"user",
"from",
"a",
"group",
"a",
"supergroup",
"or",
"a",
"channel",
".",
"In",
"the",
"case",
"of",
"supergroups",
"and",
"channels",
"the",
"user",
"will",
"not",
"be",
"able",
"to",
"return",
"to",
"the"... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/kick_chat_member.py#L27-L99 | [
"def",
"kick_chat_member",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"user_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"until_date",
":",
"int",
"=",
"0",
")",
"->",
"Union",
"[",
"\"pyrogram.Message\"",
",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | ForwardMessages.forward_messages | Use this method to forward messages of any kind.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists in ... | pyrogram/client/methods/messages/forward_messages.py | def forward_messages(
self,
chat_id: Union[int, str],
from_chat_id: Union[int, str],
message_ids: Iterable[int],
disable_notification: bool = None,
as_copy: bool = False,
remove_caption: bool = False
) -> "pyrogram.Messages":
"""Use this method to forw... | def forward_messages(
self,
chat_id: Union[int, str],
from_chat_id: Union[int, str],
message_ids: Iterable[int],
disable_notification: bool = None,
as_copy: bool = False,
remove_caption: bool = False
) -> "pyrogram.Messages":
"""Use this method to forw... | [
"Use",
"this",
"method",
"to",
"forward",
"messages",
"of",
"any",
"kind",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/forward_messages.py#L27-L129 | [
"def",
"forward_messages",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"from_chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"message_ids",
":",
"Iterable",
"[",
"int",
"]",
",",
"disable_notification",
":",
"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | DownloadMedia.download_media | Use this method to download the media from a message.
Args:
message (:obj:`Message <pyrogram.Message>` | ``str``):
Pass a Message containing the media, the media itself (message.audio, message.video, ...) or
the file id as string.
file_name (``str``, *op... | pyrogram/client/methods/messages/download_media.py | def download_media(
self,
message: Union["pyrogram.Message", str],
file_name: str = "",
block: bool = True,
progress: callable = None,
progress_args: tuple = ()
) -> Union[str, None]:
"""Use this method to download the media from a message.
Args:
... | def download_media(
self,
message: Union["pyrogram.Message", str],
file_name: str = "",
block: bool = True,
progress: callable = None,
progress_args: tuple = ()
) -> Union[str, None]:
"""Use this method to download the media from a message.
Args:
... | [
"Use",
"this",
"method",
"to",
"download",
"the",
"media",
"from",
"a",
"message",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/download_media.py#L27-L149 | [
"def",
"download_media",
"(",
"self",
",",
"message",
":",
"Union",
"[",
"\"pyrogram.Message\"",
",",
"str",
"]",
",",
"file_name",
":",
"str",
"=",
"\"\"",
",",
"block",
":",
"bool",
"=",
"True",
",",
"progress",
":",
"callable",
"=",
"None",
",",
"pr... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SendMessage.send_message | Use this method to send text messages.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists in your Teleg... | pyrogram/client/methods/messages/send_message.py | def send_message(
self,
chat_id: Union[int, str],
text: str,
parse_mode: str = "",
disable_web_page_preview: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
"pyrogram.InlineKeyboardMarkup",
... | def send_message(
self,
chat_id: Union[int, str],
text: str,
parse_mode: str = "",
disable_web_page_preview: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
"pyrogram.InlineKeyboardMarkup",
... | [
"Use",
"this",
"method",
"to",
"send",
"text",
"messages",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/send_message.py#L27-L123 | [
"def",
"send_message",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"text",
":",
"str",
",",
"parse_mode",
":",
"str",
"=",
"\"\"",
",",
"disable_web_page_preview",
":",
"bool",
"=",
"None",
",",
"disable_notification",
":... | e7258a341ba905cfa86264c22040654db732ec1c |
train | EditMessageMedia.edit_message_media | Use this method to edit audio, document, photo, or video messages.
If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise,
message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded.
Use previously uploaded ... | pyrogram/client/methods/messages/edit_message_media.py | def edit_message_media(
self,
chat_id: Union[int, str],
message_id: int,
media: InputMedia,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> "pyrogram.Message":
"""Use this method to edit audio, document, photo, or video messages.
If a message is a p... | def edit_message_media(
self,
chat_id: Union[int, str],
message_id: int,
media: InputMedia,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> "pyrogram.Message":
"""Use this method to edit audio, document, photo, or video messages.
If a message is a p... | [
"Use",
"this",
"method",
"to",
"edit",
"audio",
"document",
"photo",
"or",
"video",
"messages",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/edit_message_media.py#L36-L366 | [
"def",
"edit_message_media",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"message_id",
":",
"int",
",",
"media",
":",
"InputMedia",
",",
"reply_markup",
":",
"\"pyrogram.InlineKeyboardMarkup\"",
"=",
"None",
")",
"->",
"\"pyr... | e7258a341ba905cfa86264c22040654db732ec1c |
train | EnableCloudPassword.enable_cloud_password | Use this method to enable the Two-Step Verification security feature (Cloud Password) on your account.
This password will be asked when you log-in on a new device in addition to the SMS code.
Args:
password (``str``):
Your password.
hint (``str``, *optional*):
... | pyrogram/client/methods/password/enable_cloud_password.py | def enable_cloud_password(
self,
password: str,
hint: str = "",
email: str = None
) -> bool:
"""Use this method to enable the Two-Step Verification security feature (Cloud Password) on your account.
This password will be asked when you log-in on a new device in addit... | def enable_cloud_password(
self,
password: str,
hint: str = "",
email: str = None
) -> bool:
"""Use this method to enable the Two-Step Verification security feature (Cloud Password) on your account.
This password will be asked when you log-in on a new device in addit... | [
"Use",
"this",
"method",
"to",
"enable",
"the",
"Two",
"-",
"Step",
"Verification",
"security",
"feature",
"(",
"Cloud",
"Password",
")",
"on",
"your",
"account",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/password/enable_cloud_password.py#L27-L75 | [
"def",
"enable_cloud_password",
"(",
"self",
",",
"password",
":",
"str",
",",
"hint",
":",
"str",
"=",
"\"\"",
",",
"email",
":",
"str",
"=",
"None",
")",
"->",
"bool",
":",
"r",
"=",
"self",
".",
"send",
"(",
"functions",
".",
"account",
".",
"Ge... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetChatPreview.get_chat_preview | Use this method to get the preview of a chat using the invite link.
This method only returns a chat preview, if you want to join a chat use :meth:`join_chat`
Args:
invite_link (``str``):
Unique identifier for the target chat in form of *t.me/joinchat/* links.
Retur... | pyrogram/client/methods/chats/get_chat_preview.py | def get_chat_preview(
self,
invite_link: str
):
"""Use this method to get the preview of a chat using the invite link.
This method only returns a chat preview, if you want to join a chat use :meth:`join_chat`
Args:
invite_link (``str``):
Unique i... | def get_chat_preview(
self,
invite_link: str
):
"""Use this method to get the preview of a chat using the invite link.
This method only returns a chat preview, if you want to join a chat use :meth:`join_chat`
Args:
invite_link (``str``):
Unique i... | [
"Use",
"this",
"method",
"to",
"get",
"the",
"preview",
"of",
"a",
"chat",
"using",
"the",
"invite",
"link",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/get_chat_preview.py#L25-L65 | [
"def",
"get_chat_preview",
"(",
"self",
",",
"invite_link",
":",
"str",
")",
":",
"match",
"=",
"self",
".",
"INVITE_LINK_RE",
".",
"match",
"(",
"invite_link",
")",
"if",
"match",
":",
"r",
"=",
"self",
".",
"send",
"(",
"functions",
".",
"messages",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SetChatTitle.set_chat_title | Use this method to change the title of a chat.
Titles can't be changed for private chats.
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
Note:
In regular groups (non-supergroups), this method will only work if the "All Members A... | pyrogram/client/methods/chats/set_chat_title.py | def set_chat_title(
self,
chat_id: Union[int, str],
title: str
) -> bool:
"""Use this method to change the title of a chat.
Titles can't be changed for private chats.
You must be an administrator in the chat for this to work and must have the appropriate admin rights.... | def set_chat_title(
self,
chat_id: Union[int, str],
title: str
) -> bool:
"""Use this method to change the title of a chat.
Titles can't be changed for private chats.
You must be an administrator in the chat for this to work and must have the appropriate admin rights.... | [
"Use",
"this",
"method",
"to",
"change",
"the",
"title",
"of",
"a",
"chat",
".",
"Titles",
"can",
"t",
"be",
"changed",
"for",
"private",
"chats",
".",
"You",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/set_chat_title.py#L26-L72 | [
"def",
"set_chat_title",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"title",
":",
"str",
")",
"->",
"bool",
":",
"peer",
"=",
"self",
".",
"resolve_peer",
"(",
"chat_id",
")",
"if",
"isinstance",
"(",
"peer",
",",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetGameHighScores.get_game_high_scores | Use this method to get data for high score tables.
Args:
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists i... | pyrogram/client/methods/bots/get_game_high_scores.py | def get_game_high_scores(
self,
user_id: Union[int, str],
chat_id: Union[int, str],
message_id: int = None
):
"""Use this method to get data for high score tables.
Args:
user_id (``int`` | ``str``):
Unique identifier (int) or username (str... | def get_game_high_scores(
self,
user_id: Union[int, str],
chat_id: Union[int, str],
message_id: int = None
):
"""Use this method to get data for high score tables.
Args:
user_id (``int`` | ``str``):
Unique identifier (int) or username (str... | [
"Use",
"this",
"method",
"to",
"get",
"data",
"for",
"high",
"score",
"tables",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/bots/get_game_high_scores.py#L27-L68 | [
"def",
"get_game_high_scores",
"(",
"self",
",",
"user_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"message_id",
":",
"int",
"=",
"None",
")",
":",
"# TODO: inline_message_id",
"return",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | UnpinChatMessage.unpin_chat_message | Use this method to unpin a message in a group, channel or your own chat.
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin
right in the supergroup or "can_edit_messages" admin right in the channel.
Args:
chat_id (``int`` | ``str``):... | pyrogram/client/methods/chats/unpin_chat_message.py | def unpin_chat_message(
self,
chat_id: Union[int, str]
) -> bool:
"""Use this method to unpin a message in a group, channel or your own chat.
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin
right in the supergroup or "can_e... | def unpin_chat_message(
self,
chat_id: Union[int, str]
) -> bool:
"""Use this method to unpin a message in a group, channel or your own chat.
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin
right in the supergroup or "can_e... | [
"Use",
"this",
"method",
"to",
"unpin",
"a",
"message",
"in",
"a",
"group",
"channel",
"or",
"your",
"own",
"chat",
".",
"You",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"can_pi... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/unpin_chat_message.py#L26-L51 | [
"def",
"unpin_chat_message",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
")",
"->",
"bool",
":",
"self",
".",
"send",
"(",
"functions",
".",
"messages",
".",
"UpdatePinnedMessage",
"(",
"peer",
"=",
"self",
".",
"resolve_peer"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | CallbackQuery.answer | Bound method *answer* of :obj:`CallbackQuery <pyrogram.CallbackQuery>`.
Use this method as a shortcut for:
.. code-block:: python
client.answer_callback_query(
callback_query.id,
text="Hello",
show_alert=True
)
Example:
... | pyrogram/client/types/bots/callback_query.py | def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0):
"""Bound method *answer* of :obj:`CallbackQuery <pyrogram.CallbackQuery>`.
Use this method as a shortcut for:
.. code-block:: python
client.answer_callback_query(
cal... | def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0):
"""Bound method *answer* of :obj:`CallbackQuery <pyrogram.CallbackQuery>`.
Use this method as a shortcut for:
.. code-block:: python
client.answer_callback_query(
cal... | [
"Bound",
"method",
"*",
"answer",
"*",
"of",
":",
"obj",
":",
"CallbackQuery",
"<pyrogram",
".",
"CallbackQuery",
">",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/types/bots/callback_query.py#L123-L165 | [
"def",
"answer",
"(",
"self",
",",
"text",
":",
"str",
"=",
"None",
",",
"show_alert",
":",
"bool",
"=",
"None",
",",
"url",
":",
"str",
"=",
"None",
",",
"cache_time",
":",
"int",
"=",
"0",
")",
":",
"return",
"self",
".",
"_client",
".",
"answe... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetChat.get_chat | Use this method to get up to date information about the chat.
Information include current name of the user for one-on-one conversations, current username of a user, group or
channel, etc.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of... | pyrogram/client/methods/chats/get_chat.py | def get_chat(
self,
chat_id: Union[int, str]
) -> "pyrogram.Chat":
"""Use this method to get up to date information about the chat.
Information include current name of the user for one-on-one conversations, current username of a user, group or
channel, etc.
Args:
... | def get_chat(
self,
chat_id: Union[int, str]
) -> "pyrogram.Chat":
"""Use this method to get up to date information about the chat.
Information include current name of the user for one-on-one conversations, current username of a user, group or
channel, etc.
Args:
... | [
"Use",
"this",
"method",
"to",
"get",
"up",
"to",
"date",
"information",
"about",
"the",
"chat",
".",
"Information",
"include",
"current",
"name",
"of",
"the",
"user",
"for",
"one",
"-",
"on",
"-",
"one",
"conversations",
"current",
"username",
"of",
"a",
... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/get_chat.py#L27-L79 | [
"def",
"get_chat",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
")",
"->",
"\"pyrogram.Chat\"",
":",
"match",
"=",
"self",
".",
"INVITE_LINK_RE",
".",
"match",
"(",
"str",
"(",
"chat_id",
")",
")",
"if",
"match",
":",
"h",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | AnswerCallbackQuery.answer_callback_query | Use this method to send answers to callback queries sent from inline keyboards.
The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
Args:
callback_query_id (``str``):
Unique identifier for the query to be answered.
... | pyrogram/client/methods/bots/answer_callback_query.py | def answer_callback_query(
self,
callback_query_id: str,
text: str = None,
show_alert: bool = None,
url: str = None,
cache_time: int = 0
):
"""Use this method to send answers to callback queries sent from inline keyboards.
The answer will be displayed ... | def answer_callback_query(
self,
callback_query_id: str,
text: str = None,
show_alert: bool = None,
url: str = None,
cache_time: int = 0
):
"""Use this method to send answers to callback queries sent from inline keyboards.
The answer will be displayed ... | [
"Use",
"this",
"method",
"to",
"send",
"answers",
"to",
"callback",
"queries",
"sent",
"from",
"inline",
"keyboards",
".",
"The",
"answer",
"will",
"be",
"displayed",
"to",
"the",
"user",
"as",
"a",
"notification",
"at",
"the",
"top",
"of",
"the",
"chat",
... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/bots/answer_callback_query.py#L24-L70 | [
"def",
"answer_callback_query",
"(",
"self",
",",
"callback_query_id",
":",
"str",
",",
"text",
":",
"str",
"=",
"None",
",",
"show_alert",
":",
"bool",
"=",
"None",
",",
"url",
":",
"str",
"=",
"None",
",",
"cache_time",
":",
"int",
"=",
"0",
")",
"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | create | Use this method to create a Filter.
Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
Args:
name (``str``):
Your filter's name. Can be anything you like.
func (``callable``):
A function that accepts two argume... | pyrogram/client/filters/filters.py | def create(name: str, func: callable, **kwargs) -> type:
"""Use this method to create a Filter.
Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
Args:
name (``str``):
Your filter's name. Can be anything you like.
fun... | def create(name: str, func: callable, **kwargs) -> type:
"""Use this method to create a Filter.
Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
Args:
name (``str``):
Your filter's name. Can be anything you like.
fun... | [
"Use",
"this",
"method",
"to",
"create",
"a",
"Filter",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/filters/filters.py#L25-L51 | [
"def",
"create",
"(",
"name",
":",
"str",
",",
"func",
":",
"callable",
",",
"*",
"*",
"kwargs",
")",
"->",
"type",
":",
"# TODO: unpack kwargs using **kwargs into the dict itself. For Python 3.5+ only",
"d",
"=",
"{",
"\"__call__\"",
":",
"func",
"}",
"d",
".",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | Filters.command | Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
Args:
commands (``str`` | ``list``):
The command or list of commands as string the filter should look for.
Examples: "start", ["start", "help", "settings"]. When a message text contain... | pyrogram/client/filters/filters.py | def command(
commands: str or list,
prefix: str or list = "/",
separator: str = " ",
case_sensitive: bool = False
):
"""Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
Args:
commands (``str`` | ``list``):
... | def command(
commands: str or list,
prefix: str or list = "/",
separator: str = " ",
case_sensitive: bool = False
):
"""Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
Args:
commands (``str`` | ``list``):
... | [
"Filter",
"commands",
"i",
".",
"e",
".",
":",
"text",
"messages",
"starting",
"with",
"/",
"or",
"any",
"other",
"custom",
"prefix",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/filters/filters.py#L225-L272 | [
"def",
"command",
"(",
"commands",
":",
"str",
"or",
"list",
",",
"prefix",
":",
"str",
"or",
"list",
"=",
"\"/\"",
",",
"separator",
":",
"str",
"=",
"\" \"",
",",
"case_sensitive",
":",
"bool",
"=",
"False",
")",
":",
"def",
"func",
"(",
"flt",
"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | Filters.regex | Filter messages that match a given RegEx pattern.
Args:
pattern (``str``):
The RegEx pattern as string, it will be applied to the text of a message. When a pattern matches,
all the `Match Objects <https://docs.python.org/3/library/re.html#match-objects>`_
... | pyrogram/client/filters/filters.py | def regex(pattern, flags: int = 0):
"""Filter messages that match a given RegEx pattern.
Args:
pattern (``str``):
The RegEx pattern as string, it will be applied to the text of a message. When a pattern matches,
all the `Match Objects <https://docs.python.org... | def regex(pattern, flags: int = 0):
"""Filter messages that match a given RegEx pattern.
Args:
pattern (``str``):
The RegEx pattern as string, it will be applied to the text of a message. When a pattern matches,
all the `Match Objects <https://docs.python.org... | [
"Filter",
"messages",
"that",
"match",
"a",
"given",
"RegEx",
"pattern",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/filters/filters.py#L275-L292 | [
"def",
"regex",
"(",
"pattern",
",",
"flags",
":",
"int",
"=",
"0",
")",
":",
"def",
"f",
"(",
"_",
",",
"m",
")",
":",
"m",
".",
"matches",
"=",
"[",
"i",
"for",
"i",
"in",
"_",
".",
"p",
".",
"finditer",
"(",
"m",
".",
"text",
"or",
"m"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | ChangeCloudPassword.change_cloud_password | Use this method to change your Two-Step Verification password (Cloud Password) with a new one.
Args:
current_password (``str``):
Your current password.
new_password (``str``):
Your new password.
new_hint (``str``, *optional*):
... | pyrogram/client/methods/password/change_cloud_password.py | def change_cloud_password(
self,
current_password: str,
new_password: str,
new_hint: str = ""
) -> bool:
"""Use this method to change your Two-Step Verification password (Cloud Password) with a new one.
Args:
current_password (``str``):
Yo... | def change_cloud_password(
self,
current_password: str,
new_password: str,
new_hint: str = ""
) -> bool:
"""Use this method to change your Two-Step Verification password (Cloud Password) with a new one.
Args:
current_password (``str``):
Yo... | [
"Use",
"this",
"method",
"to",
"change",
"your",
"Two",
"-",
"Step",
"Verification",
"password",
"(",
"Cloud",
"Password",
")",
"with",
"a",
"new",
"one",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/password/change_cloud_password.py#L27-L72 | [
"def",
"change_cloud_password",
"(",
"self",
",",
"current_password",
":",
"str",
",",
"new_password",
":",
"str",
",",
"new_hint",
":",
"str",
"=",
"\"\"",
")",
"->",
"bool",
":",
"r",
"=",
"self",
".",
"send",
"(",
"functions",
".",
"account",
".",
"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetChatMember.get_chat_member | Use this method to get information about one member of a chat.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
user_id (``int`` | ``str``)::
Unique identifier (int) or username (str) of the target chat.
... | pyrogram/client/methods/chats/get_chat_member.py | def get_chat_member(
self,
chat_id: Union[int, str],
user_id: Union[int, str]
) -> "pyrogram.ChatMember":
"""Use this method to get information about one member of a chat.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str... | def get_chat_member(
self,
chat_id: Union[int, str],
user_id: Union[int, str]
) -> "pyrogram.ChatMember":
"""Use this method to get information about one member of a chat.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str... | [
"Use",
"this",
"method",
"to",
"get",
"information",
"about",
"one",
"member",
"of",
"a",
"chat",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/get_chat_member.py#L28-L77 | [
"def",
"get_chat_member",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"user_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
")",
"->",
"\"pyrogram.ChatMember\"",
":",
"chat_id",
"=",
"self",
".",
"resolve_peer",
"(",
"c... | e7258a341ba905cfa86264c22040654db732ec1c |
train | IterChatMembers.iter_chat_members | Use this method to iterate through the members of a chat sequentially.
This convenience method does the same as repeatedly calling :meth:`get_chat_members` in a loop, thus saving you
from the hassle of setting up boilerplate code. It is useful for getting the whole members list of a chat with
a... | pyrogram/client/methods/chats/iter_chat_members.py | def iter_chat_members(
self,
chat_id: Union[int, str],
limit: int = 0,
query: str = "",
filter: str = Filters.ALL
) -> Generator["pyrogram.ChatMember", None, None]:
"""Use this method to iterate through the members of a chat sequentially.
This convenience met... | def iter_chat_members(
self,
chat_id: Union[int, str],
limit: int = 0,
query: str = "",
filter: str = Filters.ALL
) -> Generator["pyrogram.ChatMember", None, None]:
"""Use this method to iterate through the members of a chat sequentially.
This convenience met... | [
"Use",
"this",
"method",
"to",
"iterate",
"through",
"the",
"members",
"of",
"a",
"chat",
"sequentially",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/iter_chat_members.py#L41-L132 | [
"def",
"iter_chat_members",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"limit",
":",
"int",
"=",
"0",
",",
"query",
":",
"str",
"=",
"\"\"",
",",
"filter",
":",
"str",
"=",
"Filters",
".",
"ALL",
")",
"->",
"Gene... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _type_check | Check that the argument is a type, and return it (internal helper).
As a special case, accept None and return type(None) instead.
Also, _TypeAlias instances (e.g. Match, Pattern) are acceptable.
The msg argument is a human-readable error message, e.g.
"Union[arg, ...]: arg should be a type."
... | pyrogram/vendor/typing/typing.py | def _type_check(arg, msg):
"""Check that the argument is a type, and return it (internal helper).
As a special case, accept None and return type(None) instead.
Also, _TypeAlias instances (e.g. Match, Pattern) are acceptable.
The msg argument is a human-readable error message, e.g.
"Union[arg,... | def _type_check(arg, msg):
"""Check that the argument is a type, and return it (internal helper).
As a special case, accept None and return type(None) instead.
Also, _TypeAlias instances (e.g. Match, Pattern) are acceptable.
The msg argument is a human-readable error message, e.g.
"Union[arg,... | [
"Check",
"that",
"the",
"argument",
"is",
"a",
"type",
"and",
"return",
"it",
"(",
"internal",
"helper",
")",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L356-L384 | [
"def",
"_type_check",
"(",
"arg",
",",
"msg",
")",
":",
"if",
"arg",
"is",
"None",
":",
"return",
"type",
"(",
"None",
")",
"if",
"isinstance",
"(",
"arg",
",",
"str",
")",
":",
"arg",
"=",
"_ForwardRef",
"(",
"arg",
")",
"if",
"(",
"isinstance",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _type_repr | Return the repr() of an object, special-casing types (internal helper).
If obj is a type, we return a shorter version than the default
type.__repr__, based on the module and qualified name, which is
typically enough to uniquely identify a type. For everything
else, we fall back on repr(obj). | pyrogram/vendor/typing/typing.py | def _type_repr(obj):
"""Return the repr() of an object, special-casing types (internal helper).
If obj is a type, we return a shorter version than the default
type.__repr__, based on the module and qualified name, which is
typically enough to uniquely identify a type. For everything
else, we fall ... | def _type_repr(obj):
"""Return the repr() of an object, special-casing types (internal helper).
If obj is a type, we return a shorter version than the default
type.__repr__, based on the module and qualified name, which is
typically enough to uniquely identify a type. For everything
else, we fall ... | [
"Return",
"the",
"repr",
"()",
"of",
"an",
"object",
"special",
"-",
"casing",
"types",
"(",
"internal",
"helper",
")",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L387-L403 | [
"def",
"_type_repr",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"type",
")",
"and",
"not",
"isinstance",
"(",
"obj",
",",
"TypingMeta",
")",
":",
"if",
"obj",
".",
"__module__",
"==",
"'builtins'",
":",
"return",
"_qualname",
"(",
"obj"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _replace_arg | An internal helper function: replace arg if it is a type variable
found in tvars with corresponding substitution from args or
with corresponding substitution sub-tree if arg is a generic type. | pyrogram/vendor/typing/typing.py | def _replace_arg(arg, tvars, args):
"""An internal helper function: replace arg if it is a type variable
found in tvars with corresponding substitution from args or
with corresponding substitution sub-tree if arg is a generic type.
"""
if tvars is None:
tvars = []
if hasattr(arg, '_subs... | def _replace_arg(arg, tvars, args):
"""An internal helper function: replace arg if it is a type variable
found in tvars with corresponding substitution from args or
with corresponding substitution sub-tree if arg is a generic type.
"""
if tvars is None:
tvars = []
if hasattr(arg, '_subs... | [
"An",
"internal",
"helper",
"function",
":",
"replace",
"arg",
"if",
"it",
"is",
"a",
"type",
"variable",
"found",
"in",
"tvars",
"with",
"corresponding",
"substitution",
"from",
"args",
"or",
"with",
"corresponding",
"substitution",
"sub",
"-",
"tree",
"if",
... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L555-L569 | [
"def",
"_replace_arg",
"(",
"arg",
",",
"tvars",
",",
"args",
")",
":",
"if",
"tvars",
"is",
"None",
":",
"tvars",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"arg",
",",
"'_subs_tree'",
")",
"and",
"isinstance",
"(",
"arg",
",",
"(",
"GenericMeta",
",",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _subs_tree | An internal helper function: calculate substitution tree
for generic cls after replacing its type parameters with
substitutions in tvars -> args (if any).
Repeat the same following __origin__'s.
Return a list of arguments with all possible substitutions
performed. Arguments that are generic classes... | pyrogram/vendor/typing/typing.py | def _subs_tree(cls, tvars=None, args=None):
"""An internal helper function: calculate substitution tree
for generic cls after replacing its type parameters with
substitutions in tvars -> args (if any).
Repeat the same following __origin__'s.
Return a list of arguments with all possible substitution... | def _subs_tree(cls, tvars=None, args=None):
"""An internal helper function: calculate substitution tree
for generic cls after replacing its type parameters with
substitutions in tvars -> args (if any).
Repeat the same following __origin__'s.
Return a list of arguments with all possible substitution... | [
"An",
"internal",
"helper",
"function",
":",
"calculate",
"substitution",
"tree",
"for",
"generic",
"cls",
"after",
"replacing",
"its",
"type",
"parameters",
"with",
"substitutions",
"in",
"tvars",
"-",
">",
"args",
"(",
"if",
"any",
")",
".",
"Repeat",
"the... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L582-L612 | [
"def",
"_subs_tree",
"(",
"cls",
",",
"tvars",
"=",
"None",
",",
"args",
"=",
"None",
")",
":",
"if",
"cls",
".",
"__origin__",
"is",
"None",
":",
"return",
"cls",
"# Make of chain of origins (i.e. cls -> cls.__origin__)",
"current",
"=",
"cls",
".",
"__origin... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _remove_dups_flatten | An internal helper for Union creation and substitution: flatten Union's
among parameters, then remove duplicates and strict subclasses. | pyrogram/vendor/typing/typing.py | def _remove_dups_flatten(parameters):
"""An internal helper for Union creation and substitution: flatten Union's
among parameters, then remove duplicates and strict subclasses.
"""
# Flatten out Union[Union[...], ...].
params = []
for p in parameters:
if isinstance(p, _Union) and p.__or... | def _remove_dups_flatten(parameters):
"""An internal helper for Union creation and substitution: flatten Union's
among parameters, then remove duplicates and strict subclasses.
"""
# Flatten out Union[Union[...], ...].
params = []
for p in parameters:
if isinstance(p, _Union) and p.__or... | [
"An",
"internal",
"helper",
"for",
"Union",
"creation",
"and",
"substitution",
":",
"flatten",
"Union",
"s",
"among",
"parameters",
"then",
"remove",
"duplicates",
"and",
"strict",
"subclasses",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L615-L653 | [
"def",
"_remove_dups_flatten",
"(",
"parameters",
")",
":",
"# Flatten out Union[Union[...], ...].",
"params",
"=",
"[",
"]",
"for",
"p",
"in",
"parameters",
":",
"if",
"isinstance",
"(",
"p",
",",
"_Union",
")",
"and",
"p",
".",
"__origin__",
"is",
"Union",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _tp_cache | Internal wrapper caching __getitem__ of generic types with a fallback to
original function for non-hashable arguments. | pyrogram/vendor/typing/typing.py | def _tp_cache(func):
"""Internal wrapper caching __getitem__ of generic types with a fallback to
original function for non-hashable arguments.
"""
cached = functools.lru_cache()(func)
_cleanups.append(cached.cache_clear)
@functools.wraps(func)
def inner(*args, **kwds):
try:
... | def _tp_cache(func):
"""Internal wrapper caching __getitem__ of generic types with a fallback to
original function for non-hashable arguments.
"""
cached = functools.lru_cache()(func)
_cleanups.append(cached.cache_clear)
@functools.wraps(func)
def inner(*args, **kwds):
try:
... | [
"Internal",
"wrapper",
"caching",
"__getitem__",
"of",
"generic",
"types",
"with",
"a",
"fallback",
"to",
"original",
"function",
"for",
"non",
"-",
"hashable",
"arguments",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L670-L686 | [
"def",
"_tp_cache",
"(",
"func",
")",
":",
"cached",
"=",
"functools",
".",
"lru_cache",
"(",
")",
"(",
"func",
")",
"_cleanups",
".",
"append",
"(",
"cached",
".",
"cache_clear",
")",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"inner",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _make_subclasshook | Construct a __subclasshook__ callable that incorporates
the associated __extra__ class in subclass checks performed
against cls. | pyrogram/vendor/typing/typing.py | def _make_subclasshook(cls):
"""Construct a __subclasshook__ callable that incorporates
the associated __extra__ class in subclass checks performed
against cls.
"""
if isinstance(cls.__extra__, abc.ABCMeta):
# The logic mirrors that of ABCMeta.__subclasscheck__.
# Registered classes ... | def _make_subclasshook(cls):
"""Construct a __subclasshook__ callable that incorporates
the associated __extra__ class in subclass checks performed
against cls.
"""
if isinstance(cls.__extra__, abc.ABCMeta):
# The logic mirrors that of ABCMeta.__subclasscheck__.
# Registered classes ... | [
"Construct",
"a",
"__subclasshook__",
"callable",
"that",
"incorporates",
"the",
"associated",
"__extra__",
"class",
"in",
"subclass",
"checks",
"performed",
"against",
"cls",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L869-L896 | [
"def",
"_make_subclasshook",
"(",
"cls",
")",
":",
"if",
"isinstance",
"(",
"cls",
".",
"__extra__",
",",
"abc",
".",
"ABCMeta",
")",
":",
"# The logic mirrors that of ABCMeta.__subclasscheck__.",
"# Registered classes need not be checked here because",
"# cls and its extra s... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _no_slots_copy | Internal helper: copy class __dict__ and clean slots class variables.
(They will be re-created if necessary by normal class machinery.) | pyrogram/vendor/typing/typing.py | def _no_slots_copy(dct):
"""Internal helper: copy class __dict__ and clean slots class variables.
(They will be re-created if necessary by normal class machinery.)
"""
dict_copy = dict(dct)
if '__slots__' in dict_copy:
for slot in dict_copy['__slots__']:
dict_copy.pop(slot, None)... | def _no_slots_copy(dct):
"""Internal helper: copy class __dict__ and clean slots class variables.
(They will be re-created if necessary by normal class machinery.)
"""
dict_copy = dict(dct)
if '__slots__' in dict_copy:
for slot in dict_copy['__slots__']:
dict_copy.pop(slot, None)... | [
"Internal",
"helper",
":",
"copy",
"class",
"__dict__",
"and",
"clean",
"slots",
"class",
"variables",
".",
"(",
"They",
"will",
"be",
"re",
"-",
"created",
"if",
"necessary",
"by",
"normal",
"class",
"machinery",
".",
")"
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L899-L907 | [
"def",
"_no_slots_copy",
"(",
"dct",
")",
":",
"dict_copy",
"=",
"dict",
"(",
"dct",
")",
"if",
"'__slots__'",
"in",
"dict_copy",
":",
"for",
"slot",
"in",
"dict_copy",
"[",
"'__slots__'",
"]",
":",
"dict_copy",
".",
"pop",
"(",
"slot",
",",
"None",
")... | e7258a341ba905cfa86264c22040654db732ec1c |
train | _get_defaults | Internal helper to extract the default arguments, by name. | pyrogram/vendor/typing/typing.py | def _get_defaults(func):
"""Internal helper to extract the default arguments, by name."""
try:
code = func.__code__
except AttributeError:
# Some built-in functions don't have __code__, __defaults__, etc.
return {}
pos_count = code.co_argcount
arg_names = code.co_varnames
... | def _get_defaults(func):
"""Internal helper to extract the default arguments, by name."""
try:
code = func.__code__
except AttributeError:
# Some built-in functions don't have __code__, __defaults__, etc.
return {}
pos_count = code.co_argcount
arg_names = code.co_varnames
... | [
"Internal",
"helper",
"to",
"extract",
"the",
"default",
"arguments",
"by",
"name",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L1446-L1463 | [
"def",
"_get_defaults",
"(",
"func",
")",
":",
"try",
":",
"code",
"=",
"func",
".",
"__code__",
"except",
"AttributeError",
":",
"# Some built-in functions don't have __code__, __defaults__, etc.",
"return",
"{",
"}",
"pos_count",
"=",
"code",
".",
"co_argcount",
"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | get_type_hints | Return type hints for an object.
This is often the same as obj.__annotations__, but it handles
forward references encoded as string literals, and if necessary
adds Optional[t] if a default value equal to None is set.
The argument may be a module, class, method, or function. The annotations
are ret... | pyrogram/vendor/typing/typing.py | def get_type_hints(obj, globalns=None, localns=None):
"""Return type hints for an object.
This is often the same as obj.__annotations__, but it handles
forward references encoded as string literals, and if necessary
adds Optional[t] if a default value equal to None is set.
The argument may be a mo... | def get_type_hints(obj, globalns=None, localns=None):
"""Return type hints for an object.
This is often the same as obj.__annotations__, but it handles
forward references encoded as string literals, and if necessary
adds Optional[t] if a default value equal to None is set.
The argument may be a mo... | [
"Return",
"type",
"hints",
"for",
"an",
"object",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L1471-L1550 | [
"def",
"get_type_hints",
"(",
"obj",
",",
"globalns",
"=",
"None",
",",
"localns",
"=",
"None",
")",
":",
"if",
"getattr",
"(",
"obj",
",",
"'__no_type_check__'",
",",
"None",
")",
":",
"return",
"{",
"}",
"# Classes require a special treatment.",
"if",
"isi... | e7258a341ba905cfa86264c22040654db732ec1c |
train | no_type_check | Decorator to indicate that annotations are not type hints.
The argument must be a class or function; if it is a class, it
applies recursively to all methods and classes defined in that class
(but not to methods defined in its superclasses or subclasses).
This mutates the function(s) or class(es) in pl... | pyrogram/vendor/typing/typing.py | def no_type_check(arg):
"""Decorator to indicate that annotations are not type hints.
The argument must be a class or function; if it is a class, it
applies recursively to all methods and classes defined in that class
(but not to methods defined in its superclasses or subclasses).
This mutates the... | def no_type_check(arg):
"""Decorator to indicate that annotations are not type hints.
The argument must be a class or function; if it is a class, it
applies recursively to all methods and classes defined in that class
(but not to methods defined in its superclasses or subclasses).
This mutates the... | [
"Decorator",
"to",
"indicate",
"that",
"annotations",
"are",
"not",
"type",
"hints",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L1553-L1576 | [
"def",
"no_type_check",
"(",
"arg",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"type",
")",
":",
"arg_attrs",
"=",
"arg",
".",
"__dict__",
".",
"copy",
"(",
")",
"for",
"attr",
",",
"val",
"in",
"arg",
".",
"__dict__",
".",
"items",
"(",
")",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | no_type_check_decorator | Decorator to give another decorator the @no_type_check effect.
This wraps the decorator with something that wraps the decorated
function in @no_type_check. | pyrogram/vendor/typing/typing.py | def no_type_check_decorator(decorator):
"""Decorator to give another decorator the @no_type_check effect.
This wraps the decorator with something that wraps the decorated
function in @no_type_check.
"""
@functools.wraps(decorator)
def wrapped_decorator(*args, **kwds):
func = decorator(... | def no_type_check_decorator(decorator):
"""Decorator to give another decorator the @no_type_check effect.
This wraps the decorator with something that wraps the decorated
function in @no_type_check.
"""
@functools.wraps(decorator)
def wrapped_decorator(*args, **kwds):
func = decorator(... | [
"Decorator",
"to",
"give",
"another",
"decorator",
"the",
"@no_type_check",
"effect",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L1579-L1592 | [
"def",
"no_type_check_decorator",
"(",
"decorator",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"decorator",
")",
"def",
"wrapped_decorator",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"func",
"=",
"decorator",
"(",
"*",
"args",
",",
"*",
"*... | e7258a341ba905cfa86264c22040654db732ec1c |
train | NewType | NewType creates simple unique types with almost zero
runtime overhead. NewType(name, tp) is considered a subtype of tp
by static type checkers. At runtime, NewType(name, tp) returns
a dummy function that simply returns its argument. Usage::
UserId = NewType('UserId', int)
def name_by_id(us... | pyrogram/vendor/typing/typing.py | def NewType(name, tp):
"""NewType creates simple unique types with almost zero
runtime overhead. NewType(name, tp) is considered a subtype of tp
by static type checkers. At runtime, NewType(name, tp) returns
a dummy function that simply returns its argument. Usage::
UserId = NewType('UserId', i... | def NewType(name, tp):
"""NewType creates simple unique types with almost zero
runtime overhead. NewType(name, tp) is considered a subtype of tp
by static type checkers. At runtime, NewType(name, tp) returns
a dummy function that simply returns its argument. Usage::
UserId = NewType('UserId', i... | [
"NewType",
"creates",
"simple",
"unique",
"types",
"with",
"almost",
"zero",
"runtime",
"overhead",
".",
"NewType",
"(",
"name",
"tp",
")",
"is",
"considered",
"a",
"subtype",
"of",
"tp",
"by",
"static",
"type",
"checkers",
".",
"At",
"runtime",
"NewType",
... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L2205-L2229 | [
"def",
"NewType",
"(",
"name",
",",
"tp",
")",
":",
"def",
"new_type",
"(",
"x",
")",
":",
"return",
"x",
"new_type",
".",
"__name__",
"=",
"name",
"new_type",
".",
"__supertype__",
"=",
"tp",
"return",
"new_type"
] | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetMessages.get_messages | Use this method to get one or more messages that belong to a specific chat.
You can retrieve up to 200 messages at once.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) ... | pyrogram/client/methods/messages/get_messages.py | def get_messages(
self,
chat_id: Union[int, str],
message_ids: Union[int, Iterable[int]] = None,
reply_to_message_ids: Union[int, Iterable[int]] = None,
replies: int = 1
) -> Union["pyrogram.Message", "pyrogram.Messages"]:
"""Use this method to get one or more message... | def get_messages(
self,
chat_id: Union[int, str],
message_ids: Union[int, Iterable[int]] = None,
reply_to_message_ids: Union[int, Iterable[int]] = None,
replies: int = 1
) -> Union["pyrogram.Message", "pyrogram.Messages"]:
"""Use this method to get one or more message... | [
"Use",
"this",
"method",
"to",
"get",
"one",
"or",
"more",
"messages",
"that",
"belong",
"to",
"a",
"specific",
"chat",
".",
"You",
"can",
"retrieve",
"up",
"to",
"200",
"messages",
"at",
"once",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/get_messages.py#L32-L99 | [
"def",
"get_messages",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"message_ids",
":",
"Union",
"[",
"int",
",",
"Iterable",
"[",
"int",
"]",
"]",
"=",
"None",
",",
"reply_to_message_ids",
":",
"Union",
"[",
"int",
",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SendVenue.send_venue | Use this method to send information about a venue.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists i... | pyrogram/client/methods/messages/send_venue.py | def send_venue(
self,
chat_id: Union[int, str],
latitude: float,
longitude: float,
title: str,
address: str,
foursquare_id: str = "",
foursquare_type: str = "",
disable_notification: bool = None,
reply_to_message_id: int = None,
rep... | def send_venue(
self,
chat_id: Union[int, str],
latitude: float,
longitude: float,
title: str,
address: str,
foursquare_id: str = "",
foursquare_type: str = "",
disable_notification: bool = None,
reply_to_message_id: int = None,
rep... | [
"Use",
"this",
"method",
"to",
"send",
"information",
"about",
"a",
"venue",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/send_venue.py#L27-L117 | [
"def",
"send_venue",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"latitude",
":",
"float",
",",
"longitude",
":",
"float",
",",
"title",
":",
"str",
",",
"address",
":",
"str",
",",
"foursquare_id",
":",
"str",
"=",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetInlineBotResults.get_inline_bot_results | Use this method to get bot results via inline queries.
You can then send a result using :obj:`send_inline_bot_result <pyrogram.Client.send_inline_bot_result>`
Args:
bot (``int`` | ``str``):
Unique identifier of the inline bot you want to get results from. You can specify
... | pyrogram/client/methods/bots/get_inline_bot_results.py | def get_inline_bot_results(
self,
bot: Union[int, str],
query: str,
offset: str = "",
latitude: float = None,
longitude: float = None
):
"""Use this method to get bot results via inline queries.
You can then send a result using :obj:`send_inline_bot_re... | def get_inline_bot_results(
self,
bot: Union[int, str],
query: str,
offset: str = "",
latitude: float = None,
longitude: float = None
):
"""Use this method to get bot results via inline queries.
You can then send a result using :obj:`send_inline_bot_re... | [
"Use",
"this",
"method",
"to",
"get",
"bot",
"results",
"via",
"inline",
"queries",
".",
"You",
"can",
"then",
"send",
"a",
"result",
"using",
":",
"obj",
":",
"send_inline_bot_result",
"<pyrogram",
".",
"Client",
".",
"send_inline_bot_result",
">"
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/bots/get_inline_bot_results.py#L27-L84 | [
"def",
"get_inline_bot_results",
"(",
"self",
",",
"bot",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"query",
":",
"str",
",",
"offset",
":",
"str",
"=",
"\"\"",
",",
"latitude",
":",
"float",
"=",
"None",
",",
"longitude",
":",
"float",
"=",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | JoinChat.join_chat | Use this method to join a group chat or channel.
Args:
chat_id (``str``):
Unique identifier for the target chat in form of a *t.me/joinchat/* link or username of the target
channel/supergroup (in the format @username).
Returns:
On success, a :obj... | pyrogram/client/methods/chats/join_chat.py | def join_chat(
self,
chat_id: str
):
"""Use this method to join a group chat or channel.
Args:
chat_id (``str``):
Unique identifier for the target chat in form of a *t.me/joinchat/* link or username of the target
channel/supergroup (in the... | def join_chat(
self,
chat_id: str
):
"""Use this method to join a group chat or channel.
Args:
chat_id (``str``):
Unique identifier for the target chat in form of a *t.me/joinchat/* link or username of the target
channel/supergroup (in the... | [
"Use",
"this",
"method",
"to",
"join",
"a",
"group",
"chat",
"or",
"channel",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/join_chat.py#L25-L72 | [
"def",
"join_chat",
"(",
"self",
",",
"chat_id",
":",
"str",
")",
":",
"match",
"=",
"self",
".",
"INVITE_LINK_RE",
".",
"match",
"(",
"chat_id",
")",
"if",
"match",
":",
"chat",
"=",
"self",
".",
"send",
"(",
"functions",
".",
"messages",
".",
"Impo... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetContacts.get_contacts | Use this method to get contacts from your Telegram address book.
Returns:
On success, a list of :obj:`User` objects is returned.
Raises:
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error. | pyrogram/client/methods/contacts/get_contacts.py | def get_contacts(self):
"""Use this method to get contacts from your Telegram address book.
Returns:
On success, a list of :obj:`User` objects is returned.
Raises:
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
"""
while True:
... | def get_contacts(self):
"""Use this method to get contacts from your Telegram address book.
Returns:
On success, a list of :obj:`User` objects is returned.
Raises:
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
"""
while True:
... | [
"Use",
"this",
"method",
"to",
"get",
"contacts",
"from",
"your",
"Telegram",
"address",
"book",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/contacts/get_contacts.py#L31-L48 | [
"def",
"get_contacts",
"(",
"self",
")",
":",
"while",
"True",
":",
"try",
":",
"contacts",
"=",
"self",
".",
"send",
"(",
"functions",
".",
"contacts",
".",
"GetContacts",
"(",
"hash",
"=",
"0",
")",
")",
"except",
"FloodWait",
"as",
"e",
":",
"log"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | UpdateChatUsername.update_chat_username | Use this method to update a channel or a supergroup username.
To update your own username (for users only, not bots) you can use :meth:`update_username`.
Args:
chat_id (``int`` | ``str``)
Unique identifier (int) or username (str) of the target chat.
user... | pyrogram/client/methods/chats/update_chat_username.py | def update_chat_username(
self,
chat_id: Union[int, str],
username: Union[str, None]
) -> bool:
"""Use this method to update a channel or a supergroup username.
To update your own username (for users only, not bots) you can use :meth:`update_username`.
Args:... | def update_chat_username(
self,
chat_id: Union[int, str],
username: Union[str, None]
) -> bool:
"""Use this method to update a channel or a supergroup username.
To update your own username (for users only, not bots) you can use :meth:`update_username`.
Args:... | [
"Use",
"this",
"method",
"to",
"update",
"a",
"channel",
"or",
"a",
"supergroup",
"username",
".",
"To",
"update",
"your",
"own",
"username",
"(",
"for",
"users",
"only",
"not",
"bots",
")",
"you",
"can",
"use",
":",
"meth",
":",
"update_username",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/update_chat_username.py#L26-L61 | [
"def",
"update_chat_username",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"username",
":",
"Union",
"[",
"str",
",",
"None",
"]",
")",
"->",
"bool",
":",
"peer",
"=",
"self",
".",
"resolve_peer",
"(",
"chat_id",
")",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SendGame.send_game | Use this method to send a game.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists in your Telegram add... | pyrogram/client/methods/bots/send_game.py | def send_game(
self,
chat_id: Union[int, str],
game_short_name: str,
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
"pyrogram.InlineKeyboardMarkup",
"pyrogram.ReplyKeyboardMarkup",
"pyrogram.Rep... | def send_game(
self,
chat_id: Union[int, str],
game_short_name: str,
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
"pyrogram.InlineKeyboardMarkup",
"pyrogram.ReplyKeyboardMarkup",
"pyrogram.Rep... | [
"Use",
"this",
"method",
"to",
"send",
"a",
"game",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/bots/send_game.py#L27-L91 | [
"def",
"send_game",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"game_short_name",
":",
"str",
",",
"disable_notification",
":",
"bool",
"=",
"None",
",",
"reply_to_message_id",
":",
"int",
"=",
"None",
",",
"reply_markup",... | e7258a341ba905cfa86264c22040654db732ec1c |
train | EditMessageReplyMarkup.edit_message_reply_markup | Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "m... | pyrogram/client/methods/messages/edit_message_reply_markup.py | def edit_message_reply_markup(
self,
chat_id: Union[int, str],
message_id: int,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> "pyrogram.Message":
"""Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
... | def edit_message_reply_markup(
self,
chat_id: Union[int, str],
message_id: int,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> "pyrogram.Message":
"""Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
... | [
"Use",
"this",
"method",
"to",
"edit",
"only",
"the",
"reply",
"markup",
"of",
"messages",
"sent",
"by",
"the",
"bot",
"or",
"via",
"the",
"bot",
"(",
"for",
"inline",
"bots",
")",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/edit_message_reply_markup.py#L27-L69 | [
"def",
"edit_message_reply_markup",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"message_id",
":",
"int",
",",
"reply_markup",
":",
"\"pyrogram.InlineKeyboardMarkup\"",
"=",
"None",
")",
"->",
"\"pyrogram.Message\"",
":",
"r",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | DeleteUserProfilePhotos.delete_user_profile_photos | Use this method to delete your own profile photos.
Args:
id (``str`` | ``list``):
A single :obj:`Photo <pyrogram.Photo>` id as string or multiple ids as list of strings for deleting
more than one photos at once.
Returns:
True on success.
... | pyrogram/client/methods/users/delete_user_profile_photos.py | def delete_user_profile_photos(
self,
id: Union[str, List[str]]
) -> bool:
"""Use this method to delete your own profile photos.
Args:
id (``str`` | ``list``):
A single :obj:`Photo <pyrogram.Photo>` id as string or multiple ids as list of strings for dele... | def delete_user_profile_photos(
self,
id: Union[str, List[str]]
) -> bool:
"""Use this method to delete your own profile photos.
Args:
id (``str`` | ``list``):
A single :obj:`Photo <pyrogram.Photo>` id as string or multiple ids as list of strings for dele... | [
"Use",
"this",
"method",
"to",
"delete",
"your",
"own",
"profile",
"photos",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/users/delete_user_profile_photos.py#L28-L63 | [
"def",
"delete_user_profile_photos",
"(",
"self",
",",
"id",
":",
"Union",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
")",
"->",
"bool",
":",
"id",
"=",
"id",
"if",
"isinstance",
"(",
"id",
",",
"list",
")",
"else",
"[",
"id",
"]",
"input_photo... | e7258a341ba905cfa86264c22040654db732ec1c |
train | InlineQuery.answer | Bound method *answer* of :obj:`InlineQuery <pyrogram.InlineQuery>`.
Use this method as a shortcut for:
.. code-block:: python
client.answer_inline_query(
inline_query.id,
results=[...]
)
Example:
.. code-block:: python
... | pyrogram/client/types/inline_mode/inline_query.py | def answer(
self,
results: List[InlineQueryResult],
cache_time: int = 300,
is_personal: bool = None,
next_offset: str = "",
switch_pm_text: str = "",
switch_pm_parameter: str = ""
):
"""Bound method *answer* of :obj:`InlineQuery <pyrogram.InlineQuery>`... | def answer(
self,
results: List[InlineQueryResult],
cache_time: int = 300,
is_personal: bool = None,
next_offset: str = "",
switch_pm_text: str = "",
switch_pm_parameter: str = ""
):
"""Bound method *answer* of :obj:`InlineQuery <pyrogram.InlineQuery>`... | [
"Bound",
"method",
"*",
"answer",
"*",
"of",
":",
"obj",
":",
"InlineQuery",
"<pyrogram",
".",
"InlineQuery",
">",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/types/inline_mode/inline_query.py#L86-L152 | [
"def",
"answer",
"(",
"self",
",",
"results",
":",
"List",
"[",
"InlineQueryResult",
"]",
",",
"cache_time",
":",
"int",
"=",
"300",
",",
"is_personal",
":",
"bool",
"=",
"None",
",",
"next_offset",
":",
"str",
"=",
"\"\"",
",",
"switch_pm_text",
":",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | SetChatPhoto.set_chat_photo | Use this method to set a new profile photo for the chat.
Photos can't be changed for private chats.
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
Note:
In regular groups (non-supergroups), this method will only work if the "All... | pyrogram/client/methods/chats/set_chat_photo.py | def set_chat_photo(
self,
chat_id: Union[int, str],
photo: str
) -> bool:
"""Use this method to set a new profile photo for the chat.
Photos can't be changed for private chats.
You must be an administrator in the chat for this to work and must have the appropriate adm... | def set_chat_photo(
self,
chat_id: Union[int, str],
photo: str
) -> bool:
"""Use this method to set a new profile photo for the chat.
Photos can't be changed for private chats.
You must be an administrator in the chat for this to work and must have the appropriate adm... | [
"Use",
"this",
"method",
"to",
"set",
"a",
"new",
"profile",
"photo",
"for",
"the",
"chat",
".",
"Photos",
"can",
"t",
"be",
"changed",
"for",
"private",
"chats",
".",
"You",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to"... | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/set_chat_photo.py#L29-L88 | [
"def",
"set_chat_photo",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"photo",
":",
"str",
")",
"->",
"bool",
":",
"peer",
"=",
"self",
".",
"resolve_peer",
"(",
"chat_id",
")",
"if",
"os",
".",
"path",
".",
"exists"... | e7258a341ba905cfa86264c22040654db732ec1c |
train | GetChatMembers.get_chat_members | Use this method to get a chunk of the members list of a chat.
You can get up to 200 chat members at once.
A chat can be either a basic group, a supergroup or a channel.
You must be admin to retrieve the members list of a channel (also known as "subscribers").
For a more convenient way o... | pyrogram/client/methods/chats/get_chat_members.py | def get_chat_members(
self,
chat_id: Union[int, str],
offset: int = 0,
limit: int = 200,
query: str = "",
filter: str = Filters.ALL
) -> "pyrogram.ChatMembers":
"""Use this method to get a chunk of the members list of a chat.
You can get up to 200 cha... | def get_chat_members(
self,
chat_id: Union[int, str],
offset: int = 0,
limit: int = 200,
query: str = "",
filter: str = Filters.ALL
) -> "pyrogram.ChatMembers":
"""Use this method to get a chunk of the members list of a chat.
You can get up to 200 cha... | [
"Use",
"this",
"method",
"to",
"get",
"a",
"chunk",
"of",
"the",
"members",
"list",
"of",
"a",
"chat",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/get_chat_members.py#L41-L142 | [
"def",
"get_chat_members",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"offset",
":",
"int",
"=",
"0",
",",
"limit",
":",
"int",
"=",
"200",
",",
"query",
":",
"str",
"=",
"\"\"",
",",
"filter",
":",
"str",
"=",
... | e7258a341ba905cfa86264c22040654db732ec1c |
train | LeaveChat.leave_chat | Use this method to leave a group chat or channel.
Args:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
delete (``bool``, *optional*):
Deletes the ... | pyrogram/client/methods/chats/leave_chat.py | def leave_chat(
self,
chat_id: Union[int, str],
delete: bool = False
):
"""Use this method to leave a group chat or channel.
Args:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
... | def leave_chat(
self,
chat_id: Union[int, str],
delete: bool = False
):
"""Use this method to leave a group chat or channel.
Args:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
... | [
"Use",
"this",
"method",
"to",
"leave",
"a",
"group",
"chat",
"or",
"channel",
"."
] | pyrogram/pyrogram | python | https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/chats/leave_chat.py#L26-L68 | [
"def",
"leave_chat",
"(",
"self",
",",
"chat_id",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"delete",
":",
"bool",
"=",
"False",
")",
":",
"peer",
"=",
"self",
".",
"resolve_peer",
"(",
"chat_id",
")",
"if",
"isinstance",
"(",
"peer",
",",
"t... | e7258a341ba905cfa86264c22040654db732ec1c |
train | grouper | grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x') | deepwalk/graph.py | def grouper(n, iterable, padvalue=None):
"grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')"
return zip_longest(*[iter(iterable)]*n, fillvalue=padvalue) | def grouper(n, iterable, padvalue=None):
"grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')"
return zip_longest(*[iter(iterable)]*n, fillvalue=padvalue) | [
"grouper",
"(",
"3",
"abcdefg",
"x",
")",
"--",
">",
"(",
"a",
"b",
"c",
")",
"(",
"d",
"e",
"f",
")",
"(",
"g",
"x",
"x",
")"
] | phanein/deepwalk | python | https://github.com/phanein/deepwalk/blob/85c96b62de36b8b7c8b652254d3940f497df634e/deepwalk/graph.py#L179-L181 | [
"def",
"grouper",
"(",
"n",
",",
"iterable",
",",
"padvalue",
"=",
"None",
")",
":",
"return",
"zip_longest",
"(",
"*",
"[",
"iter",
"(",
"iterable",
")",
"]",
"*",
"n",
",",
"fillvalue",
"=",
"padvalue",
")"
] | 85c96b62de36b8b7c8b652254d3940f497df634e |
train | Graph.random_walk | Returns a truncated random walk.
path_length: Length of the random walk.
alpha: probability of restarts.
start: the start node of the random walk. | deepwalk/graph.py | def random_walk(self, path_length, alpha=0, rand=random.Random(), start=None):
""" Returns a truncated random walk.
path_length: Length of the random walk.
alpha: probability of restarts.
start: the start node of the random walk.
"""
G = self
if start:
path = [start]
e... | def random_walk(self, path_length, alpha=0, rand=random.Random(), start=None):
""" Returns a truncated random walk.
path_length: Length of the random walk.
alpha: probability of restarts.
start: the start node of the random walk.
"""
G = self
if start:
path = [start]
e... | [
"Returns",
"a",
"truncated",
"random",
"walk",
"."
] | phanein/deepwalk | python | https://github.com/phanein/deepwalk/blob/85c96b62de36b8b7c8b652254d3940f497df634e/deepwalk/graph.py#L122-L145 | [
"def",
"random_walk",
"(",
"self",
",",
"path_length",
",",
"alpha",
"=",
"0",
",",
"rand",
"=",
"random",
".",
"Random",
"(",
")",
",",
"start",
"=",
"None",
")",
":",
"G",
"=",
"self",
"if",
"start",
":",
"path",
"=",
"[",
"start",
"]",
"else",... | 85c96b62de36b8b7c8b652254d3940f497df634e |
train | count_words | Counts the word frequences in a list of sentences.
Note:
This is a helper function for parallel execution of `Vocabulary.from_text`
method. | deepwalk/walks.py | def count_words(file):
""" Counts the word frequences in a list of sentences.
Note:
This is a helper function for parallel execution of `Vocabulary.from_text`
method.
"""
c = Counter()
with open(file, 'r') as f:
for l in f:
words = l.strip().split()
c.update(words)
return c | def count_words(file):
""" Counts the word frequences in a list of sentences.
Note:
This is a helper function for parallel execution of `Vocabulary.from_text`
method.
"""
c = Counter()
with open(file, 'r') as f:
for l in f:
words = l.strip().split()
c.update(words)
return c | [
"Counts",
"the",
"word",
"frequences",
"in",
"a",
"list",
"of",
"sentences",
"."
] | phanein/deepwalk | python | https://github.com/phanein/deepwalk/blob/85c96b62de36b8b7c8b652254d3940f497df634e/deepwalk/walks.py#L21-L33 | [
"def",
"count_words",
"(",
"file",
")",
":",
"c",
"=",
"Counter",
"(",
")",
"with",
"open",
"(",
"file",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"l",
"in",
"f",
":",
"words",
"=",
"l",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"c",
".... | 85c96b62de36b8b7c8b652254d3940f497df634e |
train | parallel_generate_walks | Generates the random walks which will be used as the skip-gram input.
:return: List of walks. Each walk is a list of nodes. | node2vec/parallel.py | def parallel_generate_walks(d_graph, global_walk_length, num_walks, cpu_num, sampling_strategy=None,
num_walks_key=None, walk_length_key=None, neighbors_key=None, probabilities_key=None,
first_travel_key=None, quiet=False):
"""
Generates the random walks w... | def parallel_generate_walks(d_graph, global_walk_length, num_walks, cpu_num, sampling_strategy=None,
num_walks_key=None, walk_length_key=None, neighbors_key=None, probabilities_key=None,
first_travel_key=None, quiet=False):
"""
Generates the random walks w... | [
"Generates",
"the",
"random",
"walks",
"which",
"will",
"be",
"used",
"as",
"the",
"skip",
"-",
"gram",
"input",
".",
":",
"return",
":",
"List",
"of",
"walks",
".",
"Each",
"walk",
"is",
"a",
"list",
"of",
"nodes",
"."
] | eliorc/node2vec | python | https://github.com/eliorc/node2vec/blob/840832460e0e41858553ad60c4ea49bfe59dbab0/node2vec/parallel.py#L5-L73 | [
"def",
"parallel_generate_walks",
"(",
"d_graph",
",",
"global_walk_length",
",",
"num_walks",
",",
"cpu_num",
",",
"sampling_strategy",
"=",
"None",
",",
"num_walks_key",
"=",
"None",
",",
"walk_length_key",
"=",
"None",
",",
"neighbors_key",
"=",
"None",
",",
... | 840832460e0e41858553ad60c4ea49bfe59dbab0 |
train | EdgeEmbedder.as_keyed_vectors | Generated a KeyedVectors instance with all
:return: | node2vec/edges.py | def as_keyed_vectors(self):
"""
Generated a KeyedVectors instance with all
:return:
"""
edge_generator = combinations_with_replacement(self.kv.index2word, r=2)
if not self.quiet:
vocab_size = len(self.kv.vocab)
total_size = reduce(lambda x, y: x ... | def as_keyed_vectors(self):
"""
Generated a KeyedVectors instance with all
:return:
"""
edge_generator = combinations_with_replacement(self.kv.index2word, r=2)
if not self.quiet:
vocab_size = len(self.kv.vocab)
total_size = reduce(lambda x, y: x ... | [
"Generated",
"a",
"KeyedVectors",
"instance",
"with",
"all",
":",
"return",
":"
] | eliorc/node2vec | python | https://github.com/eliorc/node2vec/blob/840832460e0e41858553ad60c4ea49bfe59dbab0/node2vec/edges.py#L43-L74 | [
"def",
"as_keyed_vectors",
"(",
"self",
")",
":",
"edge_generator",
"=",
"combinations_with_replacement",
"(",
"self",
".",
"kv",
".",
"index2word",
",",
"r",
"=",
"2",
")",
"if",
"not",
"self",
".",
"quiet",
":",
"vocab_size",
"=",
"len",
"(",
"self",
"... | 840832460e0e41858553ad60c4ea49bfe59dbab0 |
train | Node2Vec._precompute_probabilities | Precomputes transition probabilities for each node. | node2vec/node2vec.py | def _precompute_probabilities(self):
"""
Precomputes transition probabilities for each node.
"""
d_graph = self.d_graph
first_travel_done = set()
nodes_generator = self.graph.nodes() if self.quiet \
else tqdm(self.graph.nodes(), desc='Computing transition pr... | def _precompute_probabilities(self):
"""
Precomputes transition probabilities for each node.
"""
d_graph = self.d_graph
first_travel_done = set()
nodes_generator = self.graph.nodes() if self.quiet \
else tqdm(self.graph.nodes(), desc='Computing transition pr... | [
"Precomputes",
"transition",
"probabilities",
"for",
"each",
"node",
"."
] | eliorc/node2vec | python | https://github.com/eliorc/node2vec/blob/840832460e0e41858553ad60c4ea49bfe59dbab0/node2vec/node2vec.py#L73-L132 | [
"def",
"_precompute_probabilities",
"(",
"self",
")",
":",
"d_graph",
"=",
"self",
".",
"d_graph",
"first_travel_done",
"=",
"set",
"(",
")",
"nodes_generator",
"=",
"self",
".",
"graph",
".",
"nodes",
"(",
")",
"if",
"self",
".",
"quiet",
"else",
"tqdm",
... | 840832460e0e41858553ad60c4ea49bfe59dbab0 |
train | Node2Vec._generate_walks | Generates the random walks which will be used as the skip-gram input.
:return: List of walks. Each walk is a list of nodes. | node2vec/node2vec.py | def _generate_walks(self):
"""
Generates the random walks which will be used as the skip-gram input.
:return: List of walks. Each walk is a list of nodes.
"""
flatten = lambda l: [item for sublist in l for item in sublist]
# Split num_walks for each worker
num_w... | def _generate_walks(self):
"""
Generates the random walks which will be used as the skip-gram input.
:return: List of walks. Each walk is a list of nodes.
"""
flatten = lambda l: [item for sublist in l for item in sublist]
# Split num_walks for each worker
num_w... | [
"Generates",
"the",
"random",
"walks",
"which",
"will",
"be",
"used",
"as",
"the",
"skip",
"-",
"gram",
"input",
".",
":",
"return",
":",
"List",
"of",
"walks",
".",
"Each",
"walk",
"is",
"a",
"list",
"of",
"nodes",
"."
] | eliorc/node2vec | python | https://github.com/eliorc/node2vec/blob/840832460e0e41858553ad60c4ea49bfe59dbab0/node2vec/node2vec.py#L134-L162 | [
"def",
"_generate_walks",
"(",
"self",
")",
":",
"flatten",
"=",
"lambda",
"l",
":",
"[",
"item",
"for",
"sublist",
"in",
"l",
"for",
"item",
"in",
"sublist",
"]",
"# Split num_walks for each worker",
"num_walks_lists",
"=",
"np",
".",
"array_split",
"(",
"r... | 840832460e0e41858553ad60c4ea49bfe59dbab0 |
train | Node2Vec.fit | Creates the embeddings using gensim's Word2Vec.
:param skip_gram_params: Parameteres for gensim.models.Word2Vec - do not supply 'size' it is taken from the Node2Vec 'dimensions' parameter
:type skip_gram_params: dict
:return: A gensim word2vec model | node2vec/node2vec.py | def fit(self, **skip_gram_params):
"""
Creates the embeddings using gensim's Word2Vec.
:param skip_gram_params: Parameteres for gensim.models.Word2Vec - do not supply 'size' it is taken from the Node2Vec 'dimensions' parameter
:type skip_gram_params: dict
:return: A gensim word2v... | def fit(self, **skip_gram_params):
"""
Creates the embeddings using gensim's Word2Vec.
:param skip_gram_params: Parameteres for gensim.models.Word2Vec - do not supply 'size' it is taken from the Node2Vec 'dimensions' parameter
:type skip_gram_params: dict
:return: A gensim word2v... | [
"Creates",
"the",
"embeddings",
"using",
"gensim",
"s",
"Word2Vec",
".",
":",
"param",
"skip_gram_params",
":",
"Parameteres",
"for",
"gensim",
".",
"models",
".",
"Word2Vec",
"-",
"do",
"not",
"supply",
"size",
"it",
"is",
"taken",
"from",
"the",
"Node2Vec"... | eliorc/node2vec | python | https://github.com/eliorc/node2vec/blob/840832460e0e41858553ad60c4ea49bfe59dbab0/node2vec/node2vec.py#L164-L178 | [
"def",
"fit",
"(",
"self",
",",
"*",
"*",
"skip_gram_params",
")",
":",
"if",
"'workers'",
"not",
"in",
"skip_gram_params",
":",
"skip_gram_params",
"[",
"'workers'",
"]",
"=",
"self",
".",
"workers",
"if",
"'size'",
"not",
"in",
"skip_gram_params",
":",
"... | 840832460e0e41858553ad60c4ea49bfe59dbab0 |
train | get_user_info | An example of using the query_user_info method
:param twitter_user: the twitter user to capture user data
:return: twitter_user_data: returns a dictionary of twitter user data | twitterscraper/get_twitter_user_data_parallel.py | def get_user_info(twitter_user):
"""
An example of using the query_user_info method
:param twitter_user: the twitter user to capture user data
:return: twitter_user_data: returns a dictionary of twitter user data
"""
user_info = query_user_info(user=twitter_user)
twitter_user_data = {}
t... | def get_user_info(twitter_user):
"""
An example of using the query_user_info method
:param twitter_user: the twitter user to capture user data
:return: twitter_user_data: returns a dictionary of twitter user data
"""
user_info = query_user_info(user=twitter_user)
twitter_user_data = {}
t... | [
"An",
"example",
"of",
"using",
"the",
"query_user_info",
"method",
":",
"param",
"twitter_user",
":",
"the",
"twitter",
"user",
"to",
"capture",
"user",
"data",
":",
"return",
":",
"twitter_user_data",
":",
"returns",
"a",
"dictionary",
"of",
"twitter",
"user... | taspinar/twitterscraper | python | https://github.com/taspinar/twitterscraper/blob/b3596b5c5e22287ec3fbe84937f49e7e2ed728e8/twitterscraper/get_twitter_user_data_parallel.py#L11-L31 | [
"def",
"get_user_info",
"(",
"twitter_user",
")",
":",
"user_info",
"=",
"query_user_info",
"(",
"user",
"=",
"twitter_user",
")",
"twitter_user_data",
"=",
"{",
"}",
"twitter_user_data",
"[",
"\"user\"",
"]",
"=",
"user_info",
".",
"user",
"twitter_user_data",
... | b3596b5c5e22287ec3fbe84937f49e7e2ed728e8 |
train | query_single_page | Returns tweets from the given URL.
:param query: The query parameter of the query url
:param lang: The language parameter of the query url
:param pos: The query url parameter that determines where to start looking
:param retry: Number of retries if something goes wrong.
:return: The list of tweets,... | twitterscraper/query.py | def query_single_page(query, lang, pos, retry=50, from_user=False):
"""
Returns tweets from the given URL.
:param query: The query parameter of the query url
:param lang: The language parameter of the query url
:param pos: The query url parameter that determines where to start looking
:param re... | def query_single_page(query, lang, pos, retry=50, from_user=False):
"""
Returns tweets from the given URL.
:param query: The query parameter of the query url
:param lang: The language parameter of the query url
:param pos: The query url parameter that determines where to start looking
:param re... | [
"Returns",
"tweets",
"from",
"the",
"given",
"URL",
"."
] | taspinar/twitterscraper | python | https://github.com/taspinar/twitterscraper/blob/b3596b5c5e22287ec3fbe84937f49e7e2ed728e8/twitterscraper/query.py#L56-L117 | [
"def",
"query_single_page",
"(",
"query",
",",
"lang",
",",
"pos",
",",
"retry",
"=",
"50",
",",
"from_user",
"=",
"False",
")",
":",
"url",
"=",
"get_query_url",
"(",
"query",
",",
"lang",
",",
"pos",
",",
"from_user",
")",
"try",
":",
"response",
"... | b3596b5c5e22287ec3fbe84937f49e7e2ed728e8 |
train | query_tweets_once_generator | Queries twitter for all the tweets you want! It will load all pages it gets
from twitter. However, twitter might out of a sudden stop serving new pages,
in that case, use the `query_tweets` method.
Note that this function catches the KeyboardInterrupt so it can return
tweets on incomplete queries if th... | twitterscraper/query.py | def query_tweets_once_generator(query, limit=None, lang='', pos=None):
"""
Queries twitter for all the tweets you want! It will load all pages it gets
from twitter. However, twitter might out of a sudden stop serving new pages,
in that case, use the `query_tweets` method.
Note that this function ca... | def query_tweets_once_generator(query, limit=None, lang='', pos=None):
"""
Queries twitter for all the tweets you want! It will load all pages it gets
from twitter. However, twitter might out of a sudden stop serving new pages,
in that case, use the `query_tweets` method.
Note that this function ca... | [
"Queries",
"twitter",
"for",
"all",
"the",
"tweets",
"you",
"want!",
"It",
"will",
"load",
"all",
"pages",
"it",
"gets",
"from",
"twitter",
".",
"However",
"twitter",
"might",
"out",
"of",
"a",
"sudden",
"stop",
"serving",
"new",
"pages",
"in",
"that",
"... | taspinar/twitterscraper | python | https://github.com/taspinar/twitterscraper/blob/b3596b5c5e22287ec3fbe84937f49e7e2ed728e8/twitterscraper/query.py#L120-L168 | [
"def",
"query_tweets_once_generator",
"(",
"query",
",",
"limit",
"=",
"None",
",",
"lang",
"=",
"''",
",",
"pos",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"'Querying {}'",
".",
"format",
"(",
"query",
")",
")",
"query",
"=",
"query",
".",
... | b3596b5c5e22287ec3fbe84937f49e7e2ed728e8 |
train | query_user_page | Returns the scraped user data from a twitter user page.
:param url: The URL to get the twitter user info from (url contains the user page)
:param retry: Number of retries if something goes wrong.
:return: Returns the scraped user data from a twitter user page. | twitterscraper/query.py | def query_user_page(url, retry=10):
"""
Returns the scraped user data from a twitter user page.
:param url: The URL to get the twitter user info from (url contains the user page)
:param retry: Number of retries if something goes wrong.
:return: Returns the scraped user data from a twitter user page... | def query_user_page(url, retry=10):
"""
Returns the scraped user data from a twitter user page.
:param url: The URL to get the twitter user info from (url contains the user page)
:param retry: Number of retries if something goes wrong.
:return: Returns the scraped user data from a twitter user page... | [
"Returns",
"the",
"scraped",
"user",
"data",
"from",
"a",
"twitter",
"user",
"page",
"."
] | taspinar/twitterscraper | python | https://github.com/taspinar/twitterscraper/blob/b3596b5c5e22287ec3fbe84937f49e7e2ed728e8/twitterscraper/query.py#L242-L277 | [
"def",
"query_user_page",
"(",
"url",
",",
"retry",
"=",
"10",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"headers",
"=",
"HEADER",
")",
"html",
"=",
"response",
".",
"text",
"or",
"''",
"user",
"=",
"User",
"("... | b3596b5c5e22287ec3fbe84937f49e7e2ed728e8 |
train | query_user_info | Returns the scraped user data from a twitter user page.
:param user: the twitter user to web scrape its twitter page info | twitterscraper/query.py | def query_user_info(user):
"""
Returns the scraped user data from a twitter user page.
:param user: the twitter user to web scrape its twitter page info
"""
try:
user_info = query_user_page(INIT_URL_USER.format(u=user))
if user_info:
logger.info(f"Got user information... | def query_user_info(user):
"""
Returns the scraped user data from a twitter user page.
:param user: the twitter user to web scrape its twitter page info
"""
try:
user_info = query_user_page(INIT_URL_USER.format(u=user))
if user_info:
logger.info(f"Got user information... | [
"Returns",
"the",
"scraped",
"user",
"data",
"from",
"a",
"twitter",
"user",
"page",
"."
] | taspinar/twitterscraper | python | https://github.com/taspinar/twitterscraper/blob/b3596b5c5e22287ec3fbe84937f49e7e2ed728e8/twitterscraper/query.py#L280-L300 | [
"def",
"query_user_info",
"(",
"user",
")",
":",
"try",
":",
"user_info",
"=",
"query_user_page",
"(",
"INIT_URL_USER",
".",
"format",
"(",
"u",
"=",
"user",
")",
")",
"if",
"user_info",
":",
"logger",
".",
"info",
"(",
"f\"Got user information from username {... | b3596b5c5e22287ec3fbe84937f49e7e2ed728e8 |
train | User.from_soup | Returns the scraped user data from a twitter user page.
:param tag_prof_header: captures the left hand part of user info
:param tag_prof_nav: captures the upper part of user info
:return: Returns a User object with captured data via beautifulsoup | twitterscraper/user.py | def from_soup(self, tag_prof_header, tag_prof_nav):
"""
Returns the scraped user data from a twitter user page.
:param tag_prof_header: captures the left hand part of user info
:param tag_prof_nav: captures the upper part of user info
:return: Returns a User object with captured... | def from_soup(self, tag_prof_header, tag_prof_nav):
"""
Returns the scraped user data from a twitter user page.
:param tag_prof_header: captures the left hand part of user info
:param tag_prof_nav: captures the upper part of user info
:return: Returns a User object with captured... | [
"Returns",
"the",
"scraped",
"user",
"data",
"from",
"a",
"twitter",
"user",
"page",
"."
] | taspinar/twitterscraper | python | https://github.com/taspinar/twitterscraper/blob/b3596b5c5e22287ec3fbe84937f49e7e2ed728e8/twitterscraper/user.py#L20-L86 | [
"def",
"from_soup",
"(",
"self",
",",
"tag_prof_header",
",",
"tag_prof_nav",
")",
":",
"self",
".",
"user",
"=",
"tag_prof_header",
".",
"find",
"(",
"'a'",
",",
"{",
"'class'",
":",
"'ProfileHeaderCard-nameLink u-textInheritColor js-nav'",
"}",
")",
"[",
"'hre... | b3596b5c5e22287ec3fbe84937f49e7e2ed728e8 |
train | LogGaussian.pdf_link | :param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'
:returns: likelihood evaluated for this point
:rtype: float | GPy/likelihoods/loggaussian.py | def pdf_link(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'
:returns: likelihood evaluated for ... | def pdf_link(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'
:returns: likelihood evaluated for ... | [
":",
"param",
"link_f",
":",
"latent",
"variables",
"link",
"(",
"f",
")",
":",
"type",
"link_f",
":",
"Nx1",
"array",
":",
"param",
"y",
":",
"data",
":",
"type",
"y",
":",
"Nx1",
"array",
":",
"param",
"Y_metadata",
":",
"includes",
"censoring",
"i... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loggaussian.py#L35-L45 | [
"def",
"pdf_link",
"(",
"self",
",",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"return",
"np",
".",
"exp",
"(",
"self",
".",
"logpdf_link",
"(",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"Y_metadata",
")",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | LogGaussian.logpdf_link | :param link_f: latent variables (link(f))
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'
:returns: likelihood evaluated for this point
:rtype: float | GPy/likelihoods/loggaussian.py | def logpdf_link(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables (link(f))
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'
:returns: likelihood evaluated... | def logpdf_link(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables (link(f))
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'
:returns: likelihood evaluated... | [
":",
"param",
"link_f",
":",
"latent",
"variables",
"(",
"link",
"(",
"f",
"))",
":",
"type",
"link_f",
":",
"Nx1",
"array",
":",
"param",
"y",
":",
"data",
":",
"type",
"y",
":",
"Nx1",
"array",
":",
"param",
"Y_metadata",
":",
"includes",
"censorin... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loggaussian.py#L47-L65 | [
"def",
"logpdf_link",
"(",
"self",
",",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"assert",
"np",
".",
"atleast_1d",
"(",
"link_f",
")",
".",
"shape",
"==",
"np",
".",
"atleast_1d",
"(",
"y",
")",
".",
"shape",
"c",
"=",
"np",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | LogGaussian.dlogpdf_dlink | derivative of logpdf wrt link_f param
.. math::
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'
:returns: likelihood evaluated for thi... | GPy/likelihoods/loggaussian.py | def dlogpdf_dlink(self, link_f, y, Y_metadata=None):
"""
derivative of logpdf wrt link_f param
.. math::
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in... | def dlogpdf_dlink(self, link_f, y, Y_metadata=None):
"""
derivative of logpdf wrt link_f param
.. math::
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in... | [
"derivative",
"of",
"logpdf",
"wrt",
"link_f",
"param",
"..",
"math",
"::"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loggaussian.py#L67-L94 | [
"def",
"dlogpdf_dlink",
"(",
"self",
",",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"assert",
"np",
".",
"atleast_1d",
"(",
"link_f",
")",
".",
"shape",
"==",
"np",
".",
"atleast_1d",
"(",
"y",
")",
".",
"shape",
"c",
"=",
"np",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | LogGaussian.d3logpdf_dlink3 | Gradient of the log-likelihood function at y given f, w.r.t shape parameter
.. math::
:param inv_link_f: latent variables link(f)
:type inv_link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: includes censoring information in dictionary key 'censored'... | GPy/likelihoods/loggaussian.py | def d3logpdf_dlink3(self, link_f, y, Y_metadata=None):
"""
Gradient of the log-likelihood function at y given f, w.r.t shape parameter
.. math::
:param inv_link_f: latent variables link(f)
:type inv_link_f: Nx1 array
:param y: data
:type y: Nx1 array
:pa... | def d3logpdf_dlink3(self, link_f, y, Y_metadata=None):
"""
Gradient of the log-likelihood function at y given f, w.r.t shape parameter
.. math::
:param inv_link_f: latent variables link(f)
:type inv_link_f: Nx1 array
:param y: data
:type y: Nx1 array
:pa... | [
"Gradient",
"of",
"the",
"log",
"-",
"likelihood",
"function",
"at",
"y",
"given",
"f",
"w",
".",
"r",
".",
"t",
"shape",
"parameter"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loggaussian.py#L133-L162 | [
"def",
"d3logpdf_dlink3",
"(",
"self",
",",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"c",
"=",
"np",
".",
"zeros_like",
"(",
"y",
")",
"if",
"Y_metadata",
"is",
"not",
"None",
"and",
"'censored'",
"in",
"Y_metadata",
".",
"keys",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | LogGaussian.dlogpdf_dlink_dvar | :param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: Y_metadata not used in gaussian
:returns: derivative of log likelihood evaluated at points link(f) w.r.t variance parameter
:rtype: Nx1 array | GPy/likelihoods/loggaussian.py | def dlogpdf_dlink_dvar(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: Y_metadata not used in gaussian
:returns: derivative of log likelihood evaluated at p... | def dlogpdf_dlink_dvar(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: Y_metadata not used in gaussian
:returns: derivative of log likelihood evaluated at p... | [
":",
"param",
"link_f",
":",
"latent",
"variables",
"link",
"(",
"f",
")",
":",
"type",
"link_f",
":",
"Nx1",
"array",
":",
"param",
"y",
":",
"data",
":",
"type",
"y",
":",
"Nx1",
"array",
":",
"param",
"Y_metadata",
":",
"Y_metadata",
"not",
"used"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loggaussian.py#L193-L217 | [
"def",
"dlogpdf_dlink_dvar",
"(",
"self",
",",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"c",
"=",
"np",
".",
"zeros_like",
"(",
"y",
")",
"if",
"Y_metadata",
"is",
"not",
"None",
"and",
"'censored'",
"in",
"Y_metadata",
".",
"keys"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | LogGaussian.d2logpdf_dlink2_dvar | :param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: Y_metadata not used in gaussian
:returns: derivative of log likelihood evaluated at points link(f) w.r.t variance parameter
:rtype: Nx1 array | GPy/likelihoods/loggaussian.py | def d2logpdf_dlink2_dvar(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: Y_metadata not used in gaussian
:returns: derivative of log likelihood evaluated at... | def d2logpdf_dlink2_dvar(self, link_f, y, Y_metadata=None):
"""
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: Y_metadata not used in gaussian
:returns: derivative of log likelihood evaluated at... | [
":",
"param",
"link_f",
":",
"latent",
"variables",
"link",
"(",
"f",
")",
":",
"type",
"link_f",
":",
"Nx1",
"array",
":",
"param",
"y",
":",
"data",
":",
"type",
"y",
":",
"Nx1",
"array",
":",
"param",
"Y_metadata",
":",
"Y_metadata",
"not",
"used"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loggaussian.py#L219-L246 | [
"def",
"d2logpdf_dlink2_dvar",
"(",
"self",
",",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"c",
"=",
"np",
".",
"zeros_like",
"(",
"y",
")",
"if",
"Y_metadata",
"is",
"not",
"None",
"and",
"'censored'",
"in",
"Y_metadata",
".",
"key... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | LogGaussian.samples | Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable | GPy/likelihoods/loggaussian.py | def samples(self, gp, Y_metadata=None):
"""
Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable
"""
orig_shape = gp.shape
gp = gp.flatten() | def samples(self, gp, Y_metadata=None):
"""
Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable
"""
orig_shape = gp.shape
gp = gp.flatten() | [
"Returns",
"a",
"set",
"of",
"samples",
"of",
"observations",
"based",
"on",
"a",
"given",
"value",
"of",
"the",
"latent",
"variable",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loggaussian.py#L297-L304 | [
"def",
"samples",
"(",
"self",
",",
"gp",
",",
"Y_metadata",
"=",
"None",
")",
":",
"orig_shape",
"=",
"gp",
".",
"shape",
"gp",
"=",
"gp",
".",
"flatten",
"(",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli._preprocess_values | Check if the values of the observations correspond to the values
assumed by the likelihood function.
..Note:: Binary classification algorithm works better with classes {-1, 1} | GPy/likelihoods/bernoulli.py | def _preprocess_values(self, Y):
"""
Check if the values of the observations correspond to the values
assumed by the likelihood function.
..Note:: Binary classification algorithm works better with classes {-1, 1}
"""
Y_prep = Y.copy()
Y1 = Y[Y.flatten()==1].size
... | def _preprocess_values(self, Y):
"""
Check if the values of the observations correspond to the values
assumed by the likelihood function.
..Note:: Binary classification algorithm works better with classes {-1, 1}
"""
Y_prep = Y.copy()
Y1 = Y[Y.flatten()==1].size
... | [
"Check",
"if",
"the",
"values",
"of",
"the",
"observations",
"correspond",
"to",
"the",
"values",
"assumed",
"by",
"the",
"likelihood",
"function",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L45-L57 | [
"def",
"_preprocess_values",
"(",
"self",
",",
"Y",
")",
":",
"Y_prep",
"=",
"Y",
".",
"copy",
"(",
")",
"Y1",
"=",
"Y",
"[",
"Y",
".",
"flatten",
"(",
")",
"==",
"1",
"]",
".",
"size",
"Y2",
"=",
"Y",
"[",
"Y",
".",
"flatten",
"(",
")",
"=... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.moments_match_ep | Moments match of the marginal approximation in EP algorithm
:param i: number of observation (int)
:param tau_i: precision of the cavity distribution (float)
:param v_i: mean/variance of the cavity distribution (float) | GPy/likelihoods/bernoulli.py | def moments_match_ep(self, Y_i, tau_i, v_i, Y_metadata_i=None):
"""
Moments match of the marginal approximation in EP algorithm
:param i: number of observation (int)
:param tau_i: precision of the cavity distribution (float)
:param v_i: mean/variance of the cavity distribution (... | def moments_match_ep(self, Y_i, tau_i, v_i, Y_metadata_i=None):
"""
Moments match of the marginal approximation in EP algorithm
:param i: number of observation (int)
:param tau_i: precision of the cavity distribution (float)
:param v_i: mean/variance of the cavity distribution (... | [
"Moments",
"match",
"of",
"the",
"marginal",
"approximation",
"in",
"EP",
"algorithm"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L59-L92 | [
"def",
"moments_match_ep",
"(",
"self",
",",
"Y_i",
",",
"tau_i",
",",
"v_i",
",",
"Y_metadata_i",
"=",
"None",
")",
":",
"if",
"Y_i",
"==",
"1",
":",
"sign",
"=",
"1.",
"elif",
"Y_i",
"==",
"0",
"or",
"Y_i",
"==",
"-",
"1",
":",
"sign",
"=",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.pdf_link | Likelihood function given inverse link of f.
.. math::
p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}}
:param inv_link_f: latent variables inverse link of f.
:type inv_link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadat... | GPy/likelihoods/bernoulli.py | def pdf_link(self, inv_link_f, y, Y_metadata=None):
"""
Likelihood function given inverse link of f.
.. math::
p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}}
:param inv_link_f: latent variables inverse link of f.
:type inv_link_f: Nx1 array
... | def pdf_link(self, inv_link_f, y, Y_metadata=None):
"""
Likelihood function given inverse link of f.
.. math::
p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}}
:param inv_link_f: latent variables inverse link of f.
:type inv_link_f: Nx1 array
... | [
"Likelihood",
"function",
"given",
"inverse",
"link",
"of",
"f",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L138-L157 | [
"def",
"pdf_link",
"(",
"self",
",",
"inv_link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"#objective = (inv_link_f**y) * ((1.-inv_link_f)**(1.-y))",
"return",
"np",
".",
"where",
"(",
"y",
"==",
"1",
",",
"inv_link_f",
",",
"1.",
"-",
"inv_link_f... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.logpdf_link | Log Likelihood function given inverse link of f.
.. math::
\\ln p(y_{i}|\\lambda(f_{i})) = y_{i}\\log\\lambda(f_{i}) + (1-y_{i})\\log (1-f_{i})
:param inv_link_f: latent variables inverse link of f.
:type inv_link_f: Nx1 array
:param y: data
:type y: Nx1 array
... | GPy/likelihoods/bernoulli.py | def logpdf_link(self, inv_link_f, y, Y_metadata=None):
"""
Log Likelihood function given inverse link of f.
.. math::
\\ln p(y_{i}|\\lambda(f_{i})) = y_{i}\\log\\lambda(f_{i}) + (1-y_{i})\\log (1-f_{i})
:param inv_link_f: latent variables inverse link of f.
:type in... | def logpdf_link(self, inv_link_f, y, Y_metadata=None):
"""
Log Likelihood function given inverse link of f.
.. math::
\\ln p(y_{i}|\\lambda(f_{i})) = y_{i}\\log\\lambda(f_{i}) + (1-y_{i})\\log (1-f_{i})
:param inv_link_f: latent variables inverse link of f.
:type in... | [
"Log",
"Likelihood",
"function",
"given",
"inverse",
"link",
"of",
"f",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L159-L176 | [
"def",
"logpdf_link",
"(",
"self",
",",
"inv_link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"#objective = y*np.log(inv_link_f) + (1.-y)*np.log(inv_link_f)",
"p",
"=",
"np",
".",
"where",
"(",
"y",
"==",
"1",
",",
"inv_link_f",
",",
"1.",
"-",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.dlogpdf_dlink | Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f.
.. math::
\\frac{d\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)} = \\frac{y_{i}}{\\lambda(f_{i})} - \\frac{(1 - y_{i})}{(1 - \\lambda(f_{i}))}
:param inv_link_f: latent variables inverse link of f.
:type inv_l... | GPy/likelihoods/bernoulli.py | def dlogpdf_dlink(self, inv_link_f, y, Y_metadata=None):
"""
Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f.
.. math::
\\frac{d\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)} = \\frac{y_{i}}{\\lambda(f_{i})} - \\frac{(1 - y_{i})}{(1 - \\lambda(f_{i}))}
... | def dlogpdf_dlink(self, inv_link_f, y, Y_metadata=None):
"""
Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f.
.. math::
\\frac{d\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)} = \\frac{y_{i}}{\\lambda(f_{i})} - \\frac{(1 - y_{i})}{(1 - \\lambda(f_{i}))}
... | [
"Gradient",
"of",
"the",
"pdf",
"at",
"y",
"given",
"inverse",
"link",
"of",
"f",
"w",
".",
"r",
".",
"t",
"inverse",
"link",
"of",
"f",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L178-L197 | [
"def",
"dlogpdf_dlink",
"(",
"self",
",",
"inv_link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"#grad = (y/inv_link_f) - (1.-y)/(1-inv_link_f)",
"#grad = np.where(y, 1./inv_link_f, -1./(1-inv_link_f))",
"ff",
"=",
"np",
".",
"clip",
"(",
"inv_link_f",
",",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.d2logpdf_dlink2 | Hessian at y, given inv_link_f, w.r.t inv_link_f the hessian will be 0 unless i == j
i.e. second derivative logpdf at y given inverse link of f_i and inverse link of f_j w.r.t inverse link of f_i and inverse link of f_j.
.. math::
\\frac{d^{2}\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)^{2... | GPy/likelihoods/bernoulli.py | def d2logpdf_dlink2(self, inv_link_f, y, Y_metadata=None):
"""
Hessian at y, given inv_link_f, w.r.t inv_link_f the hessian will be 0 unless i == j
i.e. second derivative logpdf at y given inverse link of f_i and inverse link of f_j w.r.t inverse link of f_i and inverse link of f_j.
.... | def d2logpdf_dlink2(self, inv_link_f, y, Y_metadata=None):
"""
Hessian at y, given inv_link_f, w.r.t inv_link_f the hessian will be 0 unless i == j
i.e. second derivative logpdf at y given inverse link of f_i and inverse link of f_j w.r.t inverse link of f_i and inverse link of f_j.
.... | [
"Hessian",
"at",
"y",
"given",
"inv_link_f",
"w",
".",
"r",
".",
"t",
"inv_link_f",
"the",
"hessian",
"will",
"be",
"0",
"unless",
"i",
"==",
"j",
"i",
".",
"e",
".",
"second",
"derivative",
"logpdf",
"at",
"y",
"given",
"inverse",
"link",
"of",
"f_i... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L199-L226 | [
"def",
"d2logpdf_dlink2",
"(",
"self",
",",
"inv_link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"#d2logpdf_dlink2 = -y/(inv_link_f**2) - (1-y)/((1-inv_link_f)**2)",
"#d2logpdf_dlink2 = np.where(y, -1./np.square(inv_link_f), -1./np.square(1.-inv_link_f))",
"arg",
"=",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.d3logpdf_dlink3 | Third order derivative log-likelihood function at y given inverse link of f w.r.t inverse link of f
.. math::
\\frac{d^{3} \\ln p(y_{i}|\\lambda(f_{i}))}{d^{3}\\lambda(f)} = \\frac{2y_{i}}{\\lambda(f)^{3}} - \\frac{2(1-y_{i}}{(1-\\lambda(f))^{3}}
:param inv_link_f: latent variables passed ... | GPy/likelihoods/bernoulli.py | def d3logpdf_dlink3(self, inv_link_f, y, Y_metadata=None):
"""
Third order derivative log-likelihood function at y given inverse link of f w.r.t inverse link of f
.. math::
\\frac{d^{3} \\ln p(y_{i}|\\lambda(f_{i}))}{d^{3}\\lambda(f)} = \\frac{2y_{i}}{\\lambda(f)^{3}} - \\frac{2(1-y... | def d3logpdf_dlink3(self, inv_link_f, y, Y_metadata=None):
"""
Third order derivative log-likelihood function at y given inverse link of f w.r.t inverse link of f
.. math::
\\frac{d^{3} \\ln p(y_{i}|\\lambda(f_{i}))}{d^{3}\\lambda(f)} = \\frac{2y_{i}}{\\lambda(f)^{3}} - \\frac{2(1-y... | [
"Third",
"order",
"derivative",
"log",
"-",
"likelihood",
"function",
"at",
"y",
"given",
"inverse",
"link",
"of",
"f",
"w",
".",
"r",
".",
"t",
"inverse",
"link",
"of",
"f"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L228-L249 | [
"def",
"d3logpdf_dlink3",
"(",
"self",
",",
"inv_link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"assert",
"np",
".",
"atleast_1d",
"(",
"inv_link_f",
")",
".",
"shape",
"==",
"np",
".",
"atleast_1d",
"(",
"y",
")",
".",
"shape",
"#d3logpd... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.predictive_quantiles | Get the "quantiles" of the binary labels (Bernoulli draws). all the
quantiles must be either 0 or 1, since those are the only values the
draw can take! | GPy/likelihoods/bernoulli.py | def predictive_quantiles(self, mu, var, quantiles, Y_metadata=None):
"""
Get the "quantiles" of the binary labels (Bernoulli draws). all the
quantiles must be either 0 or 1, since those are the only values the
draw can take!
"""
p = self.predictive_mean(mu, var)
r... | def predictive_quantiles(self, mu, var, quantiles, Y_metadata=None):
"""
Get the "quantiles" of the binary labels (Bernoulli draws). all the
quantiles must be either 0 or 1, since those are the only values the
draw can take!
"""
p = self.predictive_mean(mu, var)
r... | [
"Get",
"the",
"quantiles",
"of",
"the",
"binary",
"labels",
"(",
"Bernoulli",
"draws",
")",
".",
"all",
"the",
"quantiles",
"must",
"be",
"either",
"0",
"or",
"1",
"since",
"those",
"are",
"the",
"only",
"values",
"the",
"draw",
"can",
"take!"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L251-L258 | [
"def",
"predictive_quantiles",
"(",
"self",
",",
"mu",
",",
"var",
",",
"quantiles",
",",
"Y_metadata",
"=",
"None",
")",
":",
"p",
"=",
"self",
".",
"predictive_mean",
"(",
"mu",
",",
"var",
")",
"return",
"[",
"np",
".",
"asarray",
"(",
"p",
">",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Bernoulli.samples | Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable | GPy/likelihoods/bernoulli.py | def samples(self, gp, Y_metadata=None):
"""
Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable
"""
orig_shape = gp.shape
gp = gp.flatten()
ns = np.ones_like(gp, dtype=int)
Ysim = np.random.bi... | def samples(self, gp, Y_metadata=None):
"""
Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable
"""
orig_shape = gp.shape
gp = gp.flatten()
ns = np.ones_like(gp, dtype=int)
Ysim = np.random.bi... | [
"Returns",
"a",
"set",
"of",
"samples",
"of",
"observations",
"based",
"on",
"a",
"given",
"value",
"of",
"the",
"latent",
"variable",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/bernoulli.py#L260-L270 | [
"def",
"samples",
"(",
"self",
",",
"gp",
",",
"Y_metadata",
"=",
"None",
")",
":",
"orig_shape",
"=",
"gp",
".",
"shape",
"gp",
"=",
"gp",
".",
"flatten",
"(",
")",
"ns",
"=",
"np",
".",
"ones_like",
"(",
"gp",
",",
"dtype",
"=",
"int",
")",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | align_subplots | make all of the subplots have the same limits, turn off unnecessary ticks | GPy/plotting/matplot_dep/base_plots.py | def align_subplots(N,M,xlim=None, ylim=None):
"""make all of the subplots have the same limits, turn off unnecessary ticks"""
#find sensible xlim,ylim
if xlim is None:
xlim = [np.inf,-np.inf]
for i in range(N*M):
plt.subplot(N,M,i+1)
xlim[0] = min(xlim[0],plt.xlim()[0... | def align_subplots(N,M,xlim=None, ylim=None):
"""make all of the subplots have the same limits, turn off unnecessary ticks"""
#find sensible xlim,ylim
if xlim is None:
xlim = [np.inf,-np.inf]
for i in range(N*M):
plt.subplot(N,M,i+1)
xlim[0] = min(xlim[0],plt.xlim()[0... | [
"make",
"all",
"of",
"the",
"subplots",
"have",
"the",
"same",
"limits",
"turn",
"off",
"unnecessary",
"ticks"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/base_plots.py#L170-L197 | [
"def",
"align_subplots",
"(",
"N",
",",
"M",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
")",
":",
"#find sensible xlim,ylim",
"if",
"xlim",
"is",
"None",
":",
"xlim",
"=",
"[",
"np",
".",
"inf",
",",
"-",
"np",
".",
"inf",
"]",
"for",
"i... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | align_subplot_array | Make all of the axes in the array hae the same limits, turn off unnecessary ticks
use plt.subplots() to get an array of axes | GPy/plotting/matplot_dep/base_plots.py | def align_subplot_array(axes,xlim=None, ylim=None):
"""
Make all of the axes in the array hae the same limits, turn off unnecessary ticks
use plt.subplots() to get an array of axes
"""
#find sensible xlim,ylim
if xlim is None:
xlim = [np.inf,-np.inf]
for ax in axes.flatten():
... | def align_subplot_array(axes,xlim=None, ylim=None):
"""
Make all of the axes in the array hae the same limits, turn off unnecessary ticks
use plt.subplots() to get an array of axes
"""
#find sensible xlim,ylim
if xlim is None:
xlim = [np.inf,-np.inf]
for ax in axes.flatten():
... | [
"Make",
"all",
"of",
"the",
"axes",
"in",
"the",
"array",
"hae",
"the",
"same",
"limits",
"turn",
"off",
"unnecessary",
"ticks",
"use",
"plt",
".",
"subplots",
"()",
"to",
"get",
"an",
"array",
"of",
"axes"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/base_plots.py#L199-L227 | [
"def",
"align_subplot_array",
"(",
"axes",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
")",
":",
"#find sensible xlim,ylim",
"if",
"xlim",
"is",
"None",
":",
"xlim",
"=",
"[",
"np",
".",
"inf",
",",
"-",
"np",
".",
"inf",
"]",
"for",
"ax",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | x_frame2D | Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits | GPy/plotting/matplot_dep/base_plots.py | def x_frame2D(X,plot_limits=None,resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
"""
assert X.shape[1] ==2, "x_frame2D is defined for two-dimensional inputs"
if plot_limits is None:
xmin,xmax = X.min(0),... | def x_frame2D(X,plot_limits=None,resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
"""
assert X.shape[1] ==2, "x_frame2D is defined for two-dimensional inputs"
if plot_limits is None:
xmin,xmax = X.min(0),... | [
"Internal",
"helper",
"function",
"for",
"making",
"plots",
"returns",
"a",
"set",
"of",
"input",
"values",
"to",
"plot",
"as",
"well",
"as",
"lower",
"and",
"upper",
"limits"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/base_plots.py#L249-L265 | [
"def",
"x_frame2D",
"(",
"X",
",",
"plot_limits",
"=",
"None",
",",
"resolution",
"=",
"None",
")",
":",
"assert",
"X",
".",
"shape",
"[",
"1",
"]",
"==",
"2",
",",
"\"x_frame2D is defined for two-dimensional inputs\"",
"if",
"plot_limits",
"is",
"None",
":"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Gamma.from_EV | Creates an instance of a Gamma Prior by specifying the Expected value(s)
and Variance(s) of the distribution.
:param E: expected value
:param V: variance | GPy/core/parameterization/priors.py | def from_EV(E, V):
"""
Creates an instance of a Gamma Prior by specifying the Expected value(s)
and Variance(s) of the distribution.
:param E: expected value
:param V: variance
"""
a = np.square(E) / V
b = E / V
return Gamma(a, b) | def from_EV(E, V):
"""
Creates an instance of a Gamma Prior by specifying the Expected value(s)
and Variance(s) of the distribution.
:param E: expected value
:param V: variance
"""
a = np.square(E) / V
b = E / V
return Gamma(a, b) | [
"Creates",
"an",
"instance",
"of",
"a",
"Gamma",
"Prior",
"by",
"specifying",
"the",
"Expected",
"value",
"(",
"s",
")",
"and",
"Variance",
"(",
"s",
")",
"of",
"the",
"distribution",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/parameterization/priors.py#L328-L338 | [
"def",
"from_EV",
"(",
"E",
",",
"V",
")",
":",
"a",
"=",
"np",
".",
"square",
"(",
"E",
")",
"/",
"V",
"b",
"=",
"E",
"/",
"V",
"return",
"Gamma",
"(",
"a",
",",
"b",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | MixedNoise.samples | Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable | GPy/likelihoods/mixed_noise.py | def samples(self, gp, Y_metadata):
"""
Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable
"""
N1, N2 = gp.shape
Ysim = np.zeros((N1,N2))
ind = Y_metadata['output_index'].flatten()
for j in np... | def samples(self, gp, Y_metadata):
"""
Returns a set of samples of observations based on a given value of the latent variable.
:param gp: latent variable
"""
N1, N2 = gp.shape
Ysim = np.zeros((N1,N2))
ind = Y_metadata['output_index'].flatten()
for j in np... | [
"Returns",
"a",
"set",
"of",
"samples",
"of",
"observations",
"based",
"on",
"a",
"given",
"value",
"of",
"the",
"latent",
"variable",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/mixed_noise.py#L66-L82 | [
"def",
"samples",
"(",
"self",
",",
"gp",
",",
"Y_metadata",
")",
":",
"N1",
",",
"N2",
"=",
"gp",
".",
"shape",
"Ysim",
"=",
"np",
".",
"zeros",
"(",
"(",
"N1",
",",
"N2",
")",
")",
"ind",
"=",
"Y_metadata",
"[",
"'output_index'",
"]",
".",
"f... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | psicomputations | Compute psi-statistics for ss-linear kernel | GPy/kern/src/psi_comp/linear_psi_comp.py | def psicomputations(variance, Z, variational_posterior, return_psi2_n=False):
"""
Compute psi-statistics for ss-linear kernel
"""
# here are the "statistics" for psi0, psi1 and psi2
# Produced intermediate results:
# psi0 N
# psi1 NxM
# psi2 MxM
mu = variational_posterior.me... | def psicomputations(variance, Z, variational_posterior, return_psi2_n=False):
"""
Compute psi-statistics for ss-linear kernel
"""
# here are the "statistics" for psi0, psi1 and psi2
# Produced intermediate results:
# psi0 N
# psi1 NxM
# psi2 MxM
mu = variational_posterior.me... | [
"Compute",
"psi",
"-",
"statistics",
"for",
"ss",
"-",
"linear",
"kernel"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/psi_comp/linear_psi_comp.py#L11-L31 | [
"def",
"psicomputations",
"(",
"variance",
",",
"Z",
",",
"variational_posterior",
",",
"return_psi2_n",
"=",
"False",
")",
":",
"# here are the \"statistics\" for psi0, psi1 and psi2",
"# Produced intermediate results:",
"# psi0 N",
"# psi1 NxM",
"# psi2 MxM",
"mu",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | _psi2computations | Z - MxQ
mu - NxQ
S - NxQ
gamma - NxQ | GPy/kern/src/psi_comp/linear_psi_comp.py | def _psi2computations(dL_dpsi2, variance, Z, mu, S):
"""
Z - MxQ
mu - NxQ
S - NxQ
gamma - NxQ
"""
# here are the "statistics" for psi1 and psi2
# Produced intermediate results:
# _psi2_dvariance Q
# _psi2_dZ MxQ
# _psi2_dmu NxQ
# _psi2_dS ... | def _psi2computations(dL_dpsi2, variance, Z, mu, S):
"""
Z - MxQ
mu - NxQ
S - NxQ
gamma - NxQ
"""
# here are the "statistics" for psi1 and psi2
# Produced intermediate results:
# _psi2_dvariance Q
# _psi2_dZ MxQ
# _psi2_dmu NxQ
# _psi2_dS ... | [
"Z",
"-",
"MxQ",
"mu",
"-",
"NxQ",
"S",
"-",
"NxQ",
"gamma",
"-",
"NxQ"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/psi_comp/linear_psi_comp.py#L50-L101 | [
"def",
"_psi2computations",
"(",
"dL_dpsi2",
",",
"variance",
",",
"Z",
",",
"mu",
",",
"S",
")",
":",
"# here are the \"statistics\" for psi1 and psi2",
"# Produced intermediate results:",
"# _psi2_dvariance Q",
"# _psi2_dZ MxQ",
"# _psi2_dmu NxQ",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Integral.Kdiag | I've used the fact that we call this method for K_ff when finding the covariance as a hack so
I know if I should return K_ff or K_xx. In this case we're returning K_ff!!
$K_{ff}^{post} = K_{ff} - K_{fx} K_{xx}^{-1} K_{xf}$ | GPy/kern/src/integral.py | def Kdiag(self, X):
"""I've used the fact that we call this method for K_ff when finding the covariance as a hack so
I know if I should return K_ff or K_xx. In this case we're returning K_ff!!
$K_{ff}^{post} = K_{ff} - K_{fx} K_{xx}^{-1} K_{xf}$"""
K_ff = np.zeros(X.shape[0])
for... | def Kdiag(self, X):
"""I've used the fact that we call this method for K_ff when finding the covariance as a hack so
I know if I should return K_ff or K_xx. In this case we're returning K_ff!!
$K_{ff}^{post} = K_{ff} - K_{fx} K_{xx}^{-1} K_{xf}$"""
K_ff = np.zeros(X.shape[0])
for... | [
"I",
"ve",
"used",
"the",
"fact",
"that",
"we",
"call",
"this",
"method",
"for",
"K_ff",
"when",
"finding",
"the",
"covariance",
"as",
"a",
"hack",
"so",
"I",
"know",
"if",
"I",
"should",
"return",
"K_ff",
"or",
"K_xx",
".",
"In",
"this",
"case",
"we... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/integral.py#L75-L82 | [
"def",
"Kdiag",
"(",
"self",
",",
"X",
")",
":",
"K_ff",
"=",
"np",
".",
"zeros",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
")",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"X",
")",
":",
"K_ff",
"[",
"i",
"]",
"=",
"self",
".",
"k_ff",
"(... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | BasisFuncKernel.concatenate_offset | Convenience function to add an offset column to phi.
You can use this function to add an offset (bias on y axis)
to phi in your custom self._phi(X). | GPy/kern/src/basis_funcs.py | def concatenate_offset(self, X):
"""
Convenience function to add an offset column to phi.
You can use this function to add an offset (bias on y axis)
to phi in your custom self._phi(X).
"""
return np.c_[np.ones((X.shape[0], 1)), X] | def concatenate_offset(self, X):
"""
Convenience function to add an offset column to phi.
You can use this function to add an offset (bias on y axis)
to phi in your custom self._phi(X).
"""
return np.c_[np.ones((X.shape[0], 1)), X] | [
"Convenience",
"function",
"to",
"add",
"an",
"offset",
"column",
"to",
"phi",
".",
"You",
"can",
"use",
"this",
"function",
"to",
"add",
"an",
"offset",
"(",
"bias",
"on",
"y",
"axis",
")",
"to",
"phi",
"in",
"your",
"custom",
"self",
".",
"_phi",
"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/basis_funcs.py#L63-L69 | [
"def",
"concatenate_offset",
"(",
"self",
",",
"X",
")",
":",
"return",
"np",
".",
"c_",
"[",
"np",
".",
"ones",
"(",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
",",
"1",
")",
")",
",",
"X",
"]"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | BasisFuncKernel.posterior_inf | Do the posterior inference on the parameters given this kernels functions
and the model posterior, which has to be a GPy posterior, usually found at m.posterior, if m is a GPy model.
If not given we search for the the highest parent to be a model, containing the posterior, and for X accordingly. | GPy/kern/src/basis_funcs.py | def posterior_inf(self, X=None, posterior=None):
"""
Do the posterior inference on the parameters given this kernels functions
and the model posterior, which has to be a GPy posterior, usually found at m.posterior, if m is a GPy model.
If not given we search for the the highest parent to... | def posterior_inf(self, X=None, posterior=None):
"""
Do the posterior inference on the parameters given this kernels functions
and the model posterior, which has to be a GPy posterior, usually found at m.posterior, if m is a GPy model.
If not given we search for the the highest parent to... | [
"Do",
"the",
"posterior",
"inference",
"on",
"the",
"parameters",
"given",
"this",
"kernels",
"functions",
"and",
"the",
"model",
"posterior",
"which",
"has",
"to",
"be",
"a",
"GPy",
"posterior",
"usually",
"found",
"at",
"m",
".",
"posterior",
"if",
"m",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/basis_funcs.py#L71-L88 | [
"def",
"posterior_inf",
"(",
"self",
",",
"X",
"=",
"None",
",",
"posterior",
"=",
"None",
")",
":",
"if",
"X",
"is",
"None",
":",
"try",
":",
"X",
"=",
"self",
".",
"_highest_parent_",
".",
"X",
"except",
"NameError",
":",
"raise",
"RuntimeError",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_data | Plot the training data
- For higher dimensions than two, use fixed_inputs to plot the data points with some of the inputs fixed.
Can plot only part of the data
using which_data_rows and which_data_ycols.
:param which_data_rows: which of the training data to plot (default all)
:type which_data_ro... | GPy/plotting/gpy_plot/data_plots.py | def plot_data(self, which_data_rows='all',
which_data_ycols='all', visible_dims=None,
projection='2d', label=None, **plot_kwargs):
"""
Plot the training data
- For higher dimensions than two, use fixed_inputs to plot the data points with some of the inputs fixed.
Can plot only part of... | def plot_data(self, which_data_rows='all',
which_data_ycols='all', visible_dims=None,
projection='2d', label=None, **plot_kwargs):
"""
Plot the training data
- For higher dimensions than two, use fixed_inputs to plot the data points with some of the inputs fixed.
Can plot only part of... | [
"Plot",
"the",
"training",
"data",
"-",
"For",
"higher",
"dimensions",
"than",
"two",
"use",
"fixed_inputs",
"to",
"plot",
"the",
"data",
"points",
"with",
"some",
"of",
"the",
"inputs",
"fixed",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/data_plots.py#L36-L60 | [
"def",
"plot_data",
"(",
"self",
",",
"which_data_rows",
"=",
"'all'",
",",
"which_data_ycols",
"=",
"'all'",
",",
"visible_dims",
"=",
"None",
",",
"projection",
"=",
"'2d'",
",",
"label",
"=",
"None",
",",
"*",
"*",
"plot_kwargs",
")",
":",
"canvas",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_data_error | Plot the training data input error.
For higher dimensions than two, use fixed_inputs to plot the data points with some of the inputs fixed.
Can plot only part of the data
using which_data_rows and which_data_ycols.
:param which_data_rows: which of the training data to plot (default all)
:type whi... | GPy/plotting/gpy_plot/data_plots.py | def plot_data_error(self, which_data_rows='all',
which_data_ycols='all', visible_dims=None,
projection='2d', label=None, **error_kwargs):
"""
Plot the training data input error.
For higher dimensions than two, use fixed_inputs to plot the data points with some of the inputs fixed.
Can ... | def plot_data_error(self, which_data_rows='all',
which_data_ycols='all', visible_dims=None,
projection='2d', label=None, **error_kwargs):
"""
Plot the training data input error.
For higher dimensions than two, use fixed_inputs to plot the data points with some of the inputs fixed.
Can ... | [
"Plot",
"the",
"training",
"data",
"input",
"error",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/data_plots.py#L97-L123 | [
"def",
"plot_data_error",
"(",
"self",
",",
"which_data_rows",
"=",
"'all'",
",",
"which_data_ycols",
"=",
"'all'",
",",
"visible_dims",
"=",
"None",
",",
"projection",
"=",
"'2d'",
",",
"label",
"=",
"None",
",",
"*",
"*",
"error_kwargs",
")",
":",
"canva... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_inducing | Plot the inducing inputs of a sparse gp model
:param array-like visible_dims: an array specifying the input dimensions to plot (maximum two)
:param kwargs plot_kwargs: keyword arguments for the plotting library | GPy/plotting/gpy_plot/data_plots.py | def plot_inducing(self, visible_dims=None, projection='2d', label='inducing', legend=True, **plot_kwargs):
"""
Plot the inducing inputs of a sparse gp model
:param array-like visible_dims: an array specifying the input dimensions to plot (maximum two)
:param kwargs plot_kwargs: keyword arguments for th... | def plot_inducing(self, visible_dims=None, projection='2d', label='inducing', legend=True, **plot_kwargs):
"""
Plot the inducing inputs of a sparse gp model
:param array-like visible_dims: an array specifying the input dimensions to plot (maximum two)
:param kwargs plot_kwargs: keyword arguments for th... | [
"Plot",
"the",
"inducing",
"inputs",
"of",
"a",
"sparse",
"gp",
"model"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/data_plots.py#L161-L170 | [
"def",
"plot_inducing",
"(",
"self",
",",
"visible_dims",
"=",
"None",
",",
"projection",
"=",
"'2d'",
",",
"label",
"=",
"'inducing'",
",",
"legend",
"=",
"True",
",",
"*",
"*",
"plot_kwargs",
")",
":",
"canvas",
",",
"kwargs",
"=",
"pl",
"(",
")",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_errorbars_trainset | Plot the errorbars of the GP likelihood on the training data.
These are the errorbars after the appropriate
approximations according to the likelihood are done.
This also works for heteroscedastic likelihoods.
Give the Y_metadata in the predict_kw if you need it.
:param which_data_rows: which of ... | GPy/plotting/gpy_plot/data_plots.py | def plot_errorbars_trainset(self, which_data_rows='all',
which_data_ycols='all', fixed_inputs=None,
plot_raw=False, apply_link=False, label=None, projection='2d',
predict_kw=None, **plot_kwargs):
"""
Plot the errorbars of the GP likelihood on the training data.
These are the errorbar... | def plot_errorbars_trainset(self, which_data_rows='all',
which_data_ycols='all', fixed_inputs=None,
plot_raw=False, apply_link=False, label=None, projection='2d',
predict_kw=None, **plot_kwargs):
"""
Plot the errorbars of the GP likelihood on the training data.
These are the errorbar... | [
"Plot",
"the",
"errorbars",
"of",
"the",
"GP",
"likelihood",
"on",
"the",
"training",
"data",
".",
"These",
"are",
"the",
"errorbars",
"after",
"the",
"appropriate",
"approximations",
"according",
"to",
"the",
"likelihood",
"are",
"done",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/data_plots.py#L199-L223 | [
"def",
"plot_errorbars_trainset",
"(",
"self",
",",
"which_data_rows",
"=",
"'all'",
",",
"which_data_ycols",
"=",
"'all'",
",",
"fixed_inputs",
"=",
"None",
",",
"plot_raw",
"=",
"False",
",",
"apply_link",
"=",
"False",
",",
"label",
"=",
"None",
",",
"pro... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | VarDTC._get_YYTfactor | find a matrix L which satisfies LLT = YYT.
Note that L may have fewer columns than Y. | GPy/inference/latent_function_inference/var_dtc.py | def _get_YYTfactor(self, Y):
"""
find a matrix L which satisfies LLT = YYT.
Note that L may have fewer columns than Y.
"""
N, D = Y.shape
if (N>=D):
return Y.view(np.ndarray)
else:
return jitchol(tdot(Y)) | def _get_YYTfactor(self, Y):
"""
find a matrix L which satisfies LLT = YYT.
Note that L may have fewer columns than Y.
"""
N, D = Y.shape
if (N>=D):
return Y.view(np.ndarray)
else:
return jitchol(tdot(Y)) | [
"find",
"a",
"matrix",
"L",
"which",
"satisfies",
"LLT",
"=",
"YYT",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/var_dtc.py#L51-L61 | [
"def",
"_get_YYTfactor",
"(",
"self",
",",
"Y",
")",
":",
"N",
",",
"D",
"=",
"Y",
".",
"shape",
"if",
"(",
"N",
">=",
"D",
")",
":",
"return",
"Y",
".",
"view",
"(",
"np",
".",
"ndarray",
")",
"else",
":",
"return",
"jitchol",
"(",
"tdot",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StateSpace.parameters_changed | Parameters have now changed | GPy/models/state_space.py | def parameters_changed(self):
"""
Parameters have now changed
"""
# Get the model matrices from the kernel
(F,L,Qc,H,Pinf,dF,dQc,dPinf) = self.kern.sde()
# Use the Kalman filter to evaluate the likelihood
self._log_marginal_likelihood = self.kf_likelihood(F,L,Qc,... | def parameters_changed(self):
"""
Parameters have now changed
"""
# Get the model matrices from the kernel
(F,L,Qc,H,Pinf,dF,dQc,dPinf) = self.kern.sde()
# Use the Kalman filter to evaluate the likelihood
self._log_marginal_likelihood = self.kf_likelihood(F,L,Qc,... | [
"Parameters",
"have",
"now",
"changed"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space.py#L59-L70 | [
"def",
"parameters_changed",
"(",
"self",
")",
":",
"# Get the model matrices from the kernel",
"(",
"F",
",",
"L",
",",
"Qc",
",",
"H",
",",
"Pinf",
",",
"dF",
",",
"dQc",
",",
"dPinf",
")",
"=",
"self",
".",
"kern",
".",
"sde",
"(",
")",
"# Use the K... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.