text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def clean_ip(ip):
"""
Cleans the ip address up, useful for removing leading zeros, e.g.::
1234:0:01:02:: -> 1234:0:1:2::
1234:0000:0000:0000:0000:0000:0000:000A -> 1234::a
1234:0000:0000:0000:0001:0000:0000:0000 -> 1234:0:0:0:1::
0000:0000:0000:0000:0001:0000:0000:0000 -> ::1:0:... | 0.000719 |
def adjoint(self):
"""Adjoint wavelet transform.
Returns
-------
adjoint : `WaveletTransformInverse`
If the transform is orthogonal, the adjoint is the inverse.
Raises
------
OpNotImplementedError
if `is_orthogonal` is ``False``
"... | 0.003578 |
def copy_frame(frame_id, source_db, target_db):
# type: (cm.ArbitrationId, cm.CanMatrix, cm.CanMatrix) -> bool
"""
Copy a Frame identified by ArbitrationId from source CAN matrix to target CAN matrix.
This function additionally copy all relevant ECUs and Defines.
:param frame_id: Frame arbitration ... | 0.002625 |
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Link Node Dataset File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Dictionary of keywords/cards and parse... | 0.001243 |
def _parse_result(self):
''' Parse the result element of the observation type '''
if self.result is not None:
result = self.result.find(nspv(
"wml2:MeasurementTimeseries"))
self.result = MeasurementTimeseries(result) | 0.00722 |
def second_order_diff(arr, x):
"""Compute second order difference of an array.
A 2nd order forward difference is used for the first point, 2nd order
central difference for interior, and 2nd order backward difference for last
point, returning an array the same length as the input array.
"""
# Co... | 0.000964 |
def remove_property(self, key=None, value=None):
"""Remove all properties matching both key and value.
:param str key: Key of the property.
:param str value: Value of the property.
"""
for k, v in self.properties[:]:
if (key is None or key == k) and (value is None or... | 0.004988 |
def status(self):
"""
Get server status. Uses GET to /status interface.
:Returns: (dict) Server status as described `here <https://cloud.knuverse.com/docs/api/#api-General-Status>`_.
"""
response = self._get(url.status)
self._check_response(response, 200)
return... | 0.008523 |
def _compile_tag_re(self):
"""
Compile regex strings from queue_tag_re option and return list of compiled regex/tag pairs
"""
queue_tag_list = []
for regex_str, tags in iteritems(self._queue_tag_re):
try:
queue_tag_list.append([re.compile(regex_str), [... | 0.00956 |
def pull_file():
""" Get a file from the server """
session_token = request.headers['session_token']
repository = request.headers['repository']
#===
current_user = have_authenticated_user(request.environ['REMOTE_ADDR'], repository, session_token)
if current_user is False: return fail(user_a... | 0.013216 |
def __write_add_tmpl(tag_key, tag_list):
'''
Generate the HTML file for adding.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None
'''
add_file = os.path.join(OUT_DIR, 'add', 'add_' + tag_key.split('_')[1] + '.html')
add_widget_arr = []
# var_dic = eval... | 0.001342 |
def allow_rwe(self, name):
"""Allow all privileges for a particular name group (user, group, other)."""
assert name in PERMISSIONS.keys()
os.chmod(self.file_path, PERMISSIONS[name]['all']) | 0.014151 |
def __create_none_connections(self):
"""!
@brief Creates network without connections.
"""
if (self._conn_represent == conn_represent.MATRIX):
for _ in range(0, self._num_osc, 1):
self._osc_conn.append([False] * self._num_osc);
elif (se... | 0.011494 |
def update_catalog(self, catalog_form):
"""Updates an existing catalog.
arg: catalog_form (osid.cataloging.CatalogForm): the form
containing the elements to be updated
raise: IllegalState - ``catalog_form`` already used in an
update transaction
raise:... | 0.004488 |
def _str_oper(op1, op2=None, reversed=False, no_exaf=False):
''' Returns pop sequence for 16 bits operands
1st operand in HL, 2nd operand in DE
You can swap operators extraction order
by setting reversed to True.
If no_exaf = True => No bits flags in A' will be used.
This s... | 0.000441 |
def calc_ispec(model, ph):
"""Compute isotropic spectrum `phr` of `ph` from 2D spectrum.
Parameters
----------
model : pyqg.Model instance
The model object from which `ph` originates
ph : complex array
The field on which to compute the variance
Returns
-------
kr : arra... | 0.009423 |
def RunJob(self, job):
"""Does the actual work of the Cron, if the job is due to run.
Args:
job: The cronjob rdfvalue that should be run. Must be leased.
Returns:
A boolean indicating if this cron job was started or not. False may
be returned when the threadpool is already full.
Rai... | 0.007781 |
def opener_from_zipfile(zipfile):
"""
Returns a function that will open a file in a zipfile by name.
For Python3 compatibility, the raw file will be converted to text.
"""
def opener(filename):
inner_file = zipfile.open(filename)
if PY3:
from io import TextIOWrapper
... | 0.002358 |
def sort_untl(self, sort_structure):
"""Sort the UNTL Python object by the index
of a sort structure pre-ordered list.
"""
self.children.sort(key=lambda obj: sort_structure.index(obj.tag)) | 0.009091 |
def ansiprint(self, *args, **kwargs):
'''Wrapper around builtins.print() that runs parse() on all arguments first.'''
args = (self.parse(str(i)) for i in args)
builtins.print(*args, **kwargs) | 0.013953 |
def chunk_fill(iterable, size, fillvalue=None):
"""
chunk_fill('ABCDEFG', 3, 'x') --> ABC DEF Gxx
"""
# TODO: not used
args = [iter(iterable)] * size
return itertools.zip_longest(*args, fillvalue=fillvalue) | 0.004348 |
def plot_inputseries(
self, names: Optional[Iterable[str]] = None,
average: bool = False, **kwargs: Any) \
-> None:
"""Plot (the selected) |InputSequence| |IOSequence.series| values.
We demonstrate the functionalities of method |Element.plot_inputseries|
base... | 0.00064 |
def resolve_parent_registry_name(self, registry_name, suffix):
"""
Subclasses should override to specify the default suffix, as the
invocation is done without a suffix.
"""
if not registry_name.endswith(suffix):
raise ValueError(
"child module registr... | 0.004211 |
def timeseries_reactive(self):
"""
Reactive power time series in kvar.
Parameters
-----------
timeseries_reactive : :pandas:`pandas.Seriese<series>`
Series containing reactive power in kvar.
Returns
-------
:pandas:`pandas.Series<series>` or ... | 0.001031 |
def _get_out_file(work_dir, paired):
"""Retrieve manta output variant file, depending on analysis.
"""
if paired:
if paired.normal_bam:
base_file = "somaticSV.vcf.gz"
else:
base_file = "tumorSV.vcf.gz"
else:
base_file = "diploidSV.vcf.gz"
return os.pat... | 0.002703 |
def tnet_to_nx(df, t=None):
"""
Creates undirected networkx object
"""
if t is not None:
df = get_network_when(df, t=t)
if 'weight' in df.columns:
nxobj = nx.from_pandas_edgelist(
df, source='i', target='j', edge_attr='weight')
else:
nxobj = nx.from_pandas_edg... | 0.002703 |
def _setintbe(self, intbe, length=None):
"""Set bitstring to a big-endian signed int interpretation."""
if length is not None and length % 8 != 0:
raise CreationError("Big-endian integers must be whole-byte. "
"Length = {0} bits.", length)
self._setint... | 0.00597 |
def utcoffset(self, dt):
"""
http://docs.python.org/library/datetime.html#datetime.tzinfo.utcoffset
"""
if self.__is_daylight_time(dt):
return self.__dst_offset
else:
return self.__offset | 0.007937 |
def __save_output(self):
"""Saves the output into a native OOo document format.
"""
out = zipfile.ZipFile(self.outputfilename, 'w')
for info_zip in self.infile.infolist():
if info_zip.filename in self.templated_files:
# Template file - we have edited these.
... | 0.001198 |
def restore_geometry_state(self, gs):
"""Restore the position of the main window and the docks.
The gui widgets need to be recreated first.
This function can be called in `on_show()`.
"""
if not gs:
return
if gs.get('geometry', None):
self.resto... | 0.004684 |
def _convert_np_data(data, data_type, num_elems): # @NoSelf
'''
Converts a single np data into byte stream.
'''
if (data_type == 51 or data_type == 52):
if (data == ''):
return ('\x00'*num_elems).encode()
else:
return data.ljust(n... | 0.003591 |
def _format_src_url(self, path, caller_system):
"""
Ensure path is absolute and use the correct URL format for use with
cross Azure storage account copy function.
Args:
path (str): Path or URL.
caller_system (pycosio.storage.azure._AzureBaseSystem subclass):
... | 0.002548 |
def get_time_step(self):
"""
returns current time step of simulation
"""
time_step = c_double()
self.library.get_time_step.argtypes = [POINTER(c_double)]
self.library.get_time_step.restype = None
self.library.get_time_step(byref(time_step))
return time_ste... | 0.006116 |
def _call(self, x, out=None):
"""Create an interpolator from grid values ``x``.
Parameters
----------
x : `Tensor`
The array of values to be interpolated
out : `FunctionSpaceElement`, optional
Element in which to store the interpolator
Returns
... | 0.001792 |
def set_plc_datetime(self, dt):
"""
Set date and time in PLC
:param dt: date and time as datetime
"""
type_ = c_int32
buffer = (type_ * 9)()
buffer[0] = dt.second
buffer[1] = dt.minute
buffer[2] = dt.hour
buffer[3] = dt.day
buffer[... | 0.004454 |
def delete_resource(self, resource):
"""
Deletes the resource from the pool and destroys the associated
resource. Not usually needed by users of the pool, but called
internally when BadResource is raised.
:param resource: the resource to remove
:type resource: Resource
... | 0.004292 |
def system_monitor_temp_threshold_marginal_threshold(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
system_monitor = ET.SubElement(config, "system-monitor", xmlns="urn:brocade.com:mgmt:brocade-system-monitor")
temp = ET.SubElement(system_monitor, "temp"... | 0.004934 |
def recarrayisin(X,Y,weak=True):
"""
Indices of elements in a numpy record array (or ndarray with structured
dtype) that appear in another.
Fast routine for determining indices of elements in numpy record array `X`
that appear in numpy record array `Y`, returning a boolean array `Z` such
tha... | 0.008748 |
def visit_class(rec, cls, op):
# type: (Any, Iterable, Union[Callable[..., Any], partial[Any]]) -> None
"""Apply a function to with "class" in cls."""
if isinstance(rec, MutableMapping):
if "class" in rec and rec.get("class") in cls:
op(rec)
for d in rec:
visit_class... | 0.002294 |
def _read_meta(ctx: ReaderContext) -> IMeta:
"""Read metadata and apply that to the next object in the
input stream."""
start = ctx.reader.advance()
assert start == "^"
meta = _read_next_consuming_comment(ctx)
meta_map: Optional[lmap.Map[LispForm, LispForm]] = None
if isinstance(meta, symbo... | 0.00107 |
def thermal_data(data, figsize=(12, 4), ms_data=50,
v_label='Unit-cell volume $(\mathrm{\AA}^3)$',
pdf_filen=None, title='P-V-T data'):
"""
plot P-V-T data before fitting
:param data: {'p': unumpy array, 'v': unumpy array, 'temp': unumpy array}
:param eoscurves: {'v': ... | 0.00133 |
def publish(spec, nb_name, template='full', save_first=True):
"""
Converts nb_name to an HTML file. Preserves widget functionality.
Outputs a link to download HTML file after conversion if called in a
notebook environment.
Equivalent to running `nbinteract ${spec} ${nb_name}` on the command line.
... | 0.000449 |
def batch_geoparse(self, text_list):
"""
Batch geoparsing function. Take in a list of text documents and return a list of lists
of the geoparsed documents. The speed improvements come exclusively from using spaCy's `nlp.pipe`.
Parameters
----------
text_list : list of st... | 0.007286 |
def main_loop():
'''main processing loop'''
global screensaver_cookie
if not mpstate.status.setup_mode and not opts.nowait:
for master in mpstate.mav_master:
if master.linknum != 0:
break
print("Waiting for heartbeat from %s" % master.address)
se... | 0.004801 |
def set_pseudo_guessing_value(self, pseudo_guessing):
"""stub"""
if not isinstance(pseudo_guessing, float):
raise InvalidArgument('pseudo-guessing value must be a decimal')
self.add_decimal_value(pseudo_guessing, 'pseudoGuessing') | 0.007519 |
def mod_watch(name, **kwargs):
'''
Install/reinstall a package based on a watch requisite
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the stat... | 0.003984 |
def _triggering_ctx(self):
"""
Context manager that ensures that a hook is not re-triggered by one of its handlers.
"""
if self._is_triggering:
raise RuntimeError('{} cannot be triggered while it is being handled'.format(self))
self._is_triggering = True
try:
... | 0.010025 |
def dispatch_hook(cls, _pkt, _underlayer=None, *args, **kargs):
"""dispatch_hook to choose among different registered payloads"""
for klass in cls._payload_class:
if hasattr(klass, "can_handle") and \
klass.can_handle(_pkt, _underlayer):
return klass
... | 0.004914 |
def overwrite(self, mesh):
"""
Overwrites this mesh inplace with the new mesh's geometries and data
Parameters
----------
mesh : vtk.vtkDataSet
The overwriting mesh.
"""
self.DeepCopy(mesh)
if is_vtki_obj(mesh):
self.copy_meta_fro... | 0.006116 |
def _do_retrieve_scopes(self, http, token):
"""Retrieves the list of authorized scopes from the OAuth2 provider.
Args:
http: an object to be used to make HTTP requests.
token: A string used as the token to identify the credentials to
the provider.
Rai... | 0.001596 |
def solveConsIndShock(solution_next,IncomeDstn,LivPrb,DiscFac,CRRA,Rfree,PermGroFac,
BoroCnstArt,aXtraGrid,vFuncBool,CubicBool):
'''
Solves a single period consumption-saving problem with CRRA utility and risky
income (subject to permanent and transitory shocks). Can generat... | 0.013618 |
def cmp_mat(a, b):
"""
Sorts two matrices returning a positive or zero value
"""
c = 0
for x, y in zip(a.flat, b.flat):
c = cmp(abs(x), abs(y))
if c != 0:
return c
return c | 0.004464 |
def merge_settings(settings, new_metadata_settings):
"""
Will update the settings with the provided new settings data extracted from the IdP metadata
:param settings: Current settings dict data
:type settings: string
:param new_metadata_settings: Settings to be merged (extracted ... | 0.004147 |
def networkCoAuthor(self, detailedInfo = False, weighted = True, dropNonJournals = False, count = True, useShortNames = False, citeProfile = False):
"""Creates a coauthorship network for the RecordCollection.
# Parameters
_detailedInfo_ : `optional [bool or iterable[WOS tag Strings]]`
... | 0.00659 |
def state_preorder_put_account_payment_info( nameop, account_addr, token_type, amount ):
"""
Call this in a @state_create-decorated method.
Identifies the account that must be debited.
"""
assert amount is None or isinstance(amount, (int,long)), 'Amount is {} (type {})'.format(amount, type(amount))
... | 0.010914 |
def FilterGOstring(names_filter=["age-", "aging", "aged", 'aging', 'aging.', 'aging,'],\
exclude_names=["packaging","voltage","cleavage-",\
"stage-1","cage-like","message-specific",\
"damage-associated","stage-specific","foraging",\
... | 0.038889 |
def _fit_island(self, island_data):
"""
Take an Island, do all the parameter estimation and fitting.
Parameters
----------
island_data : :class:`AegeanTools.models.IslandFittingData`
The island to be fit.
Returns
-------
sources : list
... | 0.003006 |
def isstring(args, quoted=False):
"""Checks if value is a (quoted) string."""
isquoted = lambda c: c[0]==c[-1] and c[0] in ['"', "'"]
if quoted:
check = lambda c: isinstance(c, str) and isquoted(c)
else:
check = lambda c: isinstance(c, str)
if isinstance(args, list):
return... | 0.013193 |
def after_model_change(self, form, User, is_created):
"""Send password instructions if desired."""
if is_created and form.notification.data is True:
send_reset_password_instructions(User) | 0.009302 |
def configure(self, options, conf):
"""
Configures the plugin.
"""
super(EverestNosePlugin, self).configure(options, conf)
opt_val = getattr(options, self.__dest_opt_name, None)
if opt_val:
self.enabled = True
EverestIni.ini_file_path = opt_val | 0.006329 |
def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
for name in self._accessor.listdir(self):
if name in ('.', '..'):
# Yielding a path object for these makes little sense
... | 0.005208 |
def ziggurat_model_init(
user=None,
group=None,
user_group=None,
group_permission=None,
user_permission=None,
user_resource_permission=None,
group_resource_permission=None,
resource=None,
external_identity=None,
*args,
**kwargs
):
"""
This function handles attaching m... | 0.000593 |
def remove_extended_args(self, instructions):
"""Go through instructions removing extended ARG.
get_instruction_bytes previously adjusted the operand values
to account for these"""
new_instructions = []
last_was_extarg = False
n = len(instructions)
for i, inst in ... | 0.003406 |
def get_folder(self, si, path, root=None):
"""
Finds folder in the vCenter or returns "None"
:param si: pyvmomi 'ServiceInstance'
:param path: the path to find the object ('dc' or 'dc/folder' or 'dc/folder/folder/etc...')
"""
search_index = si.content.sear... | 0.003238 |
def send(self, to, language=None, **data):
"""
This is the method to be called
"""
self.data = data
self.get_context_data()
if app_settings['SEND_EMAILS']:
try:
if language:
mail.send(to, template=self.template, context=self... | 0.008535 |
async def chat_send(self, message: str, team_only: bool):
""" Writes a message to the chat """
ch = ChatChannel.Team if team_only else ChatChannel.Broadcast
await self._execute(
action=sc_pb.RequestAction(
actions=[sc_pb.Action(action_chat=sc_pb.ActionChat(channel=ch.... | 0.00813 |
def run_phlat(job, fastqs, sample_type, univ_options, phlat_options):
"""
This module will run PHLAT on SAMPLE_TYPE fastqs.
ARGUMENTS -- <ST> depicts the sample type. Substitute with 'tumor_dna',
'normal_dna', or 'tumor_rna'
1. fastqs: Dict of list of input WGS/WXS fastqs
fast... | 0.001898 |
def get_canonical_url(metadata, request):
"""Builds canonical in book url from a pages metadata."""
slug_title = u'/{}'.format('-'.join(metadata['title'].split()))
settings = get_current_registry().settings
canon_host = settings.get('canonical-hostname',
re.sub('archive.',... | 0.001224 |
def posterior_bayes_information(self, expparams):
"""
Evaluates the local Bayesian Information Matrix (BIM) over all particles
of the current posterior distribution with corresponding weights.
:param expparams: Parameters describing the experiment that was
performed.
... | 0.00471 |
def download(self, sub_url):
"""download and unzip subtitle archive to a temp location"""
response = requests.get(sub_url, headers=self.headers).text
soup = BS(response, 'lxml')
downlink = self.base_url+soup.select('.download a')[0]['href']
data = requests.get(downlink, headers=s... | 0.003373 |
def iterator_cycle(variables: VarType, parent: str) -> Iterable[VarMatrix]:
"""Cycle through a list of values a specified number of times
Args:
variables: The input variables for the creation of the range
parent: The variable for which the values are being generated.
Returns: A list of dic... | 0.003501 |
def submit(self, make_request=True, **kwargs):
"""
Submit current form.
:param make_request: if `False` then grab instance will be
configured with form post data but request will not be
performed
For details see `Document.submit()` method
Example::
... | 0.00147 |
def list_courses(self):
"""
List enrolled courses.
@return: List of enrolled courses.
@rtype: [str]
"""
reply = get_page(self._session, OPENCOURSE_MEMBERSHIPS, json=True)
course_list = reply['linked']['courses.v1']
slugs = [element['slug'] for element in ... | 0.005666 |
def get_vm_ip(name=None, session=None, call=None):
'''
Get the IP address of the VM
.. code-block:: bash
salt-cloud -a get_vm_ip xenvm01
.. note:: Requires xen guest tools to be installed in VM
'''
if call == 'function':
raise SaltCloudException(
'This function mu... | 0.000687 |
def _sendRequest(self, tReq):
"""Send a single request over our protocol to the Kafka broker."""
try:
tReq.sent = True
self.proto.sendString(tReq.data)
except Exception as e:
log.exception('%r: Failed to send request %r', self, tReq)
del self.reque... | 0.002797 |
def make_safe_filename_from_url(self, url):
'''return a version of url safe for use as a filename'''
r = re.compile("([^a-zA-Z0-9_.-])")
filename = r.sub(lambda m : "%" + str(hex(ord(str(m.group(1))))).upper(), url)
return filename | 0.015209 |
def patch_namespaced_daemon_set_status(self, name, namespace, body, **kwargs): # noqa: E501
"""patch_namespaced_daemon_set_status # noqa: E501
partially update status of the specified DaemonSet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchron... | 0.00125 |
def values(self):
"""
TimeSeries of values.
"""
# if accessing and stale - update first
if self._needupdate or self.now != self.parent.now:
self.update(self.root.now)
if self.root.stale:
self.root.update(self.root.now, None)
return self._va... | 0.0059 |
def Artifacts(self, os_name=None, cpe=None, label=None):
"""Whether the conditions applies, modulo host data.
Args:
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
True if os_name, cpe or labels match. Empty values are ignored.
"""
hit = lambda x: ... | 0.004464 |
def stream(self, date_created_before=values.unset, date_created=values.unset,
date_created_after=values.unset, date_updated_before=values.unset,
date_updated=values.unset, date_updated_after=values.unset,
friendly_name=values.unset, status=values.unset, limit=None,
... | 0.009597 |
def _classname(self):
"""Return the fully qualified class name."""
if self.__class__.__module__ in (None,):
return self.__class__.__name__
else:
return "%s.%s" % (self.__class__.__module__, self.__class__.__name__) | 0.01145 |
def _pretty_hex(hex_str):
'''
Nicely formats hex strings
'''
if len(hex_str) % 2 != 0:
hex_str = '0' + hex_str
return ':'.join(
[hex_str[i:i + 2] for i in range(0, len(hex_str), 2)]).upper() | 0.004425 |
def route_has_dead_links(root, machine):
"""Quickly determine if a route uses any dead links.
Parameters
----------
root : :py:class:`~rig.place_and_route.routing_tree.RoutingTree`
The root of the RoutingTree which contains nothing but RoutingTrees
(i.e. no vertices and links).
mach... | 0.001429 |
def nhs_check_digit(ninedigits: Union[str, List[Union[str, int]]]) -> int:
"""
Calculates an NHS number check digit.
Args:
ninedigits: string or list
Returns:
check digit
Method:
1. Multiply each of the first nine digits by the corresponding
digit weighting (see :const... | 0.000956 |
def approximate_predict(clusterer, points_to_predict):
"""Predict the cluster label of new points. The returned labels
will be those of the original clustering found by ``clusterer``,
and therefore are not (necessarily) the cluster labels that would
be found by clustering the original data combined with... | 0.000295 |
def download_directory(self, remote_path, local_path, progress=None):
"""Downloads directory and downloads all nested files and directories from remote WebDAV to local.
If there is something on local path it deletes directories and files then creates new.
:param remote_path: the path to directo... | 0.006512 |
def save_waypoints_csv(self, filename):
'''save waypoints to a file in a human readable CSV file'''
try:
#need to remove the leading and trailing quotes in filename
self.wploader.savecsv(filename.strip('"'))
except Exception as msg:
print("Failed to save %s - ... | 0.009029 |
def fromfilenames(cls, filenames, coltype=LIGOTimeGPS):
"""
Read Cache objects from the files named and concatenate the results into a
single Cache.
"""
cache = cls()
for filename in filenames:
cache.extend(cls.fromfile(open(filename), coltype=coltype))
return cache | 0.035336 |
def put_snaplink(self, link_path, object_path):
"""PutSnapLink
https://mo.joyent.com/docs/muskie/master/api.html#putsnaplink
@param link_path {str} Required. A manta path, e.g.
'/trent/stor/mylink'.
@param object_path {str} Required. The manta path to an existing target
... | 0.003995 |
def run_cna(graph, root, targets, relationship_dict=None):
""" Returns the effect from the root to the target nodes represented as {-1,1}
:param pybel.BELGraph graph: A BEL graph
:param BaseEntity root: The root node
:param iter targets: The targets nodes
:param dict relationship_dict: dictionary w... | 0.00579 |
def cli(ctx, *args, **kwargs):
""" Command line interface for the brother_ql Python package. """
backend = kwargs.get('backend', None)
model = kwargs.get('model', None)
printer = kwargs.get('printer', None)
debug = kwargs.get('debug')
# Store the general CLI options in the context meta diction... | 0.001802 |
def add_weatherdata(self, data):
"""Appends weather data.
Args:
data (WeatherData): weather data object
"""
if not isinstance(data, WeatherData):
raise ValueError('Weather data need to be of type WeatherData')
self._data["WEATHER DATA"].append(data) | 0.006349 |
def scroll_constrain (self):
'''This keeps the scroll region within the screen region.'''
if self.scroll_row_start <= 0:
self.scroll_row_start = 1
if self.scroll_row_end > self.rows:
self.scroll_row_end = self.rows | 0.011407 |
def catalogue_mt_filter(self, mt_table, flag=None):
"""
Filter the catalogue using a magnitude-time table. The table has
two columns and n-rows.
:param nump.ndarray mt_table:
Magnitude time table with n-rows where column 1 is year and column
2 is magnitude
... | 0.002516 |
def set_soup(self):
"""Sets soup and strips items"""
self.soup = BeautifulSoup(self.feed_content, "html.parser")
for item in self.soup.findAll('item'):
item.decompose()
for image in self.soup.findAll('image'):
image.decompose() | 0.007067 |
def convert_nm(nm, notation=IP_DOT, inotation=IP_UNKNOWN, check=True):
"""Convert a netmask to another notation."""
return _convert(nm, notation, inotation, _check=check, _isnm=True) | 0.005263 |
def _dict_to_df(self, dictobj, xfield, yfield):
"""
Converts a dictionnary to a pandas dataframe
"""
x = []
y = []
for datapoint in dictobj:
x.append(datapoint)
y.append(dictobj[datapoint])
df = pd.DataFrame({xfield[0]: x, yfield[0]: y})
... | 0.00597 |
def inputs(dataset, batch_size=None, num_preprocess_threads=None):
"""Generate batches of ImageNet images for evaluation.
Use this function as the inputs for evaluating a network.
Note that some (minimal) image preprocessing occurs during evaluation
including central cropping and resizing of the image to fit ... | 0.005988 |
def layer_norm(x,
filters=None,
epsilon=1e-6,
name=None,
reuse=None,
layer_collection=None):
"""Layer normalize the tensor x, averaging over the last dimension."""
if filters is None:
filters = shape_list(x)[-1]
with tf.variable_scope(... | 0.009124 |
def register_connection(self, alias, api_key, base_url, timeout=5):
"""
Create and register a new connection.
:param alias: The alias of the connection. If not changed with `switch_connection`,
the connection with default 'alias' is used by the resources.
:para... | 0.008772 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.