text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def gauge(self, name, value, rate=1):
# type: (str, float, float) -> None
"""Send a Gauge metric with the specified value"""
if self._should_send_metric(name, rate):
if not is_numeric(value):
value = float(value)
self._request(
Gauge(
... | 0.006303 |
def getFingerprint(self, text):
"""Get the semantic fingerprint of the input text.
Args:
text, str: The text to be evaluated
Returns:
list of str: the positions of the semantic fingerprint
Raises:
CorticalioException: if the request was not successful
... | 0.004796 |
def _register_update(self, fmt={}, replot=False, force=False,
todefault=False):
"""
Register formatoptions for the update
Parameters
----------
fmt: dict
Keys can be any valid formatoptions with the corresponding values
(see the :... | 0.003077 |
def _send_ack(self, ip, port, packet, update_timestamp=True):
"""
Send an ack packet
:param ip: Ip to send to
:type ip: str
:param port: Port to send to
:type port: int
:param packet: Packet to be acknowledged
:type packet: APPMessage
:param updat... | 0.002541 |
def cspace_convert(arr, start, end):
"""Converts the colors in ``arr`` from colorspace ``start`` to colorspace
``end``.
:param arr: An array-like of colors.
:param start, end: Any supported colorspace specifiers. See
:ref:`supported-colorspaces` for details.
"""
converter = cspace_conv... | 0.002755 |
def expect(self, searcher, timeout=3):
"""Wait for input matching *searcher*
Waits for input matching *searcher* for up to *timeout* seconds. If
a match is found, the match result is returned (the specific type of
returned result depends on the :class:`Searcher` type). If no match is
... | 0.001533 |
def add_registry(self, registry, registry_user, registry_pass, insecure=False, registry_type="docker_v2", validate=True):
'''**Description**
Add image registry
**Arguments**
- registry: Full hostname/port of registry. Eg. myrepo.example.com:5000
- registry_user: User... | 0.005647 |
def _datetime_to_stata_elapsed_vec(dates, fmt):
"""
Convert from datetime to SIF. http://www.stata.com/help.cgi?datetime
Parameters
----------
dates : Series
Series or array containing datetime.datetime or datetime64[ns] to
convert to the Stata Internal Format given by fmt
fmt :... | 0.0008 |
def _images(self, sys_output):
''' a helper method for parsing docker image output '''
import re
gap_pattern = re.compile('\t|\s{2,}')
image_list = []
output_lines = sys_output.split('\n')
column_headers = gap_pattern.split(output_lines[0])
for i in... | 0.007267 |
def isoformat(self):
"""Generate an ISO 8601 formatted time stamp.
Returns:
str: `ISO 8601`_ formatted time stamp
.. _ISO 8601: http://www.cl.cam.ac.uk/~mgk25/iso-time.html
"""
text = [self.strftime('%Y-%m-%dT%H:%M:%S'), ]
if self.tzinfo:
text.ap... | 0.004673 |
def purge_old_logs(delete_before_days=7):
"""
Purges old logs from the database table
"""
delete_before_date = timezone.now() - timedelta(days=delete_before_days)
logs_deleted = Log.objects.filter(
created_on__lte=delete_before_date).delete()
return logs_deleted | 0.003401 |
def _subtract(summary, o):
"""Remove object o from the summary by subtracting it's size."""
found = False
row = [_repr(o), 1, _getsizeof(o)]
for r in summary:
if r[0] == row[0]:
(r[1], r[2]) = (r[1] - row[1], r[2] - row[2])
found = True
if not found:
summary.a... | 0.002688 |
def names_labels(self, do_print=False):
"""Simple helper function to get all field names and labels """
if do_print:
for name, label in zip(self.field_names, self.field_labels):
print('%s --> %s' % (str(name), str(label)))
return self.field_names, self.field_labels | 0.006309 |
def send(self, data):
"""Send data through websocket"""
log.debug('Sending %s' % data)
if not self._socket:
log.warn('No connection')
return
self._socket.send_bytes(data.encode('utf-8')) | 0.008264 |
def convert_to_units(self, units, equivalence=None, **kwargs):
"""
Convert the array to the given units in-place.
Optionally, an equivalence can be specified to convert to an
equivalent quantity which is not in the same dimensions.
Parameters
----------
units : ... | 0.000624 |
def set_alias(alias, **kwargs):
""" Set a path alias.
Arguments:
alias -- The alias specification
entry -- The entry to alias it to
category -- The category to alias it to
url -- The external URL to alias it to
"""
spec = alias.split()
path = spec[0]
values = {**kwargs, 'pat... | 0.001764 |
def find_biconnected_components_as_subgraphs(graph):
"""Finds the biconnected components and returns them as subgraphs."""
list_of_graphs = []
list_of_components = find_biconnected_components(graph)
for edge_list in list_of_components:
subgraph = get_subgraph_from_edge_list(graph, edge_list)
... | 0.002604 |
def get_environ(self):
"""Return a new environ dict targeting the given wsgi.version."""
req = self.req
req_conn = req.conn
env = {
# set a non-standard environ entry so the WSGI app can know what
# the *real* server protocol is (and what features to support).
... | 0.000711 |
def emit(self, record):
"""
Override emit() method in handler parent for sending log to RESTful
API
"""
pid = os.getpid()
if pid != self.pid:
self.pid = pid
self.logs = []
self.timer = self._flushAndRepeatTimer()
atexit.reg... | 0.003984 |
def add_urlhelpers(event):
"""
Add helpers to the template engine.
"""
event['static_url'] = lambda x: static_path(x, event['request'])
event['route_url'] = lambda name, *args, **kwargs: \
route_path(name, event['request'], *args, **kwargs)
event['parse_rest'] = parse_rest
event['has... | 0.002725 |
def group_join(self, inner_iterable, outer_key_selector=identity, inner_key_selector=identity,
result_selector=lambda outer, grouping: grouping):
'''Match elements of two sequences using keys and group the results.
The group_join() query produces a hierarchical result, with all of the
... | 0.003298 |
def live_processes(self):
"""Return a list of the live processes.
Returns:
A list of the live processes.
"""
result = []
for process_type, process_infos in self.all_processes.items():
for process_info in process_infos:
if process_info.proc... | 0.004619 |
def fetch_all_messages(self, conn, directory, readonly):
""" Fetches all messages at @conn from @directory.
Params:
conn IMAP4_SSL connection
directory The IMAP directory to look for
readonly readonly mode, true or false
Return... | 0.001857 |
def listdir(*paths, glob=None):
'''
List the (optionally glob filtered) full paths from a dir.
Args:
*paths ([str,...]): A list of path elements
glob (str): An optional fnmatch glob str
'''
path = genpath(*paths)
names = os.listdir(path)
if glob is not None:
names =... | 0.002375 |
def _read_plain(self, lines):
"""
Read text fragments from a plain format text file.
:param list lines: the lines of the plain text file
:param dict parameters: additional parameters for parsing
(e.g., class/id regex strings)
:raises: ValueError: ... | 0.002656 |
def vrrp(self, **kwargs):
"""Enable or Disable VRRP.
Args:
ip_version (str): The IP version ('4' or '6') for which VRRP should
be enabled/disabled. Default: `4`.
enabled (bool): If VRRP should be enabled or disabled. Default:
``True``.
... | 0.000896 |
def preloop(self):
"""Initialization before prompting user for commands.
Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub.
"""
cmd.Cmd.preloop(self) ## sets up command completion
try:
if readline:
readline.read_history_file(sy... | 0.008299 |
def bruteforce(users, domain, password, host):
"""
Performs a bruteforce for the given users, password, domain on the given host.
"""
cs = CredentialSearch(use_pipe=False)
print_notification("Connecting to {}".format(host))
s = Server(host)
c = Connection(s)
for user in users:
... | 0.005376 |
def localeselector():
"""Default locale selector used in abilian applications."""
# if a user is logged in, use the locale from the user settings
user = getattr(g, "user", None)
if user is not None:
locale = getattr(user, "locale", None)
if locale:
return locale
# Otherw... | 0.00354 |
def to_excel(self, *args):
"""
Dump all the data to excel, fname and path can be passed as args
"""
path = os.getcwd()
fname = self.fname.replace(".ppl", "_ppl") + ".xlsx"
if len(args) > 0 and args[0] != "":
path = args[0]
if os.path.exists... | 0.002715 |
def _clean_index(key, length):
"""
Validates and normalizes a cell range index.
>>> _clean_index(0, 10)
0
>>> _clean_index(-10, 10)
0
>>> _clean_index(10, 10)
Traceback (most recent call last):
...
IndexError: Cell index out of range.
>>> _clean_index(-11, 10)
Traceback ... | 0.002384 |
def encipher_vigenere(plaintext, plain_vocab, key):
"""Encrypt plain text with given key.
Args:
plaintext (list of list of Strings): a list of plain text to encrypt.
plain_vocab (list of Integer): unique vocabularies being used.
key (list of Integer): key to encrypt cipher using Vigenere table.
Retu... | 0.01182 |
def assign_item_to_bank(self, item_id, bank_id):
"""Adds an existing ``Item`` to a ``Bank``.
arg: item_id (osid.id.Id): the ``Id`` of the ``Item``
arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank``
raise: AlreadyExists - ``item_id`` is already assigned to
``ban... | 0.001919 |
def _stop(self):
''' calculate the duration we actually paused for and then
finish building the task result string '''
duration = time.time() - self.start
self.result['stop'] = str(datetime.datetime.now())
self.result['delta'] = int(duration)
if self.duration_unit == 'mi... | 0.005803 |
def render(self, template=None, additional=None):
"""
Render single model to its html representation.
You may set template path in render function argument,
or model's variable named 'template_path',
or get default name: $app_label$/models/$model_name$.html
Sett... | 0.002439 |
def _parse_tree(self, node):
""" Parse a <review> object """
if 'date' in node.attrib:
dt = dateutil.parser.parse(node.attrib['date'])
self.date = int(dt.strftime("%s"))
if 'id' in node.attrib:
self.id = node.attrib['id']
if 'karma' in node.attrib:
... | 0.00157 |
def calculate_r_matrices(fine_states, reduced_matrix_elements, q=None,
numeric=True, convention=1):
ur"""Calculate the matrix elements of the electric dipole (in the helicity
basis).
We calculate all matrix elements for the D2 line in Rb 87.
>>> from sympy import symbols, ppri... | 0.000314 |
def discard(self, value):
'''Remove an element *value* from a set if it is a member.'''
return self.cache.remove((self.value_pickler.dumps(value),)) | 0.012048 |
def km3h5concat(input_files, output_file, n_events=None, **kwargs):
"""Concatenate KM3HDF5 files via pipeline."""
from km3pipe import Pipeline # noqa
from km3pipe.io import HDF5Pump, HDF5Sink # noqa
pipe = Pipeline()
pipe.attach(HDF5Pump, filenames=input_files, **kwargs)
pipe.attach(Statu... | 0.002387 |
def prepare_terminal_session(self):
"""Send commands to prepare terminal session configuration."""
for cmd in self.driver.prepare_terminal_session:
try:
self.send(cmd)
except CommandSyntaxError:
self.chain.connection.log("Command not supported or n... | 0.007813 |
def _help_workers(self):
""" Help on all the available workers """
help = 'Workbench Workers:'
for worker in self.list_all_workers():
full_help = self.work_request('help_formatter', worker)['help_formatter']['help']
compact_help = full_help.split('\n')[:4]
he... | 0.010526 |
def _segment(cls, segment):
"""
Returns a property capable of setting and getting a segment.
"""
return property(
fget=lambda x: cls._get_segment(x, segment),
fset=lambda x, v: cls._set_segment(x, segment, v),
) | 0.007273 |
def encode_mv(vals):
"""For multivalues, values are wrapped in '$' and separated using ';'
Literal '$' values are represented with '$$'"""
s = ""
for val in vals:
val = val.replace('$', '$$')
if len(s) > 0:
s += ';'
s += '$' + val + '$'
return s | 0.003311 |
def decode(value):
"""Decode a geohash. Returns a (lon,lat) pair."""
assert value, "Invalid geohash: %s"%value
# Get the GeoHash bits
bits = _geohash_to_bits(value)
# Unzip the GeoHash bits.
lon = bits[0::2]
lat = bits[1::2]
# Convert to lat/lon
return (
_bits_to_float(lon, lower=-180.0, upper=180... | 0.03125 |
def update(self):
"""Update cameras and motion settings with latest from API."""
cameras = self._api.camera_list()
self._cameras_by_id = {v.camera_id: v for i, v in enumerate(cameras)}
motion_settings = []
for camera_id in self._cameras_by_id.keys():
motion_setting =... | 0.00381 |
def one_of(*args):
"Verifies that only one of the arguments is not None"
for i, arg in enumerate(args):
if arg is not None:
for argh in args[i+1:]:
if argh is not None:
raise OperationError("Too many parameters")
else:
return
... | 0.00271 |
def list_folder(self, path):
"""Looks up folder contents of `path.`"""
# Inspired by https://github.com/rspivak/sftpserver/blob/0.3/src/sftpserver/stub_sftp.py#L70
try:
folder_contents = []
for f in os.listdir(path):
attr = paramiko.SFTPAttributes.from_sta... | 0.007286 |
def process_request(self, request):
"""
Reconstitute the full JWT and add a new cookie on the request object.
"""
use_jwt_cookie_requested = request.META.get(USE_JWT_COOKIE_HEADER)
header_payload_cookie = request.COOKIES.get(jwt_cookie_header_payload_name())
signature_coo... | 0.003839 |
def get_cached_object(model, timeout=CACHE_TIMEOUT, **kwargs):
"""
Return a cached object. If the object does not exist in the cache, create it.
Params:
model - ContentType instance representing the model's class or the model class itself
timeout - TTL for the item in cache, defaults to CAC... | 0.004212 |
def reboot(name, call=None):
'''
Reboot a linode.
.. versionadded:: 2015.8.0
name
The name of the VM to reboot.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot vm_name
'''
if call != 'action':
raise SaltCloudException(
'The show_instance ac... | 0.00146 |
def print_task_help(self, task, name):
"""
Prints the help for the passed task with the passed name.
:param task: the task function object
:param name: the name of the module.
:return: None
"""
TerminalColor.set('GREEN')
print(get_signature(name, task))
... | 0.004566 |
def _padleft(width, s, has_invisible=True):
"""Flush right.
>>> _padleft(6, '\u044f\u0439\u0446\u0430') == ' \u044f\u0439\u0446\u0430'
True
"""
iwidth = width + len(s) - len(_strip_invisible(s)) if has_invisible else width
fmt = "{0:>%ds}" % iwidth
return fmt.format(s) | 0.006667 |
def answer_json_to_strings(answer: Dict[str, Any]) -> Tuple[Tuple[str, ...], str]:
"""
Takes an answer JSON blob from the DROP data release and converts it into strings used for
evaluation.
"""
if "number" in answer and answer["number"]:
return tuple([str(answer["number"])]), "number"
el... | 0.00615 |
def list_user_topics(self, start=0):
"""
ε葨ηθ―ι’
:param start: ηΏ»ι‘΅
:return: εΈ¦δΈδΈι‘΅ηε葨
"""
xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comme... | 0.014535 |
def _init_metadata(self):
"""stub"""
super(LabelOrthoFacesAnswerFormRecord, self)._init_metadata()
self._face_values_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'face... | 0.003072 |
def loop_once(self):
"""Process one callback from one of the workers."""
while 1:
if not self._active_nodes:
# If everything has died stop looping
self.triggershutdown()
raise RuntimeError("Unexpectedly no active workers available")
... | 0.002685 |
def unset(self, point):
"""Unset pixel at (x, y) point."""
if not isinstance(point, Point):
point = Point(point)
x, y = self.round(point.x) >> 1, self.round(point.y) >> 2
if (x, y) not in self.screen:
return
if isinstance(self.screen[y][x], int):
... | 0.004 |
def transform_args(self,*args,**kwargs):
"""Combine arguments and turn them into gromacs tool arguments."""
newargs = self._combineargs(*args, **kwargs)
return self._build_arg_list(**newargs) | 0.018605 |
def progress_view(shell):
""" updates the view """
while not ShellProgressView.done:
_, col = get_window_dim()
col = int(col)
progress = get_progress_message()
if '\n' in progress:
prog_list = progress.split('\n')
prog_val = len(prog_list[-1])
else... | 0.001925 |
def paint(self, painter, option, index):
"""Paint checkbox and text
_
|_| My label
"""
body_rect = QtCore.QRectF(option.rect)
check_rect = QtCore.QRectF(body_rect)
check_rect.setWidth(check_rect.height())
check_rect.adjust(6, 6, -6, -6)
check... | 0.001021 |
def __remove_URL_from_10320LOC(self, url, list_of_entries, handle):
'''
Remove an URL from the handle record's "10320/LOC" entry.
If it exists several times in the entry, all occurences are removed.
If the URL is not present, nothing happens.
If after removing, there is no more U... | 0.004092 |
def new_driver(browser_name, *args, **kwargs):
"""Instantiates a new WebDriver instance, determining class by environment variables
"""
if browser_name == FIREFOX:
return webdriver.Firefox(*args, **kwargs)
# elif options['local'] and options['browser_name'] == CHROME:
... | 0.00553 |
def sort_by(self, *fields, **kwargs):
"""
Indicate how the results should be sorted. This can also be used for
*top-N* style queries
### Parameters
- **fields**: The fields by which to sort. This can be either a single
field or a list of fields. If you wish to speci... | 0.002494 |
def drop_function(self, dbName, funcName):
"""
Parameters:
- dbName
- funcName
"""
self.send_drop_function(dbName, funcName)
self.recv_drop_function() | 0.005556 |
def RIBVRFRouteLimitExceeded_originator_switch_info_switchIpV4Address(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
RIBVRFRouteLimitExceeded = ET.SubElement(config, "RIBVRFRouteLimitExceeded", xmlns="http://brocade.com/ns/brocade-notification-stream")
... | 0.009188 |
def get(self, timeout=None):
"""Return the next available item from the tube.
Blocks if tube is empty, until a producer for the tube puts an item on it."""
if timeout:
# Todo: Consider locking the poll/recv block.
# Otherwise, this method is not thread safe.
... | 0.006148 |
def add(self, repo):
"""
Add repo to the internal lookup table...
"""
key = self.key(repo.username, repo.reponame)
repo.key = key
self.repos[key] = repo
return key | 0.009132 |
def get_edges(ont):
"""
Fetches all basic edges from a remote ontology
"""
logging.info("QUERYING:"+ont)
edges = [(c,SUBCLASS_OF, d) for (c,d) in fetchall_isa(ont)]
edges += fetchall_svf(ont)
edges += [(c,SUBPROPERTY_OF, d) for (c,d) in fetchall_subPropertyOf(ont)]
if len(edges) == 0:
... | 0.012953 |
def _set_class_(self, v, load=False):
"""
Setter method for class_, mapped from YANG variable /logging/auditlog/class (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_class_ is considered as a private
method. Backends looking to populate this variable should
... | 0.004525 |
def set_multiprocessing_logging_level_by_opts(opts):
'''
This will set the multiprocessing logging level to the lowest
logging level of all the types of logging that are configured.
'''
global __MP_LOGGING_LEVEL
log_levels = [
LOG_LEVELS.get(opts.get('log_level', '').lower(), logging.ER... | 0.003236 |
def registerGeneralHandler(self, handler):
"""注ειη¨δΊδ»Άε€ηε½ζ°ηε¬"""
if handler not in self.__generalHandlers:
self.__generalHandlers.append(handler) | 0.011765 |
def get_payload(self, items):
"""Upload given items to given account
data is an iterable of tuples where the first element is a Folder
instance representing the ParentFolder that the item will be placed in
and the second element is a Data string returned from an ExportItems
call... | 0.003215 |
def fbeta(y_pred:Tensor, y_true:Tensor, thresh:float=0.2, beta:float=2, eps:float=1e-9, sigmoid:bool=True)->Rank0Tensor:
"Computes the f_beta between `preds` and `targets`"
beta2 = beta ** 2
if sigmoid: y_pred = y_pred.sigmoid()
y_pred = (y_pred>thresh).float()
y_true = y_true.float()
TP = (y_pr... | 0.038776 |
def update_fw_local_result(self, os_result=None, dcnm_result=None,
dev_result=None):
"""Retrieve and update the FW result in the dict. """
self.update_fw_local_result_str(os_result=os_result,
dcnm_result=dcnm_result,
... | 0.008197 |
def merge_pages(self, replacements):
"""
Deprecated method.
"""
warnings.warn("merge_pages has been deprecated in favour of merge_templates",
category=DeprecationWarning,
stacklevel=2)
self.merge_templates(replacements, "p... | 0.02719 |
def alliance(self) -> Union[EveAllianceInfo, None]:
"""
Pseudo foreign key from alliance_id to EveAllianceInfo
:raises: EveAllianceInfo.DoesNotExist
:return: EveAllianceInfo or None
"""
if self.alliance_id is None:
return None
return EveAllianceInfo.ob... | 0.005571 |
def install_language(language):
"""Install translation service routines into default namespace."""
translator = get_translator(default_domain, default_directory,
languages=[get_lang(language)], fallback=True)
do_unicode = True
translator.install(do_unicode) | 0.007117 |
def reset_signal_handler(cls, signal_handler):
"""
Class state:
- Overwrites `cls._signal_handler`.
OS state:
- Overwrites signal handlers for SIGINT, SIGQUIT, and SIGTERM.
:returns: The :class:`SignalHandler` that was previously registered, or None if this is
the first time this ... | 0.00924 |
def bookmarks(self):
"""Get list of bookmarks"""
cmd = [HG, 'bookmarks']
output = self._command(cmd).decode(self.encoding, 'replace')
if output.startswith('no bookmarks set'):
return []
results = []
for line in output.splitlines():
m = bookmarks_rx... | 0.004444 |
def number_observer(t=None, targets=None):
"""
Return a number observer. If t is None, return NumberObserver. If t is a number,
return FixedIntervalNumberObserver. If t is an iterable (a list of numbers), return
TimingNumberObserver.
Parameters
----------
t : float, list or tuple, optional.... | 0.004433 |
def channel_info(self, channel):
"""Fetch information about a channel."""
resource = self.RCHANNEL_INFO
params = {
self.PCHANNEL: channel,
}
response = self._fetch(resource, params)
return response | 0.007663 |
def move(self,operand1, operand2):
"""Generates a move instruction
If the output operand (opernad2) is a working register, sets it's type
operandX - index in symbol table or text representation of operand
"""
if isinstance(operand1, int):
output_type = sel... | 0.008032 |
def print_todo(self, p_todo):
""" Given a todo item, pretty print it. """
todo_str = p_todo.source()
for ppf in self.filters:
todo_str = ppf.filter(todo_str, p_todo)
return TopydoString(todo_str) | 0.008299 |
def validate(self):
"""Verify required headers"""
for header in self._requiredHeaders:
if not self.headers.get(header, False):
raise errors.ParseError('Missing Notification Header: ' + header) | 0.029557 |
def next_intent_handler(request):
"""
Takes care of things whenver the user says 'next'
"""
message = "Sorry, couldn't find anything in your next queue"
end_session = True
if True:
user_queue = twitter_cache.user_queue(request.access_token())
if not user_queue.is_finished():
... | 0.003003 |
def my_shared_endpoint_list(endpoint_id):
"""
Executor for `globus endpoint my-shared-endpoint-list`
"""
client = get_client()
ep_iterator = client.my_shared_endpoint_list(endpoint_id)
formatted_print(ep_iterator, fields=ENDPOINT_LIST_FIELDS) | 0.003745 |
def _compute_layer_name(is_defined_within_template, arn):
"""
Computes a unique name based on the LayerVersion Arn
Format:
<Name of the LayerVersion>-<Version of the LayerVersion>-<sha256 of the arn>
Parameters
----------
is_defined_within_template bool
... | 0.004088 |
def _fell_trees(self):
"""
Removes trees from the forest according to the specified fell method.
"""
if callable(self.fell_method):
for tree in self.fell_method(list(self.trees)):
self.trees.remove(tree) | 0.007605 |
def decompose_locale(locale, strict=True):
"""
Return the decomposition of the specified locale into a language code
and a country code.
@param locale: a string representation of a locale, i.e., a ISO 639-3
alpha-3 code (or alpha-2 code), optionally followed by a dash
... | 0.003927 |
def shakemap_converter_help():
"""Help message for extent selector dialog.
.. versionadded:: 3.2.1
:returns: A message object containing helpful information.
:rtype: messaging.message.Message
"""
message = m.Message()
message.add(m.Brand())
message.add(heading())
message.add(conte... | 0.002907 |
def _check_integrate_dt(t,dt):
"""Check that the stepszie in t is an integer x dt"""
if dt is None:
return True
mult= round((t[1]-t[0])/dt)
if nu.fabs(mult*dt-t[1]+t[0]) < 10.**-10.:
return True
else:
return False | 0.011673 |
def mmapFile(self, addr, size, perms, filename, offset=0):
"""
Creates a new file mapping in the memory address space.
:param addr: the starting address (took as hint). If C{addr} is C{0} the first big enough
chunk of memory will be selected as starting address.
:pa... | 0.005208 |
def timestamp_to_datetime(timestamp):
"""Convert an ARF timestamp to a datetime.datetime object (naive local time)"""
from datetime import datetime, timedelta
obj = datetime.fromtimestamp(timestamp[0])
return obj + timedelta(microseconds=int(timestamp[1])) | 0.007353 |
async def close(self) -> None:
"""Complete queued queries/cursors and close the connection."""
await self._execute(self._conn.close)
self._running = False
self._connection = None | 0.009524 |
def paintEvent( self, event ):
"""
Overloads the paint event to handle drawing the splitter lines.
:param event | <QPaintEvent>
"""
lines = []
count = 20
# calculate the lines
if ( self.orientation() == Qt.Vertical ):
x =... | 0.010397 |
def swipe(self, element, x, y, duration=None):
"""Swipe over an element
:param element: either a WebElement, PageElement or element locator as a tuple (locator_type, locator_value)
:param x: horizontal movement
:param y: vertical movement
:param duration: time to take the swipe,... | 0.00489 |
def set_license(self, license_):
"""Sets the license.
arg: license (string): the new license
raise: InvalidArgument - ``license`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``license`` is ``null``
*compliance: mandatory... | 0.006438 |
def _get_groups(self, username):
""" Get groups of a user
@str username: name of the user
@rtype: dict, format { '<backend>': [<list of groups>] }
"""
ret = {}
for b in self.backends:
ret[b] = self.backends[b].get_groups(username)
cherrypy.log.error(
... | 0.004484 |
def to_csc(self):
"""Convert Dataset to scipy's Compressed Sparse Column matrix."""
self._X_train = csc_matrix(self._X_train)
self._X_test = csc_matrix(self._X_test) | 0.010582 |
def CA_TRACE(residue):
"""
Reduces protein residues to the alpha carbon:
CA trace only.
"""
cg_residue = deepcopy(residue)
for atom in cg_residue.child_dict.keys():
if cg_residue[atom].name != 'CA':
cg_residue.detach_child(cg_residue[atom].name)
return cg_residue | 0.006289 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.