text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def load_transaction_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._transaction_configs:
self._transaction_configs[file_id] = self._... | 0.004444 |
def iter_window(g, window_size):
"""
interate over 'g' bit-by-bit and yield a window with the given 'window_size' width.
>>> for v in iter_window([1,2,3,4], window_size=2): v
[1, 2]
[2, 3]
[3, 4]
>>> for v in iter_window([1,2,3,4,5], window_size=3): v
[1, 2, 3]
[2, 3, 4]
[3, 4, ... | 0.00318 |
def _set_connector(self, v, load=False):
"""
Setter method for connector, mapped from YANG variable /hardware/connector (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_connector is considered as a private
method. Backends looking to populate this variable shou... | 0.003583 |
def get_env_args(env):
"""Yield options to inject into the slcli command from the environment."""
for arg, val in env.vars.get('global_args', {}).items():
if val is True:
yield '--%s' % arg
elif isinstance(val, int):
for _ in range(val):
yield '--%s' % arg... | 0.00237 |
def insert(self, index, *intvs):
"""Return a copy with ``intvs`` inserted before ``index``.
The given interval products are inserted (as a block) into ``self``,
yielding a new interval product whose number of dimensions is the
sum of the numbers of dimensions of all involved interval pr... | 0.000727 |
def _parse_commit_response(commit_response_pb):
"""Extract response data from a commit response.
:type commit_response_pb: :class:`.datastore_pb2.CommitResponse`
:param commit_response_pb: The protobuf response from a commit request.
:rtype: tuple
:returns: The pair of the number of index updates ... | 0.002721 |
def available_styles(self):
""" Returns a list of all styles defined for the item """
styles = self._schema_item.get("styles", [])
return list(map(operator.itemgetter("name"), styles)) | 0.009569 |
def getPcn(dsz, Nv, dimN=2, dimC=1, crp=False, zm=False):
"""Construct the constraint set projection function for convolutional
dictionary update problem.
Parameters
----------
dsz : tuple
Filter support size(s), specified using the same format as the `dsz`
parameter of :func:`bcrop`
... | 0.000849 |
def do_setup_for_pypi_python_org(self, repo):
'''
Configure repo to point to the default package index
https://pypi.python.org.
'''
effective_repo_name = self.get_effective_repo_name(repo)
self.abort_on_nonexisting_repo(
effective_repo_name, 'setup_for_pypi_py... | 0.004902 |
def run(self, reset_current_buffer=False, pre_run=None):
"""
Read input from the command line.
This runs the eventloop until a return value has been set.
:param reset_current_buffer: XXX: Not used anymore.
:param pre_run: Callable that is called right after the reset has taken
... | 0.002784 |
def _add_sequence(self, sequence):
"""
Add a Sequence to the document
"""
if sequence.identity not in self._sequences.keys():
self._sequences[sequence.identity] = sequence
else:
raise ValueError("{} has already been defined".format(sequence.identity)) | 0.009524 |
def get_account_info(self):
"""
Gets account info.
@return: AccountInfo
"""
attrs = {sconstant.A_BY: sconstant.V_NAME}
account = SOAPpy.Types.stringType(data=self.auth_token.account_name,
attrs=attrs)
params = {sconstant.... | 0.003552 |
def _merge_colormaps(kwargs):
"""Merge colormaps listed in kwargs."""
from trollimage.colormap import Colormap
full_cmap = None
palette = kwargs['palettes']
if isinstance(palette, Colormap):
full_cmap = palette
else:
for itm in palette:
cmap = create_colormap(itm)
... | 0.00188 |
def delete(self, jid, node, *, redirect_uri=None):
"""
Delete an existing node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to delete.
:type node: :class:`str` or :data:`None`
:param redirect_uri... | 0.001892 |
def get_tempfile(suffix='.txt', dirpath=None):
""" Return a temporary file with the given suffix within dirpath.
If dirpath is None, will look for a temporary folder in your system.
Parameters
----------
suffix: str
Temporary file name suffix
dirpath: str
Folder path where crea... | 0.001783 |
def write_to(self, f):
"""
Generates code based on the given module configuration and writes it to
the file object `f`.
"""
f = CodeWriter(f)
# Write all header files
headers = set()
for plugin in self.plugins:
headers = headers.union(plugin.h... | 0.00079 |
def default_resolve_fn(source, info, **args):
# type: (Any, ResolveInfo, **Any) -> Optional[Any]
"""If a resolve function is not given, then a default resolve behavior is used which takes the property of the source object
of the same name as the field and returns it as the result, or if it's a function, ret... | 0.005085 |
def _keyDown(key):
"""Performs a keyboard key press without the release. This will put that
key in a held down state.
NOTE: For some reason, this does not seem to cause key repeats like would
happen if a keyboard key was held down on a text field.
Args:
key (str): The key to be pressed down.... | 0.006626 |
def confd_state_internal_callpoints_validationpoint_registration_type_file_file(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
confd_state = ET.SubElement(config, "confd-state", xmlns="http://tail-f.com/yang/confd-monitoring")
internal = ET.SubElement(c... | 0.004571 |
def swap_priority(self, key1, key2):
"""
Fast way to swap the priority level of two items in the pqdict. Raises
``KeyError`` if either key does not exist.
"""
heap = self._heap
position = self._position
if key1 not in self or key2 not in self:
raise K... | 0.004141 |
def p_program_tokenstring(p):
""" program : defs NEWLINE
"""
try:
tmp = [str(x()) if isinstance(x, MacroCall) else x for x in p[1]]
except PreprocError as v:
error(v.lineno, v.message)
tmp.append(p[2])
p[0] = tmp | 0.003953 |
def submit_cookbook(self, cookbook, params={}, _extra_params={}):
"""
Submit a cookbook.
"""
self._check_user_parameters(params)
files = {'cookbook': cookbook}
return self._submit(params, files, _extra_params=_extra_params) | 0.00738 |
def setUp(self, item):
'''
Parameters:
item -- WSDLTools BindingOperation instance.
'''
if not isinstance(item, WSDLTools.OperationBinding):
raise TypeError, 'Expecting WSDLTools Operation instance'
if not item.input:
raise WSDLFormatError('No... | 0.009646 |
def dict_from_hdf5(dict_like, h5group):
"""
Load a dictionnary-like object from a h5 file group
"""
# Read attributes
for name, value in h5group.attrs.items():
dict_like[name] = value | 0.004739 |
def _remove_failed_items(self, failed_items, items_to_create, items_to_update, items_to_delete):
"""
Remove content metadata items from the `items_to_create`, `items_to_update`, `items_to_delete` dicts.
Arguments:
failed_items (list): Failed Items to be removed.
items_to... | 0.008485 |
def _ensure_snapshot(connection, volume):
""" Ensure that a given volume has an appropriate snapshot
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type volume: boto.ec2.volume.Volume
:param volume: Volume to check
:returns: None
"""
if 'Au... | 0.000507 |
def make_fileitem_filename(filename, condition='is', negate=False, preserve_case=False):
"""
Create a node for FileItem/FileName
:return: A IndicatorItem represented as an Element node
"""
document = 'FileItem'
search = 'FileItem/FileName'
content_type = 'string'
content = filename
... | 0.009506 |
def list_tar (archive, compression, cmd, verbosity, interactive):
"""List a TAR archive."""
cmdlist = [cmd, '-n']
add_star_opts(cmdlist, compression, verbosity)
cmdlist.append("file=%s" % archive)
return cmdlist | 0.008658 |
def _init_map(self):
"""stub"""
QuestionTextFormRecord._init_map(self)
self.my_osid_object_form._my_map['choices'] = \
self._choices_metadata['default_object_values'][0] | 0.009756 |
def tocvx(B):
""" Converts a sparse SciPy matrix into a sparse CVXOPT matrix.
"""
Bcoo = B.tocoo()
return spmatrix(Bcoo.data, Bcoo.row.tolist(), Bcoo.col.tolist()) | 0.005587 |
def zeroing(dev):
""" zeroing last few blocks of device """
# this kills the crab
#
# sgdisk will wipe out the main copy of the GPT partition
# table (sorry), but it doesn't remove the backup copies, and
# subsequent commands will continue to complain and fail when
# they see those. zeroing... | 0.001852 |
def cli(self, commands):
"""Execute raw CLI commands and returns their output."""
cli_output = {}
def _count(txt, none): # Second arg for consistency only. noqa
"""
Return the exact output, as Junos displays
e.g.:
> show system processes extensiv... | 0.001474 |
def prepare_metadata_for_build_wheel(metadata_directory, config_settings):
"""Invoke optional prepare_metadata_for_build_wheel
Implements a fallback by building a wheel if the hook isn't defined.
"""
backend = _build_backend()
try:
hook = backend.prepare_metadata_for_build_wheel
except ... | 0.001852 |
def canChiNgay(nn, tt, nnnn, duongLich=True, timeZone=7, thangNhuan=False):
"""Summary
Args:
nn (int): ngày
tt (int): tháng
nnnn (int): năm
duongLich (bool, optional): True nếu là dương lịch, False âm lịch
timeZone (int, optional): Múi giờ
thangNhuan (bool, optio... | 0.001567 |
def getstr_data(self, name, vals):
"""Return stats data string in markdown style."""
fld2val = self.get_fld2val(name, vals)
return self.fmt.format(**fld2val) | 0.01105 |
def get_instance_route53_names(self, instance):
''' Check if an instance is referenced in the records we have from
Route53. If it is, return the list of domain names pointing to said
instance. If nothing points to it, return an empty list. '''
instance_attributes = [ 'public_dns_name', ... | 0.005355 |
def _clean_up_name(self, name):
"""
Cleans up the name according to the rules specified in this exact
function. Uses self.naughty, a list of naughty characters.
"""
for n in self.naughty: name = name.replace(n, '_')
return name | 0.010909 |
def parse_json_structure(string_item):
"""
Given a raw representation of a json structure, returns the parsed corresponding data
structure (``JsonRpcRequest`` or ``JsonRpcRequestBatch``)
:param string_item:
:return:
"""
if not isinstance(string_item, str):
raise TypeError("Expected ... | 0.002408 |
def WorkersDensity(dataTasks):
"""Return the worker density data for the graph."""
start_time, end_time = getTimes(dataTasks)
graphdata = []
for name in getWorkersName(dataTasks):
vals = dataTasks[name]
if hasattr(vals, 'values'):
# Data from worker
workerdata =... | 0.004739 |
def match_seq(self, nodes, results=None):
"""Does this pattern exactly match a sequence of nodes?"""
for c, r in self.generate_matches(nodes):
if c == len(nodes):
if results is not None:
results.update(r)
if self.name:
... | 0.004902 |
def get_list(self, name):
'''Return all the values for given name.'''
normalized_name = normalize_name(name, self._normalize_overrides)
return self._map[normalized_name] | 0.010363 |
def namer(cls, imageUrl, pageUrl):
"""Use page URL to construct meaningful image name."""
parts, year, month, stripname = pageUrl.rsplit('/', 3)
stripname = stripname.rsplit('.', 1)[0]
parts, imagename = imageUrl.rsplit('/', 1)
return '%s-%s-%s-%s' % (year, month, stripname, imag... | 0.006135 |
def export_mt_variants(variants, sample_id):
"""Export mitochondrial variants for a case to create a MT excel report
Args:
variants(list): all MT variants for a case, sorted by position
sample_id(str) : the id of a sample within the case
Returns:
document_lines(list): list of lines... | 0.00406 |
def _compute_mean(self, imt, mag, rhypo):
"""
Compute mean value from lookup table.
Lookup table defines log10(IMT) (in g) for combinations of Mw and
log10(rhypo) values. ``mag`` is therefore converted from Mblg to Mw
using Atkinson and Boore 1987 conversion equation. Mean value... | 0.00206 |
def send_media_group(chat_id, media,
reply_to_message_id=None, disable_notification=False,
**kwargs):
"""
Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
:param chat_id: Unique identifier for t... | 0.004867 |
def image_info(call=None, kwargs=None):
'''
Retrieves information for a given image. Either a name or an image_id must be
supplied.
.. versionadded:: 2016.3.0
name
The name of the image for which to gather information. Can be used instead
of ``image_id``.
image_id
The ... | 0.003205 |
def read_cstring(self) -> bool:
"""
read a double quoted string
Read following BNF rule else return False::
'"' -> ['\\' #char | ~'\\'] '"'
"""
self._stream.save_context()
idx = self._stream.index
if self.read_char("\"") and self.read_until("\"", "\\"):
txt = self._stream[i... | 0.00232 |
def sbo_upgrade(skip, flag):
"""Return packages for upgrade
"""
Msg().checking()
upgrade_names = []
data = SBoGrep(name="").names()
blacklist = BlackList().packages(pkgs=data, repo="sbo")
for pkg in sbo_list():
status(0.02)
name = split_package(pkg)[0]
ver = split_pac... | 0.001307 |
def get_context_data(self, *args, **kwargs):
"""Inject is_plans_plural and customer into context_data."""
context = super().get_context_data(**kwargs)
context["is_plans_plural"] = Plan.objects.count() > 1
context["customer"], _created = Customer.get_or_create(
subscriber=djstripe_settings.subscriber_request_... | 0.023585 |
def save(f, arr, vocab):
"""
Save word embedding file.
Args:
f (File): File to write the vectors. File should be open for writing
ascii.
arr (numpy.array): Numpy array with ``float`` dtype.
vocab (iterable): Each element is pair of a word (``bytes``) and ``arr``
... | 0.003378 |
def Focus(cls):
""" 在指定输入框发送 Null, 用于设置焦点
@note: key event -> NULL
"""
element = cls._element()
# element.send_keys(Keys.NULL)
action = ActionChains(Web.driver)
action.send_keys_to_element(element, Keys.NULL)
actio... | 0.015106 |
def all(cls, client):
""""
fetch data for multiple stocks
"""
url = "https://api.robinhood.com/orders/"
data = client.get(url)
results = data["results"]
while data["next"]:
data = client.get(data["next"])
results.extend(data["results"])
... | 0.0059 |
def make_threshold_gradient(self, py3, thresholds, size=100):
"""
Given a thresholds list, creates a gradient list that covers the range
of the thresholds.
The number of colors in the gradient is limited by size.
Because of how the range is split the exact number of colors in th... | 0.001674 |
def select_remote_checkpoint_ids(db, user_id):
"""
Get all file ids for a user.
"""
return list(
db.execute(
select([remote_checkpoints.c.id])
.where(remote_checkpoints.c.user_id == user_id)
)
) | 0.003937 |
def to_dict(self):
"""Extend Field.to_dict, take the display_international attribute."""
d = Field.to_dict(self)
if self.display_international:
d['display_international'] = self.display_international
return d | 0.007782 |
def delete_database_user(self, username):
"""Delete database user."""
url = "db/{0}/users/{1}".format(self._database, username)
self.request(
url=url,
method='DELETE',
expected_response_code=200
)
return True | 0.006993 |
def register_sizer(self, attr_name, sizedimage_cls):
"""
Register a new SizedImage subclass (`sizedimage_cls`).
To be used via the attribute (`attr_name`).
"""
if attr_name.startswith(
'_'
) or attr_name in self.unallowed_sizer_names:
raise Unallo... | 0.001472 |
def parse_mutator_settings(mutator_settings, config: ConfigObject):
"""
Assigns the mutator settings to the settings object for the dll
:param mutator_settings:
:param config:
"""
mutator_settings.match_length = safe_get_mutator(match_length_types, config, MUTATOR_MATCH_LENGTH)
mutator_setti... | 0.007955 |
def pretty_string(fc):
'''construct a nice looking string for an FC
'''
s = []
for fname, feature in sorted(fc.items()):
if isinstance(feature, StringCounter):
feature = [u'%s: %d' % (k, v)
for (k,v) in feature.most_common()]
feature = u'\n\t' + u'\... | 0.004938 |
def remove(self, name, func):
''' Remove a callback from a hook. '''
was_empty = self._empty()
if name in self.hooks and func in self.hooks[name]:
self.hooks[name].remove(func)
if self.app and not was_empty and self._empty(): self.app.reset() | 0.01049 |
def describe(cls) -> None:
"""
Prints in the console a table showing all the attributes for all the
definitions inside the class
:return: None
"""
max_lengths = []
for attr_name in cls.attr_names():
attr_func = "%ss" % attr_name
attr_list ... | 0.002012 |
def listFields(self, template):
"""List all the attributes to be rendered from the template file
:param template: The template to render.
The template is actually a file, which is usually generated
by :class:`rtcclient.template.Templater.getTemplate` and can also
be ... | 0.002392 |
def quad_genz_keister_18(order):
"""
Hermite Genz-Keister 18 rule.
Args:
order (int):
The quadrature order. Must be in the interval (0, 8).
Returns:
(:py:data:typing.Tuple[numpy.ndarray, numpy.ndarray]):
Abscissas and weights
Examples:
>>> abscissas... | 0.001269 |
def findDropzone( self, name ):
"""
Finds the dropzone based on the inputed name.
:param name | <str>
:return <XNodeHotspot> || None
"""
for dropzone in self._dropzones:
if ( dropzone.name() == name ):
return dropzone... | 0.023529 |
def fromfd(fd, family, type, proto=0):
""" fromfd(fd, family, type[, proto]) -> socket object
Create a socket object from a duplicate of the given file
descriptor. The remaining arguments are the same as for socket().
"""
nfd = dup(fd)
return socket(family, type, proto, nfd) | 0.003322 |
def dump(self):
"""
Dump the output to json.
"""
report_as_json_string = utils.dict_to_json(self.report)
if self.out_file:
utils.string_to_file(self.out_file, report_as_json_string)
else:
print report_as_json_string | 0.006969 |
def _number_parser(str_to_number_func):
"""Return a function to parse numbers."""
def _parse_number_value(element_text, state):
value = None
try:
value = str_to_number_func(element_text)
except (ValueError, TypeError):
state.raise_error(InvalidPrimitiveValue,
... | 0.004435 |
def check_version():
"""Check that submit50 is the latest version according to submit50.io."""
# Retrieve version info
res = requests.get("https://cs50.me/versions/submit50") # TODO change this to submit50.io!
if res.status_code != 200:
raise Error(_("You have an unknown version of submit50. "
... | 0.003976 |
def get_filesystem_encoding():
"""Returns the filesystem encoding that should be used. Note that this is
different from the Python understanding of the filesystem encoding which
might be deeply flawed. Do not use this value against Python's unicode APIs
because it might be different. See :ref:`filesyste... | 0.001838 |
def _sort(self, a, b):
'''
sort the headers according to rfc 2616 so when __iter__ is called, the accept media types are
in order from most preferred to least preferred
'''
ret = 0
# first we check q, higher values win:
if a[1] != b[1]:
ret = cmp(a[1]... | 0.002882 |
def install_monitor(self, monitor_pattern: str, monitor_stat_func_name: str):
"""
Installs an MXNet monitor onto the underlying module.
:param monitor_pattern: Pattern string.
:param monitor_stat_func_name: Name of monitor statistics function.
"""
self._monitor = mx.moni... | 0.005109 |
def _extract_data_from_origin_map(origin_mapped_data: Dict[str, Iterable[DataSourceType]]) \
-> Iterable[DataSourceType]:
"""
Extracts the data from a data origin map.
:param origin_mapped_data: a map containing the origin of the data as the key string and the data as the value
... | 0.007905 |
def ExpandWindowsPath(cls, path, environment_variables):
"""Expands a Windows path containing environment variables.
Args:
path (str): Windows path with environment variables.
environment_variables (list[EnvironmentVariableArtifact]): environment
variables.
Returns:
str: expand... | 0.009112 |
def parse_response(self, block=True, timeout=0):
"Parse the response from a publish/subscribe command"
connection = self.connection
if connection is None:
raise RuntimeError(
'pubsub connection not set: '
'did you forget to call subscribe() or psubscri... | 0.004124 |
def login(self, username, password=None, blob=None, zeroconf=None):
"""Authenticate to Spotify's servers.
You can login with one of three combinations:
- ``username`` and ``password``
- ``username`` and ``blob``
- ``username`` and ``zeroconf``
To get the ``blob`` strin... | 0.001613 |
def enable_svc_check(self, service):
"""Enable checks for a service
Format of the line that triggers function call::
ENABLE_SVC_CHECK;<host_name>;<service_description>
:param service: service to edit
:type service: alignak.objects.service.Service
:return: None
"... | 0.00335 |
def calculate_P(self, T, P, method):
r'''Method to calculate pressure-dependent gas molar volume at
temperature `T` and pressure `P` with a given method.
This method has no exception handling; see `TP_dependent_property`
for that.
Parameters
----------
T : float... | 0.001626 |
def highlightBlock(self, string):
""" Highlight a block of text.
"""
prev_data = self.currentBlock().previous().userData()
if prev_data is not None:
self._lexer._saved_state_stack = prev_data.syntax_stack
elif hasattr(self._lexer, '_saved_state_stack'):
de... | 0.002232 |
def from_server(cls, bundleid, server='http://localhost:5555',
as_client=True):
"""Load a new bundle from a server.
[NOT IMPLEMENTED]
Load a bundle from a phoebe server. This is a constructor so should be
called as:
>>> b = Bundle.from_server('asdf', as_cl... | 0.002676 |
def authenticate(self, provider):
"""
Starts OAuth authorization flow, will redirect to 3rd party site.
"""
callback_url = url_for(".callback", provider=provider, _external=True)
provider = self.get_provider(provider)
session['next'] = request.args.get('next') or ''
... | 0.005525 |
def is_time_valid(self, timestamp):
"""Check if time is valid for one of the timerange.
:param timestamp: time to check
:type timestamp: int
:return: True if one of the timerange is valid for t, False otherwise
:rtype: bool
"""
if self.is_time_day_valid(timestamp... | 0.004202 |
def create_groups(self, *names, **kwargs):
"""Convenience method to create multiple groups in a single call."""
return tuple(self.create_group(name, **kwargs) for name in names) | 0.010363 |
def _excel_cell(cls, cell, quote_everything=False, quote_numbers=True,
_is_header=False):
"""
This will return a text that excel interprets correctly when
importing csv
:param cell: obj to store in the cell
:param quote_everything: bool to quote ev... | 0.002111 |
def replace_series_data(self, chartSpace):
"""
Rewrite the series data under *chartSpace* using the chart data
contents. All series-level formatting is left undisturbed. If
the chart data contains fewer series than *chartSpace*, the extra
series in *chartSpace* are deleted. If *c... | 0.002398 |
def init_profile_dir(self):
"""initialize the profile dir"""
try:
# location explicitly specified:
location = self.config.ProfileDir.location
except AttributeError:
# location not specified, find by profile name
try:
p = ProfileDir.... | 0.00748 |
def _prepare_io_handler(self, handler):
"""Call the `interfaces.IOHandler.prepare` method and
remove the handler from unprepared handler list when done.
"""
logger.debug(" preparing handler: {0!r}".format(handler))
ret = handler.prepare()
logger.debug(" prepare result: ... | 0.002315 |
def p_identifier_name_string(self, p):
"""identifier_name_string : identifier_name
"""
p[0] = asttypes.PropIdentifier(p[1].value)
# manually clone the position attributes.
for k in ('_token_map', 'lexpos', 'lineno', 'colno'):
setattr(p[0], k, getattr(p[1], k)) | 0.00641 |
def encode_string(data, encoding='hex'):
'''
Encode string
:param data: string to encode
:param encoding: encoding to use (default: 'hex')
:return: encoded string
'''
if six.PY2:
return data.encode(encoding)
else:
if isinstance(data, str):
data = bytes(data, ... | 0.002571 |
def stations(self, *stns):
"""Specify one or more stations for the query.
This modifies the query in-place, but returns `self` so that multiple
queries can be chained together on one line.
This replaces any existing spatial queries that have been set.
Parameters
------... | 0.003317 |
def _nailgunnable_combined_classpath(self):
"""Register all of the component tools of the rsc compile task as a "combined" jvm tool.
This allows us to invoke their combined classpath in a single nailgun instance (see #7089 and
#7092). We still invoke their classpaths separately when not using nailgun, howe... | 0.009025 |
def to_internal_value(self, value):
"""Basically, each tag dict must include a full dict with id,
name and slug--or else you need to pass in a dict with just a name,
which indicated that the Tag doesn't exist, and should be added."""
if "id" in value:
tag = Tag.objects.get(i... | 0.002288 |
def add_device(self, device, container):
"""Add a device to a group. Wraps JSSObject.add_object_to_path.
Args:
device: A JSSObject to add (as list data), to this object.
location: Element or a string path argument to find()
"""
# There is a size tag which the JSS... | 0.002882 |
def _plot_spectrogram(G, node_idx):
r"""Plot the graph's spectrogram.
Parameters
----------
node_idx : ndarray
Order to sort the nodes in the spectrogram.
By default, does not reorder the nodes.
Notes
-----
This function is only implemented for the pyqtgraph backend at the ... | 0.000574 |
def dpar(self, cl=1):
"""Return dpar-style executable assignment for parameter
Default is to write CL version of code; if cl parameter is
false, writes Python executable code instead.
"""
sval = self.toString(self.value, quoted=1)
if not cl:
if sval == "": sv... | 0.007692 |
def _parse_time(self, date_string, settings):
"""Attemps to parse time part of date strings like '1 day ago, 2 PM' """
date_string = PATTERN.sub('', date_string)
date_string = re.sub(r'\b(?:ago|in)\b', '', date_string)
try:
return time_parser(date_string)
except:
... | 0.012048 |
def with_matching_args(self, *args, **kwargs):
"""Set the last call to expect specific argument values if those arguments exist.
Unlike :func:`fudge.Fake.with_args` use this if you want to only declare
expectations about matching arguments. Any unknown keyword arguments
used by the app... | 0.004601 |
def get_widgets(self, position=None, include_draft=False):
"""
Get widgets for given position from filesystem.
:param position: position or position list
:param include_draft: return draft widgets or not
:return: an iterable of Widget objects
"""
def widgets_gen... | 0.001394 |
def update_window_size(self):
"""
Update the current window object with its current
height and width and clear the screen if they've changed.
"""
height, width = self.window.getmaxyx()
if self.height != height or self.width != width:
self.height, self.width = ... | 0.005479 |
def unique_index(df):
"""
Assert that the index is unique
Parameters
==========
df : DataFrame
Returns
=======
df : DataFrame
"""
try:
assert df.index.is_unique
except AssertionError as e:
e.args = df.index.get_duplicates()
raise
return df | 0.003195 |
def unescape(self):
"""
Within an interpolation, evaluation, or escaping, remove HTML escaping
that had been previously added.
"""
for i, k in enumerate(self._html_escape_table):
v = self._html_escape_table[k]
self.obj = self.obj.replace(v, k)
ret... | 0.005814 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.