text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def format_axis(ax, label_padding=2, tick_padding=0, yticks_position='left'):
"""Set standardized axis formatting for figure."""
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position(yticks_position)
ax.yaxis.set_tick_params(which='both', direction='out', labelsize=fontsize,
... | 0.00149 |
def process_post_tags(self, bulk_mode, api_post, post_tags):
"""
Create or update Tags related to a post.
:param bulk_mode: If True, minimize db operations by bulk creating post objects
:param api_post: the API data for the post
:param post_tags: a mapping of Tags keyed by post ... | 0.005119 |
def add_node(self, node_id, name, labels):
""" Add a node to the graph with name and labels.
Args:
node_id: the unique node_id e.g. 'www.evil4u.com'
name: the display name of the node e.g. 'evil4u'
labels: a list of labels e.g. ['domain','evil']
... | 0.004739 |
def load_data(path, dense=False):
"""Load data from a CSV, LibSVM or HDF5 file based on the file extension.
Args:
path (str): A path to the CSV, LibSVM or HDF5 format file containing data.
dense (boolean): An optional variable indicating if the return matrix
should be d... | 0.003044 |
def _get_grammar_errors(self,pos,text,tokens):
"""
Internal function to get the number of grammar errors in given text
pos - part of speech tagged text (list)
text - normal text (list)
tokens - list of lists of tokenized text
"""
word_counts = [max(len(t),1) for t... | 0.014418 |
def _cast(self, _input, _output):
"""
Transforms a pair of input/output into the real slim shoutput.
:param _input: Bag
:param _output: mixed
:return: Bag
"""
if isenvelope(_output):
_output, _flags, _options = _output.unfold()
else:
... | 0.00381 |
def moist_amplification_factor(Tkelvin, relative_humidity=0.8):
'''Compute the moisture amplification factor for the moist diffusivity
given relative humidity and reference temperature profile.'''
deltaT = 0.01
# slope of saturation specific humidity at 1000 hPa
dqsdTs = (qsat(Tkelvin+deltaT/2, 100... | 0.004673 |
def select_links(xmrs, start=None, end=None, rargname=None, post=None):
"""
Return the list of matching links for *xmrs*.
:class:`~delphin.mrs.components.Link` objects for *xmrs* match if
their `start` matches *start*, `end` matches *end*, `rargname`
matches *rargname*, and `post` matches *post*. T... | 0.001932 |
def find(self):
"""Find slot"""
editorstack = self.get_current_editorstack()
editorstack.find_widget.show()
editorstack.find_widget.search_text.setFocus() | 0.010526 |
def getAccessURL(self, CorpNum, UserID):
""" ํ๋น ๋ก๊ทธ์ธ URL
args
CorpNum : ํ์ ์ฌ์
์๋ฒํธ
UserID : ํ์ ํ๋น์์ด๋
return
30์ด ๋ณด์ ํ ํฐ์ ํฌํจํ url
raise
PopbillException
"""
result = self._httpget('/?TG=LOGIN', CorpNum... | 0.005634 |
def _state_removal_solve(self):
"""The State Removal Operation"""
initial = sorted(
self.mma.states,
key=attrgetter('initial'),
reverse=True)[0].stateid
for state_k in self.mma.states:
if state_k.final:
continue
if state... | 0.004073 |
def send_discovery_packet(self):
""" Send discovery packet for QTM to respond to """
if self.port is None:
return
self.transport.sendto(
QRTDiscoveryP1.pack(
QRTDiscoveryPacketSize, QRTPacketType.PacketDiscover.value
)
+ QRTDiscove... | 0.005168 |
async def start(self, remoteParameters):
"""
Start DTLS transport negotiation with the parameters of the remote
DTLS transport.
:param: remoteParameters: An :class:`RTCDtlsParameters`.
"""
assert self._state == State.NEW
assert len(remoteParameters.fingerprints)
... | 0.001561 |
def update_labels(repo):
"""Update labels."""
updated = set()
for label in repo.get_labels():
edit = find_label(label.name, label.color, label.description)
if edit is not None:
print(' Updating {}: #{} "{}"'.format(edit.new, edit.color, edit.description))
label.edi... | 0.004401 |
def get(self, block=True, timeout=None):
"""Gets an item from the queue.
Uses polling if block=True, so there is no guarantee of order if
multiple consumers get from the same empty queue.
Returns:
The next item in the queue.
Raises:
Empty if the queue i... | 0.001535 |
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models import ModelName".
# Use orm.ModelName to refer to models in this application,
# and orm['appname.ModelName'] for models in other applications.
LEN_TYPE = {
7: 'GMI',
... | 0.006012 |
def add_load_constant(self, name, output_name, constant_value, shape):
"""
Add a load constant layer.
Parameters
----------
name: str
The name of this layer.
output_name: str
The output blob name of this layer.
constant_value: numpy.arra... | 0.0033 |
def bootstrap(v):
"""
Constructs Monte Carlo simulated data set using the
Bootstrap algorithm.
Usage:
>>> bootstrap(x)
where x is either an array or a list of arrays. If it is a
list, the code returns the corresponding list of bootst... | 0.043646 |
def SETNG(cpu, dest):
"""
Sets byte if not greater.
:param cpu: current CPU.
:param dest: destination operand.
"""
dest.write(Operators.ITEBV(dest.size, Operators.OR(cpu.ZF, cpu.SF != cpu.OF), 1, 0)) | 0.012097 |
def del_fields(self, *names):
"""Delete data fields from this struct instance"""
cls = type(self)
self.__class__ = cls
for n in names:
# don't raise error if a field is absent
if isinstance(getattr(cls, n, None), DataField):
if n in self._field_val... | 0.004975 |
def get_routes(
feed: "Feed", date: Optional[str] = None, time: Optional[str] = None
) -> DataFrame:
"""
Return a subset of ``feed.routes``
Parameters
-----------
feed : Feed
date : string
YYYYMMDD date string restricting routes to only those active on
the date
time : st... | 0.001163 |
def OnFindToolbarToggle(self, event):
"""Search toolbar toggle event handler"""
self.main_window.find_toolbar.SetGripperVisible(True)
find_toolbar_info = self.main_window._mgr.GetPane("find_toolbar")
self._toggle_pane(find_toolbar_info)
event.Skip() | 0.006826 |
def get_all_analytics(user, job_id):
"""Get all analytics of a job."""
args = schemas.args(flask.request.args.to_dict())
v1_utils.verify_existence_and_get(job_id, models.JOBS)
query = v1_utils.QueryBuilder(_TABLE, args, _A_COLUMNS)
# If not admin nor rh employee then restrict the view to the team
... | 0.001376 |
def log(args):
"""
%prog log logfile
Prepare a log of created files, ordered by their creation data. The purpose
for this script is to touch these files sequentially to reflect their build
order. On the JCVI scratch area, the files are touched regularly to avoid
getting deleted, losing their re... | 0.001202 |
def showtraceback(self, *args, **kwargs):
"""Display the exception that just occurred.
We remove the first stack item because it is our own code.
The output is written by self.write(), below.
"""
try:
type, value, tb = sys.exc_info()
sys.last_type = typ... | 0.002632 |
def add(self, *nodes):
""" Adds nodes as siblings
:param nodes: GraphNode(s)
"""
for node in nodes:
node.set_parent(self)
self.add_sibling(node) | 0.01 |
def _set_fcoe_config(self, v, load=False):
"""
Setter method for fcoe_config, mapped from YANG variable /rbridge_id/fcoe_config (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_fcoe_config is considered as a private
method. Backends looking to populate thi... | 0.004606 |
def _setup_notification_listener(self, topic_name, url):
"""Setup notification listener for a service."""
self.notify_listener = rpc.DfaNotifcationListener(
topic_name, url, rpc.DfaNotificationEndpoints(self)) | 0.008403 |
def server_show(endpoint_id, server_id):
"""
Executor for `globus endpoint server show`
"""
client = get_client()
server_doc = client.get_endpoint_server(endpoint_id, server_id)
if not server_doc["uri"]: # GCP endpoint server
fields = (("ID", "id"),)
text_epilog = dedent(
... | 0.001847 |
def play(self):
"""
Sends a "play" command to the player.
"""
msg = cr.Message()
msg.type = cr.PLAY
self.send_message(msg) | 0.011765 |
def SESSION_TIME(stats, info):
"""Total time of this session.
Reports the time elapsed from the construction of the `Stats` object to
this `submit()` call.
This is a flag you can pass to `Stats.submit()`.
"""
duration = time.time() - stats.started_time
secs = int(duration)
msecs = int(... | 0.002475 |
def scanned(self):
"""Number of items that DynamoDB evaluated, before any filter was applied."""
if self.request["Select"] == "COUNT":
while not self.exhausted:
next(self, None)
return self._scanned | 0.012 |
def qsub(script, job_name, dryrun=False, *args, **kwargs):
"""Submit a job via qsub."""
print("Preparing job script...")
job_string = gen_job(script=script, job_name=job_name, *args, **kwargs)
env = os.environ.copy()
if dryrun:
print(
"This is a dry run! Here is the generated job... | 0.001546 |
def _configure_port_entries(self, port, vlan_id, device_id, host_id, vni,
is_provider_vlan):
"""Create a nexus switch entry.
if needed, create a VLAN in the appropriate switch or port and
configure the appropriate interfaces for this VLAN.
Called during ... | 0.001577 |
def interpolate_nearest(self, lons, lats, data):
"""
Interpolate using nearest-neighbour approximation
Returns the same as interpolate(lons,lats,data,order=0)
"""
return self.interpolate(lons, lats, data, order=0) | 0.007905 |
def message(self_,msg,*args,**kw):
"""
Print msg merged with args as a message.
See Python's logging module for details of message formatting.
"""
self_.__db_print(INFO,msg,*args,**kw) | 0.035556 |
def visit_While(self, node: ast.While) -> Optional[ast.AST]:
"""Eliminate dead code from while bodies."""
new_node = self.generic_visit(node)
assert isinstance(new_node, ast.While)
return ast.copy_location(
ast.While(
test=new_node.test,
body=_... | 0.004367 |
def _get_mapreduce_spec(cls, mr_id):
"""Get Mapreduce spec from mr id."""
key = 'GAE-MR-spec: %s' % mr_id
spec_json = memcache.get(key)
if spec_json:
return cls.from_json(spec_json)
state = MapreduceState.get_by_job_id(mr_id)
spec = state.mapreduce_spec
spec_json = spec.to_json()
m... | 0.00551 |
def add(name, num, minimum=0, maximum=0, ref=None):
'''
Adds together the ``num`` most recent values. Requires a list.
USAGE:
.. code-block:: yaml
foo:
calc.add:
- name: myregentry
- num: 5
'''
return calc(
name=name,
num=num,
... | 0.002481 |
def to_bytes(data: Union[str, bytes]) -> bytes:
"""
:param data: Data to convert to bytes.
:type data: Union[str, bytes]
:return: `data` encoded to UTF8.
:rtype: bytes
"""
if isinstance(data, bytes):
return data
return data.encode('utf-8') | 0.003584 |
def headers(self) -> Optional[List[str]]:
"""
็ๆ headers
"""
if len(self) == 0:
return None
headers = cast(List[str], [])
for cookie in self.values():
headers.append(cookie.OutputString())
return headers | 0.007067 |
def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion):
"""Operation: Mount ISO Image (requires DPM mode)."""
assert wait_for_completion is True # synchronous operation
partition_oid = uri_parms[0]
partition_uri = '/api/partitions/' + partition_oid... | 0.001944 |
def terminate(self, devices):
"""Terminate one or more running or stopped instances.
"""
for device in devices:
self.logger.info('Terminating: %s', device.id)
try:
device.delete()
except packet.baseapi.Error:
raise PacketManager... | 0.007813 |
def _slugify_internal_collection_name(self, json_repr):
"""Parse the JSON, find its name, return a slug of its name"""
collection = self._coerce_json_to_collection(json_repr)
if collection is None:
return None
internal_name = collection['name']
return slugify(internal... | 0.006135 |
def fill_masked(self, value=-1, copy=True):
"""Fill masked genotype calls with a given value.
Parameters
----------
value : int, optional
The fill value.
copy : bool, optional
If False, modify the array in place.
Returns
-------
g... | 0.001493 |
def generate_synth_data(nsta, ntemplates, nseeds, samp_rate, t_length,
max_amp, max_lag, debug=0):
"""
Generate a synthetic dataset to be used for testing.
This will generate both templates and data to scan through.
Templates will be generated using the utils.synth_seis function... | 0.000218 |
def get_content_type (headers):
"""
Get the MIME type from the Content-Type header value, or
'application/octet-stream' if not found.
@return: MIME type
@rtype: string
"""
ptype = headers.get('Content-Type', 'application/octet-stream')
if ";" in ptype:
# split off not needed ext... | 0.005 |
def curve_reduce(curve, reduced):
"""Image for :meth:`.curve.Curve.reduce` docstring."""
if NO_IMAGES:
return
figure, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)
curve.plot(256, ax=ax1)
color = ax1.lines[-1].get_color()
add_patch(ax1, curve._nodes, color)
reduced.plot(... | 0.001845 |
def addUser(self, invitationList,
subject, html):
"""
adds a user without sending an invitation email
Inputs:
invitationList - InvitationList class used to add users without
sending an email
subject - email subject
html - email messag... | 0.008889 |
def _onMenuItemSelected(self, evt):
"""Called whenever one of the specific axis menu items is selected"""
current = self._menu.IsChecked(evt.GetId())
if current:
new = False
else:
new = True
self._menu.Check(evt.GetId(), new)
# Lines above would be... | 0.004132 |
def _defer_to_worker(deliver, worker, work, *args, **kwargs):
"""
Run a task in a worker, delivering the result as a ``Deferred`` in the
reactor thread.
"""
deferred = Deferred()
def wrapped_work():
try:
result = work(*args, **kwargs)
except BaseException:
... | 0.001996 |
def set_content(self, content):
"""Set textual content for the object/node.
Verifies the node is allowed to contain content, and throws an
exception if not.
"""
if self.allows_content:
self.content = content.strip()
else:
raise UNTLStructureExcept... | 0.004831 |
def save_heterozygosity(heterozygosity, samples, out_prefix):
"""Saves the heterozygosity data.
:param heterozygosity: the heterozygosity data.
:param samples: the list of samples.
:param out_prefix: the prefix of the output files.
:type heterozygosity: numpy.array
:type samples: list of tuple... | 0.00133 |
def walk(self, visitor):
"""
Walk the branch and call the visitor function
on each node.
@param visitor: A function.
@return: self
@rtype: L{Element}
"""
visitor(self)
for c in self.children:
c.walk(visitor)
return self | 0.006431 |
def is_numeric(obj):
"""
This detects whether an input object is numeric or not.
:param obj: object to be tested.
"""
try:
obj+obj, obj-obj, obj*obj, obj**obj, obj/obj
except ZeroDivisionError:
return True
except Exception:
return False
else:
return True | 0.003135 |
def get_log_entries(self):
"""Gets the log entry list resulting from a search.
return: (osid.logging.LogEntryList) - the log entry list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | 0.004065 |
def is_real_floating_dtype(dtype):
"""Return ``True`` if ``dtype`` is a real floating point type."""
dtype = np.dtype(dtype)
return np.issubsctype(getattr(dtype, 'base', None), np.floating) | 0.004975 |
def elements_equal(first, *others):
"""
Check elements for equality
"""
f = first
lf = list(f)
for e in others:
le = list(e)
if (len(lf) != len(le)
or f.tag != e.tag
or f.text != e.text
or f.tail != e.tail
or f.attri... | 0.004435 |
def _check_requirements(self):
"""
Checks the IOU image.
"""
if not self._path:
raise IOUError("IOU image is not configured")
if not os.path.isfile(self._path) or not os.path.exists(self._path):
if os.path.islink(self._path):
raise IOUErro... | 0.006206 |
def disk2ram(self):
"""Move internal data from disk to RAM."""
values = self.series
self.deactivate_disk()
self.ramflag = True
self.__set_array(values)
self.update_fastaccess() | 0.008929 |
def _summarize_accessible_fields(field_descriptions, width=40,
section_title='Accessible fields'):
"""
Create a summary string for the accessible fields in a model. Unlike
`_toolkit_repr_print`, this function does not look up the values of the
fields, it just formats the... | 0.00092 |
def bulk_edit(self, _fields, ids=None, filter=None, type=None, all=False, testvars=None): # pylint: disable=redefined-builtin
"""Bulk edit a set of configs.
:param _fields: :class:`configs.Config <configs.Config>` object
:param ids: (optional) Int list of config IDs.
:param filter: (opt... | 0.006969 |
def folding_model_energy(rvec, rcut):
r"""computes the potential energy at point rvec"""
r = np.linalg.norm(rvec) - rcut
rr = r ** 2
if r < 0.0:
return -2.5 * rr
return 0.5 * (r - 2.0) * rr | 0.004608 |
def generate_from_text(self, text):
"""Generate wordcloud from text.
The input "text" is expected to be a natural text. If you pass a sorted
list of words, words will appear in your output twice. To remove this
duplication, set ``collocations=False``.
Calls process_text and gen... | 0.003091 |
def get_image(row, output_dir):
"""Downloads the image that corresponds to the given row.
Prints a notification if the download fails."""
if not download_image(image_id=row[0],
url=row[1],
x1=float(row[2]),
y1=float(row[3]),
... | 0.006263 |
def Vdiff(D1, D2):
"""
finds the vector difference between two directions D1,D2
"""
A = dir2cart([D1[0], D1[1], 1.])
B = dir2cart([D2[0], D2[1], 1.])
C = []
for i in range(3):
C.append(A[i] - B[i])
return cart2dir(C) | 0.003906 |
async def login_user(self, password, **kwds):
"""
This function handles the registration of the given user credentials in the database
"""
# find the matching user with the given email
user_data = (await self._get_matching_user(fields=list(kwds.keys()), **kwds))['data']
... | 0.004049 |
def get(self, adgroup_id, nick=None):
'''xxxxx.xxxxx.adgroup.catmatch.get
===================================
ๅๅพไธไธชๆจๅนฟ็ป็็ฑป็ฎๅบไปท'''
request = TOPRequest('xxxxx.xxxxx.adgroup.catmatch.get')
request['adgroup_id'] = adgroup_id
if nick!=None: request['nick'] = nick
self.cre... | 0.023013 |
def get_components(A, no_depend=False):
'''
Returns the components of an undirected graph specified by the binary and
undirected adjacency matrix adj. Components and their constitutent nodes
are assigned the same index and stored in the vector, comps. The vector,
comp_sizes, contains the number of n... | 0.004128 |
def safe_dump_all(documents, stream=None, **kwds):
"""
Serialize a sequence of Python objects into a YAML stream.
Produce only basic YAML tags.
If stream is None, return the produced string instead.
"""
return dump_all(documents, stream, Dumper=SafeDumper, **kwds) | 0.003472 |
def save_model(self, request, obj, form, change):
"""
Save model for every language so that field auto-population
is done for every each of it.
"""
super(DisplayableAdmin, self).save_model(request, obj, form, change)
if settings.USE_MODELTRANSLATION:
lang = ge... | 0.004637 |
def last(conf):
"""How long you have kept signing in."""
try:
v2ex = V2ex(conf.config)
v2ex.login()
last_date = v2ex.get_last()
click.echo(last_date)
except KeyError:
click.echo('Keyerror, please check your config file.')
except IndexError:
click.echo('Ple... | 0.002786 |
def isNonNull(requestContext, seriesList):
"""
Takes a metric or wild card seriesList and counts up how many
non-null values are specified. This is useful for understanding
which metrics have data at a given point in time (ie, to count
which servers are alive).
Example::
&target=isNonN... | 0.001214 |
def opt_pore_diameter(elements, coordinates, bounds=None, com=None, **kwargs):
"""Return optimised pore diameter and it's COM."""
args = elements, coordinates
if com is not None:
pass
else:
com = center_of_mass(elements, coordinates)
if bounds is None:
pore_r = pore_diameter(... | 0.001372 |
def lset(self, name, index, value):
"Set ``position`` of list ``name`` to ``value``"
return self.execute_command('LSET', name, index, value) | 0.012821 |
def get_next_future_timerange_invalid(self, timestamp):
"""Get next invalid time for timeranges
:param timestamp: time to check
:type timestamp: int
:return: next time when a timerange is not valid
:rtype: None | int
"""
sec_from_morning = get_sec_from_morning(ti... | 0.002699 |
def remove_all_logger_handlers(logger: logging.Logger) -> None:
"""
Remove all handlers from a logger.
Args:
logger: logger to modify
"""
while logger.handlers:
h = logger.handlers[0]
logger.removeHandler(h) | 0.003968 |
def derivative(self, point):
"""Derivative of this operator at ``point``.
For the particular case of constant padding with non-zero
constant, the derivative is the corresponding zero-padding
variant. In all other cases, this operator is linear, i.e.
the derivative is equal to ``... | 0.0033 |
def delete_virtualip(self, loadbalancer, vip):
"""Deletes the VirtualIP from its load balancer."""
lb = vip.parent
if not lb:
raise exc.UnattachedVirtualIP("No parent Load Balancer for this "
"VirtualIP could be determined.")
resp, body = self.api.method_d... | 0.009524 |
def pages(self):
"""The total number of pages"""
if self.per_page == 0 or self.total is None:
pages = 0
else:
pages = int(ceil(self.total / float(self.per_page)))
return pages | 0.008658 |
def to_json(df, x, y):
"""Format output for json response."""
values = []
for i, row in df.iterrows():
values.append({
"x": row[x],
"y": row[y]
})
if df.empty:
return {"result": [{"x": 0, "y": 0}], "date": False}
... | 0.00545 |
def get_code_breakpoint(self, dwProcessId, address):
"""
Returns the internally used breakpoint object,
for the code breakpoint defined at the given address.
@warning: It's usually best to call the L{Debug} methods
instead of accessing the breakpoint objects directly.
... | 0.001797 |
def split(self, tValues):
"""
Split the segment according the t values
"""
if self.segmentType == "curve":
on1 = self.previousOnCurve
off1 = self.points[0].coordinates
off2 = self.points[1].coordinates
on2 = self.points[2].coordinates
... | 0.002077 |
def list_prefix(self, auth, spec = None):
""" List prefixes matching the `spec`.
* `auth` [BaseAuth]
AAA options.
* `spec` [prefix_spec]
Specifies prefixes to list. If omitted, all will be listed.
Returns a list of dicts.
This is... | 0.002335 |
def from_dict(data, ctx):
"""
Instantiate a new Position from a dict (generally from loading a JSON
response). The data used to instantiate the Position is a shallow copy
of the dict passed in, with any complex child types instantiated
appropriately.
"""
data = d... | 0.001062 |
def sv_variant(store, institute_id, case_name, variant_id=None, variant_obj=None, add_case=True,
get_overlapping=True):
"""Pre-process an SV variant entry for detail page.
Adds information to display variant
Args:
store(scout.adapter.MongoAdapter)
institute_id(str)
c... | 0.003211 |
def get_tissue_in_references(self, entry):
"""
get list of models.TissueInReference from XML node entry
:param entry: XML node entry
:return: list of :class:`pyuniprot.manager.models.TissueInReference` objects
"""
tissue_in_references = []
query = "./reference/so... | 0.004658 |
def compute_cyclomatic_complexity(function):
"""
Compute the cyclomatic complexity of a function
Args:
function (core.declarations.function.Function)
Returns:
int
"""
# from https://en.wikipedia.org/wiki/Cyclomatic_complexity
# M = E - N + 2P
# where M is the complexity
... | 0.001789 |
def all(self):
"""Returns a chained generator response containing all matching records
:return:
- Iterable response
"""
if self._stream:
return chain.from_iterable(self._get_streamed_response())
return self._get_buffered_response()[0] | 0.006645 |
def memcpy_dtoh(self, dest, src):
"""perform a device to host memory copy
:param dest: A numpy array in host memory to store the data
:type dest: numpy.ndarray
:param src: A GPU memory allocation unit
:type src: pycuda.driver.DeviceAllocation
"""
if isinstance(s... | 0.004739 |
def slugs_navigation_encode(self, u_m, phi_c, theta_c, psiDot_c, ay_body, totalDist, dist2Go, fromWP, toWP, h_c):
'''
Data used in the navigation algorithm.
u_m : Measured Airspeed prior to the nav filter in m/s (float)
phi_c ... | 0.007745 |
def aggr(self, group, *attributes, keep_all_rows=False, **named_attributes):
"""
Aggregation/projection operator
:param group: an entity set whose entities will be grouped per entity of `self`
:param attributes: attributes of self to include in the result
:param keep_all_rows: T... | 0.008578 |
def get_first(self, attr, value, e=0.000001,
sort_by="__name__", reverse=False):
"""Get the first nested Constant class that met ``klass.attr == value``.
:param attr: attribute name.
:param value: value.
:param e: used for float value comparison.
:param sort_by... | 0.007716 |
def impulse_noise(x, severity=1):
"""Impulse noise corruption to images.
Args:
x: numpy array, uncorrupted image, assumed to have uint8 pixel in [0,255].
severity: integer, severity of corruption.
Returns:
numpy array, image with uint8 pixels in [0,255]. Added impulse noise.
"""
c = [.03, .06, .... | 0.011494 |
def delete_account_certificate(self, account_id, cert_id, **kwargs): # noqa: E501
"""Delete trusted certificate by ID. # noqa: E501
An endpoint for deleting the trusted certificate. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/trusted-certificates/{... | 0.001531 |
def get_all_celcius_commands():
"""Query cron for all celcius commands"""
p = subprocess.Popen(["crontab", "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
return [x for x in out.split('\n') if 'CJOBID' in x] | 0.007782 |
def _parse_tag(self, tag):
"""
Given a tag string (characters enclosed by []), this function will
parse any options and return a tuple of the form:
(valid, tag_name, closer, options)
"""
if not tag.startswith(self.tag_opener) or not tag.endswith(self.tag_closer) or ('... | 0.003268 |
def get_input_nodes(G: nx.DiGraph) -> List[str]:
""" Get all input nodes from a network. """
return [n for n, d in G.in_degree() if d == 0] | 0.006803 |
def path_to_ls(fn):
""" Converts an absolute path to an entry resembling the output of
the ls command on most UNIX systems."""
st = os.stat(fn)
full_mode = 'rwxrwxrwx'
mode = ''
file_time = ''
d = ''
for i in range(9):
# Incrementally builds up the 9 character string, using c... | 0.004011 |
def get_descriptor_by_id(self, id, is_master_id=None):
"""GetDescriptorById.
[Preview API]
:param str id:
:param bool is_master_id:
:rtype: :class:`<str> <azure.devops.v5_0.identity.models.str>`
"""
route_values = {}
if id is not None:
route_va... | 0.004449 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.