text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def main():
"""
Main method.
"""
run_config = _parse_args(sys.argv[1:])
if run_config.debug:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)
gitlab_config = GitLabConfig(run_config.url, run_config.token)
project_updater_builder = FileBasedProjectVariab... | 0.004144 |
def get_gateway_info(self):
"""
Return the gateway info.
Returns a Command.
"""
def process_result(result):
return GatewayInfo(result)
return Command('get',
[ROOT_GATEWAY, ATTR_GATEWAY_INFO],
process_result=proce... | 0.006061 |
def trap_ctrl_c_ctrl_break() -> None:
"""
Prevent ``CTRL-C``, ``CTRL-BREAK``, and similar signals from doing
anything.
See
- https://docs.python.org/3/library/signal.html#signal.SIG_IGN
- https://msdn.microsoft.com/en-us/library/xdkz3x12.aspx
- https://msdn.microsoft.com/en-us/libr... | 0.000555 |
def fetch_projects(self, **kwargs):
"""
List projects owned
Fetch projects that the currently authenticated user has access to because he or she is the owner of the project.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please defi... | 0.002817 |
def get_xml_root(xml_file):
"""Returns XML root."""
try:
xml_root = etree.parse(os.path.expanduser(xml_file), NO_BLANKS_PARSER).getroot()
# pylint: disable=broad-except
except Exception as err:
raise Dump2PolarionException("Failed to parse XML file '{}': {}".format(xml_file, err))
re... | 0.009009 |
def _GenerateCRCTable():
"""Generate a CRC-32 table.
ZIP encryption uses the CRC32 one-byte primitive for scrambling some
internal keys. We noticed that a direct implementation is faster than
relying on binascii.crc32().
"""
poly = 0xedb88320
table = [0] * 256
... | 0.0033 |
def appendSolution(self,new_solution):
'''
Appends one solution to another to create a ConsumerSolution whose
attributes are lists. Used in ConsMarkovModel, where we append solutions
*conditional* on a particular value of a Markov state to each other in
order to get the entire s... | 0.008655 |
def write(self, session, data):
"""Writes data to device or interface synchronously.
Corresponds to viWrite function of the VISA library.
:param session: Unique logical identifier to a session.
:param data: data to be written.
:type data: str
:return: Number of bytes ac... | 0.004082 |
def get_all(self):
"""Gets all items in file."""
logger.debug('Fetching items. Path: {data_file}'.format(
data_file=self.data_file
))
return load_file(self.client, self.bucket_name, self.data_file) | 0.008264 |
def fi_iban_bank_info(v: str) -> (str, str):
"""
Returns BIC code and bank name from FI IBAN number.
:param v: IBAN account number
:return: (BIC code, bank name) or ('', '') if not found
"""
from jutil.bank_const_fi import FI_BIC_BY_ACCOUNT_NUMBER, FI_BANK_NAME_BY_BIC
v = iban_filter(v)
... | 0.004505 |
def storage_type(self):
"""Depending on input data type, the storage type is either
"field" (complex) or "phase" (real)."""
nf = np.load(str(self.path), mmap_mode="c", allow_pickle=False)
if np.iscomplexobj(nf):
st = "field"
else:
st = "phase"
retu... | 0.006154 |
def main():
"""
Computational Genomics Lab, Genomics Institute, UC Santa Cruz
Toil BWA pipeline
Alignment of fastq reads via BWA-kit
General usage:
1. Type "toil-bwa generate" to create an editable manifest and config in the current working directory.
2. Parameterize the pipeline by editin... | 0.005049 |
def get_block(self, block_identifier: BlockSpecification) -> Dict:
"""Given a block number, query the chain to get its corresponding block hash"""
return self.web3.eth.getBlock(block_identifier) | 0.014286 |
def does_not_mutate(func):
"""Prevents methods from mutating the receiver"""
def wrapper(self, *args, **kwargs):
new = self.copy()
return func(new, *args, **kwargs)
wrapper.__name__ = func.__name__
wrapper.__doc__ = func.__doc__
return wrapper | 0.003584 |
def get_params_parser():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(usage=ARTHUR_USAGE_MSG,
description=ARTHUR_DESC_MSG,
epilog=ARTHUR_EPILOG_MSG,
formatter_class=argparse.Raw... | 0.00589 |
def model_to_pymatbridge(model, variable_name="model", matlab=None):
"""send the model to a MATLAB workspace through pymatbridge
This model can then be manipulated through the COBRA toolbox
Parameters
----------
variable_name : str
The variable name to which the model will be assigned in t... | 0.000695 |
def prepend(self, bs):
"""Prepend a bitstring to the current bitstring.
bs -- The bitstring to prepend.
"""
bs = self._converttobitstring(bs)
self._prepend(bs)
self._pos += bs.len | 0.008734 |
def get_adjacent_index(I, shape, size):
"""
Find indices 2d-adjacent to those in I. Helper function for get_border*.
Parameters
----------
I : np.ndarray(dtype=int)
indices in the flattened region
shape : tuple(int, int)
region shape
size : int
region size (technical... | 0.005794 |
def networkTwoMode(self, tag1, tag2, directed = False, recordType = True, nodeCount = True, edgeWeight = True, stemmerTag1 = None, stemmerTag2 = None, edgeAttribute = None):
"""Creates a network of the objects found by two WOS tags _tag1_ and _tag2_, each node marked by which tag spawned it making the resultant... | 0.006534 |
def encode_basestring(s):
"""Return a JSON representation of a Python string
"""
if isinstance(s, str) and HAS_UTF8.search(s) is not None:
s = s.decode('utf-8')
def replace(match):
return ESCAPE_DCT[match.group(0)]
return u'"' + ESCAPE.sub(replace, s) + u'"' | 0.00678 |
def query_info(self, jid, *,
node=None, require_fresh=False, timeout=None,
no_cache=False):
"""
Query the features and identities of the specified entity.
:param jid: The entity to query.
:type jid: :class:`aioxmpp.JID`
:param node: The node... | 0.001011 |
def add_execution_profile(self, name, profile, pool_wait_timeout=5):
"""
Adds an :class:`.ExecutionProfile` to the cluster. This makes it available for use by ``name`` in :meth:`.Session.execute`
and :meth:`.Session.execute_async`. This method will raise if the profile already exists.
N... | 0.004158 |
def load(self, template, parameters=None):
"""
'template'
Loads template text from a 'string' or 'file' type
Template text contains {{TOKEN}} symbols to be replaced
'parameters'
parameters contains environment-specific sections as discussed in the class documentation.
the 'parameters' arg c... | 0.01268 |
def _save_config(jira_url, username, password, error_reporting):
"""
Saves the username and password to the config
"""
# Delete what is there before we re-write. New user means new everything
os.path.exists(_config) and os.remove(_config)
config = ConfigParser.SafeConfigParser()
config.read... | 0.000855 |
def create_from_intermediate(cls, crypto, intermediate_point, seed, compressed=True, include_cfrm=True):
"""
Given an intermediate point, given to us by "owner", generate an address
and encrypted private key that can be decoded by the passphrase used to generate
the intermediate point.
... | 0.006241 |
def get_by_provider_display_name(self, provider_display_name):
"""
Gets a SAN Manager by provider display name.
Args:
provider_display_name: Name of the Provider Display Name
Returns:
dict: SAN Manager.
"""
san_managers = self._client.get_all()
... | 0.006536 |
def endpoints(self):
"""
Gets the Endpoints API client.
Returns:
Endpoints:
"""
if not self.__endpoints:
self.__endpoints = Endpoints(self.__connection)
return self.__endpoints | 0.008032 |
def get_authorization_form(self, *args, **kwargs):
"""Pass through to provider AuthorizationAdminSession.get_authorization_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a bit sketchy. ... | 0.006897 |
def multinomLog2(selectors):
"""
Function calculates logarithm 2 of a kind of multinom.
selectors: list of integers
"""
ln2 = 0.69314718055994528622
noAll = sum(selectors)
lgNf = math.lgamma(noAll + 1.0) / ln2 # log2(N!)
lgnFac = []
for selector in selectors:
if selector ... | 0.001664 |
def connect(self, *, db=None):
"""
Attempt to connect to device. If unable, attempt to connect to a controller database
(so the user can use previously saved data).
"""
if not self.properties.network:
self.new_state(DeviceFromDB)
else:
t... | 0.001913 |
def colocate(self, others, why):
"""
Colocate this operator with another.
"""
if isinstance(self, Marker):
return
colocate_tag = '__spl_' + why + '$' + str(self.index)
self._colocate_tag(colocate_tag)
for op in others:
op._colocate_tag(colo... | 0.006079 |
def datasets(self):
"""List of datasets in this mart."""
if self._datasets is None:
self._datasets = self._fetch_datasets()
return self._datasets | 0.01105 |
def to_dataframe(self, dtypes=None):
"""Create a :class:`pandas.DataFrame` of all rows in the stream.
This method requires the pandas libary to create a data frame and the
fastavro library to parse row blocks.
.. warning::
DATETIME columns are not supported. They are curren... | 0.001838 |
def preRun_(self):
"""Create the shared memory client immediately after fork
"""
self.report("preRun_")
super().preRun_()
self.client = ShmemRGBClient(
name=self.shmem_name,
n_ringbuffer=self.n_buffer, # size of ring buffer
width=self.image_d... | 0.003831 |
def deleteByPk(self, pk):
'''
deleteByPk - Delete object associated with given primary key
'''
obj = self.mdl.objects.getOnlyIndexedFields(pk)
if not obj:
return 0
return self.deleteOne(obj) | 0.043689 |
def response_add(self, request, obj, post_url_continue=None, **kwargs):
"""Redirects to the appropriate items' 'continue' page on item add.
As we administer tree items within tree itself, we
should make some changes to redirection process.
"""
if post_url_continue is None:
... | 0.006198 |
def positionMinError(G, vmini, extension=0.0):
"""
Calculate the minimum position errors from G and (V-I). These correspond to the sky regions with the
smallest astrometric errors.
NOTE! THE ERRORS ARE FOR SKY POSITIONS IN THE ICRS (I.E., RIGHT ASCENSION, DECLINATION). MAKE SURE YOUR
SIMULATED ASTROMETRY IS ... | 0.010216 |
def update_by_external_id(self, api_objects):
"""
Update (PUT) one or more API objects by external_id.
:param api_objects:
"""
if not isinstance(api_objects, collections.Iterable):
api_objects = [api_objects]
return CRUDRequest(self).put(api_objects, update_m... | 0.005917 |
def draw_graph(G: nx.DiGraph, filename: str):
""" Draw a networkx graph with Pygraphviz. """
A = to_agraph(G)
A.graph_attr["rankdir"] = "LR"
A.draw(filename, prog="dot") | 0.005405 |
def cache_dir() -> str:
"""Return the default cache directory where downloaded models are stored."""
if config.VENDOR is None:
raise RuntimeError("modelforge is not configured; look at modelforge.configuration. "
"Depending on your objective you may or may not ... | 0.0125 |
def _make_stack(im, include_diagonals=False):
r'''
Creates a stack of images with one extra dimension to the input image
with length equal to the number of borders to search + 1.
Image is rolled along the axial shifts so that the border pixel is
overlapping the original pixel. First image in stack i... | 0.00076 |
def get_lll_frac_coords(self, frac_coords: Vector3Like) -> np.ndarray:
"""
Given fractional coordinates in the lattice basis, returns corresponding
fractional coordinates in the lll basis.
"""
return dot(frac_coords, self.lll_inverse) | 0.010949 |
def _differentiate(self, params=None):
'''Return a sequence of gradients for our parameters.
If this optimizer has been configured with a gradient norm limit, or
with elementwise gradient clipping, this method applies the appropriate
rescaling and clipping operations before returning th... | 0.001472 |
def update_security_group(self, security_group, body=None):
"""Updates a security group."""
return self.put(self.security_group_path %
security_group, body=body) | 0.00995 |
def print_config_values(self, prefix='- '):
"""a wrapper to print_config_value to print all configuration values
Parameters
==========
prefix: the character prefix to put before the printed config value
defaults to "- "
"""
print('Configuratio... | 0.003115 |
def delete_local_variable(self, onnx_name):
'''
Remove the variable whose onnx_name is the input onnx_name
'''
if onnx_name not in self.onnx_variable_names or onnx_name not in self.variables:
raise RuntimeError('The variable to be removed not found')
self.onnx_variabl... | 0.005988 |
def _get_mechanism(self, rup, coeffs):
"""
Compute fifth term of equation (1) on p. 1200:
``b6 * H``
"""
is_strike_slip = self.get_fault_type_dummy_variables(rup)
return coeffs['b6']*is_strike_slip | 0.00813 |
def GetForwardedIps(self, interface, interface_ip=None):
"""Retrieve the list of configured forwarded IP addresses.
Args:
interface: string, the output device to query.
interface_ip: string, current interface ip address.
Returns:
list, the IP address strings.
"""
args = ['ls', 't... | 0.001789 |
def MultipartArchiving(firstPartExtractList, otherPartSkippedList, archiveDir, otherPartFilePath = None):
"""
Archive all parts of multi-part compressed file.
If file has been extracted (via part1) then move all subsequent parts directly to archive directory.
If file has not been extracted then if part >1 add ... | 0.010167 |
def AssignGroupNodes(r, group, nodes, force=False, dry_run=False):
"""
Assigns nodes to a group.
@type group: string
@param group: Node gropu name
@type nodes: list of strings
@param nodes: List of nodes to assign to the group
@rtype: int
@return: job id
"""
query = {
... | 0.001894 |
def vm_disk_snapshot_create(name, kwargs=None, call=None):
'''
Takes a new snapshot of the disk image.
.. versionadded:: 2016.3.0
name
The name of the VM of which to take the snapshot.
disk_id
The ID of the disk to save.
description
The description for the snapshot.
... | 0.002613 |
def GetNewEventId(self, event_time=None):
"""Return a unique Event ID string."""
if event_time is None:
event_time = int(time.time() * 1e6)
return "%s:%s:%s" % (event_time, socket.gethostname(), os.getpid()) | 0.00885 |
def set_mlimits(self, min=None, max=None):
"""Set limits for the point meta (colormap).
Point meta values outside this range will be clipped.
:param min: value corresponding to the start of the colormap.
If None, it will be calculated.
:param max: value corresponding to the... | 0.004292 |
def focus_next(self):
"""focus next message in depth first order"""
mid = self.get_selected_mid()
newpos = self._tree.next_position(mid)
if newpos is not None:
newpos = self._sanitize_position((newpos,))
self.body.set_focus(newpos) | 0.006969 |
def workbook_to_reader(xlwt_wb):
"""
convert xlwt Workbook instance to an xlrd instance for reading
"""
_xlrd_required()
fh = BytesIO()
xlwt_wb.save(fh)
# prep for reading
fh.seek(0)
return xlrd.open_workbook(file_contents=fh.read()) | 0.003663 |
def _GetShowID(self, stringSearch, origStringSearch = None):
"""
Search for given string as an existing entry in the database file name
table or, if no match is found, as a show name from the TV guide.
If an exact match is not found in the database the user can accept
or decline the best match from... | 0.011212 |
def describe_function(FunctionName, region=None, key=None,
keyid=None, profile=None):
'''
Given a function name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_lambda.describe_function myf... | 0.002144 |
def get_version(file, name='__version__'):
"""Get the version of the package from the given file by
executing it and extracting the given `name`.
"""
path = os.path.realpath(file)
version_ns = {}
with io.open(path, encoding="utf8") as f:
exec(f.read(), {}, version_ns)
return version_... | 0.003049 |
def replace_cr_with_newline(message: str):
"""
TQDM and requests use carriage returns to get the training line to update for each batch
without adding more lines to the terminal output. Displaying those in a file won't work
correctly, so we'll just make sure that each batch shows up on its one line.
... | 0.006667 |
def nailgunned_stdio(cls, sock, env, handle_stdin=True):
"""Redirects stdio to the connected socket speaking the nailgun protocol."""
# Determine output tty capabilities from the environment.
stdin_isatty, stdout_isatty, stderr_isatty = NailgunProtocol.isatty_from_env(env)
is_tty_capable = all((stdin_is... | 0.007862 |
def get(self, key):
'''Return timings for `key`. Returns 0 if not present.'''
if key in self and len(self[key]) > 0:
return min(self[key])
else:
return 0 | 0.00995 |
def query(self, model, **kwargs):
'''Create a new :class:`Query` for *model*.'''
sm = self.model(model)
query_class = sm.manager.query_class or Query
return query_class(sm._meta, self, **kwargs) | 0.008696 |
def include(url_prefix_or_module_name: str,
module_name: Optional[str] = None,
*,
attr: str = 'routes',
exclude: Optional[Endpoints] = None,
only: Optional[Endpoints] = None,
) -> RouteGenerator:
"""
Include the routes from another module a... | 0.001738 |
def run_single_eval(nlp, loading_time, print_name, text_path, gold_ud, tmp_output_path, out_file, print_header,
check_parse, print_freq_tasks):
"""" Run an evaluation of a model nlp on a certain specified treebank """
with text_path.open(mode='r', encoding='utf-8') as f:
flat_text = ... | 0.004891 |
def _fetch(
queryset, model_objs, unique_fields, update_fields, returning, sync,
ignore_duplicate_updates=True, return_untouched=False
):
"""
Perfom the upsert and do an optional sync operation
"""
model = queryset.model
if (return_untouched or sync) and returning is not True:
return... | 0.003788 |
def get_all_devices_in_portal(self):
"""
This loops through the get_multiple_devices method 10 rids at a time.
"""
rids = self.get_portal_by_name(
self.portal_name()
)[2][1]['info']['aliases']
# print("RIDS: {0}".format(rids))
... | 0.011062 |
def key(self):
"""Embedded supports curies."""
if self.curie is None:
return self.name
return ":".join((self.curie.name, self.name)) | 0.011905 |
def rename_notes_folder(self, title, folderid):
"""Rename a folder
:param title: New title of the folder
:param folderid: The UUID of the folder to rename
"""
if self.standard_grant_type is not "authorization_code":
raise DeviantartError("Authentication through Aut... | 0.009074 |
def list_device_data_sources(self, device_rid):
"""
List data sources of a portal device with rid 'device_rid'.
http://docs.exosite.com/portals/#list-device-data-source
"""
headers = {
'User-Agent': self.user_agent(),
}
headers.update(self... | 0.008621 |
def validate_week(year, week):
"""Validate week."""
max_week = datetime.strptime("{}-{}-{}".format(12, 31, year), "%m-%d-%Y").isocalendar()[1]
if max_week == 1:
max_week = 53
return 1 <= week <= max_week | 0.012097 |
def task_remove_user(self, *args, **kwargs):
"""Remove the selected user from the task
:returns: None
:rtype: None
:raises: None
"""
if not self.cur_task:
return
i = self.task_user_tablev.currentIndex()
item = i.internalPointer()
if it... | 0.004525 |
def distance_between(self, string, start, end):
"""Returns number of lines between start and end"""
count = 0
started = False
for line in string.split("\n"):
if self.scan_line(line, start) and not started:
started = True
if self.scan_line(line, ... | 0.004673 |
def update(self, step, T, E, acceptance, improvement):
"""Print progress."""
if acceptance is None:
acceptance = 0
if improvement is None:
improvement = 0
if step > 0:
elapsed = time.time() - self.start
remain = (self.steps - step) * (elaps... | 0.003056 |
def create_vm_image(self, vm_image):
'''
Creates a VM Image in the image repository that is associated with the
specified subscription using a specified set of virtual hard disks.
vm_image:
An instance of VMImage class.
vm_image.name: Required. Specifies the name of ... | 0.001445 |
async def close_interface(self, conn_id, interface):
"""Close an interface on this IOTile device.
See :meth:`AbstractDeviceAdapter.close_interface`.
"""
adapter_id = self._get_property(conn_id, 'adapter')
await self.adapters[adapter_id].close_interface(conn_id, interface) | 0.006369 |
def collect(self):
"""
Collector GPU stats
"""
stats_config = self.config['stats']
if USE_PYTHON_BINDING:
collect_metrics = self.collect_via_pynvml
else:
collect_metrics = self.collect_via_nvidia_smi
collect_metrics(stats_config) | 0.006452 |
def _get_key_value(self, key, is_hll=False):
'''
Returns the proper key value for the stats
@param key: the redis key
@param is_hll: the key is a HyperLogLog, else is a sorted set
'''
if is_hll:
# get hll value
return self.redis_conn.execute_comma... | 0.004673 |
def plotTimeline(dataTask, filename):
"""Build a timeline"""
fig = plt.figure()
ax = fig.gca()
worker_names = [x for x in dataTask.keys() if "broker" not in x]
min_time = getMinimumTime(dataTask)
ystep = 1. / (len(worker_names) + 1)
y = 0
for worker, vals in dataTask.items():
... | 0.006829 |
def server_bind(self):
"""
Called by constructor to bind the socket.
"""
if self.allow_reuse_address:
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind(self.server_address) | 0.007752 |
def call_from_executor(self, callback, _max_postpone_until=None):
"""
Call this function in the main event loop.
Similar to Twisted's ``callFromThread``.
:param _max_postpone_until: `None` or `time.time` value. For interal
use. If the eventloop is saturated, consider this ta... | 0.002705 |
def set_vhost_permissions(self, vname, username, config, rd, wr):
"""
Set permissions for a given username on a given vhost. Both
must already exist.
:param string vname: Name of the vhost to set perms on.
:param string username: User to set permissions for.
:param strin... | 0.002622 |
def validate(self):
"""
Error check the attributes of the ActivateRequestPayload object.
"""
if self.unique_identifier is not None:
if not isinstance(self.unique_identifier,
attributes.UniqueIdentifier):
msg = "invalid unique iden... | 0.002577 |
def _filter_kwargs(self, keep_list, **kwargs):
''' Filters the dict of *kwargs*, keeping only arguments
whose keys are in *keep_list* and discarding all other
arguments.
Based on the filtring, constructs and returns a new
dict.
'''
n... | 0.009901 |
def drawBernoulli(N,p=0.5,seed=0):
'''
Generates arrays of booleans drawn from a simple Bernoulli distribution.
The input p can be a float or a list-like of floats; its length T determines
the number of entries in the output. The t-th entry of the output is an
array of N booleans which are True wit... | 0.008734 |
def _parse_player_position(self, player_info):
"""
Parse the player's position.
The player's position isn't contained within a unique tag and the
player's meta information should be iterated through until 'Position'
is found as it contains the desired text.
Parameters
... | 0.002766 |
def is_lazy(self, k):
'''
lmap.is_lazy(k) yields True if the given k is lazy and unmemoized in the given lazy map,
lmap, otherwise False.
'''
v = ps.PMap.__getitem__(self, k)
if not isinstance(v, (types.FunctionType, partial)) or \
id(v) in self._memoized or \
... | 0.007042 |
def _auth_with_refresh_token(session, refresh_token):
"""Authenticate using OAuth refresh token.
Raises GoogleAuthError if authentication fails.
Returns access token string.
"""
# Make a token request.
token_request_data = {
'client_id': OAUTH2_CLIENT_ID,
'client_secret': OAUTH... | 0.001957 |
def collect_manifest_dependencies(manifest_data, lockfile_data):
"""Convert the manifest format to the dependencies schema"""
output = {}
for dependencyName, dependencyConstraint in manifest_data.items():
output[dependencyName] = {
# identifies where this dependency is installed from
... | 0.001244 |
def _addModuleInfo(self, moduleInfo):
""" Adds a line with module info to the editor
:param moduleInfo: can either be a string or a module info class.
In the first case, an object is instantiated as ImportedModuleInfo(moduleInfo).
"""
if is_a_string(moduleInfo):
... | 0.005425 |
def request_ride(
self,
ride_type=None,
start_latitude=None,
start_longitude=None,
start_address=None,
end_latitude=None,
end_longitude=None,
end_address=None,
primetime_confirmation_token=None,
):
"""Request a ride on behalf of an Lyft... | 0.001511 |
def delete(self, docids):
"""Delete specified documents from the index."""
logger.info("asked to drop %i documents" % len(docids))
for index in [self.opt_index, self.fresh_index]:
if index is not None:
index.delete(docids)
self.flush(save_index=True) | 0.006452 |
def get_critical_original_kink_ratio(self):
"""
Returns a list of molar mixing ratio for each kink between ORIGINAL
(instead of processed) reactant compositions. This is the
same list as mixing ratio obtained from get_kinks method
if self.norm = False.
Returns:
... | 0.002717 |
def xml_import(self,
filepath=None,
xml_content=None,
markings=None,
identifier_ns_uri=None,
initialize_importer=True,
**kwargs):
"""
Import an OpenIOC indicator xml (root element 'ioc') fro... | 0.010274 |
def service_available(service_name):
"""Determine whether a system service is available"""
try:
subprocess.check_output(
['service', service_name, 'status'],
stderr=subprocess.STDOUT).decode('UTF-8')
except subprocess.CalledProcessError as e:
return b'unrecognized ser... | 0.002695 |
def save_yamlf(data: Union[list, dict], fpath: str, encoding: str) -> str:
"""
:param data: list | dict data
:param fpath: write path
:param encoding: encoding
:rtype: written path
"""
with codecs.open(fpath, mode='w', encoding=encoding) as f:
f.write(dump_yaml(data))
return ... | 0.003077 |
def get_formset(self):
"""Provide the formset corresponding to this DataTable.
Use this to validate the formset and to get the submitted data back.
"""
if self.folder:
queryset = self.folder.files.all()
else:
queryset = File.objects.none()
if self... | 0.003431 |
def _app(self):
"""The application object to work with; this is either the app
that we have been bound to, or the current application.
"""
if self.app is not None:
return self.app
ctx = _request_ctx_stack.top
if ctx is not None:
return ctx.app
... | 0.0059 |
def list_extmods():
'''
.. versionadded:: 2017.7.0
List Salt modules which have been synced externally
CLI Examples:
.. code-block:: bash
salt '*' saltutil.list_extmods
'''
ret = {}
ext_dir = os.path.join(__opts__['cachedir'], 'extmods')
mod_types = os.listdir(ext_dir)
... | 0.003306 |
def ativar_sat(self, tipo_certificado, cnpj, codigo_uf):
"""Sobrepõe :meth:`~satcfe.base.FuncoesSAT.ativar_sat`.
:return: Uma resposta SAT especilizada em ``AtivarSAT``.
:rtype: satcfe.resposta.ativarsat.RespostaAtivarSAT
"""
retorno = super(ClienteSATLocal, self).ativar_sat(
... | 0.004773 |
def setGroups(self, *args, **kwargs):
"""Adds the groups assigned to this user to a 'groups' field.
Returns the number of requests done to Mambu.
"""
try:
groups = self.mambugroupsclass(creditOfficerUsername=self['username'], *args, **kwargs)
except AttributeError as... | 0.007018 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.