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 test_socket_overrides_memory(self): "\n Test that `OpenSSL.SSL.bio_read` and `OpenSSL.SSL.bio_write` don't\n work on `OpenSSL.SSL.Connection`() that use sockets.\n " context = Context(TLSv1_METHOD) client = socket_any_family() clientSSL = Connection(context, client) with pyt...
-3,350,819,653,941,006,300
Test that `OpenSSL.SSL.bio_read` and `OpenSSL.SSL.bio_write` don't work on `OpenSSL.SSL.Connection`() that use sockets.
tests/test_ssl.py
test_socket_overrides_memory
dholth/pyopenssl
python
def test_socket_overrides_memory(self): "\n Test that `OpenSSL.SSL.bio_read` and `OpenSSL.SSL.bio_write` don't\n work on `OpenSSL.SSL.Connection`() that use sockets.\n " context = Context(TLSv1_METHOD) client = socket_any_family() clientSSL = Connection(context, client) with pyt...
def test_outgoing_overflow(self): '\n If more bytes than can be written to the memory BIO are passed to\n `Connection.send` at once, the number of bytes which were written is\n returned and that many bytes from the beginning of the input can be\n read from the other end of the connection...
-24,608,563,463,420,264
If more bytes than can be written to the memory BIO are passed to `Connection.send` at once, the number of bytes which were written is returned and that many bytes from the beginning of the input can be read from the other end of the connection.
tests/test_ssl.py
test_outgoing_overflow
dholth/pyopenssl
python
def test_outgoing_overflow(self): '\n If more bytes than can be written to the memory BIO are passed to\n `Connection.send` at once, the number of bytes which were written is\n returned and that many bytes from the beginning of the input can be\n read from the other end of the connection...
def test_shutdown(self): '\n `Connection.bio_shutdown` signals the end of the data stream\n from which the `Connection` reads.\n ' server = self._server(None) server.bio_shutdown() with pytest.raises(Error) as err: server.recv(1024) assert (type(err.value) in [Error, Sys...
6,889,483,336,208,162,000
`Connection.bio_shutdown` signals the end of the data stream from which the `Connection` reads.
tests/test_ssl.py
test_shutdown
dholth/pyopenssl
python
def test_shutdown(self): '\n `Connection.bio_shutdown` signals the end of the data stream\n from which the `Connection` reads.\n ' server = self._server(None) server.bio_shutdown() with pytest.raises(Error) as err: server.recv(1024) assert (type(err.value) in [Error, Sys...
def test_unexpected_EOF(self): '\n If the connection is lost before an orderly SSL shutdown occurs,\n `OpenSSL.SSL.SysCallError` is raised with a message of\n "Unexpected EOF".\n ' (server_conn, client_conn) = loopback() client_conn.sock_shutdown(SHUT_RDWR) with pytest.raises...
2,354,537,306,989,160,400
If the connection is lost before an orderly SSL shutdown occurs, `OpenSSL.SSL.SysCallError` is raised with a message of "Unexpected EOF".
tests/test_ssl.py
test_unexpected_EOF
dholth/pyopenssl
python
def test_unexpected_EOF(self): '\n If the connection is lost before an orderly SSL shutdown occurs,\n `OpenSSL.SSL.SysCallError` is raised with a message of\n "Unexpected EOF".\n ' (server_conn, client_conn) = loopback() client_conn.sock_shutdown(SHUT_RDWR) with pytest.raises...
def _check_client_ca_list(self, func): '\n Verify the return value of the `get_client_ca_list` method for\n server and client connections.\n\n :param func: A function which will be called with the server context\n before the client and server are connected to each other. This\n ...
-8,730,736,075,572,612,000
Verify the return value of the `get_client_ca_list` method for server and client connections. :param func: A function which will be called with the server context before the client and server are connected to each other. This function should specify a list of CAs for the server to send to the client and r...
tests/test_ssl.py
_check_client_ca_list
dholth/pyopenssl
python
def _check_client_ca_list(self, func): '\n Verify the return value of the `get_client_ca_list` method for\n server and client connections.\n\n :param func: A function which will be called with the server context\n before the client and server are connected to each other. This\n ...
def test_set_client_ca_list_errors(self): '\n `Context.set_client_ca_list` raises a `TypeError` if called with a\n non-list or a list that contains objects other than X509Names.\n ' ctx = Context(TLSv1_METHOD) with pytest.raises(TypeError): ctx.set_client_ca_list('spam') wit...
8,985,719,186,592,469,000
`Context.set_client_ca_list` raises a `TypeError` if called with a non-list or a list that contains objects other than X509Names.
tests/test_ssl.py
test_set_client_ca_list_errors
dholth/pyopenssl
python
def test_set_client_ca_list_errors(self): '\n `Context.set_client_ca_list` raises a `TypeError` if called with a\n non-list or a list that contains objects other than X509Names.\n ' ctx = Context(TLSv1_METHOD) with pytest.raises(TypeError): ctx.set_client_ca_list('spam') wit...
def test_set_empty_ca_list(self): '\n If passed an empty list, `Context.set_client_ca_list` configures the\n context to send no CA names to the client and, on both the server and\n client sides, `Connection.get_client_ca_list` returns an empty list\n after the connection is set up.\n ...
6,187,173,914,336,512,000
If passed an empty list, `Context.set_client_ca_list` configures the context to send no CA names to the client and, on both the server and client sides, `Connection.get_client_ca_list` returns an empty list after the connection is set up.
tests/test_ssl.py
test_set_empty_ca_list
dholth/pyopenssl
python
def test_set_empty_ca_list(self): '\n If passed an empty list, `Context.set_client_ca_list` configures the\n context to send no CA names to the client and, on both the server and\n client sides, `Connection.get_client_ca_list` returns an empty list\n after the connection is set up.\n ...
def test_set_one_ca_list(self): '\n If passed a list containing a single X509Name,\n `Context.set_client_ca_list` configures the context to send\n that CA name to the client and, on both the server and client sides,\n `Connection.get_client_ca_list` returns a list containing that\n ...
-2,357,789,607,760,486,400
If passed a list containing a single X509Name, `Context.set_client_ca_list` configures the context to send that CA name to the client and, on both the server and client sides, `Connection.get_client_ca_list` returns a list containing that X509Name after the connection is set up.
tests/test_ssl.py
test_set_one_ca_list
dholth/pyopenssl
python
def test_set_one_ca_list(self): '\n If passed a list containing a single X509Name,\n `Context.set_client_ca_list` configures the context to send\n that CA name to the client and, on both the server and client sides,\n `Connection.get_client_ca_list` returns a list containing that\n ...
def test_set_multiple_ca_list(self): '\n If passed a list containing multiple X509Name objects,\n `Context.set_client_ca_list` configures the context to send\n those CA names to the client and, on both the server and client sides,\n `Connection.get_client_ca_list` returns a list containi...
-7,102,183,694,918,540,000
If passed a list containing multiple X509Name objects, `Context.set_client_ca_list` configures the context to send those CA names to the client and, on both the server and client sides, `Connection.get_client_ca_list` returns a list containing those X509Names after the connection is set up.
tests/test_ssl.py
test_set_multiple_ca_list
dholth/pyopenssl
python
def test_set_multiple_ca_list(self): '\n If passed a list containing multiple X509Name objects,\n `Context.set_client_ca_list` configures the context to send\n those CA names to the client and, on both the server and client sides,\n `Connection.get_client_ca_list` returns a list containi...
def test_reset_ca_list(self): '\n If called multiple times, only the X509Names passed to the final call\n of `Context.set_client_ca_list` are used to configure the CA\n names sent to the client.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) secert = load_certificate(...
4,391,791,017,981,610,500
If called multiple times, only the X509Names passed to the final call of `Context.set_client_ca_list` are used to configure the CA names sent to the client.
tests/test_ssl.py
test_reset_ca_list
dholth/pyopenssl
python
def test_reset_ca_list(self): '\n If called multiple times, only the X509Names passed to the final call\n of `Context.set_client_ca_list` are used to configure the CA\n names sent to the client.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) secert = load_certificate(...
def test_mutated_ca_list(self): '\n If the list passed to `Context.set_client_ca_list` is mutated\n afterwards, this does not affect the list of CA names sent to the\n client.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) secert = load_certificate(FILETYPE_PEM, serve...
-2,296,114,413,460,073,000
If the list passed to `Context.set_client_ca_list` is mutated afterwards, this does not affect the list of CA names sent to the client.
tests/test_ssl.py
test_mutated_ca_list
dholth/pyopenssl
python
def test_mutated_ca_list(self): '\n If the list passed to `Context.set_client_ca_list` is mutated\n afterwards, this does not affect the list of CA names sent to the\n client.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) secert = load_certificate(FILETYPE_PEM, serve...
def test_add_client_ca_wrong_args(self): '\n `Context.add_client_ca` raises `TypeError` if called with\n a non-X509 object.\n ' ctx = Context(TLSv1_METHOD) with pytest.raises(TypeError): ctx.add_client_ca('spam')
1,486,215,216,726,044,200
`Context.add_client_ca` raises `TypeError` if called with a non-X509 object.
tests/test_ssl.py
test_add_client_ca_wrong_args
dholth/pyopenssl
python
def test_add_client_ca_wrong_args(self): '\n `Context.add_client_ca` raises `TypeError` if called with\n a non-X509 object.\n ' ctx = Context(TLSv1_METHOD) with pytest.raises(TypeError): ctx.add_client_ca('spam')
def test_one_add_client_ca(self): "\n A certificate's subject can be added as a CA to be sent to the client\n with `Context.add_client_ca`.\n " cacert = load_certificate(FILETYPE_PEM, root_cert_pem) cadesc = cacert.get_subject() def single_ca(ctx): ctx.add_client_ca(cacert)...
6,252,198,235,848,312,000
A certificate's subject can be added as a CA to be sent to the client with `Context.add_client_ca`.
tests/test_ssl.py
test_one_add_client_ca
dholth/pyopenssl
python
def test_one_add_client_ca(self): "\n A certificate's subject can be added as a CA to be sent to the client\n with `Context.add_client_ca`.\n " cacert = load_certificate(FILETYPE_PEM, root_cert_pem) cadesc = cacert.get_subject() def single_ca(ctx): ctx.add_client_ca(cacert)...
def test_multiple_add_client_ca(self): '\n Multiple CA names can be sent to the client by calling\n `Context.add_client_ca` with multiple X509 objects.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) secert = load_certificate(FILETYPE_PEM, server_cert_pem) cadesc = cacert...
949,775,207,607,759,500
Multiple CA names can be sent to the client by calling `Context.add_client_ca` with multiple X509 objects.
tests/test_ssl.py
test_multiple_add_client_ca
dholth/pyopenssl
python
def test_multiple_add_client_ca(self): '\n Multiple CA names can be sent to the client by calling\n `Context.add_client_ca` with multiple X509 objects.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) secert = load_certificate(FILETYPE_PEM, server_cert_pem) cadesc = cacert...
def test_set_and_add_client_ca(self): '\n A call to `Context.set_client_ca_list` followed by a call to\n `Context.add_client_ca` results in using the CA names from the\n first call and the CA name from the second call.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) se...
-7,623,362,178,323,251,000
A call to `Context.set_client_ca_list` followed by a call to `Context.add_client_ca` results in using the CA names from the first call and the CA name from the second call.
tests/test_ssl.py
test_set_and_add_client_ca
dholth/pyopenssl
python
def test_set_and_add_client_ca(self): '\n A call to `Context.set_client_ca_list` followed by a call to\n `Context.add_client_ca` results in using the CA names from the\n first call and the CA name from the second call.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) se...
def test_set_after_add_client_ca(self): '\n A call to `Context.set_client_ca_list` after a call to\n `Context.add_client_ca` replaces the CA name specified by the\n former call with the names specified by the latter call.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) ...
3,161,915,503,385,484,000
A call to `Context.set_client_ca_list` after a call to `Context.add_client_ca` replaces the CA name specified by the former call with the names specified by the latter call.
tests/test_ssl.py
test_set_after_add_client_ca
dholth/pyopenssl
python
def test_set_after_add_client_ca(self): '\n A call to `Context.set_client_ca_list` after a call to\n `Context.add_client_ca` replaces the CA name specified by the\n former call with the names specified by the latter call.\n ' cacert = load_certificate(FILETYPE_PEM, root_cert_pem) ...
def test_integers(self): '\n All of the info constants are integers.\n\n This is a very weak test. It would be nice to have one that actually\n verifies that as certain info events happen, the value passed to the\n info callback matches up with the constant exposed by OpenSSL.SSL.\n ...
-8,794,536,108,357,829,000
All of the info constants are integers. This is a very weak test. It would be nice to have one that actually verifies that as certain info events happen, the value passed to the info callback matches up with the constant exposed by OpenSSL.SSL.
tests/test_ssl.py
test_integers
dholth/pyopenssl
python
def test_integers(self): '\n All of the info constants are integers.\n\n This is a very weak test. It would be nice to have one that actually\n verifies that as certain info events happen, the value passed to the\n info callback matches up with the constant exposed by OpenSSL.SSL.\n ...
def test_available(self): '\n When the OpenSSL functionality is available the decorated functions\n work appropriately.\n ' feature_guard = _make_requires(True, 'Error text') results = [] @feature_guard def inner(): results.append(True) return True assert (i...
2,875,773,025,657,722,400
When the OpenSSL functionality is available the decorated functions work appropriately.
tests/test_ssl.py
test_available
dholth/pyopenssl
python
def test_available(self): '\n When the OpenSSL functionality is available the decorated functions\n work appropriately.\n ' feature_guard = _make_requires(True, 'Error text') results = [] @feature_guard def inner(): results.append(True) return True assert (i...
def test_unavailable(self): '\n When the OpenSSL functionality is not available the decorated function\n does not execute and NotImplementedError is raised.\n ' feature_guard = _make_requires(False, 'Error text') @feature_guard def inner(): pytest.fail('Should not be called...
-7,286,798,191,054,335,000
When the OpenSSL functionality is not available the decorated function does not execute and NotImplementedError is raised.
tests/test_ssl.py
test_unavailable
dholth/pyopenssl
python
def test_unavailable(self): '\n When the OpenSSL functionality is not available the decorated function\n does not execute and NotImplementedError is raised.\n ' feature_guard = _make_requires(False, 'Error text') @feature_guard def inner(): pytest.fail('Should not be called...
def _client_connection(self, callback, data, request_ocsp=True): '\n Builds a client connection suitable for using OCSP.\n\n :param callback: The callback to register for OCSP.\n :param data: The opaque data object that will be handed to the\n OCSP callback.\n :param request_o...
-2,450,263,854,002,226,000
Builds a client connection suitable for using OCSP. :param callback: The callback to register for OCSP. :param data: The opaque data object that will be handed to the OCSP callback. :param request_ocsp: Whether the client will actually ask for OCSP stapling. Useful for testing only.
tests/test_ssl.py
_client_connection
dholth/pyopenssl
python
def _client_connection(self, callback, data, request_ocsp=True): '\n Builds a client connection suitable for using OCSP.\n\n :param callback: The callback to register for OCSP.\n :param data: The opaque data object that will be handed to the\n OCSP callback.\n :param request_o...
def _server_connection(self, callback, data): '\n Builds a server connection suitable for using OCSP.\n\n :param callback: The callback to register for OCSP.\n :param data: The opaque data object that will be handed to the\n OCSP callback.\n ' ctx = Context(SSLv23_METHOD) ...
7,783,377,464,125,420,000
Builds a server connection suitable for using OCSP. :param callback: The callback to register for OCSP. :param data: The opaque data object that will be handed to the OCSP callback.
tests/test_ssl.py
_server_connection
dholth/pyopenssl
python
def _server_connection(self, callback, data): '\n Builds a server connection suitable for using OCSP.\n\n :param callback: The callback to register for OCSP.\n :param data: The opaque data object that will be handed to the\n OCSP callback.\n ' ctx = Context(SSLv23_METHOD) ...
def test_callbacks_arent_called_by_default(self): '\n If both the client and the server have registered OCSP callbacks, but\n the client does not send the OCSP request, neither callback gets\n called.\n ' def ocsp_callback(*args, **kwargs): pytest.fail('Should not be called'...
8,567,903,337,387,487,000
If both the client and the server have registered OCSP callbacks, but the client does not send the OCSP request, neither callback gets called.
tests/test_ssl.py
test_callbacks_arent_called_by_default
dholth/pyopenssl
python
def test_callbacks_arent_called_by_default(self): '\n If both the client and the server have registered OCSP callbacks, but\n the client does not send the OCSP request, neither callback gets\n called.\n ' def ocsp_callback(*args, **kwargs): pytest.fail('Should not be called'...
def test_client_negotiates_without_server(self): '\n If the client wants to do OCSP but the server does not, the handshake\n succeeds, and the client callback fires with an empty byte string.\n ' called = [] def ocsp_callback(conn, ocsp_data, ignored): called.append(ocsp_data) ...
4,349,626,982,019,916,000
If the client wants to do OCSP but the server does not, the handshake succeeds, and the client callback fires with an empty byte string.
tests/test_ssl.py
test_client_negotiates_without_server
dholth/pyopenssl
python
def test_client_negotiates_without_server(self): '\n If the client wants to do OCSP but the server does not, the handshake\n succeeds, and the client callback fires with an empty byte string.\n ' called = [] def ocsp_callback(conn, ocsp_data, ignored): called.append(ocsp_data) ...
def test_client_receives_servers_data(self): '\n The data the server sends in its callback is received by the client.\n ' calls = [] def server_callback(*args, **kwargs): return self.sample_ocsp_data def client_callback(conn, ocsp_data, ignored): calls.append(ocsp_data) ...
4,777,403,329,407,207,000
The data the server sends in its callback is received by the client.
tests/test_ssl.py
test_client_receives_servers_data
dholth/pyopenssl
python
def test_client_receives_servers_data(self): '\n \n ' calls = [] def server_callback(*args, **kwargs): return self.sample_ocsp_data def client_callback(conn, ocsp_data, ignored): calls.append(ocsp_data) return True client = self._client_connection(callback=cli...
def test_callbacks_are_invoked_with_connections(self): '\n The first arguments to both callbacks are their respective connections.\n ' client_calls = [] server_calls = [] def client_callback(conn, *args, **kwargs): client_calls.append(conn) return True def server_call...
551,831,454,631,807,200
The first arguments to both callbacks are their respective connections.
tests/test_ssl.py
test_callbacks_are_invoked_with_connections
dholth/pyopenssl
python
def test_callbacks_are_invoked_with_connections(self): '\n \n ' client_calls = [] server_calls = [] def client_callback(conn, *args, **kwargs): client_calls.append(conn) return True def server_callback(conn, *args, **kwargs): server_calls.append(conn) ...
def test_opaque_data_is_passed_through(self): '\n Both callbacks receive an opaque, user-provided piece of data in their\n callbacks as the final argument.\n ' calls = [] def server_callback(*args): calls.append(args) return self.sample_ocsp_data def client_callbac...
4,149,982,713,494,448,000
Both callbacks receive an opaque, user-provided piece of data in their callbacks as the final argument.
tests/test_ssl.py
test_opaque_data_is_passed_through
dholth/pyopenssl
python
def test_opaque_data_is_passed_through(self): '\n Both callbacks receive an opaque, user-provided piece of data in their\n callbacks as the final argument.\n ' calls = [] def server_callback(*args): calls.append(args) return self.sample_ocsp_data def client_callbac...
def test_server_returns_empty_string(self): '\n If the server returns an empty bytestring from its callback, the\n client callback is called with the empty bytestring.\n ' client_calls = [] def server_callback(*args): return b'' def client_callback(conn, ocsp_data, ignored...
7,501,926,478,803,016,000
If the server returns an empty bytestring from its callback, the client callback is called with the empty bytestring.
tests/test_ssl.py
test_server_returns_empty_string
dholth/pyopenssl
python
def test_server_returns_empty_string(self): '\n If the server returns an empty bytestring from its callback, the\n client callback is called with the empty bytestring.\n ' client_calls = [] def server_callback(*args): return b def client_callback(conn, ocsp_data, ignored):...
def test_client_returns_false_terminates_handshake(self): '\n If the client returns False from its callback, the handshake fails.\n ' def server_callback(*args): return self.sample_ocsp_data def client_callback(*args): return False client = self._client_connection(callbac...
3,973,897,642,014,427,600
If the client returns False from its callback, the handshake fails.
tests/test_ssl.py
test_client_returns_false_terminates_handshake
dholth/pyopenssl
python
def test_client_returns_false_terminates_handshake(self): '\n \n ' def server_callback(*args): return self.sample_ocsp_data def client_callback(*args): return False client = self._client_connection(callback=client_callback, data=None) server = self._server_connection(...
def test_exceptions_in_client_bubble_up(self): '\n The callbacks thrown in the client callback bubble up to the caller.\n ' class SentinelException(Exception): pass def server_callback(*args): return self.sample_ocsp_data def client_callback(*args): raise Sentine...
8,659,388,420,352,561,000
The callbacks thrown in the client callback bubble up to the caller.
tests/test_ssl.py
test_exceptions_in_client_bubble_up
dholth/pyopenssl
python
def test_exceptions_in_client_bubble_up(self): '\n \n ' class SentinelException(Exception): pass def server_callback(*args): return self.sample_ocsp_data def client_callback(*args): raise SentinelException() client = self._client_connection(callback=client_ca...
def test_exceptions_in_server_bubble_up(self): '\n The callbacks thrown in the server callback bubble up to the caller.\n ' class SentinelException(Exception): pass def server_callback(*args): raise SentinelException() def client_callback(*args): pytest.fail('Sho...
1,846,659,666,523,737,300
The callbacks thrown in the server callback bubble up to the caller.
tests/test_ssl.py
test_exceptions_in_server_bubble_up
dholth/pyopenssl
python
def test_exceptions_in_server_bubble_up(self): '\n \n ' class SentinelException(Exception): pass def server_callback(*args): raise SentinelException() def client_callback(*args): pytest.fail('Should not be called') client = self._client_connection(callback=cl...
def test_server_must_return_bytes(self): '\n The server callback must return a bytestring, or a TypeError is thrown.\n ' def server_callback(*args): return self.sample_ocsp_data.decode('ascii') def client_callback(*args): pytest.fail('Should not be called') client = self....
-5,247,461,585,641,548,000
The server callback must return a bytestring, or a TypeError is thrown.
tests/test_ssl.py
test_server_must_return_bytes
dholth/pyopenssl
python
def test_server_must_return_bytes(self): '\n \n ' def server_callback(*args): return self.sample_ocsp_data.decode('ascii') def client_callback(*args): pytest.fail('Should not be called') client = self._client_connection(callback=client_callback, data=None) server = se...
def select(conn, options): '\n Assert later that no args are actually appended.\n ' select_args.append((conn, options)) return b''
-9,000,996,100,594,796,000
Assert later that no args are actually appended.
tests/test_ssl.py
select
dholth/pyopenssl
python
def select(conn, options): '\n \n ' select_args.append((conn, options)) return b
def test_alpn_success(self): '\n Clients and servers that agree on the negotiated ALPN protocol can\n correct establish a connection, and the agreed protocol is reported\n by the connections.\n ' select_args = [] def select(conn, options): select_args.app...
-1,615,314,544,418,148,400
Clients and servers that agree on the negotiated ALPN protocol can correct establish a connection, and the agreed protocol is reported by the connections.
tests/test_ssl.py
test_alpn_success
dholth/pyopenssl
python
def test_alpn_success(self): '\n Clients and servers that agree on the negotiated ALPN protocol can\n correct establish a connection, and the agreed protocol is reported\n by the connections.\n ' select_args = [] def select(conn, options): select_args.app...
def test_alpn_set_on_connection(self): '\n The same as test_alpn_success, but setting the ALPN protocols on\n the connection rather than the context.\n ' select_args = [] def select(conn, options): select_args.append((conn, options)) return b'spdy/2' cli...
5,401,062,428,428,302,000
The same as test_alpn_success, but setting the ALPN protocols on the connection rather than the context.
tests/test_ssl.py
test_alpn_set_on_connection
dholth/pyopenssl
python
def test_alpn_set_on_connection(self): '\n The same as test_alpn_success, but setting the ALPN protocols on\n the connection rather than the context.\n ' select_args = [] def select(conn, options): select_args.append((conn, options)) return b'spdy/2' cli...
def test_alpn_server_fail(self): '\n When clients and servers cannot agree on what protocol to use next\n the TLS connection does not get established.\n ' select_args = [] def select(conn, options): select_args.append((conn, options)) return b'' client_c...
-3,258,457,692,606,931,000
When clients and servers cannot agree on what protocol to use next the TLS connection does not get established.
tests/test_ssl.py
test_alpn_server_fail
dholth/pyopenssl
python
def test_alpn_server_fail(self): '\n When clients and servers cannot agree on what protocol to use next\n the TLS connection does not get established.\n ' select_args = [] def select(conn, options): select_args.append((conn, options)) return b client_con...
def test_alpn_no_server(self): "\n When clients and servers cannot agree on what protocol to use next\n because the server doesn't offer ALPN, no protocol is negotiated.\n " client_context = Context(TLSv1_METHOD) client_context.set_alpn_protos([b'http/1.1', b'spdy/2']) s...
3,146,339,162,060,569,600
When clients and servers cannot agree on what protocol to use next because the server doesn't offer ALPN, no protocol is negotiated.
tests/test_ssl.py
test_alpn_no_server
dholth/pyopenssl
python
def test_alpn_no_server(self): "\n When clients and servers cannot agree on what protocol to use next\n because the server doesn't offer ALPN, no protocol is negotiated.\n " client_context = Context(TLSv1_METHOD) client_context.set_alpn_protos([b'http/1.1', b'spdy/2']) s...
def test_alpn_callback_exception(self): '\n We can handle exceptions in the ALPN select callback.\n ' select_args = [] def select(conn, options): select_args.append((conn, options)) raise TypeError() client_context = Context(TLSv1_METHOD) client_context.set_alp...
-1,442,336,582,692,366,800
We can handle exceptions in the ALPN select callback.
tests/test_ssl.py
test_alpn_callback_exception
dholth/pyopenssl
python
def test_alpn_callback_exception(self): '\n \n ' select_args = [] def select(conn, options): select_args.append((conn, options)) raise TypeError() client_context = Context(TLSv1_METHOD) client_context.set_alpn_protos([b'http/1.1', b'spdy/2']) server_context...
def test_alpn_not_implemented(self): '\n If ALPN is not in OpenSSL, we should raise NotImplementedError.\n ' context = Context(TLSv1_METHOD) with pytest.raises(NotImplementedError): context.set_alpn_protos(None) with pytest.raises(NotImplementedError): context.set_a...
-4,271,522,351,178,993,700
If ALPN is not in OpenSSL, we should raise NotImplementedError.
tests/test_ssl.py
test_alpn_not_implemented
dholth/pyopenssl
python
def test_alpn_not_implemented(self): '\n \n ' context = Context(TLSv1_METHOD) with pytest.raises(NotImplementedError): context.set_alpn_protos(None) with pytest.raises(NotImplementedError): context.set_alpn_select_callback(None) conn = Connection(context) wi...
def colorize(x): ' Converts a one-channel grayscale image to a color heatmap image ' if (x.dim() == 2): torch.unsqueeze(x, 0, out=x) if (x.dim() == 3): cl = torch.zeros([3, x.size(1), x.size(2)]) cl[0] = (gauss(x, 0.5, 0.6, 0.2) + gauss(x, 1, 0.8, 0.3)) cl[1] = gauss(x, 1, 0....
4,817,324,830,790,308,000
Converts a one-channel grayscale image to a color heatmap image
rethinking-network-pruning/cifar/weight-level/utils/visualize.py
colorize
1337Eddy/BirdRecognitionPruning
python
def colorize(x): ' ' if (x.dim() == 2): torch.unsqueeze(x, 0, out=x) if (x.dim() == 3): cl = torch.zeros([3, x.size(1), x.size(2)]) cl[0] = (gauss(x, 0.5, 0.6, 0.2) + gauss(x, 1, 0.8, 0.3)) cl[1] = gauss(x, 1, 0.5, 0.3) cl[2] = gauss(x, 1, 0.2, 0.3) cl[cl.gt(...
@addressable(Exactly(int)) def age(self): "Return the person's age in years.\n\n :rtype int\n "
5,267,023,490,484,108,000
Return the person's age in years. :rtype int
tests/python/pants_test/engine/test_addressable.py
age
AHassanSOS/pants
python
@addressable(Exactly(int)) def age(self): "Return the person's age in years.\n\n :rtype int\n "
@addressable_list(Exactly(int, float)) def values(self): "Return this series' values.\n\n :rtype list of int or float\n "
-8,348,155,537,852,040,000
Return this series' values. :rtype list of int or float
tests/python/pants_test/engine/test_addressable.py
values
AHassanSOS/pants
python
@addressable_list(Exactly(int, float)) def values(self): "Return this series' values.\n\n :rtype list of int or float\n "
@addressable_dict(Exactly(int, float)) def varz(self): 'Return a snapshot of the current /varz.\n\n :rtype dict of string -> int or float\n '
6,021,855,875,471,639,000
Return a snapshot of the current /varz. :rtype dict of string -> int or float
tests/python/pants_test/engine/test_addressable.py
varz
AHassanSOS/pants
python
@addressable_dict(Exactly(int, float)) def varz(self): 'Return a snapshot of the current /varz.\n\n :rtype dict of string -> int or float\n '
def read_uint32(fp, pos): 'Read 4 little-endian bytes into an unsigned 32-bit integer. Return value, position + 4.' fp.seek(pos) val = struct.unpack('<I', fp.read(4))[0] return (val, (pos + 4))
4,483,001,118,760,967,000
Read 4 little-endian bytes into an unsigned 32-bit integer. Return value, position + 4.
zw1_pack.py
read_uint32
nmbook/zw1-pack
python
def read_uint32(fp, pos): fp.seek(pos) val = struct.unpack('<I', fp.read(4))[0] return (val, (pos + 4))
def read_strn(fp, pos, size): 'Read N null-padded bytes into an ascii encoded string. Return value, position + N.' fp.seek(pos) val = struct.unpack((('<' + str(size)) + 's'), fp.read(size))[0] return (val.decode('ascii').strip('\x00'), (pos + size))
-3,470,060,733,731,498,500
Read N null-padded bytes into an ascii encoded string. Return value, position + N.
zw1_pack.py
read_strn
nmbook/zw1-pack
python
def read_strn(fp, pos, size): fp.seek(pos) val = struct.unpack((('<' + str(size)) + 's'), fp.read(size))[0] return (val.decode('ascii').strip('\x00'), (pos + size))
def pack(file_array, args): 'Packs files or folders given into the first argument: a target file name or a directory (archive will be named the same as directory).\n \n If archive name exists, appends number and tries again.' output_target = file_array[0] input_set = file_array.copy() if os.path.i...
-4,834,152,850,736,557,000
Packs files or folders given into the first argument: a target file name or a directory (archive will be named the same as directory). If archive name exists, appends number and tries again.
zw1_pack.py
pack
nmbook/zw1-pack
python
def pack(file_array, args): 'Packs files or folders given into the first argument: a target file name or a directory (archive will be named the same as directory).\n \n If archive name exists, appends number and tries again.' output_target = file_array[0] input_set = file_array.copy() if os.path.i...
def unpack(file_array, args): 'Unpacks one or more files given the provided arguments.\n \n If contents exist in the target output folder, they will be overwritten.' if (not args.quiet): print('Unpacking {} files...'.format(len(file_array))) is_multiple = (len(file_array) != 1) for file_pa...
-8,862,921,214,724,358,000
Unpacks one or more files given the provided arguments. If contents exist in the target output folder, they will be overwritten.
zw1_pack.py
unpack
nmbook/zw1-pack
python
def unpack(file_array, args): 'Unpacks one or more files given the provided arguments.\n \n If contents exist in the target output folder, they will be overwritten.' if (not args.quiet): print('Unpacking {} files...'.format(len(file_array))) is_multiple = (len(file_array) != 1) for file_pa...
def _CreateLegalIdentifier(input_string): 'Converts input_string to a legal identifier for ADMX/ADML files.\n\n Changes some characters that do not necessarily cause problems and may not\n handle all cases.\n\n Args:\n input_string: Text to convert to a legal identifier.\n\n Returns:\n String containing a...
290,922,038,349,501,200
Converts input_string to a legal identifier for ADMX/ADML files. Changes some characters that do not necessarily cause problems and may not handle all cases. Args: input_string: Text to convert to a legal identifier. Returns: String containing a legal identifier based on input_string.
omaha/enterprise/generate_group_policy_template_admx.py
_CreateLegalIdentifier
huhisoftware/omaha
python
def _CreateLegalIdentifier(input_string): 'Converts input_string to a legal identifier for ADMX/ADML files.\n\n Changes some characters that do not necessarily cause problems and may not\n handle all cases.\n\n Args:\n input_string: Text to convert to a legal identifier.\n\n Returns:\n String containing a...
def GenerateGroupPolicyTemplateAdmx(apps): 'Generates a Group Policy template (ADMX format)for the specified apps.\n\n Replaces LF in strings above with CRLF as required by gpedit.msc.\n When writing the resulting contents to a file, use binary mode to ensure the\n CRLFs are preserved.\n\n Args:\n apps: A li...
-1,079,573,196,691,132,000
Generates a Group Policy template (ADMX format)for the specified apps. Replaces LF in strings above with CRLF as required by gpedit.msc. When writing the resulting contents to a file, use binary mode to ensure the CRLFs are preserved. Args: apps: A list of tuples containing information about each app. Each el...
omaha/enterprise/generate_group_policy_template_admx.py
GenerateGroupPolicyTemplateAdmx
huhisoftware/omaha
python
def GenerateGroupPolicyTemplateAdmx(apps): 'Generates a Group Policy template (ADMX format)for the specified apps.\n\n Replaces LF in strings above with CRLF as required by gpedit.msc.\n When writing the resulting contents to a file, use binary mode to ensure the\n CRLFs are preserved.\n\n Args:\n apps: A li...
def GenerateGroupPolicyTemplateAdml(apps): 'Generates a Group Policy template (ADML format)for the specified apps.\n\n Replaces LF in strings above with CRLF as required by gpedit.msc.\n When writing the resulting contents to a file, use binary mode to ensure the\n CRLFs are preserved.\n\n Args:\n apps: A li...
-2,271,222,399,420,323,600
Generates a Group Policy template (ADML format)for the specified apps. Replaces LF in strings above with CRLF as required by gpedit.msc. When writing the resulting contents to a file, use binary mode to ensure the CRLFs are preserved. Args: apps: A list of tuples containing information about each app. Each el...
omaha/enterprise/generate_group_policy_template_admx.py
GenerateGroupPolicyTemplateAdml
huhisoftware/omaha
python
def GenerateGroupPolicyTemplateAdml(apps): 'Generates a Group Policy template (ADML format)for the specified apps.\n\n Replaces LF in strings above with CRLF as required by gpedit.msc.\n When writing the resulting contents to a file, use binary mode to ensure the\n CRLFs are preserved.\n\n Args:\n apps: A li...
def WriteGroupPolicyTemplateAdmx(target_path, apps): 'Writes a Group Policy template (ADM format)for the specified apps.\n\n The file is UTF-16 and contains CRLF on all platforms.\n\n Args:\n target_path: Output path of the .ADM template file.\n apps: A list of tuples containing information about each app.\...
1,054,630,995,328,795,000
Writes a Group Policy template (ADM format)for the specified apps. The file is UTF-16 and contains CRLF on all platforms. Args: target_path: Output path of the .ADM template file. apps: A list of tuples containing information about each app. Each element of the list is a tuple of: * app name ...
omaha/enterprise/generate_group_policy_template_admx.py
WriteGroupPolicyTemplateAdmx
huhisoftware/omaha
python
def WriteGroupPolicyTemplateAdmx(target_path, apps): 'Writes a Group Policy template (ADM format)for the specified apps.\n\n The file is UTF-16 and contains CRLF on all platforms.\n\n Args:\n target_path: Output path of the .ADM template file.\n apps: A list of tuples containing information about each app.\...
def WriteGroupPolicyTemplateAdml(target_path, apps): 'Writes a Group Policy template (ADM format)for the specified apps.\n\n The file is UTF-16 and contains CRLF on all platforms.\n\n Args:\n target_path: Output path of the .ADM template file.\n apps: A list of tuples containing information about each app.\...
5,698,310,291,979,134,000
Writes a Group Policy template (ADM format)for the specified apps. The file is UTF-16 and contains CRLF on all platforms. Args: target_path: Output path of the .ADM template file. apps: A list of tuples containing information about each app. Each element of the list is a tuple of: * app name ...
omaha/enterprise/generate_group_policy_template_admx.py
WriteGroupPolicyTemplateAdml
huhisoftware/omaha
python
def WriteGroupPolicyTemplateAdml(target_path, apps): 'Writes a Group Policy template (ADM format)for the specified apps.\n\n The file is UTF-16 and contains CRLF on all platforms.\n\n Args:\n target_path: Output path of the .ADM template file.\n apps: A list of tuples containing information about each app.\...
def _GenerateCategories(apps): 'Generates category string for each of the specified apps.\n\n Args:\n apps: list of tuples containing information about the apps.\n\n Returns:\n String containing concatenated copies of the category string for each app\n in apps, each populated with the appropria...
8,737,190,411,212,836,000
Generates category string for each of the specified apps. Args: apps: list of tuples containing information about the apps. Returns: String containing concatenated copies of the category string for each app in apps, each populated with the appropriate app-specific strings.
omaha/enterprise/generate_group_policy_template_admx.py
_GenerateCategories
huhisoftware/omaha
python
def _GenerateCategories(apps): 'Generates category string for each of the specified apps.\n\n Args:\n apps: list of tuples containing information about the apps.\n\n Returns:\n String containing concatenated copies of the category string for each app\n in apps, each populated with the appropria...
def _GeneratePolicies(apps): 'Generates policy string for each of the specified apps.\n\n Args:\n apps: list of tuples containing information about the apps.\n\n Returns:\n String containing concatenated copies of the policy template for each app\n in apps, each populated with the appropriate a...
1,275,777,392,437,355,800
Generates policy string for each of the specified apps. Args: apps: list of tuples containing information about the apps. Returns: String containing concatenated copies of the policy template for each app in apps, each populated with the appropriate app-specific strings.
omaha/enterprise/generate_group_policy_template_admx.py
_GeneratePolicies
huhisoftware/omaha
python
def _GeneratePolicies(apps): 'Generates policy string for each of the specified apps.\n\n Args:\n apps: list of tuples containing information about the apps.\n\n Returns:\n String containing concatenated copies of the policy template for each app\n in apps, each populated with the appropriate a...
def ComputeDeriv(self): 'Compute derivative w.r.t input given derivative w.r.t output.' self.deriv.apply_logistic_deriv(self.state)
-3,191,914,412,202,420,700
Compute derivative w.r.t input given derivative w.r.t output.
package/deepnet/logistic_layer.py
ComputeDeriv
Corvalius/deepnet
python
def ComputeDeriv(self): self.deriv.apply_logistic_deriv(self.state)
def GetLoss(self, get_deriv=False, acc_deriv=False, **kwargs): 'Compute loss and also deriv w.r.t to it if asked for.\n\n Compute the loss function. Targets should be in self.data, predictions\n should be in self.state.\n Args:\n get_deriv: If True, compute the derivative w.r.t the loss function and p...
6,746,405,064,523,228,000
Compute loss and also deriv w.r.t to it if asked for. Compute the loss function. Targets should be in self.data, predictions should be in self.state. Args: get_deriv: If True, compute the derivative w.r.t the loss function and put it in self.deriv.
package/deepnet/logistic_layer.py
GetLoss
Corvalius/deepnet
python
def GetLoss(self, get_deriv=False, acc_deriv=False, **kwargs): 'Compute loss and also deriv w.r.t to it if asked for.\n\n Compute the loss function. Targets should be in self.data, predictions\n should be in self.state.\n Args:\n get_deriv: If True, compute the derivative w.r.t the loss function and p...
def _CreateServiceRestriction(restriction_message_type, mask_prefix, enable_restriction, allowed_services): 'Returns a service restriction message and its update mask.' if ((allowed_services is None) and (enable_restriction is None)): return (None, []) message = restriction_message_type() update...
-358,618,633,509,207,100
Returns a service restriction message and its update mask.
gcloud/google-cloud-sdk/.install/.backup/lib/googlecloudsdk/api_lib/accesscontextmanager/zones.py
_CreateServiceRestriction
bopopescu/JobSniperRails
python
def _CreateServiceRestriction(restriction_message_type, mask_prefix, enable_restriction, allowed_services): if ((allowed_services is None) and (enable_restriction is None)): return (None, []) message = restriction_message_type() update_mask = [] if (allowed_services is not None): me...
def _CreateServicePerimeterConfig(messages, mask_prefix, include_unrestricted_services, resources, restricted_services, unrestricted_services, levels, ingress_allowed_services, vpc_allowed_services, bridge_allowed_services, enable_ingress_service_restriction, enable_vpc_service_restriction, enable_bridge_service_restri...
-1,922,617,703,878,170,400
Returns a ServicePerimeterConfig and its update mask.
gcloud/google-cloud-sdk/.install/.backup/lib/googlecloudsdk/api_lib/accesscontextmanager/zones.py
_CreateServicePerimeterConfig
bopopescu/JobSniperRails
python
def _CreateServicePerimeterConfig(messages, mask_prefix, include_unrestricted_services, resources, restricted_services, unrestricted_services, levels, ingress_allowed_services, vpc_allowed_services, bridge_allowed_services, enable_ingress_service_restriction, enable_vpc_service_restriction, enable_bridge_service_restri...
def Patch(self, perimeter_ref, description=None, title=None, perimeter_type=None, resources=None, restricted_services=None, unrestricted_services=None, levels=None, ingress_allowed_services=None, vpc_allowed_services=None, bridge_allowed_services=None, enable_ingress_service_restriction=None, enable_vpc_service_restric...
7,694,572,383,652,828,000
Patch a service perimeter. Args: perimeter_ref: resources.Resource, reference to the perimeter to patch description: str, description of the zone or None if not updating title: str, title of the zone or None if not updating perimeter_type: PerimeterTypeValueValuesEnum type enum value for the level or None ...
gcloud/google-cloud-sdk/.install/.backup/lib/googlecloudsdk/api_lib/accesscontextmanager/zones.py
Patch
bopopescu/JobSniperRails
python
def Patch(self, perimeter_ref, description=None, title=None, perimeter_type=None, resources=None, restricted_services=None, unrestricted_services=None, levels=None, ingress_allowed_services=None, vpc_allowed_services=None, bridge_allowed_services=None, enable_ingress_service_restriction=None, enable_vpc_service_restric...
def create(self, validated_data): 'Create a new user with validated password and return it' return get_user_model().objects.create_user(**validated_data)
8,558,868,365,978,276,000
Create a new user with validated password and return it
xojbackend/app/user/serializers.py
create
mazharkafi004/XOJ
python
def create(self, validated_data): return get_user_model().objects.create_user(**validated_data)
def update(self, instance, validated_data): 'update user data with encrypted password' password = validated_data.pop('password', None) user = super().update(instance, validated_data) if password: user.set_password(password) user.save() return user
3,703,274,701,840,843,000
update user data with encrypted password
xojbackend/app/user/serializers.py
update
mazharkafi004/XOJ
python
def update(self, instance, validated_data): password = validated_data.pop('password', None) user = super().update(instance, validated_data) if password: user.set_password(password) user.save() return user
def validate(self, attrs): 'validate and authenticate the user' email = attrs.get('email') password = attrs.get('password') user = authenticate(request=self.context.get('request'), username=email, password=password) if (not user): msg = _('Unable to authenticate with the provided credentials...
-7,865,784,348,675,763,000
validate and authenticate the user
xojbackend/app/user/serializers.py
validate
mazharkafi004/XOJ
python
def validate(self, attrs): email = attrs.get('email') password = attrs.get('password') user = authenticate(request=self.context.get('request'), username=email, password=password) if (not user): msg = _('Unable to authenticate with the provided credentials') raise serializers.Validat...
def create_or_update(self, resource_group_name, availability_set_name, parameters, **kwargs): 'Create or update an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set....
-1,283,394,762,818,203,600
Create or update an availability set. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param availability_set_name: The name of the availability set. :type availability_set_name: str :param parameters: Parameters supplied to the Create Availability Set operation. :type parame...
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py
create_or_update
00Kai0/azure-sdk-for-python
python
def create_or_update(self, resource_group_name, availability_set_name, parameters, **kwargs): 'Create or update an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set....
def update(self, resource_group_name, availability_set_name, parameters, **kwargs): 'Update an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set.\n :type avai...
459,799,859,112,720,300
Update an availability set. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param availability_set_name: The name of the availability set. :type availability_set_name: str :param parameters: Parameters supplied to the Update Availability Set operation. :type parameters: ~azu...
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py
update
00Kai0/azure-sdk-for-python
python
def update(self, resource_group_name, availability_set_name, parameters, **kwargs): 'Update an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set.\n :type avai...
def delete(self, resource_group_name, availability_set_name, **kwargs): 'Delete an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set.\n :type availability_set...
923,248,023,635,578,900
Delete an availability set. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param availability_set_name: The name of the availability set. :type availability_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None,...
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py
delete
00Kai0/azure-sdk-for-python
python
def delete(self, resource_group_name, availability_set_name, **kwargs): 'Delete an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set.\n :type availability_set...
def get(self, resource_group_name, availability_set_name, **kwargs): 'Retrieves information about an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set.\n :typ...
3,359,067,744,655,367,700
Retrieves information about an availability set. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param availability_set_name: The name of the availability set. :type availability_set_name: str :keyword callable cls: A custom type or function that will be passed the direct re...
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py
get
00Kai0/azure-sdk-for-python
python
def get(self, resource_group_name, availability_set_name, **kwargs): 'Retrieves information about an availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param availability_set_name: The name of the availability set.\n :typ...
def list_by_subscription(self, expand=None, **kwargs): 'Lists all availability sets in a subscription.\n\n :param expand: The expand expression to apply to the operation.\n :type expand: str\n :keyword callable cls: A custom type or function that will be passed the direct response\n :ret...
-4,662,806,663,185,924,000
Lists all availability sets in a subscription. :param expand: The expand expression to apply to the operation. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilitySetListResult or the result of cls(response)...
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py
list_by_subscription
00Kai0/azure-sdk-for-python
python
def list_by_subscription(self, expand=None, **kwargs): 'Lists all availability sets in a subscription.\n\n :param expand: The expand expression to apply to the operation.\n :type expand: str\n :keyword callable cls: A custom type or function that will be passed the direct response\n :ret...
def list(self, resource_group_name, **kwargs): 'Lists all availability sets in a resource group.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :keyword callable cls: A custom type or function that will be passed the direct response\n :...
8,732,512,862,638,445,000
Lists all availability sets in a resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailabilitySetListResult or the result of cl...
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py
list
00Kai0/azure-sdk-for-python
python
def list(self, resource_group_name, **kwargs): 'Lists all availability sets in a resource group.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :keyword callable cls: A custom type or function that will be passed the direct response\n :...
def list_available_sizes(self, resource_group_name, availability_set_name, **kwargs): 'Lists all available virtual machine sizes that can be used to create a new virtual machine in\n an existing availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group...
2,787,570,141,898,369,000
Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param availability_set_name: The name of the availability set. :type availability_set_n...
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py
list_available_sizes
00Kai0/azure-sdk-for-python
python
def list_available_sizes(self, resource_group_name, availability_set_name, **kwargs): 'Lists all available virtual machine sizes that can be used to create a new virtual machine in\n an existing availability set.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group...
@oneflow_export('tensor_buffer_to_tensor') @stable_api def tensor_buffer_to_tensor(x: oneflow._oneflow_internal.BlobDesc, dtype: flow.dtype, instance_shape: Sequence[int], name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc: "This operator converts the Blob's type from TensorBuffer to Tensor.\n Some ...
8,285,458,281,549,214,000
This operator converts the Blob's type from TensorBuffer to Tensor. Some operator's output data type is `TensorBuffer`, you can use this operator to convert back to `Tensor`. Refer to `Concept Explanation <https://docs.oneflow.org/basics_topics/concept_explanation.html#3tensorbuffer-tensorlist>`_ for more about Tensor...
oneflow/compatible_single_client_python/ops/tensor_buffer_ops.py
tensor_buffer_to_tensor
xcnick/oneflow
python
@oneflow_export('tensor_buffer_to_tensor') @stable_api def tensor_buffer_to_tensor(x: oneflow._oneflow_internal.BlobDesc, dtype: flow.dtype, instance_shape: Sequence[int], name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc: "This operator converts the Blob's type from TensorBuffer to Tensor.\n Some ...
@oneflow_export('tensor_to_tensor_buffer') @stable_api def tensor_to_tensor_buffer(x: oneflow._oneflow_internal.BlobDesc, instance_dims: int, name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc: "This operator converts the Blob's type from Tensor to TensorBuffer.\n\n Refer to `Concept Explanation <ht...
2,090,306,197,877,062,400
This operator converts the Blob's type from Tensor to TensorBuffer. Refer to `Concept Explanation <https://docs.oneflow.org/basics_topics/concept_explanation.html#3tensorbuffer-tensorlist>`_ for more about TensorBuffer. Args: x (oneflow._oneflow_internal.BlobDesc): Input `Blob`. instance_dims (int): The dime...
oneflow/compatible_single_client_python/ops/tensor_buffer_ops.py
tensor_to_tensor_buffer
xcnick/oneflow
python
@oneflow_export('tensor_to_tensor_buffer') @stable_api def tensor_to_tensor_buffer(x: oneflow._oneflow_internal.BlobDesc, instance_dims: int, name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc: "This operator converts the Blob's type from Tensor to TensorBuffer.\n\n Refer to `Concept Explanation <ht...
@oneflow_export('gen_tensor_buffer') @stable_api def gen_tensor_buffer(shape: Sequence[int], shape_list: Sequence[Sequence[int]], value_list: Sequence[float], data_type: Optional[flow.dtype]=flow.float32, dynamic_out: Optional[bool]=False, name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc: 'This opera...
-6,369,745,597,871,519,000
This operator generates a tensor buffer blob. Args: shape (Sequence[int]): shape of output blob shape_list ( Sequence[Sequence[int]]): shapes for tensor buffer in output blob value_list (Sequence[float]): values for tensor buffer in output blob data_type (Optional[flow.dtype]): data type for tensor buf...
oneflow/compatible_single_client_python/ops/tensor_buffer_ops.py
gen_tensor_buffer
xcnick/oneflow
python
@oneflow_export('gen_tensor_buffer') @stable_api def gen_tensor_buffer(shape: Sequence[int], shape_list: Sequence[Sequence[int]], value_list: Sequence[float], data_type: Optional[flow.dtype]=flow.float32, dynamic_out: Optional[bool]=False, name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc: 'This opera...
@oneflow_export('tensor_buffer_to_list_of_tensors') @stable_api def tensor_buffer_to_list_of_tensors(x: oneflow._oneflow_internal.BlobDesc, out_shape: Sequence[int], out_dtype: flow.dtype, dynamic_out: Optional[bool]=False, name: Optional[str]=None) -> List[oneflow._oneflow_internal.BlobDesc]: 'This operator conver...
1,525,385,519,540,934,400
This operator converts the Blob of TensorBuffer to list of Tensors. Every element in x will be converted to a Tensor and output will be flatten to a list. Args: x (BlobDesc): Input `Blob`, data type must be tensor buffer. out_shape (Sequence[int]): max shape for a tensor buffer in x out_dtype (flow.dtype,)...
oneflow/compatible_single_client_python/ops/tensor_buffer_ops.py
tensor_buffer_to_list_of_tensors
xcnick/oneflow
python
@oneflow_export('tensor_buffer_to_list_of_tensors') @stable_api def tensor_buffer_to_list_of_tensors(x: oneflow._oneflow_internal.BlobDesc, out_shape: Sequence[int], out_dtype: flow.dtype, dynamic_out: Optional[bool]=False, name: Optional[str]=None) -> List[oneflow._oneflow_internal.BlobDesc]: 'This operator conver...
def __init__(self, args): "[summary]Initialization of Box's parameters\n\n Args:\n args ([numpy array list]): [this argument represents the bounds of the box]\n " self.bounds = args
5,110,870,955,732,952,000
[summary]Initialization of Box's parameters Args: args ([numpy array list]): [this argument represents the bounds of the box]
src/lab2/box_window.py
__init__
AmineAitLemqeddem/sdia-python
python
def __init__(self, args): "[summary]Initialization of Box's parameters\n\n Args:\n args ([numpy array list]): [this argument represents the bounds of the box]\n " self.bounds = args
def __str__(self): "[summary] BoxWindow: :math:`[a_1, b_1] \times [a_2, b_2] \times \\cdots`\n\n Returns:\n [str]: [description of the Box's bounds]\n " shape = self.bounds.shape representation = 'BoxWindow: ' for i in range((shape[0] - 1)): representation = ((((((repres...
-1,319,349,516,868,488,000
[summary] BoxWindow: :math:`[a_1, b_1] imes [a_2, b_2] imes \cdots` Returns: [str]: [description of the Box's bounds]
src/lab2/box_window.py
__str__
AmineAitLemqeddem/sdia-python
python
def __str__(self): "[summary] BoxWindow: :math:`[a_1, b_1] \times [a_2, b_2] \times \\cdots`\n\n Returns:\n [str]: [description of the Box's bounds]\n " shape = self.bounds.shape representation = 'BoxWindow: ' for i in range((shape[0] - 1)): representation = ((((((repres...
def __len__(self): '[summary]\n\n Returns:\n [int: [the dimension of the box]\n ' return self.bounds.shape[0]
-1,972,206,058,471,564,000
[summary] Returns: [int: [the dimension of the box]
src/lab2/box_window.py
__len__
AmineAitLemqeddem/sdia-python
python
def __len__(self): '[summary]\n\n Returns:\n [int: [the dimension of the box]\n ' return self.bounds.shape[0]
def __contains__(self, args): '[summary]This method tests if an element (args) is inside the box\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the box , False if not]\n ' flag = True for i in rang...
5,534,255,717,289,143,000
[summary]This method tests if an element (args) is inside the box Args: args ([numpy array list]): [the element to test] Returns: [bool]: [True if the element is inside the box , False if not]
src/lab2/box_window.py
__contains__
AmineAitLemqeddem/sdia-python
python
def __contains__(self, args): '[summary]This method tests if an element (args) is inside the box\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the box , False if not]\n ' flag = True for i in rang...
def dimension(self): '[summary]\n This method is similar to the method __len__ described above\n ' return self.__len__()
-8,704,261,820,415,596,000
[summary] This method is similar to the method __len__ described above
src/lab2/box_window.py
dimension
AmineAitLemqeddem/sdia-python
python
def dimension(self): '[summary]\n This method is similar to the method __len__ described above\n ' return self.__len__()
def volume(self): '[summary]\n This method calculates the volume of the Box\n ' v = 1 for i in range(self.dimension()): v = (v * abs((self.bounds[i][1] - self.bounds[i][0]))) return v
7,349,744,758,689,294,000
[summary] This method calculates the volume of the Box
src/lab2/box_window.py
volume
AmineAitLemqeddem/sdia-python
python
def volume(self): '[summary]\n This method calculates the volume of the Box\n ' v = 1 for i in range(self.dimension()): v = (v * abs((self.bounds[i][1] - self.bounds[i][0]))) return v
def indicator_function(self, args): '[summary]\n This method is similar to the method __contains__ described above\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the box , False if not]\n ' if...
2,137,572,310,699,039,200
[summary] This method is similar to the method __contains__ described above Args: args ([numpy array list]): [the element to test] Returns: [bool]: [True if the element is inside the box , False if not]
src/lab2/box_window.py
indicator_function
AmineAitLemqeddem/sdia-python
python
def indicator_function(self, args): '[summary]\n This method is similar to the method __contains__ described above\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the box , False if not]\n ' if...
def center(self): '[summary] determinate the center of the box\n\n Returns:\n [numpy array list]: [the center of the box]\n ' c = np.zeros(self.__len__()) for i in range(self.__len__()): c[i] = np.mean(self.bounds[i]) return c
-2,764,501,514,137,764,400
[summary] determinate the center of the box Returns: [numpy array list]: [the center of the box]
src/lab2/box_window.py
center
AmineAitLemqeddem/sdia-python
python
def center(self): '[summary] determinate the center of the box\n\n Returns:\n [numpy array list]: [the center of the box]\n ' c = np.zeros(self.__len__()) for i in range(self.__len__()): c[i] = np.mean(self.bounds[i]) return c
def rand(self, n=1, rng=None): '[summary]\n Generate ``n`` points uniformly at random inside the :py:class:`BoxWindow`.\n\n Args:\n n (int, optional): [description]. Defaults to 1.\n rng ([type], optional): [description]. Defaults to None.\n\n Returns:\n Randoml...
-2,167,868,873,684,034,000
[summary] Generate ``n`` points uniformly at random inside the :py:class:`BoxWindow`. Args: n (int, optional): [description]. Defaults to 1. rng ([type], optional): [description]. Defaults to None. Returns: Randomly n elements that belong to the box
src/lab2/box_window.py
rand
AmineAitLemqeddem/sdia-python
python
def rand(self, n=1, rng=None): '[summary]\n Generate ``n`` points uniformly at random inside the :py:class:`BoxWindow`.\n\n Args:\n n (int, optional): [description]. Defaults to 1.\n rng ([type], optional): [description]. Defaults to None.\n\n Returns:\n Randoml...
def __init__(self, center, dimension): '[summary]a subclass of BoxWindow,represents the notion of "unit square box"\n\n Args:\n dimension ([int]): [dimension of the Unit Box]\n center ([numpy array list], optional): [center of the Box].\n ' self.bounds = np.array([[(center[i]...
-2,923,598,614,726,070,000
[summary]a subclass of BoxWindow,represents the notion of "unit square box" Args: dimension ([int]): [dimension of the Unit Box] center ([numpy array list], optional): [center of the Box].
src/lab2/box_window.py
__init__
AmineAitLemqeddem/sdia-python
python
def __init__(self, center, dimension): '[summary]a subclass of BoxWindow,represents the notion of "unit square box"\n\n Args:\n dimension ([int]): [dimension of the Unit Box]\n center ([numpy array list], optional): [center of the Box].\n ' self.bounds = np.array([[(center[i]...
def __init__(self, center, radius, dimension): "[summary]Initialization of Box's parameters\n\n Args:\n args ([numpy array list]): [this argument represents the bounds of the box]\n " self.dim = dimension self.rad = radius self.cent = center
-8,616,126,886,397,049,000
[summary]Initialization of Box's parameters Args: args ([numpy array list]): [this argument represents the bounds of the box]
src/lab2/box_window.py
__init__
AmineAitLemqeddem/sdia-python
python
def __init__(self, center, radius, dimension): "[summary]Initialization of Box's parameters\n\n Args:\n args ([numpy array list]): [this argument represents the bounds of the box]\n " self.dim = dimension self.rad = radius self.cent = center
def __contains__(self, args): '[summary]This method tests if an element (args) is inside the ball\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the ball , False if not]\n ' flag = True if (len(arg...
2,666,685,982,397,654,500
[summary]This method tests if an element (args) is inside the ball Args: args ([numpy array list]): [the element to test] Returns: [bool]: [True if the element is inside the ball , False if not]
src/lab2/box_window.py
__contains__
AmineAitLemqeddem/sdia-python
python
def __contains__(self, args): '[summary]This method tests if an element (args) is inside the ball\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the ball , False if not]\n ' flag = True if (len(arg...
def dimension(self): '[summary]\n This method gives the dimension of the ball\n ' return self.dim
3,239,927,561,274,666,500
[summary] This method gives the dimension of the ball
src/lab2/box_window.py
dimension
AmineAitLemqeddem/sdia-python
python
def dimension(self): '[summary]\n This method gives the dimension of the ball\n ' return self.dim
def volume(self): '[summary]\n This method calculates the volume of the Ball using the formula :math:` V_{n+1} =\\int_{-r}^{r}V_{n}(\\sqrt{r^2 -x^2})dx`\n ' v = 1 for i in range(self.dimension()): integ = (lambda x: (v * np.sqrt(((self.rad ** 2) - (x ** 2))))) v = integrate.qua...
8,720,640,683,625,807,000
[summary] This method calculates the volume of the Ball using the formula :math:` V_{n+1} =\int_{-r}^{r}V_{n}(\sqrt{r^2 -x^2})dx`
src/lab2/box_window.py
volume
AmineAitLemqeddem/sdia-python
python
def volume(self): '[summary]\n This method calculates the volume of the Ball using the formula :math:` V_{n+1} =\\int_{-r}^{r}V_{n}(\\sqrt{r^2 -x^2})dx`\n ' v = 1 for i in range(self.dimension()): integ = (lambda x: (v * np.sqrt(((self.rad ** 2) - (x ** 2))))) v = integrate.qua...
def indicator_function(self, args): '[summary]\n This method is similar to the method __contains__ described above\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the ball , False if not]\n ' i...
4,032,711,684,902,406,700
[summary] This method is similar to the method __contains__ described above Args: args ([numpy array list]): [the element to test] Returns: [bool]: [True if the element is inside the ball , False if not]
src/lab2/box_window.py
indicator_function
AmineAitLemqeddem/sdia-python
python
def indicator_function(self, args): '[summary]\n This method is similar to the method __contains__ described above\n\n Args:\n args ([numpy array list]): [the element to test]\n\n Returns:\n [bool]: [True if the element is inside the ball , False if not]\n ' i...
def center(self): '[summary] determinate the center of the ball\n\n Returns:\n [numpy array list]: [the center of the ball]\n ' c = np.zeros(self.__len__()) for i in range(self.__len__()): c[i] = np.mean(self.bounds[i]) return c
-3,314,628,522,506,350,000
[summary] determinate the center of the ball Returns: [numpy array list]: [the center of the ball]
src/lab2/box_window.py
center
AmineAitLemqeddem/sdia-python
python
def center(self): '[summary] determinate the center of the ball\n\n Returns:\n [numpy array list]: [the center of the ball]\n ' c = np.zeros(self.__len__()) for i in range(self.__len__()): c[i] = np.mean(self.bounds[i]) return c
def get_minibatch(roidb, num_classes): 'Given a mini batch of roidb, construct a data blob from it.' num_images = len(roidb) random_scale_inds = npr.randint(0, high=len(cfg.TRAIN.SCALES), size=num_images) assert ((cfg.TRAIN.BATCH_SIZE % num_images) == 0), 'num_images ({}) must divide BATCH_SIZE ({})'.fo...
-4,010,111,006,179,366,000
Given a mini batch of roidb, construct a data blob from it.
lib/roi_data_layer/minibatch.py
get_minibatch
Alex-Sol/scene-graph-TF-release
python
def get_minibatch(roidb, num_classes): num_images = len(roidb) random_scale_inds = npr.randint(0, high=len(cfg.TRAIN.SCALES), size=num_images) assert ((cfg.TRAIN.BATCH_SIZE % num_images) == 0), 'num_images ({}) must divide BATCH_SIZE ({})'.format(num_images, cfg.TRAIN.BATCH_SIZE) rois_per_image = (...
def _gather_samples(roidb, roi_inds, rels, num_classes): '\n join all samples and produce sampled items\n ' rois = roidb['boxes'] labels = roidb['max_classes'] overlaps = roidb['max_overlaps'] bg_inds = np.where((overlaps < cfg.TRAIN.FG_THRESH))[0] labels = labels.copy() labels[bg_inds...
-488,402,704,682,701,800
join all samples and produce sampled items
lib/roi_data_layer/minibatch.py
_gather_samples
Alex-Sol/scene-graph-TF-release
python
def _gather_samples(roidb, roi_inds, rels, num_classes): '\n \n ' rois = roidb['boxes'] labels = roidb['max_classes'] overlaps = roidb['max_overlaps'] bg_inds = np.where((overlaps < cfg.TRAIN.FG_THRESH))[0] labels = labels.copy() labels[bg_inds] = 0 labels = labels[roi_inds] ov...
def _sample_graph(roidb, num_fg_rois, num_rois, num_neg_rels=128): '\n Sample a graph from the foreground rois of an image\n\n roidb: roidb of an image\n rois_per_image: maximum number of rois per image\n ' gt_rels = roidb['gt_relations'] fg_gt_ind_assignments = roidb['fg_gt_ind_assignments'] ...
-4,104,330,219,477,050,400
Sample a graph from the foreground rois of an image roidb: roidb of an image rois_per_image: maximum number of rois per image
lib/roi_data_layer/minibatch.py
_sample_graph
Alex-Sol/scene-graph-TF-release
python
def _sample_graph(roidb, num_fg_rois, num_rois, num_neg_rels=128): '\n Sample a graph from the foreground rois of an image\n\n roidb: roidb of an image\n rois_per_image: maximum number of rois per image\n ' gt_rels = roidb['gt_relations'] fg_gt_ind_assignments = roidb['fg_gt_ind_assignments'] ...
def _sample_bg_rois(roidb, num_bg_rois): '\n Sample rois from background\n ' labels = roidb['max_classes'] overlaps = roidb['max_overlaps'] bg_inds = np.where((((overlaps < cfg.TRAIN.BG_THRESH_HI) & (overlaps >= cfg.TRAIN.BG_THRESH_LO)) | (labels == 0)))[0] bg_rois_per_this_image = np.minimum(...
3,924,593,662,606,184,400
Sample rois from background
lib/roi_data_layer/minibatch.py
_sample_bg_rois
Alex-Sol/scene-graph-TF-release
python
def _sample_bg_rois(roidb, num_bg_rois): '\n \n ' labels = roidb['max_classes'] overlaps = roidb['max_overlaps'] bg_inds = np.where((((overlaps < cfg.TRAIN.BG_THRESH_HI) & (overlaps >= cfg.TRAIN.BG_THRESH_LO)) | (labels == 0)))[0] bg_rois_per_this_image = np.minimum(num_bg_rois, bg_inds.size) ...
def _get_image_blob(roidb, scale_inds): 'Builds an input blob from the images in the roidb at the specified\n scales.\n ' num_images = len(roidb) processed_ims = [] im_scales = [] for i in xrange(num_images): im = roidb[i]['image']() if roidb[i]['flipped']: im = im[...
4,838,210,901,424,313,000
Builds an input blob from the images in the roidb at the specified scales.
lib/roi_data_layer/minibatch.py
_get_image_blob
Alex-Sol/scene-graph-TF-release
python
def _get_image_blob(roidb, scale_inds): 'Builds an input blob from the images in the roidb at the specified\n scales.\n ' num_images = len(roidb) processed_ims = [] im_scales = [] for i in xrange(num_images): im = roidb[i]['image']() if roidb[i]['flipped']: im = im[...
def _project_im_rois(im_rois, im_scale_factor): 'Project image RoIs into the rescaled training image.' rois = (im_rois * im_scale_factor) return rois
-1,758,947,012,524,473,000
Project image RoIs into the rescaled training image.
lib/roi_data_layer/minibatch.py
_project_im_rois
Alex-Sol/scene-graph-TF-release
python
def _project_im_rois(im_rois, im_scale_factor): rois = (im_rois * im_scale_factor) return rois
def _get_bbox_regression_labels(bbox_target_data, num_classes): 'Bounding-box regression targets are stored in a compact form in the\n roidb.\n\n This function expands those targets into the 4-of-4*K representation used\n by the network (i.e. only one class has non-zero targets). The loss weights\n are ...
-5,585,201,523,274,370,000
Bounding-box regression targets are stored in a compact form in the roidb. This function expands those targets into the 4-of-4*K representation used by the network (i.e. only one class has non-zero targets). The loss weights are similarly expanded. Returns: bbox_target_data (ndarray): N x 4K blob of regression ta...
lib/roi_data_layer/minibatch.py
_get_bbox_regression_labels
Alex-Sol/scene-graph-TF-release
python
def _get_bbox_regression_labels(bbox_target_data, num_classes): 'Bounding-box regression targets are stored in a compact form in the\n roidb.\n\n This function expands those targets into the 4-of-4*K representation used\n by the network (i.e. only one class has non-zero targets). The loss weights\n are ...
@staticmethod def random_choice(args: List[Any], n: int=1): '\n pick a random element from a set.\n \n Example:\n >> sampler = RandomSearch.random_choice(1,2,3)\n >> sampler()\n 2\n ' choices = [] for arg in args: choices.append(arg) ...
-7,495,781,368,315,496,000
pick a random element from a set. Example: >> sampler = RandomSearch.random_choice(1,2,3) >> sampler() 2
lr/hyperparameters.py
random_choice
kernelmachine/quality-filter
python
@staticmethod def random_choice(args: List[Any], n: int=1): '\n pick a random element from a set.\n \n Example:\n >> sampler = RandomSearch.random_choice(1,2,3)\n >> sampler()\n 2\n ' choices = [] for arg in args: choices.append(arg) ...
@staticmethod def random_integer(low: Union[(int, float)], high: Union[(int, float)]): '\n pick a random integer between two bounds\n \n Example:\n >> sampler = RandomSearch.random_integer(1, 10)\n >> sampler()\n 9\n ' return (lambda : int(np.rand...
2,527,066,972,184,185,300
pick a random integer between two bounds Example: >> sampler = RandomSearch.random_integer(1, 10) >> sampler() 9
lr/hyperparameters.py
random_integer
kernelmachine/quality-filter
python
@staticmethod def random_integer(low: Union[(int, float)], high: Union[(int, float)]): '\n pick a random integer between two bounds\n \n Example:\n >> sampler = RandomSearch.random_integer(1, 10)\n >> sampler()\n 9\n ' return (lambda : int(np.rand...
@staticmethod def random_loguniform(low: Union[(float, int)], high: Union[(float, int)]): '\n pick a random float between two bounds, using loguniform distribution\n \n Example:\n >> sampler = RandomSearch.random_loguniform(1e-5, 1e-2)\n >> sampler()\n 0.000...
-1,493,134,483,308,338,200
pick a random float between two bounds, using loguniform distribution Example: >> sampler = RandomSearch.random_loguniform(1e-5, 1e-2) >> sampler() 0.0004
lr/hyperparameters.py
random_loguniform
kernelmachine/quality-filter
python
@staticmethod def random_loguniform(low: Union[(float, int)], high: Union[(float, int)]): '\n pick a random float between two bounds, using loguniform distribution\n \n Example:\n >> sampler = RandomSearch.random_loguniform(1e-5, 1e-2)\n >> sampler()\n 0.000...
@staticmethod def random_uniform(low: Union[(float, int)], high: Union[(float, int)]): '\n pick a random float between two bounds, using uniform distribution\n \n Example:\n >> sampler = RandomSearch.random_uniform(0, 1)\n >> sampler()\n 0.01\n ' ...
5,574,592,011,469,580,000
pick a random float between two bounds, using uniform distribution Example: >> sampler = RandomSearch.random_uniform(0, 1) >> sampler() 0.01
lr/hyperparameters.py
random_uniform
kernelmachine/quality-filter
python
@staticmethod def random_uniform(low: Union[(float, int)], high: Union[(float, int)]): '\n pick a random float between two bounds, using uniform distribution\n \n Example:\n >> sampler = RandomSearch.random_uniform(0, 1)\n >> sampler()\n 0.01\n ' ...
def callback(func: CALLABLE_T) -> CALLABLE_T: 'Annotation to mark method as safe to call from within the event loop.' setattr(func, '_edge_callback', True) return func
2,672,397,233,697,125,000
Annotation to mark method as safe to call from within the event loop.
merceedge/util/async_util.py
callback
hobo0cn/MerceEdge
python
def callback(func: CALLABLE_T) -> CALLABLE_T: setattr(func, '_edge_callback', True) return func