text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def is_LaTeX(flist,env,abspath):
"""Scan a file list to decide if it's TeX- or LaTeX-flavored."""
# We need to scan files that are included in case the
# \documentclass command is in them.
# get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS']
savedpath = modify_env_var(env, 'TEXIN... | 0.009897 |
def data_msg( msg, mtype=None ):
"""
Return a Jupyter display_data message, in both HTML & text formats, by
formatting a given single message. The passed message may be:
* An exception (including a KrnlException): will generate an error message
* A list of messages (with \c mtype equal to \c mu... | 0.018719 |
def add_node(self, node_descriptor):
"""Add a node to the sensor graph based on the description given.
The node_descriptor must follow the sensor graph DSL and describe
a node whose input nodes already exist.
Args:
node_descriptor (str): A description of the node to be adde... | 0.004218 |
def repos(self, repo_type='public', organization='llnl'):
"""
Retrieves info about the repos of the current organization.
"""
print 'Getting repos.'
for repo in self.org_retrieved.iter_repos(type=repo_type):
#JSON
json = repo.to_json()
self.rep... | 0.003817 |
def pause(self, cause):
"""
Pause the current pipeline.
:param cause: reason for pausing the pipeline.
"""
self._pipeline.pause(name=self.data.name, cause=cause) | 0.009901 |
def unmount(self, path):
"""
Remove a mountpoint from the filesystem.
"""
del self._mountpoints[self._join_chunks(self._normalize_path(path))] | 0.011494 |
def CallFlow(self,
flow_name=None,
next_state=None,
request_data=None,
client_id=None,
base_session_id=None,
**kwargs):
"""Creates a new flow and send its responses to a state.
This creates a new flow. The flow may send b... | 0.005908 |
def _mutect2_filter(broad_runner, in_file, out_file, ref_file):
"""Filter of MuTect2 calls, a separate step in GATK4.
"""
params = ["-T", "FilterMutectCalls", "--reference", ref_file, "--variant", in_file, "--output", out_file]
return broad_runner.cl_gatk(params, os.path.dirname(out_file)) | 0.006536 |
def set_default_region(self, region):
"""
This sets the default region for detecting license plates. For example,
setting region to "md" for Maryland or "fr" for France.
:param region: A unicode/ascii string (Python 2/3) or bytes array (Python 3)
:return: None
"""
... | 0.007126 |
def _maybe_class_to_py_ast(_: GeneratorContext, node: MaybeClass) -> GeneratedPyAST:
"""Generate a Python AST node for accessing a potential Python module
variable name."""
assert node.op == NodeOp.MAYBE_CLASS
return GeneratedPyAST(
node=ast.Name(
id=Maybe(_MODULE_ALIASES.get(node.cl... | 0.007576 |
def distance_inches_ping(self):
"""
Measurement of the distance detected by the sensor,
in inches.
The sensor will take a single measurement then stop
broadcasting.
If you use this property too frequently (e.g. every
100msec), the sensor will sometimes lock up a... | 0.002729 |
def env_proxy_settings(selected_settings=None):
"""Get proxy settings from process environment variables.
Get charm proxy settings from environment variables that correspond to
juju-http-proxy, juju-https-proxy and juju-no-proxy (available as of 2.4.2,
see lp:1782236) in a format suitable for passing t... | 0.000461 |
def parse_neighbors(neighbors, vars=[]):
"""Convert a string of the form 'X: Y Z; Y: Z' into a dict mapping
regions to neighbors. The syntax is a region name followed by a ':'
followed by zero or more region names, followed by ';', repeated for
each region name. If you say 'X: Y' you don't need 'Y: X'... | 0.001318 |
def _sync_repo(self, repo_url: str, revision: str or None = None) -> Path:
'''Clone a Git repository to the cache dir. If it has been cloned before, update it.
:param repo_url: Repository URL
:param revision: Revision: branch, commit hash, or tag
:returns: Path to the cloned repository... | 0.002286 |
def options(self, parser, env):
"""Register commandline options.
"""
parser.add_option('--collect-only',
action='store_true',
dest=self.enableOpt,
default=env.get('NOSE_COLLECT_ONLY'),
help="E... | 0.004988 |
def _page(q, chunk=1000):
""" Quick utility to page a query, 1000 items at a time.
We need this so we don't OOM (out of memory) ourselves loading the world.
"""
offset = 0
while True:
r = False
for elem in q.limit(chunk).offset(offset):
r = True
yield elem
... | 0.002653 |
def _get_xml_dom(self):
"""
Collects all options set so far, and produce and return an
``xml.dom.minidom.Document`` representing the corresponding
XML.
"""
if self.site_control == SITE_CONTROL_NONE and \
any((self.domains, self.header_domains, self.identities)... | 0.001695 |
def csv_to_matrix(csv_file_path):
"""Load a CSV file into a Python matrix of strings.
Args:
csv_file_path: Full path to a valid CSV file (e.g. c:/ladybug/test.csv)
"""
mtx = []
with open(csv_file_path) as csv_data_file:
for row in csv_data_file:
mtx.append(row.split(',')... | 0.002976 |
def detunings_combinations(pairs):
r"""Return all combinations of detunings.
>>> Ne = 6
>>> Nl = 2
>>> omega_level = [0.0, 100.0, 100.0, 200.0, 200.0, 300.0]
>>> xi = np.zeros((Nl, Ne, Ne))
>>> coup = [[(1, 0), (2, 0)], [(3, 0), (4, 0), (5, 0)]]
>>> for l in range(Nl):
... for pair ... | 0.002904 |
def get_suggested_type_names(
schema: GraphQLSchema, type_: GraphQLOutputType, field_name: str
) -> List[str]:
"""
Get a list of suggested type names.
Go through all of the implementations of type, as well as the interfaces
that they implement. If any of those types include the provided field,
... | 0.000649 |
def compute_fd_hessian(fun, x0, epsilon, anagrad=True):
"""Compute the Hessian using the finite difference method
Arguments:
| ``fun`` -- the function for which the Hessian should be computed,
more info below
| ``x0`` -- the point at which the Hessian must be compu... | 0.001176 |
def ask_user(prompt: str, default: str = None) -> Optional[str]:
"""
Prompts the user, with a default. Returns user input from ``stdin``.
"""
if default is None:
prompt += ": "
else:
prompt += " [" + default + "]: "
result = input(prompt)
return result if len(result) > 0 else... | 0.003049 |
def send_msg(self, connection, data):
"""
Function to send messages
Parameters
----------
connection: socket or connection
data: data that can be serialized to json
"""
# serialize as JSON
msg = json.dumps(data)
# Prefix... | 0.00611 |
def xml_marshal_complete_multipart_upload(uploaded_parts):
"""
Marshal's complete multipart upload request based on *uploaded_parts*.
:param uploaded_parts: List of all uploaded parts, ordered by part number.
:return: Marshalled XML data.
"""
root = s3_xml.Element('CompleteMultipartUpload', {'x... | 0.001175 |
def copy(self, src_url, dst_url):
"""Copy an S3 object to another S3 location."""
src_bucket, src_key = _parse_url(src_url)
dst_bucket, dst_key = _parse_url(dst_url)
if not dst_bucket:
dst_bucket = src_bucket
params = {
'copy_source': '/'.join((src_bucket... | 0.004415 |
def cmp_code_objects(version, is_pypy, code_obj1, code_obj2, verify,
name=''):
"""
Compare two code-objects.
This is the main part of this module.
"""
# print code_obj1, type(code_obj2)
assert iscode(code_obj1), \
"cmp_code_object first object type is %s, not code" % ... | 0.005122 |
def _instantiateFont(self, path):
""" Return a instance of a font object with all the given subclasses"""
try:
return self.fontClass(path,
layerClass=self.layerClass,
libClass=self.libClass,
kerningClass=self.kerningClass,
group... | 0.015312 |
def executemanycolumns(self, sql, columns):
"""
Execute an SQL command or query with multiple parameter sets that are passed in
a column-wise fashion as opposed to the row-wise parameters in ``executemany()``.
This function is a turbodbc-specific extension to PEP-249.
:param sql... | 0.004695 |
def _to_diagonally_dominant(mat):
"""Make matrix unweighted diagonally dominant using the Laplacian."""
mat += np.diag(np.sum(mat != 0, axis=1) + 0.01)
return mat | 0.005747 |
def _get_spades_circular_nodes(self, fastg):
'''Returns set of names of nodes in SPAdes fastg file that are circular. Names will match those in spades fasta file'''
seq_reader = pyfastaq.sequences.file_reader(fastg)
names = set([x.id.rstrip(';') for x in seq_reader if ':' in x.id])
found... | 0.00578 |
def compiled_foreign_keys(self):
"""Returns compiled foreign key definitions"""
def get_column_args(column):
tmp = []
for arg_name, arg_val in column.items():
if arg_name not in ('name', 'type', 'reference'):
if arg_name in ('server_default', ... | 0.006494 |
def generalized_lsp_value(times, mags, errs, omega):
'''Generalized LSP value for a single omega.
The relations used are::
P(w) = (1/YY) * (YC*YC/CC + YS*YS/SS)
where: YC, YS, CC, and SS are all calculated at T
and where: tan 2omegaT = 2*CS/(CC - SS)
and where:
Y = ... | 0.007637 |
def scroll_one_line_up(event):
"""
scroll_offset -= 1
"""
w = find_window_for_buffer_name(event.cli, event.cli.current_buffer_name)
b = event.cli.current_buffer
if w:
# When the cursor is at the bottom, move to the previous line. (Otherwise, only scroll.)
if w.render_info:
... | 0.006699 |
def register_consumer():
"""Given a hostname and port attempting to be accessed,
return a unique consumer ID for accessing logs from
the referenced container."""
global _consumers
hostname, port = request.form['hostname'], request.form['port']
app_name = _app_name_from_forwarding_info(hostname,... | 0.001148 |
def WriteVarString(self, value, encoding="utf-8"):
"""
Write a string value to the stream.
Read more about variable size encoding here: http://docs.neo.org/en-us/node/network-protocol.html#convention
Args:
value (string): value to write to the stream.
encoding (s... | 0.004739 |
def update_note(note, **kwargs):
"""
Update a note
"""
note_i = _get_note(note.id)
if note.ref_key != note_i.ref_key:
raise HydraError("Cannot convert a %s note to a %s note. Please create a new note instead."%(note_i.ref_key, note.ref_key))
note_i.set_ref(note.ref_key, note.ref_id)
... | 0.007634 |
def tvdb_login(api_key):
""" Logs into TVDb using the provided api key
Note: You can register for a free TVDb key at thetvdb.com/?tab=apiregister
Online docs: api.thetvdb.com/swagger#!/Authentication/post_login=
"""
url = "https://api.thetvdb.com/login"
body = {"apikey": api_key}
status, co... | 0.001692 |
def disable_inheritance(path, objectType, copy=True):
'''
Disable inheritance on an object
Args:
path: The path to the object
objectType: The type of object (FILE, DIRECTORY, REGISTRY)
copy: True will copy the Inherited ACEs to the DACL before disabling inheritance
Returns (dic... | 0.002972 |
def list_pkgs(installed=True,
attributes=True):
'''
Lists installed packages. Due to how nix works, it defaults to just doing a ``nix-env -q``.
:param bool installed:
list only installed packages. This can be a very long list (12,000+ elements), so caution is advised.
Default:... | 0.002483 |
def _AbortJoin(self, timeout=None):
"""Aborts all registered processes by joining with the parent process.
Args:
timeout (int): number of seconds to wait for processes to join, where
None represents no timeout.
"""
for pid, process in iter(self._processes_per_pid.items()):
logger.... | 0.006969 |
async def brpoplpush(self, src, dst, timeout=0):
"""
Pop a value off the tail of ``src``, push it on the head of ``dst``
and then return it.
This command blocks until a value is in ``src`` or until ``timeout``
seconds elapse, whichever is first. A ``timeout`` value of 0 blocks
... | 0.004219 |
def all(self):
""" Returns list with vids of all indexed partitions. """
partitions = []
query = text("""
SELECT dataset_vid, vid
FROM partition_index;""")
for result in self.backend.library.database.connection.execute(query):
dataset_vid, vid = resu... | 0.006757 |
def _compute_schoenfeld_within_strata(self, X, T, E, weights):
"""
A positive value of the residual shows an X value that is higher than expected at that death time.
"""
# TODO: the diff_against is gross
# This uses Efron ties.
n, d = X.shape
if not np.any(E):
... | 0.002886 |
def streamReachAndWatershed(self,
delineate,
out_stream_order_grid,
out_network_connectivity_tree,
out_network_coordinates,
out_stream_reach_file,
... | 0.006178 |
def keyword(self, **kwargs):
"""
Search for keywords by name.
Args:
query: CGI escpaed string.
page: (optional) Minimum value of 1. Expected value is an integer.
Returns:
A dict respresentation of the JSON returned from the API.
"""
p... | 0.00432 |
def stage_tc_indicator_entity(self, indicator_data):
"""Convert JSON data to TCEntity.
Args:
indicator_data (str): [description]
Returns:
[type]: [description]
"""
path = '@.{value: summary, '
path += 'type: type, '
path += 'ownerName: ow... | 0.004228 |
def map_event_code(event_code):
"""Map a specific event_code to an event group."""
event_code = int(event_code)
# Honestly, these are just guessing based on the below event list.
# It could be wrong, I have no idea.
if 1100 <= event_code <= 1199:
return ALARM_GROUP
elif 3100 <= event_c... | 0.001087 |
def describe(self):
"""Describes the method.
:return: Description
:rtype: dict[str, object]
"""
return {
"name": self.name,
"params": self.params,
"returns": self.returns,
"description": self.description,
} | 0.006601 |
def get_content_scoped_package(self, feed_id, package_scope, unscoped_package_name, package_version, **kwargs):
"""GetContentScopedPackage.
[Preview API]
:param str feed_id:
:param str package_scope:
:param str unscoped_package_name:
:param str package_version:
:r... | 0.005502 |
def fetch_hg_push_log(repo_name, repo_url):
"""
Run a HgPushlog etl process
"""
newrelic.agent.add_custom_parameter("repo_name", repo_name)
process = HgPushlogProcess()
process.run(repo_url + '/json-pushes/?full=1&version=2', repo_name) | 0.003846 |
def get_results_as_xarray(self, parameter_space,
result_parsing_function,
output_labels, runs):
"""
Return the results relative to the desired parameter space in the form
of an xarray data structure.
Args:
parameter... | 0.002432 |
def _display_status(normalized_data, stream):
"""
print status message from docker-py stream.
"""
if 'Pull complete' in normalized_data['status'] or 'Download complete' in normalized_data['status']:
stream.write("\n")
if 'id' in normalized_data:
stream.write("%s - " % normalized_dat... | 0.005141 |
def prepare_mosaic(self, image, fov_deg, name=None):
"""Prepare a new (blank) mosaic image based on the pointing of
the parameter image
"""
header = image.get_header()
ra_deg, dec_deg = header['CRVAL1'], header['CRVAL2']
data_np = image.get_data()
#dtype = data_n... | 0.000877 |
def remove_old_dumps(connection, container: str, days=None):
"""Remove dumps older than x days
"""
if not days:
return
if days < 20:
LOG.error('A minimum of 20 backups is stored')
return
options = return_file_objects(connection, container)
for dt, o_info in options:
... | 0.00188 |
def midpoint(self):
"""Calculate the midpoint between locations in segments.
Returns:
list of Point: Groups of midpoint between points in segments
"""
midpoints = []
for segment in self:
if len(segment) < 2:
midpoints.append([])
... | 0.004938 |
def run_cli(argv=None):
"""
Calls :func:`wdiff` and prints the results to STDERR.
Parses the options for :meth:`wdiff` with :func:`parse_commandline`. If
*argv* is supplied, it is used as command line, else the actual one is used.
Return Codes
------------
0: okay
1: error with arguments
2: `wdiff`... | 0.007495 |
def get_common_name(self):
''' Get a flower's common name '''
name = random.choice(self.common_first)
if random.randint(0, 1) == 1:
name += ' ' + random.choice(self.common_first).lower()
name += ' ' + random.choice(self.common_second).lower()
return name | 0.006536 |
def fetch(self, code, **kwargs):
'''
Quandl entry point in datafeed object
'''
log.debug('fetching QuanDL data (%s)' % code)
# This way you can use your credentials even if
# you didn't provide them to the constructor
if 'authtoken' in kwargs:
self.qua... | 0.002121 |
def export_compound(infile, outfile, format, outcsv, max_rs_peakgroup_qvalue):
"""
Export Compound TSV/CSV tables
"""
if format == "score_plots":
export_score_plots(infile)
else:
if outfile is None:
if outcsv:
outfile = infile.split(".osw")[0] + ".csv"
... | 0.003817 |
def from_base(cls, base, repo):
"""
Create a :class:`DXF` object which uses the same host, settings and
session as an existing :class:`DXFBase` object.
:param base: Existing :class:`DXFBase` object.
:type base: :class:`DXFBase`
:param repo: Name of the repository to acc... | 0.005269 |
def indent_iterable(elems: Sequence[str], num: int = 2) -> List[str]:
"""Indent an iterable."""
return [" " * num + l for l in elems] | 0.014184 |
def _normalize_label(self, s, wsmap):
"""
normalized form of a synonym
"""
toks = []
for tok in list(set(self.npattern.sub(' ', s).split(' '))):
if tok in wsmap:
tok=wsmap[tok]
if tok != "":
toks.append(tok)
toks.sor... | 0.008499 |
def search(self, *args, **kwargs):
"""
Search views. See Zendesk API `Reference <https://developer.zendesk.com/rest_api/docs/core/views#search-views>`__.
:param args: query is the only accepted arg.
:param kwargs: search parameters
"""
return self._get(self._build_url(se... | 0.011204 |
def angle(x0, y0, x1, y1):
""" Returns the angle between two points.
"""
return degrees(atan2(y1-y0, x1-x0)) | 0.00813 |
def auth(username, password):
'''
REST authentication
'''
url = rest_auth_setup()
data = {'username': username, 'password': password}
# Post to the API endpoint. If 200 is returned then the result will be the ACLs
# for this user
result = salt.utils.http.query(url, method='POST', data... | 0.003026 |
def set_flow(self, flow):
"""Set the flow associated to this :class:`Work`."""
if not hasattr(self, "_flow"):
self._flow = flow
else:
if self._flow != flow:
raise ValueError("self._flow != flow") | 0.007722 |
def _convert_distance_names_to_functions(distance):
"""
Convert function names in a composite distance function into function
handles.
"""
dist_out = _copy.deepcopy(distance)
for i, d in enumerate(distance):
_, dist, _ = d
if isinstance(dist, str):
try:
... | 0.004098 |
def get_session_not_on_or_after(self):
"""
Gets the SessionNotOnOrAfter from the AuthnStatement
Could be used to set the local session expiration
:returns: The SessionNotOnOrAfter value
:rtype: time|None
"""
not_on_or_after = None
authn_statement_nodes = ... | 0.006944 |
def save_shared_file(self, sharekey=None):
"""
Save a SharedFile to your Shake.
Args:
sharekey (str): Sharekey for the file to save.
Returns:
SharedFile saved to your shake.
"""
endpoint = '/api/sharedfile/{sharekey}/save'.format(sharekey=shareke... | 0.005199 |
def main(argString=None):
"""The main function.
The purpose of this module is to plot Eigenvectors provided by the
Eigensoft software.
Here are the steps of this module:
1. Reads the Eigenvector (:py:func:`read_eigenvalues`).
2. Plots the Scree Plot (:py:func:`create_scree_plot`).
"""
... | 0.001786 |
def get_alignments(attention_matrix: np.ndarray, threshold: float = .9) -> Iterator[Tuple[int, int]]:
"""
Yields hard alignments from an attention_matrix (target_length, source_length)
given a threshold.
:param attention_matrix: The attention matrix.
:param threshold: The threshold for including an... | 0.006144 |
def infohash_base32(self):
"""Base32 encoded SHA1 info hash"""
self.validate()
info = self.convert()[b'info']
return b32encode(sha1(bencode(info)).digest()) | 0.010638 |
def get_idxs(data, eid2idx):
"""
Convert from event IDs to event indices.
:param data: an array with a field eid
:param eid2idx: a dictionary eid -> idx
:returns: the array of event indices
"""
uniq, inv = numpy.unique(data['eid'], return_inverse=True)
idxs = numpy.array([eid2idx[eid] f... | 0.002801 |
def db_dp010(self, value=None):
""" Corresponds to IDD Field `db_dp010`
mean coincident dry-bulb temperature to
Dew-point temperature corresponding to 1.0% annual cumulative frequency of occurrence
Args:
value (float): value for IDD Field `db_dp010`
Unit: C
... | 0.003619 |
def get_holding_accounts(self) -> List[Account]:
""" Returns the (cached) list of holding accounts """
if not self.__holding_accounts:
self.__holding_accounts = self.__get_holding_accounts_query().all()
return self.__holding_accounts | 0.007407 |
def save_sample_data(self):
"""Save values from the file's header row into the DataGrid columns
after doing some very basic validation
"""
bsc = getToolByName(self, 'bika_setup_catalog')
keywords = self.bika_setup_catalog.uniqueValuesFor('getKeyword')
profiles = []
... | 0.000583 |
def _ProcessSources(self, sources, parser_factory):
"""Iterates through sources yielding action responses."""
for source in sources:
for action, request in self._ParseSourceType(source):
yield self._RunClientAction(action, request, parser_factory,
source.path_ty... | 0.006192 |
def close(self):
"""Close port."""
os.close(self.in_d)
os.close(self.out_d) | 0.020202 |
def title(self):
"""
Banana banana
"""
resolved_title = Link.resolving_title_signal(self)
resolved_title = [elem for elem in resolved_title if elem is not
None]
if resolved_title:
return str(resolved_title[0])
return self._tit... | 0.006211 |
async def regions(self, *args, **kwargs):
"""
See the list of regions managed by this ec2-manager
This method is only for debugging the ec2-manager
This method is ``experimental``
"""
return await self._makeApiCall(self.funcinfo["regions"], *args, **kwargs) | 0.00974 |
def _glyph_for_monomer_pattern(self, pattern):
"""Add glyph for a PySB MonomerPattern."""
pattern.matches_key = lambda: str(pattern)
agent_id = self._make_agent_id(pattern)
# Handle sources and sinks
if pattern.monomer.name in ('__source', '__sink'):
return None
... | 0.002414 |
def check_offset(self):
"""Check to see if initial position and goal are the same
if they are, offset slightly so that the forcing term is not 0"""
for d in range(self.dmps):
if (self.y0[d] == self.goal[d]):
self.goal[d] += 1e-4 | 0.007117 |
def set_exe(self, pipes_code):
"""
Dump launcher code to the distributed file system.
"""
if not self.output:
raise RuntimeError("no output directory, can't create launcher")
parent = hdfs.path.dirname(hdfs.path.abspath(self.output.rstrip("/")))
self.exe = hdf... | 0.00495 |
def NDP_Attack_DAD_DoS_via_NA(iface=None, mac_src_filter=None, tgt_filter=None,
reply_mac=None):
"""
Perform the DAD DoS attack using NS described in section 4.1.3 of RFC
3756. This is done by listening incoming NS messages *sent from the
unspecified address* and sending a ... | 0.000349 |
def get_star_names(self, modpath):
"""Returns all the names imported by 'import *' from a given module."""
if modpath not in self.star_names:
print('Importing %s to resolve import *' % modpath, file=sys.stderr)
try:
module = self.import_module(modpath)
... | 0.00569 |
def common_entitlements_options(f):
"""Add common options for entitlement commands."""
@click.option(
"--show-tokens",
default=False,
is_flag=True,
help="Show entitlement token string contents in output.",
)
@click.pass_context
@functools.wraps(f)
def wrapper(ctx... | 0.002227 |
def _get_key_with_evict(path, timestamp, passphrase):
'''
Load a private key from disk. `timestamp` above is intended to be the
timestamp of the file's last modification. This fn is memoized so if it is
called with the same path and timestamp (the file's last modified time) the
second time the resu... | 0.001366 |
def clear_optimizer(self):
"""Cleans query optimizer state"""
self._optimized = False
self._type2decls = {}
self._type2name2decls = {}
self._type2decls_nr = {}
self._type2name2decls_nr = {}
self._all_decls = None
self._all_decls_not_recursive = None
... | 0.004577 |
def iter_final_matches(self, canonical_match, subject_graph, one_match):
"""Given a match, iterate over all related equivalent matches
When criteria sets are defined, the iterator runs over all symmetric
equivalent matches that fulfill one of the criteria sets. When not
criteri... | 0.002941 |
def __fillablebox(msg, title="", default="", mask=None, image=None, root=None):
"""
Show a box in which a user can enter some text.
You may optionally specify some default text, which will appear in the
enterbox when it is displayed.
Returns the text that the user entered, or None if he cancels the ... | 0.000451 |
def _add_listeners ( self ):
""" Adds the event listeners for a specified object.
"""
object = self.value
canvas = self.factory.canvas
if canvas is not None:
for name in canvas.node_children:
object.on_trait_change(self._nodes_replaced, name)
... | 0.007541 |
def search(self, Queue=None, order=None, raw_query=None, Format='l', **kwargs):
""" Search arbitrary needles in given fields and queue.
Example::
>>> tracker = Rt('http://tracker.example.com/REST/1.0/', 'rt-username', 'top-secret')
>>> tracker.login()
>>> tickets = ... | 0.003082 |
def fill_polygon_with_points(cls, goal=None, polygon=None):
"""
Fill a shapely polygon with X number of points
"""
if goal is None:
raise ValueError("Must specify the number of points (goal) to fill the polygon with")
if polygon is None or (not isinstance(polygon... | 0.0091 |
def _load_config(path: str) -> dict:
"""
Given a file path, parse it based on its extension (YAML or JSON)
and return the values as a Python dictionary. JSON is the default if an
extension can't be determined.
"""
__, ext = os.path.splitext(path)
if ext in ['.yaml', '.yml']:
import r... | 0.002096 |
def is_link_local(link_target):
"""
:param link_target: The target of a symbolic link, as given by os.readlink()
:type link_target: string
:returns: A boolean indicating the link is local to the current directory.
This is defined to mean that os.path.isabs(link_target) == False
... | 0.01001 |
def create_variable(self, varname, vtype=None):
"""Create a tk variable.
If the variable was created previously return that instance.
"""
var_types = ('string', 'int', 'boolean', 'double')
vname = varname
var = None
type_from_name = 'string' # default type
... | 0.002235 |
def useQt(qtLib: str = 'PyQt5', period: float = 0.01):
"""
Run combined Qt5/asyncio event loop.
Args:
qtLib: Name of Qt library to use, can be 'PyQt5' or 'PySide2'.
period: Period in seconds to poll Qt.
"""
def qt_step():
loop.call_later(period, qt_step)
if not stack... | 0.000943 |
def localize_sources(gta, **kwargs):
"""Relocalize sources in the region of interest
Parameters
----------
gta : `fermipy.gtaanalysis.GTAnalysis`
The analysis object
kwargs :
These are passed to the gta.localize function
"""
# Localize all point sources
for src i... | 0.007599 |
def clean_email(self):
"""
Ensure the email address is not already registered.
"""
email = self.cleaned_data.get("email")
qs = User.objects.exclude(id=self.instance.id).filter(email=email)
if len(qs) == 0:
return email
raise forms.ValidationError(
... | 0.005089 |
def __setUserMinimumSize( self, section, oldSize, newSize ):
"""
Records the user minimum size for a column.
:param section | <int>
oldSize | <int>
newSize | <int>
"""
if self.isVisible():
self._columnMini... | 0.014577 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.