repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
delph-in/pydelphin
delphin/itsdb.py
Table.from_file
def from_file(cls, path, fields=None, encoding='utf-8'): """ Instantiate a Table from a database file. This method instantiates a table attached to the file at *path*. The file will be opened and traversed to determine the number of records, but the contents will not be stored i...
python
def from_file(cls, path, fields=None, encoding='utf-8'): """ Instantiate a Table from a database file. This method instantiates a table attached to the file at *path*. The file will be opened and traversed to determine the number of records, but the contents will not be stored i...
[ "def", "from_file", "(", "cls", ",", "path", ",", "fields", "=", "None", ",", "encoding", "=", "'utf-8'", ")", ":", "path", "=", "_table_filename", "(", "path", ")", "# do early in case file not found", "if", "fields", "is", "None", ":", "fields", "=", "_g...
Instantiate a Table from a database file. This method instantiates a table attached to the file at *path*. The file will be opened and traversed to determine the number of records, but the contents will not be stored in memory unless they are modified. Args: path: t...
[ "Instantiate", "a", "Table", "from", "a", "database", "file", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L659-L681
delph-in/pydelphin
delphin/itsdb.py
Table.write
def write(self, records=None, path=None, fields=None, append=False, gzip=None): """ Write the table to disk. The basic usage has no arguments and writes the table's data to the attached file. The parameters accommodate a variety of use cases, such as using *fields*...
python
def write(self, records=None, path=None, fields=None, append=False, gzip=None): """ Write the table to disk. The basic usage has no arguments and writes the table's data to the attached file. The parameters accommodate a variety of use cases, such as using *fields*...
[ "def", "write", "(", "self", ",", "records", "=", "None", ",", "path", "=", "None", ",", "fields", "=", "None", ",", "append", "=", "False", ",", "gzip", "=", "None", ")", ":", "if", "path", "is", "None", ":", "if", "not", "self", ".", "is_attach...
Write the table to disk. The basic usage has no arguments and writes the table's data to the attached file. The parameters accommodate a variety of use cases, such as using *fields* to refresh a table to a new schema or *records* and *append* to incrementally build a table. ...
[ "Write", "the", "table", "to", "disk", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L683-L729
delph-in/pydelphin
delphin/itsdb.py
Table.commit
def commit(self): """ Commit changes to disk if attached. This method helps normalize the interface for detached and attached tables and makes writing attached tables a bit more efficient. For detached tables nothing is done, as there is no notion of changes, but neither...
python
def commit(self): """ Commit changes to disk if attached. This method helps normalize the interface for detached and attached tables and makes writing attached tables a bit more efficient. For detached tables nothing is done, as there is no notion of changes, but neither...
[ "def", "commit", "(", "self", ")", ":", "if", "not", "self", ".", "is_attached", "(", ")", ":", "return", "changes", "=", "self", ".", "list_changes", "(", ")", "if", "changes", ":", "indices", ",", "records", "=", "zip", "(", "*", "changes", ")", ...
Commit changes to disk if attached. This method helps normalize the interface for detached and attached tables and makes writing attached tables a bit more efficient. For detached tables nothing is done, as there is no notion of changes, but neither is an error raised (unlike with ...
[ "Commit", "changes", "to", "disk", "if", "attached", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L731-L751
delph-in/pydelphin
delphin/itsdb.py
Table.attach
def attach(self, path, encoding='utf-8'): """ Attach the Table to the file at *path*. Attaching a table to a file means that only changed records are stored in memory, which greatly reduces the memory footprint of large profiles at some cost of performance. Tables create...
python
def attach(self, path, encoding='utf-8'): """ Attach the Table to the file at *path*. Attaching a table to a file means that only changed records are stored in memory, which greatly reduces the memory footprint of large profiles at some cost of performance. Tables create...
[ "def", "attach", "(", "self", ",", "path", ",", "encoding", "=", "'utf-8'", ")", ":", "if", "self", ".", "is_attached", "(", ")", ":", "raise", "ItsdbError", "(", "'already attached at {}'", ".", "format", "(", "self", ".", "path", ")", ")", "try", ":"...
Attach the Table to the file at *path*. Attaching a table to a file means that only changed records are stored in memory, which greatly reduces the memory footprint of large profiles at some cost of performance. Tables created from :meth:`Table.from_file()` or from an attached :...
[ "Attach", "the", "Table", "to", "the", "file", "at", "*", "path", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L753-L796
delph-in/pydelphin
delphin/itsdb.py
Table.detach
def detach(self): """ Detach the table from a file. Detaching a table reads all data from the file and places it in memory. This is useful when constructing or significantly manipulating table data, or when more speed is needed. Tables created by the default constructor ...
python
def detach(self): """ Detach the table from a file. Detaching a table reads all data from the file and places it in memory. This is useful when constructing or significantly manipulating table data, or when more speed is needed. Tables created by the default constructor ...
[ "def", "detach", "(", "self", ")", ":", "if", "not", "self", ".", "is_attached", "(", ")", ":", "raise", "ItsdbError", "(", "'already detached'", ")", "records", "=", "self", ".", "_records", "for", "i", ",", "line", "in", "self", ".", "_enum_lines", "...
Detach the table from a file. Detaching a table reads all data from the file and places it in memory. This is useful when constructing or significantly manipulating table data, or when more speed is needed. Tables created by the default constructor are detached. When detaching,...
[ "Detach", "the", "table", "from", "a", "file", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L798-L825
delph-in/pydelphin
delphin/itsdb.py
Table.list_changes
def list_changes(self): """ Return a list of modified records. This is only applicable for attached tables. Returns: A list of `(row_index, record)` tuples of modified records Raises: :class:`delphin.exceptions.ItsdbError`: when called on a ...
python
def list_changes(self): """ Return a list of modified records. This is only applicable for attached tables. Returns: A list of `(row_index, record)` tuples of modified records Raises: :class:`delphin.exceptions.ItsdbError`: when called on a ...
[ "def", "list_changes", "(", "self", ")", ":", "if", "not", "self", ".", "is_attached", "(", ")", ":", "raise", "ItsdbError", "(", "'changes are not tracked for detached tables.'", ")", "return", "[", "(", "i", ",", "self", "[", "i", "]", ")", "for", "i", ...
Return a list of modified records. This is only applicable for attached tables. Returns: A list of `(row_index, record)` tuples of modified records Raises: :class:`delphin.exceptions.ItsdbError`: when called on a detached table
[ "Return", "a", "list", "of", "modified", "records", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L835-L850
delph-in/pydelphin
delphin/itsdb.py
Table._sync_with_file
def _sync_with_file(self): """Clear in-memory structures so table is synced with the file.""" self._records = [] i = -1 for i, line in self._enum_lines(): self._records.append(None) self._last_synced_index = i
python
def _sync_with_file(self): """Clear in-memory structures so table is synced with the file.""" self._records = [] i = -1 for i, line in self._enum_lines(): self._records.append(None) self._last_synced_index = i
[ "def", "_sync_with_file", "(", "self", ")", ":", "self", ".", "_records", "=", "[", "]", "i", "=", "-", "1", "for", "i", ",", "line", "in", "self", ".", "_enum_lines", "(", ")", ":", "self", ".", "_records", ".", "append", "(", "None", ")", "self...
Clear in-memory structures so table is synced with the file.
[ "Clear", "in", "-", "memory", "structures", "so", "table", "is", "synced", "with", "the", "file", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L852-L858
delph-in/pydelphin
delphin/itsdb.py
Table._enum_lines
def _enum_lines(self): """Enumerate lines from the attached file.""" with _open_table(self.path, self.encoding) as lines: for i, line in enumerate(lines): yield i, line
python
def _enum_lines(self): """Enumerate lines from the attached file.""" with _open_table(self.path, self.encoding) as lines: for i, line in enumerate(lines): yield i, line
[ "def", "_enum_lines", "(", "self", ")", ":", "with", "_open_table", "(", "self", ".", "path", ",", "self", ".", "encoding", ")", "as", "lines", ":", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "yield", "i", ",", "line" ]
Enumerate lines from the attached file.
[ "Enumerate", "lines", "from", "the", "attached", "file", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L860-L864
delph-in/pydelphin
delphin/itsdb.py
Table._enum_attached_rows
def _enum_attached_rows(self, indices): """Enumerate on-disk and in-memory records.""" records = self._records i = 0 # first rows covered by the file for i, line in self._enum_lines(): if i in indices: row = records[i] if row is None: ...
python
def _enum_attached_rows(self, indices): """Enumerate on-disk and in-memory records.""" records = self._records i = 0 # first rows covered by the file for i, line in self._enum_lines(): if i in indices: row = records[i] if row is None: ...
[ "def", "_enum_attached_rows", "(", "self", ",", "indices", ")", ":", "records", "=", "self", ".", "_records", "i", "=", "0", "# first rows covered by the file", "for", "i", ",", "line", "in", "self", ".", "_enum_lines", "(", ")", ":", "if", "i", "in", "i...
Enumerate on-disk and in-memory records.
[ "Enumerate", "on", "-", "disk", "and", "in", "-", "memory", "records", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L866-L881
delph-in/pydelphin
delphin/itsdb.py
Table._iterslice
def _iterslice(self, slice): """Yield records from a slice index.""" indices = range(*slice.indices(len(self._records))) if self.is_attached(): rows = self._enum_attached_rows(indices) if slice.step is not None and slice.step < 0: rows = reversed(list(rows...
python
def _iterslice(self, slice): """Yield records from a slice index.""" indices = range(*slice.indices(len(self._records))) if self.is_attached(): rows = self._enum_attached_rows(indices) if slice.step is not None and slice.step < 0: rows = reversed(list(rows...
[ "def", "_iterslice", "(", "self", ",", "slice", ")", ":", "indices", "=", "range", "(", "*", "slice", ".", "indices", "(", "len", "(", "self", ".", "_records", ")", ")", ")", "if", "self", ".", "is_attached", "(", ")", ":", "rows", "=", "self", "...
Yield records from a slice index.
[ "Yield", "records", "from", "a", "slice", "index", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L893-L905
delph-in/pydelphin
delphin/itsdb.py
Table._getitem
def _getitem(self, index): """Get a single non-slice index.""" row = self._records[index] if row is not None: pass elif self.is_attached(): # need to handle negative indices manually if index < 0: index = len(self._records) + index ...
python
def _getitem(self, index): """Get a single non-slice index.""" row = self._records[index] if row is not None: pass elif self.is_attached(): # need to handle negative indices manually if index < 0: index = len(self._records) + index ...
[ "def", "_getitem", "(", "self", ",", "index", ")", ":", "row", "=", "self", ".", "_records", "[", "index", "]", "if", "row", "is", "not", "None", ":", "pass", "elif", "self", ".", "is_attached", "(", ")", ":", "# need to handle negative indices manually", ...
Get a single non-slice index.
[ "Get", "a", "single", "non", "-", "slice", "index", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L907-L925
delph-in/pydelphin
delphin/itsdb.py
Table.extend
def extend(self, records): """ Add each record in *records* to the end of the table. Args: record: an iterable of :class:`Record` or other iterables containing column values """ fields = self.fields for record in records: record = ...
python
def extend(self, records): """ Add each record in *records* to the end of the table. Args: record: an iterable of :class:`Record` or other iterables containing column values """ fields = self.fields for record in records: record = ...
[ "def", "extend", "(", "self", ",", "records", ")", ":", "fields", "=", "self", ".", "fields", "for", "record", "in", "records", ":", "record", "=", "_cast_record_to_str_tuple", "(", "record", ",", "fields", ")", "self", ".", "_records", ".", "append", "(...
Add each record in *records* to the end of the table. Args: record: an iterable of :class:`Record` or other iterables containing column values
[ "Add", "each", "record", "in", "*", "records", "*", "to", "the", "end", "of", "the", "table", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L954-L965
delph-in/pydelphin
delphin/itsdb.py
Table.select
def select(self, cols, mode='list'): """ Select columns from each row in the table. See :func:`select_rows` for a description of how to use the *mode* parameter. Args: cols: an iterable of Field (column) names mode: how to return the data """ ...
python
def select(self, cols, mode='list'): """ Select columns from each row in the table. See :func:`select_rows` for a description of how to use the *mode* parameter. Args: cols: an iterable of Field (column) names mode: how to return the data """ ...
[ "def", "select", "(", "self", ",", "cols", ",", "mode", "=", "'list'", ")", ":", "if", "isinstance", "(", "cols", ",", "stringtypes", ")", ":", "cols", "=", "_split_cols", "(", "cols", ")", "if", "not", "cols", ":", "cols", "=", "[", "f", ".", "n...
Select columns from each row in the table. See :func:`select_rows` for a description of how to use the *mode* parameter. Args: cols: an iterable of Field (column) names mode: how to return the data
[ "Select", "columns", "from", "each", "row", "in", "the", "table", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L967-L982
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.add_filter
def add_filter(self, table, cols, condition): """ Add a filter. When reading *table*, rows in *table* will be filtered by filter_rows(). Args: table: The table the filter applies to. cols: The columns in *table* to filter on. condition: The filter fun...
python
def add_filter(self, table, cols, condition): """ Add a filter. When reading *table*, rows in *table* will be filtered by filter_rows(). Args: table: The table the filter applies to. cols: The columns in *table* to filter on. condition: The filter fun...
[ "def", "add_filter", "(", "self", ",", "table", ",", "cols", ",", "condition", ")", ":", "if", "table", "is", "not", "None", "and", "table", "not", "in", "self", ".", "relations", ":", "raise", "ItsdbError", "(", "'Cannot add filter; table \"{}\" is not define...
Add a filter. When reading *table*, rows in *table* will be filtered by filter_rows(). Args: table: The table the filter applies to. cols: The columns in *table* to filter on. condition: The filter function.
[ "Add", "a", "filter", ".", "When", "reading", "*", "table", "*", "rows", "in", "*", "table", "*", "will", "be", "filtered", "by", "filter_rows", "()", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1951-L1968
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.add_applicator
def add_applicator(self, table, cols, function): """ Add an applicator. When reading *table*, rows in *table* will be modified by apply_rows(). Args: table: The table to apply the function to. cols: The columns in *table* to apply the function on. fun...
python
def add_applicator(self, table, cols, function): """ Add an applicator. When reading *table*, rows in *table* will be modified by apply_rows(). Args: table: The table to apply the function to. cols: The columns in *table* to apply the function on. fun...
[ "def", "add_applicator", "(", "self", ",", "table", ",", "cols", ",", "function", ")", ":", "if", "table", "not", "in", "self", ".", "relations", ":", "raise", "ItsdbError", "(", "'Cannot add applicator; table \"{}\" is not '", "'defined by the relations file.'", "....
Add an applicator. When reading *table*, rows in *table* will be modified by apply_rows(). Args: table: The table to apply the function to. cols: The columns in *table* to apply the function on. function: The applicator function.
[ "Add", "an", "applicator", ".", "When", "reading", "*", "table", "*", "rows", "in", "*", "table", "*", "will", "be", "modified", "by", "apply_rows", "()", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L1970-L1993
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.read_raw_table
def read_raw_table(self, table): """ Yield rows in the [incr tsdb()] *table*. A row is a dictionary mapping column names to values. Data from a profile is decoded by decode_row(). No filters or applicators are used. """ fields = self.table_relations(table) if self.cast el...
python
def read_raw_table(self, table): """ Yield rows in the [incr tsdb()] *table*. A row is a dictionary mapping column names to values. Data from a profile is decoded by decode_row(). No filters or applicators are used. """ fields = self.table_relations(table) if self.cast el...
[ "def", "read_raw_table", "(", "self", ",", "table", ")", ":", "fields", "=", "self", ".", "table_relations", "(", "table", ")", "if", "self", ".", "cast", "else", "None", "field_names", "=", "[", "f", ".", "name", "for", "f", "in", "self", ".", "tabl...
Yield rows in the [incr tsdb()] *table*. A row is a dictionary mapping column names to values. Data from a profile is decoded by decode_row(). No filters or applicators are used.
[ "Yield", "rows", "in", "the", "[", "incr", "tsdb", "()", "]", "*", "table", "*", ".", "A", "row", "is", "a", "dictionary", "mapping", "column", "names", "to", "values", ".", "Data", "from", "a", "profile", "is", "decoded", "by", "decode_row", "()", "...
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2019-L2039
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.read_table
def read_table(self, table, key_filter=True): """ Yield rows in the [incr tsdb()] *table* that pass any defined filters, and with values changed by any applicators. If no filters or applicators are defined, the result is the same as from ItsdbProfile.read_raw_table(). """...
python
def read_table(self, table, key_filter=True): """ Yield rows in the [incr tsdb()] *table* that pass any defined filters, and with values changed by any applicators. If no filters or applicators are defined, the result is the same as from ItsdbProfile.read_raw_table(). """...
[ "def", "read_table", "(", "self", ",", "table", ",", "key_filter", "=", "True", ")", ":", "filters", "=", "self", ".", "filters", "[", "None", "]", "+", "self", ".", "filters", "[", "table", "]", "if", "key_filter", ":", "for", "f", "in", "self", "...
Yield rows in the [incr tsdb()] *table* that pass any defined filters, and with values changed by any applicators. If no filters or applicators are defined, the result is the same as from ItsdbProfile.read_raw_table().
[ "Yield", "rows", "in", "the", "[", "incr", "tsdb", "()", "]", "*", "table", "*", "that", "pass", "any", "defined", "filters", "and", "with", "values", "changed", "by", "any", "applicators", ".", "If", "no", "filters", "or", "applicators", "are", "defined...
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2041-L2061
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.select
def select(self, table, cols, mode='list', key_filter=True): """ Yield selected rows from *table*. This method just calls select_rows() on the rows read from *table*. """ if cols is None: cols = [c.name for c in self.relations[table]] rows = self.read_table(ta...
python
def select(self, table, cols, mode='list', key_filter=True): """ Yield selected rows from *table*. This method just calls select_rows() on the rows read from *table*. """ if cols is None: cols = [c.name for c in self.relations[table]] rows = self.read_table(ta...
[ "def", "select", "(", "self", ",", "table", ",", "cols", ",", "mode", "=", "'list'", ",", "key_filter", "=", "True", ")", ":", "if", "cols", "is", "None", ":", "cols", "=", "[", "c", ".", "name", "for", "c", "in", "self", ".", "relations", "[", ...
Yield selected rows from *table*. This method just calls select_rows() on the rows read from *table*.
[ "Yield", "selected", "rows", "from", "*", "table", "*", ".", "This", "method", "just", "calls", "select_rows", "()", "on", "the", "rows", "read", "from", "*", "table", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2063-L2072
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.join
def join(self, table1, table2, key_filter=True): """ Yield rows from a table built by joining *table1* and *table2*. The column names in the rows have the original table name prepended and separated by a colon. For example, joining tables 'item' and 'parse' will result in column ...
python
def join(self, table1, table2, key_filter=True): """ Yield rows from a table built by joining *table1* and *table2*. The column names in the rows have the original table name prepended and separated by a colon. For example, joining tables 'item' and 'parse' will result in column ...
[ "def", "join", "(", "self", ",", "table1", ",", "table2", ",", "key_filter", "=", "True", ")", ":", "get_keys", "=", "lambda", "t", ":", "(", "f", ".", "name", "for", "f", "in", "self", ".", "relations", "[", "t", "]", "if", "f", ".", "key", ")...
Yield rows from a table built by joining *table1* and *table2*. The column names in the rows have the original table name prepended and separated by a colon. For example, joining tables 'item' and 'parse' will result in column names like 'item:i-input' and 'parse:parse-id'.
[ "Yield", "rows", "from", "a", "table", "built", "by", "joining", "*", "table1", "*", "and", "*", "table2", "*", ".", "The", "column", "names", "in", "the", "rows", "have", "the", "original", "table", "name", "prepended", "and", "separated", "by", "a", ...
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2074-L2104
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.write_table
def write_table(self, table, rows, append=False, gzip=False): """ Encode and write out *table* to the profile directory. Args: table: The name of the table to write rows: The rows to write to the table append: If `True`, append the encoded rows to any existin...
python
def write_table(self, table, rows, append=False, gzip=False): """ Encode and write out *table* to the profile directory. Args: table: The name of the table to write rows: The rows to write to the table append: If `True`, append the encoded rows to any existin...
[ "def", "write_table", "(", "self", ",", "table", ",", "rows", ",", "append", "=", "False", ",", "gzip", "=", "False", ")", ":", "_write_table", "(", "self", ".", "root", ",", "table", ",", "rows", ",", "self", ".", "table_relations", "(", "table", ")...
Encode and write out *table* to the profile directory. Args: table: The name of the table to write rows: The rows to write to the table append: If `True`, append the encoded rows to any existing data. gzip: If `True`, compress the resulting table ...
[ "Encode", "and", "write", "out", "*", "table", "*", "to", "the", "profile", "directory", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2106-L2124
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.write_profile
def write_profile(self, profile_directory, relations_filename=None, key_filter=True, append=False, gzip=None): """ Write all tables (as specified by the relations) to a profile. Args: profile_directory: The directory of the output profile ...
python
def write_profile(self, profile_directory, relations_filename=None, key_filter=True, append=False, gzip=None): """ Write all tables (as specified by the relations) to a profile. Args: profile_directory: The directory of the output profile ...
[ "def", "write_profile", "(", "self", ",", "profile_directory", ",", "relations_filename", "=", "None", ",", "key_filter", "=", "True", ",", "append", "=", "False", ",", "gzip", "=", "None", ")", ":", "if", "relations_filename", ":", "src_rels", "=", "os", ...
Write all tables (as specified by the relations) to a profile. Args: profile_directory: The directory of the output profile relations_filename: If given, read and use the relations at this path instead of the current profile's relations key_fi...
[ "Write", "all", "tables", "(", "as", "specified", "by", "the", "relations", ")", "to", "a", "profile", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2126-L2179
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.exists
def exists(self, table=None): """ Return True if the profile or a table exist. If *table* is `None`, this function returns True if the root directory exists and contains a valid relations file. If *table* is given, the function returns True if the table exists as a file ...
python
def exists(self, table=None): """ Return True if the profile or a table exist. If *table* is `None`, this function returns True if the root directory exists and contains a valid relations file. If *table* is given, the function returns True if the table exists as a file ...
[ "def", "exists", "(", "self", ",", "table", "=", "None", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "self", ".", "root", ")", ":", "return", "False", "if", "not", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", ...
Return True if the profile or a table exist. If *table* is `None`, this function returns True if the root directory exists and contains a valid relations file. If *table* is given, the function returns True if the table exists as a file (even if empty). Otherwise it returns False.
[ "Return", "True", "if", "the", "profile", "or", "a", "table", "exist", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2181-L2199
delph-in/pydelphin
delphin/itsdb.py
ItsdbProfile.size
def size(self, table=None): """ Return the size, in bytes, of the profile or *table*. If *table* is `None`, this function returns the size of the whole profile (i.e. the sum of the table sizes). Otherwise, it returns the size of *table*. Note: if the file is gzipped, it...
python
def size(self, table=None): """ Return the size, in bytes, of the profile or *table*. If *table* is `None`, this function returns the size of the whole profile (i.e. the sum of the table sizes). Otherwise, it returns the size of *table*. Note: if the file is gzipped, it...
[ "def", "size", "(", "self", ",", "table", "=", "None", ")", ":", "size", "=", "0", "if", "table", "is", "None", ":", "for", "table", "in", "self", ".", "relations", ":", "size", "+=", "self", ".", "size", "(", "table", ")", "else", ":", "try", ...
Return the size, in bytes, of the profile or *table*. If *table* is `None`, this function returns the size of the whole profile (i.e. the sum of the table sizes). Otherwise, it returns the size of *table*. Note: if the file is gzipped, it returns the compressed size.
[ "Return", "the", "size", "in", "bytes", "of", "the", "profile", "or", "*", "table", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/itsdb.py#L2201-L2221
delph-in/pydelphin
delphin/interfaces/rest.py
parse
def parse(input, server=default_erg_server, params=None, headers=None): """ Request a parse of *input* on *server* and return the response. Args: input (str): sentence to be parsed server (str): the url for the server (the default LOGON server is used by default) params ...
python
def parse(input, server=default_erg_server, params=None, headers=None): """ Request a parse of *input* on *server* and return the response. Args: input (str): sentence to be parsed server (str): the url for the server (the default LOGON server is used by default) params ...
[ "def", "parse", "(", "input", ",", "server", "=", "default_erg_server", ",", "params", "=", "None", ",", "headers", "=", "None", ")", ":", "return", "next", "(", "parse_from_iterable", "(", "[", "input", "]", ",", "server", ",", "params", ",", "headers",...
Request a parse of *input* on *server* and return the response. Args: input (str): sentence to be parsed server (str): the url for the server (the default LOGON server is used by default) params (dict): a dictionary of request parameters headers (dict): a dictionary of a...
[ "Request", "a", "parse", "of", "*", "input", "*", "on", "*", "server", "*", "and", "return", "the", "response", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/rest.py#L151-L167
delph-in/pydelphin
delphin/interfaces/rest.py
parse_from_iterable
def parse_from_iterable( inputs, server=default_erg_server, params=None, headers=None): """ Request parses for all *inputs*. Args: inputs (iterable): sentences to parse server (str): the url for the server (the default LOGON server is used by defa...
python
def parse_from_iterable( inputs, server=default_erg_server, params=None, headers=None): """ Request parses for all *inputs*. Args: inputs (iterable): sentences to parse server (str): the url for the server (the default LOGON server is used by defa...
[ "def", "parse_from_iterable", "(", "inputs", ",", "server", "=", "default_erg_server", ",", "params", "=", "None", ",", "headers", "=", "None", ")", ":", "client", "=", "DelphinRestClient", "(", "server", ")", "for", "input", "in", "inputs", ":", "yield", ...
Request parses for all *inputs*. Args: inputs (iterable): sentences to parse server (str): the url for the server (the default LOGON server is used by default) params (dict): a dictionary of request parameters headers (dict): a dictionary of additional request headers ...
[ "Request", "parses", "for", "all", "*", "inputs", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/rest.py#L169-L191
delph-in/pydelphin
delphin/interfaces/rest.py
DelphinRestClient.parse
def parse(self, sentence, params=None, headers=None): """ Request a parse of *sentence* and return the response. Args: sentence (str): sentence to be parsed params (dict): a dictionary of request parameters headers (dict): a dictionary of additional request h...
python
def parse(self, sentence, params=None, headers=None): """ Request a parse of *sentence* and return the response. Args: sentence (str): sentence to be parsed params (dict): a dictionary of request parameters headers (dict): a dictionary of additional request h...
[ "def", "parse", "(", "self", ",", "sentence", ",", "params", "=", "None", ",", "headers", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "params", "[", "'input'", "]", "=", "sentence", "hdrs", "=", "{", "'Accept'...
Request a parse of *sentence* and return the response. Args: sentence (str): sentence to be parsed params (dict): a dictionary of request parameters headers (dict): a dictionary of additional request headers Returns: A ParseResponse containing the results...
[ "Request", "a", "parse", "of", "*", "sentence", "*", "and", "return", "the", "response", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/rest.py#L113-L140
kylemacfarlane/zplgrf
src/zplgrf/__init__.py
_calculate_crc_ccitt
def _calculate_crc_ccitt(data): """ All CRC stuff ripped from PyCRC, GPLv3 licensed """ global CRC_CCITT_TABLE if not CRC_CCITT_TABLE: crc_ccitt_table = [] for i in range(0, 256): crc = 0 c = i << 8 for j in range(0, 8): if (crc ^ ...
python
def _calculate_crc_ccitt(data): """ All CRC stuff ripped from PyCRC, GPLv3 licensed """ global CRC_CCITT_TABLE if not CRC_CCITT_TABLE: crc_ccitt_table = [] for i in range(0, 256): crc = 0 c = i << 8 for j in range(0, 8): if (crc ^ ...
[ "def", "_calculate_crc_ccitt", "(", "data", ")", ":", "global", "CRC_CCITT_TABLE", "if", "not", "CRC_CCITT_TABLE", ":", "crc_ccitt_table", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "256", ")", ":", "crc", "=", "0", "c", "=", "i", "<<", ...
All CRC stuff ripped from PyCRC, GPLv3 licensed
[ "All", "CRC", "stuff", "ripped", "from", "PyCRC", "GPLv3", "licensed" ]
train
https://github.com/kylemacfarlane/zplgrf/blob/aacad3e69c7abe04dbfe9ce3c5cf6ac2a1ab67b3/src/zplgrf/__init__.py#L31-L61
kylemacfarlane/zplgrf
src/zplgrf/__init__.py
GRF.to_zpl_line
def to_zpl_line(self, compression=3, **kwargs): """ Compression: 3 = ZB64/Z64, base64 encoded DEFLATE compressed - best compression 2 = ASCII hex encoded run length compressed - most compatible 1 = B64, base64 encoded - pointless? """ if compression ==...
python
def to_zpl_line(self, compression=3, **kwargs): """ Compression: 3 = ZB64/Z64, base64 encoded DEFLATE compressed - best compression 2 = ASCII hex encoded run length compressed - most compatible 1 = B64, base64 encoded - pointless? """ if compression ==...
[ "def", "to_zpl_line", "(", "self", ",", "compression", "=", "3", ",", "*", "*", "kwargs", ")", ":", "if", "compression", "==", "3", ":", "data", "=", "base64", ".", "b64encode", "(", "zlib", ".", "compress", "(", "self", ".", "data", ".", "bytes", ...
Compression: 3 = ZB64/Z64, base64 encoded DEFLATE compressed - best compression 2 = ASCII hex encoded run length compressed - most compatible 1 = B64, base64 encoded - pointless?
[ "Compression", ":", "3", "=", "ZB64", "/", "Z64", "base64", "encoded", "DEFLATE", "compressed", "-", "best", "compression", "2", "=", "ASCII", "hex", "encoded", "run", "length", "compressed", "-", "most", "compatible", "1", "=", "B64", "base64", "encoded", ...
train
https://github.com/kylemacfarlane/zplgrf/blob/aacad3e69c7abe04dbfe9ce3c5cf6ac2a1ab67b3/src/zplgrf/__init__.py#L265-L321
kylemacfarlane/zplgrf
src/zplgrf/__init__.py
GRF.to_zpl
def to_zpl( self, quantity=1, pause_and_cut=0, override_pause=False, print_mode='C', print_orientation='N', media_tracking='Y', **kwargs ): """ The most basic ZPL to print the GRF. Since ZPL printers are stateful this may not work and you may need to build your own. "...
python
def to_zpl( self, quantity=1, pause_and_cut=0, override_pause=False, print_mode='C', print_orientation='N', media_tracking='Y', **kwargs ): """ The most basic ZPL to print the GRF. Since ZPL printers are stateful this may not work and you may need to build your own. "...
[ "def", "to_zpl", "(", "self", ",", "quantity", "=", "1", ",", "pause_and_cut", "=", "0", ",", "override_pause", "=", "False", ",", "print_mode", "=", "'C'", ",", "print_orientation", "=", "'N'", ",", "media_tracking", "=", "'Y'", ",", "*", "*", "kwargs",...
The most basic ZPL to print the GRF. Since ZPL printers are stateful this may not work and you may need to build your own.
[ "The", "most", "basic", "ZPL", "to", "print", "the", "GRF", ".", "Since", "ZPL", "printers", "are", "stateful", "this", "may", "not", "work", "and", "you", "may", "need", "to", "build", "your", "own", "." ]
train
https://github.com/kylemacfarlane/zplgrf/blob/aacad3e69c7abe04dbfe9ce3c5cf6ac2a1ab67b3/src/zplgrf/__init__.py#L323-L348
kylemacfarlane/zplgrf
src/zplgrf/__init__.py
GRF.from_image
def from_image(cls, image, filename): """ Filename is 1-8 alphanumeric characters to identify the GRF in ZPL. """ source = Image.open(BytesIO(image)) source = source.convert('1') width = int(math.ceil(source.size[0] / 8.0)) data = [] for line in _chunked...
python
def from_image(cls, image, filename): """ Filename is 1-8 alphanumeric characters to identify the GRF in ZPL. """ source = Image.open(BytesIO(image)) source = source.convert('1') width = int(math.ceil(source.size[0] / 8.0)) data = [] for line in _chunked...
[ "def", "from_image", "(", "cls", ",", "image", ",", "filename", ")", ":", "source", "=", "Image", ".", "open", "(", "BytesIO", "(", "image", ")", ")", "source", "=", "source", ".", "convert", "(", "'1'", ")", "width", "=", "int", "(", "math", ".", ...
Filename is 1-8 alphanumeric characters to identify the GRF in ZPL.
[ "Filename", "is", "1", "-", "8", "alphanumeric", "characters", "to", "identify", "the", "GRF", "in", "ZPL", "." ]
train
https://github.com/kylemacfarlane/zplgrf/blob/aacad3e69c7abe04dbfe9ce3c5cf6ac2a1ab67b3/src/zplgrf/__init__.py#L351-L367
kylemacfarlane/zplgrf
src/zplgrf/__init__.py
GRF.from_pdf
def from_pdf( cls, pdf, filename, width=288, height=432, dpi=203, font_path=None, center_of_pixel=False, use_bindings=False ): """ Filename is 1-8 alphanumeric characters to identify the GRF in ZPL. Dimensions and DPI are for a typical 4"x6" shipping label. E.g. 432 ...
python
def from_pdf( cls, pdf, filename, width=288, height=432, dpi=203, font_path=None, center_of_pixel=False, use_bindings=False ): """ Filename is 1-8 alphanumeric characters to identify the GRF in ZPL. Dimensions and DPI are for a typical 4"x6" shipping label. E.g. 432 ...
[ "def", "from_pdf", "(", "cls", ",", "pdf", ",", "filename", ",", "width", "=", "288", ",", "height", "=", "432", ",", "dpi", "=", "203", ",", "font_path", "=", "None", ",", "center_of_pixel", "=", "False", ",", "use_bindings", "=", "False", ")", ":",...
Filename is 1-8 alphanumeric characters to identify the GRF in ZPL. Dimensions and DPI are for a typical 4"x6" shipping label. E.g. 432 points / 72 points in an inch / 203 dpi = 6 inches Using center of pixel will improve barcode quality but may decrease the quality of some text. ...
[ "Filename", "is", "1", "-", "8", "alphanumeric", "characters", "to", "identify", "the", "GRF", "in", "ZPL", "." ]
train
https://github.com/kylemacfarlane/zplgrf/blob/aacad3e69c7abe04dbfe9ce3c5cf6ac2a1ab67b3/src/zplgrf/__init__.py#L384-L485
kylemacfarlane/zplgrf
src/zplgrf/__init__.py
GRF._optimise_barcodes
def _optimise_barcodes( self, data, min_bar_height=20, min_bar_count=100, max_gap_size=30, min_percent_white=0.2, max_percent_white=0.8, **kwargs ): """ min_bar_height = Minimum height of black bars in px. Set this too low and it might pick up text and ...
python
def _optimise_barcodes( self, data, min_bar_height=20, min_bar_count=100, max_gap_size=30, min_percent_white=0.2, max_percent_white=0.8, **kwargs ): """ min_bar_height = Minimum height of black bars in px. Set this too low and it might pick up text and ...
[ "def", "_optimise_barcodes", "(", "self", ",", "data", ",", "min_bar_height", "=", "20", ",", "min_bar_count", "=", "100", ",", "max_gap_size", "=", "30", ",", "min_percent_white", "=", "0.2", ",", "max_percent_white", "=", "0.8", ",", "*", "*", "kwargs", ...
min_bar_height = Minimum height of black bars in px. Set this too low and it might pick up text and data matrices, too high and it might pick up borders, tables, etc. min_bar_count = Minimum number of parallel black bars before a ...
[ "min_bar_height", "=", "Minimum", "height", "of", "black", "bars", "in", "px", ".", "Set", "this", "too", "low", "and", "it", "might", "pick", "up", "text", "and", "data", "matrices", "too", "high", "and", "it", "might", "pick", "up", "borders", "tables"...
train
https://github.com/kylemacfarlane/zplgrf/blob/aacad3e69c7abe04dbfe9ce3c5cf6ac2a1ab67b3/src/zplgrf/__init__.py#L506-L572
luckydonald/pytgbot
pytgbot/api_types/sendable/payments.py
ShippingOption.from_array
def from_array(array): """ Deserialize a new ShippingOption from a given dictionary. :return: new ShippingOption instance. :rtype: ShippingOption """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, paramet...
python
def from_array(array): """ Deserialize a new ShippingOption from a given dictionary. :return: new ShippingOption instance. :rtype: ShippingOption """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, paramet...
[ "def", "from_array", "(", "array", ")", ":", "if", "array", "is", "None", "or", "not", "array", ":", "return", "None", "# end if", "assert_type_or_raise", "(", "array", ",", "dict", ",", "parameter_name", "=", "\"array\"", ")", "data", "=", "{", "}", "da...
Deserialize a new ShippingOption from a given dictionary. :return: new ShippingOption instance. :rtype: ShippingOption
[ "Deserialize", "a", "new", "ShippingOption", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/payments.py#L172-L192
luckydonald/pytgbot
code_generation/code_generator.py
convert_to_underscore
def convert_to_underscore(name): """ "someFunctionWhatever" -> "some_function_whatever" """ s1 = _first_cap_re.sub(r'\1_\2', name) return _all_cap_re.sub(r'\1_\2', s1).lower()
python
def convert_to_underscore(name): """ "someFunctionWhatever" -> "some_function_whatever" """ s1 = _first_cap_re.sub(r'\1_\2', name) return _all_cap_re.sub(r'\1_\2', s1).lower()
[ "def", "convert_to_underscore", "(", "name", ")", ":", "s1", "=", "_first_cap_re", ".", "sub", "(", "r'\\1_\\2'", ",", "name", ")", "return", "_all_cap_re", ".", "sub", "(", "r'\\1_\\2'", ",", "s1", ")", ".", "lower", "(", ")" ]
"someFunctionWhatever" -> "some_function_whatever"
[ "someFunctionWhatever", "-", ">", "some_function_whatever" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator.py#L20-L23
luckydonald/pytgbot
code_generation/code_generator.py
func
def func(command, description, link, params_string, returns="On success, the sent Message is returned.", return_type="Message"): """ Live template for pycharm: y = func(command="$cmd$", description="$desc$", link="$lnk$", params_string="$first_param$", returns="$returns$", return_type="$returntype$") "...
python
def func(command, description, link, params_string, returns="On success, the sent Message is returned.", return_type="Message"): """ Live template for pycharm: y = func(command="$cmd$", description="$desc$", link="$lnk$", params_string="$first_param$", returns="$returns$", return_type="$returntype$") "...
[ "def", "func", "(", "command", ",", "description", ",", "link", ",", "params_string", ",", "returns", "=", "\"On success, the sent Message is returned.\"", ",", "return_type", "=", "\"Message\"", ")", ":", "description_with_tabs", "=", "\"\\t\\t\"", "+", "description"...
Live template for pycharm: y = func(command="$cmd$", description="$desc$", link="$lnk$", params_string="$first_param$", returns="$returns$", return_type="$returntype$")
[ "Live", "template", "for", "pycharm", ":" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator.py#L26-L89
luckydonald/pytgbot
code_generation/code_generator.py
clazz
def clazz(clazz, parent_clazz, description, link, params_string, init_super_args=None): """ Live template for pycharm: y = clazz(clazz="$clazz$", parent_clazz="%parent$", description="$desc$", link="$lnk$", params_string="$first_param$") """ init_description_w_tabs = description.strip().replace("\...
python
def clazz(clazz, parent_clazz, description, link, params_string, init_super_args=None): """ Live template for pycharm: y = clazz(clazz="$clazz$", parent_clazz="%parent$", description="$desc$", link="$lnk$", params_string="$first_param$") """ init_description_w_tabs = description.strip().replace("\...
[ "def", "clazz", "(", "clazz", ",", "parent_clazz", ",", "description", ",", "link", ",", "params_string", ",", "init_super_args", "=", "None", ")", ":", "init_description_w_tabs", "=", "description", ".", "strip", "(", ")", ".", "replace", "(", "\"\\n\"", ",...
Live template for pycharm: y = clazz(clazz="$clazz$", parent_clazz="%parent$", description="$desc$", link="$lnk$", params_string="$first_param$")
[ "Live", "template", "for", "pycharm", ":" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator.py#L106-L212
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/peer.py
User.to_array
def to_array(self): """ Serializes this User to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(User, self).to_array() array['id'] = int(self.id) # type int array['is_bot'] = bool(self.is_bot) # type bool ...
python
def to_array(self): """ Serializes this User to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(User, self).to_array() array['id'] = int(self.id) # type int array['is_bot'] = bool(self.is_bot) # type bool ...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "User", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'id'", "]", "=", "int", "(", "self", ".", "id", ")", "# type int", "array", "[", "'is_bot'", "]", "=", "bool...
Serializes this User to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "User", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/peer.py#L98-L119
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/peer.py
User.from_array
def from_array(array): """ Deserialize a new User from a given dictionary. :return: new User instance. :rtype: User """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="array") data...
python
def from_array(array): """ Deserialize a new User from a given dictionary. :return: new User instance. :rtype: User """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="array") data...
[ "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 User from a given dictionary. :return: new User instance. :rtype: User
[ "Deserialize", "a", "new", "User", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/peer.py#L123-L143
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/peer.py
Chat.to_array
def to_array(self): """ Serializes this Chat to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(Chat, self).to_array() array['id'] = int(self.id) # type int array['type'] = u(self.type) # py2: type unicode...
python
def to_array(self): """ Serializes this Chat to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(Chat, self).to_array() array['id'] = int(self.id) # type int array['type'] = u(self.type) # py2: type unicode...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "Chat", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'id'", "]", "=", "int", "(", "self", ".", "id", ")", "# type int", "array", "[", "'type'", "]", "=", "u", ...
Serializes this Chat to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "Chat", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/peer.py#L327-L369
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/peer.py
Chat.from_array
def from_array(array): """ Deserialize a new Chat from a given dictionary. :return: new Chat instance. :rtype: Chat """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="array") from ...
python
def from_array(array): """ Deserialize a new Chat from a given dictionary. :return: new Chat instance. :rtype: Chat """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="array") from ...
[ "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 Chat from a given dictionary. :return: new Chat instance. :rtype: Chat
[ "Deserialize", "a", "new", "Chat", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/peer.py#L373-L403
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/peer.py
ChatMember.to_array
def to_array(self): """ Serializes this ChatMember to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(ChatMember, self).to_array() array['user'] = self.user.to_array() # type User array['status'] = u(self....
python
def to_array(self): """ Serializes this ChatMember to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(ChatMember, self).to_array() array['user'] = self.user.to_array() # type User array['status'] = u(self....
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "ChatMember", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'user'", "]", "=", "self", ".", "user", ".", "to_array", "(", ")", "# type User", "array", "[", "'status'"...
Serializes this ChatMember to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "ChatMember", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/peer.py#L613-L653
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/peer.py
ChatMember.from_array
def from_array(array): """ Deserialize a new ChatMember from a given dictionary. :return: new ChatMember instance. :rtype: ChatMember """ 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 ChatMember from a given dictionary. :return: new ChatMember instance. :rtype: ChatMember """ 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 ChatMember from a given dictionary. :return: new ChatMember instance. :rtype: ChatMember
[ "Deserialize", "a", "new", "ChatMember", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/peer.py#L657-L689
delph-in/pydelphin
delphin/mrs/mrx.py
loads
def loads(s, single=False): """ Deserialize MRX string representations Args: s (str): a MRX 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 single:...
python
def loads(s, single=False): """ Deserialize MRX string representations Args: s (str): a MRX 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 single:...
[ "def", "loads", "(", "s", ",", "single", "=", "False", ")", ":", "corpus", "=", "etree", ".", "fromstring", "(", "s", ")", "if", "single", ":", "ds", "=", "_deserialize_mrs", "(", "next", "(", "corpus", ")", ")", "else", ":", "ds", "=", "(", "_de...
Deserialize MRX string representations Args: s (str): a MRX string single (bool): if `True`, only return the first Xmrs object Returns: a generator of Xmrs objects (unless *single* is `True`)
[ "Deserialize", "MRX", "string", "representations" ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/mrx.py#L45-L60
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultArticle.to_array
def to_array(self): """ Serializes this InlineQueryResultArticle to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultArticle, self).to_array() # 'type' and 'id' given by superclass array['tit...
python
def to_array(self): """ Serializes this InlineQueryResultArticle to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultArticle, self).to_array() # 'type' and 'id' given by superclass array['tit...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultArticle", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'title'", "]", "=", "u", "(", "self", ".", "title", ")", ...
Serializes this InlineQueryResultArticle to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultArticle", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L167-L192
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultGif.to_array
def to_array(self): """ Serializes this InlineQueryResultGif to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultGif, self).to_array() # 'type' and 'id' given by superclass array['gif_url'] =...
python
def to_array(self): """ Serializes this InlineQueryResultGif to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultGif, self).to_array() # 'type' and 'id' given by superclass array['gif_url'] =...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultGif", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'gif_url'", "]", "=", "u", "(", "self", ".", "gif_url", ")", ...
Serializes this InlineQueryResultGif to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultGif", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L600-L627
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultAudio.to_array
def to_array(self): """ Serializes this InlineQueryResultAudio to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultAudio, self).to_array() # 'type' and 'id' given by superclass array['audio_u...
python
def to_array(self): """ Serializes this InlineQueryResultAudio to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultAudio, self).to_array() # 'type' and 'id' given by superclass array['audio_u...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultAudio", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'audio_url'", "]", "=", "u", "(", "self", ".", "audio_url", "...
Serializes this InlineQueryResultAudio to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultAudio", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L1264-L1287
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultLocation.to_array
def to_array(self): """ Serializes this InlineQueryResultLocation to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultLocation, self).to_array() # 'type' and 'id' given by superclass array['l...
python
def to_array(self): """ Serializes this InlineQueryResultLocation to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultLocation, self).to_array() # 'type' and 'id' given by superclass array['l...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultLocation", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'latitude'", "]", "=", "float", "(", "self", ".", "latitude"...
Serializes this InlineQueryResultLocation to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultLocation", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L1884-L1908
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultContact.to_array
def to_array(self): """ Serializes this InlineQueryResultContact to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultContact, self).to_array() # 'type' and 'id' given by superclass array['pho...
python
def to_array(self): """ Serializes this InlineQueryResultContact to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultContact, self).to_array() # 'type' and 'id' given by superclass array['pho...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultContact", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'phone_number'", "]", "=", "u", "(", "self", ".", "phone_numb...
Serializes this InlineQueryResultContact to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultContact", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L2321-L2344
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultGame.to_array
def to_array(self): """ Serializes this InlineQueryResultGame to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultGame, self).to_array() # 'type' and 'id' given by superclass array['game_shor...
python
def to_array(self): """ Serializes this InlineQueryResultGame to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultGame, self).to_array() # 'type' and 'id' given by superclass array['game_shor...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultGame", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'game_short_name'", "]", "=", "u", "(", "self", ".", "game_short...
Serializes this InlineQueryResultGame to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultGame", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L2467-L2479
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultCachedGif.to_array
def to_array(self): """ Serializes this InlineQueryResultCachedGif to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultCachedGif, self).to_array() # 'type' and 'id' given by superclass array[...
python
def to_array(self): """ Serializes this InlineQueryResultCachedGif to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultCachedGif, self).to_array() # 'type' and 'id' given by superclass array[...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultCachedGif", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'gif_file_id'", "]", "=", "u", "(", "self", ".", "gif_file_...
Serializes this InlineQueryResultCachedGif to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultCachedGif", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L2811-L2831
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultCachedDocument.to_array
def to_array(self): """ Serializes this InlineQueryResultCachedDocument to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultCachedDocument, self).to_array() # 'type' and 'id' given by superclass ...
python
def to_array(self): """ Serializes this InlineQueryResultCachedDocument to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultCachedDocument, self).to_array() # 'type' and 'id' given by superclass ...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultCachedDocument", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'title'", "]", "=", "u", "(", "self", ".", "title", ...
Serializes this InlineQueryResultCachedDocument to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultCachedDocument", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L3306-L3327
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultCachedVoice.to_array
def to_array(self): """ Serializes this InlineQueryResultCachedVoice to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultCachedVoice, self).to_array() # 'type' and 'id' given by superclass ar...
python
def to_array(self): """ Serializes this InlineQueryResultCachedVoice to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InlineQueryResultCachedVoice, self).to_array() # 'type' and 'id' given by superclass ar...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InlineQueryResultCachedVoice", ",", "self", ")", ".", "to_array", "(", ")", "# 'type' and 'id' given by superclass", "array", "[", "'voice_file_id'", "]", "=", "u", "(", "self", ".", "voice...
Serializes this InlineQueryResultCachedVoice to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InlineQueryResultCachedVoice", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L3664-L3683
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InlineQueryResultCachedAudio.from_array
def from_array(array): """ Deserialize a new InlineQueryResultCachedAudio from a given dictionary. :return: new InlineQueryResultCachedAudio instance. :rtype: InlineQueryResultCachedAudio """ if array is None or not array: return None # end if ...
python
def from_array(array): """ Deserialize a new InlineQueryResultCachedAudio from a given dictionary. :return: new InlineQueryResultCachedAudio instance. :rtype: InlineQueryResultCachedAudio """ if array is None or not array: return None # end if ...
[ "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 InlineQueryResultCachedAudio from a given dictionary. :return: new InlineQueryResultCachedAudio instance. :rtype: InlineQueryResultCachedAudio
[ "Deserialize", "a", "new", "InlineQueryResultCachedAudio", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L3850-L3875
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InputTextMessageContent.to_array
def to_array(self): """ Serializes this InputTextMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputTextMessageContent, self).to_array() array['message_text'] = u(self.message_text) # py2: type ...
python
def to_array(self): """ Serializes this InputTextMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputTextMessageContent, self).to_array() array['message_text'] = u(self.message_text) # py2: type ...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InputTextMessageContent", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'message_text'", "]", "=", "u", "(", "self", ".", "message_text", ")", "# py2: type unicode, py3: typ...
Serializes this InputTextMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputTextMessageContent", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L3958-L3971
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InputLocationMessageContent.to_array
def to_array(self): """ Serializes this InputLocationMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputLocationMessageContent, self).to_array() array['latitude'] = float(self.latitude) # type f...
python
def to_array(self): """ Serializes this InputLocationMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputLocationMessageContent, self).to_array() array['latitude'] = float(self.latitude) # type f...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InputLocationMessageContent", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'latitude'", "]", "=", "float", "(", "self", ".", "latitude", ")", "# type float", "array", "...
Serializes this InputLocationMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputLocationMessageContent", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L4077-L4089
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InputLocationMessageContent.from_array
def from_array(array): """ Deserialize a new InputLocationMessageContent from a given dictionary. :return: new InputLocationMessageContent instance. :rtype: InputLocationMessageContent """ if array is None or not array: return None # end if as...
python
def from_array(array): """ Deserialize a new InputLocationMessageContent from a given dictionary. :return: new InputLocationMessageContent instance. :rtype: InputLocationMessageContent """ if array is None or not array: return None # end if as...
[ "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 InputLocationMessageContent from a given dictionary. :return: new InputLocationMessageContent instance. :rtype: InputLocationMessageContent
[ "Deserialize", "a", "new", "InputLocationMessageContent", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L4093-L4112
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InputVenueMessageContent.to_array
def to_array(self): """ Serializes this InputVenueMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputVenueMessageContent, self).to_array() array['latitude'] = float(self.latitude) # type float ...
python
def to_array(self): """ Serializes this InputVenueMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputVenueMessageContent, self).to_array() array['latitude'] = float(self.latitude) # type float ...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InputVenueMessageContent", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'latitude'", "]", "=", "float", "(", "self", ".", "latitude", ")", "# type float", "array", "[",...
Serializes this InputVenueMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputVenueMessageContent", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L4224-L4240
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InputVenueMessageContent.from_array
def from_array(array): """ Deserialize a new InputVenueMessageContent from a given dictionary. :return: new InputVenueMessageContent instance. :rtype: InputVenueMessageContent """ if array is None or not array: return None # end if assert_type...
python
def from_array(array): """ Deserialize a new InputVenueMessageContent from a given dictionary. :return: new InputVenueMessageContent instance. :rtype: InputVenueMessageContent """ if array is None or not array: return None # end if assert_type...
[ "def", "from_array", "(", "array", ")", ":", "if", "array", "is", "None", "or", "not", "array", ":", "return", "None", "# end if", "assert_type_or_raise", "(", "array", ",", "dict", ",", "parameter_name", "=", "\"array\"", ")", "data", "=", "{", "}", "da...
Deserialize a new InputVenueMessageContent from a given dictionary. :return: new InputVenueMessageContent instance. :rtype: InputVenueMessageContent
[ "Deserialize", "a", "new", "InputVenueMessageContent", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L4244-L4266
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
InputContactMessageContent.to_array
def to_array(self): """ Serializes this InputContactMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputContactMessageContent, self).to_array() array['phone_number'] = u(self.phone_number) # py2:...
python
def to_array(self): """ Serializes this InputContactMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(InputContactMessageContent, self).to_array() array['phone_number'] = u(self.phone_number) # py2:...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "InputContactMessageContent", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'phone_number'", "]", "=", "u", "(", "self", ".", "phone_number", ")", "# py2: type unicode, py3: ...
Serializes this InputContactMessageContent to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "InputContactMessageContent", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L4360-L4374
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/passport.py
PassportData.from_array
def from_array(array): """ Deserialize a new PassportData from a given dictionary. :return: new PassportData instance. :rtype: PassportData """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_nam...
python
def from_array(array): """ Deserialize a new PassportData from a given dictionary. :return: new PassportData instance. :rtype: PassportData """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_nam...
[ "def", "from_array", "(", "array", ")", ":", "if", "array", "is", "None", "or", "not", "array", ":", "return", "None", "# end if", "assert_type_or_raise", "(", "array", ",", "dict", ",", "parameter_name", "=", "\"array\"", ")", "from", "pytgbot", ".", "api...
Deserialize a new PassportData from a given dictionary. :return: new PassportData instance. :rtype: PassportData
[ "Deserialize", "a", "new", "PassportData", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/passport.py#L80-L99
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/passport.py
EncryptedPassportElement.from_array
def from_array(array): """ Deserialize a new EncryptedPassportElement from a given dictionary. :return: new EncryptedPassportElement instance. :rtype: EncryptedPassportElement """ if array is None or not array: return None # end if assert_type...
python
def from_array(array): """ Deserialize a new EncryptedPassportElement from a given dictionary. :return: new EncryptedPassportElement instance. :rtype: EncryptedPassportElement """ if array is None or not array: return None # end if assert_type...
[ "def", "from_array", "(", "array", ")", ":", "if", "array", "is", "None", "or", "not", "array", ":", "return", "None", "# end if", "assert_type_or_raise", "(", "array", ",", "dict", ",", "parameter_name", "=", "\"array\"", ")", "from", "pytgbot", ".", "api...
Deserialize a new EncryptedPassportElement from a given dictionary. :return: new EncryptedPassportElement instance. :rtype: EncryptedPassportElement
[ "Deserialize", "a", "new", "EncryptedPassportElement", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/passport.py#L419-L445
luckydonald/pytgbot
code_generation/code_generator_template.py
clazz
def clazz(clazz, parent_clazz, description, link, params_string, init_super_args=None): """ Live template for pycharm: y = clazz(clazz="$clazz$", parent_clazz="%parent$", description="$description$", link="$lnk$", params_string="$first_param$") """ variables_needed = [] variables_optional = [] ...
python
def clazz(clazz, parent_clazz, description, link, params_string, init_super_args=None): """ Live template for pycharm: y = clazz(clazz="$clazz$", parent_clazz="%parent$", description="$description$", link="$lnk$", params_string="$first_param$") """ variables_needed = [] variables_optional = [] ...
[ "def", "clazz", "(", "clazz", ",", "parent_clazz", ",", "description", ",", "link", ",", "params_string", ",", "init_super_args", "=", "None", ")", ":", "variables_needed", "=", "[", "]", "variables_optional", "=", "[", "]", "imports", "=", "set", "(", ")"...
Live template for pycharm: y = clazz(clazz="$clazz$", parent_clazz="%parent$", description="$description$", link="$lnk$", params_string="$first_param$")
[ "Live", "template", "for", "pycharm", ":" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator_template.py#L52-L82
luckydonald/pytgbot
code_generation/code_generator_template.py
func
def func(command, description, link, params_string, returns="On success, the sent Message is returned.", return_type="Message"): """ Live template for pycharm: y = func(command="$cmd$", description="$desc$", link="$lnk$", params_string="$first_param$", returns="$returns$", return_type="$returntype$") "...
python
def func(command, description, link, params_string, returns="On success, the sent Message is returned.", return_type="Message"): """ Live template for pycharm: y = func(command="$cmd$", description="$desc$", link="$lnk$", params_string="$first_param$", returns="$returns$", return_type="$returntype$") "...
[ "def", "func", "(", "command", ",", "description", ",", "link", ",", "params_string", ",", "returns", "=", "\"On success, the sent Message is returned.\"", ",", "return_type", "=", "\"Message\"", ")", ":", "variables_needed", "=", "[", "]", "variables_optional", "="...
Live template for pycharm: y = func(command="$cmd$", description="$desc$", link="$lnk$", params_string="$first_param$", returns="$returns$", return_type="$returntype$")
[ "Live", "template", "for", "pycharm", ":" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator_template.py#L86-L115
luckydonald/pytgbot
code_generation/code_generator_template.py
to_type
def to_type(type_string, variable_name) -> Type: """ Returns a :class:`Type` object of a given type name. Lookup is done via :var:`code_generator_settings.CLASS_TYPE_PATHS` :param type_string: The type as string. E.g "bool". Need to be valid python. :param variable_name: Only for logging, if an unrecog...
python
def to_type(type_string, variable_name) -> Type: """ Returns a :class:`Type` object of a given type name. Lookup is done via :var:`code_generator_settings.CLASS_TYPE_PATHS` :param type_string: The type as string. E.g "bool". Need to be valid python. :param variable_name: Only for logging, if an unrecog...
[ "def", "to_type", "(", "type_string", ",", "variable_name", ")", "->", "Type", ":", "# type_string = type_string.strip()", "# remove \"list of \" and set .is_list accordingly.", "# is_list, type_string = can_strip_prefix(type_string, \"list of \")", "# var_type = Type(string=type_string, i...
Returns a :class:`Type` object of a given type name. Lookup is done via :var:`code_generator_settings.CLASS_TYPE_PATHS` :param type_string: The type as string. E.g "bool". Need to be valid python. :param variable_name: Only for logging, if an unrecognized type is found. :return: a :class:`Type` instance ...
[ "Returns", "a", ":", "class", ":", "Type", "object", "of", "a", "given", "type", "name", ".", "Lookup", "is", "done", "via", ":", "var", ":", "code_generator_settings", ".", "CLASS_TYPE_PATHS" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator_template.py#L649-L690
luckydonald/pytgbot
code_generation/code_generator_template.py
can_strip_prefix
def can_strip_prefix(text:str, prefix:str) -> (bool, str): """ If the given text starts with the given prefix, True and the text without that prefix is returned. Else False and the original text is returned. Note: the text always is stripped, before returning. :param text: :param prefix: :...
python
def can_strip_prefix(text:str, prefix:str) -> (bool, str): """ If the given text starts with the given prefix, True and the text without that prefix is returned. Else False and the original text is returned. Note: the text always is stripped, before returning. :param text: :param prefix: :...
[ "def", "can_strip_prefix", "(", "text", ":", "str", ",", "prefix", ":", "str", ")", "->", "(", "bool", ",", "str", ")", ":", "if", "text", ".", "startswith", "(", "prefix", ")", ":", "return", "True", ",", "text", "[", "len", "(", "prefix", ")", ...
If the given text starts with the given prefix, True and the text without that prefix is returned. Else False and the original text is returned. Note: the text always is stripped, before returning. :param text: :param prefix: :return: (bool, str) :class:`bool` whether he text started with given p...
[ "If", "the", "given", "text", "starts", "with", "the", "given", "prefix", "True", "and", "the", "text", "without", "that", "prefix", "is", "returned", ".", "Else", "False", "and", "the", "original", "text", "is", "returned", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator_template.py#L694-L707
luckydonald/pytgbot
code_generation/code_generator_template.py
Function.class_name
def class_name(self) -> str: """ Makes the fist letter big, keep the rest of the camelCaseApiName. """ if not self.api_name: # empty string return self.api_name # end if return self.api_name[0].upper() + self.api_name[1:]
python
def class_name(self) -> str: """ Makes the fist letter big, keep the rest of the camelCaseApiName. """ if not self.api_name: # empty string return self.api_name # end if return self.api_name[0].upper() + self.api_name[1:]
[ "def", "class_name", "(", "self", ")", "->", "str", ":", "if", "not", "self", ".", "api_name", ":", "# empty string", "return", "self", ".", "api_name", "# end if", "return", "self", ".", "api_name", "[", "0", "]", ".", "upper", "(", ")", "+", "self", ...
Makes the fist letter big, keep the rest of the camelCaseApiName.
[ "Makes", "the", "fist", "letter", "big", "keep", "the", "rest", "of", "the", "camelCaseApiName", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator_template.py#L224-L231
luckydonald/pytgbot
code_generation/code_generator_template.py
Function.class_name_teleflask_message
def class_name_teleflask_message(self) -> str: """ If it starts with `Send` remove that. """ # strip leading "Send" name = self.class_name # "sendPhoto" -> "SendPhoto" name = name[4:] if name.startswith('Send') else name # "SendPhoto" -> "Photo" name = name + "M...
python
def class_name_teleflask_message(self) -> str: """ If it starts with `Send` remove that. """ # strip leading "Send" name = self.class_name # "sendPhoto" -> "SendPhoto" name = name[4:] if name.startswith('Send') else name # "SendPhoto" -> "Photo" name = name + "M...
[ "def", "class_name_teleflask_message", "(", "self", ")", "->", "str", ":", "# strip leading \"Send\"", "name", "=", "self", ".", "class_name", "# \"sendPhoto\" -> \"SendPhoto\"", "name", "=", "name", "[", "4", ":", "]", "if", "name", ".", "startswith", "(", "'Se...
If it starts with `Send` remove that.
[ "If", "it", "starts", "with", "Send", "remove", "that", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator_template.py#L235-L249
luckydonald/pytgbot
code_generation/code_generator_template.py
Import.full
def full(self): """ self.path + "." + self.name """ if self.path: if self.name: return self.path + "." + self.name else: return self.path # end if else: if self.name: return self.name else...
python
def full(self): """ self.path + "." + self.name """ if self.path: if self.name: return self.path + "." + self.name else: return self.path # end if else: if self.name: return self.name else...
[ "def", "full", "(", "self", ")", ":", "if", "self", ".", "path", ":", "if", "self", ".", "name", ":", "return", "self", ".", "path", "+", "\".\"", "+", "self", ".", "name", "else", ":", "return", "self", ".", "path", "# end if", "else", ":", "if"...
self.path + "." + self.name
[ "self", ".", "path", "+", ".", "+", "self", ".", "name" ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/code_generator_template.py#L479-L491
luckydonald/pytgbot
pytgbot/api_types/__init__.py
from_array_list
def from_array_list(required_type, result, list_level, is_builtin): """ Tries to parse the `result` as type given in `required_type`, while traversing into lists as often as specified in `list_level`. :param required_type: What it should be parsed as :type required_type: class :param result: The ...
python
def from_array_list(required_type, result, list_level, is_builtin): """ Tries to parse the `result` as type given in `required_type`, while traversing into lists as often as specified in `list_level`. :param required_type: What it should be parsed as :type required_type: class :param result: The ...
[ "def", "from_array_list", "(", "required_type", ",", "result", ",", "list_level", ",", "is_builtin", ")", ":", "logger", ".", "debug", "(", "\"Trying parsing as {type}, list_level={list_level}, is_builtin={is_builtin}\"", ".", "format", "(", "type", "=", "required_type", ...
Tries to parse the `result` as type given in `required_type`, while traversing into lists as often as specified in `list_level`. :param required_type: What it should be parsed as :type required_type: class :param result: The result to parse :param list_level: "list of" * list_level :type list_l...
[ "Tries", "to", "parse", "the", "result", "as", "type", "given", "in", "required_type", "while", "traversing", "into", "lists", "as", "often", "as", "specified", "in", "list_level", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/__init__.py#L94-L130
luckydonald/pytgbot
pytgbot/api_types/__init__.py
as_array
def as_array(obj): """ Creates an json-like representation of a variable, supporting types with a `.to_array()` function. :rtype: dict|list|str|int|float|bool|None """ if hasattr(obj, "to_array"): return obj.to_array() elif isinstance(obj, (list, tuple)): return [as_array(x) for...
python
def as_array(obj): """ Creates an json-like representation of a variable, supporting types with a `.to_array()` function. :rtype: dict|list|str|int|float|bool|None """ if hasattr(obj, "to_array"): return obj.to_array() elif isinstance(obj, (list, tuple)): return [as_array(x) for...
[ "def", "as_array", "(", "obj", ")", ":", "if", "hasattr", "(", "obj", ",", "\"to_array\"", ")", ":", "return", "obj", ".", "to_array", "(", ")", "elif", "isinstance", "(", "obj", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "as_arr...
Creates an json-like representation of a variable, supporting types with a `.to_array()` function. :rtype: dict|list|str|int|float|bool|None
[ "Creates", "an", "json", "-", "like", "representation", "of", "a", "variable", "supporting", "types", "with", "a", ".", "to_array", "()", "function", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/__init__.py#L135-L149
luckydonald/pytgbot
pytgbot/api_types/__init__.py
TgBotApiObject.from_array_list
def from_array_list(cls, result, list_level): """ Tries to parse the `result` as type given in `required_type`, while traversing into lists as often as specified in `list_level`. :param cls: Type as what it should be parsed as. Can be any class extending :class:`TgBotApiObject`. ...
python
def from_array_list(cls, result, list_level): """ Tries to parse the `result` as type given in `required_type`, while traversing into lists as often as specified in `list_level`. :param cls: Type as what it should be parsed as. Can be any class extending :class:`TgBotApiObject`. ...
[ "def", "from_array_list", "(", "cls", ",", "result", ",", "list_level", ")", ":", "return", "from_array_list", "(", "cls", ",", "result", ",", "list_level", ",", "is_builtin", "=", "False", ")" ]
Tries to parse the `result` as type given in `required_type`, while traversing into lists as often as specified in `list_level`. :param cls: Type as what it should be parsed as. Can be any class extending :class:`TgBotApiObject`. E.g. If you call `Class.from_array_list`, it will automatical...
[ "Tries", "to", "parse", "the", "result", "as", "type", "given", "in", "required_type", "while", "traversing", "into", "lists", "as", "often", "as", "specified", "in", "list_level", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/__init__.py#L36-L51
luckydonald/pytgbot
pytgbot/api_types/__init__.py
TgBotApiObject._builtin_from_array_list
def _builtin_from_array_list(required_type, value, list_level): """ Helper method to make :func:`from_array_list` available to all classes extending this, without the need for additional imports. :param required_type: Type as what it should be parsed as. Any builtin. :param valu...
python
def _builtin_from_array_list(required_type, value, list_level): """ Helper method to make :func:`from_array_list` available to all classes extending this, without the need for additional imports. :param required_type: Type as what it should be parsed as. Any builtin. :param valu...
[ "def", "_builtin_from_array_list", "(", "required_type", ",", "value", ",", "list_level", ")", ":", "return", "from_array_list", "(", "required_type", ",", "value", ",", "list_level", ",", "is_builtin", "=", "True", ")" ]
Helper method to make :func:`from_array_list` available to all classes extending this, without the need for additional imports. :param required_type: Type as what it should be parsed as. Any builtin. :param value: The result to parse :param list_level: "list of" * list_level :re...
[ "Helper", "method", "to", "make", ":", "func", ":", "from_array_list", "available", "to", "all", "classes", "extending", "this", "without", "the", "need", "for", "additional", "imports", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/__init__.py#L55-L65
luckydonald/pytgbot
pytgbot/extra/bot_response.py
ResponseBot.do
def do(self, command, files=None, use_long_polling=False, request_timeout=None, **query): """ Return the request params we would send to the api. """ url, params = self._prepare_request(command, query) return { "url": url, "params": params, "files": files, "stream": u...
python
def do(self, command, files=None, use_long_polling=False, request_timeout=None, **query): """ Return the request params we would send to the api. """ url, params = self._prepare_request(command, query) return { "url": url, "params": params, "files": files, "stream": u...
[ "def", "do", "(", "self", ",", "command", ",", "files", "=", "None", ",", "use_long_polling", "=", "False", ",", "request_timeout", "=", "None", ",", "*", "*", "query", ")", ":", "url", ",", "params", "=", "self", ".", "_prepare_request", "(", "command...
Return the request params we would send to the api.
[ "Return", "the", "request", "params", "we", "would", "send", "to", "the", "api", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/extra/bot_response.py#L20-L29
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
Update.to_array
def to_array(self): """ Serializes this Update to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(Update, self).to_array() array['update_id'] = int(self.update_id) # type int if self.message is not None: ...
python
def to_array(self): """ Serializes this Update to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(Update, self).to_array() array['update_id'] = int(self.update_id) # type int if self.message is not None: ...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "Update", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'update_id'", "]", "=", "int", "(", "self", ".", "update_id", ")", "# type int", "if", "self", ".", "message",...
Serializes this Update to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "Update", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L149-L176
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
WebhookInfo.to_array
def to_array(self): """ Serializes this WebhookInfo to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(WebhookInfo, self).to_array() array['url'] = u(self.url) # py2: type unicode, py3: type str array['has_...
python
def to_array(self): """ Serializes this WebhookInfo to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(WebhookInfo, self).to_array() array['url'] = u(self.url) # py2: type unicode, py3: type str array['has_...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "WebhookInfo", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'url'", "]", "=", "u", "(", "self", ".", "url", ")", "# py2: type unicode, py3: type str", "array", "[", "'...
Serializes this WebhookInfo to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "WebhookInfo", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L334-L353
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
WebhookInfo.from_array
def from_array(array): """ Deserialize a new WebhookInfo from a given dictionary. :return: new WebhookInfo instance. :rtype: WebhookInfo """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="...
python
def from_array(array): """ Deserialize a new WebhookInfo from a given dictionary. :return: new WebhookInfo instance. :rtype: WebhookInfo """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="...
[ "def", "from_array", "(", "array", ")", ":", "if", "array", "is", "None", "or", "not", "array", ":", "return", "None", "# end if", "assert_type_or_raise", "(", "array", ",", "dict", ",", "parameter_name", "=", "\"array\"", ")", "data", "=", "{", "}", "da...
Deserialize a new WebhookInfo from a given dictionary. :return: new WebhookInfo instance. :rtype: WebhookInfo
[ "Deserialize", "a", "new", "WebhookInfo", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L357-L378
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
Message.to_array
def to_array(self): """ Serializes this Message to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(Message, self).to_array() array['message_id'] = int(self.message_id) # type int array['date'] = int(self.da...
python
def to_array(self): """ Serializes this Message to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(Message, self).to_array() array['message_id'] = int(self.message_id) # type int array['date'] = int(self.da...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "Message", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'message_id'", "]", "=", "int", "(", "self", ".", "message_id", ")", "# type int", "array", "[", "'date'", "]...
Serializes this Message to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "Message", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L845-L938
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
Message.from_array
def from_array(array): """ Deserialize a new Message from a given dictionary. :return: new Message instance. :rtype: Message """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="array") ...
python
def from_array(array): """ Deserialize a new Message from a given dictionary. :return: new Message instance. :rtype: Message """ if array is None or not array: return None # end if assert_type_or_raise(array, dict, parameter_name="array") ...
[ "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", ".", ".", "receivabl...
Deserialize a new Message from a given dictionary. :return: new Message instance. :rtype: Message
[ "Deserialize", "a", "new", "Message", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L942-L1006
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
CallbackQuery.to_array
def to_array(self): """ Serializes this CallbackQuery to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(CallbackQuery, self).to_array() array['id'] = u(self.id) # py2: type unicode, py3: type str array['fr...
python
def to_array(self): """ Serializes this CallbackQuery to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(CallbackQuery, self).to_array() array['id'] = u(self.id) # py2: type unicode, py3: type str array['fr...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "CallbackQuery", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'id'", "]", "=", "u", "(", "self", ".", "id", ")", "# py2: type unicode, py3: type str", "array", "[", "'...
Serializes this CallbackQuery to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "CallbackQuery", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L1140-L1159
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
CallbackQuery.from_array
def from_array(array): """ Deserialize a new CallbackQuery from a given dictionary. :return: new CallbackQuery instance. :rtype: CallbackQuery """ 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 CallbackQuery from a given dictionary. :return: new CallbackQuery instance. :rtype: CallbackQuery """ 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", ".", ".", "receivabl...
Deserialize a new CallbackQuery from a given dictionary. :return: new CallbackQuery instance. :rtype: CallbackQuery
[ "Deserialize", "a", "new", "CallbackQuery", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L1163-L1186
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
ResponseParameters.to_array
def to_array(self): """ Serializes this ResponseParameters to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(ResponseParameters, self).to_array() if self.migrate_to_chat_id is not None: array['migrate_t...
python
def to_array(self): """ Serializes this ResponseParameters to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(ResponseParameters, self).to_array() if self.migrate_to_chat_id is not None: array['migrate_t...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "ResponseParameters", ",", "self", ")", ".", "to_array", "(", ")", "if", "self", ".", "migrate_to_chat_id", "is", "not", "None", ":", "array", "[", "'migrate_to_chat_id'", "]", "=", "i...
Serializes this ResponseParameters to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "ResponseParameters", "to", "a", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L1279-L1291
luckydonald/pytgbot
pytgbot/api_types/receivable/updates.py
ResponseParameters.from_array
def from_array(array): """ Deserialize a new ResponseParameters from a given dictionary. :return: new ResponseParameters instance. :rtype: ResponseParameters """ 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 ResponseParameters from a given dictionary. :return: new ResponseParameters instance. :rtype: ResponseParameters """ 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\"", ")", "data", "=", "{", "}", "da...
Deserialize a new ResponseParameters from a given dictionary. :return: new ResponseParameters instance. :rtype: ResponseParameters
[ "Deserialize", "a", "new", "ResponseParameters", "from", "a", "given", "dictionary", "." ]
train
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/receivable/updates.py#L1295-L1311
delph-in/pydelphin
delphin/mrs/xmrs.py
Rmrs
def Rmrs(top=None, index=None, xarg=None, eps=None, args=None, hcons=None, icons=None, lnk=None, surface=None, identifier=None, vars=None): """ Construct an :class:`Xmrs` from RMRS components. Robust Minimal Recursion Semantics (RMRS) are like MRS, but all predications have a nodeid (...
python
def Rmrs(top=None, index=None, xarg=None, eps=None, args=None, hcons=None, icons=None, lnk=None, surface=None, identifier=None, vars=None): """ Construct an :class:`Xmrs` from RMRS components. Robust Minimal Recursion Semantics (RMRS) are like MRS, but all predications have a nodeid (...
[ "def", "Rmrs", "(", "top", "=", "None", ",", "index", "=", "None", ",", "xarg", "=", "None", ",", "eps", "=", "None", ",", "args", "=", "None", ",", "hcons", "=", "None", ",", "icons", "=", "None", ",", "lnk", "=", "None", ",", "surface", "=", ...
Construct an :class:`Xmrs` from RMRS components. Robust Minimal Recursion Semantics (RMRS) are like MRS, but all predications have a nodeid ("anchor"), and arguments are not contained by the source predications, but instead reference the nodeid of their predication. Args: top: the TOP (or ...
[ "Construct", "an", ":", "class", ":", "Xmrs", "from", "RMRS", "components", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L853-L910
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.from_xmrs
def from_xmrs(cls, xmrs, **kwargs): """ Facilitate conversion among subclasses. Args: xmrs (:class:`Xmrs`): instance to convert from; possibly an instance of a subclass, such as :class:`Mrs` or :class:`Dmrs` **kwargs: additional keyword ar...
python
def from_xmrs(cls, xmrs, **kwargs): """ Facilitate conversion among subclasses. Args: xmrs (:class:`Xmrs`): instance to convert from; possibly an instance of a subclass, such as :class:`Mrs` or :class:`Dmrs` **kwargs: additional keyword ar...
[ "def", "from_xmrs", "(", "cls", ",", "xmrs", ",", "*", "*", "kwargs", ")", ":", "x", "=", "cls", "(", ")", "x", ".", "__dict__", ".", "update", "(", "xmrs", ".", "__dict__", ")", "return", "x" ]
Facilitate conversion among subclasses. Args: xmrs (:class:`Xmrs`): instance to convert from; possibly an instance of a subclass, such as :class:`Mrs` or :class:`Dmrs` **kwargs: additional keyword arguments that may be used by a subclass's...
[ "Facilitate", "conversion", "among", "subclasses", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L105-L118
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.add_eps
def add_eps(self, eps): """ Incorporate the list of EPs given by *eps*. """ # (nodeid, pred, label, args, lnk, surface, base) _nodeids, _eps, _vars = self._nodeids, self._eps, self._vars for ep in eps: try: if not isinstance(ep, ElementaryPredi...
python
def add_eps(self, eps): """ Incorporate the list of EPs given by *eps*. """ # (nodeid, pred, label, args, lnk, surface, base) _nodeids, _eps, _vars = self._nodeids, self._eps, self._vars for ep in eps: try: if not isinstance(ep, ElementaryPredi...
[ "def", "add_eps", "(", "self", ",", "eps", ")", ":", "# (nodeid, pred, label, args, lnk, surface, base)", "_nodeids", ",", "_eps", ",", "_vars", "=", "self", ".", "_nodeids", ",", "self", ".", "_eps", ",", "self", ".", "_vars", "for", "ep", "in", "eps", ":...
Incorporate the list of EPs given by *eps*.
[ "Incorporate", "the", "list", "of", "EPs", "given", "by", "*", "eps", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L120-L152
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.add_hcons
def add_hcons(self, hcons): """ Incorporate the list of HandleConstraints given by *hcons*. """ # (hi, relation, lo) _vars = self._vars _hcons = self._hcons for hc in hcons: try: if not isinstance(hc, HandleConstraint): ...
python
def add_hcons(self, hcons): """ Incorporate the list of HandleConstraints given by *hcons*. """ # (hi, relation, lo) _vars = self._vars _hcons = self._hcons for hc in hcons: try: if not isinstance(hc, HandleConstraint): ...
[ "def", "add_hcons", "(", "self", ",", "hcons", ")", ":", "# (hi, relation, lo)", "_vars", "=", "self", ".", "_vars", "_hcons", "=", "self", ".", "_hcons", "for", "hc", "in", "hcons", ":", "try", ":", "if", "not", "isinstance", "(", "hc", ",", "HandleCo...
Incorporate the list of HandleConstraints given by *hcons*.
[ "Incorporate", "the", "list", "of", "HandleConstraints", "given", "by", "*", "hcons", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L159-L185
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.add_icons
def add_icons(self, icons): """ Incorporate the individual constraints given by *icons*. """ _vars, _icons = self._vars, self._icons for ic in icons: try: if not isinstance(ic, IndividualConstraint): ic = IndividualConstraint(*ic) ...
python
def add_icons(self, icons): """ Incorporate the individual constraints given by *icons*. """ _vars, _icons = self._vars, self._icons for ic in icons: try: if not isinstance(ic, IndividualConstraint): ic = IndividualConstraint(*ic) ...
[ "def", "add_icons", "(", "self", ",", "icons", ")", ":", "_vars", ",", "_icons", "=", "self", ".", "_vars", ",", "self", ".", "_icons", "for", "ic", "in", "icons", ":", "try", ":", "if", "not", "isinstance", "(", "ic", ",", "IndividualConstraint", ")...
Incorporate the individual constraints given by *icons*.
[ "Incorporate", "the", "individual", "constraints", "given", "by", "*", "icons", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L187-L207
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.nodeid
def nodeid(self, iv, quantifier=False): """ Return the nodeid of the predication selected by *iv*. Args: iv: the intrinsic variable of the predication to select quantifier: if `True`, treat *iv* as a bound variable and find its quantifier; otherwise the n...
python
def nodeid(self, iv, quantifier=False): """ Return the nodeid of the predication selected by *iv*. Args: iv: the intrinsic variable of the predication to select quantifier: if `True`, treat *iv* as a bound variable and find its quantifier; otherwise the n...
[ "def", "nodeid", "(", "self", ",", "iv", ",", "quantifier", "=", "False", ")", ":", "return", "next", "(", "iter", "(", "self", ".", "nodeids", "(", "ivs", "=", "[", "iv", "]", ",", "quantifier", "=", "quantifier", ")", ")", ",", "None", ")" ]
Return the nodeid of the predication selected by *iv*. Args: iv: the intrinsic variable of the predication to select quantifier: if `True`, treat *iv* as a bound variable and find its quantifier; otherwise the non-quantifier will be returned
[ "Return", "the", "nodeid", "of", "the", "predication", "selected", "by", "*", "iv", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L255-L265
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.nodeids
def nodeids(self, ivs=None, quantifier=None): """ Return the list of nodeids given by *ivs*, or all nodeids. Args: ivs: the intrinsic variables of the predications to select; if `None`, return all nodeids (but see *quantifier*) quantifier: if `True`, only...
python
def nodeids(self, ivs=None, quantifier=None): """ Return the list of nodeids given by *ivs*, or all nodeids. Args: ivs: the intrinsic variables of the predications to select; if `None`, return all nodeids (but see *quantifier*) quantifier: if `True`, only...
[ "def", "nodeids", "(", "self", ",", "ivs", "=", "None", ",", "quantifier", "=", "None", ")", ":", "if", "ivs", "is", "None", ":", "nids", "=", "list", "(", "self", ".", "_nodeids", ")", "else", ":", "_vars", "=", "self", ".", "_vars", "nids", "="...
Return the list of nodeids given by *ivs*, or all nodeids. Args: ivs: the intrinsic variables of the predications to select; if `None`, return all nodeids (but see *quantifier*) quantifier: if `True`, only return nodeids of quantifiers; if `False`, only r...
[ "Return", "the", "list", "of", "nodeids", "given", "by", "*", "ivs", "*", "or", "all", "nodeids", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L267-L290
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.eps
def eps(self, nodeids=None): """ Return the EPs with the given *nodeid*, or all EPs. Args: nodeids: an iterable of nodeids of EPs to return; if `None`, return all EPs """ if nodeids is None: nodeids = self._nodeids _eps = self._eps ret...
python
def eps(self, nodeids=None): """ Return the EPs with the given *nodeid*, or all EPs. Args: nodeids: an iterable of nodeids of EPs to return; if `None`, return all EPs """ if nodeids is None: nodeids = self._nodeids _eps = self._eps ret...
[ "def", "eps", "(", "self", ",", "nodeids", "=", "None", ")", ":", "if", "nodeids", "is", "None", ":", "nodeids", "=", "self", ".", "_nodeids", "_eps", "=", "self", ".", "_eps", "return", "[", "_eps", "[", "nodeid", "]", "for", "nodeid", "in", "node...
Return the EPs with the given *nodeid*, or all EPs. Args: nodeids: an iterable of nodeids of EPs to return; if `None`, return all EPs
[ "Return", "the", "EPs", "with", "the", "given", "*", "nodeid", "*", "or", "all", "EPs", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L298-L308
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.icons
def icons(self, left=None): """ Return the ICONS with left variable *left*, or all ICONS. Args: left: the left variable of the ICONS to return; if `None`, return all ICONS """ if left is not None: return self._icons[left] else: ...
python
def icons(self, left=None): """ Return the ICONS with left variable *left*, or all ICONS. Args: left: the left variable of the ICONS to return; if `None`, return all ICONS """ if left is not None: return self._icons[left] else: ...
[ "def", "icons", "(", "self", ",", "left", "=", "None", ")", ":", "if", "left", "is", "not", "None", ":", "return", "self", ".", "_icons", "[", "left", "]", "else", ":", "return", "list", "(", "chain", ".", "from_iterable", "(", "self", ".", "_icons...
Return the ICONS with left variable *left*, or all ICONS. Args: left: the left variable of the ICONS to return; if `None`, return all ICONS
[ "Return", "the", "ICONS", "with", "left", "variable", "*", "left", "*", "or", "all", "ICONS", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L322-L333
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.properties
def properties(self, var_or_nodeid, as_list=False): """ Return a dictionary of variable properties for *var_or_nodeid*. Args: var_or_nodeid: if a variable, return the properties associated with the variable; if a nodeid, return the properties associat...
python
def properties(self, var_or_nodeid, as_list=False): """ Return a dictionary of variable properties for *var_or_nodeid*. Args: var_or_nodeid: if a variable, return the properties associated with the variable; if a nodeid, return the properties associat...
[ "def", "properties", "(", "self", ",", "var_or_nodeid", ",", "as_list", "=", "False", ")", ":", "props", "=", "[", "]", "if", "var_or_nodeid", "in", "self", ".", "_vars", ":", "props", "=", "self", ".", "_vars", "[", "var_or_nodeid", "]", "[", "'props'...
Return a dictionary of variable properties for *var_or_nodeid*. Args: var_or_nodeid: if a variable, return the properties associated with the variable; if a nodeid, return the properties associated with the intrinsic variable of the predication given ...
[ "Return", "a", "dictionary", "of", "variable", "properties", "for", "*", "var_or_nodeid", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L343-L363
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.preds
def preds(self, nodeids=None): """ Return the Pred objects for *nodeids*, or all Preds. Args: nodeids: an iterable of nodeids of predications to return Preds from; if `None`, return all Preds """ if nodeids is None: nodeids = self._nodeids _ep...
python
def preds(self, nodeids=None): """ Return the Pred objects for *nodeids*, or all Preds. Args: nodeids: an iterable of nodeids of predications to return Preds from; if `None`, return all Preds """ if nodeids is None: nodeids = self._nodeids _ep...
[ "def", "preds", "(", "self", ",", "nodeids", "=", "None", ")", ":", "if", "nodeids", "is", "None", ":", "nodeids", "=", "self", ".", "_nodeids", "_eps", "=", "self", ".", "_eps", "return", "[", "_eps", "[", "nid", "]", "[", "1", "]", "for", "nid"...
Return the Pred objects for *nodeids*, or all Preds. Args: nodeids: an iterable of nodeids of predications to return Preds from; if `None`, return all Preds
[ "Return", "the", "Pred", "objects", "for", "*", "nodeids", "*", "or", "all", "Preds", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L371-L381
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.labels
def labels(self, nodeids=None): """ Return the list of labels for *nodeids*, or all labels. Args: nodeids: an iterable of nodeids for predications to get labels from; if `None`, return labels for all predications Note: This returns...
python
def labels(self, nodeids=None): """ Return the list of labels for *nodeids*, or all labels. Args: nodeids: an iterable of nodeids for predications to get labels from; if `None`, return labels for all predications Note: This returns...
[ "def", "labels", "(", "self", ",", "nodeids", "=", "None", ")", ":", "if", "nodeids", "is", "None", ":", "nodeids", "=", "self", ".", "_nodeids", "_eps", "=", "self", ".", "_eps", "return", "[", "_eps", "[", "nid", "]", "[", "2", "]", "for", "nid...
Return the list of labels for *nodeids*, or all labels. Args: nodeids: an iterable of nodeids for predications to get labels from; if `None`, return labels for all predications Note: This returns the label of each predication, even if it's ...
[ "Return", "the", "list", "of", "labels", "for", "*", "nodeids", "*", "or", "all", "labels", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L389-L407
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.outgoing_args
def outgoing_args(self, nodeid): """ Return the arguments going from *nodeid* to other predications. Valid arguments include regular variable arguments and scopal (label-selecting or HCONS) arguments. MOD/EQ links, intrinsic arguments, and constant arguments are not incl...
python
def outgoing_args(self, nodeid): """ Return the arguments going from *nodeid* to other predications. Valid arguments include regular variable arguments and scopal (label-selecting or HCONS) arguments. MOD/EQ links, intrinsic arguments, and constant arguments are not incl...
[ "def", "outgoing_args", "(", "self", ",", "nodeid", ")", ":", "_vars", "=", "self", ".", "_vars", "_hcons", "=", "self", ".", "_hcons", "args", "=", "self", ".", "args", "(", "nodeid", ")", "# args is a copy; we can edit it", "for", "arg", ",", "val", "i...
Return the arguments going from *nodeid* to other predications. Valid arguments include regular variable arguments and scopal (label-selecting or HCONS) arguments. MOD/EQ links, intrinsic arguments, and constant arguments are not included. Args: nodeid: the nodeid o...
[ "Return", "the", "arguments", "going", "from", "*", "nodeid", "*", "to", "other", "predications", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L427-L453
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.incoming_args
def incoming_args(self, nodeid): """ Return the arguments that target *nodeid*. Valid arguments include regular variable arguments and scopal (label-selecting or HCONS) arguments. MOD/EQ links and intrinsic arguments are not included. Args: nodeid: the nodei...
python
def incoming_args(self, nodeid): """ Return the arguments that target *nodeid*. Valid arguments include regular variable arguments and scopal (label-selecting or HCONS) arguments. MOD/EQ links and intrinsic arguments are not included. Args: nodeid: the nodei...
[ "def", "incoming_args", "(", "self", ",", "nodeid", ")", ":", "_vars", "=", "self", ".", "_vars", "ep", "=", "self", ".", "_eps", "[", "nodeid", "]", "lbl", "=", "ep", "[", "2", "]", "iv", "=", "ep", "[", "3", "]", ".", "get", "(", "IVARG_ROLE"...
Return the arguments that target *nodeid*. Valid arguments include regular variable arguments and scopal (label-selecting or HCONS) arguments. MOD/EQ links and intrinsic arguments are not included. Args: nodeid: the nodeid of the EP that is the arguments' target Ret...
[ "Return", "the", "arguments", "that", "target", "*", "nodeid", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L455-L492
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.labelset_heads
def labelset_heads(self, label): """ Return the heads of the labelset selected by *label*. Args: label: the label from which to find head nodes/EPs. Returns: An iterable of nodeids. """ _eps = self._eps _vars = self._vars _hcons = ...
python
def labelset_heads(self, label): """ Return the heads of the labelset selected by *label*. Args: label: the label from which to find head nodes/EPs. Returns: An iterable of nodeids. """ _eps = self._eps _vars = self._vars _hcons = ...
[ "def", "labelset_heads", "(", "self", ",", "label", ")", ":", "_eps", "=", "self", ".", "_eps", "_vars", "=", "self", ".", "_vars", "_hcons", "=", "self", ".", "_hcons", "nodeids", "=", "{", "nodeid", ":", "_eps", "[", "nodeid", "]", "[", "3", "]",...
Return the heads of the labelset selected by *label*. Args: label: the label from which to find head nodes/EPs. Returns: An iterable of nodeids.
[ "Return", "the", "heads", "of", "the", "labelset", "selected", "by", "*", "label", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L505-L549
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.subgraph
def subgraph(self, nodeids): """ Return an Xmrs object with only the specified *nodeids*. Necessary variables and arguments are also included in order to connect any nodes that are connected in the original Xmrs. Args: nodeids: the nodeids of the nodes/EPs to includ...
python
def subgraph(self, nodeids): """ Return an Xmrs object with only the specified *nodeids*. Necessary variables and arguments are also included in order to connect any nodes that are connected in the original Xmrs. Args: nodeids: the nodeids of the nodes/EPs to includ...
[ "def", "subgraph", "(", "self", ",", "nodeids", ")", ":", "_eps", ",", "_vars", "=", "self", ".", "_eps", ",", "self", ".", "_vars", "_hcons", ",", "_icons", "=", "self", ".", "_hcons", ",", "self", ".", "_icons", "top", "=", "index", "=", "xarg", ...
Return an Xmrs object with only the specified *nodeids*. Necessary variables and arguments are also included in order to connect any nodes that are connected in the original Xmrs. Args: nodeids: the nodeids of the nodes/EPs to include in the subgraph. Return...
[ "Return", "an", "Xmrs", "object", "with", "only", "the", "specified", "*", "nodeids", "*", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L551-L604
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.is_connected
def is_connected(self): """ Return `True` if the Xmrs represents a connected graph. Subgraphs can be connected through things like arguments, QEQs, and label equalities. """ nids = set(self._nodeids) # the nids left to find if len(nids) == 0: raise X...
python
def is_connected(self): """ Return `True` if the Xmrs represents a connected graph. Subgraphs can be connected through things like arguments, QEQs, and label equalities. """ nids = set(self._nodeids) # the nids left to find if len(nids) == 0: raise X...
[ "def", "is_connected", "(", "self", ")", ":", "nids", "=", "set", "(", "self", ".", "_nodeids", ")", "# the nids left to find", "if", "len", "(", "nids", ")", "==", "0", ":", "raise", "XmrsError", "(", "'Cannot compute connectedness of an empty Xmrs.'", ")", "...
Return `True` if the Xmrs represents a connected graph. Subgraphs can be connected through things like arguments, QEQs, and label equalities.
[ "Return", "True", "if", "the", "Xmrs", "represents", "a", "connected", "graph", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L606-L650
delph-in/pydelphin
delphin/mrs/xmrs.py
Xmrs.validate
def validate(self): """ Check that the Xmrs is well-formed. The Xmrs is analyzed and a list of problems is compiled. If any problems exist, an :exc:`XmrsError` is raised with the list joined as the error message. A well-formed Xmrs has the following properties: ...
python
def validate(self): """ Check that the Xmrs is well-formed. The Xmrs is analyzed and a list of problems is compiled. If any problems exist, an :exc:`XmrsError` is raised with the list joined as the error message. A well-formed Xmrs has the following properties: ...
[ "def", "validate", "(", "self", ")", ":", "errors", "=", "[", "]", "ivs", ",", "bvs", "=", "{", "}", ",", "{", "}", "_vars", "=", "self", ".", "_vars", "_hcons", "=", "self", ".", "_hcons", "labels", "=", "defaultdict", "(", "set", ")", "# ep_arg...
Check that the Xmrs is well-formed. The Xmrs is analyzed and a list of problems is compiled. If any problems exist, an :exc:`XmrsError` is raised with the list joined as the error message. A well-formed Xmrs has the following properties: * All predications have an intrinsic var...
[ "Check", "that", "the", "Xmrs", "is", "well", "-", "formed", "." ]
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/xmrs.py#L664-L719