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 weight_variable(shape):
'weight_variable generates a weight variable of a given shape.'
initial = tf.truncated_normal(shape, stddev=(0.1 / math.sqrt(float(hiddenlayer_units))))
return tf.Variable(initial) | -722,179,264,155,899,100 | weight_variable generates a weight variable of a given shape. | FSL - Entire Project + Report/Final Project/Code/Exp1.py | weight_variable | AdityaPrasadMishra/TensorflowPractice | python | def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=(0.1 / math.sqrt(float(hiddenlayer_units))))
return tf.Variable(initial) |
def bias_variable(shape):
'bias_variable generates a bias variable of a given shape.'
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial) | 4,559,501,419,305,478,000 | bias_variable generates a bias variable of a given shape. | FSL - Entire Project + Report/Final Project/Code/Exp1.py | bias_variable | AdityaPrasadMishra/TensorflowPractice | python | def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial) |
def test_update_rules(self):
"Just make sure it doesn't crash"
self.map.update_rules(1, []) | 3,621,848,459,840,140,300 | Just make sure it doesn't crash | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | test_update_rules | mmidolesov2/neutron | python | def test_update_rules(self):
self.map.update_rules(1, []) |
def test_update_members(self):
"Just make sure we doesn't crash"
self.map.update_members(1, []) | -8,679,030,213,529,236,000 | Just make sure we doesn't crash | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | test_update_members | mmidolesov2/neutron | python | def test_update_members(self):
self.map.update_members(1, []) |
def test_update_port_filter_applies_added_flows(self):
'Check flows are applied right after _set_flows is called.'
port_dict = {'device': 'port-id', 'security_groups': [1]}
self._prepare_security_group()
self.firewall.prepare_port_filter(port_dict)
with self.firewall.defer_apply():
self.fire... | -1,399,839,882,994,460,200 | Check flows are applied right after _set_flows is called. | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | test_update_port_filter_applies_added_flows | mmidolesov2/neutron | python | def test_update_port_filter_applies_added_flows(self):
port_dict = {'device': 'port-id', 'security_groups': [1]}
self._prepare_security_group()
self.firewall.prepare_port_filter(port_dict)
with self.firewall.defer_apply():
self.firewall.update_port_filter(port_dict)
self.assertEqual(2, ... |
def test_update_security_group_rules(self):
"Just make sure it doesn't crash"
new_rules = [{'ethertype': constants.IPv4, 'direction': firewall.INGRESS_DIRECTION, 'protocol': constants.PROTO_NAME_ICMP}, {'ethertype': constants.IPv4, 'direction': firewall.EGRESS_DIRECTION, 'remote_group_id': 2}]
self.firewall... | 1,945,480,302,246,285,000 | Just make sure it doesn't crash | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | test_update_security_group_rules | mmidolesov2/neutron | python | def test_update_security_group_rules(self):
new_rules = [{'ethertype': constants.IPv4, 'direction': firewall.INGRESS_DIRECTION, 'protocol': constants.PROTO_NAME_ICMP}, {'ethertype': constants.IPv4, 'direction': firewall.EGRESS_DIRECTION, 'remote_group_id': 2}]
self.firewall.update_security_group_rules(1, n... |
def test_update_security_group_members(self):
"Just make sure it doesn't crash"
new_members = {constants.IPv4: [1, 2, 3, 4]}
self.firewall.update_security_group_members(2, new_members) | 4,622,323,072,390,496,000 | Just make sure it doesn't crash | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | test_update_security_group_members | mmidolesov2/neutron | python | def test_update_security_group_members(self):
new_members = {constants.IPv4: [1, 2, 3, 4]}
self.firewall.update_security_group_members(2, new_members) |
def test_process_trusted_ports_port_not_found(self):
'Check that exception is not propagated outside.'
self.mock_bridge.br.get_vif_port_by_id.return_value = None
self.firewall.process_trusted_ports(['port_id'])
self.assertNotIn('port_id', self.firewall.sg_port_map.unfiltered) | -7,640,833,490,315,465,000 | Check that exception is not propagated outside. | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | test_process_trusted_ports_port_not_found | mmidolesov2/neutron | python | def test_process_trusted_ports_port_not_found(self):
self.mock_bridge.br.get_vif_port_by_id.return_value = None
self.firewall.process_trusted_ports(['port_id'])
self.assertNotIn('port_id', self.firewall.sg_port_map.unfiltered) |
def test_remove_trusted_ports_not_managed_port(self):
'Check that exception is not propagated outside.'
self.firewall.remove_trusted_ports(['port_id']) | 1,033,683,824,962,227,200 | Check that exception is not propagated outside. | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | test_remove_trusted_ports_not_managed_port | mmidolesov2/neutron | python | def test_remove_trusted_ports_not_managed_port(self):
self.firewall.remove_trusted_ports(['port_id']) |
def element(self, uri, content, attributes={}):
'Utility method for adding a complete simple element'
self.push(uri)
for (k, v) in attributes.iteritems():
self.attribute(k, v)
self.text(content)
self.pop() | -5,322,985,118,655,762,000 | Utility method for adding a complete simple element | lib/rdflib/plugins/serializers/xmlwriter.py | element | 27theworldinurhand/schemaorg | python | def element(self, uri, content, attributes={}):
self.push(uri)
for (k, v) in attributes.iteritems():
self.attribute(k, v)
self.text(content)
self.pop() |
def qname(self, uri):
'Compute qname for a uri using our extra namespaces,\n or the given namespace manager'
for (pre, ns) in self.extra_ns.items():
if uri.startswith(ns):
if (pre != ''):
return ':'.join(pre, uri[len(ns):])
else:
return uri[... | -4,990,880,594,916,725,000 | Compute qname for a uri using our extra namespaces,
or the given namespace manager | lib/rdflib/plugins/serializers/xmlwriter.py | qname | 27theworldinurhand/schemaorg | python | def qname(self, uri):
'Compute qname for a uri using our extra namespaces,\n or the given namespace manager'
for (pre, ns) in self.extra_ns.items():
if uri.startswith(ns):
if (pre != ):
return ':'.join(pre, uri[len(ns):])
else:
return uri[le... |
def test_logout_auth_user(test_client):
'\n GIVEN a flask app\n WHEN an authorized user logs out\n THEN check that the user was logged out successfully\n '
log_in(test_client)
response = test_client.get('auth/logout', follow_redirects=True)
assert (response.status_code == 200)
assert (b'... | 1,633,005,840,936,243,200 | GIVEN a flask app
WHEN an authorized user logs out
THEN check that the user was logged out successfully | tests/test_auth/test_logout.py | test_logout_auth_user | KGB33/Wedding-Website | python | def test_logout_auth_user(test_client):
'\n GIVEN a flask app\n WHEN an authorized user logs out\n THEN check that the user was logged out successfully\n '
log_in(test_client)
response = test_client.get('auth/logout', follow_redirects=True)
assert (response.status_code == 200)
assert (b'... |
def test_logout_anon_user(test_client):
'\n GIVEN a flask app\n WHEN an anon user attemps to log out\n THEN check that a message flashes informing them that they are already logged out.\n '
response = test_client.get('auth/logout', follow_redirects=True)
assert (response.status_code == 200)
... | 728,286,334,456,950,100 | GIVEN a flask app
WHEN an anon user attemps to log out
THEN check that a message flashes informing them that they are already logged out. | tests/test_auth/test_logout.py | test_logout_anon_user | KGB33/Wedding-Website | python | def test_logout_anon_user(test_client):
'\n GIVEN a flask app\n WHEN an anon user attemps to log out\n THEN check that a message flashes informing them that they are already logged out.\n '
response = test_client.get('auth/logout', follow_redirects=True)
assert (response.status_code == 200)
... |
def demo():
'Output:\n ---------β\n ----------\n ----?????-\n ----------\n ----------\n --!!!-----\n --!!!-----\n ----------\n ----------\n β---------\n '
n = 10
grid = {}
grid[(0, 0)] = 'β'
grid[((n - 1), (n - 1))] = 'β'
fill(grid, '!', start=(2, 3), stop=(5, 5)... | -2,668,569,732,923,006,500 | Output:
---------β
----------
----?????-
----------
----------
--!!!-----
--!!!-----
----------
----------
β--------- | examples/grids/python/grid.py | demo | ssangervasi/examples | python | def demo():
'Output:\n ---------β\n ----------\n ----?????-\n ----------\n ----------\n --!!!-----\n --!!!-----\n ----------\n ----------\n β---------\n '
n = 10
grid = {}
grid[(0, 0)] = 'β'
grid[((n - 1), (n - 1))] = 'β'
fill(grid, '!', start=(2, 3), stop=(5, 5)... |
def fill(grid: dict, value: str, start=(0, 0), stop=(0, 0)):
'Using product allows for flatter loops.'
from itertools import product
for coord in product(range(start[0], stop[0]), range(start[1], stop[1])):
grid[coord] = value | -679,394,345,175,105,200 | Using product allows for flatter loops. | examples/grids/python/grid.py | fill | ssangervasi/examples | python | def fill(grid: dict, value: str, start=(0, 0), stop=(0, 0)):
from itertools import product
for coord in product(range(start[0], stop[0]), range(start[1], stop[1])):
grid[coord] = value |
def stringify(grid: dict, n: int) -> str:
'Stringify with (0, 0) in the lower-left corner.'
rows = []
for y in reversed(range(n)):
row = []
for x in range(n):
value = grid.get((x, y), '-')
row.append(value)
rows.append(row)
return '\n'.join((''.join(row) f... | 2,110,890,005,807,589,400 | Stringify with (0, 0) in the lower-left corner. | examples/grids/python/grid.py | stringify | ssangervasi/examples | python | def stringify(grid: dict, n: int) -> str:
rows = []
for y in reversed(range(n)):
row = []
for x in range(n):
value = grid.get((x, y), '-')
row.append(value)
rows.append(row)
return '\n'.join((.join(row) for row in rows)) |
def __init__(self, ancestor_counts=None, record_set=None, rule=None, rfv=None, n_per=None, top_n=None, limits=None, table_name=None, name=None):
'Selection - a model defined in OpenAPI'
self._ancestor_counts = None
self._record_set = None
self._rule = None
self._rfv = None
self._n_per = None
... | -6,999,714,526,438,198,000 | Selection - a model defined in OpenAPI | apteco_api/models/selection.py | __init__ | Apteco/apteco-api | python | def __init__(self, ancestor_counts=None, record_set=None, rule=None, rfv=None, n_per=None, top_n=None, limits=None, table_name=None, name=None):
self._ancestor_counts = None
self._record_set = None
self._rule = None
self._rfv = None
self._n_per = None
self._top_n = None
self._limits = N... |
@property
def ancestor_counts(self):
'Gets the ancestor_counts of this Selection. # noqa: E501\n\n\n :return: The ancestor_counts of this Selection. # noqa: E501\n :rtype: bool\n '
return self._ancestor_counts | -3,247,776,088,569,675,000 | Gets the ancestor_counts of this Selection. # noqa: E501
:return: The ancestor_counts of this Selection. # noqa: E501
:rtype: bool | apteco_api/models/selection.py | ancestor_counts | Apteco/apteco-api | python | @property
def ancestor_counts(self):
'Gets the ancestor_counts of this Selection. # noqa: E501\n\n\n :return: The ancestor_counts of this Selection. # noqa: E501\n :rtype: bool\n '
return self._ancestor_counts |
@ancestor_counts.setter
def ancestor_counts(self, ancestor_counts):
'Sets the ancestor_counts of this Selection.\n\n\n :param ancestor_counts: The ancestor_counts of this Selection. # noqa: E501\n :type: bool\n '
self._ancestor_counts = ancestor_counts | 4,084,213,159,388,093,400 | Sets the ancestor_counts of this Selection.
:param ancestor_counts: The ancestor_counts of this Selection. # noqa: E501
:type: bool | apteco_api/models/selection.py | ancestor_counts | Apteco/apteco-api | python | @ancestor_counts.setter
def ancestor_counts(self, ancestor_counts):
'Sets the ancestor_counts of this Selection.\n\n\n :param ancestor_counts: The ancestor_counts of this Selection. # noqa: E501\n :type: bool\n '
self._ancestor_counts = ancestor_counts |
@property
def record_set(self):
'Gets the record_set of this Selection. # noqa: E501\n\n\n :return: The record_set of this Selection. # noqa: E501\n :rtype: RecordSet\n '
return self._record_set | -1,940,476,933,900,348,200 | Gets the record_set of this Selection. # noqa: E501
:return: The record_set of this Selection. # noqa: E501
:rtype: RecordSet | apteco_api/models/selection.py | record_set | Apteco/apteco-api | python | @property
def record_set(self):
'Gets the record_set of this Selection. # noqa: E501\n\n\n :return: The record_set of this Selection. # noqa: E501\n :rtype: RecordSet\n '
return self._record_set |
@record_set.setter
def record_set(self, record_set):
'Sets the record_set of this Selection.\n\n\n :param record_set: The record_set of this Selection. # noqa: E501\n :type: RecordSet\n '
self._record_set = record_set | 3,298,788,785,948,843,500 | Sets the record_set of this Selection.
:param record_set: The record_set of this Selection. # noqa: E501
:type: RecordSet | apteco_api/models/selection.py | record_set | Apteco/apteco-api | python | @record_set.setter
def record_set(self, record_set):
'Sets the record_set of this Selection.\n\n\n :param record_set: The record_set of this Selection. # noqa: E501\n :type: RecordSet\n '
self._record_set = record_set |
@property
def rule(self):
'Gets the rule of this Selection. # noqa: E501\n\n\n :return: The rule of this Selection. # noqa: E501\n :rtype: Rule\n '
return self._rule | 7,931,853,896,142,618,000 | Gets the rule of this Selection. # noqa: E501
:return: The rule of this Selection. # noqa: E501
:rtype: Rule | apteco_api/models/selection.py | rule | Apteco/apteco-api | python | @property
def rule(self):
'Gets the rule of this Selection. # noqa: E501\n\n\n :return: The rule of this Selection. # noqa: E501\n :rtype: Rule\n '
return self._rule |
@rule.setter
def rule(self, rule):
'Sets the rule of this Selection.\n\n\n :param rule: The rule of this Selection. # noqa: E501\n :type: Rule\n '
self._rule = rule | 6,730,253,385,272,637,000 | Sets the rule of this Selection.
:param rule: The rule of this Selection. # noqa: E501
:type: Rule | apteco_api/models/selection.py | rule | Apteco/apteco-api | python | @rule.setter
def rule(self, rule):
'Sets the rule of this Selection.\n\n\n :param rule: The rule of this Selection. # noqa: E501\n :type: Rule\n '
self._rule = rule |
@property
def rfv(self):
'Gets the rfv of this Selection. # noqa: E501\n\n\n :return: The rfv of this Selection. # noqa: E501\n :rtype: RFV\n '
return self._rfv | -5,043,599,251,545,374,000 | Gets the rfv of this Selection. # noqa: E501
:return: The rfv of this Selection. # noqa: E501
:rtype: RFV | apteco_api/models/selection.py | rfv | Apteco/apteco-api | python | @property
def rfv(self):
'Gets the rfv of this Selection. # noqa: E501\n\n\n :return: The rfv of this Selection. # noqa: E501\n :rtype: RFV\n '
return self._rfv |
@rfv.setter
def rfv(self, rfv):
'Sets the rfv of this Selection.\n\n\n :param rfv: The rfv of this Selection. # noqa: E501\n :type: RFV\n '
self._rfv = rfv | 5,855,284,156,993,970,000 | Sets the rfv of this Selection.
:param rfv: The rfv of this Selection. # noqa: E501
:type: RFV | apteco_api/models/selection.py | rfv | Apteco/apteco-api | python | @rfv.setter
def rfv(self, rfv):
'Sets the rfv of this Selection.\n\n\n :param rfv: The rfv of this Selection. # noqa: E501\n :type: RFV\n '
self._rfv = rfv |
@property
def n_per(self):
'Gets the n_per of this Selection. # noqa: E501\n\n\n :return: The n_per of this Selection. # noqa: E501\n :rtype: NPer\n '
return self._n_per | 5,518,704,617,051,992,000 | Gets the n_per of this Selection. # noqa: E501
:return: The n_per of this Selection. # noqa: E501
:rtype: NPer | apteco_api/models/selection.py | n_per | Apteco/apteco-api | python | @property
def n_per(self):
'Gets the n_per of this Selection. # noqa: E501\n\n\n :return: The n_per of this Selection. # noqa: E501\n :rtype: NPer\n '
return self._n_per |
@n_per.setter
def n_per(self, n_per):
'Sets the n_per of this Selection.\n\n\n :param n_per: The n_per of this Selection. # noqa: E501\n :type: NPer\n '
self._n_per = n_per | 3,153,032,923,048,521,700 | Sets the n_per of this Selection.
:param n_per: The n_per of this Selection. # noqa: E501
:type: NPer | apteco_api/models/selection.py | n_per | Apteco/apteco-api | python | @n_per.setter
def n_per(self, n_per):
'Sets the n_per of this Selection.\n\n\n :param n_per: The n_per of this Selection. # noqa: E501\n :type: NPer\n '
self._n_per = n_per |
@property
def top_n(self):
'Gets the top_n of this Selection. # noqa: E501\n\n\n :return: The top_n of this Selection. # noqa: E501\n :rtype: TopN\n '
return self._top_n | 9,146,417,730,161,683,000 | Gets the top_n of this Selection. # noqa: E501
:return: The top_n of this Selection. # noqa: E501
:rtype: TopN | apteco_api/models/selection.py | top_n | Apteco/apteco-api | python | @property
def top_n(self):
'Gets the top_n of this Selection. # noqa: E501\n\n\n :return: The top_n of this Selection. # noqa: E501\n :rtype: TopN\n '
return self._top_n |
@top_n.setter
def top_n(self, top_n):
'Sets the top_n of this Selection.\n\n\n :param top_n: The top_n of this Selection. # noqa: E501\n :type: TopN\n '
self._top_n = top_n | 5,989,069,227,293,145,000 | Sets the top_n of this Selection.
:param top_n: The top_n of this Selection. # noqa: E501
:type: TopN | apteco_api/models/selection.py | top_n | Apteco/apteco-api | python | @top_n.setter
def top_n(self, top_n):
'Sets the top_n of this Selection.\n\n\n :param top_n: The top_n of this Selection. # noqa: E501\n :type: TopN\n '
self._top_n = top_n |
@property
def limits(self):
'Gets the limits of this Selection. # noqa: E501\n\n\n :return: The limits of this Selection. # noqa: E501\n :rtype: Limits\n '
return self._limits | -7,770,541,340,939,093,000 | Gets the limits of this Selection. # noqa: E501
:return: The limits of this Selection. # noqa: E501
:rtype: Limits | apteco_api/models/selection.py | limits | Apteco/apteco-api | python | @property
def limits(self):
'Gets the limits of this Selection. # noqa: E501\n\n\n :return: The limits of this Selection. # noqa: E501\n :rtype: Limits\n '
return self._limits |
@limits.setter
def limits(self, limits):
'Sets the limits of this Selection.\n\n\n :param limits: The limits of this Selection. # noqa: E501\n :type: Limits\n '
self._limits = limits | 5,356,089,318,034,633,000 | Sets the limits of this Selection.
:param limits: The limits of this Selection. # noqa: E501
:type: Limits | apteco_api/models/selection.py | limits | Apteco/apteco-api | python | @limits.setter
def limits(self, limits):
'Sets the limits of this Selection.\n\n\n :param limits: The limits of this Selection. # noqa: E501\n :type: Limits\n '
self._limits = limits |
@property
def table_name(self):
'Gets the table_name of this Selection. # noqa: E501\n\n\n :return: The table_name of this Selection. # noqa: E501\n :rtype: str\n '
return self._table_name | -4,334,643,837,896,846,300 | Gets the table_name of this Selection. # noqa: E501
:return: The table_name of this Selection. # noqa: E501
:rtype: str | apteco_api/models/selection.py | table_name | Apteco/apteco-api | python | @property
def table_name(self):
'Gets the table_name of this Selection. # noqa: E501\n\n\n :return: The table_name of this Selection. # noqa: E501\n :rtype: str\n '
return self._table_name |
@table_name.setter
def table_name(self, table_name):
'Sets the table_name of this Selection.\n\n\n :param table_name: The table_name of this Selection. # noqa: E501\n :type: str\n '
if (table_name is None):
raise ValueError('Invalid value for `table_name`, must not be `None`')
... | -8,181,616,920,197,953,000 | Sets the table_name of this Selection.
:param table_name: The table_name of this Selection. # noqa: E501
:type: str | apteco_api/models/selection.py | table_name | Apteco/apteco-api | python | @table_name.setter
def table_name(self, table_name):
'Sets the table_name of this Selection.\n\n\n :param table_name: The table_name of this Selection. # noqa: E501\n :type: str\n '
if (table_name is None):
raise ValueError('Invalid value for `table_name`, must not be `None`')
... |
@property
def name(self):
'Gets the name of this Selection. # noqa: E501\n\n\n :return: The name of this Selection. # noqa: E501\n :rtype: str\n '
return self._name | -2,109,806,360,794,677,500 | Gets the name of this Selection. # noqa: E501
:return: The name of this Selection. # noqa: E501
:rtype: str | apteco_api/models/selection.py | name | Apteco/apteco-api | python | @property
def name(self):
'Gets the name of this Selection. # noqa: E501\n\n\n :return: The name of this Selection. # noqa: E501\n :rtype: str\n '
return self._name |
@name.setter
def name(self, name):
'Sets the name of this Selection.\n\n\n :param name: The name of this Selection. # noqa: E501\n :type: str\n '
self._name = name | 2,515,383,182,738,667,500 | Sets the name of this Selection.
:param name: The name of this Selection. # noqa: E501
:type: str | apteco_api/models/selection.py | name | Apteco/apteco-api | python | @name.setter
def name(self, name):
'Sets the name of this Selection.\n\n\n :param name: The name of this Selection. # noqa: E501\n :type: str\n '
self._name = name |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | 8,442,519,487,048,767,000 | Returns the model properties as a dict | apteco_api/models/selection.py | to_dict | Apteco/apteco-api | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | apteco_api/models/selection.py | to_str | Apteco/apteco-api | python | def to_str(self):
return pprint.pformat(self.to_dict()) |
def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | -8,960,031,694,814,905,000 | For `print` and `pprint` | apteco_api/models/selection.py | __repr__ | Apteco/apteco-api | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, Selection)):
return False
return (self.__dict__ == other.__dict__) | 6,380,681,132,851,042,000 | Returns true if both objects are equal | apteco_api/models/selection.py | __eq__ | Apteco/apteco-api | python | def __eq__(self, other):
if (not isinstance(other, Selection)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | 7,764,124,047,908,058,000 | Returns true if both objects are not equal | apteco_api/models/selection.py | __ne__ | Apteco/apteco-api | python | def __ne__(self, other):
return (not (self == other)) |
def update(self, delta, wind):
'\n Integrate the differential equations defining dynamics, update sensors\n delta = (delta_a, delta_e, delta_r, delta_t) are the control inputs\n wind is the wind vector in inertial coordinates\n Ts is the time step between function calls.\... | -2,032,833,507,957,320,700 | Integrate the differential equations defining dynamics, update sensors
delta = (delta_a, delta_e, delta_r, delta_t) are the control inputs
wind is the wind vector in inertial coordinates
Ts is the time step between function calls. | Lectures/MAV_Dynamics/mav_dynamics.py | update | donnel2-cooper/drone_control | python | def update(self, delta, wind):
'\n Integrate the differential equations defining dynamics, update sensors\n delta = (delta_a, delta_e, delta_r, delta_t) are the control inputs\n wind is the wind vector in inertial coordinates\n Ts is the time step between function calls.\... |
def _derivatives(self, x, u):
'\n for the dynamics xdot = f(x, u), returns fdot(x, u)\n '
f_b = u[:3]
m_b = u[3:]
r_i = x[:3]
v_b = x[3:6]
q_ib = x[6:10]
w_b = x[10:]
q_ib = (q_ib / np.linalg.norm(q_ib))
R_ib = Quaternion2Rotation(q_ib)
rdot_i = (R_ib @ v_b)
vdo... | 6,314,086,267,136,015,000 | for the dynamics xdot = f(x, u), returns fdot(x, u) | Lectures/MAV_Dynamics/mav_dynamics.py | _derivatives | donnel2-cooper/drone_control | python | def _derivatives(self, x, u):
'\n \n '
f_b = u[:3]
m_b = u[3:]
r_i = x[:3]
v_b = x[3:6]
q_ib = x[6:10]
w_b = x[10:]
q_ib = (q_ib / np.linalg.norm(q_ib))
R_ib = Quaternion2Rotation(q_ib)
rdot_i = (R_ib @ v_b)
vdot_b = (((1 / MAV.mass) * f_b) - (skew(w_b) @ v_b))
... |
def _forces_moments(self, delta):
'\n return the forces on the UAV based on the state, wind, and control surfaces\n :param delta: np.matrix(delta_e, delta_a, delta_r, delta_t)\n :return: Forces and Moments on the UAV np.matrix(Fx, Fy, Fz, Ml, Mn, Mm)\n '
(phi, theta, psi) = Quaternio... | 8,441,166,201,938,777,000 | return the forces on the UAV based on the state, wind, and control surfaces
:param delta: np.matrix(delta_e, delta_a, delta_r, delta_t)
:return: Forces and Moments on the UAV np.matrix(Fx, Fy, Fz, Ml, Mn, Mm) | Lectures/MAV_Dynamics/mav_dynamics.py | _forces_moments | donnel2-cooper/drone_control | python | def _forces_moments(self, delta):
'\n return the forces on the UAV based on the state, wind, and control surfaces\n :param delta: np.matrix(delta_e, delta_a, delta_r, delta_t)\n :return: Forces and Moments on the UAV np.matrix(Fx, Fy, Fz, Ml, Mn, Mm)\n '
(phi, theta, psi) = Quaternio... |
def _compute_K(self, F, X, variance, X2=None):
'\n The internal interface for the actual covariance matrix computation.\n\n :param F: MXNet computation type <mx.sym, mx.nd>.\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n :param X2: (o... | -8,129,138,380,491,726,000 | The internal interface for the actual covariance matrix computation.
:param F: MXNet computation type <mx.sym, mx.nd>.
:param X: the first set of inputs to the kernel.
:type X: MXNet NDArray or MXNet Symbol
:param X2: (optional) the second set of arguments to the kernel. If X2 is None,
this computes a square covarianc... | mxfusion/components/distributions/gp/kernels/static.py | _compute_K | DerrickGXD/MXFusion | python | def _compute_K(self, F, X, variance, X2=None):
'\n The internal interface for the actual covariance matrix computation.\n\n :param F: MXNet computation type <mx.sym, mx.nd>.\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n :param X2: (o... |
def _compute_Kdiag(self, F, X, variance):
'\n The internal interface for the actual computation for the diagonal.\n\n :param F: MXNet computation type <mx.sym, mx.nd>.\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n :param variance: th... | -168,833,235,967,969,820 | The internal interface for the actual computation for the diagonal.
:param F: MXNet computation type <mx.sym, mx.nd>.
:param X: the first set of inputs to the kernel.
:type X: MXNet NDArray or MXNet Symbol
:param variance: the variance parameter.
:type variance: MXNet NDArray or MXNet Symbol
:return: The covariance ma... | mxfusion/components/distributions/gp/kernels/static.py | _compute_Kdiag | DerrickGXD/MXFusion | python | def _compute_Kdiag(self, F, X, variance):
'\n The internal interface for the actual computation for the diagonal.\n\n :param F: MXNet computation type <mx.sym, mx.nd>.\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n :param variance: th... |
def _compute_K(self, F, X, variance, X2=None):
'\n The internal interface for the actual covariance matrix computation.\n\n :param F: MXNet computation type <mx.sym, mx.nd>\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n :param X2: (op... | 8,793,004,223,122,019,000 | The internal interface for the actual covariance matrix computation.
:param F: MXNet computation type <mx.sym, mx.nd>
:param X: the first set of inputs to the kernel.
:type X: MXNet NDArray or MXNet Symbol
:param X2: (optional) the second set of arguments to the kernel. If X2 is None, this computes a square
covariance... | mxfusion/components/distributions/gp/kernels/static.py | _compute_K | DerrickGXD/MXFusion | python | def _compute_K(self, F, X, variance, X2=None):
'\n The internal interface for the actual covariance matrix computation.\n\n :param F: MXNet computation type <mx.sym, mx.nd>\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n :param X2: (op... |
def _compute_Kdiag(self, F, X, variance):
'\n The internal interface for the actual computation for the diagonal of the covariance matrix.\n\n :param F: MXNet computation type <mx.sym, mx.nd>.\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n ... | 3,239,860,383,167,945,700 | The internal interface for the actual computation for the diagonal of the covariance matrix.
:param F: MXNet computation type <mx.sym, mx.nd>.
:param X: the first set of inputs to the kernel.
:type X: MXNet NDArray or MXNet Symbol
:param variance: the variance parameter.
:type variance: MXNet NDArray or MXNet Symbol
:... | mxfusion/components/distributions/gp/kernels/static.py | _compute_Kdiag | DerrickGXD/MXFusion | python | def _compute_Kdiag(self, F, X, variance):
'\n The internal interface for the actual computation for the diagonal of the covariance matrix.\n\n :param F: MXNet computation type <mx.sym, mx.nd>.\n :param X: the first set of inputs to the kernel.\n :type X: MXNet NDArray or MXNet Symbol\n ... |
def absolute_scope_name(relative_scope_name):
'Appends parent scope name to `relative_scope_name`'
base = get_scope_name()
if (len(base) > 0):
base += '/'
return (base + relative_scope_name) | 6,378,313,978,072,777,000 | Appends parent scope name to `relative_scope_name` | sandblox/util/scope.py | absolute_scope_name | SandBlox/sandblox | python | def absolute_scope_name(relative_scope_name):
base = get_scope_name()
if (len(base) > 0):
base += '/'
return (base + relative_scope_name) |
def __init__(self):
'\n TextBotFlowLaunchResponse - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and... | -4,489,177,517,340,297,700 | TextBotFlowLaunchResponse - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition. | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | __init__ | MyPureCloud/platform-client-sdk-python | python | def __init__(self):
'\n TextBotFlowLaunchResponse - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and... |
@property
def id(self):
'\n Gets the id of this TextBotFlowLaunchResponse.\n The session ID of the bot flow, used to send to subsequent turn requests\n\n :return: The id of this TextBotFlowLaunchResponse.\n :rtype: str\n '
return self._id | 95,141,098,635,902,770 | Gets the id of this TextBotFlowLaunchResponse.
The session ID of the bot flow, used to send to subsequent turn requests
:return: The id of this TextBotFlowLaunchResponse.
:rtype: str | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | id | MyPureCloud/platform-client-sdk-python | python | @property
def id(self):
'\n Gets the id of this TextBotFlowLaunchResponse.\n The session ID of the bot flow, used to send to subsequent turn requests\n\n :return: The id of this TextBotFlowLaunchResponse.\n :rtype: str\n '
return self._id |
@id.setter
def id(self, id):
'\n Sets the id of this TextBotFlowLaunchResponse.\n The session ID of the bot flow, used to send to subsequent turn requests\n\n :param id: The id of this TextBotFlowLaunchResponse.\n :type: str\n '
self._id = id | -1,358,825,402,861,718,000 | Sets the id of this TextBotFlowLaunchResponse.
The session ID of the bot flow, used to send to subsequent turn requests
:param id: The id of this TextBotFlowLaunchResponse.
:type: str | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | id | MyPureCloud/platform-client-sdk-python | python | @id.setter
def id(self, id):
'\n Sets the id of this TextBotFlowLaunchResponse.\n The session ID of the bot flow, used to send to subsequent turn requests\n\n :param id: The id of this TextBotFlowLaunchResponse.\n :type: str\n '
self._id = id |
def to_dict(self):
'\n Returns the model properties as a dict\n '
result = {}
for (attr, _) in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), v... | 2,191,974,537,531,847,000 | Returns the model properties as a dict | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | to_dict | MyPureCloud/platform-client-sdk-python | python | def to_dict(self):
'\n \n '
result = {}
for (attr, _) in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to... |
def to_json(self):
'\n Returns the model as raw JSON\n '
return json.dumps(sanitize_for_serialization(self.to_dict())) | 201,001,069,348,168,640 | Returns the model as raw JSON | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | to_json | MyPureCloud/platform-client-sdk-python | python | def to_json(self):
'\n \n '
return json.dumps(sanitize_for_serialization(self.to_dict())) |
def to_str(self):
'\n Returns the string representation of the model\n '
return pformat(self.to_dict()) | -3,531,024,894,346,511,000 | Returns the string representation of the model | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | to_str | MyPureCloud/platform-client-sdk-python | python | def to_str(self):
'\n \n '
return pformat(self.to_dict()) |
def __repr__(self):
'\n For `print` and `pprint`\n '
return self.to_str() | 5,853,962,500,611,353,000 | For `print` and `pprint` | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | __repr__ | MyPureCloud/platform-client-sdk-python | python | def __repr__(self):
'\n \n '
return self.to_str() |
def __eq__(self, other):
'\n Returns true if both objects are equal\n '
return (self.__dict__ == other.__dict__) | 3,599,733,221,149,238,300 | Returns true if both objects are equal | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | __eq__ | MyPureCloud/platform-client-sdk-python | python | def __eq__(self, other):
'\n \n '
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'\n Returns true if both objects are not equal\n '
return (not (self == other)) | 3,600,423,175,817,510,400 | Returns true if both objects are not equal | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | __ne__ | MyPureCloud/platform-client-sdk-python | python | def __ne__(self, other):
'\n \n '
return (not (self == other)) |
@property
def offline_status(self) -> MetadataManagerMessage:
'\n Status to publish when the manager goes offline.\n\n This status should ensure that any other components relying\n on this data go into a safe state.\n '
return MetadataManagerMessage(status=MetadataManagerMessage.Stat... | -8,665,394,748,630,808,000 | Status to publish when the manager goes offline.
This status should ensure that any other components relying
on this data go into a safe state. | astoria/astmetad/metadata_manager.py | offline_status | trickeydan/astoria | python | @property
def offline_status(self) -> MetadataManagerMessage:
'\n Status to publish when the manager goes offline.\n\n This status should ensure that any other components relying\n on this data go into a safe state.\n '
return MetadataManagerMessage(status=MetadataManagerMessage.Stat... |
async def main(self) -> None:
'Main routine for astmetad.'
self.update_status()
(await self.wait_loop())
for (uuid, info) in self._cur_disks.items():
asyncio.ensure_future(self.handle_disk_removal(uuid, info)) | 4,665,077,025,833,202,000 | Main routine for astmetad. | astoria/astmetad/metadata_manager.py | main | trickeydan/astoria | python | async def main(self) -> None:
self.update_status()
(await self.wait_loop())
for (uuid, info) in self._cur_disks.items():
asyncio.ensure_future(self.handle_disk_removal(uuid, info)) |
async def handle_disk_insertion(self, uuid: DiskUUID, disk_info: DiskInfo) -> None:
'Handle a disk insertion.'
LOGGER.debug(f'Disk inserted: {uuid} ({disk_info.disk_type})')
for (disk_type, lifecycle_class) in self.DISK_TYPE_LIFECYCLE_MAP.items():
if (disk_info.disk_type is disk_type):
L... | 758,388,486,186,581,200 | Handle a disk insertion. | astoria/astmetad/metadata_manager.py | handle_disk_insertion | trickeydan/astoria | python | async def handle_disk_insertion(self, uuid: DiskUUID, disk_info: DiskInfo) -> None:
LOGGER.debug(f'Disk inserted: {uuid} ({disk_info.disk_type})')
for (disk_type, lifecycle_class) in self.DISK_TYPE_LIFECYCLE_MAP.items():
if (disk_info.disk_type is disk_type):
LOGGER.info(f'{disk_type.na... |
async def handle_disk_removal(self, uuid: DiskUUID, disk_info: DiskInfo) -> None:
'Handle a disk removal.'
LOGGER.debug(f'Disk removed: {uuid} ({disk_info.disk_type})')
for (disk_type, lifecycle_class) in self.DISK_TYPE_LIFECYCLE_MAP.items():
if (disk_info.disk_type is disk_type):
LOGGER... | 3,454,666,556,045,228,000 | Handle a disk removal. | astoria/astmetad/metadata_manager.py | handle_disk_removal | trickeydan/astoria | python | async def handle_disk_removal(self, uuid: DiskUUID, disk_info: DiskInfo) -> None:
LOGGER.debug(f'Disk removed: {uuid} ({disk_info.disk_type})')
for (disk_type, lifecycle_class) in self.DISK_TYPE_LIFECYCLE_MAP.items():
if (disk_info.disk_type is disk_type):
LOGGER.info(f'Metadata disk {u... |
async def handle_mutation_request(self, request: MetadataSetManagerRequest) -> RequestResponse:
'Handle a request to mutate metadata.'
if (request.attr not in self.MUTABLE_ATTRS_BY_REQUEST):
return RequestResponse(uuid=request.uuid, success=False, reason=f'{request.attr} is not a mutable attribute')
... | 3,309,932,866,197,272,000 | Handle a request to mutate metadata. | astoria/astmetad/metadata_manager.py | handle_mutation_request | trickeydan/astoria | python | async def handle_mutation_request(self, request: MetadataSetManagerRequest) -> RequestResponse:
if (request.attr not in self.MUTABLE_ATTRS_BY_REQUEST):
return RequestResponse(uuid=request.uuid, success=False, reason=f'{request.attr} is not a mutable attribute')
if (len(request.value) == 0):
... |
def get_current_metadata(self) -> Metadata:
'\n Calculate the current metadata.\n\n Takes the default, static metadata based on the config and system\n information. It then overlays data from other sources in a priority order,\n whereby each source has a set of permitted attributes in th... | -9,035,408,928,859,739,000 | Calculate the current metadata.
Takes the default, static metadata based on the config and system
information. It then overlays data from other sources in a priority order,
whereby each source has a set of permitted attributes in the metadata that
can be overridden. | astoria/astmetad/metadata_manager.py | get_current_metadata | trickeydan/astoria | python | def get_current_metadata(self) -> Metadata:
'\n Calculate the current metadata.\n\n Takes the default, static metadata based on the config and system\n information. It then overlays data from other sources in a priority order,\n whereby each source has a set of permitted attributes in th... |
def update_status(self) -> None:
'Update the status of the manager.'
self.status = MetadataManagerMessage(status=MetadataManagerMessage.Status.RUNNING, metadata=self.get_current_metadata()) | 5,634,726,933,070,275,000 | Update the status of the manager. | astoria/astmetad/metadata_manager.py | update_status | trickeydan/astoria | python | def update_status(self) -> None:
self.status = MetadataManagerMessage(status=MetadataManagerMessage.Status.RUNNING, metadata=self.get_current_metadata()) |
def _set_nofile(nofile_atleast=4096):
'\n sets nofile soft limit to at least 4096, useful for running matlplotlib/seaborn on\n parallel executing plot generators vs. Ubuntu default ulimit -n 1024 or OS X El Captian 256\n temporary setting extinguishing with Python session.\n '
try:
import re... | -2,900,918,797,510,906,400 | sets nofile soft limit to at least 4096, useful for running matlplotlib/seaborn on
parallel executing plot generators vs. Ubuntu default ulimit -n 1024 or OS X El Captian 256
temporary setting extinguishing with Python session. | jina/__init__.py | _set_nofile | bsherifi/jina | python | def _set_nofile(nofile_atleast=4096):
'\n sets nofile soft limit to at least 4096, useful for running matlplotlib/seaborn on\n parallel executing plot generators vs. Ubuntu default ulimit -n 1024 or OS X El Captian 256\n temporary setting extinguishing with Python session.\n '
try:
import re... |
def __init__(self, **kwargs):
'Initialize RandomForestClassifier instance.\n '
warnings.filterwarnings(action='ignore', category=ChangedBehaviorWarning)
warnings.filterwarnings(action='ignore', category=ConvergenceWarning)
warnings.filterwarnings(action='ignore', category=DataConversionWarning)
... | 8,789,940,093,005,560,000 | Initialize RandomForestClassifier instance. | niaaml/classifiers/random_forest.py | __init__ | adi3/NiaAML | python | def __init__(self, **kwargs):
'\n '
warnings.filterwarnings(action='ignore', category=ChangedBehaviorWarning)
warnings.filterwarnings(action='ignore', category=ConvergenceWarning)
warnings.filterwarnings(action='ignore', category=DataConversionWarning)
warnings.filterwarnings(action='ignore',... |
def set_parameters(self, **kwargs):
'Set the parameters/arguments of the algorithm.\n '
self.__random_forest_classifier.set_params(**kwargs) | -13,568,839,352,867,336 | Set the parameters/arguments of the algorithm. | niaaml/classifiers/random_forest.py | set_parameters | adi3/NiaAML | python | def set_parameters(self, **kwargs):
'\n '
self.__random_forest_classifier.set_params(**kwargs) |
def fit(self, x, y, **kwargs):
'Fit RandomForestClassifier.\n\n Arguments:\n x (pandas.core.frame.DataFrame): n samples to classify.\n y (pandas.core.series.Series): n classes of the samples in the x array.\n\n Returns:\n None\n '
self.__random_forest_classi... | -778,738,233,557,275,900 | Fit RandomForestClassifier.
Arguments:
x (pandas.core.frame.DataFrame): n samples to classify.
y (pandas.core.series.Series): n classes of the samples in the x array.
Returns:
None | niaaml/classifiers/random_forest.py | fit | adi3/NiaAML | python | def fit(self, x, y, **kwargs):
'Fit RandomForestClassifier.\n\n Arguments:\n x (pandas.core.frame.DataFrame): n samples to classify.\n y (pandas.core.series.Series): n classes of the samples in the x array.\n\n Returns:\n None\n '
self.__random_forest_classi... |
def predict(self, x, **kwargs):
'Predict class for each sample (row) in x.\n\n Arguments:\n x (pandas.core.frame.DataFrame): n samples to classify.\n\n Returns:\n pandas.core.series.Series: n predicted classes.\n '
return self.__random_forest_classifier.predict(x) | 3,991,637,054,213,888,000 | Predict class for each sample (row) in x.
Arguments:
x (pandas.core.frame.DataFrame): n samples to classify.
Returns:
pandas.core.series.Series: n predicted classes. | niaaml/classifiers/random_forest.py | predict | adi3/NiaAML | python | def predict(self, x, **kwargs):
'Predict class for each sample (row) in x.\n\n Arguments:\n x (pandas.core.frame.DataFrame): n samples to classify.\n\n Returns:\n pandas.core.series.Series: n predicted classes.\n '
return self.__random_forest_classifier.predict(x) |
def to_string(self):
'User friendly representation of the object.\n\n Returns:\n str: User friendly representation of the object.\n '
return Classifier.to_string(self).format(name=self.Name, args=self._parameters_to_string(self.__random_forest_classifier.get_params())) | -5,826,239,005,028,580,000 | User friendly representation of the object.
Returns:
str: User friendly representation of the object. | niaaml/classifiers/random_forest.py | to_string | adi3/NiaAML | python | def to_string(self):
'User friendly representation of the object.\n\n Returns:\n str: User friendly representation of the object.\n '
return Classifier.to_string(self).format(name=self.Name, args=self._parameters_to_string(self.__random_forest_classifier.get_params())) |
def list(self, resource_group_name, resource_name, **kwargs):
'List private endpoint connections.\n\n List private endpoint connection properties.\n\n :param resource_group_name: The name of the resource group that contains the IoT hub.\n :type resource_group_name: str\n :param resource_... | -7,302,230,787,975,572,000 | List private endpoint connections.
List private endpoint connection properties.
:param resource_group_name: The name of the resource group that contains the IoT hub.
:type resource_group_name: str
:param resource_name: The name of the IoT hub.
:type resource_name: str
:keyword callable cls: A custom type or function ... | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py | list | 4thel00z/microsoft-crap-that-doesnt-work | python | def list(self, resource_group_name, resource_name, **kwargs):
'List private endpoint connections.\n\n List private endpoint connection properties.\n\n :param resource_group_name: The name of the resource group that contains the IoT hub.\n :type resource_group_name: str\n :param resource_... |
def get(self, resource_group_name, resource_name, private_endpoint_connection_name, **kwargs):
'Get private endpoint connection.\n\n Get private endpoint connection properties.\n\n :param resource_group_name: The name of the resource group that contains the IoT hub.\n :type resource_group_name:... | -2,780,641,515,259,668,000 | Get private endpoint connection.
Get private endpoint connection properties.
:param resource_group_name: The name of the resource group that contains the IoT hub.
:type resource_group_name: str
:param resource_name: The name of the IoT hub.
:type resource_name: str
:param private_endpoint_connection_name: The name of... | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py | get | 4thel00z/microsoft-crap-that-doesnt-work | python | def get(self, resource_group_name, resource_name, private_endpoint_connection_name, **kwargs):
'Get private endpoint connection.\n\n Get private endpoint connection properties.\n\n :param resource_group_name: The name of the resource group that contains the IoT hub.\n :type resource_group_name:... |
def begin_update(self, resource_group_name, resource_name, private_endpoint_connection_name, private_endpoint_connection, **kwargs):
'Update private endpoint connection.\n\n Update the status of a private endpoint connection with the specified name.\n\n :param resource_group_name: The name of the reso... | 3,924,322,189,743,012,000 | Update private endpoint connection.
Update the status of a private endpoint connection with the specified name.
:param resource_group_name: The name of the resource group that contains the IoT hub.
:type resource_group_name: str
:param resource_name: The name of the IoT hub.
:type resource_name: str
:param private_en... | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py | begin_update | 4thel00z/microsoft-crap-that-doesnt-work | python | def begin_update(self, resource_group_name, resource_name, private_endpoint_connection_name, private_endpoint_connection, **kwargs):
'Update private endpoint connection.\n\n Update the status of a private endpoint connection with the specified name.\n\n :param resource_group_name: The name of the reso... |
def begin_delete(self, resource_group_name, resource_name, private_endpoint_connection_name, **kwargs):
'Delete private endpoint connection.\n\n Delete private endpoint connection with the specified name.\n\n :param resource_group_name: The name of the resource group that contains the IoT hub.\n ... | -6,792,704,747,544,680,000 | Delete private endpoint connection.
Delete private endpoint connection with the specified name.
:param resource_group_name: The name of the resource group that contains the IoT hub.
:type resource_group_name: str
:param resource_name: The name of the IoT hub.
:type resource_name: str
:param private_endpoint_connectio... | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py | begin_delete | 4thel00z/microsoft-crap-that-doesnt-work | python | def begin_delete(self, resource_group_name, resource_name, private_endpoint_connection_name, **kwargs):
'Delete private endpoint connection.\n\n Delete private endpoint connection with the specified name.\n\n :param resource_group_name: The name of the resource group that contains the IoT hub.\n ... |
def split_train_val_forwardChaining(sequence, numInputs, numOutputs, numJumps):
' Returns sets to train and cross-validate a model using forward chaining technique\n \n Parameters:\n sequence (array) : Full training dataset\n numInputs (int) : Number of inputs X and Xcv used at each training ... | 8,890,680,324,160,942,000 | Returns sets to train and cross-validate a model using forward chaining technique
Parameters:
sequence (array) : Full training dataset
numInputs (int) : Number of inputs X and Xcv used at each training and validation
numOutputs (int) : Number of outputs y and ycv used at each training and validation
... | tsxv/splitTrainVal.py | split_train_val_forwardChaining | DidierRLopes/TimeSeriesCrossValidation | python | def split_train_val_forwardChaining(sequence, numInputs, numOutputs, numJumps):
' Returns sets to train and cross-validate a model using forward chaining technique\n \n Parameters:\n sequence (array) : Full training dataset\n numInputs (int) : Number of inputs X and Xcv used at each training ... |
def split_train_val_kFold(sequence, numInputs, numOutputs, numJumps):
' Returns sets to train and cross-validate a model using K-Fold technique\n \n Parameters:\n sequence (array) : Full training dataset\n numInputs (int) : Number of inputs X and Xcv used at each training\n numOutputs ... | -4,543,209,539,997,643,000 | Returns sets to train and cross-validate a model using K-Fold technique
Parameters:
sequence (array) : Full training dataset
numInputs (int) : Number of inputs X and Xcv used at each training
numOutputs (int) : Number of outputs y and ycv used at each training
numJumps (int) : Number of sequence... | tsxv/splitTrainVal.py | split_train_val_kFold | DidierRLopes/TimeSeriesCrossValidation | python | def split_train_val_kFold(sequence, numInputs, numOutputs, numJumps):
' Returns sets to train and cross-validate a model using K-Fold technique\n \n Parameters:\n sequence (array) : Full training dataset\n numInputs (int) : Number of inputs X and Xcv used at each training\n numOutputs ... |
def split_train_val_groupKFold(sequence, numInputs, numOutputs, numJumps):
' Returns sets to train and cross-validate a model using group K-Fold technique\n \n Parameters:\n sequence (array) : Full training dataset\n numInputs (int) : Number of inputs X and Xcv used at each training\n ... | -4,419,774,061,934,965,000 | Returns sets to train and cross-validate a model using group K-Fold technique
Parameters:
sequence (array) : Full training dataset
numInputs (int) : Number of inputs X and Xcv used at each training
numOutputs (int) : Number of outputs y and ycv used at each training
numJumps (int) : Number of se... | tsxv/splitTrainVal.py | split_train_val_groupKFold | DidierRLopes/TimeSeriesCrossValidation | python | def split_train_val_groupKFold(sequence, numInputs, numOutputs, numJumps):
' Returns sets to train and cross-validate a model using group K-Fold technique\n \n Parameters:\n sequence (array) : Full training dataset\n numInputs (int) : Number of inputs X and Xcv used at each training\n ... |
def build_block_specs(block_specs=None):
'Builds the list of BlockSpec objects for SpineNet.'
if (not block_specs):
block_specs = SPINENET_BLOCK_SPECS
logging.info('Building SpineNet block specs: %s', block_specs)
return [BlockSpec(*b) for b in block_specs] | -7,891,216,531,504,436,000 | Builds the list of BlockSpec objects for SpineNet. | official/vision/beta/modeling/backbones/spinenet.py | build_block_specs | GPhilo/models | python | def build_block_specs(block_specs=None):
if (not block_specs):
block_specs = SPINENET_BLOCK_SPECS
logging.info('Building SpineNet block specs: %s', block_specs)
return [BlockSpec(*b) for b in block_specs] |
def __init__(self, input_specs=tf.keras.layers.InputSpec(shape=[None, 640, 640, 3]), min_level=3, max_level=7, block_specs=build_block_specs(), endpoints_num_filters=256, resample_alpha=0.5, block_repeats=1, filter_size_scale=1.0, kernel_initializer='VarianceScaling', kernel_regularizer=None, bias_regularizer=None, act... | -7,501,948,293,069,149,000 | SpineNet model. | official/vision/beta/modeling/backbones/spinenet.py | __init__ | GPhilo/models | python | def __init__(self, input_specs=tf.keras.layers.InputSpec(shape=[None, 640, 640, 3]), min_level=3, max_level=7, block_specs=build_block_specs(), endpoints_num_filters=256, resample_alpha=0.5, block_repeats=1, filter_size_scale=1.0, kernel_initializer='VarianceScaling', kernel_regularizer=None, bias_regularizer=None, act... |
def _block_group(self, inputs, filters, strides, block_fn_cand, block_repeats=1, name='block_group'):
'Creates one group of blocks for the SpineNet model.'
block_fn_candidates = {'bottleneck': nn_blocks.BottleneckBlock, 'residual': nn_blocks.ResidualBlock}
block_fn = block_fn_candidates[block_fn_cand]
(... | 7,470,388,370,848,342,000 | Creates one group of blocks for the SpineNet model. | official/vision/beta/modeling/backbones/spinenet.py | _block_group | GPhilo/models | python | def _block_group(self, inputs, filters, strides, block_fn_cand, block_repeats=1, name='block_group'):
block_fn_candidates = {'bottleneck': nn_blocks.BottleneckBlock, 'residual': nn_blocks.ResidualBlock}
block_fn = block_fn_candidates[block_fn_cand]
(_, _, _, num_filters) = inputs.get_shape().as_list()
... |
def _build_stem(self, inputs):
'Build SpineNet stem.'
x = layers.Conv2D(filters=64, kernel_size=7, strides=2, use_bias=False, padding='same', kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(inputs)
x = self._norm(axis=self._b... | -1,046,958,632,795,266,400 | Build SpineNet stem. | official/vision/beta/modeling/backbones/spinenet.py | _build_stem | GPhilo/models | python | def _build_stem(self, inputs):
x = layers.Conv2D(filters=64, kernel_size=7, strides=2, use_bias=False, padding='same', kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer)(inputs)
x = self._norm(axis=self._bn_axis, momentum=self.... |
def _build_scale_permuted_network(self, net, input_width, weighted_fusion=False):
'Build scale-permuted network.'
net_sizes = ([int(math.ceil((input_width / (2 ** 2))))] * len(net))
net_block_fns = ([self._init_block_fn] * len(net))
num_outgoing_connections = ([0] * len(net))
endpoints = {}
for ... | -8,515,593,795,021,783,000 | Build scale-permuted network. | official/vision/beta/modeling/backbones/spinenet.py | _build_scale_permuted_network | GPhilo/models | python | def _build_scale_permuted_network(self, net, input_width, weighted_fusion=False):
net_sizes = ([int(math.ceil((input_width / (2 ** 2))))] * len(net))
net_block_fns = ([self._init_block_fn] * len(net))
num_outgoing_connections = ([0] * len(net))
endpoints = {}
for (i, block_spec) in enumerate(se... |
def _build_endpoints(self, net):
'Match filter size for endpoints before sharing conv layers.'
endpoints = {}
for level in range(self._min_level, (self._max_level + 1)):
x = layers.Conv2D(filters=self._endpoints_num_filters, kernel_size=1, strides=1, use_bias=False, kernel_initializer=self._kernel_i... | 659,790,285,644,945,500 | Match filter size for endpoints before sharing conv layers. | official/vision/beta/modeling/backbones/spinenet.py | _build_endpoints | GPhilo/models | python | def _build_endpoints(self, net):
endpoints = {}
for level in range(self._min_level, (self._max_level + 1)):
x = layers.Conv2D(filters=self._endpoints_num_filters, kernel_size=1, strides=1, use_bias=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias... |
def _resample_with_alpha(self, inputs, input_width, input_block_fn, target_width, target_num_filters, target_block_fn, alpha=0.5):
'Match resolution and feature dimension.'
(_, _, _, input_num_filters) = inputs.get_shape().as_list()
if (input_block_fn == 'bottleneck'):
input_num_filters /= 4
new... | 144,570,954,614,252,960 | Match resolution and feature dimension. | official/vision/beta/modeling/backbones/spinenet.py | _resample_with_alpha | GPhilo/models | python | def _resample_with_alpha(self, inputs, input_width, input_block_fn, target_width, target_num_filters, target_block_fn, alpha=0.5):
(_, _, _, input_num_filters) = inputs.get_shape().as_list()
if (input_block_fn == 'bottleneck'):
input_num_filters /= 4
new_num_filters = int((input_num_filters * a... |
@property
def output_specs(self):
'A dict of {level: TensorShape} pairs for the model output.'
return self._output_specs | -6,976,459,066,222,763,000 | A dict of {level: TensorShape} pairs for the model output. | official/vision/beta/modeling/backbones/spinenet.py | output_specs | GPhilo/models | python | @property
def output_specs(self):
return self._output_specs |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_surface(self, test_dict):
'Check that the computation of the surface is correct'
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_surface()
a = result
b = test_dict['S_exp']
msg = ((('Return ' + str(a)) + ' expected ') +... | 6,061,114,738,152,995,000 | Check that the computation of the surface is correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_surface | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_surface(self, test_dict):
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_surface()
a = result
b = test_dict['S_exp']
msg = ((('Return ' + str(a)) + ' expected ') + str(b))
assert (a == pytest.approx(b, rel=DELTA))... |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_surface_active(self, test_dict):
'Check that the computation of the active surface is correct'
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_surface_active()
a = result
b = test_dict['SA_exp']
msg = ((('Return ' + str... | -6,730,817,113,055,780,000 | Check that the computation of the active surface is correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_surface_active | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_surface_active(self, test_dict):
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_surface_active()
a = result
b = test_dict['SA_exp']
msg = ((('Return ' + str(a)) + ' expected ') + str(b))
assert (a == pytest.approx... |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_height(self, test_dict):
'Check that the computation of the height is correct'
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_height()
a = result
b = test_dict['H_exp']
msg = ((('Return ' + str(a)) + ' expected ') + st... | -4,106,914,196,046,679,000 | Check that the computation of the height is correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_height | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_height(self, test_dict):
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_height()
a = result
b = test_dict['H_exp']
msg = ((('Return ' + str(a)) + ' expected ') + str(b))
assert (a == pytest.approx(b, rel=DELTA)), ... |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_height_active(self, test_dict):
'Check that the computation of the active height is correct'
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_height_active()
a = result
b = test_dict['HA_exp']
msg = ((('Return ' + str(a)... | -3,753,773,613,012,595,700 | Check that the computation of the active height is correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_height_active | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_height_active(self, test_dict):
test_obj = test_dict['test_obj']
result = test_obj.slot.comp_height_active()
a = result
b = test_dict['HA_exp']
msg = ((('Return ' + str(a)) + ' expected ') + str(b))
b = comp_height_active(test_... |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_angle_opening(self, test_dict):
'Check that the computation of the average opening angle is correct'
test_obj = test_dict['test_obj']
a = test_obj.slot.comp_angle_opening()
assert (a == pytest.approx(test_dict['Ao'], rel=DELTA))
b = com... | 8,504,016,254,974,876,000 | Check that the computation of the average opening angle is correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_angle_opening | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_angle_opening(self, test_dict):
test_obj = test_dict['test_obj']
a = test_obj.slot.comp_angle_opening()
assert (a == pytest.approx(test_dict['Ao'], rel=DELTA))
b = comp_angle_opening(test_obj.slot)
msg = ((('Return ' + str(a)) + ' ... |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_width_opening(self, test_dict):
'Check that the computation of the average opening width is correct'
test_obj = test_dict['test_obj']
a = test_obj.slot.comp_width_opening()
point_dict = test_obj.slot._comp_point_coordinate()
assert (a =... | -266,564,087,929,575,070 | Check that the computation of the average opening width is correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_width_opening | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_width_opening(self, test_dict):
test_obj = test_dict['test_obj']
a = test_obj.slot.comp_width_opening()
point_dict = test_obj.slot._comp_point_coordinate()
assert (a == pytest.approx(abs((point_dict['Z1'] - point_dict['Z4'])), rel=DELT... |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_mec_radius(self, test_dict):
'Check that the computation of the mechanical radius is correct'
test_obj = test_dict['test_obj']
a = test_obj.comp_radius_mec()
assert (a == pytest.approx(test_dict['Rmec'], rel=DELTA)) | 7,076,176,831,930,096,000 | Check that the computation of the mechanical radius is correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_mec_radius | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_mec_radius(self, test_dict):
test_obj = test_dict['test_obj']
a = test_obj.comp_radius_mec()
assert (a == pytest.approx(test_dict['Rmec'], rel=DELTA)) |
@pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_point_coordinate(self, test_dict):
'Check that the point coordinates are correct'
test_obj = test_dict['test_obj']
point_dict = test_obj.slot._comp_point_coordinate()
Z1 = point_dict['Z1']
Z2 = point_dict['Z2']
Z3 = point_dict['Z3']... | -6,819,790,878,177,716,000 | Check that the point coordinates are correct | Tests/Methods/Slot/test_SlotM14_meth.py | test_comp_point_coordinate | ajpina/pyleecan | python | @pytest.mark.parametrize('test_dict', Mag14_test)
def test_comp_point_coordinate(self, test_dict):
test_obj = test_dict['test_obj']
point_dict = test_obj.slot._comp_point_coordinate()
Z1 = point_dict['Z1']
Z2 = point_dict['Z2']
Z3 = point_dict['Z3']
Z4 = point_dict['Z4']
ZM0 = point_dic... |
def masked_logit_cross_entropy(preds, labels, mask):
'Logit cross-entropy loss with masking.'
loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=preds, labels=labels)
loss = tf.reduce_sum(input_tensor=loss, axis=1)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.maximum(tf.reduce_sum(input_tens... | 7,783,878,588,039,748,000 | Logit cross-entropy loss with masking. | graphsage/metrics.py | masked_logit_cross_entropy | gelareh1985/GraphSAGE | python | def masked_logit_cross_entropy(preds, labels, mask):
loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=preds, labels=labels)
loss = tf.reduce_sum(input_tensor=loss, axis=1)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.maximum(tf.reduce_sum(input_tensor=mask), tf.constant([1.0]))
loss *... |
def masked_softmax_cross_entropy(preds, labels, mask):
'Softmax cross-entropy loss with masking.'
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=tf.stop_gradient(labels))
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.maximum(tf.reduce_sum(input_tensor=mask), tf.constant([1.0]))
... | 1,409,206,032,238,293,800 | Softmax cross-entropy loss with masking. | graphsage/metrics.py | masked_softmax_cross_entropy | gelareh1985/GraphSAGE | python | def masked_softmax_cross_entropy(preds, labels, mask):
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=tf.stop_gradient(labels))
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.maximum(tf.reduce_sum(input_tensor=mask), tf.constant([1.0]))
loss *= mask
return tf.reduce_mean... |
def masked_l2(preds, actuals, mask):
'L2 loss with masking.'
loss = tf.nn.l2_loss(preds, actuals)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(input_tensor=mask)
loss *= mask
return tf.reduce_mean(input_tensor=loss) | 2,564,832,346,358,642,000 | L2 loss with masking. | graphsage/metrics.py | masked_l2 | gelareh1985/GraphSAGE | python | def masked_l2(preds, actuals, mask):
loss = tf.nn.l2_loss(preds, actuals)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(input_tensor=mask)
loss *= mask
return tf.reduce_mean(input_tensor=loss) |
def masked_accuracy(preds, labels, mask):
'Accuracy with masking.'
correct_prediction = tf.equal(tf.argmax(input=preds, axis=1), tf.argmax(input=labels, axis=1))
accuracy_all = tf.cast(correct_prediction, tf.float32)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(input_tensor=mask)
... | 39,099,147,810,143,750 | Accuracy with masking. | graphsage/metrics.py | masked_accuracy | gelareh1985/GraphSAGE | python | def masked_accuracy(preds, labels, mask):
correct_prediction = tf.equal(tf.argmax(input=preds, axis=1), tf.argmax(input=labels, axis=1))
accuracy_all = tf.cast(correct_prediction, tf.float32)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(input_tensor=mask)
accuracy_all *= mask
... |
def _def_loss(self, model_fn, env):
'\n returns a module for and the loss\n '
raise NotImplementedError | 2,794,956,208,641,094,000 | returns a module for and the loss | rl/algorithms/core.py | _def_loss | cbschaff/nlimb | python | def _def_loss(self, model_fn, env):
'\n \n '
raise NotImplementedError |
def _def_opt(self, loss):
'\n returns a module for and the optimizer\n '
raise NotImplementedError | -5,681,829,422,691,011,000 | returns a module for and the optimizer | rl/algorithms/core.py | _def_opt | cbschaff/nlimb | python | def _def_opt(self, loss):
'\n \n '
raise NotImplementedError |
def setup(bot: Bot) -> None:
' Load the Mute cog. '
bot.add_cog(MuteCog(bot))
log.info('Commands loaded: mutes') | 6,675,582,806,347,262,000 | Load the Mute cog. | cogs/commands/moderation/mutes.py | setup | y0usef-2E/chiya | python | def setup(bot: Bot) -> None:
' '
bot.add_cog(MuteCog(bot))
log.info('Commands loaded: mutes') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.