text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def request(self, method, path, **kwargs):
"""Prepare HTTP request."""
if method == 'get':
session_method = self.config.session.get
elif method == 'post':
session_method = self.config.session.post
else:
raise AxisException
url = self.config.... | 0.004082 |
def root_manifest_id(self, root_manifest_id):
"""
Sets the root_manifest_id of this UpdateCampaignPutRequest.
:param root_manifest_id: The root_manifest_id of this UpdateCampaignPutRequest.
:type: str
"""
if root_manifest_id is not None and len(root_manifest_id) > 32:
... | 0.008333 |
def _exc_to_http(param1):
""" translate exception str to http code"""
if len(param1) <= 3:
try:
int(param1)
except BaseException:
logger.error(
"JMeter wrote some strange data into codes column: %s", param1)
else:
return int(param1)
... | 0.002058 |
def format_json_api_response(self, data, many):
"""Post-dump hook that formats serialized data as a top-level JSON API object.
See: http://jsonapi.org/format/#document-top-level
"""
ret = self.format_items(data, many)
ret = self.wrap_response(ret, many)
ret = self.render... | 0.007444 |
def class_register(cls):
"""Class decorator that allows to map LSP method names to class methods."""
cls.handler_registry = {}
cls.sender_registry = {}
for method_name in dir(cls):
method = getattr(cls, method_name)
if hasattr(method, '_handle'):
cls.handler_registry.update({... | 0.002123 |
def _do_download_file(self, dss_file, fh, num_retries, min_delay_seconds):
"""
Abstracts away complications for downloading a file, handles retries and delays, and computes its hash
"""
hasher = hashlib.sha256()
delay = min_delay_seconds
retries_left = num_retries
... | 0.003857 |
def package_info(pkg_name):
"""Prints the information of a package.
Args:
pkg_name (str): The name of the desired package to get information
"""
indent = " "
for config, _ in _iter_packages():
if pkg_name == config["name"]:
print("Package:", pkg_name)
print(... | 0.00317 |
def clean_protocol(self, protocol):
"""
A lot of measurement types make use of a protocol value, so we handle
that here.
"""
if protocol is not None:
try:
return self.PROTOCOL_MAP[protocol]
except KeyError:
self._handle_malf... | 0.004141 |
def draw_light_2d_linear(self, kwargs_list, n=1, new_compute=False, r_eff=1.):
"""
constructs the CDF and draws from it random realizations of projected radii R
:param kwargs_list:
:return:
"""
if not hasattr(self, '_light_cdf') or new_compute is True:
r_array... | 0.004219 |
def load_data_table(table_name, meta_file, meta):
"""Return the contents and metadata of a given table.
Args:
table_name(str): Name of the table.
meta_file(str): Path to the meta.json file.
meta(dict): Contents of meta.json.
Returns:
tuple(pandas.DataFrame, dict)
"""
... | 0.001754 |
def _set_request_referer_metric(self, request):
"""
Add metric 'request_referer' for http referer.
"""
if 'HTTP_REFERER' in request.META and request.META['HTTP_REFERER']:
monitoring.set_custom_metric('request_referer', request.META['HTTP_REFERER']) | 0.010274 |
def _ParseValueData(self, knowledge_base, value_data):
"""Parses Windows Registry value data for a preprocessing attribute.
Args:
knowledge_base (KnowledgeBase): to fill with preprocessing information.
value_data (object): Windows Registry value data.
Raises:
errors.PreProcessFail: if th... | 0.005195 |
def get_loaded_rules(rules_paths):
"""Yields all available rules.
:type rules_paths: [Path]
:rtype: Iterable[Rule]
"""
for path in rules_paths:
if path.name != '__init__.py':
rule = Rule.from_path(path)
if rule.is_enabled:
yield rule | 0.0033 |
def get_note(self, noteid):
"""Fetch a single note
:param folderid: The UUID of the note
"""
if self.standard_grant_type is not "authorization_code":
raise DeviantartError("Authentication through Authorization Code (Grant Type) is required in order to connect to this endpo... | 0.007335 |
def from_folder(cls, path:PathOrStr='.', extensions:Collection[str]=text_extensions, vocab:Vocab=None,
processor:PreProcessor=None, **kwargs)->'TextList':
"Get the list of files in `path` that have a text suffix. `recurse` determines if we search subfolders."
processor = ifnone(proce... | 0.039604 |
def sendToSbs(self, challenge_id, item_id):
"""Send card FROM CLUB to first free slot in sbs squad."""
# TODO?: multiple item_ids
method = 'PUT'
url = 'sbs/challenge/%s/squad' % challenge_id
squad = self.sbsSquad(challenge_id)
players = []
moved = False
n... | 0.003018 |
def register(registerable: Any):
"""
Registers an object, notifying any listeners that may be interested in it.
:param registerable: the object to register
"""
listenable = registration_event_listenable_map[type(registerable)]
event = RegistrationEvent(registerable, RegistrationEvent.Type.REGIST... | 0.002747 |
def get_git_repositories_activity_metrics(self, project, from_date, aggregation_type, skip, top):
"""GetGitRepositoriesActivityMetrics.
[Preview API] Retrieves git activity metrics for repositories matching a specified criteria.
:param str project: Project ID or project name
:param datet... | 0.007303 |
def submit(self, command_line, name = None, array = None, dependencies = [], exec_dir = None, log_dir = "logs", dry_run = False, verbosity = 0, stop_on_failure = False, **kwargs):
"""Submits a job that will be executed in the grid."""
# add job to database
self.lock()
job = add_job(self.session, command... | 0.029683 |
def ten_cm_temp(self, unit='kelvin'):
"""Returns the soil temperature measured 10 cm below surface
:param unit: the unit of measure for the temperature value. May be:
'*kelvin*' (default), '*celsius*' or '*fahrenheit*'
:type unit: str
:returns: a float
:raises: Value... | 0.002797 |
def _readBatchOutputForFile(self, directory, fileIO, filename, session, spatial, spatialReferenceID,
replaceParamFile=None, maskMap=None):
"""
When batch mode is run in GSSHA, the files of the same type are
prepended with an integer to avoid filename conflicts.
... | 0.003543 |
def clear(self):
"""Clear all keys from the comment."""
for i in list(self._internal):
self._internal.remove(i) | 0.014286 |
def format_exception(etype, value, tb, limit = None):
"""Format a stack trace and the exception information.
The arguments have the same meaning as the corresponding arguments
to print_exception(). The return value is a list of strings, each
ending in a newline and some containing internal newlines. ... | 0.004615 |
def _message_generator(self):
"""Iterate over fetched_records"""
while self._next_partition_records or self._completed_fetches:
if not self._next_partition_records:
completion = self._completed_fetches.popleft()
self._next_partition_records = self._parse_fetc... | 0.002913 |
def ensure_configured(func):
"""Modify a function to call ``basicConfig`` first if no handlers exist."""
@functools.wraps(func)
def wrapper(*args, **kwargs):
if len(logging.root.handlers) == 0:
basicConfig()
return func(*args, **kwargs)
return wrapper | 0.00339 |
def get_members(obj, predicate=None):
"""
Returns all members of an object for which the supplied predicate is true and that do not
begin with __. Keep in mind that the supplied function must accept a potentially very broad
range of inputs, because the members of an object can be of any type. The functi... | 0.00892 |
def get_relative_embeddings_left_right(max_relative_position, length, depth,
num_heads,
heads_share_relative_embedding,
name):
"""Instantiate or retrieve relative embeddings, sliced according to length... | 0.005719 |
def submit(self, options=[]):
"""
ensures that all relatives of nodes in node_set are also added to the set before submitting
"""
self.complete_node_set()
self._write_job_file()
args = ['condor_submit_dag']
args.extend(options)
args.append(self.dag_file)
... | 0.006711 |
def webob_to_django_response(webob_response):
"""Returns a django response to the `webob_response`"""
from django.http import HttpResponse
django_response = HttpResponse(
webob_response.app_iter,
content_type=webob_response.content_type,
status=webob_response.status_code,
)
f... | 0.002331 |
def add_password_arg(cmd, psw, ___required=False):
"""Append password switch to commandline.
"""
if UNRAR_TOOL == ALT_TOOL:
return
if psw is not None:
cmd.append('-p' + psw)
else:
cmd.append('-p-') | 0.004149 |
def find_file(self, path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file
'''
fnd = {'path': '',
'rel': ''}
if os.path.isabs(path) or ... | 0.000708 |
def from_storage(cls, storage):
"""Load from storage.
Parameters
----------
storage : `markovchain.storage.Storage`
Returns
-------
`markovchain.Markov`
"""
args = dict(storage.settings.get('markov', {}))
args['storage'] = storage
... | 0.0059 |
def queue_bind(self, queue, exchange, routing_key, arguments=None):
"""Bind queue to an exchange using a routing key."""
return self.channel.queue_bind(queue=queue,
exchange=exchange,
routing_key=routing_key,
... | 0.005525 |
def insert_record(self,
table: str,
fields: Sequence[str],
values: Sequence[Any],
update_on_duplicate_key: bool = False) -> int:
"""Inserts a record into database, table "table", using the list of
fieldnames and the ... | 0.00489 |
def set_recording(is_recording): #pylint: disable=redefined-outer-name
"""Set status to recording/not recording. When recording, graph will be constructed
for gradient computation.
Parameters
----------
is_recording: bool
Returns
-------
previous state before this set.
"""
prev... | 0.008547 |
def move_to(self, x, y, pre_dl=None, post_dl=None):
"""Move mouse to (x, y)
**中文文档**
移动鼠标到 (x, y) 的坐标处。
"""
self.delay(pre_dl)
self.m.move(x, y)
self.delay(post_dl) | 0.009009 |
def _parse_java_version(line: str) -> tuple:
""" Return the version number found in the first line of `java -version`
>>> _parse_java_version('openjdk version "11.0.2" 2018-10-16')
(11, 0, 2)
"""
m = VERSION_RE.search(line)
version_str = m and m.group(0).replace('"', '') or '0.0.0'
if '_' i... | 0.001898 |
def autogen_argparse_block(extra_args=[]):
"""
SHOULD TURN ANY REGISTERED ARGS INTO A A NEW PARSING CONFIG
FILE FOR BETTER --help COMMANDS
import utool as ut
__REGISTERED_ARGS__ = ut.util_arg.__REGISTERED_ARGS__
Args:
extra_args (list): (default = [])
CommandLine:
python -... | 0.001801 |
def create_shn (archive, compression, cmd, verbosity, interactive, filenames):
"""Compress a WAV file to a SHN archive."""
if len(filenames) > 1:
raise util.PatoolError("multiple filenames for shorten not supported")
cmdlist = [util.shell_quote(cmd)]
cmdlist.extend(['-', util.shell_quote(archive... | 0.007389 |
def squad(self, squad_id=0, persona_id=None):
"""Return a squad.
:params squad_id: Squad id.
"""
method = 'GET'
url = 'squad/%s/user/%s' % (squad_id, persona_id or self.persona_id)
# pinEvents
events = [self.pin.event('page_view', 'Hub - Squads')]
self.p... | 0.004444 |
def compact(self) -> str:
"""
Return a transaction in its compact format from the instance
:return:
"""
"""TX:VERSION:NB_ISSUERS:NB_INPUTS:NB_UNLOCKS:NB_OUTPUTS:HAS_COMMENT:LOCKTIME
PUBLIC_KEY:INDEX
...
INDEX:SOURCE:FINGERPRINT:AMOUNT
...
PUBLIC_KEY:AMOUNT
...
COMMENT
"""
... | 0.002117 |
def get_query_results(self, job_id, offset=None, limit=None,
page_token=None, timeout=0):
"""Execute the query job indicated by the given job id. This is direct
mapping to bigquery api
https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults
Par... | 0.002527 |
def buttons(self, master):
'''Add a standard button box.
Override if you do not want the standard buttons
'''
box = tk.Frame(master)
ttk.Button(
box,
text="Next",
width=10,
command=self.next_day
).pack(side=tk.LEFT, padx=... | 0.002439 |
def debug_print(self):
"""
Prints the ring for debugging purposes.
"""
ring = self._fetch_all()
print('Hash ring "{key}" replicas:'.format(key=self.key))
now = time.time()
n_replicas = len(ring)
if ring:
print('{:10} {:6} {:7} {}'.format('St... | 0.002464 |
def retrieve_list_members(self, list_, query_column, field_list, ids_to_retrieve):
""" Responsys.retrieveListMembers call
Accepts:
InteractObject list_
string query_column
possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER'
list fiel... | 0.008052 |
def get_variants_to_controllers(
graph: BELGraph,
node: Protein,
modifications: Optional[Set[str]] = None,
) -> Mapping[Protein, Set[Protein]]:
"""Get a mapping from variants of the given node to all of its upstream controllers."""
rv = defaultdict(set)
variants = variants_of(graph, ... | 0.003883 |
def log_to_stream(stream=sys.stderr, level=logging.NOTSET,
fmt=logging.BASIC_FORMAT):
""" Add :class:`logging.StreamHandler` to logger which logs to a stream.
:param stream. Stream to log to, default STDERR.
:param level: Log level, default NOTSET.
:param fmt: String with log format, ... | 0.002024 |
def reversed_graph(graph:dict) -> dict:
"""Return given graph reversed"""
ret = defaultdict(set)
for node, succs in graph.items():
for succ in succs:
ret[succ].add(node)
return dict(ret) | 0.009009 |
def get_sequence_value(node):
"""Convert an element with DataType Sequence to a DataFrame.
Note this may be a naive implementation as I assume that bulk data is always a table
"""
assert node.Datatype == 15
data = defaultdict(list)
cols = []
for i in range(node.Nu... | 0.005479 |
def _kernel_versions_debian():
'''
Last installed kernel name, for Debian based systems.
Returns:
List with possible names of last installed kernel
as they are probably interpreted in output of `uname -a` command.
'''
kernel_get_selections = __salt__['cmd.run']('dpkg --get-s... | 0.002421 |
def _from_dict(cls, _dict):
"""Initialize a SpeechRecognitionResult object from a json dictionary."""
args = {}
if 'final' in _dict or 'final_results' in _dict:
args['final_results'] = _dict.get('final') or _dict.get(
'final_results')
else:
raise V... | 0.004429 |
def unhide_tool(self, context_name, tool_name):
"""Unhide a tool so that it may be exposed in a suite.
Note that unhiding a tool doesn't guarantee it can be seen - a tool of
the same name from a different context may be overriding it.
Args:
context_name (str): Context conta... | 0.003333 |
def correlation_plots(self, x_analyte, y_analyte, window=15, filt=True, recalc=False, samples=None, subset=None, outdir=None):
"""
Plot the local correlation between two analytes.
Parameters
----------
x_analyte, y_analyte : str
The names of the x and y analytes to c... | 0.005102 |
def get_serialnumber(self):
"""
:return: the serial number
"""
command = const.CMD_OPTIONS_RRQ
command_string = b'~SerialNumber\x00'
response_size = 1024
cmd_response = self.__send_command(command, command_string, response_size)
if cmd_response.get('status... | 0.006838 |
def set_meta(self, selected_meta):
"""Sets one axis of the 2D multi-indexed dataframe
index to the selected meta data.
:param selected_meta: The list of the metadata users want to index with.
"""
meta_names = list(selected_meta)
meta_names.append('sample')
m... | 0.008056 |
def log(self):
"""Log stuff.
"""
with Subscribe(services=[""], addr_listener=True) as sub:
for msg in sub.recv(1):
if msg:
if msg.type in ["log.debug", "log.info",
"log.warning", "log.error",
... | 0.001531 |
def project_list(self):
"""The list of :py:class:`pylsdj.Project` s that the
.sav file contains"""
return [(i, self.projects[i]) for i in sorted(self.projects.keys())] | 0.010471 |
def marcxml2record(marcxml):
"""Convert a MARCXML string to a JSON record.
Tries to guess which set of rules to use by inspecting the contents
of the ``980__a`` MARC field, but falls back to HEP in case nothing
matches, because records belonging to special collections logically
belong to the Litera... | 0.000824 |
def create_lxc(name, template='ubuntu', service=None):
"""Factory method for the generic LXC"""
service = service or LXCService
service.create(name, template=template)
meta = LXCMeta(initial=dict(type='LXC'))
lxc = LXC.with_meta(name, service, meta, save=True)
return lxc | 0.00339 |
def modules_and_args(modules=True, states=False, names_only=False):
'''
Walk the Salt install tree and return a dictionary or a list
of the functions therein as well as their arguments.
:param modules: Walk the modules directory if True
:param states: Walk the states directory if True
:param na... | 0.002402 |
def find_ss_regions(dssp_residues, loop_assignments=(' ', 'B', 'S', 'T')):
"""Separates parsed DSSP data into groups of secondary structure.
Notes
-----
Example: all residues in a single helix/loop/strand will be gathered
into a list, then the next secondary structure element will be
gathered i... | 0.0006 |
async def bounded_fetch(session, url):
"""
Use session object to perform 'get' request on url
"""
async with sem, session.get(url) as response:
return await response.json() | 0.005102 |
def _generate_base_namespace_module(self, api, namespace):
"""Creates a module for the namespace. All data types and routes are
represented as Python classes."""
self.cur_namespace = namespace
generate_module_header(self)
if namespace.doc is not None:
self.emit('"""... | 0.000989 |
def _sample_actions(self,
state: Sequence[tf.Tensor]) -> Tuple[Sequence[tf.Tensor], tf.Tensor, tf.Tensor]:
'''Returns sampled action fluents and tensors related to the sampling.
Args:
state (Sequence[tf.Tensor]): A list of state fluents.
Returns:
Tuple[Seque... | 0.00681 |
def _read_midi_length(fileobj):
"""Returns the duration in seconds. Can raise all kind of errors..."""
TEMPO, MIDI = range(2)
def read_chunk(fileobj):
info = fileobj.read(8)
if len(info) != 8:
raise SMFError("truncated")
chunklen = struct.unpack(">I", info[4:])[0]
... | 0.000451 |
def _checkSetupNeeded(self, message):
"""Check an id_res message to see if it is a
checkid_immediate cancel response.
@raises SetupNeededError: if it is a checkid_immediate cancellation
"""
# In OpenID 1, we check to see if this is a cancel from
# immediate mode by the p... | 0.003484 |
def invert(self,nz,A,C):
"""
Inversion and resolution of a tridiagonal matrix
A X = C
Input:
nz number of layers
a(*,1) lower diagonal (Ai,i-1)
a(*,2) principal diagonal (Ai,i)
a(*,3) upper diagonal (Ai,i+1)
c
Output
... | 0.01138 |
def hierarchy_name(self, adjust_for_printing=True):
"""
return the name for this object with the parents names attached by dots.
:param bool adjust_for_printing: whether to call :func:`~adjust_for_printing()`
on the names, recursively
... | 0.011532 |
def _prepare_filtering_params(domain=None, category=None,
sponsored_source=None, has_field=None,
has_fields=None, query_params_match=None,
query_person_match=None, **kwargs):
"""Transform the params to th... | 0.005731 |
def tag_ca_geometry(self, force=False, reference_axis=None,
reference_axis_name='ref_axis'):
"""Tags each `Monomer` in the `Assembly` with its helical geometry.
Parameters
----------
force : bool, optional
If True the tag will be run even if `Monomers... | 0.003264 |
def kml_lod(min_lod_pixels=DEFAULT_MIN_LOD_PIXELS, max_lod_pixels=DEFAULT_MAX_LOD_PIXELS):
"""
Create the KML LevelOfDetail (LOD) Tag.
In a Region, the <minLodPixels> and <maxLodPixels> elements allow you to specify
an area of the screen (in square pixels). When your data is projected onto the screen,
... | 0.008333 |
def _resolve_functions(functions: Dict[str, Callable[[Any], Any]], fixture: Fixture) -> None:
'''Apply functions and collect values as properties on fixture.
Call functions and apply their values as properteis on fixture.
Functions will continue to get applied until no more functions resolve.
All unres... | 0.005569 |
def qubit_adjacent_lifted_gate(i, matrix, n_qubits):
"""
Lifts input k-qubit gate on adjacent qubits starting from qubit i
to complete Hilbert space of dimension 2 ** num_qubits.
Ex: 1-qubit gate, lifts from qubit i
Ex: 2-qubit gate, lifts from qubits (i+1, i)
Ex: 3-qubit gate, lifts from qubit... | 0.001931 |
def history(self, offset=0):
"""
The pipeline history allows users to list pipeline instances.
:param offset: number of pipeline instances to be skipped.
:return: an array of pipeline instances :class:`yagocd.resources.pipeline.PipelineInstance`.
:rtype: list of yagocd.resources... | 0.006944 |
def write_phy(data, sidx, pnames):
"""
write the phylip output file from the tmparr[seqarray]
"""
## grab seq data from tmparr
start = time.time()
tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name))
with h5py.File(tmparrs, 'r') as io5:
seqarr = io5["seqarr"]... | 0.011765 |
def backend(self, name):
"""
Get backend class
:param name: -- name of backend type
:type name: str
:return: class of backend
:rtype: class,module,object
"""
try:
backend = self.get_backend_handler_path(name)
if backend is None:
... | 0.00641 |
def is_compatible(self, obj):
"""Check if characters can be combined into a textline
We consider characters compatible if:
- the Unicode mapping is known, and both have the same render mode
- the Unicode mapping is unknown but both are part of the same font
"""
b... | 0.004202 |
def load_metadata(fileobj):
"""Load the submission from a file.
:param filename: where to load the submission from
"""
with gzip.GzipFile(fileobj=fileobj, mode='r') as z:
return json.loads(z.readline()) | 0.008097 |
def _shorten_line(tokens, source, indentation, indent_word,
aggressive=False, previous_line=''):
"""Separate line at OPERATOR.
The input is expected to be free of newlines except for inside multiline
strings and at the end.
Multiple candidates will be yielded.
"""
for (token... | 0.000413 |
def Scan(self, after_timestamp=None, include_suffix=False, max_records=None):
"""Scans for stored records.
Scans through the collection, returning stored values ordered by timestamp.
Args:
after_timestamp: If set, only returns values recorded after timestamp.
include_suffix: If true, the times... | 0.005063 |
def mv_connect_generators(mv_grid_district, graph, debug=False):
"""Connect MV generators to MV grid
Args
----
mv_grid_district: MVGridDistrictDing0
MVGridDistrictDing0 object for which the connection process has to be
done
graph: :networkx:`NetworkX Graph Obj< >`
NetworkX g... | 0.003033 |
def _fix_uncontracted(basis):
'''
Forces the contraction coefficient of uncontracted shells to 1.0
'''
for el in basis['elements'].values():
if 'electron_shells' not in el:
continue
for sh in el['electron_shells']:
if len(sh['coefficients']) == 1 and len(sh['coe... | 0.003442 |
def _press_pwr_btn(self, pushType="Press"):
"""Simulates a physical press of the server power button.
:param pushType: Type of power button press to simulate
Supported values are: 'Press' and 'PressAndHold'
:raises: IloError, on an error from iLO.
"""
po... | 0.002632 |
def set_or_clear_breakpoint(self):
"""Set/Clear breakpoint"""
editorstack = self.get_current_editorstack()
if editorstack is not None:
self.switch_to_plugin()
editorstack.set_or_clear_breakpoint() | 0.008032 |
def alter_subprocess_kwargs_by_platform(**kwargs):
"""
Given a dict, populate kwargs to create a generally
useful default setup for running subprocess processes
on different platforms. For example, `close_fds` is
set on posix and creation of a new console window is
disabled on Windows.
... | 0.002342 |
def extend_to_data(self, Y):
"""Build transition matrix from new data to the graph
Creates a transition matrix such that `Y` can be approximated by
a linear combination of samples in `self.data`. Any
transformation of `self.data` can be trivially applied to `Y` by
performing
... | 0.002014 |
def _setup_bonds(self):
"""Derive Bond objects from the record."""
self._bonds = {}
if 'bonds' not in self.record:
return
# Create bonds
aid1s = self.record['bonds']['aid1']
aid2s = self.record['bonds']['aid2']
orders = self.record['bonds']['order']
... | 0.00466 |
def parse_docstring(docstring):
"""
Parse a PEP-257 docstring.
SHORT -> blank line -> LONG
"""
short_desc = long_desc = ''
if docstring:
docstring = trim(docstring.lstrip('\n'))
lines = docstring.split('\n\n', 1)
short_desc = lines[0].strip().replace('\n', ' ')
... | 0.002421 |
def get_pepproteins(line):
"""Returns from a PSM line peptide sequence,
and other information about the PSM.
Return values:
psm_id - str
proteins - list of str
"""
psm_id = get_psm_id(line)
proteins = get_proteins_from_psm(line)
return psm_id, proteins | 0.003165 |
def _update_range(self, response):
""" Update the query count property from the `X-Resource-Range` response header """
header_value = response.headers.get('x-resource-range', '')
m = re.match(r'\d+-\d+/(\d+)$', header_value)
if m:
self._count = int(m.group(1))
else:
... | 0.008596 |
def showDataDirectoriesData(peInstance):
""" Prints the DATA_DIRECTORY fields. """
print "[+] Data directories:\n"
dirs = peInstance.ntHeaders.optionalHeader.dataDirectory
counter = 1
for dir in dirs:
print "[%d] --> Name: %s -- RVA: 0x%08x -- SIZE: 0x%08x" % (counter, dir.name.value, ... | 0.008043 |
def _search_solr(self, line):
"""Perform a SOLR search."""
try:
query_str = self._create_solr_query(line)
client = d1_cli.impl.client.CLICNClient(
**self._cn_client_connect_params_from_session()
)
object_list_pyxb = client.search(
... | 0.002426 |
def add_master_user_mysql(database: str,
root_user: str,
root_password: str,
new_user: str,
new_password: str,
server: str = "localhost",
port: int = 3306,
... | 0.000904 |
def sidpath(self, sid):
"""
Parameters
----------
sid : int
Asset identifier.
Returns
-------
out : string
Full path to the bcolz rootdir for the given sid.
"""
sid_subdir = _sid_subdir_path(sid)
return join(self._r... | 0.0059 |
def start_kex(self):
"""
Start the GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange
"""
if self.transport.server_mode:
self.transport._expect_packet(MSG_KEXGSS_GROUPREQ)
return
# request a bit range: we accept (min_bits) to (max_bits), but prefer... | 0.002703 |
def common_srun_options(cls, campaign):
"""Get options to be given to all srun commands
:rtype: list of string
"""
default = dict(campaign.process.get('srun') or {})
default.update(output='slurm-%N-%t.stdout', error='slurm-%N-%t.error')
return default | 0.006667 |
def fit_interval_censoring(
self,
lower_bound,
upper_bound,
event_observed=None,
timeline=None,
label=None,
alpha=None,
ci_labels=None,
show_progress=False,
entry=None,
weights=None,
): # pylint: disable=too-many-arguments
... | 0.004763 |
def add(self, key, val, minutes):
"""
Store an item in the cache if it does not exist.
:param key: The cache key
:type key: str
:param val: The cache value
:type val: mixed
:param minutes: The lifetime in minutes of the cached value
:type minutes: int|d... | 0.004184 |
def display_outOfBound(self, data, lowBound, highBound):
""" Select data that is out of bounds.
Parameters
----------
data : pd.DataFrame()
Input dataframe.
lowBound : float
Lower bound for dataframe.
highBound : float
... | 0.010187 |
def profiling_request_formatter(view, context, model, name):
"""Wrap HTTP method value in a bs3 label."""
document = model[name]
return Markup(
''.join(
[
'<p class="profiling-request">',
'<a href="{}">'.format(document.get_admin_url(_external=True)),
... | 0.001908 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.