text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def create_session(self, **params):
"""
Create the session
date format: YYYY-MM-DDThh:mm
location: ISO code
"""
required_keys = ('market', 'currency', 'locale', 'pickupplace',
'dropoffplace', 'pickupdatetime', 'dropoffdatetime',
... | 0.002217 |
def to_html(graph: BELGraph, chart: Optional[str] = None) -> str:
"""Render the graph as an HTML string.
Common usage may involve writing to a file like:
>>> from pybel.examples import sialic_acid_graph
>>> with open('ideogram_output.html', 'w') as file:
... print(to_html(sialic_acid_graph), f... | 0.001965 |
def get_visible_elements(self, locator, params=None, timeout=None):
"""
Get elements both present AND visible in the DOM.
If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise
TimeoutException should the element not be found.
:p... | 0.006568 |
def _longest_common_subsequence(x, y):
"""
Return the longest common subsequence between two sequences.
Parameters
----------
x, y : sequence
Returns
-------
sequence
Longest common subsequence of x and y.
Examples
--------
>>> _longest_common_subsequence("AGGTAB",... | 0.000668 |
def _check_for_answers(self, pk):
"""
Callback called for every packet received to check if we are
waiting for an answer on this port. If so, then cancel the retry
timer.
"""
longest_match = ()
if len(self._answer_patterns) > 0:
data = (pk.header,) + t... | 0.002139 |
def _store(self, lines, buffer=None, store='source'):
"""Store one or more lines of input.
If input lines are not newline-terminated, a newline is automatically
appended."""
if buffer is None:
buffer = self._buffer
if lines.endswith('\n'):
... | 0.008811 |
def GetNumberOfRows(self, table_name):
"""Retrieves the number of rows in the table.
Args:
table_name (str): name of the table.
Returns:
int: number of rows.
Raises:
IOError: if the file-like object has not been opened.
OSError: if the file-like object has not been opened.
... | 0.005035 |
def env(key, default):
"""
Helper to try to get a setting from the environment, or pyconfig, or
finally use a provided default.
"""
value = os.environ.get(key, None)
if value is not None:
log.info(' %s = %r', key.lower().replace('_', '.'), value)
return value
key = key.l... | 0.002315 |
def get_task(client, task_id):
''' Gets task information for the given ID '''
endpoint = '/'.join([client.api.Endpoints.TASKS, str(task_id)])
response = client.authenticated_request(endpoint)
return response.json() | 0.004348 |
def Gamma(theta: vertex_constructor_param_types, k: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex:
"""
One to one constructor for mapping some shape of theta and k to matching shaped gamma.
:param theta: the theta (scale) of the Gamma with either the same shape as specified for t... | 0.016423 |
def complex_exists(self, complex: str) -> bool:
"""
Shortcut to check if complex exists in our database.
"""
try:
self.check_complex(complex)
except exceptions.RumetrComplexNotFound:
return False
return True | 0.007143 |
def sub(self):
'''
:param fields:
Set fields to substitute
:returns:
Substituted Template with given fields.
If no fields were set up beforehand, :func:`raw` is used.
'''
if self.__fields:
return _Template(self.raw).substitute(self... | 0.00565 |
def reverse_id(self):
"""Generate the id of reverse_variable from the reaction's id."""
return '_'.join((self.id, 'reverse',
hashlib.md5(
self.id.encode('utf-8')).hexdigest()[0:5])) | 0.007968 |
def set_itunes_explicit(self):
"""Parses explicit from itunes tags and sets value"""
try:
self.itunes_explicit = self.soup.find('itunes:explicit').string
self.itunes_explicit = self.itunes_explicit.lower()
except AttributeError:
self.itunes_explicit = None | 0.006329 |
def follower_num(self):
"""获取追随者数量,就是关注此人的人数.
:return: 追随者数量
:rtype: int
"""
if self.url is None:
return 0
else:
number = int(self.soup.find(
'div', class_='zm-profile-side-following zg-clear').find_all(
'a')[1].str... | 0.005634 |
def ingest(self, co, classname=None, code_objects={}, show_asm=None):
"""
Pick out tokens from an uncompyle6 code object, and transform them,
returning a list of uncompyle6 Token's.
The transformations are made to assist the deparsing grammar.
Specificially:
- variou... | 0.005529 |
def after_connect(self):
"""Execute after connect."""
# TODO: check if this works.
show_users = self.device.send("show users", timeout=120)
result = re.search(pattern_manager.pattern(self.platform, 'connected_locally'), show_users)
if result:
self.log('Locally connect... | 0.007009 |
def kill_dashboard(self, check_alive=True):
"""Kill the dashboard.
Args:
check_alive (bool): Raise an exception if the process was already
dead.
"""
self._kill_process_type(
ray_constants.PROCESS_TYPE_DASHBOARD, check_alive=check_alive) | 0.006472 |
def types(self):
"""
Tuple containing types transformed by this transformer.
"""
out = []
if self._transform_bytes:
out.append(bytes)
if self._transform_str:
out.append(str)
return tuple(out) | 0.00738 |
def satisfies(guard):
"""Returns the current token if it satisfies the guard function provided.
Fails otherwise.
This is the a generalisation of one_of.
"""
i = peek()
if (i is EndOfFile) or (not guard(i)):
fail(["<satisfies predicate " + _fun_to_str(guard) + ">"])
next()
re... | 0.006135 |
def sql(self, stmt, parameters=None, bulk_parameters=None):
"""
Execute SQL stmt against the crate server.
"""
if stmt is None:
return None
data = _create_sql_payload(stmt, parameters, bulk_parameters)
logger.debug(
'Sending request to %s with pay... | 0.003937 |
def on_demand_annotation(twitter_app_key, twitter_app_secret, user_twitter_id):
"""
A service that leverages twitter lists for on-demand annotation of popular users.
TODO: Do this.
"""
##################################################################################################################... | 0.006887 |
def form_uri(item_content, item_class):
"""Form the URI for a music service element.
:param item_content: The content dict of the item
:type item_content: dict
:param item_class: The class of the item
:type item_class: Sub-class of
:py:class:`soco.data_structures.Mus... | 0.003221 |
def qax(mt, x, q, m=1):
""" geometrica """
q = float(q)
j = (mt.i - q) / (1 + q)
mtj = Actuarial(nt=mt.nt, i=j)
return ax(mtj, x, m) | 0.006579 |
def prepare(query, params):
"""
For every match of the form ":param_name", call marshal
on kwargs['param_name'] and replace that section of the query
with the result
"""
def repl(match):
name = match.group(1)[1:]
if name in params:
return marshal(params[name])
... | 0.001805 |
def encrypt(self, key=None, iv="", cek="", **kwargs):
"""
Produces a JWE as defined in RFC7516 using an Elliptic curve key
:param key: *Not used>, only there to present the same API as
JWE_RSA and JWE_SYM
:param iv: Initialization vector
:param cek: Content master ke... | 0.001618 |
def getFingerprintsForExpressions(self, body, sparsity=1.0):
"""Bulk resolution of expressions
Args:
body, ExpressionOperation: The JSON encoded expression to be evaluated (required)
sparsity, float: Sparsify the resulting expression to this percentage (optional)
Returns:... | 0.009398 |
def get_primary_key(self, table):
"""Retrieve the column which is the primary key for a table."""
for column in self.get_schema(table):
if len(column) > 3 and 'pri' in column[3].lower():
return column[0] | 0.008097 |
def initialize_acceptance_criteria(**kwargs):
'''
initialize acceptance criteria with NULL values for thellier_gui and demag_gui
acceptance criteria format is doctionaries:
acceptance_criteria={}
acceptance_criteria[crit]={}
acceptance_criteria[crit]['category']=
accept... | 0.001014 |
def add_query(self, sql, auto_begin=True, bindings=None,
abridge_sql_log=False):
"""Add a query to the current transaction. A thin wrapper around
ConnectionManager.add_query.
:param str sql: The SQL query to add
:param bool auto_begin: If set and there is no transactio... | 0.004298 |
def _read_dict(self, data_dict, layer=None, source=None):
"""Load a dictionary into the ConfigTree. If the dict contains nested dicts
then the values will be added recursively. See module docstring for example code.
Parameters
----------
data_dict : dict
source data
... | 0.008375 |
def check_bucket_exists(self, bucket: str) -> bool:
"""
Checks if bucket with specified name exists.
:param bucket: the bucket to be checked.
:return: true if specified bucket exists.
"""
bucket_obj = self.gcp_client.bucket(bucket) # type: Bucket
return bucket_ob... | 0.006061 |
def phonetic(s, method, concat=True, encoding='utf-8', decode_error='strict'):
"""Convert names or strings into phonetic codes.
The implemented algorithms are `soundex
<https://en.wikipedia.org/wiki/Soundex>`_, `nysiis
<https://en.wikipedia.org/wiki/New_York_State_Identification_and_
Intelligence_S... | 0.000513 |
def get_id_fields(self):
"""
Called to return a list of fields consisting of, at minimum,
the PK field name. The output of this method is used to
construct a Prefetch object with a .only() queryset
when this field is not being sideloaded but we need to
return a list of ID... | 0.001969 |
def _checkForOrphanedModels (self):
"""If there are any models that haven't been updated in a while, consider
them dead, and mark them as hidden in our resultsDB. We also change the
paramsHash and particleHash of orphaned models so that we can
re-generate that particle and/or model again if we desire.
... | 0.013603 |
def register_laser_hooks(self, hook_type: str, hook: Callable):
"""registers the hook with this Laser VM"""
if hook_type == "add_world_state":
self._add_world_state_hooks.append(hook)
elif hook_type == "execute_state":
self._execute_state_hooks.append(hook)
elif h... | 0.00361 |
def donotify(nick, rest):
"notify <nick> <message>"
opts = rest.split(' ')
to = opts[0]
Notify.store.notify(nick, to, ' '.join(opts[1:]))
return "Will do!" | 0.0375 |
def write_debug_log(self, file_path):
""" Write the debug log to a file """
with open(file_path, "wb+") as fh:
fh.write(system.get_system_info().encode('utf-8'))
# writing to debug stream
self._debug_stream.seek(0)
fh.write(self._debug_stream.read().encode... | 0.003906 |
def upload_token(
self,
bucket,
key=None,
expires=3600,
policy=None,
strict_policy=True):
"""生成上传凭证
Args:
bucket: 上传的空间名
key: 上传的文件名,默认为空
expires: 上传凭证的过期时间,默认为3600s
policy: 上传策... | 0.002469 |
def _set_next_hop_mpls(self, v, load=False):
"""
Setter method for next_hop_mpls, mapped from YANG variable /routing_system/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/next_hop_mpls (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_next_hop_m... | 0.005701 |
def get_wigner_seitz_cell(self) -> List[List[np.ndarray]]:
"""
Returns the Wigner-Seitz cell for the given lattice.
Returns:
A list of list of coordinates.
Each element in the list is a "facet" of the boundary of the
Wigner Seitz cell. For instance, a list of... | 0.003185 |
def write(self, valuedict):
"""Returns the lines that this template line should add to the input file."""
if self.identifier in valuedict:
value = valuedict[self.identifier]
elif self.default is not None:
value = self.default
elif self.fromtag is not None and self... | 0.007922 |
def chi_square_distance(point1, point2):
"""!
@brief Calculate Chi square distance between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}\frac{\left ( a_{i} - b_{i} \right )^{2}}{\left | a_{i} \right | + \left | b_{i} \right |};
\f]
@param[in] point1 (array_like): The first vector.
... | 0.008708 |
def read_detail(self, request):
"""
Implements the Read Detail (read an object)
maps to GET /api/objects/:id/ in rest semantics
:param request: rip.Request
:return: rip.Response
"""
pipeline = crud_pipeline_factory.read_detail_pipeline(
configuration=... | 0.005263 |
def collect_results(rule, max_results=500, result_stream_args=None):
"""
Utility function to quickly get a list of tweets from a ``ResultStream``
without keeping the object around. Requires your args to be configured
prior to using.
Args:
rule (str): valid powertrack rule for your account, ... | 0.000789 |
def _construct_permission(self, function, source_arn=None, source_account=None, suffix="", event_source_token=None):
"""Constructs the Lambda Permission resource allowing the source service to invoke the function this event
source triggers.
:returns: the permission resource
:rtype: mode... | 0.005106 |
def assessModel(self, target: str, prediction: str, nominal: bool = True, event: str = '', **kwargs):
"""
This method will calculate assessment measures using the SAS AA_Model_Eval Macro used for SAS Enterprise Miner.
Not all datasets can be assessed. This is designed for scored data that includ... | 0.003575 |
def sampling_query(sql, fields=None, count=5, sampling=None):
"""Returns a sampling query for the SQL object.
Args:
sql: the SQL object to sample
fields: an optional list of field names to retrieve.
count: an optional count of rows to retrieve which is used if a specific
sampling is... | 0.00339 |
def information_content(self):
"""Return the total information content of the motif.
Return
------
ic : float
Motif information content.
"""
ic = 0
for row in self.pwm:
ic += 2.0 + np.sum([row[x] * log(row[x])/log(2) for x in range(4) if r... | 0.008596 |
def canFetchMore(self, parentIndex):
""" Returns true if there is more data available for parent; otherwise returns false.
"""
parentItem = self.getItem(parentIndex)
if not parentItem:
return False
return parentItem.canFetchChildren() | 0.010453 |
def ints(l, ifilter=lambda x: x, idescr=None):
""" Parses a comma-separated list of ints. """
if isinstance(l, string_types):
if l[0] == '[' and l[-1] == ']':
l = l[1:-1]
l = list(map(lambda x: x.strip(), l.split(',')))
try:
l = list(map(ifilter, list(map(int, l))))
e... | 0.012959 |
def add_column(self, table, name='ID', data_type='int(11)', after_col=None, null=False, primary_key=False):
"""Add a column to an existing table."""
location = 'AFTER {0}'.format(after_col) if after_col else 'FIRST'
null_ = 'NULL' if null else 'NOT NULL'
comment = "COMMENT 'Column auto c... | 0.008838 |
def closest(xarr, val):
""" Return the index of the closest in xarr to value val """
idx_closest = np.argmin(np.abs(np.array(xarr) - val))
return idx_closest | 0.005917 |
def _find_usage_api_keys(self):
"""
Find usage on API Keys.
Update `self.limits`.
"""
logger.debug('Finding usage for API Keys')
key_count = 0
paginator = self.conn.get_paginator('get_api_keys')
for resp in paginator.paginate():
key_count += le... | 0.004274 |
def set_data_type(self, data_type):
"""Set the data type for ths data point
The data type is actually associated with the stream itself and should
not (generally) vary on a point-per-point basis. That being said, if
creating a new stream by writing a datapoint, it may be beneficial to
... | 0.004635 |
def get_keys(self, bucket, timeout=None):
"""
Lists all keys within a bucket.
"""
msg_code = riak.pb.messages.MSG_CODE_LIST_KEYS_REQ
codec = self._get_codec(msg_code)
stream = self.stream_keys(bucket, timeout=timeout)
return codec.decode_get_keys(stream) | 0.006452 |
def _find_weektime(datetime, time_type='min'):
"""
Finds the minutes/seconds aways from midnight between Sunday and Monday.
Parameters
----------
datetime : datetime
The date and time that needs to be converted.
time_type : 'min' or 'sec'
States whether the time difference shoul... | 0.005814 |
def get_ioos_def(self, ident, elem_type, ont):
"""Gets a definition given an identifier and where to search for it"""
if elem_type == "identifier":
getter_fn = self.system.get_identifiers_by_name
elif elem_type == "classifier":
getter_fn = self.system.get_classifiers_by_n... | 0.003788 |
def info(self, verbose=None, buf=None, max_cols=None, memory_usage=None,
null_counts=None):
"""
Print a concise summary of a DataFrame.
This method prints information about a DataFrame including
the index dtype and column dtypes, non-null values and memory usage.
P... | 0.000315 |
def show_window_option(self, option, g=False):
"""
Return a list of options for the window.
todo: test and return True/False for on/off string
Parameters
----------
option : str
g : bool, optional
Pass ``-g`` flag, global. Default False.
Ret... | 0.002016 |
def to_df(self):
'''Conversion method to Pandas DataFrame. To be attached to ResultDict.
Returns
-------
main_effect, inter_effect: tuple
A tuple of DataFrames for main effects and interaction effects.
The second element (for interactions) will be `None` if not available.
'''
na... | 0.001241 |
def _process_args(args, kwargs, prefer_local=True, recurse=True):
"""Select local or remote execution and prepare arguments accordingly.
Assumes any remote args have already been moved to a common engine.
Local execution will be chosen if:
- all args are ordinary objects or Remote instances on the loca... | 0.000861 |
def _all(cls, verb):
"""
A verb
"""
groups = set(_get_groups(verb))
return [col for col in verb.data if col not in groups] | 0.012346 |
def pipe(engine, format, data, renderer=None, formatter=None, quiet=False):
"""Return ``data`` piped through Graphviz ``engine`` into ``format``.
Args:
engine: The layout commmand used for rendering (``'dot'``, ``'neato'``, ...).
format: The output format used for rendering (``'pdf'``, ``'png'`... | 0.005838 |
def commandfactory(cmdline, mode='global'):
"""
parses `cmdline` and constructs a :class:`Command`.
:param cmdline: command line to interpret
:type cmdline: str
:param mode: mode identifier
:type mode: str
"""
# split commandname and parameters
if not cmdline:
return None
... | 0.000622 |
def to_unicode(text, charset=None):
"""Convert a `str` object to an `unicode` object.
If `charset` is given, we simply assume that encoding for the text,
but we'll use the "replace" mode so that the decoding will always
succeed.
If `charset` is ''not'' specified, we'll make some guesses, first
trying the UTF-8 e... | 0.022269 |
def is_username_valid(username):
"""
Check if a valid username.
valid:
oracle
bill-gates
steve.jobs
micro_soft
not valid
Bill Gates - no space allowed
me@yo.com - @ is not a valid character
:param username: string
:return:
"""
pattern = re.... | 0.002564 |
def on_select_mean_type_box(self, event):
"""
set parent Zeq_GUI to reflect change in this box and change the
@param: event -> the wx.ComboBoxEvent that triggered this function
"""
new_mean_type = self.mean_type_box.GetValue()
if new_mean_type == "None":
self.... | 0.004274 |
def getEmpTraitCovar(self):
"""
Returns the empirical trait covariance matrix
"""
if self.P==1:
out=self.Y[self.Iok].var()
else:
out=SP.cov(self.Y[self.Iok].T)
return out | 0.020661 |
def get_local_dist_packages_dir():
"""
Attempts to work around virtualenvs and find the system dist_pacakges.
Essentially this is implmenented as a lookuptable
"""
import utool as ut
if not ut.in_virtual_env():
# Non venv case
return get_site_packages_dir()
else:
cand... | 0.001664 |
def genes_by_alias(hgnc_genes):
"""Return a dictionary with hgnc symbols as keys
Value of the dictionaries are information about the hgnc ids for a symbol.
If the symbol is primary for a gene then 'true_id' will exist.
A list of hgnc ids that the symbol points to is in ids.
Args:
hgnc_gene... | 0.001559 |
def targets_format(self, value):
"""
Setter for **self.__targets_format** attribute.
:param value: Attribute value.
:type value: unicode
"""
if value is not None:
assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
... | 0.007843 |
def extract_code(obj, compile_mode):
"""
Generic function for converting objects into instances of `CodeType`.
"""
try:
code = obj.__code__
if isinstance(code, CodeType):
return code
raise ValueError(
"{obj} has a `__code__` attribute, "
"but i... | 0.001757 |
def _get_pooling_layers(self, start_node_id, end_node_id):
"""Given two node IDs, return all the pooling layers between them."""
layer_list = []
node_list = [start_node_id]
assert self._depth_first_search(end_node_id, layer_list, node_list)
ret = []
for layer_id in layer_... | 0.00354 |
def es_query_proto(path, selects, wheres, schema):
"""
RETURN TEMPLATE AND PATH-TO-FILTER AS A 2-TUPLE
:param path: THE NESTED PATH (NOT INCLUDING TABLE NAME)
:param wheres: MAP FROM path TO LIST OF WHERE CONDITIONS
:return: (es_query, filters_map) TUPLE
"""
output = None
last_where = MA... | 0.002131 |
def compose_projects_json(projects, data):
""" Compose projects.json with all data sources
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with all data sources
"""
projects = compose_git(projects, data)
projects = compose_mailing_lists(projects, data)
pr... | 0.001976 |
def log_call(self, cmd, callwith=subprocess.check_call,
log_level=logging.DEBUG, **kw):
"""Wrap a subprocess call with logging
:param meth: the calling method to use.
"""
logger.log(log_level, "%s> call %r", self.cwd, cmd)
ret = callwith(cmd, **kw)
if cal... | 0.007317 |
def start_log(level=logging.DEBUG, filename=None):
"""start the logger for the run
Parameters
----------
level : int, optional
logging.DEBUG, logging.INFO etc. for the log level (between 0-50).
filename : str, optional
name of the filename to save the log to or
None (default) to... | 0.001229 |
def set(self, val):
"""
set value of this param
"""
assert not self.__isReadOnly, \
("This parameter(%s) was locked"
" and now it can not be changed" % self.name)
assert self.replacedWith is None, \
("This param was replaced with new one and t... | 0.004098 |
def connect_edges(graph):
"""
Given a Graph element containing abstract edges compute edge
segments directly connecting the source and target nodes. This
operation just uses internal HoloViews operations and will be a
lot slower than the pandas equivalent.
"""
paths = []
for start, end ... | 0.001387 |
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
"""
See :meth:`superclass method
<.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
for spec of input and result values.
"""
assert all(stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES
... | 0.002805 |
def get_temp_url(self, container, obj, seconds, method="GET", key=None,
cached=True):
"""
Given a storage object in a container, returns a URL that can be used
to access that object. The URL will expire after `seconds` seconds.
The only methods supported are GET and PUT. Any... | 0.003623 |
def push(self, refspec=None, progress=None, **kwargs):
"""Push changes from source branch in refspec to target branch in refspec.
:param refspec: see 'fetch' method
:param progress:
Can take one of many value types:
* None to discard progress information
* A... | 0.006958 |
def _get_settings_file(self, imu_settings_file):
"""
Internal. Logic to check for a system wide RTIMU ini file. This is
copied to the home folder if one is not already found there.
"""
ini_file = '%s.ini' % imu_settings_file
home_dir = pwd.getpwuid(os.getuid())[5]
... | 0.002378 |
def _Fierz_to_JMS_III_IV_V(Fqqqq, qqqq):
"""From 4-quark Fierz to JMS basis for Classes III, IV and V.
`qqqq` should be of the form 'sbuc', 'sdcc', 'ucuu' etc."""
F = Fqqqq.copy()
#case dduu
classIII = ['sbuc', 'sbcu', 'dbuc', 'dbcu', 'dsuc', 'dscu']
classVdduu = ['sbuu' , 'dbuu', 'dsuu', 'sbcc'... | 0.013565 |
def execute_concurrent_with_args(session, statement, parameters, *args, **kwargs):
"""
Like :meth:`~cassandra.concurrent.execute_concurrent()`, but takes a single
statement and a sequence of parameters. Each item in ``parameters``
should be a sequence or :const:`None`.
Example usage::
sta... | 0.00641 |
def get_list_url_filtered_by_field_value(view, model, name, reverse=False):
"""Get the URL if a filter of model[name] value was appended.
This allows programatically adding filters. This is used in the specialized case
of filtering deeper into a list by a field's value.
For instance, since there can b... | 0.002978 |
def extendMarkdown(self, md, md_globals):
"""
Every extension requires a extendMarkdown method to tell the markdown
renderer how use the extension.
"""
md.registerExtension(self)
for processor in (self.preprocessors or []):
md.preprocessors.add(processor.__na... | 0.007937 |
def _get_mps_od_net(input_image_shape, batch_size, output_size, anchors,
config, weights={}):
"""
Initializes an MpsGraphAPI for object detection.
"""
network = _MpsGraphAPI(network_id=_MpsGraphNetworkType.kODGraphNet)
c_in, h_in, w_in = input_image_shape
c_out = output_siz... | 0.003578 |
def post(self, request, pk=None):
""" Handles POST requests. """
self.top_level_forum = get_object_or_404(Forum, pk=pk) if pk else None
return self.mark_as_read(request, pk) | 0.010152 |
def project_to_image(self, point_cloud, round_px=True):
"""Projects a point cloud onto the camera image plane and creates
a depth image. Zero depth means no point projected into the camera
at that pixel location (i.e. infinite depth).
Parameters
----------
point_cloud : ... | 0.008924 |
def get_urlpatterns(self):
""" Returns the URL patterns managed by the considered factory / application. """
return [
url(r'', include(self.forum_urlpatterns_factory.urlpatterns)),
url(r'', include(self.conversation_urlpatterns_factory.urlpatterns)),
url(_(r'^feeds/')... | 0.012081 |
def search(name, official=False, trusted=False):
'''
Searches the registry for an image
name
Search keyword
official : False
Limit results to official builds
trusted : False
Limit results to `trusted builds`_
**RETURN DATA**
A dictionary with each key being the n... | 0.000566 |
async def get_pypi_version(self):
"""Get version published to PyPi."""
self._version_data["beta"] = self.beta
self._version_data["source"] = "PyPi"
info_version = None
last_release = None
try:
async with async_timeout.timeout(5, loop=self.loop):
... | 0.003723 |
def check_node_attributes(pattern, node, *attributes):
"""
Searches match in attributes against given pattern and if
finds the match against any of them returns True.
"""
for attribute_name in attributes:
attribute = node.get(attribute_name)
if attribute is not None and pattern.searc... | 0.002667 |
def retrieve(self, request, *args, **kwargs):
"""
Optional `field` query parameter (can be list) allows to limit what fields are returned.
For example, given request /api/projects/<uuid>/?field=uuid&field=name you get response like this:
.. code-block:: javascript
{
... | 0.007843 |
def callback(self, username, request):
""" Having :username: return user's identifiers or None. """
credentials = self._get_credentials(request)
if credentials:
username, api_key = credentials
if self.check:
return self.check(username, api_key, request) | 0.006309 |
def query(self, table_name, hash_key_value, range_key_conditions=None,
attributes_to_get=None, limit=None, consistent_read=False,
scan_index_forward=True, exclusive_start_key=None,
object_hook=None):
"""
Perform a query of DynamoDB. This version is currently pu... | 0.002029 |
def pdfdump(self, filename=None, **kargs):
"""pdfdump(filename=None, layer_shift=0, rebuild=1)
Creates a PDF file describing a packet. If filename is not provided a temporary file is created and xpdf is called."""
canvas = self.canvas_dump(**kargs)
if filename is None:
fname ... | 0.005859 |
def open(self, options):
"""
Open and include the refrenced schema.
@param options: An options dictionary.
@type options: L{options.Options}
@return: The referenced schema.
@rtype: L{Schema}
"""
if self.opened:
return
self.opened = True... | 0.004016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.