repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
hid-io/layouts-python
layouts/__init__.py
main
def main(argv=None): ''' Main entry-point for calling layouts directly as a program. ''' # Prep argparse ap = argparse.ArgumentParser( description='Basic query options for Python HID-IO Layouts repository', ) ap.add_argument('--list', action='store_true', help='List available layout ...
python
def main(argv=None): ''' Main entry-point for calling layouts directly as a program. ''' # Prep argparse ap = argparse.ArgumentParser( description='Basic query options for Python HID-IO Layouts repository', ) ap.add_argument('--list', action='store_true', help='List available layout ...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "# Prep argparse", "ap", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Basic query options for Python HID-IO Layouts repository'", ",", ")", "ap", ".", "add_argument", "(", "'--list'", ",", "a...
Main entry-point for calling layouts directly as a program.
[ "Main", "entry", "-", "point", "for", "calling", "layouts", "directly", "as", "a", "program", "." ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L462-L487
train
hid-io/layouts-python
layouts/__init__.py
Layouts.retrieve_github_cache
def retrieve_github_cache(self, github_path, version, cache_dir, token): ''' Retrieves a cache of the layouts git repo from GitHub @param github_path: Location of the git repo on GitHub (e.g. hid-io/layouts) @param version: git reference for the version to download (e.g. master) ...
python
def retrieve_github_cache(self, github_path, version, cache_dir, token): ''' Retrieves a cache of the layouts git repo from GitHub @param github_path: Location of the git repo on GitHub (e.g. hid-io/layouts) @param version: git reference for the version to download (e.g. master) ...
[ "def", "retrieve_github_cache", "(", "self", ",", "github_path", ",", "version", ",", "cache_dir", ",", "token", ")", ":", "# Check for environment variable Github token", "token", "=", "os", ".", "environ", ".", "get", "(", "'GITHUB_APIKEY'", ",", "None", ")", ...
Retrieves a cache of the layouts git repo from GitHub @param github_path: Location of the git repo on GitHub (e.g. hid-io/layouts) @param version: git reference for the version to download (e.g. master) @param cache_dir: Directory to operate on external cache from @param token: GitHub a...
[ "Retrieves", "a", "cache", "of", "the", "layouts", "git", "repo", "from", "GitHub" ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L111-L170
train
hid-io/layouts-python
layouts/__init__.py
Layouts.get_layout
def get_layout(self, name): ''' Returns the layout with the given name ''' layout_chain = [] # Retrieve initial layout file try: json_data = self.json_files[self.layout_names[name]] except KeyError: log.error('Could not find layout: %s', n...
python
def get_layout(self, name): ''' Returns the layout with the given name ''' layout_chain = [] # Retrieve initial layout file try: json_data = self.json_files[self.layout_names[name]] except KeyError: log.error('Could not find layout: %s', n...
[ "def", "get_layout", "(", "self", ",", "name", ")", ":", "layout_chain", "=", "[", "]", "# Retrieve initial layout file", "try", ":", "json_data", "=", "self", ".", "json_files", "[", "self", ".", "layout_names", "[", "name", "]", "]", "except", "KeyError", ...
Returns the layout with the given name
[ "Returns", "the", "layout", "with", "the", "given", "name" ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L178-L215
train
hid-io/layouts-python
layouts/__init__.py
Layouts.dict_merge
def dict_merge(self, merge_to, merge_in): ''' Recursively merges two dicts Overwrites any non-dictionary items merge_to <- merge_in Modifies merge_to dictionary @param merge_to: Base dictionary to merge into @param merge_in: Dictionary that may overwrite element...
python
def dict_merge(self, merge_to, merge_in): ''' Recursively merges two dicts Overwrites any non-dictionary items merge_to <- merge_in Modifies merge_to dictionary @param merge_to: Base dictionary to merge into @param merge_in: Dictionary that may overwrite element...
[ "def", "dict_merge", "(", "self", ",", "merge_to", ",", "merge_in", ")", ":", "for", "key", ",", "value", "in", "merge_in", ".", "items", "(", ")", ":", "# Just add, if the key doesn't exist yet", "# Or if set to None/Null", "if", "key", "not", "in", "merge_to",...
Recursively merges two dicts Overwrites any non-dictionary items merge_to <- merge_in Modifies merge_to dictionary @param merge_to: Base dictionary to merge into @param merge_in: Dictionary that may overwrite elements in merge_in
[ "Recursively", "merges", "two", "dicts" ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L217-L246
train
hid-io/layouts-python
layouts/__init__.py
Layouts.squash_layouts
def squash_layouts(self, layouts): ''' Returns a squashed layout The first element takes precedence (i.e. left to right). Dictionaries are recursively merged, overwrites only occur on non-dictionary entries. [0,1] 0: test: 'my data' 1: test: 's...
python
def squash_layouts(self, layouts): ''' Returns a squashed layout The first element takes precedence (i.e. left to right). Dictionaries are recursively merged, overwrites only occur on non-dictionary entries. [0,1] 0: test: 'my data' 1: test: 's...
[ "def", "squash_layouts", "(", "self", ",", "layouts", ")", ":", "top_layout", "=", "layouts", "[", "0", "]", "json_data", "=", "{", "}", "# Generate a new container Layout", "layout", "=", "Layout", "(", "top_layout", ".", "name", "(", ")", ",", "json_data",...
Returns a squashed layout The first element takes precedence (i.e. left to right). Dictionaries are recursively merged, overwrites only occur on non-dictionary entries. [0,1] 0: test: 'my data' 1: test: 'stuff' Result: test: 'my data' ...
[ "Returns", "a", "squashed", "layout" ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L248-L281
train
hid-io/layouts-python
layouts/__init__.py
Layout.dict
def dict(self, name, key_caps=False, value_caps=False): ''' Returns a JSON dict @key_caps: Converts all dictionary keys to uppercase @value_caps: Converts all dictionary values to uppercase @return: JSON item (may be a variable, list or dictionary) ''' # Invalid...
python
def dict(self, name, key_caps=False, value_caps=False): ''' Returns a JSON dict @key_caps: Converts all dictionary keys to uppercase @value_caps: Converts all dictionary values to uppercase @return: JSON item (may be a variable, list or dictionary) ''' # Invalid...
[ "def", "dict", "(", "self", ",", "name", ",", "key_caps", "=", "False", ",", "value_caps", "=", "False", ")", ":", "# Invalid Dictionary", "if", "not", "isinstance", "(", "self", ".", "json_data", "[", "name", "]", ",", "dict", ")", ":", "raise", "Inva...
Returns a JSON dict @key_caps: Converts all dictionary keys to uppercase @value_caps: Converts all dictionary values to uppercase @return: JSON item (may be a variable, list or dictionary)
[ "Returns", "a", "JSON", "dict" ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L347-L365
train
hid-io/layouts-python
layouts/__init__.py
Layout.locale
def locale(self): ''' Do a lookup for the locale code that is set for this layout. NOTE: USB HID specifies only 35 different locales. If your layout does not fit, it should be set to Undefined/0 @return: Tuple (<USB HID locale code>, <name>) ''' name = self.json_data['h...
python
def locale(self): ''' Do a lookup for the locale code that is set for this layout. NOTE: USB HID specifies only 35 different locales. If your layout does not fit, it should be set to Undefined/0 @return: Tuple (<USB HID locale code>, <name>) ''' name = self.json_data['h...
[ "def", "locale", "(", "self", ")", ":", "name", "=", "self", ".", "json_data", "[", "'hid_locale'", "]", "# Set to Undefined/0 if not set", "if", "name", "is", "None", ":", "name", "=", "\"Undefined\"", "return", "(", "int", "(", "self", ".", "json_data", ...
Do a lookup for the locale code that is set for this layout. NOTE: USB HID specifies only 35 different locales. If your layout does not fit, it should be set to Undefined/0 @return: Tuple (<USB HID locale code>, <name>)
[ "Do", "a", "lookup", "for", "the", "locale", "code", "that", "is", "set", "for", "this", "layout", "." ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L383-L397
train
hid-io/layouts-python
layouts/__init__.py
Layout.compose
def compose(self, text, minimal_clears=False, no_clears=False): ''' Returns the sequence of combinations necessary to compose given text. If the text expression is not possible with the given layout an ComposeException is thrown. Iterate over the string, converting each character into ...
python
def compose(self, text, minimal_clears=False, no_clears=False): ''' Returns the sequence of combinations necessary to compose given text. If the text expression is not possible with the given layout an ComposeException is thrown. Iterate over the string, converting each character into ...
[ "def", "compose", "(", "self", ",", "text", ",", "minimal_clears", "=", "False", ",", "no_clears", "=", "False", ")", ":", "sequence", "=", "[", "]", "clear", "=", "self", ".", "json_data", "[", "'to_hid_keyboard'", "]", "[", "'0x00'", "]", "# No Event",...
Returns the sequence of combinations necessary to compose given text. If the text expression is not possible with the given layout an ComposeException is thrown. Iterate over the string, converting each character into a key sequence. Between each character, an empty combo is inserted to handle...
[ "Returns", "the", "sequence", "of", "combinations", "necessary", "to", "compose", "given", "text", "." ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L413-L456
train
OLC-Bioinformatics/sipprverse
sippr.py
Sipprverse.main
def main(self): """ Run the necessary methods in the correct order """ logging.info('Starting {at} analysis pipeline'.format(at=self.analysistype)) # Create the objects to be used in the analyses objects = Objectprep(self) objects.objectprep() self.runmeta...
python
def main(self): """ Run the necessary methods in the correct order """ logging.info('Starting {at} analysis pipeline'.format(at=self.analysistype)) # Create the objects to be used in the analyses objects = Objectprep(self) objects.objectprep() self.runmeta...
[ "def", "main", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {at} analysis pipeline'", ".", "format", "(", "at", "=", "self", ".", "analysistype", ")", ")", "# Create the objects to be used in the analyses", "objects", "=", "Objectprep", "(", "sel...
Run the necessary methods in the correct order
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sippr.py#L26-L137
train
OLC-Bioinformatics/sipprverse
sippr.py
Sipprverse.genus_specific
def genus_specific(self): """ For genus-specific targets, MLST and serotyping, determine if the closest refseq genus is known - i.e. if 16S analyses have been performed. Perform the analyses if required """ # Initialise a variable to store whether the necessary analyses have alre...
python
def genus_specific(self): """ For genus-specific targets, MLST and serotyping, determine if the closest refseq genus is known - i.e. if 16S analyses have been performed. Perform the analyses if required """ # Initialise a variable to store whether the necessary analyses have alre...
[ "def", "genus_specific", "(", "self", ")", ":", "# Initialise a variable to store whether the necessary analyses have already been performed", "closestrefseqgenus", "=", "False", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "if", "sample", ".", ...
For genus-specific targets, MLST and serotyping, determine if the closest refseq genus is known - i.e. if 16S analyses have been performed. Perform the analyses if required
[ "For", "genus", "-", "specific", "targets", "MLST", "and", "serotyping", "determine", "if", "the", "closest", "refseq", "genus", "is", "known", "-", "i", ".", "e", ".", "if", "16S", "analyses", "have", "been", "performed", ".", "Perform", "the", "analyses"...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sippr.py#L139-L157
train
mikemelch/hallie
hallie/modules/itunes.py
pause
def pause(): """Tell iTunes to pause""" if not settings.platformCompatible(): return False (output, error) = subprocess.Popen(["osascript", "-e", PAUSE], stdout=subprocess.PIPE).communicate()
python
def pause(): """Tell iTunes to pause""" if not settings.platformCompatible(): return False (output, error) = subprocess.Popen(["osascript", "-e", PAUSE], stdout=subprocess.PIPE).communicate()
[ "def", "pause", "(", ")", ":", "if", "not", "settings", ".", "platformCompatible", "(", ")", ":", "return", "False", "(", "output", ",", "error", ")", "=", "subprocess", ".", "Popen", "(", "[", "\"osascript\"", ",", "\"-e\"", ",", "PAUSE", "]", ",", ...
Tell iTunes to pause
[ "Tell", "iTunes", "to", "pause" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L169-L175
train
mikemelch/hallie
hallie/modules/itunes.py
resume
def resume(): """Tell iTunes to resume""" if not settings.platformCompatible(): return False (output, error) = subprocess.Popen(["osascript", "-e", RESUME], stdout=subprocess.PIPE).communicate()
python
def resume(): """Tell iTunes to resume""" if not settings.platformCompatible(): return False (output, error) = subprocess.Popen(["osascript", "-e", RESUME], stdout=subprocess.PIPE).communicate()
[ "def", "resume", "(", ")", ":", "if", "not", "settings", ".", "platformCompatible", "(", ")", ":", "return", "False", "(", "output", ",", "error", ")", "=", "subprocess", ".", "Popen", "(", "[", "\"osascript\"", ",", "\"-e\"", ",", "RESUME", "]", ",", ...
Tell iTunes to resume
[ "Tell", "iTunes", "to", "resume" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L177-L183
train
mikemelch/hallie
hallie/modules/itunes.py
skip
def skip(): """Tell iTunes to skip a song""" if not settings.platformCompatible(): return False (output, error) = subprocess.Popen(["osascript", "-e", SKIP], stdout=subprocess.PIPE).communicate()
python
def skip(): """Tell iTunes to skip a song""" if not settings.platformCompatible(): return False (output, error) = subprocess.Popen(["osascript", "-e", SKIP], stdout=subprocess.PIPE).communicate()
[ "def", "skip", "(", ")", ":", "if", "not", "settings", ".", "platformCompatible", "(", ")", ":", "return", "False", "(", "output", ",", "error", ")", "=", "subprocess", ".", "Popen", "(", "[", "\"osascript\"", ",", "\"-e\"", ",", "SKIP", "]", ",", "s...
Tell iTunes to skip a song
[ "Tell", "iTunes", "to", "skip", "a", "song" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L186-L192
train
mikemelch/hallie
hallie/modules/itunes.py
play
def play(song, artist=None, album=None): """Tells iTunes to play a given song/artist/album - MACOSX ONLY""" if not settings.platformCompatible(): return False if song and not artist and not album: (output, error) = subprocess.Popen(["osascript", "-e", DEFAULT_ITUNES_PLAY % (song, song, song)], stdout=subproces...
python
def play(song, artist=None, album=None): """Tells iTunes to play a given song/artist/album - MACOSX ONLY""" if not settings.platformCompatible(): return False if song and not artist and not album: (output, error) = subprocess.Popen(["osascript", "-e", DEFAULT_ITUNES_PLAY % (song, song, song)], stdout=subproces...
[ "def", "play", "(", "song", ",", "artist", "=", "None", ",", "album", "=", "None", ")", ":", "if", "not", "settings", ".", "platformCompatible", "(", ")", ":", "return", "False", "if", "song", "and", "not", "artist", "and", "not", "album", ":", "(", ...
Tells iTunes to play a given song/artist/album - MACOSX ONLY
[ "Tells", "iTunes", "to", "play", "a", "given", "song", "/", "artist", "/", "album", "-", "MACOSX", "ONLY" ]
a6dbb691145a85b776a1919e4c7930e0ae598437
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L195-L234
train
innolitics/service-locator
servicelocator/lookup.py
service_provider
def service_provider(*services): """ This is a class decorator that declares a class to provide a set of services. It is expected that the class has a no-arg constructor and will be instantiated as a singleton. """ def real_decorator(clazz): instance = clazz() for service in ser...
python
def service_provider(*services): """ This is a class decorator that declares a class to provide a set of services. It is expected that the class has a no-arg constructor and will be instantiated as a singleton. """ def real_decorator(clazz): instance = clazz() for service in ser...
[ "def", "service_provider", "(", "*", "services", ")", ":", "def", "real_decorator", "(", "clazz", ")", ":", "instance", "=", "clazz", "(", ")", "for", "service", "in", "services", ":", "global_lookup", ".", "add", "(", "service", ",", "instance", ")", "r...
This is a class decorator that declares a class to provide a set of services. It is expected that the class has a no-arg constructor and will be instantiated as a singleton.
[ "This", "is", "a", "class", "decorator", "that", "declares", "a", "class", "to", "provide", "a", "set", "of", "services", ".", "It", "is", "expected", "that", "the", "class", "has", "a", "no", "-", "arg", "constructor", "and", "will", "be", "instantiated...
ddccac242587c800db3fde0abb9c1e9ed461369e
https://github.com/innolitics/service-locator/blob/ddccac242587c800db3fde0abb9c1e9ed461369e/servicelocator/lookup.py#L26-L39
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
syllabify
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify_simplex syllabifications = list(syllabify(word)) for word, rules in rank(syllabifications): # post-proces...
python
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify_simplex syllabifications = list(syllabify(word)) for word, rules in rank(syllabifications): # post-proces...
[ "def", "syllabify", "(", "word", ")", ":", "compound", "=", "bool", "(", "re", ".", "search", "(", "r'(-| |=)'", ",", "word", ")", ")", "syllabify", "=", "_syllabify_compound", "if", "compound", "else", "_syllabify_simplex", "syllabifications", "=", "list", ...
Syllabify the given word, whether simplex or complex.
[ "Syllabify", "the", "given", "word", "whether", "simplex", "or", "complex", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L33-L44
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
apply_T2
def apply_T2(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 vv_sequences(WORD): seq = vv.group(2) if not is_diphthong(seq) and not is_long(seq): ...
python
def apply_T2(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 vv_sequences(WORD): seq = vv.group(2) if not is_diphthong(seq) and not is_long(seq): ...
[ "def", "apply_T2", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vv", "in", "vv_sequences", "(", "WORD", ")", ":", "seq", "=", "vv", ".", "group", "(", "2", ")", "if", "not", "is_diphthong", "(", "seq", ")", "and", "not"...
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].
[ "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", "...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L179-L195
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
apply_T5
def apply_T5(word): '''If a (V)VVV sequence contains a VV sequence that could be an /i/-final diphthong, there is a syllable boundary between it and the third vowel, e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an], [säi.e], [oi.om.me].''' WORD = word offset = 0 for v...
python
def apply_T5(word): '''If a (V)VVV sequence contains a VV sequence that could be an /i/-final diphthong, there is a syllable boundary between it and the third vowel, e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an], [säi.e], [oi.om.me].''' WORD = word offset = 0 for v...
[ "def", "apply_T5", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vi", "in", "i_final_diphthong_vvv_sequences", "(", "WORD", ")", ":", "s", "=", "max", "(", "vi", ".", "start", "(", "1", ")", ",", "vi", ".", "start", "(", ...
If a (V)VVV sequence contains a VV sequence that could be an /i/-final diphthong, there is a syllable boundary between it and the third vowel, e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an], [säi.e], [oi.om.me].
[ "If", "a", "(", "V", ")", "VVV", "sequence", "contains", "a", "VV", "sequence", "that", "could", "be", "an", "/", "i", "/", "-", "final", "diphthong", "there", "is", "a", "syllable", "boundary", "between", "it", "and", "the", "third", "vowel", "e", "...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L230-L252
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
apply_T6
def apply_T6(word): '''If a VVV-sequence contains a long vowel, there is a syllable boundary between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an], [mää.yt.te].''' WORD = word offset = 0 for vvv in vvv_sequences(WORD): seq = vvv.group(2) j = 2 if is_long(seq[:2...
python
def apply_T6(word): '''If a VVV-sequence contains a long vowel, there is a syllable boundary between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an], [mää.yt.te].''' WORD = word offset = 0 for vvv in vvv_sequences(WORD): seq = vvv.group(2) j = 2 if is_long(seq[:2...
[ "def", "apply_T6", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vvv", "in", "vvv_sequences", "(", "WORD", ")", ":", "seq", "=", "vvv", ".", "group", "(", "2", ")", "j", "=", "2", "if", "is_long", "(", "seq", "[", ":",...
If a VVV-sequence contains a long vowel, there is a syllable boundary between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an], [mää.yt.te].
[ "If", "a", "VVV", "-", "sequence", "contains", "a", "long", "vowel", "there", "is", "a", "syllable", "boundary", "between", "it", "and", "the", "third", "vowel", "e", ".", "g", ".", "[", "kor", ".", "ke", ".", "aa", "]", "[", "yh", ".", "ti", "."...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L257-L275
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
apply_T7
def apply_T7(word): '''If a VVV-sequence does not contain a potential /i/-final diphthong, there is a syllable boundary between the second and third vowels, e.g. [kau.an], [leu.an], [kiu.as].''' WORD = word offset = 0 for vvv in vvv_sequences(WORD): i = vvv.start(2) + 2 + offset ...
python
def apply_T7(word): '''If a VVV-sequence does not contain a potential /i/-final diphthong, there is a syllable boundary between the second and third vowels, e.g. [kau.an], [leu.an], [kiu.as].''' WORD = word offset = 0 for vvv in vvv_sequences(WORD): i = vvv.start(2) + 2 + offset ...
[ "def", "apply_T7", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vvv", "in", "vvv_sequences", "(", "WORD", ")", ":", "i", "=", "vvv", ".", "start", "(", "2", ")", "+", "2", "+", "offset", "WORD", "=", "WORD", "[", ":",...
If a VVV-sequence does not contain a potential /i/-final diphthong, there is a syllable boundary between the second and third vowels, e.g. [kau.an], [leu.an], [kiu.as].
[ "If", "a", "VVV", "-", "sequence", "does", "not", "contain", "a", "potential", "/", "i", "/", "-", "final", "diphthong", "there", "is", "a", "syllable", "boundary", "between", "the", "second", "and", "third", "vowels", "e", ".", "g", ".", "[", "kau", ...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L280-L294
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
apply_T8
def apply_T8(word): '''Split /ie/, /uo/, or /yö/ sequences in syllables that do not take primary stress.''' WORD = word offset = 0 for vv in tail_diphthongs(WORD): i = vv.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] offset += 1 RULE = ' T8' if word != WORD els...
python
def apply_T8(word): '''Split /ie/, /uo/, or /yö/ sequences in syllables that do not take primary stress.''' WORD = word offset = 0 for vv in tail_diphthongs(WORD): i = vv.start(1) + 1 + offset WORD = WORD[:i] + '.' + WORD[i:] offset += 1 RULE = ' T8' if word != WORD els...
[ "def", "apply_T8", "(", "word", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vv", "in", "tail_diphthongs", "(", "WORD", ")", ":", "i", "=", "vv", ".", "start", "(", "1", ")", "+", "1", "+", "offset", "WORD", "=", "WORD", "[", ":",...
Split /ie/, /uo/, or /yö/ sequences in syllables that do not take primary stress.
[ "Split", "/", "ie", "/", "/", "uo", "/", "or", "/", "yö", "/", "sequences", "in", "syllables", "that", "do", "not", "take", "primary", "stress", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L299-L312
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
wsp
def wsp(word): '''Return the number of unstressed heavy syllables.''' HEAVY = r'[ieaAoO]{1}[\.]*(u|y)[^ieaAoO]+(\.|$)' # # if the word is not monosyllabic, lop off the final syllable, which is # # extrametrical # if '.' in word: # word = word[:word.rindex('.')] # gather the indices of ...
python
def wsp(word): '''Return the number of unstressed heavy syllables.''' HEAVY = r'[ieaAoO]{1}[\.]*(u|y)[^ieaAoO]+(\.|$)' # # if the word is not monosyllabic, lop off the final syllable, which is # # extrametrical # if '.' in word: # word = word[:word.rindex('.')] # gather the indices of ...
[ "def", "wsp", "(", "word", ")", ":", "HEAVY", "=", "r'[ieaAoO]{1}[\\.]*(u|y)[^ieaAoO]+(\\.|$)'", "# # if the word is not monosyllabic, lop off the final syllable, which is", "# # extrametrical", "# if '.' in word:", "# word = word[:word.rindex('.')]", "# gather the indices of syllable ...
Return the number of unstressed heavy syllables.
[ "Return", "the", "number", "of", "unstressed", "heavy", "syllables", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L382-L408
train
tsnaomi/finnsyll
finnsyll/prev/v10.py
pk_prom
def pk_prom(word): '''Return the number of stressed light syllables.''' LIGHT = r'[ieaAoO]{1}[\.]*(u|y)(\.|$)' # # if the word is not monosyllabic, lop off the final syllable, which is # # extrametrical # if '.' in word: # word = word[:word.rindex('.')] # gather the indices of syllable...
python
def pk_prom(word): '''Return the number of stressed light syllables.''' LIGHT = r'[ieaAoO]{1}[\.]*(u|y)(\.|$)' # # if the word is not monosyllabic, lop off the final syllable, which is # # extrametrical # if '.' in word: # word = word[:word.rindex('.')] # gather the indices of syllable...
[ "def", "pk_prom", "(", "word", ")", ":", "LIGHT", "=", "r'[ieaAoO]{1}[\\.]*(u|y)(\\.|$)'", "# # if the word is not monosyllabic, lop off the final syllable, which is", "# # extrametrical", "# if '.' in word:", "# word = word[:word.rindex('.')]", "# gather the indices of syllable bounda...
Return the number of stressed light syllables.
[ "Return", "the", "number", "of", "stressed", "light", "syllables", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L411-L437
train
crdoconnor/pathquery
pathquery/query.py
pathquery.ext
def ext(self, extension): """ Match files with an extension - e.g. 'js', 'txt' """ new_pathq = copy(self) new_pathq._pattern.ext = extension return new_pathq
python
def ext(self, extension): """ Match files with an extension - e.g. 'js', 'txt' """ new_pathq = copy(self) new_pathq._pattern.ext = extension return new_pathq
[ "def", "ext", "(", "self", ",", "extension", ")", ":", "new_pathq", "=", "copy", "(", "self", ")", "new_pathq", ".", "_pattern", ".", "ext", "=", "extension", "return", "new_pathq" ]
Match files with an extension - e.g. 'js', 'txt'
[ "Match", "files", "with", "an", "extension", "-", "e", ".", "g", ".", "js", "txt" ]
4905fef27fc666ea4511eb0eee5098f754bb52ed
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/pathquery/query.py#L104-L110
train
tsnaomi/finnsyll
finnsyll/prev/v04.py
apply_T8
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,...
python
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", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "ie", "in", "ie_sequences", "(", "WORD", ")", ":", "i", "=", "ie", ".", "start", "(", "1", ")", "+", "1", "+", "offset", "WORD", "=", "WORD", "[", ":", ...
Split /ie/ sequences in syllables that do not take primary stress.
[ "Split", "/", "ie", "/", "sequences", "in", "syllables", "that", "do", "not", "take", "primary", "stress", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v04.py#L252-L264
train
tsnaomi/finnsyll
finnsyll/prev/v04.py
apply_T9
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:] ...
python
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", ")", ":", "WORD", "=", "word", "index", "=", "0", "offset", "=", "0", "for", "iu", "in", "iu_sequences", "(", "WORD", ")", ":", "if", "iu", ".", "start", "(", "1", ")", "!=", "index", ":", "i", "=", "iu", ".", ...
Split /iu/ sequences that do not appear in the first, second, or final syllables.
[ "Split", "/", "iu", "/", "sequences", "that", "do", "not", "appear", "in", "the", "first", "second", "or", "final", "syllables", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v04.py#L269-L285
train
QunarOPS/qg.core
qg/core/importutils.py
import_class
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...
python
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", ")", ":", "mod_str", ",", "_sep", ",", "class_str", "=", "import_str", ".", "rpartition", "(", "'.'", ")", "try", ":", "__import__", "(", "mod_str", ")", "return", "getattr", "(", "sys", ".", "modules", "[", "mod...
Returns a class from a string including module and class.
[ "Returns", "a", "class", "from", "a", "string", "including", "module", "and", "class", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/importutils.py#L24-L33
train
QunarOPS/qg.core
qg/core/importutils.py
import_object_ns
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...
python
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", ")", ":", "import_value", "=", "\"%s.%s\"", "%", "(", "name_space", ",", "import_str", ")", "try", ":", "return", "import_class", "(", "import_value",...
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.
[ "Tries", "to", "import", "object", "from", "default", "namespace", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/importutils.py#L41-L52
train
pyBookshelf/bookshelf
bookshelf/api_v2/vagrant.py
install_virtualbox
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...
python
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", ")", ":", "if", "'ubuntu'", "in", "distribution", ":", "with", "hide", "(", "'running'", ",", "'stdout'", ")", ":", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive apt-get update'", ...
install virtualbox
[ "install", "virtualbox" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/vagrant.py#L13-L54
train
pyBookshelf/bookshelf
bookshelf/api_v2/vagrant.py
install_vagrant_plugin
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...
python
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", ")", ":", "cmd", "=", "'vagrant plugin install %s'", "%", "plugin", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ")", ")", ":", "if", "use_sudo", ":", "if",...
install vagrant plugin
[ "install", "vagrant", "plugin" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/vagrant.py#L66-L77
train
OLC-Bioinformatics/sipprverse
MASHsippr/mashsippr.py
MashSippr.runner
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....
python
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", ")", ":", "printtime", "(", "'Starting mashsippr analysis pipeline'", ",", "self", ".", "starttime", ")", "if", "not", "self", ".", "pipeline", ":", "# Create the objects to be used in the analyses", "objects", "=", "Objectprep", "(", "...
Run the necessary methods in the correct order
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MASHsippr/mashsippr.py#L15-L26
train
benoitkugler/abstractDataLibrary
pyDLib/GUI/common.py
abstractDetails.cree_widgets
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...
python
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", ")", ":", "for", "t", "in", "self", ".", "FIELDS", ":", "if", "type", "(", "t", ")", "is", "str", ":", "attr", ",", "kwargs", "=", "t", ",", "{", "}", "else", ":", "attr", ",", "kwargs", "=", "t", "[", "0",...
Create widgets and store them in self.widgets
[ "Create", "widgets", "and", "store", "them", "in", "self", ".", "widgets" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/common.py#L346-L369
train
benoitkugler/abstractDataLibrary
pyDLib/GUI/common.py
abstractDetails.cree_ws_lecture
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...
python
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", ")", ":", "for", "c", "in", "champs_ligne", ":", "label", "=", "ASSOCIATION", "[", "c", "]", "[", "0", "]", "w", "=", "ASSOCIATION", "[", "c", "]", "[", "3", "]", "(", "self", ".", "acces"...
Alternative to create read only widgets. They should be set after.
[ "Alternative", "to", "create", "read", "only", "widgets", ".", "They", "should", "be", "set", "after", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/common.py#L371-L377
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
preservesurrogates
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 = ...
python
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", ")", ":", "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}]\"", "...
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...
[ "Function", "for", "splitting", "a", "string", "into", "a", "list", "of", "characters", "preserving", "surrogate", "pairs", "." ]
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L23-L46
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
_unichr
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: ...
python
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", ")", ":", "if", "not", "isinstance", "(", "i", ",", "int", ")", ":", "raise", "TypeError", "try", ":", "return", "six", ".", "unichr", "(", "i", ")", "except", "ValueError", ":", "# Workaround the error \"ValueError: unichr() arg ...
Helper function for taking a Unicode scalar value and returning a Unicode character. :param s: Unicode scalar value to convert. :return: Unicode character
[ "Helper", "function", "for", "taking", "a", "Unicode", "scalar", "value", "and", "returning", "a", "Unicode", "character", "." ]
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L49-L62
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
_padded_hex
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...
python
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", ")", ":", "result", "=", "hex", "(", "i", ")", "[", "2", ":", "]", "# Remove the leading \"0x\"", "if", "uppercase", ":", "result", "=", "result", ".", "upper", ...
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...
[ "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", ".", ...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L75-L91
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
_uax44lm2transform
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...
python
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", ")", ":", "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...
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...
[ "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...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L94-L135
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
_to_unicode_scalar_value
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 ...
python
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", ")", ":", "if", "len", "(", "s", ")", "==", "1", ":", "return", "ord", "(", "s", ")", "elif", "len", "(", "s", ")", "==", "2", ":", "return", "(", "ord", "(", "s", "[", "0", "]", ")", "-", "0xD800"...
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...
[ "Helper", "function", "for", "converting", "a", "character", "or", "surrogate", "pair", "into", "a", "Unicode", "scalar", "value", "e", ".", "g", ".", "\\", "ud800", "\\", "udc00", "-", ">", "0x10000" ]
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L138-L162
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
_get_nr_prefix
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...
python
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", ")", ":", "for", "lookup_range", ",", "prefix_string", "in", "_nr_prefix_strings", ".", "items", "(", ")", ":", "if", "i", "in", "lookup_range", ":", "return", "prefix_string", "raise", "ValueError", "(", "\"No prefix string as...
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.
[ "Helper", "function", "for", "looking", "up", "the", "derived", "name", "prefix", "associated", "with", "a", "Unicode", "scalar", "value", "." ]
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L198-L208
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
casefold
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. ...
python
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", ")", ":", "if", "not", "isinstance", "(", "s", ",", "six", ".", "text_type", ")", ":", "raise", "TypeError", "(", "u\"String to casefold must be of type 'unic...
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...
[ "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...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L522-L560
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
UnicodeData._build_unicode_character_database
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...
python
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", ")", ":", "filename", "=", "\"UnicodeData.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "tag", "=", "re", ".", "com...
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/
[ "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", ...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L228-L278
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
UnicodeData.lookup_by_name
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: ...
python
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", ")", ":", "try", ":", "return", "self", ".", "_name_database", "[", "_uax44lm2transform", "(", "name", ")", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "u\"Unknown character name: '{0}'!\"", ".", ...
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...
[ "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", "...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L339-L359
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
UnicodeData.lookup_by_partial_name
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 ...
python
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", ")", ":", "for", "k", ",", "v", "in", "self", ".", "_name_database", ".", "items", "(", ")", ":", "if", "_uax44lm2transform", "(", "partial_name", ")", "in", "k", ":", "yield", "v" ]
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...
[ "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...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L361-L383
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
UnicodeBlocks._load_unicode_block_info
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" ...
python
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", ")", ":", "filename", "=", "\"Blocks.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "codecs", ".", "open", "(", "os...
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/
[ "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...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L394-L409
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
CaseFoldingMap._build_casefold_map
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...
python
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", ")", ":", "self", ".", "_casefold_map", "=", "defaultdict", "(", "dict", ")", "filename", "=", "\"CaseFolding.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", ...
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/
[ "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...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L473-L489
train
leonidessaguisagjr/unicodeutil
unicodeutil/unicodeutil.py
CaseFoldingMap.lookup
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...
python
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\"", ")", ":", "if", "not", "isinstance", "(", "c", ",", "six", ".", "text_type", ")", ":", "raise", "TypeError", "(", "u\"Character to lookup must be of type 'unicode'!\"", ")", "for", "...
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. ...
[ "Function", "to", "lookup", "a", "character", "in", "the", "casefold", "map", "." ]
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/unicodeutil.py#L491-L516
train
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/models.py
RegistryResponse.load_from_json
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...
python
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", ")", ":", "if", "isinstance", "(", "data", ",", "str", ")", ":", "data", "=", "json", ".", "loads", "(", "data", ")", "applications", "=", "[", "ApplicationResponse", ".", "load_from_json", "(", "a", ")", "for", "a...
Load a :class:`RegistryReponse` from a dictionary or a string (that will be parsed as json).
[ "Load", "a", ":", "class", ":", "RegistryReponse", "from", "a", "dictionary", "or", "a", "string", "(", "that", "will", "be", "parsed", "as", "json", ")", "." ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/models.py#L26-L39
train
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/models.py
ApplicationResponse.load_from_json
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...
python
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", ")", ":", "if", "isinstance", "(", "data", ",", "str", ")", ":", "data", "=", "json", ".", "loads", "(", "data", ")", "items", "=", "[", "Item", ".", "load_from_json", "(", "a", ")", "for", "a", "in", "data", ...
Load a :class:`ApplicationResponse` from a dictionary or string (that will be parsed as json).
[ "Load", "a", ":", "class", ":", "ApplicationResponse", "from", "a", "dictionary", "or", "string", "(", "that", "will", "be", "parsed", "as", "json", ")", "." ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/models.py#L76-L87
train
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/models.py
Item.load_from_json
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'])
python
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", ")", ":", "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)
[ "Load", "a", ":", "class", ":", "Item", "from", "a", "dictionary", "ot", "string", "(", "that", "will", "be", "parsed", "as", "json", ")" ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/models.py#L114-L121
train
tsnaomi/finnsyll
finnsyll/prev/v11.py
apply_T11
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) +...
python
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", ")", ":", "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...
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/.
[ "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", "/", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v11.py#L347-L361
train
tsnaomi/finnsyll
finnsyll/prev/v11.py
apply_T12
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...
python
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", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vv", "in", "new_vv", "(", "WORD", ")", ":", "# import pdb; pdb.set_trace()", "seq", "=", "vv", ".", "group", "(", "1", ")", "if", "not", "is_diphthong", "(", ...
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].
[ "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", "...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v11.py#L366-L383
train
tsnaomi/finnsyll
finnsyll/prev/v09.py
_syllabify_simplex
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...
python
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", ")", ":", "word", ",", "rules", "=", "apply_T1", "(", "word", ")", "if", "re", ".", "search", "(", "r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*'", ",", "word", ")", ":", "word", ",", "T2", "=", "apply_T2", "(", "word...
Syllabify the given word.
[ "Syllabify", "the", "given", "word", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v09.py#L66-L95
train
tsnaomi/finnsyll
finnsyll/prev/v09.py
apply_T9
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: ...
python
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", ")", ":", "WORD", "=", "word", "index", "=", "0", "offset", "=", "0", "for", "iu", "in", "iu_sequences", "(", "WORD", ")", ":", "if", "iu", ".", "start", "(", "1", ")", "!=", "index", ":", "i", "=", "iu", ".", ...
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.
[ "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...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v09.py#L323-L349
train
tsnaomi/finnsyll
finnsyll/prev/v09.py
apply_T10
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...
python
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", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "iou", "in", "iou_sequences", "(", "WORD", ")", ":", "i", "=", "iou", ".", "start", "(", "1", ")", "+", "1", "+", "offset", "WORD", "=", "WORD", "[", ":"...
Any /iou/ sequence contains a syllable boundary between the first and second vowel.
[ "Any", "/", "iou", "/", "sequence", "contains", "a", "syllable", "boundary", "between", "the", "first", "and", "second", "vowel", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v09.py#L354-L367
train
tsnaomi/finnsyll
finnsyll/v13.py
T1
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 ...
python
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", ")", ":", "# 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", "", "", ...
Insert a syllable boundary in front of every CV sequence.
[ "Insert", "a", "syllable", "boundary", "in", "front", "of", "every", "CV", "sequence", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L80-L158
train
tsnaomi/finnsyll
finnsyll/v13.py
T2
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...
python
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", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vv", "in", "vv_sequences", "(", "WORD", ")", ":", "seq", "=", "vv", ".", "group", "(", "1", ")", "if", "not", "phon", ".", "is_diphthong", "(", "...
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.
[ "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", ...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L163-L179
train
tsnaomi/finnsyll
finnsyll/v13.py
T4
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(...
python
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", ")", ":", "WORD", "=", "re", ".", "split", "(", "r'([ieaouäöy]+[^ieaouäöy]+\\.*[ieaoäö]{1}(?:u|y)(?:\\.*[^ieaouäöy]+|$))', # noq", "a", "", "word", ",", "flags", "=", "re", ".", "I", "|", "re", ".", "U", ")", "PARTS",...
Optionally split /u,y/-final diphthongs that do not take primary stress. E.g., [lau.ka.us], [va.ka.ut.taa].
[ "Optionally", "split", "/", "u", "y", "/", "-", "final", "diphthongs", "that", "do", "not", "take", "primary", "stress", ".", "E", ".", "g", ".", "[", "lau", ".", "ka", ".", "us", "]", "[", "va", ".", "ka", ".", "ut", ".", "taa", "]", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L190-L217
train
tsnaomi/finnsyll
finnsyll/v13.py
T6
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): ...
python
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", ")", ":", "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.öön], [ruu.an], [mää.yt.te].
[ "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", "."...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L222-L253
train
tsnaomi/finnsyll
finnsyll/v13.py
T8
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 '...
python
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", ")", ":", "WORD", "=", "word", "try", ":", "vv", "=", "tail_diphthongs", "(", "WORD", ")", "i", "=", "vv", ".", "start", "(", "1", ")", "+", "1", "WORD", "=", "WORD", "[", ":", "i", "]", "+", "word", ...
Join /ie/, /uo/, or /yö/ sequences in syllables that take primary stress.
[ "Join", "/", "ie", "/", "/", "uo", "/", "or", "/", "yö", "/", "sequences", "in", "syllables", "that", "take", "primary", "stress", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L258-L273
train
tsnaomi/finnsyll
finnsyll/v13.py
T11
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...
python
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", ")", ":", "WORD", "=", "word", "offset", "=", "0", "for", "vvv", "in", "precedence_sequences", "(", "WORD", ")", ":", "i", "=", "vvv", ".", "start", "(", "1", ")", "+", "(", "1", "if", "vvv", ".", "group...
If a VVV sequence contains a /u,y/-final diphthong, insert a syllable boundary between the diphthong and the third vowel.
[ "If", "a", "VVV", "sequence", "contains", "a", "/", "u", "y", "/", "-", "final", "diphthong", "insert", "a", "syllable", "boundary", "between", "the", "diphthong", "and", "the", "third", "vowel", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L278-L291
train
tsnaomi/finnsyll
finnsyll/v13.py
pk_prom
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]): ...
python
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", ")", ":", "violations", "=", "0", "stressed", "=", "[", "]", "for", "w", "in", "extract_words", "(", "word", ")", ":", "stressed", "+=", "w", ".", "split", "(", "'.'", ")", "[", "2", ":", "-", "1", ":", "2", "]", ...
Return the number of stressed light syllables.
[ "Return", "the", "number", "of", "stressed", "light", "syllables", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L373-L392
train
tsnaomi/finnsyll
finnsyll/v13.py
rank
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...
python
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", ")", ":", "# 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...
Rank syllabifications.
[ "Rank", "syllabifications", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/v13.py#L400-L417
train
moralrecordings/mrcrowbar
mrcrowbar/lib/images/base.py
CodecImage.ansi_format_iter
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...
python
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", ")", ":", "image", "...
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...
[ "Return", "the", "ANSI", "escape", "sequence", "to", "render", "the", "image", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/lib/images/base.py#L87-L139
train
moralrecordings/mrcrowbar
mrcrowbar/lib/images/base.py
IndexedImage.ansi_format_iter
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...
python
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", "=...
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...
[ "Return", "the", "ANSI", "escape", "sequence", "to", "render", "the", "image", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/lib/images/base.py#L192-L270
train
obulpathi/cdn-fastly-python
bin/fastly_purge_url.py
main
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", ...
python
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", "(", ")", ":", "parser", "=", "OptionParser", "(", "description", "=", "\"Purge a single url from fastly.\"", ")", "parser", ".", "add_option", "(", "\"-k\"", ",", "\"--key\"", ",", "dest", "=", "\"apikey\"", ",", "default", "=", "\"\"", ",", ...
Purge a single fastly url
[ "Purge", "a", "single", "fastly", "url" ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/bin/fastly_purge_url.py#L34-L57
train
benoitkugler/abstractDataLibrary
pyDLib/GUI/tabs.py
abstractModule.set_callbacks
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....
python
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", ")", ":", "for", "action", "in", "self", ".", "interface", ".", "CALLBACKS", ":", "try", ":", "f", "=", "dic_functions", "[", "action", "]", "except", "KeyError", ":", "pass", "else", ...
Register callbacks needed by the interface object
[ "Register", "callbacks", "needed", "by", "the", "interface", "object" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/tabs.py#L37-L53
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Configurable.populate
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...
python
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", ")", ":", "section", "=", "self", ".", "default_section", "if", "section", "is", "None", "else", "section", "obj", "=", "Settings", "...
Set attributes in ``obj`` with ``setattr`` from the all values in ``section``.
[ "Set", "attributes", "in", "obj", "with", "setattr", "from", "the", "all", "values", "in", "section", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L49-L77
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Configurable._get_calling_module
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}') ...
python
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", ")", ":", "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.
[ "Get", "the", "last", "module", "in", "the", "call", "stack", "that", "is", "not", "this", "module", "or", "None", "if", "the", "call", "originated", "from", "this", "module", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L79-L90
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Configurable.resource_filename
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...
python
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", ")", ":", "if", "module_name", "is", "None", ":", "mod", "=", "self", ".", "_get_calling_module", "(", ")", "logger", ".", "debug", "(", "f'calling module: {mod}'",...
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) ...
[ "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...
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L92-L115
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.parser
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...
python
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", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_conf'", ")", ":", "cfile", "=", "self", ".", "config_file", "logger", ".", "debug", "(", "'loading config %s'", "%", "cfile", ")", "if", "os", ".", "path", ".", "isf...
Load the configuration file.
[ "Load", "the", "configuration", "file", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L144-L159
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.get_options
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...
python
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", ")", ":", "vars", "=", "vars", "if", "vars", "else", "self", ".", "default_vars", "conf", "=", "self", ".", "parser", "opts", ...
Get all options for a section. If ``opt_keys`` is given return only options with those keys.
[ "Get", "all", "options", "for", "a", "section", ".", "If", "opt_keys", "is", "given", "return", "only", "options", "with", "those", "keys", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L165-L188
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.get_option
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 ...
python
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", ")", ":", "vars", "=", "vars", "if", "vars", "else", "self", ".", "default_vars", "if", "section", "is", "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``
[ "Return", "an", "option", "from", "section", "with", "name", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L190-L206
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.get_option_list
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 []
python
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", "=", "','", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", ...
Just like ``get_option`` but parse as a list using ``split``.
[ "Just", "like", "get_option", "but", "parse", "as", "a", "list", "using", "split", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L208-L214
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.get_option_boolean
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'
python
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", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", ...
Just like ``get_option`` but parse as a boolean (any case `true`).
[ "Just", "like", "get_option", "but", "parse", "as", "a", "boolean", "(", "any", "case", "true", ")", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L216-L222
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.get_option_int
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)
python
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", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", "if...
Just like ``get_option`` but parse as an integer.
[ "Just", "like", "get_option", "but", "parse", "as", "an", "integer", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L224-L228
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.get_option_float
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)
python
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", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", "...
Just like ``get_option`` but parse as a float.
[ "Just", "like", "get_option", "but", "parse", "as", "a", "float", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L230-L234
train
plandes/actioncli
src/python/zensols/actioncli/config.py
Config.get_option_path
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)
python
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", ")", ":", "val", "=", "self", ".", "get_option", "(", "name", ",", "section", ",", "vars", ",", "expect", ")", "r...
Just like ``get_option`` but return a ``pathlib.Path`` object of the string.
[ "Just", "like", "get_option", "but", "return", "a", "pathlib", ".", "Path", "object", "of", "the", "string", "." ]
d1c4ea27e6f3394b30a1652ddd4b916160662773
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/config.py#L236-L242
train
moralrecordings/mrcrowbar
mrcrowbar/refs.py
property_get
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...
python
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", ")", ":", "if", "isinstance", "(", "prop", ",", "Ref", ")", ":", "return", "prop", ".", "get", "(", "instance", ",", "*", "*", "kwargs", ")", "return", "prop" ]
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.
[ "Wrapper", "for", "property", "reads", "which", "auto", "-", "dereferences", "Refs", "if", "required", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L101-L112
train
moralrecordings/mrcrowbar
mrcrowbar/refs.py
property_set
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. ...
python
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", ")", ":", "if", "isinstance", "(", "prop", ",", "Ref", ")", ":", "return", "prop", ".", "set", "(", "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. Throws AttributeError if prop is not a Ref.
[ "Wrapper", "for", "property", "writes", "which", "auto", "-", "deferences", "Refs", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L115-L132
train
moralrecordings/mrcrowbar
mrcrowbar/refs.py
view_property
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...
python
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", ")", ":", "def", "getter", "(", "self", ")", ":", "return", "property_get", "(", "getattr", "(", "self", ",", "prop", ")", ",", "self", ".", "parent", ")", "def", "setter", "(", "self", ",", "value", ")", ":", "...
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.
[ "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...
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L135-L150
train
moralrecordings/mrcrowbar
mrcrowbar/refs.py
Ref.get
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
python
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", ")", ":", "target", "=", "instance", "for", "attr", "in", "self", ".", "_path", ":", "target", "=", "getattr", "(", "target", ",", "attr", ")", "return", "target" ]
Return an attribute from an object using the Ref path. instance The object instance to traverse.
[ "Return", "an", "attribute", "from", "an", "object", "using", "the", "Ref", "path", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L33-L42
train
moralrecordings/mrcrowbar
mrcrowbar/refs.py
Ref.set
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: ...
python
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", ")", ":", "if", "not", "self", ".", "_allow_write", ":", "raise", "AttributeError", "(", "\"can't set Ref directly, allow_write is disabled\"", ")", "target", "=", "instance", "...
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.
[ "Set", "an", "attribute", "on", "an", "object", "using", "the", "Ref", "path", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L44-L61
train
ProjetPP/PPP-libmodule-Python
ppp_libmodule/shortcuts.py
traverse_until_fixpoint
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...
python
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", ")", ":", "old_tree", "=", "None", "tree", "=", "simplify", "(", "tree", ")", "while", "tree", "and", "old_tree", "!=", "tree", ":", "old_tree", "=", "tree", "tree", "=", "tree", ".", "trav...
Traverses the tree again and again until it is not modified.
[ "Traverses", "the", "tree", "again", "and", "again", "until", "it", "is", "not", "modified", "." ]
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/shortcuts.py#L6-L16
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.runner
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()) ...
python
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", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "# Initialise the GenObject", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ...
Run the necessary methods in the correct order
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L19-L39
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.fasta
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...
python
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", ")", ":", "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...
Create FASTA files of the PointFinder results to be fed into PointFinder
[ "Create", "FASTA", "files", "of", "the", "PointFinder", "results", "to", "be", "fed", "into", "PointFinder" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L41-L64
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.run_pointfinder
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...
python
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", ")", ":", "logging", ".", "info", "(", "'Running PointFinder on FASTA files'", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "runmetadata", ".", "samples", ")", ")", ":", "# Start threads", "threads", "=...
Run PointFinder on the FASTA sequences extracted from the raw reads
[ "Run", "PointFinder", "on", "the", "FASTA", "sequences", "extracted", "from", "the", "raw", "reads" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L66-L99
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.populate_summary_dict
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...
python
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", "(", ")", ")", ":", "# If the genus is not provided, generate the generic dictionary", "if", "not", "genus", ":", "# Populate the summary dict", "self", ".", "...
: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...
[ ":", "param", "genus", ":", "Non", "-", "supported", "genus", "to", "be", "added", "to", "the", "dictionary", ":", "param", "key", ":", "section", "of", "dictionary", "to", "be", "populated", ".", "Supported", "keys", "are", ":", "prediction", "table", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L107-L213
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.parse_pointfinder
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....
python
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 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...
Create summary reports for the PointFinder outputs
[ "Create", "summary", "reports", "for", "the", "PointFinder", "outputs" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L215-L275
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.write_report
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, :...
python
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", ")", ":", "# Set the header string if the summary report doesn't already exist", "if", "not", "os", ".", "path", ".", "isfile", "(", "summary_dict", "[", "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, :param genus: MASH-calculated genus of current isolate :param ke...
[ "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",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L278-L342
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.write_table_report
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...
python
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", ")", ":", "# Set the header string if the summary report doesn't already exist", "if", "not", "os", ".", "path", ".", "isfile", "(", "summary_dict", "[", "genus", "]", "[", "'table'", "]",...
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
[ "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...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L345-L403
train
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSipping.targets
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: ...
python
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", ")", ":", "logging", ".", "info", "(", "'Performing analysis with {} targets folder'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "runmetadata", ":", "sample", "[", "self", "....
Search the targets folder for FASTA files, create the multi-FASTA file of all targets if necessary, and populate objects
[ "Search", "the", "targets", "folder", "for", "FASTA", "files", "create", "the", "multi", "-", "FASTA", "file", "of", "all", "targets", "if", "necessary", "and", "populate", "objects" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L426-L467
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.strains
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...
python
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", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'strains.csv'", ")", ")", "as", "strains", ":", "next", "(", "strains", ")", "for", "line", "in", "strains", ":", "oln", ...
Create a dictionary of SEQID: OLNID from the supplied
[ "Create", "a", "dictionary", "of", "SEQID", ":", "OLNID", "from", "the", "supplied" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L33-L45
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.sequence_prep
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...
python
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 a sorted list of all the FASTA files in the sequence path", "strains", "=", "sorted", "(", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "fastapath", ",", "'*.fa*'", ".", "format", "(", "s...
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", "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...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L47-L89
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.write_json
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 ...
python
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", ")", ":", "# 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", "(", ...
Write the metadata object to file :param metadata: Metadata object
[ "Write", "the", "metadata", "object", "to", "file", ":", "param", "metadata", ":", "Metadata", "object" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L92-L100
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.read_json
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: ...
python
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", ")", ":", "# Load the metadata object from the file", "with", "open", "(", "json_metadata", ")", "as", "metadatareport", ":", "jsondata", "=", "json", ".", "load", "(", "metadatareport", ")", "# Create the metadata objects", "...
Read the metadata object from file :param json_metadata: Path and file name of JSON-formatted metadata object file :return: metadata object
[ "Read", "the", "metadata", "object", "from", "file", ":", "param", "json_metadata", ":", "Path", "and", "file", "name", "of", "JSON", "-", "formatted", "metadata", "object", "file", ":", "return", ":", "metadata", "object" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L103-L120
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.assembly_length
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...
python
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", ")", ":", "for", "sample", "in", "self", ".", "metadata", ":", "# Only determine the assembly length if is has not been previously calculated", "if", "not", "GenObject", ".", "isattr", "(", "sample", ",", "'assembly_length'", ")", ...
Use SeqIO.parse to extract the total number of bases in each assembly file
[ "Use", "SeqIO", ".", "parse", "to", "extract", "the", "total", "number", "of", "bases", "in", "each", "assembly", "file" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L122-L135
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.simulate_reads
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...
python
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", ")", ":", "logging", ".", "info", "(", "'Read simulation'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Create the simulated_reads GenObject", "sample", ".", "simulated_reads", "=", "GenObject", "(", ")", "#...
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
[ "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...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L137-L295
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.read_length_adjust
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...
python
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", ")", ":", "logging", ".", "info", "(", "'Trimming {at} reads'", ".", "format", "(", "at", "=", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Iterate through all ...
Trim the reads to the correct length using reformat.sh :param analysistype: current analysis type. Will be either 'simulated' or 'sampled'
[ "Trim", "the", "reads", "to", "the", "correct", "length", "using", "reformat", ".", "sh", ":", "param", "analysistype", ":", "current", "analysis", "type", ".", "Will", "be", "either", "simulated", "or", "sampled" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L297-L378
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.read_quality_trim
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...
python
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", ")", ":", "logging", ".", "info", "(", "'Quality trim'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "sample", ".", "sampled_reads", "=", "GenObject", "(", ")", "sample", ".", "sampled_reads", ".", "ou...
Perform quality trim, and toss reads below appropriate thresholds
[ "Perform", "quality", "trim", "and", "toss", "reads", "below", "appropriate", "thresholds" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L380-L470
train
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.sample_reads
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: ...
python
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", ")", ":", "logging", ".", "info", "(", "'Read sampling'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Iterate through all the desired depths of coverage", "for", "depth", "in", "self", ".", "read_depths", ":", ...
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
[ "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" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L472-L535
train