text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def virtual_machine_get(name, resource_group, **kwargs):
'''
.. versionadded:: 2019.2.0
Retrieves information about the model view or the instance view of a
virtual machine.
:param name: The name of the virtual machine.
:param resource_group: The resource group name assigned to the
vi... | 0.001043 |
def is_not_modified(
self, response_headers: Headers, request_headers: Headers
) -> bool:
"""
Given the request and response headers, return `True` if an HTTP
"Not Modified" response could be returned instead.
"""
try:
if_none_match = request_headers["if-n... | 0.003257 |
def adjust_learning_rate(optimizer, epoch):
"""Sets the learning rate to the initial LR decayed by 10 every 30 epochs"""
lr = args.lr * (0.1 ** (epoch // 30))
for param_group in optimizer.param_groups:
param_group['lr'] = lr | 0.008197 |
def main():
"""Cli entrypoint.
"""
if len(sys.argv) == 2:
fname = sys.argv[1]
data = json.load(open(fname, 'rb'))
else:
data = json.loads(sys.stdin.read())
print(pydeps2reqs(data)) | 0.00431 |
def parse_graph_section(config_obj, section, outdir_default, indir_default):
"""
Parse the GRAPH section of the config to extract useful values
:param config_obj: ConfigParser object
:param section: Section name
:param outdir_default: Default output directory passed in args
:param indir_default: Default inp... | 0.010356 |
def _get_ref_info_helper(cls, repo, ref_path):
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
rela_path points to, or None. target_ref_path is the reference we
point to, or None"""
tokens = None
repodir = _git_dir(repo, ref_path)
try:
... | 0.004932 |
def get_related(page):
"""
Returns list of related Entry instances for specified page.
:param page: the page instance.
:rtype: list.
"""
related = []
entry = Entry.get_for_model(page)
if entry:
related = entry.related
return related | 0.007117 |
def load_config_file(self):
"""Parse configuration file and get config values."""
config_parser = SafeConfigParser()
config_parser.read(self.CONFIG_FILE)
if config_parser.has_section('handlers'):
self._config['handlers_package'] = config_parser.get('handlers', 'package')
... | 0.007402 |
def search(self, pkg_name=None, search_carts=False, query='/content/units/rpm/search/'):
"""
search for a package stored in a pulp repo
`pkg_name` - substring in the name of the package
`search_carts` - whether or not to return carts that include
the listed package
"... | 0.004036 |
def create_task_from_xml(name,
location='\\',
xml_text=None,
xml_path=None,
user_name='System',
password=None):
r'''
Create a task based on XML. Source can be a file or a string of XML.
... | 0.002868 |
async def warn_user(channel, user):
"""
Gives a user a warning, and bans them if they are over the maximum warnings
Args:
channel: The channel to send the warning message in
user: The user to give the warning to
"""
data = datatools.get_data()
server_id = channel.server.id
... | 0.007413 |
def use_plenary_proficiency_view(self):
"""Pass through to provider ProficiencyLookupSession.use_plenary_proficiency_view"""
self._object_views['proficiency'] = PLENARY
# self._get_provider_session('proficiency_lookup_session') # To make sure the session is tracked
for session in self._g... | 0.008493 |
def operator_complexity(self):
"""Operator complexity of this multigrid hierarchy.
Defined as:
Number of nonzeros in the matrix on all levels /
Number of nonzeros in the matrix on the finest level
"""
return sum([level.A.nnz for level in self.levels]) /\
... | 0.005682 |
def _generate_hex_for_uris(self, uris):
"""Given uris, generate and return hex version of it
Parameters
----------
uris : list
Containing all uris
Returns
-------
str
Hexed uris
"""
return sha256((":".join(uris) + str(time... | 0.00578 |
def print_docs(self):
'''
Print out the documentation!
'''
arg = self.opts.get('fun', None)
docs = super(Runner, self).get_docs(arg)
for fun in sorted(docs):
display_output('{0}:'.format(fun), 'text', self.opts)
print(docs[fun]) | 0.006667 |
def genty_dataset(*args, **kwargs):
"""Decorator defining data sets to provide to a test.
Inspired by http://sebastian-bergmann.de/archives/
702-Data-Providers-in-PHPUnit-3.2.html
The canonical way to call @genty_dataset, with each argument each
representing a data set to be injected in the test m... | 0.000316 |
def console_hline(
con: tcod.console.Console,
x: int,
y: int,
l: int,
flag: int = BKGND_DEFAULT,
) -> None:
"""Draw a horizontal line on the console.
This always uses the character 196, the horizontal line character.
.. deprecated:: 8.5
Use :any:`Console.hline` instead.
"""... | 0.005305 |
def crop_keypoint_by_coords(keypoint, crop_coords, crop_height, crop_width, rows, cols):
"""Crop a keypoint using the provided coordinates of bottom-left and top-right corners in pixels and the
required height and width of the crop.
"""
x, y, a, s = keypoint
x1, y1, x2, y2 = crop_coords
cropped_... | 0.007874 |
def AddEventSource(self, event_source):
"""Adds an event source.
Args:
event_source (EventSource): event source.
Raises:
IOError: when the storage file is closed or read-only.
OSError: when the storage file is closed or read-only.
"""
self._RaiseIfNotWritable()
self._AddAttr... | 0.002551 |
def get_random_user(self):
"""
Gets a random user from the provider
:returns: Dictionary
"""
c = self.db.cursor()
c.execute('''SELECT username, password, fullname FROM users
WHERE rowid >= (abs(random()) % (SELECT max(rowid) FROM users))
... | 0.006897 |
def update_employee(emp_id, key=None, value=None, items=None):
'''
Update one or more items for this employee. Specifying an empty value will
clear it for that employee.
CLI Examples:
salt myminion bamboohr.update_employee 1138 nickname Curly
salt myminion bamboohr.update_employee 1138... | 0.00177 |
def delete(self, using=None, **kwargs):
"""
Deletes the index in elasticsearch.
Any additional keyword arguments will be passed to
``Elasticsearch.indices.delete`` unchanged.
"""
return self._get_connection(using).indices.delete(index=self._name, **kwargs) | 0.009836 |
def bitsCmp(self, other, op, evalFn=None):
"""
:attention: If other is Bool signal convert this to bool (not ideal,
due VHDL event operator)
"""
other = toHVal(other)
t = self._dtype
ot = other._dtype
iamVal = isinstance(self, Value)
otherIsVal = isinstance(other, Value)
if... | 0.000616 |
def _loadData(self, data):
""" Load attribute values from Plex XML response. """
self._data = data
for elem in data:
id = utils.lowerFirst(elem.attrib['id'])
if id in self._settings:
self._settings[id]._loadData(elem)
continue
s... | 0.005222 |
def get_name(self,item):
"""
Return the name for this item registered with this NameSelector.
If no name has previously been registered, then generate a new
one.
"""
if not isinstance(item,ford.sourceform.FortranBase):
raise Exception('{} is not of a type deri... | 0.008 |
def getDignities(self):
""" Returns the dignities belonging to this object. """
info = self.getInfo()
dignities = [dign for (dign, objID) in info.items()
if objID == self.obj.id]
return dignities | 0.011952 |
def guess_file_compression(file_path, magic_dict=None):
"""Guesses the compression of an input file.
This function guesses the compression of a given file by checking for
a binary signature at the beginning of the file. These signatures are
stored in the :py:data:`MAGIC_DICT` dictionary. The supported ... | 0.000724 |
def ImportContractAddr(wallet, contract_hash, pubkey_script_hash):
"""
Args:
wallet (Wallet): a UserWallet instance
contract_hash (UInt160): hash of the contract to import
pubkey_script_hash (UInt160):
Returns:
neo.SmartContract.Contract.Contract
"""
contract = Bloc... | 0.002622 |
def notify_items(**kwargs):
"""
Signal endpoint that actually sends knocks whenever an instance is created / saved
"""
instance = kwargs.get('instance')
created = kwargs.get('created', False)
if hasattr(instance, 'send_knock') and active_knocks(instance):
try:
# This is a stu... | 0.003812 |
def create_namespaced_secret(self, namespace, body, **kwargs): # noqa: E501
"""create_namespaced_secret # noqa: E501
create a Secret # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thre... | 0.001307 |
def _main(instaloader: Instaloader, targetlist: List[str],
username: Optional[str] = None, password: Optional[str] = None,
sessionfile: Optional[str] = None,
download_profile_pic: bool = True, download_posts=True,
download_stories: bool = False, download_highlights: bool = False,... | 0.005663 |
def load_metadata(self, data_dir, feature_name=None):
"""See base class for details."""
# Restore names if defined
names_filepath = _get_names_filepath(data_dir, feature_name)
if tf.io.gfile.exists(names_filepath):
self.names = _load_names_from_file(names_filepath) | 0.006969 |
def dict_entry_has_key(line, key):
"""Return True if `line` is a dict entry that uses `key`.
Return False for multiline cases where the line should not be removed by
itself.
"""
if '#' in line:
return False
result = re.match(r'\s*(.*)\s*:\s*(.*),\s*$', line)
if not result:
... | 0.001786 |
def get_installed_daps_detailed():
'''Returns a dictionary with all installed daps and their versions and locations
First version and location in the dap's list is the one that is preferred'''
daps = {}
for loc in _data_dirs():
s = get_installed_daps(loc)
for dap in s:
if dap... | 0.008421 |
def to_bytes(value, encoding='utf-8'):
"""Converts a string value to bytes, if necessary.
Unfortunately, ``six.b`` is insufficient for this task since in
Python 2 because it does not modify ``unicode`` objects.
Args:
value (Union[str, bytes]): The value to be converted.
encoding (str):... | 0.001136 |
def build_re_pattern_from_intervals(intervals: IntervalListType) -> BuiltInReType:
"""
Convert intervals to regular expression pattern.
:param intervals: Unicode codepoint intervals.
"""
inner = [f'{chr(lb)}-{chr(ub)}' for lb, ub in intervals]
joined_inner = ''.join(inner)
pattern = f'[{jo... | 0.005291 |
def onUserError(self, fail, message):
"""
Handle user errors
"""
self.log.error(fail)
self.log.error(message) | 0.013423 |
def _validate(self):
"""
The purpose of this method is to verify that the user has set sensible
values for the training program before rendering. The user will still
be able to render, but error messages will be printed. This method:
* Validates that the average ... | 0.001955 |
def add_field(self, name, script, lang=None, params=None, ignore_failure=False):
"""
Add a field to script_fields
"""
data = {}
if lang:
data["lang"] = lang
if script:
data['script'] = script
else:
raise ScriptFieldsError("Scri... | 0.007003 |
def _request(self, path, key, data, method, key_is_cik, extra_headers={}):
"""Generically shared HTTP request method.
Args:
path: The API endpoint to interact with.
key: A string for the key used by the device for the API. Either a CIK or token.
data: A string for t... | 0.004614 |
def updateState(self, slicedArray, rtiInfo, separateFields):
""" Sets the slicedArray and rtiInfo and other members. This will reset the model.
Will be called from the tableInspector._drawContents.
"""
self.beginResetModel()
try:
# The sliced array can be a maske... | 0.003686 |
def validator(self, meth):
"""
Decorator that adds *meth* to the list of validators.
Returns *meth* unchanged.
.. versionadded:: 17.1.0
"""
if self._validator is None:
self._validator = meth
else:
self._validator = and_(self._validator, m... | 0.005814 |
def in_(self, qfield, *values):
''' Check to see that the value of ``qfield`` is one of ``values``
:param qfield: Instances of :class:`ommongo.query_expression.QueryExpression`
:param values: Values should be python values which ``qfield`` \
understands
'''
... | 0.014519 |
def _set_residual_probability(p: np.ndarray) -> np.ndarray:
"""Turns any use of `RESIDUAL_CHOICE` into a residual probability.
Parameters
----------
p :
Array where each row is a set of probability weights and potentially
a `RESIDUAL_CHOICE` placeholder.
Returns
-------
np.... | 0.002755 |
def get_metadata_parser(metadata_container, **metadata_defaults):
"""
Takes a metadata_container, which may be a type or instance of a parser, a dict, string, or file.
:return: a new instance of a parser corresponding to the standard represented by metadata_container
:see: get_parsed_content(metdata_con... | 0.003685 |
def _proc_loop(proc_id, alive, queue, fn):
"""Thread loop for generating data
Parameters
----------
proc_id: int
Process id
alive: multiprocessing.Value
variable for signaling whether process should continue or not
queue: multiprocessing.Queue
... | 0.00271 |
def add_view(self, *args, **kwargs):
"""
Add a new view
Parameters
----------
uid: string
The uid of new view
width: int
The width of this of view on a 12 unit grid
height: int
The height of the this view. The height is proport... | 0.002174 |
def _translate(self):
"""
Convert the DataFrame in `self.data` and the attrs from `_build_styles`
into a dictionary of {head, body, uuid, cellstyle}.
"""
table_styles = self.table_styles or []
caption = self.caption
ctx = self.ctx
precision = self.precisio... | 0.000294 |
def from_db_value(cls, value, *_) -> Optional[LocalizedValue]:
"""Turns the specified database value into its Python
equivalent.
Arguments:
value:
The value that is stored in the database and
needs to be converted to its Python equivalent.
Re... | 0.001288 |
def create(self, resource, timeout=-1):
"""
Creates a scope.
Args:
resource (dict): Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting ... | 0.007984 |
def visit_Slice(self, node: ast.Slice) -> slice:
"""Visit ``lower``, ``upper`` and ``step`` and recompute the node as a ``slice``."""
lower = None # type: Optional[int]
if node.lower is not None:
lower = self.visit(node=node.lower)
upper = None # type: Optional[int]
... | 0.004739 |
def findall_window_ids(pattern):
"""
CommandLine:
wmctrl -l
python -m utool.util_ubuntu XCtrl.findall_window_ids gvim --src
python -m utool.util_ubuntu XCtrl.findall_window_ids gvim --src
python -m utool.util_ubuntu XCtrl.findall_window_ids joncrall --src... | 0.002392 |
def kallisto(fastq, out_dir, cb_histogram, cb_cutoff):
''' Convert fastqtransformed file to output format compatible with
kallisto.
'''
parser_re = re.compile('(.*):CELL_(?<CB>.*):UMI_(?P<UMI>.*)\\n(.*)\\n\\+\\n(.*)\\n')
if fastq.endswith('gz'):
fastq_fh = gzip.GzipFile(fileobj=open(fastq))
... | 0.001364 |
def _to_snippet(self, cfg_node=None, addr=None, size=None, thumb=False, jumpkind=None, base_state=None):
"""
Convert a CFGNode instance to a CodeNode object.
:param angr.analyses.CFGNode cfg_node: The CFGNode instance.
:param int addr: Address of the node. Only used when `cfg_node` is N... | 0.005696 |
def step_it_should_fail_with(context):
'''
EXAMPLE:
...
when I run "behave ..."
then it should fail with:
"""
TEXT
"""
'''
assert context.text is not None, "ENSURE: multiline text is provided."
step_command_output_should_contain(context)
... | 0.002571 |
def preview(ident):
'''Preview an harvesting for a given source'''
source = get_source(ident)
cls = backends.get(current_app, source.backend)
max_items = current_app.config['HARVEST_PREVIEW_MAX_ITEMS']
backend = cls(source, dryrun=True, max_items=max_items)
return backend.harvest() | 0.003268 |
def _set_start_time(self, v, load=False):
"""
Setter method for start_time, mapped from YANG variable /keychain/key/accept_lifetime/start_time (time-format-start)
If this variable is read-only (config: false) in the
source YANG file, then _set_start_time is considered as a private
method. Backends l... | 0.004796 |
def default_package(self):
"""
::
GET /:login/packages
:Returns: the default package for this datacenter
:rtype: :py:class:`dict` or ``None``
Requests all the packages in this datacenter, filters for the default,
and returns the cor... | 0.013913 |
def load_hdf(cls, filename, path='', name=None):
"""
A class method to load a saved StarModel from an HDF5 file.
File must have been created by a call to :func:`StarModel.save_hdf`.
:param filename:
H5 file to load.
:param path: (optional)
Path within H... | 0.005212 |
def load_file(self):
"""
Loads SAR format logfile in ASCII format (sarXX).
:return: ``True`` if loading and parsing of file went fine, \
``False`` if it failed (at any point)
"""
# We first split file into pieces
searchunks = self._split_file()
i... | 0.0032 |
def create_continuous_query(self, name, select, database=None,
resample_opts=None):
r"""Create a continuous query for a database.
:param name: the name of continuous query to create
:type name: str
:param select: select statement for the continuous query
... | 0.001629 |
def _add_attribute_values(self, value, att_mappings, indices):
"""Add an attribute value to the given vertices.
:param int value: Attribute value.
:param dict att_mappings: Dictionary of mappings between vertices and enumerated attributes.
:param list indices: Indices of the vertices.
... | 0.007538 |
def encrypt(self):
"""
We perform no encryption, we just encode the value as base64 and then
decode it in decrypt().
"""
value = self.parameters.get("Plaintext")
if isinstance(value, six.text_type):
value = value.encode('utf-8')
return json.dumps({"Cip... | 0.007614 |
def _reatach(self):
"""Reinsert the hidden items."""
for item, p, idx in self._detached:
# The item may have been deleted.
if self.treeview.exists(item) and self.treeview.exists(p):
self.treeview.move(item, p, idx)
self._detached = [] | 0.006711 |
def _unique_coords(self, coords_in, magmoms_in=None, lattice=None):
"""
Generate unique coordinates using coord and symmetry positions
and also their corresponding magnetic moments, if supplied.
"""
coords = []
if magmoms_in:
magmoms = []
if len(ma... | 0.001064 |
def _scroll_up(self, cli):
" Scroll window up. "
info = self.render_info
if info.vertical_scroll > 0:
# TODO: not entirely correct yet in case of line wrapping and long lines.
if info.cursor_position.y >= info.window_height - 1 - info.configured_scroll_offsets.bottom:
... | 0.009877 |
def prepare_to_run_task(context, claim_task):
"""Given a `claim_task` json dict, prepare the `context` and `work_dir`.
Set `context.claim_task`, and write a `work_dir/current_task_info.json`
Args:
context (scriptworker.context.Context): the scriptworker context.
claim_task (dict): the clai... | 0.001121 |
def plot_transit_model(self, show=True, fold=None, ax=None):
'''
Plot the light curve de-trended with a join instrumental + transit
model with the best fit transit model overlaid. The transit model
should be specified using the :py:obj:`transit_model` attribute
and should be an i... | 0.00028 |
def display_breakdown(scores, outfile=None):
"""Writes the point breakdown to `outfile` given a dictionary of scores.
`outfile` should be a string. If `outfile` is None, write to stdout.
RETURNS:
dict; 'Total' -> finalized score (float)
"""
total = 0
outfile = open(outfile, 'w') if outfile... | 0.001429 |
def search_vip_request(self, search):
"""
Method to list vip request
param search: search
"""
uri = 'api/v3/vip-request/?%s' % urllib.urlencode({'search': search})
return super(ApiVipRequest, self).get(uri) | 0.007813 |
def _FormatMessage(self, event):
"""Formats the message.
Args:
event (EventObject): event.
Returns:
str: message field.
Raises:
NoFormatterFound: if no event formatter can be found to match the data
type in the event.
"""
message, _ = self._output_mediator.GetForma... | 0.005445 |
def _update_simulation_end_from_lsm(self):
"""
Update simulation end time from LSM
"""
te = self.l2g.xd.lsm.datetime[-1]
simulation_end = te.replace(tzinfo=utc) \
.astimezone(tz=self.tz) \
.replace(tzinfo=None)
if sel... | 0.00314 |
def stepper_request_library_version(self):
"""
Request the stepper library version from the Arduino.
To retrieve the version after this command is called, call
get_stepper_version
"""
data = [self.STEPPER_LIBRARY_VERSION]
self._command_handler.send_sysex(self._com... | 0.008523 |
def get_complexity_factor(self, output='average', temp=300, doping_levels=False,
Lambda=0.5):
"""
Fermi surface complexity factor respect to calculated as explained in Ref.
Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor
from ab init... | 0.011339 |
def _update_secrets(self):
'''update secrets will take a secrets credential file
either located at .sregistry or the environment variable
SREGISTRY_CLIENT_SECRETS and update the current client
secrets as well as the associated API base.
'''
self.secrets = read_client_sec... | 0.0053 |
def get_home(self, home_id=None):
"""
Get the data about a home
"""
now = datetime.datetime.utcnow()
if self.home and now < self.home_refresh_at:
return self.home
if not self._do_auth():
raise RuntimeError("Unable to login")
if home_id is... | 0.001724 |
def set_base_step_parameters(self, filename, bp_step, parameters='all', step_range=True, helical=False):
"""To read and store base-step (Shift, Slide, Rise, Tilt, Roll and Twist) and
helical base-step (X-disp, Y-disp, h-Rise, Inclination, Tip and h-Twist) parameters from an input file
Parameter... | 0.010855 |
def check_battery(self):
"""
Implement how we will check battery condition. Now it just trying to check standard battery
in /sys
"""
self.charging = False if \
subprocess.getoutput("cat /sys/class/power_supply/BAT0/status") == 'Discharging' \
else True
... | 0.005967 |
def compute_features(self):
"""Actual implementation of the features.
Returns
-------
tonnetz: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
pcp = PCP(self.file_struct, self.feat_type, self.sr,... | 0.004024 |
def compile(self,
container: Container,
verbose: bool = False
) -> CompilationOutcome:
"""
Attempts to compile the program inside a given container.
Params:
verbose: specifies whether to print the stdout and stderr produced
... | 0.007246 |
def _wiki_articles(shard_id, wikis_dir=None):
"""Generates WikipediaArticles from GCS that are part of shard shard_id."""
if not wikis_dir:
wikis_dir = WIKI_CONTENT_DIR
with tf.Graph().as_default():
dataset = tf.data.TFRecordDataset(
cc_utils.readahead(
os.path.join(wikis_dir, WIKI_CON... | 0.008516 |
def filter(self, filter_arguments):
"""
Takes a dictionary of filter parameters.
Return a list of objects based on a list of parameters.
"""
results = self._get_content()
# Filter based on a dictionary of search parameters
if isinstance(filter_arguments, dict):
... | 0.002077 |
def fmt_confusion_matrix(hyps: Sequence[Sequence[str]],
refs: Sequence[Sequence[str]],
label_set: Set[str] = None,
max_width: int = 25) -> str:
""" Formats a confusion matrix over substitutions, ignoring insertions
and deletions. """
... | 0.002261 |
def remove_dhcp_server(self, server):
"""Removes the DHCP server settings
in server of type :class:`IDHCPServer`
DHCP server settings to be removed
raises :class:`OleErrorInvalidarg`
Host network interface @a name already exists.
"""
if not isin... | 0.009901 |
def query_all_issues(after):
"""Hits the github API for all closed issues after the given date, returns the data."""
page = count(1)
data = []
while True:
page_data = query_issues(next(page), after)
if not page_data:
break
data.extend(page_data)
return data | 0.00639 |
def item_enclosure_mime_type(self, item):
"""
Guess the enclosure's mimetype.
Note: this method is only called if item_enclosure_url
has returned something.
"""
mime_type, encoding = guess_type(self.cached_enclosure_url)
if mime_type:
return mime_type
... | 0.005764 |
def make_json_response(rv):
""" Make JsonResponse
:param rv: Response: the object to encode, or tuple (response, status, headers)
:type rv: tuple|*
:rtype: JsonResponse
"""
# Tuple of (response, status, headers)
rv, status, headers = normalize_response_value(rv)
# JsonResponse
if is... | 0.004739 |
def _frozen_pool_single_run(kwargs):
"""Single run wrapper for the frozen pool, makes a single run and passes kwargs"""
idx = kwargs.pop('idx')
frozen_kwargs = _frozen_pool_single_run.kwargs
frozen_kwargs.update(kwargs) # in case of `run_map`
# we need to update job's args and kwargs
traj = fro... | 0.004796 |
def create_user(self, params):
"""Register a new user account."""
receivers = create_user.send(
sender=__name__,
request=this.request,
params=params,
)
if len(receivers) == 0:
raise NotImplementedError(
'Handler for `create_... | 0.002857 |
def login(request):
"""View to check the persona assertion and remember the user"""
email = verify_login(request)
request.response.headers.extend(remember(request, email))
return {'redirect': request.POST.get('came_from', '/'), 'success': True} | 0.003846 |
def log_url (self, url_data):
"""Write csv formatted url check info."""
row = []
if self.has_part("urlname"):
row.append(url_data.base_url)
if self.has_part("parentname"):
row.append(url_data.parent_url)
if self.has_part("baseref"):
row.append(... | 0.001948 |
def get_qualifier_id(self):
"""Gets the ``Qualifier Id`` for this authorization.
return: (osid.id.Id) - the qualifier ``Id``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.Activity.get_objective_id
if not bo... | 0.004386 |
def _should_sign_response_header(header_name):
"""
:type header_name: str
:rtype: bool
"""
if header_name == _HEADER_SERVER_SIGNATURE:
return False
if re.match(_PATTERN_HEADER_PREFIX_BUNQ, header_name):
return True
return False | 0.003636 |
def from_string(cls, value):
"""Return single instance parsed from given accept header string."""
match = cls.pattern.search(value)
if match is None:
raise ValueError('"%s" is not a valid media type' % value)
try:
return cls(match.group('mime_type'), float(match.g... | 0.007538 |
async def run_with_interrupt(task, *events, loop=None):
"""
Awaits a task while allowing it to be interrupted by one or more
`asyncio.Event`s.
If the task finishes without the events becoming set, the results of the
task will be returned. If the event become set, the task will be cancelled
``N... | 0.000845 |
def wait_for_instance(
vm_=None,
data=None,
ip_address=None,
display_ssh_output=True,
call=None,
):
'''
Wait for an instance upon creation from the EC2 API, to become available
'''
if call == 'function':
# Technically this function may be called other ... | 0.001374 |
def remove_group_from_favorites(self, id):
"""
Remove group from favorites.
Remove a group from the current user's favorites.
"""
path = {}
data = {}
params = {}
# REQUIRED - PATH - id
"""the ID or SIS ID of the group to remove"""
... | 0.006051 |
def name():
"Get/view the name for the well known ID of a Projection"
if self.wkid in projected:
return projected[self.wkid]
elif self.wkid in geographic:
return geographic[self.wkid]
else:
raise KeyError("Not a known WKID.") | 0.006826 |
def get_chain(self, use_login=False, use_fork=False):
"""
Return the :class:`mitogen.parent.CallChain` to use for executing
function calls.
:param bool use_login:
If :data:`True`, always return the chain for the login account
rather than any active become user.
... | 0.002488 |
def handle_single_request(self, request_object):
"""
Handles a single request object and returns the correct result as follows:
- A valid response object if it is a regular request (with ID)
- ``None`` if it was a notification (if None is returned, a response object with
"rece... | 0.003164 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.