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
apply_T8
Split /ie/ sequences in syllables that do not take primary stress.
finnsyll/prev/v04.py
def apply_T8(word): '''Split /ie/ sequences in syllables that do not take primary stress.''' WORD = word offset = 0 for ie in ie_sequences(WORD): i = ie.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] offset += 1 RULE = ' T8' if word != WORD else '' return WORD,...
def apply_T8(word): '''Split /ie/ sequences in syllables that do not take primary stress.''' WORD = word offset = 0 for ie in ie_sequences(WORD): i = ie.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] offset += 1 RULE = ' T8' if word != WORD else '' return WORD,...
[ "Split", "/", "ie", "/", "sequences", "in", "syllables", "that", "do", "not", "take", "primary", "stress", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v04.py#L252-L264
[ "def", "apply_T8", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "ie", "in", "ie_sequences", "(", "WORD", ")", ":", "i", "=", "ie", ".", "start", "(", "1", ")", "+", "1", "+", "offset", "WORD", "=", "WORD", "[", ":", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
apply_T9
Split /iu/ sequences that do not appear in the first, second, or final syllables.
finnsyll/prev/v04.py
def apply_T9(word): '''Split /iu/ sequences that do not appear in the first, second, or final syllables.''' WORD = word index = 0 offset = 0 for iu in iu_sequences(WORD): if iu.start(1) != index: i = iu.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] ...
def apply_T9(word): '''Split /iu/ sequences that do not appear in the first, second, or final syllables.''' WORD = word index = 0 offset = 0 for iu in iu_sequences(WORD): if iu.start(1) != index: i = iu.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] ...
[ "Split", "/", "iu", "/", "sequences", "that", "do", "not", "appear", "in", "the", "first", "second", "or", "final", "syllables", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v04.py#L269-L285
[ "def", "apply_T9", "(", "word", ")", ":", "WORD", "=", "word", "index", "=", "0", "offset", "=", "0", "for", "iu", "in", "iu_sequences", "(", "WORD", ")", ":", "if", "iu", ".", "start", "(", "1", ")", "!=", "index", ":", "i", "=", "iu", ".", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
import_class
Returns a class from a string including module and class.
qg/core/importutils.py
def import_class(import_str): """Returns a class from a string including module and class.""" mod_str, _sep, class_str = import_str.rpartition('.') try: __import__(mod_str) return getattr(sys.modules[mod_str], class_str) except (ValueError, AttributeError): raise ImportError('Cla...
def import_class(import_str): """Returns a class from a string including module and class.""" mod_str, _sep, class_str = import_str.rpartition('.') try: __import__(mod_str) return getattr(sys.modules[mod_str], class_str) except (ValueError, AttributeError): raise ImportError('Cla...
[ "Returns", "a", "class", "from", "a", "string", "including", "module", "and", "class", "." ]
QunarOPS/qg.core
python
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/importutils.py#L24-L33
[ "def", "import_class", "(", "import_str", ")", ":", "mod_str", ",", "_sep", ",", "class_str", "=", "import_str", ".", "rpartition", "(", "'.'", ")", "try", ":", "__import__", "(", "mod_str", ")", "return", "getattr", "(", "sys", ".", "modules", "[", "mod...
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
train
import_object_ns
Tries to import object from default namespace. Imports a class and return an instance of it, first by trying to find the class in a default namespace, then failing back to a full path if not found in the default namespace.
qg/core/importutils.py
def import_object_ns(name_space, import_str, *args, **kwargs): """Tries to import object from default namespace. Imports a class and return an instance of it, first by trying to find the class in a default namespace, then failing back to a full path if not found in the default namespace. """ im...
def import_object_ns(name_space, import_str, *args, **kwargs): """Tries to import object from default namespace. Imports a class and return an instance of it, first by trying to find the class in a default namespace, then failing back to a full path if not found in the default namespace. """ im...
[ "Tries", "to", "import", "object", "from", "default", "namespace", "." ]
QunarOPS/qg.core
python
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/importutils.py#L41-L52
[ "def", "import_object_ns", "(", "name_space", ",", "import_str", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "import_value", "=", "\"%s.%s\"", "%", "(", "name_space", ",", "import_str", ")", "try", ":", "return", "import_class", "(", "import_value",...
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
train
install_virtualbox
install virtualbox
bookshelf/api_v2/vagrant.py
def install_virtualbox(distribution, force_setup=False): """ install virtualbox """ if 'ubuntu' in distribution: with hide('running', 'stdout'): sudo('DEBIAN_FRONTEND=noninteractive apt-get update') sudo("sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o " "D...
def install_virtualbox(distribution, force_setup=False): """ install virtualbox """ if 'ubuntu' in distribution: with hide('running', 'stdout'): sudo('DEBIAN_FRONTEND=noninteractive apt-get update') sudo("sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o " "D...
[ "install", "virtualbox" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/vagrant.py#L13-L54
[ "def", "install_virtualbox", "(", "distribution", ",", "force_setup", "=", "False", ")", ":", "if", "'ubuntu'", "in", "distribution", ":", "with", "hide", "(", "'running'", ",", "'stdout'", ")", ":", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive apt-get update'", ...
a6770678e735de95b194f6e6989223970db5f654
train
install_vagrant_plugin
install vagrant plugin
bookshelf/api_v2/vagrant.py
def install_vagrant_plugin(plugin, use_sudo=False): """ install vagrant plugin """ cmd = 'vagrant plugin install %s' % plugin with settings(hide('running', 'stdout')): if use_sudo: if plugin not in sudo('vagrant plugin list'): sudo(cmd) else: if plug...
def install_vagrant_plugin(plugin, use_sudo=False): """ install vagrant plugin """ cmd = 'vagrant plugin install %s' % plugin with settings(hide('running', 'stdout')): if use_sudo: if plugin not in sudo('vagrant plugin list'): sudo(cmd) else: if plug...
[ "install", "vagrant", "plugin" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/vagrant.py#L66-L77
[ "def", "install_vagrant_plugin", "(", "plugin", ",", "use_sudo", "=", "False", ")", ":", "cmd", "=", "'vagrant plugin install %s'", "%", "plugin", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "if", "use_sudo", ":", "if",...
a6770678e735de95b194f6e6989223970db5f654
train
MashSippr.runner
Run the necessary methods in the correct order
MASHsippr/mashsippr.py
def runner(self): """ Run the necessary methods in the correct order """ printtime('Starting mashsippr analysis pipeline', self.starttime) if not self.pipeline: # Create the objects to be used in the analyses objects = Objectprep(self) objects....
def runner(self): """ Run the necessary methods in the correct order """ printtime('Starting mashsippr analysis pipeline', self.starttime) if not self.pipeline: # Create the objects to be used in the analyses objects = Objectprep(self) objects....
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MASHsippr/mashsippr.py#L15-L26
[ "def", "runner", "(", "self", ")", ":", "printtime", "(", "'Starting mashsippr analysis pipeline'", ",", "self", ".", "starttime", ")", "if", "not", "self", ".", "pipeline", ":", "# Create the objects to be used in the analyses", "objects", "=", "Objectprep", "(", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
abstractDetails.cree_widgets
Create widgets and store them in self.widgets
pyDLib/GUI/common.py
def cree_widgets(self): """Create widgets and store them in self.widgets""" for t in self.FIELDS: if type(t) is str: attr, kwargs = t, {} else: attr, kwargs = t[0], t[1].copy() self.champs.append(attr) is_editable = kwargs.p...
def cree_widgets(self): """Create widgets and store them in self.widgets""" for t in self.FIELDS: if type(t) is str: attr, kwargs = t, {} else: attr, kwargs = t[0], t[1].copy() self.champs.append(attr) is_editable = kwargs.p...
[ "Create", "widgets", "and", "store", "them", "in", "self", ".", "widgets" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/common.py#L346-L369
[ "def", "cree_widgets", "(", "self", ")", ":", "for", "t", "in", "self", ".", "FIELDS", ":", "if", "type", "(", "t", ")", "is", "str", ":", "attr", ",", "kwargs", "=", "t", ",", "{", "}", "else", ":", "attr", ",", "kwargs", "=", "t", "[", "0",...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractDetails.cree_ws_lecture
Alternative to create read only widgets. They should be set after.
pyDLib/GUI/common.py
def cree_ws_lecture(self, champs_ligne): """Alternative to create read only widgets. They should be set after.""" for c in champs_ligne: label = ASSOCIATION[c][0] w = ASSOCIATION[c][3](self.acces[c], False) w.setObjectName("champ-lecture-seule-details") se...
def cree_ws_lecture(self, champs_ligne): """Alternative to create read only widgets. They should be set after.""" for c in champs_ligne: label = ASSOCIATION[c][0] w = ASSOCIATION[c][3](self.acces[c], False) w.setObjectName("champ-lecture-seule-details") se...
[ "Alternative", "to", "create", "read", "only", "widgets", ".", "They", "should", "be", "set", "after", "." ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/common.py#L371-L377
[ "def", "cree_ws_lecture", "(", "self", ",", "champs_ligne", ")", ":", "for", "c", "in", "champs_ligne", ":", "label", "=", "ASSOCIATION", "[", "c", "]", "[", "0", "]", "w", "=", "ASSOCIATION", "[", "c", "]", "[", "3", "]", "(", "self", ".", "acces"...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
preservesurrogates
Function for splitting a string into a list of characters, preserving surrogate pairs. In python 2, unicode characters above 0x10000 are stored as surrogate pairs. For example, the Unicode character u"\U0001e900" is stored as the surrogate pair u"\ud83a\udd00": s = u"AB\U0001e900CD" len(s) -> 6 l...
unicodeutil/unicodeutil.py
def preservesurrogates(s): """ Function for splitting a string into a list of characters, preserving surrogate pairs. In python 2, unicode characters above 0x10000 are stored as surrogate pairs. For example, the Unicode character u"\U0001e900" is stored as the surrogate pair u"\ud83a\udd00": s = ...
def preservesurrogates(s): """ Function for splitting a string into a list of characters, preserving surrogate pairs. In python 2, unicode characters above 0x10000 are stored as surrogate pairs. For example, the Unicode character u"\U0001e900" is stored as the surrogate pair u"\ud83a\udd00": s = ...
[ "Function", "for", "splitting", "a", "string", "into", "a", "list", "of", "characters", "preserving", "surrogate", "pairs", "." ]
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L23-L46
[ "def", "preservesurrogates", "(", "s", ")", ":", "if", "not", "isinstance", "(", "s", ",", "six", ".", "text_type", ")", ":", "raise", "TypeError", "(", "u\"String to split must be of type 'unicode'!\"", ")", "surrogates_regex_str", "=", "u\"[{0}-{1}][{2}-{3}]\"", "...
c25c882cf9cb38c123df49fad365be67e5818928
train
_unichr
Helper function for taking a Unicode scalar value and returning a Unicode character. :param s: Unicode scalar value to convert. :return: Unicode character
unicodeutil/unicodeutil.py
def _unichr(i): """ Helper function for taking a Unicode scalar value and returning a Unicode character. :param s: Unicode scalar value to convert. :return: Unicode character """ if not isinstance(i, int): raise TypeError try: return six.unichr(i) except ValueError: ...
def _unichr(i): """ Helper function for taking a Unicode scalar value and returning a Unicode character. :param s: Unicode scalar value to convert. :return: Unicode character """ if not isinstance(i, int): raise TypeError try: return six.unichr(i) except ValueError: ...
[ "Helper", "function", "for", "taking", "a", "Unicode", "scalar", "value", "and", "returning", "a", "Unicode", "character", "." ]
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L49-L62
[ "def", "_unichr", "(", "i", ")", ":", "if", "not", "isinstance", "(", "i", ",", "int", ")", ":", "raise", "TypeError", "try", ":", "return", "six", ".", "unichr", "(", "i", ")", "except", "ValueError", ":", "# Workaround the error \"ValueError: unichr() arg ...
c25c882cf9cb38c123df49fad365be67e5818928
train
_padded_hex
Helper function for taking an integer and returning a hex string. The string will be padded on the left with zeroes until the string is of the specified width. For example: _padded_hex(31, pad_width=4, uppercase=True) -> "001F" :param i: integer to convert to a hex string :param pad_width: (int spec...
unicodeutil/unicodeutil.py
def _padded_hex(i, pad_width=4, uppercase=True): """ Helper function for taking an integer and returning a hex string. The string will be padded on the left with zeroes until the string is of the specified width. For example: _padded_hex(31, pad_width=4, uppercase=True) -> "001F" :param i: integ...
def _padded_hex(i, pad_width=4, uppercase=True): """ Helper function for taking an integer and returning a hex string. The string will be padded on the left with zeroes until the string is of the specified width. For example: _padded_hex(31, pad_width=4, uppercase=True) -> "001F" :param i: integ...
[ "Helper", "function", "for", "taking", "an", "integer", "and", "returning", "a", "hex", "string", ".", "The", "string", "will", "be", "padded", "on", "the", "left", "with", "zeroes", "until", "the", "string", "is", "of", "the", "specified", "width", ".", ...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L75-L91
[ "def", "_padded_hex", "(", "i", ",", "pad_width", "=", "4", ",", "uppercase", "=", "True", ")", ":", "result", "=", "hex", "(", "i", ")", "[", "2", ":", "]", "# Remove the leading \"0x\"", "if", "uppercase", ":", "result", "=", "result", ".", "upper", ...
c25c882cf9cb38c123df49fad365be67e5818928
train
_uax44lm2transform
Helper function for taking a string (i.e. a Unicode character name) and transforming it via UAX44-LM2 loose matching rule. For more information, see <https://www.unicode.org/reports/tr44/#UAX44-LM2>. The rule is defined as follows: "UAX44-LM2. Ignore case, whitespace, underscore ('_'), and all medial hyp...
unicodeutil/unicodeutil.py
def _uax44lm2transform(s): """ Helper function for taking a string (i.e. a Unicode character name) and transforming it via UAX44-LM2 loose matching rule. For more information, see <https://www.unicode.org/reports/tr44/#UAX44-LM2>. The rule is defined as follows: "UAX44-LM2. Ignore case, whitespac...
def _uax44lm2transform(s): """ Helper function for taking a string (i.e. a Unicode character name) and transforming it via UAX44-LM2 loose matching rule. For more information, see <https://www.unicode.org/reports/tr44/#UAX44-LM2>. The rule is defined as follows: "UAX44-LM2. Ignore case, whitespac...
[ "Helper", "function", "for", "taking", "a", "string", "(", "i", ".", "e", ".", "a", "Unicode", "character", "name", ")", "and", "transforming", "it", "via", "UAX44", "-", "LM2", "loose", "matching", "rule", ".", "For", "more", "information", "see", "<htt...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L94-L135
[ "def", "_uax44lm2transform", "(", "s", ")", ":", "result", "=", "s", "# For the regex, we are using lookaround assertions to verify that there is a word character immediately before (the", "# lookbehind assertion (?<=\\w)) and immediately after (the lookahead assertion (?=\\w)) the hyphen, per t...
c25c882cf9cb38c123df49fad365be67e5818928
train
_to_unicode_scalar_value
Helper function for converting a character or surrogate pair into a Unicode scalar value e.g. "\ud800\udc00" -> 0x10000 The algorithm can be found in older versions of the Unicode Standard. https://unicode.org/versions/Unicode3.0.0/ch03.pdf, Section 3.7, D28 Unicode scalar value: a number N from 0 to...
unicodeutil/unicodeutil.py
def _to_unicode_scalar_value(s): """ Helper function for converting a character or surrogate pair into a Unicode scalar value e.g. "\ud800\udc00" -> 0x10000 The algorithm can be found in older versions of the Unicode Standard. https://unicode.org/versions/Unicode3.0.0/ch03.pdf, Section 3.7, D28 ...
def _to_unicode_scalar_value(s): """ Helper function for converting a character or surrogate pair into a Unicode scalar value e.g. "\ud800\udc00" -> 0x10000 The algorithm can be found in older versions of the Unicode Standard. https://unicode.org/versions/Unicode3.0.0/ch03.pdf, Section 3.7, D28 ...
[ "Helper", "function", "for", "converting", "a", "character", "or", "surrogate", "pair", "into", "a", "Unicode", "scalar", "value", "e", ".", "g", ".", "\\", "ud800", "\\", "udc00", "-", ">", "0x10000" ]
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L138-L162
[ "def", "_to_unicode_scalar_value", "(", "s", ")", ":", "if", "len", "(", "s", ")", "==", "1", ":", "return", "ord", "(", "s", ")", "elif", "len", "(", "s", ")", "==", "2", ":", "return", "(", "ord", "(", "s", "[", "0", "]", ")", "-", "0xD800"...
c25c882cf9cb38c123df49fad365be67e5818928
train
_get_nr_prefix
Helper function for looking up the derived name prefix associated with a Unicode scalar value. :param i: Unicode scalar value. :return: String with the derived name prefix.
unicodeutil/unicodeutil.py
def _get_nr_prefix(i): """ Helper function for looking up the derived name prefix associated with a Unicode scalar value. :param i: Unicode scalar value. :return: String with the derived name prefix. """ for lookup_range, prefix_string in _nr_prefix_strings.items(): if i in lookup_range...
def _get_nr_prefix(i): """ Helper function for looking up the derived name prefix associated with a Unicode scalar value. :param i: Unicode scalar value. :return: String with the derived name prefix. """ for lookup_range, prefix_string in _nr_prefix_strings.items(): if i in lookup_range...
[ "Helper", "function", "for", "looking", "up", "the", "derived", "name", "prefix", "associated", "with", "a", "Unicode", "scalar", "value", "." ]
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L198-L208
[ "def", "_get_nr_prefix", "(", "i", ")", ":", "for", "lookup_range", ",", "prefix_string", "in", "_nr_prefix_strings", ".", "items", "(", ")", ":", "if", "i", "in", "lookup_range", ":", "return", "prefix_string", "raise", "ValueError", "(", "\"No prefix string as...
c25c882cf9cb38c123df49fad365be67e5818928
train
casefold
Function for performing case folding. This function will take the input string s and return a copy of the string suitable for caseless comparisons. The input string must be of type 'unicode', otherwise a TypeError will be raised. For more information on case folding, see section 3.13 of the Unicode St...
unicodeutil/unicodeutil.py
def casefold(s, fullcasefold=True, useturkicmapping=False): """ Function for performing case folding. This function will take the input string s and return a copy of the string suitable for caseless comparisons. The input string must be of type 'unicode', otherwise a TypeError will be raised. ...
def casefold(s, fullcasefold=True, useturkicmapping=False): """ Function for performing case folding. This function will take the input string s and return a copy of the string suitable for caseless comparisons. The input string must be of type 'unicode', otherwise a TypeError will be raised. ...
[ "Function", "for", "performing", "case", "folding", ".", "This", "function", "will", "take", "the", "input", "string", "s", "and", "return", "a", "copy", "of", "the", "string", "suitable", "for", "caseless", "comparisons", ".", "The", "input", "string", "mus...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L522-L560
[ "def", "casefold", "(", "s", ",", "fullcasefold", "=", "True", ",", "useturkicmapping", "=", "False", ")", ":", "if", "not", "isinstance", "(", "s", ",", "six", ".", "text_type", ")", ":", "raise", "TypeError", "(", "u\"String to casefold must be of type 'unic...
c25c882cf9cb38c123df49fad365be67e5818928
train
UnicodeData._build_unicode_character_database
Function for parsing the Unicode character data from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/
unicodeutil/unicodeutil.py
def _build_unicode_character_database(self): """ Function for parsing the Unicode character data from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/ """ filename = "Uni...
def _build_unicode_character_database(self): """ Function for parsing the Unicode character data from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/ """ filename = "Uni...
[ "Function", "for", "parsing", "the", "Unicode", "character", "data", "from", "the", "Unicode", "Character", "Database", "(", "UCD", ")", "and", "generating", "a", "lookup", "table", ".", "For", "more", "info", "on", "the", "UCD", "see", "the", "following", ...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L228-L278
[ "def", "_build_unicode_character_database", "(", "self", ")", ":", "filename", "=", "\"UnicodeData.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "tag", "=", "re", ".", "com...
c25c882cf9cb38c123df49fad365be67e5818928
train
UnicodeData.lookup_by_name
Function for retrieving the UnicodeCharacter associated with a name. The name lookup uses the loose matching rule UAX44-LM2 for loose matching. See the following for more info: https://www.unicode.org/reports/tr44/#UAX44-LM2 For example: ucd = UnicodeData() ucd.lookup_by_nam...
unicodeutil/unicodeutil.py
def lookup_by_name(self, name): """ Function for retrieving the UnicodeCharacter associated with a name. The name lookup uses the loose matching rule UAX44-LM2 for loose matching. See the following for more info: https://www.unicode.org/reports/tr44/#UAX44-LM2 For example: ...
def lookup_by_name(self, name): """ Function for retrieving the UnicodeCharacter associated with a name. The name lookup uses the loose matching rule UAX44-LM2 for loose matching. See the following for more info: https://www.unicode.org/reports/tr44/#UAX44-LM2 For example: ...
[ "Function", "for", "retrieving", "the", "UnicodeCharacter", "associated", "with", "a", "name", ".", "The", "name", "lookup", "uses", "the", "loose", "matching", "rule", "UAX44", "-", "LM2", "for", "loose", "matching", ".", "See", "the", "following", "for", "...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L339-L359
[ "def", "lookup_by_name", "(", "self", ",", "name", ")", ":", "try", ":", "return", "self", ".", "_name_database", "[", "_uax44lm2transform", "(", "name", ")", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "u\"Unknown character name: '{0}'!\"", ".", ...
c25c882cf9cb38c123df49fad365be67e5818928
train
UnicodeData.lookup_by_partial_name
Similar to lookup_by_name(name), this method uses loose matching rule UAX44-LM2 to attempt to find the UnicodeCharacter associated with a name. However, it attempts to permit even looser matching by doing a substring search instead of a simple match. This method will return a generator that yields ins...
unicodeutil/unicodeutil.py
def lookup_by_partial_name(self, partial_name): """ Similar to lookup_by_name(name), this method uses loose matching rule UAX44-LM2 to attempt to find the UnicodeCharacter associated with a name. However, it attempts to permit even looser matching by doing a substring search instead of ...
def lookup_by_partial_name(self, partial_name): """ Similar to lookup_by_name(name), this method uses loose matching rule UAX44-LM2 to attempt to find the UnicodeCharacter associated with a name. However, it attempts to permit even looser matching by doing a substring search instead of ...
[ "Similar", "to", "lookup_by_name", "(", "name", ")", "this", "method", "uses", "loose", "matching", "rule", "UAX44", "-", "LM2", "to", "attempt", "to", "find", "the", "UnicodeCharacter", "associated", "with", "a", "name", ".", "However", "it", "attempts", "t...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L361-L383
[ "def", "lookup_by_partial_name", "(", "self", ",", "partial_name", ")", ":", "for", "k", ",", "v", "in", "self", ".", "_name_database", ".", "items", "(", ")", ":", "if", "_uax44lm2transform", "(", "partial_name", ")", "in", "k", ":", "yield", "v" ]
c25c882cf9cb38c123df49fad365be67e5818928
train
UnicodeBlocks._load_unicode_block_info
Function for parsing the Unicode block info from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/
unicodeutil/unicodeutil.py
def _load_unicode_block_info(self): """ Function for parsing the Unicode block info from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/ """ filename = "Blocks.txt" ...
def _load_unicode_block_info(self): """ Function for parsing the Unicode block info from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/ """ filename = "Blocks.txt" ...
[ "Function", "for", "parsing", "the", "Unicode", "block", "info", "from", "the", "Unicode", "Character", "Database", "(", "UCD", ")", "and", "generating", "a", "lookup", "table", ".", "For", "more", "info", "on", "the", "UCD", "see", "the", "following", "we...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L394-L409
[ "def", "_load_unicode_block_info", "(", "self", ")", ":", "filename", "=", "\"Blocks.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "codecs", ".", "open", "(", "os...
c25c882cf9cb38c123df49fad365be67e5818928
train
CaseFoldingMap._build_casefold_map
Function for parsing the case folding data from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/
unicodeutil/unicodeutil.py
def _build_casefold_map(self): """ Function for parsing the case folding data from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/ """ self._casefold_map = defaultdict(d...
def _build_casefold_map(self): """ Function for parsing the case folding data from the Unicode Character Database (UCD) and generating a lookup table. For more info on the UCD, see the following website: https://www.unicode.org/ucd/ """ self._casefold_map = defaultdict(d...
[ "Function", "for", "parsing", "the", "case", "folding", "data", "from", "the", "Unicode", "Character", "Database", "(", "UCD", ")", "and", "generating", "a", "lookup", "table", ".", "For", "more", "info", "on", "the", "UCD", "see", "the", "following", "web...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L473-L489
[ "def", "_build_casefold_map", "(", "self", ")", ":", "self", ".", "_casefold_map", "=", "defaultdict", "(", "dict", ")", "filename", "=", "\"CaseFolding.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", ...
c25c882cf9cb38c123df49fad365be67e5818928
train
CaseFoldingMap.lookup
Function to lookup a character in the casefold map. The casefold map has four sub-tables, the 'C' or common table, the 'F' or full table, the 'S' or simple table and the 'T' or the Turkic special case table. These tables correspond to the statuses defined in the CaseFolding.txt file. ...
unicodeutil/unicodeutil.py
def lookup(self, c, lookup_order="CF"): """ Function to lookup a character in the casefold map. The casefold map has four sub-tables, the 'C' or common table, the 'F' or full table, the 'S' or simple table and the 'T' or the Turkic special case table. These tables correspond to...
def lookup(self, c, lookup_order="CF"): """ Function to lookup a character in the casefold map. The casefold map has four sub-tables, the 'C' or common table, the 'F' or full table, the 'S' or simple table and the 'T' or the Turkic special case table. These tables correspond to...
[ "Function", "to", "lookup", "a", "character", "in", "the", "casefold", "map", "." ]
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L491-L516
[ "def", "lookup", "(", "self", ",", "c", ",", "lookup_order", "=", "\"CF\"", ")", ":", "if", "not", "isinstance", "(", "c", ",", "six", ".", "text_type", ")", ":", "raise", "TypeError", "(", "u\"Character to lookup must be of type 'unicode'!\"", ")", "for", "...
c25c882cf9cb38c123df49fad365be67e5818928
train
RegistryResponse.load_from_json
Load a :class:`RegistryReponse` from a dictionary or a string (that will be parsed as json).
pyramid_urireferencer/models.py
def load_from_json(data): """ Load a :class:`RegistryReponse` from a dictionary or a string (that will be parsed as json). """ if isinstance(data, str): data = json.loads(data) applications = [ ApplicationResponse.load_from_json(a) for a in data['a...
def load_from_json(data): """ Load a :class:`RegistryReponse` from a dictionary or a string (that will be parsed as json). """ if isinstance(data, str): data = json.loads(data) applications = [ ApplicationResponse.load_from_json(a) for a in data['a...
[ "Load", "a", ":", "class", ":", "RegistryReponse", "from", "a", "dictionary", "or", "a", "string", "(", "that", "will", "be", "parsed", "as", "json", ")", "." ]
OnroerendErfgoed/pyramid_urireferencer
python
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/models.py#L26-L39
[ "def", "load_from_json", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "str", ")", ":", "data", "=", "json", ".", "loads", "(", "data", ")", "applications", "=", "[", "ApplicationResponse", ".", "load_from_json", "(", "a", ")", "for", "a...
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
train
ApplicationResponse.load_from_json
Load a :class:`ApplicationResponse` from a dictionary or string (that will be parsed as json).
pyramid_urireferencer/models.py
def load_from_json(data): """ Load a :class:`ApplicationResponse` from a dictionary or string (that will be parsed as json). """ if isinstance(data, str): data = json.loads(data) items = [Item.load_from_json(a) for a in data['items']] if data['items'] is not N...
def load_from_json(data): """ Load a :class:`ApplicationResponse` from a dictionary or string (that will be parsed as json). """ if isinstance(data, str): data = json.loads(data) items = [Item.load_from_json(a) for a in data['items']] if data['items'] is not N...
[ "Load", "a", ":", "class", ":", "ApplicationResponse", "from", "a", "dictionary", "or", "string", "(", "that", "will", "be", "parsed", "as", "json", ")", "." ]
OnroerendErfgoed/pyramid_urireferencer
python
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/models.py#L76-L87
[ "def", "load_from_json", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "str", ")", ":", "data", "=", "json", ".", "loads", "(", "data", ")", "items", "=", "[", "Item", ".", "load_from_json", "(", "a", ")", "for", "a", "in", "data", ...
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
train
Item.load_from_json
Load a :class:`Item` from a dictionary ot string (that will be parsed as json)
pyramid_urireferencer/models.py
def load_from_json(data): """ Load a :class:`Item` from a dictionary ot string (that will be parsed as json) """ if isinstance(data, str): data = json.loads(data) return Item(data['title'], data['uri'])
def load_from_json(data): """ Load a :class:`Item` from a dictionary ot string (that will be parsed as json) """ if isinstance(data, str): data = json.loads(data) return Item(data['title'], data['uri'])
[ "Load", "a", ":", "class", ":", "Item", "from", "a", "dictionary", "ot", "string", "(", "that", "will", "be", "parsed", "as", "json", ")" ]
OnroerendErfgoed/pyramid_urireferencer
python
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/models.py#L114-L121
[ "def", "load_from_json", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "str", ")", ":", "data", "=", "json", ".", "loads", "(", "data", ")", "return", "Item", "(", "data", "[", "'title'", "]", ",", "data", "[", "'uri'", "]", ")" ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
train
apply_T11
If a VVV sequence contains a /u, y/-final diphthong and the third vowel is /i/, there is a syllable boundary between the diphthong and /i/.
finnsyll/prev/v11.py
def apply_T11(word): '''If a VVV sequence contains a /u, y/-final diphthong and the third vowel is /i/, there is a syllable boundary between the diphthong and /i/.''' WORD = word offset = 0 for vvv in t11_vvv_sequences(WORD): # i = vvv.start(1) + (1 if vvv.group(1).startswith('i') else 2) +...
def apply_T11(word): '''If a VVV sequence contains a /u, y/-final diphthong and the third vowel is /i/, there is a syllable boundary between the diphthong and /i/.''' WORD = word offset = 0 for vvv in t11_vvv_sequences(WORD): # i = vvv.start(1) + (1 if vvv.group(1).startswith('i') else 2) +...
[ "If", "a", "VVV", "sequence", "contains", "a", "/", "u", "y", "/", "-", "final", "diphthong", "and", "the", "third", "vowel", "is", "/", "i", "/", "there", "is", "a", "syllable", "boundary", "between", "the", "diphthong", "and", "/", "i", "/", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v11.py#L347-L361
[ "def", "apply_T11", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vvv", "in", "t11_vvv_sequences", "(", "WORD", ")", ":", "# i = vvv.start(1) + (1 if vvv.group(1).startswith('i') else 2) + offset", "i", "=", "vvv", ".", "start", "(", "1...
6a42740311688c946a636a3e2304866c7aa041b3
train
apply_T12
There is a syllable boundary within a VV sequence of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].
finnsyll/prev/v11.py
def apply_T12(word): '''There is a syllable boundary within a VV sequence of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].''' WORD = word offset = 0 for vv in new_vv(WORD): # import pdb; pdb.set_trace() seq = vv.group(1) if not is_diph...
def apply_T12(word): '''There is a syllable boundary within a VV sequence of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].''' WORD = word offset = 0 for vv in new_vv(WORD): # import pdb; pdb.set_trace() seq = vv.group(1) if not is_diph...
[ "There", "is", "a", "syllable", "boundary", "within", "a", "VV", "sequence", "of", "two", "nonidentical", "vowels", "that", "are", "not", "a", "genuine", "diphthong", "e", ".", "g", ".", "[", "ta", ".", "e", "]", "[", "ko", ".", "et", ".", "taa", "...
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v11.py#L366-L383
[ "def", "apply_T12", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vv", "in", "new_vv", "(", "WORD", ")", ":", "# import pdb; pdb.set_trace()", "seq", "=", "vv", ".", "group", "(", "1", ")", "if", "not", "is_diphthong", "(", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
_syllabify_simplex
Syllabify the given word.
finnsyll/prev/v09.py
def _syllabify_simplex(word): '''Syllabify the given word.''' word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) rules += T2 + T8 + T9 # T4 produc...
def _syllabify_simplex(word): '''Syllabify the given word.''' word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) rules += T2 + T8 + T9 # T4 produc...
[ "Syllabify", "the", "given", "word", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v09.py#L66-L95
[ "def", "_syllabify_simplex", "(", "word", ")", ":", "word", ",", "rules", "=", "apply_T1", "(", "word", ")", "if", "re", ".", "search", "(", "r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*'", ",", "word", ")", ":", "word", ",", "T2", "=", "apply_T2", "(", "word...
6a42740311688c946a636a3e2304866c7aa041b3
train
apply_T9
Split /iu/ sequences that do not appear in the first or second syllables. Split /iu/ sequences in the final syllable iff the final syllable would receive stress.
finnsyll/prev/v09.py
def apply_T9(word): '''Split /iu/ sequences that do not appear in the first or second syllables. Split /iu/ sequences in the final syllable iff the final syllable would receive stress.''' WORD = word index = 0 offset = 0 for iu in iu_sequences(WORD): if iu.start(1) != index: ...
def apply_T9(word): '''Split /iu/ sequences that do not appear in the first or second syllables. Split /iu/ sequences in the final syllable iff the final syllable would receive stress.''' WORD = word index = 0 offset = 0 for iu in iu_sequences(WORD): if iu.start(1) != index: ...
[ "Split", "/", "iu", "/", "sequences", "that", "do", "not", "appear", "in", "the", "first", "or", "second", "syllables", ".", "Split", "/", "iu", "/", "sequences", "in", "the", "final", "syllable", "iff", "the", "final", "syllable", "would", "receive", "s...
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v09.py#L323-L349
[ "def", "apply_T9", "(", "word", ")", ":", "WORD", "=", "word", "index", "=", "0", "offset", "=", "0", "for", "iu", "in", "iu_sequences", "(", "WORD", ")", ":", "if", "iu", ".", "start", "(", "1", ")", "!=", "index", ":", "i", "=", "iu", ".", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
apply_T10
Any /iou/ sequence contains a syllable boundary between the first and second vowel.
finnsyll/prev/v09.py
def apply_T10(word): '''Any /iou/ sequence contains a syllable boundary between the first and second vowel.''' WORD = word offset = 0 for iou in iou_sequences(WORD): i = iou.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] offset += 1 RULE = ' T10' if word != WORD...
def apply_T10(word): '''Any /iou/ sequence contains a syllable boundary between the first and second vowel.''' WORD = word offset = 0 for iou in iou_sequences(WORD): i = iou.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] offset += 1 RULE = ' T10' if word != WORD...
[ "Any", "/", "iou", "/", "sequence", "contains", "a", "syllable", "boundary", "between", "the", "first", "and", "second", "vowel", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v09.py#L354-L367
[ "def", "apply_T10", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "iou", "in", "iou_sequences", "(", "WORD", ")", ":", "i", "=", "iou", ".", "start", "(", "1", ")", "+", "1", "+", "offset", "WORD", "=", "WORD", "[", ":"...
6a42740311688c946a636a3e2304866c7aa041b3
train
T1
Insert a syllable boundary in front of every CV sequence.
finnsyll/v13.py
def T1(word): '''Insert a syllable boundary in front of every CV sequence.''' # split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n'] WORD = [i for i in re.split(r'([ieaouäöy]+)', word, flags=FLAGS) if i] # keep track of which sub-rules are applying sub_rules = set() # a count ...
def T1(word): '''Insert a syllable boundary in front of every CV sequence.''' # split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n'] WORD = [i for i in re.split(r'([ieaouäöy]+)', word, flags=FLAGS) if i] # keep track of which sub-rules are applying sub_rules = set() # a count ...
[ "Insert", "a", "syllable", "boundary", "in", "front", "of", "every", "CV", "sequence", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L80-L158
[ "def", "T1", "(", "word", ")", ":", "# split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n']", "WORD", "=", "[", "i", "for", "i", "in", "re", ".", "split", "(", "r'([ieaouäöy]+)', ", "w", "rd, ", "f", "ags=F", "L", "AGS) ", "i", " i", "", "", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
T2
Split any VV sequence that is not a genuine diphthong or long vowel. E.g., [ta.e], [ko.et.taa]. This rule can apply within VVV+ sequences.
finnsyll/v13.py
def T2(word, rules): '''Split any VV sequence that is not a genuine diphthong or long vowel. E.g., [ta.e], [ko.et.taa]. This rule can apply within VVV+ sequences.''' WORD = word offset = 0 for vv in vv_sequences(WORD): seq = vv.group(1) if not phon.is_diphthong(seq) and not phon.is...
def T2(word, rules): '''Split any VV sequence that is not a genuine diphthong or long vowel. E.g., [ta.e], [ko.et.taa]. This rule can apply within VVV+ sequences.''' WORD = word offset = 0 for vv in vv_sequences(WORD): seq = vv.group(1) if not phon.is_diphthong(seq) and not phon.is...
[ "Split", "any", "VV", "sequence", "that", "is", "not", "a", "genuine", "diphthong", "or", "long", "vowel", ".", "E", ".", "g", ".", "[", "ta", ".", "e", "]", "[", "ko", ".", "et", ".", "taa", "]", ".", "This", "rule", "can", "apply", "within", ...
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L163-L179
[ "def", "T2", "(", "word", ",", "rules", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vv", "in", "vv_sequences", "(", "WORD", ")", ":", "seq", "=", "vv", ".", "group", "(", "1", ")", "if", "not", "phon", ".", "is_diphthong", "(", "...
6a42740311688c946a636a3e2304866c7aa041b3
train
T4
Optionally split /u,y/-final diphthongs that do not take primary stress. E.g., [lau.ka.us], [va.ka.ut.taa].
finnsyll/v13.py
def T4(word, rules): '''Optionally split /u,y/-final diphthongs that do not take primary stress. E.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = re.split( r'([ieaouäöy]+[^ieaouäöy]+\.*[ieaoäö]{1}(?:u|y)(?:\.*[^ieaouäöy]+|$))', # noqa word, flags=re.I | re.U) PARTS = [[] for part in range(...
def T4(word, rules): '''Optionally split /u,y/-final diphthongs that do not take primary stress. E.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = re.split( r'([ieaouäöy]+[^ieaouäöy]+\.*[ieaoäö]{1}(?:u|y)(?:\.*[^ieaouäöy]+|$))', # noqa word, flags=re.I | re.U) PARTS = [[] for part in range(...
[ "Optionally", "split", "/", "u", "y", "/", "-", "final", "diphthongs", "that", "do", "not", "take", "primary", "stress", ".", "E", ".", "g", ".", "[", "lau", ".", "ka", ".", "us", "]", "[", "va", ".", "ka", ".", "ut", ".", "taa", "]", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L190-L217
[ "def", "T4", "(", "word", ",", "rules", ")", ":", "WORD", "=", "re", ".", "split", "(", "r'([ieaouäöy]+[^ieaouäöy]+\\.*[ieaoäö]{1}(?:u|y)(?:\\.*[^ieaouäöy]+|$))', # noq", "a", "", "word", ",", "flags", "=", "re", ".", "I", "|", "re", ".", "U", ")", "PARTS",...
6a42740311688c946a636a3e2304866c7aa041b3
train
T6
If a VVV-sequence contains a long vowel, insert a syllable boundary between it and the third vowel. E.g. [kor.ke.aa], [yh.ti.öön], [ruu.an], [mää.yt.te].
finnsyll/v13.py
def T6(word, rules): '''If a VVV-sequence contains a long vowel, insert a syllable boundary between it and the third vowel. E.g. [kor.ke.aa], [yh.ti.öön], [ruu.an], [mää.yt.te].''' offset = 0 try: WORD, rest = tuple(word.split('.', 1)) for vvv in long_vowel_sequences(rest): ...
def T6(word, rules): '''If a VVV-sequence contains a long vowel, insert a syllable boundary between it and the third vowel. E.g. [kor.ke.aa], [yh.ti.öön], [ruu.an], [mää.yt.te].''' offset = 0 try: WORD, rest = tuple(word.split('.', 1)) for vvv in long_vowel_sequences(rest): ...
[ "If", "a", "VVV", "-", "sequence", "contains", "a", "long", "vowel", "insert", "a", "syllable", "boundary", "between", "it", "and", "the", "third", "vowel", ".", "E", ".", "g", ".", "[", "kor", ".", "ke", ".", "aa", "]", "[", "yh", ".", "ti", "."...
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L222-L253
[ "def", "T6", "(", "word", ",", "rules", ")", ":", "offset", "=", "0", "try", ":", "WORD", ",", "rest", "=", "tuple", "(", "word", ".", "split", "(", "'.'", ",", "1", ")", ")", "for", "vvv", "in", "long_vowel_sequences", "(", "rest", ")", ":", "...
6a42740311688c946a636a3e2304866c7aa041b3
train
T8
Join /ie/, /uo/, or /yö/ sequences in syllables that take primary stress.
finnsyll/v13.py
def T8(word, rules): '''Join /ie/, /uo/, or /yö/ sequences in syllables that take primary stress.''' WORD = word try: vv = tail_diphthongs(WORD) i = vv.start(1) + 1 WORD = WORD[:i] + word[i + 1:] except AttributeError: pass rules += ' T8' if word != WORD else '...
def T8(word, rules): '''Join /ie/, /uo/, or /yö/ sequences in syllables that take primary stress.''' WORD = word try: vv = tail_diphthongs(WORD) i = vv.start(1) + 1 WORD = WORD[:i] + word[i + 1:] except AttributeError: pass rules += ' T8' if word != WORD else '...
[ "Join", "/", "ie", "/", "/", "uo", "/", "or", "/", "yö", "/", "sequences", "in", "syllables", "that", "take", "primary", "stress", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L258-L273
[ "def", "T8", "(", "word", ",", "rules", ")", ":", "WORD", "=", "word", "try", ":", "vv", "=", "tail_diphthongs", "(", "WORD", ")", "i", "=", "vv", ".", "start", "(", "1", ")", "+", "1", "WORD", "=", "WORD", "[", ":", "i", "]", "+", "word", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
T11
If a VVV sequence contains a /u,y/-final diphthong, insert a syllable boundary between the diphthong and the third vowel.
finnsyll/v13.py
def T11(word, rules): '''If a VVV sequence contains a /u,y/-final diphthong, insert a syllable boundary between the diphthong and the third vowel.''' WORD = word offset = 0 for vvv in precedence_sequences(WORD): i = vvv.start(1) + (1 if vvv.group(1)[-1] in 'uyUY' else 2) + offset WO...
def T11(word, rules): '''If a VVV sequence contains a /u,y/-final diphthong, insert a syllable boundary between the diphthong and the third vowel.''' WORD = word offset = 0 for vvv in precedence_sequences(WORD): i = vvv.start(1) + (1 if vvv.group(1)[-1] in 'uyUY' else 2) + offset WO...
[ "If", "a", "VVV", "sequence", "contains", "a", "/", "u", "y", "/", "-", "final", "diphthong", "insert", "a", "syllable", "boundary", "between", "the", "diphthong", "and", "the", "third", "vowel", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L278-L291
[ "def", "T11", "(", "word", ",", "rules", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vvv", "in", "precedence_sequences", "(", "WORD", ")", ":", "i", "=", "vvv", ".", "start", "(", "1", ")", "+", "(", "1", "if", "vvv", ".", "group...
6a42740311688c946a636a3e2304866c7aa041b3
train
pk_prom
Return the number of stressed light syllables.
finnsyll/v13.py
def pk_prom(word): '''Return the number of stressed light syllables.''' violations = 0 stressed = [] for w in extract_words(word): stressed += w.split('.')[2:-1:2] # odd syllables, excl. word-initial # (CVV = light) for syll in stressed: if phon.is_vowel(syll[-1]): ...
def pk_prom(word): '''Return the number of stressed light syllables.''' violations = 0 stressed = [] for w in extract_words(word): stressed += w.split('.')[2:-1:2] # odd syllables, excl. word-initial # (CVV = light) for syll in stressed: if phon.is_vowel(syll[-1]): ...
[ "Return", "the", "number", "of", "stressed", "light", "syllables", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L373-L392
[ "def", "pk_prom", "(", "word", ")", ":", "violations", "=", "0", "stressed", "=", "[", "]", "for", "w", "in", "extract_words", "(", "word", ")", ":", "stressed", "+=", "w", ".", "split", "(", "'.'", ")", "[", "2", ":", "-", "1", ":", "2", "]", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
rank
Rank syllabifications.
finnsyll/v13.py
def rank(syllabifications): '''Rank syllabifications.''' # def key(s): # word = s[0] # w = wsp(word) # p = pk_prom(word) # n = nuc(word) # t = w + p + n # print('%s\twsp: %s\tpk: %s\tnuc: %s\ttotal: %s' % (word, w, p, n, t)) # return w + p + n # syl...
def rank(syllabifications): '''Rank syllabifications.''' # def key(s): # word = s[0] # w = wsp(word) # p = pk_prom(word) # n = nuc(word) # t = w + p + n # print('%s\twsp: %s\tpk: %s\tnuc: %s\ttotal: %s' % (word, w, p, n, t)) # return w + p + n # syl...
[ "Rank", "syllabifications", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L400-L417
[ "def", "rank", "(", "syllabifications", ")", ":", "# def key(s):", "# word = s[0]", "# w = wsp(word)", "# p = pk_prom(word)", "# n = nuc(word)", "# t = w + p + n", "# print('%s\\twsp: %s\\tpk: %s\\tnuc: %s\\ttotal: %s' % (word, w, p, n, t))", "# return w + p + n...
6a42740311688c946a636a3e2304866c7aa041b3
train
CodecImage.ansi_format_iter
Return the ANSI escape sequence to render the image. x_start Offset from the left of the image data to render from. Defaults to 0. y_start Offset from the top of the image data to render from. Defaults to 0. width Width of the image data to render. Defaults...
mrcrowbar/lib/images/base.py
def ansi_format_iter( self, x_start=0, y_start=0, width=None, height=None, frame=0, columns=1, downsample=1 ): """Return the ANSI escape sequence to render the image. x_start Offset from the left of the image data to render from. Defaults to 0. y_start Offset from the t...
def ansi_format_iter( self, x_start=0, y_start=0, width=None, height=None, frame=0, columns=1, downsample=1 ): """Return the ANSI escape sequence to render the image. x_start Offset from the left of the image data to render from. Defaults to 0. y_start Offset from the t...
[ "Return", "the", "ANSI", "escape", "sequence", "to", "render", "the", "image", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/lib/images/base.py#L87-L139
[ "def", "ansi_format_iter", "(", "self", ",", "x_start", "=", "0", ",", "y_start", "=", "0", ",", "width", "=", "None", ",", "height", "=", "None", ",", "frame", "=", "0", ",", "columns", "=", "1", ",", "downsample", "=", "1", ")", ":", "image", "...
b1ed882c4555552e7656b2d84aca543184577fa3
train
IndexedImage.ansi_format_iter
Return the ANSI escape sequence to render the image. x_start Offset from the left of the image data to render from. Defaults to 0. y_start Offset from the top of the image data to render from. Defaults to 0. width Width of the image data to render. Defaults...
mrcrowbar/lib/images/base.py
def ansi_format_iter( self, x_start=0, y_start=0, width=None, height=None, frame=0, columns=1, downsample=1, frame_index=None, frame_flip_v=0, frame_flip_h=0 ): """Return the ANSI escape sequence to render the image. x_start Offset from the left of the image data to render from. Defaults to...
def ansi_format_iter( self, x_start=0, y_start=0, width=None, height=None, frame=0, columns=1, downsample=1, frame_index=None, frame_flip_v=0, frame_flip_h=0 ): """Return the ANSI escape sequence to render the image. x_start Offset from the left of the image data to render from. Defaults to...
[ "Return", "the", "ANSI", "escape", "sequence", "to", "render", "the", "image", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/lib/images/base.py#L192-L270
[ "def", "ansi_format_iter", "(", "self", ",", "x_start", "=", "0", ",", "y_start", "=", "0", ",", "width", "=", "None", ",", "height", "=", "None", ",", "frame", "=", "0", ",", "columns", "=", "1", ",", "downsample", "=", "1", ",", "frame_index", "=...
b1ed882c4555552e7656b2d84aca543184577fa3
train
main
Purge a single fastly url
bin/fastly_purge_url.py
def main(): """ Purge a single fastly url """ parser = OptionParser(description= "Purge a single url from fastly.") parser.add_option("-k", "--key", dest="apikey", default="", help="fastly api key") parser.add_option("-H", "--host", dest="host", ...
def main(): """ Purge a single fastly url """ parser = OptionParser(description= "Purge a single url from fastly.") parser.add_option("-k", "--key", dest="apikey", default="", help="fastly api key") parser.add_option("-H", "--host", dest="host", ...
[ "Purge", "a", "single", "fastly", "url" ]
obulpathi/cdn-fastly-python
python
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/bin/fastly_purge_url.py#L34-L57
[ "def", "main", "(", ")", ":", "parser", "=", "OptionParser", "(", "description", "=", "\"Purge a single url from fastly.\"", ")", "parser", ".", "add_option", "(", "\"-k\"", ",", "\"--key\"", ",", "dest", "=", "\"apikey\"", ",", "default", "=", "\"\"", ",", ...
db2564b047e8af4bce72c3b88d6c27d3d0291425
train
abstractModule.set_callbacks
Register callbacks needed by the interface object
pyDLib/GUI/tabs.py
def set_callbacks(self, **dic_functions): """Register callbacks needed by the interface object""" for action in self.interface.CALLBACKS: try: f = dic_functions[action] except KeyError: pass else: setattr(self.interface....
def set_callbacks(self, **dic_functions): """Register callbacks needed by the interface object""" for action in self.interface.CALLBACKS: try: f = dic_functions[action] except KeyError: pass else: setattr(self.interface....
[ "Register", "callbacks", "needed", "by", "the", "interface", "object" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/tabs.py#L37-L53
[ "def", "set_callbacks", "(", "self", ",", "*", "*", "dic_functions", ")", ":", "for", "action", "in", "self", ".", "interface", ".", "CALLBACKS", ":", "try", ":", "f", "=", "dic_functions", "[", "action", "]", "except", "KeyError", ":", "pass", "else", ...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
Configurable.populate
Set attributes in ``obj`` with ``setattr`` from the all values in ``section``.
src/python/zensols/actioncli/config.py
def populate(self, obj=None, section=None, parse_types=True): """Set attributes in ``obj`` with ``setattr`` from the all values in ``section``. """ section = self.default_section if section is None else section obj = Settings() if obj is None else obj is_dict = isinstanc...
def populate(self, obj=None, section=None, parse_types=True): """Set attributes in ``obj`` with ``setattr`` from the all values in ``section``. """ section = self.default_section if section is None else section obj = Settings() if obj is None else obj is_dict = isinstanc...
[ "Set", "attributes", "in", "obj", "with", "setattr", "from", "the", "all", "values", "in", "section", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L49-L77
[ "def", "populate", "(", "self", ",", "obj", "=", "None", ",", "section", "=", "None", ",", "parse_types", "=", "True", ")", ":", "section", "=", "self", ".", "default_section", "if", "section", "is", "None", "else", "section", "obj", "=", "Settings", "...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Configurable._get_calling_module
Get the last module in the call stack that is not this module or ``None`` if the call originated from this module.
src/python/zensols/actioncli/config.py
def _get_calling_module(self): """Get the last module in the call stack that is not this module or ``None`` if the call originated from this module. """ for frame in inspect.stack(): mod = inspect.getmodule(frame[0]) logger.debug(f'calling module: {mod}') ...
def _get_calling_module(self): """Get the last module in the call stack that is not this module or ``None`` if the call originated from this module. """ for frame in inspect.stack(): mod = inspect.getmodule(frame[0]) logger.debug(f'calling module: {mod}') ...
[ "Get", "the", "last", "module", "in", "the", "call", "stack", "that", "is", "not", "this", "module", "or", "None", "if", "the", "call", "originated", "from", "this", "module", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L79-L90
[ "def", "_get_calling_module", "(", "self", ")", ":", "for", "frame", "in", "inspect", ".", "stack", "(", ")", ":", "mod", "=", "inspect", ".", "getmodule", "(", "frame", "[", "0", "]", ")", "logger", ".", "debug", "(", "f'calling module: {mod}'", ")", ...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Configurable.resource_filename
Return a resource based on a file name. This uses the ``pkg_resources`` package first to find the resources. If it doesn't find it, it returns a path on the file system. :param: resource_name the file name of the resource to obtain (or name if obtained from an installed module) ...
src/python/zensols/actioncli/config.py
def resource_filename(self, resource_name, module_name=None): """Return a resource based on a file name. This uses the ``pkg_resources`` package first to find the resources. If it doesn't find it, it returns a path on the file system. :param: resource_name the file name of the resourc...
def resource_filename(self, resource_name, module_name=None): """Return a resource based on a file name. This uses the ``pkg_resources`` package first to find the resources. If it doesn't find it, it returns a path on the file system. :param: resource_name the file name of the resourc...
[ "Return", "a", "resource", "based", "on", "a", "file", "name", ".", "This", "uses", "the", "pkg_resources", "package", "first", "to", "find", "the", "resources", ".", "If", "it", "doesn", "t", "find", "it", "it", "returns", "a", "path", "on", "the", "f...
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L92-L115
[ "def", "resource_filename", "(", "self", ",", "resource_name", ",", "module_name", "=", "None", ")", ":", "if", "module_name", "is", "None", ":", "mod", "=", "self", ".", "_get_calling_module", "(", ")", "logger", ".", "debug", "(", "f'calling module: {mod}'",...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.parser
Load the configuration file.
src/python/zensols/actioncli/config.py
def parser(self): "Load the configuration file." if not hasattr(self, '_conf'): cfile = self.config_file logger.debug('loading config %s' % cfile) if os.path.isfile(cfile): conf = self._create_config_parser() conf.read(os.path.expanduse...
def parser(self): "Load the configuration file." if not hasattr(self, '_conf'): cfile = self.config_file logger.debug('loading config %s' % cfile) if os.path.isfile(cfile): conf = self._create_config_parser() conf.read(os.path.expanduse...
[ "Load", "the", "configuration", "file", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L144-L159
[ "def", "parser", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_conf'", ")", ":", "cfile", "=", "self", ".", "config_file", "logger", ".", "debug", "(", "'loading config %s'", "%", "cfile", ")", "if", "os", ".", "path", ".", "isf...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.get_options
Get all options for a section. If ``opt_keys`` is given return only options with those keys.
src/python/zensols/actioncli/config.py
def get_options(self, section='default', opt_keys=None, vars=None): """ Get all options for a section. If ``opt_keys`` is given return only options with those keys. """ vars = vars if vars else self.default_vars conf = self.parser opts = {} if opt_keys is...
def get_options(self, section='default', opt_keys=None, vars=None): """ Get all options for a section. If ``opt_keys`` is given return only options with those keys. """ vars = vars if vars else self.default_vars conf = self.parser opts = {} if opt_keys is...
[ "Get", "all", "options", "for", "a", "section", ".", "If", "opt_keys", "is", "given", "return", "only", "options", "with", "those", "keys", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L165-L188
[ "def", "get_options", "(", "self", ",", "section", "=", "'default'", ",", "opt_keys", "=", "None", ",", "vars", "=", "None", ")", ":", "vars", "=", "vars", "if", "vars", "else", "self", ".", "default_vars", "conf", "=", "self", ".", "parser", "opts", ...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.get_option
Return an option from ``section`` with ``name``. :param section: section in the ini file to fetch the value; defaults to constructor's ``default_section``
src/python/zensols/actioncli/config.py
def get_option(self, name, section=None, vars=None, expect=None): """Return an option from ``section`` with ``name``. :param section: section in the ini file to fetch the value; defaults to constructor's ``default_section`` """ vars = vars if vars else self.default_vars ...
def get_option(self, name, section=None, vars=None, expect=None): """Return an option from ``section`` with ``name``. :param section: section in the ini file to fetch the value; defaults to constructor's ``default_section`` """ vars = vars if vars else self.default_vars ...
[ "Return", "an", "option", "from", "section", "with", "name", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L190-L206
[ "def", "get_option", "(", "self", ",", "name", ",", "section", "=", "None", ",", "vars", "=", "None", ",", "expect", "=", "None", ")", ":", "vars", "=", "vars", "if", "vars", "else", "self", ".", "default_vars", "if", "section", "is", "None", ":", ...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.get_option_list
Just like ``get_option`` but parse as a list using ``split``.
src/python/zensols/actioncli/config.py
def get_option_list(self, name, section=None, vars=None, expect=None, separator=','): """Just like ``get_option`` but parse as a list using ``split``. """ val = self.get_option(name, section, vars, expect) return val.split(separator) if val else []
def get_option_list(self, name, section=None, vars=None, expect=None, separator=','): """Just like ``get_option`` but parse as a list using ``split``. """ val = self.get_option(name, section, vars, expect) return val.split(separator) if val else []
[ "Just", "like", "get_option", "but", "parse", "as", "a", "list", "using", "split", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L208-L214
[ "def", "get_option_list", "(", "self", ",", "name", ",", "section", "=", "None", ",", "vars", "=", "None", ",", "expect", "=", "None", ",", "separator", "=", "','", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", ...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.get_option_boolean
Just like ``get_option`` but parse as a boolean (any case `true`).
src/python/zensols/actioncli/config.py
def get_option_boolean(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but parse as a boolean (any case `true`). """ val = self.get_option(name, section, vars, expect) val = val.lower() if val else 'false' return val == 'true'
def get_option_boolean(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but parse as a boolean (any case `true`). """ val = self.get_option(name, section, vars, expect) val = val.lower() if val else 'false' return val == 'true'
[ "Just", "like", "get_option", "but", "parse", "as", "a", "boolean", "(", "any", "case", "true", ")", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L216-L222
[ "def", "get_option_boolean", "(", "self", ",", "name", ",", "section", "=", "None", ",", "vars", "=", "None", ",", "expect", "=", "None", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", ...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.get_option_int
Just like ``get_option`` but parse as an integer.
src/python/zensols/actioncli/config.py
def get_option_int(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but parse as an integer.""" val = self.get_option(name, section, vars, expect) if val: return int(val)
def get_option_int(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but parse as an integer.""" val = self.get_option(name, section, vars, expect) if val: return int(val)
[ "Just", "like", "get_option", "but", "parse", "as", "an", "integer", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L224-L228
[ "def", "get_option_int", "(", "self", ",", "name", ",", "section", "=", "None", ",", "vars", "=", "None", ",", "expect", "=", "None", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", "if...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.get_option_float
Just like ``get_option`` but parse as a float.
src/python/zensols/actioncli/config.py
def get_option_float(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but parse as a float.""" val = self.get_option(name, section, vars, expect) if val: return float(val)
def get_option_float(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but parse as a float.""" val = self.get_option(name, section, vars, expect) if val: return float(val)
[ "Just", "like", "get_option", "but", "parse", "as", "a", "float", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L230-L234
[ "def", "get_option_float", "(", "self", ",", "name", ",", "section", "=", "None", ",", "vars", "=", "None", ",", "expect", "=", "None", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", "...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
Config.get_option_path
Just like ``get_option`` but return a ``pathlib.Path`` object of the string.
src/python/zensols/actioncli/config.py
def get_option_path(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but return a ``pathlib.Path`` object of the string. """ val = self.get_option(name, section, vars, expect) return Path(val)
def get_option_path(self, name, section=None, vars=None, expect=None): """Just like ``get_option`` but return a ``pathlib.Path`` object of the string. """ val = self.get_option(name, section, vars, expect) return Path(val)
[ "Just", "like", "get_option", "but", "return", "a", "pathlib", ".", "Path", "object", "of", "the", "string", "." ]
plandes/actioncli
python
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L236-L242
[ "def", "get_option_path", "(", "self", ",", "name", ",", "section", "=", "None", ",", "vars", "=", "None", ",", "expect", "=", "None", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", "r...
d1c4ea27e6f3394b30a1652ddd4b916160662773
train
property_get
Wrapper for property reads which auto-dereferences Refs if required. prop A Ref (which gets dereferenced and returned) or any other value (which gets returned). instance The context object used to dereference the Ref.
mrcrowbar/refs.py
def property_get( prop, instance, **kwargs ): """Wrapper for property reads which auto-dereferences Refs if required. prop A Ref (which gets dereferenced and returned) or any other value (which gets returned). instance The context object used to dereference the Ref. """ if isinstan...
def property_get( prop, instance, **kwargs ): """Wrapper for property reads which auto-dereferences Refs if required. prop A Ref (which gets dereferenced and returned) or any other value (which gets returned). instance The context object used to dereference the Ref. """ if isinstan...
[ "Wrapper", "for", "property", "reads", "which", "auto", "-", "dereferences", "Refs", "if", "required", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L101-L112
[ "def", "property_get", "(", "prop", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "prop", ",", "Ref", ")", ":", "return", "prop", ".", "get", "(", "instance", ",", "*", "*", "kwargs", ")", "return", "prop" ]
b1ed882c4555552e7656b2d84aca543184577fa3
train
property_set
Wrapper for property writes which auto-deferences Refs. prop A Ref (which gets dereferenced and the target value set). instance The context object used to dereference the Ref. value The value to set the property to. Throws AttributeError if prop is not a Ref.
mrcrowbar/refs.py
def property_set( prop, instance, value, **kwargs ): """Wrapper for property writes which auto-deferences Refs. prop A Ref (which gets dereferenced and the target value set). instance The context object used to dereference the Ref. value The value to set the property to. ...
def property_set( prop, instance, value, **kwargs ): """Wrapper for property writes which auto-deferences Refs. prop A Ref (which gets dereferenced and the target value set). instance The context object used to dereference the Ref. value The value to set the property to. ...
[ "Wrapper", "for", "property", "writes", "which", "auto", "-", "deferences", "Refs", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L115-L132
[ "def", "property_set", "(", "prop", ",", "instance", ",", "value", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "prop", ",", "Ref", ")", ":", "return", "prop", ".", "set", "(", "instance", ",", "value", ",", "*", "*", "kwargs", ")", ...
b1ed882c4555552e7656b2d84aca543184577fa3
train
view_property
Wrapper for attributes of a View class which auto-dereferences Refs. Equivalent to setting a property on the class with the getter wrapped with property_get(), and the setter wrapped with property_set(). prop A string containing the name of the class attribute to wrap.
mrcrowbar/refs.py
def view_property( prop ): """Wrapper for attributes of a View class which auto-dereferences Refs. Equivalent to setting a property on the class with the getter wrapped with property_get(), and the setter wrapped with property_set(). prop A string containing the name of the class attribute...
def view_property( prop ): """Wrapper for attributes of a View class which auto-dereferences Refs. Equivalent to setting a property on the class with the getter wrapped with property_get(), and the setter wrapped with property_set(). prop A string containing the name of the class attribute...
[ "Wrapper", "for", "attributes", "of", "a", "View", "class", "which", "auto", "-", "dereferences", "Refs", ".", "Equivalent", "to", "setting", "a", "property", "on", "the", "class", "with", "the", "getter", "wrapped", "with", "property_get", "()", "and", "the...
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L135-L150
[ "def", "view_property", "(", "prop", ")", ":", "def", "getter", "(", "self", ")", ":", "return", "property_get", "(", "getattr", "(", "self", ",", "prop", ")", ",", "self", ".", "parent", ")", "def", "setter", "(", "self", ",", "value", ")", ":", "...
b1ed882c4555552e7656b2d84aca543184577fa3
train
Ref.get
Return an attribute from an object using the Ref path. instance The object instance to traverse.
mrcrowbar/refs.py
def get( self, instance, **kwargs ): """Return an attribute from an object using the Ref path. instance The object instance to traverse. """ target = instance for attr in self._path: target = getattr( target, attr ) return target
def get( self, instance, **kwargs ): """Return an attribute from an object using the Ref path. instance The object instance to traverse. """ target = instance for attr in self._path: target = getattr( target, attr ) return target
[ "Return", "an", "attribute", "from", "an", "object", "using", "the", "Ref", "path", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L33-L42
[ "def", "get", "(", "self", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "target", "=", "instance", "for", "attr", "in", "self", ".", "_path", ":", "target", "=", "getattr", "(", "target", ",", "attr", ")", "return", "target" ]
b1ed882c4555552e7656b2d84aca543184577fa3
train
Ref.set
Set an attribute on an object using the Ref path. instance The object instance to traverse. value The value to set. Throws AttributeError if allow_write is False.
mrcrowbar/refs.py
def set( self, instance, value, **kwargs ): """Set an attribute on an object using the Ref path. instance The object instance to traverse. value The value to set. Throws AttributeError if allow_write is False. """ if not self._allow_write: ...
def set( self, instance, value, **kwargs ): """Set an attribute on an object using the Ref path. instance The object instance to traverse. value The value to set. Throws AttributeError if allow_write is False. """ if not self._allow_write: ...
[ "Set", "an", "attribute", "on", "an", "object", "using", "the", "Ref", "path", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L44-L61
[ "def", "set", "(", "self", ",", "instance", ",", "value", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_allow_write", ":", "raise", "AttributeError", "(", "\"can't set Ref directly, allow_write is disabled\"", ")", "target", "=", "instance", "...
b1ed882c4555552e7656b2d84aca543184577fa3
train
traverse_until_fixpoint
Traverses the tree again and again until it is not modified.
ppp_libmodule/shortcuts.py
def traverse_until_fixpoint(predicate, tree): """Traverses the tree again and again until it is not modified.""" old_tree = None tree = simplify(tree) while tree and old_tree != tree: old_tree = tree tree = tree.traverse(predicate) if not tree: return None tre...
def traverse_until_fixpoint(predicate, tree): """Traverses the tree again and again until it is not modified.""" old_tree = None tree = simplify(tree) while tree and old_tree != tree: old_tree = tree tree = tree.traverse(predicate) if not tree: return None tre...
[ "Traverses", "the", "tree", "again", "and", "again", "until", "it", "is", "not", "modified", "." ]
ProjetPP/PPP-libmodule-Python
python
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/shortcuts.py#L6-L16
[ "def", "traverse_until_fixpoint", "(", "predicate", ",", "tree", ")", ":", "old_tree", "=", "None", "tree", "=", "simplify", "(", "tree", ")", "while", "tree", "and", "old_tree", "!=", "tree", ":", "old_tree", "=", "tree", "tree", "=", "tree", ".", "trav...
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
train
PointSippr.runner
Run the necessary methods in the correct order
pointsippr/pointsippr.py
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Initialise the GenObject for sample in self.runmetadata.samples: setattr(sample, self.analysistype, GenObject()) ...
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Initialise the GenObject for sample in self.runmetadata.samples: setattr(sample, self.analysistype, GenObject()) ...
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L19-L39
[ "def", "runner", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "# Initialise the GenObject", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
PointSippr.fasta
Create FASTA files of the PointFinder results to be fed into PointFinder
pointsippr/pointsippr.py
def fasta(self): """ Create FASTA files of the PointFinder results to be fed into PointFinder """ logging.info('Extracting FASTA sequences matching PointFinder database') for sample in self.runmetadata.samples: # Ensure that there are sequence data to extract from the...
def fasta(self): """ Create FASTA files of the PointFinder results to be fed into PointFinder """ logging.info('Extracting FASTA sequences matching PointFinder database') for sample in self.runmetadata.samples: # Ensure that there are sequence data to extract from the...
[ "Create", "FASTA", "files", "of", "the", "PointFinder", "results", "to", "be", "fed", "into", "PointFinder" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L41-L64
[ "def", "fasta", "(", "self", ")", ":", "logging", ".", "info", "(", "'Extracting FASTA sequences matching PointFinder database'", ")", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "# Ensure that there are sequence data to extract from the GenObjec...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
PointSippr.run_pointfinder
Run PointFinder on the FASTA sequences extracted from the raw reads
pointsippr/pointsippr.py
def run_pointfinder(self): """ Run PointFinder on the FASTA sequences extracted from the raw reads """ logging.info('Running PointFinder on FASTA files') for i in range(len(self.runmetadata.samples)): # Start threads threads = Thread(target=self.pointfinde...
def run_pointfinder(self): """ Run PointFinder on the FASTA sequences extracted from the raw reads """ logging.info('Running PointFinder on FASTA files') for i in range(len(self.runmetadata.samples)): # Start threads threads = Thread(target=self.pointfinde...
[ "Run", "PointFinder", "on", "the", "FASTA", "sequences", "extracted", "from", "the", "raw", "reads" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L66-L99
[ "def", "run_pointfinder", "(", "self", ")", ":", "logging", ".", "info", "(", "'Running PointFinder on FASTA files'", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "runmetadata", ".", "samples", ")", ")", ":", "# Start threads", "threads", "=...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
PointSippr.populate_summary_dict
:param genus: Non-supported genus to be added to the dictionary :param key: section of dictionary to be populated. Supported keys are: prediction, table, and results Populate self.summary_dict as required. If the genus is not provided, populate the dictionary for Salmonella Escherichia and Campy...
pointsippr/pointsippr.py
def populate_summary_dict(self, genus=str(), key=str()): """ :param genus: Non-supported genus to be added to the dictionary :param key: section of dictionary to be populated. Supported keys are: prediction, table, and results Populate self.summary_dict as required. If the genus is not p...
def populate_summary_dict(self, genus=str(), key=str()): """ :param genus: Non-supported genus to be added to the dictionary :param key: section of dictionary to be populated. Supported keys are: prediction, table, and results Populate self.summary_dict as required. If the genus is not p...
[ ":", "param", "genus", ":", "Non", "-", "supported", "genus", "to", "be", "added", "to", "the", "dictionary", ":", "param", "key", ":", "section", "of", "dictionary", "to", "be", "populated", ".", "Supported", "keys", "are", ":", "prediction", "table", "...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L107-L213
[ "def", "populate_summary_dict", "(", "self", ",", "genus", "=", "str", "(", ")", ",", "key", "=", "str", "(", ")", ")", ":", "# If the genus is not provided, generate the generic dictionary", "if", "not", "genus", ":", "# Populate the summary dict", "self", ".", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
PointSippr.parse_pointfinder
Create summary reports for the PointFinder outputs
pointsippr/pointsippr.py
def parse_pointfinder(self): """ Create summary reports for the PointFinder outputs """ # Create the nested dictionary that stores the necessary values for creating summary reports self.populate_summary_dict() # Clear out any previous reports for organism in self....
def parse_pointfinder(self): """ Create summary reports for the PointFinder outputs """ # Create the nested dictionary that stores the necessary values for creating summary reports self.populate_summary_dict() # Clear out any previous reports for organism in self....
[ "Create", "summary", "reports", "for", "the", "PointFinder", "outputs" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L215-L275
[ "def", "parse_pointfinder", "(", "self", ")", ":", "# Create the nested dictionary that stores the necessary values for creating summary reports", "self", ".", "populate_summary_dict", "(", ")", "# Clear out any previous reports", "for", "organism", "in", "self", ".", "summary_di...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
PointSippr.write_report
Parse the PointFinder outputs, and write the summary report for the current analysis type :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculated genus of current isolate :param ke...
pointsippr/pointsippr.py
def write_report(summary_dict, seqid, genus, key): """ Parse the PointFinder outputs, and write the summary report for the current analysis type :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :...
def write_report(summary_dict, seqid, genus, key): """ Parse the PointFinder outputs, and write the summary report for the current analysis type :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :...
[ "Parse", "the", "PointFinder", "outputs", "and", "write", "the", "summary", "report", "for", "the", "current", "analysis", "type", ":", "param", "summary_dict", ":", "nested", "dictionary", "containing", "data", "such", "as", "header", "strings", "and", "paths",...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L278-L342
[ "def", "write_report", "(", "summary_dict", ",", "seqid", ",", "genus", ",", "key", ")", ":", "# Set the header string if the summary report doesn't already exist", "if", "not", "os", ".", "path", ".", "isfile", "(", "summary_dict", "[", "genus", "]", "[", "key", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
PointSippr.write_table_report
Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculated genus of current isolate
pointsippr/pointsippr.py
def write_table_report(summary_dict, seqid, genus): """ Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculat...
def write_table_report(summary_dict, seqid, genus): """ Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculat...
[ "Parse", "the", "PointFinder", "table", "output", "and", "write", "a", "summary", "report", ":", "param", "summary_dict", ":", "nested", "dictionary", "containing", "data", "such", "as", "header", "strings", "and", "paths", "to", "reports", ":", "param", "seqi...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L345-L403
[ "def", "write_table_report", "(", "summary_dict", ",", "seqid", ",", "genus", ")", ":", "# Set the header string if the summary report doesn't already exist", "if", "not", "os", ".", "path", ".", "isfile", "(", "summary_dict", "[", "genus", "]", "[", "'table'", "]",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
PointSipping.targets
Search the targets folder for FASTA files, create the multi-FASTA file of all targets if necessary, and populate objects
pointsippr/pointsippr.py
def targets(self): """ Search the targets folder for FASTA files, create the multi-FASTA file of all targets if necessary, and populate objects """ logging.info('Performing analysis with {} targets folder'.format(self.analysistype)) for sample in self.runmetadata: ...
def targets(self): """ Search the targets folder for FASTA files, create the multi-FASTA file of all targets if necessary, and populate objects """ logging.info('Performing analysis with {} targets folder'.format(self.analysistype)) for sample in self.runmetadata: ...
[ "Search", "the", "targets", "folder", "for", "FASTA", "files", "create", "the", "multi", "-", "FASTA", "file", "of", "all", "targets", "if", "necessary", "and", "populate", "objects" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L426-L467
[ "def", "targets", "(", "self", ")", ":", "logging", ".", "info", "(", "'Performing analysis with {} targets folder'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "runmetadata", ":", "sample", "[", "self", "....
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.strains
Create a dictionary of SEQID: OLNID from the supplied
genesippr_validation.py
def strains(self): """ Create a dictionary of SEQID: OLNID from the supplied """ with open(os.path.join(self.path, 'strains.csv')) as strains: next(strains) for line in strains: oln, seqid = line.split(',') self.straindict[oln] = se...
def strains(self): """ Create a dictionary of SEQID: OLNID from the supplied """ with open(os.path.join(self.path, 'strains.csv')) as strains: next(strains) for line in strains: oln, seqid = line.split(',') self.straindict[oln] = se...
[ "Create", "a", "dictionary", "of", "SEQID", ":", "OLNID", "from", "the", "supplied" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L33-L45
[ "def", "strains", "(", "self", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'strains.csv'", ")", ")", "as", "strains", ":", "next", "(", "strains", ")", "for", "line", "in", "strains", ":", "oln", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.sequence_prep
Create metadata objects for all PacBio assembly FASTA files in the sequencepath. Create individual subdirectories for each sample. Relative symlink the original FASTA file to the appropriate subdirectory
genesippr_validation.py
def sequence_prep(self): """ Create metadata objects for all PacBio assembly FASTA files in the sequencepath. Create individual subdirectories for each sample. Relative symlink the original FASTA file to the appropriate subdirectory """ # Create a sorted list of all the...
def sequence_prep(self): """ Create metadata objects for all PacBio assembly FASTA files in the sequencepath. Create individual subdirectories for each sample. Relative symlink the original FASTA file to the appropriate subdirectory """ # Create a sorted list of all the...
[ "Create", "metadata", "objects", "for", "all", "PacBio", "assembly", "FASTA", "files", "in", "the", "sequencepath", ".", "Create", "individual", "subdirectories", "for", "each", "sample", ".", "Relative", "symlink", "the", "original", "FASTA", "file", "to", "the...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L47-L89
[ "def", "sequence_prep", "(", "self", ")", ":", "# Create a sorted list of all the FASTA files in the sequence path", "strains", "=", "sorted", "(", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "fastapath", ",", "'*.fa*'", ".", "format", "(", "s...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.write_json
Write the metadata object to file :param metadata: Metadata object
genesippr_validation.py
def write_json(metadata): """ Write the metadata object to file :param metadata: Metadata object """ # Open the metadata file to write with open(metadata.jsonfile, 'w') as metadatafile: # Write the json dump of the object dump to the metadata file ...
def write_json(metadata): """ Write the metadata object to file :param metadata: Metadata object """ # Open the metadata file to write with open(metadata.jsonfile, 'w') as metadatafile: # Write the json dump of the object dump to the metadata file ...
[ "Write", "the", "metadata", "object", "to", "file", ":", "param", "metadata", ":", "Metadata", "object" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L92-L100
[ "def", "write_json", "(", "metadata", ")", ":", "# Open the metadata file to write", "with", "open", "(", "metadata", ".", "jsonfile", ",", "'w'", ")", "as", "metadatafile", ":", "# Write the json dump of the object dump to the metadata file", "json", ".", "dump", "(", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.read_json
Read the metadata object from file :param json_metadata: Path and file name of JSON-formatted metadata object file :return: metadata object
genesippr_validation.py
def read_json(json_metadata): """ Read the metadata object from file :param json_metadata: Path and file name of JSON-formatted metadata object file :return: metadata object """ # Load the metadata object from the file with open(json_metadata) as metadatareport: ...
def read_json(json_metadata): """ Read the metadata object from file :param json_metadata: Path and file name of JSON-formatted metadata object file :return: metadata object """ # Load the metadata object from the file with open(json_metadata) as metadatareport: ...
[ "Read", "the", "metadata", "object", "from", "file", ":", "param", "json_metadata", ":", "Path", "and", "file", "name", "of", "JSON", "-", "formatted", "metadata", "object", "file", ":", "return", ":", "metadata", "object" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L103-L120
[ "def", "read_json", "(", "json_metadata", ")", ":", "# Load the metadata object from the file", "with", "open", "(", "json_metadata", ")", "as", "metadatareport", ":", "jsondata", "=", "json", ".", "load", "(", "metadatareport", ")", "# Create the metadata objects", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.assembly_length
Use SeqIO.parse to extract the total number of bases in each assembly file
genesippr_validation.py
def assembly_length(self): """ Use SeqIO.parse to extract the total number of bases in each assembly file """ for sample in self.metadata: # Only determine the assembly length if is has not been previously calculated if not GenObject.isattr(sample, 'assembly_lengt...
def assembly_length(self): """ Use SeqIO.parse to extract the total number of bases in each assembly file """ for sample in self.metadata: # Only determine the assembly length if is has not been previously calculated if not GenObject.isattr(sample, 'assembly_lengt...
[ "Use", "SeqIO", ".", "parse", "to", "extract", "the", "total", "number", "of", "bases", "in", "each", "assembly", "file" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L122-L135
[ "def", "assembly_length", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "metadata", ":", "# Only determine the assembly length if is has not been previously calculated", "if", "not", "GenObject", ".", "isattr", "(", "sample", ",", "'assembly_length'", ")", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.simulate_reads
Use the PacBio assembly FASTA files to generate simulated reads of appropriate forward and reverse lengths at different depths of sequencing using randomreads.sh from the bbtools suite
genesippr_validation.py
def simulate_reads(self): """ Use the PacBio assembly FASTA files to generate simulated reads of appropriate forward and reverse lengths at different depths of sequencing using randomreads.sh from the bbtools suite """ logging.info('Read simulation') for sample in self.me...
def simulate_reads(self): """ Use the PacBio assembly FASTA files to generate simulated reads of appropriate forward and reverse lengths at different depths of sequencing using randomreads.sh from the bbtools suite """ logging.info('Read simulation') for sample in self.me...
[ "Use", "the", "PacBio", "assembly", "FASTA", "files", "to", "generate", "simulated", "reads", "of", "appropriate", "forward", "and", "reverse", "lengths", "at", "different", "depths", "of", "sequencing", "using", "randomreads", ".", "sh", "from", "the", "bbtools...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L137-L295
[ "def", "simulate_reads", "(", "self", ")", ":", "logging", ".", "info", "(", "'Read simulation'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Create the simulated_reads GenObject", "sample", ".", "simulated_reads", "=", "GenObject", "(", ")", "#...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.read_length_adjust
Trim the reads to the correct length using reformat.sh :param analysistype: current analysis type. Will be either 'simulated' or 'sampled'
genesippr_validation.py
def read_length_adjust(self, analysistype): """ Trim the reads to the correct length using reformat.sh :param analysistype: current analysis type. Will be either 'simulated' or 'sampled' """ logging.info('Trimming {at} reads'.format(at=analysistype)) for sample in self.me...
def read_length_adjust(self, analysistype): """ Trim the reads to the correct length using reformat.sh :param analysistype: current analysis type. Will be either 'simulated' or 'sampled' """ logging.info('Trimming {at} reads'.format(at=analysistype)) for sample in self.me...
[ "Trim", "the", "reads", "to", "the", "correct", "length", "using", "reformat", ".", "sh", ":", "param", "analysistype", ":", "current", "analysis", "type", ".", "Will", "be", "either", "simulated", "or", "sampled" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L297-L378
[ "def", "read_length_adjust", "(", "self", ",", "analysistype", ")", ":", "logging", ".", "info", "(", "'Trimming {at} reads'", ".", "format", "(", "at", "=", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Iterate through all ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.read_quality_trim
Perform quality trim, and toss reads below appropriate thresholds
genesippr_validation.py
def read_quality_trim(self): """ Perform quality trim, and toss reads below appropriate thresholds """ logging.info('Quality trim') for sample in self.metadata: sample.sampled_reads = GenObject() sample.sampled_reads.outputdir = os.path.join(sample.outputd...
def read_quality_trim(self): """ Perform quality trim, and toss reads below appropriate thresholds """ logging.info('Quality trim') for sample in self.metadata: sample.sampled_reads = GenObject() sample.sampled_reads.outputdir = os.path.join(sample.outputd...
[ "Perform", "quality", "trim", "and", "toss", "reads", "below", "appropriate", "thresholds" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L380-L470
[ "def", "read_quality_trim", "(", "self", ")", ":", "logging", ".", "info", "(", "'Quality trim'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "sample", ".", "sampled_reads", "=", "GenObject", "(", ")", "sample", ".", "sampled_reads", ".", "ou...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.sample_reads
For each PacBio assembly, sample reads from corresponding FASTQ files for appropriate forward and reverse lengths and sequencing depths using reformat.sh from the bbtools suite
genesippr_validation.py
def sample_reads(self): """ For each PacBio assembly, sample reads from corresponding FASTQ files for appropriate forward and reverse lengths and sequencing depths using reformat.sh from the bbtools suite """ logging.info('Read sampling') for sample in self.metadata: ...
def sample_reads(self): """ For each PacBio assembly, sample reads from corresponding FASTQ files for appropriate forward and reverse lengths and sequencing depths using reformat.sh from the bbtools suite """ logging.info('Read sampling') for sample in self.metadata: ...
[ "For", "each", "PacBio", "assembly", "sample", "reads", "from", "corresponding", "FASTQ", "files", "for", "appropriate", "forward", "and", "reverse", "lengths", "and", "sequencing", "depths", "using", "reformat", ".", "sh", "from", "the", "bbtools", "suite" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L472-L535
[ "def", "sample_reads", "(", "self", ")", ":", "logging", ".", "info", "(", "'Read sampling'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Iterate through all the desired depths of coverage", "for", "depth", "in", "self", ".", "read_depths", ":", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.link_reads
Create folders with relative symlinks to the desired simulated/sampled reads. These folders will contain all the reads created for each sample, and will be processed with GeneSippr and COWBAT pipelines :param analysistype: Current analysis type. Will either be 'simulated' or 'sampled'
genesippr_validation.py
def link_reads(self, analysistype): """ Create folders with relative symlinks to the desired simulated/sampled reads. These folders will contain all the reads created for each sample, and will be processed with GeneSippr and COWBAT pipelines :param analysistype: Current analysis type. Wi...
def link_reads(self, analysistype): """ Create folders with relative symlinks to the desired simulated/sampled reads. These folders will contain all the reads created for each sample, and will be processed with GeneSippr and COWBAT pipelines :param analysistype: Current analysis type. Wi...
[ "Create", "folders", "with", "relative", "symlinks", "to", "the", "desired", "simulated", "/", "sampled", "reads", ".", "These", "folders", "will", "contain", "all", "the", "reads", "created", "for", "each", "sample", "and", "will", "be", "processed", "with", ...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L537-L584
[ "def", "link_reads", "(", "self", ",", "analysistype", ")", ":", "logging", ".", "info", "(", "'Linking {at} reads'", ".", "format", "(", "at", "=", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Create the output directories...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReadPrep.run_genesippr
Run GeneSippr on each of the samples
genesippr_validation.py
def run_genesippr(self): """ Run GeneSippr on each of the samples """ from pathlib import Path home = str(Path.home()) logging.info('GeneSippr') # These unfortunate hard coded paths appear to be necessary miniconda_path = os.path.join(home, 'miniconda3') ...
def run_genesippr(self): """ Run GeneSippr on each of the samples """ from pathlib import Path home = str(Path.home()) logging.info('GeneSippr') # These unfortunate hard coded paths appear to be necessary miniconda_path = os.path.join(home, 'miniconda3') ...
[ "Run", "GeneSippr", "on", "each", "of", "the", "samples" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L586-L620
[ "def", "run_genesippr", "(", "self", ")", ":", "from", "pathlib", "import", "Path", "home", "=", "str", "(", "Path", ".", "home", "(", ")", ")", "logging", ".", "info", "(", "'GeneSippr'", ")", "# These unfortunate hard coded paths appear to be necessary", "mini...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
LogOne.set_level
Set the logging level of this logger. :param level: must be an int or a str.
logone/logone.py
def set_level(self, level): """ Set the logging level of this logger. :param level: must be an int or a str. """ for handler in self.__coloredlogs_handlers: handler.setLevel(level=level) self.logger.setLevel(level=level)
def set_level(self, level): """ Set the logging level of this logger. :param level: must be an int or a str. """ for handler in self.__coloredlogs_handlers: handler.setLevel(level=level) self.logger.setLevel(level=level)
[ "Set", "the", "logging", "level", "of", "this", "logger", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L87-L96
[ "def", "set_level", "(", "self", ",", "level", ")", ":", "for", "handler", "in", "self", ".", "__coloredlogs_handlers", ":", "handler", ".", "setLevel", "(", "level", "=", "level", ")", "self", ".", "logger", ".", "setLevel", "(", "level", "=", "level", ...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
LogOne.disable_logger
Disable all logging calls.
logone/logone.py
def disable_logger(self, disabled=True): """ Disable all logging calls. """ # Disable standard IO streams if disabled: sys.stdout = _original_stdout sys.stderr = _original_stderr else: sys.stdout = self.__stdout_stream sys.s...
def disable_logger(self, disabled=True): """ Disable all logging calls. """ # Disable standard IO streams if disabled: sys.stdout = _original_stdout sys.stderr = _original_stderr else: sys.stdout = self.__stdout_stream sys.s...
[ "Disable", "all", "logging", "calls", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L98-L111
[ "def", "disable_logger", "(", "self", ",", "disabled", "=", "True", ")", ":", "# Disable standard IO streams", "if", "disabled", ":", "sys", ".", "stdout", "=", "_original_stdout", "sys", ".", "stderr", "=", "_original_stderr", "else", ":", "sys", ".", "stdout...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
LogOne.redirect_stdout
Redirect sys.stdout to file-like object.
logone/logone.py
def redirect_stdout(self, enabled=True, log_level=logging.INFO): """ Redirect sys.stdout to file-like object. """ if enabled: if self.__stdout_wrapper: self.__stdout_wrapper.update_log_level(log_level=log_level) else: self.__stdout_...
def redirect_stdout(self, enabled=True, log_level=logging.INFO): """ Redirect sys.stdout to file-like object. """ if enabled: if self.__stdout_wrapper: self.__stdout_wrapper.update_log_level(log_level=log_level) else: self.__stdout_...
[ "Redirect", "sys", ".", "stdout", "to", "file", "-", "like", "object", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L113-L128
[ "def", "redirect_stdout", "(", "self", ",", "enabled", "=", "True", ",", "log_level", "=", "logging", ".", "INFO", ")", ":", "if", "enabled", ":", "if", "self", ".", "__stdout_wrapper", ":", "self", ".", "__stdout_wrapper", ".", "update_log_level", "(", "l...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
LogOne.redirect_stderr
Redirect sys.stderr to file-like object.
logone/logone.py
def redirect_stderr(self, enabled=True, log_level=logging.ERROR): """ Redirect sys.stderr to file-like object. """ if enabled: if self.__stderr_wrapper: self.__stderr_wrapper.update_log_level(log_level=log_level) else: self.__stderr...
def redirect_stderr(self, enabled=True, log_level=logging.ERROR): """ Redirect sys.stderr to file-like object. """ if enabled: if self.__stderr_wrapper: self.__stderr_wrapper.update_log_level(log_level=log_level) else: self.__stderr...
[ "Redirect", "sys", ".", "stderr", "to", "file", "-", "like", "object", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L130-L145
[ "def", "redirect_stderr", "(", "self", ",", "enabled", "=", "True", ",", "log_level", "=", "logging", ".", "ERROR", ")", ":", "if", "enabled", ":", "if", "self", ".", "__stderr_wrapper", ":", "self", ".", "__stderr_wrapper", ".", "update_log_level", "(", "...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
LogOne.use_file
Handler for logging to a file, rotating the log file at certain timed intervals.
logone/logone.py
def use_file(self, enabled=True, file_name=None, level=logging.WARNING, when='d', interval=1, backup_count=30, delay=False, utc=False, at_time=None, log_format=None, ...
def use_file(self, enabled=True, file_name=None, level=logging.WARNING, when='d', interval=1, backup_count=30, delay=False, utc=False, at_time=None, log_format=None, ...
[ "Handler", "for", "logging", "to", "a", "file", "rotating", "the", "log", "file", "at", "certain", "timed", "intervals", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L147-L199
[ "def", "use_file", "(", "self", ",", "enabled", "=", "True", ",", "file_name", "=", "None", ",", "level", "=", "logging", ".", "WARNING", ",", "when", "=", "'d'", ",", "interval", "=", "1", ",", "backup_count", "=", "30", ",", "delay", "=", "False", ...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
LogOne.use_loggly
Enable handler for sending the record to Loggly service.
logone/logone.py
def use_loggly(self, enabled=True, loggly_token=None, loggly_tag=None, level=logging.WARNING, log_format=None, date_format=None): """ Enable handler for sending the record to Loggly service. """ ...
def use_loggly(self, enabled=True, loggly_token=None, loggly_tag=None, level=logging.WARNING, log_format=None, date_format=None): """ Enable handler for sending the record to Loggly service. """ ...
[ "Enable", "handler", "for", "sending", "the", "record", "to", "Loggly", "service", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L201-L241
[ "def", "use_loggly", "(", "self", ",", "enabled", "=", "True", ",", "loggly_token", "=", "None", ",", "loggly_tag", "=", "None", ",", "level", "=", "logging", ".", "WARNING", ",", "log_format", "=", "None", ",", "date_format", "=", "None", ")", ":", "i...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
LogOne.__find_caller
Find the stack frame of the caller so that we can note the source file name, line number and function name.
logone/logone.py
def __find_caller(stack_info=False): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ frame = logging.currentframe() # On some versions of IronPython, currentframe() returns None if # IronPython is...
def __find_caller(stack_info=False): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ frame = logging.currentframe() # On some versions of IronPython, currentframe() returns None if # IronPython is...
[ "Find", "the", "stack", "frame", "of", "the", "caller", "so", "that", "we", "can", "note", "the", "source", "file", "name", "line", "number", "and", "function", "name", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L244-L272
[ "def", "__find_caller", "(", "stack_info", "=", "False", ")", ":", "frame", "=", "logging", ".", "currentframe", "(", ")", "# On some versions of IronPython, currentframe() returns None if", "# IronPython isn't run with -X:Frames.", "if", "frame", ":", "frame", "=", "fram...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
LogOne._log
Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
logone/logone.py
def _log(self, level, msg, *args, **kwargs): """ Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1) """ ...
def _log(self, level, msg, *args, **kwargs): """ Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1) """ ...
[ "Log", "msg", "%", "args", "with", "the", "integer", "severity", "level", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L274-L333
[ "def", "_log", "(", "self", ",", "level", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "level", ",", "int", ")", ":", "if", "logging", ".", "raiseExceptions", ":", "raise", "TypeError", "(", "'Lev...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
StdErrWrapper.flush
Flush the buffer, if applicable.
logone/logone.py
def flush(self): """ Flush the buffer, if applicable. """ if self.__buffer.tell() > 0: # Write the buffer to log # noinspection PyProtectedMember self.__logger._log(level=self.__log_level, msg=self.__buffer.getvalue().strip(), ...
def flush(self): """ Flush the buffer, if applicable. """ if self.__buffer.tell() > 0: # Write the buffer to log # noinspection PyProtectedMember self.__logger._log(level=self.__log_level, msg=self.__buffer.getvalue().strip(), ...
[ "Flush", "the", "buffer", "if", "applicable", "." ]
dnanhkhoa/logone
python
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L474-L485
[ "def", "flush", "(", "self", ")", ":", "if", "self", ".", "__buffer", ".", "tell", "(", ")", ">", "0", ":", "# Write the buffer to log", "# noinspection PyProtectedMember", "self", ".", "__logger", ".", "_log", "(", "level", "=", "self", ".", "__log_level", ...
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
train
syllabify
Syllabify the given word, whether simplex or complex.
finnsyll/prev/v08.py
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify syllabifications = list(syllabify(word)) for syll, rules in syllabifications: yield syll, rules n = ...
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify syllabifications = list(syllabify(word)) for syll, rules in syllabifications: yield syll, rules n = ...
[ "Syllabify", "the", "given", "word", "whether", "simplex", "or", "complex", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v08.py#L18-L31
[ "def", "syllabify", "(", "word", ")", ":", "compound", "=", "bool", "(", "re", ".", "search", "(", "r'(-| |=)'", ",", "word", ")", ")", "syllabify", "=", "_syllabify_compound", "if", "compound", "else", "_syllabify", "syllabifications", "=", "list", "(", "...
6a42740311688c946a636a3e2304866c7aa041b3
train
apply_T4
An agglutination diphthong that ends in /u, y/ optionally contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].
finnsyll/prev/v08.py
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ optionally contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = word.split('.') PARTS = [[] for part in range(len(WORD))] for i, v in enumerate(WORD): # i % 2 != 0 preven...
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ optionally contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = word.split('.') PARTS = [[] for part in range(len(WORD))] for i, v in enumerate(WORD): # i % 2 != 0 preven...
[ "An", "agglutination", "diphthong", "that", "ends", "in", "/", "u", "y", "/", "optionally", "contains", "a", "syllable", "boundary", "when", "-", "C#", "or", "-", "CCV", "follow", "e", ".", "g", ".", "[", "lau", ".", "ka", ".", "us", "]", "[", "va"...
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v08.py#L189-L217
[ "def", "apply_T4", "(", "word", ")", ":", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "PARTS", "=", "[", "[", "]", "for", "part", "in", "range", "(", "len", "(", "WORD", ")", ")", "]", "for", "i", ",", "v", "in", "enumerate", "(", "WO...
6a42740311688c946a636a3e2304866c7aa041b3
train
setup
Setup logging.
qg/core/log.py
def setup(product_name): """Setup logging.""" if CONF.log_config: _load_log_config(CONF.log_config) else: _setup_logging_from_conf() sys.excepthook = _create_logging_excepthook(product_name)
def setup(product_name): """Setup logging.""" if CONF.log_config: _load_log_config(CONF.log_config) else: _setup_logging_from_conf() sys.excepthook = _create_logging_excepthook(product_name)
[ "Setup", "logging", "." ]
QunarOPS/qg.core
python
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L351-L357
[ "def", "setup", "(", "product_name", ")", ":", "if", "CONF", ".", "log_config", ":", "_load_log_config", "(", "CONF", ".", "log_config", ")", "else", ":", "_setup_logging_from_conf", "(", ")", "sys", ".", "excepthook", "=", "_create_logging_excepthook", "(", "...
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
train
ContextFormatter.format
Uses contextstring if request_id is set, otherwise default.
qg/core/log.py
def format(self, record): """Uses contextstring if request_id is set, otherwise default.""" # NOTE(sdague): default the fancier formating params # to an empty string so we don't throw an exception if # they get used for key in ('instance', 'color'): if key not in reco...
def format(self, record): """Uses contextstring if request_id is set, otherwise default.""" # NOTE(sdague): default the fancier formating params # to an empty string so we don't throw an exception if # they get used for key in ('instance', 'color'): if key not in reco...
[ "Uses", "contextstring", "if", "request_id", "is", "set", "otherwise", "default", "." ]
QunarOPS/qg.core
python
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L486-L507
[ "def", "format", "(", "self", ",", "record", ")", ":", "# NOTE(sdague): default the fancier formating params", "# to an empty string so we don't throw an exception if", "# they get used", "for", "key", "in", "(", "'instance'", ",", "'color'", ")", ":", "if", "key", "not",...
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
train
ContextFormatter.formatException
Format exception output with CONF.logging_exception_prefix.
qg/core/log.py
def formatException(self, exc_info, record=None): """Format exception output with CONF.logging_exception_prefix.""" if not record: return logging.Formatter.formatException(self, exc_info) stringbuffer = cStringIO.StringIO() traceback.print_exception(exc_info[0], exc_info[1],...
def formatException(self, exc_info, record=None): """Format exception output with CONF.logging_exception_prefix.""" if not record: return logging.Formatter.formatException(self, exc_info) stringbuffer = cStringIO.StringIO() traceback.print_exception(exc_info[0], exc_info[1],...
[ "Format", "exception", "output", "with", "CONF", ".", "logging_exception_prefix", "." ]
QunarOPS/qg.core
python
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L509-L528
[ "def", "formatException", "(", "self", ",", "exc_info", ",", "record", "=", "None", ")", ":", "if", "not", "record", ":", "return", "logging", ".", "Formatter", ".", "formatException", "(", "self", ",", "exc_info", ")", "stringbuffer", "=", "cStringIO", "....
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
train
abstractToolBar._set_boutons_interface
Display buttons given by the list of tuples (id,function,description,is_active)
pyDLib/GUI/app.py
def _set_boutons_interface(self, buttons): """Display buttons given by the list of tuples (id,function,description,is_active)""" for id_action, f, d, is_active in buttons: icon = self.get_icon(id_action) action = self.addAction(QIcon(icon), d) action.setEnabled(is_act...
def _set_boutons_interface(self, buttons): """Display buttons given by the list of tuples (id,function,description,is_active)""" for id_action, f, d, is_active in buttons: icon = self.get_icon(id_action) action = self.addAction(QIcon(icon), d) action.setEnabled(is_act...
[ "Display", "buttons", "given", "by", "the", "list", "of", "tuples", "(", "id", "function", "description", "is_active", ")" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L93-L99
[ "def", "_set_boutons_interface", "(", "self", ",", "buttons", ")", ":", "for", "id_action", ",", "f", ",", "d", ",", "is_active", "in", "buttons", ":", "icon", "=", "self", ".", "get_icon", "(", "id_action", ")", "action", "=", "self", ".", "addAction", ...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractToolBar.set_interface
Add update toolbar callback to the interface
pyDLib/GUI/app.py
def set_interface(self, interface): """Add update toolbar callback to the interface""" self.interface = interface self.interface.callbacks.update_toolbar = self._update self._update()
def set_interface(self, interface): """Add update toolbar callback to the interface""" self.interface = interface self.interface.callbacks.update_toolbar = self._update self._update()
[ "Add", "update", "toolbar", "callback", "to", "the", "interface" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L101-L105
[ "def", "set_interface", "(", "self", ",", "interface", ")", ":", "self", ".", "interface", "=", "interface", "self", ".", "interface", ".", "callbacks", ".", "update_toolbar", "=", "self", ".", "_update", "self", ".", "_update", "(", ")" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
train
abstractToolBar._update
Update the display of button after querying data from interface
pyDLib/GUI/app.py
def _update(self): """Update the display of button after querying data from interface""" self.clear() self._set_boutons_communs() if self.interface: self.addSeparator() l_actions = self.interface.get_actions_toolbar() self._set_boutons_interface(l_acti...
def _update(self): """Update the display of button after querying data from interface""" self.clear() self._set_boutons_communs() if self.interface: self.addSeparator() l_actions = self.interface.get_actions_toolbar() self._set_boutons_interface(l_acti...
[ "Update", "the", "display", "of", "button", "after", "querying", "data", "from", "interface" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L107-L114
[ "def", "_update", "(", "self", ")", ":", "self", ".", "clear", "(", ")", "self", ".", "_set_boutons_communs", "(", ")", "if", "self", ".", "interface", ":", "self", ".", "addSeparator", "(", ")", "l_actions", "=", "self", ".", "interface", ".", "get_ac...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
Application.init_login
Display login screen. May ask for local data loading if from_local is True.
pyDLib/GUI/app.py
def init_login(self, from_local=False): """Display login screen. May ask for local data loading if from_local is True.""" if self.toolbar: self.removeToolBar(self.toolbar) widget_login = login.Loading(self.statusBar(), self.theory_main) self.centralWidget().addWidget(widget_l...
def init_login(self, from_local=False): """Display login screen. May ask for local data loading if from_local is True.""" if self.toolbar: self.removeToolBar(self.toolbar) widget_login = login.Loading(self.statusBar(), self.theory_main) self.centralWidget().addWidget(widget_l...
[ "Display", "login", "screen", ".", "May", "ask", "for", "local", "data", "loading", "if", "from_local", "is", "True", "." ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L160-L172
[ "def", "init_login", "(", "self", ",", "from_local", "=", "False", ")", ":", "if", "self", ".", "toolbar", ":", "self", ".", "removeToolBar", "(", "self", ".", "toolbar", ")", "widget_login", "=", "login", ".", "Loading", "(", "self", ".", "statusBar", ...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
HttpRequestHandler.make_response
Shortcut for making a response to the client's request.
ppp_libmodule/http.py
def make_response(self, status, content_type, response): """Shortcut for making a response to the client's request.""" headers = [('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'), ('Access-Control-Allow-Headers', 'Content-...
def make_response(self, status, content_type, response): """Shortcut for making a response to the client's request.""" headers = [('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'), ('Access-Control-Allow-Headers', 'Content-...
[ "Shortcut", "for", "making", "a", "response", "to", "the", "client", "s", "request", "." ]
ProjetPP/PPP-libmodule-Python
python
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L23-L32
[ "def", "make_response", "(", "self", ",", "status", ",", "content_type", ",", "response", ")", ":", "headers", "=", "[", "(", "'Access-Control-Allow-Origin'", ",", "'*'", ")", ",", "(", "'Access-Control-Allow-Methods'", ",", "'GET, POST, OPTIONS'", ")", ",", "("...
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
train
HttpRequestHandler.process_request
Processes a request.
ppp_libmodule/http.py
def process_request(self, request): """Processes a request.""" try: request = Request.from_json(request.read().decode()) except ValueError: raise ClientError('Data is not valid JSON.') except KeyError: raise ClientError('Missing mandatory field in requ...
def process_request(self, request): """Processes a request.""" try: request = Request.from_json(request.read().decode()) except ValueError: raise ClientError('Data is not valid JSON.') except KeyError: raise ClientError('Missing mandatory field in requ...
[ "Processes", "a", "request", "." ]
ProjetPP/PPP-libmodule-Python
python
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L97-L116
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "try", ":", "request", "=", "Request", ".", "from_json", "(", "request", ".", "read", "(", ")", ".", "decode", "(", ")", ")", "except", "ValueError", ":", "raise", "ClientError", "(", "'D...
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
train
HttpRequestHandler.on_post
Extracts the request, feeds the module, and returns the response.
ppp_libmodule/http.py
def on_post(self): """Extracts the request, feeds the module, and returns the response.""" request = self.environ['wsgi.input'] try: return self.process_request(request) except ClientError as exc: return self.on_client_error(exc) except BadGateway as exc: ...
def on_post(self): """Extracts the request, feeds the module, and returns the response.""" request = self.environ['wsgi.input'] try: return self.process_request(request) except ClientError as exc: return self.on_client_error(exc) except BadGateway as exc: ...
[ "Extracts", "the", "request", "feeds", "the", "module", "and", "returns", "the", "response", "." ]
ProjetPP/PPP-libmodule-Python
python
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L118-L131
[ "def", "on_post", "(", "self", ")", ":", "request", "=", "self", ".", "environ", "[", "'wsgi.input'", "]", "try", ":", "return", "self", ".", "process_request", "(", "request", ")", "except", "ClientError", "as", "exc", ":", "return", "self", ".", "on_cl...
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
train
HttpRequestHandler.dispatch
Handles dispatching of the request.
ppp_libmodule/http.py
def dispatch(self): """Handles dispatching of the request.""" method_name = 'on_' + self.environ['REQUEST_METHOD'].lower() method = getattr(self, method_name, None) if method: return method() else: return self.on_bad_method()
def dispatch(self): """Handles dispatching of the request.""" method_name = 'on_' + self.environ['REQUEST_METHOD'].lower() method = getattr(self, method_name, None) if method: return method() else: return self.on_bad_method()
[ "Handles", "dispatching", "of", "the", "request", "." ]
ProjetPP/PPP-libmodule-Python
python
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L137-L144
[ "def", "dispatch", "(", "self", ")", ":", "method_name", "=", "'on_'", "+", "self", ".", "environ", "[", "'REQUEST_METHOD'", "]", ".", "lower", "(", ")", "method", "=", "getattr", "(", "self", ",", "method_name", ",", "None", ")", "if", "method", ":", ...
8098ec3e3ac62f471ff93fb8ce29e36833a8d492