text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def boundingRect( self ):
"""
Determines the bounding rectangle for this node.
:return <QRectF>
"""
rect = super(XNode, self).boundingRect()
pad = self.highlightPadding()
x = rect.x() - pad / 2.0
y = rect.y() - pad / 2.0
w = r... | 0.021739 |
def get_language_from_abbr(self, abbr):
"""Get language full name from abbreviation."""
for language in self.user_data.languages:
if language['language'] == abbr:
return language['language_string']
return None | 0.007663 |
def clean_path(p):
""" Clean a path by expanding user and environment variables and
ensuring absolute path.
"""
p = os.path.expanduser(p)
p = os.path.expandvars(p)
p = os.path.abspath(p)
return p | 0.004405 |
def fetch(self, callback):
"""
Perform a full synchronization flow.
.. code-block:: python
:linenos:
>>> client = basecrm.Client(access_token='<YOUR_PERSONAL_ACCESS_TOKEN>')
>>> sync = basecrm.Sync(client=client, device_uuid='<YOUR_DEVICES_UUID>')
... | 0.004372 |
def sphere_volume(R, n):
"""Return the volume of a sphere in an arbitrary number of dimensions.
Parameters
----------
R: array-like
Radius.
n: array-like
The number of dimensions of the space in which the sphere lives.
Returns
-------
V: array-like
Volume.
"... | 0.0025 |
def generate_menu():
"""Generate a new list of menus."""
root_menu = Menu(list(copy.deepcopy(settings.WAFER_MENUS)))
for dynamic_menu_func in settings.WAFER_DYNAMIC_MENUS:
dynamic_menu_func = maybe_obj(dynamic_menu_func)
dynamic_menu_func(root_menu)
return root_menu | 0.003356 |
def get_graph(graph=None, *, _limit=(), _print=()):
"""
Extracts a list of cafes with on euro in Paris, renames the name, address and zipcode fields,
reorders the fields and formats to json and csv files.
"""
graph = graph or bonobo.Graph()
producer = (
graph.get_cursor()
>> OD... | 0.006843 |
def _refresh_state(self):
""" Refresh the job info. """
self._info = self._api.projects().jobs().get(name=self._name).execute()
self._fatal_error = self._info.get('errorMessage', None)
state = str(self._info.get('state'))
self._is_complete = (state == 'SUCCEEDED' or state == 'FAILED') | 0.003279 |
def _validate_fromutc_inputs(f):
"""
The CPython version of ``fromutc`` checks that the input is a ``datetime``
object and that ``self`` is attached as its ``tzinfo``.
"""
@wraps(f)
def fromutc(self, dt):
if not isinstance(dt, datetime):
raise TypeError("fromutc() requires a ... | 0.002105 |
def mod_run_check(cmd_kwargs, onlyif, unless, creates):
'''
Execute the onlyif and unless logic.
Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
else return True
'''
# never use VT for onlyif/unless executions because this will lead
# to quote ... | 0.002488 |
def createMenuItem( self, title ):
"""
Creates a new menu item with the given title.
:param title | <str>
:return <QTreeWidgetItem>
"""
item = QTreeWidgetItem([title])
ico = projexui.resources.find('img/folder.png')
item... | 0.016878 |
def data(place):
"""get forecast data."""
lat, lon = place
url = "https://api.forecast.io/forecast/%s/%s,%s?solar" % (APIKEY, lat,
lon)
w_data = json.loads(urllib2.urlopen(url).read())
return w_data | 0.003559 |
def concatenate_attributes(attributes):
'''Concatenate InstanceAttribute to return a bigger one.'''
# We get a template/
tpl = attributes[0]
attr = InstanceAttribute(tpl.name, tpl.shape,
tpl.dtype, tpl.dim, alias=None)
# Special case, not a single array has size bi... | 0.00969 |
def generate(env):
"""Add Builders and construction variables for Microsoft Visual
Studio project files to an Environment."""
try:
env['BUILDERS']['MSVSProject']
except KeyError:
env['BUILDERS']['MSVSProject'] = projectBuilder
try:
env['BUILDERS']['MSVSSolution']
except ... | 0.004562 |
def _compute_vectorized(self, *args):
"""Compare attributes (vectorized)
Parameters
----------
*args : pandas.Series
pandas.Series' as arguments.
Returns
-------
pandas.Series, pandas.DataFrame, numpy.ndarray
The result of comparing recor... | 0.003044 |
def network_pf(network, snapshots=None, skip_pre=False, x_tol=1e-6, use_seed=False):
"""
Full non-linear power flow for generic network.
Parameters
----------
snapshots : list-like|single snapshot
A subset or an elements of network.snapshots on which to run
the power flow, defaults ... | 0.003918 |
def get_json_argument(self, name, default=None):
"""Find and return the argument with key 'name'
from JSON request data. Similar to Tornado's get_argument() method.
:param str name: The name of the json key you want to get the value for
:param bool default: The default value if nothing ... | 0.001874 |
def _to_dsn(hosts):
"""Convert a host URI into a dsn for aiopg.
>>> _to_dsn('aiopg://myhostname:4242/mydb')
'postgres://crate@myhostname:4242/mydb'
>>> _to_dsn('aiopg://myhostname:4242')
'postgres://crate@myhostname:4242/doc'
>>> _to_dsn('aiopg://hoschi:pw@myhostname:4242/doc?sslmode=require'... | 0.002012 |
def mim2reg(mimfile, regfile):
"""
Convert a MIMAS region (.mim) file into a DS9 region (.reg) file.
Parameters
----------
mimfile : str
Input file in MIMAS format.
regfile : str
Output file.
"""
region = Region.load(mimfile)
region.write_reg(regfile)
logging.i... | 0.002611 |
def load_extra_data(cls, data):
"""Loads extra JSON configuration parameters from a data buffer.
The data buffer must represent a JSON object.
Args:
data: str, the buffer to load the JSON data from.
"""
try:
cls._extra_config.update(json.loads(data))
except ValueError as exception:... | 0.009804 |
def search_authors(self, query):
query = query.replace(" ", "+")
"""
FIXME: Don't create a process to do this!
"""
p = subprocess.Popen("curl -H 'Accept: application/orcid+json' \
'http://pub.sandbox-1.orcid.org/search/orcid-bio?q=" +
... | 0.004545 |
def _retry_storage_check(exception):
"""Return True if we should retry, False otherwise."""
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
print_error(
'%s: Exception %s: %s' % (now, type(exception).__name__, str(exception)))
return isinstance(exception, oauth2client.client.AccessTokenRefreshError) | 0.015625 |
def make_meta_dict_consistent(self):
"""
Remove the possibility of the main keys being undefined.
"""
if self.meta_dict is None:
self.meta_dict = {}
if "galaxy_info" not in self.meta_dict:
self.meta_dict["galaxy_info"] = {}
if "dependencies" not ... | 0.004082 |
def append(self,text):
"""Add a text (or speech) to the document:
Example 1::
doc.append(folia.Text)
Example 2::
doc.append( folia.Text(doc, id='example.text') )
Example 3::
doc.append(folia.Speech)
"""
if text is Text:
... | 0.011869 |
def parse(self):
'''
read and parse a set of data read from the console. after the
data is parsed it is available in the fields variable.
'''
fields = self._get_loop_fields()
fields['Archive'] = self._get_new_archive_fields()
self._calc_derived_fields(fields)
... | 0.004902 |
def int_check(*args, func=None):
"""Check if arguments are integrals."""
func = func or inspect.stack()[2][3]
for var in args:
if not isinstance(var, numbers.Integral):
name = type(var).__name__
raise ComplexError(
f'Function {func} expected integral number, {... | 0.005882 |
def is_numeric(value,
minimum = None,
maximum = None,
**kwargs):
"""Indicate whether ``value`` is a numeric value.
:param value: The value to evaluate.
:param minimum: If supplied, will make sure that ``value`` is greater than or
equal to this value.
... | 0.010329 |
def find_peaks(sig):
"""
Find hard peaks and soft peaks in a signal, defined as follows:
- Hard peak: a peak that is either /\ or \/
- Soft peak: a peak that is either /-*\ or \-*/
In this case we define the middle as the peak
Parameters
----------
sig : np array
The 1d signa... | 0.010401 |
def get_batch(self, batch_size, next_states=False):
"""
Samples a batch of the specified size according to priority.
Args:
batch_size: The batch size
next_states: A boolean flag indicating whether 'next_states' values should be included
Returns: A dict containin... | 0.00225 |
def get_ot_study_info_from_treebase_nexml(src=None,
nexml_content=None,
encoding=u'utf8',
nexson_syntax_version=DEFAULT_NEXSON_VERSION,
merge_blocks=Tru... | 0.001411 |
def to_array(self):
"""
Serializes this InlineQueryResultCachedPhoto to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedPhoto, self).to_array()
array['type'] = u(self.type) # py2: type unicod... | 0.006065 |
def create_loadfile(entities, f):
"""Create payload and save to file."""
with open(f, 'w') as out:
out.write(Entity.create_payload(entities)) | 0.011834 |
def idxmin(self, axis=0, skipna=True):
"""
Return index of first occurrence of minimum over requested axis.
NA/null values are excluded.
Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
0 or 'index' for row-wise, 1 or 'columns' for colum... | 0.0018 |
def normalize_ip(ip):
"""
Transform the address into a standard, fixed-length form, such as:
1234:0:01:02:: -> 1234:0000:0001:0002:0000:0000:0000:0000
1234::A -> 1234:0000:0000:0000:0000:0000:0000:000a
:type ip: string
:param ip: An IP address.
:rtype: string
:return: The nor... | 0.000815 |
def read_from_memory_region(self, *, region_name: str):
"""
Reads from a memory region named region_name on the QAM.
This is a shim over the eventual API and only can return memory from a region named
"ro" of type ``BIT``.
:param region_name: The string naming the declared memo... | 0.006479 |
def fit(self, Xs=None, ys=None, Xt=None, yt=None):
"""Build a coupling matrix from source and target sets of samples
(Xs, ys) and (Xt, yt)
Parameters
----------
Xs : array-like, shape (n_source_samples, n_features)
The training input samples.
ys : array-like,... | 0.001267 |
def main():
"""Executed when script is run as-is."""
# magic_files = {}
for filename in locate_files(ROOT_DIR):
print("Processing %s" % filename)
with open(filename, "rt") as f:
tokens = list(tokenize.generate_tokens(f.readline))
text1 = tokenize.untokenize(tokens)
... | 0.002237 |
def http_log_resp(resp, body):
"""
When pyrax.get_http_debug() is True, outputs the response received
from the API request.
"""
if not pyrax.get_http_debug():
return
log = logging.getLogger("pyrax")
log.debug("RESP: %s\n%s", resp, resp.headers)
if body:
log.debug("RESP BO... | 0.002994 |
def __getDependenciesRecursiveWithProvider(self,
available_components = None,
search_dirs = None,
target = None,
traverse_links = False,
... | 0.012976 |
def decompress_decoder_1d(x, hparams, name=None):
"""Decoder that decompresses 1-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, compress_length, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, length, hparams.hidden_size].
"""
... | 0.008666 |
def get_active_subject_set(self, request):
"""Get a set containing all subjects for which the current connection has been
successfully authenticated."""
# Handle complete certificate in vendor specific extension.
if django.conf.settings.DEBUG_GMN:
if 'HTTP_VENDOR_INCLUDE_CERT... | 0.003472 |
def setup_package():
"""
Setup the package.
"""
with open('requirements.txt', 'r') as req_file:
install_reqs = req_file.read().split('\n')
cmdclass_ = {'antlr': AntlrBuildCommand}
cmdclass_.update(versioneer.get_cmdclass())
setup(
version=versioneer.get_version(),
n... | 0.000862 |
def stream(self, id, task, type, follow=False, offset=0, origin="start", plain=False):
""" This endpoint streams a task's stderr/stdout logs.
https://www.nomadproject.io/api/client.html#stream-logs
arguments:
- id: (str) allocation_id required
- task: (str) ... | 0.005245 |
def create_widgets(self):
"""Build basic components of dialog."""
self.bbox = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.idx_ok = self.bbox.button(QDialogButtonBox.Ok)
self.idx_cancel = self.bbox.button(QDialogButtonBox.Cancel)
self.idx... | 0.002621 |
def agent_pools(self):
"""Instance depends on the API version:
* 2019-02-01: :class:`AgentPoolsOperations<azure.mgmt.containerservice.v2019_02_01.operations.AgentPoolsOperations>`
"""
api_version = self._get_api_version('agent_pools')
if api_version == '2019-02-01':
... | 0.009231 |
def post_structure(entry, site):
"""
A post structure with extensions.
"""
author = entry.authors.all()[0]
return {'title': entry.title,
'description': six.text_type(entry.html_content),
'link': '%s://%s%s' % (PROTOCOL, site.domain,
entry.ge... | 0.000752 |
def _get_common_params(self, user_id, attributes):
""" Get params which are used same in both conversion and impression events.
Args:
user_id: ID for user.
attributes: Dict representing user attributes and values which need to be recorded.
Returns:
Dict consisting of parameters common to ... | 0.004075 |
def from_fileobj(cls, fileobj):
"""A new _WavPackHeader or raises WavPackHeaderError"""
header = fileobj.read(32)
if len(header) != 32 or not header.startswith(b"wvpk"):
raise WavPackHeaderError("not a WavPack header: %r" % header)
block_size = cdata.uint_le(header[4:8])
... | 0.002245 |
def _update_day_dict(self, data_point, day_dict):
"""
Helper method for :meth:`_print_daily_stats`. Given a data point and
the correct day dict, update attribs on the dict with the contents
of the data point.
:param dict data_point: The data point to add to the day's sta... | 0.005254 |
async def list(cls, fields: Iterable[str] = None) -> Sequence[dict]:
'''
Lists the keypair resource policies.
You need an admin privilege for this operation.
'''
if fields is None:
fields = (
'name', 'created_at',
'total_resource_slots'... | 0.002252 |
def letter_score(letter):
"""Returns the Scrabble score of a letter.
Args:
letter: a single character string
Raises:
TypeError if a non-Scrabble character is supplied
"""
score_map = {
1: ["a", "e", "i", "o", "u", "l", "n", "r", "s", "t"],
2: ["d", "g"],
3:... | 0.001603 |
def _run_rtg_eval(vrn_file, rm_file, rm_interval_file, base_dir, data, validate_method):
"""Run evaluation of a caller against the truth set using rtg vcfeval.
"""
out_dir = os.path.join(base_dir, "rtg")
if not utils.file_exists(os.path.join(out_dir, "done")):
if os.path.exists(out_dir):
... | 0.00398 |
def updateMesh(self, polydata):
"""
Overwrite the polygonal mesh of the actor with a new one.
"""
self.poly = polydata
self.mapper.SetInputData(polydata)
self.mapper.Modified()
return self | 0.008197 |
def zero_pad(m, n=1):
"""Pad a matrix with zeros, on all sides."""
return np.pad(m, (n, n), mode='constant', constant_values=[0]) | 0.007299 |
def spellCheckTextgrid(tg, targetTierName, newTierName, isleDict,
printEntries=False):
'''
Spell check words by using the praatio spellcheck function
Incorrect items are noted in a new tier and optionally
printed to the screen
'''
def checkFunc(word):
... | 0.008915 |
def create(self, deal_id, *args, **kwargs):
"""
Create an associated contact
Creates a deal's associated contact and its role
If the specified deal or contact does not exist, the request will return an error
:calls: ``post /deals/{deal_id}/associated_contacts``
:param i... | 0.006256 |
def imsave(filename, data, photometric=None, planarconfig=None,
resolution=None, description=None, software='tifffile.py',
byteorder=None, bigtiff=False):
"""Write image data to TIFF file.
Image data are written uncompressed in one stripe per plane.
Dimensions larger than 2 or 3 (depe... | 0.001024 |
def batch_star(self, path):
"""Evaluate the commands contained in the specific path.
The Python equivalent of the CLIPS batch* command.
"""
if lib.EnvBatchStar(self._env, path.encode()) != 1:
raise CLIPSError(self._env) | 0.007547 |
def refresh(self):
"""
Keeps the lease alive by streaming keep alive requests from the client
to the server and streaming keep alive responses from the server to
the client.
:returns: Response header.
:rtype: instance of :class:`txaioetcd.Header`
"""
if s... | 0.00431 |
def _openpyxl_read_xl(xl_path: str):
""" Use openpyxl to read an Excel file. """
try:
wb = load_workbook(filename=xl_path, read_only=True)
except:
raise
else:
return wb | 0.009615 |
def _delocalize_logging_command(self, logging_path, user_project):
"""Returns a command to delocalize logs.
Args:
logging_path: location of log files.
user_project: name of the project to be billed for the request.
Returns:
eg. 'gs://bucket/path/myfile' or 'gs://bucket/script-foobar-12'
... | 0.005495 |
def do_timeout(self, args):
"""Get or set timeout (in ms) for resource in use.
Get timeout:
timeout
Set timeout:
timeout <mstimeout>
"""
if not self.current:
print('There are no resources in use. Use the command "open".')
retu... | 0.004076 |
def ekf_ext_send(self, timestamp, Windspeed, WindDir, WindZ, Airspeed, beta, alpha, force_mavlink1=False):
'''
Extended EKF state estimates for ASLUAVs
timestamp : Time since system start [us] (uint64_t)
Windspeed : Magnitu... | 0.009278 |
def add_connection_throttle(self, maxConnectionRate=None,
maxConnections=None, minConnections=None, rateInterval=None):
"""
Updates the connection throttling information for the load balancer with
the supplied values. At least one of the parameters must be supplied.
"""
... | 0.011747 |
def datafind_keep_unique_backups(backup_outs, orig_outs):
"""This function will take a list of backup datafind files, presumably
obtained by querying a remote datafind server, e.g. CIT, and compares
these against a list of original datafind files, presumably obtained by
querying the local datafind serve... | 0.000591 |
def to_inference_data(self):
"""Convert all available data to an InferenceData object.
Note that if groups can not be created (i.e., there is no `trace`, so
the `posterior` and `sample_stats` can not be extracted), then the InferenceData
will not have those groups.
"""
... | 0.004559 |
def sort_dict(d, desc=True):
"""
Sort an ordered dictionary by value, descending.
Args:
d (OrderedDict): An ordered dictionary.
desc (bool): If true, sort desc.
Returns:
OrderedDict: The sorted dictionary.
"""
sort = sorted(d.items(), key=lambda x: x[1], reverse=desc)... | 0.002865 |
def getProjectArea(self, projectarea_name, archived=False,
returned_properties=None):
"""Get :class:`rtcclient.project_area.ProjectArea` object by its name
:param projectarea_name: the project area name
:param archived: (default is False) whether the project area
... | 0.001983 |
def serialize(message):
"""
Serialize a message to a udp packet
:type message: Message
:param message: the message to be serialized
:rtype: stream of byte
:return: the message serialized
"""
fmt = "!BBH"
if message.token is None or message.token ... | 0.000971 |
def read_10x_h5(filename, genome=None, gex_only=True) -> AnnData:
"""Read 10x-Genomics-formatted hdf5 file.
Parameters
----------
filename : `str` | :class:`~pathlib.Path`
Filename.
genome : `str`, optional (default: ``None``)
Filter expression to this genes within this genome. For ... | 0.002075 |
def get_job_logs(id):
"""Get the crawl logs from the job."""
crawler_job = models.CrawlerJob.query.filter_by(id=id).one_or_none()
if crawler_job is None:
click.secho(
(
"CrawlJob %s was not found, maybe it's not a crawl job?" %
id
),
... | 0.001364 |
def attrput(self, groupname, attrname, rownr, value, unit=[], meas=[]):
"""Put the value and optionally unit and measinfo
of an attribute in a row in a group."""
return self._attrput(groupname, attrname, rownr, value, unit, meas) | 0.007813 |
def from_sym_2_tri(symm):
"""convert a 2D symmetric matrix to an upper
triangular matrix in 1D format
Parameters
----------
symm : 2D array
Symmetric matrix
Returns
-------
tri: 1D array
Contains elements of upper triangular matrix
"""
inds = np.triu_... | 0.002674 |
def get_line_for_offset(self, code_offset):
"""
returns the line number given a code offset
"""
prev_line = 0
for (offset, line) in self.get_linenumbertable():
if offset < code_offset:
prev_line = line
elif offset == code_offset:
... | 0.004808 |
def create_or_update_role(self, name, azure_roles, ttl="", max_ttl="", mount_point=DEFAULT_MOUNT_POINT):
"""Create or update a Vault role.
The provided Azure roles must exist for this call to succeed. See the Azure secrets roles docs for more
information about roles.
Supported methods:... | 0.0053 |
def state(self, *args, **kwargs):
"""
Get AWS State for a worker type
Return the state of a given workertype as stored by the provisioner.
This state is stored as three lists: 1 for running instances, 1 for
pending requests. The `summary` property contains an updated summary
... | 0.003968 |
def p_statement_try(p):
'statement : TRY LBRACE inner_statement_list RBRACE CATCH LPAREN fully_qualified_class_name VARIABLE RPAREN LBRACE inner_statement_list RBRACE additional_catches'
p[0] = ast.Try(p[3], [ast.Catch(p[7], ast.Variable(p[8], lineno=p.lineno(8)),
p[11], line... | 0.007813 |
def average_temperature(self, unit='kelvin'):
"""Returns the average value in the temperature series
:param unit: the unit of measure for the temperature values. May be
among: '*kelvin*' (default), '*celsius*' or '*fahrenheit*'
:type unit: str
:returns: a float
... | 0.003052 |
def _get_stats_table(self, table_id, kind='R', summary=False):
"""Gets a stats table from the player page; helper function that does
the work for per-game, per-100-poss, etc. stats.
:table_id: the ID of the HTML table.
:kind: specifies regular season, playoffs, or both. One of 'R', 'P',... | 0.002801 |
def follow_cf(save, Uspan, target_cf, nup, n_tot=5.0, slsp=None):
"""Calculates the quasiparticle weight in single
site spin hamiltonian under with N degenerate half-filled orbitals """
if slsp == None:
slsp = Spinon(slaves=6, orbitals=3, avg_particles=n_tot,
hopping=[0.5]... | 0.012648 |
def _boundsspec2slicespec(boundsspec,scs):
"""
Convert an iterable boundsspec (supplying l,b,r,t of a
BoundingRegion) into a Slice specification.
Includes all units whose centers are within the specified
sheet-coordinate bounds specified by boundsspec.
Exact inverse of ... | 0.018233 |
def get_replication_group_imbalance_stats(rgs, partitions):
"""Calculate extra replica count replica count over each replication-group
and net extra-same-replica count.
"""
tot_rgs = len(rgs)
extra_replica_cnt_per_rg = defaultdict(int)
for partition in partitions:
# Get optimal replica-c... | 0.000949 |
def get_contract_from_name(self, contract_name):
"""
Return a contract from a name
Args:
contract_name (str): name of the contract
Returns:
Contract
"""
return next((c for c in self.contracts if c.name == contract_name), None) | 0.009934 |
def getallstates(self, window_name, object_name):
"""
Get all states of given object
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to look for, either full ... | 0.003306 |
def hide_routemap_holder_route_map_content_continue_holder_cont(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy")
route_map = ET.SubElement... | 0.004224 |
def ndb_put(self, entity):
"""Like put(), but for NDB entities."""
assert ndb is not None and isinstance(entity, ndb.Model)
self.ndb_puts.append(entity) | 0.006098 |
def compile_msg_payload(self, invite):
""" Determine recipient, message content, return it as
a dict that can be Posted to the message sender
"""
self.l.info("Compiling the outbound message payload")
update_invite = False
# Determine the recipient address
if "to_... | 0.001548 |
def state_load(self, f, use_active_range=False):
"""Load a state previously stored by :meth:`DataFrame.state_store`, see also :meth:`DataFrame.state_set`."""
state = vaex.utils.read_json_or_yaml(f)
self.state_set(state, use_active_range=use_active_range) | 0.010791 |
def interpolator(self, x, values):
"""
Returns a polynomial with vector coefficients which interpolates the values at the Chebyshev points x
"""
# hacking the barycentric interpolator by computing the weights in advance
p = Bary([0.])
N = len(values)
weights = np.... | 0.00823 |
def is_rotation(self, other):
'''Determine whether two sequences are the same, just at different
rotations.
:param other: The sequence to check for rotational equality.
:type other: coral.sequence._sequence.Sequence
'''
if len(self) != len(other):
return Fal... | 0.004464 |
def get_template_names(self):
"""
datagrid的默认模板
"""
names = super(EasyUIDeleteView, self).get_template_names()
names.append('easyui/confirm_delete.html')
return names | 0.009346 |
def _make_query_from_terms(self, terms, limit=None):
""" Creates a query for partition from decomposed search terms.
Args:
terms (dict or unicode or string):
Returns:
tuple of (TextClause, dict): First element is FTS query, second is
parameters of the query.... | 0.003729 |
def startLogin():
"""
If we are not logged in, this generates the redirect URL to the OIDC
provider and returns the redirect response
:return: A redirect response to the OIDC provider
"""
flask.session["state"] = oic.oauth2.rndstr(SECRET_KEY_LENGTH)
flask.session["nonce"] = oic.oauth2.rndstr... | 0.001305 |
def _nose_tools_trivial_transform():
"""Custom transform for the nose.tools module."""
stub = _BUILDER.string_build("""__all__ = []""")
all_entries = ["ok_", "eq_"]
for pep8_name, method in _nose_tools_functions():
all_entries.append(pep8_name)
stub[pep8_name] = method
# Update the... | 0.001779 |
def _from_any_pb(pb_type, any_pb):
"""Converts an Any protobuf to the specified message type
Args:
pb_type (type): the type of the message that any_pb stores an instance
of.
any_pb (google.protobuf.any_pb2.Any): the object to be converted.
Returns:
pb_type: An instance ... | 0.001546 |
def _cut_time(gammas):
"""Support function for iat().
Find cutting time, when gammas become negative."""
for i in range(len(gammas) - 1):
if not ((gammas[i + 1] > 0.0) & (gammas[i + 1] < gammas[i])):
return i
return i | 0.003906 |
def populate_schema_objects(self, schema, obj_type):
"""Returns list of tables or functions for a (optional) schema"""
metadata = self.dbmetadata[obj_type]
schema = schema or self.dbname
try:
objects = metadata[schema].keys()
except KeyError:
# schema doe... | 0.005277 |
def sample(self, bqm, **kwargs):
"""Sample from the problem provided by bqm and truncate output.
Args:
bqm (:obj:`dimod.BinaryQuadraticModel`):
Binary quadratic model to be sampled from.
**kwargs:
Parameters for the sampling method, specified by ... | 0.003096 |
def MLOAD(self, address):
"""Load word from memory"""
self._allocate(address, 32)
value = self._load(address, 32)
return value | 0.012658 |
def execute(self, args):
"""Execute show subcommand."""
if args.name is not None:
self.show_workspace(slashes2dash(args.name))
elif args.all is not None:
self.show_all() | 0.009217 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.