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
Alir3z4/python-currencies
currencies/__init__.py
Currency.get_money_with_currency_format
def get_money_with_currency_format(self, amount): """ :type amount: int or float or str Usage: >>> currency = Currency('USD') >>> currency.get_money_with_currency_format(13) >>> '$13 USD' >>> currency.get_money_with_currency_format(13.99) >>> '$13.99 USD'...
python
def get_money_with_currency_format(self, amount): """ :type amount: int or float or str Usage: >>> currency = Currency('USD') >>> currency.get_money_with_currency_format(13) >>> '$13 USD' >>> currency.get_money_with_currency_format(13.99) >>> '$13.99 USD'...
[ "def", "get_money_with_currency_format", "(", "self", ",", "amount", ")", ":", "return", "self", ".", "money_formats", "[", "self", ".", "get_money_currency", "(", ")", "]", "[", "'money_with_currency_format'", "]", ".", "format", "(", "amount", "=", "amount", ...
:type amount: int or float or str Usage: >>> currency = Currency('USD') >>> currency.get_money_with_currency_format(13) >>> '$13 USD' >>> currency.get_money_with_currency_format(13.99) >>> '$13.99 USD' >>> currency.get_money_with_currency_format('13,2313,33') ...
[ ":", "type", "amount", ":", "int", "or", "float", "or", "str" ]
train
https://github.com/Alir3z4/python-currencies/blob/f8790c4da5df405bd23c63c0d2b02a417424d835/currencies/__init__.py#L67-L84
napalm-automation-community/napalm-fortios
napalm_fortios/fortios.py
FortiOSDriver.get_config
def get_config(self, retrieve="all"): """get_config implementation for FortiOS.""" get_startup = retrieve == "all" or retrieve == "startup" get_running = retrieve == "all" or retrieve == "running" get_candidate = retrieve == "all" or retrieve == "candidate" if retrieve == "all" ...
python
def get_config(self, retrieve="all"): """get_config implementation for FortiOS.""" get_startup = retrieve == "all" or retrieve == "startup" get_running = retrieve == "all" or retrieve == "running" get_candidate = retrieve == "all" or retrieve == "candidate" if retrieve == "all" ...
[ "def", "get_config", "(", "self", ",", "retrieve", "=", "\"all\"", ")", ":", "get_startup", "=", "retrieve", "==", "\"all\"", "or", "retrieve", "==", "\"startup\"", "get_running", "=", "retrieve", "==", "\"all\"", "or", "retrieve", "==", "\"running\"", "get_ca...
get_config implementation for FortiOS.
[ "get_config", "implementation", "for", "FortiOS", "." ]
train
https://github.com/napalm-automation-community/napalm-fortios/blob/7cb0723b079ab523211d98751e15bf148a9a69b2/napalm_fortios/fortios.py#L162-L183
JohnDoee/deluge-client
deluge_client/client.py
DelugeRPCClient.connect
def connect(self): """ Connects to the Deluge instance """ self._connect() logger.debug('Connected to Deluge, detecting daemon version') self._detect_deluge_version() logger.debug('Daemon version {} detected, logging in'.format(self.deluge_version)) if sel...
python
def connect(self): """ Connects to the Deluge instance """ self._connect() logger.debug('Connected to Deluge, detecting daemon version') self._detect_deluge_version() logger.debug('Daemon version {} detected, logging in'.format(self.deluge_version)) if sel...
[ "def", "connect", "(", "self", ")", ":", "self", ".", "_connect", "(", ")", "logger", ".", "debug", "(", "'Connected to Deluge, detecting daemon version'", ")", "self", ".", "_detect_deluge_version", "(", ")", "logger", ".", "debug", "(", "'Daemon version {} detec...
Connects to the Deluge instance
[ "Connects", "to", "the", "Deluge", "instance" ]
train
https://github.com/JohnDoee/deluge-client/blob/388512661b0bb2410c78185695ce564703b0e2fe/deluge_client/client.py#L74-L87
JohnDoee/deluge-client
deluge_client/client.py
DelugeRPCClient.disconnect
def disconnect(self): """ Disconnect from deluge """ if self.connected: self._socket.close() self._socket = None self.connected = False
python
def disconnect(self): """ Disconnect from deluge """ if self.connected: self._socket.close() self._socket = None self.connected = False
[ "def", "disconnect", "(", "self", ")", ":", "if", "self", ".", "connected", ":", "self", ".", "_socket", ".", "close", "(", ")", "self", ".", "_socket", "=", "None", "self", ".", "connected", "=", "False" ]
Disconnect from deluge
[ "Disconnect", "from", "deluge" ]
train
https://github.com/JohnDoee/deluge-client/blob/388512661b0bb2410c78185695ce564703b0e2fe/deluge_client/client.py#L103-L110
JohnDoee/deluge-client
deluge_client/client.py
DelugeRPCClient.call
def call(self, method, *args, **kwargs): """ Calls an RPC function """ tried_reconnect = False for _ in range(2): try: self._send_call(self.deluge_version, self.deluge_protocol_version, method, *args, **kwargs) return self._receive_resp...
python
def call(self, method, *args, **kwargs): """ Calls an RPC function """ tried_reconnect = False for _ in range(2): try: self._send_call(self.deluge_version, self.deluge_protocol_version, method, *args, **kwargs) return self._receive_resp...
[ "def", "call", "(", "self", ",", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "tried_reconnect", "=", "False", "for", "_", "in", "range", "(", "2", ")", ":", "try", ":", "self", ".", "_send_call", "(", "self", ".", "deluge_version...
Calls an RPC function
[ "Calls", "an", "RPC", "function" ]
train
https://github.com/JohnDoee/deluge-client/blob/388512661b0bb2410c78185695ce564703b0e2fe/deluge_client/client.py#L239-L260
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/stickers.py
StickerSet.to_array
def to_array(self): """ Serializes this StickerSet to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(StickerSet, self).to_array() array['name'] = u(self.name) # py2: type unicode, py3: type str array['tit...
python
def to_array(self): """ Serializes this StickerSet to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(StickerSet, self).to_array() array['name'] = u(self.name) # py2: type unicode, py3: type str array['tit...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "StickerSet", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'name'", "]", "=", "u", "(", "self", ".", "name", ")", "# py2: type unicode, py3: type str", "array", "[", "...
Serializes this StickerSet to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "StickerSet", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/stickers.py#L81-L96
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/stickers.py
StickerSet.from_array
def from_array(array): """ Deserialize a new StickerSet from a given dictionary. :return: new StickerSet instance. :rtype: StickerSet """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="arr...
python
def from_array(array): """ Deserialize a new StickerSet from a given dictionary. :return: new StickerSet instance. :rtype: StickerSet """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="arr...
[ "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 StickerSet from a given dictionary. :return: new StickerSet instance. :rtype: StickerSet
[ "Deserialize", "a", "new", "StickerSet", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/stickers.py#L100-L120
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/stickers.py
MaskPosition.to_array
def to_array(self): """ Serializes this MaskPosition to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(MaskPosition, self).to_array() array['point'] = u(self.point) # py2: type unicode, py3: type str arra...
python
def to_array(self): """ Serializes this MaskPosition to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(MaskPosition, self).to_array() array['point'] = u(self.point) # py2: type unicode, py3: type str arra...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "MaskPosition", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'point'", "]", "=", "u", "(", "self", ".", "point", ")", "# py2: type unicode, py3: type str", "array", "[",...
Serializes this MaskPosition to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "MaskPosition", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/stickers.py#L220-L233
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/stickers.py
MaskPosition.from_array
def from_array(array): """ Deserialize a new MaskPosition from a given dictionary. :return: new MaskPosition instance. :rtype: MaskPosition """ 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 MaskPosition from a given dictionary. :return: new MaskPosition instance. :rtype: MaskPosition """ 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 MaskPosition from a given dictionary. :return: new MaskPosition instance. :rtype: MaskPosition
[ "Deserialize", "a", "new", "MaskPosition", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/stickers.py#L237-L255
delph-in/pydelphin
delphin/interfaces/ace.py
compile
def compile(cfg_path, out_path, executable=None, env=None, log=None): """ Use ACE to compile a grammar. Args: cfg_path (str): the path to the ACE config file out_path (str): the path where the compiled grammar will be written executable (str, optional): the path to the A...
python
def compile(cfg_path, out_path, executable=None, env=None, log=None): """ Use ACE to compile a grammar. Args: cfg_path (str): the path to the ACE config file out_path (str): the path where the compiled grammar will be written executable (str, optional): the path to the A...
[ "def", "compile", "(", "cfg_path", ",", "out_path", ",", "executable", "=", "None", ",", "env", "=", "None", ",", "log", "=", "None", ")", ":", "try", ":", "check_call", "(", "[", "(", "executable", "or", "'ace'", ")", ",", "'-g'", ",", "cfg_path", ...
Use ACE to compile a grammar. Args: cfg_path (str): the path to the ACE config file out_path (str): the path where the compiled grammar will be written executable (str, optional): the path to the ACE binary; if `None`, the `ace` command will be used env (dict...
[ "Use", "ACE", "to", "compile", "a", "grammar", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L439-L465
delph-in/pydelphin
delphin/interfaces/ace.py
parse_from_iterable
def parse_from_iterable(grm, data, **kwargs): """ Parse each sentence in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): the sentences to parse **kwargs: additional keyword arguments to pass to the AceParser Yields: ...
python
def parse_from_iterable(grm, data, **kwargs): """ Parse each sentence in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): the sentences to parse **kwargs: additional keyword arguments to pass to the AceParser Yields: ...
[ "def", "parse_from_iterable", "(", "grm", ",", "data", ",", "*", "*", "kwargs", ")", ":", "with", "AceParser", "(", "grm", ",", "*", "*", "kwargs", ")", "as", "parser", ":", "for", "datum", "in", "data", ":", "yield", "parser", ".", "interact", "(", ...
Parse each sentence in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): the sentences to parse **kwargs: additional keyword arguments to pass to the AceParser Yields: :class:`~delphin.interfaces.ParseResponse` Example: ...
[ "Parse", "each", "sentence", "in", "*", "data", "*", "with", "ACE", "using", "grammar", "*", "grm", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L468-L485
delph-in/pydelphin
delphin/interfaces/ace.py
transfer_from_iterable
def transfer_from_iterable(grm, data, **kwargs): """ Transfer from each MRS in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): source MRSs as SimpleMRS strings **kwargs: additional keyword arguments to pass to the A...
python
def transfer_from_iterable(grm, data, **kwargs): """ Transfer from each MRS in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): source MRSs as SimpleMRS strings **kwargs: additional keyword arguments to pass to the A...
[ "def", "transfer_from_iterable", "(", "grm", ",", "data", ",", "*", "*", "kwargs", ")", ":", "with", "AceTransferer", "(", "grm", ",", "*", "*", "kwargs", ")", "as", "transferer", ":", "for", "datum", "in", "data", ":", "yield", "transferer", ".", "int...
Transfer from each MRS in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): source MRSs as SimpleMRS strings **kwargs: additional keyword arguments to pass to the AceTransferer Yields: :class:`~delphin.interfaces....
[ "Transfer", "from", "each", "MRS", "in", "*", "data", "*", "with", "ACE", "using", "grammar", "*", "grm", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L505-L519
delph-in/pydelphin
delphin/interfaces/ace.py
generate_from_iterable
def generate_from_iterable(grm, data, **kwargs): """ Generate from each MRS in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): MRSs as SimpleMRS strings **kwargs: additional keyword arguments to pass to the AceGener...
python
def generate_from_iterable(grm, data, **kwargs): """ Generate from each MRS in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): MRSs as SimpleMRS strings **kwargs: additional keyword arguments to pass to the AceGener...
[ "def", "generate_from_iterable", "(", "grm", ",", "data", ",", "*", "*", "kwargs", ")", ":", "with", "AceGenerator", "(", "grm", ",", "*", "*", "kwargs", ")", "as", "generator", ":", "for", "datum", "in", "data", ":", "yield", "generator", ".", "intera...
Generate from each MRS in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): MRSs as SimpleMRS strings **kwargs: additional keyword arguments to pass to the AceGenerator Yields: :class:`~delphin.interfaces.ParseRes...
[ "Generate", "from", "each", "MRS", "in", "*", "data", "*", "with", "ACE", "using", "grammar", "*", "grm", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L537-L551
delph-in/pydelphin
delphin/interfaces/ace.py
AceProcess.send
def send(self, datum): """ Send *datum* (e.g. a sentence or MRS) to ACE. Warning: Sending data without reading (e.g., via :meth:`receive`) can fill the buffer and cause data to be lost. Use the :meth:`interact` method for most data-processing tasks with A...
python
def send(self, datum): """ Send *datum* (e.g. a sentence or MRS) to ACE. Warning: Sending data without reading (e.g., via :meth:`receive`) can fill the buffer and cause data to be lost. Use the :meth:`interact` method for most data-processing tasks with A...
[ "def", "send", "(", "self", ",", "datum", ")", ":", "try", ":", "self", ".", "_p", ".", "stdin", ".", "write", "(", "(", "datum", ".", "rstrip", "(", ")", "+", "'\\n'", ")", ")", "self", ".", "_p", ".", "stdin", ".", "flush", "(", ")", "excep...
Send *datum* (e.g. a sentence or MRS) to ACE. Warning: Sending data without reading (e.g., via :meth:`receive`) can fill the buffer and cause data to be lost. Use the :meth:`interact` method for most data-processing tasks with ACE.
[ "Send", "*", "datum", "*", "(", "e", ".", "g", ".", "a", "sentence", "or", "MRS", ")", "to", "ACE", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L221-L240
delph-in/pydelphin
delphin/interfaces/ace.py
AceProcess.interact
def interact(self, datum): """ Send *datum* to ACE and return the response. This is the recommended method for sending and receiving data to/from an ACE process as it reduces the chances of over-filling or reading past the end of the buffer. It also performs a simple val...
python
def interact(self, datum): """ Send *datum* to ACE and return the response. This is the recommended method for sending and receiving data to/from an ACE process as it reduces the chances of over-filling or reading past the end of the buffer. It also performs a simple val...
[ "def", "interact", "(", "self", ",", "datum", ")", ":", "validated", "=", "self", ".", "_validate_input", "(", "datum", ")", "if", "validated", ":", "self", ".", "send", "(", "validated", ")", "result", "=", "self", ".", "receive", "(", ")", "else", ...
Send *datum* to ACE and return the response. This is the recommended method for sending and receiving data to/from an ACE process as it reduces the chances of over-filling or reading past the end of the buffer. It also performs a simple validation of the input to help ensure that ...
[ "Send", "*", "datum", "*", "to", "ACE", "and", "return", "the", "response", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L264-L293
delph-in/pydelphin
delphin/interfaces/ace.py
AceProcess.process_item
def process_item(self, datum, keys=None): """ Send *datum* to ACE and return the response with context. The *keys* parameter can be used to track item identifiers through an ACE interaction. If the `task` member is set on the AceProcess instance (or one of its subclasses), it is...
python
def process_item(self, datum, keys=None): """ Send *datum* to ACE and return the response with context. The *keys* parameter can be used to track item identifiers through an ACE interaction. If the `task` member is set on the AceProcess instance (or one of its subclasses), it is...
[ "def", "process_item", "(", "self", ",", "datum", ",", "keys", "=", "None", ")", ":", "response", "=", "self", ".", "interact", "(", "datum", ")", "if", "keys", "is", "not", "None", ":", "response", "[", "'keys'", "]", "=", "keys", "if", "'task'", ...
Send *datum* to ACE and return the response with context. The *keys* parameter can be used to track item identifiers through an ACE interaction. If the `task` member is set on the AceProcess instance (or one of its subclasses), it is kept in the response as well. Args: ...
[ "Send", "*", "datum", "*", "to", "ACE", "and", "return", "the", "response", "with", "context", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L295-L314
delph-in/pydelphin
delphin/interfaces/ace.py
AceProcess.close
def close(self): """ Close the ACE process and return the process's exit code. """ self.run_info['end'] = datetime.now() self._p.stdin.close() for line in self._p.stdout: if line.startswith('NOTE: tsdb run:'): self._read_run_info(line) ...
python
def close(self): """ Close the ACE process and return the process's exit code. """ self.run_info['end'] = datetime.now() self._p.stdin.close() for line in self._p.stdout: if line.startswith('NOTE: tsdb run:'): self._read_run_info(line) ...
[ "def", "close", "(", "self", ")", ":", "self", ".", "run_info", "[", "'end'", "]", "=", "datetime", ".", "now", "(", ")", "self", ".", "_p", ".", "stdin", ".", "close", "(", ")", "for", "line", "in", "self", ".", "_p", ".", "stdout", ":", "if",...
Close the ACE process and return the process's exit code.
[ "Close", "the", "ACE", "process", "and", "return", "the", "process", "s", "exit", "code", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L316-L328
delph-in/pydelphin
delphin/mrs/dmrx.py
load
def load(fh, single=False): """ Deserialize DMRX from a file (handle or filename) Args: fh (str, file): input filename or file object single: if `True`, only return the first read Xmrs object Returns: a generator of Xmrs objects (unless the *single* option is `True`) ...
python
def load(fh, single=False): """ Deserialize DMRX from a file (handle or filename) Args: fh (str, file): input filename or file object single: if `True`, only return the first read Xmrs object Returns: a generator of Xmrs objects (unless the *single* option is `True`) ...
[ "def", "load", "(", "fh", ",", "single", "=", "False", ")", ":", "ms", "=", "deserialize", "(", "fh", ")", "if", "single", ":", "ms", "=", "next", "(", "ms", ")", "return", "ms" ]
Deserialize DMRX from a file (handle or filename) Args: fh (str, file): input filename or file object single: if `True`, only return the first read Xmrs object Returns: a generator of Xmrs objects (unless the *single* option is `True`)
[ "Deserialize", "DMRX", "from", "a", "file", "(", "handle", "or", "filename", ")" ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/dmrx.py#L24-L38
delph-in/pydelphin
delphin/mrs/dmrx.py
loads
def loads(s, single=False): """ Deserialize DMRX string representations Args: s (str): a DMRX string single (bool): if `True`, only return the first Xmrs object Returns: a generator of Xmrs objects (unless *single* is `True`) """ corpus = etree.fromstring(s) if singl...
python
def loads(s, single=False): """ Deserialize DMRX string representations Args: s (str): a DMRX string single (bool): if `True`, only return the first Xmrs object Returns: a generator of Xmrs objects (unless *single* is `True`) """ corpus = etree.fromstring(s) if singl...
[ "def", "loads", "(", "s", ",", "single", "=", "False", ")", ":", "corpus", "=", "etree", ".", "fromstring", "(", "s", ")", "if", "single", ":", "ds", "=", "_deserialize_dmrs", "(", "next", "(", "iter", "(", "corpus", ")", ")", ")", "else", ":", "...
Deserialize DMRX string representations Args: s (str): a DMRX string single (bool): if `True`, only return the first Xmrs object Returns: a generator of Xmrs objects (unless *single* is `True`)
[ "Deserialize", "DMRX", "string", "representations" ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/dmrx.py#L41-L56
delph-in/pydelphin
delphin/interfaces/base.py
ParseResult.derivation
def derivation(self): """ Deserialize and return a Derivation object for UDF- or JSON-formatted derivation data; otherwise return the original string. """ drv = self.get('derivation') if drv is not None: if isinstance(drv, dict): drv = ...
python
def derivation(self): """ Deserialize and return a Derivation object for UDF- or JSON-formatted derivation data; otherwise return the original string. """ drv = self.get('derivation') if drv is not None: if isinstance(drv, dict): drv = ...
[ "def", "derivation", "(", "self", ")", ":", "drv", "=", "self", ".", "get", "(", "'derivation'", ")", "if", "drv", "is", "not", "None", ":", "if", "isinstance", "(", "drv", ",", "dict", ")", ":", "drv", "=", "Derivation", ".", "from_dict", "(", "dr...
Deserialize and return a Derivation object for UDF- or JSON-formatted derivation data; otherwise return the original string.
[ "Deserialize", "and", "return", "a", "Derivation", "object", "for", "UDF", "-", "or", "JSON", "-", "formatted", "derivation", "data", ";", "otherwise", "return", "the", "original", "string", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L64-L76
delph-in/pydelphin
delphin/interfaces/base.py
ParseResult.tree
def tree(self): """ Deserialize and return a labeled syntax tree. The tree data may be a standalone datum, or embedded in the derivation. """ tree = self.get('tree') if isinstance(tree, stringtypes): tree = SExpr.parse(tree).data elif tree is None: ...
python
def tree(self): """ Deserialize and return a labeled syntax tree. The tree data may be a standalone datum, or embedded in the derivation. """ tree = self.get('tree') if isinstance(tree, stringtypes): tree = SExpr.parse(tree).data elif tree is None: ...
[ "def", "tree", "(", "self", ")", ":", "tree", "=", "self", ".", "get", "(", "'tree'", ")", "if", "isinstance", "(", "tree", ",", "stringtypes", ")", ":", "tree", "=", "SExpr", ".", "parse", "(", "tree", ")", ".", "data", "elif", "tree", "is", "No...
Deserialize and return a labeled syntax tree. The tree data may be a standalone datum, or embedded in the derivation.
[ "Deserialize", "and", "return", "a", "labeled", "syntax", "tree", ".", "The", "tree", "data", "may", "be", "a", "standalone", "datum", "or", "embedded", "in", "the", "derivation", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L78-L98
delph-in/pydelphin
delphin/interfaces/base.py
ParseResult.mrs
def mrs(self): """ Deserialize and return an Mrs object for simplemrs or JSON-formatted MRS data; otherwise return the original string. """ mrs = self.get('mrs') if mrs is not None: if isinstance(mrs, dict): mrs = Mrs.from_dict(mrs) ...
python
def mrs(self): """ Deserialize and return an Mrs object for simplemrs or JSON-formatted MRS data; otherwise return the original string. """ mrs = self.get('mrs') if mrs is not None: if isinstance(mrs, dict): mrs = Mrs.from_dict(mrs) ...
[ "def", "mrs", "(", "self", ")", ":", "mrs", "=", "self", ".", "get", "(", "'mrs'", ")", "if", "mrs", "is", "not", "None", ":", "if", "isinstance", "(", "mrs", ",", "dict", ")", ":", "mrs", "=", "Mrs", ".", "from_dict", "(", "mrs", ")", "elif", ...
Deserialize and return an Mrs object for simplemrs or JSON-formatted MRS data; otherwise return the original string.
[ "Deserialize", "and", "return", "an", "Mrs", "object", "for", "simplemrs", "or", "JSON", "-", "formatted", "MRS", "data", ";", "otherwise", "return", "the", "original", "string", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L100-L111
delph-in/pydelphin
delphin/interfaces/base.py
ParseResult.eds
def eds(self): """ Deserialize and return an Eds object for native- or JSON-formatted EDS data; otherwise return the original string. """ _eds = self.get('eds') if _eds is not None: if isinstance(_eds, dict): _eds = eds.Eds.from_dict(_eds) ...
python
def eds(self): """ Deserialize and return an Eds object for native- or JSON-formatted EDS data; otherwise return the original string. """ _eds = self.get('eds') if _eds is not None: if isinstance(_eds, dict): _eds = eds.Eds.from_dict(_eds) ...
[ "def", "eds", "(", "self", ")", ":", "_eds", "=", "self", ".", "get", "(", "'eds'", ")", "if", "_eds", "is", "not", "None", ":", "if", "isinstance", "(", "_eds", ",", "dict", ")", ":", "_eds", "=", "eds", ".", "Eds", ".", "from_dict", "(", "_ed...
Deserialize and return an Eds object for native- or JSON-formatted EDS data; otherwise return the original string.
[ "Deserialize", "and", "return", "an", "Eds", "object", "for", "native", "-", "or", "JSON", "-", "formatted", "EDS", "data", ";", "otherwise", "return", "the", "original", "string", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L113-L124
delph-in/pydelphin
delphin/interfaces/base.py
ParseResult.dmrs
def dmrs(self): """ Deserialize and return a Dmrs object for JSON-formatted DMRS data; otherwise return the original string. """ dmrs = self.get('dmrs') if dmrs is not None: if isinstance(dmrs, dict): dmrs = Dmrs.from_dict(dmrs) return ...
python
def dmrs(self): """ Deserialize and return a Dmrs object for JSON-formatted DMRS data; otherwise return the original string. """ dmrs = self.get('dmrs') if dmrs is not None: if isinstance(dmrs, dict): dmrs = Dmrs.from_dict(dmrs) return ...
[ "def", "dmrs", "(", "self", ")", ":", "dmrs", "=", "self", ".", "get", "(", "'dmrs'", ")", "if", "dmrs", "is", "not", "None", ":", "if", "isinstance", "(", "dmrs", ",", "dict", ")", ":", "dmrs", "=", "Dmrs", ".", "from_dict", "(", "dmrs", ")", ...
Deserialize and return a Dmrs object for JSON-formatted DMRS data; otherwise return the original string.
[ "Deserialize", "and", "return", "a", "Dmrs", "object", "for", "JSON", "-", "formatted", "DMRS", "data", ";", "otherwise", "return", "the", "original", "string", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L126-L135
delph-in/pydelphin
delphin/interfaces/base.py
ParseResponse.tokens
def tokens(self, tokenset='internal'): """ Deserialize and return a YyTokenLattice object for the initial or internal token set, if provided, from the YY format or the JSON-formatted data; otherwise return the original string. Args: tokenset (str): return `'i...
python
def tokens(self, tokenset='internal'): """ Deserialize and return a YyTokenLattice object for the initial or internal token set, if provided, from the YY format or the JSON-formatted data; otherwise return the original string. Args: tokenset (str): return `'i...
[ "def", "tokens", "(", "self", ",", "tokenset", "=", "'internal'", ")", ":", "toks", "=", "self", ".", "get", "(", "'tokens'", ",", "{", "}", ")", ".", "get", "(", "tokenset", ")", "if", "toks", "is", "not", "None", ":", "if", "isinstance", "(", "...
Deserialize and return a YyTokenLattice object for the initial or internal token set, if provided, from the YY format or the JSON-formatted data; otherwise return the original string. Args: tokenset (str): return `'initial'` or `'internal'` tokens (default: `...
[ "Deserialize", "and", "return", "a", "YyTokenLattice", "object", "for", "the", "initial", "or", "internal", "token", "set", "if", "provided", "from", "the", "YY", "format", "or", "the", "JSON", "-", "formatted", "data", ";", "otherwise", "return", "the", "or...
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L155-L174
delph-in/pydelphin
delphin/interfaces/base.py
FieldMapper.map
def map(self, response): """ Process *response* and return a list of (table, rowdata) tuples. """ inserts = [] parse = {} # custom remapping, cleanup, and filling in holes parse['i-id'] = response.get('keys', {}).get('i-id', -1) self._parse_id = max(self....
python
def map(self, response): """ Process *response* and return a list of (table, rowdata) tuples. """ inserts = [] parse = {} # custom remapping, cleanup, and filling in holes parse['i-id'] = response.get('keys', {}).get('i-id', -1) self._parse_id = max(self....
[ "def", "map", "(", "self", ",", "response", ")", ":", "inserts", "=", "[", "]", "parse", "=", "{", "}", "# custom remapping, cleanup, and filling in holes", "parse", "[", "'i-id'", "]", "=", "response", ".", "get", "(", "'keys'", ",", "{", "}", ")", ".",...
Process *response* and return a list of (table, rowdata) tuples.
[ "Process", "*", "response", "*", "and", "return", "a", "list", "of", "(", "table", "rowdata", ")", "tuples", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L230-L280
delph-in/pydelphin
delphin/interfaces/base.py
FieldMapper.cleanup
def cleanup(self): """ Return aggregated (table, rowdata) tuples and clear the state. """ inserts = [] last_run = self._runs[self._last_run_id] if 'end' not in last_run: last_run['end'] = datetime.now() for run_id in sorted(self._runs): r...
python
def cleanup(self): """ Return aggregated (table, rowdata) tuples and clear the state. """ inserts = [] last_run = self._runs[self._last_run_id] if 'end' not in last_run: last_run['end'] = datetime.now() for run_id in sorted(self._runs): r...
[ "def", "cleanup", "(", "self", ")", ":", "inserts", "=", "[", "]", "last_run", "=", "self", ".", "_runs", "[", "self", ".", "_last_run_id", "]", "if", "'end'", "not", "in", "last_run", ":", "last_run", "[", "'end'", "]", "=", "datetime", ".", "now", ...
Return aggregated (table, rowdata) tuples and clear the state.
[ "Return", "aggregated", "(", "table", "rowdata", ")", "tuples", "and", "clear", "the", "state", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L282-L305
luckydonald/pytgbot
pytgbot/api_types/receivable/game.py
GameHighScore.to_array
def to_array(self): """ Serializes this GameHighScore to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(GameHighScore, self).to_array() array['position'] = int(self.position) # type int array['user'] = sel...
python
def to_array(self): """ Serializes this GameHighScore to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(GameHighScore, self).to_array() array['position'] = int(self.position) # type int array['user'] = sel...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "GameHighScore", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'position'", "]", "=", "int", "(", "self", ".", "position", ")", "# type int", "array", "[", "'user'", ...
Serializes this GameHighScore to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "GameHighScore", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/game.py#L74-L85
luckydonald/pytgbot
pytgbot/api_types/receivable/game.py
GameHighScore.from_array
def from_array(array): """ Deserialize a new GameHighScore from a given dictionary. :return: new GameHighScore instance. :rtype: GameHighScore """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_...
python
def from_array(array): """ Deserialize a new GameHighScore from a given dictionary. :return: new GameHighScore instance. :rtype: GameHighScore """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_...
[ "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 GameHighScore from a given dictionary. :return: new GameHighScore instance. :rtype: GameHighScore
[ "Deserialize", "a", "new", "GameHighScore", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/game.py#L89-L108
delph-in/pydelphin
delphin/extra/latex.py
dmrs_tikz_dependency
def dmrs_tikz_dependency(xs, **kwargs): """ Return a LaTeX document with each Xmrs in *xs* rendered as DMRSs. DMRSs use the `tikz-dependency` package for visualization. """ def link_label(link): return '{}/{}'.format(link.rargname or '', link.post) def label_edge(link): if link...
python
def dmrs_tikz_dependency(xs, **kwargs): """ Return a LaTeX document with each Xmrs in *xs* rendered as DMRSs. DMRSs use the `tikz-dependency` package for visualization. """ def link_label(link): return '{}/{}'.format(link.rargname or '', link.post) def label_edge(link): if link...
[ "def", "dmrs_tikz_dependency", "(", "xs", ",", "*", "*", "kwargs", ")", ":", "def", "link_label", "(", "link", ")", ":", "return", "'{}/{}'", ".", "format", "(", "link", ".", "rargname", "or", "''", ",", "link", ".", "post", ")", "def", "label_edge", ...
Return a LaTeX document with each Xmrs in *xs* rendered as DMRSs. DMRSs use the `tikz-dependency` package for visualization.
[ "Return", "a", "LaTeX", "document", "with", "each", "Xmrs", "in", "*", "xs", "*", "rendered", "as", "DMRSs", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/extra/latex.py#L41-L127
delph-in/pydelphin
delphin/lib/pegre.py
valuemap
def valuemap(f): """ Decorator to help PEG functions handle value conversions. """ @wraps(f) def wrapper(*args, **kwargs): if 'value' in kwargs: val = kwargs['value'] del kwargs['value'] _f = f(*args, **kwargs) def valued_f(*args, **kwargs): ...
python
def valuemap(f): """ Decorator to help PEG functions handle value conversions. """ @wraps(f) def wrapper(*args, **kwargs): if 'value' in kwargs: val = kwargs['value'] del kwargs['value'] _f = f(*args, **kwargs) def valued_f(*args, **kwargs): ...
[ "def", "valuemap", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'value'", "in", "kwargs", ":", "val", "=", "kwargs", "[", "'value'", "]", "del", "kwargs", "[", "'...
Decorator to help PEG functions handle value conversions.
[ "Decorator", "to", "help", "PEG", "functions", "handle", "value", "conversions", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L74-L94
delph-in/pydelphin
delphin/lib/pegre.py
literal
def literal(x): """ Create a PEG function to consume a literal. """ xlen = len(x) msg = 'Expected: "{}"'.format(x) def match_literal(s, grm=None, pos=0): if s[:xlen] == x: return PegreResult(s[xlen:], x, (pos, pos+xlen)) raise PegreError(msg, pos) return match_lit...
python
def literal(x): """ Create a PEG function to consume a literal. """ xlen = len(x) msg = 'Expected: "{}"'.format(x) def match_literal(s, grm=None, pos=0): if s[:xlen] == x: return PegreResult(s[xlen:], x, (pos, pos+xlen)) raise PegreError(msg, pos) return match_lit...
[ "def", "literal", "(", "x", ")", ":", "xlen", "=", "len", "(", "x", ")", "msg", "=", "'Expected: \"{}\"'", ".", "format", "(", "x", ")", "def", "match_literal", "(", "s", ",", "grm", "=", "None", ",", "pos", "=", "0", ")", ":", "if", "s", "[", ...
Create a PEG function to consume a literal.
[ "Create", "a", "PEG", "function", "to", "consume", "a", "literal", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L97-L107
delph-in/pydelphin
delphin/lib/pegre.py
regex
def regex(r): """ Create a PEG function to match a regular expression. """ if isinstance(r, stringtypes): p = re.compile(r) else: p = r msg = 'Expected to match: {}'.format(p.pattern) def match_regex(s, grm=None, pos=0): m = p.match(s) if m is not None: ...
python
def regex(r): """ Create a PEG function to match a regular expression. """ if isinstance(r, stringtypes): p = re.compile(r) else: p = r msg = 'Expected to match: {}'.format(p.pattern) def match_regex(s, grm=None, pos=0): m = p.match(s) if m is not None: ...
[ "def", "regex", "(", "r", ")", ":", "if", "isinstance", "(", "r", ",", "stringtypes", ")", ":", "p", "=", "re", ".", "compile", "(", "r", ")", "else", ":", "p", "=", "r", "msg", "=", "'Expected to match: {}'", ".", "format", "(", "p", ".", "patte...
Create a PEG function to match a regular expression.
[ "Create", "a", "PEG", "function", "to", "match", "a", "regular", "expression", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L110-L126
delph-in/pydelphin
delphin/lib/pegre.py
nonterminal
def nonterminal(n): """ Create a PEG function to match a nonterminal. """ def match_nonterminal(s, grm=None, pos=0): if grm is None: grm = {} expr = grm[n] return expr(s, grm, pos) return match_nonterminal
python
def nonterminal(n): """ Create a PEG function to match a nonterminal. """ def match_nonterminal(s, grm=None, pos=0): if grm is None: grm = {} expr = grm[n] return expr(s, grm, pos) return match_nonterminal
[ "def", "nonterminal", "(", "n", ")", ":", "def", "match_nonterminal", "(", "s", ",", "grm", "=", "None", ",", "pos", "=", "0", ")", ":", "if", "grm", "is", "None", ":", "grm", "=", "{", "}", "expr", "=", "grm", "[", "n", "]", "return", "expr", ...
Create a PEG function to match a nonterminal.
[ "Create", "a", "PEG", "function", "to", "match", "a", "nonterminal", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L129-L137
delph-in/pydelphin
delphin/lib/pegre.py
and_next
def and_next(e): """ Create a PEG function for positive lookahead. """ def match_and_next(s, grm=None, pos=0): try: e(s, grm, pos) except PegreError as ex: raise PegreError('Positive lookahead failed', pos) else: return PegreResult(s, Ignore, (...
python
def and_next(e): """ Create a PEG function for positive lookahead. """ def match_and_next(s, grm=None, pos=0): try: e(s, grm, pos) except PegreError as ex: raise PegreError('Positive lookahead failed', pos) else: return PegreResult(s, Ignore, (...
[ "def", "and_next", "(", "e", ")", ":", "def", "match_and_next", "(", "s", ",", "grm", "=", "None", ",", "pos", "=", "0", ")", ":", "try", ":", "e", "(", "s", ",", "grm", ",", "pos", ")", "except", "PegreError", "as", "ex", ":", "raise", "PegreE...
Create a PEG function for positive lookahead.
[ "Create", "a", "PEG", "function", "for", "positive", "lookahead", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L140-L151
delph-in/pydelphin
delphin/lib/pegre.py
not_next
def not_next(e): """ Create a PEG function for negative lookahead. """ def match_not_next(s, grm=None, pos=0): try: e(s, grm, pos) except PegreError as ex: return PegreResult(s, Ignore, (pos, pos)) else: raise PegreError('Negative lookahead fai...
python
def not_next(e): """ Create a PEG function for negative lookahead. """ def match_not_next(s, grm=None, pos=0): try: e(s, grm, pos) except PegreError as ex: return PegreResult(s, Ignore, (pos, pos)) else: raise PegreError('Negative lookahead fai...
[ "def", "not_next", "(", "e", ")", ":", "def", "match_not_next", "(", "s", ",", "grm", "=", "None", ",", "pos", "=", "0", ")", ":", "try", ":", "e", "(", "s", ",", "grm", ",", "pos", ")", "except", "PegreError", "as", "ex", ":", "return", "Pegre...
Create a PEG function for negative lookahead.
[ "Create", "a", "PEG", "function", "for", "negative", "lookahead", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L154-L165
delph-in/pydelphin
delphin/lib/pegre.py
sequence
def sequence(*es): """ Create a PEG function to match a sequence. """ def match_sequence(s, grm=None, pos=0): data = [] start = pos for e in es: s, obj, span = e(s, grm, pos) pos = span[1] if obj is not Ignore: data.append(obj) ...
python
def sequence(*es): """ Create a PEG function to match a sequence. """ def match_sequence(s, grm=None, pos=0): data = [] start = pos for e in es: s, obj, span = e(s, grm, pos) pos = span[1] if obj is not Ignore: data.append(obj) ...
[ "def", "sequence", "(", "*", "es", ")", ":", "def", "match_sequence", "(", "s", ",", "grm", "=", "None", ",", "pos", "=", "0", ")", ":", "data", "=", "[", "]", "start", "=", "pos", "for", "e", "in", "es", ":", "s", ",", "obj", ",", "span", ...
Create a PEG function to match a sequence.
[ "Create", "a", "PEG", "function", "to", "match", "a", "sequence", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L168-L181
delph-in/pydelphin
delphin/lib/pegre.py
choice
def choice(*es): """ Create a PEG function to match an ordered choice. """ msg = 'Expected one of: {}'.format(', '.join(map(repr, es))) def match_choice(s, grm=None, pos=0): errs = [] for e in es: try: return e(s, grm, pos) except PegreError as...
python
def choice(*es): """ Create a PEG function to match an ordered choice. """ msg = 'Expected one of: {}'.format(', '.join(map(repr, es))) def match_choice(s, grm=None, pos=0): errs = [] for e in es: try: return e(s, grm, pos) except PegreError as...
[ "def", "choice", "(", "*", "es", ")", ":", "msg", "=", "'Expected one of: {}'", ".", "format", "(", "', '", ".", "join", "(", "map", "(", "repr", ",", "es", ")", ")", ")", "def", "match_choice", "(", "s", ",", "grm", "=", "None", ",", "pos", "=",...
Create a PEG function to match an ordered choice.
[ "Create", "a", "PEG", "function", "to", "match", "an", "ordered", "choice", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L184-L198
delph-in/pydelphin
delphin/lib/pegre.py
optional
def optional(e, default=Ignore): """ Create a PEG function to optionally match an expression. """ def match_optional(s, grm=None, pos=0): try: return e(s, grm, pos) except PegreError: return PegreResult(s, default, (pos, pos)) return match_optional
python
def optional(e, default=Ignore): """ Create a PEG function to optionally match an expression. """ def match_optional(s, grm=None, pos=0): try: return e(s, grm, pos) except PegreError: return PegreResult(s, default, (pos, pos)) return match_optional
[ "def", "optional", "(", "e", ",", "default", "=", "Ignore", ")", ":", "def", "match_optional", "(", "s", ",", "grm", "=", "None", ",", "pos", "=", "0", ")", ":", "try", ":", "return", "e", "(", "s", ",", "grm", ",", "pos", ")", "except", "Pegre...
Create a PEG function to optionally match an expression.
[ "Create", "a", "PEG", "function", "to", "optionally", "match", "an", "expression", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L201-L210
delph-in/pydelphin
delphin/lib/pegre.py
zero_or_more
def zero_or_more(e, delimiter=None): """ Create a PEG function to match zero or more expressions. Args: e: the expression to match delimiter: an optional expression to match between the primary *e* matches. """ if delimiter is None: delimiter = lambda s, grm, pos...
python
def zero_or_more(e, delimiter=None): """ Create a PEG function to match zero or more expressions. Args: e: the expression to match delimiter: an optional expression to match between the primary *e* matches. """ if delimiter is None: delimiter = lambda s, grm, pos...
[ "def", "zero_or_more", "(", "e", ",", "delimiter", "=", "None", ")", ":", "if", "delimiter", "is", "None", ":", "delimiter", "=", "lambda", "s", ",", "grm", ",", "pos", ":", "(", "s", ",", "Ignore", ",", "(", "pos", ",", "pos", ")", ")", "def", ...
Create a PEG function to match zero or more expressions. Args: e: the expression to match delimiter: an optional expression to match between the primary *e* matches.
[ "Create", "a", "PEG", "function", "to", "match", "zero", "or", "more", "expressions", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L213-L245
delph-in/pydelphin
delphin/lib/pegre.py
one_or_more
def one_or_more(e, delimiter=None): """ Create a PEG function to match one or more expressions. Args: e: the expression to match delimiter: an optional expression to match between the primary *e* matches. """ if delimiter is None: delimiter = lambda s, grm, pos: ...
python
def one_or_more(e, delimiter=None): """ Create a PEG function to match one or more expressions. Args: e: the expression to match delimiter: an optional expression to match between the primary *e* matches. """ if delimiter is None: delimiter = lambda s, grm, pos: ...
[ "def", "one_or_more", "(", "e", ",", "delimiter", "=", "None", ")", ":", "if", "delimiter", "is", "None", ":", "delimiter", "=", "lambda", "s", ",", "grm", ",", "pos", ":", "(", "s", ",", "Ignore", ",", "(", "pos", ",", "pos", ")", ")", "msg", ...
Create a PEG function to match one or more expressions. Args: e: the expression to match delimiter: an optional expression to match between the primary *e* matches.
[ "Create", "a", "PEG", "function", "to", "match", "one", "or", "more", "expressions", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/lib/pegre.py#L248-L278
delph-in/pydelphin
delphin/mrs/path.py
merge
def merge(base, obj, location=None): """ merge is like XmrsPathNode.update() except it raises errors on unequal non-None values. """ # pump object to it's location with dummy nodes while location: axis = location.pop() obj = XmrsPathNode(None, None, links={axis: obj}) if base...
python
def merge(base, obj, location=None): """ merge is like XmrsPathNode.update() except it raises errors on unequal non-None values. """ # pump object to it's location with dummy nodes while location: axis = location.pop() obj = XmrsPathNode(None, None, links={axis: obj}) if base...
[ "def", "merge", "(", "base", ",", "obj", ",", "location", "=", "None", ")", ":", "# pump object to it's location with dummy nodes", "while", "location", ":", "axis", "=", "location", ".", "pop", "(", ")", "obj", "=", "XmrsPathNode", "(", "None", ",", "None",...
merge is like XmrsPathNode.update() except it raises errors on unequal non-None values.
[ "merge", "is", "like", "XmrsPathNode", ".", "update", "()", "except", "it", "raises", "errors", "on", "unequal", "non", "-", "None", "values", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/path.py#L321-L335
delph-in/pydelphin
delphin/mrs/path.py
_prepare_axes
def _prepare_axes(node, sort_key): """ Sort axes and combine those that point to the same target and go in the same direction. """ links = node.links o_links = node._overlapping_links overlap = {ax2 for ax in links for ax2 in o_links.get(ax, [])} axes = [] for axis in sorted(links.ke...
python
def _prepare_axes(node, sort_key): """ Sort axes and combine those that point to the same target and go in the same direction. """ links = node.links o_links = node._overlapping_links overlap = {ax2 for ax in links for ax2 in o_links.get(ax, [])} axes = [] for axis in sorted(links.ke...
[ "def", "_prepare_axes", "(", "node", ",", "sort_key", ")", ":", "links", "=", "node", ".", "links", "o_links", "=", "node", ".", "_overlapping_links", "overlap", "=", "{", "ax2", "for", "ax", "in", "links", "for", "ax2", "in", "o_links", ".", "get", "(...
Sort axes and combine those that point to the same target and go in the same direction.
[ "Sort", "axes", "and", "combine", "those", "that", "point", "to", "the", "same", "target", "and", "go", "in", "the", "same", "direction", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/path.py#L432-L450
delph-in/pydelphin
delphin/tfs.py
FeatureStructure.get
def get(self, key, default=None): """ Return the value for *key* if it exists, otherwise *default*. """ try: val = self[key] except KeyError: val = default return val
python
def get(self, key, default=None): """ Return the value for *key* if it exists, otherwise *default*. """ try: val = self[key] except KeyError: val = default return val
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "try", ":", "val", "=", "self", "[", "key", "]", "except", "KeyError", ":", "val", "=", "default", "return", "val" ]
Return the value for *key* if it exists, otherwise *default*.
[ "Return", "the", "value", "for", "*", "key", "*", "if", "it", "exists", "otherwise", "*", "default", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tfs.py#L90-L98
delph-in/pydelphin
delphin/tfs.py
FeatureStructure.features
def features(self, expand=False): """ Return the list of tuples of feature paths and feature values. Args: expand (bool): if `True`, expand all feature paths Example: >>> fs = FeatureStructure([('A.B', 1), ('A.C', 2)]) >>> fs.features() [(...
python
def features(self, expand=False): """ Return the list of tuples of feature paths and feature values. Args: expand (bool): if `True`, expand all feature paths Example: >>> fs = FeatureStructure([('A.B', 1), ('A.C', 2)]) >>> fs.features() [(...
[ "def", "features", "(", "self", ",", "expand", "=", "False", ")", ":", "fs", "=", "[", "]", "if", "self", ".", "_avm", "is", "not", "None", ":", "if", "len", "(", "self", ".", "_feats", ")", "==", "len", "(", "self", ".", "_avm", ")", ":", "f...
Return the list of tuples of feature paths and feature values. Args: expand (bool): if `True`, expand all feature paths Example: >>> fs = FeatureStructure([('A.B', 1), ('A.C', 2)]) >>> fs.features() [('A', <FeatureStructure object at ...>)] >>...
[ "Return", "the", "list", "of", "tuples", "of", "feature", "paths", "and", "feature", "values", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tfs.py#L109-L138
delph-in/pydelphin
delphin/tfs.py
TypeHierarchy.ancestors
def ancestors(self, typename): """Return the ancestor types of *typename*.""" xs = [] for parent in self._hier[typename][0]: xs.append(parent) xs.extend(self.ancestors(parent)) return xs
python
def ancestors(self, typename): """Return the ancestor types of *typename*.""" xs = [] for parent in self._hier[typename][0]: xs.append(parent) xs.extend(self.ancestors(parent)) return xs
[ "def", "ancestors", "(", "self", ",", "typename", ")", ":", "xs", "=", "[", "]", "for", "parent", "in", "self", ".", "_hier", "[", "typename", "]", "[", "0", "]", ":", "xs", ".", "append", "(", "parent", ")", "xs", ".", "extend", "(", "self", "...
Return the ancestor types of *typename*.
[ "Return", "the", "ancestor", "types", "of", "*", "typename", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tfs.py#L239-L245
delph-in/pydelphin
delphin/tfs.py
TypeHierarchy.descendants
def descendants(self, typename): """Return the descendant types of *typename*.""" xs = [] for child in self._hier[typename][1]: xs.append(child) xs.extend(self.descendants(child)) return xs
python
def descendants(self, typename): """Return the descendant types of *typename*.""" xs = [] for child in self._hier[typename][1]: xs.append(child) xs.extend(self.descendants(child)) return xs
[ "def", "descendants", "(", "self", ",", "typename", ")", ":", "xs", "=", "[", "]", "for", "child", "in", "self", ".", "_hier", "[", "typename", "]", "[", "1", "]", ":", "xs", ".", "append", "(", "child", ")", "xs", ".", "extend", "(", "self", "...
Return the descendant types of *typename*.
[ "Return", "the", "descendant", "types", "of", "*", "typename", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tfs.py#L247-L253
delph-in/pydelphin
delphin/tfs.py
TypeHierarchy.subsumes
def subsumes(self, a, b): """Return `True` if type *a* subsumes type *b*.""" return a == b or b in self.descendants(a)
python
def subsumes(self, a, b): """Return `True` if type *a* subsumes type *b*.""" return a == b or b in self.descendants(a)
[ "def", "subsumes", "(", "self", ",", "a", ",", "b", ")", ":", "return", "a", "==", "b", "or", "b", "in", "self", ".", "descendants", "(", "a", ")" ]
Return `True` if type *a* subsumes type *b*.
[ "Return", "True", "if", "type", "*", "a", "*", "subsumes", "type", "*", "b", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tfs.py#L255-L257
delph-in/pydelphin
delphin/tfs.py
TypeHierarchy.compatible
def compatible(self, a, b): """Return `True` if type *a* is compatible with type *b*.""" return len(set([a] + self.descendants(a)) .intersection([b] + self.descendants(b))) > 0
python
def compatible(self, a, b): """Return `True` if type *a* is compatible with type *b*.""" return len(set([a] + self.descendants(a)) .intersection([b] + self.descendants(b))) > 0
[ "def", "compatible", "(", "self", ",", "a", ",", "b", ")", ":", "return", "len", "(", "set", "(", "[", "a", "]", "+", "self", ".", "descendants", "(", "a", ")", ")", ".", "intersection", "(", "[", "b", "]", "+", "self", ".", "descendants", "(",...
Return `True` if type *a* is compatible with type *b*.
[ "Return", "True", "if", "type", "*", "a", "*", "is", "compatible", "with", "type", "*", "b", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tfs.py#L259-L262
delph-in/pydelphin
delphin/mrs/compare.py
isomorphic
def isomorphic(q, g, check_varprops=True): """ Return `True` if Xmrs objects *q* and *g* are isomorphic. Isomorphicity compares the predicates of an Xmrs, the variable properties of their predications (if `check_varprops=True`), constant arguments, and the argument structure between predication...
python
def isomorphic(q, g, check_varprops=True): """ Return `True` if Xmrs objects *q* and *g* are isomorphic. Isomorphicity compares the predicates of an Xmrs, the variable properties of their predications (if `check_varprops=True`), constant arguments, and the argument structure between predication...
[ "def", "isomorphic", "(", "q", ",", "g", ",", "check_varprops", "=", "True", ")", ":", "qdg", "=", "_make_digraph", "(", "q", ",", "check_varprops", ")", "gdg", "=", "_make_digraph", "(", "g", ",", "check_varprops", ")", "def", "nem", "(", "qd", ",", ...
Return `True` if Xmrs objects *q* and *g* are isomorphic. Isomorphicity compares the predicates of an Xmrs, the variable properties of their predications (if `check_varprops=True`), constant arguments, and the argument structure between predications. Node IDs and Lnk values are ignored. Args: ...
[ "Return", "True", "if", "Xmrs", "objects", "*", "q", "*", "and", "*", "g", "*", "are", "isomorphic", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/compare.py#L19-L39
delph-in/pydelphin
delphin/mrs/compare.py
_turbo_isomorphic
def _turbo_isomorphic(q, g, check_varprops=True): """ Query Xmrs q is isomorphic to given Xmrs g if there exists an isomorphism (bijection of eps and vars) from q to g. """ # first some quick checks if len(q.eps()) != len(g.eps()): return False if len(q.variables()) != len(g.variables()): re...
python
def _turbo_isomorphic(q, g, check_varprops=True): """ Query Xmrs q is isomorphic to given Xmrs g if there exists an isomorphism (bijection of eps and vars) from q to g. """ # first some quick checks if len(q.eps()) != len(g.eps()): return False if len(q.variables()) != len(g.variables()): re...
[ "def", "_turbo_isomorphic", "(", "q", ",", "g", ",", "check_varprops", "=", "True", ")", ":", "# first some quick checks", "if", "len", "(", "q", ".", "eps", "(", ")", ")", "!=", "len", "(", "g", ".", "eps", "(", ")", ")", ":", "return", "False", "...
Query Xmrs q is isomorphic to given Xmrs g if there exists an isomorphism (bijection of eps and vars) from q to g.
[ "Query", "Xmrs", "q", "is", "isomorphic", "to", "given", "Xmrs", "g", "if", "there", "exists", "an", "isomorphism", "(", "bijection", "of", "eps", "and", "vars", ")", "from", "q", "to", "g", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/compare.py#L65-L78
delph-in/pydelphin
delphin/mrs/compare.py
_isomorphisms
def _isomorphisms(q, g, check_varprops=True): """ Inspired by Turbo_ISO: http://dl.acm.org/citation.cfm?id=2465300 """ # convert MRSs to be more graph-like, and add some indices qig = _IsoGraph(q, varprops=check_varprops) # qig = q isograph gig = _IsoGraph(g, varprops=check_varprops) # gig = q...
python
def _isomorphisms(q, g, check_varprops=True): """ Inspired by Turbo_ISO: http://dl.acm.org/citation.cfm?id=2465300 """ # convert MRSs to be more graph-like, and add some indices qig = _IsoGraph(q, varprops=check_varprops) # qig = q isograph gig = _IsoGraph(g, varprops=check_varprops) # gig = q...
[ "def", "_isomorphisms", "(", "q", ",", "g", ",", "check_varprops", "=", "True", ")", ":", "# convert MRSs to be more graph-like, and add some indices", "qig", "=", "_IsoGraph", "(", "q", ",", "varprops", "=", "check_varprops", ")", "# qig = q isograph", "gig", "=", ...
Inspired by Turbo_ISO: http://dl.acm.org/citation.cfm?id=2465300
[ "Inspired", "by", "Turbo_ISO", ":", "http", ":", "//", "dl", ".", "acm", ".", "org", "/", "citation", ".", "cfm?id", "=", "2465300" ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/compare.py#L81-L106
delph-in/pydelphin
delphin/mrs/compare.py
_isomorphism_rewrite_to_NECtree
def _isomorphism_rewrite_to_NECtree(q_s, qgraph): """ Neighborhood Equivalence Class tree (see Turbo_ISO paper) """ qadj = qgraph.adj adjsets = lambda x: set(chain.from_iterable(qadj[x].values())) t = ([q_s], []) # (NEC_set, children) visited = {q_s} vcur, vnext = [t], [] while vcur...
python
def _isomorphism_rewrite_to_NECtree(q_s, qgraph): """ Neighborhood Equivalence Class tree (see Turbo_ISO paper) """ qadj = qgraph.adj adjsets = lambda x: set(chain.from_iterable(qadj[x].values())) t = ([q_s], []) # (NEC_set, children) visited = {q_s} vcur, vnext = [t], [] while vcur...
[ "def", "_isomorphism_rewrite_to_NECtree", "(", "q_s", ",", "qgraph", ")", ":", "qadj", "=", "qgraph", ".", "adj", "adjsets", "=", "lambda", "x", ":", "set", "(", "chain", ".", "from_iterable", "(", "qadj", "[", "x", "]", ".", "values", "(", ")", ")", ...
Neighborhood Equivalence Class tree (see Turbo_ISO paper)
[ "Neighborhood", "Equivalence", "Class", "tree", "(", "see", "Turbo_ISO", "paper", ")" ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/compare.py#L183-L211
delph-in/pydelphin
delphin/mrs/compare.py
_node_isomorphic
def _node_isomorphic(a, b, check_varprops=True): """ Two Xmrs objects are isomorphic if they have the same structure as determined by variable linkages between preds. """ # first some quick checks a_var_refs = sorted(len(vd['refs']) for vd in a._vars.values()) b_var_refs = sorted(len(vd['ref...
python
def _node_isomorphic(a, b, check_varprops=True): """ Two Xmrs objects are isomorphic if they have the same structure as determined by variable linkages between preds. """ # first some quick checks a_var_refs = sorted(len(vd['refs']) for vd in a._vars.values()) b_var_refs = sorted(len(vd['ref...
[ "def", "_node_isomorphic", "(", "a", ",", "b", ",", "check_varprops", "=", "True", ")", ":", "# first some quick checks", "a_var_refs", "=", "sorted", "(", "len", "(", "vd", "[", "'refs'", "]", ")", "for", "vd", "in", "a", ".", "_vars", ".", "values", ...
Two Xmrs objects are isomorphic if they have the same structure as determined by variable linkages between preds.
[ "Two", "Xmrs", "objects", "are", "isomorphic", "if", "they", "have", "the", "same", "structure", "as", "determined", "by", "variable", "linkages", "between", "preds", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/compare.py#L225-L284
delph-in/pydelphin
delphin/mrs/compare.py
_var_isomorphic
def _var_isomorphic(a, b, check_varprops=True): """ Two Xmrs objects are isomorphic if they have the same structure as determined by variable linkages between preds. """ # first some quick checks if len(a.eps()) != len(b.eps()): return False if len(a.variables()) != len(b.variables()): retur...
python
def _var_isomorphic(a, b, check_varprops=True): """ Two Xmrs objects are isomorphic if they have the same structure as determined by variable linkages between preds. """ # first some quick checks if len(a.eps()) != len(b.eps()): return False if len(a.variables()) != len(b.variables()): retur...
[ "def", "_var_isomorphic", "(", "a", ",", "b", ",", "check_varprops", "=", "True", ")", ":", "# first some quick checks", "if", "len", "(", "a", ".", "eps", "(", ")", ")", "!=", "len", "(", "b", ".", "eps", "(", ")", ")", ":", "return", "False", "if...
Two Xmrs objects are isomorphic if they have the same structure as determined by variable linkages between preds.
[ "Two", "Xmrs", "objects", "are", "isomorphic", "if", "they", "have", "the", "same", "structure", "as", "determined", "by", "variable", "linkages", "between", "preds", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/compare.py#L362-L413
delph-in/pydelphin
delphin/mrs/compare.py
compare_bags
def compare_bags(testbag, goldbag, count_only=True): """ Compare two bags of Xmrs objects, returning a triple of (unique in test, shared, unique in gold). Args: testbag: An iterable of Xmrs objects to test. goldbag: An iterable of Xmrs objects to compare against. count_only: If ...
python
def compare_bags(testbag, goldbag, count_only=True): """ Compare two bags of Xmrs objects, returning a triple of (unique in test, shared, unique in gold). Args: testbag: An iterable of Xmrs objects to test. goldbag: An iterable of Xmrs objects to compare against. count_only: If ...
[ "def", "compare_bags", "(", "testbag", ",", "goldbag", ",", "count_only", "=", "True", ")", ":", "gold_remaining", "=", "list", "(", "goldbag", ")", "test_unique", "=", "[", "]", "shared", "=", "[", "]", "for", "test", "in", "testbag", ":", "gold_match",...
Compare two bags of Xmrs objects, returning a triple of (unique in test, shared, unique in gold). Args: testbag: An iterable of Xmrs objects to test. goldbag: An iterable of Xmrs objects to compare against. count_only: If True, the returned triple will only have the counts o...
[ "Compare", "two", "bags", "of", "Xmrs", "objects", "returning", "a", "triple", "of", "(", "unique", "in", "test", "shared", "unique", "in", "gold", ")", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/compare.py#L458-L492
delph-in/pydelphin
delphin/tsql.py
query
def query(query, ts, **kwargs): """ Perform *query* on the testsuite *ts*. Note: currently only 'select' queries are supported. Args: query (str): TSQL query string ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over kwargs: keyword arguments passed to the more speci...
python
def query(query, ts, **kwargs): """ Perform *query* on the testsuite *ts*. Note: currently only 'select' queries are supported. Args: query (str): TSQL query string ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over kwargs: keyword arguments passed to the more speci...
[ "def", "query", "(", "query", ",", "ts", ",", "*", "*", "kwargs", ")", ":", "queryobj", "=", "_parse_query", "(", "query", ")", "if", "queryobj", "[", "'querytype'", "]", "in", "(", "'select'", ",", "'retrieve'", ")", ":", "return", "_select", "(", "...
Perform *query* on the testsuite *ts*. Note: currently only 'select' queries are supported. Args: query (str): TSQL query string ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over kwargs: keyword arguments passed to the more specific query function (e.g., :func:...
[ "Perform", "*", "query", "*", "on", "the", "testsuite", "*", "ts", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tsql.py#L121-L150
delph-in/pydelphin
delphin/tsql.py
select
def select(query, ts, mode='list', cast=True): """ Perform the TSQL selection query *query* on testsuite *ts*. Note: The `select`/`retrieve` part of the query is not included. Args: query (str): TSQL select query ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over mo...
python
def select(query, ts, mode='list', cast=True): """ Perform the TSQL selection query *query* on testsuite *ts*. Note: The `select`/`retrieve` part of the query is not included. Args: query (str): TSQL select query ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over mo...
[ "def", "select", "(", "query", ",", "ts", ",", "mode", "=", "'list'", ",", "cast", "=", "True", ")", ":", "queryobj", "=", "_parse_select", "(", "query", ")", "return", "_select", "(", "queryobj", "[", "'projection'", "]", ",", "queryobj", "[", "'table...
Perform the TSQL selection query *query* on testsuite *ts*. Note: The `select`/`retrieve` part of the query is not included. Args: query (str): TSQL select query ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over mode (str): how to return the results (see :func:...
[ "Perform", "the", "TSQL", "selection", "query", "*", "query", "*", "on", "testsuite", "*", "ts", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tsql.py#L153-L178
delph-in/pydelphin
delphin/tsql.py
_lex
def _lex(s): """ Lex the input string according to _tsql_lex_re. Yields (gid, token, line_number) """ s += '.' # make sure there's a terminator to know when to stop parsing lines = enumerate(s.splitlines(), 1) lineno = pos = 0 try: for lineno, line in lines: ...
python
def _lex(s): """ Lex the input string according to _tsql_lex_re. Yields (gid, token, line_number) """ s += '.' # make sure there's a terminator to know when to stop parsing lines = enumerate(s.splitlines(), 1) lineno = pos = 0 try: for lineno, line in lines: ...
[ "def", "_lex", "(", "s", ")", ":", "s", "+=", "'.'", "# make sure there's a terminator to know when to stop parsing", "lines", "=", "enumerate", "(", "s", ".", "splitlines", "(", ")", ",", "1", ")", "lineno", "=", "pos", "=", "0", "try", ":", "for", "linen...
Lex the input string according to _tsql_lex_re. Yields (gid, token, line_number)
[ "Lex", "the", "input", "string", "according", "to", "_tsql_lex_re", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tsql.py#L333-L357
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_updates
def get_updates(self, offset=None, limit=None, timeout=None, allowed_updates=None): """ Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. Notes1. This method will not work if an outgoing webhook is set up.2. In order to avoid getting ...
python
def get_updates(self, offset=None, limit=None, timeout=None, allowed_updates=None): """ Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. Notes1. This method will not work if an outgoing webhook is set up.2. In order to avoid getting ...
[ "def", "get_updates", "(", "self", ",", "offset", "=", "None", ",", "limit", "=", "None", ",", "timeout", "=", "None", ",", "allowed_updates", "=", "None", ")", ":", "assert_type_or_raise", "(", "offset", ",", "None", ",", "int", ",", "parameter_name", "...
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. Notes1. This method will not work if an outgoing webhook is set up.2. In order to avoid getting duplicate updates, recalculate offset after each server response. https://core.telegram.org/bo...
[ "Use", "this", "method", "to", "receive", "incoming", "updates", "using", "long", "polling", "(", "wiki", ")", ".", "An", "Array", "of", "Update", "objects", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L52-L101
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.set_webhook
def set_webhook(self, url, certificate=None, max_connections=None, allowed_updates=None): """ Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-seriali...
python
def set_webhook(self, url, certificate=None, max_connections=None, allowed_updates=None): """ Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-seriali...
[ "def", "set_webhook", "(", "self", ",", "url", ",", "certificate", "=", "None", ",", "max_connections", "=", "None", ",", "allowed_updates", "=", "None", ")", ":", "from", "pytgbot", ".", "api_types", ".", "sendable", ".", "files", "import", "InputFile", "...
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns...
[ "Use", "this", "method", "to", "specify", "a", "url", "and", "receive", "incoming", "updates", "via", "an", "outgoing", "webhook", ".", "Whenever", "there", "is", "an", "update", "for", "the", "bot", "we", "will", "send", "an", "HTTPS", "POST", "request", ...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L104-L159
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.delete_webhook
def delete_webhook(self, ): """ Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. https://core.telegram.org/bots/api#deletewebhook Returns: :return: Returns True on success ...
python
def delete_webhook(self, ): """ Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. https://core.telegram.org/bots/api#deletewebhook Returns: :return: Returns True on success ...
[ "def", "delete_webhook", "(", "self", ",", ")", ":", "result", "=", "self", ".", "do", "(", "\"deleteWebhook\"", ",", ")", "if", "self", ".", "return_python_objects", ":", "logger", ".", "debug", "(", "\"Trying to parse {data}\"", ".", "format", "(", "data",...
Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. https://core.telegram.org/bots/api#deletewebhook Returns: :return: Returns True on success :rtype: bool
[ "Use", "this", "method", "to", "remove", "webhook", "integration", "if", "you", "decide", "to", "switch", "back", "to", "getUpdates", ".", "Returns", "True", "on", "success", ".", "Requires", "no", "parameters", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L162-L186
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_webhook_info
def get_webhook_info(self, ): """ Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. https://core.telegram.org/bots/api#getwebhookinfo ...
python
def get_webhook_info(self, ): """ Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. https://core.telegram.org/bots/api#getwebhookinfo ...
[ "def", "get_webhook_info", "(", "self", ",", ")", ":", "result", "=", "self", ".", "do", "(", "\"getWebhookInfo\"", ",", ")", "if", "self", ".", "return_python_objects", ":", "logger", ".", "debug", "(", "\"Trying to parse {data}\"", ".", "format", "(", "dat...
Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. https://core.telegram.org/bots/api#getwebhookinfo Returns: :return: On success, returns a W...
[ "Use", "this", "method", "to", "get", "current", "webhook", "status", ".", "Requires", "no", "parameters", ".", "On", "success", "returns", "a", "WebhookInfo", "object", ".", "If", "the", "bot", "is", "using", "getUpdates", "will", "return", "an", "object", ...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L189-L214
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.send_photo
def send_photo(self, chat_id, photo, caption=None, parse_mode=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send photos. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendphoto Parameters: ...
python
def send_photo(self, chat_id, photo, caption=None, parse_mode=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send photos. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendphoto Parameters: ...
[ "def", "send_photo", "(", "self", ",", "chat_id", ",", "photo", ",", "caption", "=", "None", ",", "parse_mode", "=", "None", ",", "disable_notification", "=", "None", ",", "reply_to_message_id", "=", "None", ",", "reply_markup", "=", "None", ")", ":", "fro...
Use this method to send photos. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendphoto Parameters: :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :type chat_id: ...
[ "Use", "this", "method", "to", "send", "photos", ".", "On", "success", "the", "sent", "Message", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L369-L439
luckydonald/pytgbot
code_generation/output/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 Parame...
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 Parame...
[ "def", "send_media_group", "(", "self", ",", "chat_id", ",", "media", ",", "disable_notification", "=", "None", ",", "reply_to_message_id", "=", "None", ")", ":", "from", "pytgbot", ".", "api_types", ".", "sendable", ".", "input_media", "import", "InputMediaPhot...
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 th...
[ "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/code_generation/output/pytgbot/bot.py#L961-L1013
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.send_location
def send_location(self, chat_id, latitude, longitude, live_period=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send point on the map. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendlocation ...
python
def send_location(self, chat_id, latitude, longitude, live_period=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send point on the map. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendlocation ...
[ "def", "send_location", "(", "self", ",", "chat_id", ",", "latitude", ",", "longitude", ",", "live_period", "=", "None", ",", "disable_notification", "=", "None", ",", "reply_to_message_id", "=", "None", ",", "reply_markup", "=", "None", ")", ":", "from", "p...
Use this method to send point on the map. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendlocation Parameters: :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :ty...
[ "Use", "this", "method", "to", "send", "point", "on", "the", "map", ".", "On", "success", "the", "sent", "Message", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L1016-L1085
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.send_contact
def send_contact(self, chat_id, phone_number, first_name, last_name=None, vcard=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send phone contacts. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendcontact ...
python
def send_contact(self, chat_id, phone_number, first_name, last_name=None, vcard=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send phone contacts. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendcontact ...
[ "def", "send_contact", "(", "self", ",", "chat_id", ",", "phone_number", ",", "first_name", ",", "last_name", "=", "None", ",", "vcard", "=", "None", ",", "disable_notification", "=", "None", ",", "reply_to_message_id", "=", "None", ",", "reply_markup", "=", ...
Use this method to send phone contacts. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendcontact Parameters: :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :type ...
[ "Use", "this", "method", "to", "send", "phone", "contacts", ".", "On", "success", "the", "sent", "Message", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L1302-L1376
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_user_profile_photos
def get_user_profile_photos(self, user_id, offset=None, limit=None): """ Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. https://core.telegram.org/bots/api#getuserprofilephotos Parameters: :param user_id: Uniqu...
python
def get_user_profile_photos(self, user_id, offset=None, limit=None): """ Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. https://core.telegram.org/bots/api#getuserprofilephotos Parameters: :param user_id: Uniqu...
[ "def", "get_user_profile_photos", "(", "self", ",", "user_id", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "assert_type_or_raise", "(", "user_id", ",", "int", ",", "parameter_name", "=", "\"user_id\"", ")", "assert_type_or_raise", "(", "of...
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. https://core.telegram.org/bots/api#getuserprofilephotos Parameters: :param user_id: Unique identifier of the target user :type user_id: int Opt...
[ "Use", "this", "method", "to", "get", "a", "list", "of", "profile", "pictures", "for", "a", "user", ".", "Returns", "a", "UserProfilePhotos", "object", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L1422-L1466
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_file
def get_file(self, file_id): """ Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<fil...
python
def get_file(self, file_id): """ Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<fil...
[ "def", "get_file", "(", "self", ",", "file_id", ")", ":", "assert_type_or_raise", "(", "file_id", ",", "unicode_type", ",", "parameter_name", "=", "\"file_id\"", ")", "result", "=", "self", ".", "do", "(", "\"getFile\"", ",", "file_id", "=", "file_id", ")", ...
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the resp...
[ "Use", "this", "method", "to", "get", "basic", "info", "about", "a", "file", "and", "prepare", "it", "for", "downloading", ".", "For", "the", "moment", "bots", "can", "download", "files", "of", "up", "to", "20MB", "in", "size", ".", "On", "success", "a...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L1469-L1502
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.restrict_chat_member
def restrict_chat_member(self, chat_id, user_id, until_date=None, can_send_messages=None, can_send_media_messages=None, can_send_other_messages=None, can_add_web_page_previews=None): """ Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to wo...
python
def restrict_chat_member(self, chat_id, user_id, until_date=None, can_send_messages=None, can_send_media_messages=None, can_send_other_messages=None, can_add_web_page_previews=None): """ Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to wo...
[ "def", "restrict_chat_member", "(", "self", ",", "chat_id", ",", "user_id", ",", "until_date", "=", "None", ",", "can_send_messages", "=", "None", ",", "can_send_media_messages", "=", "None", ",", "can_send_other_messages", "=", "None", ",", "can_add_web_page_previe...
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success. https://core.telegram.org/bots/api#restrictchatmemb...
[ "Use", "this", "method", "to", "restrict", "a", "user", "in", "a", "supergroup", ".", "The", "bot", "must", "be", "an", "administrator", "in", "the", "supergroup", "for", "this", "to", "work", "and", "must", "have", "the", "appropriate", "admin", "rights",...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L1593-L1656
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.promote_chat_member
def promote_chat_member(self, chat_id, user_id, can_change_info=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_invite_users=None, can_restrict_members=None, can_pin_messages=None, can_promote_members=None): """ Use this method to promote or demote a user in a supergr...
python
def promote_chat_member(self, chat_id, user_id, can_change_info=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_invite_users=None, can_restrict_members=None, can_pin_messages=None, can_promote_members=None): """ Use this method to promote or demote a user in a supergr...
[ "def", "promote_chat_member", "(", "self", ",", "chat_id", ",", "user_id", ",", "can_change_info", "=", "None", ",", "can_post_messages", "=", "None", ",", "can_edit_messages", "=", "None", ",", "can_delete_messages", "=", "None", ",", "can_invite_users", "=", "...
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success. https://core.telegram.org/bots/api#promotechatmemb...
[ "Use", "this", "method", "to", "promote", "or", "demote", "a", "user", "in", "a", "supergroup", "or", "a", "channel", ".", "The", "bot", "must", "be", "an", "administrator", "in", "the", "chat", "for", "this", "to", "work", "and", "must", "have", "the"...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L1659-L1737
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.set_chat_photo
def set_chat_photo(self, chat_id, photo): """ Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular ...
python
def set_chat_photo(self, chat_id, photo): """ Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular ...
[ "def", "set_chat_photo", "(", "self", ",", "chat_id", ",", "photo", ")", ":", "from", "pytgbot", ".", "api_types", ".", "sendable", ".", "files", "import", "InputFile", "assert_type_or_raise", "(", "chat_id", ",", "(", "int", ",", "unicode_type", ")", ",", ...
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular groups (non-supergroups), this method will only work if the ‘A...
[ "Use", "this", "method", "to", "set", "a", "new", "profile", "photo", "for", "the", "chat", ".", "Photos", "can", "t", "be", "changed", "for", "private", "chats", ".", "The", "bot", "must", "be", "an", "administrator", "in", "the", "chat", "for", "this...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L1777-L1818
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_chat
def get_chat(self, chat_id): """ Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. https://core.telegram.org/bots/api#getchat ...
python
def get_chat(self, chat_id): """ Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. https://core.telegram.org/bots/api#getchat ...
[ "def", "get_chat", "(", "self", ",", "chat_id", ")", ":", "assert_type_or_raise", "(", "chat_id", ",", "(", "int", ",", "unicode_type", ")", ",", "parameter_name", "=", "\"chat_id\"", ")", "result", "=", "self", ".", "do", "(", "\"getChat\"", ",", "chat_id...
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. https://core.telegram.org/bots/api#getchat Parameters: :param chat_id: U...
[ "Use", "this", "method", "to", "get", "up", "to", "date", "information", "about", "the", "chat", "(", "current", "name", "of", "the", "user", "for", "one", "-", "on", "-", "one", "conversations", "current", "username", "of", "a", "user", "group", "or", ...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2055-L2087
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_chat_administrators
def get_chat_administrators(self, chat_id): """ Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appoi...
python
def get_chat_administrators(self, chat_id): """ Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appoi...
[ "def", "get_chat_administrators", "(", "self", ",", "chat_id", ")", ":", "assert_type_or_raise", "(", "chat_id", ",", "(", "int", ",", "unicode_type", ")", ",", "parameter_name", "=", "\"chat_id\"", ")", "result", "=", "self", ".", "do", "(", "\"getChatAdminis...
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. https://core.t...
[ "Use", "this", "method", "to", "get", "a", "list", "of", "administrators", "in", "a", "chat", ".", "On", "success", "returns", "an", "Array", "of", "ChatMember", "objects", "that", "contains", "information", "about", "all", "chat", "administrators", "except", ...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2090-L2122
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.set_chat_sticker_set
def set_chat_sticker_set(self, chat_id, sticker_set_name): """ Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat reque...
python
def set_chat_sticker_set(self, chat_id, sticker_set_name): """ Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat reque...
[ "def", "set_chat_sticker_set", "(", "self", ",", "chat_id", ",", "sticker_set_name", ")", ":", "assert_type_or_raise", "(", "chat_id", ",", "(", "int", ",", "unicode_type", ")", ",", "parameter_name", "=", "\"chat_id\"", ")", "assert_type_or_raise", "(", "sticker_...
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. ...
[ "Use", "this", "method", "to", "set", "a", "new", "group", "sticker", "set", "for", "a", "supergroup", ".", "The", "bot", "must", "be", "an", "administrator", "in", "the", "chat", "for", "this", "to", "work", "and", "must", "have", "the", "appropriate", ...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2199-L2235
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.answer_callback_query
def answer_callback_query(self, callback_query_id, text=None, show_alert=None, url=None, cache_time=None): """ Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On succe...
python
def answer_callback_query(self, callback_query_id, text=None, show_alert=None, url=None, cache_time=None): """ Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On succe...
[ "def", "answer_callback_query", "(", "self", ",", "callback_query_id", ",", "text", "=", "None", ",", "show_alert", "=", "None", ",", "url", "=", "None", ",", "cache_time", "=", "None", ")", ":", "assert_type_or_raise", "(", "callback_query_id", ",", "unicode_...
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. Alternatively, the user can be redirected to the specified Game URL. For this option to work, yo...
[ "Use", "this", "method", "to", "send", "answers", "to", "callback", "queries", "sent", "from", "inline", "keyboards", ".", "The", "answer", "will", "be", "displayed", "to", "the", "user", "as", "a", "notification", "at", "the", "top", "of", "the", "chat", ...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2272-L2328
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.edit_message_text
def edit_message_text(self, text, chat_id=None, message_id=None, inline_message_id=None, parse_mode=None, disable_web_page_preview=None, reply_markup=None): """ Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the b...
python
def edit_message_text(self, text, chat_id=None, message_id=None, inline_message_id=None, parse_mode=None, disable_web_page_preview=None, reply_markup=None): """ Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the b...
[ "def", "edit_message_text", "(", "self", ",", "text", ",", "chat_id", "=", "None", ",", "message_id", "=", "None", ",", "inline_message_id", "=", "None", ",", "parse_mode", "=", "None", ",", "disable_web_page_preview", "=", "None", ",", "reply_markup", "=", ...
Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. https://core.telegram.org/bots/api#editmessagetext Parameters: :param...
[ "Use", "this", "method", "to", "edit", "text", "and", "game", "messages", "sent", "by", "the", "bot", "or", "via", "the", "bot", "(", "for", "inline", "bots", ")", ".", "On", "success", "if", "edited", "message", "is", "sent", "by", "the", "bot", "th...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2331-L2403
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_sticker_set
def get_sticker_set(self, name): """ Use this method to get a sticker set. On success, a StickerSet object is returned. https://core.telegram.org/bots/api#getstickerset Parameters: :param name: Name of the sticker set :type name: str|unicode ...
python
def get_sticker_set(self, name): """ Use this method to get a sticker set. On success, a StickerSet object is returned. https://core.telegram.org/bots/api#getstickerset Parameters: :param name: Name of the sticker set :type name: str|unicode ...
[ "def", "get_sticker_set", "(", "self", ",", "name", ")", ":", "assert_type_or_raise", "(", "name", ",", "unicode_type", ",", "parameter_name", "=", "\"name\"", ")", "result", "=", "self", ".", "do", "(", "\"getStickerSet\"", ",", "name", "=", "name", ")", ...
Use this method to get a sticker set. On success, a StickerSet object is returned. https://core.telegram.org/bots/api#getstickerset Parameters: :param name: Name of the sticker set :type name: str|unicode Returns: :return: On succes...
[ "Use", "this", "method", "to", "get", "a", "sticker", "set", ".", "On", "success", "a", "StickerSet", "object", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2698-L2730
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.upload_sticker_file
def upload_sticker_file(self, user_id, png_sticker): """ Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. https://core.telegram.org/bots/api#uploadstickerfile...
python
def upload_sticker_file(self, user_id, png_sticker): """ Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. https://core.telegram.org/bots/api#uploadstickerfile...
[ "def", "upload_sticker_file", "(", "self", ",", "user_id", ",", "png_sticker", ")", ":", "from", "pytgbot", ".", "api_types", ".", "sendable", ".", "files", "import", "InputFile", "assert_type_or_raise", "(", "user_id", ",", "int", ",", "parameter_name", "=", ...
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. https://core.telegram.org/bots/api#uploadstickerfile Parameters: :param user_id: User iden...
[ "Use", "this", "method", "to", "upload", "a", ".", "png", "file", "with", "a", "sticker", "for", "later", "use", "in", "createNewStickerSet", "and", "addStickerToSet", "methods", "(", "can", "be", "used", "multiple", "times", ")", ".", "Returns", "the", "u...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2733-L2772
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.create_new_sticker_set
def create_new_sticker_set(self, user_id, name, title, png_sticker, emojis, contains_masks=None, mask_position=None): """ Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success. https://core.telegram.org/bots/api#...
python
def create_new_sticker_set(self, user_id, name, title, png_sticker, emojis, contains_masks=None, mask_position=None): """ Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success. https://core.telegram.org/bots/api#...
[ "def", "create_new_sticker_set", "(", "self", ",", "user_id", ",", "name", ",", "title", ",", "png_sticker", ",", "emojis", ",", "contains_masks", "=", "None", ",", "mask_position", "=", "None", ")", ":", "from", "pytgbot", ".", "api_types", ".", "receivable...
Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success. https://core.telegram.org/bots/api#createnewstickerset Parameters: :param user_id: User identifier of created sticker set owner :t...
[ "Use", "this", "method", "to", "create", "new", "sticker", "set", "owned", "by", "a", "user", ".", "The", "bot", "will", "be", "able", "to", "edit", "the", "created", "sticker", "set", ".", "Returns", "True", "on", "success", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2775-L2841
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.set_sticker_position_in_set
def set_sticker_position_in_set(self, sticker, position): """ Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. https://core.telegram.org/bots/api#setstickerpositioninset Parameters: :param sticker:...
python
def set_sticker_position_in_set(self, sticker, position): """ Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. https://core.telegram.org/bots/api#setstickerpositioninset Parameters: :param sticker:...
[ "def", "set_sticker_position_in_set", "(", "self", ",", "sticker", ",", "position", ")", ":", "assert_type_or_raise", "(", "sticker", ",", "unicode_type", ",", "parameter_name", "=", "\"sticker\"", ")", "assert_type_or_raise", "(", "position", ",", "int", ",", "pa...
Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. https://core.telegram.org/bots/api#setstickerpositioninset Parameters: :param sticker: File identifier of the sticker :type sticker: str|unicode ...
[ "Use", "this", "method", "to", "move", "a", "sticker", "in", "a", "set", "created", "by", "the", "bot", "to", "a", "specific", "position", ".", "Returns", "True", "on", "success", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L2903-L2939
luckydonald/pytgbot
code_generation/output/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 per query are allowed. https:...
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 per query are allowed. https:...
[ "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 inl...
[ "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/code_generation/output/pytgbot/bot.py#L2976-L3041
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.send_invoice
def send_invoice(self, chat_id, title, description, payload, provider_token, start_parameter, currency, prices, provider_data=None, photo_url=None, photo_size=None, photo_width=None, photo_height=None, need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, send_phone_number_to_provider=Non...
python
def send_invoice(self, chat_id, title, description, payload, provider_token, start_parameter, currency, prices, provider_data=None, photo_url=None, photo_size=None, photo_width=None, photo_height=None, need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, send_phone_number_to_provider=Non...
[ "def", "send_invoice", "(", "self", ",", "chat_id", ",", "title", ",", "description", ",", "payload", ",", "provider_token", ",", "start_parameter", ",", "currency", ",", "prices", ",", "provider_data", "=", "None", ",", "photo_url", "=", "None", ",", "photo...
Use this method to send invoices. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendinvoice Parameters: :param chat_id: Unique identifier for the target private chat :type chat_id: int :param title: Product name, 1-32 c...
[ "Use", "this", "method", "to", "send", "invoices", ".", "On", "success", "the", "sent", "Message", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3044-L3191
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.answer_shipping_query
def answer_shipping_query(self, shipping_query_id, ok, shipping_options=None, error_message=None): """ If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shi...
python
def answer_shipping_query(self, shipping_query_id, ok, shipping_options=None, error_message=None): """ If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shi...
[ "def", "answer_shipping_query", "(", "self", ",", "shipping_query_id", ",", "ok", ",", "shipping_options", "=", "None", ",", "error_message", "=", "None", ")", ":", "from", "pytgbot", ".", "api_types", ".", "sendable", ".", "payments", "import", "ShippingOption"...
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned. https://core.telegram.org/bots/api#answershippingquery ...
[ "If", "you", "sent", "an", "invoice", "requesting", "a", "shipping", "address", "and", "the", "parameter", "is_flexible", "was", "specified", "the", "Bot", "API", "will", "send", "an", "Update", "with", "a", "shipping_query", "field", "to", "the", "bot", "."...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3194-L3244
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.answer_pre_checkout_query
def answer_pre_checkout_query(self, pre_checkout_query_id, ok, error_message=None): """ Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout que...
python
def answer_pre_checkout_query(self, pre_checkout_query_id, ok, error_message=None): """ Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout que...
[ "def", "answer_pre_checkout_query", "(", "self", ",", "pre_checkout_query_id", ",", "ok", ",", "error_message", "=", "None", ")", ":", "assert_type_or_raise", "(", "pre_checkout_query_id", ",", "unicode_type", ",", "parameter_name", "=", "\"pre_checkout_query_id\"", ")"...
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the...
[ "Once", "the", "user", "has", "confirmed", "their", "payment", "and", "shipping", "details", "the", "Bot", "API", "sends", "the", "final", "confirmation", "in", "the", "form", "of", "an", "Update", "with", "the", "field", "pre_checkout_query", ".", "Use", "t...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3247-L3290
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.set_passport_data_errors
def set_passport_data_errors(self, user_id, errors): """ Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must chan...
python
def set_passport_data_errors(self, user_id, errors): """ Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must chan...
[ "def", "set_passport_data_errors", "(", "self", ",", "user_id", ",", "errors", ")", ":", "from", "pytgbot", ".", "api_types", ".", "sendable", ".", "passport", "import", "PassportElementError", "assert_type_or_raise", "(", "user_id", ",", "int", ",", "parameter_na...
Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. Use this if the data submitted by t...
[ "Informs", "a", "user", "that", "some", "of", "the", "Telegram", "Passport", "elements", "they", "provided", "contains", "errors", ".", "The", "user", "will", "not", "be", "able", "to", "re", "-", "submit", "their", "Passport", "to", "you", "until", "the",...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3293-L3332
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.send_game
def send_game(self, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send a game. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendgame Parameters: :param ...
python
def send_game(self, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ Use this method to send a game. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendgame Parameters: :param ...
[ "def", "send_game", "(", "self", ",", "chat_id", ",", "game_short_name", ",", "disable_notification", "=", "None", ",", "reply_to_message_id", "=", "None", ",", "reply_markup", "=", "None", ")", ":", "from", "pytgbot", ".", "api_types", ".", "sendable", ".", ...
Use this method to send a game. On success, the sent Message is returned. https://core.telegram.org/bots/api#sendgame Parameters: :param chat_id: Unique identifier for the target chat :type chat_id: int :param game_short_name: Short name of the game,...
[ "Use", "this", "method", "to", "send", "a", "game", ".", "On", "success", "the", "sent", "Message", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3335-L3391
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_game_high_scores
def get_game_high_scores(self, user_id, chat_id=None, message_id=None, inline_message_id=None): """ Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. This ...
python
def get_game_high_scores(self, user_id, chat_id=None, message_id=None, inline_message_id=None): """ Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. This ...
[ "def", "get_game_high_scores", "(", "self", ",", "user_id", ",", "chat_id", "=", "None", ",", "message_id", "=", "None", ",", "inline_message_id", "=", "None", ")", ":", "assert_type_or_raise", "(", "user_id", ",", "int", ",", "parameter_name", "=", "\"user_id...
Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also r...
[ "Use", "this", "method", "to", "get", "data", "for", "high", "score", "tables", ".", "Will", "return", "the", "score", "of", "the", "specified", "user", "and", "several", "of", "his", "neighbors", "in", "a", "game", ".", "On", "success", "returns", "an",...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3467-L3519
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.do
def do(self, command, files=None, use_long_polling=False, request_timeout=None, **query): """ Send a request to the api. If the bot is set to return the json objects, it will look like this: ```json { "ok": bool, "result": {...}, # optionally...
python
def do(self, command, files=None, use_long_polling=False, request_timeout=None, **query): """ Send a request to the api. If the bot is set to return the json objects, it will look like this: ```json { "ok": bool, "result": {...}, # optionally...
[ "def", "do", "(", "self", ",", "command", ",", "files", "=", "None", ",", "use_long_polling", "=", "False", ",", "request_timeout", "=", "None", ",", "*", "*", "query", ")", ":", "import", "requests", "url", ",", "params", "=", "self", ".", "_prepare_r...
Send a request to the api. If the bot is set to return the json objects, it will look like this: ```json { "ok": bool, "result": {...}, # optionally present: "description": "human-readable description of the result", "error_code": int...
[ "Send", "a", "request", "to", "the", "api", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3527-L3566
luckydonald/pytgbot
code_generation/output/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/code_generation/output/pytgbot/bot.py#L3596-L3677
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot.get_download_url
def get_download_url(self, file): """ Creates a url to download the file. Note: Contains the secret API key, so you should not share this url! :param file: The File you want to get the url to download. :type file: pytgbot.api_types.receivable.media.File :return: url ...
python
def get_download_url(self, file): """ Creates a url to download the file. Note: Contains the secret API key, so you should not share this url! :param file: The File you want to get the url to download. :type file: pytgbot.api_types.receivable.media.File :return: url ...
[ "def", "get_download_url", "(", "self", ",", "file", ")", ":", "from", ".", "api_types", ".", "receivable", ".", "media", "import", "File", "assert", "isinstance", "(", "file", ",", "File", ")", "return", "file", ".", "get_download_url", "(", "self", ".", ...
Creates a url to download the file. Note: Contains the secret API key, so you should not share this url! :param file: The File you want to get the url to download. :type file: pytgbot.api_types.receivable.media.File :return: url :rtype: str
[ "Creates", "a", "url", "to", "download", "the", "file", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3680-L3694
luckydonald/pytgbot
code_generation/output/pytgbot/bot.py
Bot._load_info
def _load_info(self): """ This functions stores the id and the username of the bot. Called by `.username` and `.id` properties. :return: """ myself = self.get_me() if self.return_python_objects: self._id = myself.id self._username = myself....
python
def _load_info(self): """ This functions stores the id and the username of the bot. Called by `.username` and `.id` properties. :return: """ myself = self.get_me() if self.return_python_objects: self._id = myself.id self._username = myself....
[ "def", "_load_info", "(", "self", ")", ":", "myself", "=", "self", ".", "get_me", "(", ")", "if", "self", ".", "return_python_objects", ":", "self", ".", "_id", "=", "myself", ".", "id", "self", ".", "_username", "=", "myself", ".", "username", "else",...
This functions stores the id and the username of the bot. Called by `.username` and `.id` properties. :return:
[ "This", "functions", "stores", "the", "id", "and", "the", "username", "of", "the", "bot", ".", "Called", "by", ".", "username", "and", ".", "id", "properties", ".", ":", "return", ":" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/bot.py#L3697-L3709
luckydonald/pytgbot
pytgbot/api_types/sendable/input_media.py
InputMedia.get_request_data
def get_request_data(self, var_name, full_data=False): """ :param var_name: :param full_data: If you want `.to_array()` with this data, ready to be sent. :return: A tuple of `to_array()` dict and the files (:py:func:`InputFile.get_request_files()`). Files can be None, if...
python
def get_request_data(self, var_name, full_data=False): """ :param var_name: :param full_data: If you want `.to_array()` with this data, ready to be sent. :return: A tuple of `to_array()` dict and the files (:py:func:`InputFile.get_request_files()`). Files can be None, if...
[ "def", "get_request_data", "(", "self", ",", "var_name", ",", "full_data", "=", "False", ")", ":", "if", "full_data", ":", "data", "=", "self", ".", "to_array", "(", ")", "data", "[", "'media'", "]", ",", "file", "=", "self", ".", "get_inputfile_data", ...
:param var_name: :param full_data: If you want `.to_array()` with this data, ready to be sent. :return: A tuple of `to_array()` dict and the files (:py:func:`InputFile.get_request_files()`). Files can be None, if no file was given, but an url or existing `file_id`. If `...
[ ":", "param", "var_name", ":", ":", "param", "full_data", ":", "If", "you", "want", ".", "to_array", "()", "with", "this", "data", "ready", "to", "be", "sent", ".", ":", "return", ":", "A", "tuple", "of", "to_array", "()", "dict", "and", "the", "file...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/input_media.py#L77-L91
luckydonald/pytgbot
pytgbot/api_types/sendable/input_media.py
InputMediaWithThumb.get_request_data
def get_request_data(self, var_name, full_data=False): """ :param var_name: :param full_data: If you want `.to_array()` with this data, ready to be sent. :return: A tuple of `to_array()` dict and the files (:py:func:`InputFile.get_request_files()`). Files can be None, if...
python
def get_request_data(self, var_name, full_data=False): """ :param var_name: :param full_data: If you want `.to_array()` with this data, ready to be sent. :return: A tuple of `to_array()` dict and the files (:py:func:`InputFile.get_request_files()`). Files can be None, if...
[ "def", "get_request_data", "(", "self", ",", "var_name", ",", "full_data", "=", "False", ")", ":", "if", "not", "full_data", ":", "raise", "ArithmeticError", "(", "'we have a thumbnail, please use `full_data=True`.'", ")", "# end if", "file", "=", "{", "}", "data"...
:param var_name: :param full_data: If you want `.to_array()` with this data, ready to be sent. :return: A tuple of `to_array()` dict and the files (:py:func:`InputFile.get_request_files()`). Files can be None, if no file was given, but an url or existing `file_id`. If ...
[ ":", "param", "var_name", ":", ":", "param", "full_data", ":", "If", "you", "want", ".", "to_array", "()", "with", "this", "data", "ready", "to", "be", "sent", ".", ":", "return", ":", "A", "tuple", "of", "to_array", "()", "dict", "and", "the", "file...
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/input_media.py#L120-L147
luckydonald/pytgbot
pytgbot/api_types/sendable/input_media.py
InputMediaVideo.to_array
def to_array(self): """ Serializes this InputMediaVideo to a dictionary. :return: dictionary representation of this object. :rtype: dict """ from .files import InputFile array = super(InputMediaVideo, self).to_array() # 'type' given by superclass ...
python
def to_array(self): """ Serializes this InputMediaVideo to a dictionary. :return: dictionary representation of this object. :rtype: dict """ from .files import InputFile array = super(InputMediaVideo, self).to_array() # 'type' given by superclass ...
[ "def", "to_array", "(", "self", ")", ":", "from", ".", "files", "import", "InputFile", "array", "=", "super", "(", "InputMediaVideo", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' given by superclass", "# 'media' given by superclass", "if", "self", ".",...
Serializes this InputMediaVideo to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputMediaVideo", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/input_media.py#L363-L392
luckydonald/pytgbot
pytgbot/api_types/sendable/input_media.py
InputMediaAnimation.to_array
def to_array(self): """ Serializes this InputMediaAnimation to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputMediaAnimation, self).to_array() # 'type' given by superclass # 'media' given by superclass...
python
def to_array(self): """ Serializes this InputMediaAnimation to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputMediaAnimation, self).to_array() # 'type' given by superclass # 'media' given by superclass...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InputMediaAnimation", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' given by superclass", "# 'media' given by superclass", "if", "self", ".", "thumb", "is", "not", "None", ":", "if...
Serializes this InputMediaAnimation to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputMediaAnimation", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/input_media.py#L544-L570
luckydonald/pytgbot
pytgbot/api_types/sendable/input_media.py
InputMediaAudio.to_array
def to_array(self): """ Serializes this InputMediaAudio to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputMediaAudio, self).to_array() # 'type' given by superclass # 'media' given by superclass ...
python
def to_array(self): """ Serializes this InputMediaAudio to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputMediaAudio, self).to_array() # 'type' given by superclass # 'media' given by superclass ...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InputMediaAudio", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' given by superclass", "# 'media' given by superclass", "if", "self", ".", "thumb", "is", "not", "None", ":", "if", ...
Serializes this InputMediaAudio to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputMediaAudio", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/input_media.py#L723-L749
luckydonald/pytgbot
pytgbot/api_types/sendable/input_media.py
InputMediaDocument.to_array
def to_array(self): """ Serializes this InputMediaDocument to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputMediaDocument, self).to_array() # 'type' given by superclass # 'media' given by superclass ...
python
def to_array(self): """ Serializes this InputMediaDocument to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputMediaDocument, self).to_array() # 'type' given by superclass # 'media' given by superclass ...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InputMediaDocument", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' given by superclass", "# 'media' given by superclass", "if", "self", ".", "thumb", "is", "not", "None", ":", "if"...
Serializes this InputMediaDocument to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputMediaDocument", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/input_media.py#L873-L893
luckydonald/pytgbot
pytgbot/api_types/sendable/input_media.py
InputMediaDocument.from_array
def from_array(array): """ Deserialize a new InputMediaDocument from a given dictionary. :return: new InputMediaDocument instance. :rtype: InputMediaDocument """ if array is None or not array: return None # end if assert_type_or_raise(array, d...
python
def from_array(array): """ Deserialize a new InputMediaDocument from a given dictionary. :return: new InputMediaDocument instance. :rtype: InputMediaDocument """ if array is None or not array: return None # end if assert_type_or_raise(array, d...
[ "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 InputMediaDocument from a given dictionary. :return: new InputMediaDocument instance. :rtype: InputMediaDocument
[ "Deserialize", "a", "new", "InputMediaDocument", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/input_media.py#L897-L928
delph-in/pydelphin
delphin/repp.py
_mergemap
def _mergemap(map1, map2): """ Positions in map2 have an integer indicating the relative shift to the equivalent position in map1. E.g., the i'th position in map2 corresponds to the i + map2[i] position in map1. """ merged = array('i', [0] * len(map2)) for i, shift in enumerate(map2): ...
python
def _mergemap(map1, map2): """ Positions in map2 have an integer indicating the relative shift to the equivalent position in map1. E.g., the i'th position in map2 corresponds to the i + map2[i] position in map1. """ merged = array('i', [0] * len(map2)) for i, shift in enumerate(map2): ...
[ "def", "_mergemap", "(", "map1", ",", "map2", ")", ":", "merged", "=", "array", "(", "'i'", ",", "[", "0", "]", "*", "len", "(", "map2", ")", ")", "for", "i", ",", "shift", "in", "enumerate", "(", "map2", ")", ":", "merged", "[", "i", "]", "=...
Positions in map2 have an integer indicating the relative shift to the equivalent position in map1. E.g., the i'th position in map2 corresponds to the i + map2[i] position in map1.
[ "Positions", "in", "map2", "have", "an", "integer", "indicating", "the", "relative", "shift", "to", "the", "equivalent", "position", "in", "map1", ".", "E", ".", "g", ".", "the", "i", "th", "position", "in", "map2", "corresponds", "to", "the", "i", "+", ...
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L473-L482