text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def make_lines_texture(num_lines=10, resolution=50):
"""Makes a texture consisting of a given number of horizontal lines.
Args:
num_lines (int): the number of lines to draw
resolution (int): the number of midpoints on each line
Returns:
A texture.
"""
x, y = np.meshgrid(
... | 0.004082 |
def tokens(self):
"""
`generator` : the tokens in this segment
"""
for subsegment_or_token in self:
if isinstance(subsegment_or_token, Segment):
subsegment = subsegment_or_token
for token in subsegment.tokens():
yield token
... | 0.00489 |
def _det_inference(self):
"""
Internal method for determining the inference method
"""
# 2 random effects with complete design -> gp2KronSum
# TODO: add check for low-rankness, use GP3KronSumLR and GP2KronSumLR when possible
if (self.n_randEffs==2) and (~sp.isnan(self.Y).... | 0.009732 |
def get_host(self, hostname):
""" Returns a Host dict with config options, or None if none exists"""
if hostname in self.get_hosts():
return self.load_ssh_conf().lookup(hostname)
logger.warn('Tried to find host with name {0}, but host not found'.format(hostname))
return None | 0.009404 |
def _ResolutionOrder(self, variables_to_solve):
"""
return a list of lists of tuples (block,output,ndof) to be solved
"""
# Gp=nx.DiGraph()
#
# for i in range(nvar):
# Gp.add_node('v'+str(i),bipartite=0)
#
# for i in range(neq):
# Gp.add_node('e'+str(i),bipartite=1)
# ... | 0.000501 |
def cross_dir(self, forcex86=False):
r"""
Cross platform specific subfolder.
Parameters
----------
forcex86: bool
Use 'x86' as current architecture even if current acritecture is
not x86.
Return
------
subfolder: str
'... | 0.003241 |
def get_interpolation_function(self, times, data):
""" Initializes interpolation model
:param times: Array of reference times in second relative to the first timestamp
:type times: numpy.array
:param data: One dimensional array of time series
:type data: numpy.array
:ret... | 0.008529 |
def enterContainer(self, entry, query):
"""
Enters a new container for the given entry widget.
:param entry | <XOrbQueryEntryWidget> || None
"""
self._compoundStack.append(entry)
self.addContainer(query) | 0.011029 |
def delete_rows(self, row, no_rows=1):
"""Deletes no_rows rows and marks grid as changed"""
# Mark content as changed
post_command_event(self.main_window, self.ContentChangedMsg)
tab = self.grid.current_table
try:
self.code_array.delete(row, no_rows, axis=0, tab=ta... | 0.004237 |
def avail_locations(call=None):
'''
List all available locations
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
conn = get_conn()
... | 0.004902 |
def mutualReceptions(self, idA, idB):
""" Returns all pairs of dignities in mutual reception. """
AB = self.receives(idA, idB)
BA = self.receives(idB, idA)
# Returns a product of both lists
return [(a,b) for a in AB for b in BA] | 0.011194 |
def decrease_exponent_to(self, new_exp):
"""Return an EncryptedNumber with same value but lower exponent.
If we multiply the encoded value by :attr:`EncodedNumber.BASE` and
decrement :attr:`exponent`, then the decoded value does not change.
Thus we can almost arbitrarily ratchet down th... | 0.001461 |
def drag_and_release(self, start_x, start_y, end_x, end_y, pre_dl=None, post_dl=None):
"""Drag something from (start_x, start_y) to (end_x, endy)
**中文文档**
从start的坐标处鼠标左键单击拖曳到end的坐标处
start, end是tuple. 格式是(x, y)
"""
self.delay(pre_dl)
self.m.press(start_x, start_y... | 0.007042 |
def create_signed_value(
self, name: str, value: Union[str, bytes], version: int = None
) -> bytes:
"""Signs and timestamps a string so it cannot be forged.
Normally used via set_secure_cookie, but provided as a separate
method for non-cookie uses. To decode a value not stored
... | 0.003707 |
def run_query(self, body):
"""
Run a query for entities.
.. seealso::
https://cloud.google.com/datastore/docs/reference/rest/v1/projects/runQuery
:param body: the body of the query request.
:type body: dict
:return: the batch of query results.
:rtype... | 0.003515 |
def open_hierarchy(self, path, relative_to_object_id, object_id, create_file_type=0):
"""
CreateFileType
0 - Creates no new object.
1 - Creates a notebook with the specified name at the specified location.
2 - Creates a section group with the specified name at the specifi... | 0.012559 |
def toggle_pac(self):
"""Enable and disable PAC options."""
if Pac is not None:
pac_on = self.pac['pac_on'].get_value()
self.pac['prep'].setEnabled(pac_on)
self.pac['box_metric'].setEnabled(pac_on)
self.pac['box_complex'].setEnabled(pac_on)
sel... | 0.001209 |
def _add_crud(self, model_data, object_type, results):
"""
Creates a menu entry for given model data.
Updates results in place.
Args:
model_data: Model data.
object_type: Relation name.
results: Results dict.
"""
model = model_registry... | 0.004348 |
def save_report(session):
'''
Saves the session to a temp file, and returns that path.
Also prunes the number of reports to 10 so there aren't loads building up.
'''
# prune this folder to contain the last 10 sessions
previous_reports = glob.glob(os.path.join(report_dir(), '*.pyireport'))
pr... | 0.002878 |
def eval_string(self, s):
"""
Returns the tristate value of the expression 's', represented as 0, 1,
and 2 for n, m, and y, respectively. Raises KconfigError if syntax
errors are detected in 's'. Warns if undefined symbols are referenced.
As an example, if FOO and BAR are trista... | 0.001353 |
def validateNodeMsg(self, wrappedMsg):
"""
Validate another node's message sent to this node.
:param wrappedMsg: Tuple of message and the name of the node that sent
the message
:return: Tuple of message from node and name of the node
"""
msg, frm = wrappedMsg
... | 0.003643 |
def _mark_lines(lines, sender):
"""Mark message lines with markers to distinguish signature lines.
Markers:
* e - empty line
* s - line identified as signature
* t - other i.e. ordinary text line
>>> mark_message_lines(['Some text', '', 'Bob'], 'Bob')
'tes'
"""
global EXTRACTOR
... | 0.000982 |
def parse_hex_color(value):
"""
Convert a CSS color in hexadecimal notation into its R, G, B components.
:param value: A CSS color in hexadecimal notation (a string like '#000000').
:return: A tuple with three integers (with values between 0 and 255)
corresponding to the R, G and B compone... | 0.002436 |
def get_paths_cfg(
sys_file='pythran.cfg',
platform_file='pythran-{}.cfg'.format(sys.platform),
user_file='.pythranrc'
):
"""
>>> os.environ['HOME'] = '/tmp/test'
>>> get_paths_cfg()['user']
'/tmp/test/.pythranrc'
>>> os.environ['HOME'] = '/tmp/test'
>>> os.environ['XDG_CONFIG_HOME']... | 0.001751 |
def set_value(self, option, value, index=None):
"""
Sets the value on the given option.
:param option: The name of the option as it appears in the config file
:param value: The value that is being applied. If this section is indexed then the
value must be a list (to be applied di... | 0.0076 |
def unwrap(self, value):
"""
A helper method for unwrapping the loaderplugin fragment out of
the provided value (typically a modname) and return it.
Note that the filter chaining is very implementation specific to
each and every loader plugin and their specific toolchain, so
... | 0.002389 |
def enterprise_customer_required(view):
"""
Ensure the user making the API request is associated with an EnterpriseCustomer.
This decorator attempts to find an EnterpriseCustomer associated with the requesting
user and passes that EnterpriseCustomer to the view as a parameter. It will return a
Perm... | 0.004181 |
def connectDropzone( self,
rect,
slot,
color = None,
style = None,
name = '',
toolTip = '' ):
"""
Connects the inputed dropzone to the given slot at t... | 0.030601 |
def nnz_obs_names(self):
""" wrapper around pyemu.Pst.nnz_obs_names for listing non-zero
observation names
Returns
-------
nnz_obs_names : list
pyemu.Pst.nnz_obs_names
"""
if self.__pst is not None:
return self.pst.nnz_obs_names
... | 0.008108 |
def hyphen(self):
'''
Returns ISBN number with segment hypenation
Data obtained from https://www.isbn-international.org/
https://www.isbn-international.org/export_rangemessage.xml
@return: ISBN formated as ISBN13 with hyphens
'''
if not ISBN.hyphenRange:
... | 0.004808 |
def genCaCert(self, name, signas=None, outp=None, save=True):
'''
Generates a CA keypair.
Args:
name (str): The name of the CA keypair.
signas (str): The CA keypair to sign the new CA with.
outp (synapse.lib.output.Output): The output buffer.
Example... | 0.002453 |
def find_version(*paths):
'''reads a file and returns the defined __version__ value'''
version_match = re.search(r"^__version__ ?= ?['\"]([^'\"]*)['\"]",
read(*paths), re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version s... | 0.003049 |
def _uprint(dest, text):
"""
Write text to dest, adding a newline character.
Text may be a unicode string, or a byte string in UTF-8 encoding.
It must not be None.
If dest is None, the text is encoded to a codepage suitable for the current
stdout and is written to stdout.
Otherwise, dest ... | 0.000572 |
def msg2usernames(msg, **config):
''' Return cached fedmsg.meta.msg2usernames(...) '''
if not _cache.is_configured:
_cache.configure(**config['fmn.rules.cache'])
key = "|".join(['usernames', msg['msg_id']]).encode('utf-8')
creator = lambda: fedmsg.meta.msg2usernames(msg, **config)
return _... | 0.005666 |
def boot(zone, single=False, altinit=None, smf_options=None):
'''
Boot (or activate) the specified zone.
zone : string
name or uuid of the zone
single : boolean
boots only to milestone svc:/milestone/single-user:default.
altinit : string
valid path to an alternative executab... | 0.002982 |
def from_genes(cls, genes: List[ExpGene]):
"""Initialize instance using a list of `ExpGene` objects."""
data = [g.to_dict() for g in genes]
index = [d.pop('ensembl_id') for d in data]
table = cls(data, index=index)
return table | 0.007491 |
def exists(self, path_or_index):
"""
Checks if a path exists in the document. This is meant to be used
for a corresponding :meth:`~couchbase.subdocument.exists` request.
:param path_or_index: The path (or index) to check
:return: `True` if the path exists, `False` if the path do... | 0.002837 |
def load_freesurfer_geometry(filename, to='mesh', warn=False):
'''
load_freesurfer_geometry(filename) yields the data stored at the freesurfer geometry file given
by filename. The optional argument 'to' may be used to change the kind of data that is
returned.
The following are valid settings fo... | 0.004667 |
def fix_logging_path(config, main_section):
"""
Expand environment variables and user home (~) in the log.file and return
as relative path.
"""
log_file = config.get(main_section, 'log.file')
if log_file:
log_file = os.path.expanduser(os.path.expandvars(log_file))
if os.path.isab... | 0.002494 |
def parse_message(
self, body, timestamp=None, nonce=None, msg_signature=None
):
"""
解析获取到的 Raw XML ,如果需要的话进行解密,返回 WeRoBot Message。
:param body: 微信服务器发来的请求中的 Body。
:return: WeRoBot Message
"""
message_dict = parse_xml(body)
if "Encrypt" in message_dict... | 0.004747 |
def _convert_value(val):
"""Handle multiple input type values.
"""
def _is_number(x, op):
try:
op(x)
return True
except ValueError:
return False
if isinstance(val, (list, tuple)):
return [_convert_value(x) for x in val]
elif val is None:
... | 0.001085 |
def protected_resource_view(scopes=None):
"""
View decorator. The client accesses protected resources by presenting the
access token to the resource server.
https://tools.ietf.org/html/rfc6749#section-7
"""
if scopes is None:
scopes = []
def wrapper(view):
def view_wrapper(r... | 0.003331 |
def matches(self, node, value):
"""
Returns whether the given node matches the filter rule with the given value.
Args:
node (Element): The node to filter.
value (object): The desired value with which the node should be evaluated.
Returns:
bool: Wheth... | 0.004603 |
def debugTreePrint(node,pfx="->"):
"""Purely a debugging aid: Ascii-art picture of a tree descended from node"""
print pfx,node.item
for c in node.children:
debugTreePrint(c," "+pfx) | 0.036269 |
def _Complete(self):
"""Marks the hunt as completed."""
self._RemoveForemanRule()
if "w" in self.hunt_obj.mode:
self.hunt_obj.Set(self.hunt_obj.Schema.STATE("COMPLETED"))
self.hunt_obj.Flush() | 0.013889 |
def selectnotin(table, field, value, complement=False):
"""Select rows where the given field is not a member of the given value."""
return select(table, field, lambda v: v not in value,
complement=complement) | 0.004255 |
def git_checkout(branch_name, create=False):
# type: (str, bool) -> None
""" Checkout or create a given branch
Args:
branch_name (str):
The name of the branch to checkout or create.
create (bool):
If set to **True** it will create the branch instead of checking it
... | 0.002092 |
def feed_index(service, opts):
"""Feed the named index in a specific manner."""
indexname = opts.args[0]
itype = opts.kwargs['ingest']
# get index handle
try:
index = service.indexes[indexname]
except KeyError:
print("Index %s not found" % indexname)
return
if ity... | 0.001839 |
def _set_nameserver_cos(self, v, load=False):
"""
Setter method for nameserver_cos, mapped from YANG variable /brocade_nameserver_rpc/get_nameserver_detail/output/show_nameserver/nameserver_cos (nameserver-cos-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_nameser... | 0.005033 |
def process_config_section(cls, config_section, storage):
"""Process the config section and store the extracted data in
the param:`storage` (as outgoing param).
"""
# -- CONCEPT:
# if not storage:
# # -- INIT DATA: With default parts.
# storage.update(dict... | 0.002564 |
def zcat_make_temps(data, raws, num, tmpdir, optim, njobs, start):
"""
Call bash command 'cat' and 'split' to split large files. The goal
is to create N splitfiles where N is a multiple of the number of processors
so that each processor can work on a file in parallel.
"""
printstr = ' chunking... | 0.005727 |
def _add_data(self, eopatch, data):
""" Adds downloaded data to EOPatch """
valid_mask = data[..., -1]
data = data[..., :-1]
if data.ndim == 3:
data = data.reshape(data.shape + (1,))
if not self.feature_type.is_time_dependent():
if data.shape[0] > 1:
... | 0.005107 |
def sort_menus(c):
"""
sort_menus goes through the items and sorts them based on
their weight
"""
for name in c.items:
if not c.sorted[name]:
c.items[name].sort(key=lambda x: x.weight)
c.sorted[name] = True | 0.006897 |
def get_gradebook_column(self):
"""Gets the ``GradebookColumn``.
return: (osid.grading.GradebookColumn) - the ``GradebookColumn``
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from temp... | 0.005417 |
def add(self, data, overwrite=False):
"""Add given data string by guessing its format. The format must be
Motorola S-Records, Intel HEX or TI-TXT. Set `overwrite` to
``True`` to allow already added data to be overwritten.
"""
if is_srec(data):
self.add_srec(data, ov... | 0.003738 |
def get_body_region(defined):
"""Return the start and end offsets of function body"""
scope = defined.get_scope()
pymodule = defined.get_module()
lines = pymodule.lines
node = defined.get_ast()
start_line = node.lineno
if defined.get_doc() is None:
start_line = node.body[0].lineno
... | 0.001185 |
def compile_flags(args):
"""
Build a dictionnary with an entry for cppflags, ldflags, and cxxflags.
These options are filled according to the command line defined options
"""
compiler_options = {
'define_macros': args.defines,
'undef_macros': args.undefs,
'include_dirs': a... | 0.00157 |
def lmfit_jacobian(pars, x, y, errs=None, B=None, emp=False):
"""
Wrapper around :func:`AegeanTools.fitting.jacobian` and :func:`AegeanTools.fitting.emp_jacobian`
which gives the output in a format that is required for lmfit.
Parameters
----------
pars : lmfit.Model
The model parameters... | 0.003026 |
def update_loan_entry(database, entry):
"""Update a record of a loan report in the provided database.
@param db: The MongoDB database to operate on. The loans collection will be
used from this database.
@type db: pymongo.database.Database
@param entry: The entry to insert into the database, upd... | 0.003565 |
def updateGeometry(self):
"""Move widget to point under cursor
"""
WIDGET_BORDER_MARGIN = 5
SCROLLBAR_WIDTH = 30 # just a guess
sizeHint = self.sizeHint()
width = sizeHint.width()
height = sizeHint.height()
cursorRect = self._qpart.cursorRect()
... | 0.002235 |
def _completion_checker(async_id, context_id):
"""Check if all Async jobs within a Context have been run."""
if not context_id:
logging.debug("Context for async %s does not exist", async_id)
return
context = FuriousContext.from_id(context_id)
marker = FuriousCompletionMarker.get_by_id(... | 0.001289 |
def locate_arcgis():
'''
Find the path to the ArcGIS Desktop installation.
Keys to check:
HLKM/SOFTWARE/ESRI/ArcGIS 'RealVersion' - will give the version, then we can use
that to go to
HKLM/SOFTWARE/ESRI/DesktopXX.X 'InstallDir'. Where XX.X is the version
We may need to check HKLM/SOFTWARE/Wow6432Node/... | 0.005482 |
def QA_indicator_PBX(DataFrame, N1=3, N2=5, N3=8, N4=13, N5=18, N6=24):
'瀑布线'
C = DataFrame['close']
PBX1 = (EMA(C, N1) + EMA(C, 2 * N1) + EMA(C, 4 * N1)) / 3
PBX2 = (EMA(C, N2) + EMA(C, 2 * N2) + EMA(C, 4 * N2)) / 3
PBX3 = (EMA(C, N3) + EMA(C, 2 * N3) + EMA(C, 4 * N3)) / 3
PBX4 = (EMA(C, N4) + ... | 0.001616 |
def settings_view_for_block(block_wrapper, settings_view_factory):
"""
Returns the settings view for an arbitrary block.
Args:
block_wrapper (BlockWrapper): The block for which a settings
view is to be returned
settings_view_factory (SettingsViewFactory):... | 0.002907 |
def build_act_with_param_noise(make_obs_ph, q_func, num_actions, scope="deepq", reuse=None, param_noise_filter_func=None):
"""Creates the act function with support for parameter space noise exploration (https://arxiv.org/abs/1706.01905):
Parameters
----------
make_obs_ph: str -> tf.placeholder or TfInp... | 0.006655 |
def to_output(self, value):
"""Convert value to process output format."""
return json.loads(resolwe_runtime_utils.save(self.name, str(value))) | 0.012658 |
def plot_vs_mass(dataset, vars, filename, bins=60):
""" Plot 2D marginalised posteriors of the 'vars' vs the dark matter mass.
We plot the one sigma, and two sigma filled contours. More contours can be plotted
which produces something more akin to a heatmap.
If one require more complicated plotting, it... | 0.005323 |
def init_UI(self):
"""
Builds User Interface for the interpretation Editor
"""
#set fonts
FONT_WEIGHT=1
if sys.platform.startswith('win'): FONT_WEIGHT=-1
font1 = wx.Font(9+FONT_WEIGHT, wx.SWISS, wx.NORMAL, wx.NORMAL, False, self.font_type)
font2 = wx.Font... | 0.016602 |
def dump_stats(self, filename):
"""
Similar to profile.Profile.dump_stats - but different output format !
"""
if _isCallgrindName(filename):
with open(filename, 'w') as out:
self.callgrind(out)
else:
with io.open(filename, 'w', errors='repl... | 0.005435 |
def append_to_list(self, source, start=None, hasIndex=False):
'''Appends new list to self.nameDict
Argument:
source -- source of new name list (filename or list)
start -- starting index of new list
hasIndex -- the file is already indexed
'''
nfy = Numberify()
... | 0.003236 |
def wait_for(self, timeout):
"""
A decorator factory that ensures the wrapped function runs in the
reactor thread.
When the wrapped function is called, its result is returned or its
exception raised. Deferreds are handled transparently. Calls will
timeout after the given... | 0.001597 |
def calcAcceptanceRatio(self, V, W):
"""
Given a order vector V and a proposed order vector W, calculate the acceptance ratio for
changing to W when using MCMC.
ivar: dict<int,<dict,<int,int>>> wmg: A two-dimensional dictionary that associates integer
representations of eac... | 0.008713 |
def slicedIterator(sourceList, sliceSize):
"""
:param: sourceList: list which need to be sliced
:type: list
:param: sliceSize: size of the slice
:type: int
:return: iterator of the sliced list
"""
start = 0
end = 0
while len(sourceList) > end:
end = start + sliceSize
... | 0.002681 |
def bivconvolve (sx_a, sy_a, cxy_a, sx_b, sy_b, cxy_b):
"""Given two independent bivariate distributions, compute a bivariate
distribution corresponding to their convolution.
I'm sure this is worked out in a ton of places, but I got the equations
from Pineau+ (2011A&A...527A.126P).
Returns: (sx_c,... | 0.011513 |
def on_resize(self, event):
"""Resize handler
Parameters
----------
event : instance of Event
The event.
"""
if self._aspect is None:
return
w, h = self._canvas.size
aspect = self._aspect / (w / h)
self.scale = (self.scale[... | 0.005362 |
def format_formula(formula):
"""
Converts str of chemical formula into
latex format for labelling purposes
Args:
formula (str): Chemical formula
"""
formatted_formula = ""
number_format = ""
for i, s in enumerate(formula):
if s.isdigit():
if not number_forma... | 0.001316 |
def activationFunctionASIG(self, x):
"""
Determine the activation of a node based on that nodes net input.
"""
def act(v):
if v < -15.0: return 0.0
elif v > 15.0: return 1.0
else: return 1.0 / (1.0 + Numeric.exp(-v))
return Numeric.array(lis... | 0.020588 |
def parse(self, rec):
"""Retrieve row data from files associated with the ISATabRecord.
"""
final_studies = []
for study in rec.studies:
source_data = self._parse_study(study.metadata["Study File Name"],
["Source Name", "Sample Name... | 0.008574 |
def write_wonambi(data, filename, subj_id='', dtype='float64'):
"""Write file in simple Wonambi format.
Parameters
----------
data : instance of ChanTime
data with only one trial
filename : path to file
file to export to (the extensions .won and .dat will be added)
subj_id : str... | 0.000635 |
def new_project():
"""New Project."""
form = NewProjectForm()
if not form.validate_on_submit():
return jsonify(errors=form.errors), 400
data = form.data
data['slug'] = slugify(data['name'])
data['owner_id'] = get_current_user_id()
id = add_instance('project', **data)
if not id... | 0.002151 |
def validate_examples(example_file):
"""Validate that examples are well formed.
Pi should sum to 1.0
value should be {-1,1}
Usage:
validate_examples("../data/300.tfrecord.zz")
"""
def test_example(raw):
example = tf.train.Example()
example.ParseFromString(raw)
... | 0.003979 |
def pending_assignment(self):
"""Return the pending partition assignment that this state represents."""
return {
self.partitions[pid].name: [
self.brokers[bid].id for bid in self.replicas[pid]
]
for pid in set(self.pending_partitions)
} | 0.009615 |
def get_active_window_pos():
'''screen coordinates massaged so that movewindow command works to
restore the window to the same position
returns x, y
'''
# http://stackoverflow.com/questions/26050788/in-bash-on-ubuntu-14-04-unity-how-can-i-get-the-total-size-of-an-open-window-i/26060527#26060527
... | 0.008726 |
def configparser(self):
"""
Adapter to dump/load INI format strings and files using standard library's
``ConfigParser`` (or the backported configparser module in Python 2).
Returns:
ConfigPersistenceAdapter
"""
if self._configparser_adapter is None:
... | 0.006421 |
def check(self):
"""
Basic checks that don't depend on any context.
Adapted from Bicoin Code: main.cpp
"""
self._check_tx_inout_count()
self._check_txs_out()
self._check_txs_in()
# Size limits
self._check_size_limit() | 0.00692 |
def randomise_labels(
self,
inplace=False,
):
""" Shuffles the leaf labels, but doesn't alter the tree structure """
if not inplace:
t = self.copy()
else:
t = self
names = list(t.labels)
random.shuffle(names)
for l in ... | 0.009368 |
def load_config_yaml(self, flags, config_dict):
""" Load config dict and yaml dict and then override both with flags dict. """
if config_dict is None:
print('Config File not specified. Using only input flags.')
return flags
try:
config_yaml_dict = self.cfg_fro... | 0.008708 |
def validate_config_key(ctx, param, value):
"""Validate a configuration key according to `section.item`."""
if not value:
return value
try:
section, item = value.split(".", 1)
except ValueError:
raise click.BadArgumentUsage("Given key does not contain a section name.")
else:... | 0.005731 |
def _any(self, memory, addr, **kwargs):
"""
Gets any solution of an address.
"""
return memory.state.solver.eval(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | 0.015 |
def get_content_object(self, page, language, ctype):
"""Gets the latest published :class:`Content <pages.models.Content>`
for a particular page, language and placeholder type."""
params = {
'language': language,
'type': ctype,
'page': None if page is fake_page... | 0.004211 |
def render_string(self, template_name, **kwargs):
"""
添加注入模板的自定义参数等信息
"""
if hasattr(self, "session"): kwargs["session"] = self.session
return super(BaseHandler, self).render_string(template_name, **kwargs) | 0.011765 |
def config_delete(args):
""" Remove a method config from a workspace """
r = fapi.delete_workspace_config(args.project, args.workspace,
args.namespace, args.config)
fapi._check_response_code(r, [200,204])
return r.text if r.text else None | 0.010204 |
def dasonw(fname, ftype, ifname, ncomch):
"""
Internal undocumented command for creating a new DAS file
:param fname: filename
:type fname: str
:param ftype: type
:type ftype: str
:param ifname: internal file name
:type ifname: str
:param ncomch: amount of comment area
:type... | 0.009445 |
def gen_nf_quick_check(output, ascii_props=False, append=False, prefix=""):
"""Generate quick check properties."""
categories = []
nf = {}
all_chars = ALL_ASCII if ascii_props else ALL_CHARS
file_name = os.path.join(HOME, 'unicodedata', UNIVERSION, 'DerivedNormalizationProps.txt')
with codecs.o... | 0.001841 |
def get_market_most_active(*args, **kwargs):
"""
MOVED to iexfinance.stocks.get_market_most_active
"""
import warnings
warnings.warn(WNG_MSG, ("get_market_most_active",
"stocks.get_market_most_active"))
return stocks.get_market_most_active(*args, **kwargs) | 0.003175 |
def show_dependencies(self, stream=sys.stdout):
"""Writes to the given stream the ASCII representation of the dependency tree."""
def child_iter(node):
return [d.node for d in node.deps]
def text_str(node):
return colored(str(node), color=node.status.color_opts["color"])... | 0.006961 |
def get_all_maintenance_window(self, **kwargs): # noqa: E501
"""Get all maintenance windows for a customer # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get... | 0.002101 |
def from_dict(data, ctx):
"""
Instantiate a new MarketOrderTransaction from a dict (generally from
loading a JSON response). The data used to instantiate the
MarketOrderTransaction is a shallow copy of the dict passed in, with
any complex child types instantiated appropriately.
... | 0.00066 |
def dict(self):
"""A dict that holds key/values for all of the properties in the
object.
:return:
"""
d = {p.key: getattr(self, p.key) for p in self.__mapper__.attrs
if p.key not in ('contents', 'dataset')}
d['modified_datetime'] = self.modified_datetime
... | 0.005236 |
def standardize_cell(cell,
to_primitive=False,
no_idealize=False,
symprec=1e-5,
angle_tolerance=-1.0):
"""Return standardized cell.
Args:
cell, symprec, angle_tolerance:
See the docstring of get_symmetry.
... | 0.00052 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.