text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _hydrate_pivot_relation(self, models):
"""
Hydrate the pivot table relationship on the models.
:type models: list
"""
for model in models:
pivot = self.new_existing_pivot(self._clean_pivot_attributes(model))
model.set_relation("pivot", pivot) | 0.009615 |
def learn(self, objects):
"""
Learns all provided objects
:param objects: dict mapping object name to array of sensations, where each
sensation is composed of location and feature SDR for each
column. For example:
{'obj1' : [[[1,1,1],[101,205,523,... | 0.010551 |
def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None):
"""Factory function for unpickling pytz tzinfo instances.
This is shared for both StaticTzInfo and DstTzInfo instances, because
database changes could cause a zones implementation to switch between
these two base classes and we can't bre... | 0.000444 |
def make_report(plots, path):
'''
Creates a fat html report based on the previously created files
plots is a list of Plot objects defined by a path and title
statsfile is the file to which the stats have been saved,
which is parsed to a table (rather dodgy)
'''
logging.info("Writing html rep... | 0.000691 |
def echo_with_markers(text, marker='=', marker_color='blue', text_color=None):
"""Print a text to the screen with markers surrounding it.
The output looks like:
======== text ========
with marker='=' right now.
In the event that the terminal window is too small, the text is printed
without mar... | 0.002825 |
def load_template_help(builtin):
"""Loads the help for a given template"""
help_file = "templates/%s-help.yml" % builtin
help_file = resource_filename(__name__, help_file)
help_obj = {}
if os.path.exists(help_file):
help_data = yaml.safe_load(open(help_file))
if 'name' in help_data:... | 0.001805 |
def get_ip_interface_output_interface_vrf(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_ip_interface = ET.Element("get_ip_interface")
config = get_ip_interface
output = ET.SubElement(get_ip_interface, "output")
interface = ET.SubEle... | 0.002535 |
def _HandleLegacy(self, args, token=None):
"""Retrieves the clients for a hunt."""
hunt_urn = args.hunt_id.ToURN()
hunt_obj = aff4.FACTORY.Open(
hunt_urn, aff4_type=implementation.GRRHunt, token=token)
clients_by_status = hunt_obj.GetClientsByStatus()
hunt_clients = clients_by_status[args.c... | 0.003856 |
def respond(self, data):
"""
Respond to the connection accepted in this object
"""
self.push("%s%s" % (data, TERMINATOR))
if self.temporary:
self.close_when_done() | 0.009259 |
def download_archive(self, archive):
"""Download an archive's :attr:`~LegendasTVArchive.content`.
:param archive: the archive to download :attr:`~LegendasTVArchive.content` of.
:type archive: :class:`LegendasTVArchive`
"""
logger.info('Downloading archive %s', archive.id)
... | 0.00464 |
def tone_marks():
"""Keep tone-modifying punctuation by matching following character.
Assumes the `tone_marks` pre-processor was run for cases where there might
not be any space after a tone-modifying punctuation mark.
"""
return RegexBuilder(
pattern_args=symbols.TONE_MARKS,
patter... | 0.00274 |
def save(self, force_insert=False, force_update=False, *args, **kwargs):
"""
Makes sure we are in sync with the User field
"""
self.first_name = self.user.first_name
self.last_name = self.user.last_name
self.email = self.user.email
full_name = '%s %s' % (self.firs... | 0.003817 |
def get_fastq_2(job, patient_id, sample_type, fastq_1):
"""
For a path to a fastq_1 file, return a fastq_2 file with the same prefix and naming scheme.
:param str patient_id: The patient_id
:param str sample_type: The sample type of the file
:param str fastq_1: The path to the fastq_1 file
:ret... | 0.005236 |
def to_segmentation_map(self, image_shape, size_lines=1, size_points=0,
raise_if_out_of_image=False):
"""
Generate a segmentation map object from the line string.
This is similar to
:func:`imgaug.augmentables.lines.LineString.draw_mask`.
The result is... | 0.00212 |
def Transit(time, t0=0., dur=0.1, per=3.56789, depth=0.001, **kwargs):
'''
A `Mandel-Agol <http://adsabs.harvard.edu/abs/2002ApJ...580L.171M>`_
transit model, but with the depth and the duration as primary
input variables.
:param numpy.ndarray time: The time array
:param float t0: The time of f... | 0.00076 |
def _set_contents(self, force=False):
"""
Encodes all child objects into the contents for this object
:param force:
Ensure all contents are in DER format instead of possibly using
cached BER-encoded data
"""
if self.children is None:
self._pa... | 0.003442 |
def display_dp_matrix_attr(dp_matrix, attr_name):
"""
show a value assocciated with an attribute for each
DataProperty instance in the dp_matrix
"""
print()
print("---------- {:s} ----------".format(attr_name))
for dp_list in dp_matrix:
print([getattr(dp, attr_name) for dp in dp_lis... | 0.003096 |
def load_object_at_path(path):
"""Load an object from disk at explicit path"""
with open(path, 'r') as f:
data = _deserialize(f.read())
return aadict(data) | 0.005587 |
def init(cfg):
"""
Initialiaze na3x
:param cfg: db, triggers, environment variables configuration
"""
global na3x_cfg
with open(cfg[NA3X_DB]) as db_cfg_file:
na3x_cfg[NA3X_DB] = json.load(db_cfg_file, strict=False)
with open(cfg[NA3X_TRIGGERS]) as triggers_cfg_file:
na3x_cfg[... | 0.002033 |
def deserialize(cls, buf, byteorder='@'):
'''
Deserialize a lean MinHash from a buffer.
Args:
buf (buffer): `buf` must implement the `buffer`_ interface.
One such example is the built-in `bytearray`_ class.
byteorder (str. optional): This is byte order of... | 0.002672 |
def t_intnumber(self, t):
r'-?\d+'
t.value = int(t.value)
t.type = 'NUMBER'
return t | 0.017241 |
def new_freeform_sp(shape_id, name, x, y, cx, cy):
"""Return new `p:sp` element tree configured as freeform shape.
The returned shape has a `a:custGeom` subtree but no paths in its
path list.
"""
tmpl = CT_Shape._freeform_sp_tmpl()
xml = tmpl % (shape_id, name, x, y, cx,... | 0.005405 |
def plotDataframe(table, title, plotPath):
"""
Plot Panda dataframe.
:param table: Panda dataframe returned by :func:`analyzeWeightPruning`
:type table: :class:`pandas.DataFrame`
:param title: Plot title
:type title: str
:param plotPath: Plot full path
:type plotPath: str
"""
plt.figure()
axes =... | 0.014516 |
def _set_version(self, v, load=False):
"""
Setter method for version, mapped from YANG variable /rbridge_id/openflow/logical_instance/version (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_version is considered as a private
method. Backends looking to populat... | 0.004281 |
def async_state_change_callback(self, addr, state, value):
"""Log the state change."""
_LOGGING.info('Device %s state %s value is changed to %s',
addr, state, value) | 0.009852 |
def distros_for_filename(filename, metadata=None):
"""Yield possible egg or source distribution objects based on a filename"""
return distros_for_location(
normalize_path(filename), os.path.basename(filename), metadata
) | 0.004167 |
def start_update(self, draw=None, queues=None):
"""
Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`no_auto_update` attribute of this instance and the `auto_u... | 0.001312 |
def update_frame(self, key, ranges=None, plot=None):
"""
Updates an existing plot with data corresponding
to the key.
"""
element = self._get_frame(key)
self._get_title_div(key, '12pt')
# Cache frame object id to skip updating data if unchanged
previous_i... | 0.00275 |
def startswith(self, prefix, ignore_case=False, options=None):
""" A query to check if a field starts with a given prefix string
**Example**: ``session.query(Spell).filter(Spells.name.startswith("abra", ignore_case=True))``
.. note:: This is a shortcut to .regex('^' + re.escape(prefix)... | 0.006173 |
def publish():
"""Publish this package to PyPI (aka "the Cheeseshop")."""
long_description = make_long_description()
if long_description != read(RST_DESCRIPTION_PATH):
print("""\
Description file not up-to-date: %s
Run the following command and commit the changes--
python setup.py %s
""" % (RS... | 0.001587 |
def insertComments( self, comment = None ):
"""
Inserts comments into the editor based on the current selection.\
If no comment string is supplied, then the comment from the language \
will be used.
:param comment | <str> || None
:return <bool> ... | 0.020386 |
def diff(s1, s2):
"""
Return a normalised Levenshtein distance between two strings.
Distance is normalised by dividing the Levenshtein distance of the
two strings by the max(len(s1), len(s2)).
Examples:
>>> text.diff("foo", "foo")
0
>>> text.diff("foo", "fooo")
1
... | 0.001595 |
def GetMessages(self, formatter_mediator, event):
"""Determines the formatted message strings for an event object.
Args:
formatter_mediator (FormatterMediator): mediates the interactions
between formatters and other components, such as storage and Windows
EventLog resources.
eve... | 0.006178 |
def set_cursor_y(self, y):
""" Set Screen Cursor Y Position """
if y >= 0 and y <= self.server.server_info.get("screen_height"):
self.cursor_y = y
self.server.request("screen_set %s cursor_y %i" % (self.ref, self.cursor_y)) | 0.011364 |
def update_item(TableName=None, Key=None, AttributeUpdates=None, Expected=None, ConditionalOperator=None, ReturnValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, UpdateExpression=None, ConditionExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None):
"""
Edits a... | 0.003785 |
def do_args(self, modargs, send, nick, target, source, name, msgtype):
"""Handle the various args that modules need."""
realargs = {}
args = {
'nick': nick,
'handler': self,
'db': None,
'config': self.config,
'source': source,
... | 0.004246 |
def from_attribute(attr):
"""
Converts an attribute into a shadow attribute.
:param attr: :class:`MispAttribute` instance to be converted
:returns: Converted :class:`MispShadowAttribute`
:example:
>>> server = MispServer()
>>> event = server.events.get(12)
... | 0.002703 |
def cursor(self, user=None, configuration=None, convert_types=True,
dictify=False, fetch_error=True):
"""Get a cursor from the HiveServer2 (HS2) connection.
Parameters
----------
user : str, optional
configuration : dict of str keys and values, optional
... | 0.001443 |
def list_jobs(self, state=None, limit=None, marker=None):
"""ListJobs
https://apidocs.joyent.com/manta/api.html#ListJobs
Limitation: at this time `list_jobs` doesn't support paging through
more than the default response num results. (TODO)
@param state {str} Only return jobs in... | 0.001656 |
def progress(self,
enumerable,
task_progress_object=None):
"""
Enables the object to be used as an iterator. Each iteration will produce a progress update in the logger.
:param enumerable: Collection to iterate over.
:param task_progress_obj... | 0.005319 |
def create(self, instance, errors):
"""
Create an instance of a model.
:param instance: The created model instance.
:param errors: Any errors.
:return: The created model instance, or a dictionary of errors.
"""
if errors:
return self.errors(errors)
... | 0.005634 |
def getDisplayName(self):
"""Provides a name for display purpose"""
displayName = self.name + "("
if self.isAsync:
displayName = "async " + displayName
first = True
for arg in self.arguments:
if first:
displayName += str(arg)
... | 0.003584 |
def local_position_ned_send(self, time_boot_ms, x, y, z, vx, vy, vz, force_mavlink1=False):
'''
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed,
Z-axis down (aeronautical frame, NED / north-east... | 0.005139 |
def _url(self):
"""Get the URL for the resource"""
if self.ID_NAME not in self.route.keys() and "id" in self.data.keys():
self.route[self.ID_NAME] = self.data["id"]
return self.config.BASE + self.PATH.format(**self.route) | 0.007782 |
def install_program(self):
"""
install supervisor program config file
"""
text = templ_program.render(**self.options)
config = Configuration(self.buildout, self.program + '.conf', {
'deployment': self.deployment_name,
'directory': os.path.join(self.options... | 0.004878 |
def introspectRemoteObject(self, busName, objectPath,
replaceKnownInterfaces=False):
"""
Calls org.freedesktop.DBus.Introspectable.Introspect
@type busName: C{string}
@param busName: Name of the bus containing the object
@type objectPath: C{string... | 0.002125 |
def _write_git_file_and_module_config(cls, working_tree_dir, module_abspath):
"""Writes a .git file containing a (preferably) relative path to the actual git module repository.
It is an error if the module_abspath cannot be made into a relative path, relative to the working_tree_dir
:note: will ... | 0.005058 |
def asnumpy(self):
"""Copy the data from TCMPS into a new numpy ndarray"""
# Create C variables that will serve as out parameters for TCMPS.
data_ptr = _ctypes.POINTER(_ctypes.c_float)() # float* data_ptr
shape_ptr = _ctypes.POINTER(_ctypes.c_size_t)() # size_t* shape_ptr
di... | 0.002339 |
def aggregate_tree(l_tree):
"""Walk a py-radix tree and aggregate it.
Arguments
l_tree -- radix.Radix() object
"""
def _aggregate_phase1(tree):
# phase1 removes any supplied prefixes which are superfluous because
# they are already included in another supplied prefix. For example,
... | 0.000608 |
def map(self, function, *iterables, **kwargs):
"""Returns an iterator equivalent to map(function, iterables).
*chunksize* controls the size of the chunks the iterable will
be broken into before being passed to the function. If None
the size will be controlled by the Pool.
"""
... | 0.001799 |
def check_size_all(self):
"""
Get size of homedir and update data on the server
"""
result = self.rpc_srv.get_all_account(self.token)
print "debug: %s" % result
for it in result:
size = getFolderSize(it["path"])
result = self.rpc_srv.set_account_si... | 0.005714 |
def buy(self, quantity, **kwargs):
""" Shortcut for ``instrument.order("BUY", ...)`` and accepts all of its
`optional parameters <#qtpylib.instrument.Instrument.order>`_
:Parameters:
quantity : int
Order quantity
"""
self.parent.order("BUY", self, qua... | 0.008696 |
def to_xdr_object(self):
"""Creates an XDR Operation object that represents this
:class:`Operation`.
"""
try:
source_account = [account_xdr_object(self.source)]
except StellarAddressInvalidError:
source_account = []
return Xdr.types.Operation(sour... | 0.005848 |
def valid(self):
"""
``True`` if credentials are valid, ``False`` if expired.
"""
if self.expiration_time:
return self.expiration_time > int(time.time())
else:
return True | 0.008475 |
def show(
self,
filename: Optional[str] = None,
show_link: bool = True,
auto_open: bool = True,
detect_notebook: bool = True,
) -> None:
"""Display the chart.
Parameters
----------
filename : str, optional
Save plot to this filenam... | 0.004643 |
def init_optimizer(self):
"""
Initializes query optimizer state.
There are 4 internals hash tables:
1. from type to declarations
2. from type to declarations for non-recursive queries
3. from type to name to declarations
4. from type to name to de... | 0.000885 |
def gffselect(args):
"""
%prog gffselect gmaplocation.bed expectedlocation.bed translated.ids tag
Try to match up the expected location and gmap locations for particular
genes. translated.ids was generated by fasta.translate --ids. tag must be
one of "complete|pseudogene|partial".
"""
from ... | 0.002349 |
def tiles_from_geom(self, geometry, zoom):
"""
Return all tiles intersecting with input geometry.
- geometry: shapely geometry
- zoom: zoom level
"""
validate_zoom(zoom)
if geometry.is_empty:
return
if not geometry.is_valid:
raise ... | 0.00295 |
def create_namespace(self, name, ignore_errors=False):
"""creates a namespace if it does not exist
args:
name: the name of the namespace
ignore_errors(bool): Will ignore if a namespace already exists or
there is an error creating the namespace
... | 0.002789 |
def remove_repositories(repositories, default_repositories):
"""
Remove no default repositories
"""
repos = []
for repo in repositories:
if repo in default_repositories:
repos.append(repo)
return repos | 0.004082 |
def reqScannerSubscription(self, tickerId, subscription, scannerSubscriptionOptions):
"""reqScannerSubscription(EClient self, int tickerId, ScannerSubscription subscription, TagValueListSPtr const & scannerSubscriptionOptions)"""
return _swigibpy.EClient_reqScannerSubscription(self, tickerId, subscripti... | 0.014245 |
def skos_topConcept(rdf):
"""Infer skos:topConceptOf/skos:hasTopConcept (S8) and skos:inScheme (S7)."""
for s, o in rdf.subject_objects(SKOS.hasTopConcept):
rdf.add((o, SKOS.topConceptOf, s))
for s, o in rdf.subject_objects(SKOS.topConceptOf):
rdf.add((o, SKOS.hasTopConcept, s))
for s, o... | 0.004975 |
def conv_cy(self, cy_cl):
"""Convert cycles (cy/CL) to other units, such as FLOP/s or It/s."""
if not isinstance(cy_cl, PrefixedUnit):
cy_cl = PrefixedUnit(cy_cl, '', 'cy/CL')
clock = self.machine['clock']
element_size = self.kernel.datatypes_size[self.kernel.datatype]
... | 0.003681 |
def get_select_fields(self, select_fields=None):
"""
:return: string specifying the attributes to return
"""
return self.heading.as_sql if select_fields is None else self.heading.project(select_fields).as_sql | 0.0125 |
def compose_arrays(a1, a2, firstfield='etag'):
"""
Compose composite arrays by generating an extended datatype containing
all the fields. The two arrays must have the same length.
"""
assert len(a1) == len(a2), (len(a1), len(a2))
if a1.dtype.names is None and len(a1.shape) == 1:
# the f... | 0.000805 |
def remove(self, other):
"""Remove a particular factor from a tensor product space."""
if other is FullSpace:
return TrivialSpace
if other is TrivialSpace:
return self
if isinstance(other, ProductSpace):
oops = set(other.operands)
else:
... | 0.004577 |
def p_joinx(self,t):
# todo: support join types http://www.postgresql.org/docs/9.4/static/queries-table-expressions.html#QUERIES-JOIN
"""joinx : fromtable jointype fromtable
| fromtable jointype fromtable kw_on expression
| fromtable jointype fromtable kw_using '(' namelist ')'
"""... | 0.028866 |
def segment(self, document):
"""
document: list[str]
return list[int],
i-th element denotes whether exists a boundary right before paragraph i(0 indexed)
"""
# ensure document is not empty and every element is an instance of str
assert(len(document) > 0 and le... | 0.002325 |
def set_permissions(self, object, replace=False):
"""
Sets the S3 ACL grants for the given object to the appropriate
value based on the type of Distribution. If the Distribution
is serving private content the ACL will be set to include the
Origin Access Identity associated with ... | 0.001338 |
def gzip(f, *args, **kwargs):
"""GZip Flask Response Decorator."""
data = f(*args, **kwargs)
if isinstance(data, Response):
content = data.data
else:
content = data
gzip_buffer = BytesIO()
gzip_file = gzip2.GzipFile(
mode='wb',
compresslevel=4,
fileobj=... | 0.001543 |
def _pyxb_from_norm_perm_list(self, norm_perm_list):
"""Return an AccessPolicy PyXB representation of ``norm_perm_list``"""
# Using accessPolicy() instead of AccessPolicy() and accessRule() instead of
# AccessRule() gives PyXB the type information required for using this as a
# root elem... | 0.005256 |
def _get_pattern(self, pattern_id):
"""Get pattern item by id."""
for key in ('PATTERNS1', 'PATTERNS2', 'PATTERNS3'):
if key in self.tagged_blocks:
data = self.tagged_blocks.get_data(key)
for pattern in data:
if pattern.pattern_id == patter... | 0.005208 |
def _move(self, speed=0, steering=0, seconds=None):
"""Move robot."""
self.drive_queue.put((speed, steering))
if seconds is not None:
time.sleep(seconds)
self.drive_queue.put((0, 0))
self.drive_queue.join() | 0.007634 |
def set_context(self, cell_type):
"""Set protein expression amounts from CCLE as initial conditions.
This method uses :py:mod:`indra.databases.context_client` to get
protein expression levels for a given cell type and set initial
conditions for Monomers in the model accordingly.
... | 0.001929 |
def get_advances_declines(self, as_json=False):
"""
:return: a list of dictionaries with advance decline data
:raises: URLError, HTTPError
"""
url = self.advances_declines_url
req = Request(url, None, self.headers)
# raises URLError or HTTPError
resp = sel... | 0.003026 |
def sort_image_tiles(image, size, sorting_args, tile_size, tile_density=1.0, randomize_tiles=False):
"""
Sorts an image by taking various tiles and sorting them individually.
:param image: The image to be modified
:param size: The size of the image, as (width, height)
:param sorting_args: Arguments ... | 0.004278 |
def parse(str_, lsep=",", avsep=":", vssep=",", avssep=";"):
"""Generic parser"""
if avsep in str_:
return parse_attrlist(str_, avsep, vssep, avssep)
if lsep in str_:
return parse_list(str_, lsep)
return parse_single(str_) | 0.003922 |
def _path_hash(path, transform, kwargs):
"""
Generate a hash of source file path + transform + args
"""
sortedargs = ["%s:%r:%s" % (key, value, type(value))
for key, value in sorted(iteritems(kwargs))]
srcinfo = "{path}:{transform}:{{{kwargs}}}".format(path=os.path.abspath(path),
... | 0.007937 |
def prediction_error(model, X, y=None, ax=None, alpha=0.75, **kwargs):
"""
Quick method:
Plot the actual targets from the dataset against the
predicted values generated by our model(s).
This helper function is a quick wrapper to utilize the PredictionError
ScoreVisualizer for one-off analysis.... | 0.000349 |
def vlan_classifier_rule_class_type_proto_proto_proto_val(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
vlan = ET.SubElement(config, "vlan", xmlns="urn:brocade.com:mgmt:brocade-vlan")
classifier = ET.SubElement(vlan, "classifier")
rule = ET.Sub... | 0.003793 |
def fcontext_policy_applied(name, recursive=False):
'''
.. versionadded:: 2017.7.0
Checks and makes sure the SELinux policies for a given filespec are
applied.
'''
ret = {'name': name, 'result': False, 'changes': {}, 'comment': ''}
changes_text = __salt__['selinux.fcontext_policy_is_applie... | 0.003356 |
def get_rmse(self, data_x=None, data_y=None):
"""
Get Root Mean Square Error using
self.bestfit_func
args:
x_min: scalar, default=min(x)
minimum x value of the line
x_max: scalar, default=max(x)
maximum x value of the line
... | 0.002567 |
def find(find_all=False, latest=False, legacy=False, prerelease=False, products=None, prop=None, requires=None, requires_any=False, version=None):
"""
Call vswhere and return an array of the results.
If `find_all` is true, finds all instances even if they are incomplete and may not launch.
If `latest`... | 0.004212 |
def determine_encoding(buf):
"""Return the appropriate encoding for the given CSS source, according to
the CSS charset rules.
`buf` may be either a string or bytes.
"""
# The ultimate default is utf8; bravo, W3C
bom_encoding = 'UTF-8'
if not buf:
# What
return bom_encoding
... | 0.000383 |
def getParam(self, key):
"""Returns value of Run-time Database Parameter 'key'.
@param key: Run-time parameter name.
@return: Run-time parameter value.
"""
cur = self._conn.cursor()
cur.execute("SHOW %s" % key)
row = cur.fetchone()
ret... | 0.011494 |
def get_sp_metadata(self):
"""
Gets the SP metadata. The XML representation.
:returns: SP metadata (xml)
:rtype: string
"""
metadata = OneLogin_Saml2_Metadata.builder(
self.__sp, self.__security['authnRequestsSigned'],
self.__security['wantAssertio... | 0.002725 |
def renders(col_name):
"""
Use this decorator to map your custom Model properties to actual
Model db properties. As an example::
class MyModel(Model):
id = Column(Integer, primary_key=True)
name = Column(String(50), unique = True, nullable=False)
... | 0.00119 |
def envelope(self, header, body):
"""
Build the B{<Envelope/>} for a SOAP outbound message.
@param header: The SOAP message B{header}.
@type header: L{Element}
@param body: The SOAP message B{body}.
@type body: L{Element}
@return: The SOAP envelope containing the... | 0.00361 |
def convertImages(self):
"""
run this to turn all folder1 TIFs and JPGs into folder2 data.
TIFs will be treated as micrographs and converted to JPG with enhanced
contrast. JPGs will simply be copied over.
"""
# copy over JPGs (and such)
exts=['.jpg','.png']
... | 0.01927 |
def _handle_autologin(self, event):
"""Automatic logins for client configurations that allow it"""
self.log("Verifying automatic login request")
# TODO: Check for a common secret
# noinspection PyBroadException
try:
client_config = objectmodels['client'].find_one({... | 0.001368 |
def add_from_names_to_locals(self, node):
"""Store imported names to the locals
Resort the locals if coming from a delayed node
"""
_key_func = lambda node: node.fromlineno
def sort_locals(my_list):
my_list.sort(key=_key_func)
for (name, asname) in node.nam... | 0.003593 |
def rsync(config_file, source, target, override_cluster_name, down):
"""Rsyncs files.
Arguments:
config_file: path to the cluster yaml
source: source dir
target: target dir
override_cluster_name: set the name of the cluster
down: whether we're syncing remote -> local
... | 0.000773 |
def populate(self):
"""Populates a new cache.
"""
if self.exists:
raise CacheAlreadyExistsException('location: %s' % self.cache_uri)
self._populate_setup()
with closing(self.graph):
with self._download_metadata_archive() as metadata_archive:
... | 0.004673 |
def addStream(self, stream, t1=None, t2=None, limit=None, i1=None, i2=None, transform=None):
"""Adds the given stream to the query construction. The function supports both stream
names and Stream objects."""
params = query_maker(t1, t2, limit, i1, i2, transform)
params["stream"] = ... | 0.009112 |
def do_rsync(self, line):
"""rsync [-m|--mirror] [-n|--dry-run] [-q|--quiet] SRC_DIR DEST_DIR
Synchronizes a destination directory tree with a source directory tree.
"""
args = self.line_to_args(line)
src_dir = resolve_path(args.src_dir)
dst_dir = resolve_path(args.ds... | 0.008772 |
def get_notebook(self, notebook_id, format=u'json'):
"""Get the representation of a notebook in format by notebook_id."""
format = unicode(format)
if format not in self.allowed_formats:
raise web.HTTPError(415, u'Invalid notebook format: %s' % format)
last_modified, nb = self... | 0.004208 |
def allowance (self, filename):
"""Preconditions:
- our agent applies to this entry
- filename is URL decoded
Check if given filename is allowed to acces this entry.
@return: True if allowed, else False
@rtype: bool
"""
for line in self.rulelines:
... | 0.007496 |
def pipe(self, other_task):
""" Add a pipe listener to the execution of this task. The
output of this task is required to be an iterable. Each item in
the iterable will be queued as the sole argument to an execution
of the listener task.
Can also be written as::
pip... | 0.004255 |
def set_gl_state(self, preset=None, **kwargs):
"""Define the set of GL state parameters to use when drawing
Parameters
----------
preset : str
Preset to use.
**kwargs : dict
Keyword arguments to `gloo.set_state`.
"""
self._vshare.gl_state ... | 0.005305 |
def hcode(*content, sep=' '):
"""
Make mono-width text (HTML)
:param content:
:param sep:
:return:
"""
return _md(quote_html(_join(*content, sep=sep)), symbols=MD_SYMBOLS[6]) | 0.004926 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.