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
3 values
summary
stringlengths
4
350
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.deactivate_version
def deactivate_version(self, service_id, version_number): """Deactivate the current version.""" content = self._fetch("/service/%s/version/%d/deactivate" % (service_id, version_number), method="PUT") return FastlyVersion(self, content)
python
def deactivate_version(self, service_id, version_number): """Deactivate the current version.""" content = self._fetch("/service/%s/version/%d/deactivate" % (service_id, version_number), method="PUT") return FastlyVersion(self, content)
[ "def", "deactivate_version", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/deactivate\"", "%", "(", "service_id", ",", "version_number", ")", ",", "method", "=", "\"PUT\"", ...
Deactivate the current version.
[ "Deactivate", "the", "current", "version", "." ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L965-L968
train
Deactivate the current version.
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.validate_version
def validate_version(self, service_id, version_number): """Validate the version for a particular service and version.""" content = self._fetch("/service/%s/version/%d/validate" % (service_id, version_number)) return self._status(content)
python
def validate_version(self, service_id, version_number): """Validate the version for a particular service and version.""" content = self._fetch("/service/%s/version/%d/validate" % (service_id, version_number)) return self._status(content)
[ "def", "validate_version", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/validate\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "self", ".", "_statu...
Validate the version for a particular service and version.
[ "Validate", "the", "version", "for", "a", "particular", "service", "and", "version", "." ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L971-L974
train
Validate the version for a particular service and version.
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.lock_version
def lock_version(self, service_id, version_number): """Locks the specified version.""" content = self._fetch("/service/%s/version/%d/lock" % (service_id, version_number)) return self._status(content)
python
def lock_version(self, service_id, version_number): """Locks the specified version.""" content = self._fetch("/service/%s/version/%d/lock" % (service_id, version_number)) return self._status(content)
[ "def", "lock_version", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/lock\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "self", ".", "_status", "(...
Locks the specified version.
[ "Locks", "the", "specified", "version", "." ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L977-L980
train
Locks the specified version.
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.list_wordpressess
def list_wordpressess(self, service_id, version_number): """Get all of the wordpresses for a specified service and version.""" content = self._fetch("/service/%s/version/%d/wordpress" % (service_id, version_number)) return map(lambda x: FastlyWordpress(self, x), content)
python
def list_wordpressess(self, service_id, version_number): """Get all of the wordpresses for a specified service and version.""" content = self._fetch("/service/%s/version/%d/wordpress" % (service_id, version_number)) return map(lambda x: FastlyWordpress(self, x), content)
[ "def", "list_wordpressess", "(", "self", ",", "service_id", ",", "version_number", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/wordpress\"", "%", "(", "service_id", ",", "version_number", ")", ")", "return", "map", "(", "lambd...
Get all of the wordpresses for a specified service and version.
[ "Get", "all", "of", "the", "wordpresses", "for", "a", "specified", "service", "and", "version", "." ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L983-L986
train
Get all of the wordpresses for a specified service and version.
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.create_wordpress
def create_wordpress(self, service_id, version_number, name, path, comment=None): """Create a wordpress for the specified service and version.""" body = self._formdata({ "name": name, "path": path, "comment": comment, }, FastlyWordpress.FIELDS) content = self._fetch("/service/%s/version/%d/wo...
python
def create_wordpress(self, service_id, version_number, name, path, comment=None): """Create a wordpress for the specified service and version.""" body = self._formdata({ "name": name, "path": path, "comment": comment, }, FastlyWordpress.FIELDS) content = self._fetch("/service/%s/version/%d/wo...
[ "def", "create_wordpress", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ",", "path", ",", "comment", "=", "None", ")", ":", "body", "=", "self", ".", "_formdata", "(", "{", "\"name\"", ":", "name", ",", "\"path\"", ":", "path", "...
Create a wordpress for the specified service and version.
[ "Create", "a", "wordpress", "for", "the", "specified", "service", "and", "version", "." ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L989-L1002
train
Create a wordpress for the specified service and version.
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.get_wordpress
def get_wordpress(self, service_id, version_number, name): """Get information on a specific wordpress.""" content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name)) return FastlyWordpress(self, content)
python
def get_wordpress(self, service_id, version_number, name): """Get information on a specific wordpress.""" content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name)) return FastlyWordpress(self, content)
[ "def", "get_wordpress", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/wordpress/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ")", "...
Get information on a specific wordpress.
[ "Get", "information", "on", "a", "specific", "wordpress", "." ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L1005-L1008
train
Get information on a specific wordpress.
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.update_wordpress
def update_wordpress(self, service_id, version_number, name_key, **kwargs): """Update a specified wordpress.""" body = self._formdata(kwargs, FastlyWordpress.FIELDS) content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name_key), method="PUT", body=body) return FastlyWordpr...
python
def update_wordpress(self, service_id, version_number, name_key, **kwargs): """Update a specified wordpress.""" body = self._formdata(kwargs, FastlyWordpress.FIELDS) content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name_key), method="PUT", body=body) return FastlyWordpr...
[ "def", "update_wordpress", "(", "self", ",", "service_id", ",", "version_number", ",", "name_key", ",", "*", "*", "kwargs", ")", ":", "body", "=", "self", ".", "_formdata", "(", "kwargs", ",", "FastlyWordpress", ".", "FIELDS", ")", "content", "=", "self", ...
Update a specified wordpress.
[ "Update", "a", "specified", "wordpress", "." ]
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L1011-L1015
train
Update a specified wordpress.
tsnaomi/finnsyll
finnsyll/syllabifier.py
FinnSyll.annotate
def annotate(self, word): '''Annotate 'word' for syllabification, stress, weights, and vowels.''' info = [] # e.g., [ ('\'nak.su.`tus.ta', 'PUSU', 'HLHL', 'AUUA'), ] for syllabification, _ in syllabify(self.normalize(word), stress=True): stresses = '' weights = '' ...
python
def annotate(self, word): '''Annotate 'word' for syllabification, stress, weights, and vowels.''' info = [] # e.g., [ ('\'nak.su.`tus.ta', 'PUSU', 'HLHL', 'AUUA'), ] for syllabification, _ in syllabify(self.normalize(word), stress=True): stresses = '' weights = '' ...
[ "def", "annotate", "(", "self", ",", "word", ")", ":", "info", "=", "[", "]", "# e.g., [ ('\\'nak.su.`tus.ta', 'PUSU', 'HLHL', 'AUUA'), ]", "for", "syllabification", ",", "_", "in", "syllabify", "(", "self", ".", "normalize", "(", "word", ")", ",", "stress", "...
Annotate 'word' for syllabification, stress, weights, and vowels.
[ "Annotate", "word", "for", "syllabification", "stress", "weights", "and", "vowels", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/syllabifier.py#L114-L150
train
Annotate word for syllabification stress weights and vowels.
OLC-Bioinformatics/sipprverse
serosippr/serosippr.py
SeroSippr.runner
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Run the analyses Sippr(self, self.cutoff) self.serotype_escherichia() self.serotype_salmonella() # Cr...
python
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Run the analyses Sippr(self, self.cutoff) self.serotype_escherichia() self.serotype_salmonella() # Cr...
[ "def", "runner", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "# Run the analyses", "Sippr", "(", "self", ",", "self", ".", "cutoff", ")", "self", ".", "se...
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/serosippr/serosippr.py#L16-L28
train
Run the analyses in the correct order and create the reports and metadata printers.
OLC-Bioinformatics/sipprverse
serosippr/serosippr.py
SeroSippr.reporter
def reporter(self): """ Creates a report of the results """ logging.info('Creating {} report'.format(self.analysistype)) # Create the path in which the reports are stored make_path(self.reportpath) header = 'Strain,Serotype\n' data = '' with open(o...
python
def reporter(self): """ Creates a report of the results """ logging.info('Creating {} report'.format(self.analysistype)) # Create the path in which the reports are stored make_path(self.reportpath) header = 'Strain,Serotype\n' data = '' with open(o...
[ "def", "reporter", "(", "self", ")", ":", "logging", ".", "info", "(", "'Creating {} report'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "# Create the path in which the reports are stored", "make_path", "(", "self", ".", "reportpath", ")", "header...
Creates a report of the results
[ "Creates", "a", "report", "of", "the", "results" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/serosippr/serosippr.py#L30-L65
train
Creates a report of the results of the selected analyses
OLC-Bioinformatics/sipprverse
serosippr/serosippr.py
SeroSippr.serotype_escherichia
def serotype_escherichia(self): """ Create attributes storing the best results for the O and H types """ for sample in self.runmetadata.samples: # Initialise negative results to be overwritten when necessary sample[self.analysistype].best_o_pid = '-' s...
python
def serotype_escherichia(self): """ Create attributes storing the best results for the O and H types """ for sample in self.runmetadata.samples: # Initialise negative results to be overwritten when necessary sample[self.analysistype].best_o_pid = '-' s...
[ "def", "serotype_escherichia", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "# Initialise negative results to be overwritten when necessary", "sample", "[", "self", ".", "analysistype", "]", ".", "best_o_pid", "=", "...
Create attributes storing the best results for the O and H types
[ "Create", "attributes", "storing", "the", "best", "results", "for", "the", "O", "and", "H", "types" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/serosippr/serosippr.py#L67-L108
train
Create attributes storing the best results for the O and H types
tsnaomi/finnsyll
finnsyll/prev/v02.py
_syllabify
def _syllabify(word): '''Syllabify the given word.''' word = replace_umlauts(word) word, CONTINUE_VV, CONTINUE_VVV, applied_rules = apply_T1(word) if CONTINUE_VV: word, T2 = apply_T2(word) word, T4 = apply_T4(word) applied_rules += T2 + T4 if CONTINUE_VVV: word, T5 ...
python
def _syllabify(word): '''Syllabify the given word.''' word = replace_umlauts(word) word, CONTINUE_VV, CONTINUE_VVV, applied_rules = apply_T1(word) if CONTINUE_VV: word, T2 = apply_T2(word) word, T4 = apply_T4(word) applied_rules += T2 + T4 if CONTINUE_VVV: word, T5 ...
[ "def", "_syllabify", "(", "word", ")", ":", "word", "=", "replace_umlauts", "(", "word", ")", "word", ",", "CONTINUE_VV", ",", "CONTINUE_VVV", ",", "applied_rules", "=", "apply_T1", "(", "word", ")", "if", "CONTINUE_VV", ":", "word", ",", "T2", "=", "app...
Syllabify the given word.
[ "Syllabify", "the", "given", "word", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v02.py#L36-L54
train
Syllabify the given word.
tsnaomi/finnsyll
finnsyll/prev/v02.py
apply_T1
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' T1 = ' T1' WORD = _split_consonants_and_vowels(word) CONTINUE_VV = 0 CONTINUE_VVV = 0 for i, v in enumerate(WORD): if i == 0 and is_consonant(v[0][0]): continue elif is_consonant(...
python
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' T1 = ' T1' WORD = _split_consonants_and_vowels(word) CONTINUE_VV = 0 CONTINUE_VVV = 0 for i, v in enumerate(WORD): if i == 0 and is_consonant(v[0][0]): continue elif is_consonant(...
[ "def", "apply_T1", "(", "word", ")", ":", "T1", "=", "' T1'", "WORD", "=", "_split_consonants_and_vowels", "(", "word", ")", "CONTINUE_VV", "=", "0", "CONTINUE_VVV", "=", "0", "for", "i", ",", "v", "in", "enumerate", "(", "WORD", ")", ":", "if", "i", ...
There is a syllable boundary in front of every CV-sequence.
[ "There", "is", "a", "syllable", "boundary", "in", "front", "of", "every", "CV", "-", "sequence", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v02.py#L59-L84
train
This function applies T1 to the word.
tsnaomi/finnsyll
finnsyll/prev/v02.py
apply_T2
def apply_T2(word): '''There is a syllable boundary within a sequence VV of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].''' T2 = '' WORD = word.split('.') for i, v in enumerate(WORD): if not contains_diphthong(v): VV = contains_VV(v) ...
python
def apply_T2(word): '''There is a syllable boundary within a sequence VV of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].''' T2 = '' WORD = word.split('.') for i, v in enumerate(WORD): if not contains_diphthong(v): VV = contains_VV(v) ...
[ "def", "apply_T2", "(", "word", ")", ":", "T2", "=", "''", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "for", "i", ",", "v", "in", "enumerate", "(", "WORD", ")", ":", "if", "not", "contains_diphthong", "(", "v", ")", ":", "VV", "=", "co...
There is a syllable boundary within a sequence VV of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].
[ "There", "is", "a", "syllable", "boundary", "within", "a", "sequence", "VV", "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/v02.py#L118-L136
train
This function applies T2 to the word.
tsnaomi/finnsyll
finnsyll/prev/v02.py
apply_T4
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' T4 = '' WORD = word.split('.') for i, v in enumerate(WORD): # i % 2 != 0 prevents this rule from applying to first, ...
python
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' T4 = '' WORD = word.split('.') for i, v in enumerate(WORD): # i % 2 != 0 prevents this rule from applying to first, ...
[ "def", "apply_T4", "(", "word", ")", ":", "T4", "=", "''", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "for", "i", ",", "v", "in", "enumerate", "(", "WORD", ")", ":", "# i % 2 != 0 prevents this rule from applying to first, third, etc.", "# syllables, ...
An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].
[ "An", "agglutination", "diphthong", "that", "ends", "in", "/", "u", "y", "/", "usually", "contains", "a", "syllable", "boundary", "when", "-", "C#", "or", "-", "CCV", "follow", "e", ".", "g", ".", "[", "lau", ".", "ka", ".", "us", "]", "[", "va", ...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v02.py#L141-L168
train
A rule to apply T4 to agglutination diphthong that ends in u y.
tsnaomi/finnsyll
finnsyll/prev/v02.py
apply_T5
def apply_T5(word): # BROKEN '''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].''' T5 = '' WORD = word.spl...
python
def apply_T5(word): # BROKEN '''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].''' T5 = '' WORD = word.spl...
[ "def", "apply_T5", "(", "word", ")", ":", "# BROKEN", "T5", "=", "''", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "for", "i", ",", "v", "in", "enumerate", "(", "WORD", ")", ":", "if", "contains_VVV", "(", "v", ")", "and", "any", "(", "...
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", "vowe...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v02.py#L176-L193
train
Apply T5 to a word.
tsnaomi/finnsyll
finnsyll/prev/v02.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].''' T6 = '' WORD = word.split('.') for i, v in enumerate(WORD): if contains_VVV(v): VV = [v.find...
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].''' T6 = '' WORD = word.split('.') for i, v in enumerate(WORD): if contains_VVV(v): VV = [v.find...
[ "def", "apply_T6", "(", "word", ")", ":", "T6", "=", "''", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "for", "i", ",", "v", "in", "enumerate", "(", "WORD", ")", ":", "if", "contains_VVV", "(", "v", ")", ":", "VV", "=", "[", "v", ".",...
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/v02.py#L201-L226
train
This function applies T6 to the word.
tsnaomi/finnsyll
finnsyll/prev/v02.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].''' T7 = '' WORD = word.split('.') for i, v in enumerate(WORD): if contains_VVV(v): ...
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].''' T7 = '' WORD = word.split('.') for i, v in enumerate(WORD): if contains_VVV(v): ...
[ "def", "apply_T7", "(", "word", ")", ":", "T7", "=", "''", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "for", "i", ",", "v", "in", "enumerate", "(", "WORD", ")", ":", "if", "contains_VVV", "(", "v", ")", ":", "for", "I", ",", "V", "in...
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/v02.py#L231-L250
train
Apply T7 to a VVV - sequence.
obulpathi/cdn-fastly-python
bin/fastly_upload_vcl.py
main
def main(): """ Upload a vcl file to a fastly service, cloning the current version if necessary. The uploaded vcl is set as main unless --include is given. All existing vcl files will be deleted first if --delete is given. """ parser = OptionParser(description= "Upload ...
python
def main(): """ Upload a vcl file to a fastly service, cloning the current version if necessary. The uploaded vcl is set as main unless --include is given. All existing vcl files will be deleted first if --delete is given. """ parser = OptionParser(description= "Upload ...
[ "def", "main", "(", ")", ":", "parser", "=", "OptionParser", "(", "description", "=", "\"Upload a vcl file (set as main) to a given fastly service. All arguments are required.\"", ")", "parser", ".", "add_option", "(", "\"-k\"", ",", "\"--key\"", ",", "dest", "=", "\"ap...
Upload a vcl file to a fastly service, cloning the current version if necessary. The uploaded vcl is set as main unless --include is given. All existing vcl files will be deleted first if --delete is given.
[ "Upload", "a", "vcl", "file", "to", "a", "fastly", "service", "cloning", "the", "current", "version", "if", "necessary", ".", "The", "uploaded", "vcl", "is", "set", "as", "main", "unless", "--", "include", "is", "given", ".", "All", "existing", "vcl", "f...
db2564b047e8af4bce72c3b88d6c27d3d0291425
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/bin/fastly_upload_vcl.py#L34-L111
train
This function is used to upload a vcl file to a fastly service.
OLC-Bioinformatics/sipprverse
customsippr/customsippr.py
CustomGenes.main
def main(self): """ Run the necessary methods in the correct order """ self.target_validate() self.gene_names() Sippr(inputobject=self, k=self.kmer_size, allow_soft_clips=self.allow_soft_clips) self.report()
python
def main(self): """ Run the necessary methods in the correct order """ self.target_validate() self.gene_names() Sippr(inputobject=self, k=self.kmer_size, allow_soft_clips=self.allow_soft_clips) self.report()
[ "def", "main", "(", "self", ")", ":", "self", ".", "target_validate", "(", ")", "self", ".", "gene_names", "(", ")", "Sippr", "(", "inputobject", "=", "self", ",", "k", "=", "self", ".", "kmer_size", ",", "allow_soft_clips", "=", "self", ".", "allow_so...
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/customsippr/customsippr.py#L13-L22
train
Run the necessary methods in the correct order
OLC-Bioinformatics/sipprverse
customsippr/customsippr.py
CustomGenes.gene_names
def gene_names(self): """ Extract the names of the user-supplied targets """ # Iterate through all the target names in the formatted targets file for record in SeqIO.parse(self.targets, 'fasta'): # Append all the gene names to the list of names self.genes....
python
def gene_names(self): """ Extract the names of the user-supplied targets """ # Iterate through all the target names in the formatted targets file for record in SeqIO.parse(self.targets, 'fasta'): # Append all the gene names to the list of names self.genes....
[ "def", "gene_names", "(", "self", ")", ":", "# Iterate through all the target names in the formatted targets file", "for", "record", "in", "SeqIO", ".", "parse", "(", "self", ".", "targets", ",", "'fasta'", ")", ":", "# Append all the gene names to the list of names", "se...
Extract the names of the user-supplied targets
[ "Extract", "the", "names", "of", "the", "user", "-", "supplied", "targets" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/customsippr/customsippr.py#L32-L39
train
Extract the names of the user - supplied targets
OLC-Bioinformatics/sipprverse
customsippr/customsippr.py
CustomGenes.report
def report(self): """ Create the report for the user-supplied targets """ # Add all the genes to the header header = 'Sample,' data = str() with open(os.path.join(self.reportpath, '{at}.csv'.format(at=self.analysistype)), 'w') as report: write_header =...
python
def report(self): """ Create the report for the user-supplied targets """ # Add all the genes to the header header = 'Sample,' data = str() with open(os.path.join(self.reportpath, '{at}.csv'.format(at=self.analysistype)), 'w') as report: write_header =...
[ "def", "report", "(", "self", ")", ":", "# Add all the genes to the header", "header", "=", "'Sample,'", "data", "=", "str", "(", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "reportpath", ",", "'{at}.csv'", ".", "format", ...
Create the report for the user-supplied targets
[ "Create", "the", "report", "for", "the", "user", "-", "supplied", "targets" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/customsippr/customsippr.py#L41-L81
train
Create the report for the user - supplied target names and their associated results.
benoitkugler/abstractDataLibrary
pyDLib/GUI/fields.py
Tels.on_add
def on_add(self, item): """Convert to pseuso acces""" super(Tels, self).on_add(list_views.PseudoAccesCategorie(item))
python
def on_add(self, item): """Convert to pseuso acces""" super(Tels, self).on_add(list_views.PseudoAccesCategorie(item))
[ "def", "on_add", "(", "self", ",", "item", ")", ":", "super", "(", "Tels", ",", "self", ")", ".", "on_add", "(", "list_views", ".", "PseudoAccesCategorie", "(", "item", ")", ")" ]
Convert to pseuso acces
[ "Convert", "to", "pseuso", "acces" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fields.py#L70-L72
train
Convert to pseuso acces
benoitkugler/abstractDataLibrary
pyDLib/GUI/fields.py
Duree.set_data
def set_data(self, *args): """we cant to call set_data to manually update""" db = self.begining.get_data() or formats.DATE_DEFAULT df = self.end.get_data() or formats.DATE_DEFAULT jours = max((df - db).days + 1, 0) self.setText(str(jours) + (jours >= 2 and " jours" or " jour"))
python
def set_data(self, *args): """we cant to call set_data to manually update""" db = self.begining.get_data() or formats.DATE_DEFAULT df = self.end.get_data() or formats.DATE_DEFAULT jours = max((df - db).days + 1, 0) self.setText(str(jours) + (jours >= 2 and " jours" or " jour"))
[ "def", "set_data", "(", "self", ",", "*", "args", ")", ":", "db", "=", "self", ".", "begining", ".", "get_data", "(", ")", "or", "formats", ".", "DATE_DEFAULT", "df", "=", "self", ".", "end", ".", "get_data", "(", ")", "or", "formats", ".", "DATE_D...
we cant to call set_data to manually update
[ "we", "cant", "to", "call", "set_data", "to", "manually", "update" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fields.py#L95-L100
train
set the data of the record
OLC-Bioinformatics/sipprverse
genesippr/genesippr.py
GeneSippr.runner
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) if not self.pipeline: general = None for sample in self.runmetadata.samples: general = getattr(...
python
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) if not self.pipeline: general = None for sample in self.runmetadata.samples: general = getattr(...
[ "def", "runner", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "if", "not", "self", ".", "pipeline", ":", "general", "=", "None", "for", "sample", "in", "...
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/genesippr/genesippr.py#L19-L39
train
Run the necessary methods in the correct order
tsnaomi/finnsyll
finnsyll/prev/v01.py
same_syllabic_feature
def same_syllabic_feature(ch1, ch2): '''Return True if ch1 and ch2 are both vowels or both consonants.''' if ch1 == '.' or ch2 == '.': return False ch1 = 'V' if ch1 in VOWELS else 'C' if ch1 in CONSONANTS else None ch2 = 'V' if ch2 in VOWELS else 'C' if ch2 in CONSONANTS else None return c...
python
def same_syllabic_feature(ch1, ch2): '''Return True if ch1 and ch2 are both vowels or both consonants.''' if ch1 == '.' or ch2 == '.': return False ch1 = 'V' if ch1 in VOWELS else 'C' if ch1 in CONSONANTS else None ch2 = 'V' if ch2 in VOWELS else 'C' if ch2 in CONSONANTS else None return c...
[ "def", "same_syllabic_feature", "(", "ch1", ",", "ch2", ")", ":", "if", "ch1", "==", "'.'", "or", "ch2", "==", "'.'", ":", "return", "False", "ch1", "=", "'V'", "if", "ch1", "in", "VOWELS", "else", "'C'", "if", "ch1", "in", "CONSONANTS", "else", "Non...
Return True if ch1 and ch2 are both vowels or both consonants.
[ "Return", "True", "if", "ch1", "and", "ch2", "are", "both", "vowels", "or", "both", "consonants", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v01.py#L14-L22
train
Return True if ch1 and ch2 are both vowels or both consonants.
tsnaomi/finnsyll
finnsyll/prev/v01.py
syllabify
def syllabify(word): '''Syllabify the given word.''' word = replace_umlauts(word) word = apply_T1(word) word = apply_T2(word) word = apply_T4(word) word = apply_T5(word) word = apply_T6(word) word = apply_T7(word) word = replace_umlauts(word, put_back=True)[1:] # FENCEPOST r...
python
def syllabify(word): '''Syllabify the given word.''' word = replace_umlauts(word) word = apply_T1(word) word = apply_T2(word) word = apply_T4(word) word = apply_T5(word) word = apply_T6(word) word = apply_T7(word) word = replace_umlauts(word, put_back=True)[1:] # FENCEPOST r...
[ "def", "syllabify", "(", "word", ")", ":", "word", "=", "replace_umlauts", "(", "word", ")", "word", "=", "apply_T1", "(", "word", ")", "word", "=", "apply_T2", "(", "word", ")", "word", "=", "apply_T4", "(", "word", ")", "word", "=", "apply_T5", "("...
Syllabify the given word.
[ "Syllabify", "the", "given", "word", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v01.py#L56-L70
train
Syllabify the given word.
tsnaomi/finnsyll
finnsyll/prev/v01.py
apply_T1
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' WORD = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if k == 1 and is_consonantal_onset(v): WORD[k] = '.' + v elif is_consonant(v[0]) and WORD.get(k + 1, 0): WO...
python
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' WORD = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if k == 1 and is_consonantal_onset(v): WORD[k] = '.' + v elif is_consonant(v[0]) and WORD.get(k + 1, 0): WO...
[ "def", "apply_T1", "(", "word", ")", ":", "WORD", "=", "_split_consonants_and_vowels", "(", "word", ")", "for", "k", ",", "v", "in", "WORD", ".", "iteritems", "(", ")", ":", "if", "k", "==", "1", "and", "is_consonantal_onset", "(", "v", ")", ":", "WO...
There is a syllable boundary in front of every CV-sequence.
[ "There", "is", "a", "syllable", "boundary", "in", "front", "of", "every", "CV", "-", "sequence", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v01.py#L75-L89
train
This function applies T1 to the given word.
tsnaomi/finnsyll
finnsyll/prev/v01.py
apply_T2
def apply_T2(word): '''There is a syllable boundary within a sequence VV of two nonidentical that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].''' WORD = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if is_diphthong(v): continue if len(v) == 2 ...
python
def apply_T2(word): '''There is a syllable boundary within a sequence VV of two nonidentical that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].''' WORD = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if is_diphthong(v): continue if len(v) == 2 ...
[ "def", "apply_T2", "(", "word", ")", ":", "WORD", "=", "_split_consonants_and_vowels", "(", "word", ")", "for", "k", ",", "v", "in", "WORD", ".", "iteritems", "(", ")", ":", "if", "is_diphthong", "(", "v", ")", ":", "continue", "if", "len", "(", "v",...
There is a syllable boundary within a sequence VV of two nonidentical that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].
[ "There", "is", "a", "syllable", "boundary", "within", "a", "sequence", "VV", "of", "two", "nonidentical", "that", "are", "not", "a", "genuine", "diphthong", "e", ".", "g", ".", "[", "ta", ".", "e", "]", "[", "ko", ".", "et", ".", "taa", "]", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v01.py#L94-L111
train
This function applies the T2 rule to the word.
tsnaomi/finnsyll
finnsyll/prev/v01.py
apply_T4
def apply_T4(word): # OPTIMIZE '''An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if len(v) == 2 and v.endswith(('u', ...
python
def apply_T4(word): # OPTIMIZE '''An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if len(v) == 2 and v.endswith(('u', ...
[ "def", "apply_T4", "(", "word", ")", ":", "# OPTIMIZE", "WORD", "=", "_split_consonants_and_vowels", "(", "word", ")", "for", "k", ",", "v", "in", "WORD", ".", "iteritems", "(", ")", ":", "if", "len", "(", "v", ")", "==", "2", "and", "v", ".", "end...
An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].
[ "An", "agglutination", "diphthong", "that", "ends", "in", "/", "u", "y", "/", "usually", "contains", "a", "syllable", "boundary", "when", "-", "C#", "or", "-", "CCV", "follow", "e", ".", "g", ".", "[", "lau", ".", "ka", ".", "us", "]", "[", "va", ...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v01.py#L116-L141
train
This function applies T4 to the word.
tsnaomi/finnsyll
finnsyll/prev/v01.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 = _split_consonants_and_vowels(w...
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 = _split_consonants_and_vowels(w...
[ "def", "apply_T5", "(", "word", ")", ":", "WORD", "=", "_split_consonants_and_vowels", "(", "word", ")", "for", "k", ",", "v", "in", "WORD", ".", "iteritems", "(", ")", ":", "if", "len", "(", "v", ")", ">=", "3", "and", "is_vowel", "(", "v", "[", ...
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", "vowe...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v01.py#L149-L172
train
This function applies T5 to the word.
tsnaomi/finnsyll
finnsyll/prev/v01.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 = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if len(v) == 3 and is_vowel(v[0]): ...
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 = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if len(v) == 3 and is_vowel(v[0]): ...
[ "def", "apply_T6", "(", "word", ")", ":", "WORD", "=", "_split_consonants_and_vowels", "(", "word", ")", "for", "k", ",", "v", "in", "WORD", ".", "iteritems", "(", ")", ":", "if", "len", "(", "v", ")", "==", "3", "and", "is_vowel", "(", "v", "[", ...
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/v01.py#L180-L202
train
Apply T6 to a word.
tsnaomi/finnsyll
finnsyll/prev/v01.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 = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if len(v) == 3 and is_v...
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 = _split_consonants_and_vowels(word) for k, v in WORD.iteritems(): if len(v) == 3 and is_v...
[ "def", "apply_T7", "(", "word", ")", ":", "WORD", "=", "_split_consonants_and_vowels", "(", "word", ")", "for", "k", ",", "v", "in", "WORD", ".", "iteritems", "(", ")", ":", "if", "len", "(", "v", ")", "==", "3", "and", "is_vowel", "(", "v", "[", ...
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/v01.py#L207-L220
train
This function applies T7 to a VVV - sequence.
tsnaomi/finnsyll
finnsyll/prev/v12.py
syllabify
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = not word.isalpha() syllabify = _syllabify_complex if compound else _syllabify_simplex syllabifications = list(syllabify(word)) # if variation, order variants from most preferred to least preferred if len...
python
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = not word.isalpha() syllabify = _syllabify_complex if compound else _syllabify_simplex syllabifications = list(syllabify(word)) # if variation, order variants from most preferred to least preferred if len...
[ "def", "syllabify", "(", "word", ")", ":", "compound", "=", "not", "word", ".", "isalpha", "(", ")", "syllabify", "=", "_syllabify_complex", "if", "compound", "else", "_syllabify_simplex", "syllabifications", "=", "list", "(", "syllabify", "(", "word", ")", ...
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/v12.py#L17-L28
train
Syllabify the given word whether simplex or complex.
tsnaomi/finnsyll
finnsyll/prev/v12.py
wsp
def wsp(word): '''Return the number of unstressed superheavy syllables.''' violations = 0 unstressed = [] for w in extract_words(word): unstressed += w.split('.')[1::2] # even syllables # include extrametrical odd syllables as potential WSP violations if w.count('.') % 2 == 0:...
python
def wsp(word): '''Return the number of unstressed superheavy syllables.''' violations = 0 unstressed = [] for w in extract_words(word): unstressed += w.split('.')[1::2] # even syllables # include extrametrical odd syllables as potential WSP violations if w.count('.') % 2 == 0:...
[ "def", "wsp", "(", "word", ")", ":", "violations", "=", "0", "unstressed", "=", "[", "]", "for", "w", "in", "extract_words", "(", "word", ")", ":", "unstressed", "+=", "w", ".", "split", "(", "'.'", ")", "[", "1", ":", ":", "2", "]", "# even syll...
Return the number of unstressed superheavy syllables.
[ "Return", "the", "number", "of", "unstressed", "superheavy", "syllables", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v12.py#L359-L383
train
Return the number of unstressed superheavy syllables.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractAcces.modifie
def modifie(self, key: str, value: Any) -> None: """Store the modification. `value` should be dumped in DB compatible format.""" if key in self.FIELDS_OPTIONS: self.modifie_options(key, value) else: self.modifications[key] = value
python
def modifie(self, key: str, value: Any) -> None: """Store the modification. `value` should be dumped in DB compatible format.""" if key in self.FIELDS_OPTIONS: self.modifie_options(key, value) else: self.modifications[key] = value
[ "def", "modifie", "(", "self", ",", "key", ":", "str", ",", "value", ":", "Any", ")", "->", "None", ":", "if", "key", "in", "self", ".", "FIELDS_OPTIONS", ":", "self", ".", "modifie_options", "(", "key", ",", "value", ")", "else", ":", "self", ".",...
Store the modification. `value` should be dumped in DB compatible format.
[ "Store", "the", "modification", ".", "value", "should", "be", "dumped", "in", "DB", "compatible", "format", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L57-L62
train
Store the modification. value should be dumped in DB compatible format.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractAcces.modifie_many
def modifie_many(self, dic: dict): """Convenience function which calls modifie on each element of dic""" for i, v in dic.items(): self.modifie(i, v)
python
def modifie_many(self, dic: dict): """Convenience function which calls modifie on each element of dic""" for i, v in dic.items(): self.modifie(i, v)
[ "def", "modifie_many", "(", "self", ",", "dic", ":", "dict", ")", ":", "for", "i", ",", "v", "in", "dic", ".", "items", "(", ")", ":", "self", ".", "modifie", "(", "i", ",", "v", ")" ]
Convenience function which calls modifie on each element of dic
[ "Convenience", "function", "which", "calls", "modifie", "on", "each", "element", "of", "dic" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L64-L67
train
Convenience function which calls modifie on each element of dic
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractAcces.save
def save(self) -> sql.Executant: """Prepare a SQL request to save the current modifications. Returns actually a LIST of requests (which may be of length one). Note than it can include modifications on other part of the data. After succes, the base should be updated. """ r...
python
def save(self) -> sql.Executant: """Prepare a SQL request to save the current modifications. Returns actually a LIST of requests (which may be of length one). Note than it can include modifications on other part of the data. After succes, the base should be updated. """ r...
[ "def", "save", "(", "self", ")", "->", "sql", ".", "Executant", ":", "r", "=", "self", ".", "_dict_to_SQL", "(", "self", ".", "modifications", ")", "self", ".", "modifications", ".", "clear", "(", ")", "return", "r" ]
Prepare a SQL request to save the current modifications. Returns actually a LIST of requests (which may be of length one). Note than it can include modifications on other part of the data. After succes, the base should be updated.
[ "Prepare", "a", "SQL", "request", "to", "save", "the", "current", "modifications", ".", "Returns", "actually", "a", "LIST", "of", "requests", "(", "which", "may", "be", "of", "length", "one", ")", ".", "Note", "than", "it", "can", "include", "modifications...
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L73-L81
train
Prepare a SQL request to save the current modifications.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractAcces.modifie_options
def modifie_options(self, field_option, value): """Set options in modifications. All options will be stored since it should be grouped in the DB.""" options = dict(self["options"] or {}, **{field_option: value}) self.modifications["options"] = options
python
def modifie_options(self, field_option, value): """Set options in modifications. All options will be stored since it should be grouped in the DB.""" options = dict(self["options"] or {}, **{field_option: value}) self.modifications["options"] = options
[ "def", "modifie_options", "(", "self", ",", "field_option", ",", "value", ")", ":", "options", "=", "dict", "(", "self", "[", "\"options\"", "]", "or", "{", "}", ",", "*", "*", "{", "field_option", ":", "value", "}", ")", "self", ".", "modifications", ...
Set options in modifications. All options will be stored since it should be grouped in the DB.
[ "Set", "options", "in", "modifications", ".", "All", "options", "will", "be", "stored", "since", "it", "should", "be", "grouped", "in", "the", "DB", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L86-L90
train
Set options in modifications. All options will be stored since it should be grouped in the DB.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractDictTable._from_dict_dict
def _from_dict_dict(cls, dic): """Takes a dict {id : dict_attributes} """ return cls({_convert_id(i): v for i, v in dic.items()})
python
def _from_dict_dict(cls, dic): """Takes a dict {id : dict_attributes} """ return cls({_convert_id(i): v for i, v in dic.items()})
[ "def", "_from_dict_dict", "(", "cls", ",", "dic", ")", ":", "return", "cls", "(", "{", "_convert_id", "(", "i", ")", ":", "v", "for", "i", ",", "v", "in", "dic", ".", "items", "(", ")", "}", ")" ]
Takes a dict {id : dict_attributes}
[ "Takes", "a", "dict", "{", "id", ":", "dict_attributes", "}" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L114-L116
train
Takes a dict containing id and attributes and returns a new dict containing the attributes.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractDictTable._from_list_dict
def _from_list_dict(cls, list_dic): """Takes a list of dict like objects and uses `champ_id` field as Id""" return cls({_convert_id(dic[cls.CHAMP_ID]): dict(dic) for dic in list_dic})
python
def _from_list_dict(cls, list_dic): """Takes a list of dict like objects and uses `champ_id` field as Id""" return cls({_convert_id(dic[cls.CHAMP_ID]): dict(dic) for dic in list_dic})
[ "def", "_from_list_dict", "(", "cls", ",", "list_dic", ")", ":", "return", "cls", "(", "{", "_convert_id", "(", "dic", "[", "cls", ".", "CHAMP_ID", "]", ")", ":", "dict", "(", "dic", ")", "for", "dic", "in", "list_dic", "}", ")" ]
Takes a list of dict like objects and uses `champ_id` field as Id
[ "Takes", "a", "list", "of", "dict", "like", "objects", "and", "uses", "champ_id", "field", "as", "Id" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L119-L121
train
Takes a list of dict like objects and uses Champ_ID field as Id
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractDictTable.base_recherche_rapide
def base_recherche_rapide(self, base, pattern, to_string_hook=None): """ Return a collection of access matching `pattern`. `to_string_hook` is an optionnal callable dict -> str to map record to string. Default to _record_to_string """ Ac = self.ACCES if pattern == "*": ...
python
def base_recherche_rapide(self, base, pattern, to_string_hook=None): """ Return a collection of access matching `pattern`. `to_string_hook` is an optionnal callable dict -> str to map record to string. Default to _record_to_string """ Ac = self.ACCES if pattern == "*": ...
[ "def", "base_recherche_rapide", "(", "self", ",", "base", ",", "pattern", ",", "to_string_hook", "=", "None", ")", ":", "Ac", "=", "self", ".", "ACCES", "if", "pattern", "==", "\"*\"", ":", "return", "groups", ".", "Collection", "(", "Ac", "(", "base", ...
Return a collection of access matching `pattern`. `to_string_hook` is an optionnal callable dict -> str to map record to string. Default to _record_to_string
[ "Return", "a", "collection", "of", "access", "matching", "pattern", ".", "to_string_hook", "is", "an", "optionnal", "callable", "dict", "-", ">", "str", "to", "map", "record", "to", "string", ".", "Default", "to", "_record_to_string" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L141-L167
train
Return a collection of access matching pattern.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractDictTable.select_by_field
def select_by_field(self, base, field, value): """Return collection of acces whose field equal value""" Ac = self.ACCES return groups.Collection(Ac(base, i) for i, row in self.items() if row[field] == value)
python
def select_by_field(self, base, field, value): """Return collection of acces whose field equal value""" Ac = self.ACCES return groups.Collection(Ac(base, i) for i, row in self.items() if row[field] == value)
[ "def", "select_by_field", "(", "self", ",", "base", ",", "field", ",", "value", ")", ":", "Ac", "=", "self", ".", "ACCES", "return", "groups", ".", "Collection", "(", "Ac", "(", "base", ",", "i", ")", "for", "i", ",", "row", "in", "self", ".", "i...
Return collection of acces whose field equal value
[ "Return", "collection", "of", "acces", "whose", "field", "equal", "value" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L169-L172
train
Return collection of acces whose field equal value
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractDictTable.select_by_critere
def select_by_critere(self, base, criteria): """ :param base: Reference on whole base :param criteria: Callable abstractAcces -> Bool, acting as filter :return: Collection on acces passing the criteria """ Ac = self.ACCES return groups.Collection(Ac(base, i) for i...
python
def select_by_critere(self, base, criteria): """ :param base: Reference on whole base :param criteria: Callable abstractAcces -> Bool, acting as filter :return: Collection on acces passing the criteria """ Ac = self.ACCES return groups.Collection(Ac(base, i) for i...
[ "def", "select_by_critere", "(", "self", ",", "base", ",", "criteria", ")", ":", "Ac", "=", "self", ".", "ACCES", "return", "groups", ".", "Collection", "(", "Ac", "(", "base", ",", "i", ")", "for", "i", "in", "self", "if", "criteria", "(", "Ac", "...
:param base: Reference on whole base :param criteria: Callable abstractAcces -> Bool, acting as filter :return: Collection on acces passing the criteria
[ ":", "param", "base", ":", "Reference", "on", "whole", "base", ":", "param", "criteria", ":", "Callable", "abstractAcces", "-", ">", "Bool", "acting", "as", "filter", ":", "return", ":", "Collection", "on", "acces", "passing", "the", "criteria" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L174-L181
train
Select the set of acces that satisfy the criteria.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractBase.load_from_db
def load_from_db(cls, callback_etat=print, out=None): """Launch data fetching then load data received. The method _load_remote_db should be overridden. If out is given, datas are set in it, instead of returning a new base object. """ dic = cls._load_remote_db(callback_etat) ...
python
def load_from_db(cls, callback_etat=print, out=None): """Launch data fetching then load data received. The method _load_remote_db should be overridden. If out is given, datas are set in it, instead of returning a new base object. """ dic = cls._load_remote_db(callback_etat) ...
[ "def", "load_from_db", "(", "cls", ",", "callback_etat", "=", "print", ",", "out", "=", "None", ")", ":", "dic", "=", "cls", ".", "_load_remote_db", "(", "callback_etat", ")", "callback_etat", "(", "\"Chargement...\"", ",", "2", ",", "3", ")", "if", "out...
Launch data fetching then load data received. The method _load_remote_db should be overridden. If out is given, datas are set in it, instead of returning a new base object.
[ "Launch", "data", "fetching", "then", "load", "data", "received", ".", "The", "method", "_load_remote_db", "should", "be", "overridden", ".", "If", "out", "is", "given", "datas", "are", "set", "in", "it", "instead", "of", "returning", "a", "new", "base", "...
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L214-L223
train
Launch data fetching then load data received.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractBase._parse_text_DB
def _parse_text_DB(self, s): """Returns a dict of table interpreted from s. s should be Json string encoding a dict { table_name : [fields_name,...] , [rows,... ] }""" dic = self.decode_json_str(s) new_dic = {} for table_name, (header, rows) in dic.items(): newl = [{...
python
def _parse_text_DB(self, s): """Returns a dict of table interpreted from s. s should be Json string encoding a dict { table_name : [fields_name,...] , [rows,... ] }""" dic = self.decode_json_str(s) new_dic = {} for table_name, (header, rows) in dic.items(): newl = [{...
[ "def", "_parse_text_DB", "(", "self", ",", "s", ")", ":", "dic", "=", "self", ".", "decode_json_str", "(", "s", ")", "new_dic", "=", "{", "}", "for", "table_name", ",", "(", "header", ",", "rows", ")", "in", "dic", ".", "items", "(", ")", ":", "n...
Returns a dict of table interpreted from s. s should be Json string encoding a dict { table_name : [fields_name,...] , [rows,... ] }
[ "Returns", "a", "dict", "of", "table", "interpreted", "from", "s", ".", "s", "should", "be", "Json", "string", "encoding", "a", "dict", "{", "table_name", ":", "[", "fields_name", "...", "]", "[", "rows", "...", "]", "}" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L235-L244
train
Returns a dict of table interpreted from s. s should be Json string encoding a dict
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractBase.load_from_local
def load_from_local(cls): """Load datas from local file.""" try: with open(cls.LOCAL_DB_PATH, 'rb') as f: b = f.read() s = security.protege_data(b, False) except (FileNotFoundError, KeyError): logging.exception(cls.__name__) rai...
python
def load_from_local(cls): """Load datas from local file.""" try: with open(cls.LOCAL_DB_PATH, 'rb') as f: b = f.read() s = security.protege_data(b, False) except (FileNotFoundError, KeyError): logging.exception(cls.__name__) rai...
[ "def", "load_from_local", "(", "cls", ")", ":", "try", ":", "with", "open", "(", "cls", ".", "LOCAL_DB_PATH", ",", "'rb'", ")", "as", "f", ":", "b", "=", "f", ".", "read", "(", ")", "s", "=", "security", ".", "protege_data", "(", "b", ",", "False...
Load datas from local file.
[ "Load", "datas", "from", "local", "file", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L255-L266
train
Load datas from local file.
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractBase.dumps
def dumps(self): """Return a dictionnary of current tables""" return {table_name: getattr(self, table_name).dumps() for table_name in self.TABLES}
python
def dumps(self): """Return a dictionnary of current tables""" return {table_name: getattr(self, table_name).dumps() for table_name in self.TABLES}
[ "def", "dumps", "(", "self", ")", ":", "return", "{", "table_name", ":", "getattr", "(", "self", ",", "table_name", ")", ".", "dumps", "(", ")", "for", "table_name", "in", "self", ".", "TABLES", "}" ]
Return a dictionnary of current tables
[ "Return", "a", "dictionnary", "of", "current", "tables" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L285-L287
train
Return a dictionnary of current tables
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
abstractBase.save_to_local
def save_to_local(self, callback_etat=print): """ Saved current in memory base to local file. It's a backup, not a convenient way to update datas :param callback_etat: state callback, taking str,int,int as args """ callback_etat("Aquisition...", 0, 3) d = self.d...
python
def save_to_local(self, callback_etat=print): """ Saved current in memory base to local file. It's a backup, not a convenient way to update datas :param callback_etat: state callback, taking str,int,int as args """ callback_etat("Aquisition...", 0, 3) d = self.d...
[ "def", "save_to_local", "(", "self", ",", "callback_etat", "=", "print", ")", ":", "callback_etat", "(", "\"Aquisition...\"", ",", "0", ",", "3", ")", "d", "=", "self", ".", "dumps", "(", ")", "s", "=", "json", ".", "dumps", "(", "d", ",", "indent", ...
Saved current in memory base to local file. It's a backup, not a convenient way to update datas :param callback_etat: state callback, taking str,int,int as args
[ "Saved", "current", "in", "memory", "base", "to", "local", "file", ".", "It", "s", "a", "backup", "not", "a", "convenient", "way", "to", "update", "datas" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L301-L319
train
Save current in memory base to local file.
kappius/pyheaderfile
pyheaderfile/excel.py
Xls.read_cell
def read_cell(self, x, y): """ reads the cell at position x and y; puts the default styles in xlwt """ cell = self._sheet.row(x)[y] if self._file.xf_list[ cell.xf_index].background.pattern_colour_index == 64: self._file.xf_list[ cell.xf...
python
def read_cell(self, x, y): """ reads the cell at position x and y; puts the default styles in xlwt """ cell = self._sheet.row(x)[y] if self._file.xf_list[ cell.xf_index].background.pattern_colour_index == 64: self._file.xf_list[ cell.xf...
[ "def", "read_cell", "(", "self", ",", "x", ",", "y", ")", ":", "cell", "=", "self", ".", "_sheet", ".", "row", "(", "x", ")", "[", "y", "]", "if", "self", ".", "_file", ".", "xf_list", "[", "cell", ".", "xf_index", "]", ".", "background", ".", ...
reads the cell at position x and y; puts the default styles in xlwt
[ "reads", "the", "cell", "at", "position", "x", "and", "y", ";", "puts", "the", "default", "styles", "in", "xlwt" ]
8d587dadae538adcec527fd8e74ad89ed5e2006a
https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/excel.py#L20-L54
train
reads the cell at position x and y and puts the default styles in xlwt
kappius/pyheaderfile
pyheaderfile/excel.py
Xls.write_cell
def write_cell(self, x, y, value, style=None): """ writing style and value in the cell of x and y position """ if isinstance(style, str): style = self.xlwt.easyxf(style) if style: self._sheet.write(x, y, label=value, style=style) else: ...
python
def write_cell(self, x, y, value, style=None): """ writing style and value in the cell of x and y position """ if isinstance(style, str): style = self.xlwt.easyxf(style) if style: self._sheet.write(x, y, label=value, style=style) else: ...
[ "def", "write_cell", "(", "self", ",", "x", ",", "y", ",", "value", ",", "style", "=", "None", ")", ":", "if", "isinstance", "(", "style", ",", "str", ")", ":", "style", "=", "self", ".", "xlwt", ".", "easyxf", "(", "style", ")", "if", "style", ...
writing style and value in the cell of x and y position
[ "writing", "style", "and", "value", "in", "the", "cell", "of", "x", "and", "y", "position" ]
8d587dadae538adcec527fd8e74ad89ed5e2006a
https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/excel.py#L56-L65
train
write a cell to the current cell
OLC-Bioinformatics/sipprverse
cgecore/argumentparsing.py
get_string
def get_string(string): """ This function checks if a path was given as string, and tries to read the file and return the string. """ truestring = string if string is not None: if '/' in string: if os.path.isfile(string): try: with open_(string,'r') as f: ...
python
def get_string(string): """ This function checks if a path was given as string, and tries to read the file and return the string. """ truestring = string if string is not None: if '/' in string: if os.path.isfile(string): try: with open_(string,'r') as f: ...
[ "def", "get_string", "(", "string", ")", ":", "truestring", "=", "string", "if", "string", "is", "not", "None", ":", "if", "'/'", "in", "string", ":", "if", "os", ".", "path", ".", "isfile", "(", "string", ")", ":", "try", ":", "with", "open_", "("...
This function checks if a path was given as string, and tries to read the file and return the string.
[ "This", "function", "checks", "if", "a", "path", "was", "given", "as", "string", "and", "tries", "to", "read", "the", "file", "and", "return", "the", "string", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/argumentparsing.py#L14-L27
train
This function checks if a path was given as string and tries to read the the file and return the string. If the file is not found or if the string is empty it returns None.
OLC-Bioinformatics/sipprverse
cgecore/argumentparsing.py
get_arguments
def get_arguments(options): """ This function handles and validates the wrapper arguments. """ # These the next couple of lines defines the header of the Help output parser = ArgumentParser( formatter_class=RawDescriptionHelpFormatter, usage=("""%(prog)s --------------------------------------------...
python
def get_arguments(options): """ This function handles and validates the wrapper arguments. """ # These the next couple of lines defines the header of the Help output parser = ArgumentParser( formatter_class=RawDescriptionHelpFormatter, usage=("""%(prog)s --------------------------------------------...
[ "def", "get_arguments", "(", "options", ")", ":", "# These the next couple of lines defines the header of the Help output", "parser", "=", "ArgumentParser", "(", "formatter_class", "=", "RawDescriptionHelpFormatter", ",", "usage", "=", "(", "\"\"\"%(prog)s\n----------------------...
This function handles and validates the wrapper arguments.
[ "This", "function", "handles", "and", "validates", "the", "wrapper", "arguments", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/argumentparsing.py#L29-L76
train
This function handles and validates the arguments of the service wrapper script.
OLC-Bioinformatics/sipprverse
cgecore/argumentparsing.py
check_file_type
def check_file_type(files): """ Check whether the input files are in fasta format, reads format or other/mix formats. """ all_are_fasta = True all_are_reads = True all_are_empty = True if sys.version_info < (3, 0): if isinstance(files, (str, unicode)): files = [files] else: if is...
python
def check_file_type(files): """ Check whether the input files are in fasta format, reads format or other/mix formats. """ all_are_fasta = True all_are_reads = True all_are_empty = True if sys.version_info < (3, 0): if isinstance(files, (str, unicode)): files = [files] else: if is...
[ "def", "check_file_type", "(", "files", ")", ":", "all_are_fasta", "=", "True", "all_are_reads", "=", "True", "all_are_empty", "=", "True", "if", "sys", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "if", "isinstance", "(", "files", ",", "(", ...
Check whether the input files are in fasta format, reads format or other/mix formats.
[ "Check", "whether", "the", "input", "files", "are", "in", "fasta", "format", "reads", "format", "or", "other", "/", "mix", "formats", "." ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/argumentparsing.py#L78-L101
train
Check whether the input files are in fasta format reads format or other format.
OLC-Bioinformatics/sipprverse
cgecore/argumentparsing.py
make_file_list
def make_file_list(upload_path): """ This function returns list of files in the given dir """ newlist = [] for el in sorted(os.listdir(upload_path)): if ' ' in el: raise Exception('Error: Spaces are not allowed in file names!\n') newlist.append(os.path.normpath(upload_path+'/'+el)) debu...
python
def make_file_list(upload_path): """ This function returns list of files in the given dir """ newlist = [] for el in sorted(os.listdir(upload_path)): if ' ' in el: raise Exception('Error: Spaces are not allowed in file names!\n') newlist.append(os.path.normpath(upload_path+'/'+el)) debu...
[ "def", "make_file_list", "(", "upload_path", ")", ":", "newlist", "=", "[", "]", "for", "el", "in", "sorted", "(", "os", ".", "listdir", "(", "upload_path", ")", ")", ":", "if", "' '", "in", "el", ":", "raise", "Exception", "(", "'Error: Spaces are not a...
This function returns list of files in the given dir
[ "This", "function", "returns", "list", "of", "files", "in", "the", "given", "dir" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/argumentparsing.py#L103-L111
train
This function returns a list of files in the given dir
pyBookshelf/bookshelf
bookshelf/api_v2/rackspace.py
create_server_rackspace
def create_server_rackspace(connection, distribution, disk_name, disk_size, ami, region, key_pair, instance_type, ...
python
def create_server_rackspace(connection, distribution, disk_name, disk_size, ami, region, key_pair, instance_type, ...
[ "def", "create_server_rackspace", "(", "connection", ",", "distribution", ",", "disk_name", ",", "disk_size", ",", "ami", ",", "region", ",", "key_pair", ",", "instance_type", ",", "instance_name", ",", "tags", "=", "{", "}", ",", "security_groups", "=", "None...
Creates Rackspace Instance and saves it state in a local json file
[ "Creates", "Rackspace", "Instance", "and", "saves", "it", "state", "in", "a", "local", "json", "file" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/rackspace.py#L47-L93
train
Create Rackspace Instance and save it in local json file
pyBookshelf/bookshelf
bookshelf/api_v2/rackspace.py
destroy_rackspace
def destroy_rackspace(connection, region, instance_id): """ terminates the instance """ server = connection.servers.get(instance_id) log_yellow('deleting rackspace instance ...') server.delete() # wait for server to be deleted try: while True: server = connection.servers.ge...
python
def destroy_rackspace(connection, region, instance_id): """ terminates the instance """ server = connection.servers.get(instance_id) log_yellow('deleting rackspace instance ...') server.delete() # wait for server to be deleted try: while True: server = connection.servers.ge...
[ "def", "destroy_rackspace", "(", "connection", ",", "region", ",", "instance_id", ")", ":", "server", "=", "connection", ".", "servers", ".", "get", "(", "instance_id", ")", "log_yellow", "(", "'deleting rackspace instance ...'", ")", "server", ".", "delete", "(...
terminates the instance
[ "terminates", "the", "instance" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/rackspace.py#L96-L111
train
Delete the rackspace instance.
pyBookshelf/bookshelf
bookshelf/api_v2/rackspace.py
get_rackspace_info
def get_rackspace_info(connection, server_id): """ queries Rackspace for details about a particular server id """ server = connection.servers.get(server_id) data = {} data['ip_address'] = server.accessIPv4 data['accessIPv4'] = server.accessIPv4 data['accessIPv6'] = se...
python
def get_rackspace_info(connection, server_id): """ queries Rackspace for details about a particular server id """ server = connection.servers.get(server_id) data = {} data['ip_address'] = server.accessIPv4 data['accessIPv4'] = server.accessIPv4 data['accessIPv6'] = se...
[ "def", "get_rackspace_info", "(", "connection", ",", "server_id", ")", ":", "server", "=", "connection", ".", "servers", ".", "get", "(", "server_id", ")", "data", "=", "{", "}", "data", "[", "'ip_address'", "]", "=", "server", ".", "accessIPv4", "data", ...
queries Rackspace for details about a particular server id
[ "queries", "Rackspace", "for", "details", "about", "a", "particular", "server", "id" ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/rackspace.py#L142-L166
train
queries Rackspace for details about a particular server id
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
date_decoder
def date_decoder(dic): """Add python types decoding. See JsonEncoder""" if '__date__' in dic: try: d = datetime.date(**{c: v for c, v in dic.items() if not c == "__date__"}) except (TypeError, ValueError): raise json.JSONDecodeError("Corrupted date format !", str(dic), 1)...
python
def date_decoder(dic): """Add python types decoding. See JsonEncoder""" if '__date__' in dic: try: d = datetime.date(**{c: v for c, v in dic.items() if not c == "__date__"}) except (TypeError, ValueError): raise json.JSONDecodeError("Corrupted date format !", str(dic), 1)...
[ "def", "date_decoder", "(", "dic", ")", ":", "if", "'__date__'", "in", "dic", ":", "try", ":", "d", "=", "datetime", ".", "date", "(", "*", "*", "{", "c", ":", "v", "for", "c", ",", "v", "in", "dic", ".", "items", "(", ")", "if", "not", "c", ...
Add python types decoding. See JsonEncoder
[ "Add", "python", "types", "decoding", ".", "See", "JsonEncoder" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L31-L45
train
Add python types decoding. See JsonEncoder
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
_type_string
def _type_string(label, case=None): """Shortcut for string like fields""" return label, abstractSearch.in_string, lambda s: abstractRender.default(s, case=case), ""
python
def _type_string(label, case=None): """Shortcut for string like fields""" return label, abstractSearch.in_string, lambda s: abstractRender.default(s, case=case), ""
[ "def", "_type_string", "(", "label", ",", "case", "=", "None", ")", ":", "return", "label", ",", "abstractSearch", ".", "in_string", ",", "lambda", "s", ":", "abstractRender", ".", "default", "(", "s", ",", "case", "=", "case", ")", ",", "\"\"" ]
Shortcut for string like fields
[ "Shortcut", "for", "string", "like", "fields" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L301-L303
train
Shortcut for string like fields
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
_type_bool
def _type_bool(label,default=False): """Shortcut fot boolean like fields""" return label, abstractSearch.nothing, abstractRender.boolen, default
python
def _type_bool(label,default=False): """Shortcut fot boolean like fields""" return label, abstractSearch.nothing, abstractRender.boolen, default
[ "def", "_type_bool", "(", "label", ",", "default", "=", "False", ")", ":", "return", "label", ",", "abstractSearch", ".", "nothing", ",", "abstractRender", ".", "boolen", ",", "default" ]
Shortcut fot boolean like fields
[ "Shortcut", "fot", "boolean", "like", "fields" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L316-L318
train
Shortcut fot boolean like fields
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
abstractSearch.in_string
def in_string(objet, pattern): """ abstractSearch dans une chaine, sans tenir compte de la casse. """ return bool(re.search(pattern, str(objet), flags=re.I)) if objet else False
python
def in_string(objet, pattern): """ abstractSearch dans une chaine, sans tenir compte de la casse. """ return bool(re.search(pattern, str(objet), flags=re.I)) if objet else False
[ "def", "in_string", "(", "objet", ",", "pattern", ")", ":", "return", "bool", "(", "re", ".", "search", "(", "pattern", ",", "str", "(", "objet", ")", ",", "flags", "=", "re", ".", "I", ")", ")", "if", "objet", "else", "False" ]
abstractSearch dans une chaine, sans tenir compte de la casse.
[ "abstractSearch", "dans", "une", "chaine", "sans", "tenir", "compte", "de", "la", "casse", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L199-L201
train
abstractSearch une chaine sans tenir compte de la casse
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
abstractSearch.in_date
def in_date(objet, pattern): """ abstractSearch dans une date datetime.date""" if objet: pattern = re.sub(" ", '', pattern) objet_str = abstractRender.date(objet) return bool(re.search(pattern, objet_str)) return False
python
def in_date(objet, pattern): """ abstractSearch dans une date datetime.date""" if objet: pattern = re.sub(" ", '', pattern) objet_str = abstractRender.date(objet) return bool(re.search(pattern, objet_str)) return False
[ "def", "in_date", "(", "objet", ",", "pattern", ")", ":", "if", "objet", ":", "pattern", "=", "re", ".", "sub", "(", "\" \"", ",", "''", ",", "pattern", ")", "objet_str", "=", "abstractRender", ".", "date", "(", "objet", ")", "return", "bool", "(", ...
abstractSearch dans une date datetime.date
[ "abstractSearch", "dans", "une", "date", "datetime", ".", "date" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L204-L210
train
abstractSearch une date objet et et
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
abstractSearch.in_dateheure
def in_dateheure(objet, pattern): """ abstractSearch dans une date-heure datetime.datetime (cf abstractRender.dateheure) """ if objet: pattern = re.sub(" ", '', pattern) objet_str = abstractRender.dateheure(objet) return bool(re.search(pattern, objet_str)) ret...
python
def in_dateheure(objet, pattern): """ abstractSearch dans une date-heure datetime.datetime (cf abstractRender.dateheure) """ if objet: pattern = re.sub(" ", '', pattern) objet_str = abstractRender.dateheure(objet) return bool(re.search(pattern, objet_str)) ret...
[ "def", "in_dateheure", "(", "objet", ",", "pattern", ")", ":", "if", "objet", ":", "pattern", "=", "re", ".", "sub", "(", "\" \"", ",", "''", ",", "pattern", ")", "objet_str", "=", "abstractRender", ".", "dateheure", "(", "objet", ")", "return", "bool"...
abstractSearch dans une date-heure datetime.datetime (cf abstractRender.dateheure)
[ "abstractSearch", "dans", "une", "date", "-", "heure", "datetime", ".", "datetime", "(", "cf", "abstractRender", ".", "dateheure", ")" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L213-L219
train
returns True if objet is in date - heure
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
abstractSearch.in_telephones
def in_telephones(objet, pattern): """ abstractSearch dans une liste de téléphones.""" objet = objet or [] if pattern == '' or not objet: return False return max(bool(re.search(pattern, t)) for t in objet)
python
def in_telephones(objet, pattern): """ abstractSearch dans une liste de téléphones.""" objet = objet or [] if pattern == '' or not objet: return False return max(bool(re.search(pattern, t)) for t in objet)
[ "def", "in_telephones", "(", "objet", ",", "pattern", ")", ":", "objet", "=", "objet", "or", "[", "]", "if", "pattern", "==", "''", "or", "not", "objet", ":", "return", "False", "return", "max", "(", "bool", "(", "re", ".", "search", "(", "pattern", ...
abstractSearch dans une liste de téléphones.
[ "abstractSearch", "dans", "une", "liste", "de", "téléphones", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L222-L227
train
abstractSearch une liste de téléphones.
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
abstractRender.date
def date(objet): """ abstractRender d'une date datetime.date""" if objet: return "{}/{}/{}".format(objet.day, objet.month, objet.year) return ""
python
def date(objet): """ abstractRender d'une date datetime.date""" if objet: return "{}/{}/{}".format(objet.day, objet.month, objet.year) return ""
[ "def", "date", "(", "objet", ")", ":", "if", "objet", ":", "return", "\"{}/{}/{}\"", ".", "format", "(", "objet", ".", "day", ",", "objet", ".", "month", ",", "objet", ".", "year", ")", "return", "\"\"" ]
abstractRender d'une date datetime.date
[ "abstractRender", "d", "une", "date", "datetime", ".", "date" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L250-L254
train
abstractRender d un date datetime. date
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
abstractRender.dateheure
def dateheure(objet): """ abstractRender d'une date-heure datetime.datetime au format JJ/MM/AAAAàHH:mm """ if objet: return "{}/{}/{} à {:02}:{:02}".format(objet.day, objet.month, objet.year, objet.hour, objet.minute) return ""
python
def dateheure(objet): """ abstractRender d'une date-heure datetime.datetime au format JJ/MM/AAAAàHH:mm """ if objet: return "{}/{}/{} à {:02}:{:02}".format(objet.day, objet.month, objet.year, objet.hour, objet.minute) return ""
[ "def", "dateheure", "(", "objet", ")", ":", "if", "objet", ":", "return", "\"{}/{}/{} à {:02}:{:02}\".", "f", "ormat(", "o", "bjet.", "d", "ay,", " ", "bjet.", "m", "onth,", " ", "bjet.", "y", "ear,", " ", "bjet.", "h", "our,", " ", "bjet.", "m", "inut...
abstractRender d'une date-heure datetime.datetime au format JJ/MM/AAAAàHH:mm
[ "abstractRender", "d", "une", "date", "-", "heure", "datetime", ".", "datetime", "au", "format", "JJ", "/", "MM", "/", "AAAAàHH", ":", "mm" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L257-L261
train
abstractRender d un date - heure datetime. datetime au format JJMMAAAA à HH : mm
QunarOPS/qg.core
qg/core/gettextutils.py
install
def install(domain, lazy=False): """Install a _() function using the given translation domain. Given a translation domain, install a _() function using gettext's install() function. The main difference from gettext.install() is that we allow overriding the default localedir (e.g. /usr/share/locale...
python
def install(domain, lazy=False): """Install a _() function using the given translation domain. Given a translation domain, install a _() function using gettext's install() function. The main difference from gettext.install() is that we allow overriding the default localedir (e.g. /usr/share/locale...
[ "def", "install", "(", "domain", ",", "lazy", "=", "False", ")", ":", "if", "lazy", ":", "# NOTE(mrodden): Lazy gettext functionality.", "#", "# The following introduces a deferred way to do translations on", "# messages in OpenStack. We override the standard _() function", "# and ...
Install a _() function using the given translation domain. Given a translation domain, install a _() function using gettext's install() function. The main difference from gettext.install() is that we allow overriding the default localedir (e.g. /usr/share/locale) using a translation-domain-specifi...
[ "Install", "a", "_", "()", "function", "using", "the", "given", "translation", "domain", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/gettextutils.py#L83-L130
train
Install a _ function using the given translation domain.
QunarOPS/qg.core
qg/core/gettextutils.py
get_available_languages
def get_available_languages(domain): """Lists the available languages for the given translation domain. :param domain: the domain to get languages for """ if domain in _AVAILABLE_LANGUAGES: return copy.copy(_AVAILABLE_LANGUAGES[domain]) localedir = '%s_LOCALEDIR' % domain.upper() find ...
python
def get_available_languages(domain): """Lists the available languages for the given translation domain. :param domain: the domain to get languages for """ if domain in _AVAILABLE_LANGUAGES: return copy.copy(_AVAILABLE_LANGUAGES[domain]) localedir = '%s_LOCALEDIR' % domain.upper() find ...
[ "def", "get_available_languages", "(", "domain", ")", ":", "if", "domain", "in", "_AVAILABLE_LANGUAGES", ":", "return", "copy", ".", "copy", "(", "_AVAILABLE_LANGUAGES", "[", "domain", "]", ")", "localedir", "=", "'%s_LOCALEDIR'", "%", "domain", ".", "upper", ...
Lists the available languages for the given translation domain. :param domain: the domain to get languages for
[ "Lists", "the", "available", "languages", "for", "the", "given", "translation", "domain", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/gettextutils.py#L298-L343
train
Lists the available languages for the given translation domain.
QunarOPS/qg.core
qg/core/gettextutils.py
translate
def translate(obj, desired_locale=None): """Gets the translated unicode representation of the given object. If the object is not translatable it is returned as-is. If the locale is None the object is translated to the system locale. :param obj: the object to translate :param desired_locale: the lo...
python
def translate(obj, desired_locale=None): """Gets the translated unicode representation of the given object. If the object is not translatable it is returned as-is. If the locale is None the object is translated to the system locale. :param obj: the object to translate :param desired_locale: the lo...
[ "def", "translate", "(", "obj", ",", "desired_locale", "=", "None", ")", ":", "message", "=", "obj", "if", "not", "isinstance", "(", "message", ",", "Message", ")", ":", "# If the object to translate is not already translatable,", "# let's first get its unicode represen...
Gets the translated unicode representation of the given object. If the object is not translatable it is returned as-is. If the locale is None the object is translated to the system locale. :param obj: the object to translate :param desired_locale: the locale to translate the message to, if None the ...
[ "Gets", "the", "translated", "unicode", "representation", "of", "the", "given", "object", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/gettextutils.py#L346-L367
train
Translate the object in unicode representation to the desired locale.
QunarOPS/qg.core
qg/core/gettextutils.py
_translate_args
def _translate_args(args, desired_locale=None): """Translates all the translatable elements of the given arguments object. This method is used for translating the translatable values in method arguments which include values of tuples or dictionaries. If the object is not a tuple or a dictionary the obj...
python
def _translate_args(args, desired_locale=None): """Translates all the translatable elements of the given arguments object. This method is used for translating the translatable values in method arguments which include values of tuples or dictionaries. If the object is not a tuple or a dictionary the obj...
[ "def", "_translate_args", "(", "args", ",", "desired_locale", "=", "None", ")", ":", "if", "isinstance", "(", "args", ",", "tuple", ")", ":", "return", "tuple", "(", "translate", "(", "v", ",", "desired_locale", ")", "for", "v", "in", "args", ")", "if"...
Translates all the translatable elements of the given arguments object. This method is used for translating the translatable values in method arguments which include values of tuples or dictionaries. If the object is not a tuple or a dictionary the object itself is translated if it is translatable. ...
[ "Translates", "all", "the", "translatable", "elements", "of", "the", "given", "arguments", "object", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/gettextutils.py#L370-L393
train
Translates all the translatable elements of the given arguments object.
QunarOPS/qg.core
qg/core/gettextutils.py
Message.translate
def translate(self, desired_locale=None): """Translate this message to the desired locale. :param desired_locale: The desired locale to translate the message to, if no locale is provided the message will be translated to the system's default...
python
def translate(self, desired_locale=None): """Translate this message to the desired locale. :param desired_locale: The desired locale to translate the message to, if no locale is provided the message will be translated to the system's default...
[ "def", "translate", "(", "self", ",", "desired_locale", "=", "None", ")", ":", "translated_message", "=", "Message", ".", "_translate_msgid", "(", "self", ".", "msgid", ",", "self", ".", "domain", ",", "desired_locale", ")", "if", "self", ".", "params", "i...
Translate this message to the desired locale. :param desired_locale: The desired locale to translate the message to, if no locale is provided the message will be translated to the system's default locale. :returns: the translated message in...
[ "Translate", "this", "message", "to", "the", "desired", "locale", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/gettextutils.py#L163-L188
train
Translate this message to the desired locale.
QunarOPS/qg.core
qg/core/gettextutils.py
Message._sanitize_mod_params
def _sanitize_mod_params(self, other): """Sanitize the object being modded with this Message. - Add support for modding 'None' so translation supports it - Trim the modded object, which can be a large dictionary, to only those keys that would actually be used in a translation - ...
python
def _sanitize_mod_params(self, other): """Sanitize the object being modded with this Message. - Add support for modding 'None' so translation supports it - Trim the modded object, which can be a large dictionary, to only those keys that would actually be used in a translation - ...
[ "def", "_sanitize_mod_params", "(", "self", ",", "other", ")", ":", "if", "other", "is", "None", ":", "params", "=", "(", "other", ",", ")", "elif", "isinstance", "(", "other", ",", "dict", ")", ":", "params", "=", "self", ".", "_trim_dictionary_paramete...
Sanitize the object being modded with this Message. - Add support for modding 'None' so translation supports it - Trim the modded object, which can be a large dictionary, to only those keys that would actually be used in a translation - Snapshot the object being modded, in case the mess...
[ "Sanitize", "the", "object", "being", "modded", "with", "this", "Message", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/gettextutils.py#L225-L240
train
Sanitize the parameters used to modulate the object being modded with this Message.
QunarOPS/qg.core
qg/core/gettextutils.py
Message._trim_dictionary_parameters
def _trim_dictionary_parameters(self, dict_param): """Return a dict that only has matching entries in the msgid.""" # NOTE(luisg): Here we trim down the dictionary passed as parameters # to avoid carrying a lot of unnecessary weight around in the message # object, for example if someone ...
python
def _trim_dictionary_parameters(self, dict_param): """Return a dict that only has matching entries in the msgid.""" # NOTE(luisg): Here we trim down the dictionary passed as parameters # to avoid carrying a lot of unnecessary weight around in the message # object, for example if someone ...
[ "def", "_trim_dictionary_parameters", "(", "self", ",", "dict_param", ")", ":", "# NOTE(luisg): Here we trim down the dictionary passed as parameters", "# to avoid carrying a lot of unnecessary weight around in the message", "# object, for example if someone passes in Message() % locals() but", ...
Return a dict that only has matching entries in the msgid.
[ "Return", "a", "dict", "that", "only", "has", "matching", "entries", "in", "the", "msgid", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/gettextutils.py#L242-L272
train
Return a dict that only has matching entries in the msgid.
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/renderers.py
registry_adapter
def registry_adapter(obj, request): """ Adapter for rendering a :class:`pyramid_urireferencer.models.RegistryResponse` to json. :param pyramid_urireferencer.models.RegistryResponse obj: The response to be rendered. :rtype: :class:`dict` """ return { 'query_uri': obj.query_uri, '...
python
def registry_adapter(obj, request): """ Adapter for rendering a :class:`pyramid_urireferencer.models.RegistryResponse` to json. :param pyramid_urireferencer.models.RegistryResponse obj: The response to be rendered. :rtype: :class:`dict` """ return { 'query_uri': obj.query_uri, '...
[ "def", "registry_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'query_uri'", ":", "obj", ".", "query_uri", ",", "'success'", ":", "obj", ".", "success", ",", "'has_references'", ":", "obj", ".", "has_references", ",", "'count'", ":", "obj...
Adapter for rendering a :class:`pyramid_urireferencer.models.RegistryResponse` to json. :param pyramid_urireferencer.models.RegistryResponse obj: The response to be rendered. :rtype: :class:`dict`
[ "Adapter", "for", "rendering", "a", ":", "class", ":", "pyramid_urireferencer", ".", "models", ".", "RegistryResponse", "to", "json", "." ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/renderers.py#L14-L38
train
Returns a dictionary that can be used to render a registry response to json.
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/renderers.py
application_adapter
def application_adapter(obj, request): """ Adapter for rendering a :class:`pyramid_urireferencer.models.ApplicationResponse` to json. :param pyramid_urireferencer.models.ApplicationResponse obj: The response to be rendered. :rtype: :class:`dict` """ return { 'title': obj.title, ...
python
def application_adapter(obj, request): """ Adapter for rendering a :class:`pyramid_urireferencer.models.ApplicationResponse` to json. :param pyramid_urireferencer.models.ApplicationResponse obj: The response to be rendered. :rtype: :class:`dict` """ return { 'title': obj.title, ...
[ "def", "application_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'title'", ":", "obj", ".", "title", ",", "'uri'", ":", "obj", ".", "uri", ",", "'service_url'", ":", "obj", ".", "service_url", ",", "'success'", ":", "obj", ".", "succ...
Adapter for rendering a :class:`pyramid_urireferencer.models.ApplicationResponse` to json. :param pyramid_urireferencer.models.ApplicationResponse obj: The response to be rendered. :rtype: :class:`dict`
[ "Adapter", "for", "rendering", "a", ":", "class", ":", "pyramid_urireferencer", ".", "models", ".", "ApplicationResponse", "to", "json", "." ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/renderers.py#L41-L59
train
Returns a dictionary representation of an application response.
tsnaomi/finnsyll
finnsyll/prev/phonology.py
replace_umlauts
def replace_umlauts(word, put_back=False): # use translate() '''If put_back is True, put in umlauts; else, take them out!''' if put_back: word = word.replace('A', 'ä') word = word.replace('O', 'ö') else: word = word.replace('ä', 'A').replace('\xc3\xa4', 'A') word = word.rep...
python
def replace_umlauts(word, put_back=False): # use translate() '''If put_back is True, put in umlauts; else, take them out!''' if put_back: word = word.replace('A', 'ä') word = word.replace('O', 'ö') else: word = word.replace('ä', 'A').replace('\xc3\xa4', 'A') word = word.rep...
[ "def", "replace_umlauts", "(", "word", ",", "put_back", "=", "False", ")", ":", "# use translate()", "if", "put_back", ":", "word", "=", "word", ".", "replace", "(", "'A'", ",", "'ä')", "", "word", "=", "word", ".", "replace", "(", "'O'", ",", "'ö')", ...
If put_back is True, put in umlauts; else, take them out!
[ "If", "put_back", "is", "True", "put", "in", "umlauts", ";", "else", "take", "them", "out!" ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/phonology.py#L203-L213
train
Replace umlauts in a word
OLC-Bioinformatics/sipprverse
cgecore/blaster/blaster.py
Blaster.get_query_align
def get_query_align(hit, contig): """ Function for extracting extra seqeunce data to the query alignment if the full reference length are not covered """ # Getting data needed to extract sequences query_seq = hit['query_string'] homo_seq = hit['homo_string'] sbjct_...
python
def get_query_align(hit, contig): """ Function for extracting extra seqeunce data to the query alignment if the full reference length are not covered """ # Getting data needed to extract sequences query_seq = hit['query_string'] homo_seq = hit['homo_string'] sbjct_...
[ "def", "get_query_align", "(", "hit", ",", "contig", ")", ":", "# Getting data needed to extract sequences", "query_seq", "=", "hit", "[", "'query_string'", "]", "homo_seq", "=", "hit", "[", "'homo_string'", "]", "sbjct_start", "=", "int", "(", "hit", "[", "'sbj...
Function for extracting extra seqeunce data to the query alignment if the full reference length are not covered
[ "Function", "for", "extracting", "extra", "seqeunce", "data", "to", "the", "query", "alignment", "if", "the", "full", "reference", "length", "are", "not", "covered" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/blaster/blaster.py#L465-L575
train
Function for extracting extra seqeunce data to the query atom
BertrandBordage/django-tablature
tablature/views.py
TableDataViewMixin.get_ordering_for_column
def get_ordering_for_column(self, column, direction): """ Returns a tuple of lookups to order by for the given column and direction. Direction is an integer, either -1, 0 or 1. """ if direction == 0: return () if column in self.orderings: ordering ...
python
def get_ordering_for_column(self, column, direction): """ Returns a tuple of lookups to order by for the given column and direction. Direction is an integer, either -1, 0 or 1. """ if direction == 0: return () if column in self.orderings: ordering ...
[ "def", "get_ordering_for_column", "(", "self", ",", "column", ",", "direction", ")", ":", "if", "direction", "==", "0", ":", "return", "(", ")", "if", "column", "in", "self", ".", "orderings", ":", "ordering", "=", "self", ".", "orderings", "[", "column"...
Returns a tuple of lookups to order by for the given column and direction. Direction is an integer, either -1, 0 or 1.
[ "Returns", "a", "tuple", "of", "lookups", "to", "order", "by", "for", "the", "given", "column", "and", "direction", ".", "Direction", "is", "an", "integer", "either", "-", "1", "0", "or", "1", "." ]
f5198b3fb1ebf7f5dfd8ebfd4bf977468e4f0390
https://github.com/BertrandBordage/django-tablature/blob/f5198b3fb1ebf7f5dfd8ebfd4bf977468e4f0390/tablature/views.py#L116-L135
train
Returns a tuple of lookups to order by for the given column and direction.
pymacaron/pymacaron-core
pymacaron_core/swagger/spec.py
ApiSpec.model_to_json
def model_to_json(self, object, cleanup=True): """Take a model instance and return it as a json struct""" model_name = type(object).__name__ if model_name not in self.swagger_dict['definitions']: raise ValidationError("Swagger spec has no definition for model %s" % model_name) ...
python
def model_to_json(self, object, cleanup=True): """Take a model instance and return it as a json struct""" model_name = type(object).__name__ if model_name not in self.swagger_dict['definitions']: raise ValidationError("Swagger spec has no definition for model %s" % model_name) ...
[ "def", "model_to_json", "(", "self", ",", "object", ",", "cleanup", "=", "True", ")", ":", "model_name", "=", "type", "(", "object", ")", ".", "__name__", "if", "model_name", "not", "in", "self", ".", "swagger_dict", "[", "'definitions'", "]", ":", "rais...
Take a model instance and return it as a json struct
[ "Take", "a", "model", "instance", "and", "return", "it", "as", "a", "json", "struct" ]
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/spec.py#L95-L105
train
Take a model instance and return it as a json struct
pymacaron/pymacaron-core
pymacaron_core/swagger/spec.py
ApiSpec.json_to_model
def json_to_model(self, model_name, j): """Take a json strust and a model name, and return a model instance""" if model_name not in self.swagger_dict['definitions']: raise ValidationError("Swagger spec has no definition for model %s" % model_name) model_def = self.swagger_dict['defin...
python
def json_to_model(self, model_name, j): """Take a json strust and a model name, and return a model instance""" if model_name not in self.swagger_dict['definitions']: raise ValidationError("Swagger spec has no definition for model %s" % model_name) model_def = self.swagger_dict['defin...
[ "def", "json_to_model", "(", "self", ",", "model_name", ",", "j", ")", ":", "if", "model_name", "not", "in", "self", ".", "swagger_dict", "[", "'definitions'", "]", ":", "raise", "ValidationError", "(", "\"Swagger spec has no definition for model %s\"", "%", "mode...
Take a json strust and a model name, and return a model instance
[ "Take", "a", "json", "strust", "and", "a", "model", "name", "and", "return", "a", "model", "instance" ]
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/spec.py#L124-L130
train
Take a json strust and a model name and return a model instance
pymacaron/pymacaron-core
pymacaron_core/swagger/spec.py
ApiSpec.validate
def validate(self, model_name, object): """Validate an object against its swagger model""" if model_name not in self.swagger_dict['definitions']: raise ValidationError("Swagger spec has no definition for model %s" % model_name) model_def = self.swagger_dict['definitions'][model_name]...
python
def validate(self, model_name, object): """Validate an object against its swagger model""" if model_name not in self.swagger_dict['definitions']: raise ValidationError("Swagger spec has no definition for model %s" % model_name) model_def = self.swagger_dict['definitions'][model_name]...
[ "def", "validate", "(", "self", ",", "model_name", ",", "object", ")", ":", "if", "model_name", "not", "in", "self", ".", "swagger_dict", "[", "'definitions'", "]", ":", "raise", "ValidationError", "(", "\"Swagger spec has no definition for model %s\"", "%", "mode...
Validate an object against its swagger model
[ "Validate", "an", "object", "against", "its", "swagger", "model" ]
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/spec.py#L133-L139
train
Validate an object against its swagger model
pymacaron/pymacaron-core
pymacaron_core/swagger/spec.py
ApiSpec.call_on_each_endpoint
def call_on_each_endpoint(self, callback): """Find all server endpoints defined in the swagger spec and calls 'callback' for each, with an instance of EndpointData as argument. """ if 'paths' not in self.swagger_dict: return for path, d in list(self.swagger_dict['pa...
python
def call_on_each_endpoint(self, callback): """Find all server endpoints defined in the swagger spec and calls 'callback' for each, with an instance of EndpointData as argument. """ if 'paths' not in self.swagger_dict: return for path, d in list(self.swagger_dict['pa...
[ "def", "call_on_each_endpoint", "(", "self", ",", "callback", ")", ":", "if", "'paths'", "not", "in", "self", ".", "swagger_dict", ":", "return", "for", "path", ",", "d", "in", "list", "(", "self", ".", "swagger_dict", "[", "'paths'", "]", ".", "items", ...
Find all server endpoints defined in the swagger spec and calls 'callback' for each, with an instance of EndpointData as argument.
[ "Find", "all", "server", "endpoints", "defined", "in", "the", "swagger", "spec", "and", "calls", "callback", "for", "each", "with", "an", "instance", "of", "EndpointData", "as", "argument", "." ]
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/spec.py#L142-L213
train
Find all server endpoints defined in the swagger spec and calls callback for each one with an instance of EndpointData as argument.
andrewguy9/safeoutput
safeoutput/__init__.py
main
def main(args=None): """Buffer stdin and flush, and avoid incomplete files.""" parser = argparse.ArgumentParser(description=main.__doc__) parser.add_argument( '--binary', dest='mode', action='store_const', const="wb", default="w", help='write in binary mode') ...
python
def main(args=None): """Buffer stdin and flush, and avoid incomplete files.""" parser = argparse.ArgumentParser(description=main.__doc__) parser.add_argument( '--binary', dest='mode', action='store_const', const="wb", default="w", help='write in binary mode') ...
[ "def", "main", "(", "args", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "main", ".", "__doc__", ")", "parser", ".", "add_argument", "(", "'--binary'", ",", "dest", "=", "'mode'", ",", "action", "=", ...
Buffer stdin and flush, and avoid incomplete files.
[ "Buffer", "stdin", "and", "flush", "and", "avoid", "incomplete", "files", "." ]
e48fa1f691b57ea81c8faf7539f0bdd28ab59be5
https://github.com/andrewguy9/safeoutput/blob/e48fa1f691b57ea81c8faf7539f0bdd28ab59be5/safeoutput/__init__.py#L64-L86
train
Buffer stdin and flush and avoid incomplete files.
hid-io/layouts-python
layouts/emitter.py
basic_c_defines
def basic_c_defines( layout, keyboard_prefix="KEY_", led_prefix="LED_", sysctrl_prefix="SYS_", cons_prefix="CONS_", code_suffix=True, all_caps=True, space_char="_" ): ''' Generates a list of C defines that can be used to generate a header file @param layout: Layout object ...
python
def basic_c_defines( layout, keyboard_prefix="KEY_", led_prefix="LED_", sysctrl_prefix="SYS_", cons_prefix="CONS_", code_suffix=True, all_caps=True, space_char="_" ): ''' Generates a list of C defines that can be used to generate a header file @param layout: Layout object ...
[ "def", "basic_c_defines", "(", "layout", ",", "keyboard_prefix", "=", "\"KEY_\"", ",", "led_prefix", "=", "\"LED_\"", ",", "sysctrl_prefix", "=", "\"SYS_\"", ",", "cons_prefix", "=", "\"CONS_\"", ",", "code_suffix", "=", "True", ",", "all_caps", "=", "True", "...
Generates a list of C defines that can be used to generate a header file @param layout: Layout object @keyboard_prefix: Prefix used for to_hid_keyboard @led_prefix: Prefix used for to_hid_led @sysctrl_prefix: Prefix used for to_hid_sysctrl @cons_prefix: Prefix used for to_hid_consumer @code_suf...
[ "Generates", "a", "list", "of", "C", "defines", "that", "can", "be", "used", "to", "generate", "a", "header", "file" ]
b347578bfb4198fd812ecd7a2d9c7e551a856280
https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/emitter.py#L11-L81
train
Generates a list of basic C - style defines that can be used to generate a header file.
AASHE/django-constant-contact
django_constant_contact/models.py
ConstantContact.new_email_marketing_campaign
def new_email_marketing_campaign(self, name, email_content, from_email, from_name, reply_to_email, subject, text_content, address, is_view_as_webpage_enabled=False, view_as...
python
def new_email_marketing_campaign(self, name, email_content, from_email, from_name, reply_to_email, subject, text_content, address, is_view_as_webpage_enabled=False, view_as...
[ "def", "new_email_marketing_campaign", "(", "self", ",", "name", ",", "email_content", ",", "from_email", ",", "from_name", ",", "reply_to_email", ",", "subject", ",", "text_content", ",", "address", ",", "is_view_as_webpage_enabled", "=", "False", ",", "view_as_web...
Create a Constant Contact email marketing campaign. Returns an EmailMarketingCampaign object.
[ "Create", "a", "Constant", "Contact", "email", "marketing", "campaign", ".", "Returns", "an", "EmailMarketingCampaign", "object", "." ]
2a37f00ee62531804414b35637d0dad5992d5822
https://github.com/AASHE/django-constant-contact/blob/2a37f00ee62531804414b35637d0dad5992d5822/django_constant_contact/models.py#L56-L105
train
Creates a new EmailMarketingCampaign object.
AASHE/django-constant-contact
django_constant_contact/models.py
ConstantContact.update_email_marketing_campaign
def update_email_marketing_campaign(self, email_marketing_campaign, name, email_content, from_email, from_name, reply_to_email, subject, text_content, address, ...
python
def update_email_marketing_campaign(self, email_marketing_campaign, name, email_content, from_email, from_name, reply_to_email, subject, text_content, address, ...
[ "def", "update_email_marketing_campaign", "(", "self", ",", "email_marketing_campaign", ",", "name", ",", "email_content", ",", "from_email", ",", "from_name", ",", "reply_to_email", ",", "subject", ",", "text_content", ",", "address", ",", "is_view_as_webpage_enabled",...
Update a Constant Contact email marketing campaign. Returns the updated EmailMarketingCampaign object.
[ "Update", "a", "Constant", "Contact", "email", "marketing", "campaign", ".", "Returns", "the", "updated", "EmailMarketingCampaign", "object", "." ]
2a37f00ee62531804414b35637d0dad5992d5822
https://github.com/AASHE/django-constant-contact/blob/2a37f00ee62531804414b35637d0dad5992d5822/django_constant_contact/models.py#L107-L162
train
Updates an existing Constant Contact email marketing campaign.
AASHE/django-constant-contact
django_constant_contact/models.py
ConstantContact.delete_email_marketing_campaign
def delete_email_marketing_campaign(self, email_marketing_campaign): """Deletes a Constant Contact email marketing campaign. """ url = self.api.join('/'.join([ self.EMAIL_MARKETING_CAMPAIGN_URL, str(email_marketing_campaign.constant_contact_id)])) response = url.d...
python
def delete_email_marketing_campaign(self, email_marketing_campaign): """Deletes a Constant Contact email marketing campaign. """ url = self.api.join('/'.join([ self.EMAIL_MARKETING_CAMPAIGN_URL, str(email_marketing_campaign.constant_contact_id)])) response = url.d...
[ "def", "delete_email_marketing_campaign", "(", "self", ",", "email_marketing_campaign", ")", ":", "url", "=", "self", ".", "api", ".", "join", "(", "'/'", ".", "join", "(", "[", "self", ".", "EMAIL_MARKETING_CAMPAIGN_URL", ",", "str", "(", "email_marketing_campa...
Deletes a Constant Contact email marketing campaign.
[ "Deletes", "a", "Constant", "Contact", "email", "marketing", "campaign", "." ]
2a37f00ee62531804414b35637d0dad5992d5822
https://github.com/AASHE/django-constant-contact/blob/2a37f00ee62531804414b35637d0dad5992d5822/django_constant_contact/models.py#L164-L172
train
Deletes a Constant Contact email marketing campaign.
AASHE/django-constant-contact
django_constant_contact/models.py
ConstantContact.inline_css
def inline_css(self, html): """Inlines CSS defined in external style sheets. """ premailer = Premailer(html) inlined_html = premailer.transform(pretty_print=True) return inlined_html
python
def inline_css(self, html): """Inlines CSS defined in external style sheets. """ premailer = Premailer(html) inlined_html = premailer.transform(pretty_print=True) return inlined_html
[ "def", "inline_css", "(", "self", ",", "html", ")", ":", "premailer", "=", "Premailer", "(", "html", ")", "inlined_html", "=", "premailer", ".", "transform", "(", "pretty_print", "=", "True", ")", "return", "inlined_html" ]
Inlines CSS defined in external style sheets.
[ "Inlines", "CSS", "defined", "in", "external", "style", "sheets", "." ]
2a37f00ee62531804414b35637d0dad5992d5822
https://github.com/AASHE/django-constant-contact/blob/2a37f00ee62531804414b35637d0dad5992d5822/django_constant_contact/models.py#L174-L179
train
Inlines CSS defined in external style sheets.
AASHE/django-constant-contact
django_constant_contact/models.py
ConstantContact.preview_email_marketing_campaign
def preview_email_marketing_campaign(self, email_marketing_campaign): """Returns HTML and text previews of an EmailMarketingCampaign. """ url = self.api.join('/'.join([ self.EMAIL_MARKETING_CAMPAIGN_URL, str(email_marketing_campaign.constant_contact_id), 'prev...
python
def preview_email_marketing_campaign(self, email_marketing_campaign): """Returns HTML and text previews of an EmailMarketingCampaign. """ url = self.api.join('/'.join([ self.EMAIL_MARKETING_CAMPAIGN_URL, str(email_marketing_campaign.constant_contact_id), 'prev...
[ "def", "preview_email_marketing_campaign", "(", "self", ",", "email_marketing_campaign", ")", ":", "url", "=", "self", ".", "api", ".", "join", "(", "'/'", ".", "join", "(", "[", "self", ".", "EMAIL_MARKETING_CAMPAIGN_URL", ",", "str", "(", "email_marketing_camp...
Returns HTML and text previews of an EmailMarketingCampaign.
[ "Returns", "HTML", "and", "text", "previews", "of", "an", "EmailMarketingCampaign", "." ]
2a37f00ee62531804414b35637d0dad5992d5822
https://github.com/AASHE/django-constant-contact/blob/2a37f00ee62531804414b35637d0dad5992d5822/django_constant_contact/models.py#L181-L191
train
Returns HTML and text previews of an EmailMarketingCampaign.
AASHE/django-constant-contact
django_constant_contact/models.py
EmailMarketingCampaign.pre_save
def pre_save(cls, sender, instance, *args, **kwargs): """Pull constant_contact_id out of data. """ instance.constant_contact_id = str(instance.data['id'])
python
def pre_save(cls, sender, instance, *args, **kwargs): """Pull constant_contact_id out of data. """ instance.constant_contact_id = str(instance.data['id'])
[ "def", "pre_save", "(", "cls", ",", "sender", ",", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "instance", ".", "constant_contact_id", "=", "str", "(", "instance", ".", "data", "[", "'id'", "]", ")" ]
Pull constant_contact_id out of data.
[ "Pull", "constant_contact_id", "out", "of", "data", "." ]
2a37f00ee62531804414b35637d0dad5992d5822
https://github.com/AASHE/django-constant-contact/blob/2a37f00ee62531804414b35637d0dad5992d5822/django_constant_contact/models.py#L216-L219
train
Pull constant_contact_id out of data.
AASHE/django-constant-contact
django_constant_contact/models.py
EmailMarketingCampaign.pre_delete
def pre_delete(cls, sender, instance, *args, **kwargs): """Deletes the CC email marketing campaign associated with me. """ cc = ConstantContact() response = cc.delete_email_marketing_campaign(instance) response.raise_for_status()
python
def pre_delete(cls, sender, instance, *args, **kwargs): """Deletes the CC email marketing campaign associated with me. """ cc = ConstantContact() response = cc.delete_email_marketing_campaign(instance) response.raise_for_status()
[ "def", "pre_delete", "(", "cls", ",", "sender", ",", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cc", "=", "ConstantContact", "(", ")", "response", "=", "cc", ".", "delete_email_marketing_campaign", "(", "instance", ")", "response", ...
Deletes the CC email marketing campaign associated with me.
[ "Deletes", "the", "CC", "email", "marketing", "campaign", "associated", "with", "me", "." ]
2a37f00ee62531804414b35637d0dad5992d5822
https://github.com/AASHE/django-constant-contact/blob/2a37f00ee62531804414b35637d0dad5992d5822/django_constant_contact/models.py#L222-L227
train
Deletes the CC email marketing campaign associated with me.
OLC-Bioinformatics/sipprverse
sixteenS/sixteenS_probes.py
SixteenS.runner
def runner(self): """ Run the necessary methods in the correct order """ printtime('Starting {} analysis pipeline'.format(self.analysistype), self.starttime) if not self.pipeline: # If the metadata has been passed from the method script, self.pipeline must still be fa...
python
def runner(self): """ Run the necessary methods in the correct order """ printtime('Starting {} analysis pipeline'.format(self.analysistype), self.starttime) if not self.pipeline: # If the metadata has been passed from the method script, self.pipeline must still be fa...
[ "def", "runner", "(", "self", ")", ":", "printtime", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ",", "self", ".", "starttime", ")", "if", "not", "self", ".", "pipeline", ":", "# If the metadata has been passed f...
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/sixteenS/sixteenS_probes.py#L418-L443
train
Run the necessary methods in the correct order.
JeromeParadis/django-mailing
mailing/mail.py
send_email
def send_email(recipients, subject, text_content=None, html_content=None, from_email=None, use_base_template=True, category=None, fail_silently=False, language=None, cc=None, bcc=None, attachments=None, headers=None, bypass_queue=False, bypass_hijacking=False, attach_files=None): """ Will send a multi-format ...
python
def send_email(recipients, subject, text_content=None, html_content=None, from_email=None, use_base_template=True, category=None, fail_silently=False, language=None, cc=None, bcc=None, attachments=None, headers=None, bypass_queue=False, bypass_hijacking=False, attach_files=None): """ Will send a multi-format ...
[ "def", "send_email", "(", "recipients", ",", "subject", ",", "text_content", "=", "None", ",", "html_content", "=", "None", ",", "from_email", "=", "None", ",", "use_base_template", "=", "True", ",", "category", "=", "None", ",", "fail_silently", "=", "False...
Will send a multi-format email to recipients. Email may be queued through celery
[ "Will", "send", "a", "multi", "-", "format", "email", "to", "recipients", ".", "Email", "may", "be", "queued", "through", "celery" ]
e1773410ab8ab946caf2847c46e025ba43c1ba6c
https://github.com/JeromeParadis/django-mailing/blob/e1773410ab8ab946caf2847c46e025ba43c1ba6c/mailing/mail.py#L23-L103
train
Sends an email to the specified recipients.
Riffstation/Flask-Philo-SQLAlchemy
flask_philo_sqlalchemy/connection.py
ConnectionPool.initialize_connections
def initialize_connections(self, scopefunc=None): """ Initialize a database connection by each connection string defined in the configuration file """ for connection_name, connection_string in\ self.app.config['FLASK_PHILO_SQLALCHEMY'].items(): engine ...
python
def initialize_connections(self, scopefunc=None): """ Initialize a database connection by each connection string defined in the configuration file """ for connection_name, connection_string in\ self.app.config['FLASK_PHILO_SQLALCHEMY'].items(): engine ...
[ "def", "initialize_connections", "(", "self", ",", "scopefunc", "=", "None", ")", ":", "for", "connection_name", ",", "connection_string", "in", "self", ".", "app", ".", "config", "[", "'FLASK_PHILO_SQLALCHEMY'", "]", ".", "items", "(", ")", ":", "engine", "...
Initialize a database connection by each connection string defined in the configuration file
[ "Initialize", "a", "database", "connection", "by", "each", "connection", "string", "defined", "in", "the", "configuration", "file" ]
71598bb603b8458a2cf9f7989f71d8f1c77fafb9
https://github.com/Riffstation/Flask-Philo-SQLAlchemy/blob/71598bb603b8458a2cf9f7989f71d8f1c77fafb9/flask_philo_sqlalchemy/connection.py#L26-L36
train
Initialize a database connection by each connection string in the configuration file.
benoitkugler/abstractDataLibrary
pyDLib/Core/groups.py
sortableListe.sort
def sort(self, attribut, order=False): """ Implément un tri par attrbut. :param str attribut: Nom du champ concerné :param bool order: Ordre croissant ou décroissant """ value_default = formats.ASSOCIATION[attribut][3] if type(value_default) is str: # case inse...
python
def sort(self, attribut, order=False): """ Implément un tri par attrbut. :param str attribut: Nom du champ concerné :param bool order: Ordre croissant ou décroissant """ value_default = formats.ASSOCIATION[attribut][3] if type(value_default) is str: # case inse...
[ "def", "sort", "(", "self", ",", "attribut", ",", "order", "=", "False", ")", ":", "value_default", "=", "formats", ".", "ASSOCIATION", "[", "attribut", "]", "[", "3", "]", "if", "type", "(", "value_default", ")", "is", "str", ":", "# case insensitive so...
Implément un tri par attrbut. :param str attribut: Nom du champ concerné :param bool order: Ordre croissant ou décroissant
[ "Implément", "un", "tri", "par", "attrbut", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/groups.py#L9-L27
train
sorts the list according to the attribute attribut
benoitkugler/abstractDataLibrary
pyDLib/Core/groups.py
sortableListe.index_from_id
def index_from_id(self,Id): """Return the row of given Id if it'exists, otherwise None. Only works with pseudo-acces""" try: return [a.Id for a in self].index(Id) except IndexError: return
python
def index_from_id(self,Id): """Return the row of given Id if it'exists, otherwise None. Only works with pseudo-acces""" try: return [a.Id for a in self].index(Id) except IndexError: return
[ "def", "index_from_id", "(", "self", ",", "Id", ")", ":", "try", ":", "return", "[", "a", ".", "Id", "for", "a", "in", "self", "]", ".", "index", "(", "Id", ")", "except", "IndexError", ":", "return" ]
Return the row of given Id if it'exists, otherwise None. Only works with pseudo-acces
[ "Return", "the", "row", "of", "given", "Id", "if", "it", "exists", "otherwise", "None", ".", "Only", "works", "with", "pseudo", "-", "acces" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/groups.py#L38-L43
train
Return the row of given Id if it exists otherwise None. Only works with pseudo - acces
benoitkugler/abstractDataLibrary
pyDLib/Core/groups.py
Collection.append
def append(self, acces, **kwargs): """Append acces to list. Quite slow since it checks uniqueness. kwargs may set `info` for this acces. """ if acces.Id in set(ac.Id for ac in self): raise ValueError("Acces id already in list !") list.append(self, acces) if kw...
python
def append(self, acces, **kwargs): """Append acces to list. Quite slow since it checks uniqueness. kwargs may set `info` for this acces. """ if acces.Id in set(ac.Id for ac in self): raise ValueError("Acces id already in list !") list.append(self, acces) if kw...
[ "def", "append", "(", "self", ",", "acces", ",", "*", "*", "kwargs", ")", ":", "if", "acces", ".", "Id", "in", "set", "(", "ac", ".", "Id", "for", "ac", "in", "self", ")", ":", "raise", "ValueError", "(", "\"Acces id already in list !\"", ")", "list"...
Append acces to list. Quite slow since it checks uniqueness. kwargs may set `info` for this acces.
[ "Append", "acces", "to", "list", ".", "Quite", "slow", "since", "it", "checks", "uniqueness", ".", "kwargs", "may", "set", "info", "for", "this", "acces", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/groups.py#L65-L73
train
Append a new entry to the list.
benoitkugler/abstractDataLibrary
pyDLib/Core/groups.py
Collection.remove_id
def remove_id(self,key): """Suppress acces with id = key""" self.infos.pop(key, "") new_l = [a for a in self if not (a.Id == key)] list.__init__(self, new_l)
python
def remove_id(self,key): """Suppress acces with id = key""" self.infos.pop(key, "") new_l = [a for a in self if not (a.Id == key)] list.__init__(self, new_l)
[ "def", "remove_id", "(", "self", ",", "key", ")", ":", "self", ".", "infos", ".", "pop", "(", "key", ",", "\"\"", ")", "new_l", "=", "[", "a", "for", "a", "in", "self", "if", "not", "(", "a", ".", "Id", "==", "key", ")", "]", "list", ".", "...
Suppress acces with id = key
[ "Suppress", "acces", "with", "id", "=", "key" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/groups.py#L75-L79
train
Suppress acces with id = key
benoitkugler/abstractDataLibrary
pyDLib/Core/groups.py
Collection.get_info
def get_info(self, key=None, Id=None) -> dict: """Returns information associated with Id or list index""" if key is not None: Id = self[key].Id return self.infos.get(Id,{})
python
def get_info(self, key=None, Id=None) -> dict: """Returns information associated with Id or list index""" if key is not None: Id = self[key].Id return self.infos.get(Id,{})
[ "def", "get_info", "(", "self", ",", "key", "=", "None", ",", "Id", "=", "None", ")", "->", "dict", ":", "if", "key", "is", "not", "None", ":", "Id", "=", "self", "[", "key", "]", ".", "Id", "return", "self", ".", "infos", ".", "get", "(", "I...
Returns information associated with Id or list index
[ "Returns", "information", "associated", "with", "Id", "or", "list", "index" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/groups.py#L91-L95
train
Returns information associated with Id or list index