text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def exception_format():
"""
Convert exception info into a string suitable for display.
"""
return "".join(traceback.format_exception(
sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]
)) | 0.004545 |
def serial_number(self, serial_number):
"""
Sets the serial_number of this DeviceDataPostRequest.
The serial number of the device.
:param serial_number: The serial_number of this DeviceDataPostRequest.
:type: str
"""
if serial_number is not None and len(serial_nu... | 0.006186 |
def create_from_textgrid(self,word_list):
""" Fills the ParsedResponse object with a list of TextGrid.Word objects originally from a .TextGrid file.
:param list word_list: List of TextGrid.Word objects corresponding to words/tokens in the subject response.
Modifies:
- self.timing_i... | 0.006598 |
def list_attached_team(context, id, sort, limit, where, verbose):
"""list_attached_team(context, id, sort, limit. where. verbose)
List teams attached to a topic.
>>> dcictl topic-list-team
:param string id: ID of the topic to list teams for [required]
:param string sort: Field to apply sort
:... | 0.001517 |
def offer_answer(pool, answer, rationale, student_id, algo, options):
"""
submit a student answer to the answer pool
The answer maybe selected to stay in the pool depending on the selection algorithm
Args:
pool (dict): answer pool
Answer pool format:
{
o... | 0.001821 |
def find_descriptor_schemas(self, schema_file):
"""Find descriptor schemas in given path."""
if not schema_file.lower().endswith(('.yml', '.yaml')):
return []
with open(schema_file) as fn:
schemas = yaml.load(fn, Loader=yaml.FullLoader)
if not schemas:
... | 0.004823 |
def delete(self, group_id, nick=None):
'''xxxxx.xxxxx.adgroup.delete
===================================
删除一个推广组'''
request = TOPRequest('xxxxx.xxxxx.adgroup.delete')
request['group_id'] = group_id
if nick!=None: request['nick'] = nick
self.create(self.execute(req... | 0.024444 |
def _is_ignorable_404(uri):
"""
Returns True if the given request *shouldn't* notify the site managers.
"""
urls = getattr(django_settings, "IGNORABLE_404_URLS", ())
return any(pattern.search(uri) for pattern in urls) | 0.004219 |
def _flow(self, args):
"""Enable/disable flow from peer
This method asks the peer to pause or restart the flow of
content data. This is a simple flow-control mechanism that a
peer can use to avoid oveflowing its queues or otherwise
finding itself receiving more messages than it ... | 0.001158 |
def _get_error_page_callback(self):
"""Return an error page for the current response status."""
if self.response.status in self._error_handlers:
return self._error_handlers[self.response.status]
elif None in self._error_handlers:
return self._error_handlers[None]
... | 0.004 |
def to_sparse(self, format='csr', **kwargs):
"""Convert into a sparse matrix.
Parameters
----------
format : {'coo', 'csc', 'csr', 'dia', 'dok', 'lil'}
Sparse matrix format.
kwargs : keyword arguments
Passed through to sparse matrix constructor.
... | 0.001547 |
def get_collection(collection):
"""Return the appropriate *Response* for retrieving a collection of
resources.
:param string collection: a :class:`sandman.model.Model` endpoint
:param string key: the primary key for the :class:`sandman.model.Model`
:rtype: :class:`flask.Response`
"""
cls =... | 0.00129 |
def get_file_contents_text(
filename: str = None, blob: bytes = None,
config: TextProcessingConfig = _DEFAULT_CONFIG) -> str:
"""
Returns the string contents of a file, or of a BLOB.
"""
binary_contents = get_file_contents(filename=filename, blob=blob)
# 1. Try the encoding the user ... | 0.000853 |
def _get_video(edx_video_id):
"""
Get a Video instance, prefetching encoded video and course information.
Raises ValVideoNotFoundError if the video cannot be retrieved.
"""
try:
return Video.objects.prefetch_related("encoded_videos", "courses").get(edx_video_id=edx_video_id)
except Vide... | 0.004545 |
def _create_solr_query(self, line):
"""Actual search - easier to test. """
p0 = ""
if line:
p0 = line.strip()
p1 = self._query_string_to_solr_filter(line)
p2 = self._object_format_to_solr_filter(line)
p3 = self._time_span_to_solr_filter()
result = p0 +... | 0.00551 |
def addValue(self, type_uri, value):
"""Add a single value for the given attribute type to the
message. If there are already values specified for this type,
this value will be sent in addition to the values already
specified.
@param type_uri: The URI for the attribute
@... | 0.00314 |
def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(3)
>>> lnk(ACKER)
>>> relwz.values = 0.5
>>> relwb(0.2, 0.5, 0.8)
>>> relwb
... | 0.003914 |
async def set_heating_level(self, level, duration=0):
"""Update heating data json."""
url = '{}/devices/{}'.format(API_URL, self.device.deviceid)
# Catch bad inputs
level = 10 if level < 10 else level
level = 100 if level > 100 else level
if self.side == 'left':
... | 0.00222 |
def rename_pickled_ontology(filename, newname):
""" try to rename a cached ontology """
pickledfile = ONTOSPY_LOCAL_CACHE + "/" + filename + ".pickle"
newpickledfile = ONTOSPY_LOCAL_CACHE + "/" + newname + ".pickle"
if os.path.isfile(pickledfile) and not GLOBAL_DISABLE_CACHE:
os.rename(pickledfile, newpickledfile... | 0.025281 |
def sendWebmention(sourceURL, targetURL, webmention=None, test_urls=True, vouchDomain=None,
headers={}, timeout=None, debug=False):
"""Send to the :targetURL: a WebMention for the :sourceURL:
The WebMention will be discovered if not given in the :webmention:
parameter.
:param source... | 0.003644 |
def with_transactional_resource(
transactional_resource_class,
resource_name,
reference_value_from=None
):
"""a class decorator for Crontabber Apps. This decorator will give access
to a resource connection source. Configuration will be automatically set
up and the cron app can expect to have a... | 0.000547 |
def GRUCell(units):
"""Builds a traditional GRU cell with dense internal transformations.
Gated Recurrent Unit paper: https://arxiv.org/abs/1412.3555
Args:
units: Number of hidden units.
Returns:
A Stax model representing a traditional GRU RNN cell.
"""
return GeneralGRUCell(
candidate_tra... | 0.006224 |
def add_transition_to_state(from_port, to_port):
"""Interface method between Gaphas and RAFCON core for adding transitions
The method checks the types of the given ports (IncomeView or OutcomeView) and from this determines the necessary
parameters for the add_transition method of the RAFCON core. Also the ... | 0.002728 |
def dump_by_server(self, hosts):
"""Returns the output of dump for each server.
:param hosts: comma separated lists of members of the ZK ensemble.
:returns: A dictionary of ((server_ip, port), ClientInfo).
"""
dump_by_endpoint = {}
for endpoint in self._to_endpoints(ho... | 0.003724 |
def modifiedaminoacids(df):
"""
Calculate the number of modified amino acids in supplied ``DataFrame``.
Returns the total of all modifications and the total for each amino acid individually, as an ``int`` and a
``dict`` of ``int``, keyed by amino acid, respectively.
:param df: Pandas ``DataFrame``... | 0.005284 |
def _interpret_response(self, response, payload, expected_status):
# type: (Response, dict, Container[int]) -> dict
"""
Interprets the HTTP response from the node.
:param response:
The response object received from
:py:meth:`_send_http_request`.
:param p... | 0.001447 |
def _pack_target_set_default_reset_type(self):
"""! @brief Set's the first core's default reset type to the one specified in the pack."""
if 0 in self.cores:
self.cores[0].default_reset_type = self._pack_device.default_reset_type | 0.015564 |
def find_ui_tree_entity(entity_id=None, entity_value=None, entity_ca=None):
"""
find the Ariane UI tree menu entity depending on its id (priority), value or context address
:param entity_id: the Ariane UI tree menu ID to search
:param entity_value: the Ariane UI tree menu Value to search... | 0.004069 |
def _growing_step_sequence(interval_growth, max_interval, init_interval, start_level=None):
"""
Returns an iterator that constructs a sequence of trigger levels with growing intervals.
The interval is growing exponentially until it reaches the maximum value. Then the interval
stays the s... | 0.008434 |
def _set_apply_dscp_exp_map_name(self, v, load=False):
"""
Setter method for apply_dscp_exp_map_name, mapped from YANG variable /qos_mpls/map_apply/apply_dscp_exp_map_name (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_apply_dscp_exp_map_name is considered a... | 0.005558 |
def send_response(self, transaction):
"""
updates the cache with the response if there was a cache miss
:param transaction:
:return:
"""
if transaction.cacheHit is False:
"""
handling response based on the code
"""
logger.d... | 0.004773 |
def mutate(self,p_i,func_set,term_set): #, max_depth=2
"""point mutation, addition, removal"""
self.point_mutate(p_i,func_set,term_set) | 0.059603 |
def mainset(self):
"""Returns information regarding the set"""
if self.mainsetcache:
return self.mainsetcache
set_uri = self.get_set_uri()
for row in self.graph.query("SELECT ?seturi ?setid ?setlabel ?setopen ?setempty WHERE { ?seturi rdf:type skos:Collection . OPTIONAL { ?se... | 0.006726 |
def fetch_logs(self, lambda_name, filter_pattern='', limit=10000, start_time=0):
"""
Fetch the CloudWatch logs for a given Lambda name.
"""
log_name = '/aws/lambda/' + lambda_name
streams = self.logs_client.describe_log_streams(
logGroupName=log_name,
desc... | 0.002725 |
def _handle_get(self, method, remainder, request=None):
'''
Routes ``GET`` actions to the appropriate controller.
'''
if request is None:
self._raise_method_deprecation_warning(self._handle_get)
# route to a get_all or get if no additional parts are available
... | 0.001255 |
def termLons(TERMS):
""" Returns a list with the absolute longitude
of all terms.
"""
res = []
for i, sign in enumerate(SIGN_LIST):
termList = TERMS[sign]
res.extend([
ID,
sign,
start + 30 * i,
] for (ID, start, end) in termList)
... | 0.009091 |
def quote_split(sep,string):
"""
Splits the strings into pieces divided by sep, when sep in not inside quotes.
"""
if len(sep) != 1: raise Exception("Separation string must be one character long")
retlist = []
squote = False
dquote = False
left = 0
i = 0
while i < len(string):
... | 0.006024 |
def list_abundance_cartesian_expansion(graph: BELGraph) -> None:
"""Expand all list abundances to simple subject-predicate-object networks."""
for u, v, k, d in list(graph.edges(keys=True, data=True)):
if CITATION not in d:
continue
if isinstance(u, ListAbundance) and isinstance(v, ... | 0.001378 |
def Email(v):
"""Verify that the value is an Email or not.
>>> s = Schema(Email())
>>> with raises(MultipleInvalid, 'expected an Email'):
... s("a.com")
>>> with raises(MultipleInvalid, 'expected an Email'):
... s("a@.com")
>>> with raises(MultipleInvalid, 'expected an Email'):
... ... | 0.004274 |
def receive_one_ping(mySocket, myID, timeout):
"""
Receive the ping from the socket. Timeout = in ms
"""
timeLeft = timeout/1000
while True: # Loop while waiting for packet or timeout
startedSelect = default_timer()
whatReady = select.select([mySocket], [], [], timeLeft)
how... | 0.006245 |
def add_file(self, name, filename, compress_hint=True):
"""Saves the actual file in the store.
``compress_hint`` suggests whether the file should be compressed
before transfer
Works like :meth:`add_stream`, but ``filename`` is the name of
an existing file in the fil... | 0.005013 |
def serialize_tag(tag, *, indent=None, compact=False, quote=None):
"""Serialize an nbt tag to its literal representation."""
serializer = Serializer(indent=indent, compact=compact, quote=quote)
return serializer.serialize(tag) | 0.004202 |
def validateDocumentFinal(self, doc):
"""Does the final step for the document validation once all
the incremental validation steps have been completed
basically it does the following checks described by the XML
Rec Check all the IDREF/IDREFS attributes definition for
va... | 0.008264 |
def samples(self, anystring, limit=None, offset=None, sortby=None):
'''Return an object representing the samples identified by the input domain, IP, or URL'''
uri = self._uris['samples'].format(anystring)
params = {'limit': limit, 'offset': offset, 'sortby': sortby}
return self.get_par... | 0.008955 |
def update_reward(self, new_reward):
"""
Updates reward value for policy.
:param new_reward: New reward to save.
"""
self.sess.run(self.model.update_reward,
feed_dict={self.model.new_reward: new_reward}) | 0.007547 |
def _StrftimeGm(value, unused_context, args):
"""Convert a timestamp in seconds to a string based on the format string.
Returns GM time.
"""
time_tuple = time.gmtime(value)
return _StrftimeHelper(args, time_tuple) | 0.004348 |
def call(obj, method, *args, **kwargs):
"""
Allows to call any method of any object with parameters.
Because come on! It's bloody stupid that Django's templating engine doesn't
allow that.
Usage::
{% call myobj 'mymethod' myvar foobar=myvar2 as result %}
{% call myobj 'mydict' 'my... | 0.001019 |
def read_int64(self, little_endian=True):
"""
Read 8 bytes as a signed integer value from the stream.
Args:
little_endian (bool): specify the endianness. (Default) Little endian.
Returns:
int:
"""
if little_endian:
endian = "<"
... | 0.007538 |
def unpacktar(tarfile, destdir):
""" Unpack given tarball into the specified dir """
nullfd = open(os.devnull, "w")
tarfile = cygpath(os.path.abspath(tarfile))
log.debug("unpack tar %s into %s", tarfile, destdir)
try:
check_call([TAR, '-xzf', tarfile], cwd=destdir,
stdout=... | 0.002083 |
def _cryptography_cipher(key, iv):
"""Build a cryptography AES Cipher object.
:param bytes key: Encryption key
:param bytes iv: Initialization vector
:returns: AES Cipher instance
:rtype: cryptography.hazmat.primitives.ciphers.Cipher
"""
return Cipher(
algorithm=algorithms.AES(key),... | 0.002577 |
def set_naxis(self, idx, n):
"""Change the slice shown in the channel viewer.
`idx` is the slice index (0-based); `n` is the axis (0-based)
"""
self.play_idx = idx
self.logger.debug("naxis %d index is %d" % (n + 1, idx + 1))
image = self.fitsimage.get_image()
sli... | 0.001366 |
def _remove_mapper_from_plotter(plotter, actor, reset_camera):
"""removes this actor's mapper from the given plotter's _scalar_bar_mappers"""
try:
mapper = actor.GetMapper()
except AttributeError:
return
for name in list(plotter._scalar_bar_mappers.keys()):
try:
plott... | 0.003851 |
def _find_port(self, host): # pylint: disable=no-self-use
"""
Finds port number from host. Defaults to 3000 if not found
:param host: host as string
:return: (host, port)
"""
ind = host.rfind(":")
if ind != -1:
try:
port = int(host[ind... | 0.004132 |
def iterate(self):
"""
Reads and handles data from the microcontroller over the serial port.
This method should be called in a main loop or in an :class:`Iterator`
instance to keep this boards pin values up to date.
"""
byte = self.sp.read()
if not byte:
... | 0.001961 |
def create_archive(
self,
archive_name,
authority_name,
archive_path,
versioned,
raise_on_err=True,
metadata=None,
user_config=None,
tags=None,
helper=False):
'''
Create a new data arc... | 0.001775 |
def posterior_covariance_between_points(self, X1, X2):
"""
Computes the posterior covariance between points.
:param X1: some input observations
:param X2: other input observations
"""
return self.posterior.covariance_between_points(self.kern, self.X, X1, X2) | 0.009772 |
def extract_gcc_binaries():
"""Try to find GCC on OSX for OpenMP support."""
patterns = ['/opt/local/bin/g++-mp-[0-9].[0-9]',
'/opt/local/bin/g++-mp-[0-9]',
'/usr/local/bin/g++-[0-9].[0-9]',
'/usr/local/bin/g++-[0-9]']
if 'darwin' in platform.platform().lower(... | 0.0016 |
def _evalWeekday(self, datetimeString, sourceTime):
"""
Evaluate text passed by L{_partialParseWeekday()}
"""
s = datetimeString.strip()
sourceTime = self._evalDT(datetimeString, sourceTime)
# Given string is a weekday
yr, mth, dy, hr, mn, sec, wd, yd, isdst = so... | 0.001984 |
def language(self):
"""The language of this file"""
try:
return self._language
except AttributeError:
self._language = find_language(self, getattr(self, 'exts', None))
return self._language | 0.008163 |
def get_absolute_url(self):
"""Determine where I am coming from and where I am going"""
# Determine if this configuration is on a stage
if self.stage:
# Stage specific configurations go back to the stage view
url = reverse('projects_stage_view', args=(self.project.pk, se... | 0.00611 |
def gen_otu_dict(nex_obj, nexson_version=None):
"""Takes a NexSON object and returns a dict of
otu_id -> otu_obj
"""
if nexson_version is None:
nexson_version = detect_nexson_version(nex_obj)
if _is_by_id_hbf(nexson_version):
otus = nex_obj['nexml']['otusById']
if len(otus) >... | 0.001508 |
def request_encode_url(self, method, url, fields=None, **urlopen_kw):
"""
Make a request using :meth:`urlopen` with the ``fields`` encoded in
the url. This is useful for request methods like GET, HEAD, DELETE, etc.
"""
if fields:
url += '?' + urlencode(fields)
... | 0.008174 |
async def anon_decrypt(wallet_handle: int,
recipient_vk: str,
encrypted_msg: bytes) -> bytes:
"""
Decrypts a message by anonymous-encryption scheme.
Sealed boxes are designed to anonymously send messages to a Recipient given its public key.
Only the Recipie... | 0.003324 |
def listDataTypes(self, datatype="", dataset=""):
"""
API to list data types known to dbs (when no parameter supplied).
:param dataset: Returns data type (of primary dataset) of the dataset (Optional)
:type dataset: str
:param datatype: List specific data type
:type data... | 0.008946 |
def read_mesh(fname):
"""Read mesh data from file.
Parameters
----------
fname : str
File name to read. Format will be inferred from the filename.
Currently only '.obj' and '.obj.gz' are supported.
Returns
-------
vertices : array
Vertices.
faces : array | None
... | 0.001168 |
def update(self, properties=None):
"""Updates the properties being held for this instance.
:param properties: The list of properties to update.
:type properties: list or None (default). If None, update all
currently cached properties.
"""
if properties is None:
... | 0.003317 |
def qname(self):
"""
Get the B{fully} qualified name of this element
@return: The fully qualified name.
@rtype: basestring
"""
if self.prefix is None:
return self.name
else:
return '%s:%s' % (self.prefix, self.name) | 0.00678 |
def distance_correlation_sqr(x, y, **kwargs):
"""
distance_correlation_sqr(x, y, *, exponent=1)
Computes the usual (biased) estimator for the squared distance correlation
between two random vectors.
Parameters
----------
x: array_like
First random vector. The columns correspond wit... | 0.000535 |
def get_posts(self, count=10, offset=0, recent=True, tag=None,
user_id=None, include_draft=False):
"""
Get posts given by filter criteria
:param count: The number of posts to retrieve (default 10). If count
is ``None``, all posts are returned.
:type count: in... | 0.002653 |
async def set_volume(self, volume: int, *, device: Optional[SomeDevice] = None):
"""Set the volume for the user’s current playback device.
Parameters
----------
volume : int
The volume to set. Must be a value from 0 to 100 inclusive.
device : Optional[:obj:`SomeDevic... | 0.006993 |
def _move_el_inside_block(el, tag):
""" helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
and moves them inside any block-level tags. """
for child in el:
if _contains_block_level_tag(child):
break
else:
import sys
# No block-level tags in any child
... | 0.000909 |
def on_en_passant_valid_location(self):
"""
Finds out if pawn is on enemy center rank.
:rtype: bool
"""
return (self.color == color.white and self.location.rank == 4) or \
(self.color == color.black and self.location.rank == 3) | 0.007067 |
def copy(self, deep=True):
"""
Make a copy of this SparseDataFrame
"""
result = super().copy(deep=deep)
result._default_fill_value = self._default_fill_value
result._default_kind = self._default_kind
return result | 0.007435 |
def add_url(self, *args, **kwargs):
"""Add a new url to the sitemap.
This function can either be called with a :class:`UrlEntry`
or some keyword and positional arguments that are forwarded to
the :class:`UrlEntry` constructor.
"""
if len(args) == 1 and not kwargs and isi... | 0.004396 |
def load_json_string(data):
"""
<Purpose>
Deserialize 'data' (JSON string) to a Python object.
<Arguments>
data:
A JSON string.
<Exceptions>
securesystemslib.exceptions.Error, if 'data' cannot be deserialized to a
Python object.
<Side Effects>
None.
<Returns>
Deserialized o... | 0.009333 |
def read_url(url):
"""Reads given URL as JSON and returns data as loaded python object."""
logging.debug('reading {url} ...'.format(url=url))
token = os.environ.get("BOKEH_GITHUB_API_TOKEN")
headers = {}
if token:
headers['Authorization'] = 'token %s' % token
request = Request(url, heade... | 0.002392 |
def score_for_percentile_in(self, leaderboard_name, percentile):
'''
Calculate the score for a given percentile value in the leaderboard.
@param leaderboard_name [String] Name of the leaderboard.
@param percentile [float] Percentile value (0.0 to 100.0 inclusive).
@return the sc... | 0.002435 |
def get_sockinfo (host, port=None):
"""Return socket.getaddrinfo for given host and port."""
family, socktype = socket.AF_INET, socket.SOCK_STREAM
return socket.getaddrinfo(host, port, family, socktype) | 0.009346 |
def visit_NameConstant(self, node):
"""Tangent of e.g.
x = None
Lines of this type are sometimes auto-generated by reverse-mode,
and thus handling them is important for higher-order autodiff
We will shunt NameConstant tangents off to visit_Name, to prevent
code duplication.
"""
constant... | 0.005714 |
def add_data_point_xy(self, x, y):
"""Add a new data point to the data set to be smoothed."""
self.x.append(x)
self.y.append(y) | 0.013245 |
def as4_capability(self, **kwargs):
"""Set Spanning Tree state.
Args:
enabled (bool): Is AS4 Capability enabled? (True, False)
callback (function): A function executed upon completion of the
method. The only parameter passed to `callback` will be the
... | 0.000979 |
def all_blocks(self):
status = OrderedDict.fromkeys(parameters.BLOCKS.keys())
status['13AE'] = ['discovery complete', '50', '24.05']
status['13AO'] = ['discovery complete', '36', '24.40']
status['13BL'] = ['discovery complete', '79', '24.48']
status['14BH'] = ['discovery running... | 0.002997 |
def has_next(self):
"""Return True if there are more values present"""
if self._result_cache:
return self._result_cache.has_next
return self.all().has_next | 0.010417 |
def _places(client, url_part, query=None, location=None, radius=None,
keyword=None, language=None, min_price=0, max_price=4, name=None,
open_now=False, rank_by=None, type=None, region=None, page_token=None):
"""
Internal handler for ``places``, ``places_nearby``, and ``places_radar``.
... | 0.001786 |
def show_graph(self, format='svg'):
"""
Render this Pipeline as a DAG.
Parameters
----------
format : {'svg', 'png', 'jpeg'}
Image format to render with. Default is 'svg'.
"""
g = self.to_simple_graph(AssetExists())
if format == 'svg':
... | 0.003155 |
def init_from_datastore(self):
"""Initializes batches by reading from the datastore."""
self._data = {}
for entity in self._datastore_client.query_fetch(
kind=self._entity_kind_batches):
batch_id = entity.key.flat_path[-1]
self._data[batch_id] = dict(entity)
self._data[batch_id]['i... | 0.015734 |
def get_boards(self):
"""
Get the list of boards to pull cards from. If the user gave a value to
trello.include_boards use that, otherwise ask the Trello API for the
user's boards.
"""
if 'include_boards' in self.config:
for boardid in self.config.get('includ... | 0.003086 |
def _finish_connection_action(self, action):
"""Finish a connection attempt
Args:
action (ConnectionAction): the action object describing what we are
connecting to and what the result of the operation was
"""
success = action.data['success']
conn_key... | 0.0024 |
def collections(self):
"""获取用户收藏夹.
:return: 用户收藏夹,返回生成器
:rtype: Collection.Iterable
"""
from .collection import Collection
if self.url is None or self.collection_num == 0:
return
else:
collection_num = self.collection_num
for ... | 0.001778 |
def read(self, vals):
"""Read values.
Args:
vals (list): list of strings representing values
"""
i = 0
if len(vals[i]) == 0:
self.title_of_design_condition = None
else:
self.title_of_design_condition = vals[i]
i += 1
i... | 0.000223 |
def run(self, daemon=False):
"""Launch the process with the given inputs, by default running in the current interpreter.
:param daemon: boolean, if True, will submit the process instead of running it.
"""
from aiida.engine import launch
# If daemon is True, submit the process a... | 0.007794 |
def transform_file(ELEMS, ofname, EPO, TREE, opt):
"transform/map the elements of this file and dump the output on 'ofname'"
BED4_FRM = "%s\t%d\t%d\t%s\n"
log.info("%s (%d) elements ..." % (opt.screen and "screening" or "transforming", ELEMS.shape[0]))
with open(ofname, 'w') as out_fd:
if opt.s... | 0.011547 |
def _read_ent(ent_file):
"""Read notes stored in .ent file.
This is a basic implementation, that relies on turning the information in
the string in the dict format, and then evaluate it. It's not very flexible
and it might not read some notes, but it's fast. I could not implement a
nice, recursive ... | 0.000835 |
def vertical_scroll(self, image, padding=True):
"""Returns a list of images which appear to scroll from top to bottom
down the input image when displayed on the LED matrix in order.
The input image is not limited to being 8x16. If the input image is
largerthan this, then all rows will b... | 0.003854 |
def as_tuple(self):
"""Return all of the matrix’s components.
:returns: A ``(xx, yx, xy, yy, x0, y0)`` tuple of floats.
"""
ptr = self._pointer
return (ptr.xx, ptr.yx, ptr.xy, ptr.yy, ptr.x0, ptr.y0) | 0.008299 |
def semilocal_linear_trend_transition_matrix(autoregressive_coef):
"""Build the transition matrix for a semi-local linear trend model."""
# We want to write the following 2 x 2 matrix:
# [[1., 1., ], # level(t+1) = level(t) + slope(t)
# [0., ar_coef], # slope(t+1) = ar_coef * slope(t)
# but it's slightl... | 0.01268 |
def _build_pcollection(self, pipeline, filepaths, language):
"""Build PCollection of examples in the raw (text) form."""
beam = tfds.core.lazy_imports.apache_beam
def _extract_content(filepath):
"""Extracts article content from a single WikiMedia XML file."""
logging.info("generating examples ... | 0.012384 |
def documentation(self, base_url=None, api_version=None, prefix=""):
"""Generates and returns documentation for this API endpoint"""
documentation = OrderedDict()
base_url = self.base_url if base_url is None else base_url
overview = self.api.doc
if overview:
documenta... | 0.001907 |
def interactive(self, bConfirmQuit = True, bShowBanner = True):
"""
Start an interactive debugging session.
@type bConfirmQuit: bool
@param bConfirmQuit: Set to C{True} to ask the user for confirmation
before closing the session, C{False} otherwise.
@type bShowBan... | 0.00437 |
def timedelta_seconds(td):
'''
Return the offset stored by a :class:`datetime.timedelta` object as an
integer number of seconds. Microseconds, if present, are rounded to
the nearest second.
Delegates to
:meth:`timedelta.total_seconds() <datetime.timedelta.total_seconds()>`
if available.
... | 0.00105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.