sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def get_version(self, service_id, version_number): """Get the version for a particular service.""" content = self._fetch("/service/%s/version/%d" % (service_id, version_number)) return FastlyVersion(self, content)
Get the version for a particular service.
entailment
def update_version(self, service_id, version_number, **kwargs): """Update a particular version for a particular service.""" body = self._formdata(kwargs, FastlyVersion.FIELDS) content = self._fetch("/service/%s/version/%d/" % (service_id, version_number), method="PUT", body=body) return FastlyVersion(self, cont...
Update a particular version for a particular service.
entailment
def clone_version(self, service_id, version_number): """Clone the current configuration into a new version.""" content = self._fetch("/service/%s/version/%d/clone" % (service_id, version_number), method="PUT") return FastlyVersion(self, content)
Clone the current configuration into a new version.
entailment
def activate_version(self, service_id, version_number): """Activate the current version.""" content = self._fetch("/service/%s/version/%d/activate" % (service_id, version_number), method="PUT") return FastlyVersion(self, content)
Activate the current version.
entailment
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)
Deactivate the current version.
entailment
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)
Validate the version for a particular service and version.
entailment
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)
Locks the specified version.
entailment
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)
Get all of the wordpresses for a specified service and version.
entailment
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...
Create a wordpress for the specified service and version.
entailment
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)
Get information on a specific wordpress.
entailment
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...
Update a specified wordpress.
entailment
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 = '' ...
Annotate 'word' for syllabification, stress, weights, and vowels.
entailment
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...
Run the necessary methods in the correct order
entailment
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...
Creates a report of the results
entailment
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...
Create attributes storing the best results for the O and H types
entailment
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 ...
Syllabify the given word.
entailment
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(...
There is a syllable boundary in front of every CV-sequence.
entailment
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) ...
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].
entailment
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, ...
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].
entailment
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...
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].
entailment
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...
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].
entailment
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): ...
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].
entailment
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 ...
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.
entailment
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()
Run the necessary methods in the correct order
entailment
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....
Extract the names of the user-supplied targets
entailment
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 =...
Create the report for the user-supplied targets
entailment
def on_add(self, item): """Convert to pseuso acces""" super(Tels, self).on_add(list_views.PseudoAccesCategorie(item))
Convert to pseuso acces
entailment
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"))
we cant to call set_data to manually update
entailment
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(...
Run the necessary methods in the correct order
entailment
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...
Return True if ch1 and ch2 are both vowels or both consonants.
entailment
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...
Syllabify the given word.
entailment
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...
There is a syllable boundary in front of every CV-sequence.
entailment
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 ...
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].
entailment
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', ...
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].
entailment
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...
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].
entailment
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]): ...
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].
entailment
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...
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].
entailment
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...
Syllabify the given word, whether simplex or complex.
entailment
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:...
Return the number of unstressed superheavy syllables.
entailment
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
Store the modification. `value` should be dumped in DB compatible format.
entailment
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)
Convenience function which calls modifie on each element of dic
entailment
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...
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.
entailment
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
Set options in modifications. All options will be stored since it should be grouped in the DB.
entailment
def _from_dict_dict(cls, dic): """Takes a dict {id : dict_attributes} """ return cls({_convert_id(i): v for i, v in dic.items()})
Takes a dict {id : dict_attributes}
entailment
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})
Takes a list of dict like objects and uses `champ_id` field as Id
entailment
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 == "*": ...
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
entailment
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)
Return collection of acces whose field equal value
entailment
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...
:param base: Reference on whole base :param criteria: Callable abstractAcces -> Bool, acting as filter :return: Collection on acces passing the criteria
entailment
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) ...
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.
entailment
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 = [{...
Returns a dict of table interpreted from s. s should be Json string encoding a dict { table_name : [fields_name,...] , [rows,... ] }
entailment
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...
Load datas from local file.
entailment
def dumps(self): """Return a dictionnary of current tables""" return {table_name: getattr(self, table_name).dumps() for table_name in self.TABLES}
Return a dictionnary of current tables
entailment
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...
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
entailment
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...
reads the cell at position x and y; puts the default styles in xlwt
entailment
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: ...
writing style and value in the cell of x and y position
entailment
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: ...
This function checks if a path was given as string, and tries to read the file and return the string.
entailment
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 --------------------------------------------...
This function handles and validates the wrapper arguments.
entailment
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...
Check whether the input files are in fasta format, reads format or other/mix formats.
entailment
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...
This function returns list of files in the given dir
entailment
def create_server_rackspace(connection, distribution, disk_name, disk_size, ami, region, key_pair, instance_type, ...
Creates Rackspace Instance and saves it state in a local json file
entailment
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...
terminates the instance
entailment
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...
queries Rackspace for details about a particular server id
entailment
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)...
Add python types decoding. See JsonEncoder
entailment
def _type_string(label, case=None): """Shortcut for string like fields""" return label, abstractSearch.in_string, lambda s: abstractRender.default(s, case=case), ""
Shortcut for string like fields
entailment
def _type_bool(label,default=False): """Shortcut fot boolean like fields""" return label, abstractSearch.nothing, abstractRender.boolen, default
Shortcut fot boolean like fields
entailment
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
abstractSearch dans une chaine, sans tenir compte de la casse.
entailment
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
abstractSearch dans une date datetime.date
entailment
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...
abstractSearch dans une date-heure datetime.datetime (cf abstractRender.dateheure)
entailment
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)
abstractSearch dans une liste de téléphones.
entailment
def date(objet): """ abstractRender d'une date datetime.date""" if objet: return "{}/{}/{}".format(objet.day, objet.month, objet.year) return ""
abstractRender d'une date datetime.date
entailment
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 ""
abstractRender d'une date-heure datetime.datetime au format JJ/MM/AAAAàHH:mm
entailment
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...
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...
entailment
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 ...
Lists the available languages for the given translation domain. :param domain: the domain to get languages for
entailment
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...
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 ...
entailment
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...
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. ...
entailment
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...
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...
entailment
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 - ...
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...
entailment
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 ...
Return a dict that only has matching entries in the msgid.
entailment
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, '...
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`
entailment
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, ...
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`
entailment
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...
If put_back is True, put in umlauts; else, take them out!
entailment
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_...
Function for extracting extra seqeunce data to the query alignment if the full reference length are not covered
entailment
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 ...
Returns a tuple of lookups to order by for the given column and direction. Direction is an integer, either -1, 0 or 1.
entailment
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) ...
Take a model instance and return it as a json struct
entailment
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...
Take a json strust and a model name, and return a model instance
entailment
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]...
Validate an object against its swagger model
entailment
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...
Find all server endpoints defined in the swagger spec and calls 'callback' for each, with an instance of EndpointData as argument.
entailment
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') ...
Buffer stdin and flush, and avoid incomplete files.
entailment
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 ...
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...
entailment
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...
Create a Constant Contact email marketing campaign. Returns an EmailMarketingCampaign object.
entailment
def update_email_marketing_campaign(self, email_marketing_campaign, name, email_content, from_email, from_name, reply_to_email, subject, text_content, address, ...
Update a Constant Contact email marketing campaign. Returns the updated EmailMarketingCampaign object.
entailment
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...
Deletes a Constant Contact email marketing campaign.
entailment
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
Inlines CSS defined in external style sheets.
entailment
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...
Returns HTML and text previews of an EmailMarketingCampaign.
entailment
def pre_save(cls, sender, instance, *args, **kwargs): """Pull constant_contact_id out of data. """ instance.constant_contact_id = str(instance.data['id'])
Pull constant_contact_id out of data.
entailment
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()
Deletes the CC email marketing campaign associated with me.
entailment
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...
Run the necessary methods in the correct order
entailment
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 ...
Will send a multi-format email to recipients. Email may be queued through celery
entailment
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 ...
Initialize a database connection by each connection string defined in the configuration file
entailment
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...
Implément un tri par attrbut. :param str attribut: Nom du champ concerné :param bool order: Ordre croissant ou décroissant
entailment