text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def model_field_attr(model, model_field, attr):
"""
Returns the specified attribute for the specified field on the model class.
"""
fields = dict([(field.name, field) for field in model._meta.fields])
return getattr(fields[model_field], attr) | 0.003817 |
def execute(self, triple_map, output, **kwargs):
"""Method executes mapping between CSV source and
output RDF
args:
triple_map(SimpleNamespace): Triple Map
"""
subject = self.generate_term(term_map=triple_map.subjectMap,
**kwargs)... | 0.002277 |
def multiline_statement(line, previous_line=''):
"""Return True if this is part of a multiline statement."""
for symbol in '\\:;':
if symbol in line:
return True
sio = io.StringIO(line)
try:
list(tokenize.generate_tokens(sio.readline))
return previous_line.rstrip().e... | 0.0025 |
def parsexml(self, xmlstring, modules, source=None):
"""Parses the docstrings out of the specified xml file.
:arg source: the path to the file from which the XML string was extracted.
"""
result = {}
from fortpy.utility import XML_fromstring
xmlroot = XML_fromstring(xml... | 0.005744 |
def resolve(self, host: str) -> ResolveResult:
'''Resolve hostname.
Args:
host: Hostname.
Returns:
Resolved IP addresses.
Raises:
DNSNotFound if the hostname could not be resolved or
NetworkError if there was an error connecting to DNS s... | 0.00115 |
def html2vtml(vtmarkup):
""" Convert hypertext markup into vt markup.
The output can be given to `vtmlrender` for converstion to VT100
sequences. """
try:
htmlconv.feed(vtmarkup)
htmlconv.close()
return htmlconv.getvalue()
finally:
htmlconv.reset() | 0.003333 |
def _is_flag(cls, arg):
"""Check if an argument is a flag.
A flag starts with - or -- and the next character must be a letter
followed by letters, numbers, - or _. Currently we only check the
alpha'ness of the first non-dash character to make sure we're not just
looking at a ne... | 0.00277 |
def convert_to_raw(number, value, length):
"""
Get the value of an option as a ByteArray.
:param number: the option number
:param value: the option value
:param length: the option length
:return: the value of an option as a BitArray
"""
opt_type = define... | 0.001742 |
def generate_key_pair(size=2048, public_exponent=65537, as_string=True):
"""
Generate a public/private key pair.
:param size: Optional. Describes how many bits long the key should be, larger keys provide more security,
currently 1024 and below are considered breakable, and 2048 or 4096 are reasonab... | 0.005795 |
def record(self, ekey, entry, diff=False):
"""Records the specified entry to the key-value store under the specified
entity key.
Args:
ekey (str): fqdn/uuid of the method/object to store the entry for.
entry (dict): attributes and values gleaned from the execution.
... | 0.008189 |
def collapse_entrez_equivalencies(graph: BELGraph):
"""Collapse all equivalence edges away from Entrez. Assumes well formed, 2-way equivalencies."""
relation_filter = build_relation_predicate(EQUIVALENT_TO)
source_namespace_filter = build_source_namespace_filter(['EGID', 'EG', 'ENTREZ'])
edge_predicate... | 0.00641 |
def save_stream(self, key, binary=False):
"""
Yield a file object representing `key`
:param str key: The file to save to
:param bool binary: Whether we should treat it as binary
:return:
"""
mode = 'wb' if binary else 'w'
with open(os.path.join(self.uri, ... | 0.005602 |
def _harvest_validate(self, userkwargs):
"""Validate and Plant user provided arguments
- Go through and plants the seedlings
for any user arguments provided.
- Validate the arguments, cleaning and adapting (valideer wise)
- Extract negatives "!" arguments
"""
# ... | 0.002554 |
def _action(self, res):
"""Returns JSON response or raise exception if errors are present"""
try:
j = res.json()
except:
res.raise_for_status()
j = {}
if 'Retry-After' in res.headers:
raise HTTPError('403 Forbidden: API rate-limit has been... | 0.006689 |
def GetFormattedField(self, event, field_name):
"""Formats the specified field.
Args:
event (EventObject): event.
field_name (str): name of the field.
Returns:
str: value of the field.
"""
callback_name = self._FIELD_FORMAT_CALLBACKS.get(field_name, None)
callback_function = ... | 0.008174 |
def connect(self):
"""
Connects to publisher
"""
self.client = redis.Redis(
host=self.host, port=self.port, password=self.password) | 0.011429 |
def get_valid_https_verify(value):
'''
Get a value that can be the boolean representation of a string
or a boolean itself and returns It as a boolean.
If this is not the case, It returns a string.
:value: The HTTPS_verify input value. A string can be passed as a path
to a CA_BUNDLE cert... | 0.002817 |
def create_relationships(cls, id, related_collection_name, request_json):
r"""
Used to create relationship(s) between the id node and the nodes identified in the included resource \
identifier objects.
:param id: The 'id' field of the node on the left side of the relationship in the dat... | 0.006219 |
def sequence(start, stop, step=None):
"""
Generate a sequence of integers from `start` to `stop`, incrementing by `step`.
If `step` is not set, incrementing by 1 if `start` is less than or equal to `stop`,
otherwise -1.
>>> df1 = spark.createDataFrame([(-2, 2)], ('C1', 'C2'))
>>> df1.select(seq... | 0.005727 |
def astype(self, dtype, copy=True):
"""Return a copy of the array after casting to a specified type.
Parameters
----------
dtype : numpy.dtype or str
The type of the returned array.
copy : bool
Default `True`. By default, astype always returns a newly
... | 0.002094 |
async def read_frame(self) -> DataFrame:
"""Read a single frame from the local buffer.
If no frames are available but the stream is still open, waits until
more frames arrive. Otherwise, raises StreamConsumedError.
When a stream is closed, a single `None` is added to the data frame
... | 0.002967 |
def addRelation(self, link):
'''Appends Relation
'''
if isinstance(link, Relation):
self.internalLinks.append(link)
else:
raise TypeError(
'link Type should be InternalLink, not %s' % type(link)) | 0.01087 |
def count_discussions_handler(sender, **kwargs):
"""
Update the count of each type of discussion on an entry.
"""
if kwargs.get('instance') and kwargs.get('created'):
# The signal is emitted by the comment creation,
# so we do nothing, comment_was_posted is used instead.
return
... | 0.001364 |
def set_connect_args(self, dsn=None, **connect_kwargs):
r"""Set the new connection arguments for this pool.
The new connection arguments will be used for all subsequent
new connection attempts. Existing connections will remain until
they expire. Use :meth:`Pool.expire_connections()
... | 0.002055 |
def setQuery( self, query ):
"""
Sets the fixed lookup query for this widget to the inputed query.
:param query | <orb.Query>
"""
self._query = query
if ( not self.signalsBlocked() ):
self.queryChanged.emit(query) | 0.023729 |
def match_local(self, prefix, includes, excludes):
"""
Filters os.walk() with include and exclude patterns.
See: http://stackoverflow.com/a/5141829/93559
"""
includes_pattern = r"|".join([fnmatch.translate(x) for x in includes])
excludes_pattern = r"|".join([fnmatch.trans... | 0.002703 |
def configure_ghostboxes(self, nghostx=0, nghosty=0, nghostz=0):
"""
Initialize the ghost boxes.
This function only needs to be called it boundary conditions other than "none" or
"open" are used. In such a case the number of ghostboxes must be known and is set
with this functio... | 0.011923 |
def inspect_image(self, image_name, image_tag=''):
'''
a method to retrieve the settings of an image
:param image_name: string with name or id of image
:param image_tag: [optional] string with tag associated with image
:return: dictionary of settings of imag... | 0.003454 |
def _make_pull_imethod_resp(objs, eos, context_id):
"""
Create the correct imethod response for the open and pull methods
"""
eos_tup = (u'EndOfSequence', None, eos)
enum_ctxt_tup = (u'EnumerationContext', None, context_id)
return [("IRETURNVALUE", {}, objs), enum_ctxt_t... | 0.006024 |
def process_includes(self, markdown_file_path: Path, content: str) -> str:
'''Replace all include statements with the respective file contents.
:param markdown_file_path: Path to curently processed Markdown file
:param content: Markdown content
:returns: Markdown content with resolved ... | 0.00426 |
def profile():
"""View for editing a profile."""
# Create forms
verification_form = VerificationForm(formdata=None, prefix="verification")
profile_form = profile_form_factory()
# Process forms
form = request.form.get('submit', None)
if form == 'profile':
handle_profile_form(profile_... | 0.001721 |
def children(self):
"""获取此话题的子话题
:return: 此话题的子话题, 返回生成器
:rtype: Topic.Iterable
"""
self._make_soup()
child_topic_tag = self.soup.find('div', class_='child-topic')
if child_topic_tag is None:
return []
elif '共有' not in child_topic_tag.contents... | 0.001401 |
def __forall_files(file_paths, output_dir, op):
"""
Applies a function to a set of files and an output directory.
:param str output_dir: Output directory
:param list[str] file_paths: Absolute file paths to move
"""
for file_path in file_paths:
if not file_path.startswith('/'):
... | 0.004032 |
def tokenize_ofp_instruction_arg(arg):
"""
Tokenize an argument portion of ovs-ofctl style action string.
"""
arg_re = re.compile("[^,()]*")
try:
rest = arg
result = []
while len(rest):
m = arg_re.match(rest)
if m.end(0) == len(rest):
r... | 0.001071 |
def get_db_row(db, start, size):
"""
Here you see and example of readying out a part of a DB
Args:
db (int): The db to use
start (int): The index of where to start in db data
size (int): The size of the db data to read
"""
type_ = snap7.snap7types.wordlen_to_ctypes[snap7.sna... | 0.002326 |
def register_provider(self, provider):
'''
Register a :class:`skosprovider.providers.VocabularyProvider`.
:param skosprovider.providers.VocabularyProvider provider: The provider
to register.
:raises RegistryException: A provider with this id or uri has already
b... | 0.005495 |
def get_releases(self, url='', headers={}, repo_name=''):
"""
Retrieves the releases for the given repo in JSON.
"""
url_releases = (url + '/releases')
r = requests.get(url_releases, headers=headers)
self.releases_json[repo_name] = r.json() | 0.006944 |
def top_priority_effect(effects):
"""
Given a collection of variant transcript effects,
return the top priority object. ExonicSpliceSite variants require special
treatment since they actually represent two effects -- the splicing modification
and whatever else would happen to the exonic sequence if ... | 0.001302 |
def _get_xml(self, close_tag=True):
"""
generate the xml string representation.
:param close_tag: should the '</provenance_step>' tag be added or not.
:type close_tag: bool
:return: the xml
:rtype: str
"""
provenance_step_element = Element('provenance_s... | 0.00243 |
def kml_region(map_source, z, x, y):
"""KML region fetched by a Google Earth network link. """
map = app.config["mapsources"][map_source]
kml_doc = KMLRegion(app.config["url_formatter"], map, app.config["LOG_TILES_PER_ROW"],
z, x, y)
return kml_response(kml_doc) | 0.006623 |
def format_iso_datetime(datetime_obj):
"""Formats the given datetime as a UTC-zoned ISO 8601 date string.
:param datetime_obj: The datetime object.
:type datetime_obj: datetime
:return: The datetime object in 8601 string form.
:rtype: datetime
"""
datetime_obj = localize_datetime(datetime_o... | 0.003623 |
def generate_code_cover(self):
"""
Generate a list of all recovered basic blocks.
"""
lst = []
for cfg_node in self.graph.nodes():
size = cfg_node.size
lst.append((cfg_node.addr, size))
lst = sorted(lst, key=lambda x: x[0])
return lst | 0.006329 |
def __click_dropdown_link_text(self, link_text, link_css):
""" When a link may be hidden under a dropdown menu, use this. """
soup = self.get_beautiful_soup()
drop_down_list = soup.select('[class*=dropdown]')
for item in soup.select('[class*=HeaderMenu]'):
drop_down_list.appe... | 0.001372 |
def __set_cache(self, tokens):
"""
Sets the tokens cache.
:param tokens: Completer tokens list.
:type tokens: tuple or list
"""
if DefaultCompleter._DefaultCompleter__tokens.get(self.__language):
return
DefaultCompleter._DefaultCompleter__tokens[sel... | 0.005848 |
def image(self, src, title, text):
"""Rendering a image with title and text.
:param src: source link of the image.
:param title: title text of the image.
:param text: alt text of the image.
"""
# rst does not support title option
# and I couldn't find title attri... | 0.003745 |
def posts(self, blogname, type=None, **kwargs):
"""
Gets a list of posts from a particular blog
:param blogname: a string, the blogname you want to look up posts
for. eg: codingjester.tumblr.com
:param id: an int, the id of the post you are looking for on the bl... | 0.003433 |
def create(self, body=None, raise_exc=True, headers=None, **kwargs):
'''Performs an HTTP POST to the server, to create a
subordinate resource. Returns a new HALNavigator representing
that resource.
`body` may either be a string or a dictionary representing json
`headers` are add... | 0.004535 |
def delete_key(self, key_to_delete):
"""Deletes the specified key
:param key_to_delete:
:return:
"""
log = logging.getLogger(self.cls_logger + '.delete_key')
log.info('Attempting to delete key: {k}'.format(k=key_to_delete))
try:
self.s3client.delete_... | 0.005839 |
def utf8(value):
"""Converts a string argument to a byte string.
If the argument is already a byte string or None, it is returned unchanged.
Otherwise it must be a unicode string and is encoded as utf8.
"""
if isinstance(value, _UTF8_TYPES):
return value
assert isinstance(value, unicode... | 0.002825 |
def get_device(_id):
"""
Pull a device from the API.
"""
url = DEVICE_URL % _id
arequest = requests.get(url, headers=HEADERS)
status_code = str(arequest.status_code)
if status_code == '401':
_LOGGER.error("Token expired.")
return False
... | 0.00578 |
def parse_line(self, line, lineno):
"""Check a single line for an error. Keeps track of the linenumber"""
# TaskCluster logs are a bit wonky.
#
# TaskCluster logs begin with output coming from TaskCluster itself,
# before it has transitioned control of the task to the configured... | 0.001179 |
def decode(self, source):
"""Decode a source map object into a SourceMapIndex.
The index is keyed on (dst_line, dst_column) for lookups,
and a per row index is kept to help calculate which Token to retrieve.
For example:
A minified source file has two rows and two tokens pe... | 0.000781 |
def copy(self):
"""
Make a copy of the CFG.
:return: A copy of the CFG instance.
:rtype: angr.analyses.CFG
"""
new_cfg = CFGEmulated.__new__(CFGEmulated)
super(CFGEmulated, self).make_copy(new_cfg)
new_cfg._indirect_jump_target_limit = self._indirect_jum... | 0.002752 |
def POST(self, *args, **kwargs):
'''
Fire an event in Salt with a custom event tag and data
.. http:post:: /hook
:status 200: |200|
:status 401: |401|
:status 406: |406|
:status 413: request body is too large
**Example request:**
... | 0.000958 |
def _check_if_all_updated(self):
"""Check if all parameters from the TOC has at least been fetched
once"""
for g in self.toc.toc:
if g not in self.values:
return False
for n in self.toc.toc[g]:
if n not in self.values[g]:
... | 0.005634 |
def writefasta(self, fname):
""" Write sequences to FASTA formatted file"""
f = open(fname, "w")
fa_str = "\n".join([">%s\n%s" % (id, self._format_seq(seq)) for id, seq in self.items()])
f.write(fa_str)
f.close() | 0.011905 |
def flatten_container(self, container):
"""
Accepts a marathon container and pulls out the nested values into the top level
"""
for names in ARG_MAP.values():
if names[TransformationTypes.MARATHON.value]['name'] and \
'.' in names[TransformationTy... | 0.006481 |
def split_prefix(key, prefixs):
"""
split key string into prefix and remainder
for first matching prefix from a list
"""
key_upper = key.upper()
for prefix in prefixs:
if key_upper.startswith(prefix):
plen = len(prefix)
return (... | 0.005731 |
def set_resubscription_params(self, addresses=None, bind_to=None):
"""You can specify a dgram address (udp or unix) on which all of the subscriptions
request will be forwarded to (obviously changing the node address to the router one).
The system could be useful to build 'federated' setup.
... | 0.009009 |
def get_prefixes(dirname: str, extension: str) -> List[str]:
""" Returns a list of prefixes to files in the directory (which might be a whole
corpus, or a train/valid/test subset. The prefixes include the path leading
up to it, but only the filename up until the first observed period '.'
"""
prefix... | 0.002941 |
def _refresh(self):
"""
Remove all existing results files and reinit the h5 arrays
so that the tetrad object is just like fresh from a CLI start.
"""
## clear any existing results files
oldfiles = [self.files.qdump] + \
self.database.__dict__.values... | 0.011858 |
def CloseHandle(self):
'''Releases a handle acquired with VMGuestLib_OpenHandle'''
if hasattr(self, 'handle'):
ret = vmGuestLib.VMGuestLib_CloseHandle(self.handle.value)
if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret)
del(self.handle) | 0.009836 |
def main():
""" Parses the command-line args, and calls run. """
parser = argparse.ArgumentParser(
description='A pipeline that generates analysis pipelines.')
parser.add_argument('input', nargs='?',
help='A valid metapipe configuration file.')
parser.add_argument('-o', '--out... | 0.011565 |
def adjust_jobs_priority(self, high_value_jobs, priority=1):
"""For every job priority determine if we need to increase or decrease the job priority
Currently, high value jobs have a priority of 1 and a timeout of 0.
"""
# Only job priorities that don't have an expiration date (2 weeks ... | 0.0059 |
def search_tree(self, name): # noqa: D302
r"""
Search tree for all nodes with a specific name.
:param name: Node name to search for
:type name: :ref:`NodeName`
:raises: RuntimeError (Argument \`name\` is not valid)
For example:
>>> from __future__ import... | 0.001493 |
def load_experiment(folder, return_path=False):
'''load_experiment:
reads in the config.json for a folder, returns None if not found.
:param folder: full path to experiment folder
:param return_path: if True, don't load the config.json, but return it
'''
fullpath = os.path.abspath(folder)
co... | 0.005128 |
def region_selection(request):
'''Handle submission of the region selection form in the base template. '''
form = get_region_select_form(request.GET)
abbr = form.data.get('abbr')
if not abbr or len(abbr) != 2:
return redirect('homepage')
return redirect('region', abbr=abbr) | 0.003311 |
def hardware_version(self):
"""Returns the hardware version of the connected J-Link as a
major.minor string.
Args:
self (JLink): the ``JLink`` instance
Returns:
Hardware version string.
"""
version = self._dll.JLINKARM_GetHardwareVersion()
ma... | 0.004706 |
def reload(self):
'Generate histrow for each row and then reverse-sort by length.'
self.rows = []
# if len(self.origCols) == 1 and self.origCols[0].type in (int, float, currency):
# self.numericBinning()
# else:
self.discreteBinning()
# automatically add cache ... | 0.006508 |
def insertAdjacentHTML(self, position: str, html: str) -> None:
"""Parse ``html`` to DOM and insert to ``position``.
``position`` is a case-insensive string, and must be one of
"beforeBegin", "afterBegin", "beforeEnd", or "afterEnd".
"""
df = self._parse_html(html)
pos =... | 0.002538 |
def get_bins(values):
"""
Automatically compute the number of bins for discrete variables.
Parameters
----------
values = numpy array
values
Returns
-------
array with the bins
Notes
-----
Computes the width of the bins by taking the maximun of the Sturges and the ... | 0.006402 |
def get_address_overview(address, coin_symbol='btc', api_key=None):
'''
Takes an address and coin_symbol and return the address details
'''
assert is_valid_address_for_coinsymbol(b58_address=address,
coin_symbol=coin_symbol)
url = make_url(coin_symbol, 'addrs', **{address: 'balance'})
... | 0.006024 |
def cleanup_temp_filesystem(self):
"""
Cleanup the temporary directory
"""
logger.debug("Deleting compressed file extraction directory: " + self.tmp_dir)
shutil.rmtree(self.tmp_dir, True) | 0.013216 |
def _get_description(prev_description):
"""Get the parsed description file (a dictionary) from another
parsed description file."""
current_desc_file = os.path.join(utils.get_project_root(),
prev_description['data-source'],
"info.ym... | 0.001511 |
def _get_server(self):
"""
Get server to use for request.
Also process inactive server list, re-add them after given interval.
"""
with self._lock:
inactive_server_count = len(self._inactive_servers)
for i in range(inactive_server_count):
t... | 0.001516 |
def audit_customer_subscription(customer, unknown=True):
"""
Audits the provided customer's subscription against stripe and returns a pair
that contains a boolean and a result type.
Default result types can be found in zebra.conf.defaults and can be
overridden in your project's settings.
"""
... | 0.002257 |
def ok_cred_def_id(token: str, issuer_did: str = None) -> bool:
"""
Whether input token looks like a valid credential definition identifier from input issuer DID (default any); i.e.,
<issuer-did>:3:CL:<schema-seq-no>:<cred-def-id-tag> for protocol >= 1.4, or
<issuer-did>:3:CL:<schema-seq-no> for protoco... | 0.007257 |
def _show_help(self, txt,
mode_to_set=MAIN_HELP_MODE,
caption=' Help ',
prompt=' Press any key to hide ',
too_small_msg='Window too small to show message',
is_message=False):
""" Display a help, info or question window. """
... | 0.006909 |
def rate_of_turn(speed, bank):
'''return expected rate of turn in degrees/s for given speed in m/s and
bank angle in degrees'''
if abs(speed) < 2 or abs(bank) > 80:
return 0
ret = degrees(9.81*tan(radians(bank))/speed)
return ret | 0.003846 |
def pop_parameter(key):
'''Remove and get parameter by key.
Args:
key(str): Key of parameter.
Returns: ~nnabla.Variable
Parameter if key found, otherwise None.
'''
names = key.split('/')
if len(names) > 1:
with parameter_scope(names[0]):
return pop_paramete... | 0.002075 |
def upload(self, filename, input, packethook=None, timeout=SOCK_TIMEOUT):
"""This method initiates a tftp upload to the configured remote host,
uploading the filename passed. It reads the file from input, which
can be a file-like object or a path to a local file. If a packethook
is provi... | 0.002812 |
def fetch_rrlyrae_lc_params(**kwargs):
"""Fetch data from table 2 of Sesar 2010
This table includes observationally-derived parameters for all the
Sesar 2010 lightcurves.
"""
save_loc = _get_download_or_cache('table2.dat.gz', **kwargs)
dtype = [('id', 'i'), ('type', 'S2'), ('P', 'f'),
... | 0.002928 |
def execute_reliabledictionary(client, application_name, service_name, input_file):
"""Execute create, update, delete operations on existing reliable dictionaries.
carry out create, update and delete operations on existing reliable dictionaries for given application and service.
:param application_name: N... | 0.006849 |
def notify_client(
notifier_uri,
client_id,
status_code,
message=None):
"""
Notify the client of the result of handling a request
The payload contains two elements:
- client_id
- result
The *client_id* is the id of the client to notify. It is assumed
that t... | 0.000865 |
def _calendar_json_for_occurrence(self, occurrence):
"""
Return JSON for a single Occurrence
"""
# Slugify the plugin's verbose name for use as a class name.
if occurrence.is_all_day:
start = occurrence.start
# `end` is exclusive according to the doc in
... | 0.002039 |
def multiplicative_jitter(x, epsilon=1e-2):
"""Multiply values by a random number between 1-epsilon and 1+epsilon.
Makes models more resilient to rounding errors introduced by bfloat16.
This seems particularly important for logits.
Args:
x: a mtf.Tensor
epsilon: a floating point value
Returns:
... | 0.007722 |
def name(self):
""" Return a basic meaningful name based on device type """
if (
self.device_type and
self.device_type.code in (DeviceType.MOBILE, DeviceType.TABLET)
):
return self.device
else:
return self.browser | 0.006826 |
def _fromTwosComplement(x, bits=16):
"""Calculate the inverse(?) of a two's complement of an integer.
Args:
* x (int): input integer.
* bits (int): number of bits, must be > 0.
Returns:
An int, that represents the inverse(?) of two's complement of the input.
Example for bits=8... | 0.005061 |
def appliance_device_snmp_v3_users(self):
"""
Gets the ApplianceDeviceSNMPv3Users API client.
Returns:
ApplianceDeviceSNMPv3Users:
"""
if not self.__appliance_device_snmp_v3_users:
self.__appliance_device_snmp_v3_users = ApplianceDeviceSNMPv3Users(self.__... | 0.007813 |
def filterchain_all(request, app, model, field, foreign_key_app_name,
foreign_key_model_name, foreign_key_field_name, value):
"""Returns filtered results followed by excluded results below."""
model_class = get_model(app, model)
keywords = get_keywords(field, value)
# SECURITY: Make... | 0.001806 |
def get_build_container_dir(self, arch):
'''Given the arch name, returns the directory where it will be
built.
This returns a different directory depending on what
alternative or optional dependencies are being built.
'''
dir_name = self.get_dir_name()
return joi... | 0.006834 |
def get_query_args(
self,
keep_blank_values: bool = False,
strict_parsing: bool = False,
encoding: str = "utf-8",
errors: str = "replace",
) -> list:
"""
Method to parse `query_string` using `urllib.parse.parse_qsl`.
This methods is used by `query_args... | 0.001425 |
def _generate_cpu_stats():
"""Read and display processor name """
cpu_name = urwid.Text("CPU Name N/A", align="center")
try:
cpu_name = urwid.Text(get_processor_name().strip(), align="center")
except OSError:
logging.info("CPU name not available")
return [... | 0.00463 |
def _get_samples(self, samples):
"""
Internal function. Prelude for each step() to read in perhaps
non empty list of samples to process. Input is a list of sample names,
output is a list of sample objects."""
## if samples not entered use all samples
if not samples:
samples = self.sample... | 0.009873 |
def bust_self(self, obj):
"""Remove the value that is being stored on `obj` for this
:class:`.cached_property`
object.
:param obj: The instance on which to bust the cache.
"""
if self.func.__name__ in obj.__dict__:
delattr(obj, self.func.__name__) | 0.006494 |
def report_error_event(self, error_report):
"""Uses the gapic client to report the error.
:type error_report: dict
:param error_report:
payload of the error report formatted according to
https://cloud.google.com/error-reporting/docs/formatting-error-messages
... | 0.002717 |
def find_ip4_by_id(self, id_ip):
"""
Get an IP by ID
:param id_ip: IP identifier. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{ ips { id: <id_ip4>,
oct1: <oct1>,
oct2: <oct2>,
oct3: ... | 0.002532 |
def find_version():
"""Only define version in one place"""
version_file = read_file('__init__.py')
version_match = re.search(r'^__version__ = ["\']([^"\']*)["\']',
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to ... | 0.002924 |
def _get_object_from_python_path(python_path):
"""Method that will fetch a Marshmallow schema from a path to it.
Args:
python_path (str): The string path to the Marshmallow schema.
Returns:
marshmallow.Schema: The schema matching the provided path.
Raises:
... | 0.002288 |
def _ParseToken(self, file_object, file_offset):
"""Parses a token.
Args:
file_object (dfvfs.FileIO): file-like object.
file_offset (int): offset of the token relative to the start of
the file-like object.
Returns:
tuple: containing:
int: token type
object: toke... | 0.003755 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.