text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def is_wav(origin, filepath, fileobj, *args, **kwargs):
"""Identify a file as WAV
See `astropy.io.registry` for details on how this function is used.
"""
# pylint: disable=unused-argument
if origin == 'read' and fileobj is not None:
loc = fileobj.tell()
fileobj.seek(0)
try:
... | 0.001048 |
def parse_unstruct(unstruct):
"""
Convert an unstructured event JSON to a list containing one Elasticsearch-compatible key-value pair
For example, the JSON
{
"data": {
"data": {
"key": "value"
},
"schema": "iglu:com.snowplowanalytics.snowplow/link_click/jsonschem... | 0.005247 |
def flexifunction_buffer_function_encode(self, target_system, target_component, func_index, func_count, data_address, data_size, data):
'''
Flexifunction type and parameters for component at function index from
buffer
target_system : System ID... | 0.00603 |
def write_file(self, name, path=None):
"""Write the contents of a file from the disk to the XPI."""
if path is None:
path = name
self.zf.write(path, name) | 0.010417 |
def FetchCompletedResponses(self, session_id, timestamp=None, limit=10000):
"""Fetch only completed requests and responses up to a limit."""
if timestamp is None:
timestamp = (0, self.frozen_timestamp or rdfvalue.RDFDatetime.Now())
completed_requests = collections.deque(
self.FetchCompletedRe... | 0.009496 |
def error_response(self, exception):
# type: (Exception) -> Tuple[Callback, Error]
"""Create an Error Response object to signal an error"""
response = Error(id=self.id, message=exception)
log.exception("Exception raised for request %s", self)
return self.callback, response | 0.009585 |
def oindex(a, selection):
"""Implementation of orthogonal indexing with slices and ints."""
selection = replace_ellipsis(selection, a.shape)
drop_axes = tuple([i for i, s in enumerate(selection) if is_integer(s)])
selection = ix_(selection, a.shape)
result = a[selection]
if drop_axes:
re... | 0.002667 |
def input(self, **kwargs):
"""
Specify temporary input file extension.
Browserify requires explicit file extension (".js" or ".json" by default).
https://github.com/substack/node-browserify/issues/1469
"""
if self.infile is None and "{infile}" in self.command:
... | 0.005682 |
def _search_stock_info(self, code):
"""
通过雪球的接口获取股票详细信息
:param code: 股票代码 000001
:return: 查询到的股票 {u'stock_id': 1000279, u'code': u'SH600325',
u'name': u'华发股份', u'ind_color': u'#d9633b', u'chg': -1.09,
u'ind_id': 100014, u'percent': -9.31, u'current': 10.62,
... | 0.002205 |
def sub_base_uri(self):
""" This will return the sub_base_uri parsed from the base_uri
:return: str of the sub_base_uri
"""
return self._base_uri and \
self._base_uri.split('://')[-1].split('.')[0] \
or self._base_uri | 0.014337 |
def create_xml_file_from_string(self, content, destination=None):
"""
Creates XML file from text.
:param content: C++ source code
:type content: str
:param destination: file name for xml file
:type destination: str
:rtype: returns file name of xml file
... | 0.002994 |
def obj_from_file(filename='annotation.yaml', filetype='auto'):
''' Read object from file '''
if filetype == 'auto':
_, ext = os.path.splitext(filename)
filetype = ext[1:]
if filetype in ('yaml', 'yml'):
from ruamel.yaml import YAML
yaml = YAML(typ="unsafe")
with op... | 0.000907 |
def namespace(self, name=None, function=None, recursive=None):
"""
Returns reference to namespace declaration that matches
a defined criteria.
"""
return (
self._find_single(
scopedef.scopedef_t._impl_matchers[namespace_t.namespace],
... | 0.004854 |
def findCaller(self, stack_info=False):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
"""
f = logging.currentframe()
# On some versions of IronPython, currentframe() returns None if
# IronPython isn... | 0.001805 |
def _normalize(schema, allow_none=True):
"""
Normalize a schema.
"""
if allow_none and schema is None:
return schema
if isinstance(schema, CommonSchema):
return schema
if isinstance(schema, StreamSchema):
return schema
if isinstance(schema, basestring):
retur... | 0.002079 |
def download_file(url, dst_path):
"""Download a file from a url"""
request = requests.get(url, stream=True)
with open(dst_path, 'wb') as downloaded_file:
request.raw.decode_content = True
shutil.copyfileobj(request.raw, downloaded_file) | 0.003788 |
def read_list(self, request):
"""
Implements the List read (get a list of objects)
maps to GET /api/objects/ in rest semantics
:param request: rip.Request
:return: rip.Response
"""
pipeline = crud_pipeline_factory.read_list_pipeline(
configuration=sel... | 0.005305 |
def simplify(self, options=None):
"""
provide a simple representation of this change as a dictionary
"""
# TODO: we might want to get rid of this method and just move
# it into the JSONEncoder in report.py
simple = super(GenericChange, self).simplify(options)
l... | 0.003802 |
def load_xml(self, xmlfile, **kwargs):
"""Load sources from an XML file."""
extdir = kwargs.get('extdir', self.extdir)
coordsys = kwargs.get('coordsys', 'CEL')
if not os.path.isfile(xmlfile):
xmlfile = os.path.join(fermipy.PACKAGE_DATA, 'catalogs', xmlfile)
root = E... | 0.001259 |
def rnd_date(start=date(1970, 1, 1), end=None, **kwargs):
"""
Generate a random date between ``start`` to ``end``.
:param start: Left bound
:type start: string or datetime.date, (default date(1970, 1, 1))
:param end: Right bound
:type end: string or datetime.date, (default date.today())
:re... | 0.001658 |
def country_field(key='country'):
"""Provides a select box for country selection"""
country_list = list(countries)
title_map = []
for item in country_list:
title_map.append({'value': item.alpha_3, 'name': item.name})
widget = {
'key': key,
'type': 'uiselect',
'title... | 0.002778 |
def sort_rows(self, rows, section):
"""Sort the rows, as appropriate for the section.
:param rows: List of tuples (all same length, same values in each position)
:param section: Name of section, should match const in Differ class
:return: None; rows are sorted in-place
"""
... | 0.006279 |
def eaMuPlusLambda(population, toolbox, mu, lambda_, cxpb, mutpb, ngen, pbar,
stats=None, halloffame=None, verbose=0, per_generation_function=None):
"""This is the :math:`(\mu + \lambda)` evolutionary algorithm.
:param population: A list of individuals.
:param toolbox: A :class:`~deap.bas... | 0.002694 |
def to_yaml(self, ignore_none: bool=True, ignore_empty: bool=False) -> str:
"""From instance to yaml string
:param ignore_none: Properties which is None are excluded if True
:param ignore_empty: Properties which is empty are excluded if True
:return: Yaml string
Usage:
... | 0.007505 |
def do(self, arg):
".exchain - Show the SEH chain"
thread = self.get_thread_from_prefix()
print "Exception handlers for thread %d" % thread.get_tid()
print
table = Table()
table.addRow("Block", "Function")
bits = thread.get_bits()
for (seh, seh_func) in thread.get_seh_chain():
if... | 0.003711 |
def subdevicenames(self) -> Tuple[str, ...]:
"""A |tuple| containing the (sub)device names.
Property |NetCDFVariableFlat.subdevicenames| clarifies which
row of |NetCDFVariableAgg.array| contains which time series.
For 0-dimensional series like |lland_inputs.Nied|, the plain
devi... | 0.001091 |
async def download_media(self, message, file=None,
*, thumb=None, progress_callback=None):
"""
Downloads the given media, or the media from a specified Message.
Note that if the download is too slow, you should consider installing
``cryptg`` (through ``pip i... | 0.001215 |
def add_attributes(self, data, type):
""" add required attributes """
for attr, ancestry in type.attributes():
name = '_%s' % attr.name
value = attr.get_default()
setattr(data, name, value) | 0.008299 |
def take(self, indexer, axis=1, verify=True, convert=True):
"""
Take items along any axis.
"""
self._consolidate_inplace()
indexer = (np.arange(indexer.start, indexer.stop, indexer.step,
dtype='int64')
if isinstance(indexer, slice)
... | 0.002275 |
def map_words(self, start, end):
"""Return a memory-map of the elements `start` through `end`.
The memory map will offer the 8-byte double-precision floats
("elements") in the file from index `start` through to the index
`end`, inclusive, both counting the first float as element 1.
... | 0.001885 |
def get_task_filelist(cls, task_factory, courseid, taskid):
""" Returns a flattened version of all the files inside the task directory, excluding the files task.* and hidden files.
It returns a list of tuples, of the type (Integer Level, Boolean IsDirectory, String Name, String CompleteName)
... | 0.004331 |
def fit(self, x0=None, distribution='lognormal', n=None, **kwargs):
'''Incomplete method to fit experimental values to a curve. It is very
hard to get good initial guesses, which are really required for this.
Differential evolution is promissing. This API is likely to change in
the futur... | 0.006066 |
def get_deck(self):
"""
Returns parent :Deck: of a :Placeable:
"""
trace = self.get_trace()
# Find decks in trace, prepend with [None] in case nothing was found
res = [None] + [item for item in trace if isinstance(item, Deck)]
# Pop last (and hopefully only Deck... | 0.005348 |
def groupcountdistinctvalues(table, key, value):
"""Group by the `key` field then count the number of distinct values in the
`value` field."""
s1 = cut(table, key, value)
s2 = distinct(s1)
s3 = aggregate(s2, key, len)
return s3 | 0.007813 |
def decode_schedule(string):
"""Decodes a string into a schedule tuple.
Args:
string: The string encoding of a schedule tuple.
Returns:
A schedule tuple, see encode_schedule for details.
"""
splits = string.split()
steps = [int(x[1:]) for x in splits[1:] if x[0] == '@']
pmfs = np.reshape(
... | 0.013825 |
def np_lst_sq(vecMdl, aryFuncChnk):
"""Least squares fitting in numpy without cross-validation.
Notes
-----
This is just a wrapper function for np.linalg.lstsq to keep piping
consistent.
"""
aryTmpBts, vecTmpRes = np.linalg.lstsq(vecMdl,
aryFuncCh... | 0.002421 |
def _recover_cfg(self, start=None, end=None, symbols=None, callback=None):
"""Recover CFG
"""
# Retrieve symbol name in case it is available.
if symbols and start in symbols:
name = symbols[start][0]
size = symbols[start][1] - 1 if symbols[start][1] != 0 else 0
... | 0.00237 |
def min_pulse_sp(self):
"""
Used to set the pulse size in milliseconds for the signal that tells the
servo to drive to the miniumum (counter-clockwise) position_sp. Default value
is 600. Valid values are 300 to 700. You must write to the position_sp
attribute for changes to this ... | 0.010684 |
def parseCmdline(self, requestData):
"""
Parse the request command string.
Input:
Self with request filled in.
Output:
Request Handle updated with the parsed information so that
it is accessible via key/value pairs for later processing.
Re... | 0.000731 |
def get(self, what):
"""
Get the ANSI code for 'what'
Returns an empty string if disabled/not found
"""
if self.enabled:
if what in self.colors:
return self.colors[what]
return '' | 0.007813 |
def get_version(self, dependency):
"""Return the installed version parsing the output of 'pip show'."""
logger.debug("getting installed version for %s", dependency)
stdout = helpers.logged_exec([self.pip_exe, "show", str(dependency)])
version = [line for line in stdout if line.startswith... | 0.004213 |
def wash_for_utf8(text, correct=True):
"""Return UTF-8 encoded binary string with incorrect characters washed away.
:param text: input string to wash (can be either a binary or Unicode string)
:param correct: whether to correct bad characters or throw exception
"""
if isinstance(text, unicode):
... | 0.006466 |
def _render_border_line(self, t, settings):
"""
Render box border line.
"""
s = self._es(settings, self.SETTING_WIDTH, self.SETTING_MARGIN, self.SETTING_MARGIN_LEFT, self.SETTING_MARGIN_RIGHT)
w = self.calculate_width_widget(**s)
s = self._es(settings, self.SETTING_BORDER... | 0.008052 |
def get_ruptures_within(dstore, bbox):
"""
Extract the ruptures within the given bounding box, a string
minlon,minlat,maxlon,maxlat.
Example:
http://127.0.0.1:8800/v1/calc/30/extract/ruptures_with/8,44,10,46
"""
minlon, minlat, maxlon, maxlat = map(float, bbox.split(','))
hypo = dstore['... | 0.001988 |
def getboolean_config(section, option, default=False):
'''
Get data from configs which store boolean records
'''
try:
return config.getboolean(section, option) or default
except ConfigParser.NoSectionError:
return default | 0.003891 |
def get_metadata_or_fail(metadata_key):
"""
Call get_metadata; halt with fail() if it raises an exception
"""
try:
return http_get_metadata(metadata_key)
except IOError as error:
fail("Exception in http_get_metadata {} {}".format(metadata_key, repr(error))) | 0.018182 |
def main(conf_file, overwrite, logger):
"""
Create configuration and log file. Restart the daemon when configuration
is done.
Args:
conf_file (str): Path to the configuration file.
overwrite (bool): Overwrite the configuration file with `clean` config?
"""
uid = pwd.getpwnam(get... | 0.001196 |
def data(self, ctx=None):
"""Returns a copy of this parameter on one context. Must have been
initialized on this context before.
Parameters
----------
ctx : Context
Desired context.
Returns
-------
NDArray on ctx
"""
d = self._... | 0.004386 |
def snippetWithLink(self, url):
""" This method will try to return the first
<p> or <div> that contains an <a> tag linking to
the given URL.
"""
link = self.soup.find("a", attrs={'href': url})
if link:
for p in link.parents:
if p.name in ('p', ... | 0.004938 |
def file_describe(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /file-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Files#API-method%3A-%2Ffile-xxxx%2Fdescribe
"""
return DXHTTPRequest('/%s/describe' % object_id, input_p... | 0.008264 |
def validate_schema(cls, tx):
"""Validate the validator election vote transaction. Since `VOTE` extends `TRANSFER`
transaction, all the validations for `CREATE` transaction should be inherited
"""
_validate_schema(TX_SCHEMA_COMMON, tx)
_validate_schema(TX_SCHEMA_TRANSFER, tx)
... | 0.010811 |
def add_table(self, dataframe, isStyled = False):
"""This method stores plain html string."""
if isStyled :
table_string = dataframe.render()
else :
table_string = dataframe.style.render()
table_string = table_string.replace("\n", "").replace("<table... | 0.017241 |
def send_html(self, html, body=None, msgtype="m.text"):
"""Send an html formatted message.
Args:
html (str): The html formatted message to be sent.
body (str): The unformatted body of the message to be sent.
"""
return self.client.api.send_message_event(
... | 0.007519 |
def status_raw(name=None, user=None, conf_file=None, bin_env=None):
'''
Display the raw output of status
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
... | 0.001727 |
def getIRThreshold(self):
"""Returns the IR temperature threshold in degrees Celcius, or 0 if no Threshold is set"""
command = '$GO'
threshold = self.sendCommand(command)
if threshold[0] == 'NK':
return 0
else:
return float(threshold[2])/10 | 0.014706 |
def build_keyjar(key_conf, kid_template="", keyjar=None, owner=''):
"""
Builds a :py:class:`oidcmsg.key_jar.KeyJar` instance or adds keys to
an existing KeyJar based on a key specification.
An example of such a specification::
keys = [
{"type": "RSA", "key": "cp_keys/key.pem", ... | 0.002543 |
def correlation(P, obs1, obs2=None, times=[1], k=None):
r"""Time-correlation for equilibrium experiment.
Parameters
----------
P : (M, M) ndarray
Transition matrix
obs1 : (M,) ndarray
Observable, represented as vector on state space
obs2 : (M,) ndarray (optional)
Second ... | 0.00116 |
def getPk(self):
'''
getPk - @see ForeignLinkData.getPk
'''
if not self.pk or None in self.pk:
for i in range( len(self.pk) ):
if self.pk[i]:
continue
if self.obj[i] and self.obj[i]._id:
self.pk[i] = self.obj[i]._id
return self.pk | 0.05303 |
def first_or_create(cls, parent=None, **attributes):
"""
Attempts to find the first resource with the same attributes, creates the resource if no matches are found.
This will trigger an api GET request and a POST request if the resource does not exist.
:param parent ResourceBase: the par... | 0.009079 |
def still_optimizing(self):
"""True unless converged or maximum iterations/time exceeded."""
# Check if we need to give up on optimizing.
if (self.iterations > self.max_iter) or (self.time_elapsed() > self.max_time):
return False
# Always optimize for at least 'min_iter' it... | 0.006768 |
def _get_nonce(self, url):
"""
Get a nonce to use in a request, removing it from the nonces on hand.
"""
action = LOG_JWS_GET_NONCE()
if len(self._nonces) > 0:
with action:
nonce = self._nonces.pop()
action.add_success_fields(nonce=nonc... | 0.002646 |
def get_relative_positions_of_waypoints(transition_v):
"""This method takes the waypoints of a connection and returns all relative positions of these waypoints.
:param canvas: Canvas to check relative position in
:param transition_v: Transition view to extract all relative waypoint positions
:return: L... | 0.00534 |
def sign_bitcoin(self, message, compressed=False):
""" Signs a message using this private key such that it
is compatible with bitcoind, bx, and other Bitcoin
clients/nodes/utilities.
Note:
0x18 + b\"Bitcoin Signed Message:" + newline + len(message) is
prepended t... | 0.001318 |
def copy(self):
"""
Returns a copy of the datamat.
"""
return self.filter(np.ones(self._num_fix).astype(bool)) | 0.014085 |
def vcs_virtual_ip_address_inband_interface_ve(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
vcs = ET.SubElement(config, "vcs", xmlns="urn:brocade.com:mgmt:brocade-vcs")
virtual = ET.SubElement(vcs, "virtual")
ip = ET.SubElement(virtual, "ip")
... | 0.004021 |
def _add_run_info(self, idx, name='', timestamp=42.0, finish_timestamp=1.337,
runtime='forever and ever', time='>>Maybe time`s gone on strike',
completed=0, parameter_summary='Not yet my friend!',
short_environment_hexsha='N/A'):
"""Adds a new ru... | 0.004885 |
def mouseDoubleClickEvent(self, event):
"""
Overloads when a mouse press occurs. If in editable mode, and the
click occurs on a selected index, then the editor will be created
and no selection change will occur.
:param event | <QMousePressEvent>
"""
... | 0.006515 |
def DAVIDgetGeneAttribute(x,df,refCol="ensembl_gene_id",fieldTOretrieve="gene_name"):
"""
Returns a list of gene names for given gene ids.
:param x: a string with the list of IDs separated by ', '
:param df: a dataframe with the reference column and a the column to retrieve
:param refCol: the heade... | 0.032051 |
def horz_offset(self, offset):
"""
Set the value of ./c:x@val to *offset* and ./c:xMode@val to "factor".
"""
self.get_or_add_xMode().val = ST_LayoutMode.FACTOR
self.get_or_add_x().val = offset | 0.008621 |
def OnClose(self, event):
"""Program exit event handler"""
# If changes have taken place save of old grid
if undo.stack().haschanged():
save_choice = self.interfaces.get_save_request_from_user()
if save_choice is None:
# Cancelled close operation
... | 0.001715 |
def from_spec(spec):
"""
Creates an exploration object from a specification dict.
"""
exploration = util.get_object(
obj=spec,
predefined_objects=tensorforce.core.explorations.explorations
)
assert isinstance(exploration, Exploration)
retur... | 0.006006 |
def destroy(self):
""" Destroy the underlying QWidget object.
"""
self._teardown_features()
focus_registry.unregister(self.widget)
widget = self.widget
if widget is not None:
del self.widget
super(QtGraphicsItem, self).destroy()
# If a QWidget... | 0.003072 |
def pin_chat_message(self, chat_id, message_id, disable_notification=False):
"""
Use this method to pin a message in a supergroup.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
:param chat_id: In... | 0.007528 |
def draw_label(self, layout_info, ax):
"""
Draw facet label onto the axes.
This function will only draw labels if they are needed.
Parameters
----------
layout_info : dict-like
facet information
ax : axes
Axes to label
"""
... | 0.003922 |
def water(target, temperature='pore.temperature', salinity='pore.salinity'):
r"""
Calculates thermal conductivity of pure water or seawater at atmospheric
pressure using the correlation given by Jamieson and Tudhope. Values at
temperature higher the normal boiling temperature are calculated at the
... | 0.00059 |
def normalize_shape(shape):
"""Convenience function to normalize the `shape` argument."""
if shape is None:
raise TypeError('shape is None')
# handle 1D convenience form
if isinstance(shape, numbers.Integral):
shape = (int(shape),)
# normalize
shape = tuple(int(s) for s in sha... | 0.002941 |
def read(cls, proto):
"""
Reads deserialized data from proto object.
:param proto: (DynamicStructBuilder) Proto object
:returns: (:class:TemporalMemory) TemporalMemory instance
"""
tm = object.__new__(cls)
# capnp fails to save a tuple, so proto.columnDimensions was forced to
# serial... | 0.003482 |
def show_ring(devname):
'''
Queries the specified network device for rx/tx ring parameter information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_ring <devname>
'''
try:
ring = ethtool.get_ringparam(devname)
except IOError:
log.error('Ring parameters n... | 0.00202 |
def uid(self, p_todo):
"""
Returns the unique text-based ID for a todo item.
"""
try:
return self._todo_id_map[p_todo]
except KeyError as ex:
raise InvalidTodoException from ex | 0.008333 |
def _determine_termination_policies(termination_policies, termination_policies_from_pillar):
'''
helper method for present. ensure that termination_policies are set
'''
pillar_termination_policies = copy.deepcopy(
__salt__['config.option'](termination_policies_from_pillar, [])
)
if not ... | 0.00431 |
def class_balancing_oversample(X_train=None, y_train=None, printable=True):
"""Input the features and labels, return the features and labels after oversampling.
Parameters
----------
X_train : numpy.array
The inputs.
y_train : numpy.array
The targets.
Examples
--------
... | 0.003188 |
def get_system_info():
'''
Get system information.
Returns:
dict: Dictionary containing information about the system to include
name, description, version, etc...
CLI Example:
.. code-block:: bash
salt 'minion-id' system.get_system_info
'''
def byte_calc(val):
... | 0.000368 |
def rec_load_all(self, zone):
"""
Lists all DNS records for the given domain
:param zone: the domain for which records are being retrieved
:type zone: str
:return:
:rtype: generator
"""
has_more = True
current_count = 0
while has_more:
... | 0.002554 |
def callproc(self, procname, args=()):
"""Execute stored procedure procname with args
procname -- string, name of procedure to execute on server
args -- Sequence of parameters to use with procedure
Returns the original args.
Compatibility warning: PEP-249 specifies that any m... | 0.001058 |
def plot_zt_mu(self, temp=600, output='eig', relaxation_time=1e-14,
xlim=None):
"""
Plot the ZT in function of Fermi level.
Args:
temp: the temperature
xlim: a list of min and max fermi energy by default (0, and band
gap)
ta... | 0.00249 |
def hamiltonian_monte_carlo(
hmc_state: HamiltonianMonteCarloState,
target_log_prob_fn: PotentialFn,
step_size: Any,
num_leapfrog_steps: IntTensor,
momentum: State = None,
kinetic_energy_fn: PotentialFn = None,
momentum_sample_fn: MomentumSampleFn = None,
leapfrog_trace_fn: Callable[[Lea... | 0.005567 |
def loadAnns(self, ids=[]):
"""
Load anns with the specified ids.
:param ids (int array) : integer ids specifying anns
:return: anns (object array) : loaded ann objects
"""
if _isArrayLike(ids):
return [self.anns[id] for id in ids]
elif type(ids)... | 0.005495 |
def _R2deriv(self,R,z,phi=0.,t=0.):
"""
NAME:
_R2deriv
PURPOSE:
evaluate the second radial derivative for this potential
INPUT:
R - Galactocentric cylindrical radius
z - vertical height
phi - azimuth
t - time
OUTPU... | 0.019787 |
def bestLabel(self, prefLanguage="en", qname_allowed=True, quotes=True):
"""
facility for extrating the best available label for an entity
..This checks RFDS.label, SKOS.prefLabel and finally the qname local component
"""
test = self.getValuesForProperty(rdflib.RDFS.label)
... | 0.003979 |
def pull_request(self, number):
"""Get the pull request indicated by ``number``.
:param int number: (required), number of the pull request.
:returns: :class:`PullRequest <github3.pulls.PullRequest>`
"""
json = None
if int(number) > 0:
url = self._build_url('p... | 0.004283 |
def _process_fields(self):
"""Default info massage to appropiate format/style.
This processing is called on preprocess and postprocess, AKA
before and after conversion of fields to appropiate
format/style.
Perfect example: custom fields on certain objects is a mess
(IMH... | 0.004378 |
def _resolve_requirements(self, requirements):
"""
Internal method for resolving requirements into resource configurations.
:param requirements: Resource requirements from test case configuration as dictionary.
:return: Empty list if dut_count cannot be resolved, or nothing
"""
... | 0.002751 |
def create_dockwidget(self):
"""Add to parent QMainWindow as a dock widget"""
# Creating dock widget
dock = SpyderDockWidget(self.get_plugin_title(), self.main)
# Set properties
dock.setObjectName(self.__class__.__name__+"_dw")
dock.setAllowedAreas(self.ALLOWED_AREAS)
... | 0.003308 |
def read_packet(self, timeout=3.0):
"""read one packet, timeout if one packet is not available in the timeout period"""
try:
return self.queue.get(timeout=timeout)
except Empty:
raise InternalTimeoutError("Timeout waiting for packet in AsyncPacketBuffer") | 0.013158 |
def setmin(self, window_name, object_name):
"""
Set min value
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name... | 0.003478 |
def un_camel_case(text):
r"""
Splits apart words that are written in CamelCase.
Bugs:
- Non-ASCII characters are treated as lowercase letters, even if they are
actually capital letters.
Examples:
>>> un_camel_case('1984ZXSpectrumGames')
'1984 ZX Spectrum Games'
>>> un_camel_ca... | 0.00077 |
def forward(self, is_train=False):
"""Perform a forward pass on each executor."""
for texec in self.train_execs:
texec.forward(is_train=is_train) | 0.011561 |
def parse_config_path(args=sys.argv):
"""
Preprocess sys.argv and extract --config argument.
"""
config = CONFIG_PATH
if '--config' in args:
idx = args.index('--config')
if len(args) > idx + 1:
config = args.pop(idx + 1)
args.pop(idx)
return config | 0.003236 |
def _handle_results(self, success, result, expected_failures=tuple()):
"""
Given a bool and a ResultSet (the form returned per result from
Connection.wait_for_responses), return a dictionary containing the
results. Used to process results from asynchronous queries to system
table... | 0.001476 |
def ReadArtifactDefinitionValues(self, artifact_definition_values):
"""Reads an artifact definition from a dictionary.
Args:
artifact_definition_values (dict[str, object]): artifact definition
values.
Returns:
ArtifactDefinition: an artifact definition.
Raises:
FormatError... | 0.004098 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.