_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q39200 | SQLAlchemyProxy.deptree | train | def deptree(self, field, oids, date=None, level=None, table=None):
'''
Dependency tree builder. Recursively fetchs objects that
are children of the initial set of parent object ids provided.
:param field: Field that contains the 'parent of' data
:param oids: Object oids to build... | python | {
"resource": ""
} |
q39201 | SQLAlchemyProxy.get_last_field | train | def get_last_field(self, field, table=None):
'''Shortcut for querying to get the last field value for
a given owner, cube.
:param field: field name to query
'''
field = field if is_array(field) else [field]
table = self.get_table(table, except_=False)
if table is... | python | {
"resource": ""
} |
q39202 | SQLAlchemyProxy.index_list | train | def index_list(self):
'''
List all cube indexes
:param collection: cube name
:param owner: username of cube owner
'''
logger.info('Listing indexes')
_ix = {}
_i = self.inspector
for tbl in _i.get_table_names():
_ix.setdefault(tbl, [])
... | python | {
"resource": ""
} |
q39203 | SQLAlchemyProxy.ls | train | def ls(self, startswith=None):
'''
List all cubes available to the calling client.
:param startswith: string to use in a simple "startswith" query filter
:returns list: sorted list of cube names
'''
logger.info('Listing cubes starting with "%s")' % startswith)
st... | python | {
"resource": ""
} |
q39204 | muscle_seqs | train | def muscle_seqs(seqs,
add_seq_names=False,
out_filename=None,
input_handler=None,
params={},
WorkingDir=tempfile.gettempdir(),
SuppressStderr=None,
SuppressStdout=None):
"""Muscle align list of seq... | python | {
"resource": ""
} |
q39205 | cluster_seqs | train | def cluster_seqs(seqs,
neighbor_join=False,
params={},
add_seq_names=True,
WorkingDir=tempfile.gettempdir(),
SuppressStderr=None,
SuppressStdout=None,
max_chars=1000000,
max_hours=1.0,... | python | {
"resource": ""
} |
q39206 | aln_tree_seqs | train | def aln_tree_seqs(seqs,
input_handler=None,
tree_type='neighborjoining',
params={},
add_seq_names=True,
WorkingDir=tempfile.gettempdir(),
SuppressStderr=None,
SuppressStdout=None,
max_... | python | {
"resource": ""
} |
q39207 | align_and_build_tree | train | def align_and_build_tree(seqs, moltype, best_tree=False, params=None):
"""Returns an alignment and a tree from Sequences object seqs.
seqs: a cogent.core.alignment.SequenceCollection object, or data that can
be used to build one.
moltype: cogent.core.moltype.MolType object
best_tree: if True (def... | python | {
"resource": ""
} |
q39208 | Muscle._input_as_multifile | train | def _input_as_multifile(self, data):
"""For use with the -profile option
This input handler expects data to be a tuple containing two
filenames. Index 0 will be set to -in1 and index 1 to -in2
"""
if data:
try:
filename1, filename2 = data
... | python | {
"resource": ""
} |
q39209 | static_url | train | def static_url(redis, path):
"""Gets the static path for a file"""
file_hash = get_cache_buster(redis, path)
return "%s/%s?v=%s" % (oz.settings["static_host"], path, file_hash) | python | {
"resource": ""
} |
q39210 | get_cache_buster | train | def get_cache_buster(redis, path):
"""Gets the cache buster value for a given file path"""
return escape.to_unicode(redis.hget("cache-buster:{}:v3".format(oz.settings["s3_bucket"]), path)) | python | {
"resource": ""
} |
q39211 | get_bucket | train | def get_bucket(s3_bucket=None, validate=False):
"""Gets a bucket from specified settings"""
global S3Connection
if S3Connection != None:
settings = oz.settings
s3_bucket = s3_bucket or settings["s3_bucket"]
opts = {}
if settings["s3_host"]:
opts["host"] = setting... | python | {
"resource": ""
} |
q39212 | get_file | train | def get_file(path, s3_bucket=None):
"""Gets a file"""
bucket_name = s3_bucket or oz.settings["s3_bucket"]
if bucket_name:
bucket = get_bucket(bucket_name)
key = bucket.get_key(path)
if not key:
key = bucket.new_key(path)
return S3File(key)
else:
retu... | python | {
"resource": ""
} |
q39213 | LocalFile.copy | train | def copy(self, new_path, replace=False):
""" Uses shutil to copy a file over """
new_full_path = os.path.join(self.static_path, new_path)
if replace or not os.path.exists(new_full_path):
shutil.copy2(self.full_path, new_full_path)
return True
return False | python | {
"resource": ""
} |
q39214 | S3File.copy | train | def copy(self, new_path, replace=False):
"""Uses boto to copy the file to the new path instead of uploading another file to the new key"""
if replace or not get_file(new_path).exists():
self.key.copy(self.key.bucket, new_path)
return True
return False | python | {
"resource": ""
} |
q39215 | create_connection | train | def create_connection():
"""Sets up a redis configuration"""
global _cached_connection
settings = oz.settings
if settings["redis_cache_connections"] and _cached_connection != None:
return _cached_connection
else:
conn = redis.StrictRedis(
host=settings["redis_host"],
... | python | {
"resource": ""
} |
q39216 | usearch_sort_by_abundance | train | def usearch_sort_by_abundance(
fasta_filepath,
output_filepath=None,
sizein=True,
sizeout=True,
minsize=0,
log_name="abundance_sort.log",
usersort=False,
HALT_EXEC=False,
save_intermediate_files=False,
remove_usearch_logs=False,
wor... | python | {
"resource": ""
} |
q39217 | usearch_cluster_error_correction | train | def usearch_cluster_error_correction(
fasta_filepath,
output_filepath=None,
output_uc_filepath=None,
percent_id_err=0.97,
sizein=True,
sizeout=True,
w=64,
slots=16769023,
maxrejects=64,
log_name="usearch_cluster_err_corrected.log",
... | python | {
"resource": ""
} |
q39218 | usearch_chimera_filter_de_novo | train | def usearch_chimera_filter_de_novo(
fasta_filepath,
output_chimera_filepath=None,
output_non_chimera_filepath=None,
abundance_skew=2.0,
log_name="uchime_de_novo_chimera_filtering.log",
usersort=False,
HALT_EXEC=False,
save_intermediate_files=False,
... | python | {
"resource": ""
} |
q39219 | usearch_cluster_seqs_ref | train | def usearch_cluster_seqs_ref(
fasta_filepath,
output_filepath=None,
percent_id=0.97,
sizein=True,
sizeout=True,
w=64,
slots=16769023,
maxrejects=64,
log_name="usearch_cluster_seqs.log",
usersort=True,
HALT_EXEC=False,
save_i... | python | {
"resource": ""
} |
q39220 | concatenate_fastas | train | def concatenate_fastas(output_fna_clustered,
output_fna_failures,
output_concat_filepath):
""" Concatenates two input fastas, writes to output_concat_filepath
output_fna_clustered: fasta of successful ref clusters
output_fna_failures: de novo fasta of cluster f... | python | {
"resource": ""
} |
q39221 | enumerate_otus | train | def enumerate_otus(fasta_filepath,
output_filepath=None,
label_prefix="",
label_suffix="",
retain_label_as_comment=False,
count_start=0):
""" Writes unique, sequential count to OTUs
fasta_filepath = input fasta filep... | python | {
"resource": ""
} |
q39222 | get_fasta_from_uc_file | train | def get_fasta_from_uc_file(fasta_filepath,
uc_filepath,
hit_type="H",
output_fna_filepath=None,
label_prefix="",
output_dir=None):
""" writes fasta of sequences from uc file of type... | python | {
"resource": ""
} |
q39223 | get_retained_chimeras | train | def get_retained_chimeras(output_fp_de_novo_nonchimeras,
output_fp_ref_nonchimeras,
output_combined_fp,
chimeras_retention='union'):
""" Gets union or intersection of two supplied fasta files
output_fp_de_novo_nonchimeras: filepath o... | python | {
"resource": ""
} |
q39224 | assign_reads_to_otus | train | def assign_reads_to_otus(original_fasta,
filtered_fasta,
output_filepath=None,
log_name="assign_reads_to_otus.log",
perc_id_blast=0.97,
global_alignment=True,
HALT_EXEC=F... | python | {
"resource": ""
} |
q39225 | sort_by_abundance_usearch61 | train | def sort_by_abundance_usearch61(seq_path,
output_dir='.',
rev=False,
minlen=64,
remove_usearch_logs=False,
HALT_EXEC=False,
outp... | python | {
"resource": ""
} |
q39226 | sort_by_length_usearch61 | train | def sort_by_length_usearch61(seq_path,
output_dir=".",
minlen=64,
remove_usearch_logs=False,
HALT_EXEC=False,
output_fna_filepath=None,
log_name="... | python | {
"resource": ""
} |
q39227 | usearch61_cluster_ref | train | def usearch61_cluster_ref(intermediate_fasta,
refseqs_fp,
percent_id=0.97,
rev=False,
minlen=64,
output_dir=".",
remove_usearch_logs=False,
... | python | {
"resource": ""
} |
q39228 | usearch61_fast_cluster | train | def usearch61_fast_cluster(intermediate_fasta,
percent_id=0.97,
minlen=64,
output_dir=".",
remove_usearch_logs=False,
wordlength=8,
usearch61_maxrejects=8,
... | python | {
"resource": ""
} |
q39229 | usearch61_smallmem_cluster | train | def usearch61_smallmem_cluster(intermediate_fasta,
percent_id=0.97,
minlen=64,
rev=False,
output_dir=".",
remove_usearch_logs=False,
w... | python | {
"resource": ""
} |
q39230 | usearch61_chimera_check_denovo | train | def usearch61_chimera_check_denovo(abundance_fp,
uchime_denovo_fp,
minlen=64,
output_dir=".",
remove_usearch_logs=False,
uchime_denovo_log_fp="uc... | python | {
"resource": ""
} |
q39231 | usearch61_chimera_check_ref | train | def usearch61_chimera_check_ref(abundance_fp,
uchime_ref_fp,
reference_seqs_fp,
minlen=64,
output_dir=".",
remove_usearch_logs=False,
... | python | {
"resource": ""
} |
q39232 | merge_failures_dereplicated_seqs | train | def merge_failures_dereplicated_seqs(failures,
dereplicated_clusters):
""" Appends failures from dereplicated seqs to failures list
failures: list of failures
dereplicated_clusters: dict of seq IDs: dereplicated seq IDs
"""
curr_failures = set(failures)
de... | python | {
"resource": ""
} |
q39233 | parse_usearch61_failures | train | def parse_usearch61_failures(seq_path,
failures,
output_fasta_fp):
""" Parses seq IDs from failures list, writes to output_fasta_fp
seq_path: filepath of original input fasta file.
failures: list/set of failure seq IDs
output_fasta_fp: path to w... | python | {
"resource": ""
} |
q39234 | ErrorPageMiddleware._on_error_page_write_error | train | def _on_error_page_write_error(self, status_code, **kwargs):
"""Replaces the default Tornado error page with a Django-styled one"""
if oz.settings.get('debug'):
exception_type, exception_value, tback = sys.exc_info()
is_breakpoint = isinstance(exception_value, oz.error_pages.Deb... | python | {
"resource": ""
} |
q39235 | BlinkMiddleware.get_blink_cookie | train | def get_blink_cookie(self, name):
"""Gets a blink cookie value"""
value = self.get_cookie(name)
if value != None:
self.clear_cookie(name)
return escape.url_unescape(value) | python | {
"resource": ""
} |
q39236 | BlinkMiddleware.set_blink | train | def set_blink(self, message, type="info"):
"""
Sets the blink, a one-time transactional message that is shown on the
next page load
"""
self.set_cookie("blink_message", escape.url_escape(message), httponly=True)
self.set_cookie("blink_type", escape.url_escape(type), httpo... | python | {
"resource": ""
} |
q39237 | cdhit_clusters_from_seqs | train | def cdhit_clusters_from_seqs(seqs, moltype=DNA, params=None):
"""Returns the CD-HIT clusters given seqs
seqs : dict like collection of sequences
moltype : cogent.core.moltype object
params : cd-hit parameters
NOTE: This method will call CD_HIT if moltype is PROTIEN,
CD_HIT_... | python | {
"resource": ""
} |
q39238 | cdhit_from_seqs | train | def cdhit_from_seqs(seqs, moltype, params=None):
"""Returns the CD-HIT results given seqs
seqs : dict like collection of sequences
moltype : cogent.core.moltype object
params : cd-hit parameters
NOTE: This method will call CD_HIT if moltype is PROTIEN,
CD_HIT_EST if moltype is RNA/DNA,... | python | {
"resource": ""
} |
q39239 | parse_cdhit_clstr_file | train | def parse_cdhit_clstr_file(lines):
"""Returns a list of list of sequence ids representing clusters"""
clusters = []
curr_cluster = []
for l in lines:
if l.startswith('>Cluster'):
if not curr_cluster:
continue
clusters.append(curr_cluster)
curr... | python | {
"resource": ""
} |
q39240 | CD_HIT._get_clstr_outfile | train | def _get_clstr_outfile(self):
"""Returns the absolute path to the clstr outfile"""
if self.Parameters['-o'].isOn():
return ''.join([self.Parameters['-o'].Value, '.clstr'])
else:
raise ValueError, "No output file specified" | python | {
"resource": ""
} |
q39241 | ParagraphsSentencesAndWhitespace.segment | train | def segment(self, tokens):
"""
Segments a sequence of tokens into a sequence of segments.
:Parameters:
tokens : `list` ( :class:`~deltas.Token` )
"""
look_ahead = LookAhead(tokens)
segments = Segment()
while not look_ahead.empty():
if l... | python | {
"resource": ""
} |
q39242 | PushBaby.get_all_feedback | train | def get_all_feedback(self):
"""
Connects to the feedback service and returns any feedback that is sent
as a list of FeedbackItem objects.
Blocks the current greenlet until all feedback is returned.
If a network error occurs before any feedback is received, it is
propaga... | python | {
"resource": ""
} |
q39243 | Client._handle_api_error | train | def _handle_api_error(self, error):
"""
New Relic cheerfully provides expected API error codes depending on your
API call deficiencies so we convert these to exceptions and raise them
for the user to handle as they see fit.
"""
status_code = error.response.status_code
... | python | {
"resource": ""
} |
q39244 | Client._api_rate_limit_exceeded | train | def _api_rate_limit_exceeded(self, api_call, window=60):
"""
We want to keep track of the last time we sent a request to the NewRelic
API, but only for certain operations. This method will dynamically add
an attribute to the Client class with a unix timestamp with the name of
the... | python | {
"resource": ""
} |
q39245 | join_paired_end_reads_fastqjoin | train | def join_paired_end_reads_fastqjoin(
reads1_infile_path,
reads2_infile_path,
perc_max_diff=None, # typical default is 8
min_overlap=None, # typical default is 6
outfile_label='fastqjoin',
params={},
working_dir=tempfile.gettempdir(),
SuppressStderr=True,... | python | {
"resource": ""
} |
q39246 | FastqJoin._get_result_paths | train | def _get_result_paths(self, data):
"""Capture fastq-join output.
Three output files are produced, in the form of
outputjoin : assembled paired reads
outputun1 : unassembled reads_1
outputun2 : unassembled reads_2
If a barcode / mate-pairs file is also provid... | python | {
"resource": ""
} |
q39247 | date_range | train | def date_range(date, func='date'):
'''
Return back start and end dates given date string
:param date: metrique date (range) to apply to pql query
The tilde '~' symbol is used as a date range separated.
A tilde by itself will mean 'all dates ranges possible'
and will therefore search all objec... | python | {
"resource": ""
} |
q39248 | WorkerManager.enqueue_convert | train | def enqueue_convert(self, converter, from_resource, to_resource):
'''
Enqueue use of the given converter to convert to given
resources.
Deprecated: Use async version instead
'''
worker = self.pick_sticky(from_resource.url_string)
args = (converter, from_resource,... | python | {
"resource": ""
} |
q39249 | WorkerManager.async_enqueue_convert | train | async def async_enqueue_convert(self, converter, from_, to):
'''
Enqueue use of the given converter to convert to given
from and to resources.
'''
worker = self.pick_sticky(from_.url_string)
args = (converter, from_, to)
await worker.enqueue(enums.Task.CONVERT, ar... | python | {
"resource": ""
} |
q39250 | IIIVZincBlendeStrained001.strain_in_plane | train | def strain_in_plane(self, **kwargs):
'''
Returns the in-plane strain assuming no lattice relaxation, which
is positive for tensile strain and negative for compressive strain.
'''
if self._strain_out_of_plane is not None:
return ((self._strain_out_of_plane / -2.) *
... | python | {
"resource": ""
} |
q39251 | IIIVZincBlendeStrained001.substrate_a | train | def substrate_a(self, **kwargs):
'''
Returns the substrate's lattice parameter.
'''
if self.substrate is not None:
return self.substrate.a(**kwargs)
else:
return (self.unstrained.a(**kwargs) /
(1. - self.strain_in_plane(**kwargs))) | python | {
"resource": ""
} |
q39252 | IIIVZincBlendeStrained001.Eg | train | def Eg(self, **kwargs):
'''
Returns the strain-shifted bandgap, ``Eg``.
'''
return self.unstrained.Eg(**kwargs) + self.Eg_strain_shift(**kwargs) | python | {
"resource": ""
} |
q39253 | ApiMiddleware._api_on_write_error | train | def _api_on_write_error(self, status_code, **kwargs):
"""
Catches errors and renders it as a JSON message. Adds the traceback if
debug is enabled.
"""
return_error = { "code": self.get_status() }
exc_info = kwargs.get("exc_info")
if exc_info and isinstance(exc_i... | python | {
"resource": ""
} |
q39254 | ApiMiddleware.body | train | def body(self):
"""Gets the JSON body of the request"""
if self._decoded_body == None:
# Try to decode the JSON body. But raise an error if the
# content-type is unexpected, or the JSON is invalid.
raw_content_type = self.request.headers.get("content-type") or ""
... | python | {
"resource": ""
} |
q39255 | Parameter._get_id | train | def _get_id(self):
"""Construct and return the identifier"""
return ''.join(map(str,
filter(is_not_None,
[self.Prefix, self.Name]))) | python | {
"resource": ""
} |
q39256 | MixedParameter.on | train | def on(self, val=None):
"""Turns the MixedParameter ON by setting its Value to val
An attempt to turn the parameter on with value 'False' will result
in an error, since this is the same as turning the parameter off.
Turning the MixedParameter ON without a value or with value 'None'... | python | {
"resource": ""
} |
q39257 | ViewerManager.get_assets | train | def get_assets(self):
'''
Return a flat list of absolute paths to all assets required by this
viewer
'''
return sum([
[self.prefix_asset(viewer, relpath) for relpath in viewer.assets]
for viewer in self.viewers
], []) | python | {
"resource": ""
} |
q39258 | ViewerManager.get_resource | train | def get_resource(self):
'''
Returns a BytesResource to build the viewers JavaScript
'''
# Basename could be used for controlling caching
# basename = 'viewers_%s' % settings.get_cache_string()
node_packages = self.get_node_packages()
# sort_keys is essential to en... | python | {
"resource": ""
} |
q39259 | callback | train | def callback(request):
"""Callback URL for Nexmo."""
message_id = request.GET.get('messageId')
status_id = request.GET.get('status')
status_msg = NEXMO_STATUSES.get(status_id, UNKNOWN_STATUS)
error_id = int(request.GET.get('err-code'))
error_msg = NEXMO_MESSAGES.get(error_id, UNKNOWN_MESSAGE)
... | python | {
"resource": ""
} |
q39260 | setup | train | def setup(provider=None):
"""
Creates the provider config files needed to deploy your project
"""
site = init(provider)
if not site:
site = yaml.safe_load(_read_file(DEPLOY_YAML))
provider_class = PROVIDERS[site['provider']]
provider_class.init(site) | python | {
"resource": ""
} |
q39261 | deploy | train | def deploy(provider=None):
"""
Deploys your project
"""
if os.path.exists(DEPLOY_YAML):
site = yaml.safe_load(_read_file(DEPLOY_YAML))
provider_class = PROVIDERS[site['provider']]
provider_class.deploy() | python | {
"resource": ""
} |
q39262 | ida_connect | train | def ida_connect(host='localhost', port=18861, retry=10):
"""
Connect to an instance of IDA running our server.py.
:param host: The host to connect to
:param port: The port to connect to
:param retry: How many times to try after errors before giving up
"""
for i in range(... | python | {
"resource": ""
} |
q39263 | ida_spawn | train | def ida_spawn(ida_binary, filename, port=18861, mode='oneshot',
processor_type=None, logfile=None):
"""
Open IDA on the the file we want to analyse.
:param ida_binary: The binary name or path to ida
:param filename: The filename to open in IDA
:param port: The port on which... | python | {
"resource": ""
} |
q39264 | _clear_cache | train | def _clear_cache(url, ts=None):
'''
Helper function used by precache and clearcache that clears the cache
of a given URL and type
'''
if ts is None:
# Clears an entire ForeignResource cache
res = ForeignResource(url)
if not os.path.exists(res.cache_path_base):
cli... | python | {
"resource": ""
} |
q39265 | _precache | train | async def _precache(url, to_type, force=False):
'''
Helper function used by precache and precache-named which does the
actual precaching
'''
if force:
cli.print('%s: force clearing' % url)
_clear_cache(url)
cli.print('%s: precaching "%s"' % (url, to_type))
with autodrain_work... | python | {
"resource": ""
} |
q39266 | ActiveVWProcess.expect_exact | train | def expect_exact(self, *args, **kwargs):
"""This does not attempt to duplicate the expect_exact API,
but just sets self.before to the latest response line."""
response = self._recvline()
self.before = response.strip() | python | {
"resource": ""
} |
q39267 | create_bwa_index_from_fasta_file | train | def create_bwa_index_from_fasta_file(fasta_in, params=None):
"""Create a BWA index from an input fasta file.
fasta_in: the input fasta file from which to create the index
params: dict of bwa index specific paramters
This method returns a dictionary where the keys are the various
output suffixes (.... | python | {
"resource": ""
} |
q39268 | assign_dna_reads_to_dna_database | train | def assign_dna_reads_to_dna_database(query_fasta_fp, database_fasta_fp, out_fp,
params={}):
"""Wraps assign_reads_to_database, setting various parameters.
The default settings are below, but may be overwritten and/or added to
using the params dict:
algorithm: ... | python | {
"resource": ""
} |
q39269 | BWA.check_arguments | train | def check_arguments(self):
"""Sanity check the arguments passed in.
Uses the boolean functions specified in the subclasses in the
_valid_arguments dictionary to determine if an argument is valid
or invalid.
"""
for k, v in self.Parameters.iteritems():
if self... | python | {
"resource": ""
} |
q39270 | BWA._input_as_dict | train | def _input_as_dict(self, data):
"""Takes dictionary that sets input and output files.
Valid keys for the dictionary are specified in the subclasses. File
paths must be absolute.
"""
# clear self._input; ready to receive new input and output files
self._input = {}
... | python | {
"resource": ""
} |
q39271 | BWA_index._get_result_paths | train | def _get_result_paths(self, data):
"""Gets the results for a run of bwa index.
bwa index outputs 5 files when the index is created. The filename
prefix will be the same as the input fasta, unless overridden with
the -p option, and the 5 extensions are listed below:
.amb
... | python | {
"resource": ""
} |
q39272 | DirectedGraph.get_all_paths_from | train | def get_all_paths_from(self, start, seen=None):
'''
Return a list of all paths to all nodes from a given start node
'''
if seen is None:
seen = frozenset()
results = [(0, (start, ))]
if start in seen or start not in self.edges:
return results
... | python | {
"resource": ""
} |
q39273 | cmbuild_from_file | train | def cmbuild_from_file(stockholm_file_path, refine=False,return_alignment=False,\
params=None):
"""Uses cmbuild to build a CM file given a stockholm file.
- stockholm_file_path: a path to a stockholm file. This file should
contain a multiple sequence alignment formated in Stockholm format.
... | python | {
"resource": ""
} |
q39274 | cmalign_from_alignment | train | def cmalign_from_alignment(aln, structure_string, seqs, moltype=DNA,\
include_aln=True,refine=False, return_stdout=False,params=None,\
cmbuild_params=None):
"""Uses cmbuild to build a CM file, then cmalign to build an alignment.
- aln: an Alignment object or something that can be used to construct
... | python | {
"resource": ""
} |
q39275 | cmalign_from_file | train | def cmalign_from_file(cm_file_path, seqs, moltype=DNA, alignment_file_path=None,\
include_aln=False,return_stdout=False,params=None):
"""Uses cmalign to align seqs to alignment in cm_file_path.
- cm_file_path: path to the file created by cmbuild, containing aligned
sequences. This will be u... | python | {
"resource": ""
} |
q39276 | DetectorManager.detect | train | def detect(self, path):
'''
Guesses a TypeString from the given path
'''
typestring = UNKNOWN
for detector in self.detectors:
if typestring != UNKNOWN and not detector.can_improve(typestring):
continue
if not detector.can_detect(path):
... | python | {
"resource": ""
} |
q39277 | CDNMiddleware.upload_file | train | def upload_file(self, path, contents, replace=False):
"""
Uplodas the file to its path with the given `content`, adding the
appropriate parent directories when needed. If the path already exists
and `replace` is `False`, the file will not be uploaded.
"""
f = self.get_fil... | python | {
"resource": ""
} |
q39278 | CDNMiddleware.copy_file | train | def copy_file(self, from_path, to_path, replace=False):
"""
Copies a file from a given source path to a destination path, adding
appropriate parent directories when needed. If the destination path
already exists and `replace` is `False`, the file will not be
uploaded.
"""... | python | {
"resource": ""
} |
q39279 | CDNMiddleware.remove_file | train | def remove_file(self, path):
"""Removes the given file"""
self.get_file(path).remove()
self.remove_cache_buster(path) | python | {
"resource": ""
} |
q39280 | alignTwoAlignments | train | def alignTwoAlignments(aln1,aln2,outfile,WorkingDir=None,SuppressStderr=None,\
SuppressStdout=None):
"""Aligns two alignments. Individual sequences are not realigned
aln1: string, name of file containing the first alignment
aln2: string, name of file containing the second alignment
outfile: you're ... | python | {
"resource": ""
} |
q39281 | addSeqsToAlignment | train | def addSeqsToAlignment(aln1,seqs,outfile,WorkingDir=None,SuppressStderr=None,\
SuppressStdout=None):
"""Aligns sequences from second profile against first profile
aln1: string, name of file containing the alignment
seqs: string, name of file containing the sequences that should be added
to ... | python | {
"resource": ""
} |
q39282 | buildTreeFromAlignment | train | def buildTreeFromAlignment(filename,WorkingDir=None,SuppressStderr=None):
"""Builds a new tree from an existing alignment
filename: string, name of file containing the seqs or alignment
"""
app = Clustalw({'-tree':None,'-infile':filename},SuppressStderr=\
SuppressStderr,WorkingDir=WorkingDir)
... | python | {
"resource": ""
} |
q39283 | bootstrap_tree_from_alignment | train | def bootstrap_tree_from_alignment(aln, seed=None, num_trees=None, params=None):
"""Returns a tree from Alignment object aln with bootstrap support values.
aln: an cogent.core.alignment.Alignment object, or data that can be used
to build one.
seed: an interger, seed value to use
num_trees: an inte... | python | {
"resource": ""
} |
q39284 | Clustalw._suffix | train | def _suffix(self):
"""Return appropriate suffix for alignment file"""
_output_formats={'GCG':'.msf',
'GDE':'.gde',
'PHYLIP':'.phy',
'PIR':'.pir',
'NEXUS':'.nxs'}
if self.Parameters['-output'].isOn():... | python | {
"resource": ""
} |
q39285 | directory_walk | train | def directory_walk(source_d, destination_d):
'''
Walk a directory structure and yield full parallel source and destination
files, munging filenames as necessary
'''
for dirpath, dirnames, filenames in os.walk(source_d):
relpath = os.path.relpath(dirpath, source_d)
if relpath == '.':
... | python | {
"resource": ""
} |
q39286 | recursive_hardlink_dirs | train | def recursive_hardlink_dirs(source_d, destination_d):
'''
Same as above, except creating hardlinks for all files
'''
func = os.link
if os.name == 'nt':
func = shutil.copy
if os.path.exists(destination_d):
os.rmdir(destination_d)
shutil.copytree(source_d, destination_d, copy_f... | python | {
"resource": ""
} |
q39287 | SettingsManager.load_all | train | def load_all(self, key, default=None):
'''
Import settings key as a dict or list with values of importable paths
If a default constructor is specified, and a path is not importable, it
falls back to running the given constructor.
'''
value = getattr(self, key)
if ... | python | {
"resource": ""
} |
q39288 | SettingsManager.load_path | train | def load_path(self, path):
'''
Load and return a given import path to a module or class
'''
containing_module, _, last_item = path.rpartition('.')
if last_item[0].isupper():
# Is a class definition, should do an "import from"
path = containing_module
... | python | {
"resource": ""
} |
q39289 | SettingsManager.set | train | def set(self, **kwargs):
'''
Override existing settings, taking precedence over both user settings
object and default settings. Useful for specific runtime requirements,
such as overriding PORT or HOST.
'''
for lower_key, value in kwargs.items():
if lower_key.... | python | {
"resource": ""
} |
q39290 | SettingsManager.use_settings | train | def use_settings(self, settings_module):
'''
Useful for tests for overriding current settings manually
'''
self._previous_settings = self.settings_module
self.settings_module = settings_module
self.reconfigure() | python | {
"resource": ""
} |
q39291 | SettingsManager.use_settings_dict | train | def use_settings_dict(self, settings_dict):
'''
Slightly cleaner interface to override settings that autogenerates a
settings module based on a given dict.
'''
class SettingsDictModule:
__slots__ = tuple(key.upper() for key in settings_dict.keys())
settings_ob... | python | {
"resource": ""
} |
q39292 | process_sequence | train | def process_sequence(sequence,
rules=None,
skip_non_vietnamese=True):
"""\
Convert a key sequence into a Vietnamese string with diacritical marks.
Args:
rules (optional): see docstring for process_key().
skip_non_vietnamese (optional): see docstring... | python | {
"resource": ""
} |
q39293 | _get_action | train | def _get_action(trans):
"""
Return the action inferred from the transformation `trans`.
and the parameter going with this action
An _Action.ADD_MARK goes with a Mark
while an _Action.ADD_ACCENT goes with an Accent
"""
# TODO: VIQR-like convention
mark_action = {
'^': (_Action.ADD... | python | {
"resource": ""
} |
q39294 | _reverse | train | def _reverse(components, trans):
"""
Reverse the effect of transformation 'trans' on 'components'
If the transformation does not affect the components, return the original
string.
"""
action, parameter = _get_action(trans)
comps = list(components)
string = utils.join(comps)
if acti... | python | {
"resource": ""
} |
q39295 | _can_undo | train | def _can_undo(comps, trans_list):
"""
Return whether a components can be undone with one of the transformation in
trans_list.
"""
comps = list(comps)
accent_list = list(map(accent.get_accent_char, comps[1]))
mark_list = list(map(mark.get_mark_char, utils.join(comps)))
action_list = list(... | python | {
"resource": ""
} |
q39296 | add_mark_char | train | def add_mark_char(char, mark):
"""
Add mark to a single char.
"""
if char == "":
return ""
case = char.isupper()
ac = accent.get_accent_char(char)
char = accent.add_accent_char(char.lower(), Accent.NONE)
new_char = char
if mark == Mark.HAT:
if char in FAMILY_A:
... | python | {
"resource": ""
} |
q39297 | Session.delete | train | def delete(self, path):
"""Call the Infoblox device to delete the ref
:param str ref: The reference id
:rtype: requests.Response
"""
return self.session.delete(self._request_url(path),
auth=self.auth, verify=False) | python | {
"resource": ""
} |
q39298 | Session.get | train | def get(self, path, data=None, return_fields=None):
"""Call the Infoblox device to get the obj for the data passed in
:param str obj_reference: The object reference data
:param dict data: The data for the get request
:rtype: requests.Response
"""
return self.session.get... | python | {
"resource": ""
} |
q39299 | Session.post | train | def post(self, path, data):
"""Call the Infoblox device to post the obj for the data passed in
:param str obj: The object type
:param dict data: The data for the post
:rtype: requests.Response
"""
LOGGER.debug('Posting data: %r', data)
return self.session.post(s... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.