text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def propagate_average_up(self, cols=['lat', 'lon'],
target_df_name='sites', source_df_name='samples'):
"""
Propagate average values from a lower table to a higher one.
For example, propagate average lats/lons from samples to sites.
Pre-existing values will no... | 0.003135 |
def _execActions(self, type, msg):
""" Execute Registered Actions """
for action in self.ACTIONS:
action(type, msg) | 0.013986 |
def all(cls):
"""
Returns a list of all configured endpoints the server is listening on. For each endpoint,
the list of allowed databases is returned too if set.
The result is a JSON hash which has the endpoints as keys, and the list of
mapped database names as v... | 0.008525 |
def p2wpkh_input_and_witness(outpoint, sig, pubkey, sequence=0xFFFFFFFE):
'''
Outpoint, hex_string, hex_string, int -> (TxIn, InputWitness)
Create a signed witness TxIn and InputWitness from a p2wpkh prevout
'''
return tb.make_witness_input_and_witness(
outpoint=outpoint,
sequence=se... | 0.002591 |
def DEFINE_point(name, default, help): # pylint: disable=invalid-name,redefined-builtin
"""Registers a flag whose value parses as a point."""
flags.DEFINE(PointParser(), name, default, help) | 0.020513 |
def set_priors(self, priors=None, fixed=None, random=None,
match_derived_names=True):
'''Set priors for one or more existing terms.
Args:
priors (dict): Dict of priors to update. Keys are names of terms
to update; values are the new priors (either a Prior ... | 0.00176 |
def browserify_file(entry_point, output_file, babelify=False, export_as=None):
"""
Browserify a single javascript entry point plus non-external
dependencies into a single javascript file. Generates source maps
in debug mode. Minifies the output in release mode.
By default, it is not possible to ``r... | 0.001953 |
async def get_profile(self, *tags):
'''Get a profile object using tag(s)'''
url = '{0.BASE}/profile/{1}'.format(self, ','.join(tags))
data = await self.request(url)
if isinstance(data, list):
return [Profile(self, c) for c in data]
else:
... | 0.008671 |
def get_stops_in_polygon(
feed: "Feed", polygon: Polygon, geo_stops=None
) -> DataFrame:
"""
Return the slice of ``feed.stops`` that contains all stops that lie
within the given Shapely Polygon object that is specified in
WGS84 coordinates.
Parameters
----------
feed : Feed
polygon ... | 0.00093 |
def readAlignedString(self, align = 4):
"""
Reads an ASCII string aligned to the next align-bytes boundary.
@type align: int
@param align: (Optional) The value we want the ASCII string to be aligned.
@rtype: str
@return: A 4-bytes aligned (default) ASCI... | 0.014733 |
def request(self, method, url, **kwargs):
"""Build remote url request. Constructs necessary auth."""
user_token = kwargs.pop('token', self.token)
token, secret, expires_at = self.parse_raw_token(user_token)
if token is not None:
params = kwargs.get('params', {})
p... | 0.004338 |
def get_filter(cls, mimetype):
"""
Returns a filter string for the file dialog. The filter is based
on the mime type.
:param mimetype: path from which the filter must be derived.
:return: Filter string
"""
filters = ' '.join(
['*%s' % ext for ext in m... | 0.004902 |
def freeze(self):
"""Make the SchemaElement's connections immutable."""
self.in_connections = frozenset(self.in_connections)
self.out_connections = frozenset(self.out_connections) | 0.009852 |
def write(self):
""" Write the current text to self.file, and flush it.
This can be overridden to handle custom writes.
"""
if self._text is not None:
with self.lock:
self.file.write(str(self._text).encode())
self.file.flush()
sleep... | 0.005935 |
def info(self):
'''Return a nested dictionary of information related to the actor
status and performance. The dictionary contains the following entries:
* ``actor`` a dictionary containing information regarding the type of
actor and its status.
* ``events`` a dictionary of inf... | 0.001556 |
def tweets_for_user(screen_name, limit=1e10):
""" Collect the most recent 3200 tweets for this user, sleeping to deal with rate limits."""
qu = Queue()
p = Thread(target=_tweets_for_user, args=(qu, screen_name, limit))
p.start()
p.join(910)
if p.is_alive():
sys.stderr.write('no results a... | 0.007126 |
def runExperiment(args):
"""
Run experiment. What did you think this does?
args is a dict representing the parameters. We do it this way to support
multiprocessing. args contains one or more of the following keys:
@param featureNoise (float) Noise level to add to the features
d... | 0.011167 |
def next(self) -> mx.io.DataBatch:
"""
Returns the next batch from the data iterator.
"""
if not self.iter_next():
raise StopIteration
i, j = self.batch_indices[self.curr_batch_index]
self.curr_batch_index += 1
batch_size = self.bucket_batch_sizes[i]... | 0.005348 |
def setRegisterNumbersForTemporaries(ast, start):
"""Assign register numbers for temporary registers, keeping track of
aliases and handling immediate operands.
"""
seen = 0
signature = ''
aliases = []
for node in ast.postorderWalk():
if node.astType == 'alias':
aliases.ap... | 0.001447 |
def to_python(self, value, resource):
"""Converts to unicode if `self.encoding != None`, otherwise returns input without attempting to decode"""
if value is None:
return self._transform(value)
if isinstance(value, six.text_type):
return self._transform(value)
i... | 0.00627 |
def create(self, **kwargs):
"""Create a new instance of this resource type.
As a general rule, the identifier should have been provided, but in
some subclasses the identifier is server-side-generated. Those classes
have to overload this method to deal with that scenario.
"""
... | 0.005386 |
def _set_get_vnetwork_dvpgs(self, v, load=False):
"""
Setter method for get_vnetwork_dvpgs, mapped from YANG variable /brocade_vswitch_rpc/get_vnetwork_dvpgs (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_get_vnetwork_dvpgs is considered as a private
method. B... | 0.005672 |
def load_variables(layout, types=None, levels=None, skip_empty=True,
dataset=None, scope='all', **kwargs):
''' A convenience wrapper for one or more load_*_variables() calls.
Args:
layout (BIDSLayout): BIDSLayout containing variable files.
types (str, list): Types of variable... | 0.000948 |
def set_header(self, header, value):
""" Set header value """
# requests>=2.11 only accepts `str` or `bytes` header values
# raising an exception here, instead of leaving it to `requests` makes
# it easy to know where we passed a wrong header type in the code.
if not isinstance(v... | 0.006073 |
def execute_on_all_members(self, task):
"""
Executes a task on all of the known cluster members.
:param task: (Task), the task executed on the all of the members.
:return: (Map), :class:`~hazelcast.future.Future` tuples representing pending completion of the task on each member.
... | 0.00978 |
def adapter_update_nio_binding(self, adapter_number, nio):
"""
Update a port NIO binding.
:param adapter_number: adapter number
:param nio: NIO instance to add to the adapter
"""
if self.is_running():
try:
yield from self.update_ubridge_udp_c... | 0.004071 |
def collect_variables(self, selections) -> None:
"""Apply method |ChangeItem.collect_variables| of the base class
|ChangeItem| and also apply method |ExchangeItem.insert_variables|
of class |ExchangeItem| to collect the relevant base variables
handled by the devices of the given |Selecti... | 0.001663 |
def import_data(self, file_name='*', folder_name='.', head_row=0, index_col=0,
convert_col=True, concat_files=False, save_file=True):
""" Imports csv file(s) and stores the result in self.imported_data.
Note
----
1. If folder exists out of current directo... | 0.007799 |
def get_name(self, use_alias=True):
"""
Gets the name to reference the sorted field
:return: the name to reference the sorted field
:rtype: str
"""
if self.desc:
direction = 'DESC'
else:
direction = 'ASC'
if use_alias:
... | 0.004386 |
def sync_account(self, sync_message):
"""同步账户
Arguments:
sync_message {[type]} -- [description]
"""
self.init_hold = sync_message['hold_available']
self.init_cash = sync_message['cash_available']
self.sell_available = copy.deepcopy(self.init_hold)
s... | 0.004796 |
def load(self, filename, **kwargs):
"""
Parse a file specified with the filename and return an numpy array
Parameters
----------
filename : string
A path of a file
Returns
-------
ndarray
An instance of numpy array
... | 0.004914 |
def Create(name,template,group_id,network_id,cpu=None,memory=None,alias=None,password=None,ip_address=None,
storage_type="standard",type="standard",primary_dns=None,secondary_dns=None,
additional_disks=[],custom_fields=[],ttl=None,managed_os=False,description=None,
source_server_password=None,cp... | 0.03501 |
def padRect(rect, padTop, padBottom, padLeft, padRight, bounds, clipExcess = True):
"""
Pads a rectangle by the specified values on each individual side,
ensuring the padded rectangle falls within the specified bounds.
The input rectangle, bounds, and return value are all a tuple of (x,y,w,h).
"""
# Unpack th... | 0.054734 |
def get_type(bind):
""" Detect the ideal type for the data, either using the explicit type
definition or the format (for date, date-time, not supported by JSON). """
types = bind.types + [bind.schema.get('format')]
for type_name in ('date-time', 'date', 'decimal', 'integer', 'boolean',
... | 0.002353 |
def set_of_vars(arg_plot):
"""Build set of needed variables.
Args:
arg_plot (str): string with variable names separated with ``,``.
Returns:
set of str: set of variables.
"""
return set(var for var in arg_plot.split(',') if var in phyvars.PLATES) | 0.003534 |
def read_vcf(vcf_file, ref_file):
"""
Reads in a vcf/vcf.gz file and associated
reference sequence fasta (to which the VCF file is mapped).
Parses mutations, insertions, and deletions and stores them in a nested dict,
see 'returns' for the dict structure.
Calls with heterozygous values... | 0.010369 |
def place_svg_dict(self, x, y, svg_dict, layer_id, group=None):
"""Same as :meth:`place` but with a dictionary as :paramref:`svg_dict`.
:param dict svg_dict: a dictionary returned by `xmltodict.parse()
<https://github.com/martinblech/xmltodict>`__
:param dict group: a dictionary of va... | 0.002692 |
def is_valid_timestamp(date, unit='millis'):
"""
Checks that a number that represents a date as milliseconds is correct.
"""
assert isinstance(date, int), "Input is not instance of int"
if unit is 'millis':
return is_positive(date) and len(str(date)) == 13
elif unit is 'seconds':
... | 0.002304 |
def read(self, size=None):
"""Reads a byte string from the file-like object at the current offset.
The function will read a byte string of the specified size or
all of the remaining data if no size was specified.
Args:
size (Optional[int]): number of bytes to read, where None is all
re... | 0.004755 |
def _generate_nodes(self,
name,
command,
parent=None,
show_nested=False,
commands=None):
"""Generate the relevant Sphinx nodes.
Format a `click.Group` or `click.Command`.
:pa... | 0.004217 |
def collect(self):
"""Collect statistics from /proc/self/mountstats.
Currently, we do fairly naive parsing and do not actually check
the statvers value returned by mountstats.
"""
if str_to_bool(self.config['use_sudo']):
if not os.access(self.config['sudo_cmd'], os.... | 0.00056 |
def pformat(self, prefix=()):
'''
Makes a pretty ASCII format of the data, suitable for
displaying in a console or saving to a text file.
Returns a list of lines.
'''
nan = float("nan")
def sformat(segment, stat):
FMT = "n={0}, mean={1}, p50/... | 0.00223 |
def get_pullrequest(self, project, repository, pull_request_id):
"""
Retrieve a pull request.
The authenticated user must have REPO_READ permission
for the repository that this pull request targets to call this resource.
:param project:
:param repository:
:param p... | 0.008485 |
def encipher(self,string):
"""Encipher string using Polybius square cipher according to initialised key.
Example::
ciphertext = Polybius('APCZWRLFBDKOTYUQGENHXMIVS',5,'MKSBU').encipher(plaintext)
:param string: The string to encipher.
:returns: The enciphered string. ... | 0.018333 |
def predict(self, X, b=0.5, pos_label=1, return_probs=False):
"""Return numpy array of class predictions for X
based on predicted marginal probabilities.
:param X: Input data.
:param b: Decision boundary *for binary setting only*.
:type b: float
:param pos_label: Positiv... | 0.004815 |
def batch_get_item(self, batch_list):
"""
Return a set of attributes for a multiple items in
multiple tables using their primary keys.
:type batch_list: :class:`boto.dynamodb.batch.BatchList`
:param batch_list: A BatchList object which consists of a
list of :class:`b... | 0.002821 |
def get_time():
'''
Get the current system time.
:return: The current time in 24 hour format
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' timezone.get_time
'''
ret = salt.utils.mac_utils.execute_return_result('systemsetup -gettime')
return salt.utils.mac_utils.p... | 0.002976 |
def fcoe_get_interface_output_fcoe_intf_list_fcoe_intf_ifindex(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fcoe_get_interface = ET.Element("fcoe_get_interface")
config = fcoe_get_interface
output = ET.SubElement(fcoe_get_interface, "output")
... | 0.003793 |
def verify_selenium_server_is_running(self):
"""
Start the Selenium standalone server, if it isn't already running.
Returns a tuple of two elements:
* A boolean which is True if the server is now running
* The Popen object representing the process so it can be terminated
... | 0.001803 |
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2017-07-01: :mod:`v2017_07_01.models<azure.mgmt.containerservice.v2017_07_01.models>`
* 2018-03-31: :mod:`v2018_03_31.models<azure.mgmt.containerservice.v2018_03_31.models>`
* 2018-08-01-p... | 0.00602 |
def pipe_urlbuilder(context=None, _INPUT=None, conf=None, **kwargs):
"""A url module that builds a url. Loopable.
Parameters
----------
context : pipe2py.Context object
_INPUT : pipeforever pipe or an iterable of items or fields
conf : {
'PARAM': [
{'key': {'value': <'order'... | 0.000917 |
def plot_estimates(positions, estimates):
"""
Plots density, and probability estimates.
Parameters
----------
positions : iterable of float
Paragraph positions for which densities, and probabilities were estimated.
estimates : six-tuple of (sequence of float)
Estimates of P(rele... | 0.003135 |
def create_branch(profile, name, branch_off):
"""Create a branch.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
name
... | 0.001497 |
def infer_x(self, y):
"""Infer probable x from input y
@param y the desired output for infered x.
@return a list of probable x
"""
OptimizedInverseModel.infer_x(self, y)
if self.fmodel.size() == 0:
return self._random_x()
x_guesses = [self._guess_x... | 0.0125 |
def run(ctx, commandline):
"""Run command with environment variables present."""
file = ctx.obj['FILE']
dotenv_as_dict = dotenv_values(file)
if not commandline:
click.echo('No command given.')
exit(1)
ret = run_command(commandline, dotenv_as_dict)
exit(ret) | 0.003367 |
def get_scope_list(self) -> list:
"""
Return the list of all contained scope from global to local
"""
# by default only return scoped name
lstparent = [self]
p = self.get_parent()
while p is not None:
lstparent.append(p)
p = p.get_parent()
... | 0.005814 |
def SvcStop(self) -> None:
"""
Called when the service is being shut down.
"""
# tell the SCM we're shutting down
# noinspection PyUnresolvedReferences
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
# fire the stop event
win32event.SetEvent(se... | 0.005952 |
def _maybe_match_name(a, b):
"""
Try to find a name to attach to the result of an operation between
a and b. If only one of these has a `name` attribute, return that
name. Otherwise return a consensus name if they match of None if
they have different names.
Parameters
----------
a : o... | 0.001244 |
def count_with_multiplier(groups, multiplier):
""" Update group counts with multiplier
This is for handling atom counts on groups like (OH)2
:param groups: iterable of Group/Element
:param multiplier: the number to multiply by
"""
counts = collections.defaultdict(float)
for group in group... | 0.002268 |
def _get_value_from_config(self, section, name):
"""Loads the default from the config. Returns _no_value if it doesn't exist"""
conf = configuration.get_config()
try:
value = conf.get(section, name)
except (NoSectionError, NoOptionError, KeyError):
return _no_va... | 0.008403 |
def set(self, data_type, values):
"""Update/Create a new attribute and set its value(s).
Args::
data_type : attribute data type (see constants SDC.xxx)
values : attribute value(s); specify a list to create
a multi-valued attribute; a string valued
... | 0.001284 |
def transfer(ctx, _to='address', _value='uint256', returns=STATUS):
""" Standardized Contract API:
function transfer(address _to, uint256 _value) returns (bool _success)
"""
log.DEV('In Fungible.transfer')
if ctx.accounts[ctx.msg_sender] >= _value:
ctx.accounts[ctx.ms... | 0.003953 |
def normalize(es, esnull):
"""normalize the ES(S,pi) and the observed ES(S), separately rescaling
the positive and negative scores by dividing the mean of the ES(S,pi).
return: NES, NESnull
"""
nEnrichmentScores =np.zeros(es.shape)
nEnrichmentNulls=np.zeros(esnull.shape)
esnu... | 0.009514 |
def get_fields_by_class(cls, field_class):
""" Return a list of field names matching a field class
:param field_class: field class object
:return: list
"""
ret = []
for key, val in getattr(cls, '_fields').items():
if isinstance(val, field_class):
... | 0.005556 |
def clear_boxes(self):
"""
Clear all boxes
"""
self.tmin_box.Clear()
self.tmin_box.SetStringSelection("")
if self.current_fit:
self.tmin_box.SetItems(self.T_list)
self.tmin_box.SetSelection(-1)
self.tmax_box.Clear()
self.tmax_box.S... | 0.004798 |
def read_ipv6_frag(self, length, extension):
"""Read Fragment Header for IPv6.
Structure of IPv6-Frag header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Reserved | Fragment Offset |Res|M|
+-+-+-+-+-+-+-... | 0.001179 |
def benchmark_method(f):
"decorator to turn f into a factory of benchmarks"
@wraps(f)
def inner(name, *args, **kwargs):
return Benchmark(name, f, args, kwargs)
return inner | 0.005102 |
def delete(filething):
""" delete(filething)
Arguments:
filething (filething)
Raises:
mutagen.MutagenError
Remove tags from a file.
"""
t = OggTheora(filething)
filething.fileobj.seek(0)
t.delete(filething) | 0.003891 |
def get(self, key, default=None):
"""
Returns the contents of the named key.
**key** is a :ref:`type-string`, and the returned values will
either be ``list`` of key contents or ``None`` if no key was
found. ::
>>> font.lib["public.glyphOrder"]
["A", "B", ... | 0.002667 |
def _find_bounds_1d(data, x):
"""
Find the index of the lower bound where ``x`` should be inserted
into ``a`` to maintain order.
The index of the upper bound is the index of the lower bound
plus 2. Both bound indices must be within the array.
Parameters
-------... | 0.002581 |
def lambda_handler(event, context):
"""Run the script."""
body = event.get('body', dict())
events = body.get('events', list())
source_ip = str(event.get('source_ip', ''))
if len(events) == 0:
return {'success': False, 'message': "No events sent in"}
status = process_events(events, source... | 0.002326 |
def _calcEnergyStretchTwist(self, diff, es, which):
r"""Calculate energy for ``estype='ST'`` using a difference vector.
It is called in :meth:`dnaEY.getGlobalDeformationEnergy` for energy calculation of each frame.
Parameters
----------
diff : numpy.ndarray
Array of... | 0.003984 |
def dict(value,
allow_empty = False,
json_serializer = None,
**kwargs):
"""Validate that ``value`` is a :class:`dict <python:dict>`.
.. hint::
If ``value`` is a string, this validator will assume it is a JSON
object and try to convert it into a :class:`dict <python:dict>... | 0.003635 |
def read(self, sources, cache_duration=None):
"""
Queues the config sources to be read later (when config is accessed), or reads immediately if config has already been
accessed.
:param file/str/list sources: Config source URL (http/https), source string, file name, or file pointer... | 0.008911 |
def run(self):
'''
Main loop of the ConCache, starts updates in intervals and
answers requests from the MWorkers
'''
context = zmq.Context()
# the socket for incoming cache requests
creq_in = context.socket(zmq.REP)
creq_in.setsockopt(zmq.LINGER, 100)
... | 0.001115 |
def get_acs(self):
"""
Returns an instance of the Asset Control Service.
"""
import predix.security.acs
acs = predix.security.acs.AccessControl()
return acs | 0.009804 |
def pmt_angles(self):
"""A list of PMT directions sorted by PMT channel, on DU-1, floor-1"""
if self._pmt_angles == []:
mask = (self.pmts.du == 1) & (self.pmts.floor == 1)
self._pmt_angles = self.pmts.dir[mask]
return self._pmt_angles | 0.007092 |
def sanitize_filename(filename):
"""preserve the file ending, but replace the name with a random token """
# TODO: fix broken splitext (it reveals everything of the filename after the first `.` - doh!)
token = generate_drop_id()
name, extension = splitext(filename)
if extension:
return '%s%s... | 0.005362 |
def home_mode_set_state(self, state, **kwargs):
"""Set the state of Home Mode"""
# It appears that surveillance station needs lowercase text
# true/false for the on switch
if state not in (HOME_MODE_ON, HOME_MODE_OFF):
raise ValueError('Invalid home mode state')
api... | 0.002857 |
def _get_users(self, user_base):
""""Get users from LDAP"""
results = self._search(
getattr(self, '_%s_user_base' % user_base),
'(objectClass=*)',
['*'],
scope=ldap.SCOPE_ONELEVEL
)
for dn, attrs in results:
uid = attrs.get('uid... | 0.00708 |
def setRecordSet( self, recordSet ):
"""
Sets the record set instance that this widget will use.
:param recordSet | <orb.RecordSet>
"""
if ( recordSet ):
self.setQuery( recordSet.query() )
self.setGroupBy( recordSet.groupBy() ... | 0.029289 |
def _check_equal_shape(name,
static_shape,
dynamic_shape,
static_target_shape,
dynamic_target_shape=None):
"""Check that source and target shape match, statically if possible."""
static_target_shape = tf.TensorShape(static_... | 0.007335 |
def prefix(prefix):
"""Returns a dictionary of all environment variables starting with
the given prefix, lower cased and stripped.
"""
d = {}
e = lower_dict(environ.copy())
prefix = prefix.lower()
for k, v in e.items():
try:
if k.startswith(prefix):
k =... | 0.002364 |
def collectSingleContribs(self, measure='LFP'):
"""
Collect single cell data and save them to HDF5 file.
The function will also return signals generated by all cells
Parameters
----------
measure : str
{'LFP', 'CSD'}: Either 'LFP' or 'CSD'.
Returns... | 0.004896 |
def request_callback_answer(
self,
chat_id: Union[int, str],
message_id: int,
callback_data: bytes
):
"""Use this method to request a callback answer from bots.
This is the equivalent of clicking an inline button containing callback data.
Args:
ch... | 0.006085 |
def update_alarm(self, entity, alarm, criteria=None, disabled=False,
label=None, name=None, metadata=None):
"""
Updates an existing alarm on the given entity.
"""
return entity.update_alarm(alarm, criteria=criteria, disabled=disabled,
label=label, name=name, metad... | 0.012012 |
def replace_anc(dataset, parent_dataset):
"""Replace *dataset* the *parent_dataset*'s `ancillary_variables` field."""
if parent_dataset is None:
return
current_dsid = DatasetID.from_dict(dataset.attrs)
for idx, ds in enumerate(parent_dataset.attrs['ancillary_variables']):
if current_dsid... | 0.002252 |
def add_records(self, domain, records):
"""
Adds the records to this domain. Each record should be a dict with the
following keys:
- type (required)
- name (required)
- data (required)
- ttl (optional)
- comment (optional)
-... | 0.002938 |
def hybrid_forward(self, F, samples, valid_length, outputs, scores, beam_alive_mask, states):
"""
Parameters
----------
F
samples : NDArray or Symbol
The current samples generated by beam search. Shape (batch_size, beam_size, L)
valid_length : NDArray or Symbo... | 0.002302 |
def handle_ref(attr, language=DEFAULT_LANG):
"""
Receives something like:
{
"$ref": "#/files/description/1"
},
Or:
{
"$ref": "#/files/fix/39"
}
And returns the contents of the description or fix file.
:par... | 0.003021 |
def delete(self, table, condition):
""".. :py:method::
Usage::
>>> delete('hospital', {'id': '12de3wrv'})
delete from hospital where id='12de3wrv';
"""
sql = "delete from {}".format(table)
sql += self.parse_condition(condition) + ";"
super(PGWra... | 0.005587 |
def update(self, resource, force=False, timeout=-1):
"""
Updates the Deployment Server resource. The properties that are omitted (not included as part
of the request body) are ignored.
Args:
resource (dict): Object to update.
force:
If set to true... | 0.006242 |
def parse_from_dict(json_dict):
"""
Given a Unified Uploader message, parse the contents and return a
MarketHistoryList instance.
:param dict json_dict: A Unified Uploader message as a dict.
:rtype: MarketOrderList
:returns: An instance of MarketOrderList, containing the orders
within.
... | 0.000762 |
def _set_options(self, qobj_config=None, backend_options=None):
"""Set the backend options for all experiments in a qobj"""
# Reset default options
self._initial_unitary = self.DEFAULT_OPTIONS["initial_unitary"]
self._chop_threshold = self.DEFAULT_OPTIONS["chop_threshold"]
if bac... | 0.001621 |
def autoreg(self, data: ['SASdata', str] = None,
by: [str, list] = None,
cls: [str, list] = None,
hetero: str = None,
model: str = None,
nloptions: str = None,
output: [str, bool, 'SASdata'] = None,
restrict:... | 0.011009 |
def p_file_cr_value_1(self, p):
"""file_cr_value : TEXT"""
if six.PY2:
p[0] = p[1].decode(encoding='utf-8')
else:
p[0] = p[1] | 0.011561 |
def nlerp_quat(from_quat, to_quat, percent):
"""Return normalized linear interpolation of two quaternions.
Less computationally expensive than slerp (which not implemented in this
lib yet), but does not maintain a constant velocity like slerp.
"""
result = lerp_quat(from_quat, to_quat, percent)
... | 0.002793 |
def _sync_io(self):
"""Update the stream with changes to the file object contents."""
if self._file_epoch == self.file_object.epoch:
return
if self._io.binary:
contents = self.file_object.byte_contents
else:
contents = self.file_object.contents
... | 0.004902 |
def result_to_dict(raw_result):
"""
Parse raw result from fetcher into readable dictionary
Args:
raw_result (dict) - raw data from `fetcher`
Returns:
dict - readable dictionary
"""
result = {}
for channel_index, channel in enumerate(raw_result):
channel_id, channe... | 0.001166 |
def _getEndpoint(self, add_tags=None):
"""
Override Build Loggly's RESTful API endpoint
"""
return 'https://logs-01.loggly.com/bulk/{0}/tag/{1}/'.format(
self.custom_token,
self._implodeTags(add_tags=add_tags)
) | 0.007246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.