text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def intercontacttimes(tnet):
"""
Calculates the intercontacttimes of each edge in a network.
Parameters
-----------
tnet : array, dict
Temporal network (craphlet or contact). Nettype: 'bu', 'bd'
Returns
---------
contacts : dict
Intercontact times as numpy array in di... | 0.002488 |
def follower(platform, **kwargs):
"""用于生成特定的券商对象
:param platform:平台支持 ['jq', 'joinquant', '聚宽’]
:param initial_assets: [雪球参数] 控制雪球初始资金,默认为一万,
总资金由 initial_assets * 组合当前净值 得出
:param total_assets: [雪球参数] 控制雪球总资金,无默认值,
若设置则覆盖 initial_assets
:return the class of follower
Usage::
... | 0.001114 |
def aspreconditioner(self, cycle='V'):
"""Create a preconditioner using this multigrid cycle.
Parameters
----------
cycle : {'V','W','F','AMLI'}
Type of multigrid cycle to perform in each iteration.
Returns
-------
precond : LinearOperator
... | 0.001259 |
def find_le(self, k):
'Return last item with a key <= k. Raise ValueError if not found.'
i = bisect_right(self._keys, k)
if i:
return self._items[i - 1]
raise ValueError('No item found with key at or below: %r' % (k,)) | 0.007605 |
def get_thumbnail(self, width, height):
"""
thumbnail with a memory cache
"""
# get from the file
thumb_path = self._get_thumb_path()
try:
doc_file_path = self.get_doc_file_path()
if (self.fs.exists(thumb_path) and
self.fs.getm... | 0.001377 |
def _get_env_activate(bin_env):
'''
Return the path to the activate binary
'''
if not bin_env:
raise CommandNotFoundError('Could not find a `activate` binary')
if os.path.isdir(bin_env):
if salt.utils.platform.is_windows():
activate_bin = os.path.join(bin_env, 'Scripts',... | 0.001786 |
async def add(self, *instances, using_db=None) -> None:
"""
Adds one or more of ``instances`` to the relation.
If it is already added, it will be silently ignored.
"""
if not instances:
return
if self.instance.id is None:
raise OperationalError(
... | 0.0038 |
def report(self, display=False):
"""Evaluation report
Parameters
----------
display : bool, optional
Set to True to print the report to stdout.
Returns
-------
report : pandas.DataFrame
Dataframe with one column per metric component, one ... | 0.001345 |
def do_edit(self, line):
"""edit Edit the queue of write operations."""
self._split_args(line, 0, 0)
self._command_processor.get_operation_queue().edit()
self._print_info_if_verbose("The write operation queue was successfully edited") | 0.011278 |
def apply_grads(self, grads, variables):
"""Apply gradients to variables.
Call this function externally instead of apply_grad(). This causes the
operations to be combined, which is necessary for stacking variables
see mtf.rewrite_stack_variables().
Args:
grads: a list of Tensor
variab... | 0.005155 |
def by_version(cls, session, package_name, version):
"""
Get release for a given version.
:param session: SQLAlchemy session
:type session: :class:`sqlalchemy.Session`
:param package_name: package name
:type package_name: unicode
:param version: version
... | 0.003145 |
def readFromCheckpoint(cls, checkpointDir):
"""Deserializes model from checkpointDir using capnproto"""
checkpointPath = cls._getModelCheckpointFilePath(checkpointDir)
with open(checkpointPath, 'r') as f:
proto = cls.getSchema().read(f,
traversal_limit_in_words=_TRA... | 0.007732 |
def perlin(self, stat='perlin'):
"""Apply Perlin noise to my nodes, and return myself.
I'll try to use the name of the node as its spatial position
for this purpose, or use its stats 'x', 'y', and 'z', or skip
the node if neither are available. z is assumed 0 if not
provided for... | 0.000441 |
def get_external_command_output(command: str) -> bytes:
"""
Takes a command-line command, executes it, and returns its ``stdout``
output.
Args:
command: command string
Returns:
output from the command as ``bytes``
"""
args = shlex.split(command)
ret = subprocess.check_... | 0.002618 |
def get_element_desc(element, ar_tree, ns):
# type: (_Element, _DocRoot, str) -> str
"""Get element description from XML."""
desc = get_child(element, "DESC", ar_tree, ns)
txt = get_child(desc, 'L-2[@L="DE"]', ar_tree, ns)
if txt is None:
txt = get_child(desc, 'L-2[@L="EN"]', ar_tree, ns)
... | 0.00216 |
def stop_message_live_location(self, chat_id=None, message_id=None, inline_message_id=None, reply_markup=None):
"""
Use this method to stop updating a live location message sent by the bot
or via the bot (for inline bots) before live_period expires
:param chat_id:
:param message_... | 0.008787 |
def fleet_id_to_slug(did):
""" Converts a fleet id into a correct fleet slug.
Args:
did (long) : A fleet id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, g--XXXX, g--XXXX-XXXX-XXXX
Returns:
str: The device slug in the g--XXXX-XXXX-XXX format
Raises:
A... | 0.005068 |
def render(self, request, collect_render_data=True, **kwargs):
"""
Render this view. This will call the render method
on the render class specified.
:param request: The request object
:param collect_render_data: If True we will call \
the get_render_data method to pass a... | 0.002837 |
def _prepPayload(self, record):
"""
record: generated from logger module
This preps the payload to be formatted in whatever content-type is
expected from the RESTful API.
returns: a tuple of the data and the http content-type
"""
payload = self._getPayload(record... | 0.003922 |
def _make_pcaps(self):
'''
Internal method. Create libpcap devices
for every network interface we care about and
set them in non-blocking mode.
'''
self._pcaps = {}
for devname,intf in self._devinfo.items():
if intf.iftype == InterfaceType.Loopback:
... | 0.007634 |
def import_item(self, data):
""" function used by import_data """
what = 'noop'
# remove the JSON _id (may still be there if called directly)
data.pop('_id', None)
# add fields/etc.
data = self.apply_transformers(data)
data = self.prepare_for_db(data)
t... | 0.002432 |
def copy(self):
"""Copy text to clipboard"""
if not self.selectedIndexes():
return
(row_min, row_max,
col_min, col_max) = get_idx_rect(self.selectedIndexes())
index = header = False
df = self.model().df
obj = df.iloc[slice(row_min, row_max + 1... | 0.002797 |
def grant_admin_privileges(self, username):
"""Grant cluster administration privileges to a user.
:param username: the username to grant privileges to
:type username: str
.. note:: Only a cluster administrator can create/drop databases
and manage users.
"""
... | 0.004695 |
def load_site_config(name):
"""Load and return site configuration as a dict."""
return _load_config_json(
os.path.join(
CONFIG_PATH,
CONFIG_SITES_PATH,
name + CONFIG_EXT
)
) | 0.004219 |
def permalink(self, repo, path):
"""
Get the permalink to command that generated the dataset
"""
if not os.path.exists(path):
# print("Path does not exist", path)
return (None, None)
# Get this directory
cwd = os.getcwd()
# Find the ro... | 0.007809 |
def mean_abs_tree_shap(model, data):
""" mean(|TreeExplainer|)
color = red_blue_circle(0.25)
linestyle = solid
"""
def f(X):
v = TreeExplainer(model).shap_values(X)
if isinstance(v, list):
return [np.tile(np.abs(sv).mean(0), (X.shape[0], 1)) for sv in v]
else:
... | 0.002551 |
def initial_dist_from_config(cp, variable_params):
r"""Loads a distribution for the sampler start from the given config file.
A distribution will only be loaded if the config file has a [initial-\*]
section(s).
Parameters
----------
cp : Config parser
The config parser to try to load f... | 0.000845 |
def write_to_output(content, output=None,
encoding=anytemplate.compat.ENCODING):
"""
:param content: Content string to write to
:param output: Output destination
:param encoding: Character set encoding of outputs
"""
if anytemplate.compat.IS_PYTHON_3 and isinstance(content, b... | 0.001675 |
def entries_in_tree(self, prefix, tree):
"""
Traverse the entries in this tree and yield (prefix, is_tree, oid)
Where prefix is a tuple of the given prefix and the name of the entry.
"""
for entry in tree.items():
if prefix:
new_prefix = prefix + (ent... | 0.004175 |
def showMenu(self, pos):
"""
Creates a new menu for this widget and displays it.
:param pos | <QPoint>
"""
glbl_pos = self.viewport().mapToGlobal(pos)
# lookup the specific item at the given position
item = self.itemAt(pos)
... | 0.007183 |
def merge_kitchens_improved(self, from_kitchen, to_kitchen, resolved_conflicts=None):
"""
merges kitchens
'/v2/kitchen/merge/<string:kitchenname>/<string:kitchenname>', methods=['POST']
:param resolved_conflicts:
:param self: DKCloudAPI
:param from_kitchen: string
... | 0.004796 |
def clear_screen(mode=2):
''' Clear the terminal/console screen. (Also aliased to clear.)
Arguments:
mode: | 0 | 'forward' - Clear cursor to end of screen, cursor stays.
| 1 | 'backward' - Clear cursor to beginning of screen, ""
| 2 | 'full' - Cle... | 0.006838 |
def run_ops(state, serial=False, no_wait=False):
'''
Runs all operations across all servers in a configurable manner.
Args:
state (``pyinfra.api.State`` obj): the deploy state to execute
serial (boolean): whether to run operations host by host
no_wait (boolean): whether to wait for ... | 0.003736 |
def _position(self):
"""Get media position."""
position = 0
if self.state != STATE_IDLE:
resp = self._player.query_position(_FORMAT_TIME)
position = resp[1] // _NANOSEC_MULT
return position | 0.008163 |
def get_tr(self, derivatives=False, **selectors):
""" Returns the scanning repetition time (TR) for one or more runs.
Args:
derivatives (bool): If True, also checks derivatives images.
selectors: Optional keywords used to constrain the selected runs.
Can be any a... | 0.00312 |
def _initialiseIteration(self):
"""
Starts a new iteration.
"""
self._searchIterator = self._search(
self._request.start,
self._request.end if self._request.end != 0 else None)
self._currentObject = next(self._searchIterator, None)
if self._current... | 0.002972 |
def http_error_default(self, url, fp, errcode, errmsg, headers):
"""Default error handler: close the connection and raise IOError."""
fp.close()
raise HTTPError(url, errcode, errmsg, headers, None) | 0.00905 |
def reset(self, T):
r"""Recalculate the doppler broadening for a given temperature."""
self.__init__(self.shape, self.stds, T,
self.mass, self.detuning_knob, self.k,
self.omega_level, self.xi, self.theta, self.unfolding,
self.axes,
... | 0.005666 |
def mousePressEvent(self, event):
"""
Selects all the text if the property is set after this widget
first gains focus.
:param event | <QMouseEvent>
"""
super(XLineEdit, self).mousePressEvent(event)
if self._focusedIn and self.select... | 0.01 |
def access_add(package, user):
"""
Add access
"""
team, owner, pkg = parse_package(package)
session = _get_session(team)
session.put("%s/api/access/%s/%s/%s" % (get_registry_url(team), owner, pkg, user))
print(u'Access added for %s' % user) | 0.007435 |
async def send_read_acknowledge(
self, entity, message=None, *, max_id=None, clear_mentions=False):
"""
Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check").
This effectively marks a message as read (or ... | 0.000988 |
def size(cls, pid):
"""Return the number of connections in the pool
:param str pid: The pool id
:rtype int
"""
with cls._lock:
cls._ensure_pool_exists(pid)
return len(cls._pools[pid]) | 0.008032 |
def at_line(self, line: FileLine) -> Iterator[Statement]:
"""
Returns an iterator over all of the statements located at a given line.
"""
num = line.num
for stmt in self.in_file(line.filename):
if stmt.location.start.line == num:
yield stmt | 0.006494 |
def reset_user_attempts(request: AxesHttpRequest, credentials: dict = None) -> int:
"""
Reset all user attempts that match the given request and credentials.
"""
attempts = filter_user_attempts(request, credentials)
count, _ = attempts.delete()
log.info('AXES: Reset %s access attempts from dat... | 0.005666 |
def hide(self):
"""
Call `hide_all()` on all known top widgets.
"""
top = self.get_top_widget()
if isinstance(top, (list, tuple)):
for t in top:
if t is not None:
t.hide_all()
elif top is not None:
top.hide_all() | 0.00625 |
def nacm_rule_list_cmdrule_command(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
nacm = ET.SubElement(config, "nacm", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm")
rule_list = ET.SubElement(nacm, "rule-list")
name_key = ET.SubElement(ru... | 0.005333 |
def Emulation_setEmulatedMedia(self, media):
"""
Function path: Emulation.setEmulatedMedia
Domain: Emulation
Method name: setEmulatedMedia
Parameters:
Required arguments:
'media' (type: string) -> Media type to emulate. Empty string disables the override.
No return value.
Description: ... | 0.047078 |
def waitUntilFinished(self):
"""
Processes the main thread until the loading process has finished. This
is a way to force the main thread to be synchronous in its execution.
"""
QtCore.QCoreApplication.processEvents()
while self.isLoading():
QtCore.QCo... | 0.005731 |
async def movehere(self, channel):
"""
Moves the embed message to a new channel; can also be used to move the musicplayer to the front
Args:
channel (discord.Channel): The channel to move to
"""
self.logger.debug("movehere command")
# Delete the old message... | 0.004839 |
def change_autocommit_mode(self, switch):
"""
Strip and make a string case insensitive and ensure it is either 'true' or 'false'.
If neither, prompt user for either value.
When 'true', return True, and when 'false' return False.
"""
parsed_switch = switch.strip().lower()... | 0.003868 |
def _writeSedimentTable(self, session, fileObject, mapTable, replaceParamFile):
"""
Write Sediment Mapping Table Method
This method writes the sediments special mapping table case.
"""
# Write the sediment mapping table header
fileObject.write('%s\n' % (mapTable.name))
... | 0.004359 |
def ask(query, default=None):
"""Ask a question."""
if default:
default_q = ' [{0}]'.format(default)
else:
default_q = ''
if sys.version_info[0] == 3:
inp = input("{query}{default_q}: ".format(
query=query, default_q=default_q)).strip()
else:
inp = raw_inp... | 0.001972 |
def convex_hull(points):
"""Computes the convex hull of an iterable of (x, y) coordinates.
Args:
points: iterable of (x, y) tuples.
Returns:
`list`: instances of `Point` - vertices of the convex hull in
counter-clockwise order, starting from the vertex with the
lexicographi... | 0.000803 |
def create_payload(self):
"""Remove ``smart_class_parameter_id`` or ``smart_variable_id``"""
payload = super(OverrideValue, self).create_payload()
if hasattr(self, 'smart_class_parameter'):
del payload['smart_class_parameter_id']
if hasattr(self, 'smart_variable'):
... | 0.005305 |
def order_by(self, sort_key=None):
"""
Set the sort for this query. Not all attributes are sorting candidates.
To sort in descending order, call ``Query.order_by('-attribute')``.
Calling ``Query.order_by()`` replaces any previous ordering.
:rtype: Query
"""
if s... | 0.004792 |
def get_content(self, obj):
"""All content for office's page on an election day."""
election_day = ElectionDay.objects.get(
date=self.context['election_date'])
return PageContent.objects.office_content(election_day, obj) | 0.007813 |
def course_is_open_to_user(self, course, username=None, lti=None):
"""
Checks if a user is can access a course
:param course: a Course object
:param username: The username of the user that we want to check. If None, uses self.session_username()
:param lti: indicates if the user i... | 0.003876 |
def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
""" Common utilities to set transform interface params.
"""
input_features = _fm.process_or_validate_features(input_features)
output_features = _fm.process_or_validate_features(output_features)
# Add in... | 0.005148 |
def ordered_members_map(self):
"""
Mask to group the persons by entity
This function only caches the map value, to see what the map is used for, see value_nth_person method.
"""
if self._ordered_members_map is None:
return np.argsort(self.members_entity_id)
re... | 0.008571 |
def append(self, box):
"""Append a JP2 box to the file in-place.
Parameters
----------
box : Jp2Box
Instance of a JP2 box. Only UUID and XML boxes can currently be
appended.
"""
if self._codec_format == opj2.CODEC_J2K:
msg = "Only JP2... | 0.001254 |
def draw_chimera_yield(G, **kwargs):
"""Draws the given graph G with highlighted faults, according to layout.
Parameters
----------
G : NetworkX graph
The graph to be parsed for faults
unused_color : tuple or color string (optional, default (0.9,0.9,0.9,1.0))
The color to use for n... | 0.002811 |
def get_jids():
'''
Return a list of all job ids
For master job cache this also formats the output and returns a string
'''
conn = _get_conn()
cur = conn.cursor()
sql = '''SELECT ''' \
'''jid, tgt_type, cmd, tgt, kwargs, ret, username, arg, fun ''' \
'''FROM jids'''
i... | 0.001309 |
def get_all_client_tags(self, params=None):
"""
Get all client tags
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
"""
... | 0.00611 |
def set_source_yahoo_options(self):
"""
Set data source to yahoo finance, specifically to download financial options data
"""
self.data_worker = data_worker
self.worker_args = {"function": Options, "input": self.input_queue, "output": self.output_map,
... | 0.010283 |
def _matches_patterns(path, patterns):
"""Given a list of patterns, returns a if a path matches any pattern."""
for glob in patterns:
try:
if PurePath(path).match(glob):
return True
except TypeError:
pass
return False | 0.009464 |
def change_custom_seed(seed):
"""
change CustomCarry seed
example:
change_custom_seed([1,2,3]) # then CustomCarry.SEED_LIST == '123' is True
:param seed:
:return:
"""
if isinstance(seed, (basestring, list, tuple)):
seed = Seed(seed)
if isinstance(seed, Seed):
CustomC... | 0.002933 |
def get_station_by_name(self,
station_name,
num_minutes=None,
direction=None,
destination=None,
stops_at=None):
"""Returns all trains due to serve station `station_name`.
... | 0.005072 |
def eci2ecef (x, y, z, gmst=None):
"""Converts the given ECI coordinates to ECEF at the given Greenwich
Mean Sidereal Time (GMST) (defaults to now).
This code was adapted from
`shashwatak/satellite-js <https://github.com/shashwatak/satellite-js/blob/master/src/coordinate-transforms.js>`_
and http://ccar.co... | 0.020221 |
def setup_exchange(self):
"""Declare the exchange
When completed, the on_exchange_declareok method will be invoked by pika.
"""
logger.debug('Declaring exchange %s', self._exchange)
self._channel.exchange_declare(self.on_exchange_declareok,
... | 0.006682 |
def build_simple_fault_source_node(fault_source):
"""
Parses a simple fault source to a Node class
:param fault_source:
Simple fault source as instance of :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource`
:returns:
Instance of :class:`openquake.baselib.node.Nod... | 0.00155 |
def cmd_gyrocal(self, args):
'''do a full gyro calibration'''
mav = self.master
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, 0,
1, 0, 0, 0, 0, 0, 0) | 0.009709 |
def inverse(self):
"""
Return a new CSG solid with solid and empty space switched. This solid is
not modified.
"""
csg = self.clone()
map(lambda p: p.flip(), csg.polygons)
return csg | 0.012605 |
def _srvc_closing_routine(self, closing):
"""Routine to close an hdf5 file
The file is closed only when `closing=True`. `closing=True` means that
the file was opened in the current highest recursion level. This prevents re-opening
and closing of the file if `store` or `load` are called ... | 0.003948 |
def createWPText(self):
'''Creates the text for the current and final waypoint,
and the distance to the new waypoint.'''
self.wpText = self.axes.text(self.leftPos+(1.5*self.vertSize/10.0),0.97-(1.5*self.vertSize)+(0.5*self.vertSize/10.0),'0/0\n(0 m, 0 s)',color='w',size=self.fontSize,ha='left',v... | 0.026005 |
def inserir(self, id_equipment, id_script):
"""Inserts a new Related Equipment with Script and returns its identifier
:param id_equipment: Identifier of the Equipment. Integer value and greater than zero.
:param id_script: Identifier of the Script. Integer value and greater than zero.
... | 0.006494 |
def _imm_trans_setattr(self, name, value):
'''
An immutable's transient setattr allows params to be set, and runs checks as they are.
'''
params = _imm_param_data(self)
dd = object.__getattribute__(self, '__dict__')
if name in params:
(_, tx_fn, arg_lists, check_fns, deps) = params[name]... | 0.005402 |
def inject_pid(self, data):
"""Inject context PID in the RECID field."""
# Remove already deserialized "pid" field
pid_value = data.pop('pid', None)
if pid_value:
pid_field = current_app.config['PIDSTORE_RECID_FIELD']
data.setdefault(pid_field, pid_value)
... | 0.006042 |
def CallHwclock(logger):
"""Sync clock using hwclock.
Args:
logger: logger object, used to write to SysLog and serial port.
"""
command = ['/sbin/hwclock', '--hctosys']
try:
subprocess.check_call(command)
except subprocess.CalledProcessError:
logger.warning('Failed to sync system time with hard... | 0.015 |
def process_messages(self, max_messages=10000):
"""Process all messages ready in the subscription channels.
This reads messages from the subscription channels and calls the
appropriate handlers until there are no messages left.
Args:
max_messages: The maximum number of mess... | 0.001357 |
def reassign_proficiency_to_objective_bank(self, proficiency_id, from_objective_bank_id, to_objective_bank_id):
"""Moves a ``Proficiency`` from one ``ObjectiveBank`` to another.
Mappings to other ``ObjectiveBanks`` are unaffected.
arg: proficiency_id (osid.id.Id): the ``Id`` of the
... | 0.004837 |
def name(self, value):
"""Set a new name to controller."""
data = {
'_set_controller_name': 'Set Name',
'controller_name': value,
}
self.post(data, url=SETUP_ENDPOINT, referer=SETUP_ENDPOINT) | 0.008097 |
def get_queryset(self, **kwargs):
"""
Gets our queryset. This takes care of filtering if there are any
fields to filter by.
"""
queryset = self.derive_queryset(**kwargs)
return self.order_queryset(queryset) | 0.007813 |
def record_context(self, space, frame):
"""Record a __context__ for this exception from the current
frame if one exists.
__context__ is otherwise lazily determined from the
traceback. However the current frame.last_exception must be
checked for a __context__ before this Operatio... | 0.003138 |
def boll(self, n, dev, array=False):
"""布林通道"""
mid = self.sma(n, array)
std = self.std(n, array)
up = mid + std * dev
down = mid - std * dev
return up, down | 0.009662 |
def system_find_databases(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findDatabases API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDatabases
"""
return DXHTTPRequest('/system/findDatabases', input_pa... | 0.008287 |
def configure(self, options, conf):
"""
apply configured options
"""
super(Nosebook, self).configure(options, conf)
self.testMatch = re.compile(options.nosebookTestMatch).match
self.testMatchCell = re.compile(options.nosebookTestMatchCell).match
scrubs = []
... | 0.002237 |
def my_pick_non_system_keyspace(self):
"""
Find a keyspace in the cluster which is not 'system', for the purpose
of getting a valid ring view. Can't use 'system' or null.
"""
d = self.my_describe_keyspaces()
def pick_non_system(klist):
for k in klist:
... | 0.002825 |
def handle_type_inspect(self, call_id, payload):
"""Handler for responses `TypeInspectInfo`."""
style = 'fullName' if self.full_types_enabled else 'name'
interfaces = payload.get("interfaces")
ts = [i["type"][style] for i in interfaces]
prefix = "( " + ", ".join(ts) + " ) => "
... | 0.005236 |
def SETP(cpu, dest):
"""
Sets byte if parity.
:param cpu: current CPU.
:param dest: destination operand.
"""
dest.write(Operators.ITEBV(dest.size, cpu.PF, 1, 0)) | 0.009524 |
def _ctl_cmd(cmd, name, conf_file, bin_env):
'''
Return the command list to use
'''
ret = [_get_supervisorctl_bin(bin_env)]
if conf_file is not None:
ret += ['-c', conf_file]
ret.append(cmd)
if name:
ret.append(name)
return ret | 0.003636 |
def coerce(cls, key, value):
"""Ensure that loaded values are PasswordHashes."""
if isinstance(value, PasswordHash):
return value
return super(PasswordHash, cls).coerce(key, value) | 0.009259 |
def _read(self, pin):
"""Perform an ADC read. Returns the signed integer result of the read."""
config = _ADS1X15_CONFIG_OS_SINGLE
config |= (pin & 0x07) << _ADS1X15_CONFIG_MUX_OFFSET
config |= _ADS1X15_CONFIG_GAIN[self.gain]
config |= self.mode
config |= self.rate_config... | 0.00531 |
def table_names(self):
"""Returns names of all tables in the database"""
query = "SELECT name FROM sqlite_master WHERE type='table'"
cursor = self.connection.execute(query)
results = cursor.fetchall()
return [result_tuple[0] for result_tuple in results] | 0.006826 |
async def play(self, author, text_channel, query, index=None, stop_current=False, shuffle=False):
"""
The play command
Args:
author (discord.Member): The member that called the command
text_channel (discord.Channel): The channel where the command was called
q... | 0.002985 |
def build_options(slot, appointment_type, date, booking_map):
"""
Build a list of potential options for a given slot, to be used in responseCard generation.
"""
day_strings = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
if slot == 'AppointmentType':
return [
{'text': 'cleani... | 0.003523 |
def callproc(self, procname, parameters=()):
"""
Call a stored procedure with the given name.
:param procname: The name of the procedure to call
:type procname: str
:keyword parameters: The optional parameters for the procedure
:type parameters: sequence
Note: I... | 0.003035 |
def fso_readlink(self, path):
'overlays os.readlink()'
path = self.deref(path, to_parent=True)
st = self.fso_lstat(path)
if not stat.S_ISLNK(st.st_mode):
raise OSError(22, 'Invalid argument', path)
if st.st_overlay:
return self.entries[path].content
return self.originals['os:readlink... | 0.009146 |
def _make_command_method(cls, command_name, many=False):
"""
Return a function which will convert objects to their pk, then call the
super method for the given name.
The "many" attribute indicates that the command accept one or many
values as arguments (in *args)
"""
... | 0.002336 |
def StringS(name, size, uninitialized=False, explicit_name=False, **kwargs):
"""
Create a new symbolic string (analogous to z3.String())
:param name: The name of the symbolic string (i. e. the name of the variable)
:param size: The size in bytes of the string (i. e. the ... | 0.00813 |
def get_select_title_url(self, attach=None):
"""
获取商户专属开票链接
商户调用接口,获取链接。用户扫码,可以选择抬头发给商户。可以将链接转成二维码,立在收银台。
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:param attach: 附加字段,用户提交发票时会发送给商户
:return: 商户专属开票链接
"""
return self._post(
... | 0.004211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.