text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def fork(self, state, expression, policy='ALL', setstate=None):
"""
Fork state on expression concretizations.
Using policy build a list of solutions for expression.
For the state on each solution setting the new state with setstate
For example if expression is a Bool it may have... | 0.002756 |
def clear(self):
""" clear all tree data
"""
self._delete_child_storage(self.root_node)
self._delete_node_storage(self.root_node)
self.root_node = BLANK_NODE
self._root_hash = BLANK_ROOT | 0.008547 |
def load_streams(chunks):
"""
Given a gzipped stream of data, yield streams of decompressed data.
"""
chunks = peekable(chunks)
while chunks:
if six.PY3:
dc = zlib.decompressobj(wbits=zlib.MAX_WBITS | 16)
else:
dc = zlib.decompressobj(zlib.MAX_WBITS | 16)
... | 0.002203 |
def manage(group_id):
"""Manage your group."""
group = Group.query.get_or_404(group_id)
form = GroupForm(request.form, obj=group)
if form.validate_on_submit():
if group.can_edit(current_user):
try:
group.update(**form.data)
flash(_('Group "%(name)s" w... | 0.001056 |
def main():
'''main routine'''
# process arguments
if len(sys.argv) < 4:
usage()
rgname = sys.argv[1]
vmss_name = sys.argv[2]
capacity = sys.argv[3]
# Load Azure app defaults
try:
with open('azurermconfig.json') as config_file:
config_data = json.load(confi... | 0.002445 |
def get_device_state(self):
"""
returns the full device state
"""
log.debug("getting device state...")
cmd, url = DEVICE_URLS["get_device_state"]
return self._exec(cmd, url) | 0.00905 |
def notify_rollover(self, stream):
"""Notify that a reading in the given stream was overwritten.
Args:
stream (DataStream): The stream that had overwritten data.
"""
self.offset -= 1
if not self.matches(stream):
return
if self._count == 0:
... | 0.006711 |
def get_interface_detail_output_interface_ifHCOutMulticastPkts(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_interface_detail = ET.Element("get_interface_detail")
config = get_interface_detail
output = ET.SubElement(get_interface_detail, "o... | 0.002237 |
def score(self, outcomes, modelparams, expparams, return_L=False):
r"""
Returns the numerically computed score of the likelihood
function, defined as:
.. math::
q(d, \vec{x}; \vec{e}) = \vec{\nabla}_{\vec{x}} \log \Pr(d | \vec{x}; \vec{e}).
... | 0.011899 |
def getAccountNames(store, protocol=None):
"""
Retrieve account name information about the given database.
@param store: An Axiom Store representing a user account. It must
have been opened through the store which contains its account
information.
@return: A generator of two-tuples of (userna... | 0.004175 |
def set_block(fd):
"""Inverse of :func:`set_nonblock`, i.e. cause `fd` to block the thread
when the underlying kernel buffer is exhausted."""
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK) | 0.003984 |
def load_label(self, idx, label_type=None):
"""
Load label image as 1 x height x width integer array of label indices.
The leading singleton dimension is required by the loss.
"""
if label_type == 'semantic':
label = scipy.io.loadmat('{}/SemanticLabels/spatial_envelop... | 0.005464 |
def parse_cmd(self, tree, inp_cmd = None):
""" Extract command and options from string.
The tree argument should contain a specifically formatted dict
which describes the available commands, options, arguments and
callbacks to methods for completion of arguments.
... | 0.002677 |
def insert_users_for_optional_roles_trigger(plpy, td):
"""Trigger to update users from optional roles entries.
A compatibility trigger to insert users from moduleoptionalroles
records. This is primarily for legacy compatibility, but it is not
possible to tell whether the entry came from legacy or cnx-p... | 0.000965 |
def _convert_duration_to_hhmmss(self, duration):
"""stub"""
time_secs = duration.seconds
min_, sec = divmod(time_secs, 60)
hour, min_ = divmod(min_, 60)
results = {
'hours': hour,
'minutes': min_,
'seconds': sec
}
return result... | 0.006231 |
def process_file(path):
""" Open a single labeled image at path and get needed information, return as a dictionary"""
info = dict()
with fits.open(path) as hdu:
head = hdu[0].header
data = hdu[0].data
labels = {theme: value for value, theme in list(hdu[1].data)}
info['filename'] ... | 0.003273 |
def add_items(self, dataframe, hide_cols=()):
"""
Add items and/or update existing items in grid
"""
# replace "None" values with ""
dataframe = dataframe.fillna("")
# remove any columns that shouldn't be shown
for col in hide_cols:
if col in dataframe... | 0.002166 |
def probe_services(self, handle, conn_id, callback):
"""Given a connected device, probe for its GATT services and characteristics
Args:
handle (int): a handle to the connection on the BLED112 dongle
conn_id (int): a unique identifier for this connection on the DeviceManager
... | 0.009693 |
def create_multiple_expectations(df, columns, expectation_type, *args, **kwargs):
"""Creates an identical expectation for each of the given columns with the specified arguments, if any.
Args:
df (great_expectations.dataset): A great expectations dataset object.
columns (list): A list of column ... | 0.004779 |
def ParseApplicationUsageRow(
self, parser_mediator, query, row, **unused_kwargs):
"""Parses an application usage row.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
query (str): query that created the r... | 0.000791 |
def endaccess(self):
"""Terminates access to the SDS.
Args::
no argument
Returns::
None.
The SDS instance should not be used afterwards.
The 'endaccess()' method is implicitly called when
the SDS instance is deleted.
C library equivalent ... | 0.003922 |
def fetch_import_ref_restriction(self,):
"""Fetch whether importing the reference is restricted
:returns: True, if importing the reference is restricted
:rtype: :class:`bool`
:raises: None
"""
inter = self.get_refobjinter()
restricted = self.status() not in (self... | 0.006993 |
def as_qubit_order(val: 'qubit_order_or_list.QubitOrderOrList'
) -> 'QubitOrder':
"""Converts a value into a basis.
Args:
val: An iterable or a basis.
Returns:
The basis implied by the value.
"""
if isinstance(val, collections.Iter... | 0.00565 |
def pattern(self):
"""Extract query pattern from operations."""
if not self._pattern:
# trigger evaluation of operation
if (self.operation in ['query', 'getmore', 'update', 'remove'] or
self.command in ['count', 'findandmodify']):
self._patter... | 0.004107 |
def ParseOptions(cls, options, analysis_plugin):
"""Parses and validates options.
Args:
options (argparse.Namespace): parser options.
analysis_plugin (AnalysisPlugin): analysis plugin to configure.
Raises:
BadConfigObject: when the output module object is of the wrong type.
BadConf... | 0.006098 |
def ipoTodayDF(token='', version=''):
'''This returns a list of upcoming or today IPOs scheduled for the current and next month. The response is split into two structures:
rawData and viewData. rawData represents all available data for an IPO. viewData represents data structured for display to a user.
http... | 0.004115 |
def encodeAA(seq_vec, maxlen=None, seq_align="start", encode_type="one_hot"):
"""Convert the Amino-acid sequence into 1-hot-encoding numpy array
# Arguments
seq_vec: List of strings/amino-acid sequences
maxlen: Maximum sequence length. See `pad_sequences` for more detail
seq_align: How ... | 0.003367 |
def spawn(self, fn, *args, **kwargs):
"""Spawn a new process, attached to this Namespace.
It will be monitored by the "watcher" process in the Socket. If the
socket disconnects, all these greenlets are going to be killed, after
calling BaseNamespace.disconnect()
This method use... | 0.002793 |
def main():
"""
Project's main method which will parse the command line arguments, run a
scan using the TagCubeClient and exit.
"""
cmd_args = TagCubeCLI.parse_args()
try:
tagcube_cli = TagCubeCLI.from_cmd_args(cmd_args)
except ValueError, ve:
# We get here when there are no... | 0.003012 |
def calc_circuit_breaker_position(self, debug=False):
""" Calculates the optimal position of a circuit breaker on route.
Parameters
----------
debug: bool, defaults to False
If True, prints process information.
Returns
-------
int
... | 0.005523 |
def cluster_kmeans(data=None, k=None, max_iter=10, tolerance=1e-5, stride=1,
metric='euclidean', init_strategy='kmeans++', fixed_seed=False,
n_jobs=None, chunksize=None, skip=0, keep_data=False, clustercenters=None, **kwargs):
r"""k-means clustering
If data is given, it pe... | 0.004649 |
def screenshot(self, filename=None):
""" Take a screenshot """
# screen size: 1280x720
screen = self._ymc.screenshot()
if filename:
screen.save(filename)
return screen | 0.008889 |
def _vmomentsurfacemassGrid(self,n,m,grid):
"""Internal function to evaluate vmomentsurfacemass using a grid
rather than direct integration"""
if len(grid.df.shape) == 3: tlist= True
else: tlist= False
if tlist:
nt= grid.df.shape[2]
out= []
f... | 0.034868 |
def run(self, dag):
"""Run one pass of the lookahead mapper on the provided DAG.
Args:
dag (DAGCircuit): the directed acyclic graph to be mapped
Returns:
DAGCircuit: A dag mapped to be compatible with the coupling_map in
the property_set.
Raises:
... | 0.003582 |
def render_template(cmd_derived_from_alias, pos_args_table):
"""
Render cmd_derived_from_alias as a Jinja template with pos_args_table as the arguments.
Args:
cmd_derived_from_alias: The string to be injected with positional arguemnts.
pos_args_table: The dictionary used to rendered.
R... | 0.005745 |
def download(self, url,
file_name,
headers=None,
show_progress=True):
'''stream to a temporary file, rename on successful completion
Parameters
==========
file_name: the file name to stream to
url: the url to stream from
... | 0.006972 |
def takes_arg(obj, arg: str) -> bool:
"""
Checks whether the provided obj takes a certain arg.
If it's a class, we're really checking whether its constructor does.
If it's a function or method, we're checking the object itself.
Otherwise, we raise an error.
"""
if inspect.isclass(obj):
... | 0.001715 |
def get_userpass_value(cli_value, config, key, prompt_strategy):
"""Gets the username / password from config.
Uses the following rules:
1. If it is specified on the cli (`cli_value`), use that.
2. If `config[key]` is specified, use that.
3. Otherwise prompt using `prompt_strategy`.
:param cli... | 0.001131 |
def make_configure_tab(self):
""" initial set up of configure tab"""
# Setup the choice between single and multicolor
modeframe = tk.Frame(self.tab_configure)
self.mode = tk.IntVar()
singlecolor = tk.Radiobutton(modeframe, text="Single color", variable=self.mode,
... | 0.006309 |
def get(self, **kwargs):
""" Same as search, but will throw an error if there are multiple or no
results. If there are multiple results and only one is an exact match
on api_version, that resource will be returned.
"""
results = self.search(**kwargs)
# If there ar... | 0.007306 |
def CallApiHandler(handler, args, token=None):
"""Handles API call to a given handler with given args and token."""
result = handler.Handle(args, token=token)
expected_type = handler.result_type
if expected_type is None:
expected_type = None.__class__
if result.__class__ != expected_type:
... | 0.006276 |
def resolve_dynamic_values(env):
"""
Resolve dynamic values inside need data.
Rough workflow:
#. Parse all needs and their data for a string like [[ my_func(a,b,c) ]]
#. Extract function name and call parameters
#. Execute registered function name with extracted call parameters
#. Replace ... | 0.004331 |
def restore_scrollbar_position(self):
"""Restoring scrollbar position after main window is visible"""
scrollbar_pos = self.get_option('scrollbar_position', None)
if scrollbar_pos is not None:
self.explorer.treewidget.set_scrollbar_position(scrollbar_pos) | 0.006803 |
def frequency2fractional(frequency, mean_frequency=-1):
""" Convert frequency in Hz to fractional frequency
Parameters
----------
frequency: np.array
Data array of frequency in Hz
mean_frequency: float
(optional) The nominal mean frequency, in Hz
if omitted, defaults to mean... | 0.001715 |
def set_id(self, dxid):
'''
:param dxid: New job ID to be associated with the handler (localjob IDs also accepted for local runs)
:type dxid: string
Discards the currently stored ID and associates the handler with *dxid*
'''
if dxid is not None:
if not (isins... | 0.006349 |
def cache_data(self):
"""
Cache some basic data such as financial statement metrics
"""
# Set Slug if not set
if not self.slug_name:
self.slug_name = slugify(self.name).strip()
if len(self.slug_name) > 255:
self.slug_name = self.slug_name[0... | 0.006154 |
def unset(self, host, *args):
"""
Removes settings for a host.
Parameters
----------
host : the host to remove settings from.
*args : list of settings to removes.
"""
self.__check_host_args(host, args)
remove_idx = [idx for idx, x in enumerate(sel... | 0.004184 |
def filter_options(keys, options):
"""
Filter 'options' with given 'keys'.
:param keys: key names of optional keyword arguments
:param options: optional keyword arguments to filter with 'keys'
>>> filter_options(("aaa", ), dict(aaa=1, bbb=2))
{'aaa': 1}
>>> filter_options(("aaa", ), dict(b... | 0.002475 |
def _retry(event, attempts, delay):
"""
An iterator of pairs of (attempt number, event set), checking whether
`event` is set up to `attempts` number of times, and delaying `delay`
seconds in between.
Terminates as soon as `event` is set, or until `attempts` have been made.
Intended to be used ... | 0.001266 |
def prepare_child_message(self,
gas: int,
to: Address,
value: int,
data: BytesOrView,
code: bytes,
**kwargs: Any) -> Message:
"""
... | 0.011594 |
def listen(queue):
""" Appends events to the queue (ButtonEvent, WheelEvent, and MoveEvent). """
if not os.geteuid() == 0:
raise OSError("Error 13 - Must be run as administrator")
listener = MouseEventListener(lambda e: queue.put(e) or is_allowed(e.name, e.event_type == KEY_UP))
t = threading.Th... | 0.007732 |
def get_policy_for_vhost(self, vhost, name):
"""
Get a specific policy for a vhost.
:param vhost: The virtual host the policy is for
:type vhost: str
:param name: The name of the policy
:type name: str
"""
return self._api_get('/api/policies/{0}/{1}'.form... | 0.004751 |
def apply_changes(self, event):
"""
applies the changes in the various attribute boxes of this object to all highlighted fit objects in the logger, these changes are reflected both in this object and in the Zeq_GUI parent object.
@param: event -> the wx.ButtonEvent that triggered this function
... | 0.011264 |
def close_boundaries_sensibly(model):
"""
Return a cobra model with all boundaries closed and changed constraints.
In the returned model previously fixed reactions are no longer constrained
as such. Instead reactions are constrained according to their
reversibility. This is to prevent the FBA from ... | 0.001089 |
def add_settings_parser(subparsers, parent_parser):
"""Creates the args parser needed for the settings command and its
subcommands.
"""
# The following parser is for the settings subsection of commands. These
# commands display information about the currently applied on-chain
# settings.
s... | 0.000669 |
def _read_from_definition_body(self):
"""
Read the Swagger document from DefinitionBody. It could either be an inline Swagger dictionary or an
AWS::Include macro that contains location of the included Swagger. In the later case, we will download and
parse the Swagger document.
R... | 0.006 |
def fit(
self, frequency, recency, T, weights=None, initial_params=None, verbose=False, tol=1e-7, index=None, **kwargs
):
"""
Fit the data to the MBG/NBD model.
Parameters
----------
frequency: array_like
the frequency vector of customers' purchases
... | 0.002864 |
def prsdp(string):
"""
Parse a string as a double precision number, encapsulating error handling.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/prsdp_c.html
:param string: String representing a d.p. number.
:type string: str
:return: D.p. value obtained by parsing string.
:rtype:... | 0.002088 |
def project(self, from_shape, to_shape):
"""
Project the polygon onto an image with different shape.
The relative coordinates of all points remain the same.
E.g. a point at (x=20, y=20) on an image (width=100, height=200) will be
projected on a new image (width=200, height=100) ... | 0.002882 |
def new(self, page_name, **dict):
'''
Create a new item with the provided dict information
at the given page_name. Returns the new item.
As of version 2.2 of Redmine, this doesn't seem to function.
'''
self._item_new_path = '/projects/%s/wiki/%s.json' % \
(s... | 0.00432 |
def avatar_url_as(self, *, format=None, size=1024):
"""Returns a friendly URL version of the avatar the webhook has.
If the webhook does not have a traditional avatar, their default
avatar URL is returned instead.
The format must be one of 'jpeg', 'jpg', or 'png'.
The size must... | 0.004038 |
def report_parse(self):
"""
If the pipeline has previously been run on these data, instead of reading through the results, parse the
report instead
"""
# Initialise lists
report_strains = list()
genus_list = list()
if self.analysistype == 'mlst':
... | 0.003982 |
def __generate_actors(self, operator, upstream_channels,
downstream_channels):
"""Generates one actor for each instance of the given logical
operator.
Attributes:
operator (Operator): The logical operator metadata.
upstream_channels (list): A li... | 0.001684 |
def select_cb(self, viewer, event, data_x, data_y):
"""Called when the user clicks on the color bar viewer.
Calculate the index of the color bar they clicked on and
set that color map in the current channel viewer.
"""
if not (self._cmxoff <= data_x < self._cmwd):
# n... | 0.003686 |
def mangle_coverage(local_path, log):
"""Edit .coverage file substituting Windows file paths to Linux paths.
:param str local_path: Destination path to save file to.
:param logging.Logger log: Logger for this function. Populated by with_log() decorator.
"""
# Read the file, or return if not a .cove... | 0.002865 |
def _guess_name(desc, taken=None):
"""Attempts to guess the menu entry name from the function name."""
taken = taken or []
name = ""
# Try to find the shortest name based on the given description.
for word in desc.split():
c = word[0].lower()
if not c.isalnum():
continue
... | 0.001838 |
def require_resource(self, type: Type[T_Resource], name: str = 'default') -> T_Resource:
"""
Look up a resource in the chain of contexts and raise an exception if it is not found.
This is like :meth:`get_resource` except that instead of returning ``None`` when a resource
is not found, i... | 0.008653 |
def execute_phase(self, phase):
"""Executes a phase or skips it, yielding PhaseExecutionOutcome instances.
Args:
phase: Phase to execute.
Returns:
The final PhaseExecutionOutcome that wraps the phase return value
(or exception) of the final phase run. All intermediary results, if any,
... | 0.005325 |
def frontend_routing(self, context):
"""
Returns the targeted frontend and original state
:type context: satosa.context.Context
:rtype satosa.frontends.base.FrontendModule
:param context: The response context
:return: frontend
"""
target_frontend = cont... | 0.005068 |
def create_tags_with_concatenated_css_classes(tags):
"""Function that creates <mark> tags such that they are not overlapping.
In order to do this, it concatenates the css classes and stores the concatenated
result in new tags.
"""
current_classes = set()
result = []
for pos, group in group_t... | 0.001363 |
def match(self, request, *, root=None, path=None, methods=None):
"""Return match or None for the request/constraints pair.
.. seealso:: Proxy:
:meth:`.Router.match`
"""
return self.__router.match(
request, root=root, path=path, methods=methods) | 0.006645 |
def display(self):
""" dump operation
"""
print("{}".format(self))
for task in self.tasks:
print(" - {}".format(task)) | 0.012195 |
def _create_subepochs(x, nperseg, step):
"""Transform the data into a matrix for easy manipulation
Parameters
----------
x : 1d ndarray
actual data values
nperseg : int
number of samples in each row to create
step : int
distance in samples between rows
Returns
--... | 0.001174 |
def compare_cells(self, cell1, cell2):
'''
return true if exactly equal or if equal but modified,
otherwise return false
return type: BooleanPlus
'''
eqlanguage = cell1["language"] == cell2["language"]
eqinput = cell1["input"] == cell2["input"]
eqoutputs =... | 0.002433 |
def set_display_label(self, display_label):
"""Seta a display label.
arg: display_label (string): the new display label
raise: InvalidArgument - ``display_label`` is invalid
raise: NoAccess - ``display_label`` cannot be modified
raise: NullArgument - ``display_label`` is `... | 0.002725 |
def _url_builder(url_root,api_key,path,params):
"""
Helper funcation to build a parameterized url.
"""
params['api_key'] = api_key
url_end = urlencode(params)
url = "%s%s%s" % (url_root,path,url_end)
return url | 0.02521 |
def _dbus_get_object(bus_name, object_name):
""" Fetches DBUS proxy object given the specified parameters.
`bus_name`
Name of the bus interface.
`object_name`
Object path related to the interface.
Returns object or ``None``.
"""
try:
bus = dbus.... | 0.002088 |
def read_minutes_months(self, s):
"""Return a (minutes, months) tuple after parsing a "M,N" string.
"""
try:
(minutes, months) = [int(x.strip()) for x in s.split(',')]
return minutes, months
except Exception:
raise ParsingError(('Value should be "minut... | 0.005988 |
def set_callbacks(self, **dic_functions):
"""Register callbacks needed by the interface object"""
for action in self.interface.CALLBACKS:
try:
f = dic_functions[action]
except KeyError:
pass
else:
setattr(self.interface.... | 0.007022 |
def _emiss_ep(self, Eph):
"""
Electron-proton bremsstrahlung emissivity per unit photon energy
"""
if self.weight_ep == 0.0:
return np.zeros_like(Eph)
gam = np.vstack(self._gam)
eps = (Eph / mec2).decompose().value
# compute integral with electron dis... | 0.003781 |
def get_block(self, x,y,z, coord=False):
"""Return the id of the block at x, y, z."""
"""
Laid out like:
(0,0,0), (0,1,0), (0,2,0) ... (0,127,0), (0,0,1), (0,1,1), (0,2,1) ... (0,127,1), (0,0,2) ... (0,127,15), (1,0,0), (1,1,0) ... (15,127,15)
::
block... | 0.014423 |
def log_time(logger):
"""
Decorator to log the execution time of a function
"""
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
end = time.time()
_log_time(logger, func.__na... | 0.002457 |
def flush_mod(self):
"""Flush all pending LDAP modifications."""
for dn in self.__pending_mod_dn__:
try:
if self.__ro__:
for mod in self.__mod_queue__[dn]:
if mod[0] == ldap.MOD_DELETE:
mod_str = "DELETE"... | 0.001509 |
def format_help(self, formatter):
"""
Format an option group's help text, outdenting the title so it's
flush with the "SCons Options" title we print at the top.
"""
formatter.dedent()
result = formatter.format_heading(self.title)
formatter.indent()
result ... | 0.004926 |
def hash(filename):
'''returns string of MD5 hash of given filename'''
buffer_size = 10*1024*1024
m = hashlib.md5()
with open(filename) as f:
buff = f.read(buffer_size)
while len(buff)>0:
m.update(buff)
buff = f.read(buffer_size)
dig = m.digest()
return ''... | 0.005634 |
def is_datetime(value,
minimum = None,
maximum = None,
coerce_value = False,
**kwargs):
"""Indicate whether ``value`` is a :class:`datetime <python:datetime.datetime>`.
:param value: The value to evaluate.
:param minimum: If supplied, will ma... | 0.010538 |
def suitify(parent):
"""
Turn the stuff after the first colon in parent's children
into a suite, if it wasn't already
"""
for node in parent.children:
if node.type == syms.suite:
# already in the prefered format, do nothing
return
# One-liners have no suite node,... | 0.002484 |
def get_rating(postid, userid):
'''
Get the rating of certain post and user.
'''
try:
recs = TabRating.select().where(
(TabRating.post_id == postid) & (TabRating.user_id == userid)
)
except:
return False
if recs.count() ... | 0.0075 |
def tradingpairs(self, pairs):
'''
Use this function to query price and volume data for MANY trading pairs.
Usage: http://api.cryptocoincharts.info/tradingPairs/[currency1_currency2,currency2_currency3,...]
A example pair: currency1_currency2 = "doge_btc"
... | 0.008779 |
def get_proxy_config(self, headers, path):
"""
stub. this really needs to be a call to the remote
restful interface to get the appropriate host and
headers to use for this upload
"""
self.ofs.conn.add_aws_auth_header(headers, 'PUT', path)
from pprint import pprint... | 0.004808 |
def get_order_specification_visitor(name, registry=None):
"""
Returns the class registered as the order specification
visitor utility under the given name (one of the
:const:`everest.querying.base.EXPRESSION_KINDS` constants).
:returns: class implementing
:class:`everest.interfaces.IOrderSp... | 0.002066 |
def take_at_least_n_seconds(time_s):
"""A context manager which ensures it takes at least time_s to execute.
Example:
with take_at_least_n_seconds(5):
do.Something()
do.SomethingElse()
# if Something and SomethingElse took 3 seconds, the with block with sleep
# for 2 seconds before exiting.... | 0.008982 |
def _is_running(self, tries=10):
"""
Return if the server is running according to pg_ctl.
"""
# We can't possibly be running if our base_pathname isn't defined.
if not self.base_pathname:
return False
if tries < 1:
raise ValueError('tries must be ... | 0.00241 |
def _init_step(self):
"""Initialize next step of simulation to be run.
"""
self._age += 1
self.env.age = self._age
self._log(logging.INFO, "")
self._log(logging.INFO, "\t***** Step {:0>4} *****". format(self.age))
self._log(logging.INFO, "")
self._agents_t... | 0.004577 |
def rotation(cls, angle, pivot=None):
"""Create a rotation transform at the specified angle,
optionally about the specified pivot point.
:param angle: Rotation angle in degrees
:type angle: float
:param pivot: Point to rotate about, if omitted the
rotation is about t... | 0.003171 |
def make_heading_abstracts(self, heading_div):
"""
An article may contain data for various kinds of abstracts. This method
works on those that are included in the Heading. This is displayed
after the Authors and Affiliations.
Metadata element, content derived from FrontMatter
... | 0.005405 |
def is_closest_date_parameter(task, param_name):
""" Return the parameter class of param_name on task. """
for name, obj in task.get_params():
if name == param_name:
return hasattr(obj, 'use_closest_date')
return False | 0.004 |
def remove(mod, persist=False, comment=True):
'''
Remove the specified kernel module
mod
Name of module to remove
persist
Also remove module from /boot/loader.conf
comment
If persist is set don't remove line from /boot/loader.conf but only
comment it
CLI Examp... | 0.002283 |
def flatten(iterable, maps=None, unique=False) -> list:
"""
Flatten any array of items to list
Args:
iterable: any array or value
maps: map items to values
unique: drop duplicates
Returns:
list: flattened list
References:
https://stackoverflow.com/a/4085770... | 0.003247 |
def changeLocalUserPassword(self, login, user, password):
"""
Parameters:
- login
- user
- password
"""
self.send_changeLocalUserPassword(login, user, password)
self.recv_changeLocalUserPassword() | 0.004329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.