blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
1423a4714fb97c11f009780be5ebd352d13949b8
[ "self.modifier = modifier\nself.lamda = lamda if lamda is not None else 0.005\nself.regularizer = regularizer if regularizer is not None else Regularization.L2regularizer", "deltaparameters = dict()\nfor parameter in self.modifier.layer.parameters:\n deltaparameters[parameter] = numpy.multiply(self.lamda, self...
<|body_start_0|> self.modifier = modifier self.lamda = lamda if lamda is not None else 0.005 self.regularizer = regularizer if regularizer is not None else Regularization.L2regularizer <|end_body_0|> <|body_start_1|> deltaparameters = dict() for parameter in self.modifier.layer....
Regularization Modifier Class Mathematically, E = E + p * f(w)
Regularization
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Regularization: """Regularization Modifier Class Mathematically, E = E + p * f(w)""" def __init__(self, modifier, lamda=None, regularizer=None): """Constructor : param modifier : modifier to which regularization is to be applied : param lamda : p, as given in its mathematical express...
stack_v2_sparse_classes_36k_train_011000
17,243
no_license
[ { "docstring": "Constructor : param modifier : modifier to which regularization is to be applied : param lamda : p, as given in its mathematical expression : param regularizer : f, as given in its mathematical expression", "name": "__init__", "signature": "def __init__(self, modifier, lamda=None, regula...
2
stack_v2_sparse_classes_30k_train_021317
Implement the Python class `Regularization` described below. Class description: Regularization Modifier Class Mathematically, E = E + p * f(w) Method signatures and docstrings: - def __init__(self, modifier, lamda=None, regularizer=None): Constructor : param modifier : modifier to which regularization is to be applie...
Implement the Python class `Regularization` described below. Class description: Regularization Modifier Class Mathematically, E = E + p * f(w) Method signatures and docstrings: - def __init__(self, modifier, lamda=None, regularizer=None): Constructor : param modifier : modifier to which regularization is to be applie...
10ee6e2297b7a2e01165ef983ae34097d7178122
<|skeleton|> class Regularization: """Regularization Modifier Class Mathematically, E = E + p * f(w)""" def __init__(self, modifier, lamda=None, regularizer=None): """Constructor : param modifier : modifier to which regularization is to be applied : param lamda : p, as given in its mathematical express...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Regularization: """Regularization Modifier Class Mathematically, E = E + p * f(w)""" def __init__(self, modifier, lamda=None, regularizer=None): """Constructor : param modifier : modifier to which regularization is to be applied : param lamda : p, as given in its mathematical expression : param r...
the_stack_v2_python_sparse
net/modifier.py
sunilmallya-work/NET
train
0
9df2b00dc22785519e83dd06293c9c9f4addeee8
[ "self.current_md5 = dict()\nself.previous_md5 = dict()\nself.config_filename = dict()\nself.config_dir = None\nself.existing_config_hostnames = None", "if not os.path.isdir(config.SETTINGS.main.configs_directory):\n os.mkdir(config.SETTINGS.main.configs_directory)\n LOGGER.debug('Configs directory created a...
<|body_start_0|> self.current_md5 = dict() self.previous_md5 = dict() self.config_filename = dict() self.config_dir = None self.existing_config_hostnames = None <|end_body_0|> <|body_start_1|> if not os.path.isdir(config.SETTINGS.main.configs_directory): os.m...
GetConfig processor for the network_importer.
GetConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetConfig: """GetConfig processor for the network_importer.""" def __init__(self) -> None: """Initialize the processor and ensure some variables are properly initialized.""" <|body_0|> def task_started(self, task: Task) -> None: """Execute some house keeping item...
stack_v2_sparse_classes_36k_train_011001
5,878
permissive
[ { "docstring": "Initialize the processor and ensure some variables are properly initialized.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Execute some house keeping item at the beginning at the execution. Before Update all the config file: - ensure that the ...
5
stack_v2_sparse_classes_30k_train_006569
Implement the Python class `GetConfig` described below. Class description: GetConfig processor for the network_importer. Method signatures and docstrings: - def __init__(self) -> None: Initialize the processor and ensure some variables are properly initialized. - def task_started(self, task: Task) -> None: Execute so...
Implement the Python class `GetConfig` described below. Class description: GetConfig processor for the network_importer. Method signatures and docstrings: - def __init__(self) -> None: Initialize the processor and ensure some variables are properly initialized. - def task_started(self, task: Task) -> None: Execute so...
1530eb838727b2b6fbec515b2d06d902e88f9b35
<|skeleton|> class GetConfig: """GetConfig processor for the network_importer.""" def __init__(self) -> None: """Initialize the processor and ensure some variables are properly initialized.""" <|body_0|> def task_started(self, task: Task) -> None: """Execute some house keeping item...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetConfig: """GetConfig processor for the network_importer.""" def __init__(self) -> None: """Initialize the processor and ensure some variables are properly initialized.""" self.current_md5 = dict() self.previous_md5 = dict() self.config_filename = dict() self.con...
the_stack_v2_python_sparse
network_importer/processors/get_config.py
gladpark/network-importer
train
0
8c847e87b6a1421a099eabd9a39eaf8252736f0a
[ "string_to_sign = '%s\\n%s\\n' % (verb, path)\nparams['signature_method'] = self.algorithm()\nkeys = sorted(params.keys())\npairs = []\nfor key in keys:\n val = get_utf8_value(params[key])\n pairs.append(urllib.quote(key, safe='') + '=' + urllib.quote(val, safe='-_~'))\nqs = '&'.join(pairs)\nstring_to_sign +=...
<|body_start_0|> string_to_sign = '%s\n%s\n' % (verb, path) params['signature_method'] = self.algorithm() keys = sorted(params.keys()) pairs = [] for key in keys: val = get_utf8_value(params[key]) pairs.append(urllib.quote(key, safe='') + '=' + urllib.quot...
Provides Query Signature Authentication.
QuerySignatureAuthHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuerySignatureAuthHandler: """Provides Query Signature Authentication.""" def _calc_signature(self, params, verb, path): """calc signature for request""" <|body_0|> def add_auth(self, req, **kwargs): """add authorize information for request""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_011002
4,332
no_license
[ { "docstring": "calc signature for request", "name": "_calc_signature", "signature": "def _calc_signature(self, params, verb, path)" }, { "docstring": "add authorize information for request", "name": "add_auth", "signature": "def add_auth(self, req, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_009823
Implement the Python class `QuerySignatureAuthHandler` described below. Class description: Provides Query Signature Authentication. Method signatures and docstrings: - def _calc_signature(self, params, verb, path): calc signature for request - def add_auth(self, req, **kwargs): add authorize information for request
Implement the Python class `QuerySignatureAuthHandler` described below. Class description: Provides Query Signature Authentication. Method signatures and docstrings: - def _calc_signature(self, params, verb, path): calc signature for request - def add_auth(self, req, **kwargs): add authorize information for request ...
597bebdd067a74b65206210858785d1414701739
<|skeleton|> class QuerySignatureAuthHandler: """Provides Query Signature Authentication.""" def _calc_signature(self, params, verb, path): """calc signature for request""" <|body_0|> def add_auth(self, req, **kwargs): """add authorize information for request""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuerySignatureAuthHandler: """Provides Query Signature Authentication.""" def _calc_signature(self, params, verb, path): """calc signature for request""" string_to_sign = '%s\n%s\n' % (verb, path) params['signature_method'] = self.algorithm() keys = sorted(params.keys()) ...
the_stack_v2_python_sparse
source/esdk_fc_neadp_1.5_native_python/src/com/huawei/client/auth.py
dinghuaming/esdk_fc_neadp_1.5_native_python
train
0
2e303c43098f5dbb41096616a5f2fe2682d33b78
[ "super(GaussianProcessRegression, self).__init__(kernel=kernel, sigma=sigma, a=a, b=b, h=h, theta=theta)\nself.alpha = alpha\nself.beta = beta", "self.X = X\nself.y = y\nC = self.gram_func(X) / self.alpha + np.eye(X.shape[0]) / self.beta\nself.C_inv = np.linalg.inv(C)", "gram_mat = np.zeros((self.X.shape[0], X....
<|body_start_0|> super(GaussianProcessRegression, self).__init__(kernel=kernel, sigma=sigma, a=a, b=b, h=h, theta=theta) self.alpha = alpha self.beta = beta <|end_body_0|> <|body_start_1|> self.X = X self.y = y C = self.gram_func(X) / self.alpha + np.eye(X.shape[0]) / se...
GaussianProcessregression Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha,beta (float) : hyperparameter C_inv (2-D array) : inverse of C
GaussianProcessRegression
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianProcessRegression: """GaussianProcessregression Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha,beta (float) : hyperparameter C_inv (2-D array) : inverse of C""" def __init__(self, alpha=1.0, beta=5.0, kernel='L...
stack_v2_sparse_classes_36k_train_011003
10,708
permissive
[ { "docstring": "Args: alpha,beta (float) : hyperparameter kernel (string) : kernel type (default \"Linear\"). you can choose \"Linear\",\"Gaussian\",\"Sigmoid\",\"RBF\",\"Exponential\" sigma (float) : for \"Gaussian\" kernel a,b (float) : for \"Sigmoid\" kernel h (function) : for \"RBF\" kernel theta (float) : ...
3
stack_v2_sparse_classes_30k_train_008350
Implement the Python class `GaussianProcessRegression` described below. Class description: GaussianProcessregression Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha,beta (float) : hyperparameter C_inv (2-D array) : inverse of C Method signatures...
Implement the Python class `GaussianProcessRegression` described below. Class description: GaussianProcessregression Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha,beta (float) : hyperparameter C_inv (2-D array) : inverse of C Method signatures...
992f2c07e88b2bad331e08303bdba84684f04d40
<|skeleton|> class GaussianProcessRegression: """GaussianProcessregression Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha,beta (float) : hyperparameter C_inv (2-D array) : inverse of C""" def __init__(self, alpha=1.0, beta=5.0, kernel='L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianProcessRegression: """GaussianProcessregression Attributes: kernel_func (function) : kernel function k(x,y) gram_func (function) : function which make gram matrix alpha,beta (float) : hyperparameter C_inv (2-D array) : inverse of C""" def __init__(self, alpha=1.0, beta=5.0, kernel='Linear', sigma...
the_stack_v2_python_sparse
prml/kernel_method.py
hedwig100/PRML
train
1
ee085830d6addf6865f897efa657003ff26123ef
[ "time.sleep(2)\nsuper().show_tree()\nsuper().dwzh_hzz()\nsuper().change_iframe('核准制业务申报')\nsuper().data_add()\nsuper().first_businesstype('73')\nsuper().first_accountattr('2')\nsuper().sure_yes()\nsuper().add_ele_50_71_72_73_74('accountno', test_number)\nsuper().add_ele_50_71_72_73_74('accountname', test_text)\nsup...
<|body_start_0|> time.sleep(2) super().show_tree() super().dwzh_hzz() super().change_iframe('核准制业务申报') super().data_add() super().first_businesstype('73') super().first_accountattr('2') super().sure_yes() super().add_ele_50_71_72_73_74('accountno',...
账户核准制增加73类型
hzz_data_add_73
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hzz_data_add_73: """账户核准制增加73类型""" def test_73_2(self): """73_2 类型测试""" <|body_0|> def test_73_3(self): """73_3 类型测试""" <|body_1|> def test_73_4(self): """73_4 类型测试""" <|body_2|> def test_73_6(self): """73_6 类型测试""" ...
stack_v2_sparse_classes_36k_train_011004
4,796
no_license
[ { "docstring": "73_2 类型测试", "name": "test_73_2", "signature": "def test_73_2(self)" }, { "docstring": "73_3 类型测试", "name": "test_73_3", "signature": "def test_73_3(self)" }, { "docstring": "73_4 类型测试", "name": "test_73_4", "signature": "def test_73_4(self)" }, { "...
6
stack_v2_sparse_classes_30k_test_000090
Implement the Python class `hzz_data_add_73` described below. Class description: 账户核准制增加73类型 Method signatures and docstrings: - def test_73_2(self): 73_2 类型测试 - def test_73_3(self): 73_3 类型测试 - def test_73_4(self): 73_4 类型测试 - def test_73_6(self): 73_6 类型测试 - def test_73_7(self): 73_7 类型测试 - def test_73_8(self): 73_...
Implement the Python class `hzz_data_add_73` described below. Class description: 账户核准制增加73类型 Method signatures and docstrings: - def test_73_2(self): 73_2 类型测试 - def test_73_3(self): 73_3 类型测试 - def test_73_4(self): 73_4 类型测试 - def test_73_6(self): 73_6 类型测试 - def test_73_7(self): 73_7 类型测试 - def test_73_8(self): 73_...
2d1d5ae7abc59deeae7a574a61dd394da7b5c1d0
<|skeleton|> class hzz_data_add_73: """账户核准制增加73类型""" def test_73_2(self): """73_2 类型测试""" <|body_0|> def test_73_3(self): """73_3 类型测试""" <|body_1|> def test_73_4(self): """73_4 类型测试""" <|body_2|> def test_73_6(self): """73_6 类型测试""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class hzz_data_add_73: """账户核准制增加73类型""" def test_73_2(self): """73_2 类型测试""" time.sleep(2) super().show_tree() super().dwzh_hzz() super().change_iframe('核准制业务申报') super().data_add() super().first_businesstype('73') super().first_accountattr('2') ...
the_stack_v2_python_sparse
prehost/test_suite/hzz_zj_73.py
fclm1316/acct_test
train
0
e96945fababa77d483574550ab01855da9d66d98
[ "permission = AdministerOrganizationPermission(orgname)\nif permission.can():\n request_data = request.get_json()\n plan = request_data['plan']\n success_url = request_data.get('success_url')\n cancel_url = request_data.get('cancel_url')\n if not success_url or not cancel_url:\n raise InvalidR...
<|body_start_0|> permission = AdministerOrganizationPermission(orgname) if permission.can(): request_data = request.get_json() plan = request_data['plan'] success_url = request_data.get('success_url') cancel_url = request_data.get('cancel_url') ...
Resource for managing a org's subscription.
OrganizationPlan
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationPlan: """Resource for managing a org's subscription.""" def post(self, orgname): """Create the org's subscription. Returns a Stripe checkout session.""" <|body_0|> def put(self, orgname): """Update the org's subscription.""" <|body_1|> de...
stack_v2_sparse_classes_36k_train_011005
33,890
permissive
[ { "docstring": "Create the org's subscription. Returns a Stripe checkout session.", "name": "post", "signature": "def post(self, orgname)" }, { "docstring": "Update the org's subscription.", "name": "put", "signature": "def put(self, orgname)" }, { "docstring": "Fetch any existin...
3
stack_v2_sparse_classes_30k_val_000073
Implement the Python class `OrganizationPlan` described below. Class description: Resource for managing a org's subscription. Method signatures and docstrings: - def post(self, orgname): Create the org's subscription. Returns a Stripe checkout session. - def put(self, orgname): Update the org's subscription. - def ge...
Implement the Python class `OrganizationPlan` described below. Class description: Resource for managing a org's subscription. Method signatures and docstrings: - def post(self, orgname): Create the org's subscription. Returns a Stripe checkout session. - def put(self, orgname): Update the org's subscription. - def ge...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class OrganizationPlan: """Resource for managing a org's subscription.""" def post(self, orgname): """Create the org's subscription. Returns a Stripe checkout session.""" <|body_0|> def put(self, orgname): """Update the org's subscription.""" <|body_1|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationPlan: """Resource for managing a org's subscription.""" def post(self, orgname): """Create the org's subscription. Returns a Stripe checkout session.""" permission = AdministerOrganizationPermission(orgname) if permission.can(): request_data = request.get_j...
the_stack_v2_python_sparse
endpoints/api/billing.py
quay/quay
train
2,363
57bd9b15f951dd305b696db00a30210deb556577
[ "conn = self.get_connection(self.conn_id)\nconnection_string: str = str(conn.schema)\nif connection_string:\n client = ServiceBusAdministrationClient.from_connection_string(connection_string)\nelse:\n extras = conn.extra_dejson\n credential: str | DefaultAzureCredential = self._get_field(extras=extras, fie...
<|body_start_0|> conn = self.get_connection(self.conn_id) connection_string: str = str(conn.schema) if connection_string: client = ServiceBusAdministrationClient.from_connection_string(connection_string) else: extras = conn.extra_dejson credential: str...
Interact with the ServiceBusAdministrationClient. This can create, update, list, and delete resources of a Service Bus namespace. This hook uses the same Azure Service Bus client connection inherited from the base class.
AdminClientHook
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminClientHook: """Interact with the ServiceBusAdministrationClient. This can create, update, list, and delete resources of a Service Bus namespace. This hook uses the same Azure Service Bus client connection inherited from the base class.""" def get_conn(self) -> ServiceBusAdministrationCl...
stack_v2_sparse_classes_36k_train_011006
13,275
permissive
[ { "docstring": "Create a ServiceBusAdministrationClient instance. This uses the connection string in connection details.", "name": "get_conn", "signature": "def get_conn(self) -> ServiceBusAdministrationClient" }, { "docstring": "Create Queue by connecting to service Bus Admin client return the ...
4
stack_v2_sparse_classes_30k_val_000829
Implement the Python class `AdminClientHook` described below. Class description: Interact with the ServiceBusAdministrationClient. This can create, update, list, and delete resources of a Service Bus namespace. This hook uses the same Azure Service Bus client connection inherited from the base class. Method signature...
Implement the Python class `AdminClientHook` described below. Class description: Interact with the ServiceBusAdministrationClient. This can create, update, list, and delete resources of a Service Bus namespace. This hook uses the same Azure Service Bus client connection inherited from the base class. Method signature...
1b122c15030e99cef9d4ff26d3781a7a9d6949bc
<|skeleton|> class AdminClientHook: """Interact with the ServiceBusAdministrationClient. This can create, update, list, and delete resources of a Service Bus namespace. This hook uses the same Azure Service Bus client connection inherited from the base class.""" def get_conn(self) -> ServiceBusAdministrationCl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminClientHook: """Interact with the ServiceBusAdministrationClient. This can create, update, list, and delete resources of a Service Bus namespace. This hook uses the same Azure Service Bus client connection inherited from the base class.""" def get_conn(self) -> ServiceBusAdministrationClient: ...
the_stack_v2_python_sparse
airflow/providers/microsoft/azure/hooks/asb.py
apache/airflow
train
22,756
427049ddfc0caf4a1e6b014088cdffad3a8f31cd
[ "if y.ndim == 2:\n y = y.reshape(-1)\nx = x[np.arange(x.shape[0]), y]\nreturn np.mean(np.log(x + EPSILON))", "if y.ndim == 2:\n y = y.reshape(-1)\nmask = np.zeros_like(x)\nmask[np.arange(mask.shape[0]), y] = 1\nbatch_size = y.shape[0]\nreturn -mask / (x + EPSILON) / batch_size" ]
<|body_start_0|> if y.ndim == 2: y = y.reshape(-1) x = x[np.arange(x.shape[0]), y] return np.mean(np.log(x + EPSILON)) <|end_body_0|> <|body_start_1|> if y.ndim == 2: y = y.reshape(-1) mask = np.zeros_like(x) mask[np.arange(mask.shape[0]), y] = 1 ...
assume y has integers between 0 and # of categories - 1 for shape of x: (# of samples, # of categories)
SparseCrossEntropy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseCrossEntropy: """assume y has integers between 0 and # of categories - 1 for shape of x: (# of samples, # of categories)""" def f(x: np.ndarray, y: np.ndarray) -> np.ndarray: """y has shape of (# of samples, ) or (# of samples, 1)""" <|body_0|> def df(x: np.ndarray...
stack_v2_sparse_classes_36k_train_011007
2,348
no_license
[ { "docstring": "y has shape of (# of samples, ) or (# of samples, 1)", "name": "f", "signature": "def f(x: np.ndarray, y: np.ndarray) -> np.ndarray" }, { "docstring": "y has shape of (# of samples, ) or (# of samples, 1)", "name": "df", "signature": "def df(x: np.ndarray, y: np.ndarray) ...
2
stack_v2_sparse_classes_30k_train_007206
Implement the Python class `SparseCrossEntropy` described below. Class description: assume y has integers between 0 and # of categories - 1 for shape of x: (# of samples, # of categories) Method signatures and docstrings: - def f(x: np.ndarray, y: np.ndarray) -> np.ndarray: y has shape of (# of samples, ) or (# of sa...
Implement the Python class `SparseCrossEntropy` described below. Class description: assume y has integers between 0 and # of categories - 1 for shape of x: (# of samples, # of categories) Method signatures and docstrings: - def f(x: np.ndarray, y: np.ndarray) -> np.ndarray: y has shape of (# of samples, ) or (# of sa...
9558c195ab796df817cb7d83b9fbb03257eb6b69
<|skeleton|> class SparseCrossEntropy: """assume y has integers between 0 and # of categories - 1 for shape of x: (# of samples, # of categories)""" def f(x: np.ndarray, y: np.ndarray) -> np.ndarray: """y has shape of (# of samples, ) or (# of samples, 1)""" <|body_0|> def df(x: np.ndarray...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseCrossEntropy: """assume y has integers between 0 and # of categories - 1 for shape of x: (# of samples, # of categories)""" def f(x: np.ndarray, y: np.ndarray) -> np.ndarray: """y has shape of (# of samples, ) or (# of samples, 1)""" if y.ndim == 2: y = y.reshape(-1) ...
the_stack_v2_python_sparse
losses.py
RyotaFuwa/NeuralNetworkFramework
train
0
c1ddc9ffccf77597edde76ea1e557e38f2ae1d4b
[ "self.validate_parameters(network_id=network_id)\n_url_path = '/networks/{networkId}/cellularGateway/settings/subnetPool'\n_url_path = APIHelper.append_url_with_template_parameters(_url_path, {'networkId': network_id})\n_query_builder = Configuration.base_uri\n_query_builder += _url_path\n_query_url = APIHelper.cle...
<|body_start_0|> self.validate_parameters(network_id=network_id) _url_path = '/networks/{networkId}/cellularGateway/settings/subnetPool' _url_path = APIHelper.append_url_with_template_parameters(_url_path, {'networkId': network_id}) _query_builder = Configuration.base_uri _query_...
A Controller to access Endpoints in the meraki_sdk API.
MGSubnetPoolSettingsController
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MGSubnetPoolSettingsController: """A Controller to access Endpoints in the meraki_sdk API.""" def get_network_cellular_gateway_settings_subnet_pool(self, network_id): """Does a GET request to /networks/{networkId}/cellularGateway/settings/subnetPool. Return the subnet pool and mask c...
stack_v2_sparse_classes_36k_train_011008
4,796
permissive
[ { "docstring": "Does a GET request to /networks/{networkId}/cellularGateway/settings/subnetPool. Return the subnet pool and mask configured for MGs in the network. Args: network_id (string): TODO: type description here. Example: Returns: mixed: Response from the API. Successful operation Raises: APIException: W...
2
null
Implement the Python class `MGSubnetPoolSettingsController` described below. Class description: A Controller to access Endpoints in the meraki_sdk API. Method signatures and docstrings: - def get_network_cellular_gateway_settings_subnet_pool(self, network_id): Does a GET request to /networks/{networkId}/cellularGatew...
Implement the Python class `MGSubnetPoolSettingsController` described below. Class description: A Controller to access Endpoints in the meraki_sdk API. Method signatures and docstrings: - def get_network_cellular_gateway_settings_subnet_pool(self, network_id): Does a GET request to /networks/{networkId}/cellularGatew...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class MGSubnetPoolSettingsController: """A Controller to access Endpoints in the meraki_sdk API.""" def get_network_cellular_gateway_settings_subnet_pool(self, network_id): """Does a GET request to /networks/{networkId}/cellularGateway/settings/subnetPool. Return the subnet pool and mask c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MGSubnetPoolSettingsController: """A Controller to access Endpoints in the meraki_sdk API.""" def get_network_cellular_gateway_settings_subnet_pool(self, network_id): """Does a GET request to /networks/{networkId}/cellularGateway/settings/subnetPool. Return the subnet pool and mask configured for...
the_stack_v2_python_sparse
meraki_sdk/controllers/mg_subnet_pool_settings_controller.py
RaulCatalano/meraki-python-sdk
train
1
052106bdada2345d0269fe4fa56f1d47dfe15708
[ "super().__init__()\nself.fft_centered = fft_centered\nself.fft_normalization = fft_normalization\nself.spatial_dims = spatial_dims\nself.dc_weight = nn.Parameter(torch.ones(1))", "prediction = fft.fft2(prediction.float(), self.fft_centered, self.fft_normalization, self.spatial_dims).to(prediction)\nif prediction...
<|body_start_0|> super().__init__() self.fft_centered = fft_centered self.fft_normalization = fft_normalization self.spatial_dims = spatial_dims self.dc_weight = nn.Parameter(torch.ones(1)) <|end_body_0|> <|body_start_1|> prediction = fft.fft2(prediction.float(), self.ff...
Data consistency block.
SERANetDC
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SERANetDC: """Data consistency block.""" def __init__(self, fft_centered: bool, fft_normalization: str, spatial_dims: Tuple[int, ...]): """Initialize the SERANet data consistency block.""" <|body_0|> def forward(self, prediction, prev_prediction, reference_kspace, mask):...
stack_v2_sparse_classes_36k_train_011009
9,773
permissive
[ { "docstring": "Initialize the SERANet data consistency block.", "name": "__init__", "signature": "def __init__(self, fft_centered: bool, fft_normalization: str, spatial_dims: Tuple[int, ...])" }, { "docstring": "Forward pass.", "name": "forward", "signature": "def forward(self, predicti...
2
null
Implement the Python class `SERANetDC` described below. Class description: Data consistency block. Method signatures and docstrings: - def __init__(self, fft_centered: bool, fft_normalization: str, spatial_dims: Tuple[int, ...]): Initialize the SERANet data consistency block. - def forward(self, prediction, prev_pred...
Implement the Python class `SERANetDC` described below. Class description: Data consistency block. Method signatures and docstrings: - def __init__(self, fft_centered: bool, fft_normalization: str, spatial_dims: Tuple[int, ...]): Initialize the SERANet data consistency block. - def forward(self, prediction, prev_pred...
6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066
<|skeleton|> class SERANetDC: """Data consistency block.""" def __init__(self, fft_centered: bool, fft_normalization: str, spatial_dims: Tuple[int, ...]): """Initialize the SERANet data consistency block.""" <|body_0|> def forward(self, prediction, prev_prediction, reference_kspace, mask):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SERANetDC: """Data consistency block.""" def __init__(self, fft_centered: bool, fft_normalization: str, spatial_dims: Tuple[int, ...]): """Initialize the SERANet data consistency block.""" super().__init__() self.fft_centered = fft_centered self.fft_normalization = fft_nor...
the_stack_v2_python_sparse
mridc/collections/segmentation/models/seranet_base/recon_block.py
wdika/mridc
train
40
cb81b2f03abee5902a30ef1c26dea8af31b6e6f8
[ "self.input_rgb_image_topic = input_rgb_image_topic\nif output_rgb_image_topic is not None:\n self.image_publisher = rospy.Publisher(output_rgb_image_topic, ROS_Image, queue_size=1)\nelse:\n self.image_publisher = None\nif tracker_topic is not None:\n self.object_publisher = rospy.Publisher(tracker_topic, ...
<|body_start_0|> self.input_rgb_image_topic = input_rgb_image_topic if output_rgb_image_topic is not None: self.image_publisher = rospy.Publisher(output_rgb_image_topic, ROS_Image, queue_size=1) else: self.image_publisher = None if tracker_topic is not None: ...
ObjectTrackingSiamRPNNode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectTrackingSiamRPNNode: def __init__(self, object_detector, input_rgb_image_topic='/usb_cam/image_raw', output_rgb_image_topic='/opendr/image_tracking_annotated', tracker_topic='/opendr/tracked_object', device='cuda'): """Creates a ROS Node for object tracking with SiamRPN. :param obj...
stack_v2_sparse_classes_36k_train_011010
7,779
permissive
[ { "docstring": "Creates a ROS Node for object tracking with SiamRPN. :param object_detector: An object detector learner to use for initialization :type object_detector: opendr.engine.learners.Learner :param input_rgb_image_topic: Topic from which we are reading the input image :type input_rgb_image_topic: str :...
3
null
Implement the Python class `ObjectTrackingSiamRPNNode` described below. Class description: Implement the ObjectTrackingSiamRPNNode class. Method signatures and docstrings: - def __init__(self, object_detector, input_rgb_image_topic='/usb_cam/image_raw', output_rgb_image_topic='/opendr/image_tracking_annotated', track...
Implement the Python class `ObjectTrackingSiamRPNNode` described below. Class description: Implement the ObjectTrackingSiamRPNNode class. Method signatures and docstrings: - def __init__(self, object_detector, input_rgb_image_topic='/usb_cam/image_raw', output_rgb_image_topic='/opendr/image_tracking_annotated', track...
b3d6ce670cdf63469fc5766630eb295d67b3d788
<|skeleton|> class ObjectTrackingSiamRPNNode: def __init__(self, object_detector, input_rgb_image_topic='/usb_cam/image_raw', output_rgb_image_topic='/opendr/image_tracking_annotated', tracker_topic='/opendr/tracked_object', device='cuda'): """Creates a ROS Node for object tracking with SiamRPN. :param obj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObjectTrackingSiamRPNNode: def __init__(self, object_detector, input_rgb_image_topic='/usb_cam/image_raw', output_rgb_image_topic='/opendr/image_tracking_annotated', tracker_topic='/opendr/tracked_object', device='cuda'): """Creates a ROS Node for object tracking with SiamRPN. :param object_detector: ...
the_stack_v2_python_sparse
projects/opendr_ws/src/opendr_perception/scripts/object_tracking_2d_siamrpn_node.py
opendr-eu/opendr
train
535
74dfa44bfcefed7f3d2695ea1bfe56dcf22bc04e
[ "super(VendorTemplate, self).__init__()\nself.log = logger.setup_logging(self.__class__.__name__)\nself.schema_class = 'vendor_template_schema.VendorTemplateSchema'\nself.set_connection(service.get_connection())\nself.set_create_endpoint('/si/service/' + str(service.id) + '/vendortemplate')\nself.id = None\nself.up...
<|body_start_0|> super(VendorTemplate, self).__init__() self.log = logger.setup_logging(self.__class__.__name__) self.schema_class = 'vendor_template_schema.VendorTemplateSchema' self.set_connection(service.get_connection()) self.set_create_endpoint('/si/service/' + str(service.i...
VendorTemplate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VendorTemplate: def __init__(self, service=None): """Constructor to create Service object @param vsm object on which Service has to be configured""" <|body_0|> def create(self, schema_object): """Client method to perform create operation @param schema_object instance...
stack_v2_sparse_classes_36k_train_011011
1,467
no_license
[ { "docstring": "Constructor to create Service object @param vsm object on which Service has to be configured", "name": "__init__", "signature": "def __init__(self, service=None)" }, { "docstring": "Client method to perform create operation @param schema_object instance of VendorTemplate class @r...
2
null
Implement the Python class `VendorTemplate` described below. Class description: Implement the VendorTemplate class. Method signatures and docstrings: - def __init__(self, service=None): Constructor to create Service object @param vsm object on which Service has to be configured - def create(self, schema_object): Clie...
Implement the Python class `VendorTemplate` described below. Class description: Implement the VendorTemplate class. Method signatures and docstrings: - def __init__(self, service=None): Constructor to create Service object @param vsm object on which Service has to be configured - def create(self, schema_object): Clie...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class VendorTemplate: def __init__(self, service=None): """Constructor to create Service object @param vsm object on which Service has to be configured""" <|body_0|> def create(self, schema_object): """Client method to perform create operation @param schema_object instance...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VendorTemplate: def __init__(self, service=None): """Constructor to create Service object @param vsm object on which Service has to be configured""" super(VendorTemplate, self).__init__() self.log = logger.setup_logging(self.__class__.__name__) self.schema_class = 'vendor_templ...
the_stack_v2_python_sparse
SystemTesting/pylib/nsx/vsm/service_insertion/vendor_template.py
Cloudxtreme/MyProject
train
0
a5e8fe21d4e4bc9d154f7be1f11b138bb4cc6a95
[ "images_store = self.image_store.create_image_store(self.tenant_id)\nimages = []\nfor image in images_store:\n if self.region_name != 'IAD' and isinstance(image, OnMetalImage):\n continue\n if include_details:\n images.append(image.detailed_json(absolutize_url))\n else:\n images.append...
<|body_start_0|> images_store = self.image_store.create_image_store(self.tenant_id) images = [] for image in images_store: if self.region_name != 'IAD' and isinstance(image, OnMetalImage): continue if include_details: images.append(image.de...
A collection of nova images, in a given region, for a given tenant.
RegionalNovaImageCollection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegionalNovaImageCollection: """A collection of nova images, in a given region, for a given tenant.""" def list_images(self, include_details, absolutize_url): """Return a list of images.""" <|body_0|> def get_image(self, http_get_request, image_id, absolutize_url): ...
stack_v2_sparse_classes_36k_train_011012
2,783
permissive
[ { "docstring": "Return a list of images.", "name": "list_images", "signature": "def list_images(self, include_details, absolutize_url)" }, { "docstring": "Return an image object if one exists from the list `/images` api, else return 404 Image not found.", "name": "get_image", "signature"...
2
stack_v2_sparse_classes_30k_train_015875
Implement the Python class `RegionalNovaImageCollection` described below. Class description: A collection of nova images, in a given region, for a given tenant. Method signatures and docstrings: - def list_images(self, include_details, absolutize_url): Return a list of images. - def get_image(self, http_get_request, ...
Implement the Python class `RegionalNovaImageCollection` described below. Class description: A collection of nova images, in a given region, for a given tenant. Method signatures and docstrings: - def list_images(self, include_details, absolutize_url): Return a list of images. - def get_image(self, http_get_request, ...
8e7eeed84ec5ae97863f9330023298845623c639
<|skeleton|> class RegionalNovaImageCollection: """A collection of nova images, in a given region, for a given tenant.""" def list_images(self, include_details, absolutize_url): """Return a list of images.""" <|body_0|> def get_image(self, http_get_request, image_id, absolutize_url): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegionalNovaImageCollection: """A collection of nova images, in a given region, for a given tenant.""" def list_images(self, include_details, absolutize_url): """Return a list of images.""" images_store = self.image_store.create_image_store(self.tenant_id) images = [] for ...
the_stack_v2_python_sparse
mimic/model/nova_image_collection.py
ranjithpeddi/mimic
train
1
a71517ecc347a27c1a1f3f922084e1fa913fab41
[ "global dic\ndic = {}\n\ndef find(s, i, j):\n \"\"\"\n :type s: str\n :type i: int\n :rtype: str\n \"\"\"\n if j == len(s) - 1:\n dic[len(s[i:j + 1])] = s[i:j + 1]\n return\n if i == 0 and i != j:\n dic[len(s[i:j + 1])] = s[i:j + 1]\n ...
<|body_start_0|> global dic dic = {} def find(s, i, j): """ :type s: str :type i: int :rtype: str """ if j == len(s) - 1: dic[len(s[i:j + 1])] = s[i:j + 1] ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome1(self, s): """Method_one : Dynamic Programming :type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """Method_two : Expand Around Center :type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_011013
1,656
no_license
[ { "docstring": "Method_one : Dynamic Programming :type s: str :rtype: str", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s)" }, { "docstring": "Method_two : Expand Around Center :type s: str :rtype: str", "name": "longestPalindrome2", "signature": "def longest...
2
stack_v2_sparse_classes_30k_train_012191
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): Method_one : Dynamic Programming :type s: str :rtype: str - def longestPalindrome2(self, s): Method_two : Expand Around Center :type s: str :rtyp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): Method_one : Dynamic Programming :type s: str :rtype: str - def longestPalindrome2(self, s): Method_two : Expand Around Center :type s: str :rtyp...
030f2d48d20341a16f6ca57715ff1f06a59a20ec
<|skeleton|> class Solution: def longestPalindrome1(self, s): """Method_one : Dynamic Programming :type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """Method_two : Expand Around Center :type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome1(self, s): """Method_one : Dynamic Programming :type s: str :rtype: str""" global dic dic = {} def find(s, i, j): """ :type s: str :type i: int :rtype: str ...
the_stack_v2_python_sparse
Code/Longest Palindromic Substring.py
zolars/LeetCode-Solution
train
0
0dc767eede6d702c292036ba8f68b6b17fd85c1a
[ "uid = request._request.uid\nparent = Label.objects.filter(name=request.data.get('parent', None)).first()\nchild = Label.objects.filter(name=request.data.get('child', None)).first()\nif not parent or not child:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\ntry:\n parent.children.add(child)\ne...
<|body_start_0|> uid = request._request.uid parent = Label.objects.filter(name=request.data.get('parent', None)).first() child = Label.objects.filter(name=request.data.get('child', None)).first() if not parent or not child: return self.error(errorcode.MSG_NO_DATA, errorcode.N...
LabelRelationView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelRelationView: def post(self, request): """新建标签关系""" <|body_0|> def delete(self, request): """删除标签关系""" <|body_1|> <|end_skeleton|> <|body_start_0|> uid = request._request.uid parent = Label.objects.filter(name=request.data.get('parent',...
stack_v2_sparse_classes_36k_train_011014
9,306
no_license
[ { "docstring": "新建标签关系", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除标签关系", "name": "delete", "signature": "def delete(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_012217
Implement the Python class `LabelRelationView` described below. Class description: Implement the LabelRelationView class. Method signatures and docstrings: - def post(self, request): 新建标签关系 - def delete(self, request): 删除标签关系
Implement the Python class `LabelRelationView` described below. Class description: Implement the LabelRelationView class. Method signatures and docstrings: - def post(self, request): 新建标签关系 - def delete(self, request): 删除标签关系 <|skeleton|> class LabelRelationView: def post(self, request): """新建标签关系""" ...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class LabelRelationView: def post(self, request): """新建标签关系""" <|body_0|> def delete(self, request): """删除标签关系""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabelRelationView: def post(self, request): """新建标签关系""" uid = request._request.uid parent = Label.objects.filter(name=request.data.get('parent', None)).first() child = Label.objects.filter(name=request.data.get('child', None)).first() if not parent or not child: ...
the_stack_v2_python_sparse
apps/labels/views.py
Slowhalfframe/fanyijiang-API
train
0
716c761b2fa563564a0eefe179c55f317efca5a5
[ "self.num_of_ways = 0\n\ndef helper(nums, pos, current_sum):\n if pos >= len(nums):\n if current_sum == 0:\n self.num_of_ways += 1\n return\n helper(nums, pos + 1, current_sum + nums[pos])\n helper(nums, pos + 1, current_sum - nums[pos])\nhelper(nums, 0, S)\nreturn self.num_of_ways...
<|body_start_0|> self.num_of_ways = 0 def helper(nums, pos, current_sum): if pos >= len(nums): if current_sum == 0: self.num_of_ways += 1 return helper(nums, pos + 1, current_sum + nums[pos]) helper(nums, pos + 1, c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS""" <|body_0|> def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS + memoization""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_of_ways = 0 ...
stack_v2_sparse_classes_36k_train_011015
1,192
no_license
[ { "docstring": "DFS", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums: List[int], S: int) -> int" }, { "docstring": "DFS + memoization", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums: List[int], S: int) -> int" } ]
2
stack_v2_sparse_classes_30k_val_000140
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS + memoization
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS - def findTargetSumWays(self, nums: List[int], S: int) -> int: DFS + memoization <|skeleton|> class Solution: ...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS""" <|body_0|> def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS + memoization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """DFS""" self.num_of_ways = 0 def helper(nums, pos, current_sum): if pos >= len(nums): if current_sum == 0: self.num_of_ways += 1 return ...
the_stack_v2_python_sparse
Leetcode/494. Target Sum.py
brlala/Educative-Grokking-Coding-Exercise
train
3
b9fe8246c15827b213420b250eaf172812b6f949
[ "self.salt = salt\nself.forward_idx = 0\nself.idx = 0", "self.buffer = []\nfor _ in range(1000):\n hash_str = '{}{}'.format(self.salt, self.forward_idx).encode()\n self.buffer.append(md5(hash_str).hexdigest())\n self.forward_idx += 1", "self.buf_init()\nkeys = 0\nwhile keys != 64:\n res = find_in_a_...
<|body_start_0|> self.salt = salt self.forward_idx = 0 self.idx = 0 <|end_body_0|> <|body_start_1|> self.buffer = [] for _ in range(1000): hash_str = '{}{}'.format(self.salt, self.forward_idx).encode() self.buffer.append(md5(hash_str).hexdigest()) ...
KeyGetter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyGetter: def __init__(self, salt): """initialize""" <|body_0|> def buf_init(self): """create 1000 hash values""" <|body_1|> def solve(self): """find the 64th key""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.salt = salt...
stack_v2_sparse_classes_36k_train_011016
1,803
no_license
[ { "docstring": "initialize", "name": "__init__", "signature": "def __init__(self, salt)" }, { "docstring": "create 1000 hash values", "name": "buf_init", "signature": "def buf_init(self)" }, { "docstring": "find the 64th key", "name": "solve", "signature": "def solve(self...
3
stack_v2_sparse_classes_30k_train_006561
Implement the Python class `KeyGetter` described below. Class description: Implement the KeyGetter class. Method signatures and docstrings: - def __init__(self, salt): initialize - def buf_init(self): create 1000 hash values - def solve(self): find the 64th key
Implement the Python class `KeyGetter` described below. Class description: Implement the KeyGetter class. Method signatures and docstrings: - def __init__(self, salt): initialize - def buf_init(self): create 1000 hash values - def solve(self): find the 64th key <|skeleton|> class KeyGetter: def __init__(self, s...
b1688431de1c5ab60659bc632c1a7131c3c7aad5
<|skeleton|> class KeyGetter: def __init__(self, salt): """initialize""" <|body_0|> def buf_init(self): """create 1000 hash values""" <|body_1|> def solve(self): """find the 64th key""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeyGetter: def __init__(self, salt): """initialize""" self.salt = salt self.forward_idx = 0 self.idx = 0 def buf_init(self): """create 1000 hash values""" self.buffer = [] for _ in range(1000): hash_str = '{}{}'.format(self.salt, self.fo...
the_stack_v2_python_sparse
2016/14_01.py
yknot/adventOfCode
train
0
1bfa9780d05241b6460fe90eaa4a6dcd3ce22ca2
[ "query_string = request.query_string\nquery_params = dict(urlparse.parse_qsl(query_string))\nreturn query_params", "query_params = self._parse_query_params(request=request)\nvalue = query_params.get(param_name, default_value)\nif param_type == 'bool' and isinstance(value, six.string_types):\n value = transform...
<|body_start_0|> query_string = request.query_string query_params = dict(urlparse.parse_qsl(query_string)) return query_params <|end_body_0|> <|body_start_1|> query_params = self._parse_query_params(request=request) value = query_params.get(param_name, default_value) if ...
Base REST controller class which contains various utility functions.
BaseRestControllerMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseRestControllerMixin: """Base REST controller class which contains various utility functions.""" def _parse_query_params(self, request): """Parse query string for the provided request. :rtype: ``dict``""" <|body_0|> def _get_query_param_value(self, request, param_name...
stack_v2_sparse_classes_36k_train_011017
2,928
permissive
[ { "docstring": "Parse query string for the provided request. :rtype: ``dict``", "name": "_parse_query_params", "signature": "def _parse_query_params(self, request)" }, { "docstring": "Return a value for the provided query param and optionally cast it for boolean types. If the requested query par...
3
null
Implement the Python class `BaseRestControllerMixin` described below. Class description: Base REST controller class which contains various utility functions. Method signatures and docstrings: - def _parse_query_params(self, request): Parse query string for the provided request. :rtype: ``dict`` - def _get_query_param...
Implement the Python class `BaseRestControllerMixin` described below. Class description: Base REST controller class which contains various utility functions. Method signatures and docstrings: - def _parse_query_params(self, request): Parse query string for the provided request. :rtype: ``dict`` - def _get_query_param...
c3fc181981b141da95dcf6939d09c362556ca048
<|skeleton|> class BaseRestControllerMixin: """Base REST controller class which contains various utility functions.""" def _parse_query_params(self, request): """Parse query string for the provided request. :rtype: ``dict``""" <|body_0|> def _get_query_param_value(self, request, param_name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseRestControllerMixin: """Base REST controller class which contains various utility functions.""" def _parse_query_params(self, request): """Parse query string for the provided request. :rtype: ``dict``""" query_string = request.query_string query_params = dict(urlparse.parse_qs...
the_stack_v2_python_sparse
st2api/st2api/controllers/base.py
Plexxi/st2
train
3
797ff33b719b1a72a4fa852e6dc2d80006447f78
[ "zh_login(self=self, driver=self.driver)\nself.driver.press_keycode(4)\nmylogger.info('返回home page')", "test_name = '地图上发送默认地点'\nmylogger.debug('%s start' % test_name)\nself.driver.implicitly_wait(10)\nmainChat_element(self.driver)\nfirst_chat_element(self.driver)\nmylogger.info('进入与第一个联系人交互界面')\nself.driver.impl...
<|body_start_0|> zh_login(self=self, driver=self.driver) self.driver.press_keycode(4) mylogger.info('返回home page') <|end_body_0|> <|body_start_1|> test_name = '地图上发送默认地点' mylogger.debug('%s start' % test_name) self.driver.implicitly_wait(10) mainChat_element(self...
Message_share
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message_share: def test1(self): """zh login""" <|body_0|> def test2_share_software(self): """message share software""" <|body_1|> def test3_send_file(self): """message share file""" <|body_2|> def test4_send_voice_1(self): ""...
stack_v2_sparse_classes_36k_train_011018
3,752
no_license
[ { "docstring": "zh login", "name": "test1", "signature": "def test1(self)" }, { "docstring": "message share software", "name": "test2_share_software", "signature": "def test2_share_software(self)" }, { "docstring": "message share file", "name": "test3_send_file", "signatu...
6
stack_v2_sparse_classes_30k_train_007553
Implement the Python class `Message_share` described below. Class description: Implement the Message_share class. Method signatures and docstrings: - def test1(self): zh login - def test2_share_software(self): message share software - def test3_send_file(self): message share file - def test4_send_voice_1(self): messa...
Implement the Python class `Message_share` described below. Class description: Implement the Message_share class. Method signatures and docstrings: - def test1(self): zh login - def test2_share_software(self): message share software - def test3_send_file(self): message share file - def test4_send_voice_1(self): messa...
5924b88c5bc2a41d62807cc665bb3a76dfe0f3d3
<|skeleton|> class Message_share: def test1(self): """zh login""" <|body_0|> def test2_share_software(self): """message share software""" <|body_1|> def test3_send_file(self): """message share file""" <|body_2|> def test4_send_voice_1(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Message_share: def test1(self): """zh login""" zh_login(self=self, driver=self.driver) self.driver.press_keycode(4) mylogger.info('返回home page') def test2_share_software(self): """message share software""" test_name = '地图上发送默认地点' mylogger.debug('%s ...
the_stack_v2_python_sparse
testsuite/test4_chat_share.py
Lkamanda/LT
train
2
85445176f5a0f7ddf355f386f8b159d1e6f75588
[ "\"\"\"from this middle\"\"\"\nwhile i >= 0 and j < len(s) and (s[i] == s[j]):\n i -= 1\n j += 1\ntempLength = j - i - 1\nif tempLength > longest:\n return (tempLength, i + 1)\nelse:\n return (longest, start)", "start = 0\nlongest = 0\nfor i in range(len(s)):\n longest, start = self.checkPalindrome...
<|body_start_0|> """from this middle""" while i >= 0 and j < len(s) and (s[i] == s[j]): i -= 1 j += 1 tempLength = j - i - 1 if tempLength > longest: return (tempLength, i + 1) else: return (longest, start) <|end_body_0|> <|body_st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkPalindrome(self, s, i, j, longest, start): """this helper function will check the longest palindrome starting""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_011019
1,162
no_license
[ { "docstring": "this helper function will check the longest palindrome starting", "name": "checkPalindrome", "signature": "def checkPalindrome(self, s, i, j, longest, start)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(se...
2
stack_v2_sparse_classes_30k_train_003476
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPalindrome(self, s, i, j, longest, start): this helper function will check the longest palindrome starting - def longestPalindrome(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPalindrome(self, s, i, j, longest, start): this helper function will check the longest palindrome starting - def longestPalindrome(self, s): :type s: str :rtype: str <|...
c01002206fcc1b3ed35d1ba1e83dffdff5fc16a5
<|skeleton|> class Solution: def checkPalindrome(self, s, i, j, longest, start): """this helper function will check the longest palindrome starting""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkPalindrome(self, s, i, j, longest, start): """this helper function will check the longest palindrome starting""" """from this middle""" while i >= 0 and j < len(s) and (s[i] == s[j]): i -= 1 j += 1 tempLength = j - i - 1 if tem...
the_stack_v2_python_sparse
Longest Palindromic Substring/Solution.py
kimjaspermui/LeetCode
train
0
342977e676c209abdb3246d7e40f89db1bf177e3
[ "if self.__class__.all is None:\n self.__class__.all = set()\nself.__class__.all.add(self)\nself.identifier = identifier", "for instance in cls.all:\n if instance.identifier == identifier:\n return instance\nreturn None" ]
<|body_start_0|> if self.__class__.all is None: self.__class__.all = set() self.__class__.all.add(self) self.identifier = identifier <|end_body_0|> <|body_start_1|> for instance in cls.all: if instance.identifier == identifier: return instance ...
base class for domain classes
Base
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """base class for domain classes""" def __init__(self, identifier): """create domain object and self-register it""" <|body_0|> def find_instance(cls, identifier): """find instance with given identifier :param identifier: instance to look for :return: instan...
stack_v2_sparse_classes_36k_train_011020
804
permissive
[ { "docstring": "create domain object and self-register it", "name": "__init__", "signature": "def __init__(self, identifier)" }, { "docstring": "find instance with given identifier :param identifier: instance to look for :return: instance or None", "name": "find_instance", "signature": "...
2
stack_v2_sparse_classes_30k_train_016619
Implement the Python class `Base` described below. Class description: base class for domain classes Method signatures and docstrings: - def __init__(self, identifier): create domain object and self-register it - def find_instance(cls, identifier): find instance with given identifier :param identifier: instance to loo...
Implement the Python class `Base` described below. Class description: base class for domain classes Method signatures and docstrings: - def __init__(self, identifier): create domain object and self-register it - def find_instance(cls, identifier): find instance with given identifier :param identifier: instance to loo...
e65fddb94513e7c2f54f248b4ce69e9e10ce42f5
<|skeleton|> class Base: """base class for domain classes""" def __init__(self, identifier): """create domain object and self-register it""" <|body_0|> def find_instance(cls, identifier): """find instance with given identifier :param identifier: instance to look for :return: instan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """base class for domain classes""" def __init__(self, identifier): """create domain object and self-register it""" if self.__class__.all is None: self.__class__.all = set() self.__class__.all.add(self) self.identifier = identifier def find_instance(...
the_stack_v2_python_sparse
python/domain/base.py
jeroenpeeters/document-as-code
train
0
c32589cedc44a82fdad2eab427ab795edd395b39
[ "self.enable_network_isolation = enable_network_isolation\nself.security_group_ids = security_group_ids\nself.subnets = subnets\nself.encrypt_inter_container_traffic = encrypt_inter_container_traffic", "enable_network_isolation = False if self.enable_network_isolation is None else self.enable_network_isolation\nn...
<|body_start_0|> self.enable_network_isolation = enable_network_isolation self.security_group_ids = security_group_ids self.subnets = subnets self.encrypt_inter_container_traffic = encrypt_inter_container_traffic <|end_body_0|> <|body_start_1|> enable_network_isolation = False i...
Accepts network configuration parameters for conversion to request dict. The `_to_request_dict` provides a method to turn the parameters into a dict.
NetworkConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkConfig: """Accepts network configuration parameters for conversion to request dict. The `_to_request_dict` provides a method to turn the parameters into a dict.""" def __init__(self, enable_network_isolation: Union[bool, PipelineVariable]=None, security_group_ids: Optional[List[Union[...
stack_v2_sparse_classes_36k_train_011021
3,454
permissive
[ { "docstring": "Initialize a ``NetworkConfig`` instance. NetworkConfig accepts network configuration parameters and provides a method to turn these parameters into a dictionary. Args: enable_network_isolation (bool or PipelineVariable): Boolean that determines whether to enable network isolation. security_group...
2
null
Implement the Python class `NetworkConfig` described below. Class description: Accepts network configuration parameters for conversion to request dict. The `_to_request_dict` provides a method to turn the parameters into a dict. Method signatures and docstrings: - def __init__(self, enable_network_isolation: Union[bo...
Implement the Python class `NetworkConfig` described below. Class description: Accepts network configuration parameters for conversion to request dict. The `_to_request_dict` provides a method to turn the parameters into a dict. Method signatures and docstrings: - def __init__(self, enable_network_isolation: Union[bo...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class NetworkConfig: """Accepts network configuration parameters for conversion to request dict. The `_to_request_dict` provides a method to turn the parameters into a dict.""" def __init__(self, enable_network_isolation: Union[bool, PipelineVariable]=None, security_group_ids: Optional[List[Union[...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetworkConfig: """Accepts network configuration parameters for conversion to request dict. The `_to_request_dict` provides a method to turn the parameters into a dict.""" def __init__(self, enable_network_isolation: Union[bool, PipelineVariable]=None, security_group_ids: Optional[List[Union[str, Pipeline...
the_stack_v2_python_sparse
src/sagemaker/network.py
aws/sagemaker-python-sdk
train
2,050
5e3d5733a007c29f4ea22ec6da02350f01a2671f
[ "self._collector = htcondor.Collector(collector)\nlogger.debug('Finding schedds reporting to collector %s', collector)\nattempt = 0\nwhile True:\n try:\n schedd_ads = self._collector.query(htcondor.AdTypes.Schedd, schedd_constraint, ['MyAddress'])\n break\n except IOError:\n attempt += 1\...
<|body_start_0|> self._collector = htcondor.Collector(collector) logger.debug('Finding schedds reporting to collector %s', collector) attempt = 0 while True: try: schedd_ads = self._collector.query(htcondor.AdTypes.Schedd, schedd_constraint, ['MyAddress']) ...
HTCondor interface.
HTCondor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTCondor: """HTCondor interface.""" def __init__(self, collector, schedd_constraint=''): """@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.""" <|body_0|> def find_jobs(self, constraint...
stack_v2_sparse_classes_36k_train_011022
4,001
no_license
[ { "docstring": "@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.", "name": "__init__", "signature": "def __init__(self, collector, schedd_constraint='')" }, { "docstring": "Return ClassAds for jobs matching the...
2
stack_v2_sparse_classes_30k_train_000999
Implement the Python class `HTCondor` described below. Class description: HTCondor interface. Method signatures and docstrings: - def __init__(self, collector, schedd_constraint=''): @param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection. ...
Implement the Python class `HTCondor` described below. Class description: HTCondor interface. Method signatures and docstrings: - def __init__(self, collector, schedd_constraint=''): @param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection. ...
d6c2bfa2946edc8b0a293ae4aaa10d56d62e8bd9
<|skeleton|> class HTCondor: """HTCondor interface.""" def __init__(self, collector, schedd_constraint=''): """@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.""" <|body_0|> def find_jobs(self, constraint...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTCondor: """HTCondor interface.""" def __init__(self, collector, schedd_constraint=''): """@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.""" self._collector = htcondor.Collector(collector) log...
the_stack_v2_python_sparse
lib/common/interface/htc.py
ClydeHuibregtse/dynamo
train
0
ba5560bbf2a1bec1dcdd57195a8eecb3b3fecd96
[ "assert len(input_list) > 0\nsuper().__init__(self.PROBLEM_NAME)\nself.input_list = input_list", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nnotation_stack = Stack()\nfor i in range(len(self.input_list)):\n if self.input_list[i] not in self.OPERATORS:\n notation_stack.push(self.input_lis...
<|body_start_0|> assert len(input_list) > 0 super().__init__(self.PROBLEM_NAME) self.input_list = input_list <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) notation_stack = Stack() for i in range(len(self.input_list)): ...
ReversePolishNotation
ReversePolishNotation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReversePolishNotation: """ReversePolishNotation""" def __init__(self, input_list): """Reverse Polish Notation Args: input_list: input_string evaluated using reverse polish notation Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Not...
stack_v2_sparse_classes_36k_train_011023
2,292
no_license
[ { "docstring": "Reverse Polish Notation Args: input_list: input_string evaluated using reverse polish notation Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_list)" }, { "docstring": "Solve the problem Note: Args: Returns: integer Raises: None", "name...
3
null
Implement the Python class `ReversePolishNotation` described below. Class description: ReversePolishNotation Method signatures and docstrings: - def __init__(self, input_list): Reverse Polish Notation Args: input_list: input_string evaluated using reverse polish notation Returns: None Raises: None - def solve(self): ...
Implement the Python class `ReversePolishNotation` described below. Class description: ReversePolishNotation Method signatures and docstrings: - def __init__(self, input_list): Reverse Polish Notation Args: input_list: input_string evaluated using reverse polish notation Returns: None Raises: None - def solve(self): ...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class ReversePolishNotation: """ReversePolishNotation""" def __init__(self, input_list): """Reverse Polish Notation Args: input_list: input_string evaluated using reverse polish notation Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Not...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReversePolishNotation: """ReversePolishNotation""" def __init__(self, input_list): """Reverse Polish Notation Args: input_list: input_string evaluated using reverse polish notation Returns: None Raises: None""" assert len(input_list) > 0 super().__init__(self.PROBLEM_NAME) ...
the_stack_v2_python_sparse
python/problems/stack/reverse_polish_notation.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
f77e88677b97e94af07b1e31a929e1a80130060f
[ "grille = [(1, cls.xp_min)]\nmarge = sqrt(cls.xp_max - cls.xp_min)\nfor etape in range(2, cls.nb_niveaux):\n coef = 2 - (1 - etape / cls.nb_niveaux) * 0.4\n xp = ((etape / cls.nb_niveaux) ** coef * marge) ** 2\n xp += cls.xp_min * (1 - etape / cls.nb_niveaux)\n grille.append((etape, int(xp)))\ngrille.ap...
<|body_start_0|> grille = [(1, cls.xp_min)] marge = sqrt(cls.xp_max - cls.xp_min) for etape in range(2, cls.nb_niveaux): coef = 2 - (1 - etape / cls.nb_niveaux) * 0.4 xp = ((etape / cls.nb_niveaux) ** coef * marge) ** 2 xp += cls.xp_min * (1 - etape / cls.nb_n...
Classe contenant les mécanismes propres à la manipulation de niveaux. Elle se charge de calculer la grille d'expérience et les données variables d'un niveau à l'autre. Elle ne doit pas être instanciée pour manipuler ses données. En revanche, le module en charge (perso) doit lui donner les informations dont elle a besoi...
Niveaux
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Niveaux: """Classe contenant les mécanismes propres à la manipulation de niveaux. Elle se charge de calculer la grille d'expérience et les données variables d'un niveau à l'autre. Elle ne doit pas être instanciée pour manipuler ses données. En revanche, le module en charge (perso) doit lui donner...
stack_v2_sparse_classes_36k_train_011024
5,420
permissive
[ { "docstring": "Calcul la grille d'expérience. Le premier niveau est le 0. Il n'a besoin que de 0 xp. Le second niveau (1) a besoin de cls.xp_min XP pour se valider. Le dernier niveau cls.nb_niveaux a besoin de cls.xp_max pour se valider. Les niveaux intermédiaires sont calculés en fonction. Enfin, les points d...
4
null
Implement the Python class `Niveaux` described below. Class description: Classe contenant les mécanismes propres à la manipulation de niveaux. Elle se charge de calculer la grille d'expérience et les données variables d'un niveau à l'autre. Elle ne doit pas être instanciée pour manipuler ses données. En revanche, le m...
Implement the Python class `Niveaux` described below. Class description: Classe contenant les mécanismes propres à la manipulation de niveaux. Elle se charge de calculer la grille d'expérience et les données variables d'un niveau à l'autre. Elle ne doit pas être instanciée pour manipuler ses données. En revanche, le m...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class Niveaux: """Classe contenant les mécanismes propres à la manipulation de niveaux. Elle se charge de calculer la grille d'expérience et les données variables d'un niveau à l'autre. Elle ne doit pas être instanciée pour manipuler ses données. En revanche, le module en charge (perso) doit lui donner...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Niveaux: """Classe contenant les mécanismes propres à la manipulation de niveaux. Elle se charge de calculer la grille d'expérience et les données variables d'un niveau à l'autre. Elle ne doit pas être instanciée pour manipuler ses données. En revanche, le module en charge (perso) doit lui donner les informat...
the_stack_v2_python_sparse
src/primaires/perso/niveaux.py
vincent-lg/tsunami
train
5
720d6b3cd0efc383c3f896faba4fb884eb91f113
[ "LayoutItem.__init__(self, dom, parent_element, line_object, mxd, arc_doc)\nself.dom = dom\nself.parent_element = parent_element\nself.line_object = line_object\nself.mxd = mxd\nself.arc_doc = arc_doc", "arcpy_item = LayoutItem.get_arcpy_layout_element(self, self.line_object)\nLineElement.set_size_and_position(se...
<|body_start_0|> LayoutItem.__init__(self, dom, parent_element, line_object, mxd, arc_doc) self.dom = dom self.parent_element = parent_element self.line_object = line_object self.mxd = mxd self.arc_doc = arc_doc <|end_body_0|> <|body_start_1|> arcpy_item = Layout...
LineElement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineElement: def __init__(self, dom, parent_element, line_object, mxd, arc_doc): """This function creates a Line-Item for the layout :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param line_object: the line_object as ...
stack_v2_sparse_classes_36k_train_011025
2,296
permissive
[ { "docstring": "This function creates a Line-Item for the layout :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param line_object: the line_object as ArcObject :param mxd: the arcpy mxd-document :param arc_doc: the ArcObject IMxDocument", ...
2
null
Implement the Python class `LineElement` described below. Class description: Implement the LineElement class. Method signatures and docstrings: - def __init__(self, dom, parent_element, line_object, mxd, arc_doc): This function creates a Line-Item for the layout :param dom: the Document Object Model :param parent_ele...
Implement the Python class `LineElement` described below. Class description: Implement the LineElement class. Method signatures and docstrings: - def __init__(self, dom, parent_element, line_object, mxd, arc_doc): This function creates a Line-Item for the layout :param dom: the Document Object Model :param parent_ele...
cd0aa5f533194c85cf6e098fadc079ea61b63fce
<|skeleton|> class LineElement: def __init__(self, dom, parent_element, line_object, mxd, arc_doc): """This function creates a Line-Item for the layout :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param line_object: the line_object as ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LineElement: def __init__(self, dom, parent_element, line_object, mxd, arc_doc): """This function creates a Line-Item for the layout :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param line_object: the line_object as ArcObject :par...
the_stack_v2_python_sparse
layout/lineElement.py
avaldeon/mapqonverter
train
0
feb09c9fd527f0b82948c33eff699710855f78bc
[ "test = '4 4\\n1 4\\n7 8\\n9 10\\n12 14\\n4 5 3 8'\nself.assertEqual(calculate(test), 'Yes\\n2 3 1')\nself.assertEqual(get_inputs(test), [[(1, 3, 1), (2, 5, 2), (3, 7, 0)], [(3, 2), (4, 0), (5, 1), (8, 3)]])\ntest = '5 5\\n1 1\\n2 7\\n8 8\\n10 10\\n16 16\\n1 1 5 6 2'\nself.assertEqual(calculate(test), 'Yes\\n1 2 5 ...
<|body_start_0|> test = '4 4\n1 4\n7 8\n9 10\n12 14\n4 5 3 8' self.assertEqual(calculate(test), 'Yes\n2 3 1') self.assertEqual(get_inputs(test), [[(1, 3, 1), (2, 5, 2), (3, 7, 0)], [(3, 2), (4, 0), (5, 1), (8, 3)]]) test = '5 5\n1 1\n2 7\n8 8\n10 10\n16 16\n1 1 5 6 2' self.assert...
unitTests
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class unitTests: def test_sample_tests(self): """Quiz sample tests. Add to separate lines""" <|body_0|> def test_Fug_class__basic_functions(self): """Fug class basic functions testing""" <|body_1|> <|end_skeleton|> <|body_start_0|> test = '4 4\n1 4\n7 8\n...
stack_v2_sparse_classes_36k_train_011026
11,642
permissive
[ { "docstring": "Quiz sample tests. Add to separate lines", "name": "test_sample_tests", "signature": "def test_sample_tests(self)" }, { "docstring": "Fug class basic functions testing", "name": "test_Fug_class__basic_functions", "signature": "def test_Fug_class__basic_functions(self)" ...
2
stack_v2_sparse_classes_30k_train_002015
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_sample_tests(self): Quiz sample tests. Add to separate lines - def test_Fug_class__basic_functions(self): Fug class basic functions testing
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_sample_tests(self): Quiz sample tests. Add to separate lines - def test_Fug_class__basic_functions(self): Fug class basic functions testing <|skeleton|> class unitTes...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class unitTests: def test_sample_tests(self): """Quiz sample tests. Add to separate lines""" <|body_0|> def test_Fug_class__basic_functions(self): """Fug class basic functions testing""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class unitTests: def test_sample_tests(self): """Quiz sample tests. Add to separate lines""" test = '4 4\n1 4\n7 8\n9 10\n12 14\n4 5 3 8' self.assertEqual(calculate(test), 'Yes\n2 3 1') self.assertEqual(get_inputs(test), [[(1, 3, 1), (2, 5, 2), (3, 7, 0)], [(3, 2), (4, 0), (5, 1), (8...
the_stack_v2_python_sparse
codeforces/556D_fug_fastlist.py
snsokolov/contests
train
1
551d351319962976d1c5729157cc9c054385d368
[ "def call(user, perm):\n return getattr(self, perm)(obj, cls, user)\nfor func in inspect.getmembers(type(self), predicate=inspect.ismethod):\n if not isinstance(self, func[1].__self__.__class__):\n setattr(call, func[0], functools.partial(func[1], obj, cls))\n else:\n setattr(call, func[0], f...
<|body_start_0|> def call(user, perm): return getattr(self, perm)(obj, cls, user) for func in inspect.getmembers(type(self), predicate=inspect.ismethod): if not isinstance(self, func[1].__self__.__class__): setattr(call, func[0], functools.partial(func[1], obj, cl...
Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = NodePermission() # Check class permissio...
Permission
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Permission: """Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = No...
stack_v2_sparse_classes_36k_train_011027
3,550
permissive
[ { "docstring": "Hacking object internals to provide means for the mentioned interface", "name": "__get__", "signature": "def __get__(self, obj, cls)" }, { "docstring": "Aggregates cls methods to self class", "name": "_aggregate", "signature": "def _aggregate(self, obj, cls, perm)" } ]
2
stack_v2_sparse_classes_30k_train_008229
Implement the Python class `Permission` described below. Class description: Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provi...
Implement the Python class `Permission` described below. Class description: Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provi...
49c84f13a8f92427b01231615136549fb5be3a78
<|skeleton|> class Permission: """Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Permission: """Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = NodePermission(...
the_stack_v2_python_sparse
orchestra/permissions/options.py
Ro9ueAdmin/django-orchestra
train
0
d9e68e6a376e652564ea4f9a52501b8da68179af
[ "test_repo = test_repos.INVALID_REPO\nbuild_data = build_specified_commit.BuildData(project_name=test_repo.project_name, engine='libfuzzer', sanitizer='address', architecture='x86_64')\nwith self.assertRaises(ValueError):\n bisector.bisect(self.BISECT_TYPE, test_repo.old_commit, test_repo.new_commit, test_repo.t...
<|body_start_0|> test_repo = test_repos.INVALID_REPO build_data = build_specified_commit.BuildData(project_name=test_repo.project_name, engine='libfuzzer', sanitizer='address', architecture='x86_64') with self.assertRaises(ValueError): bisector.bisect(self.BISECT_TYPE, test_repo.old_...
Class to test the functionality of bisection method.
BisectIntegrationTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BisectIntegrationTests: """Class to test the functionality of bisection method.""" def test_bisect_invalid_repo(self): """Test the bisection method on a project that does not exist.""" <|body_0|> def test_bisect(self): """Test the bisect method on example project...
stack_v2_sparse_classes_36k_train_011028
2,624
permissive
[ { "docstring": "Test the bisection method on a project that does not exist.", "name": "test_bisect_invalid_repo", "signature": "def test_bisect_invalid_repo(self)" }, { "docstring": "Test the bisect method on example projects.", "name": "test_bisect", "signature": "def test_bisect(self)"...
2
null
Implement the Python class `BisectIntegrationTests` described below. Class description: Class to test the functionality of bisection method. Method signatures and docstrings: - def test_bisect_invalid_repo(self): Test the bisection method on a project that does not exist. - def test_bisect(self): Test the bisect meth...
Implement the Python class `BisectIntegrationTests` described below. Class description: Class to test the functionality of bisection method. Method signatures and docstrings: - def test_bisect_invalid_repo(self): Test the bisection method on a project that does not exist. - def test_bisect(self): Test the bisect meth...
f0275421f84b8f80ee767fb9230134ac97cb687b
<|skeleton|> class BisectIntegrationTests: """Class to test the functionality of bisection method.""" def test_bisect_invalid_repo(self): """Test the bisection method on a project that does not exist.""" <|body_0|> def test_bisect(self): """Test the bisect method on example project...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BisectIntegrationTests: """Class to test the functionality of bisection method.""" def test_bisect_invalid_repo(self): """Test the bisection method on a project that does not exist.""" test_repo = test_repos.INVALID_REPO build_data = build_specified_commit.BuildData(project_name=t...
the_stack_v2_python_sparse
infra/bisector_test.py
google/oss-fuzz
train
9,438
85f6893ae854200ee989d5b43f217b37f645c7ba
[ "if number in (0, 1):\n return False\nif number < 0:\n return False\nfor element in range(2, number):\n if number % element == 0:\n return False\nreturn True", "index = number\nwhile True:\n index += 1\n if self.is_prime(index):\n print('The next prime after {0} is {1}'.format(number,...
<|body_start_0|> if number in (0, 1): return False if number < 0: return False for element in range(2, number): if number % element == 0: return False return True <|end_body_0|> <|body_start_1|> index = number while Tru...
Prime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Prime: def is_prime(self, number): """Return True if *number* is prime.""" <|body_0|> def print_next_prime(self, number): """Print the closest prime number larger than *number*.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if number in (0, 1): ...
stack_v2_sparse_classes_36k_train_011029
793
no_license
[ { "docstring": "Return True if *number* is prime.", "name": "is_prime", "signature": "def is_prime(self, number)" }, { "docstring": "Print the closest prime number larger than *number*.", "name": "print_next_prime", "signature": "def print_next_prime(self, number)" } ]
2
stack_v2_sparse_classes_30k_train_014362
Implement the Python class `Prime` described below. Class description: Implement the Prime class. Method signatures and docstrings: - def is_prime(self, number): Return True if *number* is prime. - def print_next_prime(self, number): Print the closest prime number larger than *number*.
Implement the Python class `Prime` described below. Class description: Implement the Prime class. Method signatures and docstrings: - def is_prime(self, number): Return True if *number* is prime. - def print_next_prime(self, number): Print the closest prime number larger than *number*. <|skeleton|> class Prime: ...
2965199d439b5cf4d9074f9c43240bef457218f4
<|skeleton|> class Prime: def is_prime(self, number): """Return True if *number* is prime.""" <|body_0|> def print_next_prime(self, number): """Print the closest prime number larger than *number*.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Prime: def is_prime(self, number): """Return True if *number* is prime.""" if number in (0, 1): return False if number < 0: return False for element in range(2, number): if number % element == 0: return False return Tr...
the_stack_v2_python_sparse
python_overview/python_unit_testing/primes.py
truas/kccs
train
0
660c6d2439632624abf9e9b350f8b84fe606482e
[ "s = list(s)\nfor i in range(0, len(s), 2 * k):\n s[i:i + k] = reversed(s[i:i + k])\nreturn ''.join(s)", "def reverse(data, i, j):\n while i < j:\n data[i], data[j] = (data[j], data[i])\n i += 1\n j -= 1\ndata = list(s)\nstart, end = (0, -1)\nrounds = 0\nwhile start < len(s) - 1:\n s...
<|body_start_0|> s = list(s) for i in range(0, len(s), 2 * k): s[i:i + k] = reversed(s[i:i + k]) return ''.join(s) <|end_body_0|> <|body_start_1|> def reverse(data, i, j): while i < j: data[i], data[j] = (data[j], data[i]) i += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseStr(self, s, k): """:type s: str :type k: int :rtype: str""" <|body_0|> def reverseStr_verbose(self, s, k): """:type s: str :type k: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = list(s) for i in ra...
stack_v2_sparse_classes_36k_train_011030
1,979
no_license
[ { "docstring": ":type s: str :type k: int :rtype: str", "name": "reverseStr", "signature": "def reverseStr(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: str", "name": "reverseStr_verbose", "signature": "def reverseStr_verbose(self, s, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseStr(self, s, k): :type s: str :type k: int :rtype: str - def reverseStr_verbose(self, s, k): :type s: str :type k: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseStr(self, s, k): :type s: str :type k: int :rtype: str - def reverseStr_verbose(self, s, k): :type s: str :type k: int :rtype: str <|skeleton|> class Solution: d...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def reverseStr(self, s, k): """:type s: str :type k: int :rtype: str""" <|body_0|> def reverseStr_verbose(self, s, k): """:type s: str :type k: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseStr(self, s, k): """:type s: str :type k: int :rtype: str""" s = list(s) for i in range(0, len(s), 2 * k): s[i:i + k] = reversed(s[i:i + k]) return ''.join(s) def reverseStr_verbose(self, s, k): """:type s: str :type k: int :rtype: ...
the_stack_v2_python_sparse
src/lt_541.py
oxhead/CodingYourWay
train
0
2b750661653a1e7d68e28546e0072acf8668062e
[ "if not maze or not maze[0]:\n return False\nm, n = (len(maze), len(maze[0]))\nk = len(self.DOORS)\nkeys = [0] * k\nhas_gold = False\nqueue = []\ndoors = [None] * k\nholds = [0] * k\nvisited = set()\nfor x in range(m):\n for y in range(n):\n if maze[x][y] == self.START:\n queue.append((x, y)...
<|body_start_0|> if not maze or not maze[0]: return False m, n = (len(maze), len(maze[0])) k = len(self.DOORS) keys = [0] * k has_gold = False queue = [] doors = [None] * k holds = [0] * k visited = set() for x in range(m): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def find_treasure_in_maze(self, maze): """:type maze: list[str] :rtype: bool""" <|body_0|> def bfs(self, maze, queue, keys, holds, doors, visited): """return True if got gold, otherwise False :type maze: list[str] :type queue: list[tuple[int]] :type keys: l...
stack_v2_sparse_classes_36k_train_011031
4,626
no_license
[ { "docstring": ":type maze: list[str] :rtype: bool", "name": "find_treasure_in_maze", "signature": "def find_treasure_in_maze(self, maze)" }, { "docstring": "return True if got gold, otherwise False :type maze: list[str] :type queue: list[tuple[int]] :type keys: list[int] :type holds: list[int] ...
3
stack_v2_sparse_classes_30k_train_008701
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_treasure_in_maze(self, maze): :type maze: list[str] :rtype: bool - def bfs(self, maze, queue, keys, holds, doors, visited): return True if got gold, otherwise False :typ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_treasure_in_maze(self, maze): :type maze: list[str] :rtype: bool - def bfs(self, maze, queue, keys, holds, doors, visited): return True if got gold, otherwise False :typ...
91892fd64281d96b8a9d5c0d57b938c314ae71be
<|skeleton|> class Solution: def find_treasure_in_maze(self, maze): """:type maze: list[str] :rtype: bool""" <|body_0|> def bfs(self, maze, queue, keys, holds, doors, visited): """return True if got gold, otherwise False :type maze: list[str] :type queue: list[tuple[int]] :type keys: l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def find_treasure_in_maze(self, maze): """:type maze: list[str] :rtype: bool""" if not maze or not maze[0]: return False m, n = (len(maze), len(maze[0])) k = len(self.DOORS) keys = [0] * k has_gold = False queue = [] doors =...
the_stack_v2_python_sparse
other/find_treasure_in_maze.py
jaychsu/algorithm
train
143
de2a0f6d32dd1be1678e9ba96dcfd0ffcd5a9dc7
[ "super().__init__(fmc, **kwargs)\nlogging.debug('In __init__() for FailoverInterfaceMACAddressConfigs class.')\nself.parse_kwargs(**kwargs)", "super().parse_kwargs(**kwargs)\nlogging.debug('In parse_kwargs() for FailoverInterfaceMACAddressConfigs class.')\nif 'ha_name' in kwargs:\n self.device_ha(ha_name=kwarg...
<|body_start_0|> super().__init__(fmc, **kwargs) logging.debug('In __init__() for FailoverInterfaceMACAddressConfigs class.') self.parse_kwargs(**kwargs) <|end_body_0|> <|body_start_1|> super().parse_kwargs(**kwargs) logging.debug('In parse_kwargs() for FailoverInterfaceMACAddre...
The FailoverInterfaceMACAddressConfigs Object in the FMC.
FailoverInterfaceMACAddressConfigs
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FailoverInterfaceMACAddressConfigs: """The FailoverInterfaceMACAddressConfigs Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize FailoverInterfaceMACAddressConfigs object. :param fmc (object): FMC object :param **kwargs: Any other values passed during instantiatio...
stack_v2_sparse_classes_36k_train_011032
5,018
permissive
[ { "docstring": "Initialize FailoverInterfaceMACAddressConfigs object. :param fmc (object): FMC object :param **kwargs: Any other values passed during instantiation. :return: None", "name": "__init__", "signature": "def __init__(self, fmc, **kwargs)" }, { "docstring": "Parse the kwargs and set se...
5
null
Implement the Python class `FailoverInterfaceMACAddressConfigs` described below. Class description: The FailoverInterfaceMACAddressConfigs Object in the FMC. Method signatures and docstrings: - def __init__(self, fmc, **kwargs): Initialize FailoverInterfaceMACAddressConfigs object. :param fmc (object): FMC object :pa...
Implement the Python class `FailoverInterfaceMACAddressConfigs` described below. Class description: The FailoverInterfaceMACAddressConfigs Object in the FMC. Method signatures and docstrings: - def __init__(self, fmc, **kwargs): Initialize FailoverInterfaceMACAddressConfigs object. :param fmc (object): FMC object :pa...
fd924de96e200ca8e0d5088b27a5abaf6f915bc6
<|skeleton|> class FailoverInterfaceMACAddressConfigs: """The FailoverInterfaceMACAddressConfigs Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize FailoverInterfaceMACAddressConfigs object. :param fmc (object): FMC object :param **kwargs: Any other values passed during instantiatio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FailoverInterfaceMACAddressConfigs: """The FailoverInterfaceMACAddressConfigs Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize FailoverInterfaceMACAddressConfigs object. :param fmc (object): FMC object :param **kwargs: Any other values passed during instantiation. :return: N...
the_stack_v2_python_sparse
fmcapi/api_objects/device_ha_pair_services/failoverinterfacemacaddressconfigs.py
banzigaga/fmcapi
train
1
bed8b673f07f36960439a0bb7e016e92bff5deb6
[ "tortoise = hare = head\nwhile hare and hare.next:\n tortoise = tortoise.next\n hare = hare.next.next\n if tortoise == hare:\n return hare\nreturn None", "if not head:\n return head\nmeeting_point = self.get_intersection(head)\nif not meeting_point:\n return None\npointer_1 = head\npointer_2...
<|body_start_0|> tortoise = hare = head while hare and hare.next: tortoise = tortoise.next hare = hare.next.next if tortoise == hare: return hare return None <|end_body_0|> <|body_start_1|> if not head: return head ...
ListCycle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListCycle: def get_intersection(self, head: 'ListNode'): """Gets the intersection point of slow and fast. or hare and tortoise. :param head: :return:""" <|body_0|> def get_node(self, head: 'ListNode') -> 'ListNode': """Approach: Floyd's tortoise and hare Time Complex...
stack_v2_sparse_classes_36k_train_011033
1,598
no_license
[ { "docstring": "Gets the intersection point of slow and fast. or hare and tortoise. :param head: :return:", "name": "get_intersection", "signature": "def get_intersection(self, head: 'ListNode')" }, { "docstring": "Approach: Floyd's tortoise and hare Time Complexity: O(N) Space Complexity: O(1) ...
3
stack_v2_sparse_classes_30k_train_009403
Implement the Python class `ListCycle` described below. Class description: Implement the ListCycle class. Method signatures and docstrings: - def get_intersection(self, head: 'ListNode'): Gets the intersection point of slow and fast. or hare and tortoise. :param head: :return: - def get_node(self, head: 'ListNode') -...
Implement the Python class `ListCycle` described below. Class description: Implement the ListCycle class. Method signatures and docstrings: - def get_intersection(self, head: 'ListNode'): Gets the intersection point of slow and fast. or hare and tortoise. :param head: :return: - def get_node(self, head: 'ListNode') -...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class ListCycle: def get_intersection(self, head: 'ListNode'): """Gets the intersection point of slow and fast. or hare and tortoise. :param head: :return:""" <|body_0|> def get_node(self, head: 'ListNode') -> 'ListNode': """Approach: Floyd's tortoise and hare Time Complex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListCycle: def get_intersection(self, head: 'ListNode'): """Gets the intersection point of slow and fast. or hare and tortoise. :param head: :return:""" tortoise = hare = head while hare and hare.next: tortoise = tortoise.next hare = hare.next.next i...
the_stack_v2_python_sparse
revisited/linked_list/list_cycle_ii.py
Shiv2157k/leet_code
train
1
0fb841c8db69dc4b94ac81245a36c97f11c0f222
[ "m = len(coins)\ntable = [[0] * m for _ in range(amount + 1)]\nfor j in range(m):\n table[0][j] = 1\nfor j, c in enumerate(coins):\n for i in range(1, amount + 1):\n x = table[i - c][j] if i >= c else 0\n y = table[i][j - 1] if j > 0 else 0\n table[i][j] = x + y\nreturn table[-1][-1]", ...
<|body_start_0|> m = len(coins) table = [[0] * m for _ in range(amount + 1)] for j in range(m): table[0][j] = 1 for j, c in enumerate(coins): for i in range(1, amount + 1): x = table[i - c][j] if i >= c else 0 y = table[i][j - 1] if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange_v1(self, coins: List[int], amount: int) -> int: """Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | ...
stack_v2_sparse_classes_36k_train_011034
3,481
no_license
[ { "docstring": "Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | 1 2 3 --+-------- 0 | 1 1 1 1 | 1 1 1 2 | 1 2 2 3 | 1 2 3 4 | 1 3 4", "name": "c...
2
stack_v2_sparse_classes_30k_train_015775
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange_v1(self, coins: List[int], amount: int) -> int: Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange_v1(self, coins: List[int], amount: int) -> int: Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def coinChange_v1(self, coins: List[int], amount: int) -> int: """Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def coinChange_v1(self, coins: List[int], amount: int) -> int: """Use a 2-D table to track the status -- one column for each coin. Time complexity: O(nm) and space consumption is O(nm), where n is the amount and m is the number of coins. Examples: Input: S = {1, 2, 3}, N = 4 | 1 2 3 --+-----...
the_stack_v2_python_sparse
python3/dynamic_programming/coin_change.py
victorchu/algorithms
train
0
2314ed159aef9a0029b6e40c4999dd16dfc2ea8d
[ "self.capacity = capacity\nself.d = dict()\nself.dq = collections.deque()", "if key not in self.d:\n return -1\nself.dq.append(key)\nself.d[key][1] += 1\nreturn self.d[key][0]", "self.dq.append(key)\nif key not in self.d:\n self.d[key] = [value, 1]\nelse:\n self.d[key] = [value, self.d[key][1] + 1]\nif...
<|body_start_0|> self.capacity = capacity self.d = dict() self.dq = collections.deque() <|end_body_0|> <|body_start_1|> if key not in self.d: return -1 self.dq.append(key) self.d[key][1] += 1 return self.d[key][0] <|end_body_1|> <|body_start_2|> ...
206ms
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: """206ms""" def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|b...
stack_v2_sparse_classes_36k_train_011035
5,062
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: 206ms Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: 206ms Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|skeleton|> class LRUCache:...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class LRUCache: """206ms""" def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: """206ms""" def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.d = dict() self.dq = collections.deque() def get(self, key): """:type key: int :rtype: int""" if key not in self.d: return -1 ...
the_stack_v2_python_sparse
LRUCache_HARD_146.py
953250587/leetcode-python
train
2
5080ccbc22f398ca18ce213aa0c13713799f4bf9
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TaskReport()", "from ..entity import Entity\nfrom .lifecycle_workflow_processing_status import LifecycleWorkflowProcessingStatus\nfrom .task import Task\nfrom .task_definition import TaskDefinition\nfrom .task_processing_result import ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return TaskReport() <|end_body_0|> <|body_start_1|> from ..entity import Entity from .lifecycle_workflow_processing_status import LifecycleWorkflowProcessingStatus from .task import Tas...
TaskReport
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskReport: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TaskReport: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Task...
stack_v2_sparse_classes_36k_train_011036
6,418
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: TaskReport", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(pa...
3
null
Implement the Python class `TaskReport` described below. Class description: Implement the TaskReport class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TaskReport: Creates a new instance of the appropriate class based on discriminator value Args: pa...
Implement the Python class `TaskReport` described below. Class description: Implement the TaskReport class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TaskReport: Creates a new instance of the appropriate class based on discriminator value Args: pa...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class TaskReport: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TaskReport: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Task...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskReport: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TaskReport: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: TaskReport""" ...
the_stack_v2_python_sparse
msgraph/generated/models/identity_governance/task_report.py
microsoftgraph/msgraph-sdk-python
train
135
d1edb8c3363772c30b0d89f7095718d4f47582c5
[ "jstr = basedao.getMatchStatus(gameId, matchId)\nif jstr:\n d = json.loads(jstr)\n return StageMatchStatus(matchId, d['seq'], d['startTime'])\nreturn None", "try:\n d = {'seq': status.seq, 'startTime': status.startTime}\n jstr = json.dumps(d)\n basedao.saveMatchStatus(gameId, status.matchId, jstr)\...
<|body_start_0|> jstr = basedao.getMatchStatus(gameId, matchId) if jstr: d = json.loads(jstr) return StageMatchStatus(matchId, d['seq'], d['startTime']) return None <|end_body_0|> <|body_start_1|> try: d = {'seq': status.seq, 'startTime': status.start...
StageMatchStatusDaoRedis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StageMatchStatusDaoRedis: def load(self, gameId, matchId): """加载赛事状态""" <|body_0|> def save(self, gameId, status): """保存赛事状态""" <|body_1|> <|end_skeleton|> <|body_start_0|> jstr = basedao.getMatchStatus(gameId, matchId) if jstr: ...
stack_v2_sparse_classes_36k_train_011037
1,611
no_license
[ { "docstring": "加载赛事状态", "name": "load", "signature": "def load(self, gameId, matchId)" }, { "docstring": "保存赛事状态", "name": "save", "signature": "def save(self, gameId, status)" } ]
2
null
Implement the Python class `StageMatchStatusDaoRedis` described below. Class description: Implement the StageMatchStatusDaoRedis class. Method signatures and docstrings: - def load(self, gameId, matchId): 加载赛事状态 - def save(self, gameId, status): 保存赛事状态
Implement the Python class `StageMatchStatusDaoRedis` described below. Class description: Implement the StageMatchStatusDaoRedis class. Method signatures and docstrings: - def load(self, gameId, matchId): 加载赛事状态 - def save(self, gameId, status): 保存赛事状态 <|skeleton|> class StageMatchStatusDaoRedis: def load(self,...
99c47ad235583e765c35627ba34d4f496ccccbe4
<|skeleton|> class StageMatchStatusDaoRedis: def load(self, gameId, matchId): """加载赛事状态""" <|body_0|> def save(self, gameId, status): """保存赛事状态""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StageMatchStatusDaoRedis: def load(self, gameId, matchId): """加载赛事状态""" jstr = basedao.getMatchStatus(gameId, matchId) if jstr: d = json.loads(jstr) return StageMatchStatus(matchId, d['seq'], d['startTime']) return None def save(self, gameId, status...
the_stack_v2_python_sparse
trunk/tygame-match5-py/src/matchcomm/matchs/stage_match/match_status.py
zhaozw/freetime5
train
0
a27a2ad8559cac765ead2d0305d256c8e0ab87b1
[ "self.beta = beta\nself.a0 = a0\nself.b0 = b0", "assert X.ndim == 2\nassert t.ndim == 1\nself.a = self.a0 + 0.5 * np.size(X, 1)\nself.b = self.b0\nI = np.eye(np.size(X, 1))\nfor i in range(iter_max):\n param = self.b\n self.w_var = np.linalg.inv(self.a * I / self.b + self.beta * X.T @ X)\n self.w_mean = ...
<|body_start_0|> self.beta = beta self.a0 = a0 self.b0 = b0 <|end_body_0|> <|body_start_1|> assert X.ndim == 2 assert t.ndim == 1 self.a = self.a0 + 0.5 * np.size(X, 1) self.b = self.b0 I = np.eye(np.size(X, 1)) for i in range(iter_max): ...
VariationalLinearRegressor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VariationalLinearRegressor: def __init__(self, beta=1.0, a0=1.0, b0=1.0): """construct variational linear regressor Parameters ---------- beta : float precision of observation noise a0 : float a parameter of prior gamma distribution Gamma(alpha|a0,b0) b0 : float another parameter of prio...
stack_v2_sparse_classes_36k_train_011038
2,857
no_license
[ { "docstring": "construct variational linear regressor Parameters ---------- beta : float precision of observation noise a0 : float a parameter of prior gamma distribution Gamma(alpha|a0,b0) b0 : float another parameter of prior gamma distribution Gamma(alpha|a0,b0)", "name": "__init__", "signature": "d...
3
stack_v2_sparse_classes_30k_train_005727
Implement the Python class `VariationalLinearRegressor` described below. Class description: Implement the VariationalLinearRegressor class. Method signatures and docstrings: - def __init__(self, beta=1.0, a0=1.0, b0=1.0): construct variational linear regressor Parameters ---------- beta : float precision of observati...
Implement the Python class `VariationalLinearRegressor` described below. Class description: Implement the VariationalLinearRegressor class. Method signatures and docstrings: - def __init__(self, beta=1.0, a0=1.0, b0=1.0): construct variational linear regressor Parameters ---------- beta : float precision of observati...
77056922f23176065b056d5ca136a43971831969
<|skeleton|> class VariationalLinearRegressor: def __init__(self, beta=1.0, a0=1.0, b0=1.0): """construct variational linear regressor Parameters ---------- beta : float precision of observation noise a0 : float a parameter of prior gamma distribution Gamma(alpha|a0,b0) b0 : float another parameter of prio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VariationalLinearRegressor: def __init__(self, beta=1.0, a0=1.0, b0=1.0): """construct variational linear regressor Parameters ---------- beta : float precision of observation noise a0 : float a parameter of prior gamma distribution Gamma(alpha|a0,b0) b0 : float another parameter of prior gamma distri...
the_stack_v2_python_sparse
prml/linear_regressors/variational_linear_regressor.py
zgcgreat/PRML-1
train
0
bc8f3ad01df67ed27e210902a792077f3892b70d
[ "if not super().recognizes(file):\n return False\nwith open(file.path) as f:\n try:\n file.parsed = _parse(f)\n except (ExpatError, UnicodeDecodeError) as e:\n return False\nreturn True", "if isinstance(other, MissingFile):\n return [Difference(None, self.name, other.name, comment='Tryin...
<|body_start_0|> if not super().recognizes(file): return False with open(file.path) as f: try: file.parsed = _parse(f) except (ExpatError, UnicodeDecodeError) as e: return False return True <|end_body_0|> <|body_start_1|> ...
XML Files Comparison class Attributes: FILE_EXTENSION_SUFFIX (str): xml file extension suffix
XMLFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLFile: """XML Files Comparison class Attributes: FILE_EXTENSION_SUFFIX (str): xml file extension suffix""" def recognizes(cls, file): """Identifies if a given file has XML extension Args: file - a diffoscope.comparators.utils.file.File object Returns: False if file is not a XML Fil...
stack_v2_sparse_classes_36k_train_011039
3,646
permissive
[ { "docstring": "Identifies if a given file has XML extension Args: file - a diffoscope.comparators.utils.file.File object Returns: False if file is not a XML File, True otherwise", "name": "recognizes", "signature": "def recognizes(cls, file)" }, { "docstring": "Compares self.object with another...
3
stack_v2_sparse_classes_30k_train_014032
Implement the Python class `XMLFile` described below. Class description: XML Files Comparison class Attributes: FILE_EXTENSION_SUFFIX (str): xml file extension suffix Method signatures and docstrings: - def recognizes(cls, file): Identifies if a given file has XML extension Args: file - a diffoscope.comparators.utils...
Implement the Python class `XMLFile` described below. Class description: XML Files Comparison class Attributes: FILE_EXTENSION_SUFFIX (str): xml file extension suffix Method signatures and docstrings: - def recognizes(cls, file): Identifies if a given file has XML extension Args: file - a diffoscope.comparators.utils...
a5520738e6c5924b94f69980eba49a565c2561d7
<|skeleton|> class XMLFile: """XML Files Comparison class Attributes: FILE_EXTENSION_SUFFIX (str): xml file extension suffix""" def recognizes(cls, file): """Identifies if a given file has XML extension Args: file - a diffoscope.comparators.utils.file.File object Returns: False if file is not a XML Fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLFile: """XML Files Comparison class Attributes: FILE_EXTENSION_SUFFIX (str): xml file extension suffix""" def recognizes(cls, file): """Identifies if a given file has XML extension Args: file - a diffoscope.comparators.utils.file.File object Returns: False if file is not a XML File, True other...
the_stack_v2_python_sparse
venv/lib/python3.7/site-packages/diffoscope/comparators/xml.py
crazyzete/AppSecAssignment2
train
0
db5ea1834098e8810cb36df4cdf081282368de0e
[ "dist = dist.coalesce((source,) + (sum(others, ()),) + (target,))\nconstraints = [[0, 2], [1, 2]]\nsuper().__init__(dist, marginals=constraints, rv_mode=rv_mode)\nself._source = {0}\nself._others = {1}\nself._target = {2}", "cmi = self._conditional_mutual_information(self._source, self._target, self._others)\n\nd...
<|body_start_0|> dist = dist.coalesce((source,) + (sum(others, ()),) + (target,)) constraints = [[0, 2], [1, 2]] super().__init__(dist, marginals=constraints, rv_mode=rv_mode) self._source = {0} self._others = {1} self._target = {2} <|end_body_0|> <|body_start_1|> ...
Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.
BROJAOptimizer
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BROJAOptimizer: """Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.""" def __init__(self, dist, source, others, target, rv_mode=None): """Initialize the optimizer. Parameters ------...
stack_v2_sparse_classes_36k_train_011040
3,870
permissive
[ { "docstring": "Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to base the optimization on. source : iterable Variable to treat as the source. others : iterable of iterables The other source variables. target : iterable The target variable. rv_mode : bool Unused, provided f...
2
stack_v2_sparse_classes_30k_train_017092
Implement the Python class `BROJAOptimizer` described below. Class description: Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation. Method signatures and docstrings: - def __init__(self, dist, source, others, target, r...
Implement the Python class `BROJAOptimizer` described below. Class description: Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation. Method signatures and docstrings: - def __init__(self, dist, source, others, target, r...
b13c5020a2b8524527a4a0db5a81d8549142228c
<|skeleton|> class BROJAOptimizer: """Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.""" def __init__(self, dist, source, others, target, rv_mode=None): """Initialize the optimizer. Parameters ------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BROJAOptimizer: """Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.""" def __init__(self, dist, source, others, target, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : D...
the_stack_v2_python_sparse
dit/pid/measures/ibroja.py
dit/dit
train
468
14a627789584c09daaa46bb1f8fd058fadf3e6fd
[ "if self.action == 'retrieve':\n permission_classes = [IsAuthenticated]\nelse:\n permission_classes = [IsAdminUser]\nreturn [permission() for permission in permission_classes]", "if pk == 'i':\n return Response(UserSerializer(request.user, context={'request': request}).data)\nreturn super(UserViewSet, se...
<|body_start_0|> if self.action == 'retrieve': permission_classes = [IsAuthenticated] else: permission_classes = [IsAdminUser] return [permission() for permission in permission_classes] <|end_body_0|> <|body_start_1|> if pk == 'i': return Response(Use...
UserViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserViewSet: def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def retrieve(self, request, pk=None): """este metodo serve para retornar informacoes do usuario logado e so retorna informacao se o id p...
stack_v2_sparse_classes_36k_train_011041
1,110
permissive
[ { "docstring": "Instantiates and returns the list of permissions that this view requires.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "este metodo serve para retornar informacoes do usuario logado e so retorna informacao se o id passado por 'i'", "...
2
null
Implement the Python class `UserViewSet` described below. Class description: Implement the UserViewSet class. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def retrieve(self, request, pk=None): este metodo serve para retornar...
Implement the Python class `UserViewSet` described below. Class description: Implement the UserViewSet class. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def retrieve(self, request, pk=None): este metodo serve para retornar...
9dd1fb39c5634454217f8ea7b41c0248d4e4f222
<|skeleton|> class UserViewSet: def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def retrieve(self, request, pk=None): """este metodo serve para retornar informacoes do usuario logado e so retorna informacao se o id p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserViewSet: def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" if self.action == 'retrieve': permission_classes = [IsAuthenticated] else: permission_classes = [IsAdminUser] return [permission() for...
the_stack_v2_python_sparse
backend/tno/views/user.py
linea-it/tno
train
1
88f495c302724df293b1875f738196746c292d26
[ "n = 50\nactual = a1.num_buses(n)\nexpected = 1\nself.assertEqual(actual, expected)", "n = 0\nactual = a1.num_buses(n)\nexpected = 0\nself.assertEqual(actual, expected)", "n = 35\nactual = a1.num_buses(n)\nexpected = 1\nself.assertEqual(actual, expected)", "n = 156\nactual = a1.num_buses(n)\nexpected = 4\nsel...
<|body_start_0|> n = 50 actual = a1.num_buses(n) expected = 1 self.assertEqual(actual, expected) <|end_body_0|> <|body_start_1|> n = 0 actual = a1.num_buses(n) expected = 0 self.assertEqual(actual, expected) <|end_body_1|> <|body_start_2|> n = 35...
Test class for function a1.num_buses.
TestNumBuses
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNumBuses: """Test class for function a1.num_buses.""" def test_ecual(self): """Test if the function works properly with exact number for the passengers""" <|body_0|> def test_zero(self): """Test when the number of passangers is 0""" <|body_1|> de...
stack_v2_sparse_classes_36k_train_011042
1,065
no_license
[ { "docstring": "Test if the function works properly with exact number for the passengers", "name": "test_ecual", "signature": "def test_ecual(self)" }, { "docstring": "Test when the number of passangers is 0", "name": "test_zero", "signature": "def test_zero(self)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_012591
Implement the Python class `TestNumBuses` described below. Class description: Test class for function a1.num_buses. Method signatures and docstrings: - def test_ecual(self): Test if the function works properly with exact number for the passengers - def test_zero(self): Test when the number of passangers is 0 - def te...
Implement the Python class `TestNumBuses` described below. Class description: Test class for function a1.num_buses. Method signatures and docstrings: - def test_ecual(self): Test if the function works properly with exact number for the passengers - def test_zero(self): Test when the number of passangers is 0 - def te...
ba0e48825e3f90f9da0e7506c89354622198c4a5
<|skeleton|> class TestNumBuses: """Test class for function a1.num_buses.""" def test_ecual(self): """Test if the function works properly with exact number for the passengers""" <|body_0|> def test_zero(self): """Test when the number of passangers is 0""" <|body_1|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNumBuses: """Test class for function a1.num_buses.""" def test_ecual(self): """Test if the function works properly with exact number for the passengers""" n = 50 actual = a1.num_buses(n) expected = 1 self.assertEqual(actual, expected) def test_zero(self): ...
the_stack_v2_python_sparse
Coursera/Python3/Second Course Asignments/Assighment 1/test_num_buses.py
Vutov/SideProjects
train
0
fa3038ae9ffe3c69d5ffed859cbfa10975664a3b
[ "self.problem = problem\nself.u = problem.T\nself.params = {'snes_type': 'newtonls', 'mat_type': 'matfree', 'ksp_type': 'gmres', 'pc_type': 'python', 'pc_python_type': 'firedrake.AssembledPC', 'assembled_pc_type': 'hypre', 'assembled_pc_factor_mat_solver_type': 'mumps', 'assembled_pc_hypre_type': 'boomeramg', 'asse...
<|body_start_0|> self.problem = problem self.u = problem.T self.params = {'snes_type': 'newtonls', 'mat_type': 'matfree', 'ksp_type': 'gmres', 'pc_type': 'python', 'pc_python_type': 'firedrake.AssembledPC', 'assembled_pc_type': 'hypre', 'assembled_pc_factor_mat_solver_type': 'mumps', 'assembled_...
A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.
Solver
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solver: """A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.""" def __init__(self, problem): """Initialise the S...
stack_v2_sparse_classes_36k_train_011043
3,977
permissive
[ { "docstring": "Initialise the Solver. Args: problem (TTiP.problem.Problem): The problem to solve.", "name": "__init__", "signature": "def __init__(self, problem)" }, { "docstring": "Setup and solve the nonlinear problem. Save value to file given. Any additional keyword arguments are passed to t...
3
stack_v2_sparse_classes_30k_train_015577
Implement the Python class `Solver` described below. Class description: A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver. Method signatures and do...
Implement the Python class `Solver` described below. Class description: A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver. Method signatures and do...
cc4e7f7b9abb498893aaa05e2b25416f513905b0
<|skeleton|> class Solver: """A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.""" def __init__(self, problem): """Initialise the S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solver: """A class for the solver. Attributes: problem (TTiP.problem.Problem (or subclass)): The problem to solve. u (firedrake.Function): The variable to solve for in the problem. params (dict): The parameters passed to the solver.""" def __init__(self, problem): """Initialise the Solver. Args: ...
the_stack_v2_python_sparse
TTiP/core/solver.py
AndrewLister-STFC/TTiP
train
0
b386294a2763c5aa08aabb9c9e059394bdf5e630
[ "current_dir = os.getcwd()\npath = current_dir + '\\\\data_files'\nclear_db()\nimport_test = import_data(path, 'customer_data.csv', 'product_data.csv', 'rental_data.csv')\nself.assertEqual(list(import_test), [(8, 5, 11), (0, 0, 0)])", "current_dir = os.getcwd()\npath = current_dir + '\\\\data_files'\nclear_db()\n...
<|body_start_0|> current_dir = os.getcwd() path = current_dir + '\\data_files' clear_db() import_test = import_data(path, 'customer_data.csv', 'product_data.csv', 'rental_data.csv') self.assertEqual(list(import_test), [(8, 5, 11), (0, 0, 0)]) <|end_body_0|> <|body_start_1|> ...
Test the Import Data function from the database file.
TestCaseOne
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCaseOne: """Test the Import Data function from the database file.""" def test_import_data(self): """Tests importing of data from csv files""" <|body_0|> def test_import_bad_data(self): """Test the import of bad or incomplete data.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_011044
4,063
no_license
[ { "docstring": "Tests importing of data from csv files", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Test the import of bad or incomplete data.", "name": "test_import_bad_data", "signature": "def test_import_bad_data(self)" }, { "docst...
3
null
Implement the Python class `TestCaseOne` described below. Class description: Test the Import Data function from the database file. Method signatures and docstrings: - def test_import_data(self): Tests importing of data from csv files - def test_import_bad_data(self): Test the import of bad or incomplete data. - def t...
Implement the Python class `TestCaseOne` described below. Class description: Test the Import Data function from the database file. Method signatures and docstrings: - def test_import_data(self): Tests importing of data from csv files - def test_import_bad_data(self): Test the import of bad or incomplete data. - def t...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestCaseOne: """Test the Import Data function from the database file.""" def test_import_data(self): """Tests importing of data from csv files""" <|body_0|> def test_import_bad_data(self): """Test the import of bad or incomplete data.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCaseOne: """Test the Import Data function from the database file.""" def test_import_data(self): """Tests importing of data from csv files""" current_dir = os.getcwd() path = current_dir + '\\data_files' clear_db() import_test = import_data(path, 'customer_data...
the_stack_v2_python_sparse
students/nskvarch/Lesson5/test_database.py
JavaRod/SP_Python220B_2019
train
1
be863ef157bf82d4eb0e5afa555372c0470f3255
[ "cursor = connection.cursor()\ntable = self.model._meta.db_table\nlogger.debug('Locking table %s' % table)\ncursor.execute('LOCK TABLES %s WRITE' % table)\nrow = cursor.fetchone()\nreturn row", "cursor = connection.cursor()\ntable = self.model._meta.db_table\ncursor.execute('UNLOCK TABLES')\nrow = cursor.fetchone...
<|body_start_0|> cursor = connection.cursor() table = self.model._meta.db_table logger.debug('Locking table %s' % table) cursor.execute('LOCK TABLES %s WRITE' % table) row = cursor.fetchone() return row <|end_body_0|> <|body_start_1|> cursor = connection.cursor()...
Add lock/unlock functionality to manager. Example:: class Job(models.Model): objects = LockingManager() counter = models.IntegerField(null=True, default=0) @staticmethod def do_atomic_update(job_id) ''' Updates job integer, keeping it below 5 ''' try: # Ensure only one HTTP request can do this update at once. Job.objec...
LockingManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockingManager: """Add lock/unlock functionality to manager. Example:: class Job(models.Model): objects = LockingManager() counter = models.IntegerField(null=True, default=0) @staticmethod def do_atomic_update(job_id) ''' Updates job integer, keeping it below 5 ''' try: # Ensure only one HTTP req...
stack_v2_sparse_classes_36k_train_011045
1,989
permissive
[ { "docstring": "Lock table. Locks the object model table so that atomic update is possible. Simulatenous database access request pend until the lock is unlock()'ed. Note: If you need to lock multiple tables, you need to do lock them all in one SQL clause and this function is not enough. To avoid dead lock, all ...
2
stack_v2_sparse_classes_30k_train_012506
Implement the Python class `LockingManager` described below. Class description: Add lock/unlock functionality to manager. Example:: class Job(models.Model): objects = LockingManager() counter = models.IntegerField(null=True, default=0) @staticmethod def do_atomic_update(job_id) ''' Updates job integer, keeping it belo...
Implement the Python class `LockingManager` described below. Class description: Add lock/unlock functionality to manager. Example:: class Job(models.Model): objects = LockingManager() counter = models.IntegerField(null=True, default=0) @staticmethod def do_atomic_update(job_id) ''' Updates job integer, keeping it belo...
be5222d9c5ce57a169b94b0afd1ae9f7f10a66c1
<|skeleton|> class LockingManager: """Add lock/unlock functionality to manager. Example:: class Job(models.Model): objects = LockingManager() counter = models.IntegerField(null=True, default=0) @staticmethod def do_atomic_update(job_id) ''' Updates job integer, keeping it below 5 ''' try: # Ensure only one HTTP req...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LockingManager: """Add lock/unlock functionality to manager. Example:: class Job(models.Model): objects = LockingManager() counter = models.IntegerField(null=True, default=0) @staticmethod def do_atomic_update(job_id) ''' Updates job integer, keeping it below 5 ''' try: # Ensure only one HTTP request can do t...
the_stack_v2_python_sparse
generator/locking_manager.py
cometsong/jaxid_generator
train
2
4c7866a95b508d455de4ec1e320d0362069a1977
[ "super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug)\nself.delta_x = self.sensitivity // 4\nself.delta_y = self.sensitivity // 4\nself.set_points(200 * lives)", "if not direction:\n direction = random.choice([Direction.BOTTOM_LEFT, Direction.BOTTOM_RIGHT...
<|body_start_0|> super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug) self.delta_x = self.sensitivity // 4 self.delta_y = self.sensitivity // 4 self.set_points(200 * lives) <|end_body_0|> <|body_start_1|> if not direction: ...
Crabs
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crabs: def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): """The main class for Crabs""" <|body_0|> def shoot(self, direction: Direction=None): """Lets the mob shoot""" ...
stack_v2_sparse_classes_36k_train_011046
1,660
permissive
[ { "docstring": "The main class for Crabs", "name": "__init__", "signature": "def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool)" }, { "docstring": "Lets the mob shoot", "name": "shoot", "signature":...
3
stack_v2_sparse_classes_30k_train_008726
Implement the Python class `Crabs` described below. Class description: Implement the Crabs class. Method signatures and docstrings: - def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): The main class for Crabs - def shoot(self,...
Implement the Python class `Crabs` described below. Class description: Implement the Crabs class. Method signatures and docstrings: - def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): The main class for Crabs - def shoot(self,...
6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9
<|skeleton|> class Crabs: def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): """The main class for Crabs""" <|body_0|> def shoot(self, direction: Direction=None): """Lets the mob shoot""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Crabs: def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): """The main class for Crabs""" super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug) ...
the_stack_v2_python_sparse
gym_invaders/gym_game/envs/classes/Game/Sprites/Crabs.py
Jh123x/Orbital
train
4
6f60093b41d44ac7c85a169066bf54572bd597df
[ "self.tweet_id = 0\nself.user_tweet = {}\nself.user_user = {}", "if userId not in self.user_tweet:\n self.user_tweet[userId] = [(self.tweet_id, tweetId)]\n self.tweet_id += 1\nelse:\n self.user_tweet[userId].append((self.tweet_id, tweetId))\n self.tweet_id += 1", "res = []\nif userId in self.user_tw...
<|body_start_0|> self.tweet_id = 0 self.user_tweet = {} self.user_user = {} <|end_body_0|> <|body_start_1|> if userId not in self.user_tweet: self.user_tweet[userId] = [(self.tweet_id, tweetId)] self.tweet_id += 1 else: self.user_tweet[userId]...
Twitter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k_train_011047
4,211
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: void", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
6facec2a54d1d9f133f420c9bce1d1043f57ebc6
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.tweet_id = 0 self.user_tweet = {} self.user_user = {} def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" if userId n...
the_stack_v2_python_sparse
Design Twitter.py
sugia/leetcode
train
1
eb551c0794181a3b8beeed534c844980cd873709
[ "if isinstance(review_request_details, ReviewRequestDraft):\n return self.draft_extra_data.get(key, default)\nreturn self.extra_data.get(key, default)", "if isinstance(review_request_details, ReviewRequestDraft):\n self.draft_extra_data[key] = value\nelse:\n self.extra_data[key] = value" ]
<|body_start_0|> if isinstance(review_request_details, ReviewRequestDraft): return self.draft_extra_data.get(key, default) return self.extra_data.get(key, default) <|end_body_0|> <|body_start_1|> if isinstance(review_request_details, ReviewRequestDraft): self.draft_extra...
A non user modifiable store for data about commits. This acts as a simple store for data about commits which a review request owner may not modify themselves. A simple JSONField is used to mimic the extra_data present on many built-in Review Board models to make transitioning as quick as possible. Eventually we'll want...
CommitData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommitData: """A non user modifiable store for data about commits. This acts as a simple store for data about commits which a review request owner may not modify themselves. A simple JSONField is used to mimic the extra_data present on many built-in Review Board models to make transitioning as qu...
stack_v2_sparse_classes_36k_train_011048
4,054
permissive
[ { "docstring": "Return the extra data value for either a review request or a draft. This helper method allows a caller to fetch a key from either extra_data or draft_extra_data when they want the data associated with a ReviewRequest or a ReviewRequestDraft respectively.", "name": "get_for", "signature":...
2
null
Implement the Python class `CommitData` described below. Class description: A non user modifiable store for data about commits. This acts as a simple store for data about commits which a review request owner may not modify themselves. A simple JSONField is used to mimic the extra_data present on many built-in Review B...
Implement the Python class `CommitData` described below. Class description: A non user modifiable store for data about commits. This acts as a simple store for data about commits which a review request owner may not modify themselves. A simple JSONField is used to mimic the extra_data present on many built-in Review B...
8ef71a98892473434dbd903647a11b6903b3c92a
<|skeleton|> class CommitData: """A non user modifiable store for data about commits. This acts as a simple store for data about commits which a review request owner may not modify themselves. A simple JSONField is used to mimic the extra_data present on many built-in Review Board models to make transitioning as qu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommitData: """A non user modifiable store for data about commits. This acts as a simple store for data about commits which a review request owner may not modify themselves. A simple JSONField is used to mimic the extra_data present on many built-in Review Board models to make transitioning as quick as possib...
the_stack_v2_python_sparse
pylib/mozreview/mozreview/commits/models.py
mjzffr/version-control-tools
train
1
a07c592b8d1597370fd94174b3555b2a4eff08ed
[ "nums = sorted(nums)\nres = []\nmsum = 0\ni = 0\nmingp = (1 << 31) - 1\nwhile i < len(nums) - 2:\n start = i + 1\n end = len(nums) - 1\n cont = True\n while start < end and cont:\n sum = nums[i] + nums[start] + nums[end]\n if sum < target:\n start += 1\n elif sum > target...
<|body_start_0|> nums = sorted(nums) res = [] msum = 0 i = 0 mingp = (1 << 31) - 1 while i < len(nums) - 2: start = i + 1 end = len(nums) - 1 cont = True while start < end and cont: sum = nums[i] + nums[start...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_011049
1,701
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest", "signature": "def threeSumClosest(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest", "signature": "def threeSumClosest(se...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :r...
e718fcb6b83664d3d6413cf9b2bb4a875e62de9c
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" nums = sorted(nums) res = [] msum = 0 i = 0 mingp = (1 << 31) - 1 while i < len(nums) - 2: start = i + 1 end = len(nums) ...
the_stack_v2_python_sparse
threeSumClosest.py
bch6179/Pyn
train
1
09c9b8177cc780c276ef9ab4afcaf39129d7dee4
[ "context = super(ListTaggedPosts, self).get_context_data(**kwargs)\ncontext['page'] = 'blog'\ncontext['tag_list'] = Post.tags.values('name').annotate(count=Count('name')).order_by('-count')[:100]\ncontext['main_tag'] = self.kwargs['tag']\nreturn context", "queryset = super(ListTaggedPosts, self).get_queryset()\nq...
<|body_start_0|> context = super(ListTaggedPosts, self).get_context_data(**kwargs) context['page'] = 'blog' context['tag_list'] = Post.tags.values('name').annotate(count=Count('name')).order_by('-count')[:100] context['main_tag'] = self.kwargs['tag'] return context <|end_body_0|>...
List out all of the individual posts.
ListTaggedPosts
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListTaggedPosts: """List out all of the individual posts.""" def get_context_data(self, **kwargs): """Need to add a bit more context.""" <|body_0|> def get_queryset(self): """Only select particular posts that have the given tag.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_011050
3,006
permissive
[ { "docstring": "Need to add a bit more context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Only select particular posts that have the given tag.", "name": "get_queryset", "signature": "def get_queryset(self)" } ]
2
stack_v2_sparse_classes_30k_train_017215
Implement the Python class `ListTaggedPosts` described below. Class description: List out all of the individual posts. Method signatures and docstrings: - def get_context_data(self, **kwargs): Need to add a bit more context. - def get_queryset(self): Only select particular posts that have the given tag.
Implement the Python class `ListTaggedPosts` described below. Class description: List out all of the individual posts. Method signatures and docstrings: - def get_context_data(self, **kwargs): Need to add a bit more context. - def get_queryset(self): Only select particular posts that have the given tag. <|skeleton|>...
5058e2c652ecaf182866eced3829d317c1805588
<|skeleton|> class ListTaggedPosts: """List out all of the individual posts.""" def get_context_data(self, **kwargs): """Need to add a bit more context.""" <|body_0|> def get_queryset(self): """Only select particular posts that have the given tag.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListTaggedPosts: """List out all of the individual posts.""" def get_context_data(self, **kwargs): """Need to add a bit more context.""" context = super(ListTaggedPosts, self).get_context_data(**kwargs) context['page'] = 'blog' context['tag_list'] = Post.tags.values('name'...
the_stack_v2_python_sparse
rational_whimsy/blog/views.py
nhuntwalker/rational_whimsy
train
0
ba2ddacee0876c20dc77bbad2f57de2650a0ff89
[ "form = ProductForm({'name': '', 'description': 'test', 'price': 'test', 'image': 'test'})\nself.assertFalse(form.is_valid())\nself.assertIn('name', form.errors.keys())\nself.assertEqual(form.errors['name'][0], 'This field is required.')", "form = ProductForm({'name': 'test', 'description': '', 'price': 'test', '...
<|body_start_0|> form = ProductForm({'name': '', 'description': 'test', 'price': 'test', 'image': 'test'}) self.assertFalse(form.is_valid()) self.assertIn('name', form.errors.keys()) self.assertEqual(form.errors['name'][0], 'This field is required.') <|end_body_0|> <|body_start_1|> ...
Test that the product form works
TestProductForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestProductForm: """Test that the product form works""" def test_name_is_required(self): """Test if form submits without name field""" <|body_0|> def test_description_is_required(self): """Test if form submits without description field""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_011051
2,400
no_license
[ { "docstring": "Test if form submits without name field", "name": "test_name_is_required", "signature": "def test_name_is_required(self)" }, { "docstring": "Test if form submits without description field", "name": "test_description_is_required", "signature": "def test_description_is_requ...
4
stack_v2_sparse_classes_30k_train_003950
Implement the Python class `TestProductForm` described below. Class description: Test that the product form works Method signatures and docstrings: - def test_name_is_required(self): Test if form submits without name field - def test_description_is_required(self): Test if form submits without description field - def ...
Implement the Python class `TestProductForm` described below. Class description: Test that the product form works Method signatures and docstrings: - def test_name_is_required(self): Test if form submits without name field - def test_description_is_required(self): Test if form submits without description field - def ...
b4ef7a46708711bda460667b1f602d0bd67c0bae
<|skeleton|> class TestProductForm: """Test that the product form works""" def test_name_is_required(self): """Test if form submits without name field""" <|body_0|> def test_description_is_required(self): """Test if form submits without description field""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestProductForm: """Test that the product form works""" def test_name_is_required(self): """Test if form submits without name field""" form = ProductForm({'name': '', 'description': 'test', 'price': 'test', 'image': 'test'}) self.assertFalse(form.is_valid()) self.assertIn(...
the_stack_v2_python_sparse
products/test_forms.py
AmyOShea/MS4-ARTstop
train
1
ab67b248b25bc13a1ea2d79deb3be89702ca188e
[ "self.xyz_dims = xyz_dims\nself.xyz_remap = np.array(xyz_remap)\nself.xyz_scale = np.array(xyz_scale)\nself.xyz_abs_threshold = xyz_abs_threshold\nself.rot_dims = rot_dims\nself.rot_remap = rot_remap\nself.rot_scale = rot_scale\nself.rot_abs_threshold = rot_abs_threshold\nself.rot_discrete = rot_discrete\nself.min_...
<|body_start_0|> self.xyz_dims = xyz_dims self.xyz_remap = np.array(xyz_remap) self.xyz_scale = np.array(xyz_scale) self.xyz_abs_threshold = xyz_abs_threshold self.rot_dims = rot_dims self.rot_remap = rot_remap self.rot_scale = rot_scale self.rot_abs_thres...
SpaceMouseExpert
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpaceMouseExpert: def __init__(self, xyz_dims=3, xyz_remap=[0, 1, 2], xyz_scale=[1, 1, 1], xyz_abs_threshold=0.0, rot_dims=3, rot_remap=[0, 1, 2], rot_scale=[1, 1, 1], rot_abs_threshold=0.0, rot_discrete=False, min_clip=-np.inf, max_clip=np.inf): """TODO: fill in other params""" ...
stack_v2_sparse_classes_36k_train_011052
4,044
permissive
[ { "docstring": "TODO: fill in other params", "name": "__init__", "signature": "def __init__(self, xyz_dims=3, xyz_remap=[0, 1, 2], xyz_scale=[1, 1, 1], xyz_abs_threshold=0.0, rot_dims=3, rot_remap=[0, 1, 2], rot_scale=[1, 1, 1], rot_abs_threshold=0.0, rot_discrete=False, min_clip=-np.inf, max_clip=np.in...
2
null
Implement the Python class `SpaceMouseExpert` described below. Class description: Implement the SpaceMouseExpert class. Method signatures and docstrings: - def __init__(self, xyz_dims=3, xyz_remap=[0, 1, 2], xyz_scale=[1, 1, 1], xyz_abs_threshold=0.0, rot_dims=3, rot_remap=[0, 1, 2], rot_scale=[1, 1, 1], rot_abs_thre...
Implement the Python class `SpaceMouseExpert` described below. Class description: Implement the SpaceMouseExpert class. Method signatures and docstrings: - def __init__(self, xyz_dims=3, xyz_remap=[0, 1, 2], xyz_scale=[1, 1, 1], xyz_abs_threshold=0.0, rot_dims=3, rot_remap=[0, 1, 2], rot_scale=[1, 1, 1], rot_abs_thre...
545a4e780f9d9d480c96b67e7a8ae590a983db6b
<|skeleton|> class SpaceMouseExpert: def __init__(self, xyz_dims=3, xyz_remap=[0, 1, 2], xyz_scale=[1, 1, 1], xyz_abs_threshold=0.0, rot_dims=3, rot_remap=[0, 1, 2], rot_scale=[1, 1, 1], rot_abs_threshold=0.0, rot_discrete=False, min_clip=-np.inf, max_clip=np.inf): """TODO: fill in other params""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpaceMouseExpert: def __init__(self, xyz_dims=3, xyz_remap=[0, 1, 2], xyz_scale=[1, 1, 1], xyz_abs_threshold=0.0, rot_dims=3, rot_remap=[0, 1, 2], rot_scale=[1, 1, 1], rot_abs_threshold=0.0, rot_discrete=False, min_clip=-np.inf, max_clip=np.inf): """TODO: fill in other params""" self.xyz_dims ...
the_stack_v2_python_sparse
third_party/rlkit_library/rlkit/demos/spacemouse/input_server.py
google-research/DBAP-algorithm
train
3
aa5942db03b1a25adf77ccc02ad110ce76df3fd6
[ "if request.args.get('avg'):\n result = queries.get_departments_with_avg_salary()\n response = []\n for entry in result:\n avg_salary = round(float(entry.salary), 2)\n response.append({'id': entry.id, 'name': entry.name, 'average-salary': avg_salary})\nelse:\n departments = models.Departme...
<|body_start_0|> if request.args.get('avg'): result = queries.get_departments_with_avg_salary() response = [] for entry in result: avg_salary = round(float(entry.salary), 2) response.append({'id': entry.id, 'name': entry.name, 'average-salary':...
Rest class with methods for adding new department, fetching list of departments.
DepartmentList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepartmentList: """Rest class with methods for adding new department, fetching list of departments.""" def get(self): """Fetches a list of departments. If the avg argument in a request is not None, then returns the list of departments with an average salary. Otherwise returns the ord...
stack_v2_sparse_classes_36k_train_011053
4,247
no_license
[ { "docstring": "Fetches a list of departments. If the avg argument in a request is not None, then returns the list of departments with an average salary. Otherwise returns the ordinary list of departments. If there are no departments it returns the 204 status code. :rtype json", "name": "get", "signatur...
2
stack_v2_sparse_classes_30k_train_001996
Implement the Python class `DepartmentList` described below. Class description: Rest class with methods for adding new department, fetching list of departments. Method signatures and docstrings: - def get(self): Fetches a list of departments. If the avg argument in a request is not None, then returns the list of depa...
Implement the Python class `DepartmentList` described below. Class description: Rest class with methods for adding new department, fetching list of departments. Method signatures and docstrings: - def get(self): Fetches a list of departments. If the avg argument in a request is not None, then returns the list of depa...
45239501036921577e823e42959d2fa70e307f49
<|skeleton|> class DepartmentList: """Rest class with methods for adding new department, fetching list of departments.""" def get(self): """Fetches a list of departments. If the avg argument in a request is not None, then returns the list of departments with an average salary. Otherwise returns the ord...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DepartmentList: """Rest class with methods for adding new department, fetching list of departments.""" def get(self): """Fetches a list of departments. If the avg argument in a request is not None, then returns the list of departments with an average salary. Otherwise returns the ordinary list of...
the_stack_v2_python_sparse
department_app/rest/department.py
eewig/department_app
train
0
dc8b17d6eddc0cf03a64c017651eba809f1e1bda
[ "json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json...
<|body_start_0|> json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_id = json_dict.get('district_id') place = json_dict.get('place') mobile = jso...
修改和删除地址
UpdateDestroyAddressView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址 :param request: :param address_id: :return:""" <|body_0|> def delete(self, request, address_id): """删除地址 :param request: :param address_id: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_011054
23,231
permissive
[ { "docstring": "修改地址 :param request: :param address_id: :return:", "name": "put", "signature": "def put(self, request, address_id)" }, { "docstring": "删除地址 :param request: :param address_id: :return:", "name": "delete", "signature": "def delete(self, request, address_id)" } ]
2
stack_v2_sparse_classes_30k_train_001991
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 :param request: :param address_id: :return: - def delete(self, request, address_id): 删除地址 :param request: :param address_id: :return:
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 :param request: :param address_id: :return: - def delete(self, request, address_id): 删除地址 :param request: :param address_id: :return: <|skelet...
fecdf074ddb6844f33d6fadf05d40b0e562b46fb
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址 :param request: :param address_id: :return:""" <|body_0|> def delete(self, request, address_id): """删除地址 :param request: :param address_id: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址 :param request: :param address_id: :return:""" json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id ...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/views.py
qls7/dianshang
train
0
579330adbc74a9ae39a99d9346dca9e5053f66d9
[ "x = torch.randn(4, 2).cuda()\nn_components = np.random.randint(1, 100)\nmodel = GaussianMixture(n_components, x.size(1)).cuda()\nmodel.fit(x)\ny = model.predict(x)\nself.assertEqual(torch.Tensor(x.size(0)).size(), y.size())", "x = torch.randn(4, 2)\nn_components = np.random.randint(1, 100)\nmodel = GaussianMixtu...
<|body_start_0|> x = torch.randn(4, 2).cuda() n_components = np.random.randint(1, 100) model = GaussianMixture(n_components, x.size(1)).cuda() model.fit(x) y = model.predict(x) self.assertEqual(torch.Tensor(x.size(0)).size(), y.size()) <|end_body_0|> <|body_start_1|> ...
Basic tests for GPU models.
GpuCheck
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GpuCheck: """Basic tests for GPU models.""" def testPredictClasses(self): """Assert that torch.cuda.FloatTensor is handled correctly.""" <|body_0|> def testPredictProbabilities(self): """Assert that torch.cuda.FloatTensor is handled correctly when returning class...
stack_v2_sparse_classes_36k_train_011055
2,202
permissive
[ { "docstring": "Assert that torch.cuda.FloatTensor is handled correctly.", "name": "testPredictClasses", "signature": "def testPredictClasses(self)" }, { "docstring": "Assert that torch.cuda.FloatTensor is handled correctly when returning class probabilities.", "name": "testPredictProbabilit...
2
stack_v2_sparse_classes_30k_train_000327
Implement the Python class `GpuCheck` described below. Class description: Basic tests for GPU models. Method signatures and docstrings: - def testPredictClasses(self): Assert that torch.cuda.FloatTensor is handled correctly. - def testPredictProbabilities(self): Assert that torch.cuda.FloatTensor is handled correctly...
Implement the Python class `GpuCheck` described below. Class description: Basic tests for GPU models. Method signatures and docstrings: - def testPredictClasses(self): Assert that torch.cuda.FloatTensor is handled correctly. - def testPredictProbabilities(self): Assert that torch.cuda.FloatTensor is handled correctly...
df1c26047574fbe0a7b103ebc26687bc04739229
<|skeleton|> class GpuCheck: """Basic tests for GPU models.""" def testPredictClasses(self): """Assert that torch.cuda.FloatTensor is handled correctly.""" <|body_0|> def testPredictProbabilities(self): """Assert that torch.cuda.FloatTensor is handled correctly when returning class...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GpuCheck: """Basic tests for GPU models.""" def testPredictClasses(self): """Assert that torch.cuda.FloatTensor is handled correctly.""" x = torch.randn(4, 2).cuda() n_components = np.random.randint(1, 100) model = GaussianMixture(n_components, x.size(1)).cuda() mo...
the_stack_v2_python_sparse
util/gmm_torch/test.py
Vichoko/aidio
train
2
5a0120925072d98797090bfecd93309a27a6f9f6
[ "if kind not in ['start_date', 'end_date']:\n raise ValueError\nif dateval:\n setattr(self, 'partial_%s' % kind, dateval)\n if getattr(self, kind).year < 1919:\n setattr(self, '%s_precision' % kind, DatePrecision.month | DatePrecision.day)\nelif earliest and latest:\n setattr(self, kind, earliest...
<|body_start_0|> if kind not in ['start_date', 'end_date']: raise ValueError if dateval: setattr(self, 'partial_%s' % kind, dateval) if getattr(self, kind).year < 1919: setattr(self, '%s_precision' % kind, DatePrecision.month | DatePrecision.day) ...
Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`.
PartialDateMixin
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartialDateMixin: """Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`.""" def calculate_date(self, kind, dateval=None, earliest=None, latest=None): """Calculate end or start date based on a single value in a sup...
stack_v2_sparse_classes_36k_train_011056
10,637
permissive
[ { "docstring": "Calculate end or start date based on a single value in a supported partial date form or based on earliest/latest datetime.", "name": "calculate_date", "signature": "def calculate_date(self, kind, dateval=None, earliest=None, latest=None)" }, { "docstring": "Borrowing event date r...
2
null
Implement the Python class `PartialDateMixin` described below. Class description: Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`. Method signatures and docstrings: - def calculate_date(self, kind, dateval=None, earliest=None, latest=None): Cal...
Implement the Python class `PartialDateMixin` described below. Class description: Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`. Method signatures and docstrings: - def calculate_date(self, kind, dateval=None, earliest=None, latest=None): Cal...
6103855f07c2c0123ab21b93b794ea5d5ca39aa2
<|skeleton|> class PartialDateMixin: """Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`.""" def calculate_date(self, kind, dateval=None, earliest=None, latest=None): """Calculate end or start date based on a single value in a sup...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PartialDateMixin: """Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`.""" def calculate_date(self, kind, dateval=None, earliest=None, latest=None): """Calculate end or start date based on a single value in a supported partia...
the_stack_v2_python_sparse
mep/accounts/partial_date.py
Princeton-CDH/mep-django
train
6
5c42b26202cc93896b70e3b7f21d308f4c2c9776
[ "super(CgsEnableSnmpFlow, self).__init__(cli_handler=cli_handler, logger=logger)\nself._resource_config = resource_config\nself._api = api", "with self._cli_handler.get_cli_service(self._cli_handler.snmp_config_mode) as cli_service:\n if isinstance(snmp_parameters, SNMPV3Parameters):\n enable_snmp = sel...
<|body_start_0|> super(CgsEnableSnmpFlow, self).__init__(cli_handler=cli_handler, logger=logger) self._resource_config = resource_config self._api = api <|end_body_0|> <|body_start_1|> with self._cli_handler.get_cli_service(self._cli_handler.snmp_config_mode) as cli_service: ...
CgsEnableSnmpFlow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CgsEnableSnmpFlow: def __init__(self, cli_handler, resource_config, api, logger): """Init command. :param cli_handler: :param resource_config: :param api: :param logger:""" <|body_0|> def execute_flow(self, snmp_parameters): """Execute enable SNMP flow. :param clouds...
stack_v2_sparse_classes_36k_train_011057
4,322
no_license
[ { "docstring": "Init command. :param cli_handler: :param resource_config: :param api: :param logger:", "name": "__init__", "signature": "def __init__(self, cli_handler, resource_config, api, logger)" }, { "docstring": "Execute enable SNMP flow. :param cloudshell.snmp.snmp_parameters.SNMPParamete...
4
stack_v2_sparse_classes_30k_val_001005
Implement the Python class `CgsEnableSnmpFlow` described below. Class description: Implement the CgsEnableSnmpFlow class. Method signatures and docstrings: - def __init__(self, cli_handler, resource_config, api, logger): Init command. :param cli_handler: :param resource_config: :param api: :param logger: - def execut...
Implement the Python class `CgsEnableSnmpFlow` described below. Class description: Implement the CgsEnableSnmpFlow class. Method signatures and docstrings: - def __init__(self, cli_handler, resource_config, api, logger): Init command. :param cli_handler: :param resource_config: :param api: :param logger: - def execut...
6cfa9d810782785af373e6dc3d4cd4ec44832bd1
<|skeleton|> class CgsEnableSnmpFlow: def __init__(self, cli_handler, resource_config, api, logger): """Init command. :param cli_handler: :param resource_config: :param api: :param logger:""" <|body_0|> def execute_flow(self, snmp_parameters): """Execute enable SNMP flow. :param clouds...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CgsEnableSnmpFlow: def __init__(self, cli_handler, resource_config, api, logger): """Init command. :param cli_handler: :param resource_config: :param api: :param logger:""" super(CgsEnableSnmpFlow, self).__init__(cli_handler=cli_handler, logger=logger) self._resource_config = resource_...
the_stack_v2_python_sparse
cloudshell/cgs/flows/enable_snmp.py
QualiSystems/cloudshell-cgs
train
0
da2db0a41ba5f82c7f9d44260e4d98460931cf9a
[ "if cell.ctype == 0:\n return True\nif str(cell.value).strip() == '':\n return True\nreturn False", "if cell.value.__class__.__name__ == 'unicode':\n return str(cell.value).encode().strip()\nreturn str(cell.value).strip()" ]
<|body_start_0|> if cell.ctype == 0: return True if str(cell.value).strip() == '': return True return False <|end_body_0|> <|body_start_1|> if cell.value.__class__.__name__ == 'unicode': return str(cell.value).encode().strip() return str(cell....
Excel class to handle excel values
Excel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Excel: """Excel class to handle excel values""" def empty_cell(cell): """Test if excel cell is empty or contains only whitespace.""" <|body_0|> def cell_value(cell): """Return string value of an excel spreadsheet cell.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_011058
685
permissive
[ { "docstring": "Test if excel cell is empty or contains only whitespace.", "name": "empty_cell", "signature": "def empty_cell(cell)" }, { "docstring": "Return string value of an excel spreadsheet cell.", "name": "cell_value", "signature": "def cell_value(cell)" } ]
2
stack_v2_sparse_classes_30k_train_013960
Implement the Python class `Excel` described below. Class description: Excel class to handle excel values Method signatures and docstrings: - def empty_cell(cell): Test if excel cell is empty or contains only whitespace. - def cell_value(cell): Return string value of an excel spreadsheet cell.
Implement the Python class `Excel` described below. Class description: Excel class to handle excel values Method signatures and docstrings: - def empty_cell(cell): Test if excel cell is empty or contains only whitespace. - def cell_value(cell): Return string value of an excel spreadsheet cell. <|skeleton|> class Exc...
37982577eca010a03dd5b5e23fe30be8f42da9ed
<|skeleton|> class Excel: """Excel class to handle excel values""" def empty_cell(cell): """Test if excel cell is empty or contains only whitespace.""" <|body_0|> def cell_value(cell): """Return string value of an excel spreadsheet cell.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Excel: """Excel class to handle excel values""" def empty_cell(cell): """Test if excel cell is empty or contains only whitespace.""" if cell.ctype == 0: return True if str(cell.value).strip() == '': return True return False def cell_value(cell)...
the_stack_v2_python_sparse
retriever/lib/excel.py
weecology/retriever
train
289
55be4dc1305e179f58f2b922856dc60d6edb2fd6
[ "action = self.get_argument('action', '')\nif action != '' and action == 'config':\n with open(os.getcwd() + '\\\\handler\\\\ueconfig.json') as json_file:\n data = json.load(json_file)\n self.write(data)\nelif action != '' and action == 'listimage':\n pass\nelse:\n '\\n 文件下载\\n ...
<|body_start_0|> action = self.get_argument('action', '') if action != '' and action == 'config': with open(os.getcwd() + '\\handler\\ueconfig.json') as json_file: data = json.load(json_file) self.write(data) elif action != '' and action == 'listimage'...
FileHandler2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileHandler2: def get(self): """action=config表示获取ueditor的配置信息,在ueditor初始化时,自动请求""" <|body_0|> def post(self): """文件上传""" <|body_1|> <|end_skeleton|> <|body_start_0|> action = self.get_argument('action', '') if action != '' and action == 'con...
stack_v2_sparse_classes_36k_train_011059
3,427
no_license
[ { "docstring": "action=config表示获取ueditor的配置信息,在ueditor初始化时,自动请求", "name": "get", "signature": "def get(self)" }, { "docstring": "文件上传", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003197
Implement the Python class `FileHandler2` described below. Class description: Implement the FileHandler2 class. Method signatures and docstrings: - def get(self): action=config表示获取ueditor的配置信息,在ueditor初始化时,自动请求 - def post(self): 文件上传
Implement the Python class `FileHandler2` described below. Class description: Implement the FileHandler2 class. Method signatures and docstrings: - def get(self): action=config表示获取ueditor的配置信息,在ueditor初始化时,自动请求 - def post(self): 文件上传 <|skeleton|> class FileHandler2: def get(self): """action=config表示获取ue...
9583166ca62149714a041202a22b27329b94835e
<|skeleton|> class FileHandler2: def get(self): """action=config表示获取ueditor的配置信息,在ueditor初始化时,自动请求""" <|body_0|> def post(self): """文件上传""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileHandler2: def get(self): """action=config表示获取ueditor的配置信息,在ueditor初始化时,自动请求""" action = self.get_argument('action', '') if action != '' and action == 'config': with open(os.getcwd() + '\\handler\\ueconfig.json') as json_file: data = json.load(json_file) ...
the_stack_v2_python_sparse
web/handler/FileHandler2.py
bks1000/zsk
train
0
dd3f7342507b2f503c25a740422e22d8a8d573f9
[ "n, m = (len(robot), len(factory))\nSTRAT, END = (n + m, n + m + 1)\nmcmf = MinCostMaxFlowDinic(n + m + 2, STRAT, END)\nfor i in range(n):\n mcmf.addEdge(STRAT, i, 1, 0)\nfor i in range(n):\n for j in range(m):\n mcmf.addEdge(i, n + j, 1, abs(robot[i] - factory[j][0]))\nfor i in range(m):\n mcmf.add...
<|body_start_0|> n, m = (len(robot), len(factory)) STRAT, END = (n + m, n + m + 1) mcmf = MinCostMaxFlowDinic(n + m + 2, STRAT, END) for i in range(n): mcmf.addEdge(STRAT, i, 1, 0) for i in range(n): for j in range(m): mcmf.addEdge(i, n + j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotalDistance(self, robot: List[int], factory: List[List[int]]) -> int: """最小费用最大流 两两暴力连边 Args: robot (List[int]): 机器人的位置 factory (List[List[int]]): 每个工厂的(位置,可以修理的机器人个数) Returns: int: _description_ 请你返回所有机器人移动的最小总距离。测试数据保证所有机器人都可以被维修。""" <|body_0|> def m...
stack_v2_sparse_classes_36k_train_011060
2,433
no_license
[ { "docstring": "最小费用最大流 两两暴力连边 Args: robot (List[int]): 机器人的位置 factory (List[List[int]]): 每个工厂的(位置,可以修理的机器人个数) Returns: int: _description_ 请你返回所有机器人移动的最小总距离。测试数据保证所有机器人都可以被维修。", "name": "minimumTotalDistance", "signature": "def minimumTotalDistance(self, robot: List[int], factory: List[List[int]]) -> in...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotalDistance(self, robot: List[int], factory: List[List[int]]) -> int: 最小费用最大流 两两暴力连边 Args: robot (List[int]): 机器人的位置 factory (List[List[int]]): 每个工厂的(位置,可以修理的机器人个数) ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotalDistance(self, robot: List[int], factory: List[List[int]]) -> int: 最小费用最大流 两两暴力连边 Args: robot (List[int]): 机器人的位置 factory (List[List[int]]): 每个工厂的(位置,可以修理的机器人个数) ...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minimumTotalDistance(self, robot: List[int], factory: List[List[int]]) -> int: """最小费用最大流 两两暴力连边 Args: robot (List[int]): 机器人的位置 factory (List[List[int]]): 每个工厂的(位置,可以修理的机器人个数) Returns: int: _description_ 请你返回所有机器人移动的最小总距离。测试数据保证所有机器人都可以被维修。""" <|body_0|> def m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotalDistance(self, robot: List[int], factory: List[List[int]]) -> int: """最小费用最大流 两两暴力连边 Args: robot (List[int]): 机器人的位置 factory (List[List[int]]): 每个工厂的(位置,可以修理的机器人个数) Returns: int: _description_ 请你返回所有机器人移动的最小总距离。测试数据保证所有机器人都可以被维修。""" n, m = (len(robot), len(factory)) ...
the_stack_v2_python_sparse
7_graph/网络流/4-费用流/6232. 最小移动总距离.py
981377660LMT/algorithm-study
train
225
dc92843aa5e5d967194dd284517e082eb1df4776
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Onenote()", "from .entity import Entity\nfrom .notebook import Notebook\nfrom .onenote_operation import OnenoteOperation\nfrom .onenote_page import OnenotePage\nfrom .onenote_resource import OnenoteResource\nfrom .onenote_section impor...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Onenote() <|end_body_0|> <|body_start_1|> from .entity import Entity from .notebook import Notebook from .onenote_operation import OnenoteOperation from .onenote_page imp...
Onenote
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote"""...
stack_v2_sparse_classes_36k_train_011061
4,865
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse...
3
stack_v2_sparse_classes_30k_train_010959
Implement the Python class `Onenote` described below. Class description: Implement the Onenote class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
Implement the Python class `Onenote` described below. Class description: Implement the Onenote class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Onenote""" if no...
the_stack_v2_python_sparse
msgraph/generated/models/onenote.py
microsoftgraph/msgraph-sdk-python
train
135
1f7f691e1f99e66cd931d86f44b09088c40b6866
[ "context = context or {}\nwol_obj = self.pool.get('mrp.workorder.lot')\nres = False\nactive_id = context.get('active_id', False)\nactive_model = context.get('active_model', False)\nif active_id:\n if active_model == 'mrp.production':\n res = active_id\n elif active_model == 'mrp.workorder.lot':\n ...
<|body_start_0|> context = context or {} wol_obj = self.pool.get('mrp.workorder.lot') res = False active_id = context.get('active_id', False) active_model = context.get('active_model', False) if active_id: if active_model == 'mrp.production': r...
MrpProduce
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MrpProduce: def _get_default_mo_id(self, cr, uid, context=None): """Return the production id.""" <|body_0|> def _get_default_wo_lot(self, cr, uid, context=None): """@return: The first Work Order Lot ready to Produce (cardinal order).""" <|body_1|> def ac...
stack_v2_sparse_classes_36k_train_011062
14,637
no_license
[ { "docstring": "Return the production id.", "name": "_get_default_mo_id", "signature": "def _get_default_mo_id(self, cr, uid, context=None)" }, { "docstring": "@return: The first Work Order Lot ready to Produce (cardinal order).", "name": "_get_default_wo_lot", "signature": "def _get_def...
5
stack_v2_sparse_classes_30k_train_000194
Implement the Python class `MrpProduce` described below. Class description: Implement the MrpProduce class. Method signatures and docstrings: - def _get_default_mo_id(self, cr, uid, context=None): Return the production id. - def _get_default_wo_lot(self, cr, uid, context=None): @return: The first Work Order Lot ready...
Implement the Python class `MrpProduce` described below. Class description: Implement the MrpProduce class. Method signatures and docstrings: - def _get_default_mo_id(self, cr, uid, context=None): Return the production id. - def _get_default_wo_lot(self, cr, uid, context=None): @return: The first Work Order Lot ready...
9c588e45011a87ec8d9af73535c4c56485be92f7
<|skeleton|> class MrpProduce: def _get_default_mo_id(self, cr, uid, context=None): """Return the production id.""" <|body_0|> def _get_default_wo_lot(self, cr, uid, context=None): """@return: The first Work Order Lot ready to Produce (cardinal order).""" <|body_1|> def ac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MrpProduce: def _get_default_mo_id(self, cr, uid, context=None): """Return the production id.""" context = context or {} wol_obj = self.pool.get('mrp.workorder.lot') res = False active_id = context.get('active_id', False) active_model = context.get('active_model...
the_stack_v2_python_sparse
addons-vauxoo/mrp_workorder_lot/wizard/mrp_consume_produce.py
OpenBusinessSolutions/odoo-fondeur-server
train
1
0b6c83bd73f0ea5942450508290518a28f840dfa
[ "def dfs(root):\n if not root:\n return (0, None)\n l, r = (dfs(root.left), dfs(root.right))\n return (max(l[0], r[0]) + 1, root if l[0] == r[0] else l[1] if l[0] > r[0] else r[1])\nreturn dfs(root)[1]", "if not root:\n return root\npar = {}\nq = [root]\nwhile True:\n new_q = []\n for v i...
<|body_start_0|> def dfs(root): if not root: return (0, None) l, r = (dfs(root.left), dfs(root.right)) return (max(l[0], r[0]) + 1, root if l[0] == r[0] else l[1] if l[0] > r[0] else r[1]) return dfs(root)[1] <|end_body_0|> <|body_start_1|> if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subtreeWithAllDeepest(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def subtreeWithAllDeepest_no_dfs(self, root): """no_dfs的方法就是两次扫描,找到第一个节点""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(root): ...
stack_v2_sparse_classes_36k_train_011063
2,464
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "subtreeWithAllDeepest", "signature": "def subtreeWithAllDeepest(self, root)" }, { "docstring": "no_dfs的方法就是两次扫描,找到第一个节点", "name": "subtreeWithAllDeepest_no_dfs", "signature": "def subtreeWithAllDeepest_no_dfs(self, root)" ...
2
stack_v2_sparse_classes_30k_train_007613
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subtreeWithAllDeepest(self, root): :type root: TreeNode :rtype: TreeNode - def subtreeWithAllDeepest_no_dfs(self, root): no_dfs的方法就是两次扫描,找到第一个节点
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subtreeWithAllDeepest(self, root): :type root: TreeNode :rtype: TreeNode - def subtreeWithAllDeepest_no_dfs(self, root): no_dfs的方法就是两次扫描,找到第一个节点 <|skeleton|> class Solution:...
6c640581a642fc1a1c43e4b9f9f397b4d67bb67b
<|skeleton|> class Solution: def subtreeWithAllDeepest(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def subtreeWithAllDeepest_no_dfs(self, root): """no_dfs的方法就是两次扫描,找到第一个节点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subtreeWithAllDeepest(self, root): """:type root: TreeNode :rtype: TreeNode""" def dfs(root): if not root: return (0, None) l, r = (dfs(root.left), dfs(root.right)) return (max(l[0], r[0]) + 1, root if l[0] == r[0] else l[1] if ...
the_stack_v2_python_sparse
python/866-smallest-subtree-with-all-the-deepest-nodes.py
whiledoing/leetcode
train
0
4a0ccf5af6990eb2bbe0bb11681f56eba11b8942
[ "from slacker import Slacker\nself._default_channel = default_channel\nself._api_token = api_token\nself._username = username\nself._icon = icon\nif self._username or self._icon:\n self._as_user = False\nelse:\n self._as_user = True\nself.slack = Slacker(self._api_token)\nself.slack.auth.test()", "import sl...
<|body_start_0|> from slacker import Slacker self._default_channel = default_channel self._api_token = api_token self._username = username self._icon = icon if self._username or self._icon: self._as_user = False else: self._as_user = True ...
Implement the notification service for Slack.
SlackNotificationService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlackNotificationService: """Implement the notification service for Slack.""" def __init__(self, default_channel, api_token, username, icon): """Initialize the service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to a user.""" ...
stack_v2_sparse_classes_36k_train_011064
2,744
permissive
[ { "docstring": "Initialize the service.", "name": "__init__", "signature": "def __init__(self, default_channel, api_token, username, icon)" }, { "docstring": "Send a message to a user.", "name": "send_message", "signature": "def send_message(self, message='', **kwargs)" } ]
2
null
Implement the Python class `SlackNotificationService` described below. Class description: Implement the notification service for Slack. Method signatures and docstrings: - def __init__(self, default_channel, api_token, username, icon): Initialize the service. - def send_message(self, message='', **kwargs): Send a mes...
Implement the Python class `SlackNotificationService` described below. Class description: Implement the notification service for Slack. Method signatures and docstrings: - def __init__(self, default_channel, api_token, username, icon): Initialize the service. - def send_message(self, message='', **kwargs): Send a mes...
ca0e92aba83de2fd6cb1cc4d14f3b4471f17cf3d
<|skeleton|> class SlackNotificationService: """Implement the notification service for Slack.""" def __init__(self, default_channel, api_token, username, icon): """Initialize the service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to a user.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SlackNotificationService: """Implement the notification service for Slack.""" def __init__(self, default_channel, api_token, username, icon): """Initialize the service.""" from slacker import Slacker self._default_channel = default_channel self._api_token = api_token ...
the_stack_v2_python_sparse
homeassistant/components/notify/slack.py
Smart-Torvy/torvy-home-assistant
train
2
5b6891a04a25cdb17e7c9f3359028593d199013e
[ "self.label = label\nself.type = type\nself.inputs = inputs\nself.value = None", "out = '[{}] - {}: '.format(self.label, self.type)\nout += str(self.inputs)\nreturn out", "if self.value is None:\n inputs = []\n for i in self.inputs:\n if isinstance(i, int):\n inputs.append(i)\n el...
<|body_start_0|> self.label = label self.type = type self.inputs = inputs self.value = None <|end_body_0|> <|body_start_1|> out = '[{}] - {}: '.format(self.label, self.type) out += str(self.inputs) return out <|end_body_1|> <|body_start_2|> if self.value...
Util class to represent a piece in the circuit. It is define by its label and type, and has a list of inputs that can either be the label of another piece in the circuit or a direct integer input.
CircuitPiece
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircuitPiece: """Util class to represent a piece in the circuit. It is define by its label and type, and has a list of inputs that can either be the label of another piece in the circuit or a direct integer input.""" def __init__(self, label, type, inputs): """Initialization function...
stack_v2_sparse_classes_36k_train_011065
5,382
no_license
[ { "docstring": "Initialization function to create a new CircuitPiece. :param label: Label of the piece. :type label: str :param type: Type of piece: if None, then the piece assumes direct inputs; else it can have one or two inputs. :type type: None or str :param inputs: Inputs of the piece. :type inputs: list(s...
3
null
Implement the Python class `CircuitPiece` described below. Class description: Util class to represent a piece in the circuit. It is define by its label and type, and has a list of inputs that can either be the label of another piece in the circuit or a direct integer input. Method signatures and docstrings: - def __i...
Implement the Python class `CircuitPiece` described below. Class description: Util class to represent a piece in the circuit. It is define by its label and type, and has a list of inputs that can either be the label of another piece in the circuit or a direct integer input. Method signatures and docstrings: - def __i...
87011a22d5f1ebd1e7064c043678c3cdb02414e8
<|skeleton|> class CircuitPiece: """Util class to represent a piece in the circuit. It is define by its label and type, and has a list of inputs that can either be the label of another piece in the circuit or a direct integer input.""" def __init__(self, label, type, inputs): """Initialization function...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CircuitPiece: """Util class to represent a piece in the circuit. It is define by its label and type, and has a list of inputs that can either be the label of another piece in the circuit or a direct integer input.""" def __init__(self, label, type, inputs): """Initialization function to create a ...
the_stack_v2_python_sparse
2015/Python/day7.py
MinaPecheux/Advent-Of-Code
train
0
3ac7ff60666c3ac3478b1f1ab24da1f07554c38f
[ "if args['only_dermographic']:\n patient_schema = PatientSchema(many=False, exclude=PatientModel.relationship_keys)\nelse:\n patient_schema = PatientSchema(many=False)\npatient = PatientModel.query.filter_by(id=args['patient_uuid']).first()\nreturn (patient_schema.dump(patient), 200)", "patient_schema = Pat...
<|body_start_0|> if args['only_dermographic']: patient_schema = PatientSchema(many=False, exclude=PatientModel.relationship_keys) else: patient_schema = PatientSchema(many=False) patient = PatientModel.query.filter_by(id=args['patient_uuid']).first() return (patie...
PatientResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatientResource: def get(self, args, **kwargs): """Get patient with the UUID""" <|body_0|> def patch(self, patient_uuid): """Modify patient with the UUID""" <|body_1|> def delete(self, patient_uuid): """Delete patient with the UUID""" <|b...
stack_v2_sparse_classes_36k_train_011066
5,115
no_license
[ { "docstring": "Get patient with the UUID", "name": "get", "signature": "def get(self, args, **kwargs)" }, { "docstring": "Modify patient with the UUID", "name": "patch", "signature": "def patch(self, patient_uuid)" }, { "docstring": "Delete patient with the UUID", "name": "d...
3
stack_v2_sparse_classes_30k_train_008267
Implement the Python class `PatientResource` described below. Class description: Implement the PatientResource class. Method signatures and docstrings: - def get(self, args, **kwargs): Get patient with the UUID - def patch(self, patient_uuid): Modify patient with the UUID - def delete(self, patient_uuid): Delete pati...
Implement the Python class `PatientResource` described below. Class description: Implement the PatientResource class. Method signatures and docstrings: - def get(self, args, **kwargs): Get patient with the UUID - def patch(self, patient_uuid): Modify patient with the UUID - def delete(self, patient_uuid): Delete pati...
49fe5e4740736b2d4b34489065e29bc06cb1c0d2
<|skeleton|> class PatientResource: def get(self, args, **kwargs): """Get patient with the UUID""" <|body_0|> def patch(self, patient_uuid): """Modify patient with the UUID""" <|body_1|> def delete(self, patient_uuid): """Delete patient with the UUID""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatientResource: def get(self, args, **kwargs): """Get patient with the UUID""" if args['only_dermographic']: patient_schema = PatientSchema(many=False, exclude=PatientModel.relationship_keys) else: patient_schema = PatientSchema(many=False) patient = Pa...
the_stack_v2_python_sparse
hivclinic/namespaces/patient/patient_resource.py
LedoKun/28hiv_clinic_backend
train
0
e4b651f43248e4f93a0030cde5b57987452a616b
[ "command_store = CommandStore()\nlabware_store = LabwareStore(deck_fixed_labware=deck_fixed_labware)\npipette_store = PipetteStore()\ngeometry_store = GeometryStore(deck_definition=deck_definition, labware_store=labware_store)\nmotion_store = MotionStore(labware_store=labware_store, pipette_store=pipette_store, geo...
<|body_start_0|> command_store = CommandStore() labware_store = LabwareStore(deck_fixed_labware=deck_fixed_labware) pipette_store = PipetteStore() geometry_store = GeometryStore(deck_definition=deck_definition, labware_store=labware_store) motion_store = MotionStore(labware_store...
ProtocolEngine state store. A StateStore manages several substores, which will modify themselves in reaction to commands and other protocol events. Only Store classes should be allowed to modify State classes.
StateStore
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateStore: """ProtocolEngine state store. A StateStore manages several substores, which will modify themselves in reaction to commands and other protocol events. Only Store classes should be allowed to modify State classes.""" def __init__(self, deck_definition: DeckDefinitionV2, deck_fixed...
stack_v2_sparse_classes_36k_train_011067
4,142
permissive
[ { "docstring": "Initialize a StateStore.", "name": "__init__", "signature": "def __init__(self, deck_definition: DeckDefinitionV2, deck_fixed_labware: Sequence[DeckFixedLabware]) -> None" }, { "docstring": "Modify State in reaction to a Command.", "name": "handle_command", "signature": "...
2
stack_v2_sparse_classes_30k_train_013838
Implement the Python class `StateStore` described below. Class description: ProtocolEngine state store. A StateStore manages several substores, which will modify themselves in reaction to commands and other protocol events. Only Store classes should be allowed to modify State classes. Method signatures and docstrings...
Implement the Python class `StateStore` described below. Class description: ProtocolEngine state store. A StateStore manages several substores, which will modify themselves in reaction to commands and other protocol events. Only Store classes should be allowed to modify State classes. Method signatures and docstrings...
a255b76c8a07457787d575da12b2d5bdb6220a91
<|skeleton|> class StateStore: """ProtocolEngine state store. A StateStore manages several substores, which will modify themselves in reaction to commands and other protocol events. Only Store classes should be allowed to modify State classes.""" def __init__(self, deck_definition: DeckDefinitionV2, deck_fixed...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateStore: """ProtocolEngine state store. A StateStore manages several substores, which will modify themselves in reaction to commands and other protocol events. Only Store classes should be allowed to modify State classes.""" def __init__(self, deck_definition: DeckDefinitionV2, deck_fixed_labware: Seq...
the_stack_v2_python_sparse
api/src/opentrons/protocol_engine/state/state_store.py
Corey-ONeal/opentrons-app_ws-remote
train
0
e0adebad64b655dbb5e2c6cebbc8b311010540da
[ "if 'default' in kwargs:\n if version is not None:\n kwargs['default'] = version\n super().__init__(title=title, advanced=advanced, **kwargs)\nelse:\n super().__init__(title=title, advanced=advanced, default=version, **kwargs)", "if not is_version_valid(value):\n raise InvalidVersionFormat('Ver...
<|body_start_0|> if 'default' in kwargs: if version is not None: kwargs['default'] = version super().__init__(title=title, advanced=advanced, **kwargs) else: super().__init__(title=title, advanced=advanced, default=version, **kwargs) <|end_body_0|> <|...
Defines a Version property. Version property permits saving version information with (major.minor.build) format
VersionProperty
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionProperty: """Defines a Version property. Version property permits saving version information with (major.minor.build) format""" def __init__(self, version=None, title='Version', advanced=True, **kwargs): """Initializes a version property. Keyword Args: Property definitions""" ...
stack_v2_sparse_classes_36k_train_011068
1,220
no_license
[ { "docstring": "Initializes a version property. Keyword Args: Property definitions", "name": "__init__", "signature": "def __init__(self, version=None, title='Version', advanced=True, **kwargs)" }, { "docstring": "Override default set to make sure it's a valid version", "name": "__set__", ...
2
stack_v2_sparse_classes_30k_train_010764
Implement the Python class `VersionProperty` described below. Class description: Defines a Version property. Version property permits saving version information with (major.minor.build) format Method signatures and docstrings: - def __init__(self, version=None, title='Version', advanced=True, **kwargs): Initializes a...
Implement the Python class `VersionProperty` described below. Class description: Defines a Version property. Version property permits saving version information with (major.minor.build) format Method signatures and docstrings: - def __init__(self, version=None, title='Version', advanced=True, **kwargs): Initializes a...
e2ef4c7b56c4e7e06964fe6f64ae6c497ac31727
<|skeleton|> class VersionProperty: """Defines a Version property. Version property permits saving version information with (major.minor.build) format""" def __init__(self, version=None, title='Version', advanced=True, **kwargs): """Initializes a version property. Keyword Args: Property definitions""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VersionProperty: """Defines a Version property. Version property permits saving version information with (major.minor.build) format""" def __init__(self, version=None, title='Version', advanced=True, **kwargs): """Initializes a version property. Keyword Args: Property definitions""" if 'd...
the_stack_v2_python_sparse
nio/properties/version.py
niolabs/nio
train
5
fefa8ab3720fe963ea527224acff4fcf5abc7685
[ "if repo is None:\n raise exceptions.NonFatalError('No GitHub repository URL provided')\nwith requests.Session() as session:\n full_url = ROOT_URL + 'repos/' + repo + '/releases'\n resp = session.get(full_url)\n if resp.status_code == 404:\n raise GitHubRepositoryNotFoundException('Repository not...
<|body_start_0|> if repo is None: raise exceptions.NonFatalError('No GitHub repository URL provided') with requests.Session() as session: full_url = ROOT_URL + 'repos/' + repo + '/releases' resp = session.get(full_url) if resp.status_code == 404: ...
Keywords to utilize GitHub API
GitHubKeywords
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitHubKeywords: """Keywords to utilize GitHub API""" def get_releases(repo=None): """Retrieve the release names for a specific repository. :param repo: a project/repository partial URL (Example: OneView-TestTools/tru) :return: list of versions Examples: | =Keyword= | =GitHub Project/...
stack_v2_sparse_classes_36k_train_011069
6,305
no_license
[ { "docstring": "Retrieve the release names for a specific repository. :param repo: a project/repository partial URL (Example: OneView-TestTools/tru) :return: list of versions Examples: | =Keyword= | =GitHub Project/Repo= | | Get GitHub Releases | OneView-TestTools/tru |", "name": "get_releases", "signat...
2
null
Implement the Python class `GitHubKeywords` described below. Class description: Keywords to utilize GitHub API Method signatures and docstrings: - def get_releases(repo=None): Retrieve the release names for a specific repository. :param repo: a project/repository partial URL (Example: OneView-TestTools/tru) :return: ...
Implement the Python class `GitHubKeywords` described below. Class description: Keywords to utilize GitHub API Method signatures and docstrings: - def get_releases(repo=None): Retrieve the release names for a specific repository. :param repo: a project/repository partial URL (Example: OneView-TestTools/tru) :return: ...
24a74926170cbdfafa47e972644e2fe5b627d8ff
<|skeleton|> class GitHubKeywords: """Keywords to utilize GitHub API""" def get_releases(repo=None): """Retrieve the release names for a specific repository. :param repo: a project/repository partial URL (Example: OneView-TestTools/tru) :return: list of versions Examples: | =Keyword= | =GitHub Project/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GitHubKeywords: """Keywords to utilize GitHub API""" def get_releases(repo=None): """Retrieve the release names for a specific repository. :param repo: a project/repository partial URL (Example: OneView-TestTools/tru) :return: list of versions Examples: | =Keyword= | =GitHub Project/Repo= | | Get...
the_stack_v2_python_sparse
robo4.2/4.2/lib/python2.7/site-packages/RoboGalaxyLibrary/keywords/github.py
richa92/Jenkin_Regression_Testing
train
0
e7e68e59a2fd1da1a7e0f55a1b58b29b745e3c80
[ "latitude = self.get_argument('lat')\nlongitude = self.get_argument('lng')\nradius = self.get_argument('radius', 25000)\nlength = self.get_argument('total', 50)\nmodel = self.settings['model']\nresponse = {}\nif query == 'positive':\n response = (yield model.get_heatmap(latitude, longitude, radius, query, length...
<|body_start_0|> latitude = self.get_argument('lat') longitude = self.get_argument('lng') radius = self.get_argument('radius', 25000) length = self.get_argument('total', 50) model = self.settings['model'] response = {} if query == 'positive': response ...
Heatmap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Heatmap: def get(self, query): """Get function for the query to the server @lat: number with the latitude of the position of the person. @lng: number with the longitude of the position of the person. @radius: radius of the heatmap to be send back""" <|body_0|> def post(self,...
stack_v2_sparse_classes_36k_train_011070
2,591
no_license
[ { "docstring": "Get function for the query to the server @lat: number with the latitude of the position of the person. @lng: number with the longitude of the position of the person. @radius: radius of the heatmap to be send back", "name": "get", "signature": "def get(self, query)" }, { "docstrin...
2
stack_v2_sparse_classes_30k_test_000498
Implement the Python class `Heatmap` described below. Class description: Implement the Heatmap class. Method signatures and docstrings: - def get(self, query): Get function for the query to the server @lat: number with the latitude of the position of the person. @lng: number with the longitude of the position of the ...
Implement the Python class `Heatmap` described below. Class description: Implement the Heatmap class. Method signatures and docstrings: - def get(self, query): Get function for the query to the server @lat: number with the latitude of the position of the person. @lng: number with the longitude of the position of the ...
07aaa43858ab2009bc173d16805aa987511deb06
<|skeleton|> class Heatmap: def get(self, query): """Get function for the query to the server @lat: number with the latitude of the position of the person. @lng: number with the longitude of the position of the person. @radius: radius of the heatmap to be send back""" <|body_0|> def post(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Heatmap: def get(self, query): """Get function for the query to the server @lat: number with the latitude of the position of the person. @lng: number with the longitude of the position of the person. @radius: radius of the heatmap to be send back""" latitude = self.get_argument('lat') ...
the_stack_v2_python_sparse
Backend/handler/heatmap.py
stoutch/Lantern
train
0
973415825e49ea6743413cdfa55faa94ca472001
[ "BaseController.__init__(self, veh_id, car_following_params, delay=1.0)\nself.max_accel = car_following_params.controller_params['accel']\nself.v_history = []\nself.gamma = 2\nself.g_l = 7\nself.g_u = 30\nself.v_catch = 1\nself.alpha = 0\nself.beta = 1 - 0.5 * self.alpha\nself.U = 0\nself.v_target = 0\nself.v_cmd =...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=1.0) self.max_accel = car_following_params.controller_params['accel'] self.v_history = [] self.gamma = 2 self.g_l = 7 self.g_u = 30 self.v_catch = 1 self.alpha = 0 s...
Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow.core.params.SumoCarFollowingParams obje...
PISaturation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PISaturation: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow...
stack_v2_sparse_classes_36k_train_011071
7,700
permissive
[ { "docstring": "Instantiate PISaturation.", "name": "__init__", "signature": "def __init__(self, veh_id, car_following_params)" }, { "docstring": "See parent class.", "name": "get_accel", "signature": "def get_accel(self, env)" } ]
2
null
Implement the Python class `PISaturation` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle...
Implement the Python class `PISaturation` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class PISaturation: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PISaturation: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier car_following_params : flow.core.params....
the_stack_v2_python_sparse
flow/controllers/velocity_controllers.py
parthjaggi/flow
train
6
ba1dbacf5d15e4ffa2a776424afc02f3a6db25f8
[ "if not prices or len(prices) == 1:\n return 0\nvalley = prices[0]\npeak = prices[0]\nmax_profit = 0\nfor i in range(1, len(prices)):\n if peak > prices[i]:\n max_profit += peak - valley\n valley = prices[i]\n peak = valley\n print(1)\n else:\n peak = prices[i]\n print...
<|body_start_0|> if not prices or len(prices) == 1: return 0 valley = prices[0] peak = prices[0] max_profit = 0 for i in range(1, len(prices)): if peak > prices[i]: max_profit += peak - valley valley = prices[i] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfitSimple(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not prices or len(prices) == 1: ...
stack_v2_sparse_classes_36k_train_011072
1,221
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfitSimple", "signature": "def maxProfitSimple(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_003621
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfitSimple(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfitSimple(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def m...
a13e7faaf55cd68249267e46a91e93c97e3190c2
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfitSimple(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" if not prices or len(prices) == 1: return 0 valley = prices[0] peak = prices[0] max_profit = 0 for i in range(1, len(prices)): if peak > prices[i]: ...
the_stack_v2_python_sparse
LeetCode/Array/122.py
xiaojkql/Algorithm-Data-Structure
train
1
4bff64b5ea30f00bceac84482cd4ab24f3a15ed2
[ "self.root = root\nself.settings = settings\nself.collected = defaultdict(dict)", "base_file, ext = os.path.splitext(relative_path)\next = '.{hash}{ext}'.format(hash=hash, ext=ext)\nrelative_path = base_file + ext\nreturn os.path.join(self.root, MARKER_FOLDER, relative_path)", "hash = md5(entry.path)\ntarget = ...
<|body_start_0|> self.root = root self.settings = settings self.collected = defaultdict(dict) <|end_body_0|> <|body_start_1|> base_file, ext = os.path.splitext(relative_path) ext = '.{hash}{ext}'.format(hash=hash, ext=ext) relative_path = base_file + ext return o...
Toss all static files into perma-asset folder, MD5 hash included in the name.
CopyAndHashCollector
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopyAndHashCollector: """Toss all static files into perma-asset folder, MD5 hash included in the name.""" def __init__(self, root: str, settings: dict, target_path: str=None): """Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_pa...
stack_v2_sparse_classes_36k_train_011073
9,928
permissive
[ { "docstring": "Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_path: Destination path.", "name": "__init__", "signature": "def __init__(self, root: str, settings: dict, target_path: str=None)" }, { "docstring": "Return the permanent path fo...
5
stack_v2_sparse_classes_30k_train_017840
Implement the Python class `CopyAndHashCollector` described below. Class description: Toss all static files into perma-asset folder, MD5 hash included in the name. Method signatures and docstrings: - def __init__(self, root: str, settings: dict, target_path: str=None): Initialize CopyAndHashCollector. :param root: Ro...
Implement the Python class `CopyAndHashCollector` described below. Class description: Toss all static files into perma-asset folder, MD5 hash included in the name. Method signatures and docstrings: - def __init__(self, root: str, settings: dict, target_path: str=None): Initialize CopyAndHashCollector. :param root: Ro...
a57de54fb8a3fae859f24f373f0292e1e4b3c344
<|skeleton|> class CopyAndHashCollector: """Toss all static files into perma-asset folder, MD5 hash included in the name.""" def __init__(self, root: str, settings: dict, target_path: str=None): """Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CopyAndHashCollector: """Toss all static files into perma-asset folder, MD5 hash included in the name.""" def __init__(self, root: str, settings: dict, target_path: str=None): """Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_path: Destinati...
the_stack_v2_python_sparse
websauna/system/http/static.py
websauna/websauna
train
294
b2f9b570ab5e3babb3904aa44aece714c2b1b691
[ "client = AsyncHTTPClient()\nif params:\n url = url + '?' + urlencode(params)\nif headers:\n http_request = HTTPRequest(url, method='GET', headers=headers, connect_timeout=20, validate_cert=False)\nelse:\n http_request = HTTPRequest(url, method='GET', connect_timeout=20, validate_cert=False)\nclient.fetch(...
<|body_start_0|> client = AsyncHTTPClient() if params: url = url + '?' + urlencode(params) if headers: http_request = HTTPRequest(url, method='GET', headers=headers, connect_timeout=20, validate_cert=False) else: http_request = HTTPRequest(url, method=...
HttpMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpMixin: def request_get(self, url, params=None, user_date=None, callback=None, headers=None): """发送get请求""" <|body_0|> def request_post(self, url, body, params=None, user_data=None, callback=None, headers=None): """发送post请求""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_011074
1,541
no_license
[ { "docstring": "发送get请求", "name": "request_get", "signature": "def request_get(self, url, params=None, user_date=None, callback=None, headers=None)" }, { "docstring": "发送post请求", "name": "request_post", "signature": "def request_post(self, url, body, params=None, user_data=None, callback...
2
stack_v2_sparse_classes_30k_train_015843
Implement the Python class `HttpMixin` described below. Class description: Implement the HttpMixin class. Method signatures and docstrings: - def request_get(self, url, params=None, user_date=None, callback=None, headers=None): 发送get请求 - def request_post(self, url, body, params=None, user_data=None, callback=None, he...
Implement the Python class `HttpMixin` described below. Class description: Implement the HttpMixin class. Method signatures and docstrings: - def request_get(self, url, params=None, user_date=None, callback=None, headers=None): 发送get请求 - def request_post(self, url, body, params=None, user_data=None, callback=None, he...
8b78411413aae01e7ade0eec36f37746d0e54cd4
<|skeleton|> class HttpMixin: def request_get(self, url, params=None, user_date=None, callback=None, headers=None): """发送get请求""" <|body_0|> def request_post(self, url, body, params=None, user_data=None, callback=None, headers=None): """发送post请求""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HttpMixin: def request_get(self, url, params=None, user_date=None, callback=None, headers=None): """发送get请求""" client = AsyncHTTPClient() if params: url = url + '?' + urlencode(params) if headers: http_request = HTTPRequest(url, method='GET', headers=hea...
the_stack_v2_python_sparse
tornado_SDK/utils/http_mixin.py
du-debug/tornado_SDK
train
0
4508b4d4dcceaca1f5dad560b896a1a8369c5688
[ "comp = self.get_component()\ncomp.clear()\ncomp.send_keys(keyVal)\nbtn = ButtonPage(self.driver)\nbtn.click_button(btn.save)\nself.wait_loading_hide()\nreturn self.get_msg()", "btn = ButtonPage(self.driver)\nbtn.click_button(btn.save)\nbtn.wait_loading_hide()\nreturn self.get_msg()", "self.element.send_keys(ke...
<|body_start_0|> comp = self.get_component() comp.clear() comp.send_keys(keyVal) btn = ButtonPage(self.driver) btn.click_button(btn.save) self.wait_loading_hide() return self.get_msg() <|end_body_0|> <|body_start_1|> btn = ButtonPage(self.driver) ...
TextPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextPage: def set_val_save_get_msg(self, keyVal): """设置控件值、触发保存、获取提醒消息并返回""" <|body_0|> def save_get_msg(self): """、触发保存、获取提醒消息并返回""" <|body_1|> def send_keys_trigger_refresh(self, keyVal): """触发刷新""" <|body_2|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_011075
4,541
no_license
[ { "docstring": "设置控件值、触发保存、获取提醒消息并返回", "name": "set_val_save_get_msg", "signature": "def set_val_save_get_msg(self, keyVal)" }, { "docstring": "、触发保存、获取提醒消息并返回", "name": "save_get_msg", "signature": "def save_get_msg(self)" }, { "docstring": "触发刷新", "name": "send_keys_trigger...
3
null
Implement the Python class `TextPage` described below. Class description: Implement the TextPage class. Method signatures and docstrings: - def set_val_save_get_msg(self, keyVal): 设置控件值、触发保存、获取提醒消息并返回 - def save_get_msg(self): 、触发保存、获取提醒消息并返回 - def send_keys_trigger_refresh(self, keyVal): 触发刷新
Implement the Python class `TextPage` described below. Class description: Implement the TextPage class. Method signatures and docstrings: - def set_val_save_get_msg(self, keyVal): 设置控件值、触发保存、获取提醒消息并返回 - def save_get_msg(self): 、触发保存、获取提醒消息并返回 - def send_keys_trigger_refresh(self, keyVal): 触发刷新 <|skeleton|> class Tex...
78768989a79a14013b983024cf6e4838d51ed595
<|skeleton|> class TextPage: def set_val_save_get_msg(self, keyVal): """设置控件值、触发保存、获取提醒消息并返回""" <|body_0|> def save_get_msg(self): """、触发保存、获取提醒消息并返回""" <|body_1|> def send_keys_trigger_refresh(self, keyVal): """触发刷新""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextPage: def set_val_save_get_msg(self, keyVal): """设置控件值、触发保存、获取提醒消息并返回""" comp = self.get_component() comp.clear() comp.send_keys(keyVal) btn = ButtonPage(self.driver) btn.click_button(btn.save) self.wait_loading_hide() return self.get_msg() ...
the_stack_v2_python_sparse
test_case/page_obj/form/text_page.py
pylk/pythonSelenium
train
0
75cb25c365b813ffbfc8189c1425049cbaaf5847
[ "i2c = I2C(scl=scl_pin, sda=sda_pin)\nself.roll = 0\nself.pitch = 0\nself.xyz_calib_factor = {'AcX': 1, 'AcY': 1, 'AcZ': 1}\nself.xyz_calib_offset = {'AcX': 0.0, 'AcY': 0.4, 'AcZ': 0.0}\nself.gyro_calib_offset = {'AcX': -14, 'AcY': 2.6, 'AcZ': 1.4}\nself.accelerometer = accel(i2c)\nself.time = 0\nself.crash_detecti...
<|body_start_0|> i2c = I2C(scl=scl_pin, sda=sda_pin) self.roll = 0 self.pitch = 0 self.xyz_calib_factor = {'AcX': 1, 'AcY': 1, 'AcZ': 1} self.xyz_calib_offset = {'AcX': 0.0, 'AcY': 0.4, 'AcZ': 0.0} self.gyro_calib_offset = {'AcX': -14, 'AcY': 2.6, 'AcZ': 1.4} self...
MpuSensor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MpuSensor: def __init__(self, scl_pin, sda_pin): """Initialise the MPU6050 sensor to read accelerometer and gyroscope data. :param scl_pin: A Pin object connected to SCL on the sensor. :param sda_pin: A Pin object connected to SDA on the sensor. :param samples: An integer representing nu...
stack_v2_sparse_classes_36k_train_011076
5,290
no_license
[ { "docstring": "Initialise the MPU6050 sensor to read accelerometer and gyroscope data. :param scl_pin: A Pin object connected to SCL on the sensor. :param sda_pin: A Pin object connected to SDA on the sensor. :param samples: An integer representing number of readings to take the average of.", "name": "__in...
4
stack_v2_sparse_classes_30k_train_006966
Implement the Python class `MpuSensor` described below. Class description: Implement the MpuSensor class. Method signatures and docstrings: - def __init__(self, scl_pin, sda_pin): Initialise the MPU6050 sensor to read accelerometer and gyroscope data. :param scl_pin: A Pin object connected to SCL on the sensor. :para...
Implement the Python class `MpuSensor` described below. Class description: Implement the MpuSensor class. Method signatures and docstrings: - def __init__(self, scl_pin, sda_pin): Initialise the MPU6050 sensor to read accelerometer and gyroscope data. :param scl_pin: A Pin object connected to SCL on the sensor. :para...
1029f1eb50c0f3a220a12b467bb9f6a0dbcb02bd
<|skeleton|> class MpuSensor: def __init__(self, scl_pin, sda_pin): """Initialise the MPU6050 sensor to read accelerometer and gyroscope data. :param scl_pin: A Pin object connected to SCL on the sensor. :param sda_pin: A Pin object connected to SDA on the sensor. :param samples: An integer representing nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MpuSensor: def __init__(self, scl_pin, sda_pin): """Initialise the MPU6050 sensor to read accelerometer and gyroscope data. :param scl_pin: A Pin object connected to SCL on the sensor. :param sda_pin: A Pin object connected to SDA on the sensor. :param samples: An integer representing number of readin...
the_stack_v2_python_sparse
wireless_modules/sensors/mpu_sensor.py
monash-human-power/data-acquisition-system
train
2
f885cb398a65f71e506232b558f1ad58bdc322a7
[ "class Node(object):\n\n def __init__(self, i, j):\n self.i, self.j = (i, j)\n\n def __cmp__(self, other):\n return nums1[self.i] + nums2[self.j] - (nums1[other.i] + nums2[other.j])\n\n def hasnext(self):\n return self.j + 1 < len(nums2)\n\n def next(self):\n if self.hasnext(...
<|body_start_0|> class Node(object): def __init__(self, i, j): self.i, self.j = (i, j) def __cmp__(self, other): return nums1[self.i] + nums2[self.j] - (nums1[other.i] + nums2[other.j]) def hasnext(self): return self.j + 1 < ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kSmallestPairs(self, nums1, nums2, k): """Maintain a heap of the k pairs The art is how to select the next pair. O(k log k) https://discuss.leetcode.com/topic/50885/simple-java-o-klogk-solution-with-explanation :type nums1: List[int] :type nums2: List[int] :type k: int :rty...
stack_v2_sparse_classes_36k_train_011077
2,932
permissive
[ { "docstring": "Maintain a heap of the k pairs The art is how to select the next pair. O(k log k) https://discuss.leetcode.com/topic/50885/simple-java-o-klogk-solution-with-explanation :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]", "name": "kSmallestPairs", "signatu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kSmallestPairs(self, nums1, nums2, k): Maintain a heap of the k pairs The art is how to select the next pair. O(k log k) https://discuss.leetcode.com/topic/50885/simple-java-...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kSmallestPairs(self, nums1, nums2, k): Maintain a heap of the k pairs The art is how to select the next pair. O(k log k) https://discuss.leetcode.com/topic/50885/simple-java-...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def kSmallestPairs(self, nums1, nums2, k): """Maintain a heap of the k pairs The art is how to select the next pair. O(k log k) https://discuss.leetcode.com/topic/50885/simple-java-o-klogk-solution-with-explanation :type nums1: List[int] :type nums2: List[int] :type k: int :rty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kSmallestPairs(self, nums1, nums2, k): """Maintain a heap of the k pairs The art is how to select the next pair. O(k log k) https://discuss.leetcode.com/topic/50885/simple-java-o-klogk-solution-with-explanation :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[...
the_stack_v2_python_sparse
373 Find K Pairs with Smallest Sums.py
Aminaba123/LeetCode
train
1
295dfed522f472e30dac1cc6219bac27a9ad0ac8
[ "b = torch.div(f, 1000.0)\nb = torch.pow(b, 2.0) * 1.4\nb = torch.pow(b + 1.0, 0.69)\nreturn b * 75.0 + 25.0", "f = torch.div(x - 25.0, 75.0)\nf = torch.pow(f, 1.0 / 0.69)\nf = torch.div(f - 1.0, 1.4)\nf = torch.pow(f, 0.5)\nreturn f * 1000.0", "assert check_argument_types()\nmin_center_frequency = torch.tensor...
<|body_start_0|> b = torch.div(f, 1000.0) b = torch.pow(b, 2.0) * 1.4 b = torch.pow(b + 1.0, 0.69) return b * 75.0 + 25.0 <|end_body_0|> <|body_start_1|> f = torch.div(x - 25.0, 75.0) f = torch.pow(f, 1.0 / 0.69) f = torch.div(f - 1.0, 1.4) f = torch.pow(...
Bark frequency scale. Has wider bandwidths at lower frequencies, see: Critical bandwidth: BARK Zwicker and Terhardt, 1980
BarkScale
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarkScale: """Bark frequency scale. Has wider bandwidths at lower frequencies, see: Critical bandwidth: BARK Zwicker and Terhardt, 1980""" def convert(f): """Convert Hz to Bark.""" <|body_0|> def invert(x): """Convert Bark to Hz.""" <|body_1|> def ba...
stack_v2_sparse_classes_36k_train_011078
9,034
permissive
[ { "docstring": "Convert Hz to Bark.", "name": "convert", "signature": "def convert(f)" }, { "docstring": "Convert Bark to Hz.", "name": "invert", "signature": "def invert(x)" }, { "docstring": "Obtain initialization values for the Bark scale. Args: channels: Number of channels. f...
3
stack_v2_sparse_classes_30k_val_000688
Implement the Python class `BarkScale` described below. Class description: Bark frequency scale. Has wider bandwidths at lower frequencies, see: Critical bandwidth: BARK Zwicker and Terhardt, 1980 Method signatures and docstrings: - def convert(f): Convert Hz to Bark. - def invert(x): Convert Bark to Hz. - def bank(c...
Implement the Python class `BarkScale` described below. Class description: Bark frequency scale. Has wider bandwidths at lower frequencies, see: Critical bandwidth: BARK Zwicker and Terhardt, 1980 Method signatures and docstrings: - def convert(f): Convert Hz to Bark. - def invert(x): Convert Bark to Hz. - def bank(c...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class BarkScale: """Bark frequency scale. Has wider bandwidths at lower frequencies, see: Critical bandwidth: BARK Zwicker and Terhardt, 1980""" def convert(f): """Convert Hz to Bark.""" <|body_0|> def invert(x): """Convert Bark to Hz.""" <|body_1|> def ba...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BarkScale: """Bark frequency scale. Has wider bandwidths at lower frequencies, see: Critical bandwidth: BARK Zwicker and Terhardt, 1980""" def convert(f): """Convert Hz to Bark.""" b = torch.div(f, 1000.0) b = torch.pow(b, 2.0) * 1.4 b = torch.pow(b + 1.0, 0.69) re...
the_stack_v2_python_sparse
espnet2/layers/sinc_conv.py
espnet/espnet
train
7,242
27946086427f3fb6dd1892af440f0f524bc51e07
[ "maxprofit = 0\nfor i in range(len(prices)):\n for j in range(i, len(prices)):\n tmp = prices[j] - prices[i]\n if tmp > 0 and tmp > maxprofit:\n maxprofit = tmp\nreturn maxprofit", "if len(prices) < 2:\n return 0\nminprice = prices[0]\nmaxprofit = prices[1] - minprice\nfor i in rang...
<|body_start_0|> maxprofit = 0 for i in range(len(prices)): for j in range(i, len(prices)): tmp = prices[j] - prices[i] if tmp > 0 and tmp > maxprofit: maxprofit = tmp return maxprofit <|end_body_0|> <|body_start_1|> if len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """暴力解法 暴力解法固然可以解决问题,但是时间复杂度就爆炸了 时间复杂度为:O(mn) 空间复杂度为:O(1)""" <|body_0|> def maxProfit1(self, prices: List[int]) -> int: """时间复杂度为O(n) 空间复杂度为O(1)""" <|body_1|> def maxProfit2(self, prices: List[int]...
stack_v2_sparse_classes_36k_train_011079
2,609
no_license
[ { "docstring": "暴力解法 暴力解法固然可以解决问题,但是时间复杂度就爆炸了 时间复杂度为:O(mn) 空间复杂度为:O(1)", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "时间复杂度为O(n) 空间复杂度为O(1)", "name": "maxProfit1", "signature": "def maxProfit1(self, prices: List[int]) -> int" }, ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 暴力解法 暴力解法固然可以解决问题,但是时间复杂度就爆炸了 时间复杂度为:O(mn) 空间复杂度为:O(1) - def maxProfit1(self, prices: List[int]) -> int: 时间复杂度为O(n) 空间复杂度为O(1) - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 暴力解法 暴力解法固然可以解决问题,但是时间复杂度就爆炸了 时间复杂度为:O(mn) 空间复杂度为:O(1) - def maxProfit1(self, prices: List[int]) -> int: 时间复杂度为O(n) 空间复杂度为O(1) - de...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """暴力解法 暴力解法固然可以解决问题,但是时间复杂度就爆炸了 时间复杂度为:O(mn) 空间复杂度为:O(1)""" <|body_0|> def maxProfit1(self, prices: List[int]) -> int: """时间复杂度为O(n) 空间复杂度为O(1)""" <|body_1|> def maxProfit2(self, prices: List[int]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """暴力解法 暴力解法固然可以解决问题,但是时间复杂度就爆炸了 时间复杂度为:O(mn) 空间复杂度为:O(1)""" maxprofit = 0 for i in range(len(prices)): for j in range(i, len(prices)): tmp = prices[j] - prices[i] if tmp > 0 and tmp > ...
the_stack_v2_python_sparse
LeetCode_practice/DynamicProgramming/0121.BestTimeToBuyAndSellStock_1.py
LeBron-Jian/BasicAlgorithmPractice
train
13
a8867109319f81af2670f4ca568e223195da723f
[ "start = index * 28 * 28 + 16\npicture = []\nfor i in range(28):\n picture.append([])\n for j in range(28):\n picture[i].append(self.to_int(content[start + i * 28 + j]))\nreturn picture", "sample = []\nfor i in range(28):\n for j in range(28):\n sample.append(picture[i][j])\nreturn sample",...
<|body_start_0|> start = index * 28 * 28 + 16 picture = [] for i in range(28): picture.append([]) for j in range(28): picture[i].append(self.to_int(content[start + i * 28 + j])) return picture <|end_body_0|> <|body_start_1|> sample = [] ...
ImageLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageLoader: def get_picture(self, content, index): """从文件中获取图像""" <|body_0|> def get_one_sample(self, picture): """将图像转化为样本的输入向量""" <|body_1|> def load(self): """加载全部数据文件,获取全部样本的输入向量""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_011080
2,696
permissive
[ { "docstring": "从文件中获取图像", "name": "get_picture", "signature": "def get_picture(self, content, index)" }, { "docstring": "将图像转化为样本的输入向量", "name": "get_one_sample", "signature": "def get_one_sample(self, picture)" }, { "docstring": "加载全部数据文件,获取全部样本的输入向量", "name": "load", "...
3
stack_v2_sparse_classes_30k_train_006068
Implement the Python class `ImageLoader` described below. Class description: Implement the ImageLoader class. Method signatures and docstrings: - def get_picture(self, content, index): 从文件中获取图像 - def get_one_sample(self, picture): 将图像转化为样本的输入向量 - def load(self): 加载全部数据文件,获取全部样本的输入向量
Implement the Python class `ImageLoader` described below. Class description: Implement the ImageLoader class. Method signatures and docstrings: - def get_picture(self, content, index): 从文件中获取图像 - def get_one_sample(self, picture): 将图像转化为样本的输入向量 - def load(self): 加载全部数据文件,获取全部样本的输入向量 <|skeleton|> class ImageLoader: ...
eb8216d4bd03615361093d16295a0b082ad297fd
<|skeleton|> class ImageLoader: def get_picture(self, content, index): """从文件中获取图像""" <|body_0|> def get_one_sample(self, picture): """将图像转化为样本的输入向量""" <|body_1|> def load(self): """加载全部数据文件,获取全部样本的输入向量""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageLoader: def get_picture(self, content, index): """从文件中获取图像""" start = index * 28 * 28 + 16 picture = [] for i in range(28): picture.append([]) for j in range(28): picture[i].append(self.to_int(content[start + i * 28 + j])) re...
the_stack_v2_python_sparse
nnet/mnist2data.py
guoguolan1991/learn_tensorflow
train
1
23eee2f4b17adfcdc77ad878f7c345e65884a0d2
[ "glActiveTexture(GL_TEXTURE0)\nfrontTexture = SOIL_load_OGL_texture('wood_texture.jpg', SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS)\nglBindTexture(GL_TEXTURE_2D, frontTexture)", "glUseProgram(program)\nglUniform1i(glGetUniformLocation(program, 'frontTexture'), 0)\nglTexParam...
<|body_start_0|> glActiveTexture(GL_TEXTURE0) frontTexture = SOIL_load_OGL_texture('wood_texture.jpg', SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS) glBindTexture(GL_TEXTURE_2D, frontTexture) <|end_body_0|> <|body_start_1|> glUseProgram(program) ...
textures
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class textures: def loadTexture(self): """function to load texture data for the GPU""" <|body_0|> def setUpTexture(self, program): """function to set up the parameters for texture use :param program: The ID of an OpenGL (GLSL) shader program to which parameter values are t...
stack_v2_sparse_classes_36k_train_011081
2,368
no_license
[ { "docstring": "function to load texture data for the GPU", "name": "loadTexture", "signature": "def loadTexture(self)" }, { "docstring": "function to set up the parameters for texture use :param program: The ID of an OpenGL (GLSL) shader program to which parameter values are to be sent", "n...
2
stack_v2_sparse_classes_30k_train_015160
Implement the Python class `textures` described below. Class description: Implement the textures class. Method signatures and docstrings: - def loadTexture(self): function to load texture data for the GPU - def setUpTexture(self, program): function to set up the parameters for texture use :param program: The ID of an...
Implement the Python class `textures` described below. Class description: Implement the textures class. Method signatures and docstrings: - def loadTexture(self): function to load texture data for the GPU - def setUpTexture(self, program): function to set up the parameters for texture use :param program: The ID of an...
883c3e9d3b2e5172a3dafb6742f60c7c5126a4c5
<|skeleton|> class textures: def loadTexture(self): """function to load texture data for the GPU""" <|body_0|> def setUpTexture(self, program): """function to set up the parameters for texture use :param program: The ID of an OpenGL (GLSL) shader program to which parameter values are t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class textures: def loadTexture(self): """function to load texture data for the GPU""" glActiveTexture(GL_TEXTURE0) frontTexture = SOIL_load_OGL_texture('wood_texture.jpg', SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS) glBindTexture(GL_TEXTURE_2D,...
the_stack_v2_python_sparse
final/textures.py
hiteshishah/CG
train
0
076f9b66354cf8d6be88c56dea6d576c8271042e
[ "self.stack = []\nself.l = nestedList\nself.i = 0", "if self.hasNext():\n v = self.l[self.i]\n self.i += 1\n return v.getInteger()\nelse:\n return None", "while True:\n while self.i == len(self.l):\n if self.stack:\n self.l, self.i = self.stack.pop()\n self.i += 1\n ...
<|body_start_0|> self.stack = [] self.l = nestedList self.i = 0 <|end_body_0|> <|body_start_1|> if self.hasNext(): v = self.l[self.i] self.i += 1 return v.getInteger() else: return None <|end_body_1|> <|body_start_2|> whil...
NestedIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_36k_train_011082
2,819
no_license
[ { "docstring": "Initialize your data structure here. :type nestedList: List[NestedInteger]", "name": "__init__", "signature": "def __init__(self, nestedList)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "nam...
3
stack_v2_sparse_classes_30k_train_009455
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
d6b9f07e2d1437681fa77fee0687ea9b83cab135
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" self.stack = [] self.l = nestedList self.i = 0 def next(self): """:rtype: int""" if self.hasNext(): v = self.l[self....
the_stack_v2_python_sparse
python/algorithm/leetcode/341.py
yanxurui/keepcoding
train
1
946c0e46b7e3e6b2a39f7d7686a6a31e7051d7df
[ "super(LSTMime, self).__init__()\nself.hidden_size = d_model\nself.lstm = nn.LSTM(input_size=input_size, hidden_size=d_model, num_layers=layers, batch_first=True)\nself.fc1 = nn.Linear(d_model, d_model)\nself.fc2 = nn.Linear(d_model, num_experts)\nself.fc3 = nn.Linear(d_model, out_len)\nself.drop_out = nn.Dropout(d...
<|body_start_0|> super(LSTMime, self).__init__() self.hidden_size = d_model self.lstm = nn.LSTM(input_size=input_size, hidden_size=d_model, num_layers=layers, batch_first=True) self.fc1 = nn.Linear(d_model, d_model) self.fc2 = nn.Linear(d_model, num_experts) self.fc3 = nn...
An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.
LSTMime
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMime: """An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.""" def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTMime instance. Args: input_s...
stack_v2_sparse_classes_36k_train_011083
4,262
permissive
[ { "docstring": "Initializes a LSTMime instance. Args: input_size: Input features dimension num_experts: Number of experts out_len: Forecasting horizon d_model: Hidden layer dimension layers: Number of LSTM layers. dropout: Fraction of neurons affected by Dropout (default=0.0). device: Device used by the model",...
2
stack_v2_sparse_classes_30k_train_007667
Implement the Python class `LSTMime` described below. Class description: An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module. Method signatures and docstrings: - def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device(...
Implement the Python class `LSTMime` described below. Class description: An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module. Method signatures and docstrings: - def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device(...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class LSTMime: """An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.""" def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTMime instance. Args: input_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTMime: """An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.""" def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTMime instance. Args: input_size: Input fe...
the_stack_v2_python_sparse
ime/models/lstm.py
Jimmy-INL/google-research
train
1
24d3b0eb04dc5f105712333dfd3fab3a12da33ed
[ "try:\n qs = PagePermission.objects.subordinate_to_user(request.user)\n return qs.filter(can_view=False)\nexcept NoPermissionsException:\n return self.objects.get_empty_query_set()", "exclude = self.exclude or []\nif obj:\n if not obj.has_add_permission(request):\n exclude.append('can_add')\n ...
<|body_start_0|> try: qs = PagePermission.objects.subordinate_to_user(request.user) return qs.filter(can_view=False) except NoPermissionsException: return self.objects.get_empty_query_set() <|end_body_0|> <|body_start_1|> exclude = self.exclude or [] ...
PagePermissionInlineAdmin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PagePermissionInlineAdmin: def queryset(self, request): """Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he ...
stack_v2_sparse_classes_36k_train_011084
6,886
permissive
[ { "docstring": "Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he can add more power to itself)", "name": "queryset", "signat...
2
stack_v2_sparse_classes_30k_train_007295
Implement the Python class `PagePermissionInlineAdmin` described below. Class description: Implement the PagePermissionInlineAdmin class. Method signatures and docstrings: - def queryset(self, request): Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permis...
Implement the Python class `PagePermissionInlineAdmin` described below. Class description: Implement the PagePermissionInlineAdmin class. Method signatures and docstrings: - def queryset(self, request): Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permis...
abc3fbfb34f791f84e9a9d4dc522966421778ab2
<|skeleton|> class PagePermissionInlineAdmin: def queryset(self, request): """Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PagePermissionInlineAdmin: def queryset(self, request): """Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he can add more p...
the_stack_v2_python_sparse
py/django_tools/django-cms/cms/admin/permissionadmin.py
marceltoben/evandrix.github.com
train
3
17e53c2d1ec849c5183c7fa34d24eedefd2d707f
[ "if not valid_email(email):\n return make_response('', 422)\nwith create_session() as session:\n response = session.read_transaction(get_user_by_email, email)\n response = response.single()\n if response:\n data = response.data()\n user = dict(data['user'].items())\n user['passions'...
<|body_start_0|> if not valid_email(email): return make_response('', 422) with create_session() as session: response = session.read_transaction(get_user_by_email, email) response = response.single() if response: data = response.data() ...
Users
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Users: def get(self, email: str) -> Response: """Fetch a user given its email.""" <|body_0|> def delete(self, email: str) -> Response: """Delete a user given its email.""" <|body_1|> def put(self, email: str) -> Response: """Update a user by the ...
stack_v2_sparse_classes_36k_train_011085
11,477
no_license
[ { "docstring": "Fetch a user given its email.", "name": "get", "signature": "def get(self, email: str) -> Response" }, { "docstring": "Delete a user given its email.", "name": "delete", "signature": "def delete(self, email: str) -> Response" }, { "docstring": "Update a user by th...
3
stack_v2_sparse_classes_30k_train_001726
Implement the Python class `Users` described below. Class description: Implement the Users class. Method signatures and docstrings: - def get(self, email: str) -> Response: Fetch a user given its email. - def delete(self, email: str) -> Response: Delete a user given its email. - def put(self, email: str) -> Response:...
Implement the Python class `Users` described below. Class description: Implement the Users class. Method signatures and docstrings: - def get(self, email: str) -> Response: Fetch a user given its email. - def delete(self, email: str) -> Response: Delete a user given its email. - def put(self, email: str) -> Response:...
2c71a26d1efbee85d04ce9c51b209c8b97f0ec06
<|skeleton|> class Users: def get(self, email: str) -> Response: """Fetch a user given its email.""" <|body_0|> def delete(self, email: str) -> Response: """Delete a user given its email.""" <|body_1|> def put(self, email: str) -> Response: """Update a user by the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Users: def get(self, email: str) -> Response: """Fetch a user given its email.""" if not valid_email(email): return make_response('', 422) with create_session() as session: response = session.read_transaction(get_user_by_email, email) response = resp...
the_stack_v2_python_sparse
backend/graph/graph_api/apis/users.py
WilliamZard/PintroAppSEG-Major
train
0
8b91112f30dcfa9e842c09862f7c39d946eac039
[ "if cls.model == None:\n cls.model = fasttext.load_model('/opt/ml/model/model.bin')\nreturn cls.model", "print('Received event: ' + input)\nclf = cls.get_model()\npredictions = []\nfor line in input['text']:\n pred_label = clf.predict(line)\n predictions.append(pred_label)\nreturn predictions" ]
<|body_start_0|> if cls.model == None: cls.model = fasttext.load_model('/opt/ml/model/model.bin') return cls.model <|end_body_0|> <|body_start_1|> print('Received event: ' + input) clf = cls.get_model() predictions = [] for line in input['text']: ...
ScoringService
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScoringService: def get_model(cls): """Get the model object for this instance, loading it if it's not already loaded.""" <|body_0|> def predict(cls, input): """For the input, do the predictions and return them. Args: input (a pandas dataframe): The data on which to d...
stack_v2_sparse_classes_36k_train_011086
3,144
permissive
[ { "docstring": "Get the model object for this instance, loading it if it's not already loaded.", "name": "get_model", "signature": "def get_model(cls)" }, { "docstring": "For the input, do the predictions and return them. Args: input (a pandas dataframe): The data on which to do the predictions....
2
null
Implement the Python class `ScoringService` described below. Class description: Implement the ScoringService class. Method signatures and docstrings: - def get_model(cls): Get the model object for this instance, loading it if it's not already loaded. - def predict(cls, input): For the input, do the predictions and re...
Implement the Python class `ScoringService` described below. Class description: Implement the ScoringService class. Method signatures and docstrings: - def get_model(cls): Get the model object for this instance, loading it if it's not already loaded. - def predict(cls, input): For the input, do the predictions and re...
43dae4b28531cde167598f104f582168b0a4141f
<|skeleton|> class ScoringService: def get_model(cls): """Get the model object for this instance, loading it if it's not already loaded.""" <|body_0|> def predict(cls, input): """For the input, do the predictions and return them. Args: input (a pandas dataframe): The data on which to d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScoringService: def get_model(cls): """Get the model object for this instance, loading it if it's not already loaded.""" if cls.model == None: cls.model = fasttext.load_model('/opt/ml/model/model.bin') return cls.model def predict(cls, input): """For the input,...
the_stack_v2_python_sparse
sagemaker-clarify/text_explainability_sagemaker_algorithm/container/blazing_text/predictor.py
aws/amazon-sagemaker-examples
train
4,797
bde3147da0ae0282e08ba1fc8ecd430d9b286ab9
[ "for c in set(s):\n if s.count(c) < k:\n return max((self.longestSubstring(t, k) for t in s.split(c)))\nreturn len(s)", "i, res, n = (0, 0, len(s))\nwhile n - i > res:\n max_index = i\n mask = 0\n map = [0] * 26\n for j in range(i, len(s)):\n t = ord(s[j]) - ord('a')\n map[t] +...
<|body_start_0|> for c in set(s): if s.count(c) < k: return max((self.longestSubstring(t, k) for t in s.split(c))) return len(s) <|end_body_0|> <|body_start_1|> i, res, n = (0, 0, len(s)) while n - i > res: max_index = i mask = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring2(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> for c in set(s): ...
stack_v2_sparse_classes_36k_train_011087
2,006
no_license
[ { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring", "signature": "def longestSubstring(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring2", "signature": "def longestSubstring2(self, s, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring2(self, s, k): :type s: str :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring2(self, s, k): :type s: str :type k: int :rtype: int <|skeleton|> class Solution: ...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring2(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" for c in set(s): if s.count(c) < k: return max((self.longestSubstring(t, k) for t in s.split(c))) return len(s) def longestSubstring2(self, s, k): """:type s...
the_stack_v2_python_sparse
code395LongestSubstringWithAtLeastKRepeatingCharacters.py
cybelewang/leetcode-python
train
0
81abe9ef9825e436c2e72e5da7941e7cc7a65d4b
[ "assert width > 0\nassert addr_lines > 0\nassert addr_lines <= 16\nattrs = [] if not ext_init else [('uninitialized', '')]\nself.addr = Signal(addr_lines)\nself.n_oe = Signal()\nself.n_wr = Signal()\nself.data_in = Signal(width)\nself.data_out = Signal(width)\nself._mem = Array([Signal(width, reset_less=True, attrs...
<|body_start_0|> assert width > 0 assert addr_lines > 0 assert addr_lines <= 16 attrs = [] if not ext_init else [('uninitialized', '')] self.addr = Signal(addr_lines) self.n_oe = Signal() self.n_wr = Signal() self.data_in = Signal(width) self.data_...
Logic for a typical asynchronous memory. Attributes: addr: The address to read or write. data_in: The input data (when writing). data_out: The output data (when reading). n_oe: Output enable, active low. When n_oe is 1, the output is 0. n_wr: Write, active low.
AsyncMemory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncMemory: """Logic for a typical asynchronous memory. Attributes: addr: The address to read or write. data_in: The input data (when writing). data_out: The output data (when reading). n_oe: Output enable, active low. When n_oe is 1, the output is 0. n_wr: Write, active low.""" def __init_...
stack_v2_sparse_classes_36k_train_011088
6,588
no_license
[ { "docstring": "Constructs an asynchronous memory. Args: width: The number of bits in each memory cell (\"word\"). addr_lines: The number of address lines. We only support memories up to 16 address lines (so 64k words).", "name": "__init__", "signature": "def __init__(self, width: int, addr_lines: int, ...
4
stack_v2_sparse_classes_30k_val_001101
Implement the Python class `AsyncMemory` described below. Class description: Logic for a typical asynchronous memory. Attributes: addr: The address to read or write. data_in: The input data (when writing). data_out: The output data (when reading). n_oe: Output enable, active low. When n_oe is 1, the output is 0. n_wr:...
Implement the Python class `AsyncMemory` described below. Class description: Logic for a typical asynchronous memory. Attributes: addr: The address to read or write. data_in: The input data (when writing). data_out: The output data (when reading). n_oe: Output enable, active low. When n_oe is 1, the output is 0. n_wr:...
9e652e1ca6dd5c2488ec30560b175d6d20ee003f
<|skeleton|> class AsyncMemory: """Logic for a typical asynchronous memory. Attributes: addr: The address to read or write. data_in: The input data (when writing). data_out: The output data (when reading). n_oe: Output enable, active low. When n_oe is 1, the output is 0. n_wr: Write, active low.""" def __init_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsyncMemory: """Logic for a typical asynchronous memory. Attributes: addr: The address to read or write. data_in: The input data (when writing). data_out: The output data (when reading). n_oe: Output enable, active low. When n_oe is 1, the output is 0. n_wr: Write, active low.""" def __init__(self, width...
the_stack_v2_python_sparse
async_memory.py
ElMahdiElAnnabi/riscv-reboot
train
0
1900cbcc8dc5a3fae41bac5167976b2c72b25b2e
[ "self.N = np.power(2, N2)\nself.dv_kms = dv_kms\nself.gen = np.random.RandomState(seed)\nself.white_noise = white_noise", "tau_pl = 2.0\nrel_amp = power_amplitude(z) / power_amplitude(self.z_c)\nreturn np.exp(tau_pl * (delta * np.sqrt(rel_amp) - 0.5 * var_delta * rel_amp))", "N = self.N\nL_kms = N * self.dv_kms...
<|body_start_0|> self.N = np.power(2, N2) self.dv_kms = dv_kms self.gen = np.random.RandomState(seed) self.white_noise = white_noise <|end_body_0|> <|body_start_1|> tau_pl = 2.0 rel_amp = power_amplitude(z) / power_amplitude(self.z_c) return np.exp(tau_pl * (delt...
Class to generate 1D mock Lyman alpha skewers.
MockMaker
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MockMaker: """Class to generate 1D mock Lyman alpha skewers.""" def __init__(self, N2=15, dv_kms=10.0, seed=666, white_noise=False): """Construct object to make 1D Lyman alpha mocks. Optional arguments: N2: the number of cells in the skewer will be 2^N2 dv_kms: cell width (in km/s) s...
stack_v2_sparse_classes_36k_train_011089
5,006
permissive
[ { "docstring": "Construct object to make 1D Lyman alpha mocks. Optional arguments: N2: the number of cells in the skewer will be 2^N2 dv_kms: cell width (in km/s) seed: starting seed for the random number generator white_noise: use constant power instead of realistic P1D.", "name": "__init__", "signatur...
5
stack_v2_sparse_classes_30k_train_010759
Implement the Python class `MockMaker` described below. Class description: Class to generate 1D mock Lyman alpha skewers. Method signatures and docstrings: - def __init__(self, N2=15, dv_kms=10.0, seed=666, white_noise=False): Construct object to make 1D Lyman alpha mocks. Optional arguments: N2: the number of cells ...
Implement the Python class `MockMaker` described below. Class description: Class to generate 1D mock Lyman alpha skewers. Method signatures and docstrings: - def __init__(self, N2=15, dv_kms=10.0, seed=666, white_noise=False): Construct object to make 1D Lyman alpha mocks. Optional arguments: N2: the number of cells ...
50998bfa41c5ebfc61930d352a455ea0f913584c
<|skeleton|> class MockMaker: """Class to generate 1D mock Lyman alpha skewers.""" def __init__(self, N2=15, dv_kms=10.0, seed=666, white_noise=False): """Construct object to make 1D Lyman alpha mocks. Optional arguments: N2: the number of cells in the skewer will be 2^N2 dv_kms: cell width (in km/s) s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MockMaker: """Class to generate 1D mock Lyman alpha skewers.""" def __init__(self, N2=15, dv_kms=10.0, seed=666, white_noise=False): """Construct object to make 1D Lyman alpha mocks. Optional arguments: N2: the number of cells in the skewer will be 2^N2 dv_kms: cell width (in km/s) seed: starting...
the_stack_v2_python_sparse
py/desisim/lya_mock_p1d.py
desihub/desisim
train
16
fe10b7eaed72097d25bcec1af45066bfcb8788ef
[ "self.default_user_quota_policy = default_user_quota_policy\nself.num_users_above_alert_threshold = num_users_above_alert_threshold\nself.num_users_above_hard_limit = num_users_above_hard_limit\nself.total_num_users = total_num_users", "if dictionary is None:\n return None\ndefault_user_quota_policy = cohesity...
<|body_start_0|> self.default_user_quota_policy = default_user_quota_policy self.num_users_above_alert_threshold = num_users_above_alert_threshold self.num_users_above_hard_limit = num_users_above_hard_limit self.total_num_users = total_num_users <|end_body_0|> <|body_start_1|> ...
Implementation of the 'UserQuotaSummaryForView' model. Specifies the user quota summary information/result for a view. Attributes: default_user_quota_policy (QuotaPolicy): Default quota policy applied to all the users in the view who doesn't have a policy override. num_users_above_alert_threshold (long|int): Number of ...
UserQuotaSummaryForView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserQuotaSummaryForView: """Implementation of the 'UserQuotaSummaryForView' model. Specifies the user quota summary information/result for a view. Attributes: default_user_quota_policy (QuotaPolicy): Default quota policy applied to all the users in the view who doesn't have a policy override. num...
stack_v2_sparse_classes_36k_train_011090
3,027
permissive
[ { "docstring": "Constructor for the UserQuotaSummaryForView class", "name": "__init__", "signature": "def __init__(self, default_user_quota_policy=None, num_users_above_alert_threshold=None, num_users_above_hard_limit=None, total_num_users=None)" }, { "docstring": "Creates an instance of this mo...
2
null
Implement the Python class `UserQuotaSummaryForView` described below. Class description: Implementation of the 'UserQuotaSummaryForView' model. Specifies the user quota summary information/result for a view. Attributes: default_user_quota_policy (QuotaPolicy): Default quota policy applied to all the users in the view ...
Implement the Python class `UserQuotaSummaryForView` described below. Class description: Implementation of the 'UserQuotaSummaryForView' model. Specifies the user quota summary information/result for a view. Attributes: default_user_quota_policy (QuotaPolicy): Default quota policy applied to all the users in the view ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class UserQuotaSummaryForView: """Implementation of the 'UserQuotaSummaryForView' model. Specifies the user quota summary information/result for a view. Attributes: default_user_quota_policy (QuotaPolicy): Default quota policy applied to all the users in the view who doesn't have a policy override. num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserQuotaSummaryForView: """Implementation of the 'UserQuotaSummaryForView' model. Specifies the user quota summary information/result for a view. Attributes: default_user_quota_policy (QuotaPolicy): Default quota policy applied to all the users in the view who doesn't have a policy override. num_users_above_...
the_stack_v2_python_sparse
cohesity_management_sdk/models/user_quota_summary_for_view.py
cohesity/management-sdk-python
train
24
ead08274ad871624a9db2645fda9ec1c3b8b9fc9
[ "root = Node('*', True, None, None, None, None)\nif len(grid) == 1:\n root.isLeaf = True\n root.val = True if grid[0][0] == 1 else False\nif self.allValueSame(grid):\n root.isLeaf = True\n root.val = True if grid[0][0] == 1 else False\nelse:\n halfLength = len(grid) // 2\n root.isLeaf = False\n ...
<|body_start_0|> root = Node('*', True, None, None, None, None) if len(grid) == 1: root.isLeaf = True root.val = True if grid[0][0] == 1 else False if self.allValueSame(grid): root.isLeaf = True root.val = True if grid[0][0] == 1 else False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" <|body_0|> def allValueSame(self, grid): """:type grid: List[List[int]] :rtype: boolean""" <|body_1|> <|end_skeleton|> <|body_start_0|> root = Node('*', True, None, ...
stack_v2_sparse_classes_36k_train_011091
2,302
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: Node", "name": "construct", "signature": "def construct(self, grid)" }, { "docstring": ":type grid: List[List[int]] :rtype: boolean", "name": "allValueSame", "signature": "def allValueSame(self, grid)" } ]
2
stack_v2_sparse_classes_30k_train_000371
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid): :type grid: List[List[int]] :rtype: Node - def allValueSame(self, grid): :type grid: List[List[int]] :rtype: boolean
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid): :type grid: List[List[int]] :rtype: Node - def allValueSame(self, grid): :type grid: List[List[int]] :rtype: boolean <|skeleton|> class Solution: ...
c93f15bee2ee2eea2e6f276c4907280d110c0467
<|skeleton|> class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" <|body_0|> def allValueSame(self, grid): """:type grid: List[List[int]] :rtype: boolean""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" root = Node('*', True, None, None, None, None) if len(grid) == 1: root.isLeaf = True root.val = True if grid[0][0] == 1 else False if self.allValueSame(grid): ...
the_stack_v2_python_sparse
427. 建立四叉树.py
leesen934/leetcode_practices
train
0
f71502f79af89d928f905d196b167ba17b044224
[ "self._id = heater.device_id\nself._conn = mill_data_connection\nself._sensor_type = sensor_type\nself._attr_device_class = DEVICE_CLASS_ENERGY\nself._attr_name = f\"{heater.name} {sensor_type.replace('_', ' ')}\"\nself._attr_unique_id = f'{heater.device_id}_{sensor_type}'\nself._attr_unit_of_measurement = ENERGY_K...
<|body_start_0|> self._id = heater.device_id self._conn = mill_data_connection self._sensor_type = sensor_type self._attr_device_class = DEVICE_CLASS_ENERGY self._attr_name = f"{heater.name} {sensor_type.replace('_', ' ')}" self._attr_unique_id = f'{heater.device_id}_{sen...
Representation of a Mill Sensor device.
MillHeaterEnergySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MillHeaterEnergySensor: """Representation of a Mill Sensor device.""" def __init__(self, heater, mill_data_connection, sensor_type): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Retrieve latest state.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_011092
3,216
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, heater, mill_data_connection, sensor_type)" }, { "docstring": "Retrieve latest state.", "name": "async_update", "signature": "async def async_update(self)" } ]
2
stack_v2_sparse_classes_30k_train_018933
Implement the Python class `MillHeaterEnergySensor` described below. Class description: Representation of a Mill Sensor device. Method signatures and docstrings: - def __init__(self, heater, mill_data_connection, sensor_type): Initialize the sensor. - async def async_update(self): Retrieve latest state.
Implement the Python class `MillHeaterEnergySensor` described below. Class description: Representation of a Mill Sensor device. Method signatures and docstrings: - def __init__(self, heater, mill_data_connection, sensor_type): Initialize the sensor. - async def async_update(self): Retrieve latest state. <|skeleton|>...
e0873493e2f77e9702601969712f6d2c1536aaef
<|skeleton|> class MillHeaterEnergySensor: """Representation of a Mill Sensor device.""" def __init__(self, heater, mill_data_connection, sensor_type): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Retrieve latest state.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MillHeaterEnergySensor: """Representation of a Mill Sensor device.""" def __init__(self, heater, mill_data_connection, sensor_type): """Initialize the sensor.""" self._id = heater.device_id self._conn = mill_data_connection self._sensor_type = sensor_type self._att...
the_stack_v2_python_sparse
homeassistant/components/mill/sensor.py
Shahzad6077/core
train
2
98d20027dc3eb270b1e9636165296c15b5482d38
[ "pk = kwargs.get('pk')\nproj = Project.objects.filter(id=pk).first()\nif check_user_can_edit(proj, request.user):\n team_can_edit = check_user_teams_can_edit(proj, request.user)\n form = ProjectForm(instance=proj, can_edit=team_can_edit)\n return render(request, self.template_name, {'object': proj, 'form':...
<|body_start_0|> pk = kwargs.get('pk') proj = Project.objects.filter(id=pk).first() if check_user_can_edit(proj, request.user): team_can_edit = check_user_teams_can_edit(proj, request.user) form = ProjectForm(instance=proj, can_edit=team_can_edit) return rende...
View for editing the details of an existing Project instance.
ProjectEditView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectEditView: """View for editing the details of an existing Project instance.""" def get(self, request, *args, **kwargs): """Override default get request. So we can verify the user has edit privileges, either through super status or team membership.""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_011093
10,681
no_license
[ { "docstring": "Override default get request. So we can verify the user has edit privileges, either through super status or team membership.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Project Edit Form validation and redirect.", "name": "form_v...
2
stack_v2_sparse_classes_30k_train_017659
Implement the Python class `ProjectEditView` described below. Class description: View for editing the details of an existing Project instance. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Override default get request. So we can verify the user has edit privileges, either through super ...
Implement the Python class `ProjectEditView` described below. Class description: View for editing the details of an existing Project instance. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Override default get request. So we can verify the user has edit privileges, either through super ...
ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4
<|skeleton|> class ProjectEditView: """View for editing the details of an existing Project instance.""" def get(self, request, *args, **kwargs): """Override default get request. So we can verify the user has edit privileges, either through super status or team membership.""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectEditView: """View for editing the details of an existing Project instance.""" def get(self, request, *args, **kwargs): """Override default get request. So we can verify the user has edit privileges, either through super status or team membership.""" pk = kwargs.get('pk') pr...
the_stack_v2_python_sparse
DataSearch/projects/views.py
USEPA/FoodWaste
train
1
82fb553029fa45a6dd2810ccb7041d195cb572df
[ "real_fields = [(name, filter_.field) for name, filter_ in self.filters.items()]\nmatch_any_field = forms.NullBooleanField(label='Match any', help_text='If true, match any rather than all of the filters given.', required=False, widget=BooleanWidget)\nfields = OrderedDict([('match_any', match_any_field)] + real_fiel...
<|body_start_0|> real_fields = [(name, filter_.field) for name, filter_ in self.filters.items()] match_any_field = forms.NullBooleanField(label='Match any', help_text='If true, match any rather than all of the filters given.', required=False, widget=BooleanWidget) fields = OrderedDict([('match_a...
Filterset class that allows OR matches.
AnyOrAllFilterSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnyOrAllFilterSet: """Filterset class that allows OR matches.""" def get_form_class(self): """Adds a match_any filter to filters.""" <|body_0|> def filter_queryset(self, queryset): """If match_any is true, build the filter queryset using union. This approach may ...
stack_v2_sparse_classes_36k_train_011094
33,428
permissive
[ { "docstring": "Adds a match_any filter to filters.", "name": "get_form_class", "signature": "def get_form_class(self)" }, { "docstring": "If match_any is true, build the filter queryset using union. This approach may be problematic. Unfortunately, django-filter doesn't use Q objects to build it...
2
null
Implement the Python class `AnyOrAllFilterSet` described below. Class description: Filterset class that allows OR matches. Method signatures and docstrings: - def get_form_class(self): Adds a match_any filter to filters. - def filter_queryset(self, queryset): If match_any is true, build the filter queryset using unio...
Implement the Python class `AnyOrAllFilterSet` described below. Class description: Filterset class that allows OR matches. Method signatures and docstrings: - def get_form_class(self): Adds a match_any filter to filters. - def filter_queryset(self, queryset): If match_any is true, build the filter queryset using unio...
6be3701a8e0085d0c6fa199b2672b7f9f1266a03
<|skeleton|> class AnyOrAllFilterSet: """Filterset class that allows OR matches.""" def get_form_class(self): """Adds a match_any filter to filters.""" <|body_0|> def filter_queryset(self, queryset): """If match_any is true, build the filter queryset using union. This approach may ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnyOrAllFilterSet: """Filterset class that allows OR matches.""" def get_form_class(self): """Adds a match_any filter to filters.""" real_fields = [(name, filter_.field) for name, filter_ in self.filters.items()] match_any_field = forms.NullBooleanField(label='Match any', help_tex...
the_stack_v2_python_sparse
app/backend/wells/filters.py
bcgov/gwells
train
39
dd8d7728fa8286c059073c039bc8787a14839764
[ "self._vm = vm\nself.func_code = code\nself.func_name = self.__name__ = name or code.co_name\nself.func_defaults = tuple(defaults)\nself.func_globals = globs\nself.func_locals = self._vm.frame.f_locals\nself.__dict__ = {}\nself.func_closure = closure\nself.__doc__ = code.co_consts[0] if code.co_consts else None\nkw...
<|body_start_0|> self._vm = vm self.func_code = code self.func_name = self.__name__ = name or code.co_name self.func_defaults = tuple(defaults) self.func_globals = globs self.func_locals = self._vm.frame.f_locals self.__dict__ = {} self.func_closure = clos...
Create a realistic function object, defining the things the interpreter expects.
Function
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Function: """Create a realistic function object, defining the things the interpreter expects.""" def __init__(self, name, code, globs, defaults, closure, vm): """You don't need to follow this closely to understand the interpreter.""" <|body_0|> def __call__(self, *args, ...
stack_v2_sparse_classes_36k_train_011095
9,627
permissive
[ { "docstring": "You don't need to follow this closely to understand the interpreter.", "name": "__init__", "signature": "def __init__(self, name, code, globs, defaults, closure, vm)" }, { "docstring": "When calling a Function, make a new frame and run it.", "name": "__call__", "signature...
2
null
Implement the Python class `Function` described below. Class description: Create a realistic function object, defining the things the interpreter expects. Method signatures and docstrings: - def __init__(self, name, code, globs, defaults, closure, vm): You don't need to follow this closely to understand the interpret...
Implement the Python class `Function` described below. Class description: Create a realistic function object, defining the things the interpreter expects. Method signatures and docstrings: - def __init__(self, name, code, globs, defaults, closure, vm): You don't need to follow this closely to understand the interpret...
4f5bdab86c71f503ac3ca7fbf5f81a615e323759
<|skeleton|> class Function: """Create a realistic function object, defining the things the interpreter expects.""" def __init__(self, name, code, globs, defaults, closure, vm): """You don't need to follow this closely to understand the interpreter.""" <|body_0|> def __call__(self, *args, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Function: """Create a realistic function object, defining the things the interpreter expects.""" def __init__(self, name, code, globs, defaults, closure, vm): """You don't need to follow this closely to understand the interpreter.""" self._vm = vm self.func_code = code sel...
the_stack_v2_python_sparse
python_advance/about_pyhton/simple_interpreter/interpreter_3.py
Dustyposa/goSpider
train
66
e03a48b7292927fac36bc3f4bb86685efbe147fa
[ "self.num_generations = generations\nself.max_pruning = max_pruning\nself.train_steps = train_steps\nself.pruner = LeGRPruner(pruning_ctrl, target_model)\ninit_filter_norms = self.pruner.init_filter_norms\nagent_hparams = {'num_generations': self.num_generations}\nself.agent = EvolutionOptimizer(init_filter_norms, ...
<|body_start_0|> self.num_generations = generations self.max_pruning = max_pruning self.train_steps = train_steps self.pruner = LeGRPruner(pruning_ctrl, target_model) init_filter_norms = self.pruner.init_filter_norms agent_hparams = {'num_generations': self.num_generation...
Class for training global ranking coefficients with Evolution optimization agent (but this agent can be easily replaced by any other RL agent with a similar interface) and LeGR-optimization environment.
LeGR
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeGR: """Class for training global ranking coefficients with Evolution optimization agent (but this agent can be easily replaced by any other RL agent with a similar interface) and LeGR-optimization environment.""" def __init__(self, pruning_ctrl: 'FilterPruningController', target_model: nn....
stack_v2_sparse_classes_36k_train_011096
5,353
permissive
[ { "docstring": "Initializing all necessary structures for optimization- LeGREvolutionEnv environment and EvolutionOptimizer agent. :param pruning_ctrl: pruning controller, an instance of FilterPruningController class :param target_model: model for which layers ranking coefficient will be trained :param legr_ini...
2
null
Implement the Python class `LeGR` described below. Class description: Class for training global ranking coefficients with Evolution optimization agent (but this agent can be easily replaced by any other RL agent with a similar interface) and LeGR-optimization environment. Method signatures and docstrings: - def __ini...
Implement the Python class `LeGR` described below. Class description: Class for training global ranking coefficients with Evolution optimization agent (but this agent can be easily replaced by any other RL agent with a similar interface) and LeGR-optimization environment. Method signatures and docstrings: - def __ini...
c027c8b43c4865d46b8de01d8350dd338ec5a874
<|skeleton|> class LeGR: """Class for training global ranking coefficients with Evolution optimization agent (but this agent can be easily replaced by any other RL agent with a similar interface) and LeGR-optimization environment.""" def __init__(self, pruning_ctrl: 'FilterPruningController', target_model: nn....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LeGR: """Class for training global ranking coefficients with Evolution optimization agent (but this agent can be easily replaced by any other RL agent with a similar interface) and LeGR-optimization environment.""" def __init__(self, pruning_ctrl: 'FilterPruningController', target_model: nn.Module, legr_...
the_stack_v2_python_sparse
nncf/torch/pruning/filter_pruning/global_ranking/legr.py
openvinotoolkit/nncf
train
558
e5867135796bc7eabfea799bb107e126a6a7807f
[ "super(TimeBlock, self).__init__()\nself.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(1, kernel_size), padding=(0, 1), padding_mode='reflect')\nself.conv2 = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(1, kernel_size), padding=(0, 1), padding_mode=...
<|body_start_0|> super(TimeBlock, self).__init__() self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(1, kernel_size), padding=(0, 1), padding_mode='reflect') self.conv2 = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(1, kernel_si...
Neural network block that applies a temporal convolution to each node of a graph in isolation.
TimeBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeBlock: """Neural network block that applies a temporal convolution to each node of a graph in isolation.""" def __init__(self, in_channels, out_channels, kernel_size=3): """:param in_channels: Number of input features at each node in each time step. :param out_channels: Desired n...
stack_v2_sparse_classes_36k_train_011097
6,003
no_license
[ { "docstring": ":param in_channels: Number of input features at each node in each time step. :param out_channels: Desired number of output channels at each node in each time step. :param kernel_size: Size of the 1D temporal kernel.", "name": "__init__", "signature": "def __init__(self, in_channels, out_...
2
stack_v2_sparse_classes_30k_train_016699
Implement the Python class `TimeBlock` described below. Class description: Neural network block that applies a temporal convolution to each node of a graph in isolation. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size=3): :param in_channels: Number of input features at ea...
Implement the Python class `TimeBlock` described below. Class description: Neural network block that applies a temporal convolution to each node of a graph in isolation. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size=3): :param in_channels: Number of input features at ea...
a96b24d3034d3aa5eee149234552aa7dad002b68
<|skeleton|> class TimeBlock: """Neural network block that applies a temporal convolution to each node of a graph in isolation.""" def __init__(self, in_channels, out_channels, kernel_size=3): """:param in_channels: Number of input features at each node in each time step. :param out_channels: Desired n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeBlock: """Neural network block that applies a temporal convolution to each node of a graph in isolation.""" def __init__(self, in_channels, out_channels, kernel_size=3): """:param in_channels: Number of input features at each node in each time step. :param out_channels: Desired number of outp...
the_stack_v2_python_sparse
Spatio_Temporal idea/my_models.py
ClarkFu007/Graph-Impuation-Neural-Network
train
0
894afbec7420c31c65df42d3e367218c3ff39e16
[ "self._momentum = momentum\nself._epsilon = epsilon\nself._trainable = trainable\nself._use_sync_bn = use_sync_bn\nif activation == 'relu':\n self._activation = tf.nn.relu\nelif activation == 'swish':\n self._activation = tf.nn.swish\nelse:\n raise ValueError('Activation {} not implemented.'.format(activat...
<|body_start_0|> self._momentum = momentum self._epsilon = epsilon self._trainable = trainable self._use_sync_bn = use_sync_bn if activation == 'relu': self._activation = tf.nn.relu elif activation == 'swish': self._activation = tf.nn.swish ...
Combined Batch Normalization and ReLU layers.
BatchNormActivation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchNormActivation: """Combined Batch Normalization and ReLU layers.""" def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): """A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for...
stack_v2_sparse_classes_36k_train_011098
26,918
permissive
[ { "docstring": "A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for the moving average. epsilon: small float added to variance to avoid dividing by zero. trainable: `boolean`, if True also add variables to the graph collection GraphKeys.TRAINABLE_VARIABLES. If ...
2
stack_v2_sparse_classes_30k_train_008055
Implement the Python class `BatchNormActivation` described below. Class description: Combined Batch Normalization and ReLU layers. Method signatures and docstrings: - def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): A class to construct layers for a batch norma...
Implement the Python class `BatchNormActivation` described below. Class description: Combined Batch Normalization and ReLU layers. Method signatures and docstrings: - def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): A class to construct layers for a batch norma...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class BatchNormActivation: """Combined Batch Normalization and ReLU layers.""" def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): """A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchNormActivation: """Combined Batch Normalization and ReLU layers.""" def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): """A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for the moving a...
the_stack_v2_python_sparse
models/official/detection/modeling/architecture/nn_ops.py
tensorflow/tpu
train
5,627
9bca46cb6303803e01a256a0b04359a9cb2341b1
[ "plt.imshow(image)\nplt.axis('off')\nplt.show()", "_fig, axs = plt.subplots(2, 5, figsize=(10, 10))\nfor ax, image in zip(chain.from_iterable(axs), images):\n ax.imshow(image)\n ax.grid(False)\n ax.axis('off')\nplt.show()" ]
<|body_start_0|> plt.imshow(image) plt.axis('off') plt.show() <|end_body_0|> <|body_start_1|> _fig, axs = plt.subplots(2, 5, figsize=(10, 10)) for ax, image in zip(chain.from_iterable(axs), images): ax.imshow(image) ax.grid(False) ax.axis('off...
Class for viewing images.
ImageViewer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageViewer: """Class for viewing images.""" def display(image): """Displays an image.""" <|body_0|> def display_images(images): """Displays 10 images.""" <|body_1|> <|end_skeleton|> <|body_start_0|> plt.imshow(image) plt.axis('off') ...
stack_v2_sparse_classes_36k_train_011099
990
no_license
[ { "docstring": "Displays an image.", "name": "display", "signature": "def display(image)" }, { "docstring": "Displays 10 images.", "name": "display_images", "signature": "def display_images(images)" } ]
2
stack_v2_sparse_classes_30k_train_009990
Implement the Python class `ImageViewer` described below. Class description: Class for viewing images. Method signatures and docstrings: - def display(image): Displays an image. - def display_images(images): Displays 10 images.
Implement the Python class `ImageViewer` described below. Class description: Class for viewing images. Method signatures and docstrings: - def display(image): Displays an image. - def display_images(images): Displays 10 images. <|skeleton|> class ImageViewer: """Class for viewing images.""" def display(imag...
7855d0ca4d74565955958a5d769fdd03b8aac940
<|skeleton|> class ImageViewer: """Class for viewing images.""" def display(image): """Displays an image.""" <|body_0|> def display_images(images): """Displays 10 images.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageViewer: """Class for viewing images.""" def display(image): """Displays an image.""" plt.imshow(image) plt.axis('off') plt.show() def display_images(images): """Displays 10 images.""" _fig, axs = plt.subplots(2, 5, figsize=(10, 10)) for ax...
the_stack_v2_python_sparse
Backpropagation/ImageViewer.py
askbk/IT3030-Deep-Learning
train
0