text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _verify_encoding(self, enc):
"""Verify encoding is okay."""
enc = PYTHON_ENCODING_NAMES.get(enc, enc)
try:
codecs.getencoder(enc)
encoding = enc
except LookupError:
encoding = None
return encoding | 0.00722 |
def _transform_should_cast(self, func_nm):
"""
Parameters:
-----------
func_nm: str
The name of the aggregation function being performed
Returns:
--------
bool
Whether transform should attempt to cast the result of aggregation
"""
... | 0.004662 |
def render_layout_form(form, layout=None, **kwargs):
"""Render an entire form with Semantic UI wrappers for each field with
a layout provided in the template or in the form class
Args:
form (form): Django Form
layout (tuple): layout design
kwargs (dict): other attributes will be passed to fields
... | 0.034991 |
def update(self, forecasts, observations):
"""
Update the ROC curve with a set of forecasts and observations
Args:
forecasts: 1D array of forecast values
observations: 1D array of observation values.
"""
for t, threshold in enumerate(self.thresholds):
... | 0.003432 |
def y0(x, context=None):
"""
Return the value of the second kind Bessel function of order 0 at x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_y0,
(BigFloat._implicit_convert(x),),
context,
) | 0.003759 |
def parse_ctcp(query):
""" Strip and de-quote CTCP messages. """
query = query.strip(CTCP_DELIMITER)
query = query.replace(CTCP_ESCAPE_CHAR + '0', '\0')
query = query.replace(CTCP_ESCAPE_CHAR + 'n', '\n')
query = query.replace(CTCP_ESCAPE_CHAR + 'r', '\r')
query = query.replace(CTCP_ESCAPE_CHAR ... | 0.004587 |
def remove_absolute_impute__r2(X, y, model_generator, method_name, num_fcounts=11):
""" Remove Absolute (impute)
xlabel = "Max fraction of features removed"
ylabel = "1 - R^2"
transform = "one_minus"
sort_order = 9
"""
return __run_measure(measures.remove_impute, X, y, model_generator, metho... | 0.00813 |
def merge_equal_neighbors(self):
""" Merge neighbors with same speaker. """
IDX_LENGTH = 3
merged = self.segs.copy()
current_start = 0
j = 0
seg = self.segs.iloc[0]
for i in range(1, self.num_segments):
seg = self.segs.iloc[i]
last = self.... | 0.007013 |
def add_tag(self, tag):
"""
Adds a tag to the list of tags and makes sure the result list contains only unique results.
"""
self.tags = list(set(self.tags or []) | set([tag])) | 0.014218 |
def storage_uri_for_key(key):
"""Returns a StorageUri for the given key.
:type key: :class:`boto.s3.key.Key` or subclass
:param key: URI naming bucket + optional object.
"""
if not isinstance(key, boto.s3.key.Key):
raise InvalidUriError('Requested key (%s) is not a subclass of '
... | 0.001848 |
def get_docstring(node):
"""
Return the docstring for the given node or `None` if no docstring can be
found. If the node provided does not accept docstrings a `TypeError`
will be raised.
"""
if not isinstance(node, (FunctionDef, ClassDef, Module)):
raise TypeError("%r can't have docstri... | 0.002309 |
def reshuffle(expr, by=None, sort=None, ascending=True):
"""
Reshuffle data.
:param expr:
:param by: the sequence or scalar to shuffle by. RandomScalar as default
:param sort: the sequence or scalar to sort.
:param ascending: True if ascending else False
:return: collection
"""
by ... | 0.001898 |
def set_title(self, title):
"""
Set title. You can set multiple titles.
:Args:
- title: Title value
"""
self.title = title
self.add_metadata('DC', 'title', self.title) | 0.008772 |
def get_idx(self, arr:Collection, is_item:bool=True):
"Fetch item or user (based on `is_item`) for all in `arr`. (Set model to `cpu` and no grad.)"
m = self.model.eval().cpu()
requires_grad(m,False)
u_class,i_class = self.data.train_ds.x.classes.values()
classes = i_class if is_i... | 0.021157 |
def compute_qpi(self):
"""Compute model data with current parameters
Returns
-------
qpi: qpimage.QPImage
Modeled phase data
Notes
-----
The model image might deviate from the fitted image
because of interpolation during the fitting process.
... | 0.002721 |
def to_svg(self, instruction_or_id,
i_promise_not_to_change_the_result=False):
"""Return the SVG for an instruction.
:param instruction_or_id: either an
:class:`~knittingpattern.Instruction.Instruction` or an id
returned by :meth:`get_instruction_id`
:param bo... | 0.003667 |
def alias_log_entry(self, log_entry_id, alias_id):
"""Adds an ``Id`` to a ``LogEntry`` for the purpose of creating compatibility.
The primary ``Id`` of the ``LogEntry`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to... | 0.002688 |
def cursor(lcd, row, col):
"""
Context manager to control cursor position. DEPRECATED.
"""
warnings.warn('The `cursor` context manager is deprecated', DeprecationWarning)
lcd.cursor_pos = (row, col)
yield | 0.008772 |
def stop_sequence(self):
"""Return the sorted StopTimes for this trip."""
return sorted(
self.stop_times(),
key=lambda x:int(x.get('stop_sequence'))
) | 0.011494 |
def covfilter(args):
"""
%prog covfilter blastfile fastafile
Fastafile is used to get the sizes of the queries. Two filters can be
applied, the id% and cov%.
"""
from jcvi.algorithms.supermap import supermap
from jcvi.utils.range import range_union
allowed_iterby = ("query", "query_sbj... | 0.00341 |
def post(self, request):
"""
POST /consent/api/v1/data_sharing_consent
Requires a JSON object of the following format:
>>> {
>>> "username": "bob",
>>> "course_id": "course-v1:edX+DemoX+Demo_Course",
>>> "enterprise_customer_uuid": "enterprise-uuid-go... | 0.004714 |
def update_free_shipping_by_id(cls, free_shipping_id, free_shipping, **kwargs):
"""Update FreeShipping
Update attributes of FreeShipping
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.update_... | 0.005469 |
def _alter_code(code, **attrs):
"""Create a new code object by altering some of ``code`` attributes
Args:
code: code objcect
attrs: a mapping of names of code object attrs to their values
"""
PyCode_New = ctypes.pythonapi.PyCode_New
PyCode_New.argtypes = (
ctypes.c_int,
... | 0.000489 |
def read_qemu_img_stdout(self):
"""
Reads the standard output of the QEMU-IMG process.
"""
output = ""
if self._qemu_img_stdout_file:
try:
with open(self._qemu_img_stdout_file, "rb") as file:
output = file.read().decode("utf-8", er... | 0.006237 |
def symmetrized_csiszar_function(logu, csiszar_function, name=None):
"""Symmetrizes a Csiszar-function in log-space.
A Csiszar-function is a member of,
```none
F = { f:R_+ to R : f convex }.
```
The symmetrized Csiszar-function is defined as:
```none
f_g(u) = 0.5 g(u) + 0.5 u g (1 / u)
```
wher... | 0.001633 |
def get_unit_property(self, unit_id, property_name):
'''This function rerturns the data stored under the property name given
from the given unit.
Parameters
----------
unit_id: int
The unit id for which the property will be returned
property_name: str
... | 0.002937 |
def setChecked(src, ids=[], dpth = 0, key = ''):
""" Recursively find checked item."""
#tabs = lambda n: ' ' * n * 4 # or 2 or 8 or...
#brace = lambda s, n: '%s%s%s' % ('['*n, s, ']'*n)
if isinstance(src, dict):
for key, value in src.iteritems():
setChecked(value, ids, dpth + 1, key... | 0.023217 |
def SetDefaultValue(self, scan_object):
"""Sets the default (non-match) value.
Args:
scan_object: a scan object, either a scan tree sub node (instance of
PathFilterScanTreeNode) or a string containing a path.
Raises:
TypeError: if the scan object is of an unsupported type.
... | 0.0059 |
def _pprint(params, offset=0, printer=repr):
"""Pretty print the dictionary 'params'
Parameters
----------
params: dict
The dictionary to pretty print
offset: int
The offset in characters to add at the begin of each line.
printer:
The function to convert entries to str... | 0.001179 |
def toseries(self, chunk_size='auto'):
"""
Converts to series data.
This method is equivalent to images.toblocks(size).toSeries().
Parameters
----------
chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto'
String interprete... | 0.006506 |
def add(config, username, filename):
"""Add user's SSH public key to their LDAP entry."""
try:
client = Client()
client.prepare_connection()
user_api = UserApi(client)
key_api = API(client)
key_api.add(username, user_api, filename)
exce... | 0.002915 |
def _compute_diff(configured, expected):
'''Computes the differences between the actual config and the expected config'''
diff = {
'add': {},
'update': {},
'remove': {}
}
configured_users = set(configured.keys())
expected_users = set(expected.keys())
add_usernames = e... | 0.003376 |
def get_file_to_bytes(self, share_name, directory_name, file_name,
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, timeout=None):
'''
Downloads a file as an array of bytes, with automatic chunking a... | 0.010593 |
def find_duplicates(items, k=2, key=None):
"""
Find all duplicate items in a list.
Search for all items that appear more than `k` times and return a mapping
from each (k)-duplicate item to the positions it appeared in.
Args:
items (Iterable): hashable items possibly containing duplicates
... | 0.000453 |
def fits2radec(fitsfn: Path, solve: bool=False, args: str=None) -> xarray.Dataset:
fitsfn = Path(fitsfn).expanduser()
if fitsfn.suffix == '.fits':
WCSfn = fitsfn.with_suffix('.wcs') # using .wcs will also work but gives a spurious warning
elif fitsfn.suffix == '.wcs':
WCSfn = fitsfn
e... | 0.006567 |
def make_tokens_list(dir_, filters):
"""Find sources.json in <dir_>. It contains a list of tokenized texts. For
each tokenized text listed in sources.json, read its tokens, filter them,
and add them to an aggregated list. Write the aggregated list to disk using
a filename based on the <filters> given.
... | 0.003342 |
def convert_tree(message, config, indent=0, wrap_alternative=True, charset=None):
"""Recursively convert a potentially-multipart tree.
Returns a tuple of (the converted tree, whether any markdown was found)
"""
ct = message.get_content_type()
cs = message.get_content_subtype()
if charset is Non... | 0.001985 |
def sealedbox_encrypt(data, **kwargs):
'''
Encrypt data using a public key generated from `nacl.keygen`.
The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key.
CLI Examples:
.. code-block:: bash
salt-run nacl.sealedbox_encrypt datatoenc
salt-ca... | 0.005658 |
def list_domains(self):
""" Return all domains. Domain is a key, so group by them """
self.connect()
results = self.server.list_domains(self.session_id)
return {i['domain']: i['subdomains'] for i in results} | 0.008368 |
def send_message(self, message, mention_id=None, mentions=[]):
"""
Send the specified message to twitter, with appropriate mentions, tokenized as necessary
:param message: Message to be sent
:param mention_id: In-reply-to mention_id (to link messages to a previous message)
:param... | 0.005447 |
def next_board(board, wrap):
"""Given a board, return the board one interation later.
Adapted from Jack Diedrich's implementation from his 2012 PyCon talk "Stop
Writing Classes"
:arg wrap: A callable which takes a point and transforms it, for example
to wrap to the other edge of the screen. Re... | 0.001978 |
def find_next(start, stop, i2hits):
"""
which protein has the best hit, the one to the 'right' or to the 'left?'
"""
if start not in i2hits and stop in i2hits:
index = stop
elif stop not in i2hits and start in i2hits:
index = start
elif start not in i2hits and stop not in i2hits:... | 0.001311 |
def deleted_count(self):
"""The number of documents deleted."""
if isinstance(self.raw_result, list):
return len(self.raw_result)
else:
return self.raw_result | 0.009709 |
def logging_syslog_server_secure(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
logging = ET.SubElement(config, "logging", xmlns="urn:brocade.com:mgmt:brocade-ras")
syslog_server = ET.SubElement(logging, "syslog-server")
syslogip_key = ET.SubEle... | 0.004545 |
def serialise_to_rsh(params: dict) -> str:
"""Преобразование конфигурационного файла в формате JSON в текстовый хедер.
rsh. Хедер можно использовать как конфигурационный файл для lan10-12base
@params -- параметры в формате JSON (dfparser.def_values.DEF_RSH_PARAMS)
@return -- текстовый хедер
"""
... | 0.000635 |
def _incremental_compile_module(
optimizer: PythonASTOptimizer,
py_ast: GeneratedPyAST,
mod: types.ModuleType,
source_filename: str,
collect_bytecode: Optional[BytecodeCollector] = None,
) -> None:
"""Incrementally compile a stream of AST nodes in module mod.
The source_filename will be pas... | 0.001117 |
def _cube_dict(self):
"""dict containing raw cube response, parsed from JSON payload."""
try:
cube_response = self._cube_response_arg
# ---parse JSON to a dict when constructed with JSON---
cube_dict = (
cube_response
if isinstance(cube... | 0.002732 |
def get_url_report(self, this_url, scan='0', allinfo=1):
""" Get the scan results for a URL.
:param this_url: A URL for which you want to retrieve the most recent report. You may also specify a scan_id
(sha256-timestamp as returned by the URL submission API) to access a specific report. At the ... | 0.007803 |
def setup(app):
"""
Just connects the docstring pre_processor and should_skip functions to be
applied on all docstrings.
"""
app.connect('autodoc-process-docstring',
lambda *args: pre_processor(*args, namer=audiolazy_namer))
app.connect('autodoc-skip-member', should_skip) | 0.013378 |
def spherical_variogram_model(m, d):
"""Spherical model, m is [psill, range, nugget]"""
psill = float(m[0])
range_ = float(m[1])
nugget = float(m[2])
return np.piecewise(d, [d <= range_, d > range_],
[lambda x: psill * ((3.*x)/(2.*range_) - (x**3.)/(2.*range_**3.)) + nu... | 0.005848 |
def set_weekly(self, interval, *, days_of_week, first_day_of_week,
**kwargs):
""" Set to repeat every week on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param str first_day_of_week: starting day for a week
:param list[str] da... | 0.004255 |
def _stage_local_files(local_dir, local_files={}):
"""
Either ``local_files`` and/or ``context`` should be supplied.
Will stage a ``local_files`` dictionary of path:filename pairs where path
is relative to ``local_dir`` into a local tmp staging directory.
Returns a path to the temporary lo... | 0.012567 |
def _get_api_key(self):
"""
Get Opsgenie api_key for creating alert
"""
conn = self.get_connection(self.http_conn_id)
api_key = conn.password
if not api_key:
raise AirflowException('Opsgenie API Key is required for this hook, '
... | 0.007712 |
def make(self, cwl):
"""Instantiate a CWL object from a CWl document."""
load = load_tool.load_tool(cwl, self.loading_context)
if isinstance(load, int):
raise Exception("Error loading tool")
return Callable(load, self) | 0.007634 |
def emit_function(self, return_type=None, argtypes=[], proxy=True):
"""Compiles code and returns a Python-callable function."""
if argtypes is not None:
make_func = ctypes.CFUNCTYPE(return_type, *argtypes)
else:
make_func = ctypes.CFUNCTYPE(return_type)
# NOTE: ... | 0.001733 |
def get_services(root, hosts_map, view=None):
''' Gets a list of objects representing the Nagios services.
Each object contains the Nagios hostname, service name, service display
name, and service health summary.
'''
services_list = []
mgmt_service = root.get_cloudera_manager().get_service()
serv... | 0.007031 |
def copy_and_update(dictionary, update):
"""Returns an updated copy of the dictionary without modifying the original"""
newdict = dictionary.copy()
newdict.update(update)
return newdict | 0.00995 |
def _heapify_max(x):
"""Transform list into a maxheap, in-place, in O(len(x)) time."""
n = len(x)
for i in reversed(range(n//2)):
_siftup_max(x, i) | 0.005988 |
def edit_required_pull_request_reviews(self, dismissal_users=github.GithubObject.NotSet, dismissal_teams=github.GithubObject.NotSet, dismiss_stale_reviews=github.GithubObject.NotSet, require_code_owner_reviews=github.GithubObject.NotSet, required_approving_review_count=github.GithubObject.NotSet):
"""
:... | 0.005166 |
def dump(self, function_name):
"""
Pretty-dump the bytecode for the function with the given name.
"""
assert isinstance(function_name, str)
self.stdout.write(function_name)
self.stdout.write("\n")
self.stdout.write("-" * len(function_name))
self.stdout.w... | 0.004167 |
def prepare(self):
"""
Reorganizes the data such that the deployment logic can find it all
where it expects to be.
The raw configuration file is intended to be as human-friendly as
possible partly through the following mechanisms:
- In order to minimize repetition, ... | 0.001474 |
def types(self):
"""
Return a list of all the variable types that exist in the
Variables object.
"""
output = set()
for var in self.values():
if var.has_value():
output.update(var.types())
return list(output) | 0.006849 |
def get_fptr(self):
"""Get the function pointer."""
cmpfunc = ctypes.CFUNCTYPE(ctypes.c_int,
WPARAM,
LPARAM,
ctypes.POINTER(KBDLLHookStruct))
return cmpfunc(self.handle_input) | 0.006579 |
def IBA_calc(TPR, TNR, alpha=1):
"""
Calculate IBA (Index of balanced accuracy).
:param TNR: specificity or true negative rate
:type TNR : float
:param TPR: sensitivity, recall, hit rate, or true positive rate
:type TPR : float
:param alpha : alpha coefficient
:type alpha : float
:r... | 0.002123 |
def check_access_token(self, openid=None, access_token=None):
"""检查 access_token 有效性
:param openid: 可选,微信 openid,默认获取当前授权用户信息
:param access_token: 可选,access_token,默认使用当前授权用户的 access_token
:return: 有效返回 True,否则 False
"""
openid = openid or self.open_id
access_toke... | 0.003295 |
def set_attrs(self, username, attrs):
""" set user attributes"""
ldap_client = self._bind()
tmp = self._get_user(self._byte_p2(username), ALL_ATTRS)
if tmp is None:
raise UserDoesntExist(username, self.backend_name)
dn = self._byte_p2(tmp[0])
old_attrs = tmp[1... | 0.001029 |
def _pc_decode(self, msg):
"""PC: PLC (lighting) change."""
housecode = msg[4:7]
return {'housecode': housecode, 'index': housecode_to_index(housecode),
'light_level': int(msg[7:9])} | 0.009009 |
def get_top_assets(self):
"""
Gets images and videos to populate top assets.
Map is built separately.
"""
images = self.get_all_images()[0:14]
video = []
if supports_video:
video = self.eventvideo_set.all()[0:10]
return list(chain(images, vid... | 0.006061 |
def recent_all_projects(self, limit=30, offset=0):
"""Return information about recent builds across all projects.
Args:
limit (int), Number of builds to return, max=100, defaults=30.
offset (int): Builds returned from this point, default=0.
Returns:
A list o... | 0.002882 |
def build(c: Union[Text, 'Choice', Dict[Text, Any]]) -> 'Choice':
"""Create a choice object from different representations."""
if isinstance(c, Choice):
return c
elif isinstance(c, str):
return Choice(c, c)
else:
return Choice(c.get('name'),
... | 0.004107 |
def delete_message(self, queue_name, message_id, pop_receipt, timeout=None):
'''
Deletes the specified message.
Normally after a client retrieves a message with the get_messages operation,
the client is expected to process and delete the message. To delete the
message, you mus... | 0.007941 |
def kaplan_meier_estimator(event, time_exit, time_enter=None, time_min=None):
"""Kaplan-Meier estimator of survival function.
Parameters
----------
event : array-like, shape = (n_samples,)
Contains binary event indicators.
time_exit : array-like, shape = (n_samples,)
Contains event... | 0.002567 |
def search_all(self, queries, audio_basename=None, case_sensitive=False,
subsequence=False, supersequence=False, timing_error=0.0,
anagram=False, missing_word_tolerance=0):
"""
Returns a dictionary of all results of all of the queries for all of
the audio fi... | 0.000921 |
def run():
"""
Looks through the docs/ dir and parses each markdown document, looking for
sections to update from Python docstrings. Looks for section headers in
the format:
- ### `ClassName()` class
- ##### `.method_name()` method
- ##### `.attribute_name` attribute
- ### `function... | 0.001471 |
def subseq(self, start_offset=0, end_offset=None):
"""
Return a subset of the sequence
starting at start_offset (defaulting to the beginning)
ending at end_offset (None representing the end, whih is the default)
Raises ValueError if duration_64 is missing on any element
"... | 0.004545 |
def next_basis_label_or_index(self, label_or_index, n=1):
"""Given the label or index of a basis state, return the label
the next basis state.
More generally, if `n` is given, return the `n`'th next basis state
label/index; `n` may also be negative to obtain previous basis state
... | 0.000875 |
def calculate_ecef_velocity(inst):
"""
Calculates spacecraft velocity in ECEF frame.
Presumes that the spacecraft velocity in ECEF is in
the input instrument object as position_ecef_*. Uses a symmetric
difference to calculate the velocity thus endpoints will be
set to NaN. Routine should b... | 0.01237 |
def response_list(data, key):
"""Obtain the relevant response data in a list.
If the response does not already contain the result in a list, a new one
will be created to ease iteration in the parser methods.
Args:
data (dict): API response.
key (str): Attribute of the response that con... | 0.005068 |
def validate(self, vat_deets):
"""Validates an existing VAT identification number against VIES."""
request = self._get('validation', vat_deets)
return self.responder(request) | 0.010101 |
def get_hierarchies(self):
"""Gets the hierarchy list resulting from the search.
return: (osid.hierarchy.HierarchyList) - the hierarchy list
raise: IllegalState - the hierarchy list was already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
i... | 0.003876 |
def transform(self, X):
r'''
Computes the divergences from X to :attr:`features_`.
Parameters
----------
X : list of bag feature arrays or :class:`skl_groups.features.Features`
The bags to search "from".
Returns
-------
divs : array of shape ... | 0.002338 |
def normalize(self,asOf=None,multiplier=100):
"""
Returns a normalized series or DataFrame
Example:
Series.normalize()
Returns: series of DataFrame
Parameters:
-----------
asOf : string
Date format
'2015-02-29'
multiplier : int
Factor by which the results will be adjusted
"""
if not asOf:
... | 0.069948 |
def _get_any_translated_model(self, meta=None):
"""
Return any available translation.
Returns None if there are no translations at all.
"""
if meta is None:
meta = self._parler_meta.root
tr_model = meta.model
local_cache = self._translations_cache[tr_... | 0.003333 |
def apply(self, reboot=False):
"""Apply the configuration to iRMC."""
self.root.use_virtual_addresses = True
self.root.manage.manage = True
self.root.mode = 'new'
self.root.init_boot = reboot
self.client.set_profile(self.root.get_json()) | 0.006993 |
def get_organism(self):
"""Select Enrichr organism from below:
Human & Mouse: H. sapiens & M. musculus
Fly: D. melanogaster
Yeast: S. cerevisiae
Worm: C. elegans
Fish: D. rerio
"""
organism = {'default': ['', 'hs', 'mm', 'human','mouse',
... | 0.007253 |
def _set_market_trade_type(self, ttype):
"""根据选择的市价交易类型选择对应的下拉选项"""
selects = self._main.child_window(
control_id=self._config.TRADE_MARKET_TYPE_CONTROL_ID,
class_name="ComboBox",
)
for i, text in selects.texts():
# skip 0 index, because 0 index is cur... | 0.003643 |
def correct_scanpy(adatas, **kwargs):
"""Batch correct a list of `scanpy.api.AnnData`.
Parameters
----------
adatas : `list` of `scanpy.api.AnnData`
Data sets to integrate and/or correct.
kwargs : `dict`
See documentation for the `correct()` method for a full list of
paramet... | 0.000671 |
def setImgShape(self, shape):
'''
image shape must be known for calculating camera matrix
if method==Manual and addPoints is used instead of addImg
this method must be called before .coeffs are obtained
'''
self.img = type('Dummy', (object,), {})
# if imgPr... | 0.004545 |
def group_apis(reg, features=None, extensions=None, api=None, profile=None,
support=None):
"""Groups Types, Enums, Commands with their respective Features, Extensions
Similar to :py:func:`import_registry`, but generates a new Registry object
for every feature or extension.
:param Regist... | 0.000538 |
def create_entry(group, name, timestamp, **attributes):
"""Create a new ARF entry under group, setting required attributes.
An entry is an abstract collection of data which all refer to the same time
frame. Data can include physiological recordings, sound recordings, and
derived data such as spike time... | 0.000708 |
def get_bind_processor(column_type, dialect):
"""
Returns a bind processor for a column type and dialect, with special handling
for JSON/JSONB column types to return dictionaries instead of serialized JSON strings.
NOTE: This is a workaround for https://github.com/NerdWalletOSS/savage/issues/8
:pa... | 0.006224 |
def set_brightness(self, percent, group=None):
""" Set brightness.
Percent is int between 0 (minimum brightness) and 100 (maximum brightness), or
float between 0.0 (minimum brightness) and 1.0 (maximum brightness).
See also .nightmode().
If group (1-4) is not s... | 0.00625 |
def onTagAdd(self, name, func):
'''
Register a callback for tag addition.
Args:
name (str): The name of the tag or tag glob.
func (function): The callback func(node, tagname, tagval).
'''
# TODO allow name wild cards
if '*' in name:
s... | 0.004843 |
def plot_gen_diff(
networkA,
networkB,
leave_out_carriers=[
'geothermal',
'oil',
'other_non_renewable',
'reservoir',
'waste']):
"""
Plot difference in generation between two networks grouped by carrier type
Parameters
----------
networkA : PyPSA ... | 0.002255 |
def _ensure_data(values, dtype=None):
"""
routine to ensure that our data is of the correct
input dtype for lower-level routines
This will coerce:
- ints -> int64
- uint -> uint64
- bool -> uint64 (TODO this should be uint8)
- datetimelike -> i8
- datetime64tz -> i8 (in local tz)
... | 0.000296 |
def get_previous_dagrun(self, session=None):
"""The previous DagRun, if there is one"""
return session.query(DagRun).filter(
DagRun.dag_id == self.dag_id,
DagRun.execution_date < self.execution_date
).order_by(
DagRun.execution_date.desc()
).first() | 0.006289 |
def getmembers(self):
"""Gets members (vars) from all scopes, using both runtime and static.
This method will attempt both static and runtime getmembers. This is the
recommended way of getting available members.
Returns:
Set of available vars.
Raises:
N... | 0.004511 |
def __make_security_group_api_request(server_context, api, user_ids, group_id, container_path):
"""
Execute a request against the LabKey Security Controller Group Membership apis
:param server_context: A LabKey server context. See utils.create_server_context.
:param api: Action to execute
:param use... | 0.004819 |
def dialog_open(self, *, dialog: dict, trigger_id: str, **kwargs) -> SlackResponse:
"""Open a dialog with a user.
Args:
dialog (dict): A dictionary of dialog arguments.
{
"callback_id": "46eh782b0",
"title": "Request something",
... | 0.00266 |
def get_span_column_count(span):
"""
Find the length of a colspan.
Parameters
----------
span : list of lists of int
The [row, column] pairs that make up the span
Returns
-------
columns : int
The number of columns included in the span
Example
-------
Consi... | 0.001211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.