code
stringlengths 51
2.34k
| sequence
stringlengths 186
3.94k
| docstring
stringlengths 11
171
|
|---|---|---|
def _readable(self):
if not self.candidates:
logger.info("No candidates found in document.")
return self._handle_no_candidates()
best_candidates = sorted(
(c for c in self.candidates.values()),
key=attrgetter("content_score"), reverse=True)
printer = PrettyPrinter(indent=2)
logger.debug(printer.pformat(best_candidates))
winner = best_candidates[0]
updated_winner = check_siblings(winner, self.candidates)
updated_winner.node = prep_article(updated_winner.node)
if updated_winner.node is not None:
dom = build_base_document(
updated_winner.node, self._return_fragment)
else:
logger.info(
'Had candidates but failed to find a cleaned winning DOM.')
dom = self._handle_no_candidates()
return self._remove_orphans(dom.get_element_by_id("readabilityBody"))
|
module function_definition identifier parameters identifier block if_statement not_operator attribute identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end return_statement call attribute identifier identifier argument_list expression_statement assignment identifier call identifier argument_list generator_expression identifier for_in_clause identifier call attribute attribute identifier identifier identifier argument_list keyword_argument identifier call identifier argument_list string string_start string_content string_end keyword_argument identifier true expression_statement assignment identifier call identifier argument_list keyword_argument identifier integer expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier expression_statement assignment identifier subscript identifier integer expression_statement assignment identifier call identifier argument_list identifier attribute identifier identifier expression_statement assignment attribute identifier identifier call identifier argument_list attribute identifier identifier if_statement comparison_operator attribute identifier identifier none block expression_statement assignment identifier call identifier argument_list attribute identifier identifier attribute identifier identifier else_clause block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list return_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end
|
The readable parsed article
|
def create_subnode(self, data):
return self.__class__(data,
axis=self.sel_axis(self.axis),
sel_axis=self.sel_axis,
dimensions=self.dimensions)
|
module function_definition identifier parameters identifier identifier block return_statement call attribute identifier identifier argument_list identifier keyword_argument identifier call attribute identifier identifier argument_list attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier
|
Creates a subnode for the current node
|
def _send_status_0x01_request(self):
status_command = StandardSend(self._address,
COMMAND_LIGHT_STATUS_REQUEST_0X19_0X01)
self._send_method(status_command, self._status_message_0x01_received)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list attribute identifier identifier identifier expression_statement call attribute identifier identifier argument_list identifier attribute identifier identifier
|
Sent status request to device.
|
def subscribe(self, transport, data):
self.add(transport, address=data.get('hx_subscribe').encode())
self.send(
data['hx_subscribe'],
{'message': "%r is listening" % transport}
)
|
module function_definition identifier parameters identifier identifier identifier block expression_statement call attribute identifier identifier argument_list identifier keyword_argument identifier call attribute call attribute identifier identifier argument_list string string_start string_content string_end identifier argument_list expression_statement call attribute identifier identifier argument_list subscript identifier string string_start string_content string_end dictionary pair string string_start string_content string_end binary_operator string string_start string_content string_end identifier
|
adds a transport to a channel
|
def validateAQLQuery(self, query, bindVars = None, options = None) :
"returns the server answer is the query is valid. Raises an AQLQueryError if not"
if bindVars is None :
bindVars = {}
if options is None :
options = {}
payload = {'query' : query, 'bindVars' : bindVars, 'options' : options}
r = self.connection.session.post(self.cursorsURL, data = json.dumps(payload, default=str))
data = r.json()
if r.status_code == 201 and not data["error"] :
return data
else :
raise AQLQueryError(data["errorMessage"], query, data)
|
module function_definition identifier parameters identifier identifier default_parameter identifier none default_parameter identifier none block expression_statement string string_start string_content string_end if_statement comparison_operator identifier none block expression_statement assignment identifier dictionary if_statement comparison_operator identifier none block expression_statement assignment identifier dictionary expression_statement assignment 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 expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list attribute identifier identifier keyword_argument identifier call attribute identifier identifier argument_list identifier keyword_argument identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list if_statement boolean_operator comparison_operator attribute identifier identifier integer not_operator subscript identifier string string_start string_content string_end block return_statement identifier else_clause block raise_statement call identifier argument_list subscript identifier string string_start string_content string_end identifier identifier
|
returns the server answer is the query is valid. Raises an AQLQueryError if not
|
def nqueen_graph(self):
nqueens = self.results
for piece_label in set(PIECE_LABELS).difference(['queen']):
nqueens = nqueens[nqueens[piece_label].map(pandas.isnull)]
nqueens = nqueens[nqueens['length'] == nqueens['queen']]
nqueens = nqueens[nqueens['height'] == nqueens['queen']]
for label, value in self.context.items():
if not value:
nqueens = nqueens[nqueens[label].map(pandas.isnull)]
else:
nqueens = nqueens[nqueens[label] == value]
plot = seaborn.factorplot(
x='queen',
y='execution_time',
data=nqueens.sort(columns='queen'),
estimator=median,
kind='bar',
palette='BuGn_d',
aspect=1.5)
plot.set_xlabels('Number of queens')
plot.set_ylabels('Solving time in seconds (log scale)')
plot.fig.get_axes()[0].set_yscale('log')
plot.savefig('nqueens-performances.png')
|
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier for_statement identifier call attribute call identifier argument_list identifier identifier argument_list list string string_start string_content string_end block expression_statement assignment identifier subscript identifier call attribute subscript identifier identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier subscript identifier comparison_operator subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end expression_statement assignment identifier subscript identifier comparison_operator subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end for_statement pattern_list identifier identifier call attribute attribute identifier identifier identifier argument_list block if_statement not_operator identifier block expression_statement assignment identifier subscript identifier call attribute subscript identifier identifier identifier argument_list attribute identifier identifier else_clause block expression_statement assignment identifier subscript identifier comparison_operator subscript identifier identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier string string_start string_content string_end keyword_argument identifier call attribute identifier identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier string string_start string_content string_end keyword_argument identifier string string_start string_content string_end keyword_argument identifier float expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute subscript call attribute attribute identifier identifier identifier argument_list integer identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end
|
Graph n-queens problem for the current version and context.
|
def validate(cls, partial=True, **kwargs):
data = kwargs
if not partial:
data = dict(**kwargs, **{col.name: None for col in cls.__table__.c
if col.name not in kwargs})
errors = defaultdict(list)
for name, value in data.items():
for validator in cls._get_validators(name):
try:
validator(value)
except ValidationError as e:
e.model = cls
e.column = name
errors[name].append(str(e))
if errors:
raise ValidationErrors(errors)
|
module function_definition identifier parameters identifier default_parameter identifier true dictionary_splat_pattern identifier block expression_statement assignment identifier identifier if_statement not_operator identifier block expression_statement assignment identifier call identifier argument_list dictionary_splat identifier dictionary_splat dictionary_comprehension pair attribute identifier identifier none for_in_clause identifier attribute attribute identifier identifier identifier if_clause comparison_operator attribute identifier identifier identifier expression_statement assignment identifier call identifier argument_list identifier for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block for_statement identifier call attribute identifier identifier argument_list identifier block try_statement block expression_statement call identifier argument_list identifier except_clause as_pattern identifier as_pattern_target identifier block expression_statement assignment attribute identifier identifier identifier expression_statement assignment attribute identifier identifier identifier expression_statement call attribute subscript identifier identifier identifier argument_list call identifier argument_list identifier if_statement identifier block raise_statement call identifier argument_list identifier
|
Validate kwargs before setting attributes on the model
|
def forcemigrate(app=None):
if app is None:
abort("No app name given.")
local("./manage.py migrate {} --fake".format(app))
local("./manage.py migrate {}".format(app))
|
module function_definition identifier parameters default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier
|
Force migrations to apply for a given app.
|
def from_disk_add_path(self, path=None, resource_list=None):
if (path is None or resource_list is None or self.mapper is None):
raise ValueError("Must specify path, resource_list and mapper")
if (sys.version_info < (3, 0)):
path = path.decode('utf-8')
if os.path.isdir(path):
num_files = 0
for dirpath, dirs, files in os.walk(path, topdown=True):
for file_in_dirpath in files:
num_files += 1
if (num_files % 50000 == 0):
self.logger.info(
"ResourceListBuilder.from_disk_add_path: %d files..." % (num_files))
self.add_file(resource_list=resource_list,
dir=dirpath, file=file_in_dirpath)
for exclude in self.exclude_dirs:
if exclude in dirs:
self.logger.debug("Excluding dir %s" % (exclude))
dirs.remove(exclude)
else:
self.add_file(resource_list=resource_list, file=path)
|
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none block if_statement parenthesized_expression boolean_operator boolean_operator comparison_operator identifier none comparison_operator identifier none comparison_operator attribute identifier identifier none block raise_statement call identifier argument_list string string_start string_content string_end if_statement parenthesized_expression comparison_operator attribute identifier identifier tuple integer integer block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement assignment identifier integer for_statement pattern_list identifier identifier identifier call attribute identifier identifier argument_list identifier keyword_argument identifier true block for_statement identifier identifier block expression_statement augmented_assignment identifier integer if_statement parenthesized_expression comparison_operator binary_operator identifier integer integer block expression_statement call attribute attribute identifier identifier identifier argument_list binary_operator string string_start string_content string_end parenthesized_expression identifier expression_statement call attribute identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier for_statement identifier attribute identifier identifier block if_statement comparison_operator identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list binary_operator string string_start string_content string_end parenthesized_expression identifier expression_statement call attribute identifier identifier argument_list identifier else_clause block expression_statement call attribute identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier
|
Add to resource_list with resources from disk scan starting at path.
|
def rest_get(self, url, params=None, headers=None, auth=None, verify=True, cert=None):
res = requests.get(url, params=params, headers=headers, auth=auth, verify=verify,
cert=cert)
return res.text, res.status_code
|
module function_definition identifier parameters identifier identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier true default_parameter identifier none block expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier return_statement expression_list attribute identifier identifier attribute identifier identifier
|
Perform a GET request to url with optional authentication
|
def open_files(filenames):
command = ['open'] + filenames
process = Popen(command, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
|
module function_definition identifier parameters identifier block expression_statement assignment identifier binary_operator list string string_start string_content string_end identifier expression_statement assignment identifier call identifier argument_list identifier keyword_argument identifier identifier keyword_argument identifier identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list
|
Call the system 'open' command on a file.
|
def _init_edges_relationships(rel2src2dsts, rel2dst2srcs):
edge_rel2fromto = {}
relationships = set(rel2src2dsts).union(rel2dst2srcs)
for reltype in relationships:
edge_from_to = []
if reltype in rel2src2dsts:
for parent, children in rel2src2dsts[reltype].items():
for child in children:
edge_from_to.append((child, parent))
if reltype in rel2dst2srcs:
for parent, children in rel2dst2srcs[reltype].items():
for child in children:
edge_from_to.append((child, parent))
edge_rel2fromto[reltype] = edge_from_to
return edge_rel2fromto
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier dictionary expression_statement assignment identifier call attribute call identifier argument_list identifier identifier argument_list identifier for_statement identifier identifier block expression_statement assignment identifier list if_statement comparison_operator identifier identifier block for_statement pattern_list identifier identifier call attribute subscript identifier identifier identifier argument_list block for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list tuple identifier identifier if_statement comparison_operator identifier identifier block for_statement pattern_list identifier identifier call attribute subscript identifier identifier identifier argument_list block for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list tuple identifier identifier expression_statement assignment subscript identifier identifier identifier return_statement identifier
|
Get the directed edges from GO term to GO term using relationships.
|
def vtquery(apikey, checksums):
data = {'apikey': apikey,
'resource': isinstance(checksums, str) and checksums
or ', '.join(checksums)}
while 1:
response = requests.post(VT_REPORT_URL, data=data)
response.raise_for_status()
if response.status_code == 200:
return response.json()
elif response.status_code == 204:
logging.debug("API key request rate limit reached, throttling.")
time.sleep(VT_THROTTLE)
else:
raise RuntimeError("Response status code %s" % response.status_code)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end boolean_operator boolean_operator call identifier argument_list identifier identifier identifier call attribute string string_start string_content string_end identifier argument_list identifier while_statement integer block expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier identifier expression_statement call attribute identifier identifier argument_list if_statement comparison_operator attribute identifier identifier integer block return_statement call attribute identifier identifier argument_list elif_clause comparison_operator attribute identifier identifier integer block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier else_clause block raise_statement call identifier argument_list binary_operator string string_start string_content string_end attribute identifier identifier
|
Performs the query dealing with errors and throttling requests.
|
def deleteSNPs(setName) :
con = conf.db
try :
SMaster = SNPMaster(setName = setName)
con.beginTransaction()
SNPType = SMaster.SNPType
con.delete(SNPType, 'setName = ?', (setName,))
SMaster.delete()
con.endTransaction()
except KeyError :
raise KeyError("Can't delete the setName %s because i can't find it in SNPMaster, maybe there's not set by that name" % setName)
return False
return True
|
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier try_statement block expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier string string_start string_content string_end tuple identifier expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list except_clause identifier block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier return_statement false return_statement true
|
deletes a set of polymorphisms
|
def drop_columns(records, slices):
for record in records:
drop = set(i for slice in slices
for i in range(*slice.indices(len(record))))
keep = [i not in drop for i in range(len(record))]
record.seq = Seq(''.join(itertools.compress(record.seq, keep)), record.seq.alphabet)
yield record
|
module function_definition identifier parameters identifier identifier block for_statement identifier identifier block expression_statement assignment identifier call identifier generator_expression identifier for_in_clause identifier identifier for_in_clause identifier call identifier argument_list list_splat call attribute identifier identifier argument_list call identifier argument_list identifier expression_statement assignment identifier list_comprehension comparison_operator identifier identifier for_in_clause identifier call identifier argument_list call identifier argument_list identifier expression_statement assignment attribute identifier identifier call identifier argument_list call attribute string string_start string_end identifier argument_list call attribute identifier identifier argument_list attribute identifier identifier identifier attribute attribute identifier identifier identifier expression_statement yield identifier
|
Drop all columns present in ``slices`` from records
|
def delete_external_nodes(sender, **kwargs):
node = kwargs['instance']
if node.layer.is_external is False or not hasattr(node.layer, 'external') or node.layer.external.synchronizer_path is None:
return False
if hasattr(node, 'external') and node.external.external_id:
push_changes_to_external_layers.delay(
node=node.external.external_id,
external_layer=node.layer.external,
operation='delete'
)
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement assignment identifier subscript identifier string string_start string_content string_end if_statement boolean_operator boolean_operator comparison_operator attribute attribute identifier identifier identifier false not_operator call identifier argument_list attribute identifier identifier string string_start string_content string_end comparison_operator attribute attribute attribute identifier identifier identifier identifier none block return_statement false if_statement boolean_operator call identifier argument_list identifier string string_start string_content string_end attribute attribute identifier identifier identifier block expression_statement call attribute identifier identifier argument_list keyword_argument identifier attribute attribute identifier identifier identifier keyword_argument identifier attribute attribute identifier identifier identifier keyword_argument identifier string string_start string_content string_end
|
sync by deleting nodes from external layers when needed
|
def sendhello(self):
try:
cli_hello_msg = "<hello>\n" +\
" <capabilities>\n" +\
" <capability>urn:ietf:params:netconf:base:1.0</capability>\n" +\
" </capabilities>\n" +\
"</hello>\n"
self._cParams.set('cli_hello', cli_hello_msg)
self._hConn.sendmsg(cli_hello_msg)
ser_hello_msg = self._hConn.recvmsg()
self._cParams.set('ser_hello', ser_hello_msg)
except:
print 'BNClient: Call sendhello fail'
sys.exit()
|
module function_definition identifier parameters identifier block try_statement block expression_statement assignment identifier binary_operator binary_operator binary_operator binary_operator string string_start string_content escape_sequence string_end string string_start string_content escape_sequence string_end string string_start string_content escape_sequence string_end string string_start string_content escape_sequence string_end string string_start string_content escape_sequence string_end expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end identifier except_clause block print_statement string string_start string_content string_end expression_statement call attribute identifier identifier argument_list
|
end of function exchgcaps
|
def _create_logger_(name):
logger = logging.getLogger(name)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(levelname)s %(message)s'))
logger.addHandler(handler)
logger.setLevel(logging.INFO)
return logger
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier return_statement identifier
|
Implementation detail, creates a logger.
|
def handle_legacy_tloc(line: str, position: int, tokens: ParseResults) -> ParseResults:
log.log(5, 'legacy translocation statement: %s [%d]', line, position)
return tokens
|
module function_definition identifier parameters typed_parameter identifier type identifier typed_parameter identifier type identifier typed_parameter identifier type identifier type identifier block expression_statement call attribute identifier identifier argument_list integer string string_start string_content string_end identifier identifier return_statement identifier
|
Handle translocations that lack the ``fromLoc`` and ``toLoc`` entries.
|
def _on_leave(self, *args):
if self.__clicked:
self.config(foreground=self._clicked_color)
else:
self.config(foreground=self._normal_color)
self.config(cursor="")
|
module function_definition identifier parameters identifier list_splat_pattern identifier block if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list keyword_argument identifier attribute identifier identifier else_clause block expression_statement call attribute identifier identifier argument_list keyword_argument identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list keyword_argument identifier string string_start string_end
|
Set the text color to either the normal color when not clicked or the clicked color when clicked.
|
def run_gvcftyper(vrn_files, out_file, region, data):
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
license = license_export(data)
ref_file = dd.get_ref_file(data)
input_files = " ".join(vrn_files)
region = bamprep.region_to_gatk(region)
cmd = ("{license}sentieon driver -r {ref_file} --interval {region} "
"--algo GVCFtyper {tx_out_file} {input_files}")
do.run(cmd.format(**locals()), "Sentieon GVCFtyper")
return out_file
|
module function_definition identifier parameters identifier identifier identifier identifier block if_statement not_operator call attribute identifier identifier argument_list identifier block with_statement with_clause with_item as_pattern call identifier argument_list identifier identifier as_pattern_target identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier parenthesized_expression concatenated_string string string_start string_content string_end string string_start string_content string_end expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list dictionary_splat call identifier argument_list string string_start string_content string_end return_statement identifier
|
Produce joint called variants from input gVCF files.
|
def _read_response(self, may_block=False):
res = self._waitfor_set(yubikey_defs.RESP_PENDING_FLAG, may_block)[:7]
while True:
this = self._read()
flags = yubico_util.ord_byte(this[7])
if flags & yubikey_defs.RESP_PENDING_FLAG:
seq = flags & 0b00011111
if res and (seq == 0):
break
res += this[:7]
else:
break
self._write_reset()
return res
|
module function_definition identifier parameters identifier default_parameter identifier false block expression_statement assignment identifier subscript call attribute identifier identifier argument_list attribute identifier identifier identifier slice integer while_statement true block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list subscript identifier integer if_statement binary_operator identifier attribute identifier identifier block expression_statement assignment identifier binary_operator identifier integer if_statement boolean_operator identifier parenthesized_expression comparison_operator identifier integer block break_statement expression_statement augmented_assignment identifier subscript identifier slice integer else_clause block break_statement expression_statement call attribute identifier identifier argument_list return_statement identifier
|
Wait for a response to become available, and read it.
|
def _cwl_workflow_template(inputs, top_level=False):
ready_inputs = []
for inp in inputs:
cur_inp = copy.deepcopy(inp)
for attr in ["source", "valueFrom", "wf_duplicate"]:
cur_inp.pop(attr, None)
if top_level:
cur_inp = workflow._flatten_nested_input(cur_inp)
cur_inp = _clean_record(cur_inp)
ready_inputs.append(cur_inp)
return {"class": "Workflow",
"cwlVersion": "v1.0",
"hints": [],
"requirements": [{"class": "EnvVarRequirement",
"envDef": [{"envName": "MPLCONFIGDIR", "envValue": "."}]},
{"class": "ScatterFeatureRequirement"},
{"class": "SubworkflowFeatureRequirement"}],
"inputs": ready_inputs,
"outputs": [],
"steps": []}
|
module function_definition identifier parameters identifier default_parameter identifier false block expression_statement assignment identifier list for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier for_statement identifier list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list identifier none if_statement identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier 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 string string_start string_content string_end pair string string_start string_content string_end list pair string string_start string_content string_end list dictionary pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end list dictionary pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end dictionary pair string string_start string_content string_end string string_start string_content string_end 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 list pair string string_start string_content string_end list
|
Retrieve CWL inputs shared amongst different workflows.
|
def handle_command(editor, input_string):
m = COMMAND_GRAMMAR.match(input_string)
if m is None:
return
variables = m.variables()
command = variables.get('command')
go_to_line = variables.get('go_to_line')
shell_command = variables.get('shell_command')
if go_to_line is not None:
_go_to_line(editor, go_to_line)
elif shell_command is not None:
editor.application.run_system_command(shell_command)
elif has_command_handler(command):
call_command_handler(command, editor, variables)
else:
editor.show_message('Not an editor command: %s' % input_string)
return
editor.sync_with_prompt_toolkit()
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier none block return_statement expression_statement assignment identifier call attribute identifier identifier argument_list 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 identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator identifier none block expression_statement call identifier argument_list identifier identifier elif_clause comparison_operator identifier none block expression_statement call attribute attribute identifier identifier identifier argument_list identifier elif_clause call identifier argument_list identifier block expression_statement call identifier argument_list identifier identifier identifier else_clause block expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end identifier return_statement expression_statement call attribute identifier identifier argument_list
|
Handle commands entered on the Vi command line.
|
def fit_traptransit(ts,fs,p0):
pfit,success = leastsq(traptransit_resid,p0,args=(ts,fs))
if success not in [1,2,3,4]:
raise NoFitError
return pfit
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment pattern_list identifier identifier call identifier argument_list identifier identifier keyword_argument identifier tuple identifier identifier if_statement comparison_operator identifier list integer integer integer integer block raise_statement identifier return_statement identifier
|
Fits trapezoid model to provided ts,fs
|
def make_movie(workdir, pf, dpi=120, fps=1, format="pdf", engine="ffmpeg"):
os.chdir(workdir)
if format != "png":
cmd = "parallel convert -density {}".format(dpi)
cmd += " {} {.}.png ::: " + "*.{}".format(format)
sh(cmd)
assert engine in ("ffmpeg", "gifsicle"), \
"Only ffmpeg or gifsicle is currently supported"
if engine == "ffmpeg":
cmd = "ffmpeg -framerate {} -pattern_type glob -i '*.png' {}.mp4"\
.format(fps, pf)
elif engine == "gifsicle":
cmd = "convert *.png gif:- |"
cmd += " gifsicle --delay {} --loop --optimize=3".format(100 / fps)
cmd += " --colors=256 --multifile - > {}.gif".format(pf)
sh(cmd)
|
module function_definition identifier parameters identifier identifier default_parameter identifier integer default_parameter identifier integer default_parameter identifier string string_start string_content string_end default_parameter identifier string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier 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 augmented_assignment identifier binary_operator string string_start string_content string_end call attribute string string_start string_content string_end identifier argument_list identifier expression_statement call identifier argument_list identifier assert_statement comparison_operator identifier tuple string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end if_statement comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier call attribute string string_start string_content string_end line_continuation identifier argument_list identifier identifier elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier string string_start string_content string_end expression_statement augmented_assignment identifier call attribute string string_start string_content string_end identifier argument_list binary_operator integer identifier expression_statement augmented_assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier expression_statement call identifier argument_list identifier
|
Make the movie using either ffmpeg or gifsicle.
|
def gather_meta(self):
if not os.path.exists(self.paths["meta"]):
return ""
meta_dict = utils.yaml_load(self.paths["meta"])
if meta_dict and "dependencies" in meta_dict:
dep_list = []
for dependency in meta_dict["dependencies"]:
if type(dependency) is dict:
dep_list.append(dependency["role"])
else:
dep_list.append(dependency)
meta_dict["dependencies"] = list(set(dep_list))
self.dependencies = meta_dict["dependencies"]
else:
self.dependencies = []
return utils.file_to_string(self.paths["meta"])
|
module function_definition identifier parameters identifier block if_statement not_operator call attribute attribute identifier identifier identifier argument_list subscript attribute identifier identifier string string_start string_content string_end block return_statement string string_start string_end expression_statement assignment identifier call attribute identifier identifier argument_list subscript attribute identifier identifier string string_start string_content string_end if_statement boolean_operator identifier comparison_operator string string_start string_content string_end identifier block expression_statement assignment identifier list for_statement identifier subscript identifier string string_start string_content string_end block if_statement comparison_operator call identifier argument_list identifier identifier block expression_statement call attribute identifier identifier argument_list subscript identifier string string_start string_content string_end else_clause block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment subscript identifier string string_start string_content string_end call identifier argument_list call identifier argument_list identifier expression_statement assignment attribute identifier identifier subscript identifier string string_start string_content string_end else_clause block expression_statement assignment attribute identifier identifier list return_statement call attribute identifier identifier argument_list subscript attribute identifier identifier string string_start string_content string_end
|
Return the meta file.
|
def add_grant(self, grant):
if not isinstance(grant, AccessTokenGrant):
raise ValueError('Grant must be an instance of AccessTokenGrant.')
self.grants.append(grant)
|
module function_definition identifier parameters identifier identifier block if_statement not_operator call identifier argument_list identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list identifier
|
Add a grant to this AccessToken
|
def row_to_obj(self, row, cur):
obj = tornado.util.ObjectDict()
for val, desc in zip(row, cur.description):
obj[desc.name] = val
return obj
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list for_statement pattern_list identifier identifier call identifier argument_list identifier attribute identifier identifier block expression_statement assignment subscript identifier attribute identifier identifier identifier return_statement identifier
|
Convert a SQL row to an object supporting dict and attribute access.
|
async def startup(self, app):
self.local = slocal(app.loop)
if self.cfg.configure_jinja2 and 'jinja2' in app.ps:
app.ps.jinja2.env.add_extension('jinja2.ext.i18n')
app.ps.jinja2.env.install_gettext_callables(
lambda x: self.get_translations().ugettext(x),
lambda s, p, n: self.get_translations().ungettext(s, p, n),
newstyle=True
)
if self.locale_selector_func:
app.middlewares.append(self._middleware)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment attribute identifier identifier call identifier argument_list attribute identifier identifier if_statement boolean_operator attribute attribute identifier identifier identifier comparison_operator string string_start string_content string_end attribute identifier identifier block expression_statement call attribute attribute attribute attribute identifier identifier identifier identifier identifier argument_list string string_start string_content string_end expression_statement call attribute attribute attribute attribute identifier identifier identifier identifier identifier argument_list lambda lambda_parameters identifier call attribute call attribute identifier identifier argument_list identifier argument_list identifier lambda lambda_parameters identifier identifier identifier call attribute call attribute identifier identifier argument_list identifier argument_list identifier identifier identifier keyword_argument identifier true if_statement attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier
|
Initialize a local namespace and setup Jinja2.
|
def query_geonames_country(self, placename, country):
q = {"multi_match": {"query": placename,
"fields": ['name^5', 'asciiname^5', 'alternativenames'],
"type": "phrase"}}
res = self.conn.filter("term", country_code3=country).query(q)[0:50].execute()
if res.hits.total == 0:
q = {"multi_match": {"query": placename,
"fields": ['name', 'asciiname', 'alternativenames'],
"fuzziness": 1,
"operator": "and"}}
res = self.conn.filter("term", country_code3=country).query(q)[0:50].execute()
out = utilities.structure_results(res)
return out
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier dictionary pair string string_start string_content string_end dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier call attribute subscript call attribute call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end keyword_argument identifier identifier identifier argument_list identifier slice integer integer identifier argument_list if_statement comparison_operator attribute attribute identifier identifier identifier integer block expression_statement assignment identifier dictionary pair string string_start string_content string_end dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end integer pair string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier call attribute subscript call attribute call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end keyword_argument identifier identifier identifier argument_list identifier slice integer integer identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement identifier
|
Like query_geonames, but this time limited to a specified country.
|
def _advance_cluster_time(self, cluster_time):
if self._cluster_time is None:
self._cluster_time = cluster_time
elif cluster_time is not None:
if cluster_time["clusterTime"] > self._cluster_time["clusterTime"]:
self._cluster_time = cluster_time
|
module function_definition identifier parameters identifier identifier block if_statement comparison_operator attribute identifier identifier none block expression_statement assignment attribute identifier identifier identifier elif_clause comparison_operator identifier none block if_statement comparison_operator subscript identifier string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end block expression_statement assignment attribute identifier identifier identifier
|
Internal cluster time helper.
|
def start_parent():
while True:
args = [sys.executable] + sys.argv
new_environ = environ.copy()
new_environ["_IN_CHILD"] = 'yes'
ret = subprocess.call(args, env=new_environ)
if ret != settings.CODE_RELOAD_EXIT:
return ret
|
module function_definition identifier parameters block while_statement true block expression_statement assignment identifier binary_operator list attribute identifier identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier identifier if_statement comparison_operator identifier attribute identifier identifier block return_statement identifier
|
Start the parent that will simply run the child forever until stopped.
|
def add(self, items):
with _presub_lock:
self.load_from_cloud()
for entry in utils.ensure_listable(items):
if entry not in self.current:
self.current.append(entry)
self.save_to_cloud()
|
module function_definition identifier parameters identifier identifier block with_statement with_clause with_item identifier block expression_statement call attribute identifier identifier argument_list for_statement identifier call attribute identifier identifier argument_list identifier block if_statement comparison_operator identifier attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list
|
Add entry to global presubs list
|
def _checkremove_que(self, word):
in_que_pass_list = False
que_pass_list = ['atque',
'quoque',
'neque',
'itaque',
'absque',
'apsque',
'abusque',
'adaeque',
'adusque',
'denique',
'deque',
'susque',
'oblique',
'peraeque',
'plenisque',
'quandoque',
'quisque',
'quaeque',
'cuiusque',
'cuique',
'quemque',
'quamque',
'quaque',
'quique',
'quorumque',
'quarumque',
'quibusque',
'quosque',
'quasque',
'quotusquisque',
'quousque',
'ubique',
'undique',
'usque',
'uterque',
'utique',
'utroque',
'utribique',
'torque',
'coque',
'concoque',
'contorque',
'detorque',
'decoque',
'excoque',
'extorque',
'obtorque',
'optorque',
'retorque',
'recoque',
'attorque',
'incoque',
'intorque',
'praetorque']
if word not in que_pass_list:
word = re.sub(r'que$', '', word)
else:
in_que_pass_list = True
return word, in_que_pass_list
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier false 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 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 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 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 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 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 if_statement comparison_operator identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end identifier else_clause block expression_statement assignment identifier true return_statement expression_list identifier identifier
|
If word ends in -que and if word is not in pass list, strip -que
|
def GlorotUniformInitializer(out_dim=0, in_dim=1):
def init(shape, rng):
fan_in, fan_out = shape[in_dim], shape[out_dim]
std = np.sqrt(2.0 / (fan_in + fan_out))
a = np.sqrt(3.0) * std
return backend.random.uniform(rng, shape, minval=-a, maxval=a)
return init
|
module function_definition identifier parameters default_parameter identifier integer default_parameter identifier integer block function_definition identifier parameters identifier identifier block expression_statement assignment pattern_list identifier identifier expression_list subscript identifier identifier subscript identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list binary_operator float parenthesized_expression binary_operator identifier identifier expression_statement assignment identifier binary_operator call attribute identifier identifier argument_list float identifier return_statement call attribute attribute identifier identifier identifier argument_list identifier identifier keyword_argument identifier unary_operator identifier keyword_argument identifier identifier return_statement identifier
|
An initializer function for random uniform Glorot-scaled coefficients.
|
def save_new_channel(self):
form_info = self.input['form']
channel = Channel(typ=15, name=form_info['name'],
description=form_info['description'],
owner_id=form_info['owner_id'])
channel.blocking_save()
self.current.task_data['target_channel_key'] = channel.key
|
module function_definition identifier parameters identifier block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list keyword_argument identifier integer keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list expression_statement assignment subscript attribute attribute identifier identifier identifier string string_start string_content string_end attribute identifier identifier
|
It saves new channel according to specified channel features.
|
def render_table(output_dir, packages, jenv=JENV):
destination_filename = output_dir + "/com/swiftnav/sbp/client/MessageTable.java"
with open(destination_filename, 'w+') as f:
print(destination_filename)
f.write(jenv.get_template(TEMPLATE_TABLE_NAME).render(packages=packages))
|
module function_definition identifier parameters identifier identifier default_parameter identifier identifier block expression_statement assignment identifier binary_operator identifier string string_start string_content string_end with_statement with_clause with_item as_pattern call identifier argument_list identifier string string_start string_content string_end as_pattern_target identifier block expression_statement call identifier argument_list identifier expression_statement call attribute identifier identifier argument_list call attribute call attribute identifier identifier argument_list identifier identifier argument_list keyword_argument identifier identifier
|
Render and output dispatch table
|
def compose_post(apikey, resize, rotation, noexif):
check_rotation(rotation)
check_resize(resize)
post_data = {
'formatliste': ('', 'og'),
'userdrehung': ('', rotation),
'apikey': ('', apikey)
}
if resize and 'x' in resize:
width, height = [ x.strip() for x in resize.split('x')]
post_data['udefb'] = ('', width)
post_data['udefh'] = ('', height)
elif resize and '%' in resize:
precentage = resize.strip().strip('%')
post_data['udefp'] = precentage
if noexif:
post_data['noexif'] = ('', '')
return post_data
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier expression_statement assignment identifier dictionary pair string string_start string_content string_end tuple string string_start string_end string string_start string_content string_end pair string string_start string_content string_end tuple string string_start string_end identifier pair string string_start string_content string_end tuple string string_start string_end identifier if_statement boolean_operator identifier comparison_operator string string_start string_content string_end identifier block expression_statement assignment pattern_list identifier identifier list_comprehension call attribute identifier identifier argument_list for_in_clause identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end tuple string string_start string_end identifier expression_statement assignment subscript identifier string string_start string_content string_end tuple string string_start string_end identifier elif_clause boolean_operator identifier comparison_operator string string_start string_content string_end identifier block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list identifier argument_list string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end identifier if_statement identifier block expression_statement assignment subscript identifier string string_start string_content string_end tuple string string_start string_end string string_start string_end return_statement identifier
|
composes basic post requests
|
def to_dict(self):
as_dict = dict(self.payload or ())
as_dict['message'] = self.message
return as_dict
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list boolean_operator attribute identifier identifier tuple expression_statement assignment subscript identifier string string_start string_content string_end attribute identifier identifier return_statement identifier
|
Return a dictionary representation of the exception.
|
def makeService(self, options):
return BrokerService(
port=options['port'],
debug=options['debug'],
activate_ssh_server=options['activate-ssh-server'],
ssh_user=options['ssh-user'],
ssh_password=options['ssh-password'],
ssh_port=options['ssh-port']
)
|
module function_definition identifier parameters identifier identifier block return_statement call identifier argument_list keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end keyword_argument identifier subscript identifier string string_start string_content string_end
|
Construct a Broker Server
|
def overloaded(self, client_addr):
overloaded_txt = 'HTTP/1.0 429 Too Many Requests\r\nServer: BaseHTTP/0.3 Python/2.7.14+\r\nContent-type: text/plain\r\nContent-length: 17\r\n\r\nToo many requests'
if BLOCKSTACK_TEST:
log.warn('Too many requests; deflecting {}'.format(client_addr))
return overloaded_txt
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier string string_start string_content escape_sequence escape_sequence escape_sequence escape_sequence escape_sequence escape_sequence escape_sequence escape_sequence escape_sequence escape_sequence string_end if_statement identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier return_statement identifier
|
Deflect if we have too many inbound requests
|
def rename_keys(record: Mapping, key_map: Mapping) -> dict:
new_record = dict()
for k, v in record.items():
key = key_map[k] if k in key_map else k
new_record[key] = v
return new_record
|
module function_definition identifier parameters typed_parameter identifier type identifier typed_parameter identifier type identifier type identifier block expression_statement assignment identifier call identifier argument_list for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block expression_statement assignment identifier conditional_expression subscript identifier identifier comparison_operator identifier identifier identifier expression_statement assignment subscript identifier identifier identifier return_statement identifier
|
New record with same keys or renamed keys if key found in key_map.
|
def replace(self, name, newname):
if not re.match("[a-zA-Z]\w*", name):
return None
if not re.match("[a-zA-Z]\w*", newname):
return None
def _replace(match):
return match.group(0).replace(match.group('name'), newname)
pattern = re.compile("(\W|^)(?P<name>" + name + ")(\W|$)")
cut = re.sub(pattern, _replace, str(self))
return Cut(cut)
|
module function_definition identifier parameters identifier identifier identifier block if_statement not_operator call attribute identifier identifier argument_list string string_start string_content string_end identifier block return_statement none if_statement not_operator call attribute identifier identifier argument_list string string_start string_content string_end identifier block return_statement none function_definition identifier parameters identifier block return_statement call attribute call attribute identifier identifier argument_list integer identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier call attribute identifier identifier argument_list binary_operator binary_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 identifier identifier call identifier argument_list identifier return_statement call identifier argument_list identifier
|
Replace all occurrences of name with newname
|
def abbrev_hook(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
func = self.cmd_func(data.statement.command)
if func is None:
possible_cmds = [cmd for cmd in self.get_all_commands() if cmd.startswith(data.statement.command)]
if len(possible_cmds) == 1:
raw = data.statement.raw.replace(data.statement.command, possible_cmds[0], 1)
data.statement = self.statement_parser.parse(raw)
return data
|
module function_definition identifier parameters identifier typed_parameter identifier type attribute attribute identifier identifier identifier type attribute attribute identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute attribute identifier identifier identifier if_statement comparison_operator identifier none block expression_statement assignment identifier list_comprehension identifier for_in_clause identifier call attribute identifier identifier argument_list if_clause call attribute identifier identifier argument_list attribute attribute identifier identifier identifier if_statement comparison_operator call identifier argument_list identifier integer block expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list attribute attribute identifier identifier identifier subscript identifier integer integer expression_statement assignment attribute identifier identifier call attribute attribute identifier identifier identifier argument_list identifier return_statement identifier
|
Accept unique abbreviated commands
|
def show_command(endpoint_id, rule_id):
client = get_client()
rule = client.get_endpoint_acl_rule(endpoint_id, rule_id)
formatted_print(
rule,
text_format=FORMAT_TEXT_RECORD,
fields=(
("Rule ID", "id"),
("Permissions", "permissions"),
("Shared With", _shared_with_keyfunc),
("Path", "path"),
),
)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier expression_statement call identifier argument_list identifier keyword_argument identifier identifier keyword_argument identifier tuple tuple string string_start string_content string_end string string_start string_content string_end tuple string string_start string_content string_end string string_start string_content string_end tuple string string_start string_content string_end identifier tuple string string_start string_content string_end string string_start string_content string_end
|
Executor for `globus endpoint permission show`
|
def sortBy(self, val=None):
if val is not None:
if _(val).isString():
return self._wrap(sorted(self.obj, key=lambda x,
*args: x.get(val)))
else:
return self._wrap(sorted(self.obj, key=val))
else:
return self._wrap(sorted(self.obj))
|
module function_definition identifier parameters identifier default_parameter identifier none block if_statement comparison_operator identifier none block if_statement call attribute call identifier argument_list identifier identifier argument_list block return_statement call attribute identifier identifier argument_list call identifier argument_list attribute identifier identifier keyword_argument identifier lambda lambda_parameters identifier list_splat_pattern identifier call attribute identifier identifier argument_list identifier else_clause block return_statement call attribute identifier identifier argument_list call identifier argument_list attribute identifier identifier keyword_argument identifier identifier else_clause block return_statement call attribute identifier identifier argument_list call identifier argument_list attribute identifier identifier
|
Sort the object's values by a criterion produced by an iterator.
|
def returner(ret):
_options = _get_options(ret)
log.debug('_options %s', _options)
_options['hostname'] = ret.get('id')
if 'url' not in _options or _options['url'] == '':
log.error('nagios_nrdp.url not defined in salt config')
return
if 'token' not in _options or _options['token'] == '':
log.error('nagios_nrdp.token not defined in salt config')
return
xml = _prepare_xml(options=_options, state=ret['return'])
res = _post_data(options=_options, xml=xml)
return res
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end if_statement boolean_operator comparison_operator string string_start string_content string_end identifier comparison_operator subscript identifier string string_start string_content string_end string string_start string_end block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end return_statement if_statement boolean_operator comparison_operator string string_start string_content string_end identifier comparison_operator subscript identifier string string_start string_content string_end string string_start string_end block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end return_statement expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier keyword_argument identifier subscript identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier return_statement identifier
|
Send a message to Nagios with the data
|
def search_name(self, name, dom=None):
if dom is None:
dom = self.browser
return expect(dom.find_by_name, args=[name])
|
module function_definition identifier parameters identifier identifier default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement assignment identifier attribute identifier identifier return_statement call identifier argument_list attribute identifier identifier keyword_argument identifier list identifier
|
name find function abbreviation
|
def newsnr_threshold(self, threshold):
if not self.opt.chisq_bins:
raise RuntimeError('Chi-square test must be enabled in order to '
'use newsnr threshold')
remove = [i for i, e in enumerate(self.events) if
ranking.newsnr(abs(e['snr']), e['chisq'] / e['chisq_dof'])
< threshold]
self.events = numpy.delete(self.events, remove)
|
module function_definition identifier parameters identifier identifier block if_statement not_operator attribute attribute identifier identifier identifier block raise_statement call identifier argument_list concatenated_string string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier list_comprehension identifier for_in_clause pattern_list identifier identifier call identifier argument_list attribute identifier identifier if_clause comparison_operator call attribute identifier identifier argument_list call identifier argument_list subscript identifier string string_start string_content string_end binary_operator subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier identifier
|
Remove events with newsnr smaller than given threshold
|
def invalid_kwargs(invalid_kwargs, raise_exc=True):
if invalid_kwargs:
if isinstance(invalid_kwargs, dict):
new_invalid = [
'{0}={1}'.format(x, y)
for x, y in six.iteritems(invalid_kwargs)
]
invalid_kwargs = new_invalid
msg = (
'The following keyword arguments are not valid: {0}'
.format(', '.join(invalid_kwargs))
)
if raise_exc:
raise SaltInvocationError(msg)
else:
return msg
|
module function_definition identifier parameters identifier default_parameter identifier true block if_statement identifier block if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier list_comprehension call attribute string string_start string_content string_end identifier argument_list identifier identifier for_in_clause pattern_list identifier identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier identifier expression_statement assignment identifier parenthesized_expression call attribute string string_start string_content string_end identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier if_statement identifier block raise_statement call identifier argument_list identifier else_clause block return_statement identifier
|
Raise a SaltInvocationError if invalid_kwargs is non-empty
|
def create_api_environment(self):
return ApiEnvironment(
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 Api Environment services facade.
|
def _get_url_path(list_name):
access_key = getattr(settings,
"RESTCLIENTS_MAILMAN_KEY",
"__mock_key__")
return URL.format(key=access_key, uwnetid=list_name)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list identifier string string_start string_content string_end string string_start string_content string_end return_statement call attribute identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier
|
Live Dao requires RESTCLIENTS_MAILMAN_KEY in the settings.py
|
def _record_offset(self):
offset = self.blob_file.tell()
self.event_offsets.append(offset)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list identifier
|
Stores the current file pointer position
|
def find_path_join_using_plus(node):
return (
isinstance(node, ast.BinOp)
and isinstance(node.op, ast.Add)
and isinstance(node.left, ast.BinOp)
and isinstance(node.left.op, ast.Add)
and isinstance(node.left.right, ast.Str)
and node.left.right.s in ['/', "\\"]
)
|
module function_definition identifier parameters identifier block return_statement parenthesized_expression boolean_operator boolean_operator boolean_operator boolean_operator boolean_operator call identifier argument_list identifier attribute identifier identifier call identifier argument_list attribute identifier identifier attribute identifier identifier call identifier argument_list attribute identifier identifier attribute identifier identifier call identifier argument_list attribute attribute identifier identifier identifier attribute identifier identifier call identifier argument_list attribute attribute identifier identifier identifier attribute identifier identifier comparison_operator attribute attribute attribute identifier identifier identifier identifier list string string_start string_content string_end string string_start string_content escape_sequence string_end
|
Finds joining path with plus
|
def existing_analysis(using):
es = connections.get_connection(using)
index_name = settings.ELASTICSEARCH_CONNECTIONS[using]['index_name']
if es.indices.exists(index=index_name):
return stringer(es.indices.get_settings(index=index_name)[index_name]['settings']['index'].get('analysis', {}))
return DOES_NOT_EXIST
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier subscript subscript attribute identifier identifier identifier string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list keyword_argument identifier identifier block return_statement call identifier argument_list call attribute subscript subscript subscript call attribute attribute identifier identifier identifier argument_list keyword_argument identifier identifier identifier string string_start string_content string_end string string_start string_content string_end identifier argument_list string string_start string_content string_end dictionary return_statement identifier
|
Get the existing analysis for the `using` Elasticsearch connection
|
def flow_orifice_vert(Diam, Height, RatioVCOrifice):
ut.check_range([RatioVCOrifice, "0-1", "VC orifice ratio"])
if Height > -Diam / 2:
flow_vert = integrate.quad(lambda z: (Diam * np.sin(np.arccos(z/(Diam/2)))
* np.sqrt(Height - z)
),
- Diam / 2,
min(Diam/2, Height))
return flow_vert[0] * RatioVCOrifice * np.sqrt(2 * gravity.magnitude)
else:
return 0
|
module function_definition identifier parameters identifier identifier identifier block expression_statement call attribute identifier identifier argument_list list identifier string string_start string_content string_end string string_start string_content string_end if_statement comparison_operator identifier binary_operator unary_operator identifier integer block expression_statement assignment identifier call attribute identifier identifier argument_list lambda lambda_parameters identifier parenthesized_expression binary_operator binary_operator identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list binary_operator identifier parenthesized_expression binary_operator identifier integer call attribute identifier identifier argument_list binary_operator identifier identifier binary_operator unary_operator identifier integer call identifier argument_list binary_operator identifier integer identifier return_statement binary_operator binary_operator subscript identifier integer identifier call attribute identifier identifier argument_list binary_operator integer attribute identifier identifier else_clause block return_statement integer
|
Return the vertical flow rate of the orifice.
|
def make_exporter_resources(nb_name, out_folder, images_folder=None):
resources = defaultdict(str)
resources['metadata'] = defaultdict(str)
resources['metadata']['name'] = nb_name
resources['metadata']['path'] = out_folder
resources['unique_key'] = nb_name
resources['output_files_dir'] = images_folder
return resources
|
module function_definition identifier parameters identifier identifier default_parameter identifier none block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment subscript identifier string string_start string_content string_end call identifier argument_list identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier 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 return_statement identifier
|
Creates resources dict for the exporter
|
def _escape_attribute_quotes(self, v):
escaped = []
inside_tag = False
for i, _ in enumerate(v):
if v[i:i + 2] == '{%':
inside_tag = True
elif v[i:i + 2] == '%}':
inside_tag = False
if v[i] == self.attr_wrapper and not inside_tag:
escaped.append('\\')
escaped.append(v[i])
return ''.join(escaped)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list expression_statement assignment identifier false for_statement pattern_list identifier identifier call identifier argument_list identifier block if_statement comparison_operator subscript identifier slice identifier binary_operator identifier integer string string_start string_content string_end block expression_statement assignment identifier true elif_clause comparison_operator subscript identifier slice identifier binary_operator identifier integer string string_start string_content string_end block expression_statement assignment identifier false if_statement boolean_operator comparison_operator subscript identifier identifier attribute identifier identifier not_operator identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content escape_sequence string_end expression_statement call attribute identifier identifier argument_list subscript identifier identifier return_statement call attribute string string_start string_end identifier argument_list identifier
|
Escapes quotes with a backslash, except those inside a Django tag
|
def _mid(string, start, end=None):
if end is None:
end = len(string)
return string[start:start + end]
|
module function_definition identifier parameters identifier identifier default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement assignment identifier call identifier argument_list identifier return_statement subscript identifier slice identifier binary_operator identifier identifier
|
Returns a substring delimited by start and end position.
|
def run(self):
files_to_download = self.get_files_to_download()
total_files_size = self.get_total_files_size(files_to_download)
if self.file_download_pre_processor:
self.run_preprocessor(files_to_download)
self.try_create_dir(self.dest_directory)
watcher = ProgressPrinter(total_files_size, msg_verb='downloading')
self.download_files(files_to_download, watcher)
watcher.finished()
warnings = self.check_warnings()
if warnings:
watcher.show_warning(warnings)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier call identifier argument_list identifier keyword_argument identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier
|
Download the contents of the specified project name or id to dest_directory.
|
def parse_intervals(diff_report):
for patch in diff_report.patch_set:
try:
old_pf = diff_report.old_file(patch.source_file)
new_pf = diff_report.new_file(patch.target_file)
except InvalidPythonFile:
continue
for hunk in patch:
for line in hunk:
if line.line_type == LINE_TYPE_ADDED:
idx = line.target_line_no
yield ContextInterval(new_pf.filename, new_pf.context(idx))
elif line.line_type == LINE_TYPE_REMOVED:
idx = line.source_line_no
yield ContextInterval(old_pf.filename, old_pf.context(idx))
elif line.line_type in (LINE_TYPE_EMPTY, LINE_TYPE_CONTEXT):
pass
else:
raise AssertionError("Unexpected line type: %s" % line)
|
module function_definition identifier parameters identifier block for_statement identifier attribute identifier identifier block try_statement block expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier except_clause identifier block continue_statement for_statement identifier identifier block for_statement identifier identifier block if_statement comparison_operator attribute identifier identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement yield call identifier argument_list attribute identifier identifier call attribute identifier identifier argument_list identifier elif_clause comparison_operator attribute identifier identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement yield call identifier argument_list attribute identifier identifier call attribute identifier identifier argument_list identifier elif_clause comparison_operator attribute identifier identifier tuple identifier identifier block pass_statement else_clause block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier
|
Parse a diff into an iterator of Intervals.
|
def validate_relationship(self):
if self.relationship not in self._relationship_valid_values:
raise ValueError("relationship should be one of: {valid}".format(
valid=", ".join(self._relationship_valid_values)
))
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier attribute identifier identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier
|
Ensure relationship is of a certain type.
|
def observe_root_state_assignments(self, model, prop_name, info):
if info['old']:
self.relieve_model(info['old'])
if info['new']:
self.observe_model(info['new'])
self.logger.info("Exchange observed old root_state model with newly assigned one. sm_id: {}"
"".format(info['new'].state.parent.state_machine_id))
|
module function_definition identifier parameters identifier identifier identifier identifier block if_statement subscript identifier string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list subscript identifier string string_start string_content string_end if_statement subscript identifier string string_start string_content string_end block expression_statement call attribute identifier identifier argument_list subscript identifier string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list call attribute concatenated_string string string_start string_content string_end string string_start string_end identifier argument_list attribute attribute attribute subscript identifier string string_start string_content string_end identifier identifier identifier
|
The method relieves observed root_state models and observes newly assigned root_state models.
|
def reverse_complement(self, is_RNA=None):
Sequence.reverseComplement(self, is_RNA)
self.seq_qual = self.seq_qual[::-1]
|
module function_definition identifier parameters identifier default_parameter identifier none block expression_statement call attribute identifier identifier argument_list identifier identifier expression_statement assignment attribute identifier identifier subscript attribute identifier identifier slice unary_operator integer
|
Reverse complement this read in-place.
|
def info(self):
if self.name not in jobs: return {'status': self.status}
else: return jobs[self.name]
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier identifier block return_statement dictionary pair string string_start string_content string_end attribute identifier identifier else_clause block return_statement subscript identifier attribute identifier identifier
|
Get the existing job information dictionary
|
def last(predicate=None):
predicate = true if predicate is None else predicate
def last_transducer(reducer):
return Last(reducer, predicate)
return last_transducer
|
module function_definition identifier parameters default_parameter identifier none block expression_statement assignment identifier conditional_expression identifier comparison_operator identifier none identifier function_definition identifier parameters identifier block return_statement call identifier argument_list identifier identifier return_statement identifier
|
Create a transducer which obtains the last item.
|
def send_pending_requests(self):
try:
with self._lock:
if not self._can_send_recv():
return Errors.NodeNotReadyError(str(self))
data = self._protocol.send_bytes()
total_bytes = self._send_bytes_blocking(data)
if self._sensors:
self._sensors.bytes_sent.record(total_bytes)
return total_bytes
except ConnectionError as e:
log.exception("Error sending request data to %s", self)
error = Errors.KafkaConnectionError("%s: %s" % (self, e))
self.close(error=error)
return error
|
module function_definition identifier parameters identifier block try_statement block with_statement with_clause with_item attribute identifier identifier block if_statement not_operator call attribute identifier identifier argument_list block return_statement call attribute identifier identifier argument_list call identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement attribute identifier identifier block expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list identifier return_statement identifier except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier call attribute identifier identifier argument_list binary_operator string string_start string_content string_end tuple identifier identifier expression_statement call attribute identifier identifier argument_list keyword_argument identifier identifier return_statement identifier
|
Can block on network if request is larger than send_buffer_bytes
|
def field_cache_to_index_pattern(self, field_cache):
mapping_dict = {}
mapping_dict['customFormats'] = "{}"
mapping_dict['title'] = self.index_pattern
mapping_dict['fields'] = json.dumps(field_cache, separators=(',', ':'))
mapping_str = json.dumps(mapping_dict, separators=(',', ':'))
return mapping_str
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier dictionary expression_statement assignment subscript identifier 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 attribute identifier identifier expression_statement assignment subscript identifier string string_start string_content string_end 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 expression_statement assignment identifier 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 return_statement identifier
|
Return a .kibana index-pattern doc_type
|
def _get_external_accounts(self, locals):
users = dict()
out = __salt__['cmd.run_all']("passwd -S -a")
if out['retcode']:
return users
status = {'L': 'Locked', 'NP': 'No password', 'P': 'Usable password', 'LK': 'Locked'}
for data in [elm.strip().split(" ") for elm in out['stdout'].split(os.linesep) if elm.strip()]:
if len(data) < 2:
continue
name, login = data[:2]
if name not in locals:
users[name] = {
'login': login,
'status': status.get(login, 'N/A')
}
return users
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier call subscript identifier string string_start string_content string_end argument_list string string_start string_content string_end if_statement subscript identifier string string_start string_content string_end block return_statement 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 string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end for_statement identifier list_comprehension call attribute call attribute identifier identifier argument_list identifier argument_list string string_start string_content string_end for_in_clause identifier call attribute subscript identifier string string_start string_content string_end identifier argument_list attribute identifier identifier if_clause call attribute identifier identifier argument_list block if_statement comparison_operator call identifier argument_list identifier integer block continue_statement expression_statement assignment pattern_list identifier identifier subscript identifier slice integer if_statement comparison_operator identifier identifier block expression_statement assignment subscript identifier identifier dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end call attribute identifier identifier argument_list identifier string string_start string_content string_end return_statement identifier
|
Return all known accounts, excluding local accounts.
|
def reset(self):
if self.__row_number > self.__sample_size:
self.__parser.reset()
self.__extract_sample()
self.__extract_headers()
self.__row_number = 0
|
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 expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier integer
|
Resets the stream pointer to the beginning of the file.
|
def from_info(cls, container, info_obj):
create_fn = cls.from_subdir if 'subdir' in info_obj \
else cls.from_file_info
return create_fn(container, info_obj)
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier conditional_expression attribute identifier identifier comparison_operator string string_start string_content string_end identifier line_continuation attribute identifier identifier return_statement call identifier argument_list identifier identifier
|
Create from subdirectory or file info object.
|
def remove(self, order, cells):
self._normalized = False
order = self._validate_order(order)
for cell in cells:
cell = self._validate_cell(order, cell)
self._compare_operation(order, cell, True, 'remove')
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment attribute identifier identifier false expression_statement assignment identifier call attribute identifier identifier argument_list identifier for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list identifier identifier true string string_start string_content string_end
|
Remove cells at a given order from the MOC.
|
def stop(self):
yield from self._stop_ubridge()
with (yield from self._execute_lock):
self._hw_virtualization = False
if self.is_running():
log.info('Stopping QEMU VM "{}" PID={}'.format(self._name, self._process.pid))
try:
if self.acpi_shutdown:
yield from self._control_vm("system_powerdown")
yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=30)
else:
self._process.terminate()
yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=3)
except ProcessLookupError:
pass
except asyncio.TimeoutError:
if self._process:
try:
self._process.kill()
except ProcessLookupError:
pass
if self._process.returncode is None:
log.warn('QEMU VM "{}" PID={} is still running'.format(self._name, self._process.pid))
self._process = None
self._stop_cpulimit()
yield from super().stop()
|
module function_definition identifier parameters identifier block expression_statement yield call attribute identifier identifier argument_list with_statement with_clause with_item parenthesized_expression yield attribute identifier identifier block expression_statement assignment attribute identifier identifier false if_statement call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier attribute attribute identifier identifier identifier try_statement block if_statement attribute identifier identifier block expression_statement yield call attribute identifier identifier argument_list string string_start string_content string_end expression_statement yield call attribute attribute attribute identifier identifier identifier identifier argument_list attribute identifier identifier keyword_argument identifier integer else_clause block expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement yield call attribute attribute attribute identifier identifier identifier identifier argument_list attribute identifier identifier keyword_argument identifier integer except_clause identifier block pass_statement except_clause attribute identifier identifier block if_statement attribute identifier identifier block try_statement block expression_statement call attribute attribute identifier identifier identifier argument_list except_clause identifier block pass_statement if_statement comparison_operator attribute attribute identifier identifier identifier none block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier attribute attribute identifier identifier identifier expression_statement assignment attribute identifier identifier none expression_statement call attribute identifier identifier argument_list expression_statement yield call attribute call identifier argument_list identifier argument_list
|
Stops this QEMU VM.
|
def purge():
print("Purging the Blended files!")
templ_dir = os.path.join(cwd, "templates")
if os.path.exists(templ_dir):
shutil.rmtree(templ_dir)
cont_dir = os.path.join(cwd, "content")
if os.path.exists(cont_dir):
shutil.rmtree(cont_dir)
build_dir = os.path.join(cwd, "build")
if os.path.exists(build_dir):
shutil.rmtree(build_dir)
config_file_dir = os.path.join(cwd, "config.py")
if os.path.exists(config_file_dir):
os.remove(config_file_dir)
config2_file_dir = os.path.join(cwd, "config.pyc")
if os.path.exists(config2_file_dir):
os.remove(config2_file_dir)
config3_file_dir = os.path.join(cwd, "config.py.oldbak")
if os.path.exists(config3_file_dir):
os.remove(config3_file_dir)
|
module function_definition identifier parameters block expression_statement call identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list identifier
|
Removes all files generated by Blended
|
def to_json(self):
return {
'hum_type': self.hum_type,
'hum_value': self.hum_value,
'barometric_pressure': self.barometric_pressure,
'schedule': self.schedule,
'wet_bulb_range': self.wet_bulb_range,
}
|
module function_definition identifier parameters identifier block return_statement dictionary pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier
|
Convert the Humidity Condition to a dictionary.
|
def reset(self):
self.stack.append(Frame(src=None, src_path=None))
return Close(functools.partial(self.restore))
|
module function_definition identifier parameters identifier block expression_statement call attribute attribute identifier identifier identifier argument_list call identifier argument_list keyword_argument identifier none keyword_argument identifier none return_statement call identifier argument_list call attribute identifier identifier argument_list attribute identifier identifier
|
Used if you need to recursively parse forms.
|
def disambiguate_fname(files_path_list, filename):
fname = os.path.basename(filename)
same_name_files = get_same_name_files(files_path_list, fname)
if len(same_name_files) > 1:
compare_path = shortest_path(same_name_files)
if compare_path == filename:
same_name_files.remove(path_components(filename))
compare_path = shortest_path(same_name_files)
diff_path = differentiate_prefix(path_components(filename),
path_components(compare_path))
diff_path_length = len(diff_path)
path_component = path_components(diff_path)
if (diff_path_length > 20 and len(path_component) > 2):
if path_component[0] != '/' and path_component[0] != '':
path_component = [path_component[0], '...',
path_component[-1]]
else:
path_component = [path_component[2], '...',
path_component[-1]]
diff_path = os.path.join(*path_component)
fname = fname + " - " + diff_path
return fname
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier identifier if_statement comparison_operator call identifier argument_list identifier integer block expression_statement assignment identifier call identifier argument_list identifier if_statement comparison_operator identifier identifier block expression_statement call attribute identifier identifier argument_list call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list call identifier argument_list identifier call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier if_statement parenthesized_expression boolean_operator comparison_operator identifier integer comparison_operator call identifier argument_list identifier integer block if_statement boolean_operator comparison_operator subscript identifier integer string string_start string_content string_end comparison_operator subscript identifier integer string string_start string_end block expression_statement assignment identifier list subscript identifier integer string string_start string_content string_end subscript identifier unary_operator integer else_clause block expression_statement assignment identifier list subscript identifier integer string string_start string_content string_end subscript identifier unary_operator integer expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list list_splat identifier expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end identifier return_statement identifier
|
Get tab title without ambiguation.
|
def close(self):
if self.is_open:
message_input = UnityMessage()
message_input.header.status = 400
self.unity_to_external.parent_conn.send(message_input)
self.unity_to_external.parent_conn.close()
self.server.stop(False)
self.is_open = False
|
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment attribute attribute identifier identifier identifier integer expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list identifier expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list false expression_statement assignment attribute identifier identifier false
|
Sends a shutdown signal to the unity environment, and closes the grpc connection.
|
def move(self, path, dest, raise_if_exists=False):
if raise_if_exists and dest in self.get_all_data():
raise RuntimeError('Destination exists: %s' % path)
contents = self.get_all_data().pop(path)
self.get_all_data()[dest] = contents
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier false block if_statement boolean_operator identifier comparison_operator identifier call attribute identifier identifier argument_list block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier expression_statement assignment identifier call attribute call attribute identifier identifier argument_list identifier argument_list identifier expression_statement assignment subscript call attribute identifier identifier argument_list identifier identifier
|
Moves a single file from path to dest
|
def histogram2d(data1, data2, bins=None, *args, **kwargs):
import dask
if "axis_names" not in kwargs:
if hasattr(data1, "name") and hasattr(data2, "name"):
kwargs["axis_names"] = [data1.name, data2.name]
if not hasattr(data1, "dask"):
data1 = dask.array.from_array(data1, chunks=data1.size() / 100)
if not hasattr(data2, "dask"):
data2 = dask.array.from_array(data2, chunks=data2.size() / 100)
data = dask.array.stack([data1, data2], axis=1)
kwargs["dim"] = 2
return histogramdd(data, bins, *args, **kwargs)
|
module function_definition identifier parameters identifier identifier default_parameter identifier none list_splat_pattern identifier dictionary_splat_pattern identifier block import_statement dotted_name identifier if_statement comparison_operator string string_start string_content string_end identifier block if_statement boolean_operator call identifier argument_list identifier string string_start string_content string_end call identifier argument_list identifier string string_start string_content string_end block expression_statement assignment subscript identifier string string_start string_content string_end list attribute identifier identifier attribute identifier identifier if_statement not_operator call identifier argument_list identifier string string_start string_content string_end block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier keyword_argument identifier binary_operator call attribute identifier identifier argument_list integer if_statement not_operator call identifier argument_list identifier string string_start string_content string_end block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier keyword_argument identifier binary_operator call attribute identifier identifier argument_list integer expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list list identifier identifier keyword_argument identifier integer expression_statement assignment subscript identifier string string_start string_content string_end integer return_statement call identifier argument_list identifier identifier list_splat identifier dictionary_splat identifier
|
Facade function to create 2D histogram using dask.
|
def session_context(fn):
@functools.wraps(fn)
def wrap(*args, **kwargs):
session = args[0].Session()
result = fn(*args, session=session, **kwargs)
session.close()
return result
return wrap
|
module function_definition identifier parameters identifier block decorated_definition decorator call attribute identifier identifier argument_list identifier function_definition identifier parameters list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call attribute subscript identifier integer identifier argument_list expression_statement assignment identifier call identifier argument_list list_splat identifier keyword_argument identifier identifier dictionary_splat identifier expression_statement call attribute identifier identifier argument_list return_statement identifier return_statement identifier
|
Handles session setup and teardown
|
def _subset_by_support(orig_vcf, cmp_calls, data):
cmp_vcfs = [x["vrn_file"] for x in cmp_calls]
out_file = "%s-inensemble.vcf.gz" % utils.splitext_plus(orig_vcf)[0]
if not utils.file_uptodate(out_file, orig_vcf):
with file_transaction(data, out_file) as tx_out_file:
cmd = "bedtools intersect -header -wa -f 0.5 -r -a {orig_vcf} -b "
for cmp_vcf in cmp_vcfs:
cmd += "<(bcftools view -f 'PASS,.' %s) " % cmp_vcf
cmd += "| bgzip -c > {tx_out_file}"
do.run(cmd.format(**locals()), "Subset calls by those present in Ensemble output")
return vcfutils.bgzip_and_index(out_file, data["config"])
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier list_comprehension subscript identifier string string_start string_content string_end for_in_clause identifier identifier expression_statement assignment identifier binary_operator string string_start string_content string_end subscript call attribute identifier identifier argument_list identifier integer if_statement not_operator call attribute identifier identifier argument_list identifier identifier block with_statement with_clause with_item as_pattern call identifier argument_list identifier identifier as_pattern_target identifier block expression_statement assignment identifier string string_start string_content string_end for_statement identifier identifier block expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end identifier expression_statement augmented_assignment identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list dictionary_splat call identifier argument_list string string_start string_content string_end return_statement call attribute identifier identifier argument_list identifier subscript identifier string string_start string_content string_end
|
Subset orig_vcf to calls also present in any of the comparison callers.
|
def persistant_error(request, message, extra_tags='', fail_silently=False, *args, **kwargs):
add_message(request, ERROR_PERSISTENT, message, extra_tags=extra_tags,
fail_silently=fail_silently, *args, **kwargs)
|
module function_definition identifier parameters identifier identifier default_parameter identifier string string_start string_end default_parameter identifier false list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement call identifier argument_list identifier identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier list_splat identifier dictionary_splat identifier
|
Adds a persistant message with the ``ERROR`` level.
|
def corethreads(self):
printtime('Creating CDS files and finding core genes', self.start)
for i in range(self.cpus):
threads = Thread(target=self.coregroups, args=())
threads.setDaemon(True)
threads.start()
for sample in self.runmetadata.samples:
sample.prokka.cds = os.path.join(sample.prokka.outputdir, '{}.cds'.format(sample.name))
self.corequeue.put(sample)
self.corequeue.join()
self.corewriter()
|
module function_definition identifier parameters identifier block expression_statement call identifier argument_list string string_start string_content string_end attribute identifier identifier for_statement identifier call identifier argument_list attribute identifier identifier block expression_statement assignment identifier call identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier tuple expression_statement call attribute identifier identifier argument_list true expression_statement call attribute identifier identifier argument_list for_statement identifier attribute attribute identifier identifier identifier block expression_statement assignment attribute attribute identifier identifier identifier call attribute attribute identifier identifier identifier argument_list attribute attribute identifier identifier identifier call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
|
Create a .cds file consisting of fasta records of CDS features for each strain
|
def from_bytes(cls, data):
len_username = int.from_bytes(data[0:2], byteorder="big")
offset_username = 2 + len_username
username = data[2:offset_username].decode("UTF-8")
offset_password = 2 + offset_username
len_password = int.from_bytes(
data[offset_username:offset_password], byteorder="big"
)
pass_begin = offset_password
pass_end = offset_password + len_password
password = data[pass_begin:pass_end].decode("UTF-8")
return cls(username, password)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list subscript identifier slice integer integer keyword_argument identifier string string_start string_content string_end expression_statement assignment identifier binary_operator integer identifier expression_statement assignment identifier call attribute subscript identifier slice integer identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier binary_operator integer identifier expression_statement assignment identifier call attribute identifier identifier argument_list subscript identifier slice identifier identifier keyword_argument identifier string string_start string_content string_end expression_statement assignment identifier identifier expression_statement assignment identifier binary_operator identifier identifier expression_statement assignment identifier call attribute subscript identifier slice identifier identifier identifier argument_list string string_start string_content string_end return_statement call identifier argument_list identifier identifier
|
I am so sorry.
|
def list_clients():
p = '%s/pymux.sock.%s.*' % (tempfile.gettempdir(), getpass.getuser())
for path in glob.glob(p):
try:
yield PosixClient(path)
except socket.error:
pass
|
module function_definition identifier parameters block expression_statement assignment identifier binary_operator string string_start string_content string_end tuple call attribute identifier identifier argument_list call attribute identifier identifier argument_list for_statement identifier call attribute identifier identifier argument_list identifier block try_statement block expression_statement yield call identifier argument_list identifier except_clause attribute identifier identifier block pass_statement
|
List all the servers that are running.
|
def from_list(cls, values):
self = cls()
for value in values:
self.add(value)
return self
|
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 identifier return_statement identifier
|
Construct a tree from a list with paths.
|
def demo_supercut(composition, padding):
for i, c in enumerate(composition):
line = c['line']
start = c['start']
end = c['end']
if i > 0 and composition[i - 1]['file'] == c['file'] and start < composition[i - 1]['end']:
start = start + padding
print("{1} to {2}:\t{0}".format(line, start, end))
|
module function_definition identifier parameters identifier identifier block for_statement pattern_list identifier identifier call identifier argument_list identifier block expression_statement assignment identifier subscript identifier string string_start string_content string_end expression_statement assignment identifier subscript identifier string string_start string_content string_end expression_statement assignment identifier subscript identifier string string_start string_content string_end if_statement boolean_operator boolean_operator comparison_operator identifier integer comparison_operator subscript subscript identifier binary_operator identifier integer string string_start string_content string_end subscript identifier string string_start string_content string_end comparison_operator identifier subscript subscript identifier binary_operator identifier integer string string_start string_content string_end block expression_statement assignment identifier binary_operator identifier identifier expression_statement call identifier argument_list call attribute string string_start string_content escape_sequence string_end identifier argument_list identifier identifier identifier
|
Print out timespans to be cut followed by the line number in the srt.
|
async def soundfield(dev: Device, soundfield: str):
if soundfield is not None:
await dev.set_sound_settings("soundField", soundfield)
soundfields = await dev.get_sound_settings("soundField")
print_settings(soundfields)
|
module function_definition identifier parameters typed_parameter identifier type identifier typed_parameter identifier type identifier block if_statement comparison_operator identifier none block expression_statement await 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 string string_start string_content string_end expression_statement call identifier argument_list identifier
|
Get or set sound field.
|
def delete_project(self):
if self.current_active_project:
self.switch_to_plugin()
path = self.current_active_project.root_path
buttons = QMessageBox.Yes | QMessageBox.No
answer = QMessageBox.warning(
self,
_("Delete"),
_("Do you really want to delete <b>{filename}</b>?<br><br>"
"<b>Note:</b> This action will only delete the project. "
"Its files are going to be preserved on disk."
).format(filename=osp.basename(path)),
buttons)
if answer == QMessageBox.Yes:
try:
self.close_project()
shutil.rmtree(osp.join(path, '.spyproject'))
except EnvironmentError as error:
QMessageBox.critical(
self,
_("Project Explorer"),
_("<b>Unable to delete <i>{varpath}</i></b>"
"<br><br>The error message was:<br>{error}"
).format(varpath=path, error=to_text_string(error)))
|
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment identifier binary_operator attribute identifier identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier call identifier argument_list string string_start string_content string_end call attribute call identifier argument_list concatenated_string string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end identifier argument_list keyword_argument identifier call attribute identifier identifier argument_list identifier identifier if_statement comparison_operator identifier attribute identifier identifier block try_statement block expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier string string_start string_content string_end except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list identifier call identifier argument_list string string_start string_content string_end call attribute call identifier argument_list concatenated_string string string_start string_content string_end string string_start string_content string_end identifier argument_list keyword_argument identifier identifier keyword_argument identifier call identifier argument_list identifier
|
Delete the current project without deleting the files in the directory.
|
def _get_cols(row_content):
cols = []
subcell_col = []
prev_bar = None
for _coord, item in row_content:
if isinstance(item, LTTextLine):
subcell_col.append(item)
else:
if prev_bar:
bar_ranges = (prev_bar, item)
col_items = subcell_col if subcell_col else [None]
cols.extend([bar_ranges, col_items])
prev_bar = item
subcell_col = []
return cols
|
module function_definition identifier parameters identifier block expression_statement assignment identifier list expression_statement assignment identifier list expression_statement assignment identifier none for_statement pattern_list identifier identifier identifier block if_statement call identifier argument_list identifier identifier block expression_statement call attribute identifier identifier argument_list identifier else_clause block if_statement identifier block expression_statement assignment identifier tuple identifier identifier expression_statement assignment identifier conditional_expression identifier identifier list none expression_statement call attribute identifier identifier argument_list list identifier identifier expression_statement assignment identifier identifier expression_statement assignment identifier list return_statement identifier
|
Counting the number columns based on the content of this row
|
def zone_height_min2max(idf, zonename, debug=False):
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
surf_xyzs = [eppy.function_helpers.getcoords(s) for s in zone_surfs]
surf_xyzs = list(itertools.chain(*surf_xyzs))
surf_zs = [z for x, y, z in surf_xyzs]
topz = max(surf_zs)
botz = min(surf_zs)
height = topz - botz
return height
|
module function_definition identifier parameters identifier identifier default_parameter identifier false block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier subscript attribute identifier identifier call attribute string string_start string_content string_end identifier argument_list expression_statement assignment identifier list_comprehension identifier for_in_clause identifier identifier if_clause comparison_operator attribute identifier identifier attribute identifier identifier expression_statement assignment identifier list_comprehension call attribute attribute identifier identifier identifier argument_list identifier for_in_clause identifier identifier expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list list_splat identifier expression_statement assignment identifier list_comprehension identifier for_in_clause pattern_list identifier identifier identifier identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier binary_operator identifier identifier return_statement identifier
|
zone height = max-min
|
def embeddedFileAdd(self, buffer, name, filename=None, ufilename=None, desc=None):
if self.isClosed or self.isEncrypted:
raise ValueError("operation illegal for closed / encrypted doc")
return _fitz.Document_embeddedFileAdd(self, buffer, name, filename, ufilename, desc)
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none block if_statement boolean_operator attribute identifier identifier attribute identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end return_statement call attribute identifier identifier argument_list identifier identifier identifier identifier identifier identifier
|
Embed a new file.
|
def format_field(self, value, format_spec):
if isinstance(value, MissingField):
if format_spec is not None:
value.format_spec = format_spec
return str(value)
return super(FormatterWrapper, self).format_field(value, format_spec)
|
module function_definition identifier parameters identifier identifier identifier block if_statement call identifier argument_list identifier identifier block if_statement comparison_operator identifier none block expression_statement assignment attribute identifier identifier identifier return_statement call identifier argument_list identifier return_statement call attribute call identifier argument_list identifier identifier identifier argument_list identifier identifier
|
When field missing, return original spec.
|
def _make_spec_file(self):
spec_file = setuptools.command.bdist_rpm.bdist_rpm._make_spec_file(self)
spec_file.append('%config(noreplace) /etc/lograptor/lograptor.conf')
spec_file.append('%config(noreplace) /etc/lograptor/report_template.*')
spec_file.append('%config(noreplace) /etc/lograptor/conf.d/*.conf')
return spec_file
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute attribute attribute identifier identifier identifier identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end return_statement identifier
|
Customize spec file inserting %config section
|
def enclosure_directed(self):
root, enclosure = polygons.enclosure_tree(self.polygons_closed)
self._cache['root'] = root
return enclosure
|
module function_definition identifier parameters identifier block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list attribute identifier identifier expression_statement assignment subscript attribute identifier identifier string string_start string_content string_end identifier return_statement identifier
|
Networkx DiGraph of polygon enclosure
|
def callRemote(self, *a, **kw):
if not self.running:
return defer.fail(ServiceStopped())
return self.clientFactory.callRemote(*a, **kw)
|
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block if_statement not_operator attribute identifier identifier block return_statement call attribute identifier identifier argument_list call identifier argument_list return_statement call attribute attribute identifier identifier identifier argument_list list_splat identifier dictionary_splat identifier
|
Make a callRemote request of the JSONRPCClientFactory.
|
def pretty_path(path, _home_re=re.compile('^' + re.escape(os.path.expanduser('~') + os.sep))):
path = format_filename(path)
path = _home_re.sub('~' + os.sep, path)
return path
|
module function_definition identifier parameters identifier default_parameter identifier call attribute identifier identifier argument_list binary_operator string string_start string_content string_end call attribute identifier identifier argument_list binary_operator call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end attribute identifier identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list binary_operator string string_start string_content string_end attribute identifier identifier identifier return_statement identifier
|
Prettify path for humans, and make it Unicode.
|
def create(ctx):
import shutil
this_dir, this_filename = os.path.split(__file__)
default_config_file = os.path.join(this_dir, "apis/example-config.yaml")
config_file = ctx.obj["configfile"]
shutil.copyfile(default_config_file, config_file)
print_message("Config file created: {}".format(config_file))
|
module function_definition identifier parameters identifier block import_statement dotted_name identifier expression_statement assignment pattern_list identifier identifier call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier identifier expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier
|
Create default config file
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.