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 is_revoked(events, token_data):
'Check if a token matches a revocation event.\n\n Compare a token against every revocation event. If the token matches an\n event in the `events` list, the token is revoked. If the token is compared\n against every item in the list without a match, it is not considered\n... | -2,733,786,438,827,986,000 | Check if a token matches a revocation event.
Compare a token against every revocation event. If the token matches an
event in the `events` list, the token is revoked. If the token is compared
against every item in the list without a match, it is not considered
revoked from the `revoke_api`.
:param events: a list of R... | keystone/models/revoke_model.py | is_revoked | ISCAS-VDI/keystone | python | def is_revoked(events, token_data):
'Check if a token matches a revocation event.\n\n Compare a token against every revocation event. If the token matches an\n event in the `events` list, the token is revoked. If the token is compared\n against every item in the list without a match, it is not considered\n... |
def matches(event, token_values):
'See if the token matches the revocation event.\n\n A brute force approach to checking.\n Compare each attribute from the event with the corresponding\n value from the token. If the event does not have a value for\n the attribute, a match is still possible. If the eve... | 8,244,953,039,747,746,000 | See if the token matches the revocation event.
A brute force approach to checking.
Compare each attribute from the event with the corresponding
value from the token. If the event does not have a value for
the attribute, a match is still possible. If the event has a
value for the attribute, and it does not match the ... | keystone/models/revoke_model.py | matches | ISCAS-VDI/keystone | python | def matches(event, token_values):
'See if the token matches the revocation event.\n\n A brute force approach to checking.\n Compare each attribute from the event with the corresponding\n value from the token. If the event does not have a value for\n the attribute, a match is still possible. If the eve... |
def connect(**kwargs):
'Opens a new connection to a Vertica database.'
return Connection(kwargs) | -8,169,109,808,066,380,000 | Opens a new connection to a Vertica database. | vertica_python/vertica/connection.py | connect | uber/vertica-python | python | def connect(**kwargs):
return Connection(kwargs) |
def parse_dsn(dsn):
'Parse connection string into a dictionary of keywords and values.\n Connection string format:\n vertica://<user>:<password>@<host>:<port>/<database>?k1=v1&k2=v2&...\n '
url = urlparse(dsn)
if (url.scheme != 'vertica'):
raise ValueError('Only vertica:// scheme ... | -8,685,461,749,772,006,000 | Parse connection string into a dictionary of keywords and values.
Connection string format:
vertica://<user>:<password>@<host>:<port>/<database>?k1=v1&k2=v2&... | vertica_python/vertica/connection.py | parse_dsn | uber/vertica-python | python | def parse_dsn(dsn):
'Parse connection string into a dictionary of keywords and values.\n Connection string format:\n vertica://<user>:<password>@<host>:<port>/<database>?k1=v1&k2=v2&...\n '
url = urlparse(dsn)
if (url.scheme != 'vertica'):
raise ValueError('Only vertica:// scheme ... |
def __init__(self, host, port, backup_nodes, logger):
'Creates a new deque with the primary host first, followed by any backup hosts'
self._logger = logger
self.address_deque = deque()
self._append(host, port)
if (not isinstance(backup_nodes, list)):
err_msg = 'Connection option "backup_serv... | 4,716,196,150,234,105,000 | Creates a new deque with the primary host first, followed by any backup hosts | vertica_python/vertica/connection.py | __init__ | uber/vertica-python | python | def __init__(self, host, port, backup_nodes, logger):
self._logger = logger
self.address_deque = deque()
self._append(host, port)
if (not isinstance(backup_nodes, list)):
err_msg = 'Connection option "backup_server_node" must be a list'
self._logger.error(err_msg)
raise Type... |
@property
def autocommit(self):
"Read the connection's AUTOCOMMIT setting from cache"
return (self.parameters.get('auto_commit', 'off') == 'on') | -9,071,740,125,276,144,000 | Read the connection's AUTOCOMMIT setting from cache | vertica_python/vertica/connection.py | autocommit | uber/vertica-python | python | @property
def autocommit(self):
return (self.parameters.get('auto_commit', 'off') == 'on') |
@autocommit.setter
def autocommit(self, value):
"Change the connection's AUTOCOMMIT setting"
if (self.autocommit is value):
return
val = ('on' if value else 'off')
cur = self.cursor()
cur.execute('SET SESSION AUTOCOMMIT TO {}'.format(val), use_prepared_statements=False)
cur.fetchall() | 1,149,883,264,255,221,600 | Change the connection's AUTOCOMMIT setting | vertica_python/vertica/connection.py | autocommit | uber/vertica-python | python | @autocommit.setter
def autocommit(self, value):
if (self.autocommit is value):
return
val = ('on' if value else 'off')
cur = self.cursor()
cur.execute('SET SESSION AUTOCOMMIT TO {}'.format(val), use_prepared_statements=False)
cur.fetchall() |
def cancel(self):
'Cancel the current database operation. This can be called from a\n different thread than the one currently executing a database operation.\n '
if self.closed():
raise errors.ConnectionError('Connection is closed')
self._logger.info('Canceling the current database ... | -2,056,104,082,724,521,700 | Cancel the current database operation. This can be called from a
different thread than the one currently executing a database operation. | vertica_python/vertica/connection.py | cancel | uber/vertica-python | python | def cancel(self):
'Cancel the current database operation. This can be called from a\n different thread than the one currently executing a database operation.\n '
if self.closed():
raise errors.ConnectionError('Connection is closed')
self._logger.info('Canceling the current database ... |
def create_socket(self, family):
'Create a TCP socket object'
raw_socket = socket.socket(family, socket.SOCK_STREAM)
raw_socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
connection_timeout = self.options.get('connection_timeout')
if (connection_timeout is not None):
self._logger.... | 6,969,502,913,483,730,000 | Create a TCP socket object | vertica_python/vertica/connection.py | create_socket | uber/vertica-python | python | def create_socket(self, family):
raw_socket = socket.socket(family, socket.SOCK_STREAM)
raw_socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
connection_timeout = self.options.get('connection_timeout')
if (connection_timeout is not None):
self._logger.debug('Set socket connection... |
def establish_socket_connection(self, address_list):
'Given a list of database node addresses, establish the socket\n connection to the database server. Return a connected socket object.\n '
addrinfo = address_list.peek()
raw_socket = None
last_exception = None
while addrinfo:
... | 3,240,512,285,882,664,000 | Given a list of database node addresses, establish the socket
connection to the database server. Return a connected socket object. | vertica_python/vertica/connection.py | establish_socket_connection | uber/vertica-python | python | def establish_socket_connection(self, address_list):
'Given a list of database node addresses, establish the socket\n connection to the database server. Return a connected socket object.\n '
addrinfo = address_list.peek()
raw_socket = None
last_exception = None
while addrinfo:
... |
def test_clone(self):
'Test cloning a Timestamp instance.'
t1 = Timestamp.utcnow()
t2 = t1.clone()
self.assertEqual(t1, t2)
self.assertIsInstance(t2, Timestamp) | -3,574,128,908,683,884,500 | Test cloning a Timestamp instance. | tests/timestamp_tests.py | test_clone | LeesahMasko/piwikibot | python | def test_clone(self):
t1 = Timestamp.utcnow()
t2 = t1.clone()
self.assertEqual(t1, t2)
self.assertIsInstance(t2, Timestamp) |
def test_instantiate_from_instance(self):
'Test passing instance to factory methods works.'
t1 = Timestamp.utcnow()
self.assertIsNot(t1, Timestamp.fromISOformat(t1))
self.assertEqual(t1, Timestamp.fromISOformat(t1))
self.assertIsInstance(Timestamp.fromISOformat(t1), Timestamp)
self.assertIsNot(t... | -5,481,197,439,969,814,000 | Test passing instance to factory methods works. | tests/timestamp_tests.py | test_instantiate_from_instance | LeesahMasko/piwikibot | python | def test_instantiate_from_instance(self):
t1 = Timestamp.utcnow()
self.assertIsNot(t1, Timestamp.fromISOformat(t1))
self.assertEqual(t1, Timestamp.fromISOformat(t1))
self.assertIsInstance(Timestamp.fromISOformat(t1), Timestamp)
self.assertIsNot(t1, Timestamp.fromtimestampformat(t1))
self.as... |
def test_iso_format(self):
'Test conversion from and to ISO format.'
sep = 'T'
t1 = Timestamp.utcnow()
if (not t1.microsecond):
t1 = t1.replace(microsecond=1)
ts1 = t1.isoformat()
t2 = Timestamp.fromISOformat(ts1)
ts2 = t2.isoformat()
self.assertNotEqual(t1, t2)
t1 = t1.repla... | -6,779,347,275,526,204,000 | Test conversion from and to ISO format. | tests/timestamp_tests.py | test_iso_format | LeesahMasko/piwikibot | python | def test_iso_format(self):
sep = 'T'
t1 = Timestamp.utcnow()
if (not t1.microsecond):
t1 = t1.replace(microsecond=1)
ts1 = t1.isoformat()
t2 = Timestamp.fromISOformat(ts1)
ts2 = t2.isoformat()
self.assertNotEqual(t1, t2)
t1 = t1.replace(microsecond=0)
self.assertEqual(t1... |
def test_iso_format_with_sep(self):
'Test conversion from and to ISO format with separator.'
sep = '*'
t1 = Timestamp.utcnow().replace(microsecond=0)
ts1 = t1.isoformat(sep=sep)
t2 = Timestamp.fromISOformat(ts1, sep=sep)
ts2 = t2.isoformat(sep=sep)
self.assertEqual(t1, t2)
self.assertEqu... | 5,182,066,370,592,766,000 | Test conversion from and to ISO format with separator. | tests/timestamp_tests.py | test_iso_format_with_sep | LeesahMasko/piwikibot | python | def test_iso_format_with_sep(self):
sep = '*'
t1 = Timestamp.utcnow().replace(microsecond=0)
ts1 = t1.isoformat(sep=sep)
t2 = Timestamp.fromISOformat(ts1, sep=sep)
ts2 = t2.isoformat(sep=sep)
self.assertEqual(t1, t2)
self.assertEqual(t1, t2)
self.assertEqual(ts1, ts2)
(date, sep... |
def test_iso_format_property(self):
'Test iso format properties.'
self.assertEqual(Timestamp.ISO8601Format, Timestamp._ISO8601Format())
self.assertEqual(re.sub('[\\-:TZ]', '', Timestamp.ISO8601Format), Timestamp.mediawikiTSFormat) | -4,886,496,288,491,828,000 | Test iso format properties. | tests/timestamp_tests.py | test_iso_format_property | LeesahMasko/piwikibot | python | def test_iso_format_property(self):
self.assertEqual(Timestamp.ISO8601Format, Timestamp._ISO8601Format())
self.assertEqual(re.sub('[\\-:TZ]', , Timestamp.ISO8601Format), Timestamp.mediawikiTSFormat) |
def test_mediawiki_format(self):
'Test conversion from and to Timestamp format.'
t1 = Timestamp.utcnow()
if (not t1.microsecond):
t1 = t1.replace(microsecond=1000)
ts1 = t1.totimestampformat()
t2 = Timestamp.fromtimestampformat(ts1)
ts2 = t2.totimestampformat()
self.assertNotEqual(t1... | 8,077,372,880,063,929,000 | Test conversion from and to Timestamp format. | tests/timestamp_tests.py | test_mediawiki_format | LeesahMasko/piwikibot | python | def test_mediawiki_format(self):
t1 = Timestamp.utcnow()
if (not t1.microsecond):
t1 = t1.replace(microsecond=1000)
ts1 = t1.totimestampformat()
t2 = Timestamp.fromtimestampformat(ts1)
ts2 = t2.totimestampformat()
self.assertNotEqual(t1, t2)
t1 = t1.replace(microsecond=0)
se... |
def test_short_mediawiki_format(self):
'Test short mw timestamp conversion from and to Timestamp format.'
t1 = Timestamp(2018, 12, 17)
t2 = Timestamp.fromtimestampformat('20181217')
ts1 = t1.totimestampformat()
ts2 = t2.totimestampformat()
self.assertEqual(t1, t2)
self.assertEqual(ts1, ts2) | -2,261,167,477,131,814,400 | Test short mw timestamp conversion from and to Timestamp format. | tests/timestamp_tests.py | test_short_mediawiki_format | LeesahMasko/piwikibot | python | def test_short_mediawiki_format(self):
t1 = Timestamp(2018, 12, 17)
t2 = Timestamp.fromtimestampformat('20181217')
ts1 = t1.totimestampformat()
ts2 = t2.totimestampformat()
self.assertEqual(t1, t2)
self.assertEqual(ts1, ts2) |
def test_add_timedelta(self):
'Test addin a timedelta to a Timestamp.'
t1 = Timestamp.utcnow()
t2 = (t1 + datetime.timedelta(days=1))
if (t1.month != t2.month):
self.assertEqual(1, t2.day)
else:
self.assertEqual((t1.day + 1), t2.day)
self.assertIsInstance(t2, Timestamp) | -8,972,745,366,684,781,000 | Test addin a timedelta to a Timestamp. | tests/timestamp_tests.py | test_add_timedelta | LeesahMasko/piwikibot | python | def test_add_timedelta(self):
t1 = Timestamp.utcnow()
t2 = (t1 + datetime.timedelta(days=1))
if (t1.month != t2.month):
self.assertEqual(1, t2.day)
else:
self.assertEqual((t1.day + 1), t2.day)
self.assertIsInstance(t2, Timestamp) |
def test_add_timedate(self):
'Test unsupported additions raise NotImplemented.'
t1 = datetime.datetime.utcnow()
t2 = (t1 + datetime.timedelta(days=1))
t3 = t1.__add__(t2)
self.assertIs(t3, NotImplemented)
t1 = Timestamp.utcnow()
t2 = (t1 + datetime.timedelta(days=1))
t3 = t1.__add__(t2)
... | 9,136,707,267,426,688,000 | Test unsupported additions raise NotImplemented. | tests/timestamp_tests.py | test_add_timedate | LeesahMasko/piwikibot | python | def test_add_timedate(self):
t1 = datetime.datetime.utcnow()
t2 = (t1 + datetime.timedelta(days=1))
t3 = t1.__add__(t2)
self.assertIs(t3, NotImplemented)
t1 = Timestamp.utcnow()
t2 = (t1 + datetime.timedelta(days=1))
t3 = t1.__add__(t2)
self.assertIs(t3, NotImplemented) |
def test_sub_timedelta(self):
'Test subtracting a timedelta from a Timestamp.'
t1 = Timestamp.utcnow()
t2 = (t1 - datetime.timedelta(days=1))
if (t1.month != t2.month):
self.assertEqual(calendar.monthrange(t2.year, t2.month)[1], t2.day)
else:
self.assertEqual((t1.day - 1), t2.day)
... | 3,450,087,203,098,203,600 | Test subtracting a timedelta from a Timestamp. | tests/timestamp_tests.py | test_sub_timedelta | LeesahMasko/piwikibot | python | def test_sub_timedelta(self):
t1 = Timestamp.utcnow()
t2 = (t1 - datetime.timedelta(days=1))
if (t1.month != t2.month):
self.assertEqual(calendar.monthrange(t2.year, t2.month)[1], t2.day)
else:
self.assertEqual((t1.day - 1), t2.day)
self.assertIsInstance(t2, Timestamp) |
def test_sub_timedate(self):
'Test subtracting two timestamps.'
t1 = Timestamp.utcnow()
t2 = (t1 - datetime.timedelta(days=1))
td = (t1 - t2)
self.assertIsInstance(td, datetime.timedelta)
self.assertEqual((t2 + td), t1) | -7,567,995,634,436,964,000 | Test subtracting two timestamps. | tests/timestamp_tests.py | test_sub_timedate | LeesahMasko/piwikibot | python | def test_sub_timedate(self):
t1 = Timestamp.utcnow()
t2 = (t1 - datetime.timedelta(days=1))
td = (t1 - t2)
self.assertIsInstance(td, datetime.timedelta)
self.assertEqual((t2 + td), t1) |
def __init__(self):
'\n initialize your data structure here.\n '
self.stack1 = []
self.stack2 = [] | 7,825,434,695,264,292,000 | initialize your data structure here. | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/155_Min_Stack.py | __init__ | Sycamore-City-passerby/ML | python | def __init__(self):
'\n \n '
self.stack1 = []
self.stack2 = [] |
def push(self, x):
'\n :type x: int\n :rtype: void\n '
self.stack1.append(x)
if ((len(self.stack2) == 0) or (x <= self.stack2[(- 1)])):
self.stack2.append(x) | -6,401,598,814,599,230,000 | :type x: int
:rtype: void | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/155_Min_Stack.py | push | Sycamore-City-passerby/ML | python | def push(self, x):
'\n :type x: int\n :rtype: void\n '
self.stack1.append(x)
if ((len(self.stack2) == 0) or (x <= self.stack2[(- 1)])):
self.stack2.append(x) |
def pop(self):
'\n :rtype: void\n '
top = self.stack1[(- 1)]
self.stack1.pop()
if (top == self.stack2[(- 1)]):
self.stack2.pop() | -8,236,398,851,309,514,000 | :rtype: void | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/155_Min_Stack.py | pop | Sycamore-City-passerby/ML | python | def pop(self):
'\n \n '
top = self.stack1[(- 1)]
self.stack1.pop()
if (top == self.stack2[(- 1)]):
self.stack2.pop() |
def top(self):
'\n :rtype: int\n '
return self.stack1[(- 1)] | 260,721,099,785,025,470 | :rtype: int | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/155_Min_Stack.py | top | Sycamore-City-passerby/ML | python | def top(self):
'\n \n '
return self.stack1[(- 1)] |
def getMin(self):
'\n :rtype: int\n '
return self.stack2[(- 1)] | -8,238,747,038,127,991,000 | :rtype: int | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/155_Min_Stack.py | getMin | Sycamore-City-passerby/ML | python | def getMin(self):
'\n \n '
return self.stack2[(- 1)] |
def get_drop_connect_rate(init_rate, block_num, total_blocks):
'Get drop connect rate for the ith block.'
if (init_rate is not None):
return ((init_rate * float(block_num)) / total_blocks)
else:
return None | 4,564,176,001,601,319,000 | Get drop connect rate for the ith block. | models/official/detection/modeling/architecture/resnet.py | get_drop_connect_rate | hoangphucITJP/tpu | python | def get_drop_connect_rate(init_rate, block_num, total_blocks):
if (init_rate is not None):
return ((init_rate * float(block_num)) / total_blocks)
else:
return None |
def block_group(inputs, filters, strides, use_projection, block_fn, block_repeats, batch_norm_relu=nn_ops.BatchNormRelu(), dropblock=nn_ops.Dropblock(), drop_connect_rate=None, data_format='channels_last', name=None, is_training=False):
"Builds one group of blocks.\n\n Args:\n inputs: a `Tensor` of size `[batch... | 3,270,517,964,845,363,700 | Builds one group of blocks.
Args:
inputs: a `Tensor` of size `[batch, channels, height, width]`.
filters: an `int` number of filters for the first two convolutions.
strides: an `int` block stride. If greater than 1, this block will
ultimately downsample the input.
use_projection: a `bool` for whether this ... | models/official/detection/modeling/architecture/resnet.py | block_group | hoangphucITJP/tpu | python | def block_group(inputs, filters, strides, use_projection, block_fn, block_repeats, batch_norm_relu=nn_ops.BatchNormRelu(), dropblock=nn_ops.Dropblock(), drop_connect_rate=None, data_format='channels_last', name=None, is_training=False):
"Builds one group of blocks.\n\n Args:\n inputs: a `Tensor` of size `[batch... |
def __init__(self, resnet_depth, dropblock=nn_ops.Dropblock(), batch_norm_relu=nn_ops.BatchNormRelu(), init_drop_connect_rate=None, data_format='channels_last'):
'ResNet initialization function.\n\n Args:\n resnet_depth: `int` depth of ResNet backbone model.\n dropblock: a dropblock layer.\n batch... | -516,347,992,290,980,400 | ResNet initialization function.
Args:
resnet_depth: `int` depth of ResNet backbone model.
dropblock: a dropblock layer.
batch_norm_relu: an operation that includes a batch normalization layer
followed by a relu layer(optional).
init_drop_connect_rate: a 'float' number that specifies the initial drop
co... | models/official/detection/modeling/architecture/resnet.py | __init__ | hoangphucITJP/tpu | python | def __init__(self, resnet_depth, dropblock=nn_ops.Dropblock(), batch_norm_relu=nn_ops.BatchNormRelu(), init_drop_connect_rate=None, data_format='channels_last'):
'ResNet initialization function.\n\n Args:\n resnet_depth: `int` depth of ResNet backbone model.\n dropblock: a dropblock layer.\n batch... |
def __call__(self, inputs, is_training=False):
'Returns the ResNet model for a given size and number of output classes.\n\n Args:\n inputs: a `Tesnor` with shape [batch_size, height, width, 3] representing\n a batch of images.\n is_training: `bool` if True, the model is in training mode.\n\n ... | -7,815,563,324,686,673,000 | Returns the ResNet model for a given size and number of output classes.
Args:
inputs: a `Tesnor` with shape [batch_size, height, width, 3] representing
a batch of images.
is_training: `bool` if True, the model is in training mode.
Returns:
a `dict` containing `int` keys for continuous feature levels [2, 3, ... | models/official/detection/modeling/architecture/resnet.py | __call__ | hoangphucITJP/tpu | python | def __call__(self, inputs, is_training=False):
'Returns the ResNet model for a given size and number of output classes.\n\n Args:\n inputs: a `Tesnor` with shape [batch_size, height, width, 3] representing\n a batch of images.\n is_training: `bool` if True, the model is in training mode.\n\n ... |
def resnet_v1_generator(self, block_fn, layers):
'Generator for ResNet v1 models.\n\n Args:\n block_fn: `function` for the block to use within the model. Either\n `residual_block` or `bottleneck_block`.\n layers: list of 4 `int`s denoting the number of blocks to include in each\n of the... | -2,155,756,164,103,213,800 | Generator for ResNet v1 models.
Args:
block_fn: `function` for the block to use within the model. Either
`residual_block` or `bottleneck_block`.
layers: list of 4 `int`s denoting the number of blocks to include in each
of the 4 block groups. Each group consists of blocks that take inputs of
the same ... | models/official/detection/modeling/architecture/resnet.py | resnet_v1_generator | hoangphucITJP/tpu | python | def resnet_v1_generator(self, block_fn, layers):
'Generator for ResNet v1 models.\n\n Args:\n block_fn: `function` for the block to use within the model. Either\n `residual_block` or `bottleneck_block`.\n layers: list of 4 `int`s denoting the number of blocks to include in each\n of the... |
def model(inputs, is_training=False):
'Creation of the model graph.'
inputs = nn_ops.conv2d_fixed_padding(inputs=inputs, filters=64, kernel_size=7, strides=2, data_format=self._data_format)
inputs = tf.identity(inputs, 'initial_conv')
inputs = self._batch_norm_relu(inputs, is_training=is_training)
i... | 2,307,457,148,709,569,500 | Creation of the model graph. | models/official/detection/modeling/architecture/resnet.py | model | hoangphucITJP/tpu | python | def model(inputs, is_training=False):
inputs = nn_ops.conv2d_fixed_padding(inputs=inputs, filters=64, kernel_size=7, strides=2, data_format=self._data_format)
inputs = tf.identity(inputs, 'initial_conv')
inputs = self._batch_norm_relu(inputs, is_training=is_training)
inputs = tf.layers.max_pooling2... |
def null_boolean_form_value(bool_value):
'\n Return the value for a NullBooleanSelect wigit based on bool_value\n '
return {True: '2', False: '3', None: '1'}.get(bool_value) | 3,008,597,734,390,281,000 | Return the value for a NullBooleanSelect wigit based on bool_value | utils/utils.py | null_boolean_form_value | tperrier/mwachx | python | def null_boolean_form_value(bool_value):
'\n \n '
return {True: '2', False: '3', None: '1'}.get(bool_value) |
def null_boolean_from_form(form_value):
'\n Return the boolean value based on a NullBooleanSelect form value\n '
return {'1': None, '2': True, '3': False}.get(form_value) | 4,283,649,419,290,576,400 | Return the boolean value based on a NullBooleanSelect form value | utils/utils.py | null_boolean_from_form | tperrier/mwachx | python | def null_boolean_from_form(form_value):
'\n \n '
return {'1': None, '2': True, '3': False}.get(form_value) |
def days_as_str(days):
' Return a short string version of days '
if ((- 7) <= days <= 7):
return '{:d}d'.format(days)
return '{:d}w'.format(int(round((days / 7.0)))) | 556,966,761,621,087,900 | Return a short string version of days | utils/utils.py | days_as_str | tperrier/mwachx | python | def days_as_str(days):
' '
if ((- 7) <= days <= 7):
return '{:d}d'.format(days)
return '{:d}w'.format(int(round((days / 7.0)))) |
def sqlite_date_diff(start_date, end_date, days=False):
' return a DjanoORM Expression for the number of seconds/days between start_date and end_data '
scale = (86400 if (days is False) else 1)
return db.ExpressionWrapper(((SQLiteDate(end_date) - SQLiteDate(start_date)) * scale), db.IntegerField()) | 3,487,949,514,431,362,600 | return a DjanoORM Expression for the number of seconds/days between start_date and end_data | utils/utils.py | sqlite_date_diff | tperrier/mwachx | python | def sqlite_date_diff(start_date, end_date, days=False):
' '
scale = (86400 if (days is False) else 1)
return db.ExpressionWrapper(((SQLiteDate(end_date) - SQLiteDate(start_date)) * scale), db.IntegerField()) |
def sql_count_when(*qargs, **kwargs):
' qargs : list of models.Q objects\n kwargs : filter_term=value dict\n '
condition = db.Q(**kwargs)
for q in qargs:
condition &= q
return db.Count(db.Case(db.When(condition, then=1), output_field=db.IntegerField())) | 686,636,396,861,094,700 | qargs : list of models.Q objects
kwargs : filter_term=value dict | utils/utils.py | sql_count_when | tperrier/mwachx | python | def sql_count_when(*qargs, **kwargs):
' qargs : list of models.Q objects\n kwargs : filter_term=value dict\n '
condition = db.Q(**kwargs)
for q in qargs:
condition &= q
return db.Count(db.Case(db.When(condition, then=1), output_field=db.IntegerField())) |
def make_policy(representation_dim: int, action_dim: int, distribution: str, hidden_dimensions: List[int], nonlinearity: str, num_components: Optional[int]=None, num_actions: Optional[int]=None, action_bound: Optional[float]=None, layernorm: bool=False, log_param_min: float=(- 5), log_param_max: float=2) -> Union[(Disc... | -2,696,701,415,997,946,400 | Constructs a policy network from a given config.
The following config keys need to be specified:
- "representation_dim": int
- "action_dim": int
- "distribution": str
- "num_components": int
- "action_bound": float
- "hidden_dimensions": List[int]
- "nonlinearity": str
- "layernorm": bo... | alphazero/network/policies.py | make_policy | timoklein/A0C | python | def make_policy(representation_dim: int, action_dim: int, distribution: str, hidden_dimensions: List[int], nonlinearity: str, num_components: Optional[int]=None, num_actions: Optional[int]=None, action_bound: Optional[float]=None, layernorm: bool=False, log_param_min: float=(- 5), log_param_max: float=2) -> Union[(Disc... |
def __repr__(self) -> str:
'\n Returns\n -------\n str\n String representation of this instance.\n '
components: int = getattr(self, 'num_components', 1)
return f'class={type(self).__name__}, distribution={self.distribution_type}, components={components}, state_dim={se... | 7,866,934,010,203,949,000 | Returns
-------
str
String representation of this instance. | alphazero/network/policies.py | __repr__ | timoklein/A0C | python | def __repr__(self) -> str:
'\n Returns\n -------\n str\n String representation of this instance.\n '
components: int = getattr(self, 'num_components', 1)
return f'class={type(self).__name__}, distribution={self.distribution_type}, components={components}, state_dim={se... |
def __repr__(self) -> str:
'\n Returns\n -------\n str\n String representation of this instance.\n '
return f'class={type(self).__name__}, distribution={self.distribution_type}, num_actions={self.num_actions}, state_dim={self.state_dim}, action_dim={self.action_dim}, hidde... | 5,086,200,092,164,458,000 | Returns
-------
str
String representation of this instance. | alphazero/network/policies.py | __repr__ | timoklein/A0C | python | def __repr__(self) -> str:
'\n Returns\n -------\n str\n String representation of this instance.\n '
return f'class={type(self).__name__}, distribution={self.distribution_type}, num_actions={self.num_actions}, state_dim={self.state_dim}, action_dim={self.action_dim}, hidde... |
def _get_dist_params(self, x: torch.Tensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tuple[torch.FloatTe... | 1,357,116,296,710,905,900 | Returns the learned paremters of the distribution.
Parameters
----------
x : torch.FloatTensor
Input state tensor.
Returns
-------
Tuple[torch.FloatTensor, torch.FloatTensor, torch.FloatTensor]
Distribution mean (mu), Distribution standard deviation (sigma), State value estimate (V_hat). | alphazero/network/policies.py | _get_dist_params | timoklein/A0C | python | def _get_dist_params(self, x: torch.Tensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tuple[torch.FloatTe... |
def forward(self, x: torch.FloatTensor) -> Tuple[(D.Categorical, torch.FloatTensor)]:
'Forward pass of the model.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tuple[Normallike, torch.FloatTensor]\n N... | -4,870,456,434,438,947,000 | Forward pass of the model.
Parameters
----------
x : torch.FloatTensor
Input state tensor.
Returns
-------
Tuple[Normallike, torch.FloatTensor]
Normal or squashed Normal distribution (dist), State value estimate (V_hat). | alphazero/network/policies.py | forward | timoklein/A0C | python | def forward(self, x: torch.FloatTensor) -> Tuple[(D.Categorical, torch.FloatTensor)]:
'Forward pass of the model.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tuple[Normallike, torch.FloatTensor]\n N... |
def forward(self, x: torch.FloatTensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tupl... | -357,320,804,641,296,960 | Returns the learned paremters of the distribution.
Parameters
----------
x : torch.FloatTensor
Input state tensor.
Returns
-------
Tuple[torch.FloatTensor, torch.FloatTensor, torch.FloatTensor]
Distribution mean (mu), Distribution standard deviation (sigma), State value estimate (V_hat). | alphazero/network/policies.py | forward | timoklein/A0C | python | def forward(self, x: torch.FloatTensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tupl... |
def forward(self, x: torch.FloatTensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor, torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n --... | -252,120,947,399,175,230 | Returns the learned paremters of the distribution.
Parameters
----------
x : torch.FloatTensor
Input state tensor.
Returns
-------
Tuple[torch.FloatTensor, torch.FloatTensor, torch.FloatTensor, torch.FloatTensor]
Distribution mean (mu), Distribution standard deviation (sigma),
Logits for the categorical d... | alphazero/network/policies.py | forward | timoklein/A0C | python | def forward(self, x: torch.FloatTensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor, torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n --... |
def forward(self, x: torch.FloatTensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tupl... | -6,677,820,801,602,087,000 | Returns the learned paremters of the distribution.
Parameters
----------
x : torch.FloatTensor
Input state tensor.
Returns
-------
Tuple[torch.FloatTensor, torch.FloatTensor, torch.FloatTensor]
Alpha parameter (alpha), Beta parameter (beta), State value estimate (V_hat). | alphazero/network/policies.py | forward | timoklein/A0C | python | def forward(self, x: torch.FloatTensor) -> Tuple[(torch.FloatTensor, torch.FloatTensor, torch.FloatTensor)]:
'Returns the learned paremters of the distribution.\n\n Parameters\n ----------\n x : torch.FloatTensor\n Input state tensor.\n\n Returns\n -------\n Tupl... |
def register(cls):
'\n A decorator to register new table configuration classes.\n '
TABLE_LIST.append(cls)
return cls | -7,601,627,589,921,386,000 | A decorator to register new table configuration classes. | census_data_downloader/core/decorators.py | register | JoeGermuska/census-data-downloader | python | def register(cls):
'\n \n '
TABLE_LIST.append(cls)
return cls |
def downloader(func):
'\n A decorator to download data inside a table configuration class.\n '
def inner(*args, **kwargs):
table_config = args[0]
downloader_klass = func(table_config)
for year in table_config.years_to_download:
downloader = downloader_klass(table_confi... | 2,947,467,455,539,673,000 | A decorator to download data inside a table configuration class. | census_data_downloader/core/decorators.py | downloader | JoeGermuska/census-data-downloader | python | def downloader(func):
'\n \n '
def inner(*args, **kwargs):
table_config = args[0]
downloader_klass = func(table_config)
for year in table_config.years_to_download:
downloader = downloader_klass(table_config, year)
downloader.download()
downloade... |
def __init__(self):
'Sets test framework defaults. Do not override this method. Instead, override the set_test_params() method'
self.setup_clean_chain = False
self.nodes = []
self.mocktime = 0
self.rpc_timewait = 600
self.supports_cli = False
self.set_test_params()
assert hasattr(self, '... | 4,240,132,569,780,004,000 | Sets test framework defaults. Do not override this method. Instead, override the set_test_params() method | test/functional/test_framework/test_framework.py | __init__ | THYMESIA-SECURITIES/T-Notes | python | def __init__(self):
self.setup_clean_chain = False
self.nodes = []
self.mocktime = 0
self.rpc_timewait = 600
self.supports_cli = False
self.set_test_params()
assert hasattr(self, 'num_nodes'), 'Test must set self.num_nodes in set_test_params()' |
def main(self):
'Main function. This should not be overridden by the subclass test scripts.'
parser = optparse.OptionParser(usage='%prog [options]')
parser.add_option('--nocleanup', dest='nocleanup', default=False, action='store_true', help='Leave t_notesds and test.* datadir on exit or error')
parser.a... | 2,440,348,207,718,470,700 | Main function. This should not be overridden by the subclass test scripts. | test/functional/test_framework/test_framework.py | main | THYMESIA-SECURITIES/T-Notes | python | def main(self):
parser = optparse.OptionParser(usage='%prog [options]')
parser.add_option('--nocleanup', dest='nocleanup', default=False, action='store_true', help='Leave t_notesds and test.* datadir on exit or error')
parser.add_option('--noshutdown', dest='noshutdown', default=False, action='store_tr... |
def set_test_params(self):
'Tests must this method to change default values for number of nodes, topology, etc'
raise NotImplementedError | -2,804,650,915,158,870,000 | Tests must this method to change default values for number of nodes, topology, etc | test/functional/test_framework/test_framework.py | set_test_params | THYMESIA-SECURITIES/T-Notes | python | def set_test_params(self):
raise NotImplementedError |
def add_options(self, parser):
'Override this method to add command-line options to the test'
pass | 5,143,883,123,028,089,000 | Override this method to add command-line options to the test | test/functional/test_framework/test_framework.py | add_options | THYMESIA-SECURITIES/T-Notes | python | def add_options(self, parser):
pass |
def setup_chain(self):
'Override this method to customize blockchain setup'
self.log.info(('Initializing test directory ' + self.options.tmpdir))
if self.setup_clean_chain:
self._initialize_chain_clean()
else:
self._initialize_chain() | 8,333,220,049,645,672,000 | Override this method to customize blockchain setup | test/functional/test_framework/test_framework.py | setup_chain | THYMESIA-SECURITIES/T-Notes | python | def setup_chain(self):
self.log.info(('Initializing test directory ' + self.options.tmpdir))
if self.setup_clean_chain:
self._initialize_chain_clean()
else:
self._initialize_chain() |
def setup_network(self):
'Override this method to customize test network topology'
self.setup_nodes()
for i in range((self.num_nodes - 1)):
connect_nodes(self.nodes[(i + 1)], i)
self.sync_all() | 3,102,635,630,890,468,400 | Override this method to customize test network topology | test/functional/test_framework/test_framework.py | setup_network | THYMESIA-SECURITIES/T-Notes | python | def setup_network(self):
self.setup_nodes()
for i in range((self.num_nodes - 1)):
connect_nodes(self.nodes[(i + 1)], i)
self.sync_all() |
def setup_nodes(self):
'Override this method to customize test node setup'
extra_args = None
if hasattr(self, 'extra_args'):
extra_args = self.extra_args
self.add_nodes(self.num_nodes, extra_args)
self.start_nodes() | -4,141,827,770,806,860,000 | Override this method to customize test node setup | test/functional/test_framework/test_framework.py | setup_nodes | THYMESIA-SECURITIES/T-Notes | python | def setup_nodes(self):
extra_args = None
if hasattr(self, 'extra_args'):
extra_args = self.extra_args
self.add_nodes(self.num_nodes, extra_args)
self.start_nodes() |
def run_test(self):
'Tests must override this method to define test logic'
raise NotImplementedError | 1,254,020,197,943,498,200 | Tests must override this method to define test logic | test/functional/test_framework/test_framework.py | run_test | THYMESIA-SECURITIES/T-Notes | python | def run_test(self):
raise NotImplementedError |
def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None):
'Instantiate TestNode objects'
if (extra_args is None):
extra_args = ([[]] * num_nodes)
if self.options.legacywallet:
for arg in extra_args:
arg.append('-legacywallet')
self.log.info('Running t... | -513,096,944,268,560,830 | Instantiate TestNode objects | test/functional/test_framework/test_framework.py | add_nodes | THYMESIA-SECURITIES/T-Notes | python | def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None):
if (extra_args is None):
extra_args = ([[]] * num_nodes)
if self.options.legacywallet:
for arg in extra_args:
arg.append('-legacywallet')
self.log.info('Running test with legacy (pre-HD) walle... |
def start_node(self, i, *args, **kwargs):
'Start a t_notesd'
node = self.nodes[i]
node.start(*args, **kwargs)
node.wait_for_rpc_connection()
time.sleep(10)
if (self.options.coveragedir is not None):
coverage.write_all_rpc_commands(self.options.coveragedir, node.rpc) | -3,549,843,185,344,423,400 | Start a t_notesd | test/functional/test_framework/test_framework.py | start_node | THYMESIA-SECURITIES/T-Notes | python | def start_node(self, i, *args, **kwargs):
node = self.nodes[i]
node.start(*args, **kwargs)
node.wait_for_rpc_connection()
time.sleep(10)
if (self.options.coveragedir is not None):
coverage.write_all_rpc_commands(self.options.coveragedir, node.rpc) |
def start_nodes(self, extra_args=None, *args, **kwargs):
'Start multiple t_notesds'
if (extra_args is None):
extra_args = ([None] * self.num_nodes)
assert_equal(len(extra_args), self.num_nodes)
try:
for (i, node) in enumerate(self.nodes):
node.start(extra_args[i], *args, **kw... | 3,588,767,066,100,310,000 | Start multiple t_notesds | test/functional/test_framework/test_framework.py | start_nodes | THYMESIA-SECURITIES/T-Notes | python | def start_nodes(self, extra_args=None, *args, **kwargs):
if (extra_args is None):
extra_args = ([None] * self.num_nodes)
assert_equal(len(extra_args), self.num_nodes)
try:
for (i, node) in enumerate(self.nodes):
node.start(extra_args[i], *args, **kwargs)
for node in ... |
def stop_node(self, i):
'Stop a t_notesd test node'
self.nodes[i].stop_node()
self.nodes[i].wait_until_stopped() | 2,822,523,695,218,503,700 | Stop a t_notesd test node | test/functional/test_framework/test_framework.py | stop_node | THYMESIA-SECURITIES/T-Notes | python | def stop_node(self, i):
self.nodes[i].stop_node()
self.nodes[i].wait_until_stopped() |
def stop_nodes(self):
'Stop multiple t_notesd test nodes'
for node in self.nodes:
node.stop_node()
for node in self.nodes:
time.sleep(5)
node.wait_until_stopped() | -3,249,961,233,590,234,600 | Stop multiple t_notesd test nodes | test/functional/test_framework/test_framework.py | stop_nodes | THYMESIA-SECURITIES/T-Notes | python | def stop_nodes(self):
for node in self.nodes:
node.stop_node()
for node in self.nodes:
time.sleep(5)
node.wait_until_stopped() |
def restart_node(self, i, extra_args=None):
'Stop and start a test node'
self.stop_node(i)
self.start_node(i, extra_args) | -9,179,066,947,174,348 | Stop and start a test node | test/functional/test_framework/test_framework.py | restart_node | THYMESIA-SECURITIES/T-Notes | python | def restart_node(self, i, extra_args=None):
self.stop_node(i)
self.start_node(i, extra_args) |
def split_network(self):
'\n Split the network of four nodes into nodes 0/1 and 2/3.\n '
disconnect_nodes(self.nodes[1], 2)
disconnect_nodes(self.nodes[2], 1)
self.sync_all(self.nodes[:2])
self.sync_all(self.nodes[2:]) | -3,659,264,479,422,162,000 | Split the network of four nodes into nodes 0/1 and 2/3. | test/functional/test_framework/test_framework.py | split_network | THYMESIA-SECURITIES/T-Notes | python | def split_network(self):
'\n \n '
disconnect_nodes(self.nodes[1], 2)
disconnect_nodes(self.nodes[2], 1)
self.sync_all(self.nodes[:2])
self.sync_all(self.nodes[2:]) |
def join_network(self):
'\n Join the (previously split) network halves together.\n '
connect_nodes(self.nodes[1], 2)
self.sync_all() | 7,109,203,827,622,544,000 | Join the (previously split) network halves together. | test/functional/test_framework/test_framework.py | join_network | THYMESIA-SECURITIES/T-Notes | python | def join_network(self):
'\n \n '
connect_nodes(self.nodes[1], 2)
self.sync_all() |
def sync_blocks(self, nodes=None, wait=1, timeout=60):
"\n Wait until everybody has the same tip.\n sync_blocks needs to be called with an rpc_connections set that has least\n one node already synced to the latest, stable tip, otherwise there's a\n chance it might return before all nodes... | 7,808,380,102,412,062,000 | Wait until everybody has the same tip.
sync_blocks needs to be called with an rpc_connections set that has least
one node already synced to the latest, stable tip, otherwise there's a
chance it might return before all nodes are stably synced. | test/functional/test_framework/test_framework.py | sync_blocks | THYMESIA-SECURITIES/T-Notes | python | def sync_blocks(self, nodes=None, wait=1, timeout=60):
"\n Wait until everybody has the same tip.\n sync_blocks needs to be called with an rpc_connections set that has least\n one node already synced to the latest, stable tip, otherwise there's a\n chance it might return before all nodes... |
def sync_mempools(self, nodes=None, wait=1, timeout=60, flush_scheduler=True):
'\n Wait until everybody has the same transactions in their memory\n pools\n '
rpc_connections = (nodes or self.nodes)
stop_time = (time.time() + timeout)
while (time.time() <= stop_time):
pool = ... | 1,533,758,400,024,637,700 | Wait until everybody has the same transactions in their memory
pools | test/functional/test_framework/test_framework.py | sync_mempools | THYMESIA-SECURITIES/T-Notes | python | def sync_mempools(self, nodes=None, wait=1, timeout=60, flush_scheduler=True):
'\n Wait until everybody has the same transactions in their memory\n pools\n '
rpc_connections = (nodes or self.nodes)
stop_time = (time.time() + timeout)
while (time.time() <= stop_time):
pool = ... |
def enable_mocktime(self):
'Enable mocktime for the script.\n\n mocktime may be needed for scripts that use the cached version of the\n blockchain. If the cached version of the blockchain is used without\n mocktime then the mempools will not sync due to IBD.\n\n Sets mocktime to Tuesday... | 2,325,546,710,299,151,000 | Enable mocktime for the script.
mocktime may be needed for scripts that use the cached version of the
blockchain. If the cached version of the blockchain is used without
mocktime then the mempools will not sync due to IBD.
Sets mocktime to Tuesday, October 31, 2017 6:21:20 PM GMT (1572546080) | test/functional/test_framework/test_framework.py | enable_mocktime | THYMESIA-SECURITIES/T-Notes | python | def enable_mocktime(self):
'Enable mocktime for the script.\n\n mocktime may be needed for scripts that use the cached version of the\n blockchain. If the cached version of the blockchain is used without\n mocktime then the mempools will not sync due to IBD.\n\n Sets mocktime to Tuesday... |
def _initialize_chain(self):
'Initialize a pre-mined blockchain for use by the test.'
def create_cachedir(cachedir):
if os.path.isdir(cachedir):
shutil.rmtree(cachedir)
os.makedirs(cachedir)
def copy_cachedir(origin, destination, num_nodes=MAX_NODES):
for i in range(num... | -4,283,486,815,522,228,000 | Initialize a pre-mined blockchain for use by the test. | test/functional/test_framework/test_framework.py | _initialize_chain | THYMESIA-SECURITIES/T-Notes | python | def _initialize_chain(self):
def create_cachedir(cachedir):
if os.path.isdir(cachedir):
shutil.rmtree(cachedir)
os.makedirs(cachedir)
def copy_cachedir(origin, destination, num_nodes=MAX_NODES):
for i in range(num_nodes):
from_dir = get_datadir_path(origin,... |
def _initialize_chain_clean(self):
'Initialize empty blockchain for use by the test.\n\n Create an empty blockchain and num_nodes wallets.\n Useful if a test case wants complete control over initialization.'
for i in range(self.num_nodes):
initialize_datadir(self.options.tmpdir, i) | 755,699,836,406,072,200 | Initialize empty blockchain for use by the test.
Create an empty blockchain and num_nodes wallets.
Useful if a test case wants complete control over initialization. | test/functional/test_framework/test_framework.py | _initialize_chain_clean | THYMESIA-SECURITIES/T-Notes | python | def _initialize_chain_clean(self):
'Initialize empty blockchain for use by the test.\n\n Create an empty blockchain and num_nodes wallets.\n Useful if a test case wants complete control over initialization.'
for i in range(self.num_nodes):
initialize_datadir(self.options.tmpdir, i) |
def get_prevouts(self, node_id, utxo_list):
' get prevouts (map) for each utxo in a list\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxos.\n utxo_list: (JSON list) utxos returned from listunspent used as input\n :return: prevou... | 6,947,453,711,636,926,000 | get prevouts (map) for each utxo in a list
:param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxos.
utxo_list: (JSON list) utxos returned from listunspent used as input
:return: prevouts: ({bytes --> (int, bytes, int)} dictionary)
... | test/functional/test_framework/test_framework.py | get_prevouts | THYMESIA-SECURITIES/T-Notes | python | def get_prevouts(self, node_id, utxo_list):
' get prevouts (map) for each utxo in a list\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxos.\n utxo_list: (JSON list) utxos returned from listunspent used as input\n :return: prevou... |
def make_txes(self, node_id, spendingPrevOuts, to_pubKey):
' makes a list of CTransactions each spending an input from spending PrevOuts to an output to_pubKey\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own spendingPrevOuts.\n spendingPrevouts: ... | -2,396,199,439,492,914,000 | makes a list of CTransactions each spending an input from spending PrevOuts to an output to_pubKey
:param node_id: (int) index of the CTestNode used as rpc connection. Must own spendingPrevOuts.
spendingPrevouts: ({bytes --> (int, bytes, int)} dictionary)
maps CStake... | test/functional/test_framework/test_framework.py | make_txes | THYMESIA-SECURITIES/T-Notes | python | def make_txes(self, node_id, spendingPrevOuts, to_pubKey):
' makes a list of CTransactions each spending an input from spending PrevOuts to an output to_pubKey\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own spendingPrevOuts.\n spendingPrevouts: ... |
def stake_block(self, node_id, nVersion, nHeight, prevHash, prevModifier, finalsaplingroot, stakeableUtxos, startTime, privKeyWIF, vtx, fDoubleSpend):
' manually stakes a block selecting the coinstake input from a list of candidates\n :param node_id: (int) index of the CTestNode used as rpc conne... | 178,559,729,814,218,200 | manually stakes a block selecting the coinstake input from a list of candidates
:param node_id: (int) index of the CTestNode used as rpc connection. Must own stakeableUtxos.
nVersion: (int) version of the block being produced (7 or 8)
nHeight: (int) height of the block b... | test/functional/test_framework/test_framework.py | stake_block | THYMESIA-SECURITIES/T-Notes | python | def stake_block(self, node_id, nVersion, nHeight, prevHash, prevModifier, finalsaplingroot, stakeableUtxos, startTime, privKeyWIF, vtx, fDoubleSpend):
' manually stakes a block selecting the coinstake input from a list of candidates\n :param node_id: (int) index of the CTestNode used as rpc conne... |
def stake_next_block(self, node_id, stakeableUtxos, btime=None, privKeyWIF=None, vtx=[], fDoubleSpend=False):
' Calls stake_block appending to the current tip'
assert_greater_than(len(self.nodes), node_id)
saplingActive = (self.nodes[node_id].getblockchaininfo()['upgrades']['v5 shield']['status'] == 'active... | -4,526,642,527,111,188,500 | Calls stake_block appending to the current tip | test/functional/test_framework/test_framework.py | stake_next_block | THYMESIA-SECURITIES/T-Notes | python | def stake_next_block(self, node_id, stakeableUtxos, btime=None, privKeyWIF=None, vtx=[], fDoubleSpend=False):
' '
assert_greater_than(len(self.nodes), node_id)
saplingActive = (self.nodes[node_id].getblockchaininfo()['upgrades']['v5 shield']['status'] == 'active')
blockVersion = (8 if saplingActive else... |
def spend_inputs(self, node_id, inputs, outputs):
' auxiliary function used by spend_utxo / spend_utxos '
assert_greater_than(len(self.nodes), node_id)
rpc_conn = self.nodes[node_id]
spendingTx = rpc_conn.createrawtransaction(inputs, outputs)
spendingTx_signed = rpc_conn.signrawtransaction(spendingT... | -3,138,092,644,918,846,000 | auxiliary function used by spend_utxo / spend_utxos | test/functional/test_framework/test_framework.py | spend_inputs | THYMESIA-SECURITIES/T-Notes | python | def spend_inputs(self, node_id, inputs, outputs):
' '
assert_greater_than(len(self.nodes), node_id)
rpc_conn = self.nodes[node_id]
spendingTx = rpc_conn.createrawtransaction(inputs, outputs)
spendingTx_signed = rpc_conn.signrawtransaction(spendingTx)
if spendingTx_signed['complete']:
tx... |
def spend_utxo(self, node_id, utxo, recipient=''):
' spend amount from previously unspent output to a provided address\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxo.\n utxo: (JSON) returned from listunspent used as input\n ... | 7,583,722,645,633,327,000 | spend amount from previously unspent output to a provided address
:param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxo.
utxo: (JSON) returned from listunspent used as input
recipient: (string) destination address (new one if not provided)
:return: txha... | test/functional/test_framework/test_framework.py | spend_utxo | THYMESIA-SECURITIES/T-Notes | python | def spend_utxo(self, node_id, utxo, recipient=):
' spend amount from previously unspent output to a provided address\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxo.\n utxo: (JSON) returned from listunspent used as input\n ... |
def spend_utxos(self, node_id, utxo_list, recipient='', fMultiple=False):
' spend utxos to provided list of addresses or 10 new generate ones.\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxo.\n utxo_list: (JSON list) returned from listunspent... | -5,674,369,076,897,975,000 | spend utxos to provided list of addresses or 10 new generate ones.
:param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxo.
utxo_list: (JSON list) returned from listunspent used as input
recipient: (string, optional) destination address (new one if not provi... | test/functional/test_framework/test_framework.py | spend_utxos | THYMESIA-SECURITIES/T-Notes | python | def spend_utxos(self, node_id, utxo_list, recipient=, fMultiple=False):
' spend utxos to provided list of addresses or 10 new generate ones.\n :param node_id: (int) index of the CTestNode used as rpc connection. Must own the utxo.\n utxo_list: (JSON list) returned from listunspent u... |
def generate_pos(self, node_id, btime=None):
' stakes a block using generate on nodes[node_id]'
assert_greater_than(len(self.nodes), node_id)
rpc_conn = self.nodes[node_id]
ss = rpc_conn.getstakingstatus()
assert ss['walletunlocked']
assert (ss['stakeablecoins'] > 0)
assert (ss['stakingbalan... | 7,975,874,726,591,192,000 | stakes a block using generate on nodes[node_id] | test/functional/test_framework/test_framework.py | generate_pos | THYMESIA-SECURITIES/T-Notes | python | def generate_pos(self, node_id, btime=None):
' '
assert_greater_than(len(self.nodes), node_id)
rpc_conn = self.nodes[node_id]
ss = rpc_conn.getstakingstatus()
assert ss['walletunlocked']
assert (ss['stakeablecoins'] > 0)
assert (ss['stakingbalance'] > 0.0)
if (btime is not None):
... |
def generate_pow(self, node_id, btime=None):
' stakes a block using generate on nodes[node_id]'
assert_greater_than(len(self.nodes), node_id)
self.nodes[node_id].generate(1)
if (btime is not None):
btime += 60
set_node_times(self.nodes, btime)
return btime | 8,197,249,247,907,530,000 | stakes a block using generate on nodes[node_id] | test/functional/test_framework/test_framework.py | generate_pow | THYMESIA-SECURITIES/T-Notes | python | def generate_pow(self, node_id, btime=None):
' '
assert_greater_than(len(self.nodes), node_id)
self.nodes[node_id].generate(1)
if (btime is not None):
btime += 60
set_node_times(self.nodes, btime)
return btime |
def clone_cache_from_node_1(cachedir, from_num=4):
" Clones cache subdir from node 1 to nodes from 'from_num' to MAX_NODES"
def copy_and_overwrite(from_path, to_path):
if os.path.exists(to_path):
shutil.rmtree(to_path)
shutil.copytree(from_path, to_path)
assert (from_num < MAX_N... | 1,864,112,916,403,433,500 | Clones cache subdir from node 1 to nodes from 'from_num' to MAX_NODES | test/functional/test_framework/test_framework.py | clone_cache_from_node_1 | THYMESIA-SECURITIES/T-Notes | python | def clone_cache_from_node_1(cachedir, from_num=4):
" "
def copy_and_overwrite(from_path, to_path):
if os.path.exists(to_path):
shutil.rmtree(to_path)
shutil.copytree(from_path, to_path)
assert (from_num < MAX_NODES)
node_0_datadir = os.path.join(get_datadir_path(cachedir, 0)... |
def evaluate(self, environment=None):
'Evaluate a marker.\n\n Return the boolean from evaluating the given marker against the\n environment. environment is an optional argument to override all or\n part of the determined environment.\n\n The environment is determined from the current Pyt... | 5,745,510,292,428,242,000 | Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Python process. | env/env/lib/python3.6/site-packages/setuptools/_vendor/packaging/markers.py | evaluate | Aimee-pacy/NEWS | python | def evaluate(self, environment=None):
'Evaluate a marker.\n\n Return the boolean from evaluating the given marker against the\n environment. environment is an optional argument to override all or\n part of the determined environment.\n\n The environment is determined from the current Pyt... |
def __init__(self):
'\n\t\tAttributes:\n\t\t\tdata (arr): data stored in the stack\n\t\t\tminimum (arr): minimum values of data stored\n\t\t'
self.data = []
self.minimum = [] | 4,827,408,123,394,649,000 | Attributes:
data (arr): data stored in the stack
minimum (arr): minimum values of data stored | libalgs-py/data_structures/min_stack.py | __init__ | tdudz/libalgs-py | python | def __init__(self):
'\n\t\tAttributes:\n\t\t\tdata (arr): data stored in the stack\n\t\t\tminimum (arr): minimum values of data stored\n\t\t'
self.data = []
self.minimum = [] |
def empty(self):
'\n\t\tReturns whether or not the stack is empty.\n\n\t\tTime Complexity: O(1)\n\t\t\n\t\tReturns:\n\t\t\tbool: whether or not the stack is empty\n\t\t'
return (len(self.data) == 0) | -1,267,916,980,869,920,500 | Returns whether or not the stack is empty.
Time Complexity: O(1)
Returns:
bool: whether or not the stack is empty | libalgs-py/data_structures/min_stack.py | empty | tdudz/libalgs-py | python | def empty(self):
'\n\t\tReturns whether or not the stack is empty.\n\n\t\tTime Complexity: O(1)\n\t\t\n\t\tReturns:\n\t\t\tbool: whether or not the stack is empty\n\t\t'
return (len(self.data) == 0) |
def push(self, x):
'\n\t\tPushes an element onto the stack.\n\n\t\tTime Complexity: O(1)\n\n\t\tArgs:\n\t\t\tx: item to be added\n\t\t'
self.data.append(x)
if ((not self.minimum) or (x <= self.minimum[(- 1)])):
self.minimum.append(x) | -2,443,692,277,918,272,000 | Pushes an element onto the stack.
Time Complexity: O(1)
Args:
x: item to be added | libalgs-py/data_structures/min_stack.py | push | tdudz/libalgs-py | python | def push(self, x):
'\n\t\tPushes an element onto the stack.\n\n\t\tTime Complexity: O(1)\n\n\t\tArgs:\n\t\t\tx: item to be added\n\t\t'
self.data.append(x)
if ((not self.minimum) or (x <= self.minimum[(- 1)])):
self.minimum.append(x) |
def pop(self):
'\n\t\tPops an element off the stack. \n\n\t\tTime Complexity: O(1)\n\n\t\tReturns:\n\t\t\tany: the last element on the stack\n\n\t\t'
x = self.data.pop()
if (x == self.minimum[(- 1)]):
self.minimum.pop()
return x | -6,070,208,603,326,677,000 | Pops an element off the stack.
Time Complexity: O(1)
Returns:
any: the last element on the stack | libalgs-py/data_structures/min_stack.py | pop | tdudz/libalgs-py | python | def pop(self):
'\n\t\tPops an element off the stack. \n\n\t\tTime Complexity: O(1)\n\n\t\tReturns:\n\t\t\tany: the last element on the stack\n\n\t\t'
x = self.data.pop()
if (x == self.minimum[(- 1)]):
self.minimum.pop()
return x |
def peek(self):
"\n\t\tReturns the last item on the stack but doesn't remove it.\n\n\t\tTime Complexity: O(1)\n\n\t\t"
return self.data[(- 1)] | -7,414,183,826,497,071,000 | Returns the last item on the stack but doesn't remove it.
Time Complexity: O(1) | libalgs-py/data_structures/min_stack.py | peek | tdudz/libalgs-py | python | def peek(self):
"\n\t\tReturns the last item on the stack but doesn't remove it.\n\n\t\tTime Complexity: O(1)\n\n\t\t"
return self.data[(- 1)] |
def peek_min(self):
"\n\t\tReturns the min on the stack but doesn't remove it.\n\n\t\tTime Complexity: O(1)\n\n\t\t"
return self.minimum[(- 1)] | 1,568,990,182,936,538,000 | Returns the min on the stack but doesn't remove it.
Time Complexity: O(1) | libalgs-py/data_structures/min_stack.py | peek_min | tdudz/libalgs-py | python | def peek_min(self):
"\n\t\tReturns the min on the stack but doesn't remove it.\n\n\t\tTime Complexity: O(1)\n\n\t\t"
return self.minimum[(- 1)] |
def _send_request(self, http_request, **kwargs):
"Runs the network request through the client's chained policies.\n\n :param http_request: The network request you want to make. Required.\n :type http_request: ~azure.core.pipeline.transport.HttpRequest\n :keyword bool stream: Whether the respons... | 9,055,639,993,187,902,000 | Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your networ... | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py | _send_request | AFengKK/azure-sdk-for-python | python | def _send_request(self, http_request, **kwargs):
"Runs the network request through the client's chained policies.\n\n :param http_request: The network request you want to make. Required.\n :type http_request: ~azure.core.pipeline.transport.HttpRequest\n :keyword bool stream: Whether the respons... |
def filterGaussian(img, size=(5, 5), stdv=0):
'Summary of filterGaussian\n This will apply a noise reduction filter, we will use s 5x5 Gaussian filter to smooth\n the image to lower the sensitivity to noise. (The smaller the size the less visible the blur)\n\n To populate the Gaussian matrix we will us... | 1,231,359,395,927,140,900 | Summary of filterGaussian
This will apply a noise reduction filter, we will use s 5x5 Gaussian filter to smooth
the image to lower the sensitivity to noise. (The smaller the size the less visible the blur)
To populate the Gaussian matrix we will use a kernel of normally distributed[stdv=1] numbers which will
s... | CarlaDriving/server/lane_detection/utils.py | filterGaussian | eamorgado/Car-Self-driving-Simulator | python | def filterGaussian(img, size=(5, 5), stdv=0):
'Summary of filterGaussian\n This will apply a noise reduction filter, we will use s 5x5 Gaussian filter to smooth\n the image to lower the sensitivity to noise. (The smaller the size the less visible the blur)\n\n To populate the Gaussian matrix we will us... |
def filterCanny(img, min_val=50, max_val=150, size=(5, 5), stdv=0):
'\n The Canny detector is a multi-stage algorithm optimized for fast real-time edge detection, \n which will reduce complexity of the image much further.\n\n The algorithm will detect sharp changes in luminosity and will define them as... | 7,903,466,607,846,601,000 | The Canny detector is a multi-stage algorithm optimized for fast real-time edge detection,
which will reduce complexity of the image much further.
The algorithm will detect sharp changes in luminosity and will define them as edges.
The algorithm has the following stages:
- Noise reduction
- Intensity... | CarlaDriving/server/lane_detection/utils.py | filterCanny | eamorgado/Car-Self-driving-Simulator | python | def filterCanny(img, min_val=50, max_val=150, size=(5, 5), stdv=0):
'\n The Canny detector is a multi-stage algorithm optimized for fast real-time edge detection, \n which will reduce complexity of the image much further.\n\n The algorithm will detect sharp changes in luminosity and will define them as... |
def houghFilter(frame, distance_resolution=2, angle_resolution=(np.pi / 180), min_n_intersections=50, min_line_size=30, max_line_gap=5):
'\n Params:\n frame\n distance_resolution: distance resolution of accumulator in pixels, larger ==> less precision\n angle_resolution: angle of accumu... | 1,376,053,570,479,431,000 | Params:
frame
distance_resolution: distance resolution of accumulator in pixels, larger ==> less precision
angle_resolution: angle of accumulator in radians, larger ==> less precision
min_n_intersections: minimum number of intersections
min_line_size: minimum length of line in pixels
max_l... | CarlaDriving/server/lane_detection/utils.py | houghFilter | eamorgado/Car-Self-driving-Simulator | python | def houghFilter(frame, distance_resolution=2, angle_resolution=(np.pi / 180), min_n_intersections=50, min_line_size=30, max_line_gap=5):
'\n Params:\n frame\n distance_resolution: distance resolution of accumulator in pixels, larger ==> less precision\n angle_resolution: angle of accumu... |
def calculateLines(img, lines):
'\n Combines line segments into one or two lanes\n Note: By looking at the slop of a line we can see if it is on the left side (m<0) or right (m>0)\n '
def calculateCoordinates(img, line_params):
'\n Calculates the coordinates for a road lane\n '
... | 2,188,310,605,139,995,400 | Combines line segments into one or two lanes
Note: By looking at the slop of a line we can see if it is on the left side (m<0) or right (m>0) | CarlaDriving/server/lane_detection/utils.py | calculateLines | eamorgado/Car-Self-driving-Simulator | python | def calculateLines(img, lines):
'\n Combines line segments into one or two lanes\n Note: By looking at the slop of a line we can see if it is on the left side (m<0) or right (m>0)\n '
def calculateCoordinates(img, line_params):
'\n Calculates the coordinates for a road lane\n '
... |
def stabilizeSteeringAngle(curr_steering_angle, new_steering_angle, num_of_lane_lines, max_angle_deviation_two_lines=2, max_angle_deviation_one_lane=1):
'\n Using last steering angle to stabilize the steering angle\n This can be improved to use last N angles, etc\n if new angle is too different from curren... | -520,693,664,504,330,800 | Using last steering angle to stabilize the steering angle
This can be improved to use last N angles, etc
if new angle is too different from current angle, only turn by max_angle_deviation degrees | CarlaDriving/server/lane_detection/utils.py | stabilizeSteeringAngle | eamorgado/Car-Self-driving-Simulator | python | def stabilizeSteeringAngle(curr_steering_angle, new_steering_angle, num_of_lane_lines, max_angle_deviation_two_lines=2, max_angle_deviation_one_lane=1):
'\n Using last steering angle to stabilize the steering angle\n This can be improved to use last N angles, etc\n if new angle is too different from curren... |
def calculateCoordinates(img, line_params):
'\n Calculates the coordinates for a road lane\n '
(height, width, _) = img.shape
(m, b) = line_params
y1 = height
y2 = int((y1 * (1 / 2)))
x1 = max((- width), min((2 * width), int(((y1 - b) / m))))
x2 = max((- width), min((2 * width)... | -2,809,386,333,949,187,000 | Calculates the coordinates for a road lane | CarlaDriving/server/lane_detection/utils.py | calculateCoordinates | eamorgado/Car-Self-driving-Simulator | python | def calculateCoordinates(img, line_params):
'\n \n '
(height, width, _) = img.shape
(m, b) = line_params
y1 = height
y2 = int((y1 * (1 / 2)))
x1 = max((- width), min((2 * width), int(((y1 - b) / m))))
x2 = max((- width), min((2 * width), int(((y2 - b) / m))))
return np.arra... |
def __init__(self, worker_id):
"Create a new Service\n\n :param worker_id: the identifier of this service instance\n :type worker_id: int\n\n The identifier of the worker can be used for workload repartition\n because it's consistent and always the same.\n\n For example, if the nu... | 3,167,055,717,728,948,000 | Create a new Service
:param worker_id: the identifier of this service instance
:type worker_id: int
The identifier of the worker can be used for workload repartition
because it's consistent and always the same.
For example, if the number of workers for this service is 3,
one will got 0, the second got 1 and the last... | cotyledon/_service.py | __init__ | 1upon0/cotyledon | python | def __init__(self, worker_id):
"Create a new Service\n\n :param worker_id: the identifier of this service instance\n :type worker_id: int\n\n The identifier of the worker can be used for workload repartition\n because it's consistent and always the same.\n\n For example, if the nu... |
def terminate(self):
'Gracefully shutdown the service\n\n This method will be executed when the Service has to shutdown cleanly.\n\n If not implemented the process will just end with status 0.\n\n To customize the exit code, the :py:class:`SystemExit` exception can be\n used.\n\n ... | -4,470,026,754,118,150,000 | Gracefully shutdown the service
This method will be executed when the Service has to shutdown cleanly.
If not implemented the process will just end with status 0.
To customize the exit code, the :py:class:`SystemExit` exception can be
used.
Any exceptions raised by this method will be logged and the worker will
exi... | cotyledon/_service.py | terminate | 1upon0/cotyledon | python | def terminate(self):
'Gracefully shutdown the service\n\n This method will be executed when the Service has to shutdown cleanly.\n\n If not implemented the process will just end with status 0.\n\n To customize the exit code, the :py:class:`SystemExit` exception can be\n used.\n\n ... |
def reload(self):
'Reloading of the service\n\n This method will be executed when the Service receives a SIGHUP.\n\n If not implemented the process will just end with status 0 and\n :py:class:`ServiceRunner` will start a new fresh process for this\n service with the same worker_id.\n\n ... | -2,382,388,470,792,310,300 | Reloading of the service
This method will be executed when the Service receives a SIGHUP.
If not implemented the process will just end with status 0 and
:py:class:`ServiceRunner` will start a new fresh process for this
service with the same worker_id.
Any exceptions raised by this method will be logged and the worke... | cotyledon/_service.py | reload | 1upon0/cotyledon | python | def reload(self):
'Reloading of the service\n\n This method will be executed when the Service receives a SIGHUP.\n\n If not implemented the process will just end with status 0 and\n :py:class:`ServiceRunner` will start a new fresh process for this\n service with the same worker_id.\n\n ... |
def run(self):
'Method representing the service activity\n\n If not implemented the process will just wait to receive an ending\n signal.\n\n This method is ran into the thread and can block or return as needed\n\n Any exceptions raised by this method will be logged and the worker will\n... | -3,914,593,872,354,240,000 | Method representing the service activity
If not implemented the process will just wait to receive an ending
signal.
This method is ran into the thread and can block or return as needed
Any exceptions raised by this method will be logged and the worker will
exit with status 1. | cotyledon/_service.py | run | 1upon0/cotyledon | python | def run(self):
'Method representing the service activity\n\n If not implemented the process will just wait to receive an ending\n signal.\n\n This method is ran into the thread and can block or return as needed\n\n Any exceptions raised by this method will be logged and the worker will\n... |
def GetPrettyPrintErrors(input_api, output_api, cwd, rel_path, results):
'Runs pretty-print command for specified file.'
exit_code = input_api.subprocess.call([input_api.python_executable, 'pretty_print.py', rel_path, '--presubmit', '--non-interactive'], cwd=cwd)
if (exit_code != 0):
error_msg = ('%... | 9,207,421,196,495,104,000 | Runs pretty-print command for specified file. | tools/metrics/histograms/PRESUBMIT.py | GetPrettyPrintErrors | Ron423c/chromium | python | def GetPrettyPrintErrors(input_api, output_api, cwd, rel_path, results):
exit_code = input_api.subprocess.call([input_api.python_executable, 'pretty_print.py', rel_path, '--presubmit', '--non-interactive'], cwd=cwd)
if (exit_code != 0):
error_msg = ('%s is not formatted correctly; run git cl format... |
def GetPrefixErrors(input_api, output_api, cwd, rel_path, results):
'Validates histogram prefixes in specified file.'
exit_code = input_api.subprocess.call([input_api.python_executable, 'validate_prefix.py', rel_path], cwd=cwd)
if (exit_code != 0):
error_msg = ('%s contains histogram(s) with disallo... | 3,177,257,491,787,596,300 | Validates histogram prefixes in specified file. | tools/metrics/histograms/PRESUBMIT.py | GetPrefixErrors | Ron423c/chromium | python | def GetPrefixErrors(input_api, output_api, cwd, rel_path, results):
exit_code = input_api.subprocess.call([input_api.python_executable, 'validate_prefix.py', rel_path], cwd=cwd)
if (exit_code != 0):
error_msg = ('%s contains histogram(s) with disallowed prefix, please run validate_prefix.py %s to f... |
def GetObsoleteXmlErrors(input_api, output_api, cwd, results):
'Validates all histograms in the file are obsolete.'
exit_code = input_api.subprocess.call([input_api.python_executable, 'validate_obsolete_histograms.py'], cwd=cwd)
if (exit_code != 0):
error_msg = 'histograms_xml/obsolete_histograms.xm... | -8,614,773,996,719,192,000 | Validates all histograms in the file are obsolete. | tools/metrics/histograms/PRESUBMIT.py | GetObsoleteXmlErrors | Ron423c/chromium | python | def GetObsoleteXmlErrors(input_api, output_api, cwd, results):
exit_code = input_api.subprocess.call([input_api.python_executable, 'validate_obsolete_histograms.py'], cwd=cwd)
if (exit_code != 0):
error_msg = 'histograms_xml/obsolete_histograms.xml contains non-obsolete histograms, please run valid... |
def GetValidateHistogramsError(input_api, output_api, cwd, results):
'Validates histograms format and index file.'
exit_code = input_api.subprocess.call([input_api.python_executable, 'validate_format.py'], cwd=cwd)
if (exit_code != 0):
error_msg = ('Histograms are not well-formatted; please run %s/v... | 1,017,347,260,587,767,800 | Validates histograms format and index file. | tools/metrics/histograms/PRESUBMIT.py | GetValidateHistogramsError | Ron423c/chromium | python | def GetValidateHistogramsError(input_api, output_api, cwd, results):
exit_code = input_api.subprocess.call([input_api.python_executable, 'validate_format.py'], cwd=cwd)
if (exit_code != 0):
error_msg = ('Histograms are not well-formatted; please run %s/validate_format.py and fix the reported errors... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.