text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def nlsq_fit(x, y, dy, func, params_init, verbose=False, **kwargs):
"""Perform a non-linear least squares fit
Inputs:
x: one-dimensional numpy array of the independent variable
y: one-dimensional numpy array of the dependent variable
dy: absolute error (square root of the variance) of t... | 0.002955 |
def sofia_process_text():
"""Process text with Sofia and return INDRA Statements."""
if request.method == 'OPTIONS':
return {}
response = request.body.read().decode('utf-8')
body = json.loads(response)
text = body.get('text')
auth = body.get('auth')
sp = sofia.process_text(text, auth... | 0.002793 |
def prepare_inventory(self):
"""
Prepares the inventory default under ``private_data_dir`` if it's not overridden by the constructor.
"""
if self.inventory is None:
self.inventory = os.path.join(self.private_data_dir, "inventory") | 0.014545 |
def _querystring(self):
"""Additional keyword arguments"""
kw = {"studyoid": self.studyoid}
if self.location_oid is not None:
kw["locationoid"] = self.location_oid
return kw | 0.009174 |
def setBatchSize(self, val):
"""
Sets the value of :py:attr:`batchSize`.
"""
self._paramMap[self.batchSize] = val
pythonBigDL_method_name = "setBatchSize" + self.__class__.__name__
callBigDlFunc(self.bigdl_type, pythonBigDL_method_name, self.value, val)
return sel... | 0.009346 |
def _get_cron_cmdstr(path, user=None):
'''
Returns a format string, to be used to build a crontab command.
'''
if user:
cmd = 'crontab -u {0}'.format(user)
else:
cmd = 'crontab'
return '{0} {1}'.format(cmd, path) | 0.003968 |
def metapolicy(self, permitted):
"""
Sets metapolicy to ``permitted``. (only applicable to master
policy files). Acceptable values correspond to those listed in
Section 3(b)(i) of the crossdomain.xml specification, and are
also available as a set of constants defined in this modu... | 0.001347 |
def create_game(
self,
map_name,
bot_difficulty=sc_pb.VeryEasy,
bot_race=sc_common.Random,
bot_first=False):
"""Create a game, one remote agent vs the specified bot.
Args:
map_name: The map to use.
bot_difficulty: The difficulty of the bot to play against.
bot_ra... | 0.00416 |
def _get_workflow_with_uuid_or_name(uuid_or_name, user_uuid):
"""Get Workflow from database with uuid or name.
:param uuid_or_name: String representing a valid UUIDv4 or valid
Workflow name. Valid name contains only ASCII alphanumerics.
Name might be in format 'reana.workflow.123' with arbitra... | 0.000265 |
def rotate(self, angle, center=None):
"""Rotate the shape, in-place.
Parameters
----------
angle : float
Angle to rotate, in radians counter-clockwise.
center : array-like, optional
Point about which to rotate.
If not passed, the center of the... | 0.004073 |
def compute(self, gsim, num_events, seed=None):
"""
:param gsim: a GSIM instance
:param num_events: the number of seismic events
:param seed: a random seed or None
:returns:
a 32 bit array of shape (num_imts, num_sites, num_events) and
two arrays with shap... | 0.001427 |
def get_modules(self, type_name):
'''Getting modules by type name.
Parameters
----------
type_name : string
Type name of the modules to be returned.
Returns
-------
List of modules of given type name else empty list.
'''
modules = []
... | 0.00431 |
def fetch(self):
"""
Fetch a SyncListItemInstance
:returns: Fetched SyncListItemInstance
:rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance
"""
params = values.of({})
payload = self._version.fetch(
'GET',
... | 0.004894 |
def add_head(self, *args, **kwargs):
"""
Shortcut for add_route with method HEAD
"""
return self.add_route(hdrs.METH_HEAD, *args, **kwargs) | 0.011696 |
def get_families_by_ids(self, *args, **kwargs):
"""Pass through to provider FamilyLookupSession.get_families_by_ids"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_by_ids
catalogs = self._get_provider_session('family_lookup_session').get_families_by... | 0.007678 |
def new_multiifo_output_list_opt(self, opt, ifos, analysis_time, extension,
tags=None, store_file=None,
use_tmp_subdirs=False):
""" Add an option that determines a list of outputs from multiple
detectors. Files will be supplie... | 0.003903 |
def encode_varint_1(num):
""" Encode an integer to a varint presentation. See
https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints
on how those can be produced.
Arguments:
num (int): Value to encode
Returns:
bytearray: Encoded presentation of i... | 0.001073 |
def add_job(session, command_line, name = 'job', dependencies = [], array = None, exec_dir=None, log_dir = None, stop_on_failure = False, **kwargs):
"""Helper function to create a job, add the dependencies and the array jobs."""
job = Job(command_line=command_line, name=name, exec_dir=exec_dir, log_dir=log_dir, arr... | 0.027703 |
def add_cut(problem, indicators, bound, Constraint):
"""
Add an integer cut to the problem.
Ensure that the same solution involving these indicator variables cannot be
found by enforcing their sum to be less than before.
Parameters
----------
problem : optlang.Model
Specific optlan... | 0.001032 |
def datatype(self, value):
"""
Args:
value (string): 'uint8', 'uint16', 'uint64'
Raises:
ValueError
"""
self._datatype = self.validate_datatype(value)
self._cutout_ready = True | 0.008065 |
def start(self):
"""
Starts this VMware VM.
"""
if self.status == "started":
return
if (yield from self.is_running()):
raise VMwareError("The VM is already running in VMware")
ubridge_path = self.ubridge_path
if not ubridge_path or not o... | 0.002516 |
def CheckForeignKeysWrapper(conn):
"""Migration wrapper that checks foreign keys.
Note that this may raise different exceptions depending on the
underlying database API.
"""
yield
cur = conn.cursor()
cur.execute('PRAGMA foreign_key_check')
errors = cur.fetchall()
if errors:
... | 0.002865 |
def get_unicode_str(obj):
"""Makes sure obj is a unicode string."""
if isinstance(obj, six.text_type):
return obj
if isinstance(obj, six.binary_type):
return obj.decode("utf-8", errors="ignore")
return six.text_type(obj) | 0.003968 |
def __get_segment_types(self, element):
"""
given a <segment> or <group> element, returns its segment type and the
segment type of its parent (i.e. its dominating node)
Parameters
----------
element : ??? etree Element
Returns
-------
segment_typ... | 0.00188 |
async def metrics(self, offs, size=None):
'''
Yield metrics rows starting at offset.
Args:
offs (int): The index offset.
size (int): The maximum number of records to yield.
Yields:
((int, dict)): An index offset, info tuple for metrics.
'''
... | 0.004107 |
def get_avatar(self):
"""Gets the asset.
return: (osid.repository.Asset) - the asset
raise: IllegalState - ``has_avatar()`` is ``false``
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
"""
# Imple... | 0.005382 |
def quiet_reset_backend(self, reset_interps=True):
"""
Doesn't update plots or logger or any visable data but resets all
measurement data, hierarchy data, and optionally resets
intepretations.
Parameters
----------
reset_interps : bool to tell the function to res... | 0.002154 |
def arc(pRA, pDecl, sRA, sDecl, mcRA, lat):
""" Returns the arc of direction between a Promissor
and Significator. It uses the generic proportional
semi-arc method.
"""
pDArc, pNArc = utils.dnarcs(pDecl, lat)
sDArc, sNArc = utils.dnarcs(sDecl, lat)
# Select meridian and arcs to b... | 0.007895 |
def _cmp_key(self, obj=None):
"""Comparison key for sorting results from all linters.
The sort should group files and lines from different linters to make it
easier for refactoring.
"""
if not obj:
obj = self
line_nr = int(obj.line_nr) if obj.line_nr else 0
... | 0.004854 |
def activate(self, engine):
"""
Activates the Component.
:param engine: Engine to attach the Component to.
:type engine: QObject
:return: Method success.
:rtype: bool
"""
LOGGER.debug("> Activating '{0}' Component.".format(self.__class__.__name__))
... | 0.007289 |
def _setup_sentry_client(context):
"""Produce and configure the sentry client."""
# get_secret will be deprecated soon
dsn = os.environ.get("SENTRY_DSN")
try:
client = raven.Client(dsn, sample_rate=SENTRY_SAMPLE_RATE)
client.user_context(_sentry_context_dict(context))
return cli... | 0.004831 |
def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
command): # pylint: disable=W0613
'''
Read in the generated libvirt keys
'''
key_dir = os.path.join(
__opts__['pki_dir'],
'libvirt',
minion_id)
cacert = os.path.join(__opts__... | 0.000706 |
def end_step(self, lineno, timestamp=None, result_code=None):
"""Fill in the current step's summary and update the state to show the current step has ended."""
self.state = self.STATES['step_finished']
step_errors = self.sub_parser.get_artifact()
step_error_count = len(step_errors)
... | 0.005093 |
def make_g2p_id(self):
"""
Make an association id for phenotypic associations that is defined by:
source of association +
(Annot subject) +
relationship +
phenotype/disease +
environment +
start stage +
end stage
:return:
"""
... | 0.00722 |
async def _handle_response(self, response: aiohttp.client_reqrep.ClientResponse, await_final_result: bool) -> dict:
"""
Handles the response returned from the CloudStack API. Some CloudStack API are implemented asynchronous, which
means that the API call returns just a job id. The actually expec... | 0.006689 |
def bytes(num, check_result=False):
"""
Returns num bytes of cryptographically strong pseudo-random
bytes. If checkc_result is True, raises error if PRNG is not
seeded enough
"""
if num <= 0:
raise ValueError("'num' should be > 0")
buf = create_string_buffer(num)
result = libcry... | 0.002079 |
def full_task(self, token_id, presented_pronunciation, pronunciation, pronunciation_probability,
warn=True, default=True):
"""Provide the prediction of the full task.
This function is used to predict the probability of a given pronunciation being reported for a given token.
:... | 0.007516 |
async def stations(self, city: str, state: str, country: str) -> list:
"""Return a list of supported stations in a city."""
data = await self._request(
'get',
'stations',
params={
'city': city,
'state': state,
'country':... | 0.005051 |
def format(self, source):
"""Specifies the input data source format.
:param source: string, name of the data source, e.g. 'json', 'parquet'.
>>> df = spark.read.format('json').load('python/test_support/sql/people.json')
>>> df.dtypes
[('age', 'bigint'), ('name', 'string')]
... | 0.007481 |
def run(self):
"""
Run dbt for the query, based on the graph.
"""
self._runtime_initialize()
if len(self._flattened_nodes) == 0:
logger.warning("WARNING: Nothing to do. Try checking your model "
"configs and model specification args")
... | 0.00316 |
def get_scan_parameters_table_from_meta_data(meta_data_array, scan_parameters=None):
'''Takes the meta data array and returns the scan parameter values as a view of a numpy array only containing the parameter data .
Parameters
----------
meta_data_array : numpy.ndarray
The array with the scan pa... | 0.005147 |
def create_firewall_rule(protocol, action, profile=None, **kwargs):
'''
Creates a new firewall rule
CLI Example:
.. code-block:: bash
salt '*' neutron.create_firewall_rule protocol action
tenant_id=TENANT_ID name=NAME description=DESCRIPTION ip_version=IP_VERSION
... | 0.00403 |
def pdf(cls, uuid):
"""Return a PDF of the invoice identified by the UUID
This is a raw string, which can be written to a file with:
`
with open('invoice.pdf', 'w') as invoice_file:
invoice_file.write(recurly.Invoice.pdf(uuid))
`
"""
url = ur... | 0.006211 |
def publishing_prepare_published_copy(self, draft_obj):
""" Prepare published copy of draft prior to saving it """
# We call super here, somewhat perversely, to ensure this method will
# be called on publishable subclasses if implemented there.
mysuper = super(PublishingModel, self)
... | 0.004484 |
async def _get_twitter_configuration(self):
"""
create a ``twitter_configuration`` attribute with the response
of the endpoint
https://api.twitter.com/1.1/help/configuration.json
"""
api = self['api', general.twitter_api_version,
".json", general.twitte... | 0.005181 |
def evaluate(self, env):
"""Evaluate the symbol in the environment, returning a Unicode
string.
"""
if self.ident in env.values:
# Substitute for a value.
return env.values[self.ident]
else:
# Keep original text.
return self.origina... | 0.006231 |
def makeRequest(self, requestId, request, expectResponse=True):
"""
Send a request to our broker via our self.proto KafkaProtocol object.
Return a deferred which will fire when the reply matching the requestId
comes back from the server, or, if expectResponse is False, then
retu... | 0.001391 |
def _get_collection_for_user(self, collection_id, user):
"""Check that collection exists and user has `add` permission."""
collection_query = Collection.objects.filter(pk=collection_id)
if not collection_query.exists():
raise exceptions.ValidationError('Collection id does not exist')... | 0.003279 |
def to(self, to):
"""
[Edge-only] especifica el destino del lado
"""
if self._type.lower() != 'edge':
raise ValueError('Cannot set From/To to non-edge objects')
self._to = to
return self | 0.00813 |
def get_system_uptime_output_show_system_uptime_hours(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_system_uptime = ET.Element("get_system_uptime")
config = get_system_uptime
output = ET.SubElement(get_system_uptime, "output")
show_... | 0.002865 |
def initialize_connection(self): # noqa: E501 pylint:disable=too-many-statements, too-many-branches
"""Initialize a socket to a Chromecast, retrying as necessary."""
tries = self.tries
if self.socket is not None:
self.socket.close()
self.socket = None
# Make su... | 0.000297 |
def is_overlapping_viewport(self, hotspot, xy):
"""
Checks to see if the hotspot at position ``(x, y)``
is (at least partially) visible according to the
position of the viewport.
"""
l1, t1, r1, b1 = calc_bounds(xy, hotspot)
l2, t2, r2, b2 = calc_bounds(self._posi... | 0.004785 |
def collection_items(self, collection_name, **kwargs):
"""
implements Requirement 17 (/req/core/fc-op)
@type collection_name: string
@param collection_name: name of collection
@type bbox: list
@param bbox: list of minx,miny,maxx,maxy
@type time: string
@p... | 0.002148 |
def check_compound_consistency(database, solver, exchange=set(),
zeromass=set()):
"""Yield each compound in the database with assigned mass
Each compound will be assigned a mass and the number of compounds having a
positive mass will be approximately maximized.
This is a... | 0.000567 |
def update_model_snapshot(self, job_id, snapshot_id, body, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html>`_
:arg job_id: The ID of the job to fetch
:arg snapshot_id: The ID of the snapshot to update
:arg body: The mode... | 0.002294 |
def _getTrafficClassAndFlowLabel(self):
"""Page 6, draft feb 2011 """
if self.tf == 0x0:
return (self.tc_ecn << 6) + self.tc_dscp, self.flowlabel
elif self.tf == 0x1:
return (self.tc_ecn << 6), self.flowlabel
elif self.tf == 0x2:
return (self.tc_ecn <<... | 0.005277 |
def get_lib_module_dict(self):
"""Load the 'lib' directory as a python module, so it can be used to provide functions
for rowpipe transforms. This only works filesystem packages"""
from importlib import import_module
if not self.ref:
return {}
u = parse_app_url(se... | 0.008763 |
def label_absent(name, node=None, apiserver_url=None):
'''
.. versionadded:: 2016.3.0
Delete label to the current node
CLI Example:
.. code-block:: bash
salt '*' k8s.label_absent hw/disktype
salt '*' k8s.label_absent hw/disktype kube-node.cluster.local http://kube-master.cluster.... | 0.002022 |
def _join_paragraphs(cls, lines, use_indent=False, leading_blanks=False, trailing_blanks=False):
"""Join adjacent lines together into paragraphs using either a blank line or indent as separator."""
curr_para = []
paragraphs = []
for line in lines:
if use_indent:
... | 0.005957 |
def plot(self, flip=False, ax_channels=None, ax=None, *args, **kwargs):
"""
{_gate_plot_doc}
"""
if ax == None:
ax = pl.gca()
if ax_channels is not None:
flip = self._find_orientation(ax_channels)
if flip:
vert = [v[::-1] for v in self... | 0.005576 |
def get_stp_mst_detail_output_msti_port_admin_edge(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")
msti... | 0.002817 |
def translate(to_translate, to_language="auto", from_language="auto"):
"""Returns the translation using google translate
you must shortcut the language you define
(French = fr, English = en, Spanish = es, etc...)
if not defined it will detect it or use english by default
Example:
print(translat... | 0.000838 |
def hash_footnote_reference(text, hashes, markdown_obj):
"""Hashes a footnote [^id] reference
This function converts footnote styles:
text here[^id]
Footnotes can be defined anywhere in the Markdown text.
"""
footnotes = markdown_obj.footnotes
numbers = {f: i+1 for i, f in enumerate(f... | 0.002853 |
def get_configuration(basename='scriptabit.cfg', parents=None):
"""Parses and returns the program configuration options,
taken from a combination of ini-style config file, and
command line arguments.
Args:
basename (str): The base filename.
parents (list): A list of ArgumentParser objec... | 0.000824 |
def __with_argument(node, value):
"""Modifies the flags in value if the node contains an Argument."""
arguments = node.getElementsByTagName('Argument')
if arguments:
logging.debug('Found argument within %s', value['name'])
value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue) | 0.003125 |
def transcribe(model_path, corpus):
""" Applies a trained model to untranscribed data in a Corpus. """
exp_dir = prep_exp_dir()
model = get_simple_model(exp_dir, corpus)
model.transcribe(model_path) | 0.004651 |
def _processCheckAuthResponse(self, response, server_url):
"""Process the response message from a check_authentication
request, invalidating associations if requested.
"""
is_valid = response.getArg(OPENID_NS, 'is_valid', 'false')
invalidate_handle = response.getArg(OPENID_NS, '... | 0.003319 |
def document_agents(p):
"""
Document agents in AIKIF (purpose and intent)
"""
p.comment('agent.py', 'base agent class')
p.comment('run_agents.py', 'Top level function to run the agents')
p.comment('agent_image_metadata.py', 'agent to collect file picture metadata')
p.comment('agent_lear... | 0.008299 |
def predictor(enc_flat,
action,
lstm_states,
pred_depth,
reuse=False,
scope_prefix='',
hparams=None):
"""LSTM predictor network."""
with tf.variable_scope(scope_prefix + 'predict', reuse=reuse):
enc_final_size = enc_flat.get_sh... | 0.005064 |
def validate_utterance(self, utterance):
"""
Validate the given utterance and return a list of uncovered segments (start, end).
"""
uncovered_segments = []
if self.label_list_idx in utterance.label_lists.keys():
start = 0
end = utterance.duration
... | 0.002686 |
def exists(Name, region=None, key=None, keyid=None, profile=None):
'''
Given a rule name, check to see if the given rule exists.
Returns True if the given rule exists and returns False if the given
rule does not exist.
CLI example::
salt myminion boto_cloudwatch_event.exists myevent regio... | 0.001244 |
def add(self, agent_id, media_type, media_file):
"""
新增其它类型永久素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)普通文件(file)
... | 0.002959 |
def _JRAxiIntegrand(r,E,L,pot):
"""The J_R integrand"""
return nu.sqrt(2.*(E-potentialAxi(r,pot))-L**2./r**2.) | 0.042373 |
def install_except_hook(except_hook=_hooks.except_hook):
"""
Install an except hook that will show the crash report dialog when an
unhandled exception has occured.
:param except_hook: except_hook function that will be called on the main
thread whenever an unhandled exception occured. The functi... | 0.001546 |
def get_action(self, action_id):
"""Returns a specific Action by its ID.
Args:
action_id (int): id of action
"""
return Action.get_object(
api_token=self.token,
action_id=action_id
) | 0.007722 |
def _drop_nodes_from_errorpaths(self, _errors, dp_items, sp_items):
""" Removes nodes by index from an errorpath, relatively to the
basepaths of self.
:param errors: A list of :class:`errors.ValidationError` instances.
:param dp_items: A list of integers, pointing at the nodes to dr... | 0.001815 |
def process_data(name=None):
'''Fetch the current process local data dictionary.
If ``name`` is not ``None`` it returns the value at``name``,
otherwise it return the process data dictionary
'''
ct = current_process()
if not hasattr(ct, '_pulsar_local'):
ct._pulsar_local = {}
loc = c... | 0.002653 |
def libvlc_media_library_new(p_instance):
'''Create an new Media Library object.
@param p_instance: the libvlc instance.
@return: a new object or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_library_new', None) or \
_Cfunction('libvlc_media_library_new', ((1,),), class_result(MediaLi... | 0.007519 |
def facets_area(self):
"""
Return an array containing the area of each facet.
Returns
---------
area : (len(self.facets),) float
Total area of each facet (group of faces)
"""
# avoid thrashing the cache inside a loop
area_faces = self.area_faces... | 0.002732 |
def process_action(self, request, queryset):
"""
Deletes the object(s). Successful deletes are logged.
Returns a 'render redirect' to the result of the
`get_done_url` method.
If a ProtectedError is raised, the `render` method
is called with message explaining the error a... | 0.00771 |
def vcs_virtual_ip_address_address(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
vcs = ET.SubElement(config, "vcs", xmlns="urn:brocade.com:mgmt:brocade-vcs")
virtual = ET.SubElement(vcs, "virtual")
ip = ET.SubElement(virtual, "ip")
addr... | 0.005535 |
def restore_descriptor(self, converted_descriptor):
"""Restore descriptor rom BigQuery
"""
# Convert
fields = []
for field in converted_descriptor['fields']:
field_type = self.restore_type(field['type'])
resfield = {
'name': field['name'],... | 0.003367 |
def print_variant(variant, include, exclude):
"""Print a vcf variant
Parameters
----------
variant: cyvcf2.Variant
include: tuple
set of strings with info fields that should be included
include: tuple
set of strings with info fields that should be included
"""
if inc... | 0.006015 |
def pack(self):
'''
Make ApptRec json/msgpack-friendly
'''
reqdictf = {k.name.lower(): v for (k, v) in self.reqdict.items()}
incunitf = None if self.incunit is None else self.incunit.name.lower()
return (reqdictf, incunitf, self.incval) | 0.007042 |
def _read(**kwargs):
"""Read csv file from local disk.
Args:
filepath_or_buffer:
The filepath of the csv file.
We only support local files for now.
kwargs: Keyword arguments in pandas.read_csv
"""
pd_obj = BaseFactory.read_csv(**kwargs)
# This happens when... | 0.003035 |
def _hash_url(self, url):
"""
Hash the URL to an md5sum.
"""
if isinstance(url, six.text_type):
url = url.encode('utf-8')
return hashlib.md5(url).hexdigest() | 0.009479 |
def load(self, file_locations=[], **kwargs):
""" Loads the file_locations into the triplestores
args:
file_locations: list of tuples to load
[('vocabularies', [list of vocabs to load])
('directory', '/directory/path')
('filepath'... | 0.001876 |
def get_parents():
"""Return sorted list of names of packages without dependants."""
distributions = get_installed_distributions(user_only=ENABLE_USER_SITE)
remaining = {d.project_name.lower() for d in distributions}
requirements = {r.project_name.lower() for d in distributions for
r... | 0.002571 |
def Ry(rads: Union[float, sympy.Basic]) -> YPowGate:
"""Returns a gate with the matrix e^{-i Y rads / 2}."""
pi = sympy.pi if protocols.is_parameterized(rads) else np.pi
return YPowGate(exponent=rads / pi, global_shift=-0.5) | 0.004237 |
def get_model(self):
"""
Returns the fitted bayesian model
Example
----------
>>> from pgmpy.readwrite import BIFReader
>>> reader = BIFReader("bif_test.bif")
>>> reader.get_model()
<pgmpy.models.BayesianModel.BayesianModel object at 0x7f20af154320>
... | 0.004013 |
def health(args):
""" Health FireCloud Server """
r = fapi.health()
fapi._check_response_code(r, 200)
return r.content | 0.007463 |
def depth(self):
"""Return the circuit depth.
Returns:
int: the circuit depth
Raises:
DAGCircuitError: if not a directed acyclic graph
"""
if not nx.is_directed_acyclic_graph(self._multi_graph):
raise DAGCircuitError("not a DAG")
depth... | 0.004819 |
def build_from_issue_comment(gh_token, body):
"""Create a WebhookMetadata from a comment added to an issue.
"""
if body["action"] in ["created", "edited"]:
github_con = Github(gh_token)
repo = github_con.get_repo(body['repository']['full_name'])
issue = repo.get_issue(body['issue']['... | 0.001534 |
def Or(a: Bool, b: Bool) -> Bool:
"""Create an or expression.
:param a:
:param b:
:return:
"""
union = a.annotations + b.annotations
return Bool(z3.Or(a.raw, b.raw), annotations=union) | 0.004695 |
def show_help(fd=sys.stdout):
'''
Convenience wrapper around binwalk.core.module.Modules.help.
@fd - An object with a write method (e.g., sys.stdout, sys.stderr, etc).
Returns None.
'''
with Modules() as m:
fd.write(m.help()) | 0.003861 |
def network_lopf(network, snapshots=None, solver_name="glpk", solver_io=None,
skip_pre=False, extra_functionality=None, solver_logfile=None, solver_options={},
keep_files=False, formulation="angles", ptdf_tolerance=0.,
free_memory={},extra_postprocessing=None):
"""... | 0.002398 |
def merge(self, pdf_files, output):
"""Merge list of PDF files to a single PDF file."""
if self.method is 'pypdf3':
return self.pypdf3(pdf_files, output)
else:
return self.pdfrw(pdf_files, output) | 0.008197 |
def overhang(self, tile):
"""
Get the left and right absolute overflow -- the amount of box
overhanging `tile`, can be viewed as self \\ tile (set theory relative
complement, but in a bounding sense)
"""
ll = np.abs(amin(self.l - tile.l, aN(0, dim=self.dim)))
rr =... | 0.005089 |
def _generate_one_fake(self, schema):
"""
Recursively traverse schema dictionary and for each "leaf node", evaluate the fake
value
Implementation:
For each key-value pair:
1) If value is not an iterable (i.e. dict or list), evaluate the fake data (base case)
2) I... | 0.005175 |
def get_uncond_agent(agent):
"""Construct the unconditional state of an Agent.
The unconditional Agent is a copy of the original agent but
without any bound conditions and modification conditions.
Mutation conditions, however, are preserved since they are static.
"""
agent_uncond = ist.Agent(_n... | 0.002604 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.