code
stringlengths 51
2.34k
| sequence
stringlengths 186
3.94k
| docstring
stringlengths 11
171
|
|---|---|---|
def load_config(configfile):
try:
with open(configfile, 'r') as ymlfile:
try:
config = yaml.load(ymlfile)
return config
except yaml.parser.ParserError:
raise PyYAMLConfigError(
'Could not parse config file: {}'.format(configfile),
)
except IOError:
raise PyYAMLConfigError(
'Could not open config file: {}'.format(configfile),
)
|
module function_definition identifier parameters identifier block try_statement block with_statement with_clause with_item as_pattern call identifier argument_list identifier string string_start string_content string_end as_pattern_target identifier block try_statement block expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement identifier except_clause attribute attribute identifier identifier identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier except_clause identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier
|
Return a dict with configuration from the supplied yaml file
|
def http_call(self, url=None, **kwargs):
if not url:
url = self.search_url
http_func, arg_name = self.get_http_method_arg_name()
_kwargs = {
arg_name: kwargs,
}
response = http_func(
url=url.format(**kwargs),
headers=self.get_http_headers(),
**_kwargs
)
if response.status_code != 200:
logger.warning('Invalid Request for `%s`', response.url)
response.raise_for_status()
return response.json()
|
module function_definition identifier parameters identifier default_parameter identifier none dictionary_splat_pattern identifier block if_statement not_operator identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list expression_statement assignment identifier dictionary pair identifier identifier expression_statement assignment identifier call identifier argument_list keyword_argument identifier call attribute identifier identifier argument_list dictionary_splat identifier keyword_argument identifier call attribute identifier identifier argument_list dictionary_splat identifier if_statement comparison_operator attribute identifier identifier integer block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier expression_statement call attribute identifier identifier argument_list return_statement call attribute identifier identifier argument_list
|
Call the target URL via HTTP and return the JSON result
|
def metadataContributer(self):
if self._metaFL is None:
fl = FeatureService(url=self._metadataURL,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._metaFS = fl
return self._metaFS
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier none block expression_statement assignment identifier call identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier expression_statement assignment attribute identifier identifier identifier return_statement attribute identifier identifier
|
gets the metadata featurelayer object
|
def shared_atts(self):
atts = {}
first = self.chunks[0]
for att in sorted(first.atts):
if all(fs.atts.get(att, '???') == first.atts[att] for fs in self.chunks if len(fs) > 0):
atts[att] = first.atts[att]
return atts
|
module function_definition identifier parameters identifier block expression_statement assignment identifier dictionary expression_statement assignment identifier subscript attribute identifier identifier integer for_statement identifier call identifier argument_list attribute identifier identifier block if_statement call identifier generator_expression comparison_operator call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end subscript attribute identifier identifier identifier for_in_clause identifier attribute identifier identifier if_clause comparison_operator call identifier argument_list identifier integer block expression_statement assignment subscript identifier identifier subscript attribute identifier identifier identifier return_statement identifier
|
Gets atts shared among all nonzero length component Chunk
|
def copy(self, *args, **kwargs):
for slot in self.__slots__:
attr = getattr(self, slot)
if slot[0] == '_':
slot = slot[1:]
if slot not in kwargs:
kwargs[slot] = attr
result = type(self)(*args, **kwargs)
return result
|
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block for_statement identifier attribute identifier identifier block expression_statement assignment identifier call identifier argument_list identifier identifier if_statement comparison_operator subscript identifier integer string string_start string_content string_end block expression_statement assignment identifier subscript identifier slice integer if_statement comparison_operator identifier identifier block expression_statement assignment subscript identifier identifier identifier expression_statement assignment identifier call call identifier argument_list identifier argument_list list_splat identifier dictionary_splat identifier return_statement identifier
|
Copy this model element and contained elements if they exist.
|
def _build_codes() -> Dict[str, Dict[str, str]]:
built = {
'fore': {},
'back': {},
'style': {},
}
for name, number in _namemap:
built['fore'][name] = codeformat(30 + number)
built['back'][name] = codeformat(40 + number)
litename = 'light{}'.format(name)
built['fore'][litename] = codeformat(90 + number)
built['back'][litename] = codeformat(100 + number)
built['fore']['reset'] = codeformat(39)
built['back']['reset'] = codeformat(49)
for code, names in _stylemap:
for alias in names:
built['style'][alias] = codeformat(code)
for i in range(256):
built['fore'][str(i)] = extforeformat(i)
built['back'][str(i)] = extbackformat(i)
return built
|
module function_definition identifier parameters type generic_type identifier type_parameter type identifier type generic_type identifier type_parameter type identifier type identifier block expression_statement assignment identifier dictionary pair string string_start string_content string_end dictionary pair string string_start string_content string_end dictionary pair string string_start string_content string_end dictionary for_statement pattern_list identifier identifier identifier block expression_statement assignment subscript subscript identifier string string_start string_content string_end identifier call identifier argument_list binary_operator integer identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end identifier call identifier argument_list binary_operator integer identifier expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end identifier call identifier argument_list binary_operator integer identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end identifier call identifier argument_list binary_operator integer identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end call identifier argument_list integer expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end call identifier argument_list integer for_statement pattern_list identifier identifier identifier block for_statement identifier identifier block expression_statement assignment subscript subscript identifier string string_start string_content string_end identifier call identifier argument_list identifier for_statement identifier call identifier argument_list integer block expression_statement assignment subscript subscript identifier string string_start string_content string_end call identifier argument_list identifier call identifier argument_list identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end call identifier argument_list identifier call identifier argument_list identifier return_statement identifier
|
Build code map, encapsulated to reduce module-level globals.
|
def _vcf_info(start, end, mate_id, info=None):
out = "SVTYPE=BND;MATEID={mate};IMPRECISE;CIPOS=0,{size}".format(
mate=mate_id, size=end-start)
if info is not None:
extra_info = ";".join("{0}={1}".format(k, v) for k, v in info.iteritems())
out = "{0};{1}".format(out, extra_info)
return out
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier none block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier identifier keyword_argument identifier binary_operator identifier identifier if_statement comparison_operator identifier none block expression_statement assignment identifier call attribute string string_start string_content string_end identifier generator_expression 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 expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier identifier return_statement identifier
|
Return breakend information line with mate and imprecise location.
|
def _write_bed_header(self):
final_byte = 1 if self._bed_format == "SNP-major" else 0
self._bed.write(bytearray((108, 27, final_byte)))
|
module function_definition identifier parameters identifier block expression_statement assignment identifier conditional_expression integer comparison_operator attribute identifier identifier string string_start string_content string_end integer expression_statement call attribute attribute identifier identifier identifier argument_list call identifier argument_list tuple integer integer identifier
|
Writes the BED first 3 bytes.
|
def vsh(cmd, *args, **kw):
args = '" "'.join(i.replace('"', r'\"') for i in args)
easy.sh('"%s" "%s"' % (venv_bin(cmd), args))
|
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call attribute string string_start string_content string_end identifier generator_expression call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end for_in_clause identifier identifier expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end tuple call identifier argument_list identifier identifier
|
Execute a command installed into the active virtualenv.
|
def map_package(shutit_pexpect_session, package, install_type):
if package in PACKAGE_MAP.keys():
for itype in PACKAGE_MAP[package].keys():
if itype == install_type:
ret = PACKAGE_MAP[package][install_type]
if isinstance(ret,str):
return ret
if callable(ret):
ret(shutit_pexpect_session)
return ''
return package
|
module function_definition identifier parameters identifier identifier identifier block if_statement comparison_operator identifier call attribute identifier identifier argument_list block for_statement identifier call attribute subscript identifier identifier identifier argument_list block if_statement comparison_operator identifier identifier block expression_statement assignment identifier subscript subscript identifier identifier identifier if_statement call identifier argument_list identifier identifier block return_statement identifier if_statement call identifier argument_list identifier block expression_statement call identifier argument_list identifier return_statement string string_start string_end return_statement identifier
|
If package mapping exists, then return it, else return package.
|
def git_ls_tree(repo_dir, treeish='HEAD'):
command = ['git', 'ls-tree', '-r', '--full-tree', treeish]
raw = execute_git_command(command, repo_dir=repo_dir).splitlines()
output = [l.strip() for l in raw if l.strip()]
breakout = [k.split(None, 3) for k in output]
headers = ['mode', 'type', 'object', 'file']
return [dict(zip(headers, vals)) for vals in breakout]
|
module function_definition identifier parameters identifier default_parameter identifier string string_start string_content string_end block expression_statement assignment identifier list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end identifier expression_statement assignment identifier call attribute call identifier argument_list identifier keyword_argument identifier identifier identifier argument_list expression_statement assignment identifier list_comprehension call attribute identifier identifier argument_list for_in_clause identifier identifier if_clause call attribute identifier identifier argument_list expression_statement assignment identifier list_comprehension call attribute identifier identifier argument_list none integer for_in_clause identifier identifier 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 return_statement list_comprehension call identifier argument_list call identifier argument_list identifier identifier for_in_clause identifier identifier
|
Run git ls-tree.
|
def do_EOF(self, args):
if _debug: ConsoleCmd._debug("do_EOF %r", args)
return self.do_exit(args)
|
module function_definition identifier parameters identifier identifier block if_statement identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier return_statement call attribute identifier identifier argument_list identifier
|
Exit on system end of file character
|
def unzip_unicode(output, version):
unzipper = zipfile.ZipFile(os.path.join(output, 'unicodedata', '%s.zip' % version))
target = os.path.join(output, 'unicodedata', version)
print('Unzipping %s.zip...' % version)
os.makedirs(target)
for f in unzipper.namelist():
unzipper.extract(f, target)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end binary_operator string string_start string_content string_end identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end identifier expression_statement call identifier argument_list binary_operator string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list identifier for_statement identifier call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list identifier identifier
|
Unzip the Unicode files.
|
def add_arguments(cls, parser, sys_arg_list=None):
parser.add_argument('--tcp_check_interval',
dest='tcp_check_interval',
required=False, default=2, type=float,
help="TCP health-test interval in seconds, "
"default 2 "
"(only for 'tcp' health monitor plugin)")
parser.add_argument('--tcp_check_port',
dest='tcp_check_port',
required=False, default=22, type=int,
help="Port for TCP health-test, default 22 "
"(only for 'tcp' health monitor plugin)")
return ["tcp_check_interval", "tcp_check_port"]
|
module function_definition identifier parameters identifier identifier default_parameter identifier none block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier string string_start string_content string_end keyword_argument identifier false keyword_argument identifier integer keyword_argument identifier identifier keyword_argument identifier concatenated_string string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier string string_start string_content string_end keyword_argument identifier false keyword_argument identifier integer keyword_argument identifier identifier keyword_argument identifier concatenated_string string string_start string_content string_end string string_start string_content string_end return_statement list string string_start string_content string_end string string_start string_content string_end
|
Arguments for the TCP health monitor plugin.
|
def _triplify_object(self, data, parent):
subject = self.get_subject(data)
if self.path:
yield (subject, TYPE_SCHEMA, self.path, TYPE_SCHEMA)
if parent is not None:
yield (parent, self.predicate, subject, TYPE_LINK)
if self.reverse is not None:
yield (subject, self.reverse, parent, TYPE_LINK)
for prop in self.properties:
for res in prop.triplify(data.get(prop.name), subject):
yield res
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement attribute identifier identifier block expression_statement yield tuple identifier identifier attribute identifier identifier identifier if_statement comparison_operator identifier none block expression_statement yield tuple identifier attribute identifier identifier identifier identifier if_statement comparison_operator attribute identifier identifier none block expression_statement yield tuple identifier attribute identifier identifier identifier identifier for_statement identifier attribute identifier identifier block for_statement identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list attribute identifier identifier identifier block expression_statement yield identifier
|
Create bi-directional statements for object relationships.
|
def response_json(self, status, response, content_type='application/json', encoding='utf-8', headers=None, jsonp=None):
encoder = JSONEncoder(
check_circular=self.app.validate_output,
allow_nan=False,
sort_keys=True,
indent=2 if self.app.pretty_output else None,
separators=(',', ': ') if self.app.pretty_output else (',', ':')
)
content = encoder.encode(response)
if jsonp:
content_list = [jsonp.encode(encoding), b'(', content.encode(encoding), b');']
else:
content_list = [content.encode(encoding)]
return self.response(status, content_type, content_list, headers=headers)
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier string string_start string_content string_end default_parameter identifier string string_start string_content string_end default_parameter identifier none default_parameter identifier none block expression_statement assignment identifier call identifier argument_list keyword_argument identifier attribute attribute identifier identifier identifier keyword_argument identifier false keyword_argument identifier true keyword_argument identifier conditional_expression integer attribute attribute identifier identifier identifier none keyword_argument identifier conditional_expression tuple string string_start string_content string_end string string_start string_content string_end attribute attribute identifier identifier 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 if_statement identifier block expression_statement assignment identifier list call attribute identifier identifier argument_list identifier string string_start string_content string_end call attribute identifier identifier argument_list identifier string string_start string_content string_end else_clause block expression_statement assignment identifier list call attribute identifier identifier argument_list identifier return_statement call attribute identifier identifier argument_list identifier identifier identifier keyword_argument identifier identifier
|
Send a JSON response
|
def render_formset_errors(formset, **kwargs):
renderer_cls = get_formset_renderer(**kwargs)
return renderer_cls(formset, **kwargs).render_errors()
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call identifier argument_list dictionary_splat identifier return_statement call attribute call identifier argument_list identifier dictionary_splat identifier identifier argument_list
|
Render formset errors to a Bootstrap layout
|
def find_resources(client):
wildcard = Keys.DISPENSER.format('*')
pattern = re.compile(Keys.DISPENSER.format('(.*)'))
return [pattern.match(d).group(1)
for d in client.scan_iter(wildcard)]
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end return_statement list_comprehension call attribute call attribute identifier identifier argument_list identifier identifier argument_list integer for_in_clause identifier call attribute identifier identifier argument_list identifier
|
Detect dispensers and return corresponding resources.
|
def find_build_dir(path, build="_build"):
path = os.path.abspath(os.path.expanduser(path))
contents = os.listdir(path)
filtered_contents = [directory for directory in contents
if os.path.isdir(os.path.join(path, directory))]
if build in filtered_contents:
return os.path.join(path, build)
else:
if path == os.path.realpath("/"):
return None
else:
return find_build_dir("{0}/..".format(path), build)
|
module function_definition identifier parameters identifier default_parameter identifier string string_start string_content string_end block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier list_comprehension identifier for_in_clause identifier identifier if_clause call attribute attribute identifier identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier identifier if_statement comparison_operator identifier identifier block return_statement call attribute attribute identifier identifier identifier argument_list identifier identifier else_clause block if_statement comparison_operator identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end block return_statement none else_clause block return_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier identifier
|
try to guess the build folder's location
|
def create(self, weeks):
user_pageviews = self.create_profiles('Pageviews', weeks)
user_downloads = self.create_profiles('Downloads', weeks)
self._export_profiles('Profiles', user_pageviews, user_downloads)
user_pageviews = self.create_profiles('Pageviews_IP', weeks, True)
user_downloads = self.create_profiles('Downloads_IP', weeks, True)
self._export_profiles('Profiles_IP', user_pageviews, user_downloads,
ip_user=True)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end identifier true expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end identifier true expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier identifier keyword_argument identifier true
|
Create the user and ip profiles for the given weeks.
|
def pairwise_mean(values):
"Averages between a value and the next value in a sequence"
return numpy.array([numpy.mean(pair) for pair in pairwise(values)])
|
module function_definition identifier parameters identifier block expression_statement string string_start string_content string_end return_statement call attribute identifier identifier argument_list list_comprehension call attribute identifier identifier argument_list identifier for_in_clause identifier call identifier argument_list identifier
|
Averages between a value and the next value in a sequence
|
def current_settings(self):
settings = {}
if not self.status_data:
return settings
for (key, val) in self.status_data.get('curvals', {}).items():
try:
val = float(val)
except ValueError:
val = val
if val in ('on', 'off'):
val = (val == 'on')
settings[key] = val
return settings
|
module function_definition identifier parameters identifier block expression_statement assignment identifier dictionary if_statement not_operator attribute identifier identifier block return_statement identifier for_statement tuple_pattern identifier identifier call attribute call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end dictionary identifier argument_list block try_statement block expression_statement assignment identifier call identifier argument_list identifier except_clause identifier block expression_statement assignment identifier identifier if_statement comparison_operator identifier tuple string string_start string_content string_end string string_start string_content string_end block expression_statement assignment identifier parenthesized_expression comparison_operator identifier string string_start string_content string_end expression_statement assignment subscript identifier identifier identifier return_statement identifier
|
Return dict with all config include.
|
def scale_to(x, ratio, targ):
return max(math.floor(x*ratio), targ)
|
module function_definition identifier parameters identifier identifier identifier block return_statement call identifier argument_list call attribute identifier identifier argument_list binary_operator identifier identifier identifier
|
Calculate dimension of an image during scaling with aspect ratio
|
def verify_chunks(self, chunks):
err = []
for chunk in chunks:
err.extend(self.verify_data(chunk))
return err
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier return_statement identifier
|
Verify the chunks in a list of low data structures
|
def add_unique_template_variables(self, options):
options.update(dict(
geojson_data=json.dumps(self.data, ensure_ascii=False),
colorProperty=self.color_property,
colorType=self.color_function_type,
colorStops=self.color_stops,
strokeWidth=self.stroke_width,
strokeColor=self.stroke_color,
radius=self.radius,
defaultColor=self.color_default,
highlightColor=self.highlight_color
))
if self.vector_source:
options.update(vectorColorStops=self.generate_vector_color_map())
|
module function_definition identifier parameters identifier identifier block expression_statement call attribute identifier identifier argument_list call identifier argument_list keyword_argument identifier call attribute identifier identifier argument_list attribute identifier identifier keyword_argument identifier false keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list keyword_argument identifier call attribute identifier identifier argument_list
|
Update map template variables specific to circle visual
|
def _adb_screencap(self, scale=1.0):
remote_file = tempfile.mktemp(dir='/data/local/tmp/', prefix='screencap-', suffix='.png')
local_file = tempfile.mktemp(prefix='atx-screencap-', suffix='.png')
self.shell('screencap', '-p', remote_file)
try:
self.pull(remote_file, local_file)
image = imutils.open_as_pillow(local_file)
if scale is not None and scale != 1.0:
image = image.resize([int(scale * s) for s in image.size], Image.BICUBIC)
rotation = self.rotation()
if rotation:
method = getattr(Image, 'ROTATE_{}'.format(rotation*90))
image = image.transpose(method)
return image
finally:
self.remove(remote_file)
os.unlink(local_file)
|
module function_definition identifier parameters identifier default_parameter identifier float block 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 string string_start string_content string_end 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 expression_statement call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end identifier try_statement block expression_statement call attribute identifier identifier argument_list identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement boolean_operator comparison_operator identifier none comparison_operator identifier float block expression_statement assignment identifier call attribute identifier identifier argument_list list_comprehension call identifier argument_list binary_operator identifier identifier for_in_clause identifier attribute identifier identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list if_statement identifier block expression_statement assignment identifier call identifier argument_list identifier call attribute string string_start string_content string_end identifier argument_list binary_operator identifier integer expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement identifier finally_clause block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier
|
capture screen with adb shell screencap
|
def reset_kernel(self):
client = self.get_current_client()
if client is not None:
self.switch_to_plugin()
client.reset_namespace()
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list if_statement comparison_operator identifier none block expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
|
Reset kernel of current client.
|
def summary(self):
print("\nStatus summary")
print("=" * 79)
print("{0}found {1} dependencies in {2} packages.{3}\n".format(
self.grey, self.count_dep, self.count_pkg, self.endc))
|
module function_definition identifier parameters identifier block expression_statement call identifier argument_list string string_start string_content escape_sequence string_end expression_statement call identifier argument_list binary_operator string string_start string_content string_end integer expression_statement call identifier argument_list call attribute string string_start string_content escape_sequence string_end identifier argument_list attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier
|
Summary by packages and dependencies
|
def link_docstring(modules, docstring:str, overwrite:bool=False)->str:
"Search `docstring` for backticks and attempt to link those functions to respective documentation."
mods = listify(modules)
for mod in mods: _modvars.update(mod.__dict__)
return re.sub(BT_REGEX, replace_link, docstring)
|
module function_definition identifier parameters identifier typed_parameter identifier type identifier typed_default_parameter identifier type identifier false type identifier block expression_statement string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list attribute identifier identifier return_statement call attribute identifier identifier argument_list identifier identifier identifier
|
Search `docstring` for backticks and attempt to link those functions to respective documentation.
|
def pretty_print_table_instance(table):
assert isinstance(table, Table)
def pretty_print_row(styled, plain):
click.secho(
" | ".join(
v + " " * (table.column_widths[k] - len(plain[k]))
for k, v in enumerate(styled)
)
)
pretty_print_row(table.headers, table.plain_headers)
for k, row in enumerate(table.rows):
pretty_print_row(row, table.plain_rows[k])
|
module function_definition identifier parameters identifier block assert_statement call identifier argument_list identifier identifier function_definition identifier parameters identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier generator_expression binary_operator identifier binary_operator string string_start string_content string_end parenthesized_expression binary_operator subscript attribute identifier identifier identifier call identifier argument_list subscript identifier identifier for_in_clause pattern_list identifier identifier call identifier argument_list identifier expression_statement call identifier argument_list attribute identifier identifier attribute identifier identifier for_statement pattern_list identifier identifier call identifier argument_list attribute identifier identifier block expression_statement call identifier argument_list identifier subscript attribute identifier identifier identifier
|
Pretty print a table instance.
|
def delete_set(self, x):
if x not in self._parents:
return
members = list(self.members(x))
for v in members:
del self._parents[v]
del self._weights[v]
del self._prev_next[v]
del self._min_values[v]
|
module function_definition identifier parameters identifier identifier block if_statement comparison_operator identifier attribute identifier identifier block return_statement expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list identifier for_statement identifier identifier block delete_statement subscript attribute identifier identifier identifier delete_statement subscript attribute identifier identifier identifier delete_statement subscript attribute identifier identifier identifier delete_statement subscript attribute identifier identifier identifier
|
Removes the equivalence class containing `x`.
|
def edge_list(self) -> List[Edge]:
return [edge for edge in sorted(self._edges.values(), key=attrgetter("key"))]
|
module function_definition identifier parameters identifier type generic_type identifier type_parameter type identifier block return_statement list_comprehension identifier for_in_clause identifier call identifier argument_list call attribute attribute identifier identifier identifier argument_list keyword_argument identifier call identifier argument_list string string_start string_content string_end
|
The ordered list of edges in the container.
|
def _caching_enabled(self):
try:
config = self._runtime.get_configuration()
parameter_id = Id('parameter:useCachingForQualifierIds@json')
if config.get_value_by_parameter(parameter_id).get_boolean_value():
return True
else:
return False
except (AttributeError, KeyError, errors.NotFound):
return False
|
module function_definition identifier parameters identifier block try_statement block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier call identifier argument_list string string_start string_content string_end if_statement call attribute call attribute identifier identifier argument_list identifier identifier argument_list block return_statement true else_clause block return_statement false except_clause tuple identifier identifier attribute identifier identifier block return_statement false
|
Returns True if caching is enabled per configuration, false otherwise.
|
def addFeaturesSearchOptions(parser):
addFeatureSetIdArgument(parser)
addFeaturesReferenceNameArgument(parser)
addStartArgument(parser)
addEndArgument(parser)
addParentFeatureIdArgument(parser)
addFeatureTypesArgument(parser)
|
module function_definition identifier parameters identifier block expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier
|
Adds common options to a features search command line parser.
|
def _relative_frequency(self, word):
count = self.type_counts.get(word, 0)
return math.log(count/len(self.type_counts)) if count > 0 else 0
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier integer return_statement conditional_expression call attribute identifier identifier argument_list binary_operator identifier call identifier argument_list attribute identifier identifier comparison_operator identifier integer integer
|
Computes the log relative frequency for a word form
|
def close(self):
uwsgi.disconnect()
if self._req_ctx is None:
self._select_greenlet.kill()
self._event.set()
|
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list if_statement comparison_operator attribute identifier identifier none block expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list
|
Disconnects uWSGI from the client.
|
def add(self, items):
options = self._create_options(items)
for k, v in options.items():
if k in self.labels and v not in self.items:
options.pop(k)
count = 0
while f'{k}_{count}' in self.labels:
count += 1
options[f'{k}_{count}'] = v
self.widget.options.update(options)
self.widget.param.trigger('options')
self.widget.value = list(options.values())[:1]
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block if_statement boolean_operator comparison_operator identifier attribute identifier identifier comparison_operator identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier integer while_statement comparison_operator string string_start interpolation identifier string_content interpolation identifier string_end attribute identifier identifier block expression_statement augmented_assignment identifier integer expression_statement assignment subscript identifier string string_start interpolation identifier string_content interpolation identifier string_end identifier 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 string string_start string_content string_end expression_statement assignment attribute attribute identifier identifier identifier subscript call identifier argument_list call attribute identifier identifier argument_list slice integer
|
Add items to options
|
def isotime(at=None, subsecond=False):
if not at:
at = utcnow()
st = at.strftime(_ISO8601_TIME_FORMAT
if not subsecond
else _ISO8601_TIME_FORMAT_SUBSECOND)
tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC'
st += ('Z' if tz == 'UTC' else tz)
return st
|
module function_definition identifier parameters default_parameter identifier none default_parameter identifier false block if_statement not_operator identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list conditional_expression identifier not_operator identifier identifier expression_statement assignment identifier conditional_expression call attribute attribute identifier identifier identifier argument_list none attribute identifier identifier string string_start string_content string_end expression_statement augmented_assignment identifier parenthesized_expression conditional_expression string string_start string_content string_end comparison_operator identifier string string_start string_content string_end identifier return_statement identifier
|
Stringify time in ISO 8601 format.
|
def read(url, **kwargs):
response = open_url(url, **kwargs)
try:
return response.read()
finally:
response.close()
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call identifier argument_list identifier dictionary_splat identifier try_statement block return_statement call attribute identifier identifier argument_list finally_clause block expression_statement call attribute identifier identifier argument_list
|
Read the contents of a URL into memory, return
|
def euclid(a, b):
a = abs(a)
b = abs(b)
if a < b:
a, b = b, a
while b != 0:
a, b = b, a % b
return a
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier if_statement comparison_operator identifier identifier block expression_statement assignment pattern_list identifier identifier expression_list identifier identifier while_statement comparison_operator identifier integer block expression_statement assignment pattern_list identifier identifier expression_list identifier binary_operator identifier identifier return_statement identifier
|
returns the Greatest Common Divisor of a and b
|
def _get_image_size(self, maxcharno, maxlineno):
return (self._get_char_x(maxcharno) + self.image_pad,
self._get_line_y(maxlineno + 0) + self.image_pad)
|
module function_definition identifier parameters identifier identifier identifier block return_statement tuple binary_operator call attribute identifier identifier argument_list identifier attribute identifier identifier binary_operator call attribute identifier identifier argument_list binary_operator identifier integer attribute identifier identifier
|
Get the required image size.
|
def merged_gasmap(self, **kwargs):
kwargs_copy = self.base_dict.copy()
kwargs_copy.update(**kwargs)
self._replace_none(kwargs_copy)
localpath = NameFactory.merged_gasmap_format.format(**kwargs_copy)
if kwargs.get('fullpath', False):
return self.fullpath(localpath=localpath)
return localpath
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list dictionary_splat identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list dictionary_splat identifier if_statement call attribute identifier identifier argument_list string string_start string_content string_end false block return_statement call attribute identifier identifier argument_list keyword_argument identifier identifier return_statement identifier
|
return the file name for Galprop merged gasmaps
|
def get(self, key: Text, locale: Optional[Text]) -> List[Tuple[Text, ...]]:
locale = self.choose_locale(locale)
return self.dict[locale][key]
|
module function_definition identifier parameters identifier typed_parameter identifier type identifier typed_parameter identifier type generic_type identifier type_parameter type identifier type generic_type identifier type_parameter type generic_type identifier type_parameter type identifier type ellipsis block expression_statement assignment identifier call attribute identifier identifier argument_list identifier return_statement subscript subscript attribute identifier identifier identifier identifier
|
Get a single set of intents.
|
def use_settings(**kwargs):
from omnic import singletons
singletons.settings.use_settings_dict(kwargs)
yield
singletons.settings.use_previous_settings()
|
module function_definition identifier parameters dictionary_splat_pattern identifier block import_from_statement dotted_name identifier dotted_name identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement yield expression_statement call attribute attribute identifier identifier identifier argument_list
|
Context manager to temporarily override settings
|
def _role_remove(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
if not user_exists(name, user, host, port, maintenance_db,
password=password, runas=runas):
log.info('User \'%s\' does not exist', name)
return False
sub_cmd = 'DROP ROLE "{0}"'.format(name)
_psql_prepare_and_run(
['-c', sub_cmd],
runas=runas, host=host, user=user, port=port,
maintenance_db=maintenance_db, password=password)
if not user_exists(name, user, host, port, maintenance_db,
password=password, runas=runas):
return True
else:
log.info('Failed to delete user \'%s\'.', name)
return False
|
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier none default_parameter identifier none block if_statement not_operator call identifier argument_list identifier identifier identifier identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content escape_sequence escape_sequence string_end identifier return_statement false expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier expression_statement call identifier argument_list list string string_start string_content string_end identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier if_statement not_operator call identifier argument_list identifier identifier identifier identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier block return_statement true else_clause block expression_statement call attribute identifier identifier argument_list string string_start string_content escape_sequence escape_sequence string_end identifier return_statement false
|
Removes a role from the Postgres Server
|
def _write(self, session, openFile, replaceParamFile):
hmetRecords = self.hmetRecords
for record in hmetRecords:
openFile.write('%s\t%s\t%s\t%s\t%.3f\t%s\t%s\t%s\t%s\t%.2f\t%.2f\n' % (
record.hmetDateTime.year,
record.hmetDateTime.month,
record.hmetDateTime.day,
record.hmetDateTime.hour,
record.barometricPress,
record.relHumidity,
record.totalSkyCover,
record.windSpeed,
record.dryBulbTemp,
record.directRad,
record.globalRad))
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment identifier attribute identifier identifier for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list binary_operator 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 escape_sequence string_end tuple attribute attribute identifier identifier identifier attribute attribute identifier identifier identifier attribute attribute identifier identifier identifier attribute attribute identifier identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier
|
Write HMET WES to File Method
|
def EnsureSConsVersion(self, major, minor, revision=0):
if SCons.__version__ == '__' + 'VERSION__':
SCons.Warnings.warn(SCons.Warnings.DevelopmentVersionWarning,
"EnsureSConsVersion is ignored for development version")
return
scons_ver = self._get_major_minor_revision(SCons.__version__)
if scons_ver < (major, minor, revision):
if revision:
scons_ver_string = '%d.%d.%d' % (major, minor, revision)
else:
scons_ver_string = '%d.%d' % (major, minor)
print("SCons %s or greater required, but you have SCons %s" % \
(scons_ver_string, SCons.__version__))
sys.exit(2)
|
module function_definition identifier parameters identifier identifier identifier default_parameter identifier integer block if_statement comparison_operator attribute identifier identifier binary_operator string string_start string_content string_end string string_start string_content string_end block expression_statement call attribute attribute identifier identifier identifier argument_list attribute attribute identifier identifier identifier string string_start string_content string_end return_statement expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier if_statement comparison_operator identifier tuple identifier identifier identifier block if_statement identifier block expression_statement assignment identifier binary_operator string string_start string_content string_end tuple identifier identifier identifier else_clause block expression_statement assignment identifier binary_operator string string_start string_content string_end tuple identifier identifier expression_statement call identifier argument_list binary_operator string string_start string_content string_end line_continuation tuple identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list integer
|
Exit abnormally if the SCons version is not late enough.
|
def s3_etag(url: str) -> Optional[str]:
s3_resource = boto3.resource("s3")
bucket_name, s3_path = split_s3_path(url)
s3_object = s3_resource.Object(bucket_name, s3_path)
return s3_object.e_tag
|
module function_definition identifier parameters typed_parameter identifier type identifier type generic_type identifier type_parameter type identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment pattern_list identifier identifier call identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier return_statement attribute identifier identifier
|
Check ETag on S3 object.
|
def _byteify(data):
if isinstance(data, six.text_type):
return data.encode("utf-8")
if isinstance(data, list):
return [_byteify(item) for item in data]
if isinstance(data, dict):
return {
_byteify(key): _byteify(value) for key, value in data.items()
}
return data
|
module function_definition identifier parameters identifier block if_statement call identifier argument_list identifier attribute identifier identifier block return_statement call attribute identifier identifier argument_list string string_start string_content string_end if_statement call identifier argument_list identifier identifier block return_statement list_comprehension call identifier argument_list identifier for_in_clause identifier identifier if_statement call identifier argument_list identifier identifier block return_statement dictionary_comprehension pair call identifier argument_list identifier call identifier argument_list identifier for_in_clause pattern_list identifier identifier call attribute identifier identifier argument_list return_statement identifier
|
Convert unicode to bytes
|
def remove_workspace(self):
def confirm_clicked():
if len(self.document_model.workspaces) > 1:
command = Workspace.RemoveWorkspaceCommand(self)
command.perform()
self.document_controller.push_undo_command(command)
caption = _("Remove workspace named '{0}'?").format(self.__workspace.name)
self.pose_confirmation_message_box(caption, confirm_clicked, accepted_text=_("Remove Workspace"),
message_box_id="remove_workspace")
|
module function_definition identifier parameters identifier block function_definition identifier parameters block if_statement comparison_operator call identifier argument_list attribute attribute identifier identifier identifier integer block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call attribute call identifier argument_list string string_start string_content string_end identifier argument_list attribute attribute identifier identifier identifier expression_statement call attribute identifier identifier argument_list identifier identifier keyword_argument identifier call identifier argument_list string string_start string_content string_end keyword_argument identifier string string_start string_content string_end
|
Pose a dialog to confirm removal then remove workspace.
|
def add_view(self, *args, **kwargs):
try:
singleton = self.model.objects.get()
except (self.model.DoesNotExist, self.model.MultipleObjectsReturned):
kwargs.setdefault("extra_context", {})
kwargs["extra_context"]["singleton"] = True
response = super(SingletonAdmin, self).add_view(*args, **kwargs)
return self.handle_save(args[0], response)
return redirect(admin_url(self.model, "change", singleton.id))
|
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block try_statement block expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list except_clause tuple attribute attribute identifier identifier identifier attribute attribute identifier identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end dictionary expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end true expression_statement assignment identifier call attribute call identifier argument_list identifier identifier identifier argument_list list_splat identifier dictionary_splat identifier return_statement call attribute identifier identifier argument_list subscript identifier integer identifier return_statement call identifier argument_list call identifier argument_list attribute identifier identifier string string_start string_content string_end attribute identifier identifier
|
Redirect to the change view if the singleton instance exists.
|
def _filter_by_pattern(self, pattern):
try:
_len = len(pattern)
except TypeError:
raise TypeError("pattern is not a list of Booleans. Got {}".format(
type(pattern)))
_filt_values = [d for i, d in enumerate(self._values) if pattern[i % _len]]
_filt_datetimes = [d for i, d in enumerate(self.datetimes) if pattern[i % _len]]
return _filt_values, _filt_datetimes
|
module function_definition identifier parameters identifier identifier block try_statement block expression_statement assignment identifier call identifier argument_list identifier except_clause identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list call identifier argument_list identifier expression_statement assignment identifier list_comprehension identifier for_in_clause pattern_list identifier identifier call identifier argument_list attribute identifier identifier if_clause subscript identifier binary_operator identifier identifier expression_statement assignment identifier list_comprehension identifier for_in_clause pattern_list identifier identifier call identifier argument_list attribute identifier identifier if_clause subscript identifier binary_operator identifier identifier return_statement expression_list identifier identifier
|
Filter the Filter the Data Collection based on a list of booleans.
|
def _utc_float(self):
tai = self.tai
leap_dates = self.ts.leap_dates
leap_offsets = self.ts.leap_offsets
leap_reverse_dates = leap_dates + leap_offsets / DAY_S
i = searchsorted(leap_reverse_dates, tai, 'right')
return tai - leap_offsets[i] / DAY_S
|
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment identifier binary_operator identifier binary_operator identifier identifier expression_statement assignment identifier call identifier argument_list identifier identifier string string_start string_content string_end return_statement binary_operator identifier binary_operator subscript identifier identifier identifier
|
Return UTC as a floating point Julian date.
|
def url(self):
url = u'{home_url}{permalink}'.format(home_url=settings.HOME_URL,
permalink=self._permalink)
url = re.sub(r'/{2,}', r'/', url)
return url
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end identifier return_statement identifier
|
The site-relative URL to the post.
|
def _parse_template(self, has_content):
reset = self._head
context = contexts.TEMPLATE_NAME
if has_content:
context |= contexts.HAS_TEMPLATE
try:
template = self._parse(context)
except BadRoute:
self._head = reset
raise
self._emit_first(tokens.TemplateOpen())
self._emit_all(template)
self._emit(tokens.TemplateClose())
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier attribute identifier identifier if_statement identifier block expression_statement augmented_assignment identifier attribute identifier identifier try_statement block expression_statement assignment identifier call attribute identifier identifier argument_list identifier except_clause identifier block expression_statement assignment attribute identifier identifier identifier raise_statement expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list
|
Parse a template at the head of the wikicode string.
|
def remove_api_key(self, api_id, stage_name):
response = self.apigateway_client.get_api_keys(
limit=1,
nameQuery='{}_{}'.format(stage_name, api_id)
)
for api_key in response.get('items'):
self.apigateway_client.delete_api_key(
apiKey="{}".format(api_key['id'])
)
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list keyword_argument identifier integer keyword_argument identifier call attribute string string_start string_content string_end identifier argument_list identifier identifier for_statement identifier call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement call attribute attribute identifier identifier identifier argument_list keyword_argument identifier call attribute string string_start string_content string_end identifier argument_list subscript identifier string string_start string_content string_end
|
Remove a generated API key for api_id and stage_name
|
def bar(self, progress):
if not hasattr(self, "_limit") or not self._limit:
self._limit = self.terminal_size()
graph_progress = int(progress * self._limit)
self.stdout.write('\r', ending='')
progress_format = "[%-{}s] %d%%".format(self._limit)
self.stdout.write(
self.style.SUCCESS(progress_format % (self.progress_symbol * graph_progress, int(progress * 100))),
ending=''
)
self.stdout.flush()
|
module function_definition identifier parameters identifier identifier block if_statement boolean_operator not_operator call identifier argument_list identifier string string_start string_content string_end not_operator attribute identifier identifier block expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list expression_statement assignment identifier call identifier argument_list binary_operator identifier attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content escape_sequence string_end keyword_argument identifier string string_start string_end expression_statement assignment 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 call attribute attribute identifier identifier identifier argument_list binary_operator identifier tuple binary_operator attribute identifier identifier identifier call identifier argument_list binary_operator identifier integer keyword_argument identifier string string_start string_end expression_statement call attribute attribute identifier identifier identifier argument_list
|
Shows on the stdout the progress bar for the given progress.
|
def clean_new(self, value):
value = self.schema_class(value).full_clean()
return self.object_class(**value)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list identifier identifier argument_list return_statement call attribute identifier identifier argument_list dictionary_splat identifier
|
Return a new object instantiated with cleaned data.
|
def makeHawkExt(self):
o = self.options
c = o.get('credentials', {})
if c.get('clientId') and c.get('accessToken'):
ext = {}
cert = c.get('certificate')
if cert:
if six.PY3 and isinstance(cert, six.binary_type):
cert = cert.decode()
if isinstance(cert, six.string_types):
cert = json.loads(cert)
ext['certificate'] = cert
if 'authorizedScopes' in o:
ext['authorizedScopes'] = o['authorizedScopes']
return utils.makeB64UrlSafe(utils.encodeStringForB64Header(utils.dumpJson(ext)).strip())
else:
return {}
|
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end dictionary if_statement boolean_operator call attribute identifier identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment identifier dictionary expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end if_statement identifier block if_statement boolean_operator attribute identifier identifier call identifier argument_list identifier attribute identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list if_statement call identifier argument_list identifier attribute identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment subscript identifier string string_start string_content string_end identifier if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end return_statement call attribute identifier identifier argument_list call attribute call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier identifier argument_list else_clause block return_statement dictionary
|
Make an 'ext' for Hawk authentication
|
def server_info(self):
response = self._post(self.apiurl + "/v2/server/info", data={'apikey': self.apikey})
return self._raise_or_extract(response)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list binary_operator attribute identifier identifier string string_start string_content string_end keyword_argument identifier dictionary pair string string_start string_content string_end attribute identifier identifier return_statement call attribute identifier identifier argument_list identifier
|
Query information about the server.
|
def print_subcommands(self):
lines = ["Call"]
lines.append('-'*len(lines[-1]))
lines.append('')
lines.append("> jhubctl <subcommand> <resource-type> <resource-name>")
lines.append('')
lines.append("Subcommands")
lines.append('-'*len(lines[-1]))
lines.append('')
for name, subcommand in self.subcommands.items():
lines.append(name)
lines.append(indent(subcommand[1]))
lines.append('')
print(os.linesep.join(lines))
|
module function_definition identifier parameters identifier block expression_statement assignment identifier list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end call identifier argument_list subscript identifier unary_operator integer expression_statement call attribute identifier identifier argument_list string string_start string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list string string_start string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end call identifier argument_list subscript identifier unary_operator integer expression_statement call attribute identifier identifier argument_list string string_start string_end for_statement pattern_list identifier identifier call attribute attribute identifier identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list call identifier argument_list subscript identifier integer expression_statement call attribute identifier identifier argument_list string string_start string_end expression_statement call identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier
|
Print the subcommand part of the help.
|
def load_context(context, file_path=None):
if not file_path:
file_path = _get_context_filepath()
if os.path.exists(file_path):
with io.open(file_path, encoding='utf-8') as f:
for line in f:
execute(line, context)
|
module function_definition identifier parameters identifier default_parameter identifier none block if_statement not_operator identifier block expression_statement assignment identifier call identifier argument_list if_statement call attribute attribute identifier identifier identifier argument_list identifier block with_statement with_clause with_item as_pattern call attribute identifier identifier argument_list identifier keyword_argument identifier string string_start string_content string_end as_pattern_target identifier block for_statement identifier identifier block expression_statement call identifier argument_list identifier identifier
|
Load a Context object in place from user data directory.
|
def limit(self, keys):
if not isinstance(keys, list) and not isinstance(keys, tuple):
keys = [keys]
remove_keys = [k for k in self.keys() if k not in keys]
for k in remove_keys:
self.pop(k)
|
module function_definition identifier parameters identifier identifier block if_statement boolean_operator not_operator call identifier argument_list identifier identifier not_operator call identifier argument_list identifier identifier block expression_statement assignment identifier list identifier expression_statement assignment identifier list_comprehension identifier for_in_clause identifier call attribute identifier identifier argument_list if_clause comparison_operator identifier identifier for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list identifier
|
Remove all keys other than the keys specified.
|
def profile_path(profile_id, profile):
user = os.path.expanduser("~")
return os.path.join(user, profile_id + profile)
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end return_statement call attribute attribute identifier identifier identifier argument_list identifier binary_operator identifier identifier
|
Create full path to given provide for the current user.
|
def passagg(recipient, sender):
adj = random.choice(pmxbot.phrases.adjs)
if random.choice([False, True]):
lead = ""
trail = recipient if not recipient else ", %s" % recipient
else:
lead = recipient if not recipient else "%s, " % recipient
trail = ""
body = random.choice(pmxbot.phrases.adj_intros) % adj
if not lead:
body = body.capitalize()
msg = "{lead}{body}{trail}.".format(**locals())
fw = random.choice(pmxbot.phrases.farewells)
return "{msg} {fw}, {sender}.".format(**locals())
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute attribute identifier identifier identifier if_statement call attribute identifier identifier argument_list list false true block expression_statement assignment identifier string string_start string_end expression_statement assignment identifier conditional_expression identifier not_operator identifier binary_operator string string_start string_content string_end identifier else_clause block expression_statement assignment identifier conditional_expression identifier not_operator identifier binary_operator string string_start string_content string_end identifier expression_statement assignment identifier string string_start string_end expression_statement assignment identifier binary_operator call attribute identifier identifier argument_list attribute attribute identifier identifier identifier identifier if_statement not_operator identifier block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list dictionary_splat call identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list attribute attribute identifier identifier identifier return_statement call attribute string string_start string_content string_end identifier argument_list dictionary_splat call identifier argument_list
|
Generate a passive-aggressive statement to recipient from sender.
|
def register_bse_task(self, *args, **kwargs):
kwargs["task_class"] = BseTask
return self.register_task(*args, **kwargs)
|
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement assignment subscript identifier string string_start string_content string_end identifier return_statement call attribute identifier identifier argument_list list_splat identifier dictionary_splat identifier
|
Register a Bethe-Salpeter task.
|
def add(self, histogram: Histogram1D):
if self.binning and not self.binning == histogram.binning:
raise ValueError("Cannot add histogram with different binning.")
self.histograms.append(histogram)
|
module function_definition identifier parameters identifier typed_parameter identifier type identifier block if_statement boolean_operator attribute identifier identifier not_operator comparison_operator attribute identifier identifier attribute 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 histogram to the collection.
|
def show_run(command_history_id):
from pprint import pprint
from .config import ConfigStore
from .database import DataBase
db = DataBase(ConfigStore().db_path)
with db.connection():
for ch_id in command_history_id:
crec = db.get_full_command_record(ch_id)
pprint(crec.__dict__)
print("")
|
module function_definition identifier parameters identifier block import_from_statement dotted_name identifier dotted_name identifier import_from_statement relative_import import_prefix dotted_name identifier dotted_name identifier import_from_statement relative_import import_prefix dotted_name identifier dotted_name identifier expression_statement assignment identifier call identifier argument_list attribute call identifier argument_list identifier with_statement with_clause with_item call attribute identifier identifier argument_list block for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement call identifier argument_list attribute identifier identifier expression_statement call identifier argument_list string string_start string_end
|
Show detailed command history by its ID.
|
def _set_complete_option(cls):
get_config = cls.context.get_config
complete = get_config('complete', None)
if complete is None:
conditions = [
get_config('transitions', False),
get_config('named_transitions', False),
]
complete = not any(conditions)
cls.context.new_meta['complete'] = complete
|
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment identifier call identifier argument_list string string_start string_content string_end none if_statement comparison_operator identifier none block expression_statement assignment identifier list call identifier argument_list string string_start string_content string_end false call identifier argument_list string string_start string_content string_end false expression_statement assignment identifier not_operator call identifier argument_list identifier expression_statement assignment subscript attribute attribute identifier identifier identifier string string_start string_content string_end identifier
|
Check and set complete option.
|
def detail(callback=None, path=None, method=Method.GET, resource=None, tags=None, summary="Get specified resource.",
middleware=None):
def inner(c):
op = Operation(c, path or PathParam('{key_field}'), method, resource, tags, summary, middleware)
op.responses.add(Response(HTTPStatus.OK, "Get a {name}"))
op.responses.add(Response(HTTPStatus.NOT_FOUND, "Not found", Error))
return op
return inner(callback) if callback else inner
|
module function_definition identifier parameters default_parameter identifier none default_parameter identifier none default_parameter identifier attribute identifier identifier default_parameter identifier none default_parameter identifier none default_parameter identifier string string_start string_content string_end default_parameter identifier none block function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list identifier boolean_operator identifier call identifier argument_list string string_start string_content string_end identifier identifier identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list call identifier argument_list attribute identifier identifier string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list call identifier argument_list attribute identifier identifier string string_start string_content string_end identifier return_statement identifier return_statement conditional_expression call identifier argument_list identifier identifier identifier
|
Decorator to configure an operation that fetches a resource.
|
def short_form_one_format(jupytext_format):
if not isinstance(jupytext_format, dict):
return jupytext_format
fmt = jupytext_format['extension']
if 'suffix' in jupytext_format:
fmt = jupytext_format['suffix'] + fmt
elif fmt.startswith('.'):
fmt = fmt[1:]
if 'prefix' in jupytext_format:
fmt = jupytext_format['prefix'] + '/' + fmt
if jupytext_format.get('format_name'):
if jupytext_format['extension'] not in ['.md', '.Rmd'] or jupytext_format['format_name'] == 'pandoc':
fmt = fmt + ':' + jupytext_format['format_name']
return fmt
|
module function_definition identifier parameters identifier block if_statement not_operator call identifier argument_list identifier identifier block return_statement identifier expression_statement assignment identifier subscript identifier string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment identifier binary_operator subscript identifier string string_start string_content string_end identifier elif_clause call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment identifier subscript identifier slice integer if_statement comparison_operator string string_start string_content string_end identifier block expression_statement assignment identifier binary_operator binary_operator subscript identifier string string_start string_content string_end string string_start string_content string_end identifier if_statement call attribute identifier identifier argument_list string string_start string_content string_end block if_statement boolean_operator comparison_operator subscript identifier string string_start string_content string_end list string string_start string_content string_end string string_start string_content string_end comparison_operator subscript identifier string string_start string_content string_end string string_start string_content string_end block expression_statement assignment identifier binary_operator binary_operator identifier string string_start string_content string_end subscript identifier string string_start string_content string_end return_statement identifier
|
Represent one jupytext format as a string
|
def _parse_file(self):
args = utilities.build_includes(self.arch.includes())
args.append('-E')
args.append('-D__attribute__(x)=')
args.append('-D__extension__=')
self.ast = parse_file(self.filepath, use_cpp=True, cpp_path='arm-none-eabi-gcc', cpp_args=args)
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute 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 assignment attribute identifier identifier call identifier argument_list attribute identifier identifier keyword_argument identifier true keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier
|
Preprocess and parse C file into an AST
|
def _create_threads(self):
creator = JobCreator(
self.config,
self.observers.jobs,
self.logger
)
self.jobs = creator.job_factory()
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list attribute identifier identifier attribute attribute identifier identifier identifier attribute identifier identifier expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list
|
This method creates job instances.
|
def setCell(self, x, y, v):
self.cells[y][x] = v
|
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment subscript subscript attribute identifier identifier identifier identifier identifier
|
set the cell value at x,y
|
def load_boston():
dataset = datasets.load_boston()
return Dataset(load_boston.__doc__, dataset.data, dataset.target, r2_score)
|
module function_definition identifier parameters block expression_statement assignment identifier call attribute identifier identifier argument_list return_statement call identifier argument_list attribute identifier identifier attribute identifier identifier attribute identifier identifier identifier
|
Boston House Prices Dataset.
|
def close(self):
if self._closing:
return
log.info('MWorkerQueue under PID %s is closing', os.getpid())
self._closing = True
if getattr(self, '_monitor', None) is not None:
self._monitor.stop()
self._monitor = None
if getattr(self, '_w_monitor', None) is not None:
self._w_monitor.stop()
self._w_monitor = None
if hasattr(self, 'clients') and self.clients.closed is False:
self.clients.close()
if hasattr(self, 'workers') and self.workers.closed is False:
self.workers.close()
if hasattr(self, 'stream'):
self.stream.close()
if hasattr(self, '_socket') and self._socket.closed is False:
self._socket.close()
if hasattr(self, 'context') and self.context.closed is False:
self.context.term()
|
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block return_statement expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier true if_statement comparison_operator call identifier argument_list identifier string string_start string_content string_end none none block expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement assignment attribute identifier identifier none if_statement comparison_operator call identifier argument_list identifier string string_start string_content string_end none none block expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement assignment attribute identifier identifier none if_statement boolean_operator call identifier argument_list identifier string string_start string_content string_end comparison_operator attribute attribute identifier identifier identifier false block expression_statement call attribute attribute identifier identifier identifier argument_list if_statement boolean_operator call identifier argument_list identifier string string_start string_content string_end comparison_operator attribute attribute identifier identifier identifier false block expression_statement call attribute attribute identifier identifier identifier argument_list if_statement call identifier argument_list identifier string string_start string_content string_end block expression_statement call attribute attribute identifier identifier identifier argument_list if_statement boolean_operator call identifier argument_list identifier string string_start string_content string_end comparison_operator attribute attribute identifier identifier identifier false block expression_statement call attribute attribute identifier identifier identifier argument_list if_statement boolean_operator call identifier argument_list identifier string string_start string_content string_end comparison_operator attribute attribute identifier identifier identifier false block expression_statement call attribute attribute identifier identifier identifier argument_list
|
Cleanly shutdown the router socket
|
def cache_call_signatures(source, user_pos, stmt):
index = user_pos[0] - 1
lines = source.splitlines() or ['']
if source and source[-1] == '\n':
lines.append('')
before_cursor = lines[index][:user_pos[1]]
other_lines = lines[stmt.start_pos[0]:index]
whole = '\n'.join(other_lines + [before_cursor])
before_bracket = re.match(r'.*\(', whole, re.DOTALL)
module_path = stmt.get_parent_until().path
return None if module_path is None else (module_path, before_bracket, stmt.start_pos)
|
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier binary_operator subscript identifier integer integer expression_statement assignment identifier boolean_operator call attribute identifier identifier argument_list list string string_start string_end if_statement boolean_operator identifier comparison_operator subscript identifier unary_operator integer string string_start string_content escape_sequence string_end block expression_statement call attribute identifier identifier argument_list string string_start string_end expression_statement assignment identifier subscript subscript identifier identifier slice subscript identifier integer expression_statement assignment identifier subscript identifier slice subscript attribute identifier identifier integer identifier expression_statement assignment identifier call attribute string string_start string_content escape_sequence string_end identifier argument_list binary_operator identifier list identifier expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end identifier attribute identifier identifier expression_statement assignment identifier attribute call attribute identifier identifier argument_list identifier return_statement conditional_expression none comparison_operator identifier none tuple identifier identifier attribute identifier identifier
|
This function calculates the cache key.
|
def run_and_save(data):
run(None, data)
stats_file, idxstats_file = _get_stats_files(data)
data = tz.update_in(data, ["depth", "samtools", "stats"], lambda x: stats_file)
data = tz.update_in(data, ["depth", "samtools", "idxstats"], lambda x: idxstats_file)
return data
|
module function_definition identifier parameters identifier block expression_statement call identifier argument_list none identifier expression_statement assignment pattern_list identifier identifier call identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end lambda lambda_parameters identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end lambda lambda_parameters identifier identifier return_statement identifier
|
Run QC, saving file outputs in data dictionary.
|
def close_stream(self):
if not self.is_connected:
return
self.stream.close()
self.state = DISCONNECTED
self.on_close.send(self)
|
module function_definition identifier parameters identifier block if_statement not_operator attribute identifier identifier block return_statement expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement assignment attribute identifier identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier
|
Close the underlying socket.
|
def symbol(self):
if self._symbol is None:
self._symbol = self._symbol_extract(cache.RE_CURSOR)
return self._symbol
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier none block expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list attribute identifier identifier return_statement attribute identifier identifier
|
Gets the symbol under the current cursor.
|
def _hue(color, **kwargs):
h = colorsys.rgb_to_hls(*[x / 255.0 for x in color.value[:3]])[0]
return NumberValue(h * 360.0)
|
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement assignment identifier subscript call attribute identifier identifier argument_list list_splat list_comprehension binary_operator identifier float for_in_clause identifier subscript attribute identifier identifier slice integer integer return_statement call identifier argument_list binary_operator identifier float
|
Get hue value of HSL color.
|
def to_dict(self):
return {
'id': self.set_id,
'title': self.title,
'terms': [term.to_dict() for term in self.terms]
}
|
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 list_comprehension call attribute identifier identifier argument_list for_in_clause identifier attribute identifier identifier
|
Convert WordSet into raw dictionary data.
|
def _remove_boundaries(self, interval):
begin = interval.begin
end = interval.end
if self.boundary_table[begin] == 1:
del self.boundary_table[begin]
else:
self.boundary_table[begin] -= 1
if self.boundary_table[end] == 1:
del self.boundary_table[end]
else:
self.boundary_table[end] -= 1
|
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier attribute identifier identifier if_statement comparison_operator subscript attribute identifier identifier identifier integer block delete_statement subscript attribute identifier identifier identifier else_clause block expression_statement augmented_assignment subscript attribute identifier identifier identifier integer if_statement comparison_operator subscript attribute identifier identifier identifier integer block delete_statement subscript attribute identifier identifier identifier else_clause block expression_statement augmented_assignment subscript attribute identifier identifier identifier integer
|
Removes the boundaries of the interval from the boundary table.
|
def dump_image_data(dataset_dir, data_dir, dataset, color_array_info, root=None, compress=True):
if root is None:
root = {}
root['vtkClass'] = 'vtkImageData'
container = root
container['spacing'] = dataset.GetSpacing()
container['origin'] = dataset.GetOrigin()
container['extent'] = dataset.GetExtent()
dump_all_arrays(dataset_dir, data_dir, dataset, container, compress)
return root
|
module function_definition identifier parameters identifier identifier identifier identifier default_parameter identifier none default_parameter identifier true block if_statement comparison_operator identifier none 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 identifier identifier expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list expression_statement call identifier argument_list identifier identifier identifier identifier identifier return_statement identifier
|
Dump image data object to vtkjs
|
def run(self):
self.find_new()
for n in self.news:
print("{0}".format(n))
print("")
self.msg.template(78)
print("| Installed {0} new configuration files:".format(
len(self.news)))
self.msg.template(78)
self.choices()
|
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list for_statement identifier attribute identifier identifier block 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 string string_start string_end expression_statement call attribute attribute identifier identifier identifier argument_list integer expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list call identifier argument_list attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list integer expression_statement call attribute identifier identifier argument_list
|
print .new configuration files
|
def jsontype(self, name, path=Path.rootPath()):
return self.execute_command('JSON.TYPE', name, str_path(path))
|
module function_definition identifier parameters identifier identifier default_parameter identifier call attribute identifier identifier argument_list block return_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier call identifier argument_list identifier
|
Gets the type of the JSON value under ``path`` from key ``name``
|
def to_node(value):
if isinstance(value, Node):
return value
elif isinstance(value, str):
return Node('string', value=value, pseudo_type='String')
elif isinstance(value, int):
return Node('int', value=value, pseudo_type='Int')
elif isinstance(value, bool):
return Node('boolean', value=str(value).lower(), pseudo_type='Boolean')
elif isinstance(value, float):
return Node('float', value=value, pseudo_type='Float')
elif value is None:
return Node('null', pseudo_type='Void')
else:
1/0
|
module function_definition identifier parameters identifier block if_statement call identifier argument_list identifier identifier block return_statement identifier elif_clause call identifier argument_list identifier identifier block return_statement call identifier argument_list string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier string string_start string_content string_end elif_clause call identifier argument_list identifier identifier block return_statement call identifier argument_list string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier string string_start string_content string_end elif_clause call identifier argument_list identifier identifier block return_statement call identifier argument_list string string_start string_content string_end keyword_argument identifier call attribute call identifier argument_list identifier identifier argument_list keyword_argument identifier string string_start string_content string_end elif_clause call identifier argument_list identifier identifier block return_statement call identifier argument_list string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier string string_start string_content string_end elif_clause comparison_operator identifier none block return_statement call identifier argument_list string string_start string_content string_end keyword_argument identifier string string_start string_content string_end else_clause block expression_statement binary_operator integer integer
|
Expand to a literal node if a basic type otherwise just returns the node
|
def _check_cat_dict_source(self, cat_dict_class, key_in_self, **kwargs):
source = kwargs.get(cat_dict_class._KEYS.SOURCE, None)
if source is None:
raise CatDictError(
"{}: `source` must be provided!".format(self[self._KEYS.NAME]),
warn=True)
for x in source.split(','):
if not is_integer(x):
raise CatDictError(
"{}: `source` is comma-delimited list of "
" integers!".format(self[self._KEYS.NAME]),
warn=True)
if self.is_erroneous(key_in_self, source):
self._log.info("This source is erroneous, skipping")
return None
if (self.catalog.args is not None and not self.catalog.args.private and
self.is_private(key_in_self, source)):
self._log.info("This source is private, skipping")
return None
return source
|
module function_definition identifier parameters identifier identifier identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call attribute identifier identifier argument_list attribute attribute identifier identifier identifier none if_statement comparison_operator identifier none block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list subscript identifier attribute attribute identifier identifier identifier keyword_argument identifier true for_statement identifier call attribute identifier identifier argument_list string string_start string_content string_end block if_statement not_operator call identifier argument_list identifier block raise_statement call identifier argument_list call attribute concatenated_string string string_start string_content string_end string string_start string_content string_end identifier argument_list subscript identifier attribute attribute identifier identifier identifier keyword_argument identifier true if_statement call attribute identifier identifier argument_list identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end return_statement none if_statement parenthesized_expression boolean_operator boolean_operator comparison_operator attribute attribute identifier identifier identifier none not_operator attribute attribute attribute identifier identifier identifier identifier call attribute identifier identifier argument_list identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end return_statement none return_statement identifier
|
Check that a source exists and that a quantity isn't erroneous.
|
def _update_phi(self):
etaprod = 1.0
for w in range(N_NT - 1):
self.phi[w] = etaprod * (1 - self.eta[w])
etaprod *= self.eta[w]
self.phi[N_NT - 1] = etaprod
|
module function_definition identifier parameters identifier block expression_statement assignment identifier float for_statement identifier call identifier argument_list binary_operator identifier integer block expression_statement assignment subscript attribute identifier identifier identifier binary_operator identifier parenthesized_expression binary_operator integer subscript attribute identifier identifier identifier expression_statement augmented_assignment identifier subscript attribute identifier identifier identifier expression_statement assignment subscript attribute identifier identifier binary_operator identifier integer identifier
|
Update `phi` using current `eta`.
|
def runserver(debug, console_log, use_reloader, address, port, timeout, workers, socket):
debug = debug or config.get('DEBUG') or console_log
if debug:
print(Fore.BLUE + '-=' * 20)
print(
Fore.YELLOW + 'Starting Superset server in ' +
Fore.RED + 'DEBUG' +
Fore.YELLOW + ' mode')
print(Fore.BLUE + '-=' * 20)
print(Style.RESET_ALL)
if console_log:
console_log_run(app, port, use_reloader)
else:
debug_run(app, port, use_reloader)
else:
logging.info(
"The Gunicorn 'superset runserver' command is deprecated. Please "
"use the 'gunicorn' command instead.")
addr_str = f' unix:{socket} ' if socket else f' {address}:{port} '
cmd = (
'gunicorn '
f'-w {workers} '
f'--timeout {timeout} '
f'-b {addr_str} '
'--limit-request-line 0 '
'--limit-request-field_size 0 '
'superset:app'
)
print(Fore.GREEN + 'Starting server with command: ')
print(Fore.YELLOW + cmd)
print(Style.RESET_ALL)
Popen(cmd, shell=True).wait()
|
module function_definition identifier parameters identifier identifier identifier identifier identifier identifier identifier identifier block expression_statement assignment identifier boolean_operator boolean_operator identifier call attribute identifier identifier argument_list string string_start string_content string_end identifier if_statement identifier block expression_statement call identifier argument_list binary_operator attribute identifier identifier binary_operator string string_start string_content string_end integer expression_statement call identifier argument_list binary_operator binary_operator binary_operator binary_operator binary_operator attribute identifier identifier string string_start string_content string_end attribute identifier identifier string string_start string_content string_end attribute identifier identifier string string_start string_content string_end expression_statement call identifier argument_list binary_operator attribute identifier identifier binary_operator string string_start string_content string_end integer expression_statement call identifier argument_list attribute identifier identifier if_statement identifier block expression_statement call identifier argument_list identifier identifier identifier else_clause block expression_statement call identifier argument_list identifier identifier identifier else_clause block expression_statement call attribute identifier identifier argument_list concatenated_string string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier conditional_expression string string_start string_content interpolation identifier string_content string_end identifier string string_start string_content interpolation identifier string_content interpolation identifier string_content string_end expression_statement assignment identifier parenthesized_expression concatenated_string string string_start string_content string_end string string_start string_content interpolation identifier string_content string_end string string_start string_content interpolation identifier string_content string_end string string_start string_content interpolation identifier 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 expression_statement call identifier argument_list binary_operator attribute identifier identifier string string_start string_content string_end expression_statement call identifier argument_list binary_operator attribute identifier identifier identifier expression_statement call identifier argument_list attribute identifier identifier expression_statement call attribute call identifier argument_list identifier keyword_argument identifier true identifier argument_list
|
Starts a Superset web server.
|
def pyspread(S=None):
app = MainApplication(S=S, redirect=False)
app.MainLoop()
|
module function_definition identifier parameters default_parameter identifier none block expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier keyword_argument identifier false expression_statement call attribute identifier identifier argument_list
|
Holds application main loop
|
def graded_submissions(self):
qs = self._valid_submissions().filter(state__in=[Submission.GRADED])
return qs
|
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list identifier argument_list keyword_argument identifier list attribute identifier identifier return_statement identifier
|
Queryset for the graded submissions, which are worth closing.
|
def handle_starttag(self, tag, attrs):
if not tag == 'a':
return
for attr in attrs:
if attr[0] == 'href':
url = urllib.unquote(attr[1])
self.active_url = url.rstrip('/').split('/')[-1]
return
|
module function_definition identifier parameters identifier identifier identifier block if_statement not_operator comparison_operator identifier string string_start string_content string_end block return_statement for_statement identifier identifier block if_statement comparison_operator subscript identifier integer string string_start string_content string_end block expression_statement assignment identifier call attribute identifier identifier argument_list subscript identifier integer expression_statement assignment attribute identifier identifier subscript call attribute call attribute identifier identifier argument_list string string_start string_content string_end identifier argument_list string string_start string_content string_end unary_operator integer return_statement
|
Callback for when a tag gets opened.
|
def on_resize(self, event):
self.context.set_viewport(0, 0, event.size[0], event.size[1])
for visual in self.visuals:
visual.on_resize(event.size)
self.update()
|
module function_definition identifier parameters identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list integer integer subscript attribute identifier identifier integer subscript attribute identifier identifier integer for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement call attribute identifier identifier argument_list
|
Resize the OpenGL context.
|
async def echo_all(app, message):
for address in app.kv.get_prefix('address.').values():
host, port = address.decode().split(':')
port = int(port)
await tcp_echo_client(message, loop, host, port)
|
module function_definition identifier parameters identifier identifier block for_statement identifier call attribute call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end identifier argument_list block expression_statement assignment pattern_list identifier identifier call attribute call attribute identifier identifier argument_list identifier argument_list string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier expression_statement await call identifier argument_list identifier identifier identifier identifier
|
Send and recieve a message from all running echo servers
|
async def fromURL(
cls, url, *, credentials=None, insecure=False):
try:
description = await helpers.fetch_api_description(
url, insecure=insecure)
except helpers.RemoteError as error:
raise SessionError(str(error))
else:
session = cls(description, credentials)
session.insecure = insecure
return session
|
module function_definition identifier parameters identifier identifier keyword_separator default_parameter identifier none default_parameter identifier false block try_statement block expression_statement assignment identifier await call attribute identifier identifier argument_list identifier keyword_argument identifier identifier except_clause as_pattern attribute identifier identifier as_pattern_target identifier block raise_statement call identifier argument_list call identifier argument_list identifier else_clause block expression_statement assignment identifier call identifier argument_list identifier identifier expression_statement assignment attribute identifier identifier identifier return_statement identifier
|
Return a `SessionAPI` for a given MAAS instance.
|
def type(self):
if self.__type is None:
found_type = find_definition(
self.__type_name, self.message_definition())
if not (found_type is not Enum and
isinstance(found_type, type) and
issubclass(found_type, Enum)):
raise FieldDefinitionError(
'Invalid enum type: %s' % found_type)
self.__type = found_type
return self.__type
|
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier none block expression_statement assignment identifier call identifier argument_list attribute identifier identifier call attribute identifier identifier argument_list if_statement not_operator parenthesized_expression boolean_operator boolean_operator comparison_operator identifier identifier call identifier argument_list identifier identifier call identifier argument_list identifier identifier block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier expression_statement assignment attribute identifier identifier identifier return_statement attribute identifier identifier
|
Enum type used for field.
|
def load(path):
with open(path) as rfile:
steps = MODEL.parse(rfile.read())
new_steps = []
for step in steps:
new_steps += expand_includes(step, path)
return new_steps
|
module function_definition identifier parameters identifier block with_statement with_clause with_item as_pattern call identifier argument_list identifier as_pattern_target identifier block expression_statement assignment identifier call attribute identifier identifier argument_list call attribute identifier identifier argument_list expression_statement assignment identifier list for_statement identifier identifier block expression_statement augmented_assignment identifier call identifier argument_list identifier identifier return_statement identifier
|
Load |path| and recursively expand any includes.
|
def _normalize(self, name, columns, points):
for i, _ in enumerate(points):
if points[i] is None:
del(points[i])
del(columns[i])
continue
try:
points[i] = float(points[i])
except (TypeError, ValueError):
pass
else:
continue
try:
points[i] = str(points[i])
except (TypeError, ValueError):
pass
else:
continue
return [{'measurement': name,
'tags': self.parse_tags(self.tags),
'fields': dict(zip(columns, points))}]
|
module function_definition identifier parameters identifier identifier identifier identifier block for_statement pattern_list identifier identifier call identifier argument_list identifier block if_statement comparison_operator subscript identifier identifier none block delete_statement parenthesized_expression subscript identifier identifier delete_statement parenthesized_expression subscript identifier identifier continue_statement try_statement block expression_statement assignment subscript identifier identifier call identifier argument_list subscript identifier identifier except_clause tuple identifier identifier block pass_statement else_clause block continue_statement try_statement block expression_statement assignment subscript identifier identifier call identifier argument_list subscript identifier identifier except_clause tuple identifier identifier block pass_statement else_clause block continue_statement return_statement list dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end call attribute identifier identifier argument_list attribute identifier identifier pair string string_start string_content string_end call identifier argument_list call identifier argument_list identifier identifier
|
Normalize data for the InfluxDB's data model.
|
def _flush(self):
if self._recording:
raise Exception("Cannot flush data queue while recording!")
if self._saving_cache:
logging.warn("Flush when using cache means unsaved data will be lost and not returned!")
self._cmds_q.put(("reset_data_segment",))
else:
data = self._extract_q(0)
return data
|
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list tuple string string_start string_content string_end else_clause block expression_statement assignment identifier call attribute identifier identifier argument_list integer return_statement identifier
|
Returns a list of all current data
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.