text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _get_url_parameters(self):
"""
Encode URL parameters
"""
url_parameters = ''
if self._url_parameters is not None:
url_parameters = '?' + urllib.urlencode(self._url_parameters)
return url_parameters | 0.007663 |
def _get_property(device_path: Union[Path, str], property_name: str) -> str:
"""Gets the given property for a device."""
with open(str(Path(device_path, property_name))) as file:
return file.readline().strip() | 0.004444 |
def get_modname_from_modpath(module_fpath):
"""
returns importable name from file path
get_modname_from_modpath
Args:
module_fpath (str): module filepath
Returns:
str: modname
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_path import * # NOQA
>>> ... | 0.001309 |
def get_cloudflare_records(self, *, account):
"""Return a `list` of `dict`s containing the zones and their records, obtained from the CloudFlare API
Returns:
account (:obj:`CloudFlareAccount`): A CloudFlare Account object
:obj:`list` of `dict`
"""
zones = []
... | 0.004593 |
def echo_size(self, transferred=1, status=None):
'''Sample usage:
f=lambda x,y:x+y
ldata = range(10)
toBeTransferred = reduce(f,range(10))
progress = ProgressBarUtils("refresh", toBeTransferred=toBeTransferred, unit="KB", chunk_siz... | 0.007067 |
def consume(self, chars, min=0, max=-1):
"""
Consume chars until min/max is satisfied is valid.
"""
return self._src.consume(chars=chars, min=min, max=max) | 0.010695 |
def documentation_404(self, base_url=None):
"""Returns a smart 404 page that contains documentation for the written API"""
base_url = self.base_url if base_url is None else base_url
def handle_404(request, response, *args, **kwargs):
url_prefix = request.forwarded_uri[:-1]
... | 0.005801 |
def getJsonFromApi(view, request):
"""Return json from querying Web Api
Args:
view: django view function.
request: http request object got from django.
Returns: json format dictionary
"""
jsonText = view(request)
jsonText = json.loads(jsonText.content.decode('utf-8'))
return jsonText | 0.039216 |
def cumulative_distribution(self, X):
"""Computes the cumulative distribution function for the copula, :math:`C(u, v)`
Args:
X: `np.ndarray`
Returns:
np.array: cumulative probability
"""
self.check_fit()
U, V = self.split_matrix(X)
if (... | 0.005319 |
async def on_raw_422(self, message):
""" MOTD is missing. """
await self._registration_completed(message)
self.motd = None
await self.on_connect() | 0.011236 |
def main():
"""
NAME
dir_redo.py
DESCRIPTION
converts the Cogne DIR format to PmagPy redo file
SYNTAX
dir_redo.py [-h] [command line options]
OPTIONS
-h: prints help message and quits
-f FILE: specify input file
-F FILE: specify output file, defaul... | 0.039417 |
def home(self):
"""
Home the pipette's plunger axis during a protocol run
Notes
-----
`Pipette.home()` homes the `Robot`
Returns
-------
This instance of :class:`Pipette`.
Examples
--------
..
>>> from opentrons import i... | 0.001706 |
def create_from_settings(settings):
""" Create a connection with given settings.
Args:
settings (dict): A dictionary of settings
Returns:
:class:`Connection`. The connection
"""
return Connection(
settings["url"],
settings["base_... | 0.014141 |
def soaproot(self, node):
"""
Get whether the specified I{node} is a soap encoded root.
This is determined by examining @soapenc:root='1'.
The node is considered to be a root when the attribute
is not specified.
@param node: A node to evaluate.
@type node: L{Eleme... | 0.003604 |
def _prepare_for_training(self, records, mini_batch_size=None, job_name=None):
"""Set hyperparameters needed for training.
Args:
* records (:class:`~RecordSet`): The records to train this ``Estimator`` on.
* mini_batch_size (int or None): The size of each mini-batch to use when ... | 0.005231 |
def next(self):
"""
Get the next line of data.
Returns
-------
tag : str
data :
"""
line = self.buffer.readline()
while line == '\n': # Skip forward to the next line with content.
line = self.buffer.readline()
if line =... | 0.004354 |
def pk_prom(word):
'''Return the number of stressed light syllables.'''
violations = 0
stressed = []
for w in extract_words(word):
stressed += w.split('.')[2:-1:2] # odd syllables, excl. word-initial
# (CVV = light)
for syll in stressed:
if phon.is_vowel(syll[-1]):
... | 0.001845 |
def line_column(self) -> Tuple[int, int]:
"""Return line and column coordinates."""
ln = self.input.count("\n", 0, self.offset)
c = (self.offset if ln == 0 else
self.offset - self.input.rfind("\n", 0, self.offset) - 1)
return (ln + 1, c) | 0.007092 |
def _init_relationships(self, relationships_arg):
"""Return a set of relationships found in all subset GO Terms."""
if relationships_arg:
relationships_all = self._get_all_relationships()
if relationships_arg is True:
return relationships_all
else:
... | 0.004878 |
def add_properties(self, names, methods):
"""Returns a view of self with the given methods added as properties.
From: <http://stackoverflow.com/a/2954373/1366472>.
"""
cls = type(self)
cls = type(cls.__name__, (cls,), dict(cls.__dict__))
if isinstance(names, string_types... | 0.005837 |
def pospawn(self, pawn):
"""Position a :class:`Pawn` that is my child so as to reflect how far
its :class:`Thing` has gone along my :class:`Portal`.
"""
if self._turn < pawn.thing['arrival_time']:
# It's weird that the pawn is getting placed in me, but
# I'll do ... | 0.002037 |
def api_info(self, headers=None):
"""Retrieves information provided by the API root endpoint
``'/api/v1'``.
Args:
headers (dict): Optional headers to pass to the request.
Returns:
dict: Details of the HTTP API provided by the BigchainDB
server.
... | 0.004228 |
def calc_next_run(self):
"""Calculate next run time of this task"""
base_time = self.last_run
if self.last_run == HAS_NOT_RUN:
if self.wait_for_schedule is False:
self.next_run = timezone.now()
self.wait_for_schedule = False # reset so we don't run on ... | 0.007326 |
def exclude_file(sp, f):
"""
Exclude discovered files if they match the special exclude_
search pattern keys
"""
# Make everything a list if it isn't already
for k in sp:
if k in ['exclude_fn', 'exclude_fn_re' 'exclude_contents', 'exclude_contents_re']:
if not isinstance(sp[k... | 0.004676 |
def validate(text, file, schema_type):
"""Validate JSON input using dependencies-schema"""
content = None
if text:
print('Validating text input...')
content = text
if file:
print('Validating file input...')
content = file.read()
if content is None:
click.se... | 0.002299 |
async def fetchval(self, query, *args, column=0, timeout=None):
"""Run a query and return a value in the first row.
Pool performs this operation using one of its connections. Other than
that, it behaves identically to
:meth:`Connection.fetchval() <connection.Connection.fetchval>`.
... | 0.003968 |
def native_to_win32_pathname(name):
"""
@type name: str
@param name: Native (NT) absolute pathname.
@rtype: str
@return: Win32 absolute pathname.
"""
# XXX TODO
# There are probably some native paths that
# won't be converted by this naive appro... | 0.004154 |
def objects_to_td64ns(data, unit="ns", errors="raise"):
"""
Convert a object-dtyped or string-dtyped array into an
timedelta64[ns]-dtyped array.
Parameters
----------
data : ndarray or Index
unit : str, default "ns"
The timedelta unit to treat integers as multiples of.
errors : ... | 0.000883 |
def expectation_payload(prep_prog, operator_programs, random_seed):
"""REST payload for :py:func:`ForestConnection._expectation`"""
if operator_programs is None:
operator_programs = [Program()]
if not isinstance(prep_prog, Program):
raise TypeError("prep_prog variable must be a Quil program... | 0.001709 |
def sync(collector):
"""Sync an environment"""
amazon = collector.configuration['amazon']
aws_syncr = collector.configuration['aws_syncr']
# Convert everything before we try and sync anything
log.info("Converting configuration")
converted = {}
for thing in collector.configuration["__registe... | 0.001134 |
def list_directories_and_files(self, share_name, directory_name=None, **kwargs):
"""
Return the list of directories and files stored on a Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type dir... | 0.003866 |
def stopped(self):
"""Return if the stream is stopped."""
if self.tune and self.tune.get('@stopped'):
return True if self.tune.get('@stopped') == 'true' else False
else:
raise PyMediaroomError("No information in <node> about @stopped") | 0.007067 |
def move_all(self, from_dict, to_dict):
'''Move everything from one dictionary to another.
This can be expensive if the source dictionary is large.
This always requires a session lock.
:param str from_dict: source dictionary
:param str to_dict: destination dictionary
... | 0.001596 |
def fromXml( parent, xml, actions = None ):
"""
Generates an XMenu from the inputed xml data and returns the resulting \
menu. If no action dictionary is supplied, it will be generated based \
on the parents actions.
:param parent | <QWidget>
... | 0.012138 |
def format_decimal(decimal):
"""
Formats a decimal number
:param decimal: the decimal value
:return: the formatted string value
"""
# strip trailing fractional zeros
normalized = decimal.normalize()
sign, digits, exponent = normalized.as_tuple()
if exponent >= 1:
normalized =... | 0.002695 |
def waverange(self):
"""Range of `waveset`."""
if self.waveset is None:
x = [None, None]
else:
x = u.Quantity([self.waveset.min(), self.waveset.max()])
return x | 0.009259 |
def do_init(self, fs_settings, global_quota):
fs_settings = deepcopy(fs_settings) # because we store some of the info, we need a deep copy
'''
If the same restrictions are applied for many destinations, we use the same job to avoid processing
files twice
'''
for sender_s... | 0.00675 |
def _set_mac_group_entry(self, v, load=False):
"""
Setter method for mac_group_entry, mapped from YANG variable /mac_group/mac_group_entry (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_mac_group_entry is considered as a private
method. Backends looking to po... | 0.003502 |
def main():
"""Main function for the deprecated 'sl' command."""
print("ERROR: Use the 'slcli' command instead.", file=sys.stderr)
print("> slcli %s" % ' '.join(sys.argv[1:]), file=sys.stderr)
exit(-1) | 0.004608 |
def MergeLines(self, lines, message):
"""Merges a text representation of a protocol message into a message."""
self._allow_multiple_scalars = True
self._ParseOrMerge(lines, message)
return message | 0.004717 |
def _set_ldp_sync_info(self, v, load=False):
"""
Setter method for ldp_sync_info, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_ldp_sync_info is considered as a private
metho... | 0.005423 |
def copy(self, memo):
"""
Make a copy of this SimAbstractMemory object
:return:
"""
am = SimAbstractMemory(
memory_id=self._memory_id,
endness=self.endness,
stack_region_map=self._stack_region_map,
generic_region_map=self._generic_r... | 0.003922 |
def pication(rings, pos_charged, protcharged):
"""Return all pi-Cation interaction between aromatic rings and positively charged groups.
For tertiary and quaternary amines, check also the angle between the ring and the nitrogen.
"""
data = namedtuple(
'pication', 'ring charge distance offset typ... | 0.006955 |
def _api_key_patch_add(conn, apiKey, pvlist):
'''
the add patch operation for a list of (path, value) tuples on an ApiKey resource list path
'''
response = conn.update_api_key(apiKey=apiKey,
patchOperations=_api_key_patchops('add', pvlist))
return response | 0.009646 |
def update_child_calls(self):
"""Replace child nodes on original function call with their partials"""
for node in filter(lambda n: len(n.arg_name), self.child_list):
self.data["bound_args"].arguments[node.arg_name] = node.partial()
self.updated = True | 0.006944 |
def _get_on_trixel_sources_from_database_query(
self):
"""*generate the mysql query before executing it*
"""
self.log.debug(
'completed the ````_get_on_trixel_sources_from_database_query`` method')
tableName = self.tableName
raCol = self.raCol
dec... | 0.004093 |
def _get_ess(sample_array):
"""Compute the effective sample size for a 2D array."""
shape = sample_array.shape
if len(shape) != 2:
raise TypeError("Effective sample size calculation requires 2 dimensional arrays.")
n_chain, n_draws = shape
if n_chain <= 1:
raise TypeError("Effective ... | 0.00272 |
def _load_nucmer_hits(self, infile):
'''Returns dict ref name => list of nucmer hits from infile'''
hits = {}
file_reader = pymummer.coords_file.reader(infile)
for al in file_reader:
if al.ref_name not in hits:
hits[al.ref_name] = []
hits[al.ref_na... | 0.00565 |
def untrim(self, n='all'):
"""
Removes xmin, xmax, ymin, and ymax.
Parameters
----------
n='all'
Which data set to perform this action upon. 'all' means all data
sets, or you can specify a list.
"""
if len(self._set_xdata)==0 or l... | 0.014396 |
def create_user(self, name, password):
"""Create user with hashed password."""
hashed_password = self._password_hasher(password)
return dict(name=name, password=hashed_password) | 0.00995 |
def build(self):
"""
Create the current layer
:return: string of the packet with the payload
"""
p = self.do_build()
p += self.build_padding()
p = self.build_done(p)
return p | 0.008368 |
def popen_xboard(cls, command: Union[str, List[str]], *, timeout: Optional[float] = 10.0, debug: bool = False, setpgrp: bool = False, **popen_args: Any) -> "SimpleEngine":
"""
Spawns and initializes an XBoard engine.
Returns a :class:`~chess.engine.SimpleEngine` instance.
"""
ret... | 0.009547 |
def raw_clean(self, datas):
"""
Apply a cleaning on raw datas.
"""
datas = strip_tags(datas) # Remove HTML
datas = STOP_WORDS.rebase(datas, '') # Remove STOP WORDS
datas = PUNCTUATION.sub('', datas) # Remove punctuation
datas = datas.lower()
... | 0.00542 |
def is_colliding(self, other):
"""Check to see if two AABoundingBoxes are colliding."""
if isinstance(other, AABoundingBox):
if self.rect.colliderect(other.rect):
return True
return False | 0.00823 |
def compact(self, term_doc_matrix):
'''
Parameters
----------
term_doc_matrix : TermDocMatrix
Term document matrix object to compact
Returns
-------
New term doc matrix
'''
domain_mat = CombineDocsIntoDomains(term_doc_matrix).get_new_term_doc_mat(self.doc_domains)
domain_count = (domain_mat > 0)... | 0.034314 |
def end_container(self, cancel=None):
"""Finishes and registers the currently-active container, unless
'cancel' is True."""
if not self._containers:
return
container = self._containers.pop()
if len(self._containers) >= 1:
parent = self._containers[-1]
... | 0.004662 |
async def handle_event(self, event: "node.LavalinkEvents", extra):
"""
Handles various Lavalink Events.
If the event is TRACK END, extra will be TrackEndReason.
If the event is TRACK EXCEPTION, extra will be the string reason.
If the event is TRACK STUCK, extra will be the thr... | 0.003231 |
def _to_ndarray(self, a):
"""Casts Python lists and tuples to a numpy array or raises an AssertionError."""
if isinstance(a, (list, tuple)):
a = numpy.array(a)
if not is_ndarray(a):
raise TypeError("Expected an ndarray but got object of type '{}' instead".format(type(a)... | 0.011765 |
def normal_fields(self):
"""fields that aren't magic (eg, aren't _id, _created, _updated)"""
return {f:v for f, v in self.fields.items() if not f.startswith('_')} | 0.016854 |
def _get_path(name, settings, mkdir=True):
"""
Generate a project path.
"""
default_projects_path = settings.config.get("projects_path")
path = None
if default_projects_path:
path = raw_input("\nWhere would you like to create this project? [{0}/{1}] ".format(default_projects_path, name)... | 0.005245 |
def random_int(maximum_value):
""" Random generator (PyCrypto getrandbits wrapper). The result is a non-negative value.
:param maximum_value: maximum integer value
:return: int
"""
if maximum_value == 0:
return 0
elif maximum_value == 1:
return random_bits(1)
bits = math.floor(math.log2(maximum_value))
re... | 0.031941 |
def drug_timelines(
drug_events_df: DataFrame,
event_lasts_for: datetime.timedelta,
patient_colname: str = DEFAULT_PATIENT_COLNAME,
event_datetime_colname: str = DEFAULT_DRUG_EVENT_DATETIME_COLNAME) \
-> Dict[Any, IntervalList]:
"""
Takes a set of drug event start ... | 0.000509 |
def ssim(data, ground_truth, size=11, sigma=1.5, K1=0.01, K2=0.03,
dynamic_range=None, normalized=False, force_lower_is_better=False):
r"""Structural SIMilarity between ``data`` and ``ground_truth``.
The SSIM takes value -1 for maximum dissimilarity and +1 for maximum
similarity.
See also `th... | 0.000218 |
def representation_function_compiler(self, func_name):
"""Generic function can be used to compile __repr__ or __unicode__ or __str__"""
def get_col_accessor(col):
return ALCHEMY_TEMPLATES.col_accessor.safe_substitute(col=col)
def get_col_evaluator(col):
return ALCHEMY_T... | 0.009698 |
def verify(xml):
'''Verifies whether the validity of the signature contained in an XML
document following the XMLDSig standard'''
try:
from cStringIO import cStringIO as StringIO
except ImportError:
from StringIO import StringIO
xml = xml.encode('utf-8', 'xmlcharrefreplace')
... | 0.006293 |
def row_absent(name, db, table, where_sql, where_args=None):
'''
Makes sure the specified row is absent in db. If multiple rows
match where_sql, then the state will fail.
name
Only used as the unique ID
db
The database file name
table
The table name to check
wher... | 0.000818 |
def coords_from_query(query):
"""Transform a query line into a (lng, lat) pair of coordinates."""
try:
coords = json.loads(query)
except ValueError:
query = query.replace(',', ' ')
vals = query.split()
coords = [float(v) for v in vals]
return tuple(coords[:2]) | 0.003247 |
def to_csv(self, path, iamc_index=False, **kwargs):
"""Write timeseries data to a csv file
Parameters
----------
path: string
file path
iamc_index: bool, default False
if True, use `['model', 'scenario', 'region', 'variable', 'unit']`;
else, u... | 0.004651 |
def token_auto_auth(func):
"""Wrap class methods with automatic token re-authentication.
This wrapper will detect authentication failures coming from its wrapped method. When one is
caught, it will request a new token, and simply replay the original request.
The one constraint that this wrapper has is... | 0.005571 |
def load_cropped_svhn(path='data', include_extra=True):
"""Load Cropped SVHN.
The Cropped Street View House Numbers (SVHN) Dataset contains 32x32x3 RGB images.
Digit '1' has label 1, '9' has label 9 and '0' has label 0 (the original dataset uses 10 to represent '0'), see `ufldl website <http://ufldl.stanfo... | 0.002259 |
def set_filter(self, props_filter):
"""
Changes the current filter for the given one
:param props_filter: The new requirement filter on service properties
:raise TypeError: Unknown filter type
"""
if props_filter is not None and not (
is_string(props_filter)
... | 0.001776 |
def to_utc(a_datetime, keep_utc_tzinfo=False):
"""
Convert a time awared datetime to utc datetime.
:param a_datetime: a timezone awared datetime. (If not, then just returns)
:param keep_utc_tzinfo: whether to retain the utc time zone information.
**中文文档**
将一个带时区的时间转化成UTC时间。而对于UTC时间而言, 有没有时区信息... | 0.001681 |
def __put_buttons_in_buttonframe(choices, default_choice, cancel_choice):
"""Put the buttons in the buttons frame
"""
global buttonsFrame, cancel_invoke
# TODO: I'm using a dict to hold buttons, but this could all be cleaned up if I subclass Button to hold
# all the event bindings, etc
# T... | 0.001685 |
def treynor_ratio(self, benchmark, rf=0.02):
"""Return over `rf` per unit of systematic risk.
A measure of risk-adjusted performance that relates a
portfolio's excess returns to the portfolio's beta.
[Source: CFA Institute]
Parameters
----------
benchmark : {pd.... | 0.001705 |
def find_analysis_interims(ar_or_sample):
""" This function is used to find keywords that are not on the analysis
but keywords that are on the interim fields.
This function and is is_keyword function should probably be in
resultsimport.py or somewhere central where it can be used by other
... | 0.001779 |
def _extend_breaks(self, major):
"""
Append 2 extra breaks at either end of major
If breaks of transform space are non-equidistant,
:func:`minor_breaks` add minor breaks beyond the first
and last major breaks. The solutions is to extend those
breaks (in transformed space... | 0.002315 |
def list_device_subscriptions(self, device_id, **kwargs):
"""Lists all subscribed resources from a single device
:param device_id: ID of the device (Required)
:returns: a list of subscribed resources
:rtype: list of str
"""
api = self._get_api(mds.SubscriptionsApi)
... | 0.004843 |
def translations(self):
"""
Yield all six translations of a nucleotide sequence.
@return: A generator that produces six L{TranslatedRead} instances.
"""
rc = self.reverseComplement().sequence
for reverseComplemented in False, True:
for frame in 0, 1, 2:
... | 0.001972 |
def add_constraints(self, *args, **kwargs):
"""
Add some constraints to the state.
You may pass in any number of symbolic booleans as variadic positional arguments.
"""
if len(args) > 0 and isinstance(args[0], (list, tuple)):
raise Exception("Tuple or list passed to ... | 0.004077 |
def variants(ctx, snpeff):
"""Print the variants in a vcf"""
head = ctx.parent.head
vcf_handle = ctx.parent.handle
outfile = ctx.parent.outfile
silent = ctx.parent.silent
print_headers(head, outfile=outfile, silent=silent)
for line in vcf_handle:
print_variant(variant_line=... | 0.016913 |
def crop_bbox_by_coords(bbox, crop_coords, crop_height, crop_width, rows, cols):
"""Crop a bounding box using the provided coordinates of bottom-left and top-right corners in pixels and the
required height and width of the crop.
"""
bbox = denormalize_bbox(bbox, rows, cols)
x_min, y_min, x_max, y_ma... | 0.006073 |
def terminal_width():
"""Returns the terminal's width (number of character columns)."""
try:
if os.name == 'nt':
_WindowsCSBI.initialize()
return _WindowsCSBI.get_info(_WindowsCSBI.HANDLE_STDOUT)['terminal_width']
return struct.unpack('hhhh', fcntl.ioctl(0, termios.TIOCGW... | 0.007916 |
def shape(self):
"""
Returns (rowCount, valueCount)
"""
bf = self.copy()
content = requests.get(bf.dataset_url).json()
rowCount = content['status']['rowCount']
valueCount = content['status']['valueCount']
return (rowCount, valueCount) | 0.006689 |
def dyndns_add(nameserver, name, rdata, type="A", ttl=10):
"""Send a DNS add message to a nameserver for "name" to have a new "rdata"
dyndns_add(nameserver, name, rdata, type="A", ttl=10) -> result code (0=ok)
example: dyndns_add("ns1.toto.com", "dyn.toto.com", "127.0.0.1")
RFC2136
"""
zone = name[name.find(".... | 0.001305 |
def filter(self, node, condition):
"""
This method accepts a node and the condition function; a
generator will be returned to yield the nodes that got matched
by the condition.
"""
if not isinstance(node, Node):
raise TypeError('not a node')
for chil... | 0.004158 |
def download_file(self, project_name, remote_path, local_path=None):
"""
Download a file from a project
When local_path is None the file will be downloaded to the base filename
:param project_name: str: name of the project to download a file from
:param remote_path: str: remote p... | 0.0064 |
def get_targets(self, predicate=None):
"""Returns the candidate targets this task should act on.
This method is a convenience for processing optional transitivity. Tasks may bypass it
and make their own decisions on which targets to act on.
NOTE: This method was introduced in 2018, so at the time of w... | 0.00733 |
def capture_url_missing_namespace(self, node):
"""
Capture missing namespace in url include.
"""
for arg in node.args:
if not(isinstance(arg, ast.Call) and isinstance(arg.func, ast.Name)):
continue
if arg.func.id != 'include':
conti... | 0.005445 |
def cfset_to_set(cfset):
"""Convert CFSet to python set."""
count = cf.CFSetGetCount(cfset)
buffer = (c_void_p * count)()
cf.CFSetGetValues(cfset, byref(buffer))
return set([cftype_to_value(c_void_p(buffer[i])) for i in range(count)]) | 0.003937 |
def pageassert(func):
'''
Decorator that assert page number
'''
@wraps(func)
def wrapper(*args, **kwargs):
if args[0] < 1 or args[0] > 40:
raise ValueError('Page Number not found')
return func(*args, **kwargs)
return wrapper | 0.003623 |
def vel_disp(self, kwargs_profile, kwargs_aperture, kwargs_light, kwargs_anisotropy, num=1000):
"""
computes the averaged LOS velocity dispersion in the slit (convolved)
:param gamma:
:param phi_E:
:param r_eff:
:param r_ani:
:param R_slit:
:param FWHM:
... | 0.006221 |
def ResidualFeedForward(feature_depth,
feedforward_depth,
dropout,
mode):
"""Residual feed-forward layer with normalization at start."""
return layers.Residual(
layers.LayerNorm(),
layers.Dense(feedforward_depth),
layers.Relu(... | 0.006608 |
def _xdate_setter(self, xdate_format='%Y-%m-%d'):
"""Makes x axis a date axis with auto format
Parameters
----------
xdate_format: String
\tSets date formatting
"""
if xdate_format:
# We have to validate xdate_format. If wrong then bail out.
... | 0.002937 |
def warp_image_by_corner_points_projection(corner_points, image):
"""Given corner points of a Sudoku, warps original selection to a square image.
:param corner_points:
:type: corner_points: list
:param image:
:type image:
:return:
:rtype:
"""
# Clarify by storing in named variables... | 0.001978 |
def _dot_product(self, imgs_to_decode):
""" Decoding using the dot product.
"""
return np.dot(imgs_to_decode.T, self.feature_images).T | 0.012658 |
def main():
"""
Run autosub as a command-line program.
"""
parser = argparse.ArgumentParser()
parser.add_argument('source_path', help="Path to the video or audio file to subtitle",
nargs='?')
parser.add_argument('-C', '--concurrency', help="Number of concurrent API reques... | 0.003264 |
def network_from_edgelist(self, edgelist):
"""
Defines a network from an array.
Parameters
----------
edgelist : list of lists.
A list of lists which are 3 or 4 in length. For binary networks each sublist should be [i, j ,t] where i and j are node indicies and t is t... | 0.004 |
def config_files():
'''
Get list of currently used config files.
'''
sensu_loaded_tempfile = os.environ.get('SENSU_LOADED_TEMPFILE')
sensu_config_files = os.environ.get('SENSU_CONFIG_FILES')
sensu_v1_config = '/etc/sensu/config.json'
sensu_v1_confd = '/etc/sensu/conf.d'
if sensu_loaded_t... | 0.000986 |
def get_events_by_tripI_and_dsut(self, trip_I, day_start_ut,
start_ut=None, end_ut=None):
"""
Get trip data as a list of events (i.e. dicts).
Parameters
----------
trip_I : int
shorthand index of the trip.
day_start_ut : i... | 0.001316 |
def setDirection(self, outputLocation, inputLocation):
"""
Sets the output-to-input direction by setting both the locations \
at the same time.
:param outputLocation | <XConnectionLocation>
:param inputLocation | <XConnectionLocation>
"""
... | 0.007353 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.