text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
async def update(self):
"""Fetch the latest data from IP Webcam."""
status_data = await self._request('/status.json?show_avail=1')
if status_data:
self.status_data = status_data
sensor_data = await self._request('/sensors.json')
if sensor_data:
... | 0.005666 |
def get_stp_mst_detail_output_cist_cist_bridge_id(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_stp_mst_detail = ET.Element("get_stp_mst_detail")
config = get_stp_mst_detail
output = ET.SubElement(get_stp_mst_detail, "output")
cist ... | 0.003546 |
def _copyItemToClipboard(self):
"""Callback for item menu."""
if self._current_item is None:
return
dp = getattr(self._current_item, '_dp', None)
if dp and dp.archived:
path = dp.fullpath.replace(" ", "\\ ")
QApplication.clipboard().setText(path, QClip... | 0.00489 |
def _iter_categorized_partners(self, state):
'''
Iterator over the partners giving as extra param partners of the same
category.
'''
# categorize partners into the structure
# partner_class -> list of its instances
categorized = dict()
for partner in state... | 0.002469 |
def create_vm(client, name, compute_resource, datastore, disksize, nics,
memory, num_cpus, guest_id, host=None):
"""Create a virtual machine using the specified values.
:param name: The name of the VM to create.
:type name: str
:param compute_resource: The name of a ComputeResource in whi... | 0.001006 |
def nested_shape(array_or_tuple):
"""Figures out the shape of tensors possibly embedded in tuples
i.e
[0,0] returns (2)
([0,0], [0,0]) returns (2,2)
(([0,0], [0,0]),[0,0]) returns ((2,2),2)
"""
if hasattr(array_or_tuple, 'size'):
# pytorch tensors use V.size() to get size of te... | 0.002356 |
def samples(self, nsamples, rstate=None):
"""
Draw `nsamples` samples randomly distributed within the unit cube.
Returns
-------
x : `~numpy.ndarray` with shape (nsamples, ndim)
A collection of coordinates within the unit cube.
"""
if rstate is None... | 0.004454 |
def minor_tick_mark(self):
"""
Read/write :ref:`XlTickMark` value specifying the type of minor tick
mark for this axis.
"""
minorTickMark = self._element.minorTickMark
if minorTickMark is None:
return XL_TICK_MARK.CROSS
return minorTickMark.val | 0.00641 |
def _load_nested_libraries(self, library_path, target_dict):
"""Recursively load libraries within path
Adds all libraries specified in a given path and stores them into the provided library dictionary. The library
entries in the dictionary consist only of the path to the library in the file sys... | 0.007491 |
def _create_list(value, allow_filename=False):
"""Create a list from the input value.
If the input is a list already, return it.
If the input is a comma-separated string, split it.
"""
if isinstance(value, list):
return value
elif isinstance(value, string_type):
if allow_filena... | 0.001712 |
def merge_arena(self, mujoco_arena):
"""Adds arena model to the MJCF model."""
self.arena = mujoco_arena
self.table_top_offset = mujoco_arena.table_top_abs
self.table_size = mujoco_arena.table_full_size
self.merge(mujoco_arena) | 0.007491 |
def addOntology(self, ontology):
"""
Add an ontology map to this data repository.
"""
self._ontologyNameMap[ontology.getName()] = ontology
self._ontologyIdMap[ontology.getId()] = ontology
self._ontologyIds.append(ontology.getId()) | 0.007194 |
def get_services(self):
"""
Retrieves the list of system services that are currently running in
this process.
@see: L{System.get_services}
@rtype: list( L{win32.ServiceStatusProcessEntry} )
@return: List of service status descriptors.
"""
self.__load_Sy... | 0.004545 |
def is_hash_in_index(self, filehash):
"""
Check if there is a document using this file hash
"""
filehash = (u"%X" % filehash)
results = self.__searcher.search(
whoosh.query.Term('docfilehash', filehash))
return bool(results) | 0.007042 |
def define_params(self):
'''
Define parameters.
'''
input_dim = self.input_dim
hidden_dim = self.hidden_dim
prefix = self.name
self.w_matrix = tf.Variable(tf.random_normal([input_dim, 3 * hidden_dim], stddev=0.1),
name='/'.join(... | 0.007716 |
def delete(vpc_id=None, name=None, vpc_name=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a VPC ID or VPC name, delete the VPC.
Returns {deleted: true} if the VPC was deleted and returns
{deleted: false} if the VPC was not deleted.
CLI Example:
.. cod... | 0.001673 |
def _convert_entity_to_json(source):
''' Converts an entity object to json to send.
The entity format is:
{
"Address":"Mountain View",
"Age":23,
"AmountDue":200.23,
"CustomerCode@odata.type":"Edm.Guid",
"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833",
"Custome... | 0.000592 |
def create(self, req, driver):
"""Create a network
Create a new netowrk on special cloud
with:
:Param req
:Type object Request
"""
response = driver.create_network(req.params)
data = {
'action': "create",
'controller': "network",... | 0.004608 |
def close(self):
"""
Starts closing the HighFive master. The server will be closed and
all queued job sets will be cancelled.
"""
if self._closed:
return
self._closed = True
self._server.close()
self._manager.close()
for worker in se... | 0.005571 |
def compound_crossspec(a_data, tbin, Df=None, pointProcess=False):
"""
Calculate cross spectra of compound signals.
a_data is a list of datasets (a_data = [data1,data2,...]).
For each dataset in a_data, the compound signal is calculated
and the crossspectra between these compound signals is computed... | 0.003307 |
def sys_call(cmd):
"""Execute cmd and capture stdout and stderr
:param cmd: command to be executed
:return: (stdout, stderr)
"""
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
return p.stdout.readlines(), p.stderr.readlines() | 0.006557 |
def radintpix(data, dataerr, bcx, bcy, mask=None, pix=None, returnavgpix=False,
phi0=0, dphi=0, returnmask=False, symmetric_sector=False,
doslice=False, errorpropagation=2, autoqrange_linear=True):
"""Radial integration (averaging) on the detector plane
Inputs:
data: scatter... | 0.001473 |
def conceptscheme_from_uri(conceptscheme_uri, **kwargs):
'''
Read a SKOS Conceptscheme from a :term:`URI`
:param string conceptscheme_uri: URI of the conceptscheme.
:rtype: skosprovider.skos.ConceptScheme
'''
# get the conceptscheme
# ensure it only ends in one slash
conceptscheme_uri ... | 0.002361 |
def validate(config):
'''
Validate the beacon configuration
'''
if not isinstance(config, list):
return False, ('Configuration for network_settings '
'beacon must be a list.')
else:
_config = {}
list(map(_config.update, config))
interfaces = _c... | 0.003074 |
def startElement(self, name, attrs):
"""
Handle opening elements.
:param name: Name of the element
:type name: String
:param attrs: Attributes of the element
:type attrs: Dict
"""
if name in self.ignore_start:
return
try:
h... | 0.004107 |
async def request(self, method: base.String,
data: Optional[Dict] = None,
files: Optional[Dict] = None, **kwargs) -> Union[List, Dict, base.Boolean]:
"""
Make an request to Telegram Bot API
https://core.telegram.org/bots/api#making-requests
:... | 0.008314 |
def run_program(prog_list, debug, shell):
"""Run a program and check program return code Note that some commands don't work
well with Popen. So if this function is specifically called with 'shell=True',
then it will run the old 'os.system'. In which case, there is no program output
"""
try:
... | 0.00565 |
def insert(self, order_id, card_id, appid, card_ext):
"""
制作发票卡券,并放入用户卡包
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param card_id: 发票卡券模板的编号
:param appid: 商户 AppID
:param card_ext: 发票具体内容
:typ... | 0.00321 |
def feed_amount(self, amount):
'''Calling this function sets the form feed amount to the specified setting.
Args:
amount: the form feed setting you desire. Options are '1/8', '1/6', 'x/180', and 'x/60',
with x being your own desired amount. X must be a minimum of 24 for 'x/1... | 0.008658 |
def fd(self):
""":return: file descriptor used to create the underlying mapping.
**Note:** it is not required to be valid anymore
:raise ValueError: if the mapping was not created by a file descriptor"""
if isinstance(self._rlist.path_or_fd(), string_types()):
raise ValueErr... | 0.008772 |
def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return is_module_or_package(to_text_string(qstr)) | 0.01 |
def minimize_source(source):
"""Remove comments and docstrings from Python `source`, preserving line
numbers and syntax of empty blocks.
:param str source:
The source to minimize.
:returns str:
The minimized source.
"""
source = mitogen.core.to_text(source)
tokens = tokeniz... | 0.001972 |
def prompt(youtube_list):
'''
Prompts for song number from list of songs
'''
option = int(input('\nEnter song number > '))
try:
song_url = list(youtube_list.values())[option - 1]
song_title = list(youtube_list.keys())[option - 1]
except IndexError:
log.log_error('Invalid... | 0.001506 |
def get_image_url(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Extracts the URL from an image element on the page. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return ... | 0.007092 |
def delete_record_set(self, record_set):
"""Append a record set to the 'deletions' for the change set.
:type record_set:
:class:`google.cloud.dns.resource_record_set.ResourceRecordSet`
:param record_set: the record set to append.
:raises: ``ValueError`` if ``record_set`` is... | 0.003891 |
def get_sequence_rules(self):
"""Gets the ``SequenceRuleList`` resulting from a search.
return: (osid.assessment.authoring.SequenceRuleList) - the
sequence rule list
raise: IllegalState - list has already been retrieved
*compliance: mandatory -- This method must be impl... | 0.00363 |
def get_cached(location, **kwargs):
"""
Simple wrapper that adds Django caching support to 'geocoder.get()'.
"""
result = cache.get(location)
# Result is not cached or wrong
if not result or not result.ok:
result = geocoder.get(location, **kwargs)
if result.ok:
cache... | 0.00277 |
def read_config(self, config_file):
"""
Parses the specified configuration file and stores the values. Raises
an InvalidConfigurationFile exception if the file is not well-formed.
"""
cfg = ConfigParser.SafeConfigParser()
try:
cfg.read(config_file)
exc... | 0.001976 |
def meta(cls):
"""Return a dictionary containing meta-information about the given
resource."""
if getattr(cls, '__from_class__', None) is not None:
cls = cls.__from_class__
attribute_info = {}
for name, value in cls.__table__.columns.items():
attribute_inf... | 0.005 |
def cutout_shape(self, shape_obj):
"""
Cut out and return a portion of the data corresponding to `shape_obj`.
A masked numpy array is returned, where the pixels not enclosed in
the shape are masked out.
"""
view, mask = self.get_shape_view(shape_obj)
# cutout ou... | 0.003914 |
def _apply_default_values(catalog, default_values):
"""Aplica valores default a los campos de un catálogo.
Si el campo está vacío, aplica el default. Si tiene un valor, deja el valor
que estaba. Sólo soporta defaults para las siguientes clases:
catalog
dataset
distribution
f... | 0.000523 |
def current_window_handle(self):
"""
Returns the handle of the current window.
:Usage:
::
driver.current_window_handle
"""
if self.w3c:
return self.execute(Command.W3C_GET_CURRENT_WINDOW_HANDLE)['value']
else:
return s... | 0.005333 |
def create_albaran_automatic(pk, list_lines):
"""
creamos de forma automatica el albaran
"""
line_bd = SalesLineAlbaran.objects.filter(line_order__pk__in=list_lines).values_list('line_order__pk')
if line_bd.count() == 0 or len(list_lines) != len(line_bd[0]):
# solo aq... | 0.005254 |
def status_message(self):
"""Return friendly response from API based on response code. """
msg = None
if self.last_ddns_response in response_messages.keys():
return response_messages.get(self.last_ddns_response)
if 'good' in self.last_ddns_response:
ip = re.sear... | 0.003584 |
def resume(self, email, master_token, state=None, sync=True):
"""Authenticate to Google with the provided master token & sync.
Args:
email (str): The account to use.
master_token (str): The master token.
state (dict): Serialized state to load.
Raises:
... | 0.003478 |
def __create_proj_mat(self, size):
"""Create a random projection matrix
[1] D. Achlioptas. Database-friendly random projections: Johnson-Lindenstrauss with binary coins.
[2] P. Li, et al. Very sparse random projections.
http://scikit-learn.org/stable/modules/random_projection.html#spar... | 0.005658 |
def run(self, realm, users):
"""
Requests a TGT in the name of the users specified in users.
Returns a list of usernames that are in the domain.
realm: kerberos realm (domain name of the corp)
users: list : list of usernames to test
"""
existing_users = []
for user in users:
logging.debug('Probing ... | 0.041312 |
def process_notebook(self, disable_warnings=True):
"""Process the notebook and create all the pictures and files
This method runs the notebook using the :mod:`nbconvert` and
:mod:`nbformat` modules. It creates the :attr:`outfile` notebook,
a python and a rst file"""
infile = sel... | 0.000823 |
def draw_freehand(self):
""" Freehand sketching.
"""
if _ctx._ns["mousedown"]:
x, y = mouse()
if self.show_grid:
x, y = self.grid.snap(x, y)
if self.freehand_move == True:
cmd = MOVETO... | 0.009208 |
def fsencoding(s, encoding=sys.getfilesystemencoding()):
"""
Ensure the given argument is in filesystem encoding (not unicode)
"""
if isinstance(s, unicode):
s = s.encode(encoding)
return s | 0.004608 |
def list_qos_rule_types(self, retrieve_all=True, **_params):
"""List available qos rule types."""
return self.list('rule_types', self.qos_rule_types_path,
retrieve_all, **_params) | 0.009091 |
def output_to_graphviz(file, namer=_graphviz_default_namer, block=None):
""" Walk the block and output it in graphviz format to the open file. """
print(block_to_graphviz_string(block, namer), file=file) | 0.004739 |
def output_results(results, split_id='results', output_stream=None):
'''
Log `results` readably to `output_stream`, with a header
containing `split_id`.
:param results: a dictionary of summary statistics from an evaluation
:type results: dict(str -> object)
:param str split_id: an identifier f... | 0.001323 |
def excel():
"""
Convert Excel files to LiPD files. LiPD data is returned directly from this function.
| Example
| 1: lipd.readExcel()
| 2: D = lipd.excel()
:return dict _d: Metadata
"""
global files, cwd, settings
_d = {}
# Turn off verbose. We don't want to clutter the consol... | 0.003642 |
def decode_sql(self, sql):
"""Base64 decode a string. This should only be used for sql in calls.
:param str sql: The base64 encoded form of the original utf-8 string
:return str: The decoded utf-8 string
"""
# JSON is defined as using "unicode", we'll go a step further and
... | 0.002358 |
def forward(self, # pylint: disable=arguments-differ
inputs: torch.Tensor,
word_inputs: torch.Tensor = None) -> Dict[str, Union[torch.Tensor, List[torch.Tensor]]]:
"""
Parameters
----------
inputs: ``torch.Tensor``, required.
Shape ``(batch_size... | 0.00432 |
def gateway_by_type(self, type=None, on_network=None): # @ReservedAssignment
"""
Return gateways for the specified node. You can also
specify type to find only gateways of a specific type.
Valid types are: bgp_peering, netlink, ospfv2_area.
:param RoutingNode self: the routing node to check
... | 0.002465 |
def set_source_nodes(self, source_nodes):
r"""
Set the source nodes and compute their t-weights.
Parameters
----------
source_nodes : sequence of integers
Declare the source nodes via their ids.
Notes
-----
It does not get che... | 0.00814 |
def on_unselect(self, item, action):
"""Add an action to make when an object is unfocused."""
if not isinstance(item, int):
item = self.items.index(item)
self._on_unselect[item] = action | 0.008969 |
def crop(stream, x, y, width, height, **kwargs):
"""Crop the input video.
Args:
x: The horizontal position, in the input video, of the left edge of
the output video.
y: The vertical position, in the input video, of the top edge of the
output video.
width: The width... | 0.003012 |
def publish(self, key, value):
"""publish value to status"""
self.log.debug(
"Publishing status: %s/%s: %s", self.__class__.__name__, key, value)
self.core.publish(self.__class__.__name__, key, value) | 0.012712 |
def get_vs_dir_from_tool_dir(self):
"""
Get the directory of Visual Studio
from the directory Tools.
"""
index = self.tool_dir.find(r'Common7\Tools')
return self.tool_dir[:index] | 0.00885 |
def getEmailAddresses(self):
"""
Return an iterator of all email addresses associated with this person.
@return: an iterator of unicode strings in RFC2822 address format.
"""
return self.store.query(
EmailAddress,
EmailAddress.person == self).getColumn('a... | 0.006098 |
def show_corrections(self, status=None, nids=None):
"""
Show the corrections applied to the flow at run-time.
Args:
status: if not None, only the tasks with this status are select.
nids: optional list of node identifiers used to filter the tasks.
Return: The num... | 0.005222 |
def should_run_now(self, force=False):
from django_cron.models import CronJobLog
cron_job = self.cron_job
"""
Returns a boolean determining whether this cron should run now or not!
"""
self.user_time = None
self.previously_ran_successful_cron = None
# If... | 0.003604 |
def compare(self, other, filter_fcn=None):
"""Returns True if properties can be compared in terms of eq.
Entity's Fields can be filtered accordingly to 'filter_fcn'.
This callable receives field's name as first parameter and field itself
as second parameter.
It must return True i... | 0.001833 |
def r_plokamos_proxy(self):
""" Proxy to write to the annotation store
:return: response from the remote query store
:rtype: {str: Any}
"""
query = request.data
if self.is_authorized(query,NemoOauthPlugin.current_user()['uri']):
try:
resp = ... | 0.007194 |
def fromOpenIDRequest(cls, request):
"""Instantiate a Request object from the arguments in a
C{checkid_*} OpenID message
"""
self = cls()
args = request.message.getArgs(self.ns_uri)
is_openid1 = request.message.isOpenID1()
if args == {}:
return None
... | 0.005141 |
def power_source_type():
"""
FreeBSD use sysctl hw.acpi.acline to tell if Mains (1) is used or Battery (0).
Beware, that on a Desktop machines this hw.acpi.acline oid may not exist.
@return: One of common.POWER_TYPE_*
@raise: Runtime error if type of power source is not supported... | 0.014388 |
def pre_save(self, model_instance, add):
"""
Process the source image through the defined processors.
"""
file = getattr(model_instance, self.attname)
if file and not file._committed:
image_file = file
if self.resize_source_to:
file.seek(0... | 0.004688 |
def prepare_input(self, extracted_str):
"""
Input raw string and do transformations, as set in template file.
"""
# Remove withspace
if self.options['remove_whitespace']:
optimized_str = re.sub(' +', '', extracted_str)
else:
optimized_str = extrac... | 0.002415 |
def enqueue(self, stream_url, offset=0, opaque_token=None):
"""Adds stream to the queue. Does not impact the currently playing stream."""
directive = self._play_directive('ENQUEUE')
audio_item = self._audio_item(stream_url=stream_url,
offset=offset,
... | 0.004762 |
def get(self, template_ids, session, fields=[]):
'''taobao.delivery.template.get 获取用户指定运费模板信息
获取用户指定运费模板信息'''
request = TOPRequest('taobao.delivery.template.get')
request['template_ids'] = template_ids
if not fields:
fields = self.fields
request['fiel... | 0.009615 |
def remove_label(self, doc, label, update_index=True):
"""
Remove a label from a doc. Takes care of updating the index
"""
doc.remove_label(label)
if update_index:
self.upd_doc(doc)
self.commit() | 0.007722 |
def getDaysToExpire(self):
"""Returns the days until this certificate expires
:returns: Days until the certificate expires
:rtype: int
"""
delta = 0
today = DateTime()
valid_from = self.getValidFrom() or today
valid_to = self.getValidTo()
# one ... | 0.002801 |
def _from_dict(cls, _dict):
"""Initialize a DocumentAccepted object from a json dictionary."""
args = {}
if 'document_id' in _dict:
args['document_id'] = _dict.get('document_id')
if 'status' in _dict:
args['status'] = _dict.get('status')
if 'notices' in _d... | 0.004292 |
def proxy_config(commands, **kwargs):
'''
Send configuration commands over SSH or NX-API
commands
List of configuration commands
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
De... | 0.000678 |
def only_specific_multisets(ent, multisets_to_show):
'''
returns a pretty-printed string for specific features in a FeatureCollection
'''
out_str = []
for mset_name in multisets_to_show:
for key, count in ent[mset_name].items():
out_str.append( '%s - %d: %s' % (mset_name, count, ... | 0.011236 |
def backup(self, container, url):
"""
Backup a container to the given restic url
all restic urls are supported
:param container:
:param url: Url to restic repo
examples
(file:///path/to/restic/?password=<password>)
:return: Json response ... | 0.005556 |
def create_app(self, apps_path, name):
"""
Create Trionyx app in given path
:param str path: path to create app in.
:param str name: name of app
:raises FileExistsError:
"""
app_path = os.path.join(apps_path, name.lower())
shutil.copytree(self.app_path, ... | 0.003534 |
def create(self, resource):
"""Create the given resource.
Args:
resource (intern.resource.boss.BossResource): Create a data model object with attributes matching those of the resource.
Returns:
(intern.resource.boss.BossResource): Returns resource of type requested on s... | 0.007477 |
def get_resources(minify=False):
"""Find all resources which subclass ResourceBase.
Keyword arguments:
minify -- select minified resources if available.
Returns:
Dictionary of available resources. Keys are resource names (part of the config variable names), values are dicts
with css and js key... | 0.00565 |
def rake(self, strike, dip, rake_angle, *args, **kwargs):
"""
Plot points representing lineations along planes on the axes.
Additional arguments and keyword arguments are passed on to `plot`.
Parameters
----------
strike, dip : number or sequences of numbers
... | 0.001654 |
def _lookup_nslookup(name, rdtype, timeout=None, server=None):
'''
Use nslookup to lookup addresses
:param name: Name of record to search
:param rdtype: DNS record type
:param timeout: server response timeout
:param server: server to query
:return: [] of records or False if error
'''
... | 0.00098 |
def linsert(self, key, pivot, value, before=False):
"""Inserts value in the list stored at key either before or
after the reference value pivot.
"""
where = b'AFTER' if not before else b'BEFORE'
return self.execute(b'LINSERT', key, where, pivot, value) | 0.006849 |
def resolve_selector(self):
"""Resolve the selector variable in place
"""
effective_selector_list = []
for current_selector in self._selector_list:
# INLINE SELECTOR
if self.get_type(current_selector) != 'selector_variable':
effective_selector_li... | 0.000952 |
def mkdir(path,
owner=None,
grant_perms=None,
deny_perms=None,
inheritance=True,
reset=False):
'''
Ensure that the directory is available and permissions are set.
Args:
path (str):
The full path to the directory.
owner (str):
... | 0.002578 |
def instruction_BLT(self, opcode, ea):
"""
Causes a branch if either, but not both, of the N (negative) or V
(overflow) bits is set. That is, branch if the sign of a valid twos
complement result is, or would be, negative. When used after a subtract
or compare operation on twos co... | 0.007692 |
def ContextTupleToDict(context):
"""Convert a tuple representing a context into a dict of (key, value) pairs
"""
d = {}
if not context:
return d
for k, v in zip(ExceptionWithContext.CONTEXT_PARTS, context):
if v != '' and v != None: # Don't ignore int(0), a valid row_num
d[k] = ... | 0.011976 |
def filter_step_asarray(G, covY, pred, yt):
"""Filtering step of Kalman filter: array version.
Parameters
----------
G: (dy, dx) numpy array
mean of Y_t | X_t is G * X_t
covX: (dx, dx) numpy array
covariance of Y_t | X_t
pred: MeanAndCov object
predictive distribution... | 0.006349 |
def _run_query(client, query, job_config=None):
"""Runs a query while printing status updates
Args:
client (google.cloud.bigquery.client.Client):
Client to bundle configuration needed for API requests.
query (str):
SQL query to be executed. Defaults to the standard SQL d... | 0.001448 |
def _keplerian_to_keplerian_circular(cls, coord, center):
"""Conversion from Mean Keplerian to Keplerian near-circular elements
"""
a, e, i, Ω, ω, ν = coord
ex = e * cos(ω)
ey = e * sin(ω)
u = ω + ν
return np.array([a, ex, ey, i, Ω, u], dtype=float) | 0.006515 |
def get_root_uri(uri):
"""Return root URI - strip query and fragment."""
chunks = urlsplit(uri)
return urlunsplit((chunks.scheme, chunks.netloc, chunks.path, '', '')) | 0.005618 |
def resolution(file_, resolution_string):
"""
A filter to return the URL for the provided resolution of the thumbnail.
"""
if sorl_settings.THUMBNAIL_DUMMY:
dummy_source = sorl_settings.THUMBNAIL_DUMMY_SOURCE
source = dummy_source.replace('%(width)s', '(?P<width>[0-9]+)')
source ... | 0.002103 |
def power(self, n):
"""The matrix power of the channel.
Args:
n (int): compute the matrix power of the superoperator matrix.
Returns:
Chi: the matrix power of the SuperOp converted to a Chi channel.
Raises:
QiskitError: if the input and output dimen... | 0.003883 |
def clear(self) -> None:
"""
Clears out the tracked metrics, but keeps the patience and should_decrease settings.
"""
self._best_so_far = None
self._epochs_with_no_improvement = 0
self._is_best_so_far = True
self._epoch_number = 0
self.best_epoch = None | 0.009464 |
def assign(self, dst, req, src):
"""Helper function for assigning into dst depending on requirements."""
if req == 'null':
return
elif req in ('write', 'inplace'):
dst[:] = src
elif req == 'add':
dst[:] += src | 0.00722 |
def run_normalization(self):
"""
Run the normalization procedures
"""
for index, media_file in enumerate(
tqdm(
self.media_files,
desc="File",
disable=not self.progress,
position=0
... | 0.007067 |
def geometry_within_radius(geometry, center, radius):
"""
To valid whether point or linestring or polygon is inside a radius around a center
Keyword arguments:
geometry -- point/linstring/polygon geojson object
center -- point geojson object
radius -- radius
if(geometry inside radiu... | 0.003322 |
def s_data(nrows_fdata, Nmax, Q):
""" I am going to assume we will always have even data. This is pretty
safe because it means that we have measured both poles of the sphere and
have data that has been continued.
nrows_fdata: Number of rows in fdata.
Nmax: The largest numbe... | 0.006431 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.