repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
delph-in/pydelphin | delphin/repp.py | REPP.from_config | def from_config(cls, path, directory=None):
"""
Instantiate a REPP from a PET-style `.set` configuration file.
The *path* parameter points to the configuration file.
Submodules are loaded from *directory*. If *directory* is not
given, it is the directory part of *path*.
... | python | def from_config(cls, path, directory=None):
"""
Instantiate a REPP from a PET-style `.set` configuration file.
The *path* parameter points to the configuration file.
Submodules are loaded from *directory*. If *directory* is not
given, it is the directory part of *path*.
... | [
"def",
"from_config",
"(",
"cls",
",",
"path",
",",
"directory",
"=",
"None",
")",
":",
"if",
"not",
"exists",
"(",
"path",
")",
":",
"raise",
"REPPError",
"(",
"'REPP config file not found: {}'",
".",
"format",
"(",
"path",
")",
")",
"confdir",
"=",
"di... | Instantiate a REPP from a PET-style `.set` configuration file.
The *path* parameter points to the configuration file.
Submodules are loaded from *directory*. If *directory* is not
given, it is the directory part of *path*.
Args:
path (str): the path to the REPP configuratio... | [
"Instantiate",
"a",
"REPP",
"from",
"a",
"PET",
"-",
"style",
".",
"set",
"configuration",
"file",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L282-L340 |
delph-in/pydelphin | delphin/repp.py | REPP.from_file | def from_file(cls, path, directory=None, modules=None, active=None):
"""
Instantiate a REPP from a `.rpp` file.
The *path* parameter points to the top-level module. Submodules
are loaded from *directory*. If *directory* is not given, it is
the directory part of *path*.
... | python | def from_file(cls, path, directory=None, modules=None, active=None):
"""
Instantiate a REPP from a `.rpp` file.
The *path* parameter points to the top-level module. Submodules
are loaded from *directory*. If *directory* is not given, it is
the directory part of *path*.
... | [
"def",
"from_file",
"(",
"cls",
",",
"path",
",",
"directory",
"=",
"None",
",",
"modules",
"=",
"None",
",",
"active",
"=",
"None",
")",
":",
"name",
"=",
"basename",
"(",
"path",
")",
"if",
"name",
".",
"endswith",
"(",
"'.rpp'",
")",
":",
"name"... | Instantiate a REPP from a `.rpp` file.
The *path* parameter points to the top-level module. Submodules
are loaded from *directory*. If *directory* is not given, it is
the directory part of *path*.
A REPP module may utilize external submodules, which may be
defined in two ways. ... | [
"Instantiate",
"a",
"REPP",
"from",
"a",
".",
"rpp",
"file",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L343-L376 |
delph-in/pydelphin | delphin/repp.py | REPP.from_string | def from_string(cls, s, name=None, modules=None, active=None):
"""
Instantiate a REPP from a string.
Args:
name (str, optional): the name of the REPP module
modules (dict, optional): a mapping from identifiers to
REPP modules
active (iterable,... | python | def from_string(cls, s, name=None, modules=None, active=None):
"""
Instantiate a REPP from a string.
Args:
name (str, optional): the name of the REPP module
modules (dict, optional): a mapping from identifiers to
REPP modules
active (iterable,... | [
"def",
"from_string",
"(",
"cls",
",",
"s",
",",
"name",
"=",
"None",
",",
"modules",
"=",
"None",
",",
"active",
"=",
"None",
")",
":",
"r",
"=",
"cls",
"(",
"name",
"=",
"name",
",",
"modules",
"=",
"modules",
",",
"active",
"=",
"active",
")",... | Instantiate a REPP from a string.
Args:
name (str, optional): the name of the REPP module
modules (dict, optional): a mapping from identifiers to
REPP modules
active (iterable, optional): an iterable of default module
activations | [
"Instantiate",
"a",
"REPP",
"from",
"a",
"string",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L379-L392 |
delph-in/pydelphin | delphin/repp.py | REPP.deactivate | def deactivate(self, mod):
"""
Set external module *mod* to inactive.
"""
if mod in self.active:
self.active.remove(mod) | python | def deactivate(self, mod):
"""
Set external module *mod* to inactive.
"""
if mod in self.active:
self.active.remove(mod) | [
"def",
"deactivate",
"(",
"self",
",",
"mod",
")",
":",
"if",
"mod",
"in",
"self",
".",
"active",
":",
"self",
".",
"active",
".",
"remove",
"(",
"mod",
")"
] | Set external module *mod* to inactive. | [
"Set",
"external",
"module",
"*",
"mod",
"*",
"to",
"inactive",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L400-L405 |
delph-in/pydelphin | delphin/repp.py | REPP.apply | def apply(self, s, active=None):
"""
Apply the REPP's rewrite rules to the input string *s*.
Args:
s (str): the input string to process
active (optional): a collection of external module names
that may be applied if called
Returns:
a :... | python | def apply(self, s, active=None):
"""
Apply the REPP's rewrite rules to the input string *s*.
Args:
s (str): the input string to process
active (optional): a collection of external module names
that may be applied if called
Returns:
a :... | [
"def",
"apply",
"(",
"self",
",",
"s",
",",
"active",
"=",
"None",
")",
":",
"if",
"active",
"is",
"None",
":",
"active",
"=",
"self",
".",
"active",
"return",
"self",
".",
"group",
".",
"apply",
"(",
"s",
",",
"active",
"=",
"active",
")"
] | Apply the REPP's rewrite rules to the input string *s*.
Args:
s (str): the input string to process
active (optional): a collection of external module names
that may be applied if called
Returns:
a :class:`REPPResult` object containing the processed
... | [
"Apply",
"the",
"REPP",
"s",
"rewrite",
"rules",
"to",
"the",
"input",
"string",
"*",
"s",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L410-L424 |
delph-in/pydelphin | delphin/repp.py | REPP.trace | def trace(self, s, active=None, verbose=False):
"""
Rewrite string *s* like `apply()`, but yield each rewrite step.
Args:
s (str): the input string to process
active (optional): a collection of external module names
that may be applied if called
... | python | def trace(self, s, active=None, verbose=False):
"""
Rewrite string *s* like `apply()`, but yield each rewrite step.
Args:
s (str): the input string to process
active (optional): a collection of external module names
that may be applied if called
... | [
"def",
"trace",
"(",
"self",
",",
"s",
",",
"active",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"active",
"is",
"None",
":",
"active",
"=",
"self",
".",
"active",
"return",
"self",
".",
"group",
".",
"trace",
"(",
"s",
",",
"acti... | Rewrite string *s* like `apply()`, but yield each rewrite step.
Args:
s (str): the input string to process
active (optional): a collection of external module names
that may be applied if called
verbose (bool, optional): if `False`, only output rules or
... | [
"Rewrite",
"string",
"*",
"s",
"*",
"like",
"apply",
"()",
"but",
"yield",
"each",
"rewrite",
"step",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L426-L443 |
delph-in/pydelphin | delphin/repp.py | REPP.tokenize | def tokenize(self, s, pattern=None, active=None):
"""
Rewrite and tokenize the input string *s*.
Args:
s (str): the input string to process
pattern (str, optional): the regular expression pattern on
which to split tokens; defaults to `[ \t]+`
... | python | def tokenize(self, s, pattern=None, active=None):
"""
Rewrite and tokenize the input string *s*.
Args:
s (str): the input string to process
pattern (str, optional): the regular expression pattern on
which to split tokens; defaults to `[ \t]+`
... | [
"def",
"tokenize",
"(",
"self",
",",
"s",
",",
"pattern",
"=",
"None",
",",
"active",
"=",
"None",
")",
":",
"if",
"pattern",
"is",
"None",
":",
"if",
"self",
".",
"tokenize_pattern",
"is",
"None",
":",
"pattern",
"=",
"r'[ \\t]+'",
"else",
":",
"pat... | Rewrite and tokenize the input string *s*.
Args:
s (str): the input string to process
pattern (str, optional): the regular expression pattern on
which to split tokens; defaults to `[ \t]+`
active (optional): a collection of external module names
... | [
"Rewrite",
"and",
"tokenize",
"the",
"input",
"string",
"*",
"s",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L445-L466 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | SendableMessageBase._apply_update_receiver | def _apply_update_receiver(self, receiver, reply_id):
"""
Updates `self.receiver` and/or `self.reply_id` if they still contain the default value.
:param receiver: The receiver `chat_id` to use.
Either `self.receiver`, if set, e.g. when instancing `TextMessage(receiver=10... | python | def _apply_update_receiver(self, receiver, reply_id):
"""
Updates `self.receiver` and/or `self.reply_id` if they still contain the default value.
:param receiver: The receiver `chat_id` to use.
Either `self.receiver`, if set, e.g. when instancing `TextMessage(receiver=10... | [
"def",
"_apply_update_receiver",
"(",
"self",
",",
"receiver",
",",
"reply_id",
")",
":",
"if",
"self",
".",
"receiver",
"is",
"None",
":",
"self",
".",
"receiver",
"=",
"receiver",
"# end if",
"if",
"self",
".",
"reply_id",
"is",
"DEFAULT_MESSAGE_ID",
":",
... | Updates `self.receiver` and/or `self.reply_id` if they still contain the default value.
:param receiver: The receiver `chat_id` to use.
Either `self.receiver`, if set, e.g. when instancing `TextMessage(receiver=10001231231, ...)`,
or the `chat.id` of the update ... | [
"Updates",
"self",
".",
"receiver",
"and",
"/",
"or",
"self",
".",
"reply_id",
"if",
"they",
"still",
"contain",
"the",
"default",
"value",
".",
":",
"param",
"receiver",
":",
"The",
"receiver",
"chat_id",
"to",
"use",
".",
"Either",
"self",
".",
"receiv... | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L14-L32 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | TextMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_message(
# receiver, self.media, disable_notificati... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_message(
# receiver, self.media, disable_notificati... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_message",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"text",
"=",
"self",
".",
"text",
",",
"chat_id... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L140-L152 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | TextMessage.to_array | def to_array(self):
"""
Serializes this TextMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(TextMessage, self).to_array()
array['text'] = u(self.text) # py2: type unicode, py3: type str
if self.... | python | def to_array(self):
"""
Serializes this TextMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(TextMessage, self).to_array()
array['text'] = u(self.text) # py2: type unicode, py3: type str
if self.... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"TextMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'text'",
"]",
"=",
"u",
"(",
"self",
".",
"text",
")",
"# py2: type unicode, py3: type str",
"if",
"self",
... | Serializes this TextMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"TextMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L155-L201 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | PhotoMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_photo(
# receiver, self.media, disable_notification... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_photo(
# receiver, self.media, disable_notification... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_photo",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"photo",
"=",
"self",
".",
"photo",
",",
"chat_id... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L385-L397 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | AudioMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_audio(
# receiver, self.media, disable_notification... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_audio(
# receiver, self.media, disable_notification... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_audio",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"audio",
"=",
"self",
".",
"audio",
",",
"chat_id... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L682-L694 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | AudioMessage.to_array | def to_array(self):
"""
Serializes this AudioMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(AudioMessage, self).to_array()
if isinstance(self.audio, InputFile):
array['audio'] = self.audio.to... | python | def to_array(self):
"""
Serializes this AudioMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(AudioMessage, self).to_array()
if isinstance(self.audio, InputFile):
array['audio'] = self.audio.to... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"AudioMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"audio",
",",
"InputFile",
")",
":",
"array",
"[",
"'audio'",
"]",
"=",
"self",
... | Serializes this AudioMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"AudioMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L697-L767 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | DocumentMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_document(
# receiver, self.media, disable_notificat... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_document(
# receiver, self.media, disable_notificat... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_document",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"document",
"=",
"self",
".",
"document",
",",
... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L979-L991 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | VideoMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_video(
# receiver, self.media, disable_notification... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_video(
# receiver, self.media, disable_notification... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_video",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"video",
"=",
"self",
".",
"video",
",",
"chat_id... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L1301-L1313 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | AnimationMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_animation(
# receiver, self.media, disable_notifica... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_animation(
# receiver, self.media, disable_notifica... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_animation",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"animation",
"=",
"self",
".",
"animation",
","... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L1626-L1638 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | AnimationMessage.to_array | def to_array(self):
"""
Serializes this AnimationMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(AnimationMessage, self).to_array()
if isinstance(self.animation, InputFile):
array['animation']... | python | def to_array(self):
"""
Serializes this AnimationMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(AnimationMessage, self).to_array()
if isinstance(self.animation, InputFile):
array['animation']... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"AnimationMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"animation",
",",
"InputFile",
")",
":",
"array",
"[",
"'animation'",
"]",
"=",... | Serializes this AnimationMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"AnimationMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L1641-L1709 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | VoiceMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_voice(
# receiver, self.media, disable_notification... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_voice(
# receiver, self.media, disable_notification... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_voice",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"voice",
"=",
"self",
".",
"voice",
",",
"chat_id... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L1921-L1933 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | VoiceMessage.to_array | def to_array(self):
"""
Serializes this VoiceMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VoiceMessage, self).to_array()
if isinstance(self.voice, InputFile):
array['voice'] = self.voice.to... | python | def to_array(self):
"""
Serializes this VoiceMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VoiceMessage, self).to_array()
if isinstance(self.voice, InputFile):
array['voice'] = self.voice.to... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"VoiceMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"voice",
",",
"InputFile",
")",
":",
"array",
"[",
"'voice'",
"]",
"=",
"self",
... | Serializes this VoiceMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"VoiceMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L1936-L1991 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | VideoNoteMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_video_note(
# receiver, self.media, disable_notific... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_video_note(
# receiver, self.media, disable_notific... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_video_note",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"video_note",
"=",
"self",
".",
"video_note",
... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2192-L2204 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | VideoNoteMessage.to_array | def to_array(self):
"""
Serializes this VideoNoteMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VideoNoteMessage, self).to_array()
if isinstance(self.video_note, InputFile):
array['video_note... | python | def to_array(self):
"""
Serializes this VideoNoteMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VideoNoteMessage, self).to_array()
if isinstance(self.video_note, InputFile):
array['video_note... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"VideoNoteMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"video_note",
",",
"InputFile",
")",
":",
"array",
"[",
"'video_note'",
"]",
"=... | Serializes this VideoNoteMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"VideoNoteMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2207-L2267 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | MediaGroupMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_media_group(
# receiver, self.media, disable_notifi... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_media_group(
# receiver, self.media, disable_notifi... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_media_group",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"media",
"=",
"self",
".",
"media",
",",
"c... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2437-L2449 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | MediaGroupMessage.to_array | def to_array(self):
"""
Serializes this MediaGroupMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(MediaGroupMessage, self).to_array()
if isinstance(self.media, InputMediaPhoto):
array['media']... | python | def to_array(self):
"""
Serializes this MediaGroupMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(MediaGroupMessage, self).to_array()
if isinstance(self.media, InputMediaPhoto):
array['media']... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"MediaGroupMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"media",
",",
"InputMediaPhoto",
")",
":",
"array",
"[",
"'media'",
"]",
"=",
... | Serializes this MediaGroupMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"MediaGroupMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2452-L2486 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | MediaGroupMessage.from_array | def from_array(array):
"""
Deserialize a new MediaGroupMessage from a given dictionary.
:return: new MediaGroupMessage instance.
:rtype: MediaGroupMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict... | python | def from_array(array):
"""
Deserialize a new MediaGroupMessage from a given dictionary.
:return: new MediaGroupMessage instance.
:rtype: MediaGroupMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"from",
"pytgbot",
".",
"api... | Deserialize a new MediaGroupMessage from a given dictionary.
:return: new MediaGroupMessage instance.
:rtype: MediaGroupMessage | [
"Deserialize",
"a",
"new",
"MediaGroupMessage",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2490-L2534 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | LocationMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_location(
# receiver, self.media, disable_notificat... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_location(
# receiver, self.media, disable_notificat... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_location",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"latitude",
"=",
"self",
".",
"latitude",
",",
... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2658-L2670 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | LocationMessage.to_array | def to_array(self):
"""
Serializes this LocationMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(LocationMessage, self).to_array()
array['latitude'] = float(self.latitude) # type float
array['long... | python | def to_array(self):
"""
Serializes this LocationMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(LocationMessage, self).to_array()
array['latitude'] = float(self.latitude) # type float
array['long... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"LocationMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'latitude'",
"]",
"=",
"float",
"(",
"self",
".",
"latitude",
")",
"# type float",
"array",
"[",
"'long... | Serializes this LocationMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"LocationMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2673-L2716 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | VenueMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_venue(
# receiver, self.media, disable_notification... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_venue(
# receiver, self.media, disable_notification... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_venue",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"latitude",
"=",
"self",
".",
"latitude",
",",
"l... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2926-L2938 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | VenueMessage.to_array | def to_array(self):
"""
Serializes this VenueMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VenueMessage, self).to_array()
array['latitude'] = float(self.latitude) # type float
array['longitude'... | python | def to_array(self):
"""
Serializes this VenueMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VenueMessage, self).to_array()
array['latitude'] = float(self.latitude) # type float
array['longitude'... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"VenueMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'latitude'",
"]",
"=",
"float",
"(",
"self",
".",
"latitude",
")",
"# type float",
"array",
"[",
"'longitu... | Serializes this VenueMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"VenueMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L2941-L2992 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | ContactMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_contact(
# receiver, self.media, disable_notificati... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_contact(
# receiver, self.media, disable_notificati... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_contact",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"phone_number",
"=",
"self",
".",
"phone_number",
... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3187-L3199 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | ContactMessage.to_array | def to_array(self):
"""
Serializes this ContactMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ContactMessage, self).to_array()
array['phone_number'] = u(self.phone_number) # py2: type unicode, py3: type... | python | def to_array(self):
"""
Serializes this ContactMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ContactMessage, self).to_array()
array['phone_number'] = u(self.phone_number) # py2: type unicode, py3: type... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"ContactMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'phone_number'",
"]",
"=",
"u",
"(",
"self",
".",
"phone_number",
")",
"# py2: type unicode, py3: type str",
... | Serializes this ContactMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"ContactMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3202-L3251 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | ChatActionMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_chat_action(
# receiver, self.media, disable_notifi... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_chat_action(
# receiver, self.media, disable_notifi... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_chat_action",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"action",
"=",
"self",
".",
"action",
",",
... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3393-L3405 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | ChatActionMessage.to_array | def to_array(self):
"""
Serializes this ChatActionMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ChatActionMessage, self).to_array()
array['action'] = u(self.action) # py2: type unicode, py3: type str
... | python | def to_array(self):
"""
Serializes this ChatActionMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ChatActionMessage, self).to_array()
array['action'] = u(self.action) # py2: type unicode, py3: type str
... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"ChatActionMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'action'",
"]",
"=",
"u",
"(",
"self",
".",
"action",
")",
"# py2: type unicode, py3: type str",
"if",
... | Serializes this ChatActionMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"ChatActionMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3408-L3427 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | ChatActionMessage.from_array | def from_array(array):
"""
Deserialize a new ChatActionMessage from a given dictionary.
:return: new ChatActionMessage instance.
:rtype: ChatActionMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict... | python | def from_array(array):
"""
Deserialize a new ChatActionMessage from a given dictionary.
:return: new ChatActionMessage instance.
:rtype: ChatActionMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"data",
"=",
"{",
"}",
"da... | Deserialize a new ChatActionMessage from a given dictionary.
:return: new ChatActionMessage instance.
:rtype: ChatActionMessage | [
"Deserialize",
"a",
"new",
"ChatActionMessage",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3431-L3456 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | StickerMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_sticker(
# receiver, self.media, disable_notificati... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_sticker(
# receiver, self.media, disable_notificati... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_sticker",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"sticker",
"=",
"self",
".",
"sticker",
",",
"c... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3563-L3575 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | StickerMessage.to_array | def to_array(self):
"""
Serializes this StickerMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(StickerMessage, self).to_array()
if isinstance(self.sticker, InputFile):
array['sticker'] = self.... | python | def to_array(self):
"""
Serializes this StickerMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(StickerMessage, self).to_array()
if isinstance(self.sticker, InputFile):
array['sticker'] = self.... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"StickerMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"sticker",
",",
"InputFile",
")",
":",
"array",
"[",
"'sticker'",
"]",
"=",
"se... | Serializes this StickerMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"StickerMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3578-L3625 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | StickerMessage.from_array | def from_array(array):
"""
Deserialize a new StickerMessage from a given dictionary.
:return: new StickerMessage instance.
:rtype: StickerMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, paramet... | python | def from_array(array):
"""
Deserialize a new StickerMessage from a given dictionary.
:return: new StickerMessage instance.
:rtype: StickerMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, paramet... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"from",
"pytgbot",
".",
"api... | Deserialize a new StickerMessage from a given dictionary.
:return: new StickerMessage instance.
:rtype: StickerMessage | [
"Deserialize",
"a",
"new",
"StickerMessage",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3629-L3689 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | InvoiceMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_invoice(
# receiver, self.media, disable_notificati... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_invoice(
# receiver, self.media, disable_notificati... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_invoice",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"title",
"=",
"self",
".",
"title",
",",
"descr... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3955-L3967 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | InvoiceMessage.to_array | def to_array(self):
"""
Serializes this InvoiceMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InvoiceMessage, self).to_array()
array['title'] = u(self.title) # py2: type unicode, py3: type str
... | python | def to_array(self):
"""
Serializes this InvoiceMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InvoiceMessage, self).to_array()
array['title'] = u(self.title) # py2: type unicode, py3: type str
... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"InvoiceMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'title'",
"]",
"=",
"u",
"(",
"self",
".",
"title",
")",
"# py2: type unicode, py3: type str",
"array",
"[... | Serializes this InvoiceMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"InvoiceMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L3970-L4039 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | InvoiceMessage.from_array | def from_array(array):
"""
Deserialize a new InvoiceMessage from a given dictionary.
:return: new InvoiceMessage instance.
:rtype: InvoiceMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, paramet... | python | def from_array(array):
"""
Deserialize a new InvoiceMessage from a given dictionary.
:return: new InvoiceMessage instance.
:rtype: InvoiceMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, paramet... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"from",
"pytgbot",
".",
"api... | Deserialize a new InvoiceMessage from a given dictionary.
:return: new InvoiceMessage instance.
:rtype: InvoiceMessage | [
"Deserialize",
"a",
"new",
"InvoiceMessage",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L4043-L4100 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | GameMessage.send | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_game(
# receiver, self.media, disable_notification=... | python | def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_game(
# receiver, self.media, disable_notification=... | [
"def",
"send",
"(",
"self",
",",
"sender",
":",
"PytgbotApiBot",
")",
":",
"return",
"sender",
".",
"send_game",
"(",
"# receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id",
"game_short_name",
"=",
"self",
".",
"game_short_name"... | Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage | [
"Send",
"the",
"message",
"via",
"pytgbot",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L4203-L4215 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | GameMessage.to_array | def to_array(self):
"""
Serializes this GameMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(GameMessage, self).to_array()
array['game_short_name'] = u(self.game_short_name) # py2: type unicode, py3: type... | python | def to_array(self):
"""
Serializes this GameMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(GameMessage, self).to_array()
array['game_short_name'] = u(self.game_short_name) # py2: type unicode, py3: type... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"GameMessage",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'game_short_name'",
"]",
"=",
"u",
"(",
"self",
".",
"game_short_name",
")",
"# py2: type unicode, py3: type str"... | Serializes this GameMessage to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"GameMessage",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L4218-L4249 |
luckydonald/pytgbot | code_generation/output/teleflask_messages.py | GameMessage.from_array | def from_array(array):
"""
Deserialize a new GameMessage from a given dictionary.
:return: new GameMessage instance.
:rtype: GameMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="... | python | def from_array(array):
"""
Deserialize a new GameMessage from a given dictionary.
:return: new GameMessage instance.
:rtype: GameMessage
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_name="... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"from",
"pytgbot",
".",
"api... | Deserialize a new GameMessage from a given dictionary.
:return: new GameMessage instance.
:rtype: GameMessage | [
"Deserialize",
"a",
"new",
"GameMessage",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/teleflask_messages.py#L4253-L4291 |
delph-in/pydelphin | delphin/mrs/query.py | select_nodeids | def select_nodeids(xmrs, iv=None, label=None, pred=None):
"""
Return the list of matching nodeids in *xmrs*.
Nodeids in *xmrs* match if their corresponding
:class:`~delphin.mrs.components.ElementaryPredication` object
matches its `intrinsic_variable` to *iv*, `label` to *label*,
and `pred` to *... | python | def select_nodeids(xmrs, iv=None, label=None, pred=None):
"""
Return the list of matching nodeids in *xmrs*.
Nodeids in *xmrs* match if their corresponding
:class:`~delphin.mrs.components.ElementaryPredication` object
matches its `intrinsic_variable` to *iv*, `label` to *label*,
and `pred` to *... | [
"def",
"select_nodeids",
"(",
"xmrs",
",",
"iv",
"=",
"None",
",",
"label",
"=",
"None",
",",
"pred",
"=",
"None",
")",
":",
"def",
"datamatch",
"(",
"nid",
")",
":",
"ep",
"=",
"xmrs",
".",
"ep",
"(",
"nid",
")",
"return",
"(",
"(",
"iv",
"is"... | Return the list of matching nodeids in *xmrs*.
Nodeids in *xmrs* match if their corresponding
:class:`~delphin.mrs.components.ElementaryPredication` object
matches its `intrinsic_variable` to *iv*, `label` to *label*,
and `pred` to *pred*. The *iv*, *label*, and *pred* filters are
ignored if they a... | [
"Return",
"the",
"list",
"of",
"matching",
"nodeids",
"in",
"*",
"xmrs",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L12-L37 |
delph-in/pydelphin | delphin/mrs/query.py | select_nodes | def select_nodes(xmrs, nodeid=None, pred=None):
"""
Return the list of matching nodes in *xmrs*.
DMRS :class:`nodes <delphin.mrs.components.node>` for *xmrs* match
if their `nodeid` matches *nodeid* and `pred` matches *pred*. The
*nodeid* and *pred* filters are ignored if they are `None`.
Args... | python | def select_nodes(xmrs, nodeid=None, pred=None):
"""
Return the list of matching nodes in *xmrs*.
DMRS :class:`nodes <delphin.mrs.components.node>` for *xmrs* match
if their `nodeid` matches *nodeid* and `pred` matches *pred*. The
*nodeid* and *pred* filters are ignored if they are `None`.
Args... | [
"def",
"select_nodes",
"(",
"xmrs",
",",
"nodeid",
"=",
"None",
",",
"pred",
"=",
"None",
")",
":",
"nodematch",
"=",
"lambda",
"n",
":",
"(",
"(",
"nodeid",
"is",
"None",
"or",
"n",
".",
"nodeid",
"==",
"nodeid",
")",
"and",
"(",
"pred",
"is",
"... | Return the list of matching nodes in *xmrs*.
DMRS :class:`nodes <delphin.mrs.components.node>` for *xmrs* match
if their `nodeid` matches *nodeid* and `pred` matches *pred*. The
*nodeid* and *pred* filters are ignored if they are `None`.
Args:
xmrs (:class:`~delphin.mrs.xmrs.Xmrs`): semantic s... | [
"Return",
"the",
"list",
"of",
"matching",
"nodes",
"in",
"*",
"xmrs",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L40-L59 |
delph-in/pydelphin | delphin/mrs/query.py | select_eps | def select_eps(xmrs, nodeid=None, iv=None, label=None, pred=None):
"""
Return the list of matching elementary predications in *xmrs*.
:class:`~delphin.mrs.components.ElementaryPredication` objects for
*xmrs* match if their `nodeid` matches *nodeid*,
`intrinsic_variable` matches *iv*, `label` matche... | python | def select_eps(xmrs, nodeid=None, iv=None, label=None, pred=None):
"""
Return the list of matching elementary predications in *xmrs*.
:class:`~delphin.mrs.components.ElementaryPredication` objects for
*xmrs* match if their `nodeid` matches *nodeid*,
`intrinsic_variable` matches *iv*, `label` matche... | [
"def",
"select_eps",
"(",
"xmrs",
",",
"nodeid",
"=",
"None",
",",
"iv",
"=",
"None",
",",
"label",
"=",
"None",
",",
"pred",
"=",
"None",
")",
":",
"epmatch",
"=",
"lambda",
"n",
":",
"(",
"(",
"nodeid",
"is",
"None",
"or",
"n",
".",
"nodeid",
... | Return the list of matching elementary predications in *xmrs*.
:class:`~delphin.mrs.components.ElementaryPredication` objects for
*xmrs* match if their `nodeid` matches *nodeid*,
`intrinsic_variable` matches *iv*, `label` matches *label*, and
`pred` to *pred*. The *nodeid*, *iv*, *label*, and *pred* fi... | [
"Return",
"the",
"list",
"of",
"matching",
"elementary",
"predications",
"in",
"*",
"xmrs",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L62-L87 |
delph-in/pydelphin | delphin/mrs/query.py | select_args | def select_args(xmrs, nodeid=None, rargname=None, value=None):
"""
Return the list of matching (nodeid, role, value) triples in *xmrs*.
Predication arguments in *xmrs* match if the `nodeid` of the
:class:`~delphin.mrs.components.ElementaryPredication` they are
arguments of match *nodeid*, their rol... | python | def select_args(xmrs, nodeid=None, rargname=None, value=None):
"""
Return the list of matching (nodeid, role, value) triples in *xmrs*.
Predication arguments in *xmrs* match if the `nodeid` of the
:class:`~delphin.mrs.components.ElementaryPredication` they are
arguments of match *nodeid*, their rol... | [
"def",
"select_args",
"(",
"xmrs",
",",
"nodeid",
"=",
"None",
",",
"rargname",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"argmatch",
"=",
"lambda",
"a",
":",
"(",
"(",
"nodeid",
"is",
"None",
"or",
"a",
"[",
"0",
"]",
"==",
"nodeid",
")"... | Return the list of matching (nodeid, role, value) triples in *xmrs*.
Predication arguments in *xmrs* match if the `nodeid` of the
:class:`~delphin.mrs.components.ElementaryPredication` they are
arguments of match *nodeid*, their role matches *rargname*, and
their value matches *value*. The *nodeid*, *r... | [
"Return",
"the",
"list",
"of",
"matching",
"(",
"nodeid",
"role",
"value",
")",
"triples",
"in",
"*",
"xmrs",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L90-L128 |
delph-in/pydelphin | delphin/mrs/query.py | select_links | def select_links(xmrs, start=None, end=None, rargname=None, post=None):
"""
Return the list of matching links for *xmrs*.
:class:`~delphin.mrs.components.Link` objects for *xmrs* match if
their `start` matches *start*, `end` matches *end*, `rargname`
matches *rargname*, and `post` matches *post*. T... | python | def select_links(xmrs, start=None, end=None, rargname=None, post=None):
"""
Return the list of matching links for *xmrs*.
:class:`~delphin.mrs.components.Link` objects for *xmrs* match if
their `start` matches *start*, `end` matches *end*, `rargname`
matches *rargname*, and `post` matches *post*. T... | [
"def",
"select_links",
"(",
"xmrs",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"rargname",
"=",
"None",
",",
"post",
"=",
"None",
")",
":",
"linkmatch",
"=",
"lambda",
"l",
":",
"(",
"(",
"start",
"is",
"None",
"or",
"l",
".",
"star... | Return the list of matching links for *xmrs*.
:class:`~delphin.mrs.components.Link` objects for *xmrs* match if
their `start` matches *start*, `end` matches *end*, `rargname`
matches *rargname*, and `post` matches *post*. The *start*, *end*,
*rargname*, and *post* filters are ignored if they are `None`... | [
"Return",
"the",
"list",
"of",
"matching",
"links",
"for",
"*",
"xmrs",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L131-L155 |
delph-in/pydelphin | delphin/mrs/query.py | select_hcons | def select_hcons(xmrs, hi=None, relation=None, lo=None):
"""
Return the list of matching HCONS for *xmrs*.
:class:`~delphin.mrs.components.HandleConstraint` objects for
*xmrs* match if their `hi` matches *hi*, `relation` matches
*relation*, and `lo` matches *lo*. The *hi*, *relation*, and *lo*
... | python | def select_hcons(xmrs, hi=None, relation=None, lo=None):
"""
Return the list of matching HCONS for *xmrs*.
:class:`~delphin.mrs.components.HandleConstraint` objects for
*xmrs* match if their `hi` matches *hi*, `relation` matches
*relation*, and `lo` matches *lo*. The *hi*, *relation*, and *lo*
... | [
"def",
"select_hcons",
"(",
"xmrs",
",",
"hi",
"=",
"None",
",",
"relation",
"=",
"None",
",",
"lo",
"=",
"None",
")",
":",
"hcmatch",
"=",
"lambda",
"hc",
":",
"(",
"(",
"hi",
"is",
"None",
"or",
"hc",
".",
"hi",
"==",
"hi",
")",
"and",
"(",
... | Return the list of matching HCONS for *xmrs*.
:class:`~delphin.mrs.components.HandleConstraint` objects for
*xmrs* match if their `hi` matches *hi*, `relation` matches
*relation*, and `lo` matches *lo*. The *hi*, *relation*, and *lo*
filters are ignored if they are `None`.
Args:
xmrs (:cla... | [
"Return",
"the",
"list",
"of",
"matching",
"HCONS",
"for",
"*",
"xmrs",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L158-L180 |
delph-in/pydelphin | delphin/mrs/query.py | select_icons | def select_icons(xmrs, left=None, relation=None, right=None):
"""
Return the list of matching ICONS for *xmrs*.
:class:`~delphin.mrs.components.IndividualConstraint` objects for
*xmrs* match if their `left` matches *left*, `relation` matches
*relation*, and `right` matches *right*. The *left*, *rel... | python | def select_icons(xmrs, left=None, relation=None, right=None):
"""
Return the list of matching ICONS for *xmrs*.
:class:`~delphin.mrs.components.IndividualConstraint` objects for
*xmrs* match if their `left` matches *left*, `relation` matches
*relation*, and `right` matches *right*. The *left*, *rel... | [
"def",
"select_icons",
"(",
"xmrs",
",",
"left",
"=",
"None",
",",
"relation",
"=",
"None",
",",
"right",
"=",
"None",
")",
":",
"icmatch",
"=",
"lambda",
"ic",
":",
"(",
"(",
"left",
"is",
"None",
"or",
"ic",
".",
"left",
"==",
"left",
")",
"and... | Return the list of matching ICONS for *xmrs*.
:class:`~delphin.mrs.components.IndividualConstraint` objects for
*xmrs* match if their `left` matches *left*, `relation` matches
*relation*, and `right` matches *right*. The *left*, *relation*,
and *right* filters are ignored if they are `None`.
Args:... | [
"Return",
"the",
"list",
"of",
"matching",
"ICONS",
"for",
"*",
"xmrs",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L183-L205 |
delph-in/pydelphin | delphin/mrs/query.py | find_argument_target | def find_argument_target(xmrs, nodeid, rargname):
"""
Return the target of an argument (rather than just the variable).
Note:
If the argument value is an intrinsic variable whose target is
an EP that has a quantifier, the non-quantifier EP's nodeid
will be returned. With this nodeid... | python | def find_argument_target(xmrs, nodeid, rargname):
"""
Return the target of an argument (rather than just the variable).
Note:
If the argument value is an intrinsic variable whose target is
an EP that has a quantifier, the non-quantifier EP's nodeid
will be returned. With this nodeid... | [
"def",
"find_argument_target",
"(",
"xmrs",
",",
"nodeid",
",",
"rargname",
")",
":",
"tgt",
"=",
"xmrs",
".",
"args",
"(",
"nodeid",
")",
"[",
"rargname",
"]",
"if",
"tgt",
"in",
"xmrs",
".",
"variables",
"(",
")",
":",
"try",
":",
"return",
"xmrs",... | Return the target of an argument (rather than just the variable).
Note:
If the argument value is an intrinsic variable whose target is
an EP that has a quantifier, the non-quantifier EP's nodeid
will be returned. With this nodeid, one can then use
:meth:`Xmrs.nodeid() <delphin.mrs.x... | [
"Return",
"the",
"target",
"of",
"an",
"argument",
"(",
"rather",
"than",
"just",
"the",
"variable",
")",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L208-L254 |
delph-in/pydelphin | delphin/mrs/query.py | find_subgraphs_by_preds | def find_subgraphs_by_preds(xmrs, preds, connected=None):
"""
Yield subgraphs matching a list of predicates.
Predicates may match multiple EPs/nodes in the *xmrs*, meaning that
more than one subgraph is possible. Also, predicates in *preds*
match in number, so if a predicate appears twice in *preds... | python | def find_subgraphs_by_preds(xmrs, preds, connected=None):
"""
Yield subgraphs matching a list of predicates.
Predicates may match multiple EPs/nodes in the *xmrs*, meaning that
more than one subgraph is possible. Also, predicates in *preds*
match in number, so if a predicate appears twice in *preds... | [
"def",
"find_subgraphs_by_preds",
"(",
"xmrs",
",",
"preds",
",",
"connected",
"=",
"None",
")",
":",
"preds",
"=",
"list",
"(",
"preds",
")",
"count",
"=",
"len",
"(",
"preds",
")",
"# find all lists of nodeids such that the lists have no repeated nids;",
"# keep t... | Yield subgraphs matching a list of predicates.
Predicates may match multiple EPs/nodes in the *xmrs*, meaning that
more than one subgraph is possible. Also, predicates in *preds*
match in number, so if a predicate appears twice in *preds*, there
will be two matching EPs/nodes in each subgraph.
Arg... | [
"Yield",
"subgraphs",
"matching",
"a",
"list",
"of",
"predicates",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L257-L290 |
delph-in/pydelphin | delphin/mrs/query.py | intrinsic_variables | def intrinsic_variables(xmrs):
"""Return the list of all intrinsic variables in *xmrs*"""
ivs = set(
ep.intrinsic_variable for ep in xmrs.eps()
if not ep.is_quantifier() and ep.intrinsic_variable is not None
)
return sorted(ivs, key=var_id) | python | def intrinsic_variables(xmrs):
"""Return the list of all intrinsic variables in *xmrs*"""
ivs = set(
ep.intrinsic_variable for ep in xmrs.eps()
if not ep.is_quantifier() and ep.intrinsic_variable is not None
)
return sorted(ivs, key=var_id) | [
"def",
"intrinsic_variables",
"(",
"xmrs",
")",
":",
"ivs",
"=",
"set",
"(",
"ep",
".",
"intrinsic_variable",
"for",
"ep",
"in",
"xmrs",
".",
"eps",
"(",
")",
"if",
"not",
"ep",
".",
"is_quantifier",
"(",
")",
"and",
"ep",
".",
"intrinsic_variable",
"i... | Return the list of all intrinsic variables in *xmrs* | [
"Return",
"the",
"list",
"of",
"all",
"intrinsic",
"variables",
"in",
"*",
"xmrs",
"*"
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L297-L303 |
delph-in/pydelphin | delphin/mrs/query.py | bound_variables | def bound_variables(xmrs):
"""Return the list of all bound variables in *xmrs*"""
bvs = set(
ep.intrinsic_variable for ep in xmrs.eps()
if ep.is_quantifier() and ep.intrinsic_variable is not None
)
return sorted(bvs, key=var_id) | python | def bound_variables(xmrs):
"""Return the list of all bound variables in *xmrs*"""
bvs = set(
ep.intrinsic_variable for ep in xmrs.eps()
if ep.is_quantifier() and ep.intrinsic_variable is not None
)
return sorted(bvs, key=var_id) | [
"def",
"bound_variables",
"(",
"xmrs",
")",
":",
"bvs",
"=",
"set",
"(",
"ep",
".",
"intrinsic_variable",
"for",
"ep",
"in",
"xmrs",
".",
"eps",
"(",
")",
"if",
"ep",
".",
"is_quantifier",
"(",
")",
"and",
"ep",
".",
"intrinsic_variable",
"is",
"not",
... | Return the list of all bound variables in *xmrs* | [
"Return",
"the",
"list",
"of",
"all",
"bound",
"variables",
"in",
"*",
"xmrs",
"*"
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L305-L311 |
delph-in/pydelphin | delphin/mrs/query.py | in_labelset | def in_labelset(xmrs, nodeids, label=None):
"""
Test if all nodeids share a label.
Args:
nodeids: iterable of nodeids
label (str, optional): the label that all nodeids must share
Returns:
bool: `True` if all nodeids share a label, otherwise `False`
"""
nodeids = set(node... | python | def in_labelset(xmrs, nodeids, label=None):
"""
Test if all nodeids share a label.
Args:
nodeids: iterable of nodeids
label (str, optional): the label that all nodeids must share
Returns:
bool: `True` if all nodeids share a label, otherwise `False`
"""
nodeids = set(node... | [
"def",
"in_labelset",
"(",
"xmrs",
",",
"nodeids",
",",
"label",
"=",
"None",
")",
":",
"nodeids",
"=",
"set",
"(",
"nodeids",
")",
"if",
"label",
"is",
"None",
":",
"label",
"=",
"xmrs",
".",
"ep",
"(",
"next",
"(",
"iter",
"(",
"nodeids",
")",
... | Test if all nodeids share a label.
Args:
nodeids: iterable of nodeids
label (str, optional): the label that all nodeids must share
Returns:
bool: `True` if all nodeids share a label, otherwise `False` | [
"Test",
"if",
"all",
"nodeids",
"share",
"a",
"label",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L313-L326 |
luckydonald/pytgbot | pytgbot/api_types/sendable/files.py | InputFile.get_input_media_referenced_files | def get_input_media_referenced_files(self, var_name):
"""
Generates a tuple with the value for the json/url argument and a dictionary for the multipart file upload.
Will return something which might be similar to
`('attach://{var_name}', {var_name: ('foo.png', open('foo.png', 'rb'), 'ima... | python | def get_input_media_referenced_files(self, var_name):
"""
Generates a tuple with the value for the json/url argument and a dictionary for the multipart file upload.
Will return something which might be similar to
`('attach://{var_name}', {var_name: ('foo.png', open('foo.png', 'rb'), 'ima... | [
"def",
"get_input_media_referenced_files",
"(",
"self",
",",
"var_name",
")",
":",
"# file to be uploaded",
"string",
"=",
"'attach://{name}'",
".",
"format",
"(",
"name",
"=",
"var_name",
")",
"return",
"string",
",",
"self",
".",
"get_request_files",
"(",
"var_n... | Generates a tuple with the value for the json/url argument and a dictionary for the multipart file upload.
Will return something which might be similar to
`('attach://{var_name}', {var_name: ('foo.png', open('foo.png', 'rb'), 'image/png')})`
or in the case of the :class:`InputFileUseFileID` cla... | [
"Generates",
"a",
"tuple",
"with",
"the",
"value",
"for",
"the",
"json",
"/",
"url",
"argument",
"and",
"a",
"dictionary",
"for",
"the",
"multipart",
"file",
"upload",
".",
"Will",
"return",
"something",
"which",
"might",
"be",
"similar",
"to",
"(",
"attac... | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/files.py#L107-L124 |
luckydonald/pytgbot | pytgbot/api_types/sendable/files.py | InputFile.factory | def factory(
cls, file_id=None, path=None, url=None, blob=None, mime=None,
prefer_local_download=True, prefer_str=False, create_instance=True
):
"""
Creates a new InputFile subclass instance fitting the given parameters.
:param prefer_local_download: If `True`, we do... | python | def factory(
cls, file_id=None, path=None, url=None, blob=None, mime=None,
prefer_local_download=True, prefer_str=False, create_instance=True
):
"""
Creates a new InputFile subclass instance fitting the given parameters.
:param prefer_local_download: If `True`, we do... | [
"def",
"factory",
"(",
"cls",
",",
"file_id",
"=",
"None",
",",
"path",
"=",
"None",
",",
"url",
"=",
"None",
",",
"blob",
"=",
"None",
",",
"mime",
"=",
"None",
",",
"prefer_local_download",
"=",
"True",
",",
"prefer_str",
"=",
"False",
",",
"create... | Creates a new InputFile subclass instance fitting the given parameters.
:param prefer_local_download: If `True`, we download the file and send it to telegram. This is the default.
If `False`, we send Telegram just the URL, and they'll try to download it.
:type pre... | [
"Creates",
"a",
"new",
"InputFile",
"subclass",
"instance",
"fitting",
"the",
"given",
"parameters",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/files.py#L149-L228 |
luckydonald/pytgbot | pytgbot/api_types/receivable/passport.py | PassportData.to_array | def to_array(self):
"""
Serializes this PassportData to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportData, self).to_array()
array['data'] = self._as_array(self.data) # type list of EncryptedPassportEleme... | python | def to_array(self):
"""
Serializes this PassportData to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportData, self).to_array()
array['data'] = self._as_array(self.data) # type list of EncryptedPassportEleme... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"PassportData",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'data'",
"]",
"=",
"self",
".",
"_as_array",
"(",
"self",
".",
"data",
")",
"# type list of EncryptedPasspor... | Serializes this PassportData to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"PassportData",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/passport.py#L63-L73 |
luckydonald/pytgbot | pytgbot/api_types/receivable/passport.py | PassportData.from_array | def from_array(array):
"""
Deserialize a new PassportData from a given dictionary.
:return: new PassportData instance.
:rtype: PassportData
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_nam... | python | def from_array(array):
"""
Deserialize a new PassportData from a given dictionary.
:return: new PassportData instance.
:rtype: PassportData
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_nam... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"data",
"=",
"{",
"}",
"da... | Deserialize a new PassportData from a given dictionary.
:return: new PassportData instance.
:rtype: PassportData | [
"Deserialize",
"a",
"new",
"PassportData",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/passport.py#L77-L94 |
luckydonald/pytgbot | pytgbot/api_types/receivable/passport.py | PassportFile.to_array | def to_array(self):
"""
Serializes this PassportFile to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportFile, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
a... | python | def to_array(self):
"""
Serializes this PassportFile to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(PassportFile, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
a... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"PassportFile",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'file_id'",
"]",
"=",
"u",
"(",
"self",
".",
"file_id",
")",
"# py2: type unicode, py3: type str",
"array",
... | Serializes this PassportFile to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"PassportFile",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/passport.py#L186-L197 |
luckydonald/pytgbot | pytgbot/api_types/receivable/passport.py | EncryptedPassportElement.to_array | def to_array(self):
"""
Serializes this EncryptedPassportElement to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(EncryptedPassportElement, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: ... | python | def to_array(self):
"""
Serializes this EncryptedPassportElement to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(EncryptedPassportElement, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: ... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"EncryptedPassportElement",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'type'",
"]",
"=",
"u",
"(",
"self",
".",
"type",
")",
"# py2: type unicode, py3: type str",
"arra... | Serializes this EncryptedPassportElement to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"EncryptedPassportElement",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/passport.py#L373-L401 |
luckydonald/pytgbot | pytgbot/api_types/receivable/passport.py | EncryptedPassportElement.from_array | def from_array(array):
"""
Deserialize a new EncryptedPassportElement from a given dictionary.
:return: new EncryptedPassportElement instance.
:rtype: EncryptedPassportElement
"""
if array is None or not array:
return None
# end if
assert_type... | python | def from_array(array):
"""
Deserialize a new EncryptedPassportElement from a given dictionary.
:return: new EncryptedPassportElement instance.
:rtype: EncryptedPassportElement
"""
if array is None or not array:
return None
# end if
assert_type... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"data",
"=",
"{",
"}",
"da... | Deserialize a new EncryptedPassportElement from a given dictionary.
:return: new EncryptedPassportElement instance.
:rtype: EncryptedPassportElement | [
"Deserialize",
"a",
"new",
"EncryptedPassportElement",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/passport.py#L405-L430 |
luckydonald/pytgbot | pytgbot/api_types/receivable/passport.py | EncryptedCredentials.to_array | def to_array(self):
"""
Serializes this EncryptedCredentials to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(EncryptedCredentials, self).to_array()
array['data'] = u(self.data) # py2: type unicode, py3: type str... | python | def to_array(self):
"""
Serializes this EncryptedCredentials to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(EncryptedCredentials, self).to_array()
array['data'] = u(self.data) # py2: type unicode, py3: type str... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"EncryptedCredentials",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'data'",
"]",
"=",
"u",
"(",
"self",
".",
"data",
")",
"# py2: type unicode, py3: type str",
"array",
... | Serializes this EncryptedCredentials to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"EncryptedCredentials",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/passport.py#L522-L533 |
luckydonald/pytgbot | pytgbot/api_types/receivable/passport.py | EncryptedCredentials.from_array | def from_array(array):
"""
Deserialize a new EncryptedCredentials from a given dictionary.
:return: new EncryptedCredentials instance.
:rtype: EncryptedCredentials
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(ar... | python | def from_array(array):
"""
Deserialize a new EncryptedCredentials from a given dictionary.
:return: new EncryptedCredentials instance.
:rtype: EncryptedCredentials
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(ar... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"data",
"=",
"{",
"}",
"da... | Deserialize a new EncryptedCredentials from a given dictionary.
:return: new EncryptedCredentials instance.
:rtype: EncryptedCredentials | [
"Deserialize",
"a",
"new",
"EncryptedCredentials",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/passport.py#L537-L554 |
luckydonald/pytgbot | pytgbot/bot.py | Bot.get_updates | def get_updates(self, offset=None, limit=100, poll_timeout=0, allowed_updates=None, request_timeout=None, delta=timedelta(milliseconds=100), error_as_empty=False):
"""
Use this method to receive incoming updates using long polling. An Array of Update objects is returned.
You can choose to set `... | python | def get_updates(self, offset=None, limit=100, poll_timeout=0, allowed_updates=None, request_timeout=None, delta=timedelta(milliseconds=100), error_as_empty=False):
"""
Use this method to receive incoming updates using long polling. An Array of Update objects is returned.
You can choose to set `... | [
"def",
"get_updates",
"(",
"self",
",",
"offset",
"=",
"None",
",",
"limit",
"=",
"100",
",",
"poll_timeout",
"=",
"0",
",",
"allowed_updates",
"=",
"None",
",",
"request_timeout",
"=",
"None",
",",
"delta",
"=",
"timedelta",
"(",
"milliseconds",
"=",
"1... | Use this method to receive incoming updates using long polling. An Array of Update objects is returned.
You can choose to set `error_as_empty` to `True` or `False`.
If `error_as_empty` is set to `True`, it will log that exception as warning, and fake an empty result,
intended for use in for loo... | [
"Use",
"this",
"method",
"to",
"receive",
"incoming",
"updates",
"using",
"long",
"polling",
".",
"An",
"Array",
"of",
"Update",
"objects",
"is",
"returned",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L51-L152 |
luckydonald/pytgbot | pytgbot/bot.py | Bot.get_me | def get_me(self):
"""
A simple method for testing your bot's auth token. Requires no parameters.
Returns basic information about the bot in form of a :class:`pytgbot.api_types.receivable.peer.User` object.
https://core.telegram.org/bots/api#getme
Returns:
:return: Ret... | python | def get_me(self):
"""
A simple method for testing your bot's auth token. Requires no parameters.
Returns basic information about the bot in form of a :class:`pytgbot.api_types.receivable.peer.User` object.
https://core.telegram.org/bots/api#getme
Returns:
:return: Ret... | [
"def",
"get_me",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"do",
"(",
"\"getMe\"",
")",
"if",
"self",
".",
"return_python_objects",
":",
"logger",
".",
"debug",
"(",
"\"Trying to parse {data}\"",
".",
"format",
"(",
"data",
"=",
"repr",
"(",
"re... | A simple method for testing your bot's auth token. Requires no parameters.
Returns basic information about the bot in form of a :class:`pytgbot.api_types.receivable.peer.User` object.
https://core.telegram.org/bots/api#getme
Returns:
:return: Returns basic information about the bot i... | [
"A",
"simple",
"method",
"for",
"testing",
"your",
"bot",
"s",
"auth",
"token",
".",
"Requires",
"no",
"parameters",
".",
"Returns",
"basic",
"information",
"about",
"the",
"bot",
"in",
"form",
"of",
"a",
":",
"class",
":",
"pytgbot",
".",
"api_types",
"... | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L296-L321 |
luckydonald/pytgbot | pytgbot/bot.py | Bot.forward_message | def forward_message(self, chat_id, from_chat_id, message_id, disable_notification=False):
"""
Use this method to forward messages of any kind. On success, the sent Message is returned.
https://core.telegram.org/bots/api#forwardmessage
Parameters:
:param chat_id: Unique identif... | python | def forward_message(self, chat_id, from_chat_id, message_id, disable_notification=False):
"""
Use this method to forward messages of any kind. On success, the sent Message is returned.
https://core.telegram.org/bots/api#forwardmessage
Parameters:
:param chat_id: Unique identif... | [
"def",
"forward_message",
"(",
"self",
",",
"chat_id",
",",
"from_chat_id",
",",
"message_id",
",",
"disable_notification",
"=",
"False",
")",
":",
"assert_type_or_raise",
"(",
"chat_id",
",",
"(",
"int",
",",
"unicode_type",
")",
",",
"parameter_name",
"=",
"... | Use this method to forward messages of any kind. On success, the sent Message is returned.
https://core.telegram.org/bots/api#forwardmessage
Parameters:
:param chat_id: Unique identifier for the target chat (chat id of user chat or group chat) or username of the
target... | [
"Use",
"this",
"method",
"to",
"forward",
"messages",
"of",
"any",
"kind",
".",
"On",
"success",
"the",
"sent",
"Message",
"is",
"returned",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L404-L458 |
luckydonald/pytgbot | pytgbot/bot.py | Bot.send_media_group | def send_media_group(self, chat_id, media, disable_notification=None, reply_to_message_id=None):
"""
Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
https://core.telegram.org/bots/api#sendmediagroup
Parameters:
... | python | def send_media_group(self, chat_id, media, disable_notification=None, reply_to_message_id=None):
"""
Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
https://core.telegram.org/bots/api#sendmediagroup
Parameters:
... | [
"def",
"send_media_group",
"(",
"self",
",",
"chat_id",
",",
"media",
",",
"disable_notification",
"=",
"None",
",",
"reply_to_message_id",
"=",
"None",
")",
":",
"assert_type_or_raise",
"(",
"chat_id",
",",
"(",
"int",
",",
"unicode_type",
")",
",",
"paramete... | Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
https://core.telegram.org/bots/api#sendmediagroup
Parameters:
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channe... | [
"Use",
"this",
"method",
"to",
"send",
"a",
"group",
"of",
"photos",
"or",
"videos",
"as",
"an",
"album",
".",
"On",
"success",
"an",
"array",
"of",
"the",
"sent",
"Messages",
"is",
"returned",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L1149-L1213 |
luckydonald/pytgbot | pytgbot/bot.py | Bot.answer_inline_query | def answer_inline_query(self, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None,
switch_pm_text=None, switch_pm_parameter=None):
"""
Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results p... | python | def answer_inline_query(self, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None,
switch_pm_text=None, switch_pm_parameter=None):
"""
Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results p... | [
"def",
"answer_inline_query",
"(",
"self",
",",
"inline_query_id",
",",
"results",
",",
"cache_time",
"=",
"None",
",",
"is_personal",
"=",
"None",
",",
"next_offset",
"=",
"None",
",",
"switch_pm_text",
"=",
"None",
",",
"switch_pm_parameter",
"=",
"None",
")... | Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.
https://core.telegram.org/bots/api#answerinlinequery
Parameters:
:param inline_query_id: Unique identifier for the answered query
:type inline_que... | [
"Use",
"this",
"method",
"to",
"send",
"answers",
"to",
"an",
"inline",
"query",
".",
"On",
"success",
"True",
"is",
"returned",
".",
"No",
"more",
"than",
"50",
"results",
"per",
"query",
"are",
"allowed",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L3286-L3392 |
luckydonald/pytgbot | pytgbot/bot.py | Bot.set_game_score | def set_game_score(self, user_id, score, force=False, disable_edit_message=False, chat_id=None, message_id=None, inline_message_id=None):
"""
Use this method to set the score of the specified user in a game.
On success, if the message was sent by the bot, returns the edited Message, otherwise re... | python | def set_game_score(self, user_id, score, force=False, disable_edit_message=False, chat_id=None, message_id=None, inline_message_id=None):
"""
Use this method to set the score of the specified user in a game.
On success, if the message was sent by the bot, returns the edited Message, otherwise re... | [
"def",
"set_game_score",
"(",
"self",
",",
"user_id",
",",
"score",
",",
"force",
"=",
"False",
",",
"disable_edit_message",
"=",
"False",
",",
"chat_id",
"=",
"None",
",",
"message_id",
"=",
"None",
",",
"inline_message_id",
"=",
"None",
")",
":",
"assert... | Use this method to set the score of the specified user in a game.
On success, if the message was sent by the bot, returns the edited Message, otherwise returns True.
Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
https://core.tele... | [
"Use",
"this",
"method",
"to",
"set",
"the",
"score",
"of",
"the",
"specified",
"user",
"in",
"a",
"game",
".",
"On",
"success",
"if",
"the",
"message",
"was",
"sent",
"by",
"the",
"bot",
"returns",
"the",
"edited",
"Message",
"otherwise",
"returns",
"Tr... | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L3759-L3833 |
luckydonald/pytgbot | pytgbot/bot.py | Bot._postprocess_request | def _postprocess_request(self, r):
"""
This converts the response to either the response or a parsed :class:`pytgbot.api_types.receivable.Receivable`.
:param r: the request response
:type r: requests.Response
:return: The json response from the server, or, if `self.return_pyth... | python | def _postprocess_request(self, r):
"""
This converts the response to either the response or a parsed :class:`pytgbot.api_types.receivable.Receivable`.
:param r: the request response
:type r: requests.Response
:return: The json response from the server, or, if `self.return_pyth... | [
"def",
"_postprocess_request",
"(",
"self",
",",
"r",
")",
":",
"from",
"DictObject",
"import",
"DictObject",
"import",
"requests",
"assert",
"isinstance",
"(",
"r",
",",
"requests",
".",
"Response",
")",
"try",
":",
"logger",
".",
"debug",
"(",
"r",
".",
... | This converts the response to either the response or a parsed :class:`pytgbot.api_types.receivable.Receivable`.
:param r: the request response
:type r: requests.Response
:return: The json response from the server, or, if `self.return_python_objects` is `True`, a parsed return type.
:r... | [
"This",
"converts",
"the",
"response",
"to",
"either",
"the",
"response",
"or",
"a",
"parsed",
":",
"class",
":",
"pytgbot",
".",
"api_types",
".",
"receivable",
".",
"Receivable",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L3964-L4001 |
luckydonald/pytgbot | pytgbot/bot.py | Bot._do_fileupload | def _do_fileupload(self, file_param_name, value, _command=None, _file_is_optional=False, **kwargs):
"""
:param file_param_name: For what field the file should be uploaded.
:type file_param_name: str
:param value: File to send. You can either pass a file_id as String to resend a file
... | python | def _do_fileupload(self, file_param_name, value, _command=None, _file_is_optional=False, **kwargs):
"""
:param file_param_name: For what field the file should be uploaded.
:type file_param_name: str
:param value: File to send. You can either pass a file_id as String to resend a file
... | [
"def",
"_do_fileupload",
"(",
"self",
",",
"file_param_name",
",",
"value",
",",
"_command",
"=",
"None",
",",
"_file_is_optional",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"api_types",
".",
"sendable",
".",
"files",
"import",
"InputFi... | :param file_param_name: For what field the file should be uploaded.
:type file_param_name: str
:param value: File to send. You can either pass a file_id as String to resend a file
file that is already on the Telegram servers, or upload a new file,
specifying... | [
":",
"param",
"file_param_name",
":",
"For",
"what",
"field",
"the",
"file",
"should",
"be",
"uploaded",
".",
":",
"type",
"file_param_name",
":",
"str"
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/bot.py#L4004-L4064 |
luckydonald/pytgbot | code_generation/output/pytgbot/api_types/sendable/payments.py | LabeledPrice.to_array | def to_array(self):
"""
Serializes this LabeledPrice to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(LabeledPrice, self).to_array()
array['label'] = u(self.label) # py2: type unicode, py3: type str
arra... | python | def to_array(self):
"""
Serializes this LabeledPrice to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(LabeledPrice, self).to_array()
array['label'] = u(self.label) # py2: type unicode, py3: type str
arra... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"LabeledPrice",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'label'",
"]",
"=",
"u",
"(",
"self",
".",
"label",
")",
"# py2: type unicode, py3: type str",
"array",
"[",... | Serializes this LabeledPrice to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"LabeledPrice",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/sendable/payments.py#L53-L64 |
luckydonald/pytgbot | code_generation/output/pytgbot/api_types/sendable/payments.py | LabeledPrice.from_array | def from_array(array):
"""
Deserialize a new LabeledPrice from a given dictionary.
:return: new LabeledPrice instance.
:rtype: LabeledPrice
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_nam... | python | def from_array(array):
"""
Deserialize a new LabeledPrice from a given dictionary.
:return: new LabeledPrice instance.
:rtype: LabeledPrice
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, parameter_nam... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"data",
"=",
"{",
"}",
"da... | Deserialize a new LabeledPrice from a given dictionary.
:return: new LabeledPrice instance.
:rtype: LabeledPrice | [
"Deserialize",
"a",
"new",
"LabeledPrice",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/sendable/payments.py#L68-L86 |
luckydonald/pytgbot | code_generation/output/pytgbot/api_types/sendable/payments.py | ShippingOption.to_array | def to_array(self):
"""
Serializes this ShippingOption to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ShippingOption, self).to_array()
array['id'] = u(self.id) # py2: type unicode, py3: type str
array[... | python | def to_array(self):
"""
Serializes this ShippingOption to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(ShippingOption, self).to_array()
array['id'] = u(self.id) # py2: type unicode, py3: type str
array[... | [
"def",
"to_array",
"(",
"self",
")",
":",
"array",
"=",
"super",
"(",
"ShippingOption",
",",
"self",
")",
".",
"to_array",
"(",
")",
"array",
"[",
"'id'",
"]",
"=",
"u",
"(",
"self",
".",
"id",
")",
"# py2: type unicode, py3: type str",
"array",
"[",
"... | Serializes this ShippingOption to a dictionary.
:return: dictionary representation of this object.
:rtype: dict | [
"Serializes",
"this",
"ShippingOption",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/sendable/payments.py#L171-L185 |
luckydonald/pytgbot | code_generation/output/pytgbot/api_types/sendable/payments.py | ShippingOption.from_array | def from_array(array):
"""
Deserialize a new ShippingOption from a given dictionary.
:return: new ShippingOption instance.
:rtype: ShippingOption
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, paramet... | python | def from_array(array):
"""
Deserialize a new ShippingOption from a given dictionary.
:return: new ShippingOption instance.
:rtype: ShippingOption
"""
if array is None or not array:
return None
# end if
assert_type_or_raise(array, dict, paramet... | [
"def",
"from_array",
"(",
"array",
")",
":",
"if",
"array",
"is",
"None",
"or",
"not",
"array",
":",
"return",
"None",
"# end if",
"assert_type_or_raise",
"(",
"array",
",",
"dict",
",",
"parameter_name",
"=",
"\"array\"",
")",
"from",
"pytgbot",
".",
"api... | Deserialize a new ShippingOption from a given dictionary.
:return: new ShippingOption instance.
:rtype: ShippingOption | [
"Deserialize",
"a",
"new",
"ShippingOption",
"from",
"a",
"given",
"dictionary",
"."
] | train | https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/sendable/payments.py#L189-L210 |
delph-in/pydelphin | delphin/itsdb.py | _prepare_target | def _prepare_target(ts, tables, buffer_size):
"""Clear tables affected by the processing."""
for tablename in tables:
table = ts[tablename]
table[:] = []
if buffer_size is not None and table.is_attached():
table.write(append=False) | python | def _prepare_target(ts, tables, buffer_size):
"""Clear tables affected by the processing."""
for tablename in tables:
table = ts[tablename]
table[:] = []
if buffer_size is not None and table.is_attached():
table.write(append=False) | [
"def",
"_prepare_target",
"(",
"ts",
",",
"tables",
",",
"buffer_size",
")",
":",
"for",
"tablename",
"in",
"tables",
":",
"table",
"=",
"ts",
"[",
"tablename",
"]",
"table",
"[",
":",
"]",
"=",
"[",
"]",
"if",
"buffer_size",
"is",
"not",
"None",
"an... | Clear tables affected by the processing. | [
"Clear",
"tables",
"affected",
"by",
"the",
"processing",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1289-L1295 |
delph-in/pydelphin | delphin/itsdb.py | _prepare_source | def _prepare_source(selector, source):
"""Normalize source rows and selectors."""
tablename, fields = get_data_specifier(selector)
if len(fields) != 1:
raise ItsdbError(
'Selector must specify exactly one data column: {}'
.format(selector)
)
if isinstance(source, ... | python | def _prepare_source(selector, source):
"""Normalize source rows and selectors."""
tablename, fields = get_data_specifier(selector)
if len(fields) != 1:
raise ItsdbError(
'Selector must specify exactly one data column: {}'
.format(selector)
)
if isinstance(source, ... | [
"def",
"_prepare_source",
"(",
"selector",
",",
"source",
")",
":",
"tablename",
",",
"fields",
"=",
"get_data_specifier",
"(",
"selector",
")",
"if",
"len",
"(",
"fields",
")",
"!=",
"1",
":",
"raise",
"ItsdbError",
"(",
"'Selector must specify exactly one data... | Normalize source rows and selectors. | [
"Normalize",
"source",
"rows",
"and",
"selectors",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1298-L1311 |
delph-in/pydelphin | delphin/itsdb.py | _add_record | def _add_record(table, data, buffer_size):
"""
Prepare and append a Record into its Table; flush to disk if necessary.
"""
fields = table.fields
# remove any keys that aren't relation fields
for invalid_key in set(data).difference([f.name for f in fields]):
del data[invalid_key]
tabl... | python | def _add_record(table, data, buffer_size):
"""
Prepare and append a Record into its Table; flush to disk if necessary.
"""
fields = table.fields
# remove any keys that aren't relation fields
for invalid_key in set(data).difference([f.name for f in fields]):
del data[invalid_key]
tabl... | [
"def",
"_add_record",
"(",
"table",
",",
"data",
",",
"buffer_size",
")",
":",
"fields",
"=",
"table",
".",
"fields",
"# remove any keys that aren't relation fields",
"for",
"invalid_key",
"in",
"set",
"(",
"data",
")",
".",
"difference",
"(",
"[",
"f",
".",
... | Prepare and append a Record into its Table; flush to disk if necessary. | [
"Prepare",
"and",
"append",
"a",
"Record",
"into",
"its",
"Table",
";",
"flush",
"to",
"disk",
"if",
"necessary",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1314-L1328 |
delph-in/pydelphin | delphin/itsdb.py | get_data_specifier | def get_data_specifier(string):
"""
Return a tuple (table, col) for some [incr tsdb()] data specifier.
For example::
item -> ('item', None)
item:i-input -> ('item', ['i-input'])
item:i-input@i-wf -> ('item', ['i-input', 'i-wf'])
:i-input -> (None, ... | python | def get_data_specifier(string):
"""
Return a tuple (table, col) for some [incr tsdb()] data specifier.
For example::
item -> ('item', None)
item:i-input -> ('item', ['i-input'])
item:i-input@i-wf -> ('item', ['i-input', 'i-wf'])
:i-input -> (None, ... | [
"def",
"get_data_specifier",
"(",
"string",
")",
":",
"match",
"=",
"data_specifier_re",
".",
"match",
"(",
"string",
")",
"if",
"match",
"is",
"None",
":",
"return",
"(",
"None",
",",
"None",
")",
"table",
"=",
"match",
".",
"group",
"(",
"'table'",
"... | Return a tuple (table, col) for some [incr tsdb()] data specifier.
For example::
item -> ('item', None)
item:i-input -> ('item', ['i-input'])
item:i-input@i-wf -> ('item', ['i-input', 'i-wf'])
:i-input -> (None, ['i-input'])
(otherwise) -> (N... | [
"Return",
"a",
"tuple",
"(",
"table",
"col",
")",
"for",
"some",
"[",
"incr",
"tsdb",
"()",
"]",
"data",
"specifier",
".",
"For",
"example",
"::"
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1335-L1353 |
delph-in/pydelphin | delphin/itsdb.py | decode_row | def decode_row(line, fields=None):
"""
Decode a raw line from a profile into a list of column values.
Decoding involves splitting the line by the field delimiter
(`"@"` by default) and unescaping special characters. If *fields*
is given, cast the values into the datatype given by their
respecti... | python | def decode_row(line, fields=None):
"""
Decode a raw line from a profile into a list of column values.
Decoding involves splitting the line by the field delimiter
(`"@"` by default) and unescaping special characters. If *fields*
is given, cast the values into the datatype given by their
respecti... | [
"def",
"decode_row",
"(",
"line",
",",
"fields",
"=",
"None",
")",
":",
"cols",
"=",
"line",
".",
"rstrip",
"(",
"'\\n'",
")",
".",
"split",
"(",
"_field_delimiter",
")",
"cols",
"=",
"list",
"(",
"map",
"(",
"unescape",
",",
"cols",
")",
")",
"if"... | Decode a raw line from a profile into a list of column values.
Decoding involves splitting the line by the field delimiter
(`"@"` by default) and unescaping special characters. If *fields*
is given, cast the values into the datatype given by their
respective Field object.
Args:
line: a raw... | [
"Decode",
"a",
"raw",
"line",
"from",
"a",
"profile",
"into",
"a",
"list",
"of",
"column",
"values",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1362-L1391 |
delph-in/pydelphin | delphin/itsdb.py | encode_row | def encode_row(fields):
"""
Encode a list of column values into a [incr tsdb()] profile line.
Encoding involves escaping special characters for each value, then
joining the values into a single string with the field delimiter
(`"@"` by default). It does not fill in default values (see
make_row(... | python | def encode_row(fields):
"""
Encode a list of column values into a [incr tsdb()] profile line.
Encoding involves escaping special characters for each value, then
joining the values into a single string with the field delimiter
(`"@"` by default). It does not fill in default values (see
make_row(... | [
"def",
"encode_row",
"(",
"fields",
")",
":",
"# NOTE: str(f) only works for Python3",
"unicode_fields",
"=",
"[",
"unicode",
"(",
"f",
")",
"for",
"f",
"in",
"fields",
"]",
"escaped_fields",
"=",
"map",
"(",
"escape",
",",
"unicode_fields",
")",
"return",
"_f... | Encode a list of column values into a [incr tsdb()] profile line.
Encoding involves escaping special characters for each value, then
joining the values into a single string with the field delimiter
(`"@"` by default). It does not fill in default values (see
make_row()).
Args:
fields: a lis... | [
"Encode",
"a",
"list",
"of",
"column",
"values",
"into",
"a",
"[",
"incr",
"tsdb",
"()",
"]",
"profile",
"line",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1418-L1435 |
delph-in/pydelphin | delphin/itsdb.py | _table_filename | def _table_filename(tbl_filename):
"""
Determine if the table path should end in .gz or not and return it.
A .gz path is preferred only if it exists and is newer than any
regular text file path.
Raises:
:class:`delphin.exceptions.ItsdbError`: when neither the .gz
nor text file ... | python | def _table_filename(tbl_filename):
"""
Determine if the table path should end in .gz or not and return it.
A .gz path is preferred only if it exists and is newer than any
regular text file path.
Raises:
:class:`delphin.exceptions.ItsdbError`: when neither the .gz
nor text file ... | [
"def",
"_table_filename",
"(",
"tbl_filename",
")",
":",
"tbl_filename",
"=",
"str",
"(",
"tbl_filename",
")",
"# convert any Path objects",
"txfn",
"=",
"_normalize_table_path",
"(",
"tbl_filename",
")",
"gzfn",
"=",
"txfn",
"+",
"'.gz'",
"if",
"os",
".",
"path... | Determine if the table path should end in .gz or not and return it.
A .gz path is preferred only if it exists and is newer than any
regular text file path.
Raises:
:class:`delphin.exceptions.ItsdbError`: when neither the .gz
nor text file exist. | [
"Determine",
"if",
"the",
"table",
"path",
"should",
"end",
"in",
".",
"gz",
"or",
"not",
"and",
"return",
"it",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1478-L1508 |
delph-in/pydelphin | delphin/itsdb.py | _open_table | def _open_table(tbl_filename, encoding):
"""
Transparently open the compressed or text table file.
Can be used as a context manager in a 'with' statement.
"""
path = _table_filename(tbl_filename)
if path.endswith('.gz'):
# gzip.open() cannot use mode='rt' until Python2.7 support
... | python | def _open_table(tbl_filename, encoding):
"""
Transparently open the compressed or text table file.
Can be used as a context manager in a 'with' statement.
"""
path = _table_filename(tbl_filename)
if path.endswith('.gz'):
# gzip.open() cannot use mode='rt' until Python2.7 support
... | [
"def",
"_open_table",
"(",
"tbl_filename",
",",
"encoding",
")",
":",
"path",
"=",
"_table_filename",
"(",
"tbl_filename",
")",
"if",
"path",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"# gzip.open() cannot use mode='rt' until Python2.7 support",
"# is gone; until then us... | Transparently open the compressed or text table file.
Can be used as a context manager in a 'with' statement. | [
"Transparently",
"open",
"the",
"compressed",
"or",
"text",
"table",
"file",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1512-L1528 |
delph-in/pydelphin | delphin/itsdb.py | make_row | def make_row(row, fields):
"""
Encode a mapping of column name to values into a [incr tsdb()]
profile line. The *fields* parameter determines what columns are
used, and default values are provided if a column is missing from
the mapping.
Args:
row: a mapping of column names to values
... | python | def make_row(row, fields):
"""
Encode a mapping of column name to values into a [incr tsdb()]
profile line. The *fields* parameter determines what columns are
used, and default values are provided if a column is missing from
the mapping.
Args:
row: a mapping of column names to values
... | [
"def",
"make_row",
"(",
"row",
",",
"fields",
")",
":",
"if",
"not",
"hasattr",
"(",
"row",
",",
"'get'",
")",
":",
"row",
"=",
"{",
"f",
".",
"name",
":",
"col",
"for",
"f",
",",
"col",
"in",
"zip",
"(",
"fields",
",",
"row",
")",
"}",
"row_... | Encode a mapping of column name to values into a [incr tsdb()]
profile line. The *fields* parameter determines what columns are
used, and default values are provided if a column is missing from
the mapping.
Args:
row: a mapping of column names to values
fields: an iterable of :class:`Fi... | [
"Encode",
"a",
"mapping",
"of",
"column",
"name",
"to",
"values",
"into",
"a",
"[",
"incr",
"tsdb",
"()",
"]",
"profile",
"line",
".",
"The",
"*",
"fields",
"*",
"parameter",
"determines",
"what",
"columns",
"are",
"used",
"and",
"default",
"values",
"ar... | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1578-L1600 |
delph-in/pydelphin | delphin/itsdb.py | select_rows | def select_rows(cols, rows, mode='list', cast=True):
"""
Yield data selected from rows.
It is sometimes useful to select a subset of data from a profile.
This function selects the data in *cols* from *rows* and yields it
in a form specified by *mode*. Possible values of *mode* are:
===========... | python | def select_rows(cols, rows, mode='list', cast=True):
"""
Yield data selected from rows.
It is sometimes useful to select a subset of data from a profile.
This function selects the data in *cols* from *rows* and yields it
in a form specified by *mode*. Possible values of *mode* are:
===========... | [
"def",
"select_rows",
"(",
"cols",
",",
"rows",
",",
"mode",
"=",
"'list'",
",",
"cast",
"=",
"True",
")",
":",
"mode",
"=",
"mode",
".",
"lower",
"(",
")",
"if",
"mode",
"==",
"'list'",
":",
"modecast",
"=",
"lambda",
"cols",
",",
"data",
":",
"... | Yield data selected from rows.
It is sometimes useful to select a subset of data from a profile.
This function selects the data in *cols* from *rows* and yields it
in a form specified by *mode*. Possible values of *mode* are:
================== ================= ==========================
mode ... | [
"Yield",
"data",
"selected",
"from",
"rows",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1603-L1645 |
delph-in/pydelphin | delphin/itsdb.py | match_rows | def match_rows(rows1, rows2, key, sort_keys=True):
"""
Yield triples of `(value, left_rows, right_rows)` where
`left_rows` and `right_rows` are lists of rows that share the same
column value for *key*. This means that both *rows1* and *rows2*
must have a column with the same name *key*.
.. warn... | python | def match_rows(rows1, rows2, key, sort_keys=True):
"""
Yield triples of `(value, left_rows, right_rows)` where
`left_rows` and `right_rows` are lists of rows that share the same
column value for *key*. This means that both *rows1* and *rows2*
must have a column with the same name *key*.
.. warn... | [
"def",
"match_rows",
"(",
"rows1",
",",
"rows2",
",",
"key",
",",
"sort_keys",
"=",
"True",
")",
":",
"matched",
"=",
"OrderedDict",
"(",
")",
"for",
"i",
",",
"rows",
"in",
"enumerate",
"(",
"[",
"rows1",
",",
"rows2",
"]",
")",
":",
"for",
"row",... | Yield triples of `(value, left_rows, right_rows)` where
`left_rows` and `right_rows` are lists of rows that share the same
column value for *key*. This means that both *rows1* and *rows2*
must have a column with the same name *key*.
.. warning::
Both *rows1* and *rows2* will exist in memory for... | [
"Yield",
"triples",
"of",
"(",
"value",
"left_rows",
"right_rows",
")",
"where",
"left_rows",
"and",
"right_rows",
"are",
"lists",
"of",
"rows",
"that",
"share",
"the",
"same",
"column",
"value",
"for",
"*",
"key",
"*",
".",
"This",
"means",
"that",
"both"... | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1648-L1683 |
delph-in/pydelphin | delphin/itsdb.py | join | def join(table1, table2, on=None, how='inner', name=None):
"""
Join two tables and return the resulting Table object.
Fields in the resulting table have their names prefixed with their
corresponding table name. For example, when joining `item` and
`parse` tables, the `i-input` field of the `item` t... | python | def join(table1, table2, on=None, how='inner', name=None):
"""
Join two tables and return the resulting Table object.
Fields in the resulting table have their names prefixed with their
corresponding table name. For example, when joining `item` and
`parse` tables, the `i-input` field of the `item` t... | [
"def",
"join",
"(",
"table1",
",",
"table2",
",",
"on",
"=",
"None",
",",
"how",
"=",
"'inner'",
",",
"name",
"=",
"None",
")",
":",
"if",
"how",
"not",
"in",
"(",
"'inner'",
",",
"'left'",
")",
":",
"ItsdbError",
"(",
"'Only \\'inner\\' and \\'left\\'... | Join two tables and return the resulting Table object.
Fields in the resulting table have their names prefixed with their
corresponding table name. For example, when joining `item` and
`parse` tables, the `i-input` field of the `item` table will be
named `item:i-input` in the resulting Table. Pivot fie... | [
"Join",
"two",
"tables",
"and",
"return",
"the",
"resulting",
"Table",
"object",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1686-L1734 |
delph-in/pydelphin | delphin/itsdb.py | default_value | def default_value(fieldname, datatype):
"""
Return the default value for a column.
If the column name (e.g. *i-wf*) is defined to have an idiosyncratic
value, that value is returned. Otherwise the default value for the
column's datatype is returned.
Args:
fieldname: the column name (e.... | python | def default_value(fieldname, datatype):
"""
Return the default value for a column.
If the column name (e.g. *i-wf*) is defined to have an idiosyncratic
value, that value is returned. Otherwise the default value for the
column's datatype is returned.
Args:
fieldname: the column name (e.... | [
"def",
"default_value",
"(",
"fieldname",
",",
"datatype",
")",
":",
"if",
"fieldname",
"in",
"tsdb_coded_attributes",
":",
"return",
"str",
"(",
"tsdb_coded_attributes",
"[",
"fieldname",
"]",
")",
"else",
":",
"return",
"_default_datatype_values",
".",
"get",
... | Return the default value for a column.
If the column name (e.g. *i-wf*) is defined to have an idiosyncratic
value, that value is returned. Otherwise the default value for the
column's datatype is returned.
Args:
fieldname: the column name (e.g. `i-wf`)
datatype: the datatype of the col... | [
"Return",
"the",
"default",
"value",
"for",
"a",
"column",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1772-L1791 |
delph-in/pydelphin | delphin/itsdb.py | make_skeleton | def make_skeleton(path, relations, item_rows, gzip=False):
"""
Instantiate a new profile skeleton (only the relations file and
item file) from an existing relations file and a list of rows
for the item table. For standard relations files, it is suggested
to have, as a minimum, the `i-id` and `i-inpu... | python | def make_skeleton(path, relations, item_rows, gzip=False):
"""
Instantiate a new profile skeleton (only the relations file and
item file) from an existing relations file and a list of rows
for the item table. For standard relations files, it is suggested
to have, as a minimum, the `i-id` and `i-inpu... | [
"def",
"make_skeleton",
"(",
"path",
",",
"relations",
",",
"item_rows",
",",
"gzip",
"=",
"False",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
":",
"raise",
"ItsdbError",
"(",
"'Path already exists: {}.'",
".",
"for... | Instantiate a new profile skeleton (only the relations file and
item file) from an existing relations file and a list of rows
for the item table. For standard relations files, it is suggested
to have, as a minimum, the `i-id` and `i-input` fields in the
item rows.
Args:
path: the destinatio... | [
"Instantiate",
"a",
"new",
"profile",
"skeleton",
"(",
"only",
"the",
"relations",
"file",
"and",
"item",
"file",
")",
"from",
"an",
"existing",
"relations",
"file",
"and",
"a",
"list",
"of",
"rows",
"for",
"the",
"item",
"table",
".",
"For",
"standard",
... | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1795-L1827 |
delph-in/pydelphin | delphin/itsdb.py | filter_rows | def filter_rows(filters, rows):
"""
Yield rows matching all applicable filters.
Filter functions have binary arity (e.g. `filter(row, col)`) where
the first parameter is the dictionary of row data, and the second
parameter is the data at one particular column.
Args:
filters: a tuple of... | python | def filter_rows(filters, rows):
"""
Yield rows matching all applicable filters.
Filter functions have binary arity (e.g. `filter(row, col)`) where
the first parameter is the dictionary of row data, and the second
parameter is the data at one particular column.
Args:
filters: a tuple of... | [
"def",
"filter_rows",
"(",
"filters",
",",
"rows",
")",
":",
"for",
"row",
"in",
"rows",
":",
"if",
"all",
"(",
"condition",
"(",
"row",
",",
"row",
".",
"get",
"(",
"col",
")",
")",
"for",
"(",
"cols",
",",
"condition",
")",
"in",
"filters",
"fo... | Yield rows matching all applicable filters.
Filter functions have binary arity (e.g. `filter(row, col)`) where
the first parameter is the dictionary of row data, and the second
parameter is the data at one particular column.
Args:
filters: a tuple of (cols, filter_func) where filter_func will
... | [
"Yield",
"rows",
"matching",
"all",
"applicable",
"filters",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1831-L1854 |
delph-in/pydelphin | delphin/itsdb.py | apply_rows | def apply_rows(applicators, rows):
"""
Yield rows after applying the applicator functions to them.
Applicators are simple unary functions that return a value, and that
value is stored in the yielded row. E.g.
`row[col] = applicator(row[col])`. These are useful to, e.g., cast
strings to numeric ... | python | def apply_rows(applicators, rows):
"""
Yield rows after applying the applicator functions to them.
Applicators are simple unary functions that return a value, and that
value is stored in the yielded row. E.g.
`row[col] = applicator(row[col])`. These are useful to, e.g., cast
strings to numeric ... | [
"def",
"apply_rows",
"(",
"applicators",
",",
"rows",
")",
":",
"for",
"row",
"in",
"rows",
":",
"for",
"(",
"cols",
",",
"function",
")",
"in",
"applicators",
":",
"for",
"col",
"in",
"(",
"cols",
"or",
"[",
"]",
")",
":",
"value",
"=",
"row",
"... | Yield rows after applying the applicator functions to them.
Applicators are simple unary functions that return a value, and that
value is stored in the yielded row. E.g.
`row[col] = applicator(row[col])`. These are useful to, e.g., cast
strings to numeric datatypes, to convert formats stored in a cell,... | [
"Yield",
"rows",
"after",
"applying",
"the",
"applicator",
"functions",
"to",
"them",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1858-L1883 |
delph-in/pydelphin | delphin/itsdb.py | Field.default_value | def default_value(self):
"""Get the default value of the field."""
if self.name in tsdb_coded_attributes:
return tsdb_coded_attributes[self.name]
elif self.datatype == ':integer':
return -1
else:
return '' | python | def default_value(self):
"""Get the default value of the field."""
if self.name in tsdb_coded_attributes:
return tsdb_coded_attributes[self.name]
elif self.datatype == ':integer':
return -1
else:
return '' | [
"def",
"default_value",
"(",
"self",
")",
":",
"if",
"self",
".",
"name",
"in",
"tsdb_coded_attributes",
":",
"return",
"tsdb_coded_attributes",
"[",
"self",
".",
"name",
"]",
"elif",
"self",
".",
"datatype",
"==",
"':integer'",
":",
"return",
"-",
"1",
"e... | Get the default value of the field. | [
"Get",
"the",
"default",
"value",
"of",
"the",
"field",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L183-L190 |
delph-in/pydelphin | delphin/itsdb.py | Relation.keys | def keys(self):
"""Return the tuple of field names of key fields."""
keys = self._keys
if keys is None:
keys = tuple(self[i].name for i in self.key_indices)
return keys | python | def keys(self):
"""Return the tuple of field names of key fields."""
keys = self._keys
if keys is None:
keys = tuple(self[i].name for i in self.key_indices)
return keys | [
"def",
"keys",
"(",
"self",
")",
":",
"keys",
"=",
"self",
".",
"_keys",
"if",
"keys",
"is",
"None",
":",
"keys",
"=",
"tuple",
"(",
"self",
"[",
"i",
"]",
".",
"name",
"for",
"i",
"in",
"self",
".",
"key_indices",
")",
"return",
"keys"
] | Return the tuple of field names of key fields. | [
"Return",
"the",
"tuple",
"of",
"field",
"names",
"of",
"key",
"fields",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L219-L224 |
delph-in/pydelphin | delphin/itsdb.py | Relations.from_file | def from_file(cls, source):
"""Instantiate Relations from a relations file."""
if hasattr(source, 'read'):
relations = cls.from_string(source.read())
else:
with open(source) as f:
relations = cls.from_string(f.read())
return relations | python | def from_file(cls, source):
"""Instantiate Relations from a relations file."""
if hasattr(source, 'read'):
relations = cls.from_string(source.read())
else:
with open(source) as f:
relations = cls.from_string(f.read())
return relations | [
"def",
"from_file",
"(",
"cls",
",",
"source",
")",
":",
"if",
"hasattr",
"(",
"source",
",",
"'read'",
")",
":",
"relations",
"=",
"cls",
".",
"from_string",
"(",
"source",
".",
"read",
"(",
")",
")",
"else",
":",
"with",
"open",
"(",
"source",
")... | Instantiate Relations from a relations file. | [
"Instantiate",
"Relations",
"from",
"a",
"relations",
"file",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L324-L331 |
delph-in/pydelphin | delphin/itsdb.py | Relations.from_string | def from_string(cls, s):
"""Instantiate Relations from a relations string."""
tables = []
seen = set()
current_table = None
lines = list(reversed(s.splitlines())) # to pop() in right order
while lines:
line = lines.pop().strip()
table_m = re.match... | python | def from_string(cls, s):
"""Instantiate Relations from a relations string."""
tables = []
seen = set()
current_table = None
lines = list(reversed(s.splitlines())) # to pop() in right order
while lines:
line = lines.pop().strip()
table_m = re.match... | [
"def",
"from_string",
"(",
"cls",
",",
"s",
")",
":",
"tables",
"=",
"[",
"]",
"seen",
"=",
"set",
"(",
")",
"current_table",
"=",
"None",
"lines",
"=",
"list",
"(",
"reversed",
"(",
"s",
".",
"splitlines",
"(",
")",
")",
")",
"# to pop() in right or... | Instantiate Relations from a relations string. | [
"Instantiate",
"Relations",
"from",
"a",
"relations",
"string",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L334-L368 |
delph-in/pydelphin | delphin/itsdb.py | Relations.find | def find(self, fieldname):
"""
Return the list of tables that define the field *fieldname*.
"""
tablename, _, column = fieldname.rpartition(':')
if tablename and tablename in self._field_map[column]:
return tablename
else:
return self._field_map[fi... | python | def find(self, fieldname):
"""
Return the list of tables that define the field *fieldname*.
"""
tablename, _, column = fieldname.rpartition(':')
if tablename and tablename in self._field_map[column]:
return tablename
else:
return self._field_map[fi... | [
"def",
"find",
"(",
"self",
",",
"fieldname",
")",
":",
"tablename",
",",
"_",
",",
"column",
"=",
"fieldname",
".",
"rpartition",
"(",
"':'",
")",
"if",
"tablename",
"and",
"tablename",
"in",
"self",
".",
"_field_map",
"[",
"column",
"]",
":",
"return... | Return the list of tables that define the field *fieldname*. | [
"Return",
"the",
"list",
"of",
"tables",
"that",
"define",
"the",
"field",
"*",
"fieldname",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L395-L403 |
delph-in/pydelphin | delphin/itsdb.py | Relations.path | def path(self, source, target):
"""
Find the path of id fields connecting two tables.
This is just a basic breadth-first-search. The relations file
should be small enough to not be a problem.
Returns:
list: (table, fieldname) pairs describing the path from
... | python | def path(self, source, target):
"""
Find the path of id fields connecting two tables.
This is just a basic breadth-first-search. The relations file
should be small enough to not be a problem.
Returns:
list: (table, fieldname) pairs describing the path from
... | [
"def",
"path",
"(",
"self",
",",
"source",
",",
"target",
")",
":",
"visited",
"=",
"set",
"(",
"source",
".",
"split",
"(",
"'+'",
")",
")",
"# split on + for joins",
"targets",
"=",
"set",
"(",
"target",
".",
"split",
"(",
"'+'",
")",
")",
"-",
"... | Find the path of id fields connecting two tables.
This is just a basic breadth-first-search. The relations file
should be small enough to not be a problem.
Returns:
list: (table, fieldname) pairs describing the path from
the source to target tables
Raises:
... | [
"Find",
"the",
"path",
"of",
"id",
"fields",
"connecting",
"two",
"tables",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L405-L452 |
delph-in/pydelphin | delphin/itsdb.py | Record._make | def _make(cls, fields, iterable, table, rowid):
"""
Create a Record bound to a :class:`Table`.
This is a helper method for creating Records from rows of a
Table that is attached to a file. It is not meant to be called
directly. It specifies the row number and a weak reference to... | python | def _make(cls, fields, iterable, table, rowid):
"""
Create a Record bound to a :class:`Table`.
This is a helper method for creating Records from rows of a
Table that is attached to a file. It is not meant to be called
directly. It specifies the row number and a weak reference to... | [
"def",
"_make",
"(",
"cls",
",",
"fields",
",",
"iterable",
",",
"table",
",",
"rowid",
")",
":",
"record",
"=",
"cls",
"(",
"fields",
",",
"iterable",
")",
"record",
".",
"_tableref",
"=",
"weakref",
".",
"ref",
"(",
"table",
")",
"record",
".",
"... | Create a Record bound to a :class:`Table`.
This is a helper method for creating Records from rows of a
Table that is attached to a file. It is not meant to be called
directly. It specifies the row number and a weak reference to
the Table object so that when the Record is modified it is
... | [
"Create",
"a",
"Record",
"bound",
"to",
"a",
":",
"class",
":",
"Table",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L497-L514 |
delph-in/pydelphin | delphin/itsdb.py | Record.from_dict | def from_dict(cls, fields, mapping):
"""
Create a Record from a dictionary of field mappings.
The *fields* object is used to determine the column indices
of fields in the mapping.
Args:
fields: the Relation schema for the table of this record
mapping: a ... | python | def from_dict(cls, fields, mapping):
"""
Create a Record from a dictionary of field mappings.
The *fields* object is used to determine the column indices
of fields in the mapping.
Args:
fields: the Relation schema for the table of this record
mapping: a ... | [
"def",
"from_dict",
"(",
"cls",
",",
"fields",
",",
"mapping",
")",
":",
"iterable",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
"fields",
")",
"for",
"key",
",",
"value",
"in",
"mapping",
".",
"items",
"(",
")",
":",
"try",
":",
"index",
"=",
"field... | Create a Record from a dictionary of field mappings.
The *fields* object is used to determine the column indices
of fields in the mapping.
Args:
fields: the Relation schema for the table of this record
mapping: a dictionary or other mapping from field names to
... | [
"Create",
"a",
"Record",
"from",
"a",
"dictionary",
"of",
"field",
"mappings",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L517-L538 |
delph-in/pydelphin | delphin/itsdb.py | Record.get | def get(self, key, default=None, cast=True):
"""
Return the field data given by field name *key*.
Args:
key: the field name of the data to return
default: the value to return if *key* is not in the row
"""
tablename, _, key = key.rpartition(':')
i... | python | def get(self, key, default=None, cast=True):
"""
Return the field data given by field name *key*.
Args:
key: the field name of the data to return
default: the value to return if *key* is not in the row
"""
tablename, _, key = key.rpartition(':')
i... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
",",
"cast",
"=",
"True",
")",
":",
"tablename",
",",
"_",
",",
"key",
"=",
"key",
".",
"rpartition",
"(",
"':'",
")",
"if",
"tablename",
"and",
"tablename",
"not",
"in",
"self",
... | Return the field data given by field name *key*.
Args:
key: the field name of the data to return
default: the value to return if *key* is not in the row | [
"Return",
"the",
"field",
"data",
"given",
"by",
"field",
"name",
"*",
"key",
"*",
"."
] | train | https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L581-L602 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.