text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def OnCellFont(self, event):
"""Cell font event handler"""
with undo.group(_("Font")):
self.grid.actions.set_attr("textfont", event.font)
self.grid.ForceRefresh()
self.grid.update_attribute_toolbar()
event.Skip() | 0.007463 |
def iter_predecessors(self, graph, dest, branch, turn, tick, *, forward=None):
"""Iterate over predecessors to a given destination node at a given time."""
if self.db._no_kc:
yield from self._adds_dels_sucpred(self.predecessors[graph, dest], branch, turn, tick)[0]
return
... | 0.010707 |
def route_stanza(self, stanza):
"""Process stanza not addressed to us.
Return "recipient-unavailable" return if it is not
"error" nor "result" stanza.
This method should be overriden in derived classes if they
are supposed to handle stanzas not addressed directly to local
... | 0.003252 |
def find_requirements(filename):
"""
Find requirements in file.
"""
import string
content = read(filename)
requirements = []
for line in content.splitlines():
line = line.strip()
if line and line[:1] in string.ascii_letters:
requirements.append(line)
return re... | 0.00303 |
def source_file_name(self):
"""
File name where the object is implemented (e.g. pandas/core/frame.py).
"""
try:
fname = inspect.getsourcefile(self.code_obj)
except TypeError:
# In some cases the object is something complex like a cython
# objec... | 0.00339 |
def gp_norm(infile):
"""indentify normalization region"""
inDir, outDir = getWorkDirs()
data, titles = [], []
for eidx,energy in enumerate(['19', '27', '39', '62']):
file_url = os.path.realpath(os.path.join(
inDir, 'rawdata', energy, 'pt-integrated', infile+'.dat'
))
... | 0.024612 |
def load_forecasts(self):
"""
Load the forecast files into memory.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
for model_name in self.model_names:
self.raw_forecasts[model_name] = {}
forecast_file = self.forecast_path + run_date_str + "/" + \
... | 0.005353 |
def _chk_docopt_kws(self, docdict, exp):
"""Check for common user errors when running from the command-line."""
for key, val in docdict.items():
if isinstance(val, str):
assert '=' not in val, self._err("'=' FOUND IN VALUE", key, val, exp)
elif key != 'help' and k... | 0.008889 |
def get_ignored_files(self):
"""Returns the list of files being ignored in this repository.
Note that file names, not directories, are returned.
So, we will get the following:
a/b.txt
a/c.txt
instead of just:
a/
Returns:
List[str] - list ... | 0.003521 |
def add_bridge(self, bridge):
""" Add bridge groups.
:param bridge: Add groups from this bridge.
"""
for group in bridge.groups:
self._groups[group.name] = group | 0.009709 |
def pull(collector, image, **kwargs):
"""Pull an image"""
if not image.image_index:
raise BadOption("The chosen image does not have a image_index configuration", wanted=image.name)
tag = kwargs["artifact"]
if tag is NotSpecified:
collector.configuration["harpoon"].tag
if tag is not N... | 0.004283 |
def sign(self, data, **kwargs):
"""Create a signature for a message string or file.
Note that this method is not for signing other keys. (In GnuPG's
terms, what we all usually call 'keysigning' is actually termed
'certification'...) Even though they are cryptographically the same
... | 0.000794 |
def detect_interval(
self,
min_head_length=None,
max_head_length=None,
min_tail_length=None,
max_tail_length=None
):
"""
Detect the interval of the audio file
containing the fragments in the text file.
Return the audio inte... | 0.002333 |
def make_eventrule(date_rule, time_rule, cal, half_days=True):
"""
Constructs an event rule from the factory api.
"""
# Insert the calendar in to the individual rules
date_rule.cal = cal
time_rule.cal = cal
if half_days:
inner_rule = date_rule & time_rule
else:
nhd_rule... | 0.002193 |
def _request_status(self):
""" Checks the api endpoint to check if the async job progress """
if self.item_id:
return True
response = self.con.get(self.monitor_url)
if not response:
return False
data = response.json()
self.status = data.get('sta... | 0.003515 |
def valid_status(*valid):
"""Decorator to assert that we're in a valid state."""
def decorator(func):
@functools.wraps(func)
def _valid_status(self, *args, **kwargs):
if self.status not in valid:
raise protocol.ProtocolError(
"`%s` called while in state: %s, valid: (%s)" % (
... | 0.012766 |
def auto_detect(self, args):
"""Check for already Slackware binary packages exist
"""
suffixes = [
".tgz",
".txz",
".tbz",
".tlz"
]
if (not args[0].startswith("-") and args[0] not in self.commands and
args[0].endswit... | 0.002342 |
def normalize_hostname(hostname):
'''Normalizes a hostname so that it is ASCII and valid domain name.'''
try:
new_hostname = hostname.encode('idna').decode('ascii').lower()
except UnicodeError as error:
raise UnicodeError('Hostname {} rejected: {}'.format(hostname, error)) from error
if... | 0.004329 |
def split_segments(text, closing_paren=False):
"""Return objects representing segments."""
buf = StringIO()
# The segments we're building, and the combinators used to combine them.
# Note that after this is complete, this should be true:
# len(segments) == len(combinators) + 1
# Thus we can und... | 0.000279 |
def create(self, type, friendly_name=values.unset, certificate=values.unset,
private_key=values.unset, sandbox=values.unset, api_key=values.unset,
secret=values.unset):
"""
Create a new CredentialInstance
:param CredentialInstance.PushService type: The Credential t... | 0.00657 |
def _load_from_yaml(self, filename: str, model_identifiers: Dict[str, List[str]]):
"""
Load fixtures from the given filename
"""
class_name = filename[:filename.rfind('.')]
rendered_yaml = self.env.get_template(filename).render(
model_identifiers=model_identifiers)
... | 0.006431 |
def _read_record(self, stream):
"""
Read a complete record from a GDSII stream file.
Parameters
----------
stream : file
GDSII stream file to be imported.
Returns
-------
out : 2-tuple
Record type and data (as a numpy.array)
... | 0.001078 |
def str_strip(arr, to_strip=None, side='both'):
"""
Strip whitespace (including newlines) from each string in the
Series/Index.
Parameters
----------
to_strip : str or unicode
side : {'left', 'right', 'both'}, default 'both'
Returns
-------
Series or Index
"""
if side =... | 0.006667 |
def create_from_stack(cls, shape, components, ylims, weights=None):
""" Combine the log-likelihoods from a number of components.
Parameters
----------
shape : tuple
The shape of the return array
components : [~fermipy.castro.CastroData_Base]
The compo... | 0.003145 |
def run(sc, map_fun, tf_args, num_executors, num_ps, tensorboard=False, input_mode=InputMode.TENSORFLOW,
log_dir=None, driver_ps_nodes=False, master_node=None, reservation_timeout=600, queues=['input', 'output', 'error'],
eval_node=False):
"""Starts the TensorFlowOnSpark cluster and Runs the TensorFlo... | 0.014469 |
def target(key, full=True):
'''
Return the basename of a SysFS key path
:param key: the location to resolve within SysFS
:param full: full path instead of basename
:return: fullpath or basename of path
CLI example:
.. code-block:: bash
salt '*' sysfs.read class/ttyS0
'''
... | 0.001653 |
def module(self):
"""The module in which the Function is defined.
Python equivalent of the CLIPS deffunction-module command.
"""
modname = ffi.string(lib.EnvDeffunctionModule(self._env, self._fnc))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self... | 0.005935 |
def update(self, key, item):
"""
Update item into hash table with specified key and item.
If key is already present, destroys old item and inserts new one.
Use free_fn method to ensure deallocator is properly called on item.
"""
return lib.zhash_update(self._as_parameter_, key, item) | 0.006329 |
def parse_input(command_input=None):
"""Parses command line input."""
parser = argparse.ArgumentParser(
prog='python3 ok',
description=__doc__,
usage='%(prog)s [--help] [options]',
formatter_class=argparse.RawDescriptionHelpFormatter)
testing = parser.add_argument_group('run... | 0.006241 |
def set_from_template_string(self, string):
"""
Reads the given template (SMTP formatted) and sets all fields
accordingly.
:type string: string
:param string: The template.
"""
in_header = True
body = ''
for line in string.split('\n'):
... | 0.001894 |
def _config_net_topology(self, conf):
"""
Initialize and populate all the network related elements, like
reserving ips and populating network specs of the given confiiguration
spec
Args:
conf (dict): Configuration spec to initalize
Returns:
None
... | 0.003401 |
def beat_track(input_file, output_csv):
'''Beat tracking function
:parameters:
- input_file : str
Path to input audio file (wav, mp3, m4a, flac, etc.)
- output_file : str
Path to save beat event timestamps as a CSV file
'''
print('Loading ', input_file)
y, sr = lib... | 0.001065 |
def kullback_leibler(h1, h2): # 83 us @array, 109 us @list \w 100 bins
r"""
Kullback-Leibler divergence.
Compute how inefficient it would to be code one histogram into another.
Actually computes :math:`\frac{d_{KL}(h1, h2) + d_{KL}(h2, h1)}{2}` to achieve symmetry.
The Kullback-Leibler div... | 0.010303 |
def _single_resource_json_response(resource, depth=0):
"""Return the JSON representation of *resource*.
:param resource: :class:`sandman.model.Model` to render
:type resource: :class:`sandman.model.Model`
:rtype: :class:`flask.Response`
"""
links = resource.links()
response = jsonify(**res... | 0.001727 |
def galactic_latlon(self):
"""Compute galactic coordinates (lat, lon, distance)"""
vector = _GALACTIC.dot(self.position.au)
d, lat, lon = to_polar(vector)
return (Angle(radians=lat, signed=True),
Angle(radians=lon),
Distance(au=d)) | 0.00678 |
def transform(self, jam):
'''Bypass transformations.
Parameters
----------
jam : pyjams.JAMS
A muda-enabled JAMS object
Yields
------
jam_out : pyjams.JAMS iterator
The first result is `jam` (unmodified), by reference
All subs... | 0.003534 |
def tile(self, z, x, y):
"""
Download the specified tile from `tiles_url`
"""
logger.debug(_("Download tile %s") % ((z, x, y),))
# Render each keyword in URL ({s}, {x}, {y}, {z}, {size} ... )
size = self.tilesize
s = self.tiles_subdomains[(x + y) % len(self.tiles_... | 0.003751 |
def makeDigraph(automaton, inputAsString=repr,
outputAsString=repr,
stateAsString=repr):
"""
Produce a L{graphviz.Digraph} object from an automaton.
"""
digraph = graphviz.Digraph(graph_attr={'pack': 'true',
'dpi': '100'},
... | 0.000596 |
def chdir(new_dir):
"""
stolen from bcbio.
Context manager to temporarily change to a new directory.
http://lucentbeing.com/blog/context-managers-and-the-with-statement-in-python/
"""
cur_dir = os.getcwd()
_mkdir(new_dir)
os.chdir(new_dir)
try:
yield
finally:
os.... | 0.002994 |
def load_x11_color_map(paths=X11_RGB_PATHS):
''' Load and parse X11's rgb.txt.
Loads:
x11_color_map: { name_lower: ('R', 'G', 'B') }
'''
if type(paths) is str:
paths = (paths,)
x11_color_map = color_tables.x11_color_map
for path in paths:
try:
with o... | 0.000981 |
def get_credentials():
"""Gets valid user credentials from storage.
If nothing has been stored, or if the stored credentials are invalid,
the OAuth2 flow is completed to obtain the new credentials.
Returns:
Credentials, the obtained credential.
"""
home_dir = os.path.expanduser('~')
... | 0.00185 |
def get_item_list(self, item_list_url):
""" Retrieve an item list from the server as an ItemList object
:type item_list_url: String or ItemList
:param item_list_url: URL of the item list to retrieve, or an
ItemList object
:rtype: ItemList
:returns: The ItemList
... | 0.003839 |
def export_kml_file(self):
"""Generate KML element tree from ``Placemarks``.
Returns:
etree.ElementTree: KML element tree depicting ``Placemarks``
"""
kml = create_elem('kml')
kml.Document = create_elem('Document')
for place in sorted(self.values(), key=lambd... | 0.004773 |
def emit(self, name, *args, **kwargs):
"""Dispatches an event to any subscribed listeners
Note:
If a listener returns :obj:`False`, the event will stop dispatching to
other listeners. Any other return value is ignored.
Args:
name (str): The name of the :clas... | 0.004688 |
def _get_minidom_tag_value(station, tag_name):
"""get a value from a tag (if it exists)"""
tag = station.getElementsByTagName(tag_name)[0].firstChild
if tag:
return tag.nodeValue
return None | 0.004651 |
def _build(self, inputs):
"""Connects the MergeDims module into the graph.
Args:
inputs: Tensor or a nested list of Tensors to merge. Its rank must be
greater than or equal to `start` + `size`.
Returns:
The merged Tensor or a nested list of merged Tensors.
Raises:
ValueErr... | 0.004808 |
def measureSize(self, diffTo, diffFrom, estimatedSize, chunkSize, isInteractive):
""" Spend some time to get an accurate size. """
diff = self.toObj.diff(diffTo, diffFrom, estimatedSize)
isInteractive = self.toObj.bool(isInteractive)
self.butterStore.showProgress = None if isInteractive ... | 0.007026 |
def get_length(self, byte_stream):
''' In Hadoop protobuf RPC, some parts of the stream are delimited with protobuf varint,
while others are delimited with 4 byte integers. This reads 4 bytes from the byte stream
and retruns the length of the delimited part that follows, by unpacking the 4 bytes... | 0.009756 |
def batch_rename_file(path, f, t):
"""根据replaces中定义的规则,批量重命名"""
files = os.listdir(path)
for file in files:
if f in file:
new_fn = file.replace(f, t)
old = os.path.join(path, file)
new = os.path.join(path, new_fn)
os.rename(old, new) | 0.003322 |
def getSaveFileName(self, *args, **kwargs):
"""
analogue to QtWidgets.QFileDialog.getSaveFileNameAndFilter
but returns the filename + chosen file ending even if not typed in gui
"""
if 'directory' not in kwargs:
if self.opts['save']:
if self.opts['save... | 0.004771 |
def pixel_coord(self):
"""
Return the coordinates of the source in the cutout reference frame.
@return:
"""
return self.get_pixel_coordinates(self.reading.pix_coord, self.reading.get_ccd_num()) | 0.012876 |
def change_history_fields(self, fields, value=None):
r"""
"""
if not isinstance(fields, list):
raise Exception('fields should be a list')
self._change_history['fields'] = fields
if value:
self._change_history['value'] = value
return self | 0.00641 |
def from_dict(cls, data):
"""Transforms a Python dictionary to an Output object.
Note:
To pass a serialization cycle multiple times, a
Cryptoconditions Fulfillment needs to be present in the
passed-in dictionary, as Condition URIs are not serializable... | 0.003178 |
def CheckCommandSpaces(filename, linenumber, clean_lines, errors):
"""
No extra spaces between command and parenthesis
"""
line = clean_lines.lines[linenumber]
match = ContainsCommand(line)
if match and len(match.group(2)):
errors(filename, linenumber, 'whitespace/extra',
... | 0.004032 |
def send_response(self, code, message=None):
"""Add the response header to the headers buffer and log the
response code.
Also send two standard headers with the server software
version and the current date.
"""
self.log_request(code)
self.send_response_only(code... | 0.004484 |
def _link_fastqs(self, path=None, force=False, append=False, splitnames="_",
fields=None, ipyclient=None):
"""
Create Sample objects from demultiplexed fastq files in sorted_fastq_path,
or append additional fastq files to existing Samples. This provides
more flexible file input t... | 0.006066 |
def _sorted_resource_labels(labels):
"""Sort label names, putting well-known resource labels first."""
head = [label for label in TOP_RESOURCE_LABELS if label in labels]
tail = sorted(label for label in labels if label not in TOP_RESOURCE_LABELS)
return head + tail | 0.007117 |
def hook(name=None, priority=-1):
"""
Decorator
"""
def _hook(hook_func):
return register_hook(name, hook_func=hook_func, priority=priority)
return _hook | 0.005464 |
def get_queryset(self):
"""
Check if relation_names is correctly set and
do a prefetch related on the queryset with it.
"""
if self.relation_names is None:
raise ImproperlyConfigured(
"'%s' must define 'relation_names'" %
self.__class__... | 0.002972 |
def update(self, path, data=None):
"""Send an update request to the given path of the CRUD API, with the given data dict, which will be converted
into json"""
return self.handleresult(self.r.put(urljoin(self.url + CRUD_PATH,
path),
... | 0.008 |
def unset_values(self):
"""
Resets the user values of all symbols, as if Kconfig.load_config() or
Symbol.set_value() had never been called.
"""
self._warn_for_no_prompt = False
try:
# set_value() already rejects undefined symbols, and they don't
# ... | 0.003003 |
def is_valid_folder(parser, arg):
"""Check if arg is a valid file that already exists on the file system."""
arg = os.path.abspath(arg)
if not os.path.isdir(arg):
parser.error("The folder %s does not exist!" % arg)
else:
return arg | 0.003802 |
def _guess_next_poll_interval(self):
"""
Determine when to query the progress status next.
This function is used if the external progress function did not return time interval for when it should be
queried next.
"""
time_elapsed = self._progress_data[-1][0] - self._progr... | 0.006593 |
def scalarcoords(self):
"""A dictionary of values that don't label any axes (point-like)."""
return {k: v.values for k, v in self.coords.items() if v.dims==()} | 0.017143 |
def nltides_gw_phase_difference(f, f0, amplitude, n, m1, m2):
"""Calculate the gravitational-wave phase shift bwtween
f and f_coalescence = infinity due to non-linear tides.
To compute the phase shift between e.g. f_low and f_isco,
call this function twice and compute the difference.
Parameters
... | 0.000787 |
def index(request, template_name="index.html"):
"""\
The index view, which basically just displays a button and increments
a counter.
"""
if request.GET.get('ic-request'):
counter, created = Counter.objects.get_or_create(pk=1)
counter.value += 1
counter.save()
else:
... | 0.001923 |
def currentSchemaPath(self):
"""
Returns the column path for the current item. This will be a '.'
joined path based on the root schema to the given column.
:return <str>
"""
item = self.currentItem()
path = []
while item:
... | 0.008969 |
def configure_urls(apps, index_view=None, prefixes=None):
'''
Configure urls from a list of apps.
'''
prefixes = prefixes or {}
urlpatterns = patterns('')
if index_view:
from django.views.generic.base import RedirectView
urlpatterns += patterns('',
url(r'^$', Redirec... | 0.004673 |
def open_resource(self, resource, *mode):
"""
Return an open file object for a particular named resource in this
reference package.
"""
return self.open(self.resource_name(resource), *mode) | 0.008734 |
def pl_resolve(ci, cj):
"""Return all clauses that can be obtained by resolving clauses ci and cj.
>>> for res in pl_resolve(to_cnf(A|B|C), to_cnf(~B|~C|F)):
... ppset(disjuncts(res))
set([A, C, F, ~C])
set([A, B, F, ~B])
"""
clauses = []
for di in disjuncts(ci):
for dj in dis... | 0.001776 |
def get_setter(cls, prop_name, # @NoSelf
user_setter=None, setter_takes_name=False,
user_getter=None, getter_takes_name=False):
"""Similar to get_getter, but for setting property
values. If user_getter is specified, that it may be used to
get the old value... | 0.005825 |
def draw_hsv(mag, ang, dtype=uint8, fn=None):
"""
mag must be uint8, uint16, uint32 and 2-D
ang is in radians (float)
"""
assert mag.shape == ang.shape
assert mag.ndim == 2
maxval = iinfo(dtype).max
hsv = dstack(((degrees(ang)/2).astype(dtype), # /2 to keep less than 255
... | 0.003241 |
def rename_with_prefix(self, prefix="", new_path=None, in_place=True, remove_desc=True):
"""Rename every sequence based on a prefix."""
# Temporary path #
if new_path is None: prefixed = self.__class__(new_temp_path())
else: prefixed = self.__class__(new_path)
# Ge... | 0.010499 |
def make_osa_report(repo_dir, old_commit, new_commit,
args):
"""Create initial RST report header for OpenStack-Ansible."""
update_repo(repo_dir, args.osa_repo_url, args.update)
# Are these commits valid?
validate_commits(repo_dir, [old_commit, new_commit])
# Do we have a valid ... | 0.001153 |
def update_sequence_rule(self, sequence_rule_form):
"""Updates an existing sequence rule.
arg: sequence_rule_form
(osid.assessment.authoring.SequenceRuleForm): the form
containing the elements to be updated
raise: IllegalState - ``sequence_rule_form`` already... | 0.003967 |
def is_prime(n):
"""
Check if n is a prime number
"""
if n % 2 == 0 and n > 2:
return False
return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2)) | 0.005525 |
def _get_env_vars_value(filename):
"""
If the user provided a file containing values of environment variables, this method will read the file and
return its value
:param string filename: Path to file containing environment variable values
:return dict: Value of environment varia... | 0.007795 |
def __post(self, path, **kargs):
'''
Make a HTTP POST request to the Dominos UK API with the given
parameters for the current session.
:param string path: The API endpoint path.
:params list kargs: A list of arguments.
:return: A response from the Dominos UK API.
... | 0.004728 |
def strip_brackets(text, brackets=None):
"""Strip brackets and what is inside brackets from text.
.. note::
If the text contains only one opening bracket, the rest of the text
will be ignored. This is a feature, not a bug, as we want to avoid that
this function raises errors too easily.... | 0.002049 |
def _get_labels_left(self, validate=None):
"""Get all labels of the left dataframe."""
labels = []
for compare_func in self.features:
labels = labels + listify(compare_func.labels_left)
# check requested labels (for better error messages)
if not is_label_dataframe... | 0.004255 |
def get_standard_vars(cls, context, variant, build_type, install,
build_path, install_path=None):
"""Returns a standard set of environment variables that can be set
for the build system to use
"""
from rez.config import config
package = variant.parent
... | 0.002119 |
def pick_q_v1(self):
"""Update inflow."""
flu = self.sequences.fluxes.fastaccess
inl = self.sequences.inlets.fastaccess
flu.qin = 0.
for idx in range(inl.len_q):
flu.qin += inl.q[idx][0] | 0.004673 |
def ToJSon(self, columns_order=None, order_by=()):
"""Returns a string that can be used in a JS DataTable constructor.
This method writes a JSON string that can be passed directly into a Google
Visualization API DataTable constructor. Use this output if you are
hosting the visualization HTML on your si... | 0.002111 |
def to_(self, attrvals):
""" Create a list of Attribute instances.
:param attrvals: A dictionary of attributes and values
:return: A list of Attribute instances
"""
attributes = []
for key, value in attrvals.items():
key = key.lower()
attributes.a... | 0.003559 |
def getUnionLocations(encoder, x, y, r, step=1):
"""
Return a union of location encodings that correspond to the union of all locations
within the specified circle.
"""
output = np.zeros(encoder.getWidth(), dtype=defaultDtype)
locations = set()
for dx in range(-r, r+1, step):
for dy in range(-r, r+1, ... | 0.016771 |
def plot(self, atrix, atriy, fname=None, numtype='ndump',
legend=None, labelx=None, labely=None, indexx=None,
indexy=None, title=None, shape='.', logx=False,
logy=False, path='/', base=10, sparse=1, show=True, pdf=False,limits=None,
markevery=None, linewidth=1):
... | 0.01681 |
def new_stories(self, raw=False, limit=None):
"""Returns list of item ids of current new stories
Args:
limit (int): specifies the number of stories to be returned.
raw (bool): Flag to indicate whether to transform all
objects into raw json.
Returns:
... | 0.003623 |
def encode(self, s):
"""Transform a string with a filename into a list of float32.
Args:
s: path to the file with a waveform.
Returns:
samples: list of int16s
"""
# Make sure that the data is a single channel, 16bit, 16kHz wave.
# TODO(chorowski): the directory may not be writable,... | 0.008057 |
def create_parser(description):
"""
Create and return command-line argument parser.
"""
parser = argparse.ArgumentParser(description=description,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
display_types = get_display_types()
display_choices = [display for k, v in display_ty... | 0.005776 |
def generic_parse(self, node, pad=0):
"""A Generic parser for arbitrary tags in a node.
Parameters:
- node: A node in the DOM.
- pad: `int` (default: 0)
If 0 the node data is not padded with newlines. If 1 it
appends a newline after parsing the childNodes. I... | 0.002809 |
def get_plaintext_citations(bibtex):
"""
Parse a BibTeX file to get a clean list of plaintext citations.
:param bibtex: Either the path to the BibTeX file or the content of a \
BibTeX file.
:returns: A list of cleaned plaintext citations.
"""
parser = BibTexParser()
parser.cust... | 0.001318 |
def _compute_stationary(self):
"""
Store the stationary distributions in self._stationary_distributions.
"""
if self.is_irreducible:
if not self.is_sparse: # Dense
stationary_dists = gth_solve(self.P).reshape(1, self.n)
else: # Sparse
... | 0.002055 |
def delete_experiment(self):
'''Deletes the experiment.
See also
--------
:func:`tmserver.api.experiment.delete_experiment`
:class:`tmlib.models.experiment.ExperimentReference`
:class:`tmlib.models.experiment.Experiment`
'''
logger.info('delete experiment... | 0.003263 |
def from_grib_date_time(message, date_key='dataDate', time_key='dataTime', epoch=DEFAULT_EPOCH):
# type: (T.Mapping, str, str, datetime.datetime) -> int
"""
Return the number of seconds since the ``epoch`` from the values of the ``message`` keys,
using datetime.total_seconds().
:param message: the ... | 0.004111 |
def _find_schema(data_path, schema_name):
""" Checks if `schema_name` is a valid file, if not
searches in `data_path` for it. """
path = glob.glob(schema_name)
for p in path:
if os.path.isfile(p):
return p
return _find_data_path_schema(data_path, schema_name) | 0.003322 |
def default_reverse_key_func(full_key):
"""
Reverse of Django's default_key_func, i.e. undoing:
def default_key_func(key, key_prefix, version):
return '%s:%s:%s' % (key_prefix, version, key)
"""
match = reverse_key_re.match(full_key)
return match.group(3), match.group(1), int(ma... | 0.003003 |
def computeFunctional(x, cooP):
'''
Compute value of functional J(X) = ||PX - PA||^2_F,
where P is projector into index subspace of known elements,
X is our approximation,
A is original tensor.
Parameters:
:tt.vector: x
current approximation [X]
... | 0.00501 |
def logical_chassis_fwdl_status_output_cluster_fwdl_entries_fwdl_entries_blade_app(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
logical_chassis_fwdl_status = ET.Element("logical_chassis_fwdl_status")
config = logical_chassis_fwdl_status
output... | 0.004121 |
def get(self):
"""
Retrieve the GUI elements for program use.
:return: a dictionary containing all \
of the data from the key/value entries
"""
data = dict()
for label, entry in zip(self.keys, self.values):
data[label.cget('text')] = entry.get()
... | 0.00597 |
def _contains_span(span0, span1):
"""Return true if span0 contains span1, False otherwise."""
if (span0 == span1 or span0[0] > span1[0] or span0[1] < span1[1]):
return False
return True | 0.004878 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.