code
stringlengths 51
2.34k
| sequence
stringlengths 186
3.94k
| docstring
stringlengths 11
171
|
|---|---|---|
def _chk_docunknown(args, exp):
unknown = []
for arg in args:
if arg[:2] == '--':
val = arg[2:]
if val not in exp:
unknown.append(arg)
elif arg[:1] == '-':
val = arg[1:]
if val not in exp:
unknown.append(arg)
if '-h' in unknown or '--help' in unknown:
return []
return unknown
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list for_statement identifier identifier block if_statement comparison_operator subscript identifier slice integer string string_start string_content string_end block expression_statement assignment identifier subscript identifier slice integer if_statement comparison_operator identifier identifier block expression_statement call attribute identifier identifier argument_list identifier elif_clause comparison_operator subscript identifier slice integer string string_start string_content string_end block expression_statement assignment identifier subscript identifier slice integer if_statement comparison_operator identifier identifier block expression_statement call attribute identifier identifier argument_list identifier if_statement boolean_operator comparison_operator string string_start string_content string_end identifier comparison_operator string string_start string_content string_end identifier block return_statement list return_statement identifier
|
Return any unknown args.
|
def _copy_from(self, rhs):
self._manager = rhs._manager
self._rlist = type(rhs._rlist)(rhs._rlist)
self._region = rhs._region
self._ofs = rhs._ofs
self._size = rhs._size
for region in self._rlist:
region.increment_client_count()
if self._region is not None:
self._region.increment_client_count()
|
module function_definition identifier parameters identifier identifier block expression_statement assignment attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier call call identifier argument_list attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier attribute identifier identifier for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list if_statement comparison_operator attribute identifier identifier none block expression_statement call attribute attribute identifier identifier identifier argument_list
|
Copy all data from rhs into this instance, handles usage count
|
def predict(self,param_dict):
encoder_dict = self._designmatrix_object.encoder
X, col_names = self._designmatrix_object.run_encoder(param_dict, encoder_dict)
Y_pred = self._compute_prediction(X)
return Y_pred
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment pattern_list identifier identifier call attribute attribute identifier identifier identifier argument_list identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement identifier
|
predict new waveforms using multivar fit
|
def _from_dict(cls, _dict):
args = {}
if 'nodes_visited' in _dict:
args['nodes_visited'] = [
DialogNodesVisited._from_dict(x)
for x in (_dict.get('nodes_visited'))
]
if 'log_messages' in _dict:
args['log_messages'] = [
DialogLogMessage._from_dict(x)
for x in (_dict.get('log_messages'))
]
if 'branch_exited' in _dict:
args['branch_exited'] = _dict.get('branch_exited')
if 'branch_exited_reason' in _dict:
args['branch_exited_reason'] = _dict.get('branch_exited_reason')
return cls(**args)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier dictionary if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end list_comprehension call attribute identifier identifier argument_list identifier for_in_clause identifier parenthesized_expression call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end list_comprehension call attribute identifier identifier argument_list identifier for_in_clause identifier parenthesized_expression call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end return_statement call identifier argument_list dictionary_splat identifier
|
Initialize a MessageOutputDebug object from a json dictionary.
|
def export_to_xml(self, block, xmlfile):
root = etree.Element("unknown_root", nsmap=XML_NAMESPACES)
tree = etree.ElementTree(root)
block.add_xml_to_node(root)
for aside in self.get_asides(block):
if aside.needs_serialization():
aside_node = etree.Element("unknown_root", nsmap=XML_NAMESPACES)
aside.add_xml_to_node(aside_node)
block.append(aside_node)
tree.write(xmlfile, xml_declaration=True, pretty_print=True, encoding='utf-8')
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier for_statement identifier call attribute identifier identifier argument_list identifier block if_statement call attribute identifier identifier argument_list block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier keyword_argument identifier true keyword_argument identifier true keyword_argument identifier string string_start string_content string_end
|
Export the block to XML, writing the XML to `xmlfile`.
|
def install(python=PYTHON):
local(
"LIBRARY_PATH={library_path} CPATH={include_path} {python} "
"setup.py build".format(
library_path=LIBRARY_PATH,
include_path=INCLUDE_PATH,
python=python,
))
local("sudo {python} setup.py install".format(python=python))
|
module function_definition identifier parameters default_parameter identifier identifier block expression_statement call identifier argument_list call attribute concatenated_string string string_start string_content string_end string string_start string_content string_end identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier identifier
|
Install into site-packages
|
def content_id(self) -> Optional[UnstructuredHeader]:
try:
return cast(UnstructuredHeader, self[b'content-id'][0])
except (KeyError, IndexError):
return None
|
module function_definition identifier parameters identifier type generic_type identifier type_parameter type identifier block try_statement block return_statement call identifier argument_list identifier subscript subscript identifier string string_start string_content string_end integer except_clause tuple identifier identifier block return_statement none
|
The ``Content-Id`` header.
|
def _get_host(name, array):
host = None
for temp in array.list_hosts():
if temp['name'] == name:
host = temp
break
return host
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier none for_statement identifier call attribute identifier identifier argument_list block if_statement comparison_operator subscript identifier string string_start string_content string_end identifier block expression_statement assignment identifier identifier break_statement return_statement identifier
|
Private function to check host
|
def _set_default_refdata():
global GRAPHTABLE, COMPTABLE, THERMTABLE, PRIMARY_AREA
try:
GRAPHTABLE = _refTable(os.path.join('mtab','*_tmg.fits'))
COMPTABLE = _refTable(os.path.join('mtab','*_tmc.fits'))
except IOError as e:
GRAPHTABLE = None
COMPTABLE = None
warnings.warn('No graph or component tables found; '
'functionality will be SEVERELY crippled. ' + str(e))
try:
THERMTABLE = _refTable(os.path.join('mtab','*_tmt.fits'))
except IOError as e:
THERMTABLE = None
warnings.warn('No thermal tables found, '
'no thermal calculations can be performed. ' + str(e))
PRIMARY_AREA = 45238.93416
set_default_waveset()
|
module function_definition identifier parameters block global_statement identifier identifier identifier identifier try_statement block expression_statement assignment identifier call identifier argument_list call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier call identifier argument_list call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end except_clause as_pattern identifier as_pattern_target identifier block expression_statement assignment identifier none expression_statement assignment identifier none expression_statement call attribute identifier identifier argument_list binary_operator concatenated_string string string_start string_content string_end string string_start string_content string_end call identifier argument_list identifier try_statement block expression_statement assignment identifier call identifier argument_list call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end except_clause as_pattern identifier as_pattern_target identifier block expression_statement assignment identifier none expression_statement call attribute identifier identifier argument_list binary_operator concatenated_string string string_start string_content string_end string string_start string_content string_end call identifier argument_list identifier expression_statement assignment identifier float expression_statement call identifier argument_list
|
Default refdata set on import.
|
def comma_separated_list(self, node, subnodes):
for item in subnodes:
position = (item.last_line, item.last_col)
first, last = find_next_comma(self.lcode, position)
if first:
node.op_pos.append(NodeWithPosition(last, first))
|
module function_definition identifier parameters identifier identifier identifier block for_statement identifier identifier block expression_statement assignment identifier tuple attribute identifier identifier attribute identifier identifier expression_statement assignment pattern_list identifier identifier call identifier argument_list attribute identifier identifier identifier if_statement identifier block expression_statement call attribute attribute identifier identifier identifier argument_list call identifier argument_list identifier identifier
|
Process comma separated list
|
def _find_usage_environments(self):
environments = self.conn.describe_environments()
self.limits['Environments']._add_current_usage(
len(environments['Environments']),
aws_type='AWS::ElasticBeanstalk::Environment',
)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list call identifier argument_list subscript identifier string string_start string_content string_end keyword_argument identifier string string_start string_content string_end
|
find usage for ElasticBeanstalk environments
|
def solve_tuple(expr, vars):
result = tuple(solve(x, vars).value for x in expr.children)
return Result(result, ())
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier generator_expression attribute call identifier argument_list identifier identifier identifier for_in_clause identifier attribute identifier identifier return_statement call identifier argument_list identifier tuple
|
Build a tuple from subexpressions.
|
def write(self, file):
render(
self.template,
file,
benchmarks=self.benchmarks,
hostname=socket.gethostname(),
)
|
module function_definition identifier parameters identifier identifier block expression_statement call identifier argument_list attribute identifier identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier call attribute identifier identifier argument_list
|
Write YAML campaign template to the given open file
|
def im_messages_others(self, room_id, **kwargs):
return self.__call_api_get('im.messages.others', roomId=room_id, kwargs=kwargs)
|
module function_definition identifier parameters identifier identifier dictionary_splat_pattern identifier block return_statement call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier identifier
|
Retrieves the messages from any direct message in the server
|
def DEFINE_integer(self, name, default, help, constant=False):
self.AddOption(
type_info.Integer(name=name, default=default, description=help),
constant=constant)
|
module function_definition identifier parameters identifier identifier identifier identifier default_parameter identifier false block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier
|
A helper for defining integer options.
|
def dicomdir_info(dirpath, *args, **kwargs):
dr = DicomReader(dirpath=dirpath, *args, **kwargs)
info = dr.dicomdirectory.get_stats_of_series_in_dir()
return info
|
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier list_splat identifier dictionary_splat identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list return_statement identifier
|
Get information about series in dir
|
def setup_auth(**keys):
auth = tweepy.OAuthHandler(consumer_key=keys['consumer_key'], consumer_secret=keys['consumer_secret'])
auth.set_access_token(
key=keys.get('token', keys.get('key', keys.get('oauth_token'))),
secret=keys.get('secret', keys.get('oauth_secret'))
)
return auth
|
module function_definition identifier parameters dictionary_splat_pattern identifier block expression_statement assignment identifier call attribute identifier identifier argument_list keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list keyword_argument identifier call attribute identifier identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier call attribute identifier identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end return_statement identifier
|
Set up Tweepy authentication using passed args or config file settings.
|
def list_slack():
try:
token = os.environ['SLACK_TOKEN']
slack = Slacker(token)
response = slack.channels.list()
channels = response.body['channels']
for channel in channels:
print(channel['id'], channel['name'])
print()
response = slack.users.list()
users = response.body['members']
for user in users:
if not user['deleted']:
print(user['id'], user['name'], user['is_admin'], user[
'is_owner'])
print()
except KeyError as ex:
print('Environment variable %s not set.' % str(ex))
|
module function_definition identifier parameters block try_statement block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end for_statement identifier identifier block expression_statement call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end expression_statement call identifier argument_list expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end for_statement identifier identifier block if_statement not_operator subscript identifier string string_start string_content string_end block expression_statement call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end expression_statement call identifier argument_list except_clause as_pattern identifier as_pattern_target identifier block expression_statement call identifier argument_list binary_operator string string_start string_content string_end call identifier argument_list identifier
|
List channels & users in slack.
|
def deprecated(function, instead):
if not isinstance(function, types.FunctionType):
return function
@wraps(function)
def wrap(*args, **kwargs):
warnings.warn("Deprecated, use %s instead" % instead,
PyGIDeprecationWarning)
return function(*args, **kwargs)
return wrap
|
module function_definition identifier parameters identifier identifier block if_statement not_operator call identifier argument_list identifier attribute identifier identifier block return_statement identifier decorated_definition decorator call identifier argument_list identifier function_definition identifier parameters list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end identifier identifier return_statement call identifier argument_list list_splat identifier dictionary_splat identifier return_statement identifier
|
Mark a function deprecated so calling it issues a warning
|
def estimateabundance(self):
logging.info('Estimating abundance of taxonomic groups')
for i in range(self.cpus):
threads = Thread(target=self.estimate, args=())
threads.setDaemon(True)
threads.start()
with progressbar(self.runmetadata.samples) as bar:
for sample in bar:
try:
if sample.general.combined != 'NA':
sample.general.abundance = sample.general.combined.split('.')[0] + '_abundance.csv'
if not sample.commands.datastore:
sample.commands = GenObject()
sample.commands.target = self.targetcall
sample.commands.classify = self.classifycall
sample.commands.abundancecall = \
'cd {} && ./estimate_abundance.sh -D {} -F {} > {}'.format(self.clarkpath,
self.databasepath,
sample.general.classification,
sample.general.abundance)
self.abundancequeue.put(sample)
except KeyError:
pass
self.abundancequeue.join()
|
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end for_statement identifier call identifier argument_list attribute identifier identifier block expression_statement assignment identifier call identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier tuple expression_statement call attribute identifier identifier argument_list true expression_statement call attribute identifier identifier argument_list with_statement with_clause with_item as_pattern call identifier argument_list attribute attribute identifier identifier identifier as_pattern_target identifier block for_statement identifier identifier block try_statement block if_statement comparison_operator attribute attribute identifier identifier identifier string string_start string_content string_end block expression_statement assignment attribute attribute identifier identifier identifier binary_operator subscript call attribute attribute attribute identifier identifier identifier identifier argument_list string string_start string_content string_end integer string string_start string_content string_end if_statement not_operator attribute attribute identifier identifier identifier block expression_statement assignment attribute identifier identifier call identifier argument_list expression_statement assignment attribute attribute identifier identifier identifier attribute identifier identifier expression_statement assignment attribute attribute identifier identifier identifier attribute identifier identifier expression_statement assignment attribute attribute identifier identifier identifier call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier attribute identifier identifier attribute attribute identifier identifier identifier attribute attribute identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier except_clause identifier block pass_statement expression_statement call attribute attribute identifier identifier identifier argument_list
|
Estimate the abundance of taxonomic groups
|
def slicenet_params1_noam():
hparams = slicenet_params1()
hparams.learning_rate_decay_scheme = "noam"
hparams.learning_rate = 1.0
hparams.learning_rate_warmup_steps = 4000
hparams.initializer = "uniform_unit_scaling"
hparams.optimizer_adam_epsilon = 1e-9
hparams.optimizer_adam_beta1 = 0.9
hparams.optimizer_adam_beta2 = 0.98
return hparams
|
module function_definition identifier parameters block expression_statement assignment identifier call identifier argument_list expression_statement assignment attribute identifier identifier string string_start string_content string_end expression_statement assignment attribute identifier identifier float expression_statement assignment attribute identifier identifier integer expression_statement assignment attribute identifier identifier string string_start string_content string_end expression_statement assignment attribute identifier identifier float expression_statement assignment attribute identifier identifier float expression_statement assignment attribute identifier identifier float return_statement identifier
|
Version with Noam's decay scheme.
|
def _decode(value):
if value.isdigit():
return int(value)
if isinstance(value, bytes):
return value.decode('utf-8')
else:
return value
|
module function_definition identifier parameters identifier block if_statement call attribute identifier identifier argument_list block return_statement call identifier argument_list identifier if_statement call identifier argument_list identifier identifier block return_statement call attribute identifier identifier argument_list string string_start string_content string_end else_clause block return_statement identifier
|
decode byte strings and convert to int where needed
|
def rec(self):
try:
self._snapshot()
except Exception as e:
self.log("Timer error: ", e, type(e), lvl=error)
|
module function_definition identifier parameters identifier block try_statement block expression_statement call attribute identifier identifier argument_list except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier call identifier argument_list identifier keyword_argument identifier identifier
|
Records a single snapshot
|
def display_variogram_model(self):
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(self.lags, self.semivariance, 'r*')
ax.plot(self.lags,
self.variogram_function(self.variogram_model_parameters,
self.lags), 'k-')
plt.show()
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list integer expression_statement call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list
|
Displays variogram model with the actual binned data.
|
def _rlfunc(rl,lz,pot):
thisvcirc= vcirc(pot,rl,use_physical=False)
return rl*thisvcirc-lz
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call identifier argument_list identifier identifier keyword_argument identifier false return_statement binary_operator binary_operator identifier identifier identifier
|
Function that gives rvc-lz
|
def image_channel_embeddings_bottom(x, model_hparams, vocab_size):
del vocab_size
inputs = tf.to_int32(x)
io_depth = model_hparams.num_channels
tshape = common_layers.shape_list(inputs)
hidden_size = model_hparams.hidden_size
target_embeddings = cia.get_channel_embeddings(
io_depth, inputs, hidden_size, "input_bottom")
return tf.reshape(target_embeddings,
[tshape[0], tshape[1], tshape[2] * io_depth, hidden_size])
|
module function_definition identifier parameters identifier identifier identifier block delete_statement identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier identifier string string_start string_content string_end return_statement call attribute identifier identifier argument_list identifier list subscript identifier integer subscript identifier integer binary_operator subscript identifier integer identifier identifier
|
Bottom transformation for image targets.
|
def update_value(self, key, value):
if key == "Status":
self._inhibited = value != "Enabled"
elif key == "Color temperature":
self._temperature = int(value.rstrip("K"), 10)
elif key == "Period":
self._period = value
elif key == "Brightness":
self._brightness = value
elif key == "Location":
location = []
for x in value.split(", "):
v, d = x.split(" ")
location.append(float(v) * (1 if d in "NE" else -1))
self._location = (location)
|
module function_definition identifier parameters identifier identifier identifier block if_statement comparison_operator identifier string string_start string_content string_end block expression_statement assignment attribute identifier identifier comparison_operator identifier string string_start string_content string_end elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement assignment attribute identifier identifier call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end integer elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement assignment attribute identifier identifier identifier elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement assignment attribute identifier identifier identifier elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier list for_statement identifier call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list binary_operator call identifier argument_list identifier parenthesized_expression conditional_expression integer comparison_operator identifier string string_start string_content string_end unary_operator integer expression_statement assignment attribute identifier identifier parenthesized_expression identifier
|
Parse key value pairs to update their values
|
def register_lsp_server_settings(self, settings, language):
self.lsp_editor_settings[language] = settings
logger.debug('LSP server settings for {!s} are: {!r}'.format(
language, settings))
self.lsp_server_ready(language, self.lsp_editor_settings[language])
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment subscript attribute identifier identifier identifier identifier expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list identifier subscript attribute identifier identifier identifier
|
Register LSP server settings.
|
def parse_children(parent):
components = []
for tag in parent.children:
matched = parse_tag(tag)
if matched:
components.append(matched)
elif hasattr(tag, 'contents'):
components += parse_children(tag)
return components
|
module function_definition identifier parameters identifier block expression_statement assignment identifier list for_statement identifier attribute identifier identifier block expression_statement assignment identifier call identifier argument_list identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier elif_clause call identifier argument_list identifier string string_start string_content string_end block expression_statement augmented_assignment identifier call identifier argument_list identifier return_statement identifier
|
Recursively parse child tags until match is found
|
def _per_file_event_handler(self):
file_event_handler = PatternMatchingEventHandler()
file_event_handler.on_created = self._on_file_created
file_event_handler.on_modified = self._on_file_modified
file_event_handler.on_moved = self._on_file_moved
file_event_handler._patterns = [
os.path.join(self._watch_dir, os.path.normpath('*'))]
file_event_handler._ignore_patterns = [
'*/.*',
'*.tmp',
os.path.join(self._run.dir, OUTPUT_FNAME)
]
for glob in self._api.settings("ignore_globs"):
file_event_handler._ignore_patterns.append(
os.path.join(self._run.dir, glob))
return file_event_handler
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier list call attribute attribute identifier identifier identifier argument_list attribute identifier identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end expression_statement assignment attribute identifier identifier list string string_start string_content string_end string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list attribute attribute identifier identifier identifier identifier for_statement identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end block expression_statement call attribute attribute identifier identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list attribute attribute identifier identifier identifier identifier return_statement identifier
|
Create a Watchdog file event handler that does different things for every file
|
def _convert_exception(e):
args = ('exception in ldap backend: {0}'.format(repr(e)), e)
if six.PY2:
six.reraise(LDAPError, args, sys.exc_info()[2])
else:
six.raise_from(LDAPError(*args), e)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier tuple call attribute string string_start string_content string_end identifier argument_list call identifier argument_list identifier identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list identifier identifier subscript call attribute identifier identifier argument_list integer else_clause block expression_statement call attribute identifier identifier argument_list call identifier argument_list list_splat identifier identifier
|
Convert an ldap backend exception to an LDAPError and raise it.
|
def instantiate_tasks(self):
self.tasks_instances = {}
for task_name, task_class in self.tasks_classes.items():
try:
self.tasks_instances[task_name] = task_class()
except Exception as ex:
if not self.configuration[Configuration.ALGORITHM][Configuration.IOSF]:
raise GOSTaskException("An exception happened during the task instantiation."
"{exception}".format(exception=ex))
|
module function_definition identifier parameters identifier block expression_statement assignment attribute identifier identifier dictionary for_statement pattern_list identifier identifier call attribute attribute identifier identifier identifier argument_list block try_statement block expression_statement assignment subscript attribute identifier identifier identifier call identifier argument_list except_clause as_pattern identifier as_pattern_target identifier block if_statement not_operator subscript subscript attribute identifier identifier attribute identifier identifier attribute identifier identifier block raise_statement call identifier argument_list call attribute concatenated_string string string_start string_content string_end string string_start string_content string_end identifier argument_list keyword_argument identifier identifier
|
All loaded tasks are initialized. Depending on configuration fails in such instantiations may be silent
|
def start(self):
self.is_collocated = bool(socket.gethostname() == self.config.slaveinput['cov_master_host'] and
self.topdir == self.config.slaveinput['cov_master_topdir'])
if not self.is_collocated:
master_topdir = self.config.slaveinput['cov_master_topdir']
slave_topdir = self.topdir
self.cov_source = [source.replace(master_topdir, slave_topdir) for source in self.cov_source]
self.cov_data_file = self.cov_data_file.replace(master_topdir, slave_topdir)
self.cov_config = self.cov_config.replace(master_topdir, slave_topdir)
self.cov_data_file += '.%s' % self.nodeid
self.cov = coverage.coverage(source=self.cov_source,
data_file=self.cov_data_file,
config_file=self.cov_config)
self.cov.erase()
self.cov.start()
self.set_env()
|
module function_definition identifier parameters identifier block expression_statement assignment attribute identifier identifier call identifier argument_list boolean_operator comparison_operator call attribute identifier identifier argument_list subscript attribute attribute identifier identifier identifier string string_start string_content string_end comparison_operator attribute identifier identifier subscript attribute attribute identifier identifier identifier string string_start string_content string_end if_statement not_operator attribute identifier identifier block expression_statement assignment identifier subscript attribute attribute identifier identifier identifier string string_start string_content string_end expression_statement assignment identifier attribute identifier identifier expression_statement assignment attribute identifier identifier list_comprehension call attribute identifier identifier argument_list identifier identifier for_in_clause identifier attribute identifier identifier expression_statement assignment attribute identifier identifier call attribute attribute identifier identifier identifier argument_list identifier identifier expression_statement assignment attribute identifier identifier call attribute attribute identifier identifier identifier argument_list identifier identifier expression_statement augmented_assignment attribute identifier identifier binary_operator string string_start string_content string_end attribute identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
|
Determine what data file and suffix to contribute to and start coverage.
|
def add_parameter(self, param_name, description=None, default=0, unit=None):
if description is None:
description = "Parameter called {}".format(param_name)
if unit is None:
unit = "-"
name_check = lambda x: x['name'] == param_name
name_check_list = list(filter(name_check, self.ext_params))
if len(name_check_list) == 0:
self.ext_params.append({'name': param_name, 'description': description, 'default': default, 'unit': unit})
else:
print('{} already exists - choose a different name'.format(param_name))
|
module function_definition identifier parameters identifier identifier default_parameter identifier none default_parameter identifier integer default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement assignment identifier string string_start string_content string_end expression_statement assignment identifier lambda lambda_parameters identifier comparison_operator subscript identifier string string_start string_content string_end identifier expression_statement assignment identifier call identifier argument_list call identifier argument_list identifier attribute identifier identifier if_statement comparison_operator call identifier argument_list identifier integer block expression_statement call attribute attribute identifier identifier identifier argument_list dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier else_clause block expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier
|
Add a global parameter to the database that can be accessed by functions
|
def getThirdPartyLibIncludeDirs(self, libs):
platformDefaults = True
if libs[0] == '--nodefaults':
platformDefaults = False
libs = libs[1:]
details = self.getThirdpartyLibs(libs, includePlatformDefaults=platformDefaults)
return details.getIncludeDirectories(self.getEngineRoot(), delimiter='\n')
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier true if_statement comparison_operator subscript identifier integer string string_start string_content string_end block expression_statement assignment identifier false expression_statement assignment identifier subscript identifier slice integer expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier identifier return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list keyword_argument identifier string string_start string_content escape_sequence string_end
|
Retrieves the list of include directories for building against the Unreal-bundled versions of the specified third-party libraries
|
def build_option_parser(parser):
parser.add_argument(
"--os-data-processing-api-version",
metavar="<data-processing-api-version>",
default=utils.env(
'OS_DATA_PROCESSING_API_VERSION',
default=DEFAULT_DATA_PROCESSING_API_VERSION),
help=("Data processing API version, default=" +
DEFAULT_DATA_PROCESSING_API_VERSION +
' (Env: OS_DATA_PROCESSING_API_VERSION)'))
parser.add_argument(
"--os-data-processing-url",
default=utils.env(
"OS_DATA_PROCESSING_URL"),
help=("Data processing API URL, "
"(Env: OS_DATA_PROCESSING_API_URL)"))
return parser
|
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier string string_start string_content string_end keyword_argument identifier call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier parenthesized_expression binary_operator binary_operator string string_start string_content string_end identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier parenthesized_expression concatenated_string string string_start string_content string_end string string_start string_content string_end return_statement identifier
|
Hook to add global options.
|
def load(obj, settings_module, identifier="py", silent=False, key=None):
mod, loaded_from = get_module(obj, settings_module, silent)
if mod and loaded_from:
obj.logger.debug("py_loader: {}".format(mod))
else:
obj.logger.debug(
"py_loader: %s (Ignoring, Not Found)", settings_module
)
return
for setting in dir(mod):
if setting.isupper():
if key is None or key == setting:
setting_value = getattr(mod, setting)
obj.logger.debug(
"py_loader: loading %s: %s (%s)",
setting,
"*****" if "secret" in settings_module else setting_value,
identifier,
)
obj.set(setting, setting_value, loader_identifier=identifier)
obj._loaded_files.append(mod.__file__)
|
module function_definition identifier parameters identifier identifier default_parameter identifier string string_start string_content string_end default_parameter identifier false default_parameter identifier none block expression_statement assignment pattern_list identifier identifier call identifier argument_list identifier identifier identifier if_statement boolean_operator identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier else_clause block expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end identifier return_statement for_statement identifier call identifier argument_list identifier block if_statement call attribute identifier identifier argument_list block if_statement boolean_operator comparison_operator identifier none comparison_operator identifier identifier block expression_statement assignment identifier call identifier argument_list identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end identifier conditional_expression string string_start string_content string_end comparison_operator string string_start string_content string_end identifier identifier identifier expression_statement call attribute identifier identifier argument_list identifier identifier keyword_argument identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier
|
Tries to import a python module
|
def _pick_align_split_size(total_size, target_size, target_size_reads, max_splits):
if total_size // target_size > max_splits:
piece_size = total_size // max_splits
return int(piece_size * target_size_reads / target_size)
else:
return int(target_size_reads)
|
module function_definition identifier parameters identifier identifier identifier identifier block if_statement comparison_operator binary_operator identifier identifier identifier block expression_statement assignment identifier binary_operator identifier identifier return_statement call identifier argument_list binary_operator binary_operator identifier identifier identifier else_clause block return_statement call identifier argument_list identifier
|
Do the work of picking an alignment split size for the given criteria.
|
def _get_filekey(self):
if not os.path.exists(self.keyfile):
raise KPError('Keyfile not exists.')
try:
with open(self.keyfile, 'rb') as handler:
handler.seek(0, os.SEEK_END)
size = handler.tell()
handler.seek(0, os.SEEK_SET)
if size == 32:
return handler.read(32)
elif size == 64:
try:
return binascii.unhexlify(handler.read(64))
except (TypeError, binascii.Error):
handler.seek(0, os.SEEK_SET)
sha = SHA256.new()
while True:
buf = handler.read(2048)
sha.update(buf)
if len(buf) < 2048:
break
return sha.digest()
except IOError as e:
raise KPError('Could not read file: %s' % e)
|
module function_definition identifier parameters identifier block if_statement not_operator call attribute attribute identifier identifier identifier argument_list attribute identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end try_statement block with_statement with_clause with_item as_pattern call identifier argument_list attribute identifier identifier string string_start string_content string_end as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list integer attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list integer attribute identifier identifier if_statement comparison_operator identifier integer block return_statement call attribute identifier identifier argument_list integer elif_clause comparison_operator identifier integer block try_statement block return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list integer except_clause tuple identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list integer attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list while_statement true block expression_statement assignment identifier call attribute identifier identifier argument_list integer expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator call identifier argument_list identifier integer block break_statement return_statement call attribute identifier identifier argument_list except_clause as_pattern identifier as_pattern_target identifier block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier
|
This method creates a key from a keyfile.
|
def _gather_image_parts(self):
for rel in self.iter_rels():
if rel.is_external:
continue
if rel.reltype != RT.IMAGE:
continue
if rel.target_part in self.image_parts:
continue
self.image_parts.append(rel.target_part)
|
module function_definition identifier parameters identifier block for_statement identifier call attribute identifier identifier argument_list block if_statement attribute identifier identifier block continue_statement if_statement comparison_operator attribute identifier identifier attribute identifier identifier block continue_statement if_statement comparison_operator attribute identifier identifier attribute identifier identifier block continue_statement expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier
|
Load the image part collection with all the image parts in package.
|
def count_partitions(self, topic):
return sum(1 for p in topic.partitions if p in self.partitions)
|
module function_definition identifier parameters identifier identifier block return_statement call identifier generator_expression integer for_in_clause identifier attribute identifier identifier if_clause comparison_operator identifier attribute identifier identifier
|
Return count of partitions for given topic.
|
def update(self, branch='default'):
log.debug('Updating hg repo from hg_pillar module (pull)')
self.repo.pull()
log.debug('Updating hg repo from hg_pillar module (update)')
self.repo.update(branch, clean=True)
|
module function_definition identifier parameters identifier default_parameter identifier string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list identifier keyword_argument identifier true
|
Ensure we are using the latest revision in the hg repository
|
def change_tunnel_ad_url(self):
if self.is_open:
self.close()
req = requests.delete('https://api.psiturk.org/api/tunnel/',
auth=(self.access_key, self.secret_key))
if req.status_code in [401, 403, 500]:
print(req.content)
return False
|
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier tuple attribute identifier identifier attribute identifier identifier if_statement comparison_operator attribute identifier identifier list integer integer integer block expression_statement call identifier argument_list attribute identifier identifier return_statement false
|
Change tunnel ad url.
|
def _doc2vec_doc_stream(paths, n, tokenizer=word_tokenize, sentences=True):
i = 0
p = Progress()
for path in paths:
with open(path, 'r') as f:
for line in f:
i += 1
p.print_progress(i/n)
line = line.lower()
if sentences:
for sent in sent_tokenize(line):
tokens = tokenizer(sent)
yield LabeledSentence(tokens, ['SENT_{}'.format(i)])
else:
tokens = tokenizer(line)
yield LabeledSentence(tokens, ['SENT_{}'.format(i)])
|
module function_definition identifier parameters identifier identifier default_parameter identifier identifier default_parameter identifier true block expression_statement assignment identifier integer expression_statement assignment identifier call identifier argument_list for_statement identifier identifier block with_statement with_clause with_item as_pattern call identifier argument_list identifier string string_start string_content string_end as_pattern_target identifier block for_statement identifier identifier block expression_statement augmented_assignment identifier integer expression_statement call attribute identifier identifier argument_list binary_operator identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list if_statement identifier block for_statement identifier call identifier argument_list identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement yield call identifier argument_list identifier list call attribute string string_start string_content string_end identifier argument_list identifier else_clause block expression_statement assignment identifier call identifier argument_list identifier expression_statement yield call identifier argument_list identifier list call attribute string string_start string_content string_end identifier argument_list identifier
|
Generator to feed sentences to the dov2vec model.
|
def device_info(device):
status = subprocess.check_output([
'ibstat', device, '-s']).splitlines()
regexes = {
"CA type: (.*)": "device_type",
"Number of ports: (.*)": "num_ports",
"Firmware version: (.*)": "fw_ver",
"Hardware version: (.*)": "hw_ver",
"Node GUID: (.*)": "node_guid",
"System image GUID: (.*)": "sys_guid",
}
device = DeviceInfo()
for line in status:
for expression, key in regexes.items():
matches = re.search(expression, line)
if matches:
setattr(device, key, matches.group(1))
return device
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list list string string_start string_content string_end identifier string string_start string_content string_end identifier argument_list expression_statement assignment identifier dictionary pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier call identifier argument_list for_statement identifier identifier block for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier if_statement identifier block expression_statement call identifier argument_list identifier identifier call attribute identifier identifier argument_list integer return_statement identifier
|
Returns a DeviceInfo object with the current device settings
|
def _open(self, path, skip_to_end = True, offset = None):
fh = os.fdopen(os.open(path, os.O_RDONLY | os.O_NONBLOCK))
if offset is None:
if skip_to_end:
fh.seek(0, 2)
self._offset = fh.tell()
else:
self._offset = 0
else:
fh.seek(offset)
self._offset = fh.tell()
self._fh = fh
self._lastsize = fh.tell()
self._inode = os.stat(self._path).st_ino
|
module function_definition identifier parameters identifier identifier default_parameter identifier true default_parameter identifier none block expression_statement assignment identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier binary_operator attribute identifier identifier attribute identifier identifier if_statement comparison_operator identifier none block if_statement identifier block expression_statement call attribute identifier identifier argument_list integer integer expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list else_clause block expression_statement assignment attribute identifier identifier integer else_clause block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier attribute call attribute identifier identifier argument_list attribute identifier identifier identifier
|
Open `path`, optionally seeking to the end if `skip_to_end` is True.
|
def address(self, is_compressed=None):
return self._network.address.for_p2pkh(self.hash160(is_compressed=is_compressed))
|
module function_definition identifier parameters identifier default_parameter identifier none block return_statement call attribute attribute attribute identifier identifier identifier identifier argument_list call attribute identifier identifier argument_list keyword_argument identifier identifier
|
Return the public address representation of this key, if available.
|
def reset_defaults(self):
self.save_login.setChecked(False)
self.save_password.setChecked(False)
self.save_url.setChecked(False)
set_setting(GEONODE_USER, '')
set_setting(GEONODE_PASSWORD, '')
set_setting(GEONODE_URL, '')
self.login.setText('')
self.password.setText('')
self.url.setText('')
|
module function_definition identifier parameters identifier block expression_statement call attribute attribute identifier identifier identifier argument_list false expression_statement call attribute attribute identifier identifier identifier argument_list false expression_statement call attribute attribute identifier identifier identifier argument_list false expression_statement call identifier argument_list identifier string string_start string_end expression_statement call identifier argument_list identifier string string_start string_end expression_statement call identifier argument_list identifier string string_start string_end expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_end expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_end expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_end
|
Reset login and password in QgsSettings.
|
def base_url(self, space_id, content_type_id, environment_id=None, **kwargs):
return "spaces/{0}{1}/content_types/{2}/editor_interface".format(
space_id,
'/environments/{0}'.format(environment_id) if environment_id is not None else '',
content_type_id
)
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier none dictionary_splat_pattern identifier block return_statement call attribute string string_start string_content string_end identifier argument_list identifier conditional_expression call attribute string string_start string_content string_end identifier argument_list identifier comparison_operator identifier none string string_start string_end identifier
|
Returns the URI for the editor interface.
|
def _sample_batch_prioritized(self, segment_tree, batch_size, history, forward_steps=1):
p_total = segment_tree.total()
segment = p_total / batch_size
batch = [
self._get_sample_from_segment(segment_tree, segment, i, history, forward_steps)
for i in range(batch_size)
]
probs, idxs, tree_idxs = zip(*batch)
return np.array(probs), np.array(idxs), np.array(tree_idxs)
|
module function_definition identifier parameters identifier identifier identifier identifier default_parameter identifier integer block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier binary_operator identifier identifier expression_statement assignment identifier list_comprehension call attribute identifier identifier argument_list identifier identifier identifier identifier identifier for_in_clause identifier call identifier argument_list identifier expression_statement assignment pattern_list identifier identifier identifier call identifier argument_list list_splat identifier return_statement expression_list call attribute identifier identifier argument_list identifier call attribute identifier identifier argument_list identifier call attribute identifier identifier argument_list identifier
|
Return indexes of the next sample in from prioritized distribution
|
def step_use_curdir_as_working_directory(context):
context.workdir = os.path.abspath(".")
command_util.ensure_workdir_exists(context)
|
module function_definition identifier parameters identifier block expression_statement assignment attribute identifier identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier
|
Uses the current directory as working directory
|
def calc_std(c0, c1=[]):
if c1 == []:
return numpy.std(c0, 0)
prop = float(len(c0)) / float(len(c1))
if prop < 1:
p0 = int(math.ceil(1 / prop))
p1 = 1
else:
p0 = 1
p1 = int(math.ceil(prop))
return numpy.std(numpy.vstack(p0 * [c0] + p1 * [c1]), 0)
|
module function_definition identifier parameters identifier default_parameter identifier list block if_statement comparison_operator identifier list block return_statement call attribute identifier identifier argument_list identifier integer expression_statement assignment identifier binary_operator call identifier argument_list call identifier argument_list identifier call identifier argument_list call identifier argument_list identifier if_statement comparison_operator identifier integer block expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list binary_operator integer identifier expression_statement assignment identifier integer else_clause block expression_statement assignment identifier integer expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list identifier return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list binary_operator binary_operator identifier list identifier binary_operator identifier list identifier integer
|
Calculates the variance of the data.
|
def create_arguments(primary, pyfunction, call_node, scope):
args = list(call_node.args)
args.extend(call_node.keywords)
called = call_node.func
if _is_method_call(primary, pyfunction) and \
isinstance(called, ast.Attribute):
args.insert(0, called.value)
return Arguments(args, scope)
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment identifier call identifier argument_list attribute identifier identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier attribute identifier identifier if_statement boolean_operator call identifier argument_list identifier identifier line_continuation call identifier argument_list identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list integer attribute identifier identifier return_statement call identifier argument_list identifier identifier
|
A factory for creating `Arguments`
|
def register_token_network(
self,
token_registry_abi: Dict,
token_registry_address: str,
token_address: str,
channel_participant_deposit_limit: Optional[int],
token_network_deposit_limit: Optional[int],
):
with_limits = contracts_version_expects_deposit_limits(self.contracts_version)
if with_limits:
return self._register_token_network_with_limits(
token_registry_abi,
token_registry_address,
token_address,
channel_participant_deposit_limit,
token_network_deposit_limit,
)
else:
return self._register_token_network_without_limits(
token_registry_abi,
token_registry_address,
token_address,
channel_participant_deposit_limit,
token_network_deposit_limit,
)
|
module function_definition identifier parameters identifier typed_parameter identifier type identifier typed_parameter identifier type identifier typed_parameter identifier type identifier typed_parameter identifier type generic_type identifier type_parameter type identifier typed_parameter identifier type generic_type identifier type_parameter type identifier block expression_statement assignment identifier call identifier argument_list attribute identifier identifier if_statement identifier block return_statement call attribute identifier identifier argument_list identifier identifier identifier identifier identifier else_clause block return_statement call attribute identifier identifier argument_list identifier identifier identifier identifier identifier
|
Register token with a TokenNetworkRegistry contract.
|
def _write_values(kwargs, variables):
writeto = []
for var_name, value in kwargs.items():
var = variables[var_name]
var.notify_will_write()
var.write(value)
writeto.append(var)
return _notify_reader_writes(writeto)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block expression_statement assignment identifier subscript identifier identifier expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier return_statement call identifier argument_list identifier
|
Write values of kwargs and return thus-satisfied closures.
|
def touch(self, pathobj):
if not pathobj.drive or not pathobj.root:
raise RuntimeError('Full path required')
if pathobj.exists():
return
url = str(pathobj)
text, code = self.rest_put(url, session=pathobj.session, verify=pathobj.verify, cert=pathobj.cert)
if not code == 201:
raise RuntimeError("%s %d" % (text, code))
|
module function_definition identifier parameters identifier identifier block if_statement boolean_operator not_operator attribute identifier identifier not_operator attribute identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end if_statement call attribute identifier identifier argument_list block return_statement expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier if_statement not_operator comparison_operator identifier integer block raise_statement call identifier argument_list binary_operator string string_start string_content string_end tuple identifier identifier
|
Create an empty file
|
def to_data_frame(sc, features, labels, categorical=False):
lp_rdd = to_labeled_point(sc, features, labels, categorical)
sql_context = SQLContext(sc)
df = sql_context.createDataFrame(lp_rdd)
return df
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier false block expression_statement assignment identifier call identifier argument_list identifier identifier identifier identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement identifier
|
Convert numpy arrays of features and labels into Spark DataFrame
|
def v_type_base(ctx, stmt, no_error_report=False):
name = stmt.arg
stmt.i_identity = None
if name.find(":") == -1:
prefix = None
else:
[prefix, name] = name.split(':', 1)
if prefix is None or stmt.i_module.i_prefix == prefix:
pmodule = stmt.i_module
else:
pmodule = prefix_to_module(stmt.i_module, prefix, stmt.pos, ctx.errors)
if pmodule is None:
return
if name in pmodule.i_identities:
i = pmodule.i_identities[name]
if prefix is None and not is_submodule_included(stmt, i):
pass
else:
stmt.i_identity = i
v_type_identity(ctx, stmt.i_identity)
if stmt.i_identity is None and no_error_report == False:
err_add(ctx.errors, stmt.pos,
'IDENTITY_NOT_FOUND', (name, pmodule.arg))
|
module function_definition identifier parameters identifier identifier default_parameter identifier false block expression_statement assignment identifier attribute identifier identifier expression_statement assignment attribute identifier identifier none if_statement comparison_operator call attribute identifier identifier argument_list string string_start string_content string_end unary_operator integer block expression_statement assignment identifier none else_clause block expression_statement assignment list_pattern identifier identifier call attribute identifier identifier argument_list string string_start string_content string_end integer if_statement boolean_operator comparison_operator identifier none comparison_operator attribute attribute identifier identifier identifier identifier block expression_statement assignment identifier attribute identifier identifier else_clause block expression_statement assignment identifier call identifier argument_list attribute identifier identifier identifier attribute identifier identifier attribute identifier identifier if_statement comparison_operator identifier none block return_statement if_statement comparison_operator identifier attribute identifier identifier block expression_statement assignment identifier subscript attribute identifier identifier identifier if_statement boolean_operator comparison_operator identifier none not_operator call identifier argument_list identifier identifier block pass_statement else_clause block expression_statement assignment attribute identifier identifier identifier expression_statement call identifier argument_list identifier attribute identifier identifier if_statement boolean_operator comparison_operator attribute identifier identifier none comparison_operator identifier false block expression_statement call identifier argument_list attribute identifier identifier attribute identifier identifier string string_start string_content string_end tuple identifier attribute identifier identifier
|
verify that the referenced identity exists.
|
def repo_tools(self, branch):
tools = []
m_helper = Tools()
repo = self.parentApp.repo_value['repo']
version = self.parentApp.repo_value['versions'][branch]
status = m_helper.repo_tools(repo, branch, version)
if status[0]:
r_tools = status[1]
for tool in r_tools:
tools.append(tool[0])
return tools
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier subscript attribute attribute identifier identifier identifier string string_start string_content string_end expression_statement assignment identifier subscript subscript attribute attribute identifier identifier identifier string string_start string_content string_end identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier identifier if_statement subscript identifier integer block expression_statement assignment identifier subscript identifier integer for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list subscript identifier integer return_statement identifier
|
Set the appropriate repo dir and get the tools available of it
|
def RGBA(self, val):
val = np.atleast_1d(val).astype(np.float32) / 255
self.rgba = val
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier binary_operator call attribute call attribute identifier identifier argument_list identifier identifier argument_list attribute identifier identifier integer expression_statement assignment attribute identifier identifier identifier
|
Set the color using an Nx4 array of RGBA uint8 values
|
def smooth_rectangle(x, y, rec_w, rec_h, gaussian_width_x, gaussian_width_y):
gaussian_x_coord = abs(x)-rec_w/2.0
gaussian_y_coord = abs(y)-rec_h/2.0
box_x=np.less(gaussian_x_coord,0.0)
box_y=np.less(gaussian_y_coord,0.0)
sigmasq_x=gaussian_width_x*gaussian_width_x
sigmasq_y=gaussian_width_y*gaussian_width_y
with float_error_ignore():
falloff_x=x*0.0 if sigmasq_x==0.0 else \
np.exp(np.divide(-gaussian_x_coord*gaussian_x_coord,2*sigmasq_x))
falloff_y=y*0.0 if sigmasq_y==0.0 else \
np.exp(np.divide(-gaussian_y_coord*gaussian_y_coord,2*sigmasq_y))
return np.minimum(np.maximum(box_x,falloff_x), np.maximum(box_y,falloff_y))
|
module function_definition identifier parameters identifier identifier identifier identifier identifier identifier block expression_statement assignment identifier binary_operator call identifier argument_list identifier binary_operator identifier float expression_statement assignment identifier binary_operator call identifier argument_list identifier binary_operator identifier float expression_statement assignment identifier call attribute identifier identifier argument_list identifier float expression_statement assignment identifier call attribute identifier identifier argument_list identifier float expression_statement assignment identifier binary_operator identifier identifier expression_statement assignment identifier binary_operator identifier identifier with_statement with_clause with_item call identifier argument_list block expression_statement assignment identifier conditional_expression binary_operator identifier float comparison_operator identifier float line_continuation call attribute identifier identifier argument_list call attribute identifier identifier argument_list binary_operator unary_operator identifier identifier binary_operator integer identifier expression_statement assignment identifier conditional_expression binary_operator identifier float comparison_operator identifier float line_continuation call attribute identifier identifier argument_list call attribute identifier identifier argument_list binary_operator unary_operator identifier identifier binary_operator integer identifier return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier identifier call attribute identifier identifier argument_list identifier identifier
|
Rectangle with a solid central region, then Gaussian fall-off at the edges.
|
def help_text(self):
result = []
for name in sorted(self._declarations.keys()):
result.append(name)
result.append('-' * len(name))
decl = self._declarations[name]
if decl.description:
result.append(decl.description.strip())
else:
result.append('(no description found)')
if decl.has_default:
result.append('')
quotes = '"' if type(decl.default_value) is str else ''
result.append(' default_value={quotes}{val}{quotes}'.format(
quotes=quotes, val=decl.default_value))
result.append('')
result.append('')
return '\n'.join(result)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier list for_statement identifier call identifier argument_list call attribute attribute identifier identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end call identifier argument_list identifier expression_statement assignment identifier subscript attribute identifier identifier identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list else_clause block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_end expression_statement assignment identifier conditional_expression string string_start string_content string_end comparison_operator call identifier argument_list attribute identifier identifier identifier string string_start string_end expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_end expression_statement call attribute identifier identifier argument_list string string_start string_end return_statement call attribute string string_start string_content escape_sequence string_end identifier argument_list identifier
|
Return a string with all config keys and their descriptions.
|
def read_json_breakdown(cls, fname):
if not os.path.exists(fname):
raise RuntimeError
with open(fname, 'r') as data_file:
return cls.fixup_from_json(data_file.read())
|
module function_definition identifier parameters identifier identifier block if_statement not_operator call attribute attribute identifier identifier identifier argument_list identifier block raise_statement identifier with_statement with_clause with_item as_pattern call identifier argument_list identifier string string_start string_content string_end as_pattern_target identifier block return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list
|
Read json file to get fixture data
|
def url(self, name):
scheme = 'http'
path = self._prepend_name_prefix(name)
query = ''
fragment = ''
url_tuple = (scheme, self.netloc, path, query, fragment)
return urllib.parse.urlunsplit(url_tuple)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier string string_start string_end expression_statement assignment identifier string string_start string_end expression_statement assignment identifier tuple identifier attribute identifier identifier identifier identifier identifier return_statement call attribute attribute identifier identifier identifier argument_list identifier
|
Return URL of resource
|
def default_working_dir():
import nameset.virtualchain_hooks as virtualchain_hooks
return os.path.expanduser('~/.{}'.format(virtualchain_hooks.get_virtual_chain_name()))
|
module function_definition identifier parameters block import_statement aliased_import dotted_name identifier identifier identifier return_statement call attribute attribute identifier identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list call attribute identifier identifier argument_list
|
Get the default configuration directory for blockstackd
|
def _update_capacity(self, data):
if 'ConsumedCapacity' in data:
consumed = data['ConsumedCapacity']
if not isinstance(consumed, list):
consumed = [consumed]
for cap in consumed:
self.capacity += cap.get('CapacityUnits', 0)
self.table_capacity += cap.get('Table',
{}).get('CapacityUnits', 0)
local_indexes = cap.get('LocalSecondaryIndexes', {})
for k, v in six.iteritems(local_indexes):
self.indexes.setdefault(k, 0)
self.indexes[k] += v['CapacityUnits']
global_indexes = cap.get('GlobalSecondaryIndexes', {})
for k, v in six.iteritems(global_indexes):
self.global_indexes.setdefault(k, 0)
self.global_indexes[k] += v['CapacityUnits']
|
module function_definition identifier parameters identifier identifier block if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment identifier subscript identifier string string_start string_content string_end if_statement not_operator call identifier argument_list identifier identifier block expression_statement assignment identifier list identifier for_statement identifier identifier block expression_statement augmented_assignment attribute identifier identifier call attribute identifier identifier argument_list string string_start string_content string_end integer expression_statement augmented_assignment attribute identifier identifier call attribute call attribute identifier identifier argument_list string string_start string_content string_end dictionary identifier argument_list string string_start string_content string_end integer expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end dictionary for_statement pattern_list identifier identifier call attribute identifier identifier argument_list identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier integer expression_statement augmented_assignment subscript attribute identifier identifier identifier subscript identifier string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end dictionary for_statement pattern_list identifier identifier call attribute identifier identifier argument_list identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier integer expression_statement augmented_assignment subscript attribute identifier identifier identifier subscript identifier string string_start string_content string_end
|
Update the consumed capacity metrics
|
def append_sample(self, v, vartype, _left=False):
vstr = str(v).rjust(2)
length = len(vstr)
if vartype is dimod.SPIN:
def f(datum):
return _spinstr(datum.sample[v], rjust=length)
else:
def f(datum):
return _binarystr(datum.sample[v], rjust=length)
self.append(vstr, f, _left=_left)
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier false block expression_statement assignment identifier call attribute call identifier argument_list identifier identifier argument_list integer expression_statement assignment identifier call identifier argument_list identifier if_statement comparison_operator identifier attribute identifier identifier block function_definition identifier parameters identifier block return_statement call identifier argument_list subscript attribute identifier identifier identifier keyword_argument identifier identifier else_clause block function_definition identifier parameters identifier block return_statement call identifier argument_list subscript attribute identifier identifier identifier keyword_argument identifier identifier expression_statement call attribute identifier identifier argument_list identifier identifier keyword_argument identifier identifier
|
Add a sample column
|
def _sub_nat(self):
result = np.zeros(len(self), dtype=np.int64)
result.fill(iNaT)
return result.view('timedelta64[ns]')
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list call identifier argument_list identifier keyword_argument identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier return_statement call attribute identifier identifier argument_list string string_start string_content string_end
|
Subtract pd.NaT from self
|
def _convert_dns_answer(cls, answer: dns.resolver.Answer) \
-> Iterable[AddressInfo]:
assert answer.rdtype in (dns.rdatatype.A, dns.rdatatype.AAAA)
if answer.rdtype == dns.rdatatype.A:
family = socket.AF_INET
else:
family = socket.AF_INET6
for record in answer:
ip_address = record.to_text()
if family == socket.AF_INET6:
flow_info, control_id = cls._get_ipv6_info(ip_address)
else:
flow_info = control_id = None
yield AddressInfo(ip_address, family, flow_info, control_id)
|
module function_definition identifier parameters identifier typed_parameter identifier type attribute attribute identifier identifier identifier line_continuation type generic_type identifier type_parameter type identifier block assert_statement comparison_operator attribute identifier identifier tuple attribute attribute identifier identifier identifier attribute attribute identifier identifier identifier if_statement comparison_operator attribute identifier identifier attribute attribute identifier identifier identifier block expression_statement assignment identifier attribute identifier identifier else_clause block expression_statement assignment identifier attribute identifier identifier for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list if_statement comparison_operator identifier attribute identifier identifier block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier else_clause block expression_statement assignment identifier assignment identifier none expression_statement yield call identifier argument_list identifier identifier identifier identifier
|
Convert the DNS answer to address info.
|
def copy_id(self):
stdout, stderr, retcode = self._run_cmd(self._copy_id_str_old())
if salt.defaults.exitcodes.EX_OK != retcode and 'Usage' in stderr:
stdout, stderr, retcode = self._run_cmd(self._copy_id_str_new())
return stdout, stderr, retcode
|
module function_definition identifier parameters identifier block expression_statement assignment pattern_list identifier identifier identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list if_statement boolean_operator comparison_operator attribute attribute attribute identifier identifier identifier identifier identifier comparison_operator string string_start string_content string_end identifier block expression_statement assignment pattern_list identifier identifier identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list return_statement expression_list identifier identifier identifier
|
Execute ssh-copy-id to plant the id file on the target
|
def store_from(self, last_level_store):
assert isinstance(last_level_store, Cache), \
"last_level needs to be a Cache object."
assert last_level_store.store_to is None, \
"last_level_store must be a last level cache (.store_to is None)."
self.last_level_store = last_level_store
|
module function_definition identifier parameters identifier identifier block assert_statement call identifier argument_list identifier identifier string string_start string_content string_end assert_statement comparison_operator attribute identifier identifier none string string_start string_content string_end expression_statement assignment attribute identifier identifier identifier
|
Set level where to store to.
|
def make_path(phase) -> str:
return "{}/{}{}{}".format(conf.instance.output_path, phase.phase_path, phase.phase_name, phase.phase_tag)
|
module function_definition identifier parameters identifier type identifier block return_statement call attribute string string_start string_content string_end identifier argument_list attribute attribute identifier identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier
|
Create the path to the folder at which the metadata and optimizer pickle should be saved
|
def median(timeseries, segmentlength, **kwargs):
if scipy_version <= '1.1.9999':
raise ValueError(
"median average PSD estimation requires scipy >= 1.2.0",
)
kwargs.setdefault('average', 'median')
return welch(timeseries, segmentlength, **kwargs)
|
module function_definition identifier parameters identifier identifier dictionary_splat_pattern identifier block if_statement comparison_operator identifier string string_start string_content string_end block raise_statement call identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end return_statement call identifier argument_list identifier identifier dictionary_splat identifier
|
Calculate a PSD using Welch's method with a median average
|
def loadd(self, ava):
if "attributes" in ava:
for key, val in ava["attributes"].items():
self.attributes[key] = val
try:
self.tag = ava["tag"]
except KeyError:
if not self.tag:
raise KeyError("ExtensionElement must have a tag")
try:
self.namespace = ava["namespace"]
except KeyError:
if not self.namespace:
raise KeyError("ExtensionElement must belong to a namespace")
try:
self.text = ava["text"]
except KeyError:
pass
if "children" in ava:
for item in ava["children"]:
self.children.append(ExtensionElement(item["tag"]).loadd(item))
return self
|
module function_definition identifier parameters identifier identifier block if_statement comparison_operator string string_start string_content string_end identifier block for_statement pattern_list identifier identifier call attribute subscript identifier string string_start string_content string_end identifier argument_list block expression_statement assignment subscript attribute identifier identifier identifier identifier try_statement block expression_statement assignment attribute identifier identifier subscript identifier string string_start string_content string_end except_clause identifier block if_statement not_operator attribute identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end try_statement block expression_statement assignment attribute identifier identifier subscript identifier string string_start string_content string_end except_clause identifier block if_statement not_operator attribute identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end try_statement block expression_statement assignment attribute identifier identifier subscript identifier string string_start string_content string_end except_clause identifier block pass_statement if_statement comparison_operator string string_start string_content string_end identifier block for_statement identifier subscript identifier string string_start string_content string_end block expression_statement call attribute attribute identifier identifier identifier argument_list call attribute call identifier argument_list subscript identifier string string_start string_content string_end identifier argument_list identifier return_statement identifier
|
expects a special set of keys
|
def delete_account(self, data):
error = False
msg = ""
username = self.user_manager.session_username()
result = self.database.users.find_one_and_delete({"username": username,
"email": data.get("delete_email", "")})
if not result:
error = True
msg = _("The specified email is incorrect.")
else:
self.database.submissions.remove({"username": username})
self.database.user_tasks.remove({"username": username})
all_courses = self.course_factory.get_all_courses()
for courseid, course in all_courses.items():
if self.user_manager.course_is_open_to_user(course, username):
self.user_manager.course_unregister_user(course, username)
self.user_manager.disconnect_user()
raise web.seeother("/index")
return msg, error
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier false expression_statement assignment identifier string string_start string_end expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end if_statement not_operator identifier block expression_statement assignment identifier true expression_statement assignment identifier call identifier argument_list string string_start string_content string_end else_clause block expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list dictionary pair string string_start string_content string_end identifier expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list dictionary pair string string_start string_content string_end identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block if_statement call attribute attribute identifier identifier identifier argument_list identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list raise_statement call attribute identifier identifier argument_list string string_start string_content string_end return_statement expression_list identifier identifier
|
Delete account from DB
|
def majority(image, mask=None, iterations=1):
global majority_table
if mask is None:
masked_image = image
else:
masked_image = image.astype(bool).copy()
masked_image[~mask] = False
result = table_lookup(masked_image, majority_table, False, iterations)
if not mask is None:
result[~mask] = image[~mask]
return result
|
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier integer block global_statement identifier if_statement comparison_operator identifier none block expression_statement assignment identifier identifier else_clause block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list identifier identifier argument_list expression_statement assignment subscript identifier unary_operator identifier false expression_statement assignment identifier call identifier argument_list identifier identifier false identifier if_statement not_operator comparison_operator identifier none block expression_statement assignment subscript identifier unary_operator identifier subscript identifier unary_operator identifier return_statement identifier
|
A pixel takes the value of the majority of its neighbors
|
def _get_struct_shapewithstyle(self, shape_number):
obj = _make_object("ShapeWithStyle")
obj.FillStyles = self._get_struct_fillstylearray(shape_number)
obj.LineStyles = self._get_struct_linestylearray(shape_number)
bc = BitConsumer(self._src)
obj.NumFillBits = n_fill_bits = bc.u_get(4)
obj.NumlineBits = n_line_bits = bc.u_get(4)
obj.ShapeRecords = self._get_shaperecords(
n_fill_bits, n_line_bits, shape_number)
return obj
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list string string_start string_content string_end expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list attribute identifier identifier expression_statement assignment attribute identifier identifier assignment identifier call attribute identifier identifier argument_list integer expression_statement assignment attribute identifier identifier assignment identifier call attribute identifier identifier argument_list integer expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list identifier identifier identifier return_statement identifier
|
Get the values for the SHAPEWITHSTYLE record.
|
def _feature_returner(self, **kwargs):
kwargs.setdefault('dialect', self.dialect)
kwargs.setdefault('keep_order', self.keep_order)
kwargs.setdefault('sort_attribute_values', self.sort_attribute_values)
return Feature(**kwargs)
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier return_statement call identifier argument_list dictionary_splat identifier
|
Returns a feature, adding additional database-specific defaults
|
def projR(gamma, p):
return np.multiply(gamma.T, p / np.maximum(np.sum(gamma, axis=1), 1e-10)).T
|
module function_definition identifier parameters identifier identifier block return_statement attribute call attribute identifier identifier argument_list attribute identifier identifier binary_operator identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier keyword_argument identifier integer float identifier
|
return the KL projection on the row constrints
|
def _drop_indices(self):
self._logger.info('Dropping database indices')
self._conn.execute(constants.DROP_TEXTNGRAM_INDEX_SQL)
self._logger.info('Finished dropping database indices')
|
module function_definition identifier parameters identifier block expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end
|
Drops the database indices relating to n-grams.
|
def basic_map(proj):
fig = plt.figure(figsize=(15, 10))
add_metpy_logo(fig, 0, 80, size='large')
view = fig.add_axes([0, 0, 1, 1], projection=proj)
view.set_extent([-120, -70, 20, 50])
view.add_feature(cfeature.STATES.with_scale('50m'))
view.add_feature(cfeature.OCEAN)
view.add_feature(cfeature.COASTLINE)
view.add_feature(cfeature.BORDERS, linestyle=':')
return fig, view
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list keyword_argument identifier tuple integer integer expression_statement call identifier argument_list identifier integer integer keyword_argument identifier string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list list integer integer integer integer keyword_argument identifier identifier expression_statement call attribute identifier identifier argument_list list unary_operator integer unary_operator integer integer integer expression_statement call attribute identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier keyword_argument identifier string string_start string_content string_end return_statement expression_list identifier identifier
|
Make our basic default map for plotting
|
def register(self, scope, *args, **kwargs):
self._assert_not_frozen()
self.get_parser(scope).register(*args, **kwargs)
deprecated_scope = self.known_scope_to_info[scope].deprecated_scope
if deprecated_scope:
self.get_parser(deprecated_scope).register(*args, **kwargs)
|
module function_definition identifier parameters identifier identifier list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement call attribute identifier identifier argument_list expression_statement call attribute call attribute identifier identifier argument_list identifier identifier argument_list list_splat identifier dictionary_splat identifier expression_statement assignment identifier attribute subscript attribute identifier identifier identifier identifier if_statement identifier block expression_statement call attribute call attribute identifier identifier argument_list identifier identifier argument_list list_splat identifier dictionary_splat identifier
|
Register an option in the given scope.
|
def reset_weights(self):
if self.fk.isAPF:
lw = (rs.log_mean_exp(self.logetat, W=self.W)
- self.logetat[self.A])
self.wgts = rs.Weights(lw=lw)
else:
self.wgts = rs.Weights()
|
module function_definition identifier parameters identifier block if_statement attribute attribute identifier identifier identifier block expression_statement assignment identifier parenthesized_expression binary_operator call attribute identifier identifier argument_list attribute identifier identifier keyword_argument identifier attribute identifier identifier subscript attribute identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list keyword_argument identifier identifier else_clause block expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list
|
Reset weights after a resampling step.
|
async def status_by_state(self, state: str) -> dict:
data = await self.raw_cdc_data()
try:
info = next((v for k, v in data.items() if state in k))
except StopIteration:
return {}
return adjust_status(info)
|
module function_definition identifier parameters identifier typed_parameter identifier type identifier type identifier block expression_statement assignment identifier await call attribute identifier identifier argument_list try_statement block expression_statement assignment identifier call identifier argument_list generator_expression identifier for_in_clause pattern_list identifier identifier call attribute identifier identifier argument_list if_clause comparison_operator identifier identifier except_clause identifier block return_statement dictionary return_statement call identifier argument_list identifier
|
Return the CDC status for the specified state.
|
def ranges(self):
ranges = self._target.getRanges()
return map(SheetAddress._from_uno, ranges)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list return_statement call identifier argument_list attribute identifier identifier identifier
|
Returns a list of addresses with source data.
|
def _get_cells(self, left, right, vertical):
if vertical:
vcells = max(sum(self._shape(l)[0] for l in left),
self._shape(right)[0])
hcells = (max(self._shape(l)[1] for l in left) +
self._shape(right)[1])
else:
vcells = max([self._shape(l)[0] for l in left] +
[self._shape(right)[0]])
hcells = sum([self._shape(l)[1] for l in left] +
[self._shape(right)[1]])
return hcells, vcells
|
module function_definition identifier parameters identifier identifier identifier identifier block if_statement identifier block expression_statement assignment identifier call identifier argument_list call identifier generator_expression subscript call attribute identifier identifier argument_list identifier integer for_in_clause identifier identifier subscript call attribute identifier identifier argument_list identifier integer expression_statement assignment identifier parenthesized_expression binary_operator call identifier generator_expression subscript call attribute identifier identifier argument_list identifier integer for_in_clause identifier identifier subscript call attribute identifier identifier argument_list identifier integer else_clause block expression_statement assignment identifier call identifier argument_list binary_operator list_comprehension subscript call attribute identifier identifier argument_list identifier integer for_in_clause identifier identifier list subscript call attribute identifier identifier argument_list identifier integer expression_statement assignment identifier call identifier argument_list binary_operator list_comprehension subscript call attribute identifier identifier argument_list identifier integer for_in_clause identifier identifier list subscript call attribute identifier identifier argument_list identifier integer return_statement expression_list identifier identifier
|
Calculate appropriate figure size based on left and right data.
|
def getFixedStarList(IDs, date):
starList = [getFixedStar(ID, date) for ID in IDs]
return FixedStarList(starList)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list_comprehension call identifier argument_list identifier identifier for_in_clause identifier identifier return_statement call identifier argument_list identifier
|
Returns a list of fixed stars.
|
def returner(ret):
serv = _get_serv(ret)
json_return = salt.utils.json.dumps(ret['return'])
del ret['return']
json_full_ret = salt.utils.json.dumps(ret)
if "influxdb08" in serv.__module__:
req = [
{
'name': 'returns',
'columns': ['fun', 'id', 'jid', 'return', 'full_ret'],
'points': [
[ret['fun'], ret['id'], ret['jid'], json_return, json_full_ret]
],
}
]
else:
req = [
{
'measurement': 'returns',
'tags': {
'fun': ret['fun'],
'id': ret['id'],
'jid': ret['jid']
},
'fields': {
'return': json_return,
'full_ret': json_full_ret
}
}
]
try:
serv.write_points(req)
except Exception as ex:
log.critical('Failed to store return with InfluxDB returner: %s', ex)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list subscript identifier string string_start string_content string_end delete_statement subscript identifier string string_start string_content string_end expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list identifier if_statement comparison_operator string string_start string_content string_end attribute identifier identifier block expression_statement assignment identifier list dictionary pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end list list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end identifier identifier else_clause block expression_statement assignment identifier list dictionary pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end dictionary pair string string_start string_content string_end subscript identifier string string_start string_content string_end pair string string_start string_content string_end subscript identifier string string_start string_content string_end pair string string_start string_content string_end subscript identifier string string_start string_content string_end pair string string_start string_content string_end dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier try_statement block expression_statement call attribute identifier identifier argument_list identifier except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier
|
Return data to a influxdb data store
|
def _assemble_activeform(stmt):
subj_str = _assemble_agent_str(stmt.agent)
if stmt.is_active:
is_active_str = 'active'
else:
is_active_str = 'inactive'
if stmt.activity == 'activity':
stmt_str = subj_str + ' is ' + is_active_str
elif stmt.activity == 'kinase':
stmt_str = subj_str + ' is kinase-' + is_active_str
elif stmt.activity == 'phosphatase':
stmt_str = subj_str + ' is phosphatase-' + is_active_str
elif stmt.activity == 'catalytic':
stmt_str = subj_str + ' is catalytically ' + is_active_str
elif stmt.activity == 'transcription':
stmt_str = subj_str + ' is transcriptionally ' + is_active_str
elif stmt.activity == 'gtpbound':
stmt_str = subj_str + ' is GTP-bound ' + is_active_str
return _make_sentence(stmt_str)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list attribute identifier identifier if_statement attribute identifier identifier block expression_statement assignment identifier string string_start string_content string_end else_clause block expression_statement assignment identifier string string_start string_content string_end if_statement comparison_operator attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end identifier elif_clause comparison_operator attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end identifier elif_clause comparison_operator attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end identifier elif_clause comparison_operator attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end identifier elif_clause comparison_operator attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end identifier elif_clause comparison_operator attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end identifier return_statement call identifier argument_list identifier
|
Assemble ActiveForm statements into text.
|
def print_bytes(byte_str):
if isinstance(byte_str, str):
print(byte_str)
else:
print(str(byte_str, encoding='utf8'))
|
module function_definition identifier parameters identifier block if_statement call identifier argument_list identifier identifier block expression_statement call identifier argument_list identifier else_clause block expression_statement call identifier argument_list call identifier argument_list identifier keyword_argument identifier string string_start string_content string_end
|
Prints a string or converts bytes to a string and then prints.
|
def all_macro_systems(network, state, do_blackbox=False, do_coarse_grain=False,
time_scales=None):
if time_scales is None:
time_scales = [1]
def blackboxes(system):
if not do_blackbox:
return [None]
return all_blackboxes(system)
def coarse_grains(blackbox, system):
if not do_coarse_grain:
return [None]
if blackbox is None:
return all_coarse_grains(system)
return all_coarse_grains_for_blackbox(blackbox)
for system in utils.powerset(network.node_indices):
for time_scale in time_scales:
for blackbox in blackboxes(system):
for coarse_grain in coarse_grains(blackbox, system):
try:
yield MacroSubsystem(
network, state, system,
time_scale=time_scale,
blackbox=blackbox,
coarse_grain=coarse_grain)
except (StateUnreachableError,
ConditionallyDependentError):
continue
|
module function_definition identifier parameters identifier identifier default_parameter identifier false default_parameter identifier false default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement assignment identifier list integer function_definition identifier parameters identifier block if_statement not_operator identifier block return_statement list none return_statement call identifier argument_list identifier function_definition identifier parameters identifier identifier block if_statement not_operator identifier block return_statement list none if_statement comparison_operator identifier none block return_statement call identifier argument_list identifier return_statement call identifier argument_list identifier for_statement identifier call attribute identifier identifier argument_list attribute identifier identifier block for_statement identifier identifier block for_statement identifier call identifier argument_list identifier block for_statement identifier call identifier argument_list identifier identifier block try_statement block expression_statement yield call identifier argument_list identifier identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier except_clause tuple identifier identifier block continue_statement
|
Generator over all possible macro-systems for the network.
|
def pitch(self):
x, y, z, w = self.x, self.y, self.z, self.w
return math.atan2(2*x*w - 2*y*z, 1 - 2*x*x - 2*z*z)
|
module function_definition identifier parameters identifier block expression_statement assignment pattern_list identifier identifier identifier identifier expression_list attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier return_statement call attribute identifier identifier argument_list binary_operator binary_operator binary_operator integer identifier identifier binary_operator binary_operator integer identifier identifier binary_operator binary_operator integer binary_operator binary_operator integer identifier identifier binary_operator binary_operator integer identifier identifier
|
Calculates the Pitch of the Quaternion.
|
def entries_published(queryset):
now = timezone.now()
return queryset.filter(
models.Q(start_publication__lte=now) |
models.Q(start_publication=None),
models.Q(end_publication__gt=now) |
models.Q(end_publication=None),
status=PUBLISHED, sites=Site.objects.get_current())
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list return_statement call attribute identifier identifier argument_list binary_operator call attribute identifier identifier argument_list keyword_argument identifier identifier call attribute identifier identifier argument_list keyword_argument identifier none binary_operator call attribute identifier identifier argument_list keyword_argument identifier identifier call attribute identifier identifier argument_list keyword_argument identifier none keyword_argument identifier identifier keyword_argument identifier call attribute attribute identifier identifier identifier argument_list
|
Return only the entries published.
|
def dtype_repr(dtype):
dtype = np.dtype(dtype)
if dtype == np.dtype(int):
return "'int'"
elif dtype == np.dtype(float):
return "'float'"
elif dtype == np.dtype(complex):
return "'complex'"
elif dtype.shape:
return "('{}', {})".format(dtype.base, dtype.shape)
else:
return "'{}'".format(dtype)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier call attribute identifier identifier argument_list identifier block return_statement string string_start string_content string_end elif_clause comparison_operator identifier call attribute identifier identifier argument_list identifier block return_statement string string_start string_content string_end elif_clause comparison_operator identifier call attribute identifier identifier argument_list identifier block return_statement string string_start string_content string_end elif_clause attribute identifier identifier block return_statement call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier attribute identifier identifier else_clause block return_statement call attribute string string_start string_content string_end identifier argument_list identifier
|
Stringify ``dtype`` for ``repr`` with default for int and float.
|
def precision(precision, id_, hwid, type_):
if id_ and (hwid or type_):
raise click.BadOptionUsage(
"If --id is given --hwid and --type are not allowed."
)
if id_:
try:
sensor = W1ThermSensor.get_available_sensors()[id_ - 1]
except IndexError:
raise click.BadOptionUsage(
"No sensor with id {0} available. "
"Use the ls command to show all available sensors.".format(id_)
)
else:
sensor = W1ThermSensor(type_, hwid)
sensor.set_precision(precision, persist=True)
|
module function_definition identifier parameters identifier identifier identifier identifier block if_statement boolean_operator identifier parenthesized_expression boolean_operator identifier identifier block raise_statement call attribute identifier identifier argument_list string string_start string_content string_end if_statement identifier block try_statement block expression_statement assignment identifier subscript call attribute identifier identifier argument_list binary_operator identifier integer except_clause identifier block raise_statement call attribute identifier identifier argument_list call attribute concatenated_string string string_start string_content string_end string string_start string_content string_end identifier argument_list identifier else_clause block expression_statement assignment identifier call identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list identifier keyword_argument identifier true
|
Change the precision for the sensor and persist it in the sensor's EEPROM
|
def update(self):
if self.device_time_check():
if not self.in_process:
outlets, switches, fans = self.get_devices()
self.outlets = helpers.resolve_updates(self.outlets, outlets)
self.switches = helpers.resolve_updates(
self.switches, switches)
self.fans = helpers.resolve_updates(self.fans, fans)
self.last_update_ts = time.time()
|
module function_definition identifier parameters identifier block if_statement call attribute identifier identifier argument_list block if_statement not_operator attribute identifier identifier block expression_statement assignment pattern_list identifier identifier identifier call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list
|
Fetch updated information about devices
|
def fix_job_def(job_def):
if six.PY2 and isinstance(job_def.get('func'), six.text_type):
job_def['func'] = str(job_def.get('func'))
if isinstance(job_def.get('start_date'), six.string_types):
job_def['start_date'] = dateutil.parser.parse(job_def.get('start_date'))
if isinstance(job_def.get('end_date'), six.string_types):
job_def['end_date'] = dateutil.parser.parse(job_def.get('end_date'))
if isinstance(job_def.get('run_date'), six.string_types):
job_def['run_date'] = dateutil.parser.parse(job_def.get('run_date'))
if isinstance(job_def.get('trigger'), dict):
trigger = job_def.pop('trigger')
job_def['trigger'] = trigger.pop('type', 'date')
job_def.update(trigger)
|
module function_definition identifier parameters identifier block if_statement boolean_operator attribute identifier identifier call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier block expression_statement assignment subscript identifier string string_start string_content string_end call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end if_statement call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end if_statement call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end if_statement call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier block expression_statement assignment subscript identifier string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end if_statement call identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier
|
Replaces the datetime in string by datetime object.
|
def retry(self):
logger.info('Job {0} retrying all failed tasks'.format(self.name))
self.initialize_snapshot()
failed_task_names = []
for task_name, log in self.run_log['tasks'].items():
if log.get('success', True) == False:
failed_task_names.append(task_name)
if len(failed_task_names) == 0:
raise DagobahError('no failed tasks to retry')
self._set_status('running')
self.run_log['last_retry_time'] = datetime.utcnow()
logger.debug('Job {0} seeding run logs'.format(self.name))
for task_name in failed_task_names:
self._put_task_in_run_log(task_name)
self.tasks[task_name].start()
self._commit_run_log()
|
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier list for_statement pattern_list identifier identifier call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list block if_statement comparison_operator call attribute identifier identifier argument_list string string_start string_content string_end true false block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator call identifier argument_list identifier integer block raise_statement call identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment subscript attribute identifier identifier string string_start string_content string_end call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute subscript attribute identifier identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
|
Restarts failed tasks of a job.
|
def digest_auth(realm, auth_func):
def digest_auth_decorator(func):
def func_replacement(self, *args, **kwargs):
if self.get_authenticated_user(auth_func, realm):
return func(self, *args, **kwargs)
return func_replacement
return digest_auth_decorator
|
module function_definition identifier parameters identifier identifier block function_definition identifier parameters identifier block function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block if_statement call attribute identifier identifier argument_list identifier identifier block return_statement call identifier argument_list identifier list_splat identifier dictionary_splat identifier return_statement identifier return_statement identifier
|
A decorator used to protect methods with HTTP Digest authentication.
|
def from_json(s):
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return sbp
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement identifier
|
Given a JSON-encoded message, build an object.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.