partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
JsonValidator.string_to_json
Deserialize string into JSON structure. *Args:*\n _source_ - JSON string *Returns:*\n JSON structure *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSystem | ...
src/JsonValidator.py
def string_to_json(self, source): """ Deserialize string into JSON structure. *Args:*\n _source_ - JSON string *Returns:*\n JSON structure *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonV...
def string_to_json(self, source): """ Deserialize string into JSON structure. *Args:*\n _source_ - JSON string *Returns:*\n JSON structure *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonV...
[ "Deserialize", "string", "into", "JSON", "structure", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L152-L180
[ "def", "string_to_json", "(", "self", ",", "source", ")", ":", "try", ":", "load_input_json", "=", "json", ".", "loads", "(", "source", ")", "except", "ValueError", "as", "e", ":", "raise", "JsonValidatorError", "(", "\"Could not parse '%s' as JSON: %s\"", "%", ...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.json_to_string
Serialize JSON structure into string. *Args:*\n _source_ - JSON structure *Returns:*\n JSON string *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSystem | ...
src/JsonValidator.py
def json_to_string(self, source): """ Serialize JSON structure into string. *Args:*\n _source_ - JSON structure *Returns:*\n JSON string *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonVal...
def json_to_string(self, source): """ Serialize JSON structure into string. *Args:*\n _source_ - JSON structure *Returns:*\n JSON string *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonVal...
[ "Serialize", "JSON", "structure", "into", "string", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L182-L210
[ "def", "json_to_string", "(", "self", ",", "source", ")", ":", "try", ":", "load_input_json", "=", "json", ".", "dumps", "(", "source", ")", "except", "ValueError", "as", "e", ":", "raise", "JsonValidatorError", "(", "\"Could serialize '%s' to JSON: %s\"", "%", ...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.get_elements
Get list of elements from _json_string_, matching [http://goessner.net/articles/JsonPath/|JSONPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression; *Returns:*\n List of found elements or ``None`` if no elements were found *Example:*\n...
src/JsonValidator.py
def get_elements(self, json_string, expr): """ Get list of elements from _json_string_, matching [http://goessner.net/articles/JsonPath/|JSONPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression; *Returns:*\n List of found eleme...
def get_elements(self, json_string, expr): """ Get list of elements from _json_string_, matching [http://goessner.net/articles/JsonPath/|JSONPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression; *Returns:*\n List of found eleme...
[ "Get", "list", "of", "elements", "from", "_json_string_", "matching", "[", "http", ":", "//", "goessner", ".", "net", "/", "articles", "/", "JsonPath", "/", "|JSONPath", "]", "expression", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L212-L243
[ "def", "get_elements", "(", "self", ",", "json_string", ",", "expr", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "# parsing jsonpath", "jsonpath_expr", "=", "parse", "(", "expr", ")", "# list of returned elements", "va...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.select_elements
Return list of elements from _json_string_, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _ex...
src/JsonValidator.py
def select_elements(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. ...
def select_elements(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. ...
[ "Return", "list", "of", "elements", "from", "_json_string_", "matching", "[", "http", ":", "//", "jsonselect", ".", "org", "/", "|", "JSONSelect", "]", "expression", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L245-L273
[ "def", "select_elements", "(", "self", ",", "json_string", ",", "expr", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "# parsing jsonselect", "match", "=", "jsonselect", ".", "match", "(", "sel", "=", "expr", ",", ...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.select_objects
Return list of elements from _json_string_, matching [ http://objectpath.org// | ObjectPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - ObjectPath expression; *Returns:*\n List of found elements. If no elements were found, empty list will be returned ...
src/JsonValidator.py
def select_objects(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://objectpath.org// | ObjectPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - ObjectPath expression; *Returns:*\n List of found elements...
def select_objects(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://objectpath.org// | ObjectPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - ObjectPath expression; *Returns:*\n List of found elements...
[ "Return", "list", "of", "elements", "from", "_json_string_", "matching", "[", "http", ":", "//", "objectpath", ".", "org", "//", "|", "ObjectPath", "]", "expression", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L275-L300
[ "def", "select_objects", "(", "self", ",", "json_string", ",", "expr", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "# parsing objectpath", "tree", "=", "objectpath", ".", "Tree", "(", "load_input_json", ")", "values"...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.element_should_exist
Check the existence of one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _e...
src/JsonValidator.py
def element_should_exist(self, json_string, expr): """ Check the existence of one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSO...
def element_should_exist(self, json_string, expr): """ Check the existence of one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSO...
[ "Check", "the", "existence", "of", "one", "or", "more", "elements", "matching", "[", "http", ":", "//", "jsonselect", ".", "org", "/", "|", "JSONSelect", "]", "expression", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L302-L327
[ "def", "element_should_exist", "(", "self", ",", "json_string", ",", "expr", ")", ":", "value", "=", "self", ".", "select_elements", "(", "json_string", ",", "expr", ")", "if", "value", "is", "None", ":", "raise", "JsonValidatorError", "(", "'Elements %s does ...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.element_should_not_exist
Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _...
src/JsonValidator.py
def element_should_not_exist(self, json_string, expr): """ Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to quer...
def element_should_not_exist(self, json_string, expr): """ Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to quer...
[ "Check", "that", "one", "or", "more", "elements", "matching", "[", "http", ":", "//", "jsonselect", ".", "org", "/", "|", "JSONSelect", "]", "expression", "don", "t", "exist", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L329-L345
[ "def", "element_should_not_exist", "(", "self", ",", "json_string", ",", "expr", ")", ":", "value", "=", "self", ".", "select_elements", "(", "json_string", ",", "expr", ")", "if", "value", "is", "not", "None", ":", "raise", "JsonValidatorError", "(", "'Elem...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator._json_path_search
Scan JSON dictionary with using json-path passed sting of the format of $.element..element1[index] etc. *Args:*\n _json_dict_ - JSON dictionary;\n _expr_ - string of fuzzy search for items within the directory;\n *Returns:*\n List of DatumInContext objects: ``[DatumInCo...
src/JsonValidator.py
def _json_path_search(self, json_dict, expr): """ Scan JSON dictionary with using json-path passed sting of the format of $.element..element1[index] etc. *Args:*\n _json_dict_ - JSON dictionary;\n _expr_ - string of fuzzy search for items within the directory;\n *Return...
def _json_path_search(self, json_dict, expr): """ Scan JSON dictionary with using json-path passed sting of the format of $.element..element1[index] etc. *Args:*\n _json_dict_ - JSON dictionary;\n _expr_ - string of fuzzy search for items within the directory;\n *Return...
[ "Scan", "JSON", "dictionary", "with", "using", "json", "-", "path", "passed", "sting", "of", "the", "format", "of", "$", ".", "element", "..", "element1", "[", "index", "]", "etc", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L347-L371
[ "def", "_json_path_search", "(", "self", ",", "json_dict", ",", "expr", ")", ":", "path", "=", "parse", "(", "expr", ")", "results", "=", "path", ".", "find", "(", "json_dict", ")", "if", "len", "(", "results", ")", "is", "0", ":", "raise", "JsonVali...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.update_json
Replace the value in the JSON string. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression for determining the value to be replaced;\n _value_ - the value to be replaced with;\n _index_ - index for selecting item within a match list, default value is 0;\n ...
src/JsonValidator.py
def update_json(self, json_string, expr, value, index=0): """ Replace the value in the JSON string. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression for determining the value to be replaced;\n _value_ - the value to be replaced with;\n _index...
def update_json(self, json_string, expr, value, index=0): """ Replace the value in the JSON string. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression for determining the value to be replaced;\n _value_ - the value to be replaced with;\n _index...
[ "Replace", "the", "value", "in", "the", "JSON", "string", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L373-L412
[ "def", "update_json", "(", "self", ",", "json_string", ",", "expr", ",", "value", ",", "index", "=", "0", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "matches", "=", "self", ".", "_json_path_search", "(", "load...
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
JsonValidator.pretty_print_json
Return formatted JSON string _json_string_.\n Using method json.dumps with settings: _indent=2, ensure_ascii=False_. *Args:*\n _json_string_ - JSON string. *Returns:*\n Formatted JSON string. *Example:*\n | *Settings* | *Value* | | Library | JsonVali...
src/JsonValidator.py
def pretty_print_json(self, json_string): """ Return formatted JSON string _json_string_.\n Using method json.dumps with settings: _indent=2, ensure_ascii=False_. *Args:*\n _json_string_ - JSON string. *Returns:*\n Formatted JSON string. *Example:*\n ...
def pretty_print_json(self, json_string): """ Return formatted JSON string _json_string_.\n Using method json.dumps with settings: _indent=2, ensure_ascii=False_. *Args:*\n _json_string_ - JSON string. *Returns:*\n Formatted JSON string. *Example:*\n ...
[ "Return", "formatted", "JSON", "string", "_json_string_", ".", "\\", "n", "Using", "method", "json", ".", "dumps", "with", "settings", ":", "_indent", "=", "2", "ensure_ascii", "=", "False_", "." ]
peterservice-rnd/robotframework-jsonvalidator
python
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L414-L447
[ "def", "pretty_print_json", "(", "self", ",", "json_string", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "string_to_json", "(", "json_string", ")", ",", "indent", "=", "2", ",", "ensure_ascii", "=", "False", ")" ]
acde5045c04d0a7b9079f22707c3e71a5d3fa724
train
HistogramLogWriter.output_interval_histogram
Output an interval histogram, with the given timestamp and a configurable maxValueUnitRatio. (note that the specified timestamp will be used, and the timestamp in the actual histogram will be ignored). The max value reported with the interval line will be scaled by the given max_...
hdrh/log.py
def output_interval_histogram(self, histogram, start_time_stamp_sec=0, end_time_stamp_sec=0, max_value_unit_ratio=1000000.0): '''Output an interval histogram, with the given ti...
def output_interval_histogram(self, histogram, start_time_stamp_sec=0, end_time_stamp_sec=0, max_value_unit_ratio=1000000.0): '''Output an interval histogram, with the given ti...
[ "Output", "an", "interval", "histogram", "with", "the", "given", "timestamp", "and", "a", "configurable", "maxValueUnitRatio", ".", "(", "note", "that", "the", "specified", "timestamp", "will", "be", "used", "and", "the", "timestamp", "in", "the", "actual", "h...
HdrHistogram/HdrHistogram_py
python
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L51-L92
[ "def", "output_interval_histogram", "(", "self", ",", "histogram", ",", "start_time_stamp_sec", "=", "0", ",", "end_time_stamp_sec", "=", "0", ",", "max_value_unit_ratio", "=", "1000000.0", ")", ":", "if", "not", "start_time_stamp_sec", ":", "start_time_stamp_sec", ...
cb99981b0564a62e1aa02bd764efa6445923f8f7
train
HistogramLogWriter.output_start_time
Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start time (the epoch)
hdrh/log.py
def output_start_time(self, start_time_msec): '''Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start time (the epoch) ''' self.log.write("#[StartTime: %f (seconds since epoch), %s]\n" % (float(start_time_...
def output_start_time(self, start_time_msec): '''Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start time (the epoch) ''' self.log.write("#[StartTime: %f (seconds since epoch), %s]\n" % (float(start_time_...
[ "Log", "a", "start", "time", "in", "the", "log", ".", "Params", ":", "start_time_msec", "time", "(", "in", "milliseconds", ")", "since", "the", "absolute", "start", "time", "(", "the", "epoch", ")" ]
HdrHistogram/HdrHistogram_py
python
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L94-L101
[ "def", "output_start_time", "(", "self", ",", "start_time_msec", ")", ":", "self", ".", "log", ".", "write", "(", "\"#[StartTime: %f (seconds since epoch), %s]\\n\"", "%", "(", "float", "(", "start_time_msec", ")", "/", "1000.0", ",", "datetime", ".", "fromtimesta...
cb99981b0564a62e1aa02bd764efa6445923f8f7
train
HistogramLogReader._decode_next_interval_histogram
Read the next interval histogram from the log, if interval falls within an absolute or relative time range. Timestamps are assumed to appear in order in the log file, and as such this method will return a null upon encountering a timestamp larger than range_end_time_sec. Relati...
hdrh/log.py
def _decode_next_interval_histogram(self, dest_histogram, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next in...
def _decode_next_interval_histogram(self, dest_histogram, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next in...
[ "Read", "the", "next", "interval", "histogram", "from", "the", "log", "if", "interval", "falls", "within", "an", "absolute", "or", "relative", "time", "range", "." ]
HdrHistogram/HdrHistogram_py
python
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L173-L289
[ "def", "_decode_next_interval_histogram", "(", "self", ",", "dest_histogram", ",", "range_start_time_sec", "=", "0.0", ",", "range_end_time_sec", "=", "sys", ".", "maxsize", ",", "absolute", "=", "False", ")", ":", "while", "1", ":", "line", "=", "self", ".", ...
cb99981b0564a62e1aa02bd764efa6445923f8f7
train
HistogramLogReader.get_next_interval_histogram
Read the next interval histogram from the log, if interval falls within an absolute or relative time range. Timestamps are assumed to appear in order in the log file, and as such this method will return a null upon encountering a timestamp larger than range_end_time_sec. Relati...
hdrh/log.py
def get_next_interval_histogram(self, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogram from the log, if interval falls within an absol...
def get_next_interval_histogram(self, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogram from the log, if interval falls within an absol...
[ "Read", "the", "next", "interval", "histogram", "from", "the", "log", "if", "interval", "falls", "within", "an", "absolute", "or", "relative", "time", "range", "." ]
HdrHistogram/HdrHistogram_py
python
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L291-L337
[ "def", "get_next_interval_histogram", "(", "self", ",", "range_start_time_sec", "=", "0.0", ",", "range_end_time_sec", "=", "sys", ".", "maxsize", ",", "absolute", "=", "False", ")", ":", "return", "self", ".", "_decode_next_interval_histogram", "(", "None", ",", ...
cb99981b0564a62e1aa02bd764efa6445923f8f7
train
HistogramLogReader.add_next_interval_histogram
Read the next interval histogram from the log, if interval falls within an absolute or relative time range, and add it to the destination histogram (or to the reference histogram if dest_histogram is None) Timestamps are assumed to appear in order in the log file, and as such this metho...
hdrh/log.py
def add_next_interval_histogram(self, dest_histogram=None, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogra...
def add_next_interval_histogram(self, dest_histogram=None, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogra...
[ "Read", "the", "next", "interval", "histogram", "from", "the", "log", "if", "interval", "falls", "within", "an", "absolute", "or", "relative", "time", "range", "and", "add", "it", "to", "the", "destination", "histogram", "(", "or", "to", "the", "reference", ...
HdrHistogram/HdrHistogram_py
python
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L339-L391
[ "def", "add_next_interval_histogram", "(", "self", ",", "dest_histogram", "=", "None", ",", "range_start_time_sec", "=", "0.0", ",", "range_end_time_sec", "=", "sys", ".", "maxsize", ",", "absolute", "=", "False", ")", ":", "if", "not", "dest_histogram", ":", ...
cb99981b0564a62e1aa02bd764efa6445923f8f7
train
sanitize
Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|escape_html }}
sanitizer/templatetags/sanitizer.py
def sanitize(value): ''' Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|escape_html }} ''' if isinstance(value, basestring): value =...
def sanitize(value): ''' Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|escape_html }} ''' if isinstance(value, basestring): value =...
[ "Sanitizes", "strings", "according", "to", "SANITIZER_ALLOWED_TAGS", "SANITIZER_ALLOWED_ATTRIBUTES", "and", "SANITIZER_ALLOWED_STYLES", "variables", "in", "settings", "." ]
ui/django-html_sanitizer
python
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L20-L36
[ "def", "sanitize", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", ".", "clean", "(", "value", ",", "tags", "=", "ALLOWED_TAGS", ",", "attributes", "=", "ALLOWED_ATTRIBUTES", ",", "styles", "...
63311131630471ef2315f1ddbbd18354159d24c1
train
strip_filter
Strips HTML tags from strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|strip_html }}
sanitizer/templatetags/sanitizer.py
def strip_filter(value): ''' Strips HTML tags from strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|strip_html }} ''' if isinstance(value, basestring): ...
def strip_filter(value): ''' Strips HTML tags from strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|strip_html }} ''' if isinstance(value, basestring): ...
[ "Strips", "HTML", "tags", "from", "strings", "according", "to", "SANITIZER_ALLOWED_TAGS", "SANITIZER_ALLOWED_ATTRIBUTES", "and", "SANITIZER_ALLOWED_STYLES", "variables", "in", "settings", "." ]
ui/django-html_sanitizer
python
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L42-L58
[ "def", "strip_filter", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", ".", "clean", "(", "value", ",", "tags", "=", "ALLOWED_TAGS", ",", "attributes", "=", "ALLOWED_ATTRIBUTES", ",", "styles",...
63311131630471ef2315f1ddbbd18354159d24c1
train
sanitize_allow
Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {{ post.body|sanitize_allow:'a, strong, img; href, src'}}
sanitizer/templatetags/sanitizer.py
def sanitize_allow(value, args=''): ''' Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {{ post.body|sanitize_allow:'a, strong, img; href, src'}} ''' if isinstance(value, basestring): allowed_tags = [] allowed_attributes = [] ...
def sanitize_allow(value, args=''): ''' Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {{ post.body|sanitize_allow:'a, strong, img; href, src'}} ''' if isinstance(value, basestring): allowed_tags = [] allowed_attributes = [] ...
[ "Strip", "HTML", "tags", "other", "than", "provided", "tags", "and", "attributes", ".", "Example", "usage", ":" ]
ui/django-html_sanitizer
python
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L64-L85
[ "def", "sanitize_allow", "(", "value", ",", "args", "=", "''", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "allowed_tags", "=", "[", "]", "allowed_attributes", "=", "[", "]", "allowed_styles", "=", "[", "]", "args", "=", "a...
63311131630471ef2315f1ddbbd18354159d24c1
train
escape_html
Template tag to sanitize string values. It accepts lists of allowed tags, attributes or styles in comma separated string or list format. For example: {% load sanitizer %} {% escape_html '<a href="">bar</a> <script>alert('baz')</script>' "a,img' 'href',src' %} Will output: <a href="">bar</a> ...
sanitizer/templatetags/sanitizer.py
def escape_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to sanitize string values. It accepts lists of allowed tags, attributes or styles in comma separated string or list format. For example: {% load sanitizer %} {% escape_html '<a h...
def escape_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to sanitize string values. It accepts lists of allowed tags, attributes or styles in comma separated string or list format. For example: {% load sanitizer %} {% escape_html '<a h...
[ "Template", "tag", "to", "sanitize", "string", "values", ".", "It", "accepts", "lists", "of", "allowed", "tags", "attributes", "or", "styles", "in", "comma", "separated", "string", "or", "list", "format", "." ]
ui/django-html_sanitizer
python
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L91-L115
[ "def", "escape_html", "(", "value", ",", "allowed_tags", "=", "[", "]", ",", "allowed_attributes", "=", "[", "]", ",", "allowed_styles", "=", "[", "]", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", "."...
63311131630471ef2315f1ddbbd18354159d24c1
train
strip_html
Template tag to strip html from string values. It accepts lists of allowed tags, attributes or stylesin comma separated string or list format. For example: {% load sanitizer %} {% strip_html '<a href="">bar</a> <script>alert('baz')</script>' "a,img' 'href',src' %} Will output: <a href="">bar...
sanitizer/templatetags/sanitizer.py
def strip_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to strip html from string values. It accepts lists of allowed tags, attributes or stylesin comma separated string or list format. For example: {% load sanitizer %} {% strip_html '<...
def strip_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to strip html from string values. It accepts lists of allowed tags, attributes or stylesin comma separated string or list format. For example: {% load sanitizer %} {% strip_html '<...
[ "Template", "tag", "to", "strip", "html", "from", "string", "values", ".", "It", "accepts", "lists", "of", "allowed", "tags", "attributes", "or", "stylesin", "comma", "separated", "string", "or", "list", "format", "." ]
ui/django-html_sanitizer
python
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L119-L143
[ "def", "strip_html", "(", "value", ",", "allowed_tags", "=", "[", "]", ",", "allowed_attributes", "=", "[", "]", ",", "allowed_styles", "=", "[", "]", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", ".",...
63311131630471ef2315f1ddbbd18354159d24c1
train
get_censor_char
Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is done to ensure all censor chars are used before grabbing more (avoids ugly duplicates).
profanity/profanity.py
def get_censor_char(): """Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is done to ensure all censor chars are used before grabbing more (avoids ugly duplicates). """ global _censor_pool if not _censor_pool: # censor pool is empty. fill it bac...
def get_censor_char(): """Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is done to ensure all censor chars are used before grabbing more (avoids ugly duplicates). """ global _censor_pool if not _censor_pool: # censor pool is empty. fill it bac...
[ "Plucks", "a", "letter", "out", "of", "the", "censor_pool", ".", "If", "the", "censor_pool", "is", "empty", "replenishes", "it", ".", "This", "is", "done", "to", "ensure", "all", "censor", "chars", "are", "used", "before", "grabbing", "more", "(", "avoids"...
ben174/profanity
python
https://github.com/ben174/profanity/blob/98e76d189f4b31848dcc129845bb359b47516c98/profanity/profanity.py#L27-L37
[ "def", "get_censor_char", "(", ")", ":", "global", "_censor_pool", "if", "not", "_censor_pool", ":", "# censor pool is empty. fill it back up.", "_censor_pool", "=", "list", "(", "_censor_chars", ")", "return", "_censor_pool", ".", "pop", "(", "random", ".", "randra...
98e76d189f4b31848dcc129845bb359b47516c98
train
censor
Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool.
profanity/profanity.py
def censor(input_text): """ Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool. """ ret = input_text words = get_words() for word in words: curse_word = re.compile(re.escape(word), re.IGNORECASE) cen = "".j...
def censor(input_text): """ Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool. """ ret = input_text words = get_words() for word in words: curse_word = re.compile(re.escape(word), re.IGNORECASE) cen = "".j...
[ "Returns", "the", "input", "string", "with", "profanity", "replaced", "with", "a", "random", "string", "of", "characters", "plucked", "from", "the", "censor_characters", "pool", "." ]
ben174/profanity
python
https://github.com/ben174/profanity/blob/98e76d189f4b31848dcc129845bb359b47516c98/profanity/profanity.py#L57-L68
[ "def", "censor", "(", "input_text", ")", ":", "ret", "=", "input_text", "words", "=", "get_words", "(", ")", "for", "word", "in", "words", ":", "curse_word", "=", "re", ".", "compile", "(", "re", ".", "escape", "(", "word", ")", ",", "re", ".", "IG...
98e76d189f4b31848dcc129845bb359b47516c98
train
load_words
Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line.
profanity/profanity.py
def load_words(wordlist=None): """ Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line. """ global words if not wordlist: # no wordlist was provided, load the wordlist from the local store filename = get_dat...
def load_words(wordlist=None): """ Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line. """ global words if not wordlist: # no wordlist was provided, load the wordlist from the local store filename = get_dat...
[ "Loads", "and", "caches", "the", "profanity", "word", "list", ".", "Input", "file", "(", "if", "provided", ")", "should", "be", "a", "flat", "text", "file", "with", "one", "profanity", "entry", "per", "line", "." ]
ben174/profanity
python
https://github.com/ben174/profanity/blob/98e76d189f4b31848dcc129845bb359b47516c98/profanity/profanity.py#L71-L83
[ "def", "load_words", "(", "wordlist", "=", "None", ")", ":", "global", "words", "if", "not", "wordlist", ":", "# no wordlist was provided, load the wordlist from the local store", "filename", "=", "get_data", "(", "'wordlist.txt'", ")", "f", "=", "open", "(", "filen...
98e76d189f4b31848dcc129845bb359b47516c98
train
convert
Convert csv to json. csv: filename or file-like object json: filename or file-like object if csv is '-' or None: stdin is used for input if json is '-' or None: stdout is used for output
csv2json/__init__.py
def convert(csv, json, **kwargs): '''Convert csv to json. csv: filename or file-like object json: filename or file-like object if csv is '-' or None: stdin is used for input if json is '-' or None: stdout is used for output ''' csv_local, json_local = None, None try...
def convert(csv, json, **kwargs): '''Convert csv to json. csv: filename or file-like object json: filename or file-like object if csv is '-' or None: stdin is used for input if json is '-' or None: stdout is used for output ''' csv_local, json_local = None, None try...
[ "Convert", "csv", "to", "json", "." ]
oplatek/csv2json
python
https://github.com/oplatek/csv2json/blob/f2f95db71ba2ce683fd6d0d3e2f13c9d0a77ceb6/csv2json/__init__.py#L20-L51
[ "def", "convert", "(", "csv", ",", "json", ",", "*", "*", "kwargs", ")", ":", "csv_local", ",", "json_local", "=", "None", ",", "None", "try", ":", "if", "csv", "==", "'-'", "or", "csv", "is", "None", ":", "csv", "=", "sys", ".", "stdin", "elif",...
f2f95db71ba2ce683fd6d0d3e2f13c9d0a77ceb6
train
WordCharEmbd.update_dicts
Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence.
keras_wc_embd/wrapper.py
def update_dicts(self, sentence): """Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence. """ self.dict_generator(sentence=sentence) self.word_dict, self.char_dict = None, None
def update_dicts(self, sentence): """Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence. """ self.dict_generator(sentence=sentence) self.word_dict, self.char_dict = None, None
[ "Add", "new", "sentence", "to", "generate", "dictionaries", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L30-L36
[ "def", "update_dicts", "(", "self", ",", "sentence", ")", ":", "self", ".", "dict_generator", "(", "sentence", "=", "sentence", ")", "self", ".", "word_dict", ",", "self", ".", "char_dict", "=", "None", ",", "None" ]
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
WordCharEmbd.set_dicts
Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary.
keras_wc_embd/wrapper.py
def set_dicts(self, word_dict, char_dict): """Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary. """ self.word_dict = word_dict self.char_dict = char_dict
def set_dicts(self, word_dict, char_dict): """Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary. """ self.word_dict = word_dict self.char_dict = char_dict
[ "Set", "with", "custom", "dictionaries", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L38-L45
[ "def", "set_dicts", "(", "self", ",", "word_dict", ",", "char_dict", ")", ":", "self", ".", "word_dict", "=", "word_dict", "self", ".", "char_dict", "=", "char_dict" ]
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
WordCharEmbd.get_dicts
Get word and character dictionaries. :return word_dict, char_dict:
keras_wc_embd/wrapper.py
def get_dicts(self): """Get word and character dictionaries. :return word_dict, char_dict: """ if self.word_dict is None: self.word_dict, self.char_dict, self.max_word_len = self.dict_generator(return_dict=True) return self.word_dict, self.char_dict
def get_dicts(self): """Get word and character dictionaries. :return word_dict, char_dict: """ if self.word_dict is None: self.word_dict, self.char_dict, self.max_word_len = self.dict_generator(return_dict=True) return self.word_dict, self.char_dict
[ "Get", "word", "and", "character", "dictionaries", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L47-L54
[ "def", "get_dicts", "(", "self", ")", ":", "if", "self", ".", "word_dict", "is", "None", ":", "self", ".", "word_dict", ",", "self", ".", "char_dict", ",", "self", ".", "max_word_len", "=", "self", ".", "dict_generator", "(", "return_dict", "=", "True", ...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
WordCharEmbd.get_embedding_layer
Get the merged embedding layer. :param word_embd_dim: The dimensions of the word embedding. :param char_embd_dim: The dimensions of the character embedding :param char_hidden_dim: The dimensions of the hidden states of RNN in one direction. :param word_embd_weights: A numpy array repres...
keras_wc_embd/wrapper.py
def get_embedding_layer(self, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', word_embd_weights=None, word_embd...
def get_embedding_layer(self, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', word_embd_weights=None, word_embd...
[ "Get", "the", "merged", "embedding", "layer", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L72-L122
[ "def", "get_embedding_layer", "(", "self", ",", "word_embd_dim", "=", "300", ",", "char_embd_dim", "=", "30", ",", "char_hidden_dim", "=", "150", ",", "char_hidden_layer_type", "=", "'lstm'", ",", "word_embd_weights", "=", "None", ",", "word_embd_file_path", "=", ...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
WordCharEmbd.get_batch_input
Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :return word_embd_input, char_embd_input: The desired inputs.
keras_wc_embd/wrapper.py
def get_batch_input(self, sentences): """Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :return word_embd_input, char_embd_input: The desired inputs. """ return get_batch_input(sentences, ...
def get_batch_input(self, sentences): """Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :return word_embd_input, char_embd_input: The desired inputs. """ return get_batch_input(sentences, ...
[ "Convert", "sentences", "to", "desired", "input", "tensors", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L124-L136
[ "def", "get_batch_input", "(", "self", ",", "sentences", ")", ":", "return", "get_batch_input", "(", "sentences", ",", "max_word_len", "=", "self", ".", "max_word_len", ",", "word_dict", "=", "self", ".", "get_word_dict", "(", ")", ",", "char_dict", "=", "se...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
get_batch_input
Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :param max_word_len: The maximum allowed length of word. :param word_dict: Map a word to an integer. (0 and 1 should be preserved) :param char_dict: Map a character to an integer. (0 and 1 sh...
keras_wc_embd/word_char_embd.py
def get_batch_input(sentences, max_word_len, word_dict, char_dict, word_unknown=1, char_unknown=1, word_ignore_case=False, char_ignore_case=False): """Convert sentences to desi...
def get_batch_input(sentences, max_word_len, word_dict, char_dict, word_unknown=1, char_unknown=1, word_ignore_case=False, char_ignore_case=False): """Convert sentences to desi...
[ "Convert", "sentences", "to", "desired", "input", "tensors", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L39-L81
[ "def", "get_batch_input", "(", "sentences", ",", "max_word_len", ",", "word_dict", ",", "char_dict", ",", "word_unknown", "=", "1", ",", "char_unknown", "=", "1", ",", "word_ignore_case", "=", "False", ",", "char_ignore_case", "=", "False", ")", ":", "sentence...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
get_embedding_layer
Get the merged embedding layer. :param word_dict_len: The number of words in the dictionary including the ones mapped to 0 or 1. :param char_dict_len: The number of characters in the dictionary including the ones mapped to 0 or 1. :param max_word_len: The maximum allowed length of word. :param word_emb...
keras_wc_embd/word_char_embd.py
def get_embedding_layer(word_dict_len, char_dict_len, max_word_len, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', ...
def get_embedding_layer(word_dict_len, char_dict_len, max_word_len, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', ...
[ "Get", "the", "merged", "embedding", "layer", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L84-L198
[ "def", "get_embedding_layer", "(", "word_dict_len", ",", "char_dict_len", ",", "max_word_len", ",", "word_embd_dim", "=", "300", ",", "char_embd_dim", "=", "30", ",", "char_hidden_dim", "=", "150", ",", "char_hidden_layer_type", "=", "'lstm'", ",", "word_embd_weight...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
get_dicts_generator
Get word and character dictionaries from sentences. :param word_min_freq: The minimum frequency of a word. :param char_min_freq: The minimum frequency of a character. :param word_ignore_case: Word will be transformed to lower case before saving to dictionary. :param char_ignore_case: Character will be ...
keras_wc_embd/word_char_embd.py
def get_dicts_generator(word_min_freq=4, char_min_freq=2, word_ignore_case=False, char_ignore_case=False): """Get word and character dictionaries from sentences. :param word_min_freq: The minimum frequency of a word. :param char_min_fr...
def get_dicts_generator(word_min_freq=4, char_min_freq=2, word_ignore_case=False, char_ignore_case=False): """Get word and character dictionaries from sentences. :param word_min_freq: The minimum frequency of a word. :param char_min_fr...
[ "Get", "word", "and", "character", "dictionaries", "from", "sentences", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L201-L251
[ "def", "get_dicts_generator", "(", "word_min_freq", "=", "4", ",", "char_min_freq", "=", "2", ",", "word_ignore_case", "=", "False", ",", "char_ignore_case", "=", "False", ")", ":", "word_count", ",", "char_count", "=", "{", "}", ",", "{", "}", "def", "get...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
get_word_list_eng
A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings.
keras_wc_embd/word_char_embd.py
def get_word_list_eng(text): """A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings. """ words, index = [''], 0 while index < len(text): while index < len(text) and ('a' <= text[index] <= 'z' or 'A' <= text[index] <= '...
def get_word_list_eng(text): """A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings. """ words, index = [''], 0 while index < len(text): while index < len(text) and ('a' <= text[index] <= 'z' or 'A' <= text[index] <= '...
[ "A", "naive", "function", "that", "extracts", "English", "words", "from", "raw", "texts", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L254-L275
[ "def", "get_word_list_eng", "(", "text", ")", ":", "words", ",", "index", "=", "[", "''", "]", ",", "0", "while", "index", "<", "len", "(", "text", ")", ":", "while", "index", "<", "len", "(", "text", ")", "and", "(", "'a'", "<=", "text", "[", ...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
get_embedding_weights_from_file
Load pre-trained embeddings from a text file. Each line in the file should look like this: word feature_dim_1 feature_dim_2 ... feature_dim_n The `feature_dim_i` should be a floating point number. :param word_dict: A dict that maps words to indice. :param file_path: The location of the text f...
keras_wc_embd/word_char_embd.py
def get_embedding_weights_from_file(word_dict, file_path, ignore_case=False): """Load pre-trained embeddings from a text file. Each line in the file should look like this: word feature_dim_1 feature_dim_2 ... feature_dim_n The `feature_dim_i` should be a floating point number. :param word_dic...
def get_embedding_weights_from_file(word_dict, file_path, ignore_case=False): """Load pre-trained embeddings from a text file. Each line in the file should look like this: word feature_dim_1 feature_dim_2 ... feature_dim_n The `feature_dim_i` should be a floating point number. :param word_dic...
[ "Load", "pre", "-", "trained", "embeddings", "from", "a", "text", "file", "." ]
CyberZHG/keras-word-char-embd
python
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L278-L313
[ "def", "get_embedding_weights_from_file", "(", "word_dict", ",", "file_path", ",", "ignore_case", "=", "False", ")", ":", "pre_trained", "=", "{", "}", "with", "codecs", ".", "open", "(", "file_path", ",", "'r'", ",", "'utf8'", ")", "as", "reader", ":", "f...
cca6ddff01b6264dd0d12613bb9ed308e1367b8c
train
init_backends
Loads all backends
pgi/codegen/backend.py
def init_backends(): """Loads all backends""" global _BACKENDS, _ACTIVE_BACKENDS try: from .cffi_backend import CFFIBackend except ImportError: pass else: _BACKENDS.append(CFFIBackend) from .ctypes_backend import CTypesBackend from .null_backend import NullBackend ...
def init_backends(): """Loads all backends""" global _BACKENDS, _ACTIVE_BACKENDS try: from .cffi_backend import CFFIBackend except ImportError: pass else: _BACKENDS.append(CFFIBackend) from .ctypes_backend import CTypesBackend from .null_backend import NullBackend ...
[ "Loads", "all", "backends" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/backend.py#L12-L30
[ "def", "init_backends", "(", ")", ":", "global", "_BACKENDS", ",", "_ACTIVE_BACKENDS", "try", ":", "from", ".", "cffi_backend", "import", "CFFIBackend", "except", "ImportError", ":", "pass", "else", ":", "_BACKENDS", ".", "append", "(", "CFFIBackend", ")", "fr...
2090435df6241a15ec2a78379a36b738b728652c
train
get_backend
Returns the backend by name or raises KeyError
pgi/codegen/backend.py
def get_backend(name): """Returns the backend by name or raises KeyError""" for backend in _BACKENDS: if backend.NAME == name: return backend raise KeyError("Backend %r not available" % name)
def get_backend(name): """Returns the backend by name or raises KeyError""" for backend in _BACKENDS: if backend.NAME == name: return backend raise KeyError("Backend %r not available" % name)
[ "Returns", "the", "backend", "by", "name", "or", "raises", "KeyError" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/backend.py#L39-L45
[ "def", "get_backend", "(", "name", ")", ":", "for", "backend", "in", "_BACKENDS", ":", "if", "backend", ".", "NAME", "==", "name", ":", "return", "backend", "raise", "KeyError", "(", "\"Backend %r not available\"", "%", "name", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
set_backend
Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("cffi") -- cffi first, others as fallback set_backend("ctypes") -- ctypes first, others as fallback
pgi/codegen/backend.py
def set_backend(name=None): """Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("cffi") -- cffi first, others as fallback set_backend("ctypes") -- ctypes first, others as fallback """ possible = list(_BACKENDS) if name is None: names = [] else: ...
def set_backend(name=None): """Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("cffi") -- cffi first, others as fallback set_backend("ctypes") -- ctypes first, others as fallback """ possible = list(_BACKENDS) if name is None: names = [] else: ...
[ "Set", "a", "prefered", "ffi", "backend", "(", "cffi", "ctypes", ")", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/backend.py#L48-L75
[ "def", "set_backend", "(", "name", "=", "None", ")", ":", "possible", "=", "list", "(", "_BACKENDS", ")", "if", "name", "is", "None", ":", "names", "=", "[", "]", "else", ":", "names", "=", "name", ".", "split", "(", "\",\"", ")", "for", "name", ...
2090435df6241a15ec2a78379a36b738b728652c
train
pprint
Prints debug information for various public objects like methods, functions, constructors etc.
pgi/debug.py
def pprint(obj, file_=None): """Prints debug information for various public objects like methods, functions, constructors etc. """ if file_ is None: file_ = sys.stdout # functions, methods if callable(obj) and hasattr(obj, "_code"): obj._code.pprint(file_) return #...
def pprint(obj, file_=None): """Prints debug information for various public objects like methods, functions, constructors etc. """ if file_ is None: file_ = sys.stdout # functions, methods if callable(obj) and hasattr(obj, "_code"): obj._code.pprint(file_) return #...
[ "Prints", "debug", "information", "for", "various", "public", "objects", "like", "methods", "functions", "constructors", "etc", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/debug.py#L11-L31
[ "def", "pprint", "(", "obj", ",", "file_", "=", "None", ")", ":", "if", "file_", "is", "None", ":", "file_", "=", "sys", ".", "stdout", "# functions, methods", "if", "callable", "(", "obj", ")", "and", "hasattr", "(", "obj", ",", "\"_code\"", ")", ":...
2090435df6241a15ec2a78379a36b738b728652c
train
get_field_type
A field python type
pgi/codegen/fieldgen.py
def get_field_type(info): """A field python type""" type_ = info.get_type() cls = get_field_class(type_) field = cls(info, type_, None) field.setup() return field.py_type
def get_field_type(info): """A field python type""" type_ = info.get_type() cls = get_field_class(type_) field = cls(info, type_, None) field.setup() return field.py_type
[ "A", "field", "python", "type" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/fieldgen.py#L105-L114
[ "def", "get_field_type", "(", "info", ")", ":", "type_", "=", "info", ".", "get_type", "(", ")", "cls", "=", "get_field_class", "(", "type_", ")", "field", "=", "cls", "(", "info", ",", "type_", ",", "None", ")", "field", ".", "setup", "(", ")", "r...
2090435df6241a15ec2a78379a36b738b728652c
train
Color.from_floats
Return a new Color object from red/green/blue values from 0.0 to 1.0.
pgi/overrides/Gdk.py
def from_floats(red, green, blue): """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" return Color(int(red * Color.MAX_VALUE), int(green * Color.MAX_VALUE), int(blue * Color.MAX_VALUE))
def from_floats(red, green, blue): """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" return Color(int(red * Color.MAX_VALUE), int(green * Color.MAX_VALUE), int(blue * Color.MAX_VALUE))
[ "Return", "a", "new", "Color", "object", "from", "red", "/", "green", "/", "blue", "values", "from", "0", ".", "0", "to", "1", ".", "0", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gdk.py#L74-L79
[ "def", "from_floats", "(", "red", ",", "green", ",", "blue", ")", ":", "return", "Color", "(", "int", "(", "red", "*", "Color", ".", "MAX_VALUE", ")", ",", "int", "(", "green", "*", "Color", ".", "MAX_VALUE", ")", ",", "int", "(", "blue", "*", "C...
2090435df6241a15ec2a78379a36b738b728652c
train
_construct_target_list
Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list.
pgi/overrides/Gtk.py
def _construct_target_list(targets): """Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. """ target_entries = [] for entry in targets: ...
def _construct_target_list(targets): """Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. """ target_entries = [] for entry in targets: ...
[ "Create", "a", "list", "of", "TargetEntry", "items", "from", "a", "list", "of", "tuples", "in", "the", "form", "(", "target", "flags", "info", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L59-L70
[ "def", "_construct_target_list", "(", "targets", ")", ":", "target_entries", "=", "[", "]", "for", "entry", "in", "targets", ":", "if", "not", "isinstance", "(", "entry", ",", "Gtk", ".", "TargetEntry", ")", ":", "entry", "=", "Gtk", ".", "TargetEntry", ...
2090435df6241a15ec2a78379a36b738b728652c
train
Widget.style_get_property
style_get_property(property_name, value=None) :param property_name: the name of a style property :type property_name: :obj:`str` :param value: Either :obj:`None` or a correctly initialized :obj:`GObject.Value` :type value: :obj:`GObject.Value` or :obj:`None` ...
pgi/overrides/Gtk.py
def style_get_property(self, property_name, value=None): """style_get_property(property_name, value=None) :param property_name: the name of a style property :type property_name: :obj:`str` :param value: Either :obj:`None` or a correctly initialized :obj:`GObject...
def style_get_property(self, property_name, value=None): """style_get_property(property_name, value=None) :param property_name: the name of a style property :type property_name: :obj:`str` :param value: Either :obj:`None` or a correctly initialized :obj:`GObject...
[ "style_get_property", "(", "property_name", "value", "=", "None", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L147-L171
[ "def", "style_get_property", "(", "self", ",", "property_name", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "prop", "=", "self", ".", "find_style_property", "(", "property_name", ")", "if", "prop", "is", "None", ":", "raise", "...
2090435df6241a15ec2a78379a36b738b728652c
train
Container.child_get_property
child_get_property(child, property_name, value=None) :param child: a widget which is a child of `self` :type child: :obj:`Gtk.Widget` :param property_name: the name of the property to get :type property_name: :obj:`str` :param value: Either ...
pgi/overrides/Gtk.py
def child_get_property(self, child, property_name, value=None): """child_get_property(child, property_name, value=None) :param child: a widget which is a child of `self` :type child: :obj:`Gtk.Widget` :param property_name: the name of the property to get ...
def child_get_property(self, child, property_name, value=None): """child_get_property(child, property_name, value=None) :param child: a widget which is a child of `self` :type child: :obj:`Gtk.Widget` :param property_name: the name of the property to get ...
[ "child_get_property", "(", "child", "property_name", "value", "=", "None", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L208-L236
[ "def", "child_get_property", "(", "self", ",", "child", ",", "property_name", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "prop", "=", "self", ".", "find_child_property", "(", "property_name", ")", "if", "prop", "is", "None", "...
2090435df6241a15ec2a78379a36b738b728652c
train
Container.child_get
Returns a list of child property values for the given names.
pgi/overrides/Gtk.py
def child_get(self, child, *prop_names): """Returns a list of child property values for the given names.""" return [self.child_get_property(child, name) for name in prop_names]
def child_get(self, child, *prop_names): """Returns a list of child property values for the given names.""" return [self.child_get_property(child, name) for name in prop_names]
[ "Returns", "a", "list", "of", "child", "property", "values", "for", "the", "given", "names", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L238-L241
[ "def", "child_get", "(", "self", ",", "child", ",", "*", "prop_names", ")", ":", "return", "[", "self", ".", "child_get_property", "(", "child", ",", "name", ")", "for", "name", "in", "prop_names", "]" ]
2090435df6241a15ec2a78379a36b738b728652c
train
Container.child_set
Set a child properties on the given child to key/value pairs.
pgi/overrides/Gtk.py
def child_set(self, child, **kwargs): """Set a child properties on the given child to key/value pairs.""" for name, value in kwargs.items(): name = name.replace('_', '-') self.child_set_property(child, name, value)
def child_set(self, child, **kwargs): """Set a child properties on the given child to key/value pairs.""" for name, value in kwargs.items(): name = name.replace('_', '-') self.child_set_property(child, name, value)
[ "Set", "a", "child", "properties", "on", "the", "given", "child", "to", "key", "/", "value", "pairs", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L243-L248
[ "def", "child_set", "(", "self", ",", "child", ",", "*", "*", "kwargs", ")", ":", "for", "name", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "name", "=", "name", ".", "replace", "(", "'_'", ",", "'-'", ")", "self", ".", "child_set_...
2090435df6241a15ec2a78379a36b738b728652c
train
Editable.insert_text
insert_text(self, text, position) :param new_text: the text to append :type new_text: :obj:`str` :param position: location of the position text will be inserted at :type position: :obj:`int` :returns: location of the position text will be in...
pgi/overrides/Gtk.py
def insert_text(self, text, position): """insert_text(self, text, position) :param new_text: the text to append :type new_text: :obj:`str` :param position: location of the position text will be inserted at :type position: :obj:`int` :returns: ...
def insert_text(self, text, position): """insert_text(self, text, position) :param new_text: the text to append :type new_text: :obj:`str` :param position: location of the position text will be inserted at :type position: :obj:`int` :returns: ...
[ "insert_text", "(", "self", "text", "position", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L257-L278
[ "def", "insert_text", "(", "self", ",", "text", ",", "position", ")", ":", "return", "super", "(", "Editable", ",", "self", ")", ".", "insert_text", "(", "text", ",", "-", "1", ",", "position", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
ActionGroup.add_actions
The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following inf...
pgi/overrides/Gtk.py
def add_actions(self, entries, user_data=None): """ The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples c...
def add_actions(self, entries, user_data=None): """ The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples c...
[ "The", "add_actions", "()", "method", "is", "a", "convenience", "method", "that", "creates", "a", "number", "of", "gtk", ".", "Action", "objects", "based", "on", "the", "information", "in", "the", "list", "of", "action", "entry", "tuples", "contained", "in",...
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L325-L368
[ "def", "add_actions", "(", "self", ",", "entries", ",", "user_data", "=", "None", ")", ":", "try", ":", "iter", "(", "entries", ")", "except", "(", "TypeError", ")", ":", "raise", "TypeError", "(", "'entries must be iterable'", ")", "def", "_process_action",...
2090435df6241a15ec2a78379a36b738b728652c
train
ActionGroup.add_toggle_actions
The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The toggle action entry tuples can vary in size from one to seven ...
pgi/overrides/Gtk.py
def add_toggle_actions(self, entries, user_data=None): """ The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group....
def add_toggle_actions(self, entries, user_data=None): """ The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group....
[ "The", "add_toggle_actions", "()", "method", "is", "a", "convenience", "method", "that", "creates", "a", "number", "of", "gtk", ".", "ToggleAction", "objects", "based", "on", "the", "information", "in", "the", "list", "of", "action", "entry", "tuples", "contai...
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L370-L417
[ "def", "add_toggle_actions", "(", "self", ",", "entries", ",", "user_data", "=", "None", ")", ":", "try", ":", "iter", "(", "entries", ")", "except", "(", "TypeError", ")", ":", "raise", "TypeError", "(", "'entries must be iterable'", ")", "def", "_process_a...
2090435df6241a15ec2a78379a36b738b728652c
train
ActionGroup.add_radio_actions
The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the fol...
pgi/overrides/Gtk.py
def add_radio_actions(self, entries, value=None, on_change=None, user_data=None): """ The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to ...
def add_radio_actions(self, entries, value=None, on_change=None, user_data=None): """ The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to ...
[ "The", "add_radio_actions", "()", "method", "is", "a", "convenience", "method", "that", "creates", "a", "number", "of", "gtk", ".", "RadioAction", "objects", "based", "on", "the", "information", "in", "the", "list", "of", "action", "entry", "tuples", "containe...
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L419-L481
[ "def", "add_radio_actions", "(", "self", ",", "entries", ",", "value", "=", "None", ",", "on_change", "=", "None", ",", "user_data", "=", "None", ")", ":", "try", ":", "iter", "(", "entries", ")", "except", "(", "TypeError", ")", ":", "raise", "TypeErr...
2090435df6241a15ec2a78379a36b738b728652c
train
UIManager.add_ui_from_string
add_ui_from_string(buffer, length=-1) {{ all }}
pgi/overrides/Gtk.py
def add_ui_from_string(self, buffer, length=-1): """add_ui_from_string(buffer, length=-1) {{ all }} """ return Gtk.UIManager.add_ui_from_string(self, buffer, length)
def add_ui_from_string(self, buffer, length=-1): """add_ui_from_string(buffer, length=-1) {{ all }} """ return Gtk.UIManager.add_ui_from_string(self, buffer, length)
[ "add_ui_from_string", "(", "buffer", "length", "=", "-", "1", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L488-L494
[ "def", "add_ui_from_string", "(", "self", ",", "buffer", ",", "length", "=", "-", "1", ")", ":", "return", "Gtk", ".", "UIManager", ".", "add_ui_from_string", "(", "self", ",", "buffer", ",", "length", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
Builder.add_from_string
add_from_string(buffer, length=-1) {{ all }}
pgi/overrides/Gtk.py
def add_from_string(self, buffer, length=-1): """add_from_string(buffer, length=-1) {{ all }} """ return Gtk.Builder.add_from_string(self, buffer, length)
def add_from_string(self, buffer, length=-1): """add_from_string(buffer, length=-1) {{ all }} """ return Gtk.Builder.add_from_string(self, buffer, length)
[ "add_from_string", "(", "buffer", "length", "=", "-", "1", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L561-L567
[ "def", "add_from_string", "(", "self", ",", "buffer", ",", "length", "=", "-", "1", ")", ":", "return", "Gtk", ".", "Builder", ".", "add_from_string", "(", "self", ",", "buffer", ",", "length", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
Builder.add_objects_from_string
add_objects_from_string(buffer, object_ids) :param buffer: the string to parse :type buffer: :obj:`str` :param object_ids: array of objects to build :type object_ids: [:obj:`str`] :raises: :class:`GLib.Error` :returns: A positive value on success, 0 if an error occurre...
pgi/overrides/Gtk.py
def add_objects_from_string(self, buffer, object_ids): """add_objects_from_string(buffer, object_ids) :param buffer: the string to parse :type buffer: :obj:`str` :param object_ids: array of objects to build :type object_ids: [:obj:`str`] :raises: :class:`GLib.Error` ...
def add_objects_from_string(self, buffer, object_ids): """add_objects_from_string(buffer, object_ids) :param buffer: the string to parse :type buffer: :obj:`str` :param object_ids: array of objects to build :type object_ids: [:obj:`str`] :raises: :class:`GLib.Error` ...
[ "add_objects_from_string", "(", "buffer", "object_ids", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L569-L586
[ "def", "add_objects_from_string", "(", "self", ",", "buffer", ",", "object_ids", ")", ":", "length", "=", "-", "1", "return", "Gtk", ".", "Builder", ".", "add_objects_from_string", "(", "self", ",", "buffer", ",", "length", ",", "object_ids", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
Dialog.add_buttons
add_buttons(*args) The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button text (or stock ID) and a response ID inte...
pgi/overrides/Gtk.py
def add_buttons(self, *args): """add_buttons(*args) The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button ...
def add_buttons(self, *args): """add_buttons(*args) The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button ...
[ "add_buttons", "(", "*", "args", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L661-L686
[ "def", "add_buttons", "(", "self", ",", "*", "args", ")", ":", "def", "_button", "(", "b", ")", ":", "while", "b", ":", "t", ",", "r", "=", "b", "[", "0", ":", "2", "]", "b", "=", "b", "[", "2", ":", "]", "yield", "t", ",", "r", "try", ...
2090435df6241a15ec2a78379a36b738b728652c
train
TextBuffer.create_tag
Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values :returns: A new tag. This is equivalent to creating a Gtk.TextTag and the...
pgi/overrides/Gtk.py
def create_tag(self, tag_name=None, **properties): """Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values :returns: A new tag....
def create_tag(self, tag_name=None, **properties): """Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values :returns: A new tag....
[ "Creates", "a", "tag", "and", "adds", "it", "to", "the", "tag", "table", "of", "the", "TextBuffer", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L876-L901
[ "def", "create_tag", "(", "self", ",", "tag_name", "=", "None", ",", "*", "*", "properties", ")", ":", "tag", "=", "Gtk", ".", "TextTag", "(", "name", "=", "tag_name", ",", "*", "*", "properties", ")", "self", ".", "_get_or_create_tag_table", "(", ")",...
2090435df6241a15ec2a78379a36b738b728652c
train
TextBuffer.set_text
set_text(text, length=-1) {{ all }}
pgi/overrides/Gtk.py
def set_text(self, text, length=-1): """set_text(text, length=-1) {{ all }} """ Gtk.TextBuffer.set_text(self, text, length)
def set_text(self, text, length=-1): """set_text(text, length=-1) {{ all }} """ Gtk.TextBuffer.set_text(self, text, length)
[ "set_text", "(", "text", "length", "=", "-", "1", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L906-L912
[ "def", "set_text", "(", "self", ",", "text", ",", "length", "=", "-", "1", ")", ":", "Gtk", ".", "TextBuffer", ".", "set_text", "(", "self", ",", "text", ",", "length", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TextBuffer.insert
insert(iter, text, length=-1) {{ all }}
pgi/overrides/Gtk.py
def insert(self, iter, text, length=-1): """insert(iter, text, length=-1) {{ all }} """ Gtk.TextBuffer.insert(self, iter, text, length)
def insert(self, iter, text, length=-1): """insert(iter, text, length=-1) {{ all }} """ Gtk.TextBuffer.insert(self, iter, text, length)
[ "insert", "(", "iter", "text", "length", "=", "-", "1", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L914-L920
[ "def", "insert", "(", "self", ",", "iter", ",", "text", ",", "length", "=", "-", "1", ")", ":", "Gtk", ".", "TextBuffer", ".", "insert", "(", "self", ",", "iter", ",", "text", ",", "length", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModel.get_iter
:param path: the :obj:`Gtk.TreePath`-struct :type path: :obj:`Gtk.TreePath` :raises: :class:`ValueError` if `path` doesn't exist :returns: a :obj:`Gtk.TreeIter` :rtype: :obj:`Gtk.TreeIter` Returns an iterator pointing to `path`. If `path` does not exist :class:`ValueErr...
pgi/overrides/Gtk.py
def get_iter(self, path): """ :param path: the :obj:`Gtk.TreePath`-struct :type path: :obj:`Gtk.TreePath` :raises: :class:`ValueError` if `path` doesn't exist :returns: a :obj:`Gtk.TreeIter` :rtype: :obj:`Gtk.TreeIter` Returns an iterator pointing to `path`. If ...
def get_iter(self, path): """ :param path: the :obj:`Gtk.TreePath`-struct :type path: :obj:`Gtk.TreePath` :raises: :class:`ValueError` if `path` doesn't exist :returns: a :obj:`Gtk.TreeIter` :rtype: :obj:`Gtk.TreeIter` Returns an iterator pointing to `path`. If ...
[ ":", "param", "path", ":", "the", ":", "obj", ":", "Gtk", ".", "TreePath", "-", "struct", ":", "type", "path", ":", ":", "obj", ":", "Gtk", ".", "TreePath" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1155-L1172
[ "def", "get_iter", "(", "self", ",", "path", ")", ":", "path", "=", "self", ".", "_coerce_path", "(", "path", ")", "success", ",", "aiter", "=", "super", "(", "TreeModel", ",", "self", ")", ".", "get_iter", "(", "path", ")", "if", "not", "success", ...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModel.iter_next
:param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the node following `iter` at the current level. If there is no next `it...
pgi/overrides/Gtk.py
def iter_next(self, iter): """ :param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the node following `iter` at the ...
def iter_next(self, iter): """ :param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the node following `iter` at the ...
[ ":", "param", "iter", ":", "the", ":", "obj", ":", "Gtk", ".", "TreeIter", "-", "struct", ":", "type", "iter", ":", ":", "obj", ":", "Gtk", ".", "TreeIter" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1174-L1191
[ "def", "iter_next", "(", "self", ",", "iter", ")", ":", "next_iter", "=", "iter", ".", "copy", "(", ")", "success", "=", "super", "(", "TreeModel", ",", "self", ")", ".", "iter_next", "(", "next_iter", ")", "if", "success", ":", "return", "next_iter" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModel.iter_previous
:param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the previous node at the current level. If there is no previous `iter`, :obj:`N...
pgi/overrides/Gtk.py
def iter_previous(self, iter): """ :param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the previous node at the current leve...
def iter_previous(self, iter): """ :param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the previous node at the current leve...
[ ":", "param", "iter", ":", "the", ":", "obj", ":", "Gtk", ".", "TreeIter", "-", "struct", ":", "type", "iter", ":", ":", "obj", ":", "Gtk", ".", "TreeIter" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1193-L1209
[ "def", "iter_previous", "(", "self", ",", "iter", ")", ":", "prev_iter", "=", "iter", ".", "copy", "(", ")", "success", "=", "super", "(", "TreeModel", ",", "self", ")", ".", "iter_previous", "(", "prev_iter", ")", "if", "success", ":", "return", "prev...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModel.set_row
:param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param row: a list of values for each column :type row: [:obj:`object`] Sets all values of a row pointed to by `treeiter` from a list of values passes as `row`. The length of the row has to match the n...
pgi/overrides/Gtk.py
def set_row(self, treeiter, row): """ :param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param row: a list of values for each column :type row: [:obj:`object`] Sets all values of a row pointed to by `treeiter` from a list of values pas...
def set_row(self, treeiter, row): """ :param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param row: a list of values for each column :type row: [:obj:`object`] Sets all values of a row pointed to by `treeiter` from a list of values pas...
[ ":", "param", "treeiter", ":", "the", ":", "obj", ":", "Gtk", ".", "TreeIter", ":", "type", "treeiter", ":", ":", "obj", ":", "Gtk", ".", "TreeIter" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1231-L1254
[ "def", "set_row", "(", "self", ",", "treeiter", ",", "row", ")", ":", "converted_row", ",", "columns", "=", "self", ".", "_convert_row", "(", "row", ")", "for", "column", "in", "columns", ":", "value", "=", "row", "[", "column", "]", "if", "value", "...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModel._convert_value
Convert value to a GObject.Value of the expected type
pgi/overrides/Gtk.py
def _convert_value(self, column, value): '''Convert value to a GObject.Value of the expected type''' if isinstance(value, GObject.Value): return value return GObject.Value(self.get_column_type(column), value)
def _convert_value(self, column, value): '''Convert value to a GObject.Value of the expected type''' if isinstance(value, GObject.Value): return value return GObject.Value(self.get_column_type(column), value)
[ "Convert", "value", "to", "a", "GObject", ".", "Value", "of", "the", "expected", "type" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1256-L1261
[ "def", "_convert_value", "(", "self", ",", "column", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "GObject", ".", "Value", ")", ":", "return", "value", "return", "GObject", ".", "Value", "(", "self", ".", "get_column_type", "(", "column...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModel.get
:param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param \\*columns: a list of column indices to fetch :type columns: (:obj:`int`) Returns a tuple of all values specified by their indices in `columns` in the order the indices are contained in `columns...
pgi/overrides/Gtk.py
def get(self, treeiter, *columns): """ :param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param \\*columns: a list of column indices to fetch :type columns: (:obj:`int`) Returns a tuple of all values specified by their indices in `columns` ...
def get(self, treeiter, *columns): """ :param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param \\*columns: a list of column indices to fetch :type columns: (:obj:`int`) Returns a tuple of all values specified by their indices in `columns` ...
[ ":", "param", "treeiter", ":", "the", ":", "obj", ":", "Gtk", ".", "TreeIter", ":", "type", "treeiter", ":", ":", "obj", ":", "Gtk", ".", "TreeIter" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1263-L1289
[ "def", "get", "(", "self", ",", "treeiter", ",", "*", "columns", ")", ":", "n_columns", "=", "self", ".", "get_n_columns", "(", ")", "values", "=", "[", "]", "for", "col", "in", "columns", ":", "if", "not", "isinstance", "(", "col", ",", "int", ")"...
2090435df6241a15ec2a78379a36b738b728652c
train
ListStore.append
append(row=None) :param row: a list of values to apply to the newly append row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :obj:`Gtk.TreeIter` of the appended row :rtype: :obj:`Gtk.TreeIter` If `row` is :obj:`None` the appended row will be empty and to f...
pgi/overrides/Gtk.py
def append(self, row=None): """append(row=None) :param row: a list of values to apply to the newly append row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :obj:`Gtk.TreeIter` of the appended row :rtype: :obj:`Gtk.TreeIter` If `row` is :obj:`None` ...
def append(self, row=None): """append(row=None) :param row: a list of values to apply to the newly append row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :obj:`Gtk.TreeIter` of the appended row :rtype: :obj:`Gtk.TreeIter` If `row` is :obj:`None` ...
[ "append", "(", "row", "=", "None", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1368-L1390
[ "def", "append", "(", "self", ",", "row", "=", "None", ")", ":", "if", "row", ":", "return", "self", ".", "_do_insert", "(", "-", "1", ",", "row", ")", "# gtk_list_store_insert() does not know about the \"position == -1\"", "# case, so use append() here", "else", ...
2090435df6241a15ec2a78379a36b738b728652c
train
ListStore.insert_before
insert_before(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :ob...
pgi/overrides/Gtk.py
def insert_before(self, sibling, row=None): """insert_before(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row...
def insert_before(self, sibling, row=None): """insert_before(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row...
[ "insert_before", "(", "sibling", "row", "=", "None", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1439-L1467
[ "def", "insert_before", "(", "self", ",", "sibling", ",", "row", "=", "None", ")", ":", "treeiter", "=", "Gtk", ".", "ListStore", ".", "insert_before", "(", "self", ",", "sibling", ")", "if", "row", "is", "not", "None", ":", "self", ".", "set_row", "...
2090435df6241a15ec2a78379a36b738b728652c
train
ListStore.insert_after
insert_after(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :obj...
pgi/overrides/Gtk.py
def insert_after(self, sibling, row=None): """insert_after(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row: ...
def insert_after(self, sibling, row=None): """insert_after(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row: ...
[ "insert_after", "(", "sibling", "row", "=", "None", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1472-L1500
[ "def", "insert_after", "(", "self", ",", "sibling", ",", "row", "=", "None", ")", ":", "treeiter", "=", "Gtk", ".", "ListStore", ".", "insert_after", "(", "self", ",", "sibling", ")", "if", "row", "is", "not", "None", ":", "self", ".", "set_row", "("...
2090435df6241a15ec2a78379a36b738b728652c
train
ListStore.set_value
{{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()).
pgi/overrides/Gtk.py
def set_value(self, treeiter, column, value): """ {{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()). """ value = self._convert_value(co...
def set_value(self, treeiter, column, value): """ {{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()). """ value = self._convert_value(co...
[ "{{", "all", "}}" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1502-L1512
[ "def", "set_value", "(", "self", ",", "treeiter", ",", "column", ",", "value", ")", ":", "value", "=", "self", ".", "_convert_value", "(", "column", ",", "value", ")", "Gtk", ".", "ListStore", ".", "set_value", "(", "self", ",", "treeiter", ",", "colum...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModelRow.get_next
Returns the next :obj:`Gtk.TreeModelRow` or None
pgi/overrides/Gtk.py
def get_next(self): """Returns the next :obj:`Gtk.TreeModelRow` or None""" next_iter = self.model.iter_next(self.iter) if next_iter: return TreeModelRow(self.model, next_iter)
def get_next(self): """Returns the next :obj:`Gtk.TreeModelRow` or None""" next_iter = self.model.iter_next(self.iter) if next_iter: return TreeModelRow(self.model, next_iter)
[ "Returns", "the", "next", ":", "obj", ":", "Gtk", ".", "TreeModelRow", "or", "None" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1618-L1623
[ "def", "get_next", "(", "self", ")", ":", "next_iter", "=", "self", ".", "model", ".", "iter_next", "(", "self", ".", "iter", ")", "if", "next_iter", ":", "return", "TreeModelRow", "(", "self", ".", "model", ",", "next_iter", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModelRow.get_previous
Returns the previous :obj:`Gtk.TreeModelRow` or None
pgi/overrides/Gtk.py
def get_previous(self): """Returns the previous :obj:`Gtk.TreeModelRow` or None""" prev_iter = self.model.iter_previous(self.iter) if prev_iter: return TreeModelRow(self.model, prev_iter)
def get_previous(self): """Returns the previous :obj:`Gtk.TreeModelRow` or None""" prev_iter = self.model.iter_previous(self.iter) if prev_iter: return TreeModelRow(self.model, prev_iter)
[ "Returns", "the", "previous", ":", "obj", ":", "Gtk", ".", "TreeModelRow", "or", "None" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1625-L1630
[ "def", "get_previous", "(", "self", ")", ":", "prev_iter", "=", "self", ".", "model", ".", "iter_previous", "(", "self", ".", "iter", ")", "if", "prev_iter", ":", "return", "TreeModelRow", "(", "self", ".", "model", ",", "prev_iter", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModelRow.get_parent
Returns the parent :obj:`Gtk.TreeModelRow` or htis row or None
pgi/overrides/Gtk.py
def get_parent(self): """Returns the parent :obj:`Gtk.TreeModelRow` or htis row or None""" parent_iter = self.model.iter_parent(self.iter) if parent_iter: return TreeModelRow(self.model, parent_iter)
def get_parent(self): """Returns the parent :obj:`Gtk.TreeModelRow` or htis row or None""" parent_iter = self.model.iter_parent(self.iter) if parent_iter: return TreeModelRow(self.model, parent_iter)
[ "Returns", "the", "parent", ":", "obj", ":", "Gtk", ".", "TreeModelRow", "or", "htis", "row", "or", "None" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1632-L1637
[ "def", "get_parent", "(", "self", ")", ":", "parent_iter", "=", "self", ".", "model", ".", "iter_parent", "(", "self", ".", "iter", ")", "if", "parent_iter", ":", "return", "TreeModelRow", "(", "self", ".", "model", ",", "parent_iter", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModelRow.iterchildren
Returns a :obj:`Gtk.TreeModelRowIter` for the row's children
pgi/overrides/Gtk.py
def iterchildren(self): """Returns a :obj:`Gtk.TreeModelRowIter` for the row's children""" child_iter = self.model.iter_children(self.iter) return TreeModelRowIter(self.model, child_iter)
def iterchildren(self): """Returns a :obj:`Gtk.TreeModelRowIter` for the row's children""" child_iter = self.model.iter_children(self.iter) return TreeModelRowIter(self.model, child_iter)
[ "Returns", "a", ":", "obj", ":", "Gtk", ".", "TreeModelRowIter", "for", "the", "row", "s", "children" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1681-L1685
[ "def", "iterchildren", "(", "self", ")", ":", "child_iter", "=", "self", ".", "model", ".", "iter_children", "(", "self", ".", "iter", ")", "return", "TreeModelRowIter", "(", "self", ".", "model", ",", "child_iter", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeStore.insert
insert(parent, position, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param position: position to insert the new row, or -1 for last :type position: :obj:`int` :param row: a list ...
pgi/overrides/Gtk.py
def insert(self, parent, position, row=None): """insert(parent, position, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param position: position to insert the new row, or -1 for last ...
def insert(self, parent, position, row=None): """insert(parent, position, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param position: position to insert the new row, or -1 for last ...
[ "insert", "(", "parent", "position", "row", "=", "None", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1851-L1883
[ "def", "insert", "(", "self", ",", "parent", ",", "position", ",", "row", "=", "None", ")", ":", "return", "self", ".", "_do_insert", "(", "parent", ",", "position", ",", "row", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeStore.insert_before
insert_before(parent, sibling, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list...
pgi/overrides/Gtk.py
def insert_before(self, parent, sibling, row=None): """insert_before(parent, sibling, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling:...
def insert_before(self, parent, sibling, row=None): """insert_before(parent, sibling, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling:...
[ "insert_before", "(", "parent", "sibling", "row", "=", "None", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1888-L1924
[ "def", "insert_before", "(", "self", ",", "parent", ",", "sibling", ",", "row", "=", "None", ")", ":", "treeiter", "=", "Gtk", ".", "TreeStore", ".", "insert_before", "(", "self", ",", "parent", ",", "sibling", ")", "if", "row", "is", "not", "None", ...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeStore.set_value
{{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()).
pgi/overrides/Gtk.py
def set_value(self, treeiter, column, value): """ {{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()). """ value = self._convert_value(co...
def set_value(self, treeiter, column, value): """ {{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()). """ value = self._convert_value(co...
[ "{{", "all", "}}" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1966-L1976
[ "def", "set_value", "(", "self", ",", "treeiter", ",", "column", ",", "value", ")", ":", "value", "=", "self", ".", "_convert_value", "(", "column", ",", "value", ")", "Gtk", ".", "TreeStore", ".", "set_value", "(", "self", ",", "treeiter", ",", "colum...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeView.insert_column_with_attributes
:param position: The position to insert the new column in :type position: :obj:`int` :param title: The title to set the header to :type title: :obj:`str` :param cell: The :obj:`Gtk.CellRenderer` :type cell: :obj:`Gtk.CellRenderer` {{ docs }}
pgi/overrides/Gtk.py
def insert_column_with_attributes(self, position, title, cell, **kwargs): """ :param position: The position to insert the new column in :type position: :obj:`int` :param title: The title to set the header to :type title: :obj:`str` :param cell: The :obj:`Gtk.CellRendere...
def insert_column_with_attributes(self, position, title, cell, **kwargs): """ :param position: The position to insert the new column in :type position: :obj:`int` :param title: The title to set the header to :type title: :obj:`str` :param cell: The :obj:`Gtk.CellRendere...
[ ":", "param", "position", ":", "The", "position", "to", "insert", "the", "new", "column", "in", ":", "type", "position", ":", ":", "obj", ":", "int" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L2098-L2116
[ "def", "insert_column_with_attributes", "(", "self", ",", "position", ",", "title", ",", "cell", ",", "*", "*", "kwargs", ")", ":", "column", "=", "TreeViewColumn", "(", ")", "column", ".", "set_title", "(", "title", ")", "column", ".", "pack_start", "(", ...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeViewColumn.set_attributes
:param cell_renderer: the :obj:`Gtk.CellRenderer` we're setting the attributes of :type cell_renderer: :obj:`Gtk.CellRenderer` {{ docs }}
pgi/overrides/Gtk.py
def set_attributes(self, cell_renderer, **attributes): """ :param cell_renderer: the :obj:`Gtk.CellRenderer` we're setting the attributes of :type cell_renderer: :obj:`Gtk.CellRenderer` {{ docs }} """ Gtk.CellLayout.clear_attributes(self, cell_renderer) for (na...
def set_attributes(self, cell_renderer, **attributes): """ :param cell_renderer: the :obj:`Gtk.CellRenderer` we're setting the attributes of :type cell_renderer: :obj:`Gtk.CellRenderer` {{ docs }} """ Gtk.CellLayout.clear_attributes(self, cell_renderer) for (na...
[ ":", "param", "cell_renderer", ":", "the", ":", "obj", ":", "Gtk", ".", "CellRenderer", "we", "re", "setting", "the", "attributes", "of", ":", "type", "cell_renderer", ":", ":", "obj", ":", "Gtk", ".", "CellRenderer" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L2153-L2164
[ "def", "set_attributes", "(", "self", ",", "cell_renderer", ",", "*", "*", "attributes", ")", ":", "Gtk", ".", "CellLayout", ".", "clear_attributes", "(", "self", ",", "cell_renderer", ")", "for", "(", "name", ",", "value", ")", "in", "attributes", ".", ...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeSelection.get_selected
:returns: :model: the :obj:`Gtk.TreeModel` :iter: The :obj:`Gtk.TreeIter` or :obj:`None` :rtype: (**model**: :obj:`Gtk.TreeModel`, **iter**: :obj:`Gtk.TreeIter` or :obj:`None`) {{ docs }}
pgi/overrides/Gtk.py
def get_selected(self): """ :returns: :model: the :obj:`Gtk.TreeModel` :iter: The :obj:`Gtk.TreeIter` or :obj:`None` :rtype: (**model**: :obj:`Gtk.TreeModel`, **iter**: :obj:`Gtk.TreeIter` or :obj:`None`) {{ docs }} """ success, model, aiter = s...
def get_selected(self): """ :returns: :model: the :obj:`Gtk.TreeModel` :iter: The :obj:`Gtk.TreeIter` or :obj:`None` :rtype: (**model**: :obj:`Gtk.TreeModel`, **iter**: :obj:`Gtk.TreeIter` or :obj:`None`) {{ docs }} """ success, model, aiter = s...
[ ":", "returns", ":", ":", "model", ":", "the", ":", "obj", ":", "Gtk", ".", "TreeModel", ":", "iter", ":", "The", ":", "obj", ":", "Gtk", ".", "TreeIter", "or", ":", "obj", ":", "None" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L2178-L2193
[ "def", "get_selected", "(", "self", ")", ":", "success", ",", "model", ",", "aiter", "=", "super", "(", "TreeSelection", ",", "self", ")", ".", "get_selected", "(", ")", "if", "success", ":", "return", "(", "model", ",", "aiter", ")", "else", ":", "r...
2090435df6241a15ec2a78379a36b738b728652c
train
TreeSelection.get_selected_rows
:returns: A list containing a :obj:`Gtk.TreePath` for each selected row and a :obj:`Gtk.TreeModel` or :obj:`None`. :rtype: (:obj:`Gtk.TreeModel`, [:obj:`Gtk.TreePath`]) {{ docs }}
pgi/overrides/Gtk.py
def get_selected_rows(self): """ :returns: A list containing a :obj:`Gtk.TreePath` for each selected row and a :obj:`Gtk.TreeModel` or :obj:`None`. :rtype: (:obj:`Gtk.TreeModel`, [:obj:`Gtk.TreePath`]) {{ docs }} """ rows, model = super(TreeSele...
def get_selected_rows(self): """ :returns: A list containing a :obj:`Gtk.TreePath` for each selected row and a :obj:`Gtk.TreeModel` or :obj:`None`. :rtype: (:obj:`Gtk.TreeModel`, [:obj:`Gtk.TreePath`]) {{ docs }} """ rows, model = super(TreeSele...
[ ":", "returns", ":", "A", "list", "containing", "a", ":", "obj", ":", "Gtk", ".", "TreePath", "for", "each", "selected", "row", "and", "a", ":", "obj", ":", "Gtk", ".", "TreeModel", "or", ":", "obj", ":", "None", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L2197-L2209
[ "def", "get_selected_rows", "(", "self", ")", ":", "rows", ",", "model", "=", "super", "(", "TreeSelection", ",", "self", ")", ".", "get_selected_rows", "(", ")", "return", "(", "model", ",", "rows", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
TreeModelFilter.set_value
Set the value of the child model
pgi/overrides/Gtk.py
def set_value(self, iter, column, value): """Set the value of the child model""" # Delegate to child model iter = self.convert_iter_to_child_iter(iter) self.get_model().set_value(iter, column, value)
def set_value(self, iter, column, value): """Set the value of the child model""" # Delegate to child model iter = self.convert_iter_to_child_iter(iter) self.get_model().set_value(iter, column, value)
[ "Set", "the", "value", "of", "the", "child", "model" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L2376-L2381
[ "def", "set_value", "(", "self", ",", "iter", ",", "column", ",", "value", ")", ":", "# Delegate to child model", "iter", "=", "self", ".", "convert_iter_to_child_iter", "(", "iter", ")", "self", ".", "get_model", "(", ")", ".", "set_value", "(", "iter", "...
2090435df6241a15ec2a78379a36b738b728652c
train
get_foreign_module
Returns the module or raises ForeignError
pgi/foreign/__init__.py
def get_foreign_module(namespace): """Returns the module or raises ForeignError""" if namespace not in _MODULES: try: module = importlib.import_module("." + namespace, __package__) except ImportError: module = None _MODULES[namespace] = module module = _MODU...
def get_foreign_module(namespace): """Returns the module or raises ForeignError""" if namespace not in _MODULES: try: module = importlib.import_module("." + namespace, __package__) except ImportError: module = None _MODULES[namespace] = module module = _MODU...
[ "Returns", "the", "module", "or", "raises", "ForeignError" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/foreign/__init__.py#L21-L34
[ "def", "get_foreign_module", "(", "namespace", ")", ":", "if", "namespace", "not", "in", "_MODULES", ":", "try", ":", "module", "=", "importlib", ".", "import_module", "(", "\".\"", "+", "namespace", ",", "__package__", ")", "except", "ImportError", ":", "mo...
2090435df6241a15ec2a78379a36b738b728652c
train
get_foreign_struct
Returns a ForeignStruct implementation or raises ForeignError
pgi/foreign/__init__.py
def get_foreign_struct(namespace, name): """Returns a ForeignStruct implementation or raises ForeignError""" get_foreign_module(namespace) try: return ForeignStruct.get(namespace, name) except KeyError: raise ForeignError("Foreign %s.%s not supported" % (namespace, name))
def get_foreign_struct(namespace, name): """Returns a ForeignStruct implementation or raises ForeignError""" get_foreign_module(namespace) try: return ForeignStruct.get(namespace, name) except KeyError: raise ForeignError("Foreign %s.%s not supported" % (namespace, name))
[ "Returns", "a", "ForeignStruct", "implementation", "or", "raises", "ForeignError" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/foreign/__init__.py#L37-L45
[ "def", "get_foreign_struct", "(", "namespace", ",", "name", ")", ":", "get_foreign_module", "(", "namespace", ")", "try", ":", "return", "ForeignStruct", ".", "get", "(", "namespace", ",", "name", ")", "except", "KeyError", ":", "raise", "ForeignError", "(", ...
2090435df6241a15ec2a78379a36b738b728652c
train
require_foreign
Raises ImportError if the specified foreign module isn't supported or the needed dependencies aren't installed. e.g.: check_foreign('cairo', 'Context')
pgi/foreign/__init__.py
def require_foreign(namespace, symbol=None): """Raises ImportError if the specified foreign module isn't supported or the needed dependencies aren't installed. e.g.: check_foreign('cairo', 'Context') """ try: if symbol is None: get_foreign_module(namespace) else: ...
def require_foreign(namespace, symbol=None): """Raises ImportError if the specified foreign module isn't supported or the needed dependencies aren't installed. e.g.: check_foreign('cairo', 'Context') """ try: if symbol is None: get_foreign_module(namespace) else: ...
[ "Raises", "ImportError", "if", "the", "specified", "foreign", "module", "isn", "t", "supported", "or", "the", "needed", "dependencies", "aren", "t", "installed", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/foreign/__init__.py#L48-L62
[ "def", "require_foreign", "(", "namespace", ",", "symbol", "=", "None", ")", ":", "try", ":", "if", "symbol", "is", "None", ":", "get_foreign_module", "(", "namespace", ")", "else", ":", "get_foreign_struct", "(", "namespace", ",", "symbol", ")", "except", ...
2090435df6241a15ec2a78379a36b738b728652c
train
io_add_watch
io_add_watch(channel, priority, condition, func, *user_data) -> event_source_id
pgi/overrides/GLib.py
def io_add_watch(*args, **kwargs): """io_add_watch(channel, priority, condition, func, *user_data) -> event_source_id""" channel, priority, condition, func, user_data = _io_add_watch_get_args(*args, **kwargs) return GLib.io_add_watch(channel, priority, condition, func, *user_data)
def io_add_watch(*args, **kwargs): """io_add_watch(channel, priority, condition, func, *user_data) -> event_source_id""" channel, priority, condition, func, user_data = _io_add_watch_get_args(*args, **kwargs) return GLib.io_add_watch(channel, priority, condition, func, *user_data)
[ "io_add_watch", "(", "channel", "priority", "condition", "func", "*", "user_data", ")", "-", ">", "event_source_id" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L813-L816
[ "def", "io_add_watch", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "channel", ",", "priority", ",", "condition", ",", "func", ",", "user_data", "=", "_io_add_watch_get_args", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "GLib", "....
2090435df6241a15ec2a78379a36b738b728652c
train
child_watch_add
child_watch_add(priority, pid, function, *data)
pgi/overrides/GLib.py
def child_watch_add(*args, **kwargs): """child_watch_add(priority, pid, function, *data)""" priority, pid, function, data = _child_watch_add_get_args(*args, **kwargs) return GLib.child_watch_add(priority, pid, function, *data)
def child_watch_add(*args, **kwargs): """child_watch_add(priority, pid, function, *data)""" priority, pid, function, data = _child_watch_add_get_args(*args, **kwargs) return GLib.child_watch_add(priority, pid, function, *data)
[ "child_watch_add", "(", "priority", "pid", "function", "*", "data", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L964-L967
[ "def", "child_watch_add", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "priority", ",", "pid", ",", "function", ",", "data", "=", "_child_watch_add_get_args", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "GLib", ".", "child_watch_add...
2090435df6241a15ec2a78379a36b738b728652c
train
_VariantCreator._create
Create a GVariant object from given format and argument list. This method recursively calls itself for complex structures (arrays, dictionaries, boxed). Return a tuple (variant, rest_format, rest_args) with the generated GVariant, the remainder of the format string, and the remainder o...
pgi/overrides/GLib.py
def _create(self, format, args): """Create a GVariant object from given format and argument list. This method recursively calls itself for complex structures (arrays, dictionaries, boxed). Return a tuple (variant, rest_format, rest_args) with the generated GVariant, the remaind...
def _create(self, format, args): """Create a GVariant object from given format and argument list. This method recursively calls itself for complex structures (arrays, dictionaries, boxed). Return a tuple (variant, rest_format, rest_args) with the generated GVariant, the remaind...
[ "Create", "a", "GVariant", "object", "from", "given", "format", "and", "argument", "list", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L153-L187
[ "def", "_create", "(", "self", ",", "format", ",", "args", ")", ":", "# leaves (simple types)", "constructor", "=", "self", ".", "_LEAF_CONSTRUCTORS", ".", "get", "(", "format", "[", "0", "]", ")", "if", "constructor", ":", "if", "args", "is", "not", "No...
2090435df6241a15ec2a78379a36b738b728652c
train
_VariantCreator._create_tuple
Handle the case where the outermost type of format is a tuple.
pgi/overrides/GLib.py
def _create_tuple(self, format, args): """Handle the case where the outermost type of format is a tuple.""" format = format[1:] # eat the '(' if args is None: # empty value: we need to call _create() to parse the subtype rest_format = format while rest_forma...
def _create_tuple(self, format, args): """Handle the case where the outermost type of format is a tuple.""" format = format[1:] # eat the '(' if args is None: # empty value: we need to call _create() to parse the subtype rest_format = format while rest_forma...
[ "Handle", "the", "case", "where", "the", "outermost", "type", "of", "format", "is", "a", "tuple", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L189-L221
[ "def", "_create_tuple", "(", "self", ",", "format", ",", "args", ")", ":", "format", "=", "format", "[", "1", ":", "]", "# eat the '('", "if", "args", "is", "None", ":", "# empty value: we need to call _create() to parse the subtype", "rest_format", "=", "format",...
2090435df6241a15ec2a78379a36b738b728652c
train
_VariantCreator._create_dict
Handle the case where the outermost type of format is a dict.
pgi/overrides/GLib.py
def _create_dict(self, format, args): """Handle the case where the outermost type of format is a dict.""" builder = None if args is None or not args[0]: # empty value: we need to call _create() to parse the subtype, # and specify the element type precisely re...
def _create_dict(self, format, args): """Handle the case where the outermost type of format is a dict.""" builder = None if args is None or not args[0]: # empty value: we need to call _create() to parse the subtype, # and specify the element type precisely re...
[ "Handle", "the", "case", "where", "the", "outermost", "type", "of", "format", "is", "a", "dict", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L223-L254
[ "def", "_create_dict", "(", "self", ",", "format", ",", "args", ")", ":", "builder", "=", "None", "if", "args", "is", "None", "or", "not", "args", "[", "0", "]", ":", "# empty value: we need to call _create() to parse the subtype,", "# and specify the element type p...
2090435df6241a15ec2a78379a36b738b728652c
train
_VariantCreator._create_array
Handle the case where the outermost type of format is an array.
pgi/overrides/GLib.py
def _create_array(self, format, args): """Handle the case where the outermost type of format is an array.""" builder = None if args is None or not args[0]: # empty value: we need to call _create() to parse the subtype, # and specify the element type precisely ...
def _create_array(self, format, args): """Handle the case where the outermost type of format is an array.""" builder = None if args is None or not args[0]: # empty value: we need to call _create() to parse the subtype, # and specify the element type precisely ...
[ "Handle", "the", "case", "where", "the", "outermost", "type", "of", "format", "is", "an", "array", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L256-L273
[ "def", "_create_array", "(", "self", ",", "format", ",", "args", ")", ":", "builder", "=", "None", "if", "args", "is", "None", "or", "not", "args", "[", "0", "]", ":", "# empty value: we need to call _create() to parse the subtype,", "# and specify the element type ...
2090435df6241a15ec2a78379a36b738b728652c
train
Variant.unpack
Decompose a GVariant into a native Python object.
pgi/overrides/GLib.py
def unpack(self): """Decompose a GVariant into a native Python object.""" LEAF_ACCESSORS = { 'b': self.get_boolean, 'y': self.get_byte, 'n': self.get_int16, 'q': self.get_uint16, 'i': self.get_int32, 'u': self.get_uint32, ...
def unpack(self): """Decompose a GVariant into a native Python object.""" LEAF_ACCESSORS = { 'b': self.get_boolean, 'y': self.get_byte, 'n': self.get_int16, 'q': self.get_uint16, 'i': self.get_int32, 'u': self.get_uint32, ...
[ "Decompose", "a", "GVariant", "into", "a", "native", "Python", "object", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L342-L394
[ "def", "unpack", "(", "self", ")", ":", "LEAF_ACCESSORS", "=", "{", "'b'", ":", "self", ".", "get_boolean", ",", "'y'", ":", "self", ".", "get_byte", ",", "'n'", ":", "self", ".", "get_int16", ",", "'q'", ":", "self", ".", "get_uint16", ",", "'i'", ...
2090435df6241a15ec2a78379a36b738b728652c
train
Variant.split_signature
Return a list of the element signatures of the topmost signature tuple. If the signature is not a tuple, it returns one element with the entire signature. If the signature is an empty tuple, the result is []. This is useful for e. g. iterating over method parameters which are passed as...
pgi/overrides/GLib.py
def split_signature(klass, signature): """Return a list of the element signatures of the topmost signature tuple. If the signature is not a tuple, it returns one element with the entire signature. If the signature is an empty tuple, the result is []. This is useful for e. g. iterating ...
def split_signature(klass, signature): """Return a list of the element signatures of the topmost signature tuple. If the signature is not a tuple, it returns one element with the entire signature. If the signature is an empty tuple, the result is []. This is useful for e. g. iterating ...
[ "Return", "a", "list", "of", "the", "element", "signatures", "of", "the", "topmost", "signature", "tuple", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L397-L444
[ "def", "split_signature", "(", "klass", ",", "signature", ")", ":", "if", "signature", "==", "'()'", ":", "return", "[", "]", "if", "not", "signature", ".", "startswith", "(", "'('", ")", ":", "return", "[", "signature", "]", "result", "=", "[", "]", ...
2090435df6241a15ec2a78379a36b738b728652c
train
typeinfo_to_ctypes
Maps a GITypeInfo() to a ctypes type. The ctypes types have to be different in the case of return values since ctypes does 'auto unboxing' in some cases which gives us no chance to free memory if there is a ownership transfer.
pgi/codegen/ctypes_backend/utils.py
def typeinfo_to_ctypes(info, return_value=False): """Maps a GITypeInfo() to a ctypes type. The ctypes types have to be different in the case of return values since ctypes does 'auto unboxing' in some cases which gives us no chance to free memory if there is a ownership transfer. """ tag = info...
def typeinfo_to_ctypes(info, return_value=False): """Maps a GITypeInfo() to a ctypes type. The ctypes types have to be different in the case of return values since ctypes does 'auto unboxing' in some cases which gives us no chance to free memory if there is a ownership transfer. """ tag = info...
[ "Maps", "a", "GITypeInfo", "()", "to", "a", "ctypes", "type", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/ctypes_backend/utils.py#L96-L168
[ "def", "typeinfo_to_ctypes", "(", "info", ",", "return_value", "=", "False", ")", ":", "tag", "=", "info", ".", "tag", ".", "value", "ptr", "=", "info", ".", "is_pointer", "mapping", "=", "{", "GITypeTag", ".", "BOOLEAN", ":", "gboolean", ",", "GITypeTag...
2090435df6241a15ec2a78379a36b738b728652c
train
BaseType.pack_pointer
Returns a pointer containing the value. This only works for int32/uint32/utf-8..
pgi/codegen/ctypes_backend/utils.py
def pack_pointer(self, name): """Returns a pointer containing the value. This only works for int32/uint32/utf-8.. """ return self.parse(""" raise $_.TypeError('Can\\'t convert %(type_name)s to pointer: %%r' %% $in_) """ % {"type_name": type(self).__name__}, in_=name)["in_"]
def pack_pointer(self, name): """Returns a pointer containing the value. This only works for int32/uint32/utf-8.. """ return self.parse(""" raise $_.TypeError('Can\\'t convert %(type_name)s to pointer: %%r' %% $in_) """ % {"type_name": type(self).__name__}, in_=name)["in_"]
[ "Returns", "a", "pointer", "containing", "the", "value", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/ctypes_backend/utils.py#L78-L86
[ "def", "pack_pointer", "(", "self", ",", "name", ")", ":", "return", "self", ".", "parse", "(", "\"\"\"\nraise $_.TypeError('Can\\\\'t convert %(type_name)s to pointer: %%r' %% $in_)\n\"\"\"", "%", "{", "\"type_name\"", ":", "type", "(", "self", ")", ".", "__name__", ...
2090435df6241a15ec2a78379a36b738b728652c
train
GITypelib.new_from_memory
Takes bytes and returns a GITypelib, or raises GIError
pgi/clib/gir/gitypelib.py
def new_from_memory(cls, data): """Takes bytes and returns a GITypelib, or raises GIError""" size = len(data) copy = g_memdup(data, size) ptr = cast(copy, POINTER(guint8)) try: with gerror(GIError) as error: return GITypelib._new_from_memory(ptr, size...
def new_from_memory(cls, data): """Takes bytes and returns a GITypelib, or raises GIError""" size = len(data) copy = g_memdup(data, size) ptr = cast(copy, POINTER(guint8)) try: with gerror(GIError) as error: return GITypelib._new_from_memory(ptr, size...
[ "Takes", "bytes", "and", "returns", "a", "GITypelib", "or", "raises", "GIError" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/clib/gir/gitypelib.py#L28-L39
[ "def", "new_from_memory", "(", "cls", ",", "data", ")", ":", "size", "=", "len", "(", "data", ")", "copy", "=", "g_memdup", "(", "data", ",", "size", ")", "ptr", "=", "cast", "(", "copy", ",", "POINTER", "(", "guint8", ")", ")", "try", ":", "with...
2090435df6241a15ec2a78379a36b738b728652c
train
GIBaseInfo._get_type
Get the subtype class for a pointer
pgi/cffilib/gir/gibaseinfo.py
def _get_type(cls, ptr): """Get the subtype class for a pointer""" # fall back to the base class if unknown return cls.__types.get(lib.g_base_info_get_type(ptr), cls)
def _get_type(cls, ptr): """Get the subtype class for a pointer""" # fall back to the base class if unknown return cls.__types.get(lib.g_base_info_get_type(ptr), cls)
[ "Get", "the", "subtype", "class", "for", "a", "pointer" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/cffilib/gir/gibaseinfo.py#L42-L46
[ "def", "_get_type", "(", "cls", ",", "ptr", ")", ":", "# fall back to the base class if unknown", "return", "cls", ".", "__types", ".", "get", "(", "lib", ".", "g_base_info_get_type", "(", "ptr", ")", ",", "cls", ")" ]
2090435df6241a15ec2a78379a36b738b728652c
train
add_method
Add a method to the target class
pgi/obj.py
def add_method(info, target_cls, virtual=False, dont_replace=False): """Add a method to the target class""" # escape before prefixing, like pygobject name = escape_identifier(info.name) if virtual: name = "do_" + name attr = VirtualMethodAttribute(info, target_cls, name) else: ...
def add_method(info, target_cls, virtual=False, dont_replace=False): """Add a method to the target class""" # escape before prefixing, like pygobject name = escape_identifier(info.name) if virtual: name = "do_" + name attr = VirtualMethodAttribute(info, target_cls, name) else: ...
[ "Add", "a", "method", "to", "the", "target", "class" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/obj.py#L308-L322
[ "def", "add_method", "(", "info", ",", "target_cls", ",", "virtual", "=", "False", ",", "dont_replace", "=", "False", ")", ":", "# escape before prefixing, like pygobject", "name", "=", "escape_identifier", "(", "info", ".", "name", ")", "if", "virtual", ":", ...
2090435df6241a15ec2a78379a36b738b728652c
train
InterfaceAttribute
Creates a GInterface class
pgi/obj.py
def InterfaceAttribute(iface_info): """Creates a GInterface class""" # Create a new class cls = type(iface_info.name, (InterfaceBase,), dict(_Interface.__dict__)) cls.__module__ = iface_info.namespace # GType cls.__gtype__ = PGType(iface_info.g_type) # Properties cls.props = PropertyA...
def InterfaceAttribute(iface_info): """Creates a GInterface class""" # Create a new class cls = type(iface_info.name, (InterfaceBase,), dict(_Interface.__dict__)) cls.__module__ = iface_info.namespace # GType cls.__gtype__ = PGType(iface_info.g_type) # Properties cls.props = PropertyA...
[ "Creates", "a", "GInterface", "class" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/obj.py#L341-L390
[ "def", "InterfaceAttribute", "(", "iface_info", ")", ":", "# Create a new class", "cls", "=", "type", "(", "iface_info", ".", "name", ",", "(", "InterfaceBase", ",", ")", ",", "dict", "(", "_Interface", ".", "__dict__", ")", ")", "cls", ".", "__module__", ...
2090435df6241a15ec2a78379a36b738b728652c
train
new_class_from_gtype
Create a new class for a gtype not in the gir. The caller is responsible for caching etc.
pgi/obj.py
def new_class_from_gtype(gtype): """Create a new class for a gtype not in the gir. The caller is responsible for caching etc. """ if gtype.is_a(PGType.from_name("GObject")): parent = gtype.parent.pytype if parent is None or parent == PGType.from_name("void"): return ...
def new_class_from_gtype(gtype): """Create a new class for a gtype not in the gir. The caller is responsible for caching etc. """ if gtype.is_a(PGType.from_name("GObject")): parent = gtype.parent.pytype if parent is None or parent == PGType.from_name("void"): return ...
[ "Create", "a", "new", "class", "for", "a", "gtype", "not", "in", "the", "gir", ".", "The", "caller", "is", "responsible", "for", "caching", "etc", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/obj.py#L393-L411
[ "def", "new_class_from_gtype", "(", "gtype", ")", ":", "if", "gtype", ".", "is_a", "(", "PGType", ".", "from_name", "(", "\"GObject\"", ")", ")", ":", "parent", "=", "gtype", ".", "parent", ".", "pytype", "if", "parent", "is", "None", "or", "parent", "...
2090435df6241a15ec2a78379a36b738b728652c
train
ObjectAttribute
Creates a GObject class. It inherits from the base class and all interfaces it implements.
pgi/obj.py
def ObjectAttribute(obj_info): """Creates a GObject class. It inherits from the base class and all interfaces it implements. """ if obj_info.name == "Object" and obj_info.namespace == "GObject": cls = Object else: # Get the parent class parent_obj = obj_info.get_parent() ...
def ObjectAttribute(obj_info): """Creates a GObject class. It inherits from the base class and all interfaces it implements. """ if obj_info.name == "Object" and obj_info.namespace == "GObject": cls = Object else: # Get the parent class parent_obj = obj_info.get_parent() ...
[ "Creates", "a", "GObject", "class", "." ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/obj.py#L414-L519
[ "def", "ObjectAttribute", "(", "obj_info", ")", ":", "if", "obj_info", ".", "name", "==", "\"Object\"", "and", "obj_info", ".", "namespace", "==", "\"GObject\"", ":", "cls", "=", "Object", "else", ":", "# Get the parent class", "parent_obj", "=", "obj_info", "...
2090435df6241a15ec2a78379a36b738b728652c
train
Object._generate_constructor
Get a hopefully cache constructor
pgi/obj.py
def _generate_constructor(cls, names): """Get a hopefully cache constructor""" cache = cls._constructors if names in cache: return cache[names] elif len(cache) > 3: cache.clear() func = generate_constructor(cls, names) cache[names] = func ...
def _generate_constructor(cls, names): """Get a hopefully cache constructor""" cache = cls._constructors if names in cache: return cache[names] elif len(cache) > 3: cache.clear() func = generate_constructor(cls, names) cache[names] = func ...
[ "Get", "a", "hopefully", "cache", "constructor" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/obj.py#L55-L66
[ "def", "_generate_constructor", "(", "cls", ",", "names", ")", ":", "cache", "=", "cls", ".", "_constructors", "if", "names", "in", "cache", ":", "return", "cache", "[", "names", "]", "elif", "len", "(", "cache", ")", ">", "3", ":", "cache", ".", "cl...
2090435df6241a15ec2a78379a36b738b728652c
train
Object.set_property
set_property(property_name: str, value: object) Set property *property_name* to *value*.
pgi/obj.py
def set_property(self, name, value): """set_property(property_name: str, value: object) Set property *property_name* to *value*. """ if not hasattr(self.props, name): raise TypeError("Unknown property: %r" % name) setattr(self.props, name, value)
def set_property(self, name, value): """set_property(property_name: str, value: object) Set property *property_name* to *value*. """ if not hasattr(self.props, name): raise TypeError("Unknown property: %r" % name) setattr(self.props, name, value)
[ "set_property", "(", "property_name", ":", "str", "value", ":", "object", ")" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/obj.py#L68-L76
[ "def", "set_property", "(", "self", ",", "name", ",", "value", ")", ":", "if", "not", "hasattr", "(", "self", ".", "props", ",", "name", ")", ":", "raise", "TypeError", "(", "\"Unknown property: %r\"", "%", "name", ")", "setattr", "(", "self", ".", "pr...
2090435df6241a15ec2a78379a36b738b728652c
train
Object.get_property
get_property(property_name: str) -> object Retrieves a property value.
pgi/obj.py
def get_property(self, name): """get_property(property_name: str) -> object Retrieves a property value. """ if not hasattr(self.props, name): raise TypeError("Unknown property: %r" % name) return getattr(self.props, name)
def get_property(self, name): """get_property(property_name: str) -> object Retrieves a property value. """ if not hasattr(self.props, name): raise TypeError("Unknown property: %r" % name) return getattr(self.props, name)
[ "get_property", "(", "property_name", ":", "str", ")", "-", ">", "object" ]
pygobject/pgi
python
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/obj.py#L78-L86
[ "def", "get_property", "(", "self", ",", "name", ")", ":", "if", "not", "hasattr", "(", "self", ".", "props", ",", "name", ")", ":", "raise", "TypeError", "(", "\"Unknown property: %r\"", "%", "name", ")", "return", "getattr", "(", "self", ".", "props", ...
2090435df6241a15ec2a78379a36b738b728652c