text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _check_client_settings(self, request):
"""
This method checks any client settings configured for this service to call other services, calls the `status`
action of each configured service with `verbose: False` (which guarantees no further recursive status checking),
adds that diagnost... | 0.005393 |
def negate_gate(wordlen, input='x', output='~x'):
"""Implements two's complement negation."""
neg = bitwise_negate(wordlen, input, "tmp")
inc = inc_gate(wordlen, "tmp", output)
return neg >> inc | 0.004762 |
def server_add_and_update_opts(*args, **kwargs):
"""
shared collection of options for `globus transfer endpoint server add` and
`globus transfer endpoint server update`.
Accepts a toggle to know if it's being used as `add` or `update`.
usage:
>>> @server_add_and_update_opts
>>> def command... | 0.000977 |
def get(self):
"""Returns the current VARP configuration
The Varp resource returns the following:
* mac_address (str): The virtual-router mac address
* interfaces (dict): A list of the interfaces that have a
virtual-router address configured.
... | 0.001957 |
def md_to_pdf(input_name, output_name):
"""
Converts an input MarkDown file to a PDF of the given output name.
Parameters
==========
input_name : String
Relative file location of the input file to where this function is being called.
output_name : String
Relative file location of the o... | 0.005682 |
def encode(self, word):
"""Return the MRA personal numeric identifier (PNI) for a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The MRA PNI
Examples
--------
>>> pe = MRA()
... | 0.002283 |
def set_max(self):
"""Set the charger to max range for trips."""
if not self.__maxrange_state:
data = self._controller.command(self._id, 'charge_max_range',
wake_if_asleep=True)
if data['response']['result']:
self.__maxr... | 0.005141 |
def log_player_buys_city(self, player, location):
"""
:param player: catan.game.Player
:param location: string, see hexgrid.location()
"""
self._logln('{0} buys city, builds at {1}'.format(
player.color,
location
)) | 0.006969 |
def process_data(self, file_info):
"""expects FileInfo"""
if self._is_already_processed(file_info):
self.log.debug("Content file already processed '%s'", str(file_info))
self.fire(events.FilteredFile(file_info))
self.fire(events.FileInfoAlreadyProcessed(file_info))
... | 0.007895 |
def write_lines(self, lines, encoding=None, errors='strict',
linesep=os.linesep, append=False):
r""" Write the given lines of text to this file.
By default this overwrites any existing file at this path.
This puts a platform-specific newline sequence on every line.
... | 0.001384 |
def extract_datetime_hour(cls, datetime_str):
"""
Tries to extract a `datetime` object from the given string, including only hours.
Raises `DateTimeFormatterException` if the extraction fails.
"""
if not datetime_str:
raise DateTimeFormatterException('datetime_str mu... | 0.01049 |
def Log(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex:
"""
Returns the natural logarithm, base e, of a vertex
:param input_vertex: the vertex
"""
return Double(context.jvm_view().LogVertex, label, cast_to_double_vertex(input_vertex)) | 0.020339 |
def fill_arg(self, *args):
"""
If we get a single positional argument, and only a single
variable needs to be filled, fill that variable with
the value from that positional argument.
"""
missing = self.missing_vars()
if len(args) == len(missing) == 1:
... | 0.005682 |
def confusion_matrix(self, metrics=None, thresholds=None):
"""
Get the confusion matrix for the specified metric
:param metrics: A string (or list of strings) among metrics listed in :const:`max_metrics`. Defaults to 'f1'.
:param thresholds: A value (or list of values) between 0 and 1.
... | 0.004487 |
def update(self, spec, document, upsert=False, manipulate=False,
multi=False, check_keys=True, **kwargs):
"""Update a document(s) in this collection.
**DEPRECATED** - Use :meth:`replace_one`, :meth:`update_one`, or
:meth:`update_many` instead.
.. versionchanged:: 3.0
... | 0.001862 |
def reversed(self):
"""returns a copy of the QuadraticBezier object with its orientation
reversed."""
new_quad = QuadraticBezier(self.end, self.control, self.start)
if self._length_info['length']:
new_quad._length_info = self._length_info
new_quad._length_info['bp... | 0.004914 |
def add_arguments(cls, parser, sys_arg_list=None):
"""
Arguments for the Multi health monitor plugin.
"""
parser.add_argument('--multi_plugins',
dest='multi_plugins', required=True,
help="Column seperated list of health monitor "
... | 0.003325 |
def get_configuration(self, key, default=None):
"""Returns the configuration for KEY"""
if key in self.config:
return self.config.get(key)
else:
return default | 0.009662 |
def _get_distinct_objs(objs):
"""
Return a list with distinct elements of "objs" (different ids).
Preserves order.
"""
ids = set()
res = []
for obj in objs:
if not id(obj) in ids:
ids.add(id(obj))
res.append(obj)
return res | 0.003484 |
def getArguments(parser):
"Provides additional validation of the arguments collected by argparse."
args = parser.parse_args()
# get the number of dimensions in the image
if args.example:
args.example_image, args.example_header = load(args.example)
dimensions = args.example_image.ndim
... | 0.005212 |
def rpad(self, ecc, k=None):
'''Automatically right pad with null bytes an ecc to fill for missing bytes if too small, or leave unchanged if not necessary. This can be used as a workaround for field delimiter misdetection. Equivalent to puncturing (punctured reed-solomon code).'''
if not k: k = self.k
... | 0.009524 |
def fetchUnseen(self):
"""
Get the unseen (new) thread list
:return: List of unseen thread ids
:rtype: list
:raises: FBchatException if request failed
"""
j = self._post(
self.req_url.UNSEEN_THREADS, None, fix_request=True, as_json=True
)
... | 0.004525 |
def registerWorker(self, name, worker):
"""
Register a new Worker, under the given descriptive name.
Trying to register multiple workers under the same name will raise an Exception.
Parameters
----------
name: string
Name to register the given worker under.
worker: multiprocessing.Process, or a subcl... | 0.026128 |
def dc_element(self, parent, name, text):
"""Add DC element `name` containing `text` to `parent`."""
if self.dc_uri in self.namespaces:
dcel = SchemaNode(self.namespaces[self.dc_uri] + ":" + name,
text=text)
parent.children.insert(0,dcel) | 0.00974 |
def dump(self, msg):
'''
Dumps the provided message to this dump.
'''
msg_size = len(msg)
# We start a new batch if the resulting batch file is larger than the
# max batch file size. However, if the current batch file size is zero
# then that means the message al... | 0.001387 |
def from_str(cls, input_string, fmt, primitive=False, sort=False,
merge_tol=0.0):
"""
Reads a structure from a string.
Args:
input_string (str): String to parse.
fmt (str): A format specification.
primitive (bool): Whether to find a primitive... | 0.001425 |
def check_groups_on_profile_update(sender, instance, created, *args, **kwargs):
"""
Trigger check when main character or state changes.
"""
AutogroupsConfig.objects.update_groups_for_user(instance.user) | 0.004587 |
def _get_storage(cls, uri):
"""
Given a URI like local:///srv/repo or s3://key:secret@apt.example.com,
return a libcloud storage or container object.
"""
driver = cls._get_driver(uri.scheme)
key = uri.username
secret = uri.password
container = uri.netloc
... | 0.001963 |
def add(self, observation, action, reward, terminal, *args):
"""Append artificial_done to *args and run parent method."""
# If this will be a problem for maintenance, we could probably override
# DQNAgent.add() method instead.
artificial_done = self._artificial_done and terminal
args = list(args)
... | 0.004 |
def make_directory(self, directory_name, *args, **kwargs):
""" :meth:`.WNetworkClientProto.make_directory` method implementation
"""
self.dav_client().mkdir(self.join_path(self.session_path(), directory_name)) | 0.023256 |
def gridSnap(point, grid=1.0):
"""cause the given point to snap to nearest X/Y grid point"""
def snapFunc(value):
value += 0.000001 # ensure values that are close to a half grid value round up
remainder = value%grid
value -= remainder
newAdd = round(remainder/grid)*grid
r... | 0.016588 |
def get_batch(sequence, size, start=0, endpoint=None, complete=False):
""" create a batched result record out of a sequence (catalog brains)
"""
batch = make_batch(sequence, size, start)
return {
"pagesize": batch.get_pagesize(),
"next": batch.make_next_url(),
"previous": batch... | 0.001684 |
def pivot_by_group(
df,
variable,
value,
new_columns,
groups,
id_cols=None
):
"""
Pivot a dataframe by group of variables
---
### Parameters
*mandatory :*
* `variable` (*str*): name of the column used to create the groups.
* `value` (*str*):... | 0.00253 |
def load(self, key=None):
# type: (Hashable) -> Promise
"""
Loads a key, returning a `Promise` for the value represented by that key.
"""
if key is None:
raise TypeError(
(
"The loader.load() function must be called with a value,"
... | 0.004188 |
def get_private_key_from_wif(wif: str) -> bytes:
"""
This interface is used to decode a WIF encode ECDSA private key.
:param wif: a WIF encode private key.
:return: a ECDSA private key in the form of bytes.
"""
if wif is None or wif is "":
raise Exception("no... | 0.002976 |
def toggle_badge(self, kind):
'''Toggle a bdage given its kind'''
badge = self.get_badge(kind)
if badge:
return self.remove_badge(kind)
else:
return self.add_badge(kind) | 0.008889 |
def SegmentMax(a, ids):
"""
Segmented max op.
"""
func = lambda idxs: np.amax(a[idxs], axis=0)
return seg_map(func, a, ids), | 0.013889 |
def main():
"""Sanitizes the loaded *.ipynb."""
with open(sys.argv[1], 'r') as nbfile:
notebook = json.load(nbfile)
# remove kernelspec (venvs)
try:
del notebook['metadata']['kernelspec']
except KeyError:
pass
# remove outputs and metadata, set execution counts to None
... | 0.001513 |
def key(self, key, strictkey=None):
"""
Return a chunk referencing a key in a mapping with the name 'key'.
"""
return self._select(self._pointer.key(key, strictkey)) | 0.010152 |
def read(self, key, array=False, embedded=True):
"""Read method of CRUD operation for working with KeyValue DB.
This method will automatically check to see if a single variable is passed
or if "mixed" data is passed and return the results from the DB. It will also
automatically determin... | 0.002656 |
def __perform_request(self, url, type=GET, params=None):
"""
This method will perform the real request,
in this way we can customize only the "output" of the API call by
using self.__call_api method.
This method will return the request object.
"""
... | 0.002925 |
def get_min_sec_from_morning(self):
"""Get the first second from midnight where a timerange is effective
:return: smallest amount of second from midnight of all timerange
:rtype: int
"""
mins = []
for timerange in self.timeranges:
mins.append(timerange.get_se... | 0.005525 |
def dump_dict(dict_input, indent=4):
"""
辞書型変数を文字列に変換して返す
"""
dict_work = dict(dict_input)
"""
for key, value in six.iteritems(dict_input):
if any([f(value) for f in (is_float, isDict, is_list_or_tuple)]):
dict_work[key] = value
continue
try:
... | 0.001104 |
def python(self, cmd):
"""Execute a python script using the virtual environment python."""
python_bin = self.cmd_path('python')
cmd = '{0} {1}'.format(python_bin, cmd)
return self._execute(cmd) | 0.008889 |
def delete(self, uri, default_response=None):
"""
Call DELETE on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.delete('/users/5')
:param uri: String with the URI you w... | 0.003827 |
def build_config(dataset, datasets_dir, phase, problem=None, output_dir='data/output'):
"""
root@d3m-example-pod:/# cat /input/185_baseball/test_config.json
{
"problem_schema": "/input/TEST/problem_TEST/problemDoc.json",
"problem_root": "/input/TEST/problem_TEST",
"dataset_schema": "/input... | 0.000982 |
def helices(self):
"""Generates new `Assembly` containing just α-helices.
Notes
-----
Metadata is not currently preserved from the parent object.
Returns
-------
hel_assembly : ampal.Protein
`Assembly` containing only the α-helices of the original `A... | 0.005042 |
def max_bit_rate(self):
"""
Returns a tuple with the maximun upstream- and downstream-rate
of the given connection. The rate is given in bits/sec.
"""
status = self.fc.call_action('WANCommonInterfaceConfig',
'GetCommonLinkProperties')
... | 0.004301 |
def set(self, key, value):
"""Set a value in the task context
"""
task = Task.current_task()
try:
context = task._context
except AttributeError:
task._context = context = {}
context[key] = value | 0.007519 |
def getOrderVectorsEGMM(self):
"""
Returns a list of lists, one for each preference, of candidates ordered from most preferred
to least. Note that ties are not indicated in the returned lists. Also returns a list of
the number of times each preference is given.
"""
order... | 0.008529 |
def segs_safe(self, word):
"""Return a list of segments (as strings) from a word
Characters that are not valid segments are included in the list as
individual characters.
Args:
word (unicode): word as an IPA string
Returns:
list: list of Unicode IPA str... | 0.002933 |
def scaled_pressure2_send(self, time_boot_ms, press_abs, press_diff, temperature, force_mavlink1=False):
'''
Barometer readings for 2nd barometer
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
press_abs :... | 0.011173 |
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the rational (numerator / denominator) value at *value_offset*
in *stream_rdr* as a floating-point number. Only supports single
values at present.
"""
if value_count == 1:
numerat... | 0.003584 |
def get_config(path):
"""Load a config from disk
:param path: target config
:type path: unicode
:return:
:rtype: configparser.Config
"""
if configparser is None:
return None
# Check for env specific configs first
if os.path.exists(os.path.join(ROOT, 'config', NAME, path)):
... | 0.001282 |
def trace_plots(self, analytes=None, samples=None, ranges=False,
focus=None, outdir=None, filt=None, scale='log',
figsize=[10, 4], stats=False, stat='nanmean',
err='nanstd', subset='All_Analyses'):
"""
Plot analytes as a function of time.
... | 0.002813 |
def highlight_region(plt, start_x, end_x):
"""
Highlight a region on the chart between the specified start and end x-co-ordinates.
param pyplot plt: matplotlibk pyplot which contains the charts to be highlighted
param string start_x : epoch time millis
param string end_x : epoch time millis
"""
start_x = ... | 0.016842 |
def findGap(song):
"""Return the position of silence in a song"""
try:
silence = pd.silence.detect_silence(song)
except IOError:
print("There isn't a song there!")
maxlength = 0
for pair in silence:
length = pair[1] - pair[0]
if length >= maxlength:
maxl... | 0.002681 |
def resize_contain(image, size, resample=Image.LANCZOS, bg_color=(255, 255, 255, 0)):
"""
Resize image according to size.
image: a Pillow image instance
size: a list of two integers [width, height]
"""
img_format = image.format
img = image.copy()
img.thumbnail((size[0], size[1... | 0.003115 |
def execute_command(self):
"""
The generate command uses `Jinja2 <http://jinja.pocoo.org/>`_ templates \
to create Python scripts, according to the specification in the configuration \
file. The predefined templates use the extract_content() method of the \
:ref:`selector classes... | 0.007779 |
def list_public_containers(self):
"""
Returns a list of the names of all CDN-enabled containers.
"""
resp, resp_body = self.api.cdn_request("", "GET")
return [cont["name"] for cont in resp_body] | 0.008547 |
def _get_image(self):
"""
Prepare watermark image
:return: Image.Image
"""
if self.image is None:
image_path = '%s/%s' % (current_app.static_folder, os.path.normpath(self.image_path))
try:
self.image = Image.open(image_path)
... | 0.00616 |
def dict_union_combine(dict1, dict2, combine_op=op.add,
default=util_const.NoParam,
default2=util_const.NoParam):
"""
Combine of dict keys and uses dfault value when key does not exist
CAREFUL WHEN USING THIS WITH REDUCE. Use dict_stack2 instead
"""
key... | 0.002857 |
def _write_conf(conf, path=MAIN_CF):
'''
Write out configuration file.
'''
with salt.utils.files.fopen(path, 'w') as fh_:
for line in conf:
line = salt.utils.stringutils.to_str(line)
if isinstance(line, dict):
fh_.write(' '.join(line))
else:
... | 0.002653 |
def add(self, recv):
"""
Add a :class:`mitogen.core.Receiver`, :class:`Select` or
:class:`mitogen.core.Latch` to the select.
:raises mitogen.select.Error:
An attempt was made to add a :class:`Select` to which this select
is indirectly a member of.
"""
... | 0.003067 |
def _set_tk_config(self, keys, value):
"""
Gets the config from the widget's tk object
:param string/List keys:
The tk config key or a list of tk keys.
:param variable value:
The value to set. If the value is `None`, the config value will be
reset to... | 0.002656 |
def register_model(self, model_cls):
"""Decorator for registering model."""
if not getattr(model_cls, '_database_'):
raise ModelAttributeError('_database_ missing '
'on %s!' % model_cls.__name__)
if not getattr(model_cls, '_collection_'):
... | 0.003442 |
def follower_num(self):
"""获取问题关注人数.
:return: 问题关注人数
:rtype: int
"""
follower_num_block = self.soup.find('div', class_='zg-gray-normal')
# 无人关注时 找不到对应block,直接返回0 (感谢知乎用户 段晓晨 提出此问题)
if follower_num_block is None or follower_num_block.strong is None:
re... | 0.005305 |
def buffer_wipe(editor, force=False):
"""
Wipe buffer.
"""
eb = editor.window_arrangement.active_editor_buffer
if not force and eb.has_unsaved_changes:
editor.show_message(_NO_WRITE_SINCE_LAST_CHANGE_TEXT)
else:
editor.window_arrangement.close_buffer() | 0.003425 |
def new_worker_redirected_log_file(self, worker_id):
"""Create new logging files for workers to redirect its output."""
worker_stdout_file, worker_stderr_file = (self.new_log_files(
"worker-" + ray.utils.binary_to_hex(worker_id), True))
return worker_stdout_file, worker_stderr_file | 0.006289 |
def get_instance(self, payload):
"""
Build an instance of VoipInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance
:rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInsta... | 0.007491 |
def b58ToC32(b58check, version=-1):
"""
>>> b58ToC32('1FzTxL9Mxnm2fdmnQEArfhzJHevwbvcH6d')
'SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7'
>>> b58ToC32('3GgUssdoWh5QkoUDXKqT6LMESBDf8aqp2y')
'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G'
>>> b58ToC32('mvWRFPELmpCHSkFQ7o9EVdCd9eXeUTa9T8')
'ST2J6ZY48G... | 0.001255 |
def get_dem(bounds, out_file="dem.tif", src_crs="EPSG:3005", dst_crs="EPSG:3005", resolution=25):
"""Get 25m DEM for provided bounds, write to GeoTIFF
"""
bbox = ",".join([str(b) for b in bounds])
# todo: validate resolution units are equivalent to src_crs units
# build request
payload = {
... | 0.00202 |
def main():
"""
NAME
plot_magmap.py
DESCRIPTION
makes a color contour map of desired field model
SYNTAX
plot_magmap.py [command line options]
OPTIONS
-h prints help and quits
-f FILE specify field model file with format: l m g h
-fmt [pdf,eps,svg,... | 0.002942 |
def getLVstats(self, *args):
"""Returns I/O stats for LV.
@param args: Two calling conventions are implemented:
- Passing two parameters vg and lv.
- Passing only one parameter in 'vg-lv' format.
@return: Dict of stats.
""... | 0.006242 |
def enable_cache():
"""Enable requests library cache."""
try:
import requests_cache
except ImportError as err:
sys.stderr.write('Failed to enable cache: {0}\n'.format(str(err)))
return
if not os.path.exists(CACHE_DIR):
os.makedirs(CACHE_DIR)
requests_cache.install_cac... | 0.002994 |
def this_machine(self, machineid=None):
"""Add match for _MACHINE_ID equal to the ID of this machine.
If specified, machineid should be either a UUID or a 32 digit hex
number.
Equivalent to add_match(_MACHINE_ID='machineid').
"""
if machineid is None:
machin... | 0.004246 |
def key_value_convert(dictin, keyfn=lambda x: x, valuefn=lambda x: x, dropfailedkeys=False, dropfailedvalues=False,
exception=ValueError):
# type: (DictUpperBound, Callable[[Any], Any], Callable[[Any], Any], bool, bool, ExceptionUpperBound) -> Dict
"""Convert keys and/or values of dictiona... | 0.006089 |
def cmd_ok(cmd):
"""Returns True if cmd can be run.
"""
try:
sp.check_call(cmd, stderr=sp.PIPE, stdout=sp.PIPE)
except sp.CalledProcessError:
# bwa gives return code of 1 with no argument
pass
except:
sys.stderr.write("{} not found, skipping\n".format(cmd))
r... | 0.008646 |
def del_feed(name):
"""remove from database (and delete aliases)"""
with Database("aliases") as aliases, Database("feeds") as feeds:
if aliases[name]:
proper_name = aliases[name]
elif feeds[name]:
proper_name = feeds[name]
for k, v in aliases:
if v == ... | 0.002353 |
def export(self, Height=None, options=None, outputFile=None, Resolution=None,\
Units=None, Width=None, Zoom=None, view="current", verbose=False):
"""
Exports the current view to a graphics file and returns the path to the
saved file. PNG and JPEG formats have options for scaling, whi... | 0.014073 |
def makedirs(path, mode=0o777, exist_ok=False):
"""A wrapper of os.makedirs()."""
os.makedirs(path, mode, exist_ok) | 0.00813 |
def get_format_names(cls):
"""
:return: Available format names.
:rtype: list
:Example:
.. code:: python
>>> import pytablewriter as ptw
>>> for name in ptw.TableWriterFactory.get_format_names():
... print(name)
... | 0.001429 |
def recheck(self, infohash_list):
"""
Recheck torrents.
:param infohash_list: Single or list() of infohashes.
"""
data = self._process_infohash_list(infohash_list)
return self._post('command/recheck', data=data) | 0.007692 |
def do_POST(self):
"""Handles the HTTP POST request.
Attempts to interpret all HTTP POST requests as XML-RPC calls,
which are forwarded to the server's _dispatch method for handling.
"""
# Check that the path is legal
if not self.is_rpc_path_valid():
self.re... | 0.001659 |
def allocate_observation_matrix(self):
"""!
@brief Allocates observation matrix in line with output dynamic of the network.
@details Matrix where state of each neuron is denoted by zero/one in line with Heaviside function on each iteration.
@return (list) Observation matrix... | 0.012392 |
def joinpaths(self, *paths):
"""Mimic os.path.join using the specified path_separator.
Args:
*paths: (str) Zero or more paths to join.
Returns:
(str) The paths joined by the path separator, starting with
the last absolute path in paths.
"""
... | 0.001702 |
def export(self, queryset=None, *args, **kwargs):
"""
Exports a resource.
"""
self.before_export(queryset, *args, **kwargs)
if queryset is None:
queryset = self.get_queryset()
headers = self.get_export_headers()
data = tablib.Dataset(headers=headers)... | 0.002729 |
def get_collections(module_ident, plpy):
"""Get all the collections that the module is part of."""
# Make sure to only return one match per collection and only if it is the
# latest collection (which may not be the same as what is in
# latest_modules)
plan = plpy.prepare('''
WITH RECURSIVE t(node, p... | 0.000865 |
def ow_search(self, vid=0xBC, pid=None, name=None):
"""Search for specific memory id/name and return it"""
for m in self.get_mems(MemoryElement.TYPE_1W):
if pid and m.pid == pid or name and m.name == name:
return m
return None | 0.007168 |
def sodium_pad(s, blocksize):
"""
Pad the input bytearray ``s`` to a multiple of ``blocksize``
using the ISO/IEC 7816-4 algorithm
:param s: input bytes string
:type s: bytes
:param blocksize:
:type blocksize: int
:return: padded string
:rtype: bytes
"""
ensure(isinstance(s, ... | 0.001217 |
def on_click(self, event):
"""
Control moc with mouse clicks.
"""
button = event["button"]
if button == self.button_pause:
if self.state == "STOP":
self.py3.command_run("mocp --play")
else:
self.py3.command_run("mocp --toggl... | 0.003063 |
def handle_new(path, **kwargs):
""":return: new repo.Local instance"""
log.info('new: %s %s' %(path, kwargs))
repo = Local.new(path=path, **kwargs)
return repo.serialize() | 0.010695 |
def equivalent_to(std_function):
"""
Decorates a cloud object compatible function
to provides fall back to standard function if
used on local files.
Args:
std_function (function): standard function to
used with local files.
Returns:
function: new function
"""
... | 0.001015 |
def role_revoke(auth=None, **kwargs):
'''
Grant a role in a project/domain to a user/group
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_revoke name=role1 user=user1 project=project1
salt '*' keystoneng.role_revoke name=ddbe3e0ed74e4c7f8027bad4af03339d group=user1 project... | 0.004815 |
def _send(self, send_method, service_name, data=None, **kwargs):
"""Send a request to the AppNexus API (used for internal routing)
:param send_method: The method sending the request (usualy requests.*)
:type send_method: function
:param service_name: The target service
:param da... | 0.00128 |
def parse_tables(self, markup):
""" Returns a list of tables in the markup.
A Wikipedia table looks like:
{| border="1"
|-
|Cell 1 (no modifier - not aligned)
|-
|align="right" |Cell 2 (right aligned)
|-
|}
"""
tables = ... | 0.005774 |
def get_id_generator(self, name):
"""
Creates cluster-wide :class:`~hazelcast.proxy.id_generator.IdGenerator`.
:param name: (str), name of the IdGenerator proxy.
:return: (:class:`~hazelcast.proxy.id_generator.IdGenerator`), IdGenerator proxy for the given name.
"""
atom... | 0.012422 |
def get_dimension_by_name(dimension_name,**kwargs):
"""
Given a dimension name returns all its data. Used in convert functions
"""
try:
if dimension_name is None:
dimension_name = ''
dimension = db.DBSession.query(Dimension).filter(func.lower(Dimension.name)==func.lower(d... | 0.009294 |
def allowed(self, context):
"""Checks for role based access for this dashboard.
Checks for access to any panels in the dashboard and of the
dashboard itself.
This method should be overridden to return the result of
any policy checks required for the user to access this dashboar... | 0.002551 |
def put_bits( self, path_or_tuple,
folder_id=None, folder_path=None, frag_bytes=None,
raw_id=False, chunk_callback=None ):
'''Upload a file (object) using BITS API (via several http requests), possibly
overwriting (default behavior) a file with the same "name" attribute, if it exists.
Unlike "put" metho... | 0.030849 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.