text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def decimal_precision(row):
"""
Change the "precision" of values before writing to CSV. Each value is rounded to 3 numbers.
ex: 300 -> 300
ex: 300.123456 -> 300.123
ex: 3.123456e-25 - > 3.123e-25
:param tuple row: Row of numbers to process
:return list row: Processed row
"""
# _row... | 0.003281 |
def popat(*args):
""" Convenience function. Sets the popup location (currently not used). """
if len(args) == 2 and isinstance(args[0], int) and isinstance(args[1], int):
# popat(x,y)
Settings.PopupLocation = Location(args[0], args[1])
elif len(args) == 1 and isinstance(args[0], Location):
... | 0.003101 |
def _dumps_itr(cnf, dkey=DEFAULTSECT):
"""
:param cnf: Configuration data to dump
"""
for sect, params in iteritems(cnf):
yield "[%s]" % sect
for key, val in iteritems(params):
if sect != dkey and dkey in cnf and cnf[dkey].get(key) == val:
continue # It shou... | 0.002415 |
def fetch_entries(self):
"""Fetch data and parse it to build a list of cable entries."""
data = []
for row in self.get_rows():
# Stop fetching data if limit has been met
if exceeded_limit(self.limit, len(data)):
break
entry = row.find_all('td'... | 0.002051 |
def upgrade_available(name, **kwargs):
'''
Check whether or not an upgrade is available for a given package
Args:
name (str): The name of a single package
Kwargs:
refresh (bool): Refresh package metadata. Default ``True``
saltenv (str): The salt environment. Default ``base``
... | 0.003151 |
def restart_user(self, subid):
'''restart user will remove any "finished" or "revoked" extensions from
the user folder to restart the session. This command always comes from
the client users function, so we know subid does not start with the
study identifer first
'''
if os.path.exists(s... | 0.011086 |
def get_wd_data(self):
"""
Show dialog to get user input for which directory
to set as working directory.
Called by self.get_dm_and_wd
"""
wait = wx.BusyInfo('Reading in data from current working directory, please wait...')
#wx.Yield()
print('-I- Read in a... | 0.008772 |
def get_current_version(project_name=None, project_dir=os.curdir,
repo_dir=None):
"""
Retrieves the version of the package, checking in this order of priority:
* From an environment variable named ${project_name}_VERSION (all in caps)
if project_name was specified.
* From ... | 0.00157 |
def keyboard_input(message, yesno=False):
""" Get keyboard input from a human, optionally reasking for valid
yes or no input.
Parameters
----------
message : :obj:`str`
the message to display to the user
yesno : :obj:`bool`
whether or not to enforce yes or no inputs
Ret... | 0.003741 |
def _install_exception_handler(self):
"""
Installs a replacement for sys.excepthook, which handles pretty-printing uncaught exceptions.
"""
def handler(t, value, traceback):
if self.args.verbose:
sys.__excepthook__(t, value, traceback)
else:
... | 0.007126 |
def custom_sort(param):
"""Custom Click(Command|Group).params sorter.
Case insensitive sort with capitals after lowercase. --version at the end since I can't sort --help.
:param click.core.Option param: Parameter to evaluate.
:return: Sort weight.
:rtype: int
"""
... | 0.005941 |
def get_relationship(cls, request_args, id, related_collection_name, related_resource=None):
"""
Get a relationship
:param request_args:
:param id: The 'id' field of the node on the left side of the relationship in the database. The id field must \
be set in the model -- it is n... | 0.005725 |
def _unpack_union(type_: int, union: Any) -> Any:
"""
unpack items from parser new_property (value_converter)
"""
if type_ == lib.TCOD_TYPE_BOOL:
return bool(union.b)
elif type_ == lib.TCOD_TYPE_CHAR:
return union.c.decode("latin-1")
elif type_ == lib.TCOD_TYPE_INT:
r... | 0.001122 |
def delete_folder(self, uri, purge=False):
"""Delete folder.
uri -- MediaFire folder URI
Keyword arguments:
purge -- delete the folder without sending it to Trash
"""
try:
resource = self.get_resource_by_uri(uri)
except ResourceNotFoundError:
... | 0.001965 |
def create(self, reference, document_data):
"""Add a "change" to this batch to create a document.
If the document given by ``reference`` already exists, then this
batch will fail when :meth:`commit`-ed.
Args:
reference (~.firestore_v1beta1.document.DocumentReference): A
... | 0.004808 |
def get_version():
"""
Retrieves the version of the GLFW library.
Wrapper for:
void glfwGetVersion(int* major, int* minor, int* rev);
"""
major_value = ctypes.c_int(0)
major = ctypes.pointer(major_value)
minor_value = ctypes.c_int(0)
minor = ctypes.pointer(minor_value)
rev_v... | 0.002053 |
def __data_url(self):
"""
URL for posting metrics to the host agent. Only valid when announced.
"""
path = AGENT_DATA_PATH % self.from_.pid
return "http://%s:%s/%s" % (self.host, self.port, path) | 0.008475 |
def ndiag_mc(funcs, S: int, Fmu, Fvar, logspace: bool=False, epsilon=None, **Ys):
"""
Computes N Gaussian expectation integrals of one or more functions
using Monte Carlo samples. The Gaussians must be independent.
:param funcs: the integrand(s):
Callable or Iterable of Callables that operates ... | 0.002317 |
def autocommit(f):
"A decorator to commit to the storage if autocommit is set to True."
@wraps(f)
def wrapper(self, *args, **kwargs):
result = f(self, *args, **kwargs)
if self._meta.commit_ready():
self.commit()
return result
return wrapper | 0.003425 |
def rpm_packages(attrs=None, where=None):
'''
Return cpuid information from osquery
CLI Example:
.. code-block:: bash
salt '*' osquery.rpm_packages
'''
if __grains__['os_family'] == 'RedHat':
return _osquery_cmd(table='rpm_packages', attrs=attrs, where=where)
return {'resu... | 0.002513 |
def setData(self, data, setName=None):
"""
Assign the data in the dataframe to the AMPL entities with the names
corresponding to the column names.
Args:
data: The dataframe containing the data to be assigned.
setName: The name of the set to which the indices val... | 0.002128 |
def _move_temp_binary_to_path(tmp_binary_path):
"""Moves the temporary binary to the location of the binary that's currently being run.
Preserves owner, group, and permissions of original binary"""
# pylint: disable=E1101
binary_path = _get_binary_location()
if not binary_path.endswith(constants.DUS... | 0.004484 |
def _subtotals(self):
"""Composed tuple storing actual sequence of _Subtotal objects."""
return tuple(
_Subtotal(subtotal_dict, self.valid_elements)
for subtotal_dict in self._iter_valid_subtotal_dicts()
) | 0.007905 |
def destroy(self):
"""Delete all indexes from Elasticsearch and index builder."""
self.unregister_signals()
for index in self.indexes:
index.destroy()
self.indexes = [] | 0.009434 |
def stop(self):
"""Stop listening."""
self.zeroconf.unregister_service(self.service_info)
self.zeroconf.close()
self.server.stop() | 0.012346 |
def GetDeepComps(self, zws_id, zpid, count=10, rentzestimate=False):
"""
The GetDeepComps API returns a list of comparable recent sales for a specified property.
The result set returned contains the address, Zillow property identifier, and Zestimate for the comparable
properties and the ... | 0.006132 |
def update_filters(self, filters):
"""
Modify the filters list.
Filter with value 0 will be dropped because not active
"""
new_filters = {}
for (filter, values) in filters.items():
new_values = []
for value in values:
if isinstance... | 0.003359 |
def _get_fwl_port_speed(self, server_id, is_virt=True):
"""Determines the appropriate speed for a firewall.
:param int server_id: The ID of server the firewall is for
:param bool is_virt: True if the server_id is for a virtual server
:returns: a integer representing the Mbps speed of a ... | 0.001013 |
def index():
"""Handler for showing the GUI index page."""
stats = dict((k, {"count": 0}) for k, tt in conf.InputTables)
countminmax = "SUM(count) AS count, MIN(day) AS first, MAX(day) AS last"
for input, table in [(x, t) for x, tt in conf.InputTables for t in tt]:
row = db.fetchone("counts... | 0.004184 |
def connect_ws(self, path: str) -> _WSRequestContextManager:
"""
Connect to a websocket in order to use API parameters
In reality, aiohttp.session.ws_connect returns a aiohttp.client._WSRequestContextManager instance.
It must be used in a with statement to get the ClientWebSocketRespons... | 0.008075 |
def getUe(classname, eta_s, f, alpha_s, alpha_e, m_u, m_d, m_s, m_c, m_b, m_e, m_mu, m_tau):
"""Get the QCD evolution matrix."""
args = f, m_u, m_d, m_s, m_c, m_b, m_e, m_mu, m_tau
A = getattr(adm, 'adm_e_' + classname)(*args)
perm_keys = get_permissible_wcs(classname, f)
if perm_keys != 'all':
... | 0.003517 |
def execute(self, time_interval):
"""
Here we execute the factors over the streams in the workflow
Execute the factors in reverse order. We can't just execute the last factor because there may be multiple
"leaf" factors that aren't triggered by upstream computations.
:param time... | 0.004162 |
def forum_topic_update(self, topic_id, title=None, category=None):
"""Update a specific topic (Login Requires) (UNTESTED).
Parameters:
topic_id (int): Where topic_id is the topic id.
title (str): Topic title.
category (str): Can be: 0, 1, 2 (General, Tags, Bugs & Fea... | 0.003185 |
def dispatch(self, id):
"""Dispatch by id.
Parameters
----------
id : int
Dispatch id.
Returns
-------
an :class:`ApiQuery` of :class:`Dispatch`
Raises
------
:class:`NotFound`
If a dispatch with the requested id ... | 0.003195 |
def list_endpoints(self):
"""Lists the known object storage endpoints."""
_filter = {
'hubNetworkStorage': {'vendorName': {'operation': 'Swift'}},
}
endpoints = []
network_storage = self.client.call('Account',
'getHubNetworkS... | 0.002395 |
def interrupt(self):
"""
Invoked by the renderering.Renderer, if the image has changed.
"""
self.image = io.BytesIO()
self.renderer.screen.save(self.image, "png") | 0.040698 |
def _accumulate_remotes(synapse_parent_id, syn):
"""Retrieve references to all remote directories and files.
"""
remotes = {}
s_base_folder = syn.get(synapse_parent_id)
for (s_dirpath, s_dirpath_id), _, s_filenames in synapseutils.walk(syn, synapse_parent_id):
remotes[s_dirpath] = s_dirpath_... | 0.003883 |
def _insert_cache(self, key, val, read):
'''
Does an insert into the cache such that the cache
will have an updated entry for the key,value,read
tuple. Any changes to those values will both update
the local cache and queue any required writes to the
database.
... | 0.00625 |
def to_dict(self, flat=True):
"""
Return the contents as regular dict. If `flat` is `True` the
returned dict will only have the first item present, if `flat` is
`False` all values will be returned as lists.
:param flat: If set to `False` the dict returned will have lists
... | 0.00346 |
def pause(self, lastGoodStep=0):
# type: (ALastGoodStep) -> None
"""Pause a run() so that resume() can be called later, or seek within
an Armed or Paused state.
The original call to run() will not be interrupted by pause(), it will
wait until the scan completes or is aborted.
... | 0.00457 |
def _event_filter_console_keypress(self, event):
""" Reimplemented for execution interruption and smart backspace.
"""
key = event.key()
if self._control_key_down(event.modifiers(), include_command=False):
if key == QtCore.Qt.Key_C and self._executing:
self.r... | 0.002082 |
def _add_q(self, q_object):
"""Add a Q-object to the current filter."""
self._criteria = self._criteria._combine(q_object, q_object.connector) | 0.012658 |
def remove(self, value):
"""Remove the first occurence of *value*."""
def remove_trans(pipe):
# If we're caching, we'll need to synchronize before removing.
if self.writeback:
self._sync_helper(pipe)
delete_count = pipe.lrem(self.key, 1, self._pickle(... | 0.004598 |
def evaluation(self, evl):
"""
Sets the statistic to use for evaluation.
:param evl: the statistic
:type evl: SelectedTag, Tag or str
"""
if isinstance(evl, str):
evl = self.tags_evaluation.find(evl)
if isinstance(evl, Tag):
evl = Selected... | 0.006438 |
def forwards(self, orm):
"Write your forwards methods here."
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
for translation in orm['people.PersonTranslation'].objects.all():
if translation.language in ['en', 'de']:
translation.ro... | 0.004823 |
def __system_multiCall(calls, **kwargs):
"""
Call multiple RPC methods at once.
:param calls: An array of struct like {"methodName": string, "params": array }
:param kwargs: Internal data
:type calls: list
:type kwargs: dict
:return:
"""
if not isinstance(calls, list):
raise... | 0.004789 |
def group_batches_joint(samples):
"""Perform grouping by batches for joint calling/squaring off.
"""
def _caller_batches(data):
jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)
batch = tz.get_in(("metadata", "batch"), data) if jointcaller else None
return jointca... | 0.004872 |
def read_bytes(self, count):
"""Read a given number of bytes from the input stream.
Throws MissingBytes if the bytes are not found.
Note: This method does not read from the line buffer.
:return: a string
"""
result = self.input.read(count)
found = len(result)
... | 0.004274 |
def fundrefxml2json(self, node):
"""Convert a FundRef 'skos:Concept' node into JSON."""
doi = FundRefDOIResolver.strip_doi_host(self.get_attrib(node,
'rdf:about'))
oaf_id = FundRefDOIResolver().resolve_by_doi(
"http://dx.doi.org/" + doi... | 0.000733 |
def status(self):
"""Get the status of the responding member."""
status_request = etcdrpc.StatusRequest()
status_response = self.maintenancestub.Status(
status_request,
self.timeout,
credentials=self.call_credentials,
metadata=self.metadata
... | 0.002695 |
def snmp_server_group_group_version(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
snmp_server = ET.SubElement(config, "snmp-server", xmlns="urn:brocade.com:mgmt:brocade-snmp")
group = ET.SubElement(snmp_server, "group")
group_name_key = ET.SubE... | 0.004902 |
def read_csv(filepath):
"""
Read a CSV into a list of dictionarys. The first line of the CSV determines
the keys of the dictionary.
Parameters
----------
filepath : string
Returns
-------
list of dictionaries
"""
symbols = []
with open(filepath, 'rb') as csvfile:
... | 0.002128 |
def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about commits
Level 2 provides events abo... | 0.001497 |
def _to_pil_rgb_image(image):
"""Returns an PIL Image converted to the RGB color space. If the image has
an alpha channel (transparency), it will be overlaid on a black background.
:param image: the PIL image to convert
:returns: The input image if it was already in RGB mode, or a new RGB image
... | 0.001361 |
def query(self):
"""Determines which method of getting the query object for use"""
if hasattr(self.model, 'query'):
return self.model.query
else:
return self.session.query(self.model) | 0.008658 |
def _space(self, hwr_obj, stroke, kind):
"""Do the interpolation of 'kind' for 'stroke'"""
new_stroke = []
stroke = sorted(stroke, key=lambda p: p['time'])
x, y, t = [], [], []
for point in stroke:
x.append(point['x'])
y.append(point['y'])
t.... | 0.001252 |
def main(args=None):
""" Performs an action against a Streaming Analytics service.
"""
streamsx._streams._version._mismatch_check('streamsx.topology.context')
try:
sr = run_cmd(args)
sr['return_code'] = 0
except:
sr = {'return_code':1, 'error': sys.exc_info()}
return sr | 0.009434 |
def generate_circle_output():
"""Build sequence for Circle CI 2.0 config.yml
builds the circleci structure
also links individual jobs into a workflow graph
"""
base = new_base()
workflow = networkx.DiGraph()
LOG.info('%s python versions', len(python_versions))
LOG.info('%s mbed cloud ho... | 0.00219 |
def parse_value(val, var_type=None, enums=None, rebase_arrays=True):
"""Parses the value of a dzn statement.
Parameters
----------
val : str
A value in dzn format.
var_type : dict
The dictionary of variable type as returned by the command ``minizinc
--model-types-only``. Def... | 0.001162 |
def content_list(self, key, model):
"""Returns the list of content IDs for a given model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#get---list-content-ids
Args:
key: The CIK or Token for the device
model:
"""
path ... | 0.00463 |
def _make_request(self, url, headers, params=None):
"""
Generic request handler for OpenStack API requests
Raises specialized Exceptions for commonly encountered error codes
"""
self.logger.debug("Request URL, Headers and Params: %s, %s, %s", url, headers, params)
# Chec... | 0.004436 |
def get_doc(node):
"""
Return a node's documentation as a string, pulling from annotations
or constructing a simple fake as needed.
"""
res = " ".join(get_doc_annotations(node))
if not res:
res = "(%s)" % node.__class__.__name__.lower()
return res | 0.003534 |
def iter_instances(self):
"""Iterate over the stored objects
Yields:
wrkey: The two-tuple key used to store the object
obj: The instance or function object
"""
for wrkey in set(self.keys()):
obj = self.get(wrkey)
if obj is None:
... | 0.00551 |
def get_paginated_response(data, request):
"""
Update pagination links in course catalog data and return DRF Response.
Arguments:
data (dict): Dictionary containing catalog courses.
request (HttpRequest): Current request object.
Returns:
(Response): DRF response object containi... | 0.000895 |
def plot(self, atDataset,
errorbars=False,
grid=False):
""" use matplotlib methods for plotting
Parameters
----------
atDataset : allantools.Dataset()
a dataset with computed data
errorbars : boolean
Plot errorbars. Defaults to F... | 0.004124 |
def add_payload(self, payload):
"""Add new the stanza payload.
Marks the stanza dirty.
:Parameters:
- `payload`: XML element or stanza payload object to add
:Types:
- `payload`: :etree:`ElementTree.Element` or `StanzaPayload`
"""
if self._payload... | 0.00311 |
def _strip_commas(cls, kw):
"Strip out any leading/training commas from the token"
kw = kw[:-1] if kw[-1]==',' else kw
return kw[1:] if kw[0]==',' else kw | 0.022472 |
def flatten_spec(spec, prefix,joiner=" :: "):
"""Flatten a canonical specification with nesting into one without nesting.
When building unique names, concatenate the given prefix to the local test
name without the "Test " tag."""
if any(filter(operator.methodcaller("startswith","Test"),spec.keys())):
flat_... | 0.022541 |
def keys_in_dict(d, parent_key, keys):
"""
Create a list of keys from a dict recursively.
"""
for key, value in d.iteritems():
if isinstance(value, dict):
keys_in_dict(value, key, keys)
else:
if parent_key:
prefix = parent_key + "."
els... | 0.002463 |
def get(self):
"""
Constructs a StepContextContext
:returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext
:rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext
"""
return StepContextContext(
self._ver... | 0.008097 |
def list_locations(self, provider=None):
'''
List all available locations in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.location_list(provider)
) | 0.00692 |
def _process_json(data):
"""
return a list of GradPetition objects.
"""
requests = []
for item in data:
petition = GradPetition()
petition.description = item.get('description')
petition.submit_date = parse_datetime(item.get('submitDate'))
petition.decision_date = pars... | 0.001332 |
def clean(self):
"""When receiving the filled out form, check for valid access."""
cleaned_data = super(AuthForm, self).clean()
user = self.get_user()
if self.staff_only and (not user or not user.is_staff):
raise forms.ValidationError('Sorry, only staff are allowed.')
... | 0.004065 |
def get_font(self, values):
"""
'height' 10pt = 200, 8pt = 160
"""
font_key = values
f = self.FONT_FACTORY.get(font_key, None)
if f is None:
f = xlwt.Font()
for attr, value in values:
f.__setattr__(attr, value)
self.FONT... | 0.005571 |
def _restore_isolated(sampleset, bqm, isolated):
"""Return samples-like by adding isolated variables into sampleset in a
way that minimizes the energy (relative to the other non-isolated variables).
"""
samples = sampleset.record.sample
variables = sampleset.variables
new_samples = np.empty((l... | 0.005447 |
def set_input_fields(self, input_fields):
"""Given a scalar or ordered list of strings generate JSONPaths
that describe how to access the values necessary for the Extractor """
if not (isinstance(input_fields, basestring) or
isinstance(input_fields, types.ListType)):
... | 0.004211 |
def assign_utc(self, reading_id, uptime=None, prefer="before"):
"""Assign a utc datetime to a reading id.
This method will return an object with assignment information or None
if a utc value cannot be assigned. The assignment object returned
contains a utc property that has the asssign... | 0.003131 |
def newNodeEatName(self, name):
"""Creation of a new node element. @ns is optional (None). """
ret = libxml2mod.xmlNewNodeEatName(self._o, name)
if ret is None:raise treeError('xmlNewNodeEatName() failed')
__tmp = xmlNode(_obj=ret)
return __tmp | 0.014085 |
def select_qadapter(self, pconfs):
"""
Given a list of parallel configurations, pconfs, this method select an `optimal` configuration
according to some criterion as well as the :class:`QueueAdapter` to use.
Args:
pconfs: :class:`ParalHints` object with the list of parallel c... | 0.005584 |
def _get_npcap_config(param_key):
"""
Get a Npcap parameter matching key in the registry.
List:
AdminOnly, DefaultFilterSettings, DltNull, Dot11Adapters, Dot11Support
LoopbackAdapter, LoopbackSupport, NdisImPlatformBindingOptions, VlanSupport
WinPcapCompatible
"""
hkey = winreg.HKEY_LOC... | 0.001642 |
def _merge_many_to_one_field_from_fkey(self, main_infos, prop, result):
"""
Find the relationship associated with this fkey and set the title
:param dict main_infos: The already collected datas about this column
:param obj prop: The property mapper of the relationship
:param lis... | 0.00226 |
def get_pages(self, namespace, apcontinue=''):
"""Retrieve all pages from a namespace starting from apcontinue."""
params = {
"action": "query",
"list": "allpages",
"aplimit": self.limit,
"apnamespace": namespace,
"format": "json"
}
... | 0.004773 |
def find_prime_polynomials(generator=2, c_exp=8, fast_primes=False, single=False):
'''Compute the list of prime polynomials for the given generator and galois field characteristic exponent.'''
# fast_primes will output less results but will be significantly faster.
# single will output the first prime polyn... | 0.005719 |
def convert_chain(
txtfiles,
headers,
h5file,
chunksize):
"""Converts chain in plain text format into HDF5 format.
Keyword arguments:
txtfiles -- list of paths to the plain text chains.
headers -- name of each column.
h5file -- where to put the resulting HDF5 file.
... | 0.002221 |
def compile_pythrancode(module_name, pythrancode, specs=None,
opts=None, cpponly=False, pyonly=False,
output_file=None, module_dir=None, **kwargs):
'''Pythran code (string) -> c++ code -> native module
if `cpponly` is set to true, return the generated C++ filenam... | 0.000449 |
def _cells(self):
"""
A sequence of |_Cell| objects, one for each cell of the layout grid.
If the table contains a span, one or more |_Cell| object references
are repeated.
"""
col_count = self._column_count
cells = []
for tc in self._tbl.iter_tcs():
... | 0.003086 |
def disable_user():
"""
Disables a user in the data store
.. example::
$ curl http://localhost:5000/disable_user -X POST \
-H "Authorization: Bearer <your_token>" \
-d '{"username":"Walter"}'
"""
req = flask.request.get_json(force=True)
usr = User.query.filter_by(use... | 0.002075 |
def setCurrentDebugLine( self, lineno ):
"""
Returns the line number for the documents debug line.
:param lineno | <int>
"""
self.markerDeleteAll(self._currentDebugMarker)
self.markerAdd(lineno, self._currentDebugMarker)
self.setCurrentLine(l... | 0.015337 |
def present(name, value, config=None):
'''
Ensure that the named sysctl value is set in memory and persisted to the
named configuration file. The default sysctl configuration file is
/etc/sysctl.conf
name
The name of the sysctl value to edit
value
The sysctl value to apply
... | 0.00055 |
def get_suggestions(self, reftrack):
"""Return a list with possible children for this reftrack
Each Reftrack may want different children. E.g. a Asset wants
to suggest a shader for itself and all assets that are linked in
to it in the database. Suggestions only apply for enities with st... | 0.004664 |
def csv_line(self, line):
'''turn a list of values into a CSV line'''
self.csv_sep = ","
return self.csv_sep.join(['"' + str(x) + '"' for x in line]) | 0.011561 |
def _GetTripSequence(self, schedule=None):
"""Return a list of (trip, stop_sequence) for all trips visiting this stop.
A trip may be in the list multiple times with different index.
stop_sequence is an integer.
Args:
schedule: Deprecated, do not use.
"""
if schedule is None:
schedu... | 0.003881 |
def _generate_identifier_name(self, columns, prefix="", max_size=30):
"""
Generates an identifier from a list of column names obeying a certain string length.
"""
hash = ""
for column in columns:
hash += "%x" % binascii.crc32(encode(str(column)))
return (pref... | 0.008646 |
def load_ini(self):
""" Load the given .INI file.
"""
if not self.config_file:
return
# Load INI file
ini_file = ConfigParser.SafeConfigParser()
if not ini_file.read(self.config_file):
raise ConfigParser.ParsingError("Global configuration file %r ... | 0.003981 |
def auth_kubernetes(self, role, jwt, use_token=True, mount_point='kubernetes'):
"""POST /auth/<mount_point>/login
:param role: Name of the role against which the login is being attempted.
:type role: str.
:param jwt: Signed JSON Web Token (JWT) for authenticating a service account.
... | 0.00603 |
def as_sql(self, compiler, connection):
"""Compiles this expression into SQL."""
qn = compiler.quote_name_unless_alias
return "%s.%s->'%s'" % (qn(self.alias), qn(self.target.column), self.hstore_key), [] | 0.013158 |
def apply_color_scheme(self, color_scheme):
"""
Apply a pygments color scheme to the console.
As there is not a 1 to 1 mapping between color scheme formats and
console formats, we decided to make the following mapping (it usually
looks good for most of the available pygments sty... | 0.001799 |
def draw_scores(self):
"""Draw the current and best score"""
x1, y1 = self.WIDTH - self.BORDER - 200 - 2 * self.BORDER, self.BORDER
width, height = 100, 60
self.screen.fill((255, 255, 255), (x1, 0, self.WIDTH - x1, height + y1))
self._draw_score_box(self.score_label, self.score, ... | 0.009506 |
def trigger(self, *args, **kwargs):
"""Called on event emission and notifies the :meth:`wait` method
Called by :class:`AioEventWaiters` when the
:class:`~pydispatch.dispatch.Event` instance is dispatched.
Positional and keyword arguments are stored as instance attributes for
us... | 0.004228 |
def reward_battery(self):
"""
Add a battery level reward
"""
if not 'battery' in self.mode:
return
mode = self.mode['battery']
if mode and mode and self.__test_cond(mode):
self.logger.debug('Battery out')
self.player.stats['reward'] += ... | 0.007264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.