code
stringlengths 51
2.34k
| sequence
stringlengths 186
3.94k
| docstring
stringlengths 11
171
|
|---|---|---|
def _get_object_as_soft(self):
soft = ["^%s = %s" % (self.geotype, self.name),
self._get_metadata_as_string(),
self._get_columns_as_string(),
self._get_table_as_string()]
return "\n".join(soft)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier list binary_operator string string_start string_content string_end tuple attribute identifier identifier attribute identifier identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list call attribute identifier identifier argument_list return_statement call attribute string string_start string_content escape_sequence string_end identifier argument_list identifier
|
Get the object as SOFT formated string.
|
def _sort_column(self, column, reverse):
if tk.DISABLED in self.state():
return
l = [(self.set(child, column), child) for child in self.get_children('')]
l.sort(reverse=reverse, key=lambda x: self._column_types[column](x[0]))
for index, (val, child) in enumerate(l):
self.move(child, "", index)
self.heading(column, command=lambda: self._sort_column(column, not reverse))
|
module function_definition identifier parameters identifier identifier identifier block if_statement comparison_operator attribute identifier identifier call attribute identifier identifier argument_list block return_statement expression_statement assignment identifier list_comprehension tuple call attribute identifier identifier argument_list identifier identifier identifier for_in_clause identifier call attribute identifier identifier argument_list string string_start string_end expression_statement call attribute identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier lambda lambda_parameters identifier call subscript attribute identifier identifier identifier argument_list subscript identifier integer for_statement pattern_list identifier tuple_pattern identifier identifier call identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier string string_start string_end identifier expression_statement call attribute identifier identifier argument_list identifier keyword_argument identifier lambda call attribute identifier identifier argument_list identifier not_operator identifier
|
Sort a column by its values
|
def read_hdf5_timeseries(h5f, path=None, start=None, end=None, **kwargs):
kwargs.setdefault('array_type', TimeSeries)
series = read_hdf5_array(h5f, path=path, **kwargs)
if start is not None or end is not None:
return series.crop(start, end)
return series
|
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none dictionary_splat_pattern identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier call identifier argument_list identifier keyword_argument identifier identifier dictionary_splat identifier if_statement boolean_operator comparison_operator identifier none comparison_operator identifier none block return_statement call attribute identifier identifier argument_list identifier identifier return_statement identifier
|
Read a `TimeSeries` from HDF5
|
def _fetchAllChildren(self):
bands = self._bands
if len(bands) != self._array.shape[-1]:
logger.warn("No bands added, bands != last_dim_lenght ({} !: {})"
.format(len(bands), self._array.shape[-1]))
return []
childItems = []
for bandNr, band in enumerate(bands):
bandItem = PillowBandRti(self._array[..., bandNr],
nodeName=band, fileName=self.fileName,
iconColor=self.iconColor, attributes=self._attributes)
childItems.append(bandItem)
return childItems
|
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier if_statement comparison_operator call identifier argument_list identifier subscript attribute attribute identifier identifier identifier unary_operator integer block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list call identifier argument_list identifier subscript attribute attribute identifier identifier identifier unary_operator integer return_statement list expression_statement assignment identifier list for_statement pattern_list identifier identifier call identifier argument_list identifier block expression_statement assignment identifier call identifier argument_list subscript attribute identifier identifier ellipsis identifier keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier return_statement identifier
|
Adds the bands as separate fields so they can be inspected easily.
|
def check_git_unchanged(filename, yes=False):
if check_staged(filename):
s = 'There are staged changes in {}, overwrite? [y/n] '.format(filename)
if yes or input(s) in ('y', 'yes'):
return
else:
raise RuntimeError('There are staged changes in '
'{}, aborting.'.format(filename))
if check_unstaged(filename):
s = 'There are unstaged changes in {}, overwrite? [y/n] '.format(filename)
if yes or input(s) in ('y', 'yes'):
return
else:
raise RuntimeError('There are unstaged changes in '
'{}, aborting.'.format(filename))
|
module function_definition identifier parameters identifier default_parameter identifier false block if_statement call identifier argument_list identifier block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier if_statement boolean_operator identifier comparison_operator call identifier argument_list identifier tuple string string_start string_content string_end string string_start string_content string_end block return_statement else_clause 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 identifier if_statement call identifier argument_list identifier block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier if_statement boolean_operator identifier comparison_operator call identifier argument_list identifier tuple string string_start string_content string_end string string_start string_content string_end block return_statement else_clause 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 identifier
|
Check git to avoid overwriting user changes.
|
def to_string(self, hdr, other):
result = "%s[%s,%s" % (
hdr, self.get_type(self.type), self.get_clazz(self.clazz))
if self.unique:
result += "-unique,"
else:
result += ","
result += self.name
if other is not None:
result += ",%s]" % (other)
else:
result += "]"
return result
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier binary_operator string string_start string_content string_end tuple identifier call attribute identifier identifier argument_list attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier if_statement attribute identifier identifier block expression_statement augmented_assignment identifier string string_start string_content string_end else_clause block expression_statement augmented_assignment identifier string string_start string_content string_end expression_statement augmented_assignment identifier attribute identifier identifier if_statement comparison_operator identifier none block expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end parenthesized_expression identifier else_clause block expression_statement augmented_assignment identifier string string_start string_content string_end return_statement identifier
|
String representation with additional information
|
def scroll_down (self):
s = self.scroll_row_start - 1
e = self.scroll_row_end - 1
self.w[s+1:e+1] = copy.deepcopy(self.w[s:e])
|
module function_definition identifier parameters identifier block expression_statement assignment identifier binary_operator attribute identifier identifier integer expression_statement assignment identifier binary_operator attribute identifier identifier integer expression_statement assignment subscript attribute identifier identifier slice binary_operator identifier integer binary_operator identifier integer call attribute identifier identifier argument_list subscript attribute identifier identifier slice identifier identifier
|
Scroll display down one line.
|
def _assert_keys_match(keys1, keys2):
if set(keys1) != set(keys2):
raise ValueError('{} {}'.format(list(keys1), list(keys2)))
|
module function_definition identifier parameters identifier identifier block if_statement comparison_operator call identifier argument_list identifier call identifier argument_list identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list call identifier argument_list identifier call identifier argument_list identifier
|
Ensure the two list of keys matches.
|
def new(self, filename=None):
path = (self.exec_path,)
if self.exec_path.filetype() in ('py', 'pyw', 'pyz', self.FTYPE):
p = find_executable("python")
path = (p, 'python') + path
else:
path += (self.exec_path,)
if filename:
path += ('-o', filename)
os.spawnl(os.P_NOWAIT, *path)
|
module function_definition identifier parameters identifier default_parameter identifier none block expression_statement assignment identifier tuple attribute identifier identifier if_statement comparison_operator call attribute attribute identifier identifier identifier argument_list tuple string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end attribute identifier identifier block expression_statement assignment identifier call identifier argument_list string string_start string_content string_end expression_statement assignment identifier binary_operator tuple identifier string string_start string_content string_end identifier else_clause block expression_statement augmented_assignment identifier tuple attribute identifier identifier if_statement identifier block expression_statement augmented_assignment identifier tuple string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier list_splat identifier
|
start a session an independent process
|
def _add_properties(self, **kwargs):
for k,v in kwargs.items():
if k=='parallax':
self.obs.add_parallax(v)
elif k in ['Teff', 'logg', 'feh', 'density']:
par = {k:v}
self.obs.add_spectroscopy(**par)
elif re.search('_', k):
m = re.search('^(\w+)_(\w+)$', k)
prop = m.group(1)
tag = m.group(2)
self.obs.add_spectroscopy(**{prop:v, 'label':'0_{}'.format(tag)})
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block if_statement comparison_operator identifier string string_start string_content string_end block expression_statement call attribute attribute identifier identifier identifier argument_list identifier elif_clause comparison_operator identifier 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 block expression_statement assignment identifier dictionary pair identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list dictionary_splat identifier elif_clause 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 identifier expression_statement assignment identifier call attribute identifier identifier argument_list integer expression_statement assignment identifier call attribute identifier identifier argument_list integer expression_statement call attribute attribute identifier identifier identifier argument_list dictionary_splat dictionary pair identifier identifier pair string string_start string_content string_end call attribute string string_start string_content string_end identifier argument_list identifier
|
Adds non-photometry properties to ObservationTree
|
def add_target_and_index(self, name, sig, signode):
targetname = '%s-%s' % (self.objtype, name)
if targetname not in self.state.document.ids:
signode['names'].append(targetname)
signode['ids'].append(targetname)
signode['first'] = (not self.names)
self.state.document.note_explicit_target(signode)
objects = self.env.domaindata['everett']['objects']
key = (self.objtype, name)
if key in objects:
self.state_machine.reporter.warning(
'duplicate description of %s %s, ' % (self.objtype, name) +
'other instance in ' + self.env.doc2path(objects[key]),
line=self.lineno
)
objects[key] = self.env.docname
indextext = _('%s (component)') % name
self.indexnode['entries'].append(('single', indextext, targetname, '', None))
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment identifier binary_operator string string_start string_content string_end tuple attribute identifier identifier identifier if_statement comparison_operator identifier attribute attribute attribute identifier identifier identifier identifier block expression_statement call attribute subscript identifier string string_start string_content string_end identifier argument_list identifier expression_statement call attribute subscript identifier string string_start string_content string_end identifier argument_list identifier expression_statement assignment subscript identifier string string_start string_content string_end parenthesized_expression not_operator attribute identifier identifier expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list identifier expression_statement assignment identifier subscript subscript attribute attribute identifier identifier identifier string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier tuple attribute identifier identifier identifier if_statement comparison_operator identifier identifier block expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list binary_operator binary_operator binary_operator string string_start string_content string_end tuple attribute identifier identifier identifier string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list subscript identifier identifier keyword_argument identifier attribute identifier identifier expression_statement assignment subscript identifier identifier attribute attribute identifier identifier identifier expression_statement assignment identifier binary_operator call identifier argument_list string string_start string_content string_end identifier expression_statement call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list tuple string string_start string_content string_end identifier identifier string string_start string_end none
|
Add a target and index for this thing.
|
def validate_vars(env):
if 'PCH' in env and env['PCH']:
if 'PCHSTOP' not in env:
raise SCons.Errors.UserError("The PCHSTOP construction must be defined if PCH is defined.")
if not SCons.Util.is_String(env['PCHSTOP']):
raise SCons.Errors.UserError("The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'])
|
module function_definition identifier parameters identifier block if_statement boolean_operator comparison_operator string string_start string_content string_end identifier subscript identifier string string_start string_content string_end block if_statement comparison_operator string string_start string_content string_end identifier block raise_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end if_statement not_operator call attribute attribute identifier identifier identifier argument_list subscript identifier string string_start string_content string_end block raise_statement call attribute attribute identifier identifier identifier argument_list binary_operator string string_start string_content string_end subscript identifier string string_start string_content string_end
|
Validate the PCH and PCHSTOP construction variables.
|
def _make_qheader(self, job_name, qout_path, qerr_path):
subs_dict = self.get_subs_dict()
subs_dict['job_name'] = job_name.replace('/', '_')
subs_dict['_qout_path'] = qout_path
subs_dict['_qerr_path'] = qerr_path
qtemplate = QScriptTemplate(self.QTEMPLATE)
unclean_template = qtemplate.safe_substitute(subs_dict)
clean_template = []
for line in unclean_template.split('\n'):
if '$$' not in line:
clean_template.append(line)
return '\n'.join(clean_template)
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list 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 assignment subscript identifier string string_start string_content string_end identifier expression_statement assignment subscript identifier string string_start string_content string_end identifier expression_statement assignment identifier call identifier argument_list attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier list for_statement identifier call attribute identifier identifier argument_list string string_start string_content escape_sequence string_end block if_statement comparison_operator string string_start string_content string_end identifier block expression_statement call attribute identifier identifier argument_list identifier return_statement call attribute string string_start string_content escape_sequence string_end identifier argument_list identifier
|
Return a string with the options that are passed to the resource manager.
|
def power_up(self):
for m in self.motors:
m.compliant = False
m.moving_speed = 0
m.torque_limit = 100.0
|
module function_definition identifier parameters identifier block for_statement identifier attribute identifier identifier block expression_statement assignment attribute identifier identifier false expression_statement assignment attribute identifier identifier integer expression_statement assignment attribute identifier identifier float
|
Changes all settings to guarantee the motors will be used at their maximum power.
|
def _uint2objs(ftype, num, length=None):
if num == 0:
objs = [ftype.box(0)]
else:
_num = num
objs = list()
while _num != 0:
objs.append(ftype.box(_num & 1))
_num >>= 1
if length:
if length < len(objs):
fstr = "overflow: num = {} requires length >= {}, got length = {}"
raise ValueError(fstr.format(num, len(objs), length))
else:
while len(objs) < length:
objs.append(ftype.box(0))
return objs
|
module function_definition identifier parameters identifier identifier default_parameter identifier none block if_statement comparison_operator identifier integer block expression_statement assignment identifier list call attribute identifier identifier argument_list integer else_clause block expression_statement assignment identifier identifier expression_statement assignment identifier call identifier argument_list while_statement comparison_operator identifier integer block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list binary_operator identifier integer expression_statement augmented_assignment identifier integer if_statement identifier block if_statement comparison_operator identifier call identifier argument_list identifier block expression_statement assignment identifier string string_start string_content string_end raise_statement call identifier argument_list call attribute identifier identifier argument_list identifier call identifier argument_list identifier identifier else_clause block while_statement comparison_operator call identifier argument_list identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list integer return_statement identifier
|
Convert an unsigned integer to a list of constant expressions.
|
def _client_connection(self, conn, addr):
log.debug('Established connection with %s:%d', addr[0], addr[1])
conn.settimeout(self.socket_timeout)
try:
while self.__up:
msg = conn.recv(self.buffer_size)
if not msg:
continue
log.debug('[%s] Received %s from %s. Adding in the queue', time.time(), msg, addr)
self.buffer.put((msg, '{}:{}'.format(addr[0], addr[1])))
except socket.timeout:
if not self.__up:
return
log.debug('Connection %s:%d timed out', addr[1], addr[0])
raise ListenerException('Connection %s:%d timed out' % addr)
finally:
log.debug('Closing connection with %s', addr)
conn.close()
|
module function_definition identifier parameters identifier identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end subscript identifier integer subscript identifier integer expression_statement call attribute identifier identifier argument_list attribute identifier identifier try_statement block while_statement attribute identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier if_statement not_operator identifier block continue_statement expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list tuple identifier call attribute string string_start string_content string_end identifier argument_list subscript identifier integer subscript identifier integer except_clause attribute identifier identifier block if_statement not_operator attribute identifier identifier block return_statement expression_statement call attribute identifier identifier argument_list string string_start string_content string_end subscript identifier integer subscript identifier integer raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier finally_clause block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list
|
Handle the connecition with one client.
|
def format_coord(self, x, y):
p, b = stereonet_math.geographic2plunge_bearing(x, y)
s, d = stereonet_math.geographic2pole(x, y)
pb = u'P/B={:0.0f}\u00b0/{:03.0f}\u00b0'.format(p[0], b[0])
sd = u'S/D={:03.0f}\u00b0/{:0.0f}\u00b0'.format(s[0], d[0])
return u'{}, {}'.format(pb, sd)
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier identifier expression_statement assignment identifier call attribute string string_start string_content escape_sequence escape_sequence string_end identifier argument_list subscript identifier integer subscript identifier integer expression_statement assignment identifier call attribute string string_start string_content escape_sequence escape_sequence string_end identifier argument_list subscript identifier integer subscript identifier integer return_statement call attribute string string_start string_content string_end identifier argument_list identifier identifier
|
Format displayed coordinates during mouseover of axes.
|
def _get_bus_array_construct(self):
bus_no = integer.setResultsName("bus_no")
v_base = real.setResultsName("v_base")
v_magnitude = Optional(real).setResultsName("v_magnitude")
v_angle = Optional(real).setResultsName("v_angle")
area = Optional(integer).setResultsName("area")
region = Optional(integer).setResultsName("region")
bus_data = bus_no + v_base + v_magnitude + v_angle + \
area + region + scolon
bus_data.setParseAction(self.push_bus)
bus_array = Literal("Bus.con") + "=" + "[" + "..." + \
ZeroOrMore(bus_data + Optional("]" + scolon))
bus_array.setParseAction(self.sort_buses)
return bus_array
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute call identifier argument_list identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute call identifier argument_list identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute call identifier argument_list identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute call identifier argument_list identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier binary_operator binary_operator binary_operator binary_operator binary_operator binary_operator identifier identifier identifier identifier line_continuation identifier identifier identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier binary_operator binary_operator binary_operator binary_operator call identifier argument_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 line_continuation call identifier argument_list binary_operator identifier call identifier argument_list binary_operator string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier return_statement identifier
|
Returns a construct for an array of bus data.
|
def _connect_lxd(spec):
return {
'method': 'lxd',
'kwargs': {
'container': spec.remote_addr(),
'python_path': spec.python_path(),
'lxc_path': spec.mitogen_lxc_path(),
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
'remote_name': get_remote_name(spec),
}
}
|
module function_definition identifier parameters identifier block return_statement 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 call attribute identifier identifier argument_list pair string string_start string_content string_end call attribute identifier identifier argument_list pair string string_start string_content string_end call attribute identifier identifier argument_list pair string string_start string_content string_end boolean_operator call attribute identifier identifier argument_list call attribute identifier identifier argument_list pair string string_start string_content string_end call identifier argument_list identifier
|
Return ContextService arguments for an LXD container connection.
|
async def send_webmention(self, entry, url):
if (entry.url, url) in self._processed_mentions:
LOGGER.debug(
"Skipping already processed mention %s -> %s", entry.url, url)
self._processed_mentions.add((entry.url, url))
LOGGER.debug("++WAIT: webmentions.get_target %s", url)
target = await webmentions.get_target(self, url)
LOGGER.debug("++DONE: webmentions.get_target %s", url)
if target:
LOGGER.debug("++WAIT: Sending webmention %s -> %s", entry.url, url)
await target.send(self, entry)
LOGGER.debug("++DONE: Sending webmention %s -> %s", entry.url, url)
|
module function_definition identifier parameters identifier identifier identifier block if_statement comparison_operator tuple attribute identifier identifier identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list tuple attribute identifier identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier await call attribute identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier identifier expression_statement await call attribute identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier identifier
|
send a webmention from an entry to a URL
|
def parse_option(self, option, block_name, message):
if option == 'show':
option = 'start_' + option
key = option.split('_', 1)[0]
self.messages[key] = message
|
module function_definition identifier parameters identifier identifier identifier identifier block if_statement comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier binary_operator string string_start string_content string_end identifier expression_statement assignment identifier subscript call attribute identifier identifier argument_list string string_start string_content string_end integer integer expression_statement assignment subscript attribute identifier identifier identifier identifier
|
Parse show, end_show, and timer_show options.
|
def run_work(self):
if os.path.exists(LOCAL_EVAL_ROOT_DIR):
sudo_remove_dirtree(LOCAL_EVAL_ROOT_DIR)
self.run_attacks()
self.run_defenses()
|
module function_definition identifier parameters identifier block if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call identifier argument_list identifier expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
|
Run attacks and defenses
|
def unindent(self):
_logger().debug('unindent')
cursor = self.editor.textCursor()
_logger().debug('cursor has selection %r', cursor.hasSelection())
if cursor.hasSelection():
cursor.beginEditBlock()
self.unindent_selection(cursor)
cursor.endEditBlock()
self.editor.setTextCursor(cursor)
else:
tab_len = self.editor.tab_length
indentation = cursor.positionInBlock()
indentation -= self.min_column
if indentation == 0:
return
max_spaces = indentation % tab_len
if max_spaces == 0:
max_spaces = tab_len
spaces = self.count_deletable_spaces(cursor, max_spaces)
_logger().info('deleting %d space before cursor' % spaces)
cursor.beginEditBlock()
for _ in range(spaces):
cursor.deletePreviousChar()
cursor.endEditBlock()
self.editor.setTextCursor(cursor)
_logger().debug(cursor.block().text())
|
module function_definition identifier parameters identifier block expression_statement call attribute call identifier argument_list identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement call attribute call identifier argument_list identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list if_statement call attribute identifier identifier argument_list block 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 expression_statement call attribute attribute identifier identifier identifier argument_list identifier else_clause block expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement augmented_assignment identifier attribute identifier identifier if_statement comparison_operator identifier integer block return_statement expression_statement assignment identifier binary_operator identifier identifier if_statement comparison_operator identifier integer block expression_statement assignment identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier expression_statement call attribute call identifier argument_list identifier argument_list binary_operator string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list for_statement identifier call identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute call identifier argument_list identifier argument_list call attribute call attribute identifier identifier argument_list identifier argument_list
|
Un-indents text at cursor position.
|
def _should_defer(input_layer, args, kwargs):
for arg in itertools.chain([input_layer], args, six.itervalues(kwargs)):
if isinstance(arg, (_DeferredLayer, UnboundVariable)):
return True
elif (isinstance(arg, collections.Sequence) and
not isinstance(arg, six.string_types)):
if _should_defer(None, arg, {}):
return True
elif isinstance(arg, collections.Mapping):
if _should_defer(None, (), arg):
return True
return False
|
module function_definition identifier parameters identifier identifier identifier block for_statement identifier call attribute identifier identifier argument_list list identifier identifier call attribute identifier identifier argument_list identifier block if_statement call identifier argument_list identifier tuple identifier identifier block return_statement true elif_clause parenthesized_expression boolean_operator call identifier argument_list identifier attribute identifier identifier not_operator call identifier argument_list identifier attribute identifier identifier block if_statement call identifier argument_list none identifier dictionary block return_statement true elif_clause call identifier argument_list identifier attribute identifier identifier block if_statement call identifier argument_list none tuple identifier block return_statement true return_statement false
|
Checks to see if any of the args are templates.
|
def _handle_tag_enabledebugger2(self):
obj = _make_object("EnableDebugger2")
obj.Reserved = unpack_ui16(self._src)
obj.Password = self._get_struct_string()
return obj
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list string string_start string_content string_end expression_statement assignment attribute identifier identifier call identifier argument_list attribute identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list return_statement identifier
|
Handle the EnableDebugger2 tag.
|
def audio_load_time(self):
load_times = self.get_load_times('audio')
return round(mean(load_times), self.decimal_precision)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end return_statement call identifier argument_list call identifier argument_list identifier attribute identifier identifier
|
Returns aggregate audio load time for all pages.
|
def create_modelo(self):
return Modelo(
self.networkapi_url,
self.user,
self.password,
self.user_ldap)
|
module function_definition identifier parameters identifier block return_statement call identifier argument_list attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier
|
Get an instance of modelo services facade.
|
def _fill_out_err(result, testcase):
if result.get("stdout"):
system_out = etree.SubElement(testcase, "system-out")
system_out.text = utils.get_unicode_str(result["stdout"])
if result.get("stderr"):
system_err = etree.SubElement(testcase, "system-err")
system_err.text = utils.get_unicode_str(result["stderr"])
|
module function_definition identifier parameters identifier identifier block if_statement call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment identifier call attribute identifier identifier argument_list identifier string string_start string_content string_end expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list subscript identifier string string_start string_content string_end if_statement call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment identifier call attribute identifier identifier argument_list identifier string string_start string_content string_end expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list subscript identifier string string_start string_content string_end
|
Adds stdout and stderr if present.
|
def packstr(instr, textwidth=160, breakchars=' ', break_words=True,
newline_prefix='', indentation='', nlprefix=None, wordsep=' ',
remove_newlines=True):
if not isinstance(instr, six.string_types):
instr = repr(instr)
if nlprefix is not None:
newline_prefix = nlprefix
str_ = pack_into(instr, textwidth, breakchars, break_words, newline_prefix,
wordsep, remove_newlines)
if indentation != '':
str_ = indent(str_, indentation)
return str_
|
module function_definition identifier parameters identifier default_parameter identifier integer default_parameter identifier string string_start string_content string_end default_parameter identifier true default_parameter identifier string string_start string_end default_parameter identifier string string_start string_end default_parameter identifier none default_parameter identifier string string_start string_content string_end default_parameter identifier true block if_statement not_operator call identifier argument_list identifier attribute identifier identifier block expression_statement assignment identifier call identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement assignment identifier identifier expression_statement assignment identifier call identifier argument_list identifier identifier identifier identifier identifier identifier identifier if_statement comparison_operator identifier string string_start string_end block expression_statement assignment identifier call identifier argument_list identifier identifier return_statement identifier
|
alias for pack_into. has more up to date kwargs
|
def validate(self):
_validate_operator_name(self.operator, BinaryComposition.SUPPORTED_OPERATORS)
if not isinstance(self.left, Expression):
raise TypeError(u'Expected Expression left, got: {} {} {}'.format(
type(self.left).__name__, self.left, self))
if not isinstance(self.right, Expression):
raise TypeError(u'Expected Expression right, got: {} {}'.format(
type(self.right).__name__, self.right))
|
module function_definition identifier parameters identifier block expression_statement call identifier argument_list attribute identifier identifier attribute identifier identifier if_statement not_operator call identifier argument_list attribute identifier identifier identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list attribute call identifier argument_list attribute identifier identifier identifier attribute identifier identifier identifier if_statement not_operator call identifier argument_list attribute identifier identifier identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list attribute call identifier argument_list attribute identifier identifier identifier attribute identifier identifier
|
Validate that the BinaryComposition is correctly representable.
|
def mute_parse_args(self, text):
error = AzCliCommandParser.error
_check_value = AzCliCommandParser._check_value
AzCliCommandParser.error = error_pass
AzCliCommandParser._check_value = _check_value_muted
try:
parse_args = self.argsfinder.get_parsed_args(parse_quotes(text, quotes=False, string=False))
except Exception:
pass
AzCliCommandParser.error = error
AzCliCommandParser._check_value = _check_value
return parse_args
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier attribute identifier identifier expression_statement assignment attribute identifier identifier identifier expression_statement assignment attribute identifier identifier identifier try_statement block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list call identifier argument_list identifier keyword_argument identifier false keyword_argument identifier false except_clause identifier block pass_statement expression_statement assignment attribute identifier identifier identifier expression_statement assignment attribute identifier identifier identifier return_statement identifier
|
mutes the parser error when parsing, then puts it back
|
def all_floating_ips(self):
if self.api_version == 2:
json = self.request('/floating_ips')
return json['floating_ips']
else:
raise DoError(v2_api_required_str)
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier integer block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end return_statement subscript identifier string string_start string_content string_end else_clause block raise_statement call identifier argument_list identifier
|
Lists all of the Floating IPs available on the account.
|
def _get_argument_list_from_toolkit_function_name(fn):
unity = _get_unity()
fnprops = unity.describe_toolkit_function(fn)
argnames = fnprops['arguments']
return argnames
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier subscript identifier string string_start string_content string_end return_statement identifier
|
Given a toolkit function name, return the argument list
|
def android_example():
env = holodeck.make("AndroidPlayground")
command = np.ones(94) * 10
for i in range(10):
env.reset()
for j in range(1000):
if j % 50 == 0:
command *= -1
state, reward, terminal, _ = env.step(command)
pixels = state[Sensors.PIXEL_CAMERA]
orientation = state[Sensors.ORIENTATION_SENSOR]
|
module function_definition identifier parameters block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier binary_operator call attribute identifier identifier argument_list integer integer for_statement identifier call identifier argument_list integer block expression_statement call attribute identifier identifier argument_list for_statement identifier call identifier argument_list integer block if_statement comparison_operator binary_operator identifier integer integer block expression_statement augmented_assignment identifier unary_operator integer expression_statement assignment pattern_list identifier identifier identifier identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier subscript identifier attribute identifier identifier expression_statement assignment identifier subscript identifier attribute identifier identifier
|
A basic example of how to use the android agent.
|
def _build_body_schema(serializer, body_parameters):
description = ""
if isinstance(body_parameters, Param):
schema = serializer.to_json_schema(body_parameters.arginfo.type)
description = body_parameters.description
required = True
else:
if len(body_parameters) == 0:
return None
required = set()
body_properties = {}
for name, param in body_parameters.items():
arginfo = param.arginfo
body_properties[name] = serializer.to_json_schema(arginfo.type)
body_properties[name]["description"] = param.description
if arginfo.default is NoDefault:
required.add(name)
schema = {
"type": "object",
"required": list(required),
"properties": body_properties,
}
required = len(required) > 0
return BodyParameter(
{
"name": "body",
"description": description,
"required": required,
"schema": schema,
}
)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier string string_start string_end if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute attribute identifier identifier identifier expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier true else_clause block if_statement comparison_operator call identifier argument_list identifier integer block return_statement none expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier dictionary for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block expression_statement assignment identifier attribute identifier identifier expression_statement assignment subscript identifier identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment subscript subscript identifier identifier string string_start string_content string_end attribute identifier identifier if_statement comparison_operator attribute identifier identifier identifier block expression_statement call attribute identifier identifier argument_list identifier 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 call identifier argument_list identifier pair string string_start string_content string_end identifier expression_statement assignment identifier comparison_operator call identifier argument_list identifier integer return_statement call identifier argument_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 identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier
|
body is built differently, since it's a single argument no matter what.
|
def tileXYZToQuadKey(self, x, y, z):
quadKey = ''
for i in range(z, 0, -1):
digit = 0
mask = 1 << (i - 1)
if (x & mask) != 0:
digit += 1
if (y & mask) != 0:
digit += 2
quadKey += str(digit)
return quadKey
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment identifier string string_start string_end for_statement identifier call identifier argument_list identifier integer unary_operator integer block expression_statement assignment identifier integer expression_statement assignment identifier binary_operator integer parenthesized_expression binary_operator identifier integer if_statement comparison_operator parenthesized_expression binary_operator identifier identifier integer block expression_statement augmented_assignment identifier integer if_statement comparison_operator parenthesized_expression binary_operator identifier identifier integer block expression_statement augmented_assignment identifier integer expression_statement augmented_assignment identifier call identifier argument_list identifier return_statement identifier
|
Computes quadKey value based on tile x, y and z values.
|
def parse_url(request, url):
try:
validate = URLValidator()
validate(url)
except ValidationError:
if url.startswith('/'):
host = request.get_host()
scheme = 'https' if request.is_secure() else 'http'
url = '{scheme}://{host}{uri}'.format(scheme=scheme,
host=host,
uri=url)
else:
url = request.build_absolute_uri(reverse(url))
return url
|
module function_definition identifier parameters identifier identifier block try_statement block expression_statement assignment identifier call identifier argument_list expression_statement call identifier argument_list identifier except_clause identifier block if_statement call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier conditional_expression string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier else_clause block expression_statement assignment identifier call attribute identifier identifier argument_list call identifier argument_list identifier return_statement identifier
|
Parse url URL parameter.
|
def scores_to_probs(scores, proba, eps=0.01):
if np.any(~proba):
probs = copy.deepcopy(scores)
n_class = len(proba)
for m in range(n_class):
if not proba[m]:
max_extreme_score = max(np.abs(np.min(scores[:,m])),\
np.abs(np.max(scores[:,m])))
k = np.log((1-eps)/eps)/max_extreme_score
self._probs[:,m] = expit(k * self.scores[:,m])
return probs
else:
return scores
|
module function_definition identifier parameters identifier identifier default_parameter identifier float block if_statement call attribute identifier identifier argument_list unary_operator identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier for_statement identifier call identifier argument_list identifier block if_statement not_operator subscript identifier identifier block expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list call attribute identifier identifier argument_list subscript identifier slice identifier line_continuation call attribute identifier identifier argument_list call attribute identifier identifier argument_list subscript identifier slice identifier expression_statement assignment identifier binary_operator call attribute identifier identifier argument_list binary_operator parenthesized_expression binary_operator integer identifier identifier identifier expression_statement assignment subscript attribute identifier identifier slice identifier call identifier argument_list binary_operator identifier subscript attribute identifier identifier slice identifier return_statement identifier else_clause block return_statement identifier
|
Transforms scores to probabilities by applying the logistic function
|
def _on_client_latency_changed(self, data):
self._clients.get(data.get('id')).update_latency(data)
|
module function_definition identifier parameters identifier identifier block expression_statement call attribute call attribute attribute identifier identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end identifier argument_list identifier
|
Handle client latency changed.
|
def GetSOAPPart(self):
head, part = self.parts[0]
return StringIO.StringIO(part.getvalue())
|
module function_definition identifier parameters identifier block expression_statement assignment pattern_list identifier identifier subscript attribute identifier identifier integer return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list
|
Get the SOAP body part.
|
def load_user_envs(self):
installed_packages = self._list_packages()
gym_package = 'gym ({})'.format(installed_packages['gym']) if 'gym' in installed_packages else 'gym'
core_specs = registry.all()
for spec in core_specs:
spec.source = 'OpenAI Gym Core Package'
spec.package = gym_package
if not os.path.isfile(self.cache_path):
return
with open(self.cache_path) as cache:
for line in cache:
user_package, registered_envs = self._load_package(line.rstrip('\n'), installed_packages)
if logger.level <= logging.DEBUG:
logger.debug('Installed %d user environments from package "%s"', len(registered_envs), user_package['name'])
if self.cache_needs_update:
self._update_cache()
if len(self.env_ids) > 0:
logger.info('Found and registered %d user environments.', len(self.env_ids))
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier conditional_expression call attribute string string_start string_content string_end identifier argument_list subscript identifier string string_start string_content string_end comparison_operator string string_start string_content string_end identifier string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list for_statement identifier identifier block expression_statement assignment attribute identifier identifier string string_start string_content string_end expression_statement assignment attribute identifier identifier identifier if_statement not_operator call attribute attribute identifier identifier identifier argument_list attribute identifier identifier block return_statement with_statement with_clause with_item as_pattern call identifier argument_list attribute identifier identifier as_pattern_target identifier block for_statement identifier identifier block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content escape_sequence string_end identifier if_statement comparison_operator attribute identifier identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call identifier argument_list identifier subscript identifier string string_start string_content string_end if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list if_statement comparison_operator call identifier argument_list attribute identifier identifier integer block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call identifier argument_list attribute identifier identifier
|
Loads downloaded user envs from filesystem cache on `import gym`
|
def optimize_no(self):
self.optimization = 0
self.relax = False
self.gc_sections = False
self.ffunction_sections = False
self.fdata_sections = False
self.fno_inline_small_functions = False
|
module function_definition identifier parameters identifier block expression_statement assignment attribute identifier identifier integer expression_statement assignment attribute identifier identifier false expression_statement assignment attribute identifier identifier false expression_statement assignment attribute identifier identifier false expression_statement assignment attribute identifier identifier false expression_statement assignment attribute identifier identifier false
|
all options set to default
|
def apool(self,
k_height,
k_width,
d_height=2,
d_width=2,
mode="VALID",
input_layer=None,
num_channels_in=None):
return self._pool("apool", pooling_layers.average_pooling2d, k_height,
k_width, d_height, d_width, mode, input_layer,
num_channels_in)
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier integer default_parameter identifier integer default_parameter identifier string string_start string_content string_end default_parameter identifier none default_parameter identifier none block return_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier identifier identifier identifier identifier identifier identifier identifier
|
Construct an average pooling layer.
|
def Y_tighter(self):
self.parent.value('y_distance', self.parent.value('y_distance') / 1.4)
self.parent.traces.display()
|
module function_definition identifier parameters identifier block expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end binary_operator call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end float expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list
|
Decrease the distance of the lines.
|
def clear_cache_delete_selected(modeladmin, request, queryset):
result = delete_selected(modeladmin, request, queryset)
if not result and hasattr(modeladmin, 'invalidate_cache'):
modeladmin.invalidate_cache(queryset=queryset)
return result
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call identifier argument_list identifier identifier identifier if_statement boolean_operator not_operator identifier call identifier argument_list identifier string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list keyword_argument identifier identifier return_statement identifier
|
A delete action that will invalidate cache after being called.
|
def config_scale(self, cnf={}, **kwargs):
self._scale.config(cnf, **kwargs)
self._variable.configure(high=self._scale['to'],
low=self._scale['from'])
if 'orient' in cnf or 'orient' in kwargs:
self._grid_widgets()
|
module function_definition identifier parameters identifier default_parameter identifier dictionary dictionary_splat_pattern identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier dictionary_splat identifier expression_statement call attribute attribute identifier identifier identifier argument_list keyword_argument identifier subscript attribute identifier identifier string string_start string_content string_end keyword_argument identifier subscript attribute identifier identifier string string_start string_content string_end 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 expression_statement call attribute identifier identifier argument_list
|
Configure resources of the Scale widget.
|
def __addNode(self, name, cls):
if name in self.nodes:
raise Exception("A node by the name {} already exists. Can't add a duplicate.".format(name))
self.__nxgraph.add_node(name)
self.__nxgraph.node[name]['label'] = name
self.__nxgraph.node[name]['nodeobj'] = cls()
self.__nxgraph.node[name]['type'] = cls.__name__
|
module function_definition identifier parameters identifier identifier identifier block if_statement comparison_operator identifier attribute identifier identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment subscript subscript attribute attribute identifier identifier identifier identifier string string_start string_content string_end identifier expression_statement assignment subscript subscript attribute attribute identifier identifier identifier identifier string string_start string_content string_end call identifier argument_list expression_statement assignment subscript subscript attribute attribute identifier identifier identifier identifier string string_start string_content string_end attribute identifier identifier
|
Add a node to the topology
|
def dispatch(self, *args, **kwargs):
return super(QuickEntry, self).dispatch(*args, **kwargs)
|
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block return_statement call attribute call identifier argument_list identifier identifier identifier argument_list list_splat identifier dictionary_splat identifier
|
Decorate the view dispatcher with permission_required.
|
def properties_changed(self, properties, changed_properties, invalidated_properties):
value = changed_properties.get('Value')
if value is not None:
self.service.device.characteristic_value_updated(characteristic=self, value=bytes(value))
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator identifier none block expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier call identifier argument_list identifier
|
Called when a Characteristic property has changed.
|
def process_build_metrics(context, build_processors):
build_metrics = OrderedDict()
for p in build_processors:
p.reset()
for p in build_processors:
build_metrics.update(p.build_metrics)
return build_metrics
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list attribute identifier identifier return_statement identifier
|
use processors to collect build metrics.
|
def response(self, msgtype, msgid, error, result):
self._proxy.response(msgid, error, result)
|
module function_definition identifier parameters identifier identifier identifier identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier identifier identifier
|
Handle an incoming response.
|
def index():
kwdb = current_app.kwdb
libraries = get_collections(kwdb, libtype="library")
resource_files = get_collections(kwdb, libtype="resource")
return flask.render_template("libraryNames.html",
data={"libraries": libraries,
"version": __version__,
"resource_files": resource_files
})
|
module function_definition identifier parameters block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list identifier keyword_argument identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier keyword_argument identifier string string_start string_content string_end return_statement call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier 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
|
Show a list of available libraries, and resource files
|
def write_summary_cnts_all(self):
cnts = self.get_cnts_levels_depths_recs(set(self.obo.values()))
self._write_summary_cnts(cnts)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list call identifier argument_list call attribute attribute identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier
|
Write summary of level and depth counts for all active GO Terms.
|
def _convert_to_identifier_json(self, address_data):
if isinstance(address_data, str):
return {"slug": address_data}
if isinstance(address_data, tuple) and len(address_data) > 0:
address_json = {"address": address_data[0]}
if len(address_data) > 1:
address_json["zipcode"] = address_data[1]
if len(address_data) > 2:
address_json["meta"] = address_data[2]
return address_json
if isinstance(address_data, dict):
allowed_keys = ["address", "zipcode", "unit", "city", "state", "slug", "meta",
"client_value", "client_value_sqft"]
for key in address_data:
if key not in allowed_keys:
msg = "Key in address input not allowed: " + key
raise housecanary.exceptions.InvalidInputException(msg)
if "address" in address_data or "slug" in address_data:
return address_data
msg = ("Input is invalid. Must be a list of (address, zipcode) tuples, or a dict or list"
" of dicts with each item containing at least an 'address' or 'slug' key.")
raise housecanary.exceptions.InvalidInputException((msg))
|
module function_definition identifier parameters identifier identifier block if_statement call identifier argument_list identifier identifier block return_statement dictionary pair string string_start string_content string_end identifier if_statement boolean_operator call identifier argument_list identifier identifier comparison_operator call identifier argument_list identifier integer block expression_statement assignment identifier dictionary pair string string_start string_content string_end subscript identifier integer if_statement comparison_operator call identifier argument_list identifier integer block expression_statement assignment subscript identifier string string_start string_content string_end subscript identifier integer if_statement comparison_operator call identifier argument_list identifier integer block expression_statement assignment subscript identifier string string_start string_content string_end subscript identifier integer return_statement identifier if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier 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 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 for_statement identifier identifier block if_statement comparison_operator identifier identifier block expression_statement assignment identifier binary_operator string string_start string_content string_end identifier raise_statement call attribute attribute identifier 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 identifier expression_statement assignment identifier parenthesized_expression concatenated_string string string_start string_content string_end string string_start string_content string_end raise_statement call attribute attribute identifier identifier identifier argument_list parenthesized_expression identifier
|
Convert input address data into json format
|
def check_enum(enum, name=None, valid=None):
name = name or 'enum'
res = None
if isinstance(enum, int):
if hasattr(enum, 'name') and enum.name.startswith('GL_'):
res = enum.name[3:].lower()
elif isinstance(enum, string_types):
res = enum.lower()
if res is None:
raise ValueError('Could not determine string represenatation for'
'enum %r' % enum)
elif valid and res not in valid:
raise ValueError('Value of %s must be one of %r, not %r' %
(name, valid, enum))
return res
|
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none block expression_statement assignment identifier boolean_operator identifier string string_start string_content string_end expression_statement assignment identifier none if_statement call identifier argument_list identifier identifier block if_statement boolean_operator call identifier argument_list identifier string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end block expression_statement assignment identifier call attribute subscript attribute identifier identifier slice integer identifier argument_list elif_clause call identifier argument_list identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list if_statement comparison_operator identifier none block raise_statement call identifier argument_list binary_operator concatenated_string string string_start string_content string_end string string_start string_content string_end identifier elif_clause boolean_operator identifier comparison_operator identifier identifier block raise_statement call identifier argument_list binary_operator string string_start string_content string_end tuple identifier identifier identifier return_statement identifier
|
Get lowercase string representation of enum.
|
def callback_result(self):
if self._state == self._PENDING:
self._loop.run_until_complete(self)
if self._callbacks:
result = self._callback_result
else:
result = self.result()
return result
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier if_statement attribute identifier identifier block expression_statement assignment identifier attribute identifier identifier else_clause block expression_statement assignment identifier call attribute identifier identifier argument_list return_statement identifier
|
Blocking until the task finish and return the callback_result.until
|
def execute(self):
self._collect_garbage()
upstream_channels = {}
for node in nx.topological_sort(self.logical_topo):
operator = self.operators[node]
downstream_channels = self._generate_channels(operator)
handles = self.__generate_actors(operator, upstream_channels,
downstream_channels)
if handles:
self.actor_handles.extend(handles)
upstream_channels.update(downstream_channels)
logger.debug("Running...")
return self.actor_handles
|
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier dictionary for_statement identifier call attribute identifier identifier argument_list attribute identifier identifier block expression_statement assignment identifier subscript attribute identifier identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier identifier if_statement identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end return_statement attribute identifier identifier
|
Deploys and executes the physical dataflow.
|
def template_to_base_path(template, google_songs):
if template == os.getcwd() or template == '%suggested%':
base_path = os.getcwd()
else:
template = os.path.abspath(template)
song_paths = [template_to_filepath(template, song) for song in google_songs]
base_path = os.path.dirname(os.path.commonprefix(song_paths))
return base_path
|
module function_definition identifier parameters identifier identifier block if_statement boolean_operator comparison_operator identifier call attribute identifier identifier argument_list comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier call attribute identifier identifier argument_list else_clause block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier list_comprehension call identifier argument_list identifier identifier for_in_clause identifier identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier return_statement identifier
|
Get base output path for a list of songs for download.
|
def fingerprint_from_var(var):
vsn = gpg_version()
cmd = flatten([gnupg_bin(), gnupg_home()])
if vsn[0] >= 2 and vsn[1] < 1:
cmd.append("--with-fingerprint")
output = polite_string(stderr_with_input(cmd, var)).split('\n')
if not output[0].startswith('pub'):
raise CryptoritoError('probably an invalid gpg key')
if vsn[0] >= 2 and vsn[1] < 1:
return output[1] \
.split('=')[1] \
.replace(' ', '')
return output[1].strip()
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier call identifier argument_list list call identifier argument_list call identifier argument_list if_statement boolean_operator comparison_operator subscript identifier integer integer comparison_operator subscript identifier integer integer block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute call identifier argument_list call identifier argument_list identifier identifier identifier argument_list string string_start string_content escape_sequence string_end if_statement not_operator call attribute subscript identifier integer identifier argument_list string string_start string_content string_end block raise_statement call identifier argument_list string string_start string_content string_end if_statement boolean_operator comparison_operator subscript identifier integer integer comparison_operator subscript identifier integer integer block return_statement call attribute subscript call attribute subscript identifier integer line_continuation identifier argument_list string string_start string_content string_end integer line_continuation identifier argument_list string string_start string_content string_end string string_start string_end return_statement call attribute subscript identifier integer identifier argument_list
|
Extract a fingerprint from a GPG public key
|
def humanize_hours(total_hours, frmt='{hours:02d}:{minutes:02d}:{seconds:02d}',
negative_frmt=None):
seconds = int(float(total_hours) * 3600)
return humanize_seconds(seconds, frmt, negative_frmt)
|
module function_definition identifier parameters identifier default_parameter identifier string string_start string_content string_end default_parameter identifier none block expression_statement assignment identifier call identifier argument_list binary_operator call identifier argument_list identifier integer return_statement call identifier argument_list identifier identifier identifier
|
Given time in hours, return a string representing the time.
|
def _update_axes(ax, xincrease, yincrease,
xscale=None, yscale=None,
xticks=None, yticks=None,
xlim=None, ylim=None):
if xincrease is None:
pass
elif xincrease and ax.xaxis_inverted():
ax.invert_xaxis()
elif not xincrease and not ax.xaxis_inverted():
ax.invert_xaxis()
if yincrease is None:
pass
elif yincrease and ax.yaxis_inverted():
ax.invert_yaxis()
elif not yincrease and not ax.yaxis_inverted():
ax.invert_yaxis()
if xscale is not None:
ax.set_xscale(xscale)
if yscale is not None:
ax.set_yscale(yscale)
if xticks is not None:
ax.set_xticks(xticks)
if yticks is not None:
ax.set_yticks(yticks)
if xlim is not None:
ax.set_xlim(xlim)
if ylim is not None:
ax.set_ylim(ylim)
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier none block if_statement comparison_operator identifier none block pass_statement elif_clause boolean_operator identifier call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list elif_clause boolean_operator not_operator identifier not_operator call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list if_statement comparison_operator identifier none block pass_statement elif_clause boolean_operator identifier call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list elif_clause boolean_operator not_operator identifier not_operator call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list identifier
|
Update axes with provided parameters
|
def editor_js_initialization(selector, **extra_settings):
init_template = loader.get_template(
settings.MARKDOWN_EDITOR_INIT_TEMPLATE)
options = dict(
previewParserPath=reverse('django_markdown_preview'),
**settings.MARKDOWN_EDITOR_SETTINGS)
options.update(extra_settings)
ctx = dict(
selector=selector,
extra_settings=simplejson.dumps(options)
)
return init_template.render(ctx)
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier call identifier argument_list keyword_argument identifier call identifier argument_list string string_start string_content string_end dictionary_splat attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier keyword_argument identifier call attribute identifier identifier argument_list identifier return_statement call attribute identifier identifier argument_list identifier
|
Return script tag with initialization code.
|
def serialize_checks(check_set):
check_set_list = []
for check in check_set.all()[:25]:
check_set_list.append(
{
'datetime': check.checked_datetime.isoformat(),
'value': check.response_time,
'success': 1 if check.success else 0
}
)
return check_set_list
|
module function_definition identifier parameters identifier block expression_statement assignment identifier list for_statement identifier subscript call attribute identifier identifier argument_list slice integer block expression_statement call attribute identifier identifier argument_list dictionary pair string string_start string_content string_end call attribute attribute identifier identifier identifier argument_list pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end conditional_expression integer attribute identifier identifier integer return_statement identifier
|
Serialize a check_set for raphael
|
def list(self):
service = self._service
lxc_names = service.list_names()
lxc_list = []
for name in lxc_names:
lxc = self.get(name)
lxc_list.append(lxc)
return lxc_list
|
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier list for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier return_statement identifier
|
Get's all of the LXC's and creates objects for them
|
def monitor(self):
while self.monitor_running.is_set():
if time.time() - self.last_flush > self.batch_time:
if not self.queue.empty():
logger.info("Queue Flush: time without flush exceeded")
self.flush_queue()
time.sleep(self.batch_time)
|
module function_definition identifier parameters identifier block while_statement call attribute attribute identifier identifier identifier argument_list block if_statement comparison_operator binary_operator call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier block if_statement not_operator call attribute attribute identifier identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list attribute identifier identifier
|
Flushes the queue periodically.
|
def close(self):
if VERBOSE:
_print_out('\nDummy_serial: Closing port\n')
if not self._isOpen:
raise IOError('Dummy_serial: The port is already closed')
self._isOpen = False
self.port = None
|
module function_definition identifier parameters identifier block if_statement identifier block expression_statement call identifier argument_list string string_start string_content escape_sequence escape_sequence string_end if_statement not_operator attribute identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end expression_statement assignment attribute identifier identifier false expression_statement assignment attribute identifier identifier none
|
Close a port on dummy_serial.
|
def _post_build(self, module, encoding):
module.file_encoding = encoding
self._manager.cache_module(module)
for from_node in module._import_from_nodes:
if from_node.modname == "__future__":
for symbol, _ in from_node.names:
module.future_imports.add(symbol)
self.add_from_names_to_locals(from_node)
for delayed in module._delayed_assattr:
self.delayed_assattr(delayed)
if self._apply_transforms:
module = self._manager.visit_transforms(module)
return module
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment attribute identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier for_statement identifier attribute identifier identifier block if_statement comparison_operator attribute identifier identifier string string_start string_content string_end block for_statement pattern_list identifier identifier attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list identifier if_statement attribute identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier return_statement identifier
|
Handles encoding and delayed nodes after a module has been built
|
def _get_data_from_list_of_lists(source, fields='*', first_row=0, count=-1, schema=None):
if schema is None:
schema = google.datalab.bigquery.Schema.from_data(source)
fields = get_field_list(fields, schema)
gen = source[first_row:first_row + count] if count >= 0 else source
cols = [schema.find(name) for name in fields]
rows = [{'c': [{'v': row[i]} for i in cols]} for row in gen]
return {'cols': _get_cols(fields, schema), 'rows': rows}, len(source)
|
module function_definition identifier parameters identifier default_parameter identifier string string_start string_content string_end default_parameter identifier integer default_parameter identifier unary_operator integer default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement assignment identifier call attribute attribute attribute attribute identifier identifier identifier identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier identifier expression_statement assignment identifier conditional_expression subscript identifier slice identifier binary_operator identifier identifier comparison_operator identifier integer identifier expression_statement assignment identifier list_comprehension call attribute identifier identifier argument_list identifier for_in_clause identifier identifier expression_statement assignment identifier list_comprehension dictionary pair string string_start string_content string_end list_comprehension dictionary pair string string_start string_content string_end subscript identifier identifier for_in_clause identifier identifier for_in_clause identifier identifier return_statement expression_list dictionary pair string string_start string_content string_end call identifier argument_list identifier identifier pair string string_start string_content string_end identifier call identifier argument_list identifier
|
Helper function for _get_data that handles lists of lists.
|
def _match_magic(self, full_path):
for magic in self.magics:
if magic.matches(full_path):
return magic
|
module function_definition identifier parameters identifier identifier block for_statement identifier attribute identifier identifier block if_statement call attribute identifier identifier argument_list identifier block return_statement identifier
|
Return the first magic that matches this path or None.
|
def import_graph(self, t_input=None, scope='import', forget_xy_shape=True):
graph = tf.get_default_graph()
assert graph.unique_name(scope, False) == scope, (
'Scope "%s" already exists. Provide explicit scope names when '
'importing multiple instances of the model.') % scope
t_input, t_prep_input = self.create_input(t_input, forget_xy_shape)
tf.import_graph_def(
self.graph_def, {self.input_name: t_prep_input}, name=scope)
self.post_import(scope)
|
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier string string_start string_content string_end default_parameter identifier true block expression_statement assignment identifier call attribute identifier identifier argument_list assert_statement comparison_operator call attribute identifier identifier argument_list identifier false identifier binary_operator parenthesized_expression concatenated_string string string_start string_content string_end string string_start string_content string_end identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier dictionary pair attribute identifier identifier identifier keyword_argument identifier identifier expression_statement call attribute identifier identifier argument_list identifier
|
Import model GraphDef into the current graph.
|
def _is_reference(arg):
return isinstance(arg, dict) and len(arg) == 1 and isinstance(next(six.itervalues(arg)), six.string_types)
|
module function_definition identifier parameters identifier block return_statement boolean_operator boolean_operator call identifier argument_list identifier identifier comparison_operator call identifier argument_list identifier integer call identifier argument_list call identifier argument_list call attribute identifier identifier argument_list identifier attribute identifier identifier
|
Return True, if arg is a reference to a previously defined statement.
|
def action(arguments):
source_format = (arguments.source_format or
fileformat.from_handle(arguments.source_file))
output_format = (arguments.output_format or
fileformat.from_handle(arguments.output_file))
with arguments.source_file:
sequences = SeqIO.parse(
arguments.source_file,
source_format,
alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))
(forward_start, forward_end), (reverse_start, reverse_end) = locate_primers(
sequences, arguments.forward_primer,
arguments.reverse_primer, arguments.reverse_complement,
arguments.max_hamming_distance)
if arguments.include_primers:
start = forward_start
end = reverse_end + 1
else:
start = forward_end + 1
end = reverse_start
arguments.source_file.seek(0)
sequences = SeqIO.parse(
arguments.source_file,
source_format,
alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))
prune_action = _ACTIONS[arguments.prune_action]
transformed_sequences = prune_action(sequences, start, end)
with arguments.output_file:
SeqIO.write(transformed_sequences, arguments.output_file,
output_format)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier parenthesized_expression boolean_operator attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier parenthesized_expression boolean_operator attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier with_statement with_clause with_item attribute identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier identifier keyword_argument identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment pattern_list tuple_pattern identifier identifier tuple_pattern identifier identifier call identifier argument_list identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier if_statement attribute identifier identifier block expression_statement assignment identifier identifier expression_statement assignment identifier binary_operator identifier integer else_clause block expression_statement assignment identifier binary_operator identifier integer expression_statement assignment identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list integer expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier identifier keyword_argument identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier subscript identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list identifier identifier identifier with_statement with_clause with_item attribute identifier identifier block expression_statement call attribute identifier identifier argument_list identifier attribute identifier identifier identifier
|
Trim the alignment as specified
|
def parse_buffer_to_jpeg(data):
return [
Image.open(BytesIO(image_data + b'\xff\xd9'))
for image_data in data.split(b'\xff\xd9')[:-1]
]
|
module function_definition identifier parameters identifier block return_statement list_comprehension call attribute identifier identifier argument_list call identifier argument_list binary_operator identifier string string_start string_content escape_sequence escape_sequence string_end for_in_clause identifier subscript call attribute identifier identifier argument_list string string_start string_content escape_sequence escape_sequence string_end slice unary_operator integer
|
Parse JPEG file bytes to Pillow Image
|
def load_vstr(buf, pos):
slen, pos = load_vint(buf, pos)
return load_bytes(buf, slen, pos)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment pattern_list identifier identifier call identifier argument_list identifier identifier return_statement call identifier argument_list identifier identifier identifier
|
Load bytes prefixed by vint length
|
def check_config(config):
url = config.get("Server", "url")
try:
urlopen(url)
except Exception as e:
logger.error(
"The configured OpenSubmit server URL ({0}) seems to be invalid: {1}".format(url, e))
return False
targetdir = config.get("Execution", "directory")
if platform.system() is not "Windows" and not targetdir.startswith("/"):
logger.error(
"Please use absolute paths, starting with a /, in your Execution-directory setting.")
return False
if not targetdir.endswith(os.sep):
logger.error(
"Your Execution-directory setting must end with a " + os.sep)
return False
return True
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end try_statement block expression_statement call identifier argument_list identifier except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier identifier return_statement false expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end if_statement boolean_operator comparison_operator call attribute identifier identifier argument_list string string_start string_content string_end not_operator call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end return_statement false if_statement not_operator call attribute identifier identifier argument_list attribute identifier identifier block expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end attribute identifier identifier return_statement false return_statement true
|
Check the executor config file for consistency.
|
def remove_droppable(self, droppable_id):
updated_droppables = []
for droppable in self.my_osid_object_form._my_map['droppables']:
if droppable['id'] != droppable_id:
updated_droppables.append(droppable)
self.my_osid_object_form._my_map['droppables'] = updated_droppables
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list for_statement identifier subscript attribute attribute identifier identifier identifier string string_start string_content string_end block if_statement comparison_operator subscript identifier string string_start string_content string_end identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment subscript attribute attribute identifier identifier identifier string string_start string_content string_end identifier
|
remove a droppable, given the id
|
def cmd_devid(self, args):
for p in self.mav_param.keys():
if p.startswith('COMPASS_DEV_ID'):
mp_util.decode_devid(self.mav_param[p], p)
if p.startswith('INS_') and p.endswith('_ID'):
mp_util.decode_devid(self.mav_param[p], p)
|
module function_definition identifier parameters identifier identifier block for_statement identifier call attribute attribute identifier identifier identifier argument_list block if_statement call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list subscript attribute identifier identifier identifier identifier if_statement boolean_operator 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 block expression_statement call attribute identifier identifier argument_list subscript attribute identifier identifier identifier identifier
|
decode device IDs from parameters
|
def webob_to_django_response(webob_response):
from django.http import HttpResponse
django_response = HttpResponse(
webob_response.app_iter,
content_type=webob_response.content_type,
status=webob_response.status_code,
)
for name, value in webob_response.headerlist:
django_response[name] = value
return django_response
|
module function_definition identifier parameters identifier block import_from_statement dotted_name identifier identifier dotted_name identifier expression_statement assignment identifier call identifier argument_list attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier for_statement pattern_list identifier identifier attribute identifier identifier block expression_statement assignment subscript identifier identifier identifier return_statement identifier
|
Returns a django response to the `webob_response`
|
def correct(self, image, keepSize=False, borderValue=0):
image = imread(image)
(h, w) = image.shape[:2]
mapx, mapy = self.getUndistortRectifyMap(w, h)
self.img = cv2.remap(image, mapx, mapy, cv2.INTER_LINEAR,
borderMode=cv2.BORDER_CONSTANT,
borderValue=borderValue
)
if not keepSize:
xx, yy, ww, hh = self.roi
self.img = self.img[yy: yy + hh, xx: xx + ww]
return self.img
|
module function_definition identifier parameters identifier identifier default_parameter identifier false default_parameter identifier integer block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment tuple_pattern identifier identifier subscript attribute identifier identifier slice integer expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list identifier identifier identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier identifier if_statement not_operator identifier block expression_statement assignment pattern_list identifier identifier identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier subscript attribute identifier identifier slice identifier binary_operator identifier identifier slice identifier binary_operator identifier identifier return_statement attribute identifier identifier
|
remove lens distortion from given image
|
def update(self):
if self.input_method == 'local':
if self._thread is None:
thread_is_running = False
else:
thread_is_running = self._thread.isAlive()
if self.timer_ports.finished() and not thread_is_running:
self._thread = ThreadScanner(self.stats)
self._thread.start()
if len(self.stats) > 0:
self.timer_ports = Timer(self.stats[0]['refresh'])
else:
self.timer_ports = Timer(0)
else:
pass
return self.stats
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier string string_start string_content string_end block if_statement comparison_operator attribute identifier identifier none block expression_statement assignment identifier false else_clause block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list if_statement boolean_operator call attribute attribute identifier identifier identifier argument_list not_operator identifier block expression_statement assignment attribute identifier identifier call identifier argument_list attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list if_statement comparison_operator call identifier argument_list attribute identifier identifier integer block expression_statement assignment attribute identifier identifier call identifier argument_list subscript subscript attribute identifier identifier integer string string_start string_content string_end else_clause block expression_statement assignment attribute identifier identifier call identifier argument_list integer else_clause block pass_statement return_statement attribute identifier identifier
|
Update the ports list.
|
def create_variable(descriptor):
if descriptor['type'] == 'continuous':
return ContinuousVariable(descriptor['name'], descriptor['domain'], descriptor.get('dimensionality', 1))
elif descriptor['type'] == 'bandit':
return BanditVariable(descriptor['name'], descriptor['domain'], descriptor.get('dimensionality', None))
elif descriptor['type'] == 'discrete':
return DiscreteVariable(descriptor['name'], descriptor['domain'], descriptor.get('dimensionality', 1))
elif descriptor['type'] == 'categorical':
return CategoricalVariable(descriptor['name'], descriptor['domain'], descriptor.get('dimensionality', 1))
else:
raise InvalidConfigError('Unknown variable type ' + descriptor['type'])
|
module function_definition identifier parameters identifier block if_statement comparison_operator subscript identifier string string_start string_content string_end string string_start string_content string_end block return_statement call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end integer elif_clause comparison_operator subscript identifier string string_start string_content string_end string string_start string_content string_end block return_statement call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end none elif_clause comparison_operator subscript identifier string string_start string_content string_end string string_start string_content string_end block return_statement call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end integer elif_clause comparison_operator subscript identifier string string_start string_content string_end string string_start string_content string_end block return_statement call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end integer else_clause block raise_statement call identifier argument_list binary_operator string string_start string_content string_end subscript identifier string string_start string_content string_end
|
Creates a variable from a dictionary descriptor
|
def strip_uri(repo):
splits = repo.split()
for idx in range(len(splits)):
if any(splits[idx].startswith(x)
for x in ('http://', 'https://', 'ftp://')):
splits[idx] = splits[idx].rstrip('/')
return ' '.join(splits)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list for_statement identifier call identifier argument_list call identifier argument_list identifier block if_statement call identifier generator_expression call attribute subscript identifier identifier identifier argument_list identifier for_in_clause identifier tuple string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end block expression_statement assignment subscript identifier identifier call attribute subscript identifier identifier identifier argument_list string string_start string_content string_end return_statement call attribute string string_start string_content string_end identifier argument_list identifier
|
Remove the trailing slash from the URI in a repo definition
|
def build_ebound_table(self):
cols = [
Column(name="E_MIN", dtype=float, data=self._emin, unit='MeV'),
Column(name="E_MAX", dtype=float, data=self._emax, unit='MeV'),
Column(name="E_REF", dtype=float, data=self._eref, unit='MeV'),
Column(name="REF_DNDE", dtype=float, data=self._ref_dnde,
unit='ph / (MeV cm2 s)'),
Column(name="REF_FLUX", dtype=float, data=self._ref_flux,
unit='ph / (cm2 s)'),
Column(name="REF_EFLUX", dtype=float, data=self._ref_eflux,
unit='MeV / (cm2 s)'),
Column(name="REF_NPRED", dtype=float, data=self._ref_npred,
unit='ph')
]
tab = Table(data=cols)
return tab
|
module function_definition identifier parameters identifier block expression_statement assignment identifier list call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier string string_start string_content string_end call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier string string_start string_content string_end call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier string string_start string_content string_end call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier string string_start string_content string_end call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier string string_start string_content string_end call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier string string_start string_content string_end call identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier return_statement identifier
|
Build and return an EBOUNDS table with the encapsulated data.
|
def connections(self):
conn = lambda x: str(x).replace('connection:', '')
return [conn(name) for name in self.sections()]
|
module function_definition identifier parameters identifier block expression_statement assignment identifier lambda lambda_parameters identifier call attribute call identifier argument_list identifier identifier argument_list string string_start string_content string_end string string_start string_end return_statement list_comprehension call identifier argument_list identifier for_in_clause identifier call attribute identifier identifier argument_list
|
Returns all of the loaded connections names as a list
|
def _CreateSingleValueCondition(self, value, operator):
if isinstance(value, str) or isinstance(value, unicode):
value = '"%s"' % value
return '%s %s %s' % (self._field, operator, value)
|
module function_definition identifier parameters identifier identifier identifier block if_statement boolean_operator call identifier argument_list identifier identifier call identifier argument_list identifier identifier block expression_statement assignment identifier binary_operator string string_start string_content string_end identifier return_statement binary_operator string string_start string_content string_end tuple attribute identifier identifier identifier identifier
|
Creates a single-value condition with the provided value and operator.
|
def column(m, linkpart):
assert linkpart in (0, 1, 2, 3)
seen = set()
for link in m.match():
val = link[linkpart]
if val not in seen:
seen.add(val)
yield val
|
module function_definition identifier parameters identifier identifier block assert_statement comparison_operator identifier tuple integer integer integer integer expression_statement assignment identifier call identifier argument_list for_statement identifier call attribute identifier identifier argument_list block expression_statement assignment identifier subscript identifier identifier if_statement comparison_operator identifier identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement yield identifier
|
Generate all parts of links according to the parameter
|
def _query(self, cmd, *datas):
cmd = Command(query=cmd)
return cmd.query(self._transport, self._protocol, *datas)
|
module function_definition identifier parameters identifier identifier list_splat_pattern identifier block expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier return_statement call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier list_splat identifier
|
Helper function to allow method queries.
|
def clean_aliases(ctx, force_yes):
inactive_aliases = []
for (alias, mapping) in six.iteritems(aliases_database):
if mapping.mapping is None:
continue
project = ctx.obj['projects_db'].get(mapping.mapping[0],
mapping.backend)
if (project is None or not project.is_active() or
(mapping.mapping[1] is not None
and project.get_activity(mapping.mapping[1]) is None)):
inactive_aliases.append(((alias, mapping), project))
if not inactive_aliases:
ctx.obj['view'].msg("No inactive aliases found.")
return
if not force_yes:
confirm = ctx.obj['view'].clean_inactive_aliases(inactive_aliases)
if force_yes or confirm:
ctx.obj['settings'].remove_aliases(
[item[0] for item in inactive_aliases]
)
ctx.obj['settings'].write_config()
ctx.obj['view'].msg("%d inactive aliases have been successfully"
" cleaned." % len(inactive_aliases))
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list for_statement tuple_pattern identifier identifier call attribute identifier identifier argument_list identifier block if_statement comparison_operator attribute identifier identifier none block continue_statement expression_statement assignment identifier call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list subscript attribute identifier identifier integer attribute identifier identifier if_statement parenthesized_expression boolean_operator boolean_operator comparison_operator identifier none not_operator call attribute identifier identifier argument_list parenthesized_expression boolean_operator comparison_operator subscript attribute identifier identifier integer none comparison_operator call attribute identifier identifier argument_list subscript attribute identifier identifier integer none block expression_statement call attribute identifier identifier argument_list tuple tuple identifier identifier identifier if_statement not_operator identifier block expression_statement call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list string string_start string_content string_end return_statement if_statement not_operator identifier block expression_statement assignment identifier call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list identifier if_statement boolean_operator identifier identifier block expression_statement call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list list_comprehension subscript identifier integer for_in_clause identifier identifier expression_statement call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list expression_statement call attribute subscript attribute identifier identifier string string_start string_content string_end 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
|
Removes aliases from your config file that point to inactive projects.
|
def show(cls, msg=None):
if msg:
cls.add(msg)
cls.overlay.show()
cls.overlay.el.bind("click", lambda x: cls.hide())
cls.el.style.display = "block"
cls.bind()
|
module function_definition identifier parameters identifier default_parameter identifier none block if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list string string_start string_content string_end lambda lambda_parameters identifier call attribute identifier identifier argument_list expression_statement assignment attribute attribute attribute identifier identifier identifier identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list
|
Show the log interface on the page.
|
def from_name_re(cls, path:PathOrStr, fnames:FilePathList, pat:str, valid_pct:float=0.2, **kwargs):
"Create from list of `fnames` in `path` with re expression `pat`."
pat = re.compile(pat)
def _get_label(fn):
if isinstance(fn, Path): fn = fn.as_posix()
res = pat.search(str(fn))
assert res,f'Failed to find "{pat}" in "{fn}"'
return res.group(1)
return cls.from_name_func(path, fnames, _get_label, valid_pct=valid_pct, **kwargs)
|
module function_definition identifier parameters identifier typed_parameter identifier type identifier typed_parameter identifier type identifier typed_parameter identifier type identifier typed_default_parameter identifier type identifier float dictionary_splat_pattern identifier block expression_statement string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list identifier function_definition identifier parameters identifier block if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list call identifier argument_list identifier assert_statement identifier string string_start string_content interpolation identifier string_content interpolation identifier string_content string_end return_statement call attribute identifier identifier argument_list integer return_statement call attribute identifier identifier argument_list identifier identifier identifier keyword_argument identifier identifier dictionary_splat identifier
|
Create from list of `fnames` in `path` with re expression `pat`.
|
def audit_ghosts(self):
print_header = True
for app_name in self._get_ghosts():
if print_header:
print_header = False
print (
"Found the following in the state database but not "
"available as a configured job:"
)
print "\t%s" % (app_name,)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier true for_statement identifier call attribute identifier identifier argument_list block if_statement identifier block expression_statement assignment identifier false expression_statement call identifier argument_list concatenated_string string string_start string_content string_end string string_start string_content string_end print_statement binary_operator string string_start string_content escape_sequence string_end tuple identifier
|
compare the list of configured jobs with the jobs in the state
|
def which(fname):
if "PATH" not in os.environ or not os.environ["PATH"]:
path = os.defpath
else:
path = os.environ["PATH"]
for p in [fname] + [os.path.join(x, fname) for x in path.split(os.pathsep)]:
p = os.path.abspath(p)
if os.access(p, os.X_OK) and not os.path.isdir(p):
return p
p = sp.Popen("locate %s" % fname, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
(stdout, stderr) = p.communicate()
if not stderr:
for p in stdout.decode().split("\n"):
if (os.path.basename(p) == fname) and (
os.access(p, os.X_OK)) and (
not os.path.isdir(p)):
return p
|
module function_definition identifier parameters identifier block if_statement boolean_operator comparison_operator string string_start string_content string_end attribute identifier identifier not_operator subscript attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier attribute identifier identifier else_clause block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end for_statement identifier binary_operator list identifier list_comprehension call attribute attribute identifier identifier identifier argument_list identifier identifier for_in_clause identifier call attribute identifier identifier argument_list attribute identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier if_statement boolean_operator call attribute identifier identifier argument_list identifier attribute identifier identifier not_operator call attribute attribute identifier identifier identifier argument_list identifier block return_statement identifier expression_statement assignment identifier call attribute identifier identifier argument_list binary_operator string string_start string_content string_end identifier keyword_argument identifier true keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier expression_statement assignment tuple_pattern identifier identifier call attribute identifier identifier argument_list if_statement not_operator identifier block for_statement identifier call attribute call attribute identifier identifier argument_list identifier argument_list string string_start string_content escape_sequence string_end block if_statement boolean_operator boolean_operator parenthesized_expression comparison_operator call attribute attribute identifier identifier identifier argument_list identifier identifier parenthesized_expression call attribute identifier identifier argument_list identifier attribute identifier identifier parenthesized_expression not_operator call attribute attribute identifier identifier identifier argument_list identifier block return_statement identifier
|
Find location of executable.
|
def _get(operation: Operation, url=URL, **params):
prepped_request = _prep_get(operation, url=url, **params)
return cgi.send(prepped_request)
|
module function_definition identifier parameters typed_parameter identifier type identifier default_parameter identifier identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call identifier argument_list identifier keyword_argument identifier identifier dictionary_splat identifier return_statement call attribute identifier identifier argument_list identifier
|
HTTP GET of the FlashAir command.cgi entrypoint
|
def _estimate_strains(self):
for l in self._profile:
l.reset()
l.strain = self._motion.pgv / l.initial_shear_vel
|
module function_definition identifier parameters identifier block for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier binary_operator attribute attribute identifier identifier identifier attribute identifier identifier
|
Compute an estimate of the strains.
|
def from_analysis_period(cls, analysis_period, tau_b, tau_d,
daylight_savings_indicator='No'):
_check_analysis_period(analysis_period)
return cls(analysis_period.st_month, analysis_period.st_day, tau_b, tau_d,
daylight_savings_indicator)
|
module function_definition identifier parameters identifier identifier identifier identifier default_parameter identifier string string_start string_content string_end block expression_statement call identifier argument_list identifier return_statement call identifier argument_list attribute identifier identifier attribute identifier identifier identifier identifier identifier
|
Initialize a RevisedClearSkyCondition from an analysis_period
|
def export_data(self):
data_tuples = ((key, self._serialize(key, value))
for key, value in six.iteritems(self._data))
data_tuples = filter(lambda t: t[1] is not '', data_tuples)
data = dict(data_tuples)
return json.dumps(data, separators=(',', ':'))
|
module function_definition identifier parameters identifier block expression_statement assignment identifier generator_expression tuple identifier call attribute identifier identifier argument_list identifier identifier for_in_clause pattern_list identifier identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier call identifier argument_list lambda lambda_parameters identifier comparison_operator subscript identifier integer string string_start string_end identifier expression_statement assignment identifier call identifier argument_list identifier return_statement call attribute identifier identifier argument_list identifier keyword_argument identifier tuple string string_start string_content string_end string string_start string_content string_end
|
Exports current data contained in the Task as JSON
|
def next(self):
if self._stopped_iteration:
raise StopIteration()
while True:
try:
chunk = self.process._pipe_queue.get(True, 0.001)
except Empty:
if self.call_args["iter_noblock"]:
return errno.EWOULDBLOCK
else:
if chunk is None:
self.wait()
self._stopped_iteration = True
raise StopIteration()
try:
return chunk.decode(self.call_args["encoding"],
self.call_args["decode_errors"])
except UnicodeDecodeError:
return chunk
|
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block raise_statement call identifier argument_list while_statement true block try_statement block expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list true float except_clause identifier block if_statement subscript attribute identifier identifier string string_start string_content string_end block return_statement attribute identifier identifier else_clause block if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier true raise_statement call identifier argument_list try_statement block return_statement call attribute identifier identifier argument_list subscript attribute identifier identifier string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end except_clause identifier block return_statement identifier
|
allow us to iterate over the output of our command
|
def _if(cls, verb):
pred = verb.predicate
data = verb.data
groups = set(_get_groups(verb))
if isinstance(pred, str):
if not pred.endswith('_dtype'):
pred = '{}_dtype'.format(pred)
pred = getattr(pdtypes, pred)
elif pdtypes.is_bool_dtype(np.array(pred)):
it = iter(pred)
def pred(col):
return next(it)
return [col for col in data
if pred(data[col]) and col not in groups]
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list call identifier argument_list identifier if_statement call identifier argument_list identifier identifier block if_statement not_operator call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier identifier elif_clause call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier block expression_statement assignment identifier call identifier argument_list identifier function_definition identifier parameters identifier block return_statement call identifier argument_list identifier return_statement list_comprehension identifier for_in_clause identifier identifier if_clause boolean_operator call identifier argument_list subscript identifier identifier comparison_operator identifier identifier
|
A verb with a predicate function
|
def create_dialog(self):
self.bbox = QDialogButtonBox(QDialogButtonBox.Close)
self.idx_close = self.bbox.button(QDialogButtonBox.Close)
self.idx_close.pressed.connect(self.reject)
btnlayout = QHBoxLayout()
btnlayout.addStretch(1)
btnlayout.addWidget(self.bbox)
layout = QVBoxLayout()
layout.addWidget(self.toolbar)
layout.addWidget(self.canvas)
layout.addLayout(btnlayout)
layout.addStretch(1)
self.setLayout(layout)
|
module function_definition identifier parameters identifier block expression_statement assignment attribute identifier identifier call identifier argument_list attribute identifier identifier expression_statement assignment attribute identifier identifier call attribute attribute identifier identifier identifier argument_list attribute identifier identifier expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier call identifier argument_list expression_statement call attribute identifier identifier argument_list integer expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier call identifier argument_list 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 identifier expression_statement call attribute identifier identifier argument_list integer expression_statement call attribute identifier identifier argument_list identifier
|
Create the basic dialog.
|
def freeze(self, number=None):
if number is None:
number = self.head_layers
for idx, child in enumerate(self.model.children()):
if idx < number:
mu.freeze_layer(child)
|
module function_definition identifier parameters identifier default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement assignment identifier attribute identifier identifier for_statement pattern_list identifier identifier call identifier argument_list call attribute attribute identifier identifier identifier argument_list block if_statement comparison_operator identifier identifier block expression_statement call attribute identifier identifier argument_list identifier
|
Freeze given number of layers in the model
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.