text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def fill_symbolic(self):
"""
Fill the class with constrained symbolic values.
"""
self.wYear = self.state.solver.BVS('cur_year', 16, key=('api', 'GetLocalTime', 'cur_year'))
self.wMonth = self.state.solver.BVS('cur_month', 16, key=('api', 'GetLocalTime', 'cur_month'))
sel... | 0.006418 |
def _handle_request(self, request: dict) -> dict:
"""Processes Alexa requests from skill server and returns responses to Alexa.
Args:
request: Dict with Alexa request payload and metadata.
Returns:
result: Alexa formatted or error response.
"""
request_bo... | 0.00383 |
def pymmh3_hash128(key: Union[bytes, bytearray],
seed: int = 0,
x64arch: bool = True) -> int:
"""
Implements 128bit murmur3 hash, as per ``pymmh3``.
Args:
key: data to hash
seed: seed
x64arch: is a 64-bit architecture available?
Returns:
... | 0.00216 |
def find_playlist_by_id(self, playlist_id):
"""doc: http://open.youku.com/docs/doc?id=66
"""
url = 'https://openapi.youku.com/v2/playlists/show.json'
params = {
'client_id': self.client_id,
'playlist_id': playlist_id
}
r = requests.get(url, params=... | 0.005348 |
def create(self, name, volume, description=None, force=False):
"""
Adds exception handling to the default create() call.
"""
try:
snap = super(CloudBlockStorageSnapshotManager, self).create(
name=name, volume=volume, description=description,
... | 0.005054 |
def instance_path_for(name, identifier_type, identifier_key=None):
"""
Get a path for thing.
"""
return "/{}/<{}:{}>".format(
name_for(name),
identifier_type,
identifier_key or "{}_id".format(name_for(name)),
) | 0.003922 |
def transform(self, x, warn=True):
"""Obtain the transformed values
"""
# 1. split across last dimension
# 2. re-use ranges
# 3. Merge
array_list = [encodeSplines(x[..., i].reshape((-1, 1)),
n_bases=self.n_bases,
... | 0.004518 |
def surf_vol(length, girth):
'''Calculate the surface volume of an animal from its length and girth
Args
----
length: float or ndarray
Length of animal (m)
girth: float or ndarray
Girth of animal (m)
Returns
-------
surf:
Surface area of animal (m^2)
vol: fl... | 0.010101 |
def get_char_type(ch):
"""
0, 汉字
1, 英文字母
2. 数字
3. 其他
"""
if re.match(en_p, ch):
return 1
elif re.match("\d+", ch):
return 2
elif re.match(re_han, ch):
return 3
else:
return 4 | 0.00813 |
def batch_id(self, batch_id):
"""The ID of the batch job used to push data and/or retrieve status.
Args:
batch_id (integer): The id of the batch job.
"""
self._request_uri = '{}/{}'.format(self._api_uri, batch_id)
self._request_entity = 'batchStatus' | 0.006601 |
def _is_requirement(line):
"""Returns whether the line is a valid package requirement."""
line = line.strip()
return line and not (line.startswith("-r") or line.startswith("#")) | 0.005291 |
def update_record(self, record, data=None, priority=None,
ttl=None, comment=None):
"""
Modifies an existing record for this domain.
"""
return self.manager.update_record(self, record, data=data,
priority=priority, ttl=ttl, comment=comment) | 0.013559 |
def combination_step(self):
"""Update auxiliary state by a smart combination of previous
updates in the frequency domain (standard FISTA
:cite:`beck-2009-fast`).
"""
# Update t step
tprv = self.t
self.t = 0.5 * float(1. + np.sqrt(1. + 4. * tprv**2))
# Up... | 0.004167 |
def get_pdb_contents_to_pose_residue_map(pdb_file_contents, rosetta_scripts_path, rosetta_database_path = None, pdb_id = None, extra_flags = ''):
'''Takes a string containing a PDB file, the RosettaScripts executable, and the Rosetta database and then uses the features database to map PDB residue IDs to pose residu... | 0.021454 |
def _parse_last_build_date(self):
"""
Returns the last build date of the RSS feed as datetime.datetime
object. Returned datetime is not time-zone aware
"""
date = self._channel.find('lastBuildDate').text
date = parser.parse(date, ignoretz=True)
return date | 0.00641 |
def _golden(self, triplet, fun):
"""Reduce the size of the bracket until the minimum is found"""
self.num_golden = 0
(qa, fa), (qb, fb), (qc, fc) = triplet
while True:
self.num_golden += 1
qd = qa + (qb-qa)*phi/(1+phi)
fd = fun(qd)
if fd < ... | 0.00678 |
def visit_tree(node, previsit, postvisit):
"""
Scans the tree under the node depth-first using an explicit stack. It avoids implicit recursion
via the function call stack to avoid hitting 'maximum recursion depth exceeded' error.
It calls ``previsit()`` and ``postvisit()`` as follows:
* ``previsit(node, par... | 0.016166 |
def SetOption(self, section, option, value, overwrite=True):
"""Set the value of an option in the config file.
Args:
section: string, the section of the config file to check.
option: string, the option to set the value of.
value: string, the value to set the option.
overwrite: bool, Tru... | 0.005068 |
def rank(self, dim, pct=False, keep_attrs=None):
"""Ranks the data.
Equal values are assigned a rank that is the average of the ranks that
would have been otherwise assigned to all of the values within
that set.
Ranks begin at 1, not 0. If pct is True, computes percentage ranks.... | 0.00119 |
def analyze_logfile(self, logfile_path):
self._run_stats['logSource'] = logfile_path
"""Analyzes queries from a given log file"""
with open(logfile_path) as obj:
self.analyze_logfile_object(obj)
self._output_aggregated_report(sys.stdout)
return 0 | 0.006667 |
def _error_to_string(self, error_id):
"""Returns an error string from libiperf
:param error_id: The error_id produced by libiperf
:rtype: string
"""
strerror = self.lib.iperf_strerror
strerror.restype = c_char_p
return strerror(error_id).decode('utf-8') | 0.006452 |
def add_special_file(self, mask, path, from_quick_server, ctype=None):
"""Adds a special file that might have a different actual path than
its address.
Parameters
----------
mask : string
The URL that must be matched to perform this request.
path : string... | 0.002179 |
def get_texts(self):
""" Parse documents from a .txt file assuming 1 document per line, yielding lists of filtered tokens """
with self.getstream() as text_stream:
for i, line in enumerate(text_stream):
line = to_unicode(line)
line = (TweetCorpus.case_normaliz... | 0.004624 |
def iteritems(self, prefix=None):
"""Like dict.iteritems."""
query = Setting.query
if prefix:
query = query.filter(Setting.key.startswith(prefix))
for s in query.yield_per(1000):
yield (s.key, s.value) | 0.007752 |
def comments(case_id):
"""Upload a new comment."""
text = request.form['text']
variant_id = request.form.get('variant_id')
username = request.form.get('username')
case_obj = app.db.case(case_id)
app.db.add_comment(case_obj, text, variant_id=variant_id, username=username)
return redirect(requ... | 0.006006 |
def AddEthernetDevice(self, device_name, iface_name, state):
'''Add an ethernet device.
You have to specify device_name, device interface name (e. g. eth0), and
state. You can use the predefined DeviceState values (e. g.
DeviceState.ACTIVATED) or supply a numeric value. For valid state values
pleas... | 0.000583 |
def revoke_permission_from_user_groups(self, permission, **kwargs): # noqa: E501
"""Revokes a single permission from user group(s) # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
... | 0.00181 |
def contains(self, other):
"""Determine whether this range contains another."""
return self._start <= other.start and self._end >= other.end | 0.012821 |
def remove_unsupported_kwargs(module_or_fn, all_kwargs_dict):
"""Removes any kwargs not supported by `module_or_fn` from `all_kwargs_dict`.
A new dict is return with shallow copies of keys & values from
`all_kwargs_dict`, as long as the key is accepted by module_or_fn. The
returned dict can then be used to con... | 0.003819 |
def request(self, url, method='GET', params=None, data=None,
expected_response_code=200):
"""Make a http request to API."""
url = "{0}/{1}".format(self._baseurl, url)
if params is None:
params = {}
auth = {
'u': self._username,
'p': s... | 0.002099 |
def get_chunk_coords(self):
"""
Return the x,z coordinates and length of the chunks that are defined in te regionfile.
This includes chunks which may not be readable for whatever reason.
This method is deprecated. Use :meth:`get_metadata` instead.
"""
chunks = []... | 0.009042 |
def wrap_scene(cls, root, refobjinter):
"""Wrap all refobjects in the scene in a :class:`Reftrack` instance
and set the right parents, also add suggestions for the current scene
When you want to quickly scan the scene and display the reftracks in a tool,
this is the easiest function.
... | 0.005204 |
def _mul8(ins):
""" Multiplies 2 las values from the stack.
Optimizations:
* If any of the ops is ZERO,
then do A = 0 ==> XOR A, cause A * 0 = 0 * A = 0
* If any ot the ops is ONE, do NOTHING
A * 1 = 1 * A = A
"""
op1, op2 = tuple(ins.quad[2:])
if _int_ops(op1, op2) is... | 0.000796 |
def _reduce_opacity(self):
"""
Reduce opacity for watermark image.
"""
if self.image.mode != 'RGBA':
image = self.image.convert('RGBA')
else:
image = self.image.copy()
alpha = image.split()[3]
alpha = ImageEnhance.Brightness(alpha).enhance... | 0.005102 |
def maketabdesc(descs=[]):
"""Create a table description.
Creates a table description from a set of column descriptions. The
resulting table description can be used in the :class:`table` constructor.
For example::
scd1 = makescacoldesc("col2", "aa")
scd2 = makescacoldesc("col1", 1, "Incre... | 0.00159 |
def delete(self, file_id):
"""Given an file_id, delete this stored file's files collection document
and associated chunks from a GridFS bucket.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# Get _id of file to delete
file_id = fs.upl... | 0.003659 |
def default_type(self):
"""The default value type for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-defaultp function.
"""
return TemplateSlotDefaultType(
lib.EnvDeftemplateSlotDefaultP(self._env, self._tpl, self._name)) | 0.007067 |
def provider_for_url(self, url):
"""
Find the right provider for a URL
"""
for provider, regex in self.get_registry().items():
if re.match(regex, url) is not None:
return provider
raise OEmbedMissingEndpoint('No endpoint matches URL: %s' % url... | 0.009346 |
def get_en_words() -> Set[str]:
"""
Returns a list of English words which can be used to filter out
code-switched sentences.
"""
pull_en_words()
with open(config.EN_WORDS_PATH) as words_f:
raw_words = words_f.readlines()
en_words = set([word.strip().lower() for word in raw_words])
... | 0.010383 |
def sort_languages(self, order=Qt.AscendingOrder):
"""
Sorts the Model languages.
:param order: Order. ( Qt.SortOrder )
"""
self.beginResetModel()
self.__languages = sorted(self.__languages, key=lambda x: (x.name), reverse=order)
self.endResetModel() | 0.00974 |
def download(self, bucket, key, fileobj, extra_args=None,
subscribers=None):
"""Downloads a file from S3
:type bucket: str
:param bucket: The name of the bucket to download from
:type key: str
:param key: The name of the key to download from
:type file... | 0.001752 |
def _remove_session_save_objects(self):
"""Used during exception handling in case we need to remove() session:
keep instances and merge them in the new session.
"""
if self.testing:
return
# Before destroying the session, get all instances to be attached to the
... | 0.002372 |
def train(self, data, epochs, autostop=False):
"""!
@brief Trains self-organized feature map (SOM).
@param[in] data (list): Input data - list of points where each point is represented by list of features, for example coordinates.
@param[in] epochs (uint): Number of epochs for train... | 0.010338 |
def show_gallery(slug, size="100x100", crop="center", **kwargs):
"""
Тег отображения фотогалереи
Пример использования::
{% show_gallery "gallery-slug" "150x110" "center" class='gallery-class' %}
:param slug: символьный код фотогалереи
:param size: размер
:param crop: параметры кропа
... | 0.004399 |
def attribute_invoked(self, sender, name, args, kwargs):
"Handles the creation of ExpectationBuilder when an attribute is invoked."
return ExpectationBuilder(self.sender, self.delegate, self.add_invocation, self.add_expectations, '__call__')(*args, **kwargs) | 0.014599 |
def is_lesser(a, b):
"""
Verify that an item *a* is <= then an item *b*
:param a: An item
:param b: Another item
:return: True or False
"""
if type(a) != type(b):
return False
if isinstance(a, str) and isinstance(b, str):
return a == b
elif isinstance(a, bool) ... | 0.001812 |
def populateFromFile(self, dataUrl, indexFile=None):
"""
Populates the instance variables of this ReadGroupSet from the
specified dataUrl and indexFile. If indexFile is not specified
guess usual form.
"""
self._dataUrl = dataUrl
self._indexFile = indexFile
... | 0.001201 |
def combine_keys(pks: Iterable[Ed25519PublicPoint]) -> Ed25519PublicPoint:
"""Combine a list of Ed25519 points into a "global" CoSi key."""
P = [_ed25519.decodepoint(pk) for pk in pks]
combine = reduce(_ed25519.edwards_add, P)
return Ed25519PublicPoint(_ed25519.encodepoint(combine)) | 0.003344 |
def p_duration_number_duration_unit(self, p):
'duration : NUMBER DURATION_UNIT'
logger.debug('duration = number %s, duration unit %s', p[1], p[2])
p[0] = Duration.from_quantity_unit(p[1], p[2]) | 0.009217 |
def edit_section(self, id, course_section_end_at=None, course_section_name=None, course_section_restrict_enrollments_to_section_dates=None, course_section_sis_section_id=None, course_section_start_at=None):
"""
Edit a section.
Modify an existing section.
"""
path = {}
... | 0.003992 |
def make_clean_visible(_html, tag_replacement_char=' '):
'''
Takes an HTML-like Unicode string as input and returns a UTF-8
encoded string with all tags replaced by whitespace. In particular,
all Unicode characters inside HTML are replaced with a single
whitespace character.
This does not detec... | 0.001109 |
def iter_assets(self, number=-1, etag=None):
"""Iterate over the assets available for this release.
:param int number: (optional), Number of assets to return
:param str etag: (optional), last ETag header sent
:returns: generator of :class:`Asset <Asset>` objects
"""
url ... | 0.004717 |
def _get_session(team, timeout=None):
"""
Creates a session or returns an existing session.
"""
global _sessions # pylint:disable=C0103
session = _sessions.get(team)
if session is None:
auth = _create_auth(team, timeout)
_sessions[team] = session = _create_session(team... | 0.002639 |
def fitToSize(rect, targetWidth, targetHeight, bounds):
"""
Pads or crops a rectangle as necessary to achieve the target dimensions,
ensuring the modified rectangle falls within the specified bounds.
The input rectangle, bounds, and return value are all a tuple of (x,y,w,h).
"""
# Determine the difference bet... | 0.065756 |
def get_context_data(self,**kwargs):
''' Pass the initial kwargs, then update with the needed registration info. '''
context_data = super(RegistrationSummaryView,self).get_context_data(**kwargs)
regSession = self.request.session[REG_VALIDATION_STR]
reg_id = regSession["temp_reg_id"]
... | 0.008068 |
def verify_authentication_data(self, key):
'''
Verify the current authentication data based on the current key-id and
the given key.
'''
correct_authentication_data = self.calculate_authentication_data(key)
return self.authentication_data == correct_authentication_data | 0.006309 |
def send_reply_to(address, reply=EMPTY):
"""Reply to a message previously received
:param address: a nw0 address (eg from `nw0.advertise`)
:param reply: any simple Python object, including text & tuples
"""
_logger.debug("Sending reply %s to %s", reply, address)
return sockets._sockets.send... | 0.005797 |
def parse(cls, line, encoding=pydle.protocol.DEFAULT_ENCODING):
"""
Parse given line into IRC message structure.
Returns a TaggedMessage.
"""
valid = True
# Decode message.
try:
message = line.decode(encoding)
except UnicodeDecodeError:
... | 0.0025 |
def _read_stimtime_AFNI(stimtime_files, n_C, n_S, scan_onoff):
""" Utility called by gen_design. It reads in one or more stimulus timing
file comforming to AFNI style, and return a list
(size of ``[number of runs \\* number of conditions]``)
of dictionary including onsets, durations and weig... | 0.000345 |
def get_suffix(name):
"""Check if file name have valid suffix for formatting.
if have suffix return it else return False.
"""
a = name.count(".")
if a:
ext = name.split(".")[-1]
if ext in LANGS.keys():
return ext
return False
else:
return False | 0.003175 |
def binglookup(w1i, w2i):
"""
Bingham statistics lookup table.
"""
K = {'0.06': {'0.02': ['-25.58', '-8.996'], '0.06': ['-9.043', '-9.043'], '0.04': ['-13.14', '-9.019']}, '0.22': {'0.08': ['-6.944', '-2.644'], '0.02': ['-25.63', '-2.712'], '0.20': ['-2.649', '-2.354'], '0.06': ['-9.027', '-2.673'], '0.... | 0.000293 |
def get_next_appointment(self, appointment_group_ids=None):
"""
Get next appointment.
Return the next appointment available to sign up for. The appointment
is returned in a one-element array. If no future appointments are
available, an empty array is returned.
"""... | 0.004348 |
def factory(
cls, file_id=None, path=None, url=None, blob=None, mime=None,
prefer_local_download=True, prefer_str=False, create_instance=True
):
"""
Creates a new InputFile subclass instance fitting the given parameters.
:param prefer_local_download: If `True`, we do... | 0.004217 |
def filter_creation_date(groups, start, end):
"""Filter log groups by their creation date.
Also sets group specific value for start to the minimum
of creation date or start.
"""
results = []
for g in groups:
created = datetime.fromtimestamp(g['creationTime'] / 1000.0)
if created... | 0.001957 |
def loadSchema(uri, base_uri=None):
"""Load an XSD XML document (specified by filename or URL), and return a
:class:`lxml.etree.XMLSchema`.
"""
# uri to use for reporting errors - include base uri if any
if uri in _loaded_schemas:
return _loaded_schemas[uri]
error_uri = uri
if base... | 0.005199 |
def _get_substitute_element(head, elt, ps):
'''if elt matches a member of the head substitutionGroup, return
the GED typecode.
head -- ElementDeclaration typecode,
elt -- the DOM element being parsed
ps -- ParsedSoap Instance
'''
if not isinstance(head, ElementDeclaration):
return... | 0.007614 |
def model_tree(name, model_cls, visited=None):
"""Create a simple tree of model's properties and its related models.
It traverse trough relations, but ignore any loops.
:param name: name of the model
:type name: str
:param model_cls: model class
:param visited: set of visited models
:type ... | 0.002525 |
def satisfaction_ratings_list(self, score=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/satisfaction_ratings#list-satisfaction-ratings"
api_path = "/api/v2/satisfaction_ratings.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["que... | 0.005825 |
def define_selector(by, value, el_class):
"""
:param by:
:param value:
:param el_class:
:rtype: tuple[type, str|tuple[str, str]]
:return:
"""
el = el_class
selector = by
if isinstance(value, six.string_types):
selector = (by, value)
elif value is not None:
el ... | 0.002463 |
def _convert_schemas(mapping, schemas):
"""Convert schemas to be compatible with storage schemas.
Foreign keys related operations.
Args:
mapping (dict): mapping between resource name and table name
schemas (list): schemas
Raises:
ValueError: if there is no resource
... | 0.001104 |
def in6_getRandomizedIfaceId(ifaceid, previous=None):
"""
Implements the interface ID generation algorithm described in RFC 3041.
The function takes the Modified EUI-64 interface identifier generated
as described in RFC 4291 and an optional previous history value (the
first element of the output of ... | 0.005446 |
def _get(self, *args, **kwargs):
"""
A wrapper for getting things
:returns: The response of your get
:rtype: dict
"""
response = requests.get(*args, **kwargs)
response.raise_for_status()
return response.json() | 0.007246 |
def atlas_peer_get_zonefile_inventory( peer_hostport, peer_table=None ):
"""
What's the zonefile inventory vector for this peer?
Return None if not defined
"""
inv = None
with AtlasPeerTableLocked(peer_table) as ptbl:
if peer_hostport not in ptbl.keys():
return None
... | 0.007937 |
def _set_node_output(self, node_id, no_call, next_nds=None, **kw):
"""
Set the node outputs from node inputs.
:param node_id:
Data or function node id.
:type node_id: str
:param no_call:
If True data node estimation function is not used.
:type no... | 0.002121 |
def AddSlur(self, item):
'''
Very simple method which is used for adding slurs.
:param item:
:return:
'''
if not hasattr(self, "slurs"):
self.slurs = []
self.slurs.append(item) | 0.008197 |
def get_structure_with_charges(self, structure_filename):
"""
get a Structure with Mulliken and Loewdin charges as site properties
Args:
structure_filename: filename of POSCAR
Returns:
Structure Object with Mulliken and Loewdin charges as site properties
"... | 0.006441 |
def get_default_config(self):
"""
Returns the default collector settings
"""
config = super(HBaseCollector, self).get_default_config()
config.update({
'path': 'hbase',
'metrics': ['/var/log/hbase/*.metrics'],
})
return config | 0.006452 |
def get_client_unread_messages_count(self, client_name=None):
"""Gets count of unread messages from client
"""
client = self._clients.get_with_name(client_name)[0]
return client.get_messages_count_in_buffer() | 0.008333 |
def iso_date_to_datetime(string):
"""
>>> iso_date_to_datetime('2013-12-26T10:11:12Z')
datetime.datetime(2013, 12, 26, 10, 11, 12)
>>> iso_date_to_datetime('2013-12-26T10:11:12.456789Z')
datetime.datetime(2013, 12, 26, 10, 11, 12, 456789)
>>> iso_date_to_datetime('2013-12-26T10:11:12.30Z')
... | 0.000908 |
def verify(opts):
"""
Verify that one or more resources were downloaded successfully.
"""
resources = _load(opts.resources, opts.output_dir)
if opts.all:
opts.resource_names = ALL
invalid = _invalid(resources, opts.resource_names)
if not invalid:
if not opts.quiet:
... | 0.003846 |
def add_from_depend(self, node, from_module):
"""add dependencies created by from-imports
"""
mod_name = node.root().name
obj = self.module(mod_name)
if from_module not in obj.node.depends:
obj.node.depends.append(from_module) | 0.007194 |
def run(image_id, name=None, tags=None, key_name=None, security_groups=None,
user_data=None, instance_type='m1.small', placement=None,
kernel_id=None, ramdisk_id=None, monitoring_enabled=None, vpc_id=None,
vpc_name=None, subnet_id=None, subnet_name=None, private_ip_address=None,
block_de... | 0.002188 |
def _runargs(argstring):
""" Entrypoint for debugging
"""
import shlex
parser = cli.make_arg_parser()
args = parser.parse_args(shlex.split(argstring))
run(args) | 0.005435 |
def subscriber_has_active_subscription(subscriber, plan=None):
"""
Helper function to check if a subscriber has an active subscription.
Throws improperlyConfigured if the subscriber is an instance of AUTH_USER_MODEL
and get_user_model().is_anonymous == True.
Activate subscription rules (or):
* customer has act... | 0.026276 |
def main(port, ip, command, loglevel):
"""Console script for satel_integra."""
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int):
raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level)
click.echo("D... | 0.005013 |
def reporter(self):
"""
Creates a report of the results
"""
# Create a set of all the gene names without alleles or accessions e.g. sul1_18_AY260546 becomes sul1
genedict = dict()
# Load the notes file to a dictionary
notefile = os.path.join(self.targetpath, 'note... | 0.005295 |
def add_new_grid_headers(self, new_headers, er_items, pmag_items):
"""
Add in all user-added headers.
If those new headers depend on other headers, add the other headers too.
"""
def add_pmag_reqd_headers():
if self.grid_type == 'result':
return []
... | 0.004842 |
def ReadBytes(self, address, num_bytes):
"""Reads at most num_bytes starting from offset <address>."""
address = int(address)
buf = ctypes.create_string_buffer(num_bytes)
bytesread = ctypes.c_size_t(0)
res = ReadProcessMemory(self.h_process, address, buf, num_bytes,
ctype... | 0.006211 |
def addORFs(fig, seq, minX, maxX, offsetAdjuster):
"""
fig is a matplotlib figure.
seq is a Bio.Seq.Seq.
minX: the smallest x coordinate.
maxX: the largest x coordinate.
featureEndpoints: an array of features as returned by addFeatures (may be
empty).
offsetAdjuster: a function to ad... | 0.000926 |
def validate_header(header, required_fields=None):
'''validate_header ensures that the first row contains the exp_id,
var_name, var_value, and token. Capitalization isn't important, but
ordering is. This criteria is very strict, but it's reasonable
to require.
Parameters
=======... | 0.003524 |
def assert_series_equal(left, right, data_function=None, data_args=None):
"""
For unit testing equality of two Series.
:param left: first Series
:param right: second Series
:param data_function: if provided will use this function to assert compare the df.data
:param data_args: arguments to pass... | 0.002186 |
def _advance(self):
""" Return the value of the current token and read the next one into
self.cur_token.
"""
cur_val = None if self.cur_token is None else self.cur_token.value
try:
self.cur_token = next(self._tokenizer)
except StopIteration:
se... | 0.005525 |
def add_reorganize_data(self, name, input_name, output_name, mode = 'SPACE_TO_DEPTH', block_size = 2):
"""
Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
... | 0.007191 |
def _property_create_dict(header, data):
'''
Create a property dict
'''
prop = dict(zip(header, _merge_last(data, len(header))))
prop['name'] = _property_normalize_name(prop['property'])
prop['type'] = _property_detect_type(prop['name'], prop['values'])
prop['edit'] = from_bool(prop['edit'])... | 0.002273 |
def sample(a=None, temperature=1.0):
"""Sample an index from a probability array.
Parameters
----------
a : list of float
List of probabilities.
temperature : float or None
The higher the more uniform. When a = [0.1, 0.2, 0.7],
- temperature = 0.7, the distribution will ... | 0.00324 |
def find_id(self, element_id):
"""Find a single element with the given ID.
Parameters
----------
element_id : str
ID of the element to find
Returns
-------
found element
"""
element = _transform.FigureElement.find_id(self, element_id)... | 0.005602 |
def search(self, search_phrase, limit=None):
""" Finds datasets by search phrase.
Args:
search_phrase (str or unicode):
limit (int, optional): how many results to return. None means without limit.
Returns:
list of DatasetSearchResult instances.
"""
... | 0.002212 |
def stats(args):
"""Create stats from the analysis
"""
logger.info("Reading sequeces")
data = parse_ma_file(args.ma)
logger.info("Get sequences from sam")
is_align = _read_sam(args.sam)
is_json, is_db = _read_json(args.json)
res = _summarise_sam(data, is_align, is_json, is_db)
_write... | 0.002519 |
def _start_callables(self, row, callables):
"""Start running `callables` asynchronously.
"""
id_vals = {c: row[c] for c in self.ids}
def callback(tab, cols, result):
if isinstance(result, Mapping):
pass
elif isinstance(result, tuple):
... | 0.001555 |
def add_to_win32_PATH(script_fpath, *add_path_list):
r"""
Writes a registery script to update the PATH variable into the sync registry
CommandLine:
python -m utool.util_win32 --test-add_to_win32_PATH --newpath "C:\Program Files (x86)\Graphviz2.38\bin"
Example:
>>> # DISABLE_DOCTEST
... | 0.005622 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.