text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _reset_py_display() -> None:
"""
Resets the dynamic objects in the sys module that the py and ipy consoles fight over.
When a Python console starts it adopts certain display settings if they've already been set.
If an ipy console has previously been run, then py uses its settings and... | 0.007477 |
def read(self, table):
"""..."""
# Table exists
if table in self.by_id:
return self.by_id[table].values()
if table in self.cache:
return self.cache[table]
# Read table
cls = self.FACTORIES[table]
key = cls.KEY
if key:
if table not in self.by_id:
self.by_id[table... | 0.014778 |
def reset( self ):
"""
Resets the colors to the default settings.
"""
dataSet = self.dataSet()
if ( not dataSet ):
dataSet = XScheme()
dataSet.reset() | 0.031963 |
def receive(self, max_batch_size=None, timeout=None):
"""
Receive events from the EventHub.
:param max_batch_size: Receive a batch of events. Batch size will
be up to the maximum specified, but will return as soon as service
returns no new events. If combined with a timeout an... | 0.001592 |
def create_image_summary(name, val):
"""
Args:
name(str):
val(np.ndarray): 4D tensor of NHWC. assume RGB if C==3.
Can be either float or uint8. Range has to be [0,255].
Returns:
tf.Summary:
"""
assert isinstance(name, six.string_types), type(name)
n, h, w, c ... | 0.000858 |
def session(df, start='17:00', end='16:00'):
""" remove previous globex day from df """
if df.empty:
return df
# get start/end/now as decimals
int_start = list(map(int, start.split(':')))
int_start = (int_start[0] + int_start[1] - 1 / 100) - 0.0001
int_end = list(map(int, end.split(':')... | 0.001107 |
def mmGetMetricStabilityConfusion(self):
"""
For each iteration that doesn't follow a reset, looks at every other
iteration for the same world that doesn't follow a reset, and computes the
number of bits that show up in one or the other set of active cells for
that iteration, but not both. This metr... | 0.001727 |
def monkey_patch():
"""
Monkey patches `zmq.Context` and `zmq.Socket`
If test_suite is True, the pyzmq test suite will be patched for
compatibility as well.
"""
ozmq = __import__('zmq')
ozmq.Socket = zmq.Socket
ozmq.Context = zmq.Context
ozmq.Poller = zmq.Poller
ioloop = __impor... | 0.002646 |
def fun_inverse(fun=None, y=0, x0=None, args=(), disp=False, method='Nelder-Mead', **kwargs):
r"""Find the threshold level that accomplishes the desired specificity
Call indicated function repeatedly to find answer to the inverse function evaluation
Arguments:
fun (function): function to be calculate ... | 0.005612 |
def get_triples(self, subject=None, predicate=None, object_=None):
"""Returns triples that correspond to the specified subject,
predicates, and objects."""
for triple in self.triples:
# Filter out non-matches
if subject is not None and triple['subject'] != subject:
... | 0.003578 |
def delete(self):
" Delete the address."
response = self.dyn.delete(self.delete_url)
return response.content['job_id'] | 0.014085 |
def splits_and_paths(self, data_dir):
"""List of pairs (split, paths) for the current epoch."""
filepath_fns = {
problem.DatasetSplit.TRAIN: self.training_filepaths,
problem.DatasetSplit.EVAL: self.dev_filepaths,
problem.DatasetSplit.TEST: self.test_filepaths,
}
def append_epoch... | 0.002882 |
def _convert_data(self, data_type, num_elems, num_values, indata):
'''
Converts "indata" into a byte stream
Parameters:
data_type : int
The CDF file data type
num_elems : int
The number of elements in the data
num_values : in... | 0.000662 |
def offer(self, item, timeout=0):
"""
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity
restrictions. Returns ``true`` upon success. If there is no space currently available:
* If a timeout is provided, it waits until this... | 0.008999 |
def read_json_file(cls, path):
"""
Read an instance from a JSON-formatted file.
:return: A new instance
"""
with open(path, 'r') as f:
return cls.from_dict(json.load(f)) | 0.009009 |
def _gather_reverses(self):
"""
Get all the related objects that point to this
object that we need to clone. Uses self.clone_related
to find those objects.
"""
old_reverses = {'m2m': {}, 'reverse': {}}
for reverse in self.clone_related:
ctype, name, l... | 0.006912 |
def _apply_mask(
data: np.ndarray,
encoded_fill_values: list,
decoded_fill_value: Any,
dtype: Any,
) -> np.ndarray:
"""Mask all matching values in a NumPy arrays."""
data = np.asarray(data, dtype=dtype)
condition = False
for fv in encoded_fill_values:
condition |= data == fv
... | 0.002688 |
def _send_packet(self, data):
" Send to server. "
data = json.dumps(data).encode('utf-8')
# Be sure that our socket is blocking, otherwise, the send() call could
# raise `BlockingIOError` if the buffer is full.
self.socket.setblocking(1)
self.socket.send(data + b'\0') | 0.006289 |
def angle(v1,v2, cos=False):
"""
Find the angle between two vectors.
:param cos: If True, the cosine of the
angle will be returned. False by default.
"""
n = (norm(v1)*norm(v2))
_ = dot(v1,v2)/n
return _ if cos else N.arccos(_) | 0.011538 |
def fit(self, X, y, cost_mat):
""" Build a example-dependent cost-sensitive logistic regression from the training set (X, y, cost_mat)
Parameters
----------
X : array-like of shape = [n_samples, n_features]
The input samples.
y : array indicator matrix
G... | 0.003085 |
def gcal2jd(year, month, day):
"""Gregorian calendar date to Julian date.
The input and output are for the proleptic Gregorian calendar,
i.e., no consideration of historical usage of the calendar is
made.
Parameters
----------
year : int
Year as an integer.
month : int
... | 0.000269 |
async def reseed(self, seed: str = None) -> None:
"""
Rotate key for VON anchor: generate new key, submit to ledger, update wallet.
Raise WalletState if wallet is currently closed.
:param seed: new seed for ed25519 key pair (default random)
"""
LOGGER.debug('BaseAnchor.... | 0.00419 |
def _assert_response_success(self, response):
"""
:type response: requests.Response
:rtype: None
:raise ApiException: When the response is not successful.
"""
if response.status_code != self._STATUS_CODE_OK:
raise ExceptionFactory.create_exception_for_respon... | 0.004149 |
def get_gene_ids(fusion_bed):
"""
Parses FusionInspector bed file to ascertain the ENSEMBL gene ids
:param str fusion_bed: path to fusion annotation
:return: dict
"""
with open(fusion_bed, 'r') as f:
gene_to_id = {}
regex = re.compile(r'(?P<gene>ENSG\d*)')
for line in f:... | 0.001832 |
def locate(self, minimum_version=None, maximum_version=None, jdk=False):
"""Finds a java distribution that meets the given constraints and returns it.
First looks for a cached version that was previously located, otherwise calls locate().
:param minimum_version: minimum jvm version to look for (eg, 1.7).
... | 0.007156 |
def verify_row(self, row):
"""Checks parameter at index *row* for invalidating conditions
:returns: str -- message if error, 0 otherwise
"""
param = self._parameters[row]
if param['parameter'] == '':
return "Auto-parameter type undefined"
if len(param['select... | 0.00313 |
def __uncache(self, file):
"""
Uncaches given file.
:param file: File to uncache.
:type file: unicode
"""
if file in self.__files_cache:
self.__files_cache.remove_content(file) | 0.008403 |
def create_key_for_data(prefix, data, key_params):
"""
From ``data`` params in task create corresponding key with help of ``key_params`` (defined in decorator)
"""
d = data.get_data()
values = []
for k in key_params:
if k in d and type(d[k]) is list:
values.append("{0}:{1}".f... | 0.003906 |
def A2(self):
"""
If the "qop" directive's value is "auth" or is unspecified, then A2 is:
A2 = Method ":" digest-uri-value
Else,
A2 = Method ":" digest-uri-value ":" H(entity-body)
"""
if self.params['qop'] == 'auth' or not self.params['qop']:
... | 0.004155 |
def search_with_retry(self, sleeptime=3.0, retrycount=3, **params):
"""
This function performs a search given a dictionary of search(..)
parameters. It accounts for server timeouts as necessary and
will retry some number of times.
@param sleeptime: number of seconds to sleep bet... | 0.002804 |
def relStdDev(self, limit=None):
"""return the relative standard deviation optionally limited to the last limit values"""
moments = self.meanAndStdDev(limit)
if moments is None:
return None
return moments[1] / moments[0] | 0.011364 |
def prepare_working_directory(job, submission_path, validator_path):
'''
Based on two downloaded files in the working directory,
the student submission and the validation package,
the working directory is prepared.
We unpack student submission first, so that teacher files overwrite
them in case... | 0.002357 |
def _build_module_db(self):
"""
Build database of module callables sorted by line number.
The database is a dictionary whose keys are module file names and
whose values are lists of dictionaries containing name and line
number of callables in that module
"""
tdic... | 0.002195 |
def write_csv(filename, header, data=None, rows=None, mode="w"):
"""Write the data to the specified filename
Usage
-----
>>> write_csv(filename, header, data, mode=mode)
Parameters
----------
filename : str
The name of the file
header : list of strings
The names of... | 0.003193 |
def copy(self):
"""
Returns a duplicate of this instance.
:return <Query>
"""
options = {
'op': self.__op,
'caseSensitive': self.__caseSensitive,
'value': copy.copy(self.__value),
'inverted': self.__inverted,
'funct... | 0.004228 |
def diff(self, cursor='null', **kwargs):
"""文件增量更新操作查询接口.
本接口有数秒延迟,但保证返回结果为最终一致.
:param cursor: 用于标记更新断点。
* 首次调用cursor=null;
* 非首次调用,使用最后一次调用diff接口的返回结果
中的cursor。
:type cursor: str
:return: Response 对象
... | 0.004329 |
def xml_parser(self, scode, *args):
"""
args[0]: xpath
args[1]: text / html / xml
"""
allow_method = ('text', 'html', 'xml')
xpath_string, method = args
assert method in allow_method, 'method allow: %s' % allow_method
result = self.ensure_list(
... | 0.003333 |
def short_help(i):
"""
Input: {
}
Output: {
return - return code = 0, if successful
> 0, if error
(error) - error text if return > 0
help - help text
}
"""
o=i.get('... | 0.027586 |
def _set_next_vrf_list(self, v, load=False):
"""
Setter method for next_vrf_list, mapped from YANG variable /rbridge_id/route_map/content/set/ipv6/next_vrf/next_vrf_list (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_next_vrf_list is considered as a private
m... | 0.00463 |
def _read_signer(key_filename):
"""Reads the given file as a hex key.
Args:
key_filename: The filename where the key is stored. If None,
defaults to the default key for the current user.
Returns:
Signer: the signer
Raises:
CliException: If unable to read the file.
... | 0.000907 |
def parse(self, filename, verbose=0):
"""
Parse the given file. Return :class:`EventReport`.
"""
run_completed, start_datetime, end_datetime = False, None, None
filename = os.path.abspath(filename)
report = EventReport(filename)
w = WildCard("*Error|*Warning|*Com... | 0.007792 |
def _parse_hz(self,hz,Hz,dHzdz):
"""
NAME:
_parse_hz
PURPOSE:
Parse the various input options for Sigma* functions
HISTORY:
2016-12-27 - Written - Bovy (UofT/CCA)
"""
if isinstance(hz,dict):
hz= [hz]
try:
nh... | 0.021758 |
def env(section, map_files, phusion, phusion_path, quiet, edit, create):
"""
Reads the file defined by the S3CONF variable and output its contents to stdout. Logs are printed to stderr.
See options for added functionality: editing file, mapping files, dumping in the phusion-baseimage format, etc.
"""
... | 0.003797 |
def logout(self):
"""
Logout from steam. Doesn't nothing if not logged on.
.. note::
The server will drop the connection immediatelly upon logout.
"""
if self.logged_on:
self.logged_on = False
self.send(MsgProto(EMsg.ClientLogOff))
... | 0.008264 |
def fatal(self, i: int=None) -> str:
"""
Returns a fatal error message
"""
head = "[" + colors.red("\033[1mfatal error") + "]"
if i is not None:
head = str(i) + " " + head
return head | 0.016461 |
def _init_design_chooser(self):
"""
Initializes the choice of X and Y based on the selected initial design and number of points selected.
"""
# If objective function was not provided, we require some initial sample data
if self.f is None and (self.X is None or self.Y is None):
... | 0.007792 |
def copy(self):
"""
Returns a copy of this Markov Model.
Returns
-------
MarkovModel: Copy of this Markov model.
Examples
-------
>>> from pgmpy.factors.discrete import DiscreteFactor
>>> from pgmpy.models import MarkovModel
>>> G = Marko... | 0.001724 |
def create_build_from_buildrequest(self, build_request):
"""
render provided build_request and submit build from it
:param build_request: instance of build.build_request.BuildRequest
:return: instance of build.build_response.BuildResponse
"""
build_request.set_openshift_... | 0.005236 |
def thermal_fit_result(fit_result, v_residual=None,
v_label='Unit-cell volume $(\mathrm{\AA}^3)$',
temp_fitline=np.asarray(
[300., 1000., 1500., 2000., 2500., 3000.]),
figsize=(5, 5), height_ratios=(3, 1), ms_data=50,
... | 0.000792 |
def fcoe_fcoe_fabric_map_fcoe_fip_advertisement_fcoe_fip_advertisement_interval(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt:brocade-fcoe")
fcoe_fabric_map = ET.SubElement(fcoe, "fcoe-fa... | 0.00905 |
def mode(self):
"""Computes the mode of a log-normal distribution built with the stats data."""
mu = self.mean()
sigma = self.std()
ret_val = math.exp(mu - sigma**2)
if math.isnan(ret_val):
ret_val = float("inf")
return ret_val | 0.010453 |
def setFormula(self, Formula=None):
"""Set the Dependent Services from the text of the calculation Formula
"""
bsc = getToolByName(self, 'bika_setup_catalog')
if Formula is None:
self.setDependentServices(None)
self.getField('Formula').set(self, Formula)
e... | 0.002933 |
def check_perf():
"Suggest how to improve the setup to speed things up"
from PIL import features, Image
from packaging import version
print("Running performance checks.")
# libjpeg_turbo check
print("\n*** libjpeg-turbo status")
if version.parse(Image.PILLOW_VERSION) >= version.parse("5.3... | 0.004915 |
def iter_terms(fs, conj=False):
"""Iterate through all min/max terms in an N-dimensional Boolean space.
The *fs* argument is a sequence of :math:`N` Boolean functions.
If *conj* is ``False``, yield minterms.
Otherwise, yield maxterms.
"""
for num in range(1 << len(fs)):
yield num2term(... | 0.002994 |
def delete_site(self, webspace_name, website_name,
delete_empty_server_farm=False, delete_metrics=False):
'''
Delete a website.
webspace_name:
The name of the webspace.
website_name:
The name of the website.
delete_empty_server_farm:
... | 0.003086 |
def find_spelling(n):
"""
Finds d, r s.t. n-1 = 2^r * d
"""
r = 0
d = n - 1
# divmod used for large numbers
quotient, remainder = divmod(d, 2)
# while we can still divide 2's into n-1...
while remainder != 1:
r += 1
d = quotient # previous quotient before ... | 0.002525 |
def clear_old_backups(self, block_id):
"""
If we limit the number of backups we make, then clean out old ones
older than block_id - backup_max_age (given in the constructor)
This method does nothing otherwise.
Return None on success
Raise exception on error
"""
... | 0.010127 |
def t_backquote(self, t):
r'`'
t.lexer.string_start = t.lexer.lexpos
t.lexer.string_value = ''
t.lexer.push_state('backquote') | 0.012658 |
def private_config_content(self, private_config):
"""
Update the private config
:param private_config: content of the private configuration file
"""
try:
private_config_path = os.path.join(self.working_dir, "private-config.cfg")
if private_config is Non... | 0.00528 |
def _code_line(self, line):
"""Add a code line."""
assert self._containers
container = self._containers[-1]
# Handle extra spaces.
text = line
while text:
if text.startswith(' '):
r = re.match(r'(^ +)', text)
n = len(r.group(1)... | 0.002849 |
def shell_exec(command, **kwargs): # from gitapi.py
"""Excecutes the given command silently.
"""
proc = Popen(shlex.split(command), stdout=PIPE, stderr=PIPE, **kwargs)
out, err = [x.decode("utf-8") for x in proc.communicate()]
return {'out': out, 'err': err, 'code': proc.returncode} | 0.023649 |
def create(self, pools):
"""
Method to create pool's
:param pools: List containing pool's desired to be created on database
:return: None
"""
data = {'server_pools': pools}
return super(ApiPool, self).post('api/v3/pool/', data) | 0.007018 |
def assigned(self, user, include=None):
"""
Retrieve the assigned tickets for this user.
:param include: list of objects to sideload. `Side-loading API Docs
<https://developer.zendesk.com/rest_api/docs/core/side_loading>`__.
:param user: User object or id
"""
... | 0.009804 |
def _msg_name(self, container, max_width):
"""Build the container name."""
name = container['name']
if len(name) > max_width:
name = '_' + name[-max_width + 1:]
else:
name = name[:max_width]
return ' {:{width}}'.format(name, width=max_width) | 0.006557 |
def click_event(event):
"""On click, bring the cell under the cursor to Life"""
grid_x_coord = int(divmod(event.x, cell_size)[0])
grid_y_coord = int(divmod(event.y, cell_size)[0])
world[grid_x_coord][grid_y_coord].value = True
color = world[x][y].color_alive.get_as_hex()
canvas.itemconfig(canvas... | 0.002732 |
def minimizeSPSA(func, x0, args=(), bounds=None, niter=100, paired=True,
a=1.0, alpha=0.602, c=1.0, gamma=0.101,
disp=False, callback=None):
"""
Minimization of an objective function by a simultaneous perturbation
stochastic approximation algorithm.
This algorithm appr... | 0.003926 |
def _process_return_multi_z_attr(self, data, attr_names, var_names, sub_num_elems):
'''process and attach data from fortran_cdf.get_multi_*'''
# process data
for i, (attr_name, var_name, num_e) in enumerate(zip(attr_names, var_names, sub_num_elems)):
if var_name not in self.meta.key... | 0.007092 |
def _get_bradcrack_data(bravais):
r"""Read Bradley--Cracknell k-points path from data file
Args:
bravais (str): Lattice code including orientation e.g. 'trig_p_c'
Returns:
dict: kpoint path and special point locations, formatted as e.g.::
{'kpoints': {'\G... | 0.003063 |
def price_name_stacks(name, namespace, block_height):
"""
Get a name's price in Stacks, regardless of whether or not
the namespace it was created in was created before Stacks
existed. This is because any name can be purchased with
Stacks. If the namespace price curve was meant for BTC
(per it... | 0.004124 |
def lists(self):
""" :class:`Lists feed <pypump.models.feed.Lists>` with all lists
owned by the person.
Example:
>>> for list in pump.me.lists:
... print(list)
...
Acquaintances
Family
Coworkers
Friends
... | 0.004367 |
def partition_dumps(self):
"""Yeild a set of manifest object that parition the dumps.
Simply adds resources/files to a manifest until their are either the
the correct number of files or the size limit is exceeded, then yields
that manifest.
"""
manifest = self.manifest_c... | 0.002237 |
def as_nonlinear(self, params=None):
"""Return a `Model` equivalent to this object. The nonlinear solver is less
efficient, but lets you freeze parameters, compute uncertainties, etc.
If the `params` argument is provided, solve() will be called on the
returned object with those paramete... | 0.003667 |
def get(cls):
"""
Use the masking function (``sigprocmask(2)`` or ``pthread_sigmask(3)``)
to obtain the mask of blocked signals
:returns:
A fresh :class:`sigprocmask` object.
The returned object behaves as it was constructed with the list of
currently blocke... | 0.002043 |
def get_fw_version():
"""
Try to get version of the framework. First try pkg_resources.require, if that fails
read from setup.py
:return: Version as str
"""
version = 'unknown'
try:
pkg = require(get_fw_name())[0]
except DistributionNotFound:
# Icetea is not installed. tr... | 0.002116 |
def get_decoder(encoding, *args, **kwargs):
"""
Returns a L{codec.Decoder} capable of decoding AMF[C{encoding}] streams.
@raise ValueError: Unknown C{encoding}.
"""
def _get_decoder_class():
if encoding == AMF0:
try:
from cpyamf import amf0
except Imp... | 0.001416 |
def grab_earliest(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Grab the earliest data from the buffer, blocking until one is available."""
timeout = timeout if timeout is not None else 10.0
with self.__buffer_lock:
if len(self.__buffer) == 0:
... | 0.008798 |
def set_ipcsem_params(self, ftok=None, persistent=None):
"""Sets ipcsem lock engine params.
:param str|unicode ftok: Set the ipcsem key via ftok() for avoiding duplicates.
:param bool persistent: Do not remove ipcsem's on shutdown.
"""
self._set('ftok', ftok)
self._set... | 0.007614 |
def cycle_canceling(self, display):
'''
API:
cycle_canceling(self, display)
Description:
Solves minimum cost feasible flow problem using cycle canceling
algorithm. Returns True when an optimal solution is found, returns
False otherwise. 'flow' attr... | 0.001131 |
def get_path_list(args, nni_config, trial_content, temp_nni_path):
'''get path list according to different platform'''
path_list, host_list = parse_log_path(args, trial_content)
platform = nni_config.get_config('experimentConfig').get('trainingServicePlatform')
if platform == 'local':
print_norm... | 0.00438 |
def _get_lottery_detail_by_id(self, id):
"""
相应彩种历史信息生成
百度详细信息页有两种结构,需要分开处理
"""
header = '编号 期号 开奖日期 开奖号码'.split()
pt = PrettyTable()
pt._set_field_names(header)
url = QUERY_DETAIL_URL.format(id=id)
import requests
content = requests.get(u... | 0.001144 |
def tune(runner, kernel_options, device_options, tuning_options):
""" Find the best performing kernel configuration in the parameter space
:params runner: A runner from kernel_tuner.runners
:type runner: kernel_tuner.runner
:param kernel_options: A dictionary with all options for the kernel.
:type... | 0.001365 |
def attribute_is_visible(self, permission):
""" Checks privacy options to see if an attribute is visible to public
"""
try:
parent = getattr(self, "parent_{}".format(permission))
student = getattr(self, "self_{}".format(permission))
return (parent and student)... | 0.008016 |
def search(self, evaluation, data):
"""
Performs the search and returns the indices of the selected attributes.
:param evaluation: the evaluation algorithm to use
:type evaluation: ASEvaluation
:param data: the data to use
:type data: Instances
:return: the selec... | 0.004304 |
def get_worksheets_section(self):
""" Returns the section dictionary related with Worksheets,
that contains some informative panels (like
WS to be verified, WS with results pending, etc.)
"""
out = []
bc = getToolByName(self.context, CATALOG_WORKSHEET_LISTING)
... | 0.000964 |
def get(key, default='', merge=False, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.14
Attempt to retrieve the named value from pillar, if the named value is not
available return the passed default. The default return is an empty string.
If the merge parameter is set to ``True``, the de... | 0.001356 |
def _get_attachment_data(self, id, filename):
"""
Retrieve the contents of a specific attachment (identified by filename).
"""
uri = '/'.join([self.base_url, self.name, id, 'Attachments', filename])
return uri, {}, 'get', None, None, False | 0.010753 |
def raster_to_shape(raster):
"""Take a raster and return a polygon representing the outer edge."""
left = raster.bounds.left
right = raster.bounds.right
top = raster.bounds.top
bottom = raster.bounds.bottom
top_left = (left, top)
top_right = (right, top)
bottom_left = (left, bottom)
... | 0.002242 |
def _split_field_to_single_value(field):
"""Convert number field values split by a '/' to a single number value."""
split_field = re.match(r'(\d+)/\d+', field)
return split_field.group(1) or field | 0.0199 |
def summarization(self, summarization):
"""Sets the summarization of this Chart.
Summarization strategy for the chart. MEAN is default # noqa: E501
:param summarization: The summarization of this Chart. # noqa: E501
:type: str
"""
allowed_values = ["MEAN", "MEDIAN", ... | 0.003012 |
def run_from_argv(self, argv):
"""
Called by the system when executing the command from the command line.
This should not be overridden.
:param argv: Arguments from command line
"""
parser = self.create_parser(argv[0], argv[1])
options = parser.parse_args... | 0.004405 |
def subproc_map(self, f, items):
"""Map function `f` over `items` in subprocesses and return the result.
:API: public
:param f: A multiproc-friendly (importable) work function.
:param items: A iterable of pickleable arguments to f.
"""
try:
# Pool.map (and async_map().get() w/o tim... | 0.015021 |
def updateCache(self, service, url, new_data, new_data_dt):
"""
:param new_data: a string representation of the data
:param new_data_dt: a timezone aware datetime object giving
the timestamp of the new_data
:raise MemcachedException: if update failed
"""
k... | 0.001196 |
def process_module(self, node):
"""Process the astroid node stream."""
if self.config.file_header:
if sys.version_info[0] < 3:
pattern = re.compile(
'\A' + self.config.file_header, re.LOCALE | re.MULTILINE)
else:
# The use of re... | 0.004728 |
def handle_starttag(self, tag, attrs):
"""Return representation of html start tag and attributes."""
if tag in self.mathml_elements:
final_attr = ""
for key, value in attrs:
final_attr += ' {0}="{1}"'.format(key, value)
self.fed.append("<{0}{1}>".forma... | 0.0059 |
def gcg(a, b, M, reg1, reg2, f, df, G0=None, numItermax=10,
numInnerItermax=200, stopThr=1e-9, verbose=False, log=False):
"""
Solve the general regularized OT problem with the generalized conditional gradient
The function solves the following optimization problem:
.. math::
\gamma ... | 0.007006 |
def is_error_retryable(request, exc):
"""
Return ``True`` if the exception is recognized as :term:`retryable error`.
This will return ``False`` if the request is on its last attempt.
This will return ``False`` if ``pyramid_retry`` is inactive for the
request.
"""
if is_last_attempt(request... | 0.002222 |
def _get_converter(self, convert_to=None):
'''see convert and save. This is a helper function that returns
the proper conversion function, but doesn't call it. We do this
so that in the case of convert, we do the conversion and return
a string. In the case of save, we save the ... | 0.004994 |
def read_validate_params(self, request):
"""
Reads and validates data in an incoming request as required by
the Authorization Request of the Authorization Code Grant and the
Implicit Grant.
"""
self.client = self.client_authenticator.by_identifier(request)
respon... | 0.003205 |
def update(self, other, copy=True, *args, **kwargs):
"""Update this element related to other element.
:param other: same type than this.
:param bool copy: copy other before update attributes.
:param tuple args: copy args.
:param dict kwargs: copy kwargs.
:return: this"""... | 0.002336 |
def __query_safebrowsing(self, search_value, search_type):
"""
The actual query to safebrowsing api
:param search_value: value to search for
:type search_value: str
:param search_type: 'url' or 'ip'
:type search_type: str
:return: Results
:rtype: ... | 0.004754 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.