text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _getNextEventBatch(self):
"""download next batch of events based on the event uris in the uri list"""
self._eventPage += 1
# if we have already obtained all pages, then exit
if self._totalPages != None and self._eventPage > self._totalPages:
return
self.setRequest... | 0.010271 |
def _parse_module(self, uri):
''' Parse module defined in *uri* '''
filename = self._uri2path(uri)
if filename is None:
# nothing that we could handle here.
return ([],[])
f = open(filename, 'rt')
functions, classes = self._parse_lines(f)
f.close()... | 0.008475 |
def next_layout(pymux, variables):
" Select next layout. "
pane = pymux.arrangement.get_active_window()
if pane:
pane.select_next_layout() | 0.006329 |
def get_variable_name_from_bird(bird_conf):
"""Return the variable name set in Bird configuration.
The variable name in Bird configuration is set with the keyword 'define',
here is an example:
define ACAST_PS_ADVERTISE =
and we exract the string between the word 'define' and the equals sign.
... | 0.001103 |
def parsyfiles_global_config(multiple_errors_tb_limit: int = None, full_paths_in_logs: bool = None,
dict_to_object_subclass_limit: int = None):
"""
This is the method you should use to configure the parsyfiles library
:param multiple_errors_tb_limit: the traceback size (defaul... | 0.00674 |
def assign_assessment_to_bank(self, assessment_id, bank_id):
"""Adds an existing ``Assessment`` to a ``Bank``.
arg: assessment_id (osid.id.Id): the ``Id`` of the
``Assessment``
arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank``
raise: AlreadyExists - ``assessme... | 0.001773 |
def uid_exists(uid):
"""Check if a uid exists"""
try:
pwd.getpwuid(uid)
uid_exists = True
except KeyError:
uid_exists = False
return uid_exists | 0.005464 |
def write_metadata(self, handler):
""" set the meta data """
if self.metadata is not None:
handler.write_metadata(self.cname, self.metadata) | 0.011905 |
def compare(self, src):
"""Compare this ResourceList object with that specified as src.
The parameter src must also be a ResourceList object, it is assumed
to be the source, and the current object is the destination. This
written to work for any objects in self and sc, provided that the... | 0.001024 |
def load_scalars(filename, strict_type_checks=True):
"""Parses a YAML file containing the scalar definition.
:param filename: the YAML file containing the scalars definition.
:raises ParserError: if the scalar file cannot be opened or parsed.
"""
# Parse the scalar definitions from the YAML file.
... | 0.003783 |
def connect(self):
"""This method connects to RabbitMQ, returning the connection handle.
When the connection is established, the on_connection_open method
will be invoked by pika.
:rtype: pika.SelectConnection
"""
_logger.info('Connecting to %s', self.AMQP_URL)
w... | 0.005172 |
def make_a_call(self, number: int or str = 18268237856) -> None:
'''Make a call.'''
self.app_start_action(Actions.CALL, '-d', 'tel:{}'.format(str(number))) | 0.011696 |
def fail_acs_response(request, *args, **kwargs):
""" Serves as a common mechanism for ending ACS in case of any SAML related failure.
Handling can be configured by setting the SAML_ACS_FAILURE_RESPONSE_FUNCTION as
suitable for the project.
The default behavior uses SAML specific template that is render... | 0.010189 |
def add_argument(self, *args, **kwargs):
"""Add an argument.
This method adds a new argument to the current parser. The function is
same as ``argparse.ArgumentParser.add_argument``. However, this method
tries to determine help messages for the adding argument from some
docstring... | 0.002727 |
def get_model_index(cls, model, default=True):
'''
Returns the default model index for the given model, or the list of indices if default is False.
:param model: model name as a string.
:raise KeyError: If the provided model does not have any index associated.
'''
try:
... | 0.008606 |
def reset_coords(self, names=None, drop=False, inplace=None):
"""Given names of coordinates, reset them to become variables
Parameters
----------
names : str or list of str, optional
Name(s) of non-index coordinates in this dataset to reset into
variables. By def... | 0.001472 |
def run_standalone(self, color_depth):
"""
Run pymux standalone, rather than using a client/server architecture.
This is mainly useful for debugging.
"""
self._runs_standalone = True
self._start_auto_refresh_thread()
client_state = self.add_client(
in... | 0.004082 |
def vdatainfo(self, listAttr=0):
"""Return info about all the file vdatas.
Args::
listAttr Set to 0 to ignore vdatas used to store attribute
values, 1 to list them (see the VD._isattr readonly
attribute)
Returns::
List of vdata ... | 0.001191 |
def disconnect(self, id): # pylint: disable=invalid-name,redefined-builtin
"""Close proxy connection to a device's management interface.
:param id: Device ID as an int.
"""
return self.service.post(self.base+str(id)+'/disconnect/') | 0.011364 |
def _find_closest(self, n0):
"""returns the node in the tree that is closest to n0, but not
in the same observation
"""
dmin = np.inf
nclose = None
ds = []
nodes = []
ds.append(np.inf)
nodes.append(self)
for n in self:
if n... | 0.004301 |
def paste(cmd=paste_cmd, stdout=PIPE):
"""Returns system clipboard contents.
"""
return Popen(cmd, stdout=stdout).communicate()[0].decode('utf-8') | 0.006329 |
def Subclasses(cls, sort_by=None, reverse=False):
"""Get all nested Constant class and it's name pair.
:param sort_by: the attribute name used for sorting.
:param reverse: if True, return in descend order.
:returns: [(attr, value),...] pairs.
::
>>> class MyClass(Const... | 0.004583 |
def rapidupload(self, file_handler, path, **kwargs):
"""秒传一个文件
:param file_handler: 文件handler, e.g. open('file','rb')
:type file_handler: file
:param path: 上传到服务器的路径,包含文件名
:type path: str
:return: requests.Response
.. note::
* 文件已在服务器上存在,不上... | 0.001442 |
def requeue(self, **kwargs):
"""
Respond to ``nsqd`` that you've failed to process this message successfully (and would
like it to be requeued).
:param backoff: whether or not :class:`nsq.Reader` should apply backoff handling
:type backoff: bool
:param delay: the amount... | 0.006623 |
def check_plan_id(self, plan_id) -> bool:
"""
Checks that the plan_id exists in the catalog
:return: boolean
"""
for plan in self.catalog().plans:
if plan.id == plan_id:
return True
return False | 0.007407 |
def s3_cache_readonly(self):
"""
Whether the Amazon S3 bucket is considered read only.
If this is :data:`True` then the Amazon S3 bucket will only be used for
:class:`~pip_accel.caches.s3.S3CacheBackend.get()` operations (all
:class:`~pip_accel.caches.s3.S3CacheBackend.put()` op... | 0.002762 |
def learning_schedule() -> Callable:
"""
Returns a method that can be used in argument parsing to check that the argument is a valid learning rate schedule
string.
:return: A method that can be used as a type in argparse.
"""
def parse(schedule_str):
try:
schedule = Learnin... | 0.006656 |
def _get_file(self):
'''
return an opened tempfile pointer that can be used
http://docs.python.org/2/library/tempfile.html
'''
f = tempfile.NamedTemporaryFile(delete=False)
self.tmp_files.add(f.name)
return f | 0.007547 |
def sort_and_index_star(job, star_bams, univ_options, star_options):
"""
A wrapper for sorting and indexing the genomic star bam generated by run_star. It is required
since run_star returns a dict of 2 bams
:param dict star_bams: The bams from run_star
:param dict univ_options: Dict of universal op... | 0.004305 |
def from_config(cls, cp, ifo, section):
"""Read a config file to get calibration options and transfer
functions which will be used to intialize the model.
Parameters
----------
cp : WorkflowConfigParser
An open config file.
ifo : string
The detect... | 0.002217 |
def get_prev_step(self, step=None):
"""
Returns the previous step before the given `step`. If there are no
steps available, None will be returned. If the `step` argument is
None, the current step will be determined automatically.
"""
if step is None:
step = se... | 0.003205 |
def iter_errors(self, data):
"""Lazily yields each ValidationError for the received data dict.
"""
# Deprecate
warnings.warn(
'Property "profile.iter_errors" is deprecated.',
UserWarning)
for error in self._validator.iter_errors(data):
yield ... | 0.006154 |
def DOM_node_to_XML(tree, xml_declaration=True):
"""
Prints a DOM tree to its Unicode representation.
:param tree: the input DOM tree
:type tree: an ``xml.etree.ElementTree.Element`` object
:param xml_declaration: if ``True`` (default) prints a leading XML
declaration line
:type xml_dec... | 0.001748 |
def init_process(self):
"""
init a standard daq process for multiple devices
"""
for item in Device.objects.filter(protocol__daq_daemon=1, active=1, id__in=self.device_ids):
try:
tmp_device = item.get_device_instance()
if tmp_device is not Non... | 0.007792 |
def code_binary(item):
"""
Return a binary 'code' suitable for hashing.
"""
code_str = code(item)
if isinstance(code_str, six.string_types):
return code_str.encode('utf-8')
return code_str | 0.004545 |
def __send_default_challenge(self, **kwargs):
"""Call documentation: `/user/mfa/send_default_challenge
<https://www.wepay.com/developer/reference/user-mfa#send_default_challenge>`_,
plus extra keyword parameter:
:keyword bool batch_mode: turn on/off the batch_mode, see
... | 0.00597 |
def circumcircleForTriangle(cls, triangle):
'''
:param: triangle - Triangle class
:return: Circle class
Returns the circle where every vertex in the input triangle is
on the radius of that circle.
'''
if triangle.isRight:
# circumcircle origin is th... | 0.002083 |
def getFilename(name):
"""Get a filename from given name without dangerous or incompatible characters."""
# first replace all illegal chars
name = re.sub(r"[^0-9a-zA-Z_\-\.]", "_", name)
# then remove double dots and underscores
while ".." in name:
name = name.replace('..', '.')
while "_... | 0.004149 |
def rename(path):
"""Rename a file if necessary."""
new_path = prompt(path)
if path != new_path:
try:
from shutil import move
except ImportError:
from os import rename as move
move(path, new_path)
return new_path | 0.003571 |
def _unlock(self):
"""Unlock the config DB."""
if self.locked:
try:
self.device.cu.unlock()
self.locked = False
except JnrpUnlockError as jue:
raise UnlockError(jue.messsage) | 0.007634 |
def staff(I,T,N,J,S,c,b):
"""
staff: staff scheduling
Parameters:
- I: set of members in the staff
- T: number of periods in a cycle
- N: number of working periods required for staff's elements in a cycle
- J: set of shifts in each period (shift 0 == rest)
- S: subset... | 0.030796 |
def dispatch_failed(self, context):
"""Print the unhandled exception and exit the application."""
traceback.print_exception(
context.exc_type, context.exc_value, context.traceback)
raise SystemExit(1) | 0.008475 |
def _set_ipv4_routes(self, v, load=False):
"""
Setter method for ipv4_routes, mapped from YANG variable /isis_state/ipv4_routes (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_ipv4_routes is considered as a private
method. Backends looking to populate thi... | 0.005599 |
def provide_session(func):
"""
Function decorator that provides a session if it isn't provided.
If you want to reuse a session or run the function as part of a
database transaction, you pass it to the function, if not this wrapper
will create one and close it for you.
"""
@wraps(func)
de... | 0.001171 |
def _assert_executable_regions_match(workflow_enabled_regions, workflow_spec):
"""
Check if the global workflow regions and the regions of stages (apps) match.
If the workflow contains any applets, the workflow can be currently enabled
in only one region - the region in which the applets are stored.
... | 0.006876 |
async def get_data(self):
"""Get details of OpenSenseMap station."""
try:
async with async_timeout.timeout(5, loop=self._loop):
response = await self._session.get(self.base_url)
_LOGGER.info(
"Response from OpenSenseMap API: %s", response.status)
... | 0.0033 |
def setBusStop(self, vehID, stopID, duration=2**31 - 1, until=-1, flags=tc.STOP_DEFAULT):
"""setBusStop(string, string, integer, integer, integer) -> None
Adds or modifies a bus stop with the given parameters. The duration and the until attribute are
in milliseconds.
"""
self.se... | 0.009412 |
def iterable(target):
''' returns true if the given argument is iterable '''
if any(i in ('next', '__next__', '__iter__') for i in dir(target)):
return True
else:
try:
iter(target)
return True
except:
return False | 0.007018 |
def restart_cluster(name):
'''
Restart the traffic_manager process and the traffic_server process on all
the nodes in a cluster.
.. code-block:: bash
restart_ats_cluster:
trafficserver.restart_cluster
'''
ret = {'name': name,
'changes': {},
'result': No... | 0.001751 |
def upgradeProcessor1to2(oldProcessor):
"""
Batch processors stopped polling at version 2, so they no longer needed the
idleInterval attribute. They also gained a scheduled attribute which
tracks their interaction with the scheduler. Since they stopped polling,
we also set them up as a timed event... | 0.000746 |
def array(events, slots, objective_function=None, solver=None, **kwargs):
"""Compute a schedule in array form
Parameters
----------
events : list or tuple
of :py:class:`resources.Event` instances
slots : list or tuple
of :py:class:`resources.Slot` instances
objective_function : ... | 0.00095 |
def copy_content(origin, dstPath, blockSize, mode):
''' copy the content of `origin` to `dstPath` in a safe manner.
this function will first copy the content to a temporary file
and then move it atomically to the requested destination.
if some error occurred during content copy or file mov... | 0.002874 |
def get_network_resource_property_entry(resource, prop):
""" Factory method for creating get functions. """
def get_func(cmd, resource_group_name, resource_name, item_name):
client = getattr(network_client_factory(cmd.cli_ctx), resource)
items = getattr(client.get(resource_group_name, resource_... | 0.003896 |
def delete_devices(self, auth_body, devices):
"""Bulk deletion of devices.
NOTE: This endpoint uses the User-Interactive Authentication API.
Args:
auth_body (dict): Authentication params.
devices (list): List of device ID"s to delete.
"""
content = {
... | 0.004367 |
def recreate_grams(self):
"""Re-create grams for database.
In normal situations, you never need to call this method.
But after migrate DB, this method is useful.
:param session: DB session
:type session: :class:`sqlalchemt.orm.Session`
"""
session = self.Sessi... | 0.002782 |
def experiments_predictions_attachments_create(self, experiment_id, run_id, resource_id, filename, mime_type=None):
"""Attach a given data file with a model run. The attached file is
identified by the resource identifier. If a resource with the given
identifier already exists it will be overwrit... | 0.002435 |
def get_param(self, number):
"""
Reads an internal Partner object parameter.
"""
logger.debug("retreiving param number %s" % number)
type_ = snap7.snap7types.param_types[number]
value = type_()
code = self.library.Par_GetParam(self.pointer, ctypes.c_int(number),
... | 0.004619 |
def _on_automation_update(self, event):
"""Automation update broadcast from Abode SocketIO server."""
event_group = TIMELINE.AUTOMATION_EDIT_GROUP
if isinstance(event, (tuple, list)):
event = event[0]
for callback in self._event_callbacks.get(event_group, ()):
_... | 0.005666 |
def unbroadcast_tfe_to(tensor, shape):
"""Reverse the broadcasting operation.
See utils.py.
Args:
tensor: A Tensor.
shape: A shape that could have been broadcasted to the shape of tensor.
Returns:
Tensor with dimensions summed to match `shape`.
"""
axis = utils.create_unbroadcast_axis(shape, ... | 0.009926 |
def fft(self, start_s=None, duration_s=None, start_sample=None, num_samples=None, zero_pad=False):
"""
Transforms the indicated slice of the AudioSegment into the frequency domain and returns the bins
and the values.
If neither `start_s` or `start_sample` is specified, the first sample ... | 0.005127 |
def terminateAppByBundleId(bundleID):
"""Terminate app with a given bundle ID.
Requires 10.6.
Return True if succeed.
"""
ra = AppKit.NSRunningApplication
if getattr(ra, "runningApplicationsWithBundleIdentifier_"):
appList = ra.runningApplicationsWithBundleId... | 0.003976 |
def surface(self):
"""The playing surface on which the game was played.
:returns: string representing the type of surface. Returns np.nan if
not avaiable.
"""
doc = self.get_doc()
table = doc('table#game_info')
giTable = sportsref.utils.parse_info_table(table)
... | 0.00551 |
def get_parameters(self, packet_count=None):
"""
Returns the special tshark parameters to be used according to the configuration of this class.
"""
params = super(LiveCapture, self).get_parameters(packet_count=packet_count)
# Read from STDIN
params += ['-r', '-']
... | 0.012012 |
def get_dimension(self):
"""Get the dimension of the returned feature. This equals the number
of elements in the returned list of numbers."""
return int(round(float(self.strokes**2)/2 + float(self.strokes)/2)) | 0.008475 |
def pointIsInTriangle(p, p1, p2, p3):
"""
Return True if a point is inside (or above/below) a triangle defined by 3 points in space.
"""
p = np.array(p)
u = np.array(p2) - p1
v = np.array(p3) - p1
n = np.cross(u, v)
w = p - p1
ln = np.dot(n, n)
if not ln:
return True # d... | 0.003636 |
def cmd_attitude(self, args):
'''attitude q0 q1 q2 q3 thrust'''
if len(args) != 5:
print("Usage: attitude q0 q1 q2 q3 thrust (0~1)")
return
if len(args) == 5:
q0 = float(args[0])
q1 = float(args[1])
q2 = float(args[2])
q3 =... | 0.005272 |
def process_file_sorted_by_pmid(file_name):
"""Processes a file and returns a dictionary mapping pmids to a list of
statements corresponding to that pmid.
Parameters
----------
file_name : str
A csxml file to process
Returns
-------
s_dict : dict
Dictionary mapping pmid... | 0.001706 |
def context(name=None):
"""Declare that a class defines a context.
Contexts are for use with HierarchicalShell for discovering
and using functionality from the command line.
Args:
name (str): Optional name for this context if you don't want
to just use the class name.
"""
... | 0.002299 |
def _green_worker(self):
"""
A worker that does actual jobs
"""
while not self.quit.is_set():
try:
task = self.green_queue.get(timeout=1)
timestamp, missile, marker = task
planned_time = self.start_time + (timestamp / 1000.0)
... | 0.002634 |
def plot_leverages(self):
"""
Leverage (h) per observation, with a red line plotted at y = 1/Number of samples (expected
:return: Plot with observation leverages (h)
"""
plt.figure()
lev = self.leverages()
plt.xlabel('Sample Index')
plt.ylabel('Leverage')
... | 0.008114 |
def _construct_auto_distance(feature_names, column_names, column_types, sample):
"""
Construct composite distance parameters based on selected features and their
types.
"""
## Make a dictionary from the column_names and column_types
col_type_dict = {k: v for k, v in zip(column_names, column_typ... | 0.007659 |
def colorize(occurence,maxoccurence,minoccurence):
'''A formula for determining colors.'''
if occurence == maxoccurence:
color = (255,0,0)
elif occurence == minoccurence:
color = (0,0,255)
else:
color = (int((float(occurence)/maxoccurence*255)),0,int(float(minoccurence)/occurence... | 0.029155 |
def _calculate_solar_time(self, hour, eq_of_time, is_solar_time):
"""Calculate Solar time for an hour."""
if is_solar_time:
return hour
return (
(hour * 60 + eq_of_time + 4 * math.degrees(self._longitude) -
60 * self.time_zone) % 1440) / 60 | 0.006623 |
def _build_request_url(self, secure, api_method):
"""Build a URL for a API method request
"""
if secure:
proto = ANDROID_MANGA.PROTOCOL_SECURE
else:
proto = ANDROID_MANGA.PROTOCOL_INSECURE
req_url = ANDROID_MANGA.API_URL.format(
protocol=proto,... | 0.005168 |
def str_eval(token):
"""
Mostly replicate `ast.literal_eval(token)` manually to avoid any performance hit.
This supports f-strings, contrary to `ast.literal_eval`.
We have to support all string literal notations:
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
... | 0.003623 |
def interval_range(start=None, end=None, periods=None, freq=None,
name=None, closed='right'):
"""
Return a fixed frequency IntervalIndex
Parameters
----------
start : numeric or datetime-like, default None
Left bound for generating intervals
end : numeric or datetime-... | 0.000158 |
def _chunk_length(self, data):
"""Received the chunk length"""
assert data[-2:] == "\r\n", "CRLF"
length = data[:-2].split(';')[0] # cut off optional length paramters
length = int(length.strip(), 16) # length is in hex
if length:
logger.debug('Got chunk length: %d'... | 0.008333 |
def register_field(mongo_field_cls, marshmallow_field_cls,
available_params=()):
"""
Bind a marshmallow field to it corresponding mongoengine field
:param mongo_field_cls: Mongoengine Field
:param marshmallow_field_cls: Marshmallow Field
:param available_params: List of :class mar... | 0.00314 |
def safe_cd(path):
"""
Changes to a directory, yields, and changes back.
Additionally any error will also change the directory back.
Usage:
>>> with safe_cd('some/repo'):
... call('git status')
"""
starting_directory = os.getcwd()
try:
os.chdir(path)
yield
fi... | 0.002755 |
def profile_norm(self, name, logemin=None, logemax=None, reoptimize=False,
xvals=None, npts=None, fix_shape=True, savestate=True,
**kwargs):
"""Profile the normalization of a source.
Parameters
----------
name : str
Source name.
... | 0.001142 |
def clean_partitions(self):
"""Delete partition records and any built partition files. """
import shutil
from ambry.orm import ColumnStat
# FIXME. There is a problem with the cascades for ColumnStats that prevents them from
# being deleted with the partitions. Probably, they ar... | 0.006729 |
def do_req(self, method, url, body=None, headers=None, status=None):
"""Used internally to send a request to the API, left public
so it can be used to talk to the API more directly.
"""
if body is None:
body = ''
else:
body = json.dumps(body)
res =... | 0.002252 |
def sample_stats_prior_to_xarray(self):
"""Extract sample_stats_prior from prior."""
prior = self.prior
prior_model = self.prior_model
data = get_sample_stats_stan3(prior, model=prior_model)
return dict_to_dataset(data, library=self.stan, coords=self.coords, dims=self.dims) | 0.009404 |
def KnowsFile(self,filename):
"""Looks at extension and decides if it knows
how to manage this file"""
if self._isMediaFile(filename) or self._isConfigFile(filename):
return True
return False | 0.012766 |
def get_pager(self, *path, **kwargs):
""" A generator for all the results a resource can provide. The pages
are lazily loaded. """
page_arg = kwargs.pop('page_size', None)
limit_arg = kwargs.pop('limit', None)
kwargs['limit'] = page_arg or limit_arg or self.default_page_size
... | 0.005305 |
def _get_attention(inp_text, out_text, enc_atts, dec_atts, encdec_atts):
"""Compute representation of the attention ready for the d3 visualization.
Args:
inp_text: list of strings, words to be displayed on the left of the vis
out_text: list of strings, words to be displayed on the right of the vis
enc_... | 0.00305 |
def subclass(cls, *bases, **kwargs):
"""
Add bases to class (late subclassing)
Annoyingly we cannot yet modify __bases__ of an existing
class, instead we must create another subclass, see here;
http://bugs.python.org/issue672115
>>> class A(object): pass
>>> class B(object): pass
>>> c... | 0.001326 |
def unit(x1, x2, block_num, depth, num_layers, dim='2d',
bottleneck=True, first_batch_norm=True, stride=1, training=True):
"""Implements bottleneck RevNet unit from authors' RevNet architecture.
Args:
x1: [N, H, W, C] tensor of network activations.
x2: [N, H, W, C] tensor of network activations.
... | 0.005337 |
def apply_and_save(self):
"""Apply replaced words and patches, and save setup.py file."""
patches = self.patches
content = None
with open(self.IN_PATH) as f_in:
# As setup.py.in file size is 2.4 KByte.
# it's fine to read entire content.
content = f_i... | 0.001643 |
def save_video(video, fps, save_filename='media/output.avi'):
"""Save a video to disk"""
# fourcc = cv2.CAP_PROP_FOURCC('M', 'J', 'P', 'G')
print(save_filename)
video = float_to_uint8(video)
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
writer = cv2.VideoWriter(save_filename, fourcc, fps, (video.shap... | 0.004405 |
def update_state(self):
""" Update state with latest info from Wink API. """
response = self.api_interface.get_device_state(self, id_override=self.parent_id(),
type_override=self.parent_object_type())
self._update_state_from_response(res... | 0.01227 |
def set_mouse_button_callback(window, cbfun):
"""
Sets the mouse button callback.
Wrapper for:
GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
"""
window_addr = ctypes.cast(ctypes.pointer(window),
ctypes.POINTER(ctyp... | 0.002358 |
def _get_drawn_rect(self, grid, key, rect):
"""Replaces drawn rect if the one provided by wx is incorrect
This handles merged rects including those that are partly off screen.
"""
rect = self.get_merged_rect(grid, key, rect)
if rect is None:
# Merged cell is drawn
... | 0.003053 |
def _get_dump_item_context(self, index, name, opts):
"""
Return a formated dict context
"""
c = {
'item_no': index,
'label': name,
'name': name,
'models': ' '.join(opts['models']),
'natural_key': '',
}
if opts.ge... | 0.004484 |
def _load_group_permissions(self):
"""
Populates self._group_permissions based on LDAP group membership and
Django group permissions.
"""
group_names = self._get_groups().get_group_names()
perms = Permission.objects.filter(group__name__in=group_names)
perms = per... | 0.00611 |
def check_calendar_dates(
feed: "Feed", *, as_df: bool = False, include_warnings: bool = False
) -> List:
"""
Analog of :func:`check_agency` for ``feed.calendar_dates``.
"""
table = "calendar_dates"
problems = []
# Preliminary checks
if feed.calendar_dates is None:
return proble... | 0.001741 |
def hexbin(x, y, color="purple", **kwargs):
"""Seaborn-compatible hexbin plot.
See also: http://seaborn.pydata.org/tutorial/axis_grids.html#mapping-custom-functions-onto-the-grid
"""
if HAS_SEABORN:
cmap = sns.light_palette(color, as_cmap=True)
else:
cmap = "Purples"
plt.hexbin(... | 0.00578 |
def get_3_3_tuple(self,obj,default=None):
"""Return tuple of 3-tuples
"""
if is_sequence2(obj):
ret = []
for i in range(3):
if i<len(obj):
ret.append(self.get_3_tuple(obj[i],default))
else:
ret.append... | 0.02112 |
def reset(self, force=False):
"""
Clears out all the views and panels and resets the widget to a blank \
parent.
:return <bool>
"""
answer = QtGui.QMessageBox.Yes
opts = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
if not force:
... | 0.009139 |
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'logs') and self.logs is not None:
_dict['logs'] = [x._to_dict() for x in self.logs]
if hasattr(self, 'pagination') and self.pagination is not None:
_dict['pagi... | 0.005291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.