text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
url,
with_grains=False):
'''
Read pillar data from HTTP response.
:param str url: Url to request.
:param bool with_grains: Whether to substitute strings in the url with their grain values.
:retu... | 0.002831 |
def get_template_namespace(self) -> Dict[str, Any]:
"""Returns a dictionary to be used as the default template namespace.
May be overridden by subclasses to add or modify values.
The results of this method will be combined with additional
defaults in the `tornado.template` module and k... | 0.002413 |
def unpack(self, buff, offset=0):
"""Unpack a binary struct into this object's attributes.
Return the values instead of the lib's basic types.
After unpacking, the abscence of a `tpid` value causes the assignment
of None to the field values to indicate that there is no VLAN
inf... | 0.002114 |
def _error(self, request, status, headers={}, prefix_template_path=False, **kwargs):
"""
Convenience method to render an error response. The template is inferred from the status code.
:param request: A django.http.HttpRequest instance.
:param status: An integer describing the HTTP statu... | 0.018981 |
def optional_args(proxy=None):
'''
Return the connection optional args.
.. note::
Sensible data will not be returned.
.. versionadded:: 2017.7.0
CLI Example - select all devices connecting via port 1234:
.. code-block:: bash
salt -G 'optional_args:port:1234' test.ping
... | 0.001527 |
def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | 0.004396 |
def add_callback(self, instance, func, echo_old=False, priority=0):
"""
Add a callback to a specific instance that manages this property
Parameters
----------
instance
The instance to add the callback to
func : func
The callback function to add
... | 0.004975 |
def count_missing(self, data, output="number"):
""" ???
Parameters
----------
data : pd.DataFrame()
Input dataframe.
output : str
Sting indicating the output of function (number or percent)
Returns
-------
int/float
... | 0.006791 |
def get_neurommsig_score(graph: BELGraph,
genes: List[Gene],
ora_weight: Optional[float] = None,
hub_weight: Optional[float] = None,
top_percent: Optional[float] = None,
topology_weight: Optional... | 0.003123 |
def float_range(string, minimum, maximum, inf, sup):
""" Requires values to be a number and range in a certain range.
:param string: Value to validate
:param minimum: Minimum value to accept
:param maximum: Maximum value to accept
:param inf: Infimum value to accept
:param sup: Supremum value t... | 0.001949 |
def new(self, inlineparent = None):
'''
Compatible to Parser.new()
'''
v = list(range(0, self.size))
for i in range(0, self.size):
v[i] = self.innerparser.new()
return v | 0.017467 |
def consolidate_args(args):
"""There are many argument fields related to configuring plugins.
This function consolidates all of them, and saves the consolidated
information in args.plugins.
Note that we're deferring initialization of those plugins, because
plugins may have vario... | 0.000986 |
def check_units(self, ds):
'''
Check the units attribute for all variables to ensure they are CF
compliant under CF §3.1
CF §3.1 The units attribute is required for all variables that represent dimensional quantities
(except for boundary variables defined in Section 7.1, "Cell B... | 0.003635 |
def _shape(self):
""" Returns the shape of the data array associated with this file."""
hdu = self.open()
_shape = hdu.shape
if not self.inmemory:
self.close()
del hdu
return _shape | 0.008163 |
def get_extension(filepath, check_if_exists=False, allowed_exts=ALLOWED_EXTS):
"""Return the extension of fpath.
Parameters
----------
fpath: string
File name or path
check_if_exists: bool
allowed_exts: dict
Dictionary of strings, where the key if the last part of a complex ('.' separ... | 0.003421 |
def getLabelByName(self, name):
"""Gets a label widget by it component name
:param name: name of the AbstractStimulusComponent which this label is named after
:type name: str
:returns: :class:`DragLabel<sparkle.gui.drag_label.DragLabel>`
"""
name = name.lower()
i... | 0.007059 |
def prepare_patchset(project, patchset, binaries, ips, urls):
""" Create black/white lists and default / project waivers
and iterates over patchset file """
# Get Various Lists / Project Waivers
lists = get_lists.GetLists()
# Get file name black list and project waivers
file_audit_list, fil... | 0.002358 |
def enforce_git_config(self):
'''
For the config options which need to be maintained in the git config,
ensure that the git config file is configured as desired.
'''
git_config = os.path.join(self.gitdir, 'config')
conf = salt.utils.configparser.GitConfigParser()
... | 0.000793 |
def commutes(
m1: np.ndarray,
m2: np.ndarray,
*,
rtol: float = 1e-5,
atol: float = 1e-8) -> bool:
"""Determines if two matrices approximately commute.
Two matrices A and B commute if they are square and have the same size and
AB = BA.
Args:
m1: One of th... | 0.001285 |
def _file_path(self, uid):
"""Create and return full file path for DayOne entry"""
file_name = '%s.doentry' % (uid)
return os.path.join(self.dayone_journal_path, file_name) | 0.010204 |
def create_event(options, config, credentials):
"""
Create event in calendar with sms reminder.
"""
try:
http = credentials.authorize(httplib2.Http())
service = build("calendar", "v3", http=http)
event = {
"summary": options.message,
"location": "",
... | 0.003185 |
def __process_requests_stack(self):
"""
Process the requests stack.
"""
while self.__requests_stack:
try:
exec self.__requests_stack.popleft() in self.__locals
except Exception as error:
umbra.exceptions.notify_exception_handler(er... | 0.006173 |
def len(self,resolution=1.0,units=None,conversion_function=convert_time, end_at_end=True):
"""
Calculates the length of the Label Dimension from its minimum, maximum and wether it is discrete.
`resolution`:
`units`: output units
`conversion_function`:
... | 0.015081 |
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'dialog_nodes') and self.dialog_nodes is not None:
_dict['dialog_nodes'] = [x._to_dict() for x in self.dialog_nodes]
if hasattr(self, 'pagination') and self.pagination is n... | 0.004878 |
def connect(self):
"""
Establish a connection to APNs. If already connected, the function does nothing. If the
connection fails, the function retries up to MAX_CONNECTION_RETRIES times.
"""
retries = 0
while retries < MAX_CONNECTION_RETRIES:
try:
... | 0.007605 |
def read(self, amt=None, decode_content=None, cache_content=False):
"""
Similar to :meth:`httplib.HTTPResponse.read`, but with two additional
parameters: ``decode_content`` and ``cache_content``.
:param amt:
How much of the content to read. If specified, caching is skipped
... | 0.003008 |
def lookup_color(color):
"""
Returns the hex color for any valid css color name
>>> lookup_color('aliceblue')
'F0F8FF'
"""
if color is None: return
color = color.lower()
if color in COLOR_MAP:
return COLOR_MAP[color]
return color | 0.010791 |
def _write_color_colorama (fp, text, color):
"""Colorize text with given color."""
foreground, background, style = get_win_color(color)
colorama.set_console(foreground=foreground, background=background,
style=style)
fp.write(text)
colorama.reset_console() | 0.010676 |
def init_autoreload(mode: int) -> None:
"""Load and initialize the IPython autoreload extension."""
from IPython.extensions import autoreload
ip = get_ipython() # type: ignore # noqa: F821
autoreload.load_ipython_extension(ip)
ip.magics_manager.magics["line"]["autoreload"](str(... | 0.006135 |
def add_nodes(self, nodes, nesting=1):
"""
Adds nodes and edges for generating the graph showing the relationship
between modules and submodules listed in nodes.
"""
hopNodes = set() # nodes in this hop
hopEdges = [] # edges in this hop
# get nodes and edges ... | 0.001864 |
def _memoize_cache_key(args, kwargs):
"""Turn args tuple and kwargs dictionary into a hashable key.
Expects that all arguments to a memoized function are either hashable
or can be uniquely identified from type(arg) and repr(arg).
"""
cache_key_list = []
# hack to get around the unhashability o... | 0.001357 |
def optimize(self, n_iter, inplace=False, propagate_exception=False,
**gradient_descent_params):
"""Run optmization on the embedding for a given number of steps.
Parameters
----------
n_iter: int
The number of optimization iterations.
learning_rate:... | 0.001847 |
def create_index(self, cls_or_collection,
params=None, fields=None, ephemeral=False, unique=False):
"""Create new index on the given collection/class with given parameters.
:param cls_or_collection:
The name of the collection or the class for which to create an
... | 0.002343 |
def add_artifact_file(self, filename, keep_original=False):
"""
Add file to be stored as result artifact on post-process phase
"""
if filename:
logger.debug(
"Adding artifact file to collect (keep=%s): %s", keep_original,
filename)
... | 0.005479 |
def BuildStats(self):
"""Builds the statistics."""
artifact_reader = reader.YamlArtifactsReader()
self.label_counts = {}
self.os_counts = {}
self.path_count = 0
self.reg_key_count = 0
self.source_type_counts = {}
self.total_count = 0
for artifact_definition in artifact_reader.ReadDi... | 0.006065 |
def set_wd_noise(self, wd_noise):
"""Add White Dwarf Background Noise
This adds the White Dwarf (WD) Background noise. This can either do calculations with,
without, or with and without WD noise.
Args:
wd_noise (bool or str, optional): Add or remove WD background noise. Fir... | 0.005089 |
def get_publication_list(context, list, template='publications/publications.html'):
"""
Get a publication list.
"""
list = List.objects.filter(list__iexact=list)
if not list:
return ''
list = list[0]
publications = list.publication_set.all()
publications = publications.order_by('-year', '-month', '-id')
... | 0.033203 |
def _visit_step(
self,
number,
step_config,
visited_steps=None,
parent_options=None,
parent_ui_options=None,
from_flow=None,
):
"""
for each step (as defined in the flow YAML), _visit_step is called with only
the first two parameters. t... | 0.00381 |
def normalized_distance(self, image):
"""Calculates the distance of a given image to the
original image.
Parameters
----------
image : `numpy.ndarray`
The image that should be compared to the original image.
Returns
-------
:class:`Distance`
... | 0.003717 |
def rotated(self, angle_degrees_ccw):
"""Concatenates a rotation matrix on this matrix"""
angle = angle_degrees_ccw / 180.0 * pi
c, s = cos(angle), sin(angle)
return self @ PdfMatrix((c, s, -s, c, 0, 0)) | 0.008511 |
def mapping_matrix_from_sub_to_pix(sub_to_pix, pixels, regular_pixels, sub_to_regular, sub_grid_fraction):
"""Computes the mapping matrix, by iterating over the known mappings between the sub-grid and pixelization.
Parameters
-----------
sub_to_pix : ndarray
The mappings between the observed re... | 0.006931 |
def Theissing(m, x, rhol, rhog, mul, mug, D, roughness=0, L=1):
r'''Calculates two-phase pressure drop with the Theissing (1980)
correlation as shown in [2]_ and [3]_.
.. math::
\Delta P_{{tp}} = \left[ {\Delta P_{{lo}}^{{1/{n\epsilon}}} \left({1 -
x} \right)^{{1/\epsilon}} + \Delta P_{{go}... | 0.000248 |
def set_access_control(self, mode, onerror = None):
"""Enable use of access control lists at connection setup if mode
is X.EnableAccess, disable if it is X.DisableAccess."""
request.SetAccessControl(display = self.display,
onerror = onerror,
... | 0.02907 |
def modifyPdpContextAccept():
"""MODIFY PDP CONTEXT ACCEPT Section 9.5.7"""
a = TpPd(pd=0x8)
b = MessageType(mesType=0x45) # 01000101
packet = a / b
return packet | 0.005464 |
def extend_instance(instance, *bases, **kwargs):
"""
Apply subclass (mixin) to a class object or its instance
By default, the mixin is placed at the start of bases
to ensure its called first as per MRO. If you wish to
have it injected last, which is useful for monkeypatching,
then you can speci... | 0.000822 |
def analyze(self, filename):
"""Reimplement analyze method"""
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
self.dockwidget.setFocus()
self.dockwidget.raise_()
self.pylint.analyze(filename) | 0.006969 |
def action_inactivate(self, ids):
"""Inactivate users."""
try:
count = 0
for user_id in ids:
user = _datastore.get_user(user_id)
if user is None:
raise ValueError(_("Cannot find user."))
if _datastore.deactivate_... | 0.002762 |
def tags_in_string(msg):
"""
Return the set of tags in a message string.
Tags includes HTML tags, data placeholders, etc.
Skips tags that might change due to translations: HTML entities, <abbr>,
and so on.
"""
def is_linguistic_tag(tag):
"""Is this tag one that can change with the... | 0.001647 |
def parse(self, filepath, content):
"""
Parse opened settings content using YAML parser.
Args:
filepath (str): Settings object, depends from backend
content (str): Settings content from opened file, depends from
backend.
Raises:
bouss... | 0.002618 |
def get(self, keyword):
"""Return the element of the list after the given keyword.
Parameters
----------
keyword : str
The keyword parameter to find in the list.
Putting a colon before the keyword is optional, if no colon is
given, it is added automat... | 0.001967 |
def run_dssp(pdb, path=True):
"""Uses DSSP to find helices and extracts helices from a pdb file or string.
Parameters
----------
pdb : str
Path to pdb file or string.
path : bool, optional
Indicates if pdb is a path or a string.
Returns
-------
dssp_out : str
Std... | 0.002604 |
def insertRnaQuantificationSet(self, rnaQuantificationSet):
"""
Inserts a the specified rnaQuantificationSet into this repository.
"""
try:
models.Rnaquantificationset.create(
id=rnaQuantificationSet.getId(),
datasetid=rnaQuantificationSet.getP... | 0.002445 |
def _at_dump_options(self, calculator, rule, scope, block):
"""
Implements @dump_options
"""
sys.stderr.write("%s\n" % repr(rule.options)) | 0.011765 |
def save_vocabulary(self, vocab_path):
"""Save the tokenizer vocabulary to a directory or file."""
index = 0
if os.path.isdir(vocab_path):
vocab_file = os.path.join(vocab_path, VOCAB_NAME)
with open(vocab_file, "w", encoding="utf-8") as writer:
for token, token_in... | 0.006536 |
def update_optimiser(context, *args, **kwargs) -> None:
"""
Writes optimiser state into corresponding TensorFlow variables. This may need to be done
for optimisers like ScipyOptimiser that work with their own copies of the variables.
Normally the source variables would be updated only when the optimiser... | 0.007407 |
def is_model_name_lookup(self, base):
"""
Return True if class is defined as the respective model name lookup declaration
"""
return (
isinstance(base, ast.Name) and
base.id == self.model_name_lookup
) | 0.011321 |
def canonical_transcripts(gtf, out_file):
"""
given a GTF file, produce a new GTF file with only the longest transcript
for each gene
function lifted from:
https://pythonhosted.org/gffutils/_modules/gffutils/helpers.html
"""
if file_exists(out_file):
return out_file
db = get_gtf_... | 0.000668 |
def parse_names(lstfile):
"""
This is the alternative format `lstfile`. In this format, there are two
sections, starting with [Sequence] and [Manuscript], respectively, then
followed by authors separated by comma.
"""
from jcvi.formats.base import read_block
fp = open(lstfile)
all_autho... | 0.002708 |
def remove_objects_not_in(self, objects_to_keep, verbosity):
"""
Delete all the objects in the database that are not in objects_to_keep.
- objects_to_keep: A map where the keys are classes, and the values are a
set of the objects of that class we should keep.
"""
for cla... | 0.002429 |
def _compute_errors(self):
"""
Compute parameter errors based on the diagonal of the covariance
matrix of the four harmonic coefficients for harmonics n=1 and
n=2.
"""
try:
coeffs = fit_first_and_second_harmonics(self.sample.values[0],
... | 0.0011 |
def read_atoms(fn, cycfn=None, pos_only=False, conv=1.0):
"""
Read atom information from an atoms.dat file (i.e., tblmd, MDCORE input file)
"""
f = paropen(fn, "r")
l = f.readline().lstrip()
while len(l) > 0 and ( l[0] == '#' or l[0] == '<' ):
l = f.readline().lstrip()
n_atoms = in... | 0.022481 |
def _fetch_itemslist(self, current_item):
""" Get a all available apis
"""
if current_item.is_root:
html = requests.get(self.base_url).text
soup = BeautifulSoup(html, 'html.parser')
for item_html in soup.select(".row .col-md-6"):
try:
... | 0.003812 |
def add_colorbar(self, **kwargs):
"""Draw a colorbar
"""
kwargs = kwargs.copy()
if self._cmap_extend is not None:
kwargs.setdefault('extend', self._cmap_extend)
if 'label' not in kwargs:
kwargs.setdefault('label', label_from_attrs(self.data))
self.... | 0.004032 |
def get_primary_keys(conn, table: str, schema='public'):
"""Returns primary key columns for a specific table."""
query = """\
SELECT
c.constraint_name AS pkey_constraint_name,
c.column_name AS column_name
FROM
information_schema.key_column_usage AS c
JOIN information_schema.table_constraints AS t
... | 0.001404 |
def render_stats(stats, sort, format):
"""
Returns a StringIO containing the formatted statistics from _statsfile_.
_sort_ is a list of fields to sort by.
_format_ is the name of the method that pstats uses to format the data.
"""
output = StdoutWrapper()
if hasattr(stats, "stream"):
... | 0.002315 |
def reject_sv(m, s, y):
""" Sample from N(m, s^2) times SV likelihood using rejection.
SV likelihood (in x) corresponds to y ~ N(0, exp(x)).
"""
mp = m + 0.5 * s**2 * (-1. + y**2 * np.exp(-m))
ntries = 0
while True:
ntries += 1
x = stats.norm.rvs(loc=mp, scale=s)
u = st... | 0.003552 |
def telnet_login(
self,
pri_prompt_terminator=r"#\s*$",
alt_prompt_terminator=r">\s*$",
username_pattern=r"(?:user:|username|login|user name)",
pwd_pattern=r"assword",
delay_factor=1,
max_loops=20,
):
"""Telnet login. Can be username/password or just p... | 0.002179 |
def _set_unfinished_dag_runs_to_failed(self, dag_runs, session=None):
"""
Go through the dag_runs and update the state based on the task_instance state.
Then set DAG runs that are not finished to failed.
:param dag_runs: DAG runs
:param session: session
:return: None
... | 0.005629 |
def get_number_of_messages_in_topics(self, topics):
"""Retrun number of messages in topics.
- ``topics`` (list): list of topics.
"""
if not isinstance(topics, list):
topics = [topics]
number_of_messages = 0
for t in topics:
part = self.g... | 0.008803 |
def open_file(self, filename):
"""Open the file with filename"""
try:
if filename.endswith('.gz'):
self.blob_file = gzip.open(filename, 'rb')
else:
self.blob_file = open(filename, 'rb')
except TypeError:
log.error("Please specif... | 0.004193 |
def persistent_identifiers2marc(self, key, value):
"""Populate the ``0247`` MARC field."""
return {
'2': value.get('schema'),
'9': value.get('source'),
'a': value.get('value'),
'q': value.get('material'),
} | 0.004 |
def evict(self, urls):
"""Evict url(s) from the cache.
:param urls: An iterable containing normalized urls.
:returns: The number of items removed from the cache.
"""
if isinstance(urls, six.string_types):
urls = (urls,)
return self.handler.evict(urls) | 0.00639 |
def flag(self, payload):
"""Set a single flag on a resource.
:param payload:
t: can be one of make_public, make_private, make_shareable,
make_not_shareable, make_discoverable, make_not_discoverable
:return:
empty but with 202 status_code
"""
... | 0.005464 |
def list_all_discount_coupons(cls, **kwargs):
"""List DiscountCoupons
Return a list of DiscountCoupons
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_all_discount_coupons(async=True)
... | 0.002205 |
def _shutil_which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""Given a command, mode, and a PATH string, return the path which conforms
to the given mode on the PATH, or None if there is no such file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
of os.environ.get("PATH"), or can b... | 0.001289 |
def auto_docstr(modname, funcname, verbose=True, moddir=None, modpath=None, **kwargs):
r"""
called from vim. Uses strings of filename and modnames to build docstr
Args:
modname (str): name of a python module
funcname (str): name of a function in the module
Returns:
str: docstr
... | 0.003733 |
def mock_attr(self, *args, **kwargs):
"""
Empty method to call to slurp up args and kwargs.
`args` get pushed onto the url path.
`kwargs` are converted to a query string and appended to the URL.
"""
self.path.extend(args)
self.qs.update(kwargs)
return sel... | 0.006231 |
def _do_cron():
"""Handles the cron request to github to check for new pull requests. If
any are found, they are run *sequentially* until they are all completed.
"""
if not args["cron"]:
return
if ("enabled" in db and not db["enabled"]) or "enabled" not in db:
warn("The CI serve... | 0.006631 |
def all_selectors(Class, fn):
"""return a sorted list of selectors that occur in the stylesheet"""
selectors = []
cssparser = cssutils.CSSParser(validate=False)
css = cssparser.parseFile(fn)
for rule in [r for r in css.cssRules if type(r)==cssutils.css.CSSStyleRule]:
... | 0.008658 |
def _diff_graph(self):
'''
Uses rdflib.compare diff, https://github.com/RDFLib/rdflib/blob/master/rdflib/compare.py
When a resource is retrieved, the graph retrieved and parsed at that time is saved to self.rdf._orig_graph,
and all local modifications are made to self.rdf.graph. This method compares the two g... | 0.028515 |
def applyFunction(self, func):
"""
Applies a function to the dataFrame with appropriate signals.
The function must return a dataframe.
:param func: A function (or partial function) that accepts a dataframe as the first argument.
:return: None
:raise:
Assertion... | 0.004813 |
def decodeBinaryData(binaryData, arrayLength, bitEncoding, compression):
"""Function to decode a mzML byte array into a numpy array. This is the
inverse function of :func:`encodeBinaryData`. Concept inherited from
:func:`pymzml.spec.Spectrum._decode` of the python library `pymzML
<https://pymzml.github.... | 0.001587 |
def start_of_new_markdown_cell(self, line):
"""Does this line starts a new markdown cell?
Then, return the cell marker"""
for empty_markdown_cell in ['""', "''"]:
if line == empty_markdown_cell:
return empty_markdown_cell
for triple_quote in ['"""', "'''"]:
... | 0.004107 |
def device(self, device_id, *args, **kwargs):
"""
Return a Device object based on id
:param device_id: id of device
:type device_id: int
:param args: extra parameters
:param kwargs: extra parameters
:returns: Device object
:rtype: Device
"""
... | 0.007389 |
def transform(self, blocks, y=None):
"""
Transform an ordered sequence of blocks into a 2D features matrix with
shape (num blocks, num features) and standardized feature values.
Args:
blocks (List[Block]): as output by :class:`Blockifier.blockify`
y (None): This ... | 0.00292 |
def get_shares_list(self, **kwargs):
"""
Gets *all* shares.
Input:
* ``skip`` the number of shares to skip (optional)
* ``limit`` the maximum number of shares to return (optional)
Output:
* a list of :py:mod:`pygett.shares.GettShare` objects
... | 0.00319 |
def handle_status(self):
"""Handle status from device"""
status = self.get_status()
if status:
# Update main-zone
self.zones['main'].update_status(status) | 0.009852 |
def toLily(self):
'''
Method which converts the object instance, its attributes and children to a string of lilypond code
:return: str of lilypond code
'''
lilystring = ""
left_barline = self.GetBarline("left")
other_lefts = self.GetBarline("left-1")
if o... | 0.001533 |
def _validate_header(self, hed):
"""
Validate the list that represents the table header.
:param hed: The list that represents the table header.
:type hed: list(list(hatemile.util.html.htmldomelement.HTMLDOMElement))
:return: True if the table header is valid or False if the tabl... | 0.002717 |
def _get_fieldcodes(skw_matches, ckw_matches, spires=False):
"""Return the output for the field codes.
:var skw_matches: dict of {keyword: [info,...]}
:var ckw_matches: dict of {keyword: [info,...]}
:keyword spires: bool, to get the spires output
:return: list of tuples with (fieldcodes, keywords)
... | 0.000804 |
def read_from(self, data, pad=0):
"""
Returns a generator with the elements "data" taken by offset, restricted
by self.begin and self.end, and padded on either end by `pad` to get
back to the original length of `data`
"""
for i in range(self.BEGIN, self.END + 1):
... | 0.007282 |
def chat_update(self, chat_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/chats#update-chat"
api_path = "/api/v2/chats/{chat_id}"
api_path = api_path.format(chat_id=chat_id)
return self.call(api_path, method="PUT", data=data, **kwargs) | 0.006873 |
def build_options(self):
"""The package build options.
:returns: :func:`set` of build options strings.
"""
if self.version.build_metadata:
return set(self.version.build_metadata.split('.'))
else:
return set() | 0.007299 |
def select(query, ts, mode='list', cast=True):
"""
Perform the TSQL selection query *query* on testsuite *ts*.
Note: The `select`/`retrieve` part of the query is not included.
Args:
query (str): TSQL select query
ts (:class:`delphin.itsdb.TestSuite`): testsuite to query over
mo... | 0.001096 |
def store(self, o, id=None): #pylint:disable=redefined-builtin
"""
Stores an object and returns its ID.
:param o: the object
:param id: an ID to use
"""
actual_id = id or self._get_persistent_id(o) or "TMP-"+str(uuid.uuid4())
l.debug("STORE: %s %s", o, actual_id... | 0.006485 |
def pre_signature_part(ident, public_key=None, identifier=None, digest_alg=None, sign_alg=None):
"""
If an assertion is to be signed the signature part has to be preset
with which algorithms to be used, this function returns such a
preset part.
:param ident: The identifier of the assertion, so you ... | 0.001099 |
def subdir_findall(dir, subdir):
"""
Find all files in a subdirectory and return paths relative to dir
This is similar to (and uses) setuptools.findall
However, the paths returned are in the form needed for package_data
"""
strip_n = len(dir.split('/'))
path = '/'.join((dir, subdir))
re... | 0.002545 |
def display(self):
"Renders the scene once every refresh"
self.compositor.waitGetPoses(self.poses, openvr.k_unMaxTrackedDeviceCount, None, 0)
hmd_pose0 = self.poses[openvr.k_unTrackedDeviceIndex_Hmd]
if not hmd_pose0.bPoseIsValid:
return
# hmd_pose = hmd_pose0.m... | 0.005566 |
def drilldown(self, attributes, path):
""" Recursively descends the tree/forest (starting from each root node)
in order to find a :class:`CTENode` which corresponds to the given
`path`. The path is expected to be an iterable of tuples, called
path components, consisting of at... | 0.002969 |
def nearest_point(query, root_id, get_properties, dist_fun=euclidean_dist):
"""Find the point in the tree that minimizes the distance to the query.
This method implements the nearest_point query for any structure
implementing a kd-tree. The only requirement is a function capable to
extract the relevant... | 0.000338 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.