text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def delete_forwarding_address(payment_id, coin_symbol='btc', api_key=None):
'''
Delete a forwarding address on a specific blockchain, using its
payment id
'''
assert payment_id, 'payment_id required'
assert is_valid_coin_symbol(coin_symbol)
assert api_key, 'api_key required'
params = {... | 0.003868 |
def create_dataset(self, dataset, exists_ok=False, retry=DEFAULT_RETRY):
"""API call: create the dataset via a POST request.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/insert
Args:
dataset (Union[ \
:class:`~google.cloud.bigquery.dat... | 0.001433 |
def start_archive(self, session_id, has_audio=True, has_video=True, name=None, output_mode=OutputModes.composed, resolution=None):
"""
Starts archiving an OpenTok session.
Clients must be actively connected to the OpenTok session for you to successfully start
recording an archive.
... | 0.006907 |
def from_response(response):
"""Returns the correct error type from a ::class::`Response` object."""
if response.code:
return ERRORS[response.code](response)
else:
return Error(response) | 0.008547 |
def get_problem_name(base_name, was_reversed=False, was_copy=False):
"""Construct a problem name from base and reversed/copy options.
Inverse of `parse_problem_name`.
Args:
base_name: base problem name. Should not end in "_rev" or "_copy"
was_reversed: if the problem is to be reversed
was_copy: if t... | 0.009259 |
def fetch_data(self):
"""Fetch the latest data from Fido."""
# Get http session
yield from self._get_httpsession()
# Post login page
yield from self._post_login_page()
# Get token
token_uuid = yield from self._get_token()
# Get account number
accou... | 0.003749 |
def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet,
private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet,
has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet,
h... | 0.005762 |
def output(output_id, name, value_class=NumberValue):
"""Add output to controller"""
def _init():
return value_class(
name,
input_id=output_id,
is_input=False,
index=-1
)
def _decorator(cls):
seta... | 0.007557 |
def _check_if_ins_is_dup(self, start, insertion):
"""Helper to identify an insertion as a duplicate
:param start: 1-based insertion start
:type start: int
:param insertion: sequence
:type insertion: str
:return (is duplicate, variant start)
:rtype (bool, int)
... | 0.004261 |
async def vafter(self):
"""Function that is called after a song finishes playing"""
self.logger.debug("Finished playing a song")
if self.state != 'ready':
self.logger.debug("Returning because player is in state {}".format(self.state))
return
self.pause_time = Non... | 0.003074 |
def selected_urls(self):
"""
Gets the list of selected items file path (url)
"""
urls = []
debug('gettings urls')
for proxy_index in self.tree_view.selectedIndexes():
finfo = self.tree_view.fileInfo(proxy_index)
urls.append(finfo.canonicalFilePath(... | 0.004938 |
def not_alived(subset=None, show_ip=False, show_ipv4=None):
'''
.. versionadded:: 2015.8.0
.. versionchanged:: 2019.2.0
The 'show_ipv4' argument has been renamed to 'show_ip' as it now
includes IPv6 addresses for IPv6-connected minions.
Print a list of all minions that are NOT up accord... | 0.001335 |
def range(self, dim, data_range=True, dimension_range=True):
"""Return the lower and upper bounds of values along dimension.
Args:
dimension: The dimension to compute the range on.
data_range (bool): Compute range from data values
dimension_range (bool): Include Dime... | 0.001835 |
def cache_etag(request, *argz, **kwz):
'''Produce etag value for a cached page.
Intended for usage in conditional views (@condition decorator).'''
response, site, cachekey = kwz.get('_view_data') or initview(request)
if not response: return None
return fjcache.str2md5(
'{0}--{1}--{2}'.format( site.id if site el... | 0.033505 |
def validate(self):
"""
Ensure `self.path` has one of the extensions in `self.allowed_formats`.
"""
assert self.path, "{} must have a path".format(self.__class__.__name__)
ext = extract_path_ext(self.path, default_ext=self.default_ext)
if ext not in self.allowed_formats a... | 0.00823 |
def __shapefileHeader(self, fileObj, headerType='shp'):
"""Writes the specified header type to the specified file-like object.
Several of the shapefile formats are so similar that a single generic
method to read or write them is warranted."""
f = self.__getFileObj(fileObj)
f... | 0.008602 |
def _check_prompts(pre_prompt, post_prompt):
'''Check that the prompts are strings'''
if not isinstance(pre_prompt, str):
raise TypeError("The pre_prompt was not a string!")
if post_prompt is not _NO_ARG and not isinstance(post_prompt, str):
raise TypeError("The post_prompt was given and was... | 0.002976 |
def write_input(self, output_dir,
make_dir_if_not_present=True, include_cif=False):
"""
Writes a set of VASP input to a directory.
Args:
output_dir (str): Directory to output the VASP input files
make_dir_if_not_present (bool): Set to True if you want... | 0.00452 |
def build_is_last_day_of_season(num_steps_per_season):
"""Build utility method to compute whether the season is changing."""
num_steps_per_cycle = np.sum(num_steps_per_season)
changepoints = np.cumsum(np.ravel(num_steps_per_season)) - 1
def is_last_day_of_season(t):
t_ = dist_util.maybe_get_static_value(t)
... | 0.017028 |
def _add_meta_info(self, eopatch, request_params, service_type):
""" Adds any missing metadata info to EOPatch """
for param, eoparam in zip(['time', 'time_difference', 'maxcc'], ['time_interval', 'time_difference', 'maxcc']):
if eoparam not in eopatch.meta_info:
eopatch.met... | 0.004178 |
def _wait_for_result(self):
"""Wait for the sensor to be ready for measurement."""
basetime = 0.018 if self._low_res else 0.128
sleep(basetime * (self._mtreg / 69.0) + self._delay) | 0.009804 |
def design(npos):
"""
make a design matrix for an anisotropy experiment
"""
if npos == 15:
#
# rotatable design of Jelinek for kappabridge (see Tauxe, 1998)
#
A = np.array([[.5, .5, 0, -1., 0, 0], [.5, .5, 0, 1., 0, 0], [1, .0, 0, 0, 0, 0], [.5, .5, 0, -1., 0, 0], [.5, .... | 0.00469 |
def start_raylet_monitor(self):
"""Start the raylet monitor."""
stdout_file, stderr_file = self.new_log_files("raylet_monitor")
process_info = ray.services.start_raylet_monitor(
self._redis_address,
stdout_file=stdout_file,
stderr_file=stderr_file,
... | 0.003273 |
def read_tuple_ticks(self, symbol, start, end):
''' read ticks as tuple '''
if end is None:
end=sys.maxint
session=self.getReadSession()()
try:
rows=session.query(Tick).filter(and_(Tick.symbol == symbol,
... | 0.012727 |
def _exec_calcs(calcs, parallelize=False, client=None, **compute_kwargs):
"""Execute the given calculations.
Parameters
----------
calcs : Sequence of ``aospy.Calc`` objects
parallelize : bool, default False
Whether to submit the calculations in parallel or not
client : distributed.Clie... | 0.000654 |
def to_XML(self, xml_declaration=True, xmlns=True):
"""
Dumps object fields to an XML-formatted string. The 'xml_declaration'
switch enables printing of a leading standard XML line containing XML
version and encoding. The 'xmlns' switch enables printing of qualified
XMLNS prefix... | 0.002155 |
def predict_netmhcii_binding(job, peptfile, allele, univ_options, netmhciipan_options):
"""
Predict binding for each peptide in `peptfile` to `allele` using netMHCIIpan.
:param toil.fileStore.FileID peptfile: The input peptide fasta
:param str allele: Allele to predict binding against
:param dict u... | 0.005906 |
def equation(self):
"""Mix-in class that returns matrix rows for potential-specified conditions.
Returns matrix part (nunknowns,neq)
Returns rhs part nunknowns
"""
mat = np.empty((self.nunknowns, self.model.neq))
# rhs = np.zeros(self.nunknowns) # Needs to be initialized... | 0.005017 |
def create_transfer_job(self, body):
"""
Creates a transfer job that runs periodically.
:param body: (Required) A request body, as described in
https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body
:type body: dict
:return: ... | 0.004615 |
def projection_as_vec_v3(v, w):
"""Return the signed length of the projection of vector v on vector w.
Returns the full vector result of projection_v3().
"""
proj_len = projection_v3(v, w)
return scale_v3(v, proj_len) | 0.004202 |
def eventFilter(self, object, event):
"""
Filters events for the popup tree widget.
:param object | <QObject>
event | <QEvent>
:retuen <bool> | consumed
"""
try:
is_lineedit = object == self.lineEdit()
... | 0.006834 |
def union_elements(elements):
"""elements = [(chr, s, e, id), ...], this is to join elements that have a
deletion in the 'to' species
"""
if len(elements) < 2: return elements
assert set( [e[3] for e in elements] ) == set( [elements[0][3]] ), "more than one id"
el_id = elements[0][3]
union... | 0.018377 |
def _read_pdb(path):
"""Read PDB file from local drive."""
r_mode = 'r'
openf = open
if path.endswith('.gz'):
r_mode = 'rb'
openf = gzip.open
with openf(path, r_mode) as f:
txt = f.read()
if path.endswith('.gz'):
if sys.vers... | 0.00431 |
def get_kwdefaults(func, parse_source=False):
r"""
Args:
func (func):
Returns:
dict:
CommandLine:
python -m utool.util_inspect get_kwdefaults
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>... | 0.003946 |
def clear(self):
"""
Removes all data from the buffer.
"""
self.io.seek(0)
self.io.truncate()
for item in self.monitors:
item[2] = 0 | 0.010417 |
def parse_result(self, data):
"""
Parse result of L{pyhsm.defines.YSM_BUFFER_LOAD} command.
@return: Number of bytes now in the YubiHSM internal buffer.
@rtype: integer
@raise pyhsm.exception.YHSM_Error: Unexpected number of bytes were loaded
"""
# typedef struc... | 0.008294 |
def show_summary(self, **kwargs):
"""
Print a short summary with the status of the flow and a counter task_status --> number_of_tasks
Args:
stream: File-like object, Default: sys.stdout
Example:
Status Count
--------- -------
Comp... | 0.006227 |
def clone(self, population):
"""
Copy the holder just enough to be able to run a new simulation without modifying the original simulation.
"""
new = empty_clone(self)
new_dict = new.__dict__
for key, value in self.__dict__.items():
if key not in ('populat... | 0.005894 |
def push(self, bot, channel_type, ar, user_id):
"""
Use this method to push message to user of bot.
The message should be packed into ActionResponse object.
This allows to push text messages, buttons, images.
This also allows to force current state of user.
:param bot: b... | 0.003386 |
def Flush(self):
"""Flush the data to the index."""
super(LabelSet, self).Flush()
self.to_delete = self.to_delete.difference(self.to_set)
with data_store.DB.GetMutationPool() as mutation_pool:
mutation_pool.LabelUpdateLabels(
self.urn, self.to_set, to_delete=self.to_delete)
self.to... | 0.005571 |
def unlink_user_account(self, id, provider, user_id):
"""Unlink a user account
Args:
id (str): The user_id of the user identity.
provider (str): The type of identity provider (e.g: facebook).
user_id (str): The unique identifier for the user for the identity.
... | 0.005587 |
def _set_mode(self, mode='r', bufsize=-1):
"""
Subclasses call this method to initialize the BufferedFile.
"""
# set bufsize in any event, because it's used for readline().
self._bufsize = self._DEFAULT_BUFSIZE
if bufsize < 0:
# do no buffering by default, bec... | 0.001125 |
def get_path_to_repo_and_branch(self, repo: str, branch: str) -> Path:
""" Returns a :class:`Path <pathlib.Path>` to where this specific branch is stored on disk.
:param repo: Repo URL
:param branch: branch
:return: Path to where the specific branch from this repo is being cloned.
... | 0.010309 |
def zSetDefaultMeritFunctionSEQ(self, ofType=0, ofData=0, ofRef=0, pupilInteg=0, rings=0,
arms=0, obscuration=0, grid=0, delVignetted=False, useGlass=False,
glassMin=0, glassMax=1000, glassEdge=0, useAir=False, airMin=0,
... | 0.010949 |
async def close(self):
"""|coro|
Closes the connection to discord.
"""
if self._closed:
return
await self.http.close()
self._closed = True
for voice in self.voice_clients:
try:
await voice.disconnect()
except ... | 0.003731 |
def elbv2_load_balancer_hosted_zone(self, lookup, default=None):
"""
Args:
lookup: the friendly name of the V2 elb to look up
default: value to return in case of no match
Returns:
The hosted zone ID of the ELB found with a name matching 'lookup'.
"""
try:
elb = self._elbv2_lo... | 0.00939 |
def program(self, *, vertex_shader, fragment_shader=None, geometry_shader=None,
tess_control_shader=None, tess_evaluation_shader=None, varyings=()) -> 'Program':
'''
Create a :py:class:`Program` object.
Only linked programs will be returned.
A single shader ... | 0.003837 |
def processStream(self):
"""Process a brotli stream.
"""
print('addr hex{:{}s}binary context explanation'.format(
'', self.width-10))
print('Stream header'.center(60, '-'))
self.windowSize = self.verboseRead(WindowSizeAlphabet())
print('Metablock header'.cent... | 0.007226 |
def validate_one(cls, keystr):
""" validates one key string """
regex = r'%s$' % cls.ALLOWED_KEY
if re.match(regex, keystr) is None:
raise cls.Bad("Bad key syntax for: %s. Should be: key1.key2..." % (keystr))
return True | 0.011321 |
def release_value_set(self):
"""
Release a reserved value set so that other executions can use it also.
"""
if self._remotelib:
self._remotelib.run_keyword('release_value_set', [self._my_id], {})
else:
_PabotLib.release_value_set(self, self._my_id) | 0.00641 |
def filter_match_kwargs(kwargs, children=False):
"""
Filters out kwargs for Match construction
:param kwargs:
:type kwargs: dict
:param children:
:type children: Flag to filter children matches
:return: A filtered dict
:rtype: dict
"""
kwargs = kwargs.copy()
for key in ('pat... | 0.001799 |
def _parse_csv_header_lcc_csv_v1(headerlines):
'''
This parses the header of the LCC CSV V1 LC format.
'''
# the first three lines indicate the format name, comment char, separator
commentchar = headerlines[1]
separator = headerlines[2]
headerlines = [x.lstrip('%s ' % commentchar) for x i... | 0.001252 |
def fetch(self, from_time, until_time=None):
"""
This method fetch data from the database according to the period
given
fetch(path, fromTime, untilTime=None)
fromTime is an datetime
untilTime is also an datetime, but defaults to now.
Returns a tuple of (timeInf... | 0.002041 |
def create_context(self, state_hash, base_contexts, inputs, outputs):
"""Create a ExecutionContext to run a transaction against.
Args:
state_hash: (str): Merkle root to base state on.
base_contexts (list of str): Context ids of contexts that will
have their state... | 0.000931 |
def begin_track(tuning, padding=2):
"""Helper function that builds the first few characters of every bar."""
# find longest shorthand tuning base
names = [x.to_shorthand() for x in tuning.tuning]
basesize = len(max(names)) + 3
# Build result
res = []
for x in names:
r = ' %s' % x
... | 0.002283 |
def goal_update(self, goal_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/goals#update-goal"
api_path = "/api/v2/goals/{goal_id}"
api_path = api_path.format(goal_id=goal_id)
return self.call(api_path, method="PUT", data=data, **kwargs) | 0.006873 |
def _fail(self, message, text, i):
"""Raise an exception with given message and text at i."""
raise ValueError("{}:\n{}".format(message, text[i : i + 79])) | 0.017442 |
def _update_plot(self, key, element, bars, lims, ranges):
"""
Process the bars and draw the offset line as necessary. If a
color map is set in the style of the 'main' ViewableElement object, color
the bars appropriately, respecting the required normalization
settings.
"""... | 0.001979 |
def dependencies(self) -> List[Dependency]:
"""Return the PB dependencies."""
dependencies_str = DB.get_hash_value(self.key, 'dependencies')
dependencies = []
for dependency in ast.literal_eval(dependencies_str):
dependencies.append(Dependency(dependency))
return depe... | 0.006098 |
def python_data(self):
'''Representation of aggregate value as dictionary.'''
try:
value = self.clean_value
except LookupError:
# XXX is this necessary?
value = self.get_initial()
return self.from_python(value) | 0.007194 |
def get_verify_command(self, signature_filename, data_filename,
keystore=None):
"""
Return a suitable command for verifying a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_fil... | 0.002757 |
def slot_schedule_difference(old_schedule, new_schedule):
"""Compute the difference between two schedules from a slot perspective
Parameters
----------
old_schedule : list or tuple
of :py:class:`resources.ScheduledItem` objects
new_schedule : list or tuple
of :py:class:`resources.Sc... | 0.000464 |
def _write(self, data):
"""
_write: binary data -> None
Packages the given binary data in an API frame and writes the
result to the serial port
"""
frame = APIFrame(data, self._escaped).output()
self.serial.write(frame) | 0.007246 |
def _wait_time(self, shard_state, secs, now=datetime.datetime.now):
"""Time to wait until slice_start_time is secs ago from now.
Args:
shard_state: shard state.
secs: duration in seconds.
now: a func that gets now.
Returns:
0 if no wait. A positive int in seconds otherwise. Always ... | 0.005111 |
def _get_object_key(self, p_object):
"""Get key from object"""
matched_key = None
matched_index = None
if hasattr(p_object, self._searchNames[0]):
return getattr(p_object, self._searchNames[0])
for x in xrange(len(self._searchNames)):
key = self._searchN... | 0.00295 |
def update_network_asset(self, asset_id, name, asset_type):
"""
Updates a Network Asset
Args:
name: The name provided to the network asset
asset_type: The type provided to the network asset
asset_id:
Returns:
"""
self.update_asset('NE... | 0.005634 |
def parse_dom(dom):
"""Parse dom into a Graph.
:param dom: dom as returned by minidom.parse or minidom.parseString
:return: A Graph representation
"""
root = dom.getElementsByTagName("graphml")[0]
graph = root.getElementsByTagName("graph")[0]
name = graph.getAttr... | 0.002033 |
def _rm_joliet_dir(self, joliet_path):
# type: (bytes) -> int
'''
An internal method to remove a directory from the Joliet portion of the ISO.
Parameters:
joliet_path - The Joliet directory to remove.
Returns:
The number of bytes to remove from the ISO for this... | 0.006255 |
def no_history_check(func):
"""
Decorator function to setup a check to see if history has been turned off,
because if it has then the decorated function needs to throw an exception
:param func: function to decorate
:return: original results or exception
"""
def no_history_check_decorator(se... | 0.001629 |
def log(self, level, prefix = ''):
"""Writes the contents of the Extension to the logging system.
"""
logging.log(level, "%sname: %s", prefix, self.__name)
logging.log(level, "%soptions: %s", prefix, self.__options) | 0.016194 |
def retrieve_data_blob(self, txid):
"""TODO add docstring"""
rawtx = self.retrieve_tx(txid)
return self.get_data_blob(rawtx) | 0.013514 |
def get_config(self, name, default=MISSING):
"""Get a config value from this adapter by name
Args:
name (string): The name of the config variable
default (object): The default value to return if config is not found
Returns:
object: the value associated with ... | 0.006299 |
def _read_ftdna(file):
""" Read and parse Family Tree DNA (FTDNA) file.
https://www.familytreedna.com
Parameters
----------
file : str
path to file
Returns
-------
pandas.DataFrame
individual's genetic data normalized for use wit... | 0.003043 |
def _validate_response(self, response):
"""
:param response: requests.models.Response
:raises: pybomb.exceptions.InvalidResponseException
:raises: pybomb.exceptions.BadRequestException
"""
try:
response.raise_for_status()
except HTTPError as http_error... | 0.002928 |
def returner(ret):
'''
Return information to a Kafka server
'''
if __salt__['config.option']('returner.kafka.topic'):
topic = __salt__['config.option']('returner.kafka.topic')
conn = _get_conn()
producer = Producer({'bootstrap.servers': conn})
producer.poll(0)
pr... | 0.003774 |
def _getphotosets(self):
"""Returns dictionary of photosets retrieved from flickr
d['title']['number_photos'] : Number of photos
d['title']['id'] : ID of photoset
d['title']['photo_id'] : ID of primary photo
d['title']['url'] : URL to photoset
""... | 0.012513 |
def rate(self):
"""Get the sample rate in Hz.
Returns
---------
rate : float
The sample rate, in Hz, calculated from the timestamps
"""
N = len(self.timestamps)
t = self.timestamps[-1] - self.timestamps[0]
rate = 1.0 * N / ... | 0.01173 |
def get_address_coords(self, address):
''' Use the google geocoder to get latitude and longitude for an address string
Args:
address: any address string
Returns:
A tuple of (lat,lng)
'''
url = "https://maps.googleapis.com/maps/api/geocode/json?&address="... | 0.007105 |
def _get_schema():
"""Get the schema for validation"""
schema_path = os.path.join(os.path.dirname(__file__),
'schema', 'scheduling_block_schema.json')
with open(schema_path, 'r') as file:
schema_data = file.read()
schema = json.loads(schema_... | 0.005764 |
def metadata(self):
"""Retrieves metadata about the bucket.
Returns:
A BucketMetadata instance with information about this bucket.
Raises:
Exception if there was an error requesting the bucket's metadata.
"""
if self._info is None:
try:
self._info = self._api.buckets_get(s... | 0.006849 |
def find(self, strSeq) :
"""returns the first occurence of strSeq in self. Takes polymorphisms into account"""
arr = self.encode(strSeq)
return self._kmp_find(arr[0], self) | 0.036458 |
def load_results_from_table_definition(table_definition, table_definition_file, options):
"""
Load all results in files that are listed in the given table-definition file.
@return: a list of RunSetResult objects
"""
default_columns = extract_columns_from_table_definition_file(table_definition, table... | 0.007024 |
def bias_field_correction(
fmr,
fimout = '',
outpath = '',
fcomment = '_N4bias',
executable = '',
exe_options = [],
sitk_image_mask = True,
verbose = False,):
''' Correct for bias field in MR image(s) given in <fmr> as a string
(single file) o... | 0.014456 |
def get_value(self, key):
# type: (str) -> Any
"""Get a value from the configuration.
"""
try:
return self._dictionary[key]
except KeyError:
raise ConfigurationError("No such key - {}".format(key)) | 0.011494 |
def modify_image_attribute(self, image_id, attribute='launchPermission',
operation='add', user_ids=None, groups=None,
product_codes=None):
"""
Changes an attribute of an image.
:type image_id: string
:param image_id: The imag... | 0.004554 |
def xmoe_tr_dense_2k():
"""Series of architectural experiments on Translation.
# run on 8-core setup
119M params, einsum=0.95e13
Returns:
a hparams
"""
hparams = mtf_transformer2.mtf_bitransformer_base()
hparams.encoder_layers = ["self_att", "drd"] * 4
hparams.decoder_layers = ["self_att", "enc_a... | 0.019355 |
def get_endpoints(self, start=0, count=-1, filter='', sort=''):
"""
Gets a list of endpoints in a SAN.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
... | 0.007772 |
def wrap(self, availWidth, availHeight):
"""
All table properties should be known by now.
"""
widths = (availWidth - self.rightColumnWidth,
self.rightColumnWidth)
# makes an internal table which does all the work.
# we draw the LAST RUN's entries! If ... | 0.001896 |
def _cached_path_needs_update(ca_path, cache_length):
"""
Checks to see if a cache file needs to be refreshed
:param ca_path:
A unicode string of the path to the cache file
:param cache_length:
An integer representing the number of hours the cache is valid for
:return:
A b... | 0.00149 |
def today(self) -> datetime:
""" Returns today (date only) as datetime """
self.value = datetime.combine(datetime.today().date(), time.min)
return self.value | 0.01105 |
def confirm_email(self):
""" Confirm email """
if self._email and self.email_new:
self._email = self.email_new
self.email_confirmed = True
self.email_link = None
self.email_new = None
self.email_link_expires = None | 0.007273 |
def get(self, sid):
"""
Constructs a ParticipantContext
:param sid: The sid
:returns: twilio.rest.video.v1.room.room_participant.ParticipantContext
:rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext
"""
return ParticipantContext(self._version,... | 0.008152 |
def play(self):
""" Play Conway's Game of Life. """
# Write the initial configuration to file.
self.t = 1 # Current time level
while self.t <= self.T: # Evolve!
# print( "At time level %d" % t)
# Loop over each cell of the grid and apply Conway's rules.
... | 0.003077 |
def unregister_vm(vm_ref):
'''
Destroys the virtual machine
vm_ref
Managed object reference of a virtual machine object
'''
vm_name = get_managed_object_name(vm_ref)
log.trace('Destroying vm \'%s\'', vm_name)
try:
vm_ref.UnregisterVM()
except vim.fault.NoPermission as ex... | 0.001462 |
def setupRenderModels(self):
"Purpose: Create/destroy GL Render Models"
self.m_rTrackedDeviceToRenderModel = [None] * openvr.k_unMaxTrackedDeviceCount
if self.m_pHMD is None:
return
for unTrackedDevice in range(openvr.k_unTrackedDeviceIndex_Hmd + 1, openvr.k_unMaxTracked... | 0.01581 |
def dilate(self, size):
"""
Dilate a region using morphological operators.
Parameters
----------
size : int
Size of dilation in pixels
"""
if size > 0:
from scipy.ndimage.morphology import binary_dilation
size = (size * 2) + 1
... | 0.003886 |
def plot_sector_exposures_longshort(long_exposures, short_exposures,
sector_dict=SECTORS, ax=None):
"""
Plots outputs of compute_sector_exposures as area charts
Parameters
----------
long_exposures, short_exposures : arrays
Arrays of long and short sector... | 0.000787 |
def _augment_observation(self, ob, reward, cumulative_reward):
""""Expand observation array with additional information header (top rows).
Args:
ob: observation
reward: reward to be included in header.
cumulative_reward: total cumulated reward to be included in header.
Returns:
Exp... | 0.002979 |
def get_scan(self, scan_id):
"""
:param scan_id: The scan ID as a string
:return: A resource containing the scan information
"""
url = self.build_full_url('%s%s' % (self.SCANS, scan_id))
_, json_data = self.send_request(url)
return Resource(json_data) | 0.006515 |
def _claskey(obj, style):
'''Wrap an old- or new-style class object.
'''
i = id(obj)
k = _claskeys.get(i, None)
if not k:
_claskeys[i] = k = _Claskey(obj, style)
return k | 0.009852 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.