body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def __init__(self, doc):
'\n Initialize from a database document.\n\n :param dict doc: A database document.\n '
self._enabled = doc.get('enabled', True)
self._strip_parameters = doc.get('strip_parameters', list()) | 4,003,996,736,965,378,600 | Initialize from a database document.
:param dict doc: A database document. | starbelly/policy.py | __init__ | HyperionGray/starbelly | python | def __init__(self, doc):
'\n Initialize from a database document.\n\n :param dict doc: A database document.\n '
self._enabled = doc.get('enabled', True)
self._strip_parameters = doc.get('strip_parameters', list()) |
def normalize(self, url):
'\n Normalize ``url`` according to policy.\n\n :param str url: The URL to be normalized.\n :returns: The normalized URL.\n :rtype str:\n '
if self._enabled:
if self._strip_parameters:
url = w3lib.url.url_query_cleaner(url, remove=T... | -8,645,073,213,677,712,000 | Normalize ``url`` according to policy.
:param str url: The URL to be normalized.
:returns: The normalized URL.
:rtype str: | starbelly/policy.py | normalize | HyperionGray/starbelly | python | def normalize(self, url):
'\n Normalize ``url`` according to policy.\n\n :param str url: The URL to be normalized.\n :returns: The normalized URL.\n :rtype str:\n '
if self._enabled:
if self._strip_parameters:
url = w3lib.url.url_query_cleaner(url, remove=T... |
@staticmethod
def convert_doc_to_pb(doc, pb):
'\n Convert from database document to protobuf.\n\n :param dict doc: Database document.\n :param pb: An empty protobuf.\n :type pb: starbelly.starbelly_pb2.PolicyUrlRules\n '
for doc_url in doc:
pb_url = pb.add()
if... | -6,116,275,236,407,626,000 | Convert from database document to protobuf.
:param dict doc: Database document.
:param pb: An empty protobuf.
:type pb: starbelly.starbelly_pb2.PolicyUrlRules | starbelly/policy.py | convert_doc_to_pb | HyperionGray/starbelly | python | @staticmethod
def convert_doc_to_pb(doc, pb):
'\n Convert from database document to protobuf.\n\n :param dict doc: Database document.\n :param pb: An empty protobuf.\n :type pb: starbelly.starbelly_pb2.PolicyUrlRules\n '
for doc_url in doc:
pb_url = pb.add()
if... |
@staticmethod
def convert_pb_to_doc(pb, doc):
'\n Convert protobuf to database document.\n\n :param pb: A protobuf\n :type pb: starbelly.starbelly_pb2.PolicyUrlRules\n :returns: Database document.\n :rtype: dict\n '
for pb_url in pb:
doc_url = dict()
if ... | 2,046,348,049,237,025,000 | Convert protobuf to database document.
:param pb: A protobuf
:type pb: starbelly.starbelly_pb2.PolicyUrlRules
:returns: Database document.
:rtype: dict | starbelly/policy.py | convert_pb_to_doc | HyperionGray/starbelly | python | @staticmethod
def convert_pb_to_doc(pb, doc):
'\n Convert protobuf to database document.\n\n :param pb: A protobuf\n :type pb: starbelly.starbelly_pb2.PolicyUrlRules\n :returns: Database document.\n :rtype: dict\n '
for pb_url in pb:
doc_url = dict()
if ... |
def __init__(self, docs, seeds):
'\n Initialize from database documents.\n\n :param docs: Database document.\n :type docs: list[dict]\n :param seeds: Seed URLs, used for computing the costs for crawled links.\n :type seeds: list[str]\n '
if (not docs):
_invalid(... | -1,408,077,322,427,772,000 | Initialize from database documents.
:param docs: Database document.
:type docs: list[dict]
:param seeds: Seed URLs, used for computing the costs for crawled links.
:type seeds: list[str] | starbelly/policy.py | __init__ | HyperionGray/starbelly | python | def __init__(self, docs, seeds):
'\n Initialize from database documents.\n\n :param docs: Database document.\n :type docs: list[dict]\n :param seeds: Seed URLs, used for computing the costs for crawled links.\n :type seeds: list[str]\n '
if (not docs):
_invalid(... |
def get_cost(self, parent_cost, url):
'\n Return the cost for a URL.\n\n :param float parent_cost: The cost of the resource which yielded this\n URL.\n :param str url: The URL to compute cost for.\n :returns: Cost of ``url``.\n :rtype: float\n '
for (pattern,... | -8,746,397,229,955,853,000 | Return the cost for a URL.
:param float parent_cost: The cost of the resource which yielded this
URL.
:param str url: The URL to compute cost for.
:returns: Cost of ``url``.
:rtype: float | starbelly/policy.py | get_cost | HyperionGray/starbelly | python | def get_cost(self, parent_cost, url):
'\n Return the cost for a URL.\n\n :param float parent_cost: The cost of the resource which yielded this\n URL.\n :param str url: The URL to compute cost for.\n :returns: Cost of ``url``.\n :rtype: float\n '
for (pattern,... |
@staticmethod
def convert_doc_to_pb(doc, pb):
'\n Convert from database document to protobuf.\n\n :param dict doc: Database document.\n :param pb: An empty protobuf.\n :type pb: starbelly.starbelly_pb2.PolicyUserAgents\n '
for doc_user_agent in doc:
pb_user_agent = pb.... | -4,759,767,526,905,407,000 | Convert from database document to protobuf.
:param dict doc: Database document.
:param pb: An empty protobuf.
:type pb: starbelly.starbelly_pb2.PolicyUserAgents | starbelly/policy.py | convert_doc_to_pb | HyperionGray/starbelly | python | @staticmethod
def convert_doc_to_pb(doc, pb):
'\n Convert from database document to protobuf.\n\n :param dict doc: Database document.\n :param pb: An empty protobuf.\n :type pb: starbelly.starbelly_pb2.PolicyUserAgents\n '
for doc_user_agent in doc:
pb_user_agent = pb.... |
@staticmethod
def convert_pb_to_doc(pb, doc):
'\n Convert protobuf to database document.\n\n :param pb: A protobuf\n :type pb: starbelly.starbelly_pb2.PolicyUserAgents\n :returns: Database document.\n :rtype: dict\n '
for user_agent in pb:
doc.append({'name': us... | 608,808,429,641,883,000 | Convert protobuf to database document.
:param pb: A protobuf
:type pb: starbelly.starbelly_pb2.PolicyUserAgents
:returns: Database document.
:rtype: dict | starbelly/policy.py | convert_pb_to_doc | HyperionGray/starbelly | python | @staticmethod
def convert_pb_to_doc(pb, doc):
'\n Convert protobuf to database document.\n\n :param pb: A protobuf\n :type pb: starbelly.starbelly_pb2.PolicyUserAgents\n :returns: Database document.\n :rtype: dict\n '
for user_agent in pb:
doc.append({'name': us... |
def __init__(self, docs, version):
'\n Initialize from database documents.\n\n :param docs: Database document.\n :type docs: list[dict]\n :param str version: The version number interpolated into ``{VERSION}``.\n '
if (not docs):
_invalid('At least one user agent is req... | -6,679,003,698,236,295,000 | Initialize from database documents.
:param docs: Database document.
:type docs: list[dict]
:param str version: The version number interpolated into ``{VERSION}``. | starbelly/policy.py | __init__ | HyperionGray/starbelly | python | def __init__(self, docs, version):
'\n Initialize from database documents.\n\n :param docs: Database document.\n :type docs: list[dict]\n :param str version: The version number interpolated into ``{VERSION}``.\n '
if (not docs):
_invalid('At least one user agent is req... |
def get_first_user_agent(self):
'\n :returns: Return the first user agent.\n :rtype: str\n '
return self._user_agents[0] | 1,953,470,778,544,375,300 | :returns: Return the first user agent.
:rtype: str | starbelly/policy.py | get_first_user_agent | HyperionGray/starbelly | python | def get_first_user_agent(self):
'\n :returns: Return the first user agent.\n :rtype: str\n '
return self._user_agents[0] |
def get_user_agent(self):
'\n :returns: A randomly selected user agent string.\n :rtype: str\n '
return random.choice(self._user_agents) | -8,234,317,892,050,347,000 | :returns: A randomly selected user agent string.
:rtype: str | starbelly/policy.py | get_user_agent | HyperionGray/starbelly | python | def get_user_agent(self):
'\n :returns: A randomly selected user agent string.\n :rtype: str\n '
return random.choice(self._user_agents) |
@transaction.atomic
def merge_users(main_user, other_user, preview=False):
'Merges other_user into main_user'
merged_user = {}
merged_user['is_active'] = (main_user.is_active or other_user.is_active)
merged_user['title'] = (main_user.title or other_user.title or '')
merged_user['first_name'] = (main... | -4,810,132,564,737,749,000 | Merges other_user into main_user | evap/staff/tools.py | merge_users | lill28/EvaP | python | @transaction.atomic
def merge_users(main_user, other_user, preview=False):
merged_user = {}
merged_user['is_active'] = (main_user.is_active or other_user.is_active)
merged_user['title'] = (main_user.title or other_user.title or )
merged_user['first_name'] = (main_user.first_name or other_user.first... |
def timer_callback(self):
' Calculate Mx1, My1, ...... Mx6, My6 '
Mx1 = (self.x2 - self.x1)
My1 = (self.y2 - self.y1)
Mx2 = (((self.x1 - self.x2) + (self.x3 - self.x2)) / 2)
My2 = (((self.y1 - self.y2) + (self.y3 - self.y2)) / 2)
Mx3 = (((self.x2 - self.x3) + (self.x4 - self.x3)) / 2)
My3 = ... | 6,601,636,101,486,824,000 | Calculate Mx1, My1, ...... Mx6, My6 | Real Topology Graph/GNN Model 1/Cyclic Graph/Main_MLP_line.py | timer_callback | HusseinLezzaik/Consensus-Algorithm-for-2-Mobile-Robots | python | def timer_callback(self):
' '
Mx1 = (self.x2 - self.x1)
My1 = (self.y2 - self.y1)
Mx2 = (((self.x1 - self.x2) + (self.x3 - self.x2)) / 2)
My2 = (((self.y1 - self.y2) + (self.y3 - self.y2)) / 2)
Mx3 = (((self.x2 - self.x3) + (self.x4 - self.x3)) / 2)
My3 = (((self.y2 - self.y3) + (self.y4 - ... |
def fOBatch(colmap=None, runName='opsim', extraSql=None, extraMetadata=None, nside=64, benchmarkArea=18000, benchmarkNvisits=825, minNvisits=750):
'Metrics for calculating fO.\n\n Parameters\n ----------\n colmap : dict or None, optional\n A dictionary with a mapping of column names. Default will us... | -1,700,880,196,380,505,000 | Metrics for calculating fO.
Parameters
----------
colmap : dict or None, optional
A dictionary with a mapping of column names. Default will use OpsimV4 column names.
runName : str, optional
The name of the simulated survey. Default is "opsim".
nside : int, optional
Nside for the healpix slicer. Default 64.... | rubin_sim/maf/batches/srdBatch.py | fOBatch | RileyWClarke/Flarubin | python | def fOBatch(colmap=None, runName='opsim', extraSql=None, extraMetadata=None, nside=64, benchmarkArea=18000, benchmarkNvisits=825, minNvisits=750):
'Metrics for calculating fO.\n\n Parameters\n ----------\n colmap : dict or None, optional\n A dictionary with a mapping of column names. Default will us... |
def astrometryBatch(colmap=None, runName='opsim', extraSql=None, extraMetadata=None, nside=64, ditherStacker=None, ditherkwargs=None):
'Metrics for evaluating proper motion and parallax.\n\n Parameters\n ----------\n colmap : dict or None, optional\n A dictionary with a mapping of column names. Defa... | 879,015,945,918,942,300 | Metrics for evaluating proper motion and parallax.
Parameters
----------
colmap : dict or None, optional
A dictionary with a mapping of column names. Default will use OpsimV4 column names.
runName : str, optional
The name of the simulated survey. Default is "opsim".
nside : int, optional
Nside for the heal... | rubin_sim/maf/batches/srdBatch.py | astrometryBatch | RileyWClarke/Flarubin | python | def astrometryBatch(colmap=None, runName='opsim', extraSql=None, extraMetadata=None, nside=64, ditherStacker=None, ditherkwargs=None):
'Metrics for evaluating proper motion and parallax.\n\n Parameters\n ----------\n colmap : dict or None, optional\n A dictionary with a mapping of column names. Defa... |
def rapidRevisitBatch(colmap=None, runName='opsim', extraSql=None, extraMetadata=None, nside=64, ditherStacker=None, ditherkwargs=None):
'Metrics for evaluating proper motion and parallax.\n\n Parameters\n ----------\n colmap : dict or None, optional\n A dictionary with a mapping of column names. De... | 2,913,542,167,369,276,400 | Metrics for evaluating proper motion and parallax.
Parameters
----------
colmap : dict or None, optional
A dictionary with a mapping of column names. Default will use OpsimV4 column names.
runName : str, optional
The name of the simulated survey. Default is "opsim".
nside : int, optional
Nside for the heal... | rubin_sim/maf/batches/srdBatch.py | rapidRevisitBatch | RileyWClarke/Flarubin | python | def rapidRevisitBatch(colmap=None, runName='opsim', extraSql=None, extraMetadata=None, nside=64, ditherStacker=None, ditherkwargs=None):
'Metrics for evaluating proper motion and parallax.\n\n Parameters\n ----------\n colmap : dict or None, optional\n A dictionary with a mapping of column names. De... |
@cached_property
def additional_properties_type():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n '
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type) | 1,702,168,743,392,494,600 | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | intersight/model/compute_vmedia_relationship.py | additional_properties_type | CiscoDevNet/intersight-python | python | @cached_property
def additional_properties_type():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n '
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type) |
@cached_property
def openapi_types():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n\n Returns\n openapi_types (dict): The key is attribute name\n and the value is attribute type.\n ... | 6,070,496,696,298,718,000 | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type. | intersight/model/compute_vmedia_relationship.py | openapi_types | CiscoDevNet/intersight-python | python | @cached_property
def openapi_types():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n\n Returns\n openapi_types (dict): The key is attribute name\n and the value is attribute type.\n ... |
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs):
'ComputeVmediaRelationship - a model defined in OpenAPI\n\n Args:\n\n Keyword Args:\n class_id (str): The fully-qualified name of the instantiated, concrete type. This property is used as a discriminator to identify the ty... | -6,755,999,235,934,246,000 | ComputeVmediaRelationship - a model defined in OpenAPI
Args:
Keyword Args:
class_id (str): The fully-qualified name of the instantiated, concrete type. This property is used as a discriminator to identify the type of the payload when marshaling and unmarshaling data.. defaults to "mo.MoRef", must be one of ["mo.M... | intersight/model/compute_vmedia_relationship.py | __init__ | CiscoDevNet/intersight-python | python | @convert_js_args_to_python_args
def __init__(self, *args, **kwargs):
'ComputeVmediaRelationship - a model defined in OpenAPI\n\n Args:\n\n Keyword Args:\n class_id (str): The fully-qualified name of the instantiated, concrete type. This property is used as a discriminator to identify the ty... |
def conv3x3(in_planes, out_planes, stride=1):
'3x3 convolution with padding'
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) | -798,009,169,856,366,800 | 3x3 convolution with padding | ever/module/_hrnet.py | conv3x3 | Bobholamovic/ever | python | def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) |
def read_go_deps(main_packages, build_tags):
'\n read_go_deps returns a list of module dependencies in JSON format.\n Main modules are excluded; only dependencies are returned.\n\n Unlike `go list -m all`, this function excludes modules that are only\n required for running tests.\n '
go_list_args... | -277,839,500,052,257,000 | read_go_deps returns a list of module dependencies in JSON format.
Main modules are excluded; only dependencies are returned.
Unlike `go list -m all`, this function excludes modules that are only
required for running tests. | script/generate_notice.py | read_go_deps | cyrille-leclerc/apm-server | python | def read_go_deps(main_packages, build_tags):
'\n read_go_deps returns a list of module dependencies in JSON format.\n Main modules are excluded; only dependencies are returned.\n\n Unlike `go list -m all`, this function excludes modules that are only\n required for running tests.\n '
go_list_args... |
def get_service(hass, config, discovery_info=None):
'Get the Facebook notification service.'
return FacebookNotificationService(config[CONF_PAGE_ACCESS_TOKEN]) | -8,924,997,349,872,512,000 | Get the Facebook notification service. | homeassistant/components/notify/facebook.py | get_service | Anthonymcqueen21/home-assistant | python | def get_service(hass, config, discovery_info=None):
return FacebookNotificationService(config[CONF_PAGE_ACCESS_TOKEN]) |
def __init__(self, access_token):
'Initialize the service.'
self.page_access_token = access_token | 5,738,748,362,617,202,000 | Initialize the service. | homeassistant/components/notify/facebook.py | __init__ | Anthonymcqueen21/home-assistant | python | def __init__(self, access_token):
self.page_access_token = access_token |
def send_message(self, message='', **kwargs):
'Send some message.'
payload = {'access_token': self.page_access_token}
targets = kwargs.get(ATTR_TARGET)
data = kwargs.get(ATTR_DATA)
body_message = {'text': message}
if (data is not None):
body_message.update(data)
if ('attachment' ... | 1,549,348,951,645,210,600 | Send some message. | homeassistant/components/notify/facebook.py | send_message | Anthonymcqueen21/home-assistant | python | def send_message(self, message=, **kwargs):
payload = {'access_token': self.page_access_token}
targets = kwargs.get(ATTR_TARGET)
data = kwargs.get(ATTR_DATA)
body_message = {'text': message}
if (data is not None):
body_message.update(data)
if ('attachment' in body_message):
... |
def test_ppv():
'Verifies correctness of the PPV calculation'
nose.tools.eq_(ppv([1], [1]), 1.0)
nose.tools.eq_(ppv([1, 1], [1, 0]), 1.0)
nose.tools.eq_(ppv([1, 0, 0, 1], [1, 1, 1, 1]), 0.5)
nose.tools.eq_(ppv([1, 0, 0, 1], [0, 1, 1, 0]), 0.0)
nose.tools.eq_(ppv([1, 0, 0, 1], [1, 1, 0, 1]), (2.0... | -8,664,074,173,561,047,000 | Verifies correctness of the PPV calculation | tests/test_metrics.py | test_ppv | MGHComputationalPathology/CalicoML | python | def test_ppv():
nose.tools.eq_(ppv([1], [1]), 1.0)
nose.tools.eq_(ppv([1, 1], [1, 0]), 1.0)
nose.tools.eq_(ppv([1, 0, 0, 1], [1, 1, 1, 1]), 0.5)
nose.tools.eq_(ppv([1, 0, 0, 1], [0, 1, 1, 0]), 0.0)
nose.tools.eq_(ppv([1, 0, 0, 1], [1, 1, 0, 1]), (2.0 / 3))
nose.tools.eq_(ppv([1, 0, 1, 0, 1,... |
def test_npv():
'Verifies correctness of the NPV calculation'
nose.tools.eq_(npv([0], [0]), 1.0)
nose.tools.eq_(npv([0, 0], [0, 1]), 1.0)
nose.tools.eq_(npv([0, 1], [0, 0]), 0.5)
nose.tools.eq_(npv([1, 0, 0, 1], [0, 0, 0, 0]), 0.5)
nose.tools.eq_(npv([1, 0, 0, 1], [0, 1, 1, 0]), 0.0)
nose.to... | 1,187,938,013,456,644,900 | Verifies correctness of the NPV calculation | tests/test_metrics.py | test_npv | MGHComputationalPathology/CalicoML | python | def test_npv():
nose.tools.eq_(npv([0], [0]), 1.0)
nose.tools.eq_(npv([0, 0], [0, 1]), 1.0)
nose.tools.eq_(npv([0, 1], [0, 0]), 0.5)
nose.tools.eq_(npv([1, 0, 0, 1], [0, 0, 0, 0]), 0.5)
nose.tools.eq_(npv([1, 0, 0, 1], [0, 1, 1, 0]), 0.0)
nose.tools.eq_(npv([0, 1, 1, 0], [0, 0, 1, 0]), (2.0... |
def test_roc():
'Tests the ROC class'
def checkme(y_true, y_pred, expected_auc):
'Tests the ROC for a single set of predictions. Mostly sanity checks since all the computation is done\n by scikit, which we assume is correct'
roc = ROC.from_scores(y_true, y_pred)
nose.tools.assert... | 8,086,216,524,832,628,000 | Tests the ROC class | tests/test_metrics.py | test_roc | MGHComputationalPathology/CalicoML | python | def test_roc():
def checkme(y_true, y_pred, expected_auc):
'Tests the ROC for a single set of predictions. Mostly sanity checks since all the computation is done\n by scikit, which we assume is correct'
roc = ROC.from_scores(y_true, y_pred)
nose.tools.assert_almost_equal(roc.auc... |
def test_auc_ci():
"Validates the AUC confidence interval by comparing with R's pROC"
def checkme(y_true, y_pred):
'Test utility'
roc = ROC.from_scores(y_true, y_pred)
print(roc.auc_ci)
np.testing.assert_allclose(roc.auc_ci.estimate, roc.auc, atol=0.01)
proc = importr('p... | 8,535,585,425,928,689,000 | Validates the AUC confidence interval by comparing with R's pROC | tests/test_metrics.py | test_auc_ci | MGHComputationalPathology/CalicoML | python | def test_auc_ci():
def checkme(y_true, y_pred):
'Test utility'
roc = ROC.from_scores(y_true, y_pred)
print(roc.auc_ci)
np.testing.assert_allclose(roc.auc_ci.estimate, roc.auc, atol=0.01)
proc = importr('pROC')
r_ci_obj = proc.ci(proc.roc(FloatVector(y_true), Flo... |
def test_compute_averaged_metrics():
' Tests compute_averaged_metrics function'
y_truth = [0, 1, 2, 0, 1, 2]
scores1 = [[0.7, 0.2, 0.1], [0.1, 0.7, 0.2], [0.2, 0.1, 0.7], [0.8, 0.1, 0.1], [0.1, 0.8, 0.1], [0.1, 0.1, 0.8]]
result1 = compute_averaged_metrics(y_truth, scores1, roc_auc_function)
nose.to... | -7,717,467,559,827,050,000 | Tests compute_averaged_metrics function | tests/test_metrics.py | test_compute_averaged_metrics | MGHComputationalPathology/CalicoML | python | def test_compute_averaged_metrics():
' '
y_truth = [0, 1, 2, 0, 1, 2]
scores1 = [[0.7, 0.2, 0.1], [0.1, 0.7, 0.2], [0.2, 0.1, 0.7], [0.8, 0.1, 0.1], [0.1, 0.8, 0.1], [0.1, 0.1, 0.8]]
result1 = compute_averaged_metrics(y_truth, scores1, roc_auc_function)
nose.tools.assert_almost_equal(1.0, result1, d... |
def test_pearson():
' Validate pearson correlation'
X = np.asarray([[1, 2], [(- 2), 8], [3, 5]])
y = np.asarray([(- 1), (- 2), 0])
(rs_pearson, ps_pearson) = f_pearson(X, y)
nose.tools.assert_almost_equal(0.07318639504032803, ps_pearson[0], delta=1e-06)
nose.tools.assert_almost_equal(0.666666666... | 1,935,036,754,687,980,000 | Validate pearson correlation | tests/test_metrics.py | test_pearson | MGHComputationalPathology/CalicoML | python | def test_pearson():
' '
X = np.asarray([[1, 2], [(- 2), 8], [3, 5]])
y = np.asarray([(- 1), (- 2), 0])
(rs_pearson, ps_pearson) = f_pearson(X, y)
nose.tools.assert_almost_equal(0.07318639504032803, ps_pearson[0], delta=1e-06)
nose.tools.assert_almost_equal(0.6666666666666666, ps_pearson[1], delt... |
def test_accuracy_from_confusion_matrix():
' test accuracy computations from confusion matrix '
y_truth = [0, 1, 2, 0, 1, 2]
y_score = [[0.7, 0.2, 0.1], [0.1, 0.7, 0.2], [0.2, 0.1, 0.7], [0.1, 0.8, 0.1], [0.1, 0.8, 0.1], [0.8, 0.1, 0.1]]
y_pred = [0, 1, 2, 1, 1, 0]
computed_confusion_matrix = confus... | 1,542,621,636,828,830,700 | test accuracy computations from confusion matrix | tests/test_metrics.py | test_accuracy_from_confusion_matrix | MGHComputationalPathology/CalicoML | python | def test_accuracy_from_confusion_matrix():
' '
y_truth = [0, 1, 2, 0, 1, 2]
y_score = [[0.7, 0.2, 0.1], [0.1, 0.7, 0.2], [0.2, 0.1, 0.7], [0.1, 0.8, 0.1], [0.1, 0.8, 0.1], [0.8, 0.1, 0.1]]
y_pred = [0, 1, 2, 1, 1, 0]
computed_confusion_matrix = confusion_matrix(y_truth, y_pred)
accuracy = accur... |
def test_conditional_means_selector():
' test ConditionalMeansSelector class '
cms = ConditionalMeansSelector(f_pearson)
test_y = np.asarray([3, 2, 1, 0, 3, 2, 1, 0])
test_x = np.asarray([[0, 3], [5, 2], [9, 1], [13, 0], [0, 3], [5, 2], [9, 1], [13, 0]])
(rs_cond_means, ps_cond_means) = cms.selector... | 5,418,517,911,469,496,000 | test ConditionalMeansSelector class | tests/test_metrics.py | test_conditional_means_selector | MGHComputationalPathology/CalicoML | python | def test_conditional_means_selector():
' '
cms = ConditionalMeansSelector(f_pearson)
test_y = np.asarray([3, 2, 1, 0, 3, 2, 1, 0])
test_x = np.asarray([[0, 3], [5, 2], [9, 1], [13, 0], [0, 3], [5, 2], [9, 1], [13, 0]])
(rs_cond_means, ps_cond_means) = cms.selector_function(test_x, test_y)
nose.... |
def checkme(y_true, y_pred, expected_auc):
'Tests the ROC for a single set of predictions. Mostly sanity checks since all the computation is done\n by scikit, which we assume is correct'
roc = ROC.from_scores(y_true, y_pred)
nose.tools.assert_almost_equal(roc.auc, expected_auc)
nose.tools.ok_(all... | -8,855,786,280,949,161,000 | Tests the ROC for a single set of predictions. Mostly sanity checks since all the computation is done
by scikit, which we assume is correct | tests/test_metrics.py | checkme | MGHComputationalPathology/CalicoML | python | def checkme(y_true, y_pred, expected_auc):
'Tests the ROC for a single set of predictions. Mostly sanity checks since all the computation is done\n by scikit, which we assume is correct'
roc = ROC.from_scores(y_true, y_pred)
nose.tools.assert_almost_equal(roc.auc, expected_auc)
nose.tools.ok_(all... |
def checkme(y_true, y_pred):
'Test utility'
roc = ROC.from_scores(y_true, y_pred)
print(roc.auc_ci)
np.testing.assert_allclose(roc.auc_ci.estimate, roc.auc, atol=0.01)
proc = importr('pROC')
r_ci_obj = proc.ci(proc.roc(FloatVector(y_true), FloatVector(y_pred), ci=True), method='bootstrap')
r... | 8,098,000,074,996,210,000 | Test utility | tests/test_metrics.py | checkme | MGHComputationalPathology/CalicoML | python | def checkme(y_true, y_pred):
roc = ROC.from_scores(y_true, y_pred)
print(roc.auc_ci)
np.testing.assert_allclose(roc.auc_ci.estimate, roc.auc, atol=0.01)
proc = importr('pROC')
r_ci_obj = proc.ci(proc.roc(FloatVector(y_true), FloatVector(y_pred), ci=True), method='bootstrap')
r_ci_dict = dic... |
def request_hook(self, method, path, data, params, **kwargs):
'\n Used by Jira Client to apply the jira-cloud authentication\n '
url_params = dict(parse_qs(urlsplit(path).query))
url_params.update((params or {}))
path = path.split('?')[0]
jwt_payload = {'iss': JIRA_KEY, 'iat': datetime... | 631,998,840,742,974,600 | Used by Jira Client to apply the jira-cloud authentication | src/sentry/integrations/jira/client.py | request_hook | YtvwlD/sentry | python | def request_hook(self, method, path, data, params, **kwargs):
'\n \n '
url_params = dict(parse_qs(urlsplit(path).query))
url_params.update((params or {}))
path = path.split('?')[0]
jwt_payload = {'iss': JIRA_KEY, 'iat': datetime.datetime.utcnow(), 'exp': (datetime.datetime.utcnow() + d... |
def request(self, method, path, data=None, params=None, **kwargs):
'\n Use the request_hook method for our specific style of Jira to\n add authentication data and transform parameters.\n '
request_spec = self.jira_style.request_hook(method, path, data, params, **kwargs)
return self._req... | 3,131,367,285,858,472,400 | Use the request_hook method for our specific style of Jira to
add authentication data and transform parameters. | src/sentry/integrations/jira/client.py | request | YtvwlD/sentry | python | def request(self, method, path, data=None, params=None, **kwargs):
'\n Use the request_hook method for our specific style of Jira to\n add authentication data and transform parameters.\n '
request_spec = self.jira_style.request_hook(method, path, data, params, **kwargs)
return self._req... |
def get_cached(self, url, params=None):
'\n Basic Caching mechanism for Jira metadata which changes infrequently\n '
query = ''
if params:
query = json.dumps(params, sort_keys=True)
key = (self.jira_style.cache_prefix + md5(url, query, self.base_url).hexdigest())
cached_result ... | -6,390,656,553,114,833,000 | Basic Caching mechanism for Jira metadata which changes infrequently | src/sentry/integrations/jira/client.py | get_cached | YtvwlD/sentry | python | def get_cached(self, url, params=None):
'\n \n '
query =
if params:
query = json.dumps(params, sort_keys=True)
key = (self.jira_style.cache_prefix + md5(url, query, self.base_url).hexdigest())
cached_result = cache.get(key)
if (not cached_result):
cached_result = s... |
def make_keras_optimizer_class(cls):
'Constructs a DP Keras optimizer class from an existing one.'
class DPOptimizerClass(cls):
'Differentially private subclass of given class cls.\n\n The class tf.keras.optimizers.Optimizer has two methods to compute\n gradients, `_compute_gradients` and `get_gr... | -3,486,794,200,675,963,400 | Constructs a DP Keras optimizer class from an existing one. | tutorials/dp_optimizer_adp.py | make_keras_optimizer_class | Jerry-li-uw/privacy | python | def make_keras_optimizer_class(cls):
class DPOptimizerClass(cls):
'Differentially private subclass of given class cls.\n\n The class tf.keras.optimizers.Optimizer has two methods to compute\n gradients, `_compute_gradients` and `get_gradients`. The first works\n with eager execution, while th... |
def __init__(self, l2_norm_clip, noise_multiplier, changing_clipping=False, num_microbatches=None, gradient_norm=None, *args, **kwargs):
'Initialize the DPOptimizerClass.\n\n Args:\n l2_norm_clip: Clipping norm (max L2 norm of per microbatch gradients)\n noise_multiplier: Ratio of the standard de... | -7,996,842,349,113,027,000 | Initialize the DPOptimizerClass.
Args:
l2_norm_clip: Clipping norm (max L2 norm of per microbatch gradients)
noise_multiplier: Ratio of the standard deviation to the clipping norm
num_microbatches: The number of microbatches into which each minibatch
is split. | tutorials/dp_optimizer_adp.py | __init__ | Jerry-li-uw/privacy | python | def __init__(self, l2_norm_clip, noise_multiplier, changing_clipping=False, num_microbatches=None, gradient_norm=None, *args, **kwargs):
'Initialize the DPOptimizerClass.\n\n Args:\n l2_norm_clip: Clipping norm (max L2 norm of per microbatch gradients)\n noise_multiplier: Ratio of the standard de... |
def _compute_gradients(self, loss, var_list, grad_loss=None, tape=None):
'DP version of superclass method.'
self._was_dp_gradients_called = True
if ((not callable(loss)) and (tape is None)):
raise ValueError('`tape` is required when a `Tensor` loss is passed.')
tape = (tape if (tape is not None)... | 5,076,299,590,624,403,000 | DP version of superclass method. | tutorials/dp_optimizer_adp.py | _compute_gradients | Jerry-li-uw/privacy | python | def _compute_gradients(self, loss, var_list, grad_loss=None, tape=None):
self._was_dp_gradients_called = True
if ((not callable(loss)) and (tape is None)):
raise ValueError('`tape` is required when a `Tensor` loss is passed.')
tape = (tape if (tape is not None) else tf.GradientTape())
if ca... |
def process_microbatch(i, sample_state):
'Process one microbatch (record) with privacy helper.'
mean_loss = tf.reduce_mean(input_tensor=tf.gather(microbatch_losses, [i]))
grads = tf.gradients(mean_loss, params)
sample_state = self._dp_sum_query.accumulate_record(sample_params, sample_state, grads)
r... | -7,686,618,661,728,659,000 | Process one microbatch (record) with privacy helper. | tutorials/dp_optimizer_adp.py | process_microbatch | Jerry-li-uw/privacy | python | def process_microbatch(i, sample_state):
mean_loss = tf.reduce_mean(input_tensor=tf.gather(microbatch_losses, [i]))
grads = tf.gradients(mean_loss, params)
sample_state = self._dp_sum_query.accumulate_record(sample_params, sample_state, grads)
return sample_state |
def _preprocess_graph(G, weight):
'Compute edge weights and eliminate zero-weight edges.\n '
if G.is_directed():
H = nx.MultiGraph()
H.add_nodes_from(G)
H.add_weighted_edges_from(((u, v, e.get(weight, 1.0)) for (u, v, e) in G.edges(data=True) if (u != v)), weight=weight)
G = H... | -7,964,628,692,638,116,000 | Compute edge weights and eliminate zero-weight edges. | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | _preprocess_graph | AlexKovrigin/facerecognition | python | def _preprocess_graph(G, weight):
'\n '
if G.is_directed():
H = nx.MultiGraph()
H.add_nodes_from(G)
H.add_weighted_edges_from(((u, v, e.get(weight, 1.0)) for (u, v, e) in G.edges(data=True) if (u != v)), weight=weight)
G = H
if (not G.is_multigraph()):
edges = ((u,... |
def _rcm_estimate(G, nodelist):
'Estimate the Fiedler vector using the reverse Cuthill-McKee ordering.\n '
G = G.subgraph(nodelist)
order = reverse_cuthill_mckee_ordering(G)
n = len(nodelist)
index = dict(zip(nodelist, range(n)))
x = ndarray(n, dtype=float)
for (i, u) in enumerate(order):... | 1,117,101,656,544,271,700 | Estimate the Fiedler vector using the reverse Cuthill-McKee ordering. | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | _rcm_estimate | AlexKovrigin/facerecognition | python | def _rcm_estimate(G, nodelist):
'\n '
G = G.subgraph(nodelist)
order = reverse_cuthill_mckee_ordering(G)
n = len(nodelist)
index = dict(zip(nodelist, range(n)))
x = ndarray(n, dtype=float)
for (i, u) in enumerate(order):
x[index[u]] = i
x -= ((n - 1) / 2.0)
return x |
def _tracemin_fiedler(L, X, normalized, tol, method):
"Compute the Fiedler vector of L using the TraceMIN-Fiedler algorithm.\n\n The Fiedler vector of a connected undirected graph is the eigenvector\n corresponding to the second smallest eigenvalue of the Laplacian matrix of\n of the graph. This function s... | -5,370,466,597,142,446,000 | Compute the Fiedler vector of L using the TraceMIN-Fiedler algorithm.
The Fiedler vector of a connected undirected graph is the eigenvector
corresponding to the second smallest eigenvalue of the Laplacian matrix of
of the graph. This function starts with the Laplacian L, not the Graph.
Parameters
----------
L : Lapla... | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | _tracemin_fiedler | AlexKovrigin/facerecognition | python | def _tracemin_fiedler(L, X, normalized, tol, method):
"Compute the Fiedler vector of L using the TraceMIN-Fiedler algorithm.\n\n The Fiedler vector of a connected undirected graph is the eigenvector\n corresponding to the second smallest eigenvalue of the Laplacian matrix of\n of the graph. This function s... |
def _get_fiedler_func(method):
'Return a function that solves the Fiedler eigenvalue problem.\n '
if (method == 'tracemin'):
method = 'tracemin_pcg'
if (method in ('tracemin_pcg', 'tracemin_chol', 'tracemin_lu')):
def find_fiedler(L, x, normalized, tol):
q = (1 if (method == ... | 700,050,216,056,586,100 | Return a function that solves the Fiedler eigenvalue problem. | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | _get_fiedler_func | AlexKovrigin/facerecognition | python | def _get_fiedler_func(method):
'\n '
if (method == 'tracemin'):
method = 'tracemin_pcg'
if (method in ('tracemin_pcg', 'tracemin_chol', 'tracemin_lu')):
def find_fiedler(L, x, normalized, tol):
q = (1 if (method == 'tracemin_pcg') else min(4, (L.shape[0] - 1)))
X ... |
@not_implemented_for('directed')
def algebraic_connectivity(G, weight='weight', normalized=False, tol=1e-08, method='tracemin_pcg'):
"Return the algebraic connectivity of an undirected graph.\n\n The algebraic connectivity of a connected undirected graph is the second\n smallest eigenvalue of its Laplacian ma... | -3,385,227,640,535,646,000 | Return the algebraic connectivity of an undirected graph.
The algebraic connectivity of a connected undirected graph is the second
smallest eigenvalue of its Laplacian matrix.
Parameters
----------
G : NetworkX graph
An undirected graph.
weight : object, optional (default: None)
The data key used to determin... | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | algebraic_connectivity | AlexKovrigin/facerecognition | python | @not_implemented_for('directed')
def algebraic_connectivity(G, weight='weight', normalized=False, tol=1e-08, method='tracemin_pcg'):
"Return the algebraic connectivity of an undirected graph.\n\n The algebraic connectivity of a connected undirected graph is the second\n smallest eigenvalue of its Laplacian ma... |
@not_implemented_for('directed')
def fiedler_vector(G, weight='weight', normalized=False, tol=1e-08, method='tracemin_pcg'):
"Return the Fiedler vector of a connected undirected graph.\n\n The Fiedler vector of a connected undirected graph is the eigenvector\n corresponding to the second smallest eigenvalue o... | 8,916,865,751,598,344,000 | Return the Fiedler vector of a connected undirected graph.
The Fiedler vector of a connected undirected graph is the eigenvector
corresponding to the second smallest eigenvalue of the Laplacian matrix of
of the graph.
Parameters
----------
G : NetworkX graph
An undirected graph.
weight : object, optional (defaul... | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | fiedler_vector | AlexKovrigin/facerecognition | python | @not_implemented_for('directed')
def fiedler_vector(G, weight='weight', normalized=False, tol=1e-08, method='tracemin_pcg'):
"Return the Fiedler vector of a connected undirected graph.\n\n The Fiedler vector of a connected undirected graph is the eigenvector\n corresponding to the second smallest eigenvalue o... |
def spectral_ordering(G, weight='weight', normalized=False, tol=1e-08, method='tracemin_pcg'):
"Compute the spectral_ordering of a graph.\n\n The spectral ordering of a graph is an ordering of its nodes where nodes\n in the same weakly connected components appear contiguous and ordered by\n their correspon... | 8,107,492,088,688,550,000 | Compute the spectral_ordering of a graph.
The spectral ordering of a graph is an ordering of its nodes where nodes
in the same weakly connected components appear contiguous and ordered by
their corresponding elements in the Fiedler vector of the component.
Parameters
----------
G : NetworkX graph
A graph.
weight... | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | spectral_ordering | AlexKovrigin/facerecognition | python | def spectral_ordering(G, weight='weight', normalized=False, tol=1e-08, method='tracemin_pcg'):
"Compute the spectral_ordering of a graph.\n\n The spectral ordering of a graph is an ordering of its nodes where nodes\n in the same weakly connected components appear contiguous and ordered by\n their correspon... |
def project(X):
'Make X orthogonal to the nullspace of L.\n '
X = asarray(X)
for j in range(X.shape[1]):
X[:, j] -= (dot(X[:, j], e) * e) | 7,863,523,705,977,705,000 | Make X orthogonal to the nullspace of L. | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | project | AlexKovrigin/facerecognition | python | def project(X):
'\n '
X = asarray(X)
for j in range(X.shape[1]):
X[:, j] -= (dot(X[:, j], e) * e) |
def project(X):
'Make X orthogonal to the nullspace of L.\n '
X = asarray(X)
for j in range(X.shape[1]):
X[:, j] -= (X[:, j].sum() / n) | -2,174,882,100,608,564,000 | Make X orthogonal to the nullspace of L. | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | project | AlexKovrigin/facerecognition | python | def project(X):
'\n '
X = asarray(X)
for j in range(X.shape[1]):
X[:, j] -= (X[:, j].sum() / n) |
def setup(self):
'\n Setting up test parameters\n '
log.info('Starting the test setup')
super(TestBulkPodAttachPerformance, self).setup()
self.benchmark_name = 'bulk_pod_attach_time'
helpers.pull_images(constants.PERF_IMAGE) | 532,208,516,122,918,100 | Setting up test parameters | tests/e2e/performance/csi_tests/test_bulk_pod_attachtime_performance.py | setup | Sravikaz/ocs-ci | python | def setup(self):
'\n \n '
log.info('Starting the test setup')
super(TestBulkPodAttachPerformance, self).setup()
self.benchmark_name = 'bulk_pod_attach_time'
helpers.pull_images(constants.PERF_IMAGE) |
@pytest.fixture()
def base_setup(self, project_factory, interface_type, storageclass_factory):
'\n A setup phase for the test\n\n Args:\n interface_type: Interface type\n storageclass_factory: A fixture to create everything needed for a storage class\n '
self.interface... | 5,094,464,455,281,032,000 | A setup phase for the test
Args:
interface_type: Interface type
storageclass_factory: A fixture to create everything needed for a storage class | tests/e2e/performance/csi_tests/test_bulk_pod_attachtime_performance.py | base_setup | Sravikaz/ocs-ci | python | @pytest.fixture()
def base_setup(self, project_factory, interface_type, storageclass_factory):
'\n A setup phase for the test\n\n Args:\n interface_type: Interface type\n storageclass_factory: A fixture to create everything needed for a storage class\n '
self.interface... |
@pytest.mark.parametrize(argnames=['interface_type', 'bulk_size'], argvalues=[pytest.param(*[constants.CEPHBLOCKPOOL, 120]), pytest.param(*[constants.CEPHBLOCKPOOL, 240]), pytest.param(*[constants.CEPHFILESYSTEM, 120]), pytest.param(*[constants.CEPHFILESYSTEM, 240])])
@pytest.mark.usefixtures(base_setup.__name__)
@pola... | -3,165,609,193,103,609,300 | Measures pods attachment time in bulk_size bulk
Args:
teardown_factory: A fixture used when we want a new resource that was created during the tests
to be removed in the teardown phase.
bulk_size: Size of the bulk to be tested
Returns: | tests/e2e/performance/csi_tests/test_bulk_pod_attachtime_performance.py | test_bulk_pod_attach_performance | Sravikaz/ocs-ci | python | @pytest.mark.parametrize(argnames=['interface_type', 'bulk_size'], argvalues=[pytest.param(*[constants.CEPHBLOCKPOOL, 120]), pytest.param(*[constants.CEPHBLOCKPOOL, 240]), pytest.param(*[constants.CEPHFILESYSTEM, 120]), pytest.param(*[constants.CEPHFILESYSTEM, 240])])
@pytest.mark.usefixtures(base_setup.__name__)
@pola... |
def test_bulk_pod_attach_results(self):
'\n This is not a test - it is only check that previous test ran and finish as expected\n and reporting the full results (links in the ES) of previous tests (4)\n '
self.number_of_tests = 4
self.results_path = get_full_test_logs_path(cname=self, f... | 7,541,969,266,199,892,000 | This is not a test - it is only check that previous test ran and finish as expected
and reporting the full results (links in the ES) of previous tests (4) | tests/e2e/performance/csi_tests/test_bulk_pod_attachtime_performance.py | test_bulk_pod_attach_results | Sravikaz/ocs-ci | python | def test_bulk_pod_attach_results(self):
'\n This is not a test - it is only check that previous test ran and finish as expected\n and reporting the full results (links in the ES) of previous tests (4)\n '
self.number_of_tests = 4
self.results_path = get_full_test_logs_path(cname=self, f... |
def init_full_results(self, full_results):
'\n Initialize the full results object which will send to the ES server\n\n Args:\n full_results (obj): an empty ResultsAnalyse object\n\n Returns:\n ResultsAnalyse (obj): the input object filled with data\n\n '
for key... | 7,311,891,208,824,734,000 | Initialize the full results object which will send to the ES server
Args:
full_results (obj): an empty ResultsAnalyse object
Returns:
ResultsAnalyse (obj): the input object filled with data | tests/e2e/performance/csi_tests/test_bulk_pod_attachtime_performance.py | init_full_results | Sravikaz/ocs-ci | python | def init_full_results(self, full_results):
'\n Initialize the full results object which will send to the ES server\n\n Args:\n full_results (obj): an empty ResultsAnalyse object\n\n Returns:\n ResultsAnalyse (obj): the input object filled with data\n\n '
for key... |
@pytest.fixture(scope='function', autouse=True)
def reset_loggers():
'Prevent logging handlers from capturing temporary file handles.\n\n For example, a test that uses the `capsys` fixture and calls\n `logging.exception()` will initialize logging with a default handler that\n captures `sys.stderr`. When t... | 4,657,129,917,017,633,000 | Prevent logging handlers from capturing temporary file handles.
For example, a test that uses the `capsys` fixture and calls
`logging.exception()` will initialize logging with a default handler that
captures `sys.stderr`. When the test ends, the file handles will be closed
and `sys.stderr` will be returned to its ori... | tests/conftest.py | reset_loggers | JasperJuergensen/elastalert | python | @pytest.fixture(scope='function', autouse=True)
def reset_loggers():
'Prevent logging handlers from capturing temporary file handles.\n\n For example, a test that uses the `capsys` fixture and calls\n `logging.exception()` will initialize logging with a default handler that\n captures `sys.stderr`. When t... |
@pytest.fixture(scope='function')
def environ():
'py.test fixture to get a fresh mutable environment.'
old_env = os.environ
new_env = dict(list(old_env.items()))
os.environ = new_env
(yield os.environ)
os.environ = old_env | -5,649,586,395,634,223,000 | py.test fixture to get a fresh mutable environment. | tests/conftest.py | environ | JasperJuergensen/elastalert | python | @pytest.fixture(scope='function')
def environ():
old_env = os.environ
new_env = dict(list(old_env.items()))
os.environ = new_env
(yield os.environ)
os.environ = old_env |
def remove_prefix(val: str, prefix: str) -> str:
'This function removes a prefix from a string.\n\n Note this is a built-in function in Python 3.9 once we upgrade to it we should use it instead.\n '
return (val[len(prefix):] if val.startswith(prefix) else val) | -4,224,620,920,993,406,500 | This function removes a prefix from a string.
Note this is a built-in function in Python 3.9 once we upgrade to it we should use it instead. | cbmgr.py | remove_prefix | b33f/couchbase-cli | python | def remove_prefix(val: str, prefix: str) -> str:
'This function removes a prefix from a string.\n\n Note this is a built-in function in Python 3.9 once we upgrade to it we should use it instead.\n '
return (val[len(prefix):] if val.startswith(prefix) else val) |
def rest_initialiser(cluster_init_check=False, version_check=False, enterprise_check=None):
'rest_initialiser is a decorator that does common subcommand tasks.\n\n The decorator will always creates a cluster manager and assign it to the subcommand variable rest\n :param cluster_init_check: if true it will che... | 6,277,477,557,780,287,000 | rest_initialiser is a decorator that does common subcommand tasks.
The decorator will always creates a cluster manager and assign it to the subcommand variable rest
:param cluster_init_check: if true it will check if the cluster is initialized before executing the subcommand
:param version_check: if true it will check... | cbmgr.py | rest_initialiser | b33f/couchbase-cli | python | def rest_initialiser(cluster_init_check=False, version_check=False, enterprise_check=None):
'rest_initialiser is a decorator that does common subcommand tasks.\n\n The decorator will always creates a cluster manager and assign it to the subcommand variable rest\n :param cluster_init_check: if true it will che... |
def index_storage_mode_to_param(value, default='plasma'):
'Converts the index storage mode to what Couchbase understands'
if (value == 'default'):
return default
if (value == 'memopt'):
return 'memory_optimized'
return value | 5,129,255,220,943,172,000 | Converts the index storage mode to what Couchbase understands | cbmgr.py | index_storage_mode_to_param | b33f/couchbase-cli | python | def index_storage_mode_to_param(value, default='plasma'):
if (value == 'default'):
return default
if (value == 'memopt'):
return 'memory_optimized'
return value |
def process_services(services, enterprise):
'Converts services to a format Couchbase understands'
sep = ','
if (services.find(sep) < 0):
sep = ';'
svc_set = set([w.strip() for w in services.split(sep)])
svc_candidate = ['data', 'index', 'query', 'fts', 'eventing', 'analytics', 'backup']
... | 4,243,807,396,608,450,600 | Converts services to a format Couchbase understands | cbmgr.py | process_services | b33f/couchbase-cli | python | def process_services(services, enterprise):
sep = ','
if (services.find(sep) < 0):
sep = ';'
svc_set = set([w.strip() for w in services.split(sep)])
svc_candidate = ['data', 'index', 'query', 'fts', 'eventing', 'analytics', 'backup']
for svc in svc_set:
if (svc not in svc_candid... |
def find_subcommands():
'Finds all subcommand classes'
clsmembers = inspect.getmembers(sys.modules[__name__], inspect.isclass)
subclasses = [cls for cls in clsmembers if (issubclass(cls[1], (Subcommand, LocalSubcommand)) and (cls[1] not in [Subcommand, LocalSubcommand]))]
subcommands = []
for subcla... | 2,693,386,715,100,359,700 | Finds all subcommand classes | cbmgr.py | find_subcommands | b33f/couchbase-cli | python | def find_subcommands():
clsmembers = inspect.getmembers(sys.modules[__name__], inspect.isclass)
subclasses = [cls for cls in clsmembers if (issubclass(cls[1], (Subcommand, LocalSubcommand)) and (cls[1] not in [Subcommand, LocalSubcommand]))]
subcommands = []
for subclass in subclasses:
name... |
def apply_default_port(nodes):
'\n Adds the default port if the port is missing.\n\n @type nodes: string\n @param nodes: A comma seprated list of nodes\n @rtype: array of strings\n @return: The nodes with the port postfixed on each one\n '
nodes = nodes.split(',')
def append_p... | -1,273,594,236,596,573,200 | Adds the default port if the port is missing.
@type nodes: string
@param nodes: A comma seprated list of nodes
@rtype: array of strings
@return: The nodes with the port postfixed on each one | cbmgr.py | apply_default_port | b33f/couchbase-cli | python | def apply_default_port(nodes):
'\n Adds the default port if the port is missing.\n\n @type nodes: string\n @param nodes: A comma seprated list of nodes\n @rtype: array of strings\n @return: The nodes with the port postfixed on each one\n '
nodes = nodes.split(',')
def append_p... |
def parse(self, args):
'Parses the subcommand'
if (len(args) == 0):
self.short_help()
return self.parser.parse_args(args) | 8,049,019,916,786,133,000 | Parses the subcommand | cbmgr.py | parse | b33f/couchbase-cli | python | def parse(self, args):
if (len(args) == 0):
self.short_help()
return self.parser.parse_args(args) |
def short_help(self, code=0):
'Prints the short help message and exits'
self.parser.print_help()
self.parser.exit(code) | -3,749,013,151,046,599,700 | Prints the short help message and exits | cbmgr.py | short_help | b33f/couchbase-cli | python | def short_help(self, code=0):
self.parser.print_help()
self.parser.exit(code) |
def execute(self, opts):
'Executes the subcommand'
raise NotImplementedError | 3,123,175,722,342,094,300 | Executes the subcommand | cbmgr.py | execute | b33f/couchbase-cli | python | def execute(self, opts):
raise NotImplementedError |
@staticmethod
def get_man_page_name():
'Returns the man page name'
raise NotImplementedError | 1,340,514,292,959,518,200 | Returns the man page name | cbmgr.py | get_man_page_name | b33f/couchbase-cli | python | @staticmethod
def get_man_page_name():
raise NotImplementedError |
@staticmethod
def get_description():
'Returns the command description'
raise NotImplementedError | -9,053,620,187,950,240,000 | Returns the command description | cbmgr.py | get_description | b33f/couchbase-cli | python | @staticmethod
def get_description():
raise NotImplementedError |
@staticmethod
def get_man_page_name():
'Returns the man page name'
return (('couchbase-cli' + '.1') if (os.name != 'nt') else '.html') | 7,705,955,945,054,665,000 | Returns the man page name | cbmgr.py | get_man_page_name | b33f/couchbase-cli | python | @staticmethod
def get_man_page_name():
return (('couchbase-cli' + '.1') if (os.name != 'nt') else '.html') |
@staticmethod
def is_hidden():
'Whether or not the subcommand should be hidden from the help message'
return False | 7,354,332,169,593,689,000 | Whether or not the subcommand should be hidden from the help message | cbmgr.py | is_hidden | b33f/couchbase-cli | python | @staticmethod
def is_hidden():
return False |
@staticmethod
def is_hidden():
'Whether or not the subcommand should be hidden from the help message'
return False | 7,354,332,169,593,689,000 | Whether or not the subcommand should be hidden from the help message | cbmgr.py | is_hidden | b33f/couchbase-cli | python | @staticmethod
def is_hidden():
return False |
def __init__(self, subparser):
'setup the parser'
self.rest = None
repository_parser = subparser.add_parser('repository', help='Manage backup repositories', add_help=False, allow_abbrev=False)
action_group = repository_parser.add_mutually_exclusive_group(required=True)
action_group.add_argument('--l... | 3,225,793,807,027,137,000 | setup the parser | cbmgr.py | __init__ | b33f/couchbase-cli | python | def __init__(self, subparser):
self.rest = None
repository_parser = subparser.add_parser('repository', help='Manage backup repositories', add_help=False, allow_abbrev=False)
action_group = repository_parser.add_mutually_exclusive_group(required=True)
action_group.add_argument('--list', action='stor... |
@rest_initialiser(version_check=True, enterprise_check=True, cluster_init_check=True)
def execute(self, opts):
'Run the backup-service repository subcommand'
if opts.list:
self.list_repositories(opts.state, (opts.output == 'json'))
elif opts.get:
self.get_repository(opts.id, opts.state, (opt... | -1,515,356,174,697,526,300 | Run the backup-service repository subcommand | cbmgr.py | execute | b33f/couchbase-cli | python | @rest_initialiser(version_check=True, enterprise_check=True, cluster_init_check=True)
def execute(self, opts):
if opts.list:
self.list_repositories(opts.state, (opts.output == 'json'))
elif opts.get:
self.get_repository(opts.id, opts.state, (opts.output == 'json'))
elif opts.archive:
... |
def remove_repository(self, repository_id: str, state: str, delete_repo: bool=False):
"Removes the repository in state 'state' and with id 'repository_id'\n Args:\n repository_id (str): The repository id\n state (str): It must be either archived or imported otherwise it will return an e... | 5,525,413,171,259,426,000 | Removes the repository in state 'state' and with id 'repository_id'
Args:
repository_id (str): The repository id
state (str): It must be either archived or imported otherwise it will return an error
delete_repo (bool): Whether or not the backup repository should be deleted | cbmgr.py | remove_repository | b33f/couchbase-cli | python | def remove_repository(self, repository_id: str, state: str, delete_repo: bool=False):
"Removes the repository in state 'state' and with id 'repository_id'\n Args:\n repository_id (str): The repository id\n state (str): It must be either archived or imported otherwise it will return an e... |
def add_active_repository(self, repository_id: str, plan: str, archive: str, **kwargs):
"Adds a new active repository identified by 'repository_id' and that uses 'plan' as base.\n\n Args:\n repository_id (str): The ID to give to the repository. This must be unique, if it is not an error will be\n ... | -722,556,864,150,031,100 | Adds a new active repository identified by 'repository_id' and that uses 'plan' as base.
Args:
repository_id (str): The ID to give to the repository. This must be unique, if it is not an error will be
returned.
plan (str): The name of the plan to use as base for the repository. If it does not exist the... | cbmgr.py | add_active_repository | b33f/couchbase-cli | python | def add_active_repository(self, repository_id: str, plan: str, archive: str, **kwargs):
"Adds a new active repository identified by 'repository_id' and that uses 'plan' as base.\n\n Args:\n repository_id (str): The ID to give to the repository. This must be unique, if it is not an error will be\n ... |
@staticmethod
def check_cloud_params(archive: str, **kwargs) -> Optional[List[str]]:
'Checks that inside kwargs there is a valid set of parameters to add a cloud repository\n Args:\n archive (str): The archive to use for the repository.\n '
if (not archive.startswith('s3://')):
... | 2,361,866,333,037,891,000 | Checks that inside kwargs there is a valid set of parameters to add a cloud repository
Args:
archive (str): The archive to use for the repository. | cbmgr.py | check_cloud_params | b33f/couchbase-cli | python | @staticmethod
def check_cloud_params(archive: str, **kwargs) -> Optional[List[str]]:
'Checks that inside kwargs there is a valid set of parameters to add a cloud repository\n Args:\n archive (str): The archive to use for the repository.\n '
if (not archive.startswith('s3://')):
... |
def archive_repository(self, repository_id, new_id):
'Archive an repository. The archived repository will have the id `new_id`\n\n Args:\n repository_id (str): The active repository ID to be archived\n new_id (str): The id that will be given to the archived repository\n '
if ... | -480,300,558,992,815,900 | Archive an repository. The archived repository will have the id `new_id`
Args:
repository_id (str): The active repository ID to be archived
new_id (str): The id that will be given to the archived repository | cbmgr.py | archive_repository | b33f/couchbase-cli | python | def archive_repository(self, repository_id, new_id):
'Archive an repository. The archived repository will have the id `new_id`\n\n Args:\n repository_id (str): The active repository ID to be archived\n new_id (str): The id that will be given to the archived repository\n '
if ... |
def list_repositories(self, state=None, json_out=False):
"List the backup repositories.\n\n If a repository state is given only repositories in that state will be listed. This command supports listing both in\n json and human friendly format.\n\n Args:\n state (str, optional): One of... | 4,899,242,005,880,844,000 | List the backup repositories.
If a repository state is given only repositories in that state will be listed. This command supports listing both in
json and human friendly format.
Args:
state (str, optional): One of ['active', 'imported', 'archived']. The repository on this state will be
retrieved.
jso... | cbmgr.py | list_repositories | b33f/couchbase-cli | python | def list_repositories(self, state=None, json_out=False):
"List the backup repositories.\n\n If a repository state is given only repositories in that state will be listed. This command supports listing both in\n json and human friendly format.\n\n Args:\n state (str, optional): One of... |
def get_repository(self, repository_id, state, json_out=False):
'Retrieves one repository from the backup service\n\n If the repository does not exist an error will be returned\n\n Args:\n repository_id (str): The repository id to be retrieved\n state (str): The state of the repo... | -1,288,550,630,235,059,200 | Retrieves one repository from the backup service
If the repository does not exist an error will be returned
Args:
repository_id (str): The repository id to be retrieved
state (str): The state of the repository to retrieve
json_out (bool): If True the output will be JSON otherwise it will be a human friend... | cbmgr.py | get_repository | b33f/couchbase-cli | python | def get_repository(self, repository_id, state, json_out=False):
'Retrieves one repository from the backup service\n\n If the repository does not exist an error will be returned\n\n Args:\n repository_id (str): The repository id to be retrieved\n state (str): The state of the repo... |
@staticmethod
def human_firendly_print_repository(repository):
'Print the repository in a human friendly format\n\n Args:\n repository (obj): The backup repository information\n '
print(f"ID: {repository['id']}")
print(f"State: {repository['state']}")
print(f"Healthy: {(not (('h... | -6,050,599,214,953,128,000 | Print the repository in a human friendly format
Args:
repository (obj): The backup repository information | cbmgr.py | human_firendly_print_repository | b33f/couchbase-cli | python | @staticmethod
def human_firendly_print_repository(repository):
'Print the repository in a human friendly format\n\n Args:\n repository (obj): The backup repository information\n '
print(f"ID: {repository['id']}")
print(f"State: {repository['state']}")
print(f"Healthy: {(not (('h... |
@staticmethod
def human_friendly_print_running_tasks(one_off, scheduled):
'Prints the running task summary in a human friendly way\n\n Args:\n one_off (map<str, task object>): Running one off tasks\n scheduled (map<str, task object>): Running scheduled tasks\n '
all_vals = []... | -7,640,512,187,726,037,000 | Prints the running task summary in a human friendly way
Args:
one_off (map<str, task object>): Running one off tasks
scheduled (map<str, task object>): Running scheduled tasks | cbmgr.py | human_friendly_print_running_tasks | b33f/couchbase-cli | python | @staticmethod
def human_friendly_print_running_tasks(one_off, scheduled):
'Prints the running task summary in a human friendly way\n\n Args:\n one_off (map<str, task object>): Running one off tasks\n scheduled (map<str, task object>): Running scheduled tasks\n '
all_vals = []... |
@staticmethod
def human_firendly_print_repository_scheduled_tasks(scheduled):
'Print the scheduled task in a tabular format'
name_pad = 5
for name in scheduled:
if (len(name) > name_pad):
name_pad = len(name)
name_pad += 1
header = f"{'Name':<{name_pad}}| Task type | Next run"
... | 6,615,798,119,820,247,000 | Print the scheduled task in a tabular format | cbmgr.py | human_firendly_print_repository_scheduled_tasks | b33f/couchbase-cli | python | @staticmethod
def human_firendly_print_repository_scheduled_tasks(scheduled):
name_pad = 5
for name in scheduled:
if (len(name) > name_pad):
name_pad = len(name)
name_pad += 1
header = f"{'Name':<{name_pad}}| Task type | Next run"
print('Scheduled tasks:')
print(header)
... |
@staticmethod
def human_friendly_print_repositories(repositories_map):
'This will print the repositories in a tabular format\n\n Args:\n repository_map (map<state (str), repository (list of objects)>)\n '
repository_count = 0
id_pad = 5
plan_pad = 7
for repositories in repos... | -8,155,784,159,145,587,000 | This will print the repositories in a tabular format
Args:
repository_map (map<state (str), repository (list of objects)>) | cbmgr.py | human_friendly_print_repositories | b33f/couchbase-cli | python | @staticmethod
def human_friendly_print_repositories(repositories_map):
'This will print the repositories in a tabular format\n\n Args:\n repository_map (map<state (str), repository (list of objects)>)\n '
repository_count = 0
id_pad = 5
plan_pad = 7
for repositories in repos... |
def __init__(self, subparser):
'setup the parser'
self.rest = None
plan_parser = subparser.add_parser('plan', help='Manage backup plans', add_help=False, allow_abbrev=False)
action_group = plan_parser.add_mutually_exclusive_group(required=True)
action_group.add_argument('--list', action='store_true'... | 7,797,398,368,704,295,000 | setup the parser | cbmgr.py | __init__ | b33f/couchbase-cli | python | def __init__(self, subparser):
self.rest = None
plan_parser = subparser.add_parser('plan', help='Manage backup plans', add_help=False, allow_abbrev=False)
action_group = plan_parser.add_mutually_exclusive_group(required=True)
action_group.add_argument('--list', action='store_true', help='List all a... |
@rest_initialiser(version_check=True, enterprise_check=True, cluster_init_check=True)
def execute(self, opts):
'Run the backup plan managment command'
if opts.list:
self.list_plans((opts.output == 'json'))
elif opts.get:
self.get_plan(opts.name, (opts.output == 'json'))
elif opts.remove:... | 6,970,312,617,960,120,000 | Run the backup plan managment command | cbmgr.py | execute | b33f/couchbase-cli | python | @rest_initialiser(version_check=True, enterprise_check=True, cluster_init_check=True)
def execute(self, opts):
if opts.list:
self.list_plans((opts.output == 'json'))
elif opts.get:
self.get_plan(opts.name, (opts.output == 'json'))
elif opts.remove:
self.remove_plan(opts.name)
... |
def add_plan(self, name: str, services: Optional[str], tasks: Optional[List[str]], description: Optional[str]):
'Add a new backup plan\n\n The validation of the inputs in the CLI is intentionally lacking as this is offloaded to the backup service.\n Args:\n name (str): The name to give the ... | -9,096,600,411,109,224,000 | Add a new backup plan
The validation of the inputs in the CLI is intentionally lacking as this is offloaded to the backup service.
Args:
name (str): The name to give the new plan. It must be unique.
services (optional list): A list of services to backup if empty all services are backed up.
tasks (optional ... | cbmgr.py | add_plan | b33f/couchbase-cli | python | def add_plan(self, name: str, services: Optional[str], tasks: Optional[List[str]], description: Optional[str]):
'Add a new backup plan\n\n The validation of the inputs in the CLI is intentionally lacking as this is offloaded to the backup service.\n Args:\n name (str): The name to give the ... |
def remove_plan(self, name: str):
'Removes a plan by name'
if (not name):
_exit_if_errors(['--name is required'])
(_, errors) = self.rest.delete_backup_plan(name)
_exit_if_errors(errors)
_success('Plan removed') | 3,467,677,332,179,611,600 | Removes a plan by name | cbmgr.py | remove_plan | b33f/couchbase-cli | python | def remove_plan(self, name: str):
if (not name):
_exit_if_errors(['--name is required'])
(_, errors) = self.rest.delete_backup_plan(name)
_exit_if_errors(errors)
_success('Plan removed') |
def get_plan(self, name: str, json_output: bool=False):
'Gets a backup plan by name\n\n Args:\n name (str): The name of the plan to retrieve\n json_output (bool): Whether to print in JSON or a more human friendly way\n '
if (not name):
_exit_if_errors(['--name is requ... | 411,347,194,790,967,360 | Gets a backup plan by name
Args:
name (str): The name of the plan to retrieve
json_output (bool): Whether to print in JSON or a more human friendly way | cbmgr.py | get_plan | b33f/couchbase-cli | python | def get_plan(self, name: str, json_output: bool=False):
'Gets a backup plan by name\n\n Args:\n name (str): The name of the plan to retrieve\n json_output (bool): Whether to print in JSON or a more human friendly way\n '
if (not name):
_exit_if_errors(['--name is requ... |
def list_plans(self, json_output: bool=False):
'Prints all the plans stored in the backup service\n\n Args:\n json_output (bool): Whether to print in JSON or a more human friendly way\n '
(plans, errors) = self.rest.list_backup_plans()
_exit_if_errors(errors)
if json_output:
... | -8,035,865,599,006,419,000 | Prints all the plans stored in the backup service
Args:
json_output (bool): Whether to print in JSON or a more human friendly way | cbmgr.py | list_plans | b33f/couchbase-cli | python | def list_plans(self, json_output: bool=False):
'Prints all the plans stored in the backup service\n\n Args:\n json_output (bool): Whether to print in JSON or a more human friendly way\n '
(plans, errors) = self.rest.list_backup_plans()
_exit_if_errors(errors)
if json_output:
... |
@staticmethod
def human_print_plan(plan: object):
'Prints the plan in a human friendly way'
print(f"Name: {plan['name']}")
print(f"Description: {(plan['description'] if ('description' in plan) else 'N/A')}")
print(f"Services: {BackupServicePlan.service_list_to_str(plan['services'])}")
print(f"Defaul... | 4,812,293,286,272,715,000 | Prints the plan in a human friendly way | cbmgr.py | human_print_plan | b33f/couchbase-cli | python | @staticmethod
def human_print_plan(plan: object):
print(f"Name: {plan['name']}")
print(f"Description: {(plan['description'] if ('description' in plan) else 'N/A')}")
print(f"Services: {BackupServicePlan.service_list_to_str(plan['services'])}")
print(f"Default: {(plan['default'] if ('deafult' in pla... |
@staticmethod
def format_options(task: object) -> str:
'Format the full backup or merge options'
options = 'N/A'
if ((task['task_type'] == 'BACKUP') and task['full_backup']):
options = 'Full backup'
elif (task['task_type'] == 'MERGE'):
if ('merge_options' in task):
options = ... | -8,492,650,752,532,442,000 | Format the full backup or merge options | cbmgr.py | format_options | b33f/couchbase-cli | python | @staticmethod
def format_options(task: object) -> str:
options = 'N/A'
if ((task['task_type'] == 'BACKUP') and task['full_backup']):
options = 'Full backup'
elif (task['task_type'] == 'MERGE'):
if ('merge_options' in task):
options = f"Merge from {task['merge_options']['offs... |
@staticmethod
def format_schedule(schedule: object) -> str:
'Format the schedule object in a string of the format <task> every <frequency>? <period> (at <time>)?'
task_start = f"{schedule['job_type'].lower()}"
frequency_part = 'every'
if (schedule['frequency'] == 1):
period = schedule['period'].... | 7,484,876,531,967,456,000 | Format the schedule object in a string of the format <task> every <frequency>? <period> (at <time>)? | cbmgr.py | format_schedule | b33f/couchbase-cli | python | @staticmethod
def format_schedule(schedule: object) -> str:
task_start = f"{schedule['job_type'].lower()}"
frequency_part = 'every'
if (schedule['frequency'] == 1):
period = schedule['period'].lower()
period = (period if (period[(- 1)] != 's') else period[:(- 1)])
frequency_part... |
@staticmethod
def human_print_plans(plans: List[Any]):
'Prints a table with an overview of each plan'
if (not plans):
print('No plans')
return
name_pad = 5
service_pad = 8
for plan in plans:
if (len(plan['name']) > name_pad):
name_pad = len(plan['name'])
s... | 5,685,385,219,044,567,000 | Prints a table with an overview of each plan | cbmgr.py | human_print_plans | b33f/couchbase-cli | python | @staticmethod
def human_print_plans(plans: List[Any]):
if (not plans):
print('No plans')
return
name_pad = 5
service_pad = 8
for plan in plans:
if (len(plan['name']) > name_pad):
name_pad = len(plan['name'])
services_str = BackupServicePlan.service_list_t... |
@staticmethod
def service_list_to_str(services: Optional[List[Any]]) -> str:
'convert the list of services to a concise list of services'
if (not services):
return 'all'
convert = {'gsi': 'Indexing', 'cbas': 'Analytics', 'ft': 'Full Text Search'}
return ', '.join([(convert[service] if (service i... | -5,899,828,531,706,344,000 | convert the list of services to a concise list of services | cbmgr.py | service_list_to_str | b33f/couchbase-cli | python | @staticmethod
def service_list_to_str(services: Optional[List[Any]]) -> str:
if (not services):
return 'all'
convert = {'gsi': 'Indexing', 'cbas': 'Analytics', 'ft': 'Full Text Search'}
return ', '.join([(convert[service] if (service in convert) else service.title()) for service in services]) |
def build_evaluator_list(base_ds, dataset_name):
'Helper function to build the list of evaluators for a given dataset'
evaluator_list = []
if args.no_detection:
return evaluator_list
iou_types = ['bbox']
if args.masks:
iou_types.append('segm')
evaluator_list.append(CocoEvaluator(... | -2,649,098,745,732,784,000 | Helper function to build the list of evaluators for a given dataset | main.py | build_evaluator_list | TopCoder2K/mdetr | python | def build_evaluator_list(base_ds, dataset_name):
evaluator_list = []
if args.no_detection:
return evaluator_list
iou_types = ['bbox']
if args.masks:
iou_types.append('segm')
evaluator_list.append(CocoEvaluator(base_ds, tuple(iou_types), useCats=False))
if ('refexp' in datase... |
def time_nifti_to_numpy(N_TRIALS):
'\n Times how fast a framework can read a nifti file and convert it to numpy\n '
datadir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data')
img_paths = []
for dtype in ['CHAR', 'DOUBLE', 'FLOAT', 'SHORT', 'UNSIGNEDCHAR', 'UNSIGNEDSHORT']:
... | -2,848,315,200,530,991,600 | Times how fast a framework can read a nifti file and convert it to numpy | tests/timings.py | time_nifti_to_numpy | ncullen93/ANTsPy | python | def time_nifti_to_numpy(N_TRIALS):
'\n \n '
datadir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data')
img_paths = []
for dtype in ['CHAR', 'DOUBLE', 'FLOAT', 'SHORT', 'UNSIGNEDCHAR', 'UNSIGNEDSHORT']:
for dim in [2, 3]:
img_paths.append(os.path.join(datadir, (... |
def ElusimicrobiaBacteriumRifoxyc2Full3412(directed: bool=False, preprocess: bool=True, load_nodes: bool=True, verbose: int=2, cache: bool=True, cache_path: str='graphs/string', version: str='links.v11.5', **additional_graph_kwargs: Dict) -> Graph:
'Return new instance of the Elusimicrobia bacterium RIFOXYC2_FULL_3... | -3,087,674,889,159,628,300 | Return new instance of the Elusimicrobia bacterium RIFOXYC2_FULL_34_12 graph.
The graph is automatically retrieved from the STRING repository.
Parameters
-------------------
directed: bool = False
Wether to load the graph as directed or undirected.
By default false.
preprocess: bool = True
Whether to ... | bindings/python/ensmallen/datasets/string/elusimicrobiabacteriumrifoxyc2full3412.py | ElusimicrobiaBacteriumRifoxyc2Full3412 | AnacletoLAB/ensmallen | python | def ElusimicrobiaBacteriumRifoxyc2Full3412(directed: bool=False, preprocess: bool=True, load_nodes: bool=True, verbose: int=2, cache: bool=True, cache_path: str='graphs/string', version: str='links.v11.5', **additional_graph_kwargs: Dict) -> Graph:
'Return new instance of the Elusimicrobia bacterium RIFOXYC2_FULL_3... |
def __init__(__self__, *, group_id: pulumi.Input[str], users: pulumi.Input[Sequence[pulumi.Input[str]]]):
'\n The set of arguments for constructing a GroupMemberships resource.\n :param pulumi.Input[str] group_id: ID of a Okta group.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] users: The... | -5,059,611,389,573,100,000 | The set of arguments for constructing a GroupMemberships resource.
:param pulumi.Input[str] group_id: ID of a Okta group.
:param pulumi.Input[Sequence[pulumi.Input[str]]] users: The list of Okta user IDs which the group should have membership managed for. | sdk/python/pulumi_okta/group_memberships.py | __init__ | pulumi/pulumi-okta | python | def __init__(__self__, *, group_id: pulumi.Input[str], users: pulumi.Input[Sequence[pulumi.Input[str]]]):
'\n The set of arguments for constructing a GroupMemberships resource.\n :param pulumi.Input[str] group_id: ID of a Okta group.\n :param pulumi.Input[Sequence[pulumi.Input[str]]] users: The... |
@property
@pulumi.getter(name='groupId')
def group_id(self) -> pulumi.Input[str]:
'\n ID of a Okta group.\n '
return pulumi.get(self, 'group_id') | -9,015,551,660,011,583,000 | ID of a Okta group. | sdk/python/pulumi_okta/group_memberships.py | group_id | pulumi/pulumi-okta | python | @property
@pulumi.getter(name='groupId')
def group_id(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'group_id') |
@property
@pulumi.getter
def users(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
'\n The list of Okta user IDs which the group should have membership managed for.\n '
return pulumi.get(self, 'users') | 1,672,975,142,781,222,700 | The list of Okta user IDs which the group should have membership managed for. | sdk/python/pulumi_okta/group_memberships.py | users | pulumi/pulumi-okta | python | @property
@pulumi.getter
def users(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
'\n \n '
return pulumi.get(self, 'users') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.