text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def save_module(self, obj):
"""
Save a module as an import
"""
self.modules.add(obj)
if _is_dynamic(obj):
self.save_reduce(dynamic_subimport, (obj.__name__, vars(obj)),
obj=obj)
else:
self.save_reduce(subimport, (obj.__... | 0.005917 |
def new_build():
"""Page for crediting or editing a build."""
form = forms.BuildForm()
if form.validate_on_submit():
build = models.Build()
form.populate_obj(build)
build.owners.append(current_user)
db.session.add(build)
db.session.flush()
auth.save_admin_lo... | 0.001414 |
def get_default_ENV(env):
"""
A fiddlin' little function that has an 'import SCons.Environment' which
can't be moved to the top level without creating an import loop. Since
this import creates a local variable named 'SCons', it blocks access to
the global variable, so we move it here to prevent com... | 0.001028 |
def rename_window(self, new_name):
"""
Return :class:`Window` object ``$ tmux rename-window <new_name>``.
Parameters
----------
new_name : str
name of the window
"""
import shlex
lex = shlex.shlex(new_name)
lex.escape = ' '
l... | 0.003503 |
def update(self, E=None, **F):
"""
Update ContextDict from dict/iterable E and F
:return: Nothing
:rtype: None
"""
if E is not None:
if hasattr(E, 'keys'):
for K in E:
self.replace(K, E[K])
elif hasattr(E, 'items... | 0.003683 |
def is_extension_type(arr):
"""
Check whether an array-like is of a pandas extension class instance.
Extension classes include categoricals, pandas sparse objects (i.e.
classes represented within the pandas library and not ones external
to it like scipy sparse matrices), and datetime-like arrays.
... | 0.000669 |
def _find_cellid(self, code):
"""Determines the most similar cell (if any) to the specified code. It
must have at least 50% overlap ratio and have been a loop-intercepted
cell previously.
Args:
code (str): contents of the code cell that were executed.
"""
fro... | 0.004525 |
def lock(self, lock=True, changelist=0):
"""Locks or unlocks the file
:param lock: Lock or unlock the file
:type lock: bool
:param changelist: Optional changelist to checkout the file into
:type changelist: :class:`.Changelist`
"""
cmd = 'lock' if lock else 'unl... | 0.003899 |
def r_division(onarray, offarray, rarray, mode='mean'):
"""Apply R division.
Args:
onarray (decode.array): Decode array of on-point observations.
offarray (decode.array): Decode array of off-point observations.
rarray (decode.array): Decode array of R observations.
mode (str): M... | 0.010546 |
def get_image_descriptor(self, im, xy=None):
""" get_image_descriptor(im, xy=None)
Used for the local color table properties per image.
Otherwise global color table applies to all frames irrespective of
whether additional colors comes in play that require a redefined
palette. St... | 0.002641 |
def select_lamb(self, lamb=None, out=bool):
""" Return a wavelength index array
Return a boolean or integer index array, hereafter called 'ind'
The array refers to the reference time vector self.ddataRef['lamb']
Parameters
----------
lamb : None / float / np.ndarray... | 0.003569 |
def qs_field(
model_class,
field,
filters=None,
formatter=queryset_formatter,
manager_name='objects',
):
"""
Show computed fields based on QuerySet's.
This is a workaround since sometimes some filtering is involved to see if a user
owns and object, is a student, etc.
Example
... | 0.002281 |
def deltas(errors, epsilon, mean, std):
"""Compute mean and std deltas.
delta_mean = mean(errors) - mean(all errors below epsilon)
delta_std = std(errors) - std(all errors below epsilon)
"""
below = errors[errors <= epsilon]
if not len(below):
return 0, 0
return mean - below.mean()... | 0.00295 |
def _wait_threads(self):
"""
Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so.
"""
# Note that you need two loops, since you can't say which
# thread will get each sentinel
for t in self._threads:
self._to_fetc... | 0.004706 |
def authenticate(self, request):
"""
Authenticate a user from a token form field
Errors thrown here will be swallowed by django-rest-framework, and it
expects us to return None if authentication fails.
"""
try:
key = request.data['token']
except KeyEr... | 0.003984 |
def periodogram_auto(self, oversampling=5, nyquist_factor=3,
return_periods=True):
"""Compute the periodogram on an automatically-determined grid
This function uses heuristic arguments to choose a suitable frequency
grid for the data. Note that depending on the data win... | 0.002333 |
def attach_usage_plan_to_apis(plan_id, apis, region=None, key=None, keyid=None, profile=None):
'''
Attaches given usage plan to each of the apis provided in a list of apiId and stage values
.. versionadded:: 2017.7.0
apis
a list of dictionaries, where each dictionary contains the following:
... | 0.006173 |
def peaks(samples):
""" Find the minimum and maximum peak of the samples.
Returns that pair in the order they were found.
So if min was found first, it returns (min, max) else the other way around. """
max_index = numpy.argmax(samples)
max_value = samples[max_index]
min_index = numpy.argmin(sam... | 0.004193 |
def dump(self, stream=None, encoding='utf8', encoding_errors='ignore'): # pylint: disable=arguments-differ
"""Writes a stream to a file.
:param stream:
An ``io.StringIO`` instance. A ``basestring`` is also possible and
get converted to ``io.StringIO``.
:param encoding:... | 0.004121 |
def set_value(self, instance, value):
'''Set the ``value`` for this :class:`Field` in a ``instance``
of a :class:`StdModel`.'''
setattr(instance, self.attname, self.to_python(value)) | 0.010101 |
def upload_custom_service_account_avatar(self, account, avatar):
"""
设置客服帐号的头像。
:param account: 客服账号的用户名
:param avatar: 头像文件,必须是 jpg 格式
:return: 返回的 JSON 数据包
"""
return self.post(
url=
"http://api.weixin.qq.com/customservice/kfaccount/uplo... | 0.006061 |
def cli(context, verbose, api_key, base_url, workers):
'''Planet API Client'''
configure_logging(verbose)
client_params.clear()
client_params['api_key'] = api_key
client_params['workers'] = workers
if base_url:
client_params['base_url'] = base_url | 0.003559 |
def cut_levels(self, loval, hival, no_reset=False):
"""Apply cut levels on the image view.
Parameters
----------
loval, hival : float
Low and high values of the cut levels, respectively.
no_reset : bool
Do not reset ``autocuts`` setting.
"""
... | 0.003175 |
def _render_full_resource(self, instance, include, fields):
"""
Generate a representation of a full resource to match JSON API spec.
:param instance: The instance to serialize
:param include: Dictionary of relationships to include
:param fields: Dictionary of fields to filter
... | 0.000462 |
def encoding_and_executable(notebook, metadata, ext):
"""Return encoding and executable lines for a notebook, if applicable"""
lines = []
comment = _SCRIPT_EXTENSIONS.get(ext, {}).get('comment')
jupytext_metadata = metadata.get('jupytext', {})
if ext not in ['.Rmd', '.md'] and 'executable' in jupyt... | 0.001263 |
def __write_columns(self, pc, table):
"""
Read numeric data from csv and write to the bottom section of the txt file.
:param dict table: Paleodata dictionary
:return none:
"""
logger_lpd_noaa.info("writing section: data, csv values from file")
# get filename for t... | 0.003453 |
def _as_document(self, dataset):
""" Converts dataset to document indexed by to FTS index.
Args:
dataset (orm.Dataset): dataset to convert.
Returns:
dict with structure matches to BaseDatasetIndex._schema.
"""
# find tables.
assert isinstance(... | 0.002886 |
def main():
"""Parse the command line and run :func:`migrate`."""
parser = get_args_parser()
args = parser.parse_args()
config = Config.from_parse_args(args)
migrate(config) | 0.005181 |
def entry_for_view(self, view, perm_name):
"""Get registry entry for permission if ``view`` requires it.
In other words, if ``view`` requires the permission specified by
``perm_name``, return the :class:`Entry` associated with the
permission. If ``view`` doesn't require the permission, ... | 0.003731 |
def set_dns(name, dnsservers=None, searchdomains=None, path=None):
'''
.. versionchanged:: 2015.5.0
The ``dnsservers`` and ``searchdomains`` parameters can now be passed
as a comma-separated list.
Update /etc/resolv.confo
path
path to the container parent
default: /var... | 0.000302 |
def ls_remote(cwd=None,
remote='origin',
ref=None,
opts='',
git_opts='',
user=None,
password=None,
identity=None,
https_user=None,
https_pass=None,
ignore_retcode=False,
... | 0.000906 |
def get_parser(self, **kwargs):
"""This method will create and return a new parser with prog_name,
description, and a config file argument.
"""
self.parser = argparse.ArgumentParser(prog=self.prog_name,
description=self._desc,
... | 0.002509 |
def init_raspbian_vm(self):
"""
Creates an image for running Raspbian in a QEMU virtual machine.
Based on the guide at:
https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki/Emulating-Jessie-image-with-4.1.x-kernel
"""
r = self.local_renderer
r.comment('Inst... | 0.004617 |
def history(name, quiet=False):
'''
Return the history for an image. Equivalent to running the ``docker
history`` Docker CLI command.
name
Container name or ID
quiet : False
If ``True``, the return data will simply be a list of the commands run
to build the container.
... | 0.001481 |
def register_json(self, obj):
"""Register Descriptors from json descriptor objects.
Parameters:
obj(list or dict): descriptors to register
"""
if not isinstance(obj, list):
obj = [obj]
self.register(Descriptor.from_json(j) for j in obj) | 0.006601 |
def fromJson(struct, attributes=None):
"Convert a JSON struct to a Geometry based on its structure"
if isinstance(struct, basestring):
struct = json.loads(struct)
indicative_attributes = {
'x': Point,
'wkid': SpatialReference,
'paths': Polyline,
'rings': Polygon,
... | 0.003549 |
def wrap_command(cmds, data_dirs, cls, strict=True):
"""Wrap a setup command
Parameters
----------
cmds: list(str)
The names of the other commands to run prior to the command.
strict: boolean, optional
Wether to raise errors when a pre-command fails.
"""
class WrappedCommand... | 0.000951 |
def multiplyC(self, alpha):
"""multiply C with a scalar and update all related internal variables (dC, D,...)"""
self.C *= alpha
if self.dC is not self.C:
self.dC *= alpha
self.D *= alpha**0.5 | 0.012712 |
def killCells(self, percent=0.05):
"""
Changes the percentage of cells that are now considered dead. The first
time you call this method a permutation list is set up. Calls change the
number of cells considered dead.
"""
numColumns = numpy.prod(self.getColumnDimensions())
if self.zombiePerm... | 0.005797 |
def values(self):
"""return a list of all state values"""
values = []
for __, data in self.items():
values.append(data)
return values | 0.011299 |
def generate_data(self, data_dir, tmp_dir, task_id=-1):
"""Generates training/dev data.
Args:
data_dir: a string
tmp_dir: a string
task_id: an optional integer
Returns:
shard or shards for which data was generated.
"""
tf.logging.info("generate_data task_id=%s" % task_id)
... | 0.003375 |
def handle_starting_instance(self):
"""Starting up PostgreSQL may take a long time. In case we are the leader we may want to
fail over to."""
# Check if we are in startup, when paused defer to main loop for manual failovers.
if not self.state_handler.check_for_startup() or self.is_pause... | 0.005362 |
def worksheet(self, title):
"""Returns a worksheet with specified `title`.
:param title: A title of a worksheet. If there're multiple
worksheets with the same title, first one will
be returned.
:type title: int
:returns: an instance of :class... | 0.002315 |
def _create_tmpfile(cls, status):
"""Creates a new random-named tmpfile."""
# We can't put the tmpfile in the same directory as the output. There are
# rare circumstances when we leave trash behind and we don't want this trash
# to be loaded into bigquery and/or used for restore.
#
# We used ma... | 0.00438 |
def _index_document(self, identifier, force=False):
""" Adds identifier document to the index. """
query = text("""
INSERT INTO identifier_index(identifier, type, name)
VALUES(:identifier, :type, :name);
""")
self.execute(query, **identifier) | 0.006689 |
def get_user(self, user_id=None, user_name=None):
""" Get a user object from the API. If no ``user_id`` or ``user_name``
is specified, it will return the User object for the currently
authenticated user.
Args:
user_id (int): User ID of the user for whom you want to get
... | 0.003161 |
def get_slot(handler_input, slot_name):
# type: (HandlerInput, str) -> Optional[Slot]
"""Return the slot information from intent request.
The method retrieves the slot information
:py:class:`ask_sdk_model.slot.Slot` from the input intent request
for the given ``slot_name``. More information on the ... | 0.000692 |
def _dbg_output(self):
"""
Returns a string representation of the segments that form this SegmentList
:return: String representation of contents
:rtype: str
"""
s = "["
lst = []
for segment in self._list:
lst.append(repr(segment))
s +=... | 0.00813 |
def html(self, unicode=False):
""" Return HTML of element """
html = lxml.html.tostring(self.element, encoding=self.encoding)
if unicode:
html = html.decode(self.encoding)
return html | 0.008811 |
def extract_srcset(self, srcset):
"""
Handle ``srcset="image.png 1x, image@2x.jpg 2x"``
"""
urls = []
for item in srcset.split(','):
if item:
urls.append(unquote_utf8(item.rsplit(' ', 1)[0]))
return urls | 0.007168 |
def get_parent(self, update=False):
""":returns: the parent node of the current node object."""
if self._meta.proxy_for_model:
# the current node is a proxy model; the returned parent
# should be the same proxy model, so we need to explicitly
# fetch it as an instance... | 0.003344 |
def build_extension(extensions: Sequence[ExtensionHeader]) -> str:
"""
Unparse a ``Sec-WebSocket-Extensions`` header.
This is the reverse of :func:`parse_extension`.
"""
return ", ".join(
build_extension_item(name, parameters) for name, parameters in extensions
) | 0.006734 |
def getPollFDList(self):
"""
Return file descriptors to be used to poll USB events.
You should not have to call this method, unless you are integrating
this class with a polling mechanism.
"""
pollfd_p_p = libusb1.libusb_get_pollfds(self.__context_p)
if not pollfd... | 0.00203 |
def get_interfaces_counters(self):
"""Return interfaces counters."""
query = junos_views.junos_iface_counter_table(self.device)
query.get()
interface_counters = {}
for interface, counters in query.items():
interface_counters[interface] = {
k: v if v is... | 0.004926 |
def helpful_error_list_get(lst, index):
"""
>>> helpful_error_list_get([1, 2, 3], 1)
2
>>> helpful_error_list_get([1, 2, 3], 4)
Traceback (most recent call last):
...
IndexError: Tried to access 4, length is only 3
"""
try:
return lst[index]
except IndexError:
rai... | 0.005076 |
def load_module(module_name, file_path):
"""
Load a module by name and search path
Returns None if Module could not be loaded.
"""
if sys.version_info >= (3,5,):
import importlib.util
spec = importlib.util.spec_from_file_location(module_name, file_path)
if not spec:
... | 0.003623 |
def _count_model(self, model):
"""
return model count
"""
try:
res = model.objects.all().count()
except Exception as e:
self.err(e)
return
return res | 0.008584 |
def vd(inc, sd):
"""
Calculate vertical distance.
:param inc: (float) inclination angle in degrees
:param sd: (float) slope distance in any units
"""
return abs(sd * math.sin(math.radians(inc))) | 0.004545 |
def StringEscape(self, string, match, **unused_kwargs):
"""Escape backslashes found inside a string quote.
Backslashes followed by anything other than ['"rnbt] will just be included
in the string.
Args:
string: The string that matched.
match: the match object (instance of re.MatchObject).
... | 0.005825 |
def _from_dataframe(dataframe, default_type='STRING'):
"""
Infer a BigQuery table schema from a Pandas dataframe. Note that if you don't explicitly set
the types of the columns in the dataframe, they may be of a type that forces coercion to
STRING, so even though the fields in the dataframe themse... | 0.006656 |
def SConscript_exception(file=sys.stderr):
"""Print an exception stack trace just for the SConscript file(s).
This will show users who have Python errors where the problem is,
without cluttering the output with all of the internal calls leading
up to where we exec the SConscript."""
exc_type, exc_va... | 0.001002 |
def parse(cls, text):
"""
Parse the given text. Returns a tuple:
(list_of_parts, start_pos_of_the_last_part).
"""
OUTSIDE, IN_DOUBLE, IN_SINGLE = 0, 1, 2
iterator = enumerate(text)
state = OUTSIDE
parts = []
current_part = ''
part_start_po... | 0.001361 |
def _write_bed_header(self):
"""Writes the BED first 3 bytes."""
# Writing the first three bytes
final_byte = 1 if self._bed_format == "SNP-major" else 0
self._bed.write(bytearray((108, 27, final_byte))) | 0.008511 |
def get_managed_configurations(self):
"""Get the configurations managed by this scheduler
The configuration managed by a scheduler is the self configuration got
by the scheduler during the dispatching.
:return: a dict of scheduler links with instance_id as key and
hash, push_fl... | 0.002664 |
def list_records(after=None, before=None):
'''
Display fault management logs
after : string
filter events after time, see man fmdump for format
before : string
filter events before time, see man fmdump for format
CLI Example:
.. code-block:: bash
salt '*' fmadm.list
... | 0.00128 |
def get(self, uuid):
""" Get one document store into LinShare."""
#return self.core.get("documents/" + uuid)
documents = (v for v in self.list() if v.get('uuid') == uuid)
for i in documents:
self.log.debug(i)
return i
return None | 0.010239 |
def has_cache(self):
"""Intended to be called before any call that might access the
cache. If the cache is not selected, then returns False,
otherwise the cache is build if needed and returns True."""
if not self.cache_enabled:
return False
if self._cache is None:
... | 0.00545 |
def dicom_series_to_nifti(original_dicom_directory, output_file=None, reorient_nifti=True):
""" Converts dicom single series (see pydicom) to nifty, mimicking SPM
Examples: See unit test
will return a dictionary containing
- the NIFTI under key 'NIFTI'
- the NIFTI file path under 'NII_FILE'
-... | 0.003966 |
def close(self):
"""Flushes the pending events and closes the writer after it is done."""
self.flush()
if self._recordio_writer is not None:
self._recordio_writer.close()
self._recordio_writer = None | 0.012146 |
def add_next(self, requester: int, track: dict):
""" Adds a track to beginning of the queue """
self.queue.insert(0, AudioTrack().build(track, requester)) | 0.011628 |
def _expand_libs_in_apps(specs):
"""
Expands specs.apps.depends.libs to include any indirectly required libs
"""
for app_name, app_spec in specs['apps'].iteritems():
if 'depends' in app_spec and 'libs' in app_spec['depends']:
app_spec['depends']['libs'] = _get_dependent('libs', app_n... | 0.0059 |
def get_process_behavior(self, process_id, behavior_ref_name, expand=None):
"""GetProcessBehavior.
[Preview API] Returns a behavior of the process.
:param str process_id: The ID of the process
:param str behavior_ref_name: The reference name of the behavior
:param str expand:
... | 0.005512 |
def scrub_dict(d):
""" Recursively inspect a dictionary and remove all empty values, including
empty strings, lists, and dictionaries.
"""
if type(d) is dict:
return dict(
(k, scrub_dict(v)) for k, v in d.iteritems() if v and scrub_dict(v)
)
elif type(d) is list:
... | 0.002331 |
def marketOhlcDF(token='', version=''):
'''Returns the official open and close for whole market.
https://iexcloud.io/docs/api/#news
9:30am-5pm ET Mon-Fri
Args:
token (string); Access token
version (string); API version
Returns:
DataFrame: result
'''
x = marketOhlc(... | 0.001887 |
def review_metadata_csv_single_user(filedir, metadata, csv_in, n_headers):
"""
Check validity of metadata for single user.
:param filedir: This field is the filepath of the directory whose csv
has to be made.
:param metadata: This field is the metadata generated from the
load_metadata_c... | 0.001241 |
def encode_basestring(s, _PY3=PY3, _q=u('"')):
"""Return a JSON representation of a Python string
"""
if _PY3:
if isinstance(s, binary_type):
s = s.decode('utf-8')
else:
if isinstance(s, str) and HAS_UTF8.search(s) is not None:
s = s.decode('utf-8')
def repla... | 0.004808 |
def _setMotorShutdown(self, value, device, message):
"""
Set the motor shutdown on error status stored on the hardware device.
:Parameters:
value : `int`
An integer indicating the effect on the motors when an error occurs.
device : `int`
The device is... | 0.003448 |
def _calculateError(self, recordNum, bucketIdxList):
"""
Calculate error signal
:param bucketIdxList: list of encoder buckets
:return: dict containing error. The key is the number of steps
The value is a numpy array of error at the output layer
"""
error = dict()
targetDist = ... | 0.004896 |
def get_closest_station(latitude, longitude, minumum_recent_data=20140000,
match_max=100):
'''Query function to find the nearest weather station to a particular
set of coordinates. Optionally allows for a recent date by which the
station is required to be still active at.
... | 0.005922 |
def oriented_bounds(obj, angle_digits=1, ordered=True):
"""
Find the oriented bounding box for a Trimesh
Parameters
----------
obj : trimesh.Trimesh, (n, 2) float, or (n, 3) float
Mesh object or points in 2D or 3D space
angle_digits : int
How much angular precision do we want on o... | 0.000837 |
def get_region(self, x1, y1, x2, y2):
'''Get an image that refers to the given rectangle within this image. The image data is not actually
copied; if the image region is rendered into, it will affect this image.
:param int x1: left edge of the image region to return
:param int y1: top ... | 0.017711 |
def binned_bitsets_by_chrom( f, chrom, chrom_col=0, start_col=1, end_col=2):
"""Read a file by chrom name into a bitset"""
bitset = BinnedBitSet( MAX )
for line in f:
if line.startswith("#"): continue
fields = line.split()
if fields[chrom_col] == chrom:
start, end = int( ... | 0.025581 |
def data(self):
"""Fetch latest data from PyPI, and cache for 30s."""
key = cache_key(self.name)
data = cache.get(key)
if data is None:
logger.debug("Updating package info for %s from PyPI.", self.name)
data = requests.get(self.url).json()
cache.set(ke... | 0.00545 |
def add_base_str(self, base_str, pattern='.+', pattern_base=None,
append=True):
"""
Add further base string to this instance
Parameters
----------
base_str: str or list of str
Strings that are used as to look for keys to get and set keys in
... | 0.001785 |
def _dfs_preorder(node, visited):
"""Iterate through nodes in DFS pre-order."""
if node not in visited:
visited.add(node)
yield node
if node.lo is not None:
yield from _dfs_preorder(node.lo, visited)
if node.hi is not None:
yield from _dfs_preorder(node.hi, visited) | 0.003185 |
def Convert(self, metadata, yara_match, token=None):
"""Convert a single YaraProcessScanMatch."""
conv = ProcessToExportedProcessConverter(options=self.options)
process = list(
conv.Convert(ExportedMetadata(), yara_match.process, token=token))[0]
seen_rules = set()
for m in yara_match.matc... | 0.006791 |
def start(self):
""" Initialize websockets, say hello, and start listening for events
"""
self.connect()
if not self.isAlive():
super(WAMPClient,self).start()
self.hello()
return self | 0.012346 |
def _set_session_ldp_stats(self, v, load=False):
"""
Setter method for session_ldp_stats, mapped from YANG variable /mpls_state/ldp/ldp_session/session_ldp_stats (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_session_ldp_stats is considered as a private
... | 0.005291 |
def parse_node_descriptor(desc, model):
"""Parse a string node descriptor.
The function creates an SGNode object without connecting its inputs and outputs
and returns a 3-tuple:
SGNode, [(input X, trigger X)], <processing function name>
Args:
desc (str): A description of the node to be cr... | 0.003484 |
def abook_file(vcard, bookfile):
"""Write a new Abook file with the given vcards"""
book = ConfigParser(default_section='format')
book['format'] = {}
book['format']['program'] = 'abook'
book['format']['version'] = '0.6.1'
for (i, card) in enumerate(readComponents(vcard.... | 0.004348 |
def get_command_handlers():
'''
Create a map of command names and handlers
'''
return {
'activate': activate,
'config': hconfig,
'deactivate': deactivate,
'help': cli_help,
'kill': kill,
'restart': restart,
'submit': submit,
'update': update,
'version': vers... | 0.009174 |
def root_frame(self):
"""
Returns the parsed results in the form of a tree of Frame objects
"""
if not hasattr(self, '_root_frame'):
self._root_frame = Frame()
# define a recursive function that builds the hierarchy of frames given the
# stack of fram... | 0.004505 |
def serialize_data(data, compression=False, encryption=False, public_key=None):
"""Serializes normal Python datatypes into plaintext using json.
You may also choose to enable compression and encryption when serializing
data to send over the network. Enabling one or both of these options will
incur addi... | 0.000902 |
def is_true(self, item=None):
"""
If you are filtering on object values, you need to pass that object here.
"""
if item:
values = [item]
else:
values = []
self._get_item_and_att_names(*values)
return self._passes_all | 0.010135 |
def nn(self, x, k = 1, radius = np.inf, eps = 0.0, p = 2):
"""Find the k nearest neighbors of x in the observed input data
:arg x: center
:arg k: the number of nearest neighbors to return (default: 1)
:arg eps: approximate nearest neighbors.
the k-th ret... | 0.018393 |
def cache_location():
'''Cross-platform placement of cached files'''
plat = platform.platform()
log.debug('Platform read as: {0}'.format(plat))
if plat.startswith('Windows'):
log.debug('Windows platform detected')
return os.path.join(os.environ['APPDATA'], 'OpenAccess_EPUB')
elif pla... | 0.001974 |
def get(self, service_name, **kwargs):
"""Retrieve data from AppNexus API"""
return self._send(requests.get, service_name, **kwargs) | 0.013514 |
def hisat2_general_stats_table(self):
""" Take the parsed stats from the HISAT2 report and add it to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['overall_alignment_rate'] = {
'title': '% Aligned',
'description': 'overall ali... | 0.003953 |
def send_templated_mail(tpl, subject, context, to=getattr(settings, 'MIDNIGHT_MAIN_ADMIN_EMAIL', 'admin@example.com')):
"""
Отправляет письмо на основе шаблона
:param tpl: шаблон
:param subject: тема письма
:param context: контекст для рендеринга шаблона
:param to: кому слать письмо
:return:... | 0.005848 |
def confd_state_netconf_listen_tcp_port(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
confd_state = ET.SubElement(config, "confd-state", xmlns="http://tail-f.com/yang/confd-monitoring")
netconf = ET.SubElement(confd_state, "netconf")
listen = E... | 0.0053 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.