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
e0e6e8bcdf473841fcc19a9e49ba8bce02bd9c23
[ "pseqs = []\nfor i, ind in enumerate(indexes):\n pseqs.append(MySeq(self.seqs[i][ind:ind + self.motif_size], self.seqs[i].get_seq_biotype()))\nreturn MyMotifs(pseqs)", "from random import randint\ns = [0] * len(self.seqs)\nfor k in range(len(s)):\n s[k] = randint(0, self.seq_size(k) - self.motif_size)\nmoti...
<|body_start_0|> pseqs = [] for i, ind in enumerate(indexes): pseqs.append(MySeq(self.seqs[i][ind:ind + self.motif_size], self.seqs[i].get_seq_biotype())) return MyMotifs(pseqs) <|end_body_0|> <|body_start_1|> from random import randint s = [0] * len(self.seqs) ...
Inherited from parent class: ``DeterministicMotifFinding`` Add new function: * ``new_create_motif_from_indexes()`` * ``heuristic_stochastic()``
MotifFinding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MotifFinding: """Inherited from parent class: ``DeterministicMotifFinding`` Add new function: * ``new_create_motif_from_indexes()`` * ``heuristic_stochastic()``""" def new_create_motif_from_indexes(self, indexes): """Description:: * A matrix is constructed from a set of motifs. * The...
stack_v2_sparse_classes_36k_train_025000
6,636
no_license
[ { "docstring": "Description:: * A matrix is constructed from a set of motifs. * The number of columns is equal to the length of motif and the number of rows is equal to the size of alphabet. * Each cell of the matrix contains the frequency of the symbol in a given location", "name": "new_create_motif_from_i...
2
stack_v2_sparse_classes_30k_test_001020
Implement the Python class `MotifFinding` described below. Class description: Inherited from parent class: ``DeterministicMotifFinding`` Add new function: * ``new_create_motif_from_indexes()`` * ``heuristic_stochastic()`` Method signatures and docstrings: - def new_create_motif_from_indexes(self, indexes): Descriptio...
Implement the Python class `MotifFinding` described below. Class description: Inherited from parent class: ``DeterministicMotifFinding`` Add new function: * ``new_create_motif_from_indexes()`` * ``heuristic_stochastic()`` Method signatures and docstrings: - def new_create_motif_from_indexes(self, indexes): Descriptio...
a9448241b629681dfba44ce69d0b28c0d7717735
<|skeleton|> class MotifFinding: """Inherited from parent class: ``DeterministicMotifFinding`` Add new function: * ``new_create_motif_from_indexes()`` * ``heuristic_stochastic()``""" def new_create_motif_from_indexes(self, indexes): """Description:: * A matrix is constructed from a set of motifs. * The...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MotifFinding: """Inherited from parent class: ``DeterministicMotifFinding`` Add new function: * ``new_create_motif_from_indexes()`` * ``heuristic_stochastic()``""" def new_create_motif_from_indexes(self, indexes): """Description:: * A matrix is constructed from a set of motifs. * The number of co...
the_stack_v2_python_sparse
M_BioPy/BioAlgo_1028_1730416009.py
NatureGeorge/ProBioinformatics
train
1
d0dc872a10714073dd4989a83ec6f50474bde170
[ "logger.info('Overriding class: Discriminator -> LSTMDiscriminator.')\nsuper(LSTMDiscriminator, self).__init__(name='D_lstm')\nself.embedding = Dense(embedding_size, name='embedding')\nself.cell = LSTMCell(hidden_size, name='lstm_cell')\nself.rnn = RNN(self.cell, name='rnn_layer', return_sequences=True, stateful=Tr...
<|body_start_0|> logger.info('Overriding class: Discriminator -> LSTMDiscriminator.') super(LSTMDiscriminator, self).__init__(name='D_lstm') self.embedding = Dense(embedding_size, name='embedding') self.cell = LSTMCell(hidden_size, name='lstm_cell') self.rnn = RNN(self.cell, name...
A LSTMDiscriminator class is the one in charge of a discriminative Long Short-Term Memory implementation. References: S. Hochreiter, Jürgen Schmidhuber. Long short-term memory. Neural computation 9.8 (1997).
LSTMDiscriminator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMDiscriminator: """A LSTMDiscriminator class is the one in charge of a discriminative Long Short-Term Memory implementation. References: S. Hochreiter, Jürgen Schmidhuber. Long short-term memory. Neural computation 9.8 (1997).""" def __init__(self, embedding_size: Optional[int]=32, hidden...
stack_v2_sparse_classes_36k_train_025001
1,714
permissive
[ { "docstring": "Initialization method. Args: embedding_size: The size of the embedding layer. hidden_size: The amount of hidden neurons.", "name": "__init__", "signature": "def __init__(self, embedding_size: Optional[int]=32, hidden_size: Optional[int]=64) -> None" }, { "docstring": "Method that...
2
stack_v2_sparse_classes_30k_train_007593
Implement the Python class `LSTMDiscriminator` described below. Class description: A LSTMDiscriminator class is the one in charge of a discriminative Long Short-Term Memory implementation. References: S. Hochreiter, Jürgen Schmidhuber. Long short-term memory. Neural computation 9.8 (1997). Method signatures and docst...
Implement the Python class `LSTMDiscriminator` described below. Class description: A LSTMDiscriminator class is the one in charge of a discriminative Long Short-Term Memory implementation. References: S. Hochreiter, Jürgen Schmidhuber. Long short-term memory. Neural computation 9.8 (1997). Method signatures and docst...
4b7e7c1b1a304a5b37b21a972c50668e60b7bd7f
<|skeleton|> class LSTMDiscriminator: """A LSTMDiscriminator class is the one in charge of a discriminative Long Short-Term Memory implementation. References: S. Hochreiter, Jürgen Schmidhuber. Long short-term memory. Neural computation 9.8 (1997).""" def __init__(self, embedding_size: Optional[int]=32, hidden...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTMDiscriminator: """A LSTMDiscriminator class is the one in charge of a discriminative Long Short-Term Memory implementation. References: S. Hochreiter, Jürgen Schmidhuber. Long short-term memory. Neural computation 9.8 (1997).""" def __init__(self, embedding_size: Optional[int]=32, hidden_size: Option...
the_stack_v2_python_sparse
nalp/models/discriminators/lstm.py
gugarosa/nalp
train
25
90e08401cf50ef80d42fcfa6c388650e5fc09d54
[ "target_user = auth.User.filter(id=assignee_id)\nif not target_user:\n return jsonify_response({'status': f\"User with provided ID doesn't exist\"}, 404)\ntarget_user = target_user[0]\ndata = json.loads(request.data)\nif 'role' not in data:\n return jsonify_response({'status': f'The `role` parameter must be p...
<|body_start_0|> target_user = auth.User.filter(id=assignee_id) if not target_user: return jsonify_response({'status': f"User with provided ID doesn't exist"}, 404) target_user = target_user[0] data = json.loads(request.data) if 'role' not in data: return ...
Contains the PUT and DELETE method for assigned users for a given node
UpdateDeleteNodesAssignedUsers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDeleteNodesAssignedUsers: """Contains the PUT and DELETE method for assigned users for a given node""" def put(self, vertex=None, vertex_type=None, vertex_id=None, assignee_id=None): """Endpoint for updating a user's role for a given node""" <|body_0|> def delete(s...
stack_v2_sparse_classes_36k_train_025002
44,865
no_license
[ { "docstring": "Endpoint for updating a user's role for a given node", "name": "put", "signature": "def put(self, vertex=None, vertex_type=None, vertex_id=None, assignee_id=None)" }, { "docstring": "Endpoint for removing an assigned user edge for a given node/user pair", "name": "delete", ...
2
stack_v2_sparse_classes_30k_train_014616
Implement the Python class `UpdateDeleteNodesAssignedUsers` described below. Class description: Contains the PUT and DELETE method for assigned users for a given node Method signatures and docstrings: - def put(self, vertex=None, vertex_type=None, vertex_id=None, assignee_id=None): Endpoint for updating a user's role...
Implement the Python class `UpdateDeleteNodesAssignedUsers` described below. Class description: Contains the PUT and DELETE method for assigned users for a given node Method signatures and docstrings: - def put(self, vertex=None, vertex_type=None, vertex_id=None, assignee_id=None): Endpoint for updating a user's role...
00434985013b65fe45b0a8c8a7f0b50bb727087a
<|skeleton|> class UpdateDeleteNodesAssignedUsers: """Contains the PUT and DELETE method for assigned users for a given node""" def put(self, vertex=None, vertex_type=None, vertex_id=None, assignee_id=None): """Endpoint for updating a user's role for a given node""" <|body_0|> def delete(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateDeleteNodesAssignedUsers: """Contains the PUT and DELETE method for assigned users for a given node""" def put(self, vertex=None, vertex_type=None, vertex_id=None, assignee_id=None): """Endpoint for updating a user's role for a given node""" target_user = auth.User.filter(id=assigne...
the_stack_v2_python_sparse
core/views.py
gingerComms/gingerCommsAPIs
train
0
14e085bc601432516c434b14f6d448d16a463172
[ "self.degree = degree\nself.n_vars = n_vars\nself.coefs = coefs", "coefs = [2 * (random.random() - 0.5) for i in Polynomial.terms(degree, n_vars)]\np = Polynomial(degree, n_vars, coefs)\nreturn p", "for pows in itertools.product(range(degree + 1), repeat=n_vars):\n if sum(pows) <= degree:\n yield pows...
<|body_start_0|> self.degree = degree self.n_vars = n_vars self.coefs = coefs <|end_body_0|> <|body_start_1|> coefs = [2 * (random.random() - 0.5) for i in Polynomial.terms(degree, n_vars)] p = Polynomial(degree, n_vars, coefs) return p <|end_body_1|> <|body_start_2|> ...
A polynomial of a given degree and a given number of variables, with one coefficient for each term.
Polynomial
[ "MIT", "GPL-3.0-only", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Polynomial: """A polynomial of a given degree and a given number of variables, with one coefficient for each term.""" def __init__(self, degree, n_vars, coefs): """Constructor for the case where we already have coefficients.""" <|body_0|> def from_random(cls, degree, n_v...
stack_v2_sparse_classes_36k_train_025003
4,452
permissive
[ { "docstring": "Constructor for the case where we already have coefficients.", "name": "__init__", "signature": "def __init__(self, degree, n_vars, coefs)" }, { "docstring": "Constructor for the case where we want random coefficients.", "name": "from_random", "signature": "def from_rando...
5
stack_v2_sparse_classes_30k_train_005100
Implement the Python class `Polynomial` described below. Class description: A polynomial of a given degree and a given number of variables, with one coefficient for each term. Method signatures and docstrings: - def __init__(self, degree, n_vars, coefs): Constructor for the case where we already have coefficients. - ...
Implement the Python class `Polynomial` described below. Class description: A polynomial of a given degree and a given number of variables, with one coefficient for each term. Method signatures and docstrings: - def __init__(self, degree, n_vars, coefs): Constructor for the case where we already have coefficients. - ...
27f19678d69e2c6c7038514e26638a9962229118
<|skeleton|> class Polynomial: """A polynomial of a given degree and a given number of variables, with one coefficient for each term.""" def __init__(self, degree, n_vars, coefs): """Constructor for the case where we already have coefficients.""" <|body_0|> def from_random(cls, degree, n_v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Polynomial: """A polynomial of a given degree and a given number of variables, with one coefficient for each term.""" def __init__(self, degree, n_vars, coefs): """Constructor for the case where we already have coefficients.""" self.degree = degree self.n_vars = n_vars sel...
the_stack_v2_python_sparse
src/PonyGE2/src/fitness/supervised_learning/regression_random_polynomial.py
flexgp/novelty-prog-sys
train
1
374b0a5a5544f3a94498ded7e45e8bda524cb17f
[ "if address is None:\n return\ntry:\n if network:\n ipaddress.ip_network(address, strict=True)\n else:\n ipaddress.ip_address(address)\nexcept ValueError as exc:\n msg = \"The value '{}={}' is invalid: {}\".format(field_name, address, str(exc))\n raise BaseHttpError(code=400, msg=msg)",...
<|body_start_0|> if address is None: return try: if network: ipaddress.ip_network(address, strict=True) else: ipaddress.ip_address(address) except ValueError as exc: msg = "The value '{}={}' is invalid: {}".format(fi...
Resource for subnets
SubnetResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubnetResource: """Resource for subnets""" def _assert_address(address, field_name, network=False): """Assert that address is a valid ip address. Args: address (str): network or ip address field_name (str): field name to report in case of error network (bool): whether it is a network...
stack_v2_sparse_classes_36k_train_025004
8,007
permissive
[ { "docstring": "Assert that address is a valid ip address. Args: address (str): network or ip address field_name (str): field name to report in case of error network (bool): whether it is a network address Raises: BaseHttpError: in case provided address is invalid", "name": "_assert_address", "signature...
4
stack_v2_sparse_classes_30k_train_012958
Implement the Python class `SubnetResource` described below. Class description: Resource for subnets Method signatures and docstrings: - def _assert_address(address, field_name, network=False): Assert that address is a valid ip address. Args: address (str): network or ip address field_name (str): field name to report...
Implement the Python class `SubnetResource` described below. Class description: Resource for subnets Method signatures and docstrings: - def _assert_address(address, field_name, network=False): Assert that address is a valid ip address. Args: address (str): network or ip address field_name (str): field name to report...
9c9040f6a173af5c495f5447889e9349fa56f234
<|skeleton|> class SubnetResource: """Resource for subnets""" def _assert_address(address, field_name, network=False): """Assert that address is a valid ip address. Args: address (str): network or ip address field_name (str): field name to report in case of error network (bool): whether it is a network...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubnetResource: """Resource for subnets""" def _assert_address(address, field_name, network=False): """Assert that address is a valid ip address. Args: address (str): network or ip address field_name (str): field name to report in case of error network (bool): whether it is a network address Rais...
the_stack_v2_python_sparse
tessia/server/api/resources/subnets.py
tessia-project/tessia
train
10
30e95d22f0c92190090e870f6152c549a5e30e74
[ "super(ImageEncoding, self).__init__()\nself.conv1 = nn.Conv2d(3, 32, kernel_size=3, stride=1)\nself.batchNorm1 = nn.BatchNorm2d(32)\nself.conv2 = nn.Conv2d(32, 64, kernel_size=3, stride=1)\nself.batchNorm2 = nn.BatchNorm2d(64)\nself.conv3 = nn.Conv2d(64, 128, kernel_size=3, stride=2)\nself.batchNorm3 = nn.BatchNor...
<|body_start_0|> super(ImageEncoding, self).__init__() self.conv1 = nn.Conv2d(3, 32, kernel_size=3, stride=1) self.batchNorm1 = nn.BatchNorm2d(32) self.conv2 = nn.Conv2d(32, 64, kernel_size=3, stride=1) self.batchNorm2 = nn.BatchNorm2d(64) self.conv3 = nn.Conv2d(64, 128, ...
Image encoding using 4 convolutional layers with batch normalization, it was designed specifically for sort of clevr https://arxiv.org/abs/1706.01427.
ImageEncoding
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageEncoding: """Image encoding using 4 convolutional layers with batch normalization, it was designed specifically for sort of clevr https://arxiv.org/abs/1706.01427.""" def __init__(self): """Constructor of the ImageEncoding class.""" <|body_0|> def forward(self, img)...
stack_v2_sparse_classes_36k_train_025005
4,377
permissive
[ { "docstring": "Constructor of the ImageEncoding class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Apply 4 convolutional layers over the image. :param img: input image [batch_size, num_channels, height, width] :return x: feature map with flattening the width and h...
2
null
Implement the Python class `ImageEncoding` described below. Class description: Image encoding using 4 convolutional layers with batch normalization, it was designed specifically for sort of clevr https://arxiv.org/abs/1706.01427. Method signatures and docstrings: - def __init__(self): Constructor of the ImageEncoding...
Implement the Python class `ImageEncoding` described below. Class description: Image encoding using 4 convolutional layers with batch normalization, it was designed specifically for sort of clevr https://arxiv.org/abs/1706.01427. Method signatures and docstrings: - def __init__(self): Constructor of the ImageEncoding...
c655c88cc6aec4d0724c19ea95209f1c2dd6770d
<|skeleton|> class ImageEncoding: """Image encoding using 4 convolutional layers with batch normalization, it was designed specifically for sort of clevr https://arxiv.org/abs/1706.01427.""" def __init__(self): """Constructor of the ImageEncoding class.""" <|body_0|> def forward(self, img)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageEncoding: """Image encoding using 4 convolutional layers with batch normalization, it was designed specifically for sort of clevr https://arxiv.org/abs/1706.01427.""" def __init__(self): """Constructor of the ImageEncoding class.""" super(ImageEncoding, self).__init__() self....
the_stack_v2_python_sparse
models/stacked_attention_vqa/image_encoding.py
aasseman/mi-prometheus
train
0
f02f997b82ae619a6edbefdf26afa4ea95d0d2f6
[ "super().__init__(env)\nself.env = env\nself.env_category = env_config.env_name.split(':')[0]\nself.max_videos = env_config.video.max_videos\nself.capture_interval = env_config.video.record_every\nself.frame_interval = frame_interval\nself.fps = fps\nself.ext = '.gif' if use_gif else '.mp4'\nself.save_folder = env_...
<|body_start_0|> super().__init__(env) self.env = env self.env_category = env_config.env_name.split(':')[0] self.max_videos = env_config.video.max_videos self.capture_interval = env_config.video.record_every self.frame_interval = frame_interval self.fps = fps ...
Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame default to 10 fps (int): frame rate defau...
VideoWrapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoWrapper: """Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame d...
stack_v2_sparse_classes_36k_train_025006
6,239
permissive
[ { "docstring": "Constructor for VideoWrapper. also creates the save directory if not present Args: env (Env): environment to be wrapped capture_interval (int): number of episodes between captures frame_interval (int): number of frames between each recorded frame fps (int): frame rate save_folder (str): director...
4
stack_v2_sparse_classes_30k_train_020637
Implement the Python class `VideoWrapper` described below. Class description: Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number ...
Implement the Python class `VideoWrapper` described below. Class description: Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number ...
2556bd9c362a53e0a94da914ba59b5d4621c4081
<|skeleton|> class VideoWrapper: """Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoWrapper: """Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame default to 10 ...
the_stack_v2_python_sparse
surreal/env/video_env.py
PeihongYu/surreal
train
0
aeac0fed66c294dac95010b19e1cc1ca2568eb08
[ "actual_dict = linear.csv_to_dict('data/products.csv')\nexpected_dict_1 = {'product_id': 'prd001', 'description': '700-W microwave', 'product_type': 'kitchen', 'quantity_available': '5'}\nself.assertEqual(actual_dict[0], expected_dict_1)", "linear.drop_db()\nactual_1_raw = linear.import_data('', 'data/products.cs...
<|body_start_0|> actual_dict = linear.csv_to_dict('data/products.csv') expected_dict_1 = {'product_id': 'prd001', 'description': '700-W microwave', 'product_type': 'kitchen', 'quantity_available': '5'} self.assertEqual(actual_dict[0], expected_dict_1) <|end_body_0|> <|body_start_1|> lin...
Contains test functions to evaluate basic_operations
DatabaseTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseTests: """Contains test functions to evaluate basic_operations""" def test_csv_to_dict(self): """Test csv_to_dict function""" <|body_0|> def test_import_data(self): """Test import_data function""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025007
1,089
no_license
[ { "docstring": "Test csv_to_dict function", "name": "test_csv_to_dict", "signature": "def test_csv_to_dict(self)" }, { "docstring": "Test import_data function", "name": "test_import_data", "signature": "def test_import_data(self)" } ]
2
null
Implement the Python class `DatabaseTests` described below. Class description: Contains test functions to evaluate basic_operations Method signatures and docstrings: - def test_csv_to_dict(self): Test csv_to_dict function - def test_import_data(self): Test import_data function
Implement the Python class `DatabaseTests` described below. Class description: Contains test functions to evaluate basic_operations Method signatures and docstrings: - def test_csv_to_dict(self): Test csv_to_dict function - def test_import_data(self): Test import_data function <|skeleton|> class DatabaseTests: "...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class DatabaseTests: """Contains test functions to evaluate basic_operations""" def test_csv_to_dict(self): """Test csv_to_dict function""" <|body_0|> def test_import_data(self): """Test import_data function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseTests: """Contains test functions to evaluate basic_operations""" def test_csv_to_dict(self): """Test csv_to_dict function""" actual_dict = linear.csv_to_dict('data/products.csv') expected_dict_1 = {'product_id': 'prd001', 'description': '700-W microwave', 'product_type': ...
the_stack_v2_python_sparse
students/will_chang/lesson07/test_linear.py
JavaRod/SP_Python220B_2019
train
1
91591795c31dc82345f24568d9d0dc053db5f715
[ "try:\n self.email = email\n self.password = password\nexcept Exception as e:\n config.logger.log('ERROR', str(e))", "try:\n if self.email is not None and self.password is not None:\n self.email = self.email.lower()\n config.logger.log('INFO', 'Searching for email in database...')\n ...
<|body_start_0|> try: self.email = email self.password = password except Exception as e: config.logger.log('ERROR', str(e)) <|end_body_0|> <|body_start_1|> try: if self.email is not None and self.password is not None: self.email = ...
Validation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validation: def __init__(self, email, password): """:param email: email of the user :param password: password of the user""" <|body_0|> def check(self): """:return: whether valid or not along with a new jwt.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025008
1,885
no_license
[ { "docstring": ":param email: email of the user :param password: password of the user", "name": "__init__", "signature": "def __init__(self, email, password)" }, { "docstring": ":return: whether valid or not along with a new jwt.", "name": "check", "signature": "def check(self)" } ]
2
stack_v2_sparse_classes_30k_train_006682
Implement the Python class `Validation` described below. Class description: Implement the Validation class. Method signatures and docstrings: - def __init__(self, email, password): :param email: email of the user :param password: password of the user - def check(self): :return: whether valid or not along with a new j...
Implement the Python class `Validation` described below. Class description: Implement the Validation class. Method signatures and docstrings: - def __init__(self, email, password): :param email: email of the user :param password: password of the user - def check(self): :return: whether valid or not along with a new j...
b7444684784d8320c833bf9f7a5ee15d983e474b
<|skeleton|> class Validation: def __init__(self, email, password): """:param email: email of the user :param password: password of the user""" <|body_0|> def check(self): """:return: whether valid or not along with a new jwt.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Validation: def __init__(self, email, password): """:param email: email of the user :param password: password of the user""" try: self.email = email self.password = password except Exception as e: config.logger.log('ERROR', str(e)) def check(sel...
the_stack_v2_python_sparse
py_backend/login/login_user.py
shubhamgantayat/MedHub
train
2
37ba07b527f3cf7c38faf219ea0cf7ba220da65a
[ "s = cb.ConvergenceEvaluationSpecification()\ns.add_sampled_input(name='Inlet_Flowrate', pyomo_path='fs.pc.control_volume.properties_in[0].flow_mol', lower=1, upper=1000000.0, mean=5000.0, std=5000.0)\ns.add_sampled_input(name='Inlet_Pressure', pyomo_path='fs.pc.control_volume.properties_in[0].pressure', lower=1000...
<|body_start_0|> s = cb.ConvergenceEvaluationSpecification() s.add_sampled_input(name='Inlet_Flowrate', pyomo_path='fs.pc.control_volume.properties_in[0].flow_mol', lower=1, upper=1000000.0, mean=5000.0, std=5000.0) s.add_sampled_input(name='Inlet_Pressure', pyomo_path='fs.pc.control_volume.prop...
PressureChangerConvergenceEvaluation
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PressureChangerConvergenceEvaluation: def get_specification(self): """Returns the convergence evaluation specification for the PressureChanger unit model Returns ------- ConvergenceEvaluationSpecification""" <|body_0|> def get_initialized_model(self): """Returns an i...
stack_v2_sparse_classes_36k_train_025009
3,539
permissive
[ { "docstring": "Returns the convergence evaluation specification for the PressureChanger unit model Returns ------- ConvergenceEvaluationSpecification", "name": "get_specification", "signature": "def get_specification(self)" }, { "docstring": "Returns an initialized model for the PressureChanger...
3
null
Implement the Python class `PressureChangerConvergenceEvaluation` described below. Class description: Implement the PressureChangerConvergenceEvaluation class. Method signatures and docstrings: - def get_specification(self): Returns the convergence evaluation specification for the PressureChanger unit model Returns -...
Implement the Python class `PressureChangerConvergenceEvaluation` described below. Class description: Implement the PressureChangerConvergenceEvaluation class. Method signatures and docstrings: - def get_specification(self): Returns the convergence evaluation specification for the PressureChanger unit model Returns -...
afec89b8273fcc17a0b5f08ea9b97b5fc98d2a31
<|skeleton|> class PressureChangerConvergenceEvaluation: def get_specification(self): """Returns the convergence evaluation specification for the PressureChanger unit model Returns ------- ConvergenceEvaluationSpecification""" <|body_0|> def get_initialized_model(self): """Returns an i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PressureChangerConvergenceEvaluation: def get_specification(self): """Returns the convergence evaluation specification for the PressureChanger unit model Returns ------- ConvergenceEvaluationSpecification""" s = cb.ConvergenceEvaluationSpecification() s.add_sampled_input(name='Inlet_Fl...
the_stack_v2_python_sparse
idaes/convergence/generic_models/pressure_changer.py
JackaChou/idaes-pse
train
1
eb167cd1538afe2f068c909707ebad2089f9937e
[ "super().__init__()\nself._model = deepcopy(model)\nseed = torch.tensor(seed if seed is not None else torch.randint(0, 1000000, (1,)).item())\nself.register_buffer('_seed', seed)", "try:\n return self._Xs\nexcept AttributeError:\n return None", "try:\n return self._Ys\nexcept AttributeError:\n retur...
<|body_start_0|> super().__init__() self._model = deepcopy(model) seed = torch.tensor(seed if seed is not None else torch.randint(0, 1000000, (1,)).item()) self.register_buffer('_seed', seed) <|end_body_0|> <|body_start_1|> try: return self._Xs except Attribu...
Convenience wrapper for sampling a function from a GP prior. This wrapper implicitly defines the GP sample as a self-updating function by keeping track of the evaluated points and respective base samples used during the evaluation. This does not yet support multi-output models.
GPDraw
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GPDraw: """Convenience wrapper for sampling a function from a GP prior. This wrapper implicitly defines the GP sample as a self-updating function by keeping track of the evaluated points and respective base samples used during the evaluation. This does not yet support multi-output models.""" ...
stack_v2_sparse_classes_36k_train_025010
15,960
permissive
[ { "docstring": "Construct a GP function sampler. Args: model: The Model defining the GP prior.", "name": "__init__", "signature": "def __init__(self, model: Model, seed: Optional[int]=None) -> None" }, { "docstring": "A `(batch_shape) x n_eval x d`-dim tensor of locations at which the GP was eva...
4
stack_v2_sparse_classes_30k_train_010625
Implement the Python class `GPDraw` described below. Class description: Convenience wrapper for sampling a function from a GP prior. This wrapper implicitly defines the GP sample as a self-updating function by keeping track of the evaluated points and respective base samples used during the evaluation. This does not y...
Implement the Python class `GPDraw` described below. Class description: Convenience wrapper for sampling a function from a GP prior. This wrapper implicitly defines the GP sample as a self-updating function by keeping track of the evaluated points and respective base samples used during the evaluation. This does not y...
52c611cb716856777af87763a98c141507b019b3
<|skeleton|> class GPDraw: """Convenience wrapper for sampling a function from a GP prior. This wrapper implicitly defines the GP sample as a self-updating function by keeping track of the evaluated points and respective base samples used during the evaluation. This does not yet support multi-output models.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GPDraw: """Convenience wrapper for sampling a function from a GP prior. This wrapper implicitly defines the GP sample as a self-updating function by keeping track of the evaluated points and respective base samples used during the evaluation. This does not yet support multi-output models.""" def __init__...
the_stack_v2_python_sparse
botorch/utils/gp_sampling.py
utkarshiam/botorch
train
0
735bdcd3cefd3a12af3f8cd5f5c4c27c11e9cd57
[ "self.inline = inline\nself.escape = escape\nsuper().__init__(data=data)", "if self.inline:\n return '$' + self.dumps_content() + '$'\nreturn '\\\\[%\\n' + self.dumps_content() + '%\\n\\\\]'" ]
<|body_start_0|> self.inline = inline self.escape = escape super().__init__(data=data) <|end_body_0|> <|body_start_1|> if self.inline: return '$' + self.dumps_content() + '$' return '\\[%\n' + self.dumps_content() + '%\n\\]' <|end_body_1|>
A class representing a math environment.
Math
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Math: """A class representing a math environment.""" def __init__(self, *, inline=False, data=None, escape=None): """Args ---- data: list Content of the math container. inline: bool If the math should be displayed inline or not. escape : bool if True, will escape strings""" <...
stack_v2_sparse_classes_36k_train_025011
3,905
permissive
[ { "docstring": "Args ---- data: list Content of the math container. inline: bool If the math should be displayed inline or not. escape : bool if True, will escape strings", "name": "__init__", "signature": "def __init__(self, *, inline=False, data=None, escape=None)" }, { "docstring": "Return a ...
2
stack_v2_sparse_classes_30k_train_007229
Implement the Python class `Math` described below. Class description: A class representing a math environment. Method signatures and docstrings: - def __init__(self, *, inline=False, data=None, escape=None): Args ---- data: list Content of the math container. inline: bool If the math should be displayed inline or not...
Implement the Python class `Math` described below. Class description: A class representing a math environment. Method signatures and docstrings: - def __init__(self, *, inline=False, data=None, escape=None): Args ---- data: list Content of the math container. inline: bool If the math should be displayed inline or not...
2050b14d8d7ed4fe788c769afec6816e2b703355
<|skeleton|> class Math: """A class representing a math environment.""" def __init__(self, *, inline=False, data=None, escape=None): """Args ---- data: list Content of the math container. inline: bool If the math should be displayed inline or not. escape : bool if True, will escape strings""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Math: """A class representing a math environment.""" def __init__(self, *, inline=False, data=None, escape=None): """Args ---- data: list Content of the math container. inline: bool If the math should be displayed inline or not. escape : bool if True, will escape strings""" self.inline = ...
the_stack_v2_python_sparse
pylatex/math.py
JelteF/PyLaTeX
train
2,104
feda5f5ab6d8f5e0aca8fcecf68979188a8fb768
[ "engine = db_connect()\ncreate_table(engine)\nself.Session = sessionmaker(bind=engine)", "session = self.Session()\npractice_id = uuid.uuid4()\ndb1 = PhysicianDB()\ndb1.id = practice_id\ndb1.license = item['license']\ndb1.license_type = item['license_type']\ndb1.physician_name = item['name'].title()\ndb1.address ...
<|body_start_0|> engine = db_connect() create_table(engine) self.Session = sessionmaker(bind=engine) <|end_body_0|> <|body_start_1|> session = self.Session() practice_id = uuid.uuid4() db1 = PhysicianDB() db1.id = practice_id db1.license = item['license']...
ScrapyDcaPipeline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScrapyDcaPipeline: def __init__(self): """Initializes database connection and sessionmaker. Creates deals table.""" <|body_0|> def process_item(self, item, spider): """This method is called for every item pipeline component.""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_025012
1,473
no_license
[ { "docstring": "Initializes database connection and sessionmaker. Creates deals table.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "This method is called for every item pipeline component.", "name": "process_item", "signature": "def process_item(self, item, ...
2
stack_v2_sparse_classes_30k_train_014489
Implement the Python class `ScrapyDcaPipeline` described below. Class description: Implement the ScrapyDcaPipeline class. Method signatures and docstrings: - def __init__(self): Initializes database connection and sessionmaker. Creates deals table. - def process_item(self, item, spider): This method is called for eve...
Implement the Python class `ScrapyDcaPipeline` described below. Class description: Implement the ScrapyDcaPipeline class. Method signatures and docstrings: - def __init__(self): Initializes database connection and sessionmaker. Creates deals table. - def process_item(self, item, spider): This method is called for eve...
13bf1f02bc6c6817badf7d162c55169e276725b8
<|skeleton|> class ScrapyDcaPipeline: def __init__(self): """Initializes database connection and sessionmaker. Creates deals table.""" <|body_0|> def process_item(self, item, spider): """This method is called for every item pipeline component.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScrapyDcaPipeline: def __init__(self): """Initializes database connection and sessionmaker. Creates deals table.""" engine = db_connect() create_table(engine) self.Session = sessionmaker(bind=engine) def process_item(self, item, spider): """This method is called fo...
the_stack_v2_python_sparse
scrapy/scrapy-webdriver/scrapy_dca/pipelines.py
bidcms/crawler
train
0
7957f484cd7f8831bcc656d7cae5ec2c058e93db
[ "less = []\nfor pair in zip(words, words[1:]):\n for a, b in zip(*pair):\n if a != b:\n less += (a + b,)\n break\nchars = set(''.join(words))\norder = []\nwhile less:\n free = chars - set(zip(*less)[1])\n if not free:\n return ''\n order += free\n less = filter(fre...
<|body_start_0|> less = [] for pair in zip(words, words[1:]): for a, b in zip(*pair): if a != b: less += (a + b,) break chars = set(''.join(words)) order = [] while less: free = chars - set(zip(*less)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def alienOrder(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def rewrite(self, words): """:type words: List[str] :rtype: str 注意 data structure 的 type [ "wrt", "wrf", "er", "ett", "rftt" ]""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_025013
2,995
no_license
[ { "docstring": ":type words: List[str] :rtype: str", "name": "alienOrder", "signature": "def alienOrder(self, words)" }, { "docstring": ":type words: List[str] :rtype: str 注意 data structure 的 type [ \"wrt\", \"wrf\", \"er\", \"ett\", \"rftt\" ]", "name": "rewrite", "signature": "def rewr...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def alienOrder(self, words): :type words: List[str] :rtype: str - def rewrite(self, words): :type words: List[str] :rtype: str 注意 data structure 的 type [ "wrt", "wrf", "er", "ett...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def alienOrder(self, words): :type words: List[str] :rtype: str - def rewrite(self, words): :type words: List[str] :rtype: str 注意 data structure 的 type [ "wrt", "wrf", "er", "ett...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def alienOrder(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def rewrite(self, words): """:type words: List[str] :rtype: str 注意 data structure 的 type [ "wrt", "wrf", "er", "ett", "rftt" ]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def alienOrder(self, words): """:type words: List[str] :rtype: str""" less = [] for pair in zip(words, words[1:]): for a, b in zip(*pair): if a != b: less += (a + b,) break chars = set(''.join(words))...
the_stack_v2_python_sparse
co_fb/269_Alien_Dictionary.py
vsdrun/lc_public
train
6
1aaee45ad67cba7f3f8226db140a91c7e75a86c5
[ "super().__init__()\nself.root_dir = root_dir\nself.dir_filter = dir_filter\nself.file_keys = file_keys\nself.file_path_generator = file_path_generator\nself.file_extension = file_extension if file_extension.startswith('.') else '.' + file_extension\nself.data = {}\ndata_dir = self._crawl_directories()\nself._crawl...
<|body_start_0|> super().__init__() self.root_dir = root_dir self.dir_filter = dir_filter self.file_keys = file_keys self.file_path_generator = file_path_generator self.file_extension = file_extension if file_extension.startswith('.') else '.' + file_extension sel...
Represents a file system data crawler. Examples: Suppose we have the following directory structure:: /path/to/root_dir ./Patient1 ./Image.mha ./GroundTruth.mha ./some_text_file.txt ./Patient2 ./Image.mha ./GroundTruth.mha ./GroundTruthRater2.mha ./Atlas ./Atlas.mha We can use the following code to load the images `Imag...
FileSystemDataCrawler
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSystemDataCrawler: """Represents a file system data crawler. Examples: Suppose we have the following directory structure:: /path/to/root_dir ./Patient1 ./Image.mha ./GroundTruth.mha ./some_text_file.txt ./Patient2 ./Image.mha ./GroundTruth.mha ./GroundTruthRater2.mha ./Atlas ./Atlas.mha We ca...
stack_v2_sparse_classes_36k_train_025014
6,815
permissive
[ { "docstring": "Initializes a new instance of the FileSystemDataCrawler class. Args: root_dir (str): The path to the root directory, which contains subdirectories with the data. file_keys (list): A list of objects, which represent human readable data identifiers (one identifier for each data file to crawl). fil...
3
stack_v2_sparse_classes_30k_train_018051
Implement the Python class `FileSystemDataCrawler` described below. Class description: Represents a file system data crawler. Examples: Suppose we have the following directory structure:: /path/to/root_dir ./Patient1 ./Image.mha ./GroundTruth.mha ./some_text_file.txt ./Patient2 ./Image.mha ./GroundTruth.mha ./GroundTr...
Implement the Python class `FileSystemDataCrawler` described below. Class description: Represents a file system data crawler. Examples: Suppose we have the following directory structure:: /path/to/root_dir ./Patient1 ./Image.mha ./GroundTruth.mha ./some_text_file.txt ./Patient2 ./Image.mha ./GroundTruth.mha ./GroundTr...
7917c6a6c4e3728db17ec762c63f8253392e6c04
<|skeleton|> class FileSystemDataCrawler: """Represents a file system data crawler. Examples: Suppose we have the following directory structure:: /path/to/root_dir ./Patient1 ./Image.mha ./GroundTruth.mha ./some_text_file.txt ./Patient2 ./Image.mha ./GroundTruth.mha ./GroundTruthRater2.mha ./Atlas ./Atlas.mha We ca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileSystemDataCrawler: """Represents a file system data crawler. Examples: Suppose we have the following directory structure:: /path/to/root_dir ./Patient1 ./Image.mha ./GroundTruth.mha ./some_text_file.txt ./Patient2 ./Image.mha ./GroundTruth.mha ./GroundTruthRater2.mha ./Atlas ./Atlas.mha We can use the fol...
the_stack_v2_python_sparse
miapy/miapy/data/loading.py
SCAN-NRAD/BrainRegressorCNN
train
3
dcb3401a9110b7c3383f2bb9d596bd8f0e54e97d
[ "outputs = sorted(StreamAlertOutput.get_all_outputs().keys())\nget_parser = generate_subparser(subparser, 'get', description=cls.description, help=cls.description, subcommand=True)\nget_parser.add_argument('service', choices=outputs, metavar='SERVICE', help='Service to pull configured outputs and their secrets, sel...
<|body_start_0|> outputs = sorted(StreamAlertOutput.get_all_outputs().keys()) get_parser = generate_subparser(subparser, 'get', description=cls.description, help=cls.description, subcommand=True) get_parser.add_argument('service', choices=outputs, metavar='SERVICE', help='Service to pull configu...
OutputGetSubCommand
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputGetSubCommand: def setup_subparser(cls, subparser): """Add the output get subparser: manage.py output get [options]""" <|body_0|> def handler(cls, options, config): """Fetches the configuration for a service Args: options (argparse.Namespace): Basically a named...
stack_v2_sparse_classes_36k_train_025015
19,044
permissive
[ { "docstring": "Add the output get subparser: manage.py output get [options]", "name": "setup_subparser", "signature": "def setup_subparser(cls, subparser)" }, { "docstring": "Fetches the configuration for a service Args: options (argparse.Namespace): Basically a namedtuple with the service sett...
2
stack_v2_sparse_classes_30k_train_019803
Implement the Python class `OutputGetSubCommand` described below. Class description: Implement the OutputGetSubCommand class. Method signatures and docstrings: - def setup_subparser(cls, subparser): Add the output get subparser: manage.py output get [options] - def handler(cls, options, config): Fetches the configura...
Implement the Python class `OutputGetSubCommand` described below. Class description: Implement the OutputGetSubCommand class. Method signatures and docstrings: - def setup_subparser(cls, subparser): Add the output get subparser: manage.py output get [options] - def handler(cls, options, config): Fetches the configura...
75ba140d2e1aa6e903313d88326920adcb8bff45
<|skeleton|> class OutputGetSubCommand: def setup_subparser(cls, subparser): """Add the output get subparser: manage.py output get [options]""" <|body_0|> def handler(cls, options, config): """Fetches the configuration for a service Args: options (argparse.Namespace): Basically a named...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutputGetSubCommand: def setup_subparser(cls, subparser): """Add the output get subparser: manage.py output get [options]""" outputs = sorted(StreamAlertOutput.get_all_outputs().keys()) get_parser = generate_subparser(subparser, 'get', description=cls.description, help=cls.description,...
the_stack_v2_python_sparse
streamalert_cli/outputs/handler.py
avmi/streamalert
train
0
3aedabadd9652e25b37713f09f9db2f95aab1c83
[ "Inter.__init__(self, slab=slab)\nself['B'] = []\nself['L'] = []\nself[''] = []\nself['T'] = []\nself['D'] = []\nself.evaluated = False\nself.nimax = 0", "for i in li:\n if i.idx != []:\n self.nimax = max(self.nimax, max(i.idx)) + 1\nfor i in li:\n self.addi(i)", "if not isinstance(self.typ, np.nda...
<|body_start_0|> Inter.__init__(self, slab=slab) self['B'] = [] self['L'] = [] self[''] = [] self['T'] = [] self['D'] = [] self.evaluated = False self.nimax = 0 <|end_body_0|> <|body_start_1|> for i in li: if i.idx != []: ...
Interaction parameters gather all type of interactions (IntB/L/R/T) Methods ------- add(self,li): add a list of basis interactions addi(self,i): add a single interaction eval(self) : evaluate all the interactions added thanks to self.add or self.addi and create the self.I which gather all thoses interactions 5 followin...
Interactions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Interactions: """Interaction parameters gather all type of interactions (IntB/L/R/T) Methods ------- add(self,li): add a list of basis interactions addi(self,i): add a single interaction eval(self) : evaluate all the interactions added thanks to self.add or self.addi and create the self.I which g...
stack_v2_sparse_classes_36k_train_025016
25,448
permissive
[ { "docstring": "object constructor", "name": "__init__", "signature": "def __init__(self, slab={})" }, { "docstring": "add a list of interactions Parameters ---------- li : list list of interactions", "name": "add", "signature": "def add(self, li)" }, { "docstring": "add interact...
4
stack_v2_sparse_classes_30k_train_020784
Implement the Python class `Interactions` described below. Class description: Interaction parameters gather all type of interactions (IntB/L/R/T) Methods ------- add(self,li): add a list of basis interactions addi(self,i): add a single interaction eval(self) : evaluate all the interactions added thanks to self.add or ...
Implement the Python class `Interactions` described below. Class description: Interaction parameters gather all type of interactions (IntB/L/R/T) Methods ------- add(self,li): add a list of basis interactions addi(self,i): add a single interaction eval(self) : evaluate all the interactions added thanks to self.add or ...
a3a5973a0cb549d0a16f17b96a9c78c200cf0c7e
<|skeleton|> class Interactions: """Interaction parameters gather all type of interactions (IntB/L/R/T) Methods ------- add(self,li): add a list of basis interactions addi(self,i): add a single interaction eval(self) : evaluate all the interactions added thanks to self.add or self.addi and create the self.I which g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Interactions: """Interaction parameters gather all type of interactions (IntB/L/R/T) Methods ------- add(self,li): add a list of basis interactions addi(self,i): add a single interaction eval(self) : evaluate all the interactions added thanks to self.add or self.addi and create the self.I which gather all tho...
the_stack_v2_python_sparse
pylayers/antprop/interactions.py
sahibdhanjal/DeepLocNet
train
40
f80028f432062fd25b47322822d8adbb095ae004
[ "try:\n project_obj = self.get_object()\n part_id = request.query_params.get('part_id') or None\n part_name = request.query_params.get('part_name') or None\n if part_id is not None:\n project_obj.delete_tag_by_id(tag_id=part_id)\n return Response({'status': 'ok'})\n if part_name is not ...
<|body_start_0|> try: project_obj = self.get_object() part_id = request.query_params.get('part_id') or None part_name = request.query_params.get('part_name') or None if part_id is not None: project_obj.delete_tag_by_id(tag_id=part_id) ...
Project ModelViewSet Filters: is_demo
ProjectViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectViewSet: """Project ModelViewSet Filters: is_demo""" def delete_tag(self, request, pk=None): """delete tag""" <|body_0|> def relabel_keep_alive(self, request, pk=None) -> Response: """relabel_keep_alive. Args: request: kwargs: Returns: Response: Return pro...
stack_v2_sparse_classes_36k_train_025017
30,302
permissive
[ { "docstring": "delete tag", "name": "delete_tag", "signature": "def delete_tag(self, request, pk=None)" }, { "docstring": "relabel_keep_alive. Args: request: kwargs: Returns: Response: Return project with updated timestamp", "name": "relabel_keep_alive", "signature": "def relabel_keep_a...
2
stack_v2_sparse_classes_30k_train_020520
Implement the Python class `ProjectViewSet` described below. Class description: Project ModelViewSet Filters: is_demo Method signatures and docstrings: - def delete_tag(self, request, pk=None): delete tag - def relabel_keep_alive(self, request, pk=None) -> Response: relabel_keep_alive. Args: request: kwargs: Returns:...
Implement the Python class `ProjectViewSet` described below. Class description: Project ModelViewSet Filters: is_demo Method signatures and docstrings: - def delete_tag(self, request, pk=None): delete tag - def relabel_keep_alive(self, request, pk=None) -> Response: relabel_keep_alive. Args: request: kwargs: Returns:...
d72c3c1c2d56a762b74a72cd3befd076dc77b8ac
<|skeleton|> class ProjectViewSet: """Project ModelViewSet Filters: is_demo""" def delete_tag(self, request, pk=None): """delete tag""" <|body_0|> def relabel_keep_alive(self, request, pk=None) -> Response: """relabel_keep_alive. Args: request: kwargs: Returns: Response: Return pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectViewSet: """Project ModelViewSet Filters: is_demo""" def delete_tag(self, request, pk=None): """delete tag""" try: project_obj = self.get_object() part_id = request.query_params.get('part_id') or None part_name = request.query_params.get('part_na...
the_stack_v2_python_sparse
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_training/api/views.py
timlawless/azure-intelligent-edge-patterns
train
0
79db637826dc4d3c063b33d40e609d8327f02874
[ "super(JointTorqueController, self).__init__()\nself.input_max = input_max\nself.input_min = input_min\nself.output_max = output_max\nself.output_min = output_min\nself.joint_dim = robot_model.joint_dim\nself.control_freq = control_freq\nself.model = robot_model\nself.interpolator = interpolator\nself.goal_torque =...
<|body_start_0|> super(JointTorqueController, self).__init__() self.input_max = input_max self.input_min = input_min self.output_max = output_max self.output_min = output_min self.joint_dim = robot_model.joint_dim self.control_freq = control_freq self.mode...
Controller for joint torque Attributes: robot_model (Model): model of robot containing state and parameters. input_max (float or list of floats): Maximum above which an inputted action will be clipped. input_min (float or list of floats): Minimum below which an inputted action will be clipped. output_max (float or list...
JointTorqueController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JointTorqueController: """Controller for joint torque Attributes: robot_model (Model): model of robot containing state and parameters. input_max (float or list of floats): Maximum above which an inputted action will be clipped. input_min (float or list of floats): Minimum below which an inputted ...
stack_v2_sparse_classes_36k_train_025018
4,761
no_license
[ { "docstring": "Initialize Joint Torque Controller. Args: robot_model (Model): model of robot containing state and parameters. input_max (float or list of floats): Maximum above which an inputted action will be clipped. input_min (float or list of floats): Minimum below which an inputted action will be clipped....
3
null
Implement the Python class `JointTorqueController` described below. Class description: Controller for joint torque Attributes: robot_model (Model): model of robot containing state and parameters. input_max (float or list of floats): Maximum above which an inputted action will be clipped. input_min (float or list of fl...
Implement the Python class `JointTorqueController` described below. Class description: Controller for joint torque Attributes: robot_model (Model): model of robot containing state and parameters. input_max (float or list of floats): Maximum above which an inputted action will be clipped. input_min (float or list of fl...
d15791905abf8ff5def7fd0d3e303e619fc150d1
<|skeleton|> class JointTorqueController: """Controller for joint torque Attributes: robot_model (Model): model of robot containing state and parameters. input_max (float or list of floats): Maximum above which an inputted action will be clipped. input_min (float or list of floats): Minimum below which an inputted ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JointTorqueController: """Controller for joint torque Attributes: robot_model (Model): model of robot containing state and parameters. input_max (float or list of floats): Maximum above which an inputted action will be clipped. input_min (float or list of floats): Minimum below which an inputted action will b...
the_stack_v2_python_sparse
perls2/controllers/joint_torque.py
kayburns/perls2
train
0
6b531ca890793a4312b2a8a52d0256eff09a2f20
[ "super(InceptionV3, self).__init__()\nself.resize_input = resize_input\nself.normalize_input = normalize_input\nself.output_blocks = sorted(output_blocks)\nself.last_needed_block = max(output_blocks)\nassert self.last_needed_block <= 3, 'Last possible output block index is 3'\nself.blocks = nn.ModuleList()\nif use_...
<|body_start_0|> super(InceptionV3, self).__init__() self.resize_input = resize_input self.normalize_input = normalize_input self.output_blocks = sorted(output_blocks) self.last_needed_block = max(output_blocks) assert self.last_needed_block <= 3, 'Last possible output bl...
Pretrained InceptionV3 network returning feature maps
InceptionV3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InceptionV3: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False, use_fid_inception=True): """Build pretrained InceptionV3 Parameters ---------- output_blocks...
stack_v2_sparse_classes_36k_train_025019
40,832
no_license
[ { "docstring": "Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possible values are: - 0: corresponds to output of first max pooling - 1: corresponds to output of second max pooling - 2: corresponds to output which is fed to aux classifier ...
2
null
Implement the Python class `InceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False, use_fid_inception=True): Build p...
Implement the Python class `InceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False, use_fid_inception=True): Build p...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class InceptionV3: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False, use_fid_inception=True): """Build pretrained InceptionV3 Parameters ---------- output_blocks...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InceptionV3: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False, use_fid_inception=True): """Build pretrained InceptionV3 Parameters ---------- output_blocks : list of in...
the_stack_v2_python_sparse
generated/test_mit_han_lab_anycost_gan.py
jansel/pytorch-jit-paritybench
train
35
959063d06591719ff7e20c65efa9fa544953cfc7
[ "if post_id:\n post = Post.query.filter_by(id=post_id).first()\n if not post:\n abort(404)\n return post\nelse:\n args = parsers.post_get_parser.parse_args()\n page = args['page'] or 1\n if args['user']:\n user = User.query.filter_by(username=args['user']).first()\n if not use...
<|body_start_0|> if post_id: post = Post.query.filter_by(id=post_id).first() if not post: abort(404) return post else: args = parsers.post_get_parser.parse_args() page = args['page'] or 1 if args['user']: ...
Restful API of posts resource.
PostApi
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostApi: """Restful API of posts resource.""" def get(self, post_id=None): """Can be execute when receive HTTP Method `GET`. Will be return the Dict object as post_fields.""" <|body_0|> def post(self, post_id=None): """Can be execute when receive HTTP Method `POS...
stack_v2_sparse_classes_36k_train_025020
4,835
permissive
[ { "docstring": "Can be execute when receive HTTP Method `GET`. Will be return the Dict object as post_fields.", "name": "get", "signature": "def get(self, post_id=None)" }, { "docstring": "Can be execute when receive HTTP Method `POST`.", "name": "post", "signature": "def post(self, post...
4
stack_v2_sparse_classes_30k_train_012516
Implement the Python class `PostApi` described below. Class description: Restful API of posts resource. Method signatures and docstrings: - def get(self, post_id=None): Can be execute when receive HTTP Method `GET`. Will be return the Dict object as post_fields. - def post(self, post_id=None): Can be execute when rec...
Implement the Python class `PostApi` described below. Class description: Restful API of posts resource. Method signatures and docstrings: - def get(self, post_id=None): Can be execute when receive HTTP Method `GET`. Will be return the Dict object as post_fields. - def post(self, post_id=None): Can be execute when rec...
b05ed73210ab7ebdaa39d8ebcf9687d4ef16125c
<|skeleton|> class PostApi: """Restful API of posts resource.""" def get(self, post_id=None): """Can be execute when receive HTTP Method `GET`. Will be return the Dict object as post_fields.""" <|body_0|> def post(self, post_id=None): """Can be execute when receive HTTP Method `POS...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostApi: """Restful API of posts resource.""" def get(self, post_id=None): """Can be execute when receive HTTP Method `GET`. Will be return the Dict object as post_fields.""" if post_id: post = Post.query.filter_by(id=post_id).first() if not post: a...
the_stack_v2_python_sparse
flask/JmilkFan-s-Blog-master/jmilkfansblog/controllers/flask_restful/posts.py
chenzhenpin/py_test
train
0
73e8babfd5e0e672e15a5b6968724ece0cf6a44c
[ "players = get_object_or_404(player, pk=pk)\nuser = request.user\nplayers.voters.remove(user)\nplayers.save()\nserializer_context = {'request': request}\nserializer = self.serializer_class(players, context=serializer_context)\nreturn Response(serializer.data, status=status.HTTP_200_OK)", "players = get_object_or_...
<|body_start_0|> players = get_object_or_404(player, pk=pk) user = request.user players.voters.remove(user) players.save() serializer_context = {'request': request} serializer = self.serializer_class(players, context=serializer_context) return Response(serializer....
Allow users to add/remove a like to/from an answer instance.
PlayerLikeAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlayerLikeAPIView: """Allow users to add/remove a like to/from an answer instance.""" def delete(self, request, pk): """Remove request.user from the voters queryset of an answer instance.""" <|body_0|> def post(self, request, pk): """Add request.user to the voter...
stack_v2_sparse_classes_36k_train_025021
10,756
no_license
[ { "docstring": "Remove request.user from the voters queryset of an answer instance.", "name": "delete", "signature": "def delete(self, request, pk)" }, { "docstring": "Add request.user to the voters queryset of an answer instance.", "name": "post", "signature": "def post(self, request, p...
2
stack_v2_sparse_classes_30k_val_000859
Implement the Python class `PlayerLikeAPIView` described below. Class description: Allow users to add/remove a like to/from an answer instance. Method signatures and docstrings: - def delete(self, request, pk): Remove request.user from the voters queryset of an answer instance. - def post(self, request, pk): Add requ...
Implement the Python class `PlayerLikeAPIView` described below. Class description: Allow users to add/remove a like to/from an answer instance. Method signatures and docstrings: - def delete(self, request, pk): Remove request.user from the voters queryset of an answer instance. - def post(self, request, pk): Add requ...
e74237fd26226afa108d981c95e962c72ab4b11a
<|skeleton|> class PlayerLikeAPIView: """Allow users to add/remove a like to/from an answer instance.""" def delete(self, request, pk): """Remove request.user from the voters queryset of an answer instance.""" <|body_0|> def post(self, request, pk): """Add request.user to the voter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlayerLikeAPIView: """Allow users to add/remove a like to/from an answer instance.""" def delete(self, request, pk): """Remove request.user from the voters queryset of an answer instance.""" players = get_object_or_404(player, pk=pk) user = request.user players.voters.remo...
the_stack_v2_python_sparse
battlesoccer/app/api/views.py
battlesocce/tournament
train
0
d769422300e8714038fd3f4a8d75586abd1eade8
[ "Source.__init__(self)\nself.note_handles = []\nself.repositories = []", "if 'batch_id' in kwargs:\n batch_id = kwargs['batch_id']\nelse:\n raise RuntimeError(f'Source_gramps.save needs batch_id for {self.id}')\nself.uuid = self.newUuid()\ns_attr = {}\ntry:\n s_attr = {'uuid': self.uuid, 'handle': self.h...
<|body_start_0|> Source.__init__(self) self.note_handles = [] self.repositories = [] <|end_body_0|> <|body_start_1|> if 'batch_id' in kwargs: batch_id = kwargs['batch_id'] else: raise RuntimeError(f'Source_gramps.save needs batch_id for {self.id}') ...
Genealogical data source from Gramps xml file. Properties: handle change id esim. "S0001" stitle str lähteen otsikko sauthor str lähteen tekijä spubinfo str lähteen julkaisutiedot note_handles[] str list note handles (ent. noteref_hlink) repositories[] Repository object containing prev. reporef_hlink and reporef_medium
Source_gramps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Source_gramps: """Genealogical data source from Gramps xml file. Properties: handle change id esim. "S0001" stitle str lähteen otsikko sauthor str lähteen tekijä spubinfo str lähteen julkaisutiedot note_handles[] str list note handles (ent. noteref_hlink) repositories[] Repository object containi...
stack_v2_sparse_classes_36k_train_025022
4,580
no_license
[ { "docstring": "Creates a Source instance for Gramps xml upload.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Saves this Source and connect it to Notes and Repositories.", "name": "save", "signature": "def save(self, tx, **kwargs)" } ]
2
null
Implement the Python class `Source_gramps` described below. Class description: Genealogical data source from Gramps xml file. Properties: handle change id esim. "S0001" stitle str lähteen otsikko sauthor str lähteen tekijä spubinfo str lähteen julkaisutiedot note_handles[] str list note handles (ent. noteref_hlink) re...
Implement the Python class `Source_gramps` described below. Class description: Genealogical data source from Gramps xml file. Properties: handle change id esim. "S0001" stitle str lähteen otsikko sauthor str lähteen tekijä spubinfo str lähteen julkaisutiedot note_handles[] str list note handles (ent. noteref_hlink) re...
0f8d6ba035e3cca8dc756531b7cc51029a549a4f
<|skeleton|> class Source_gramps: """Genealogical data source from Gramps xml file. Properties: handle change id esim. "S0001" stitle str lähteen otsikko sauthor str lähteen tekijä spubinfo str lähteen julkaisutiedot note_handles[] str list note handles (ent. noteref_hlink) repositories[] Repository object containi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Source_gramps: """Genealogical data source from Gramps xml file. Properties: handle change id esim. "S0001" stitle str lähteen otsikko sauthor str lähteen tekijä spubinfo str lähteen julkaisutiedot note_handles[] str list note handles (ent. noteref_hlink) repositories[] Repository object containing prev. repo...
the_stack_v2_python_sparse
bp/gramps/models/source_gramps.py
kkujansuu/stk
train
0
ce24a91ca8b71e0eb47145a13fcb9a5e8b16dc81
[ "if digits == '':\n return []\nself.letters = dict()\nself.letters['2'] = ['a', 'b', 'c']\nself.letters['3'] = ['d', 'e', 'f']\nself.letters['4'] = ['g', 'h', 'i']\nself.letters['5'] = ['j', 'k', 'l']\nself.letters['6'] = ['m', 'n', 'o']\nself.letters['7'] = ['p', 'q', 'r', 's']\nself.letters['8'] = ['t', 'u', '...
<|body_start_0|> if digits == '': return [] self.letters = dict() self.letters['2'] = ['a', 'b', 'c'] self.letters['3'] = ['d', 'e', 'f'] self.letters['4'] = ['g', 'h', 'i'] self.letters['5'] = ['j', 'k', 'l'] self.letters['6'] = ['m', 'n', 'o'] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def _letterCombinations(self, curr_str, digits): """Helper method to compute letter combinations of a digit""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025023
1,142
no_license
[ { "docstring": ":type digits: str :rtype: List[str]", "name": "letterCombinations", "signature": "def letterCombinations(self, digits)" }, { "docstring": "Helper method to compute letter combinations of a digit", "name": "_letterCombinations", "signature": "def _letterCombinations(self, ...
2
stack_v2_sparse_classes_30k_test_000784
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def _letterCombinations(self, curr_str, digits): Helper method to compute letter combinations of a dig...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def _letterCombinations(self, curr_str, digits): Helper method to compute letter combinations of a dig...
43dbcc129de3092d1ef24b95eaf35e20363cbd93
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def _letterCombinations(self, curr_str, digits): """Helper method to compute letter combinations of a digit""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" if digits == '': return [] self.letters = dict() self.letters['2'] = ['a', 'b', 'c'] self.letters['3'] = ['d', 'e', 'f'] self.letters['4'] = ['g', 'h', 'i'] ...
the_stack_v2_python_sparse
letter-combinations-of-a-phone-number.py
iyyuan/leetcode-practice
train
0
692d9d81bd566d70c7fad026a9fb881f60bf92ef
[ "update_interval = REST_SENSORS_UPDATE_INTERVAL\nif device.settings['device']['type'] in BATTERY_DEVICES_WITH_PERMANENT_CONNECTION:\n update_interval = SLEEP_PERIOD_MULTIPLIER * device.settings['coiot']['update_period']\nsuper().__init__(hass, entry, device, update_interval)", "LOGGER.debug('REST update for %s...
<|body_start_0|> update_interval = REST_SENSORS_UPDATE_INTERVAL if device.settings['device']['type'] in BATTERY_DEVICES_WITH_PERMANENT_CONNECTION: update_interval = SLEEP_PERIOD_MULTIPLIER * device.settings['coiot']['update_period'] super().__init__(hass, entry, device, update_interv...
Coordinator for a Shelly REST device.
ShellyRestCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShellyRestCoordinator: """Coordinator for a Shelly REST device.""" def __init__(self, hass: HomeAssistant, device: BlockDevice, entry: ConfigEntry) -> None: """Initialize the Shelly REST device coordinator.""" <|body_0|> async def _async_update_data(self) -> None: ...
stack_v2_sparse_classes_36k_train_025024
24,604
permissive
[ { "docstring": "Initialize the Shelly REST device coordinator.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, device: BlockDevice, entry: ConfigEntry) -> None" }, { "docstring": "Fetch data.", "name": "_async_update_data", "signature": "async def _async_updat...
2
stack_v2_sparse_classes_30k_train_003487
Implement the Python class `ShellyRestCoordinator` described below. Class description: Coordinator for a Shelly REST device. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, device: BlockDevice, entry: ConfigEntry) -> None: Initialize the Shelly REST device coordinator. - async def _async_u...
Implement the Python class `ShellyRestCoordinator` described below. Class description: Coordinator for a Shelly REST device. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, device: BlockDevice, entry: ConfigEntry) -> None: Initialize the Shelly REST device coordinator. - async def _async_u...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ShellyRestCoordinator: """Coordinator for a Shelly REST device.""" def __init__(self, hass: HomeAssistant, device: BlockDevice, entry: ConfigEntry) -> None: """Initialize the Shelly REST device coordinator.""" <|body_0|> async def _async_update_data(self) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShellyRestCoordinator: """Coordinator for a Shelly REST device.""" def __init__(self, hass: HomeAssistant, device: BlockDevice, entry: ConfigEntry) -> None: """Initialize the Shelly REST device coordinator.""" update_interval = REST_SENSORS_UPDATE_INTERVAL if device.settings['devi...
the_stack_v2_python_sparse
homeassistant/components/shelly/coordinator.py
home-assistant/core
train
35,501
591fefc123a82c64cb171ed030cfb6cb4e42aefc
[ "if n_qubits <= 0:\n raise ValueError('Operator must operate on at least 1 qubit!')\nself.n_qubits = n_qubits\nself.size = 2 ** n_qubits\nif self.size < len(base):\n raise ValueError('Operator cannot act on the specified number' + 'of qubits.')\nact_qubits = int(np.log2(len(base)))\nbase_matrix = SparseMatrix...
<|body_start_0|> if n_qubits <= 0: raise ValueError('Operator must operate on at least 1 qubit!') self.n_qubits = n_qubits self.size = 2 ** n_qubits if self.size < len(base): raise ValueError('Operator cannot act on the specified number' + 'of qubits.') ac...
Operator class inherits from SparceMatrix
Operator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Operator: """Operator class inherits from SparceMatrix""" def __init__(self, n_qubits: int=1, base=np.zeros((2, 2))): """Class constructor Inputs: n_qubits <int>: Number of qubits the oparator acts on base <np.array>: Matrix representation for the operators""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_025025
3,117
no_license
[ { "docstring": "Class constructor Inputs: n_qubits <int>: Number of qubits the oparator acts on base <np.array>: Matrix representation for the operators", "name": "__init__", "signature": "def __init__(self, n_qubits: int=1, base=np.zeros((2, 2)))" }, { "docstring": ":return: (QuantumRegister / ...
3
stack_v2_sparse_classes_30k_train_019112
Implement the Python class `Operator` described below. Class description: Operator class inherits from SparceMatrix Method signatures and docstrings: - def __init__(self, n_qubits: int=1, base=np.zeros((2, 2))): Class constructor Inputs: n_qubits <int>: Number of qubits the oparator acts on base <np.array>: Matrix re...
Implement the Python class `Operator` described below. Class description: Operator class inherits from SparceMatrix Method signatures and docstrings: - def __init__(self, n_qubits: int=1, base=np.zeros((2, 2))): Class constructor Inputs: n_qubits <int>: Number of qubits the oparator acts on base <np.array>: Matrix re...
488aeaacf84b9019c967a1f118818a96445b9eb5
<|skeleton|> class Operator: """Operator class inherits from SparceMatrix""" def __init__(self, n_qubits: int=1, base=np.zeros((2, 2))): """Class constructor Inputs: n_qubits <int>: Number of qubits the oparator acts on base <np.array>: Matrix representation for the operators""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Operator: """Operator class inherits from SparceMatrix""" def __init__(self, n_qubits: int=1, base=np.zeros((2, 2))): """Class constructor Inputs: n_qubits <int>: Number of qubits the oparator acts on base <np.array>: Matrix representation for the operators""" if n_qubits <= 0: ...
the_stack_v2_python_sparse
QCP-Group-1-2019/src/quantum_operator.py
IainMcl/Quantum-Computing-Project
train
0
ef28dba2899646192d7caf2ae8c731db744294aa
[ "specs = super().getInputSpecification()\nspecs.name = 'logtransformer'\nspecs.description = 'applies the natural logarithm to the data and inverts by applying the\\n exponential function.'\nreturn specs", "for t, (target, data) in enumerate(params.items()):\n if np.any(initial[:, t] <= ...
<|body_start_0|> specs = super().getInputSpecification() specs.name = 'logtransformer' specs.description = 'applies the natural logarithm to the data and inverts by applying the\n exponential function.' return specs <|end_body_0|> <|body_start_1|> for t, (...
Wrapper of scikit-learn's FunctionTransformer for np.log/np.exp
LogTransformer
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogTransformer: """Wrapper of scikit-learn's FunctionTransformer for np.log/np.exp""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying in...
stack_v2_sparse_classes_36k_train_025026
6,301
permissive
[ { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls.", "name": "getInputSpecification", "signature": "def getInputSpecification(cls)" }, { "docstring": "Remov...
2
null
Implement the Python class `LogTransformer` described below. Class description: Wrapper of scikit-learn's FunctionTransformer for np.log/np.exp Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs,...
Implement the Python class `LogTransformer` described below. Class description: Wrapper of scikit-learn's FunctionTransformer for np.log/np.exp Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs,...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class LogTransformer: """Wrapper of scikit-learn's FunctionTransformer for np.log/np.exp""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogTransformer: """Wrapper of scikit-learn's FunctionTransformer for np.log/np.exp""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls.""...
the_stack_v2_python_sparse
ravenframework/TSA/Transformers/FunctionTransformers.py
idaholab/raven
train
201
2df5df756ce58a338d527cf8296f173414b6e2d5
[ "if tokenizer_args is None:\n tokenizer_args = {}\ntokenizer_options = []\nif arg_separator != ' ':\n tokenizer_options = [option + arg_separator + str(tokenizer_args[option]) for option in tokenizer_args]\nelse:\n for option in tokenizer_args:\n tokenizer_options.extend([option, str(tokenizer_args[...
<|body_start_0|> if tokenizer_args is None: tokenizer_args = {} tokenizer_options = [] if arg_separator != ' ': tokenizer_options = [option + arg_separator + str(tokenizer_args[option]) for option in tokenizer_args] else: for option in tokenizer_args: ...
Class for arbitrary external tokenizer that accepts untokenized text to stdin and emits tokenized tezt to stdout, with passable parameters. It is assumed that in general, external tokenizers will be more efficient when run once per file, so are run as such (instead of one-execution-per-line.) Args: path tokenizer_args ...
ExternalTokenizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalTokenizer: """Class for arbitrary external tokenizer that accepts untokenized text to stdin and emits tokenized tezt to stdout, with passable parameters. It is assumed that in general, external tokenizers will be more efficient when run once per file, so are run as such (instead of one-ex...
stack_v2_sparse_classes_36k_train_025027
32,168
permissive
[ { "docstring": "Initialize the wrapper around the external tokenizer.", "name": "__init__", "signature": "def __init__(self, path: str, tokenizer_args: Optional[Sequence[str]]=None, arg_separator: str=' ') -> None" }, { "docstring": "Pass the sentence through the external tokenizer. Args: sent: ...
2
stack_v2_sparse_classes_30k_train_017609
Implement the Python class `ExternalTokenizer` described below. Class description: Class for arbitrary external tokenizer that accepts untokenized text to stdin and emits tokenized tezt to stdout, with passable parameters. It is assumed that in general, external tokenizers will be more efficient when run once per file...
Implement the Python class `ExternalTokenizer` described below. Class description: Class for arbitrary external tokenizer that accepts untokenized text to stdin and emits tokenized tezt to stdout, with passable parameters. It is assumed that in general, external tokenizers will be more efficient when run once per file...
b5e6985d3bedfac102312cab030a60594bc17baf
<|skeleton|> class ExternalTokenizer: """Class for arbitrary external tokenizer that accepts untokenized text to stdin and emits tokenized tezt to stdout, with passable parameters. It is assumed that in general, external tokenizers will be more efficient when run once per file, so are run as such (instead of one-ex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExternalTokenizer: """Class for arbitrary external tokenizer that accepts untokenized text to stdin and emits tokenized tezt to stdout, with passable parameters. It is assumed that in general, external tokenizers will be more efficient when run once per file, so are run as such (instead of one-execution-per-l...
the_stack_v2_python_sparse
xnmt/preproc.py
philip30/xnmt
train
0
15300c101c7ff9642e06e2278c5842b425ccddc0
[ "Report.__init__(self, database, options, user)\nself._user = user\nself.set_locale(options.menu.get_option_by_name('trans').get_value())", "mark = IndexMark(self._('Table Of Contents'), INDEX_TYPE_TOC, 1)\nself.doc.start_paragraph('TOC-Title')\nself.doc.write_text('', mark)\nself.doc.end_paragraph()\nself.doc.to...
<|body_start_0|> Report.__init__(self, database, options, user) self._user = user self.set_locale(options.menu.get_option_by_name('trans').get_value()) <|end_body_0|> <|body_start_1|> mark = IndexMark(self._('Table Of Contents'), INDEX_TYPE_TOC, 1) self.doc.start_paragraph('TOC-...
This report class generates a table of contents for a book.
TableOfContents
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TableOfContents: """This report class generates a table of contents for a book.""" def __init__(self, database, options, user): """Create TableOfContents object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options clas...
stack_v2_sparse_classes_36k_train_025028
4,800
no_license
[ { "docstring": "Create TableOfContents object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance", "name": "__init__", "signature": "def __init__(self, database, options, user)" ...
2
null
Implement the Python class `TableOfContents` described below. Class description: This report class generates a table of contents for a book. Method signatures and docstrings: - def __init__(self, database, options, user): Create TableOfContents object that produces the report. The arguments are: database - the GRAMPS...
Implement the Python class `TableOfContents` described below. Class description: This report class generates a table of contents for a book. Method signatures and docstrings: - def __init__(self, database, options, user): Create TableOfContents object that produces the report. The arguments are: database - the GRAMPS...
0c79561bed7ff42c88714edbc85197fa9235e188
<|skeleton|> class TableOfContents: """This report class generates a table of contents for a book.""" def __init__(self, database, options, user): """Create TableOfContents object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options clas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TableOfContents: """This report class generates a table of contents for a book.""" def __init__(self, database, options, user): """Create TableOfContents object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this re...
the_stack_v2_python_sparse
plugins/textreport/tableofcontents.py
balrok/gramps_addon
train
2
04f2e2a2b2c56f38744dda340891b0fbcc2f646f
[ "super(CustomRNN, self).__init__()\nself.hidden_size = hidden_size\nself.rnn_type = rnn_type\nself.vocab_size = vocab_size\nself.num_layers = num_layers\nself.net = nn.ModuleList()\nfor i in range(num_layers):\n if rnn_type == 'basic_rnn':\n if i == 0:\n self.net.append(BasicRNNCell(vocab_size,...
<|body_start_0|> super(CustomRNN, self).__init__() self.hidden_size = hidden_size self.rnn_type = rnn_type self.vocab_size = vocab_size self.num_layers = num_layers self.net = nn.ModuleList() for i in range(num_layers): if rnn_type == 'basic_rnn': ...
CustomRNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomRNN: def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): """Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell A...
stack_v2_sparse_classes_36k_train_025029
4,622
no_license
[ { "docstring": "Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell Arguments --------- vocab_size: (int), the number of unique characters in the corpus. This is the number...
2
stack_v2_sparse_classes_30k_train_008388
Implement the Python class `CustomRNN` described below. Class description: Implement the CustomRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose lay...
Implement the Python class `CustomRNN` described below. Class description: Implement the CustomRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose lay...
07703e76f49d9be86b39d7c2af1ee1e0efe07031
<|skeleton|> class CustomRNN: def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): """Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomRNN: def __init__(self, vocab_size, hidden_size, num_layers=1, rnn_type='basic_rnn'): """Creates an recurrent neural network of type {basic_rnn, lstm_rnn} basic_rnn is an rnn whose layers implement a tanH activation function lstm_rnn is ann rnn whose layers implement an LSTM cell Arguments -----...
the_stack_v2_python_sparse
DL_HW/Jialing_Wu_HW4/create_rnn.py
muzhiBryn/ML_DL_at-Dartmouth
train
0
39132d568ce373d0516bb6a7afa7b2ee5455bc6c
[ "super(LandsatBandstack, self).__init__(dataset.metadata_dict)\nself.dataset = dataset\nself.band_dict = OrderedDict(sorted(band_dict.items(), key=lambda t: t[0]))\nself.source_file_list = None\nself.nodata_list = None\nself.vrt_name = None\nself.vrt_band_stack = None", "self.source_file_list, self.nodata_list = ...
<|body_start_0|> super(LandsatBandstack, self).__init__(dataset.metadata_dict) self.dataset = dataset self.band_dict = OrderedDict(sorted(band_dict.items(), key=lambda t: t[0])) self.source_file_list = None self.nodata_list = None self.vrt_name = None self.vrt_ban...
Landsat subclass of AbstractBandstack class
LandsatBandstack
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LandsatBandstack: """Landsat subclass of AbstractBandstack class""" def __init__(self, dataset, band_dict): """The bandstack allows for the construction of a list, or stack, of bands from the given dataset.""" <|body_0|> def buildvrt(self, temp_dir): """Given a d...
stack_v2_sparse_classes_36k_train_025030
6,670
permissive
[ { "docstring": "The bandstack allows for the construction of a list, or stack, of bands from the given dataset.", "name": "__init__", "signature": "def __init__(self, dataset, band_dict)" }, { "docstring": "Given a dataset_record and corresponding dataset, build the vrt that will be used to repr...
5
stack_v2_sparse_classes_30k_train_005791
Implement the Python class `LandsatBandstack` described below. Class description: Landsat subclass of AbstractBandstack class Method signatures and docstrings: - def __init__(self, dataset, band_dict): The bandstack allows for the construction of a list, or stack, of bands from the given dataset. - def buildvrt(self,...
Implement the Python class `LandsatBandstack` described below. Class description: Landsat subclass of AbstractBandstack class Method signatures and docstrings: - def __init__(self, dataset, band_dict): The bandstack allows for the construction of a list, or stack, of bands from the given dataset. - def buildvrt(self,...
05fdfdad0100875ffa72ebdd41d32ad3a7a213bc
<|skeleton|> class LandsatBandstack: """Landsat subclass of AbstractBandstack class""" def __init__(self, dataset, band_dict): """The bandstack allows for the construction of a list, or stack, of bands from the given dataset.""" <|body_0|> def buildvrt(self, temp_dir): """Given a d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LandsatBandstack: """Landsat subclass of AbstractBandstack class""" def __init__(self, dataset, band_dict): """The bandstack allows for the construction of a list, or stack, of bands from the given dataset.""" super(LandsatBandstack, self).__init__(dataset.metadata_dict) self.data...
the_stack_v2_python_sparse
agdc/agdc/landsat_ingester/landsat_bandstack.py
jharrison902/Data-Cube
train
0
a6060d8832484d2996c8dfa132d32b9d5b986de1
[ "if map_protocol.lower() == 'wms':\n return MapService.proxy_request_to_geoserver(map_protocol, query_string)\nelif map_protocol.lower() == 'geojson':\n return MapService.handle_geojson_request(query_string)\nelse:\n raise MapServiceClientError(f'Unknown map protocol: {map_protocol}')", "layer_source = M...
<|body_start_0|> if map_protocol.lower() == 'wms': return MapService.proxy_request_to_geoserver(map_protocol, query_string) elif map_protocol.lower() == 'geojson': return MapService.handle_geojson_request(query_string) else: raise MapServiceClientError(f'Unkno...
MapService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapService: def handle_map_request(map_protocol: str, query_string: str) -> Response: """Handler looks at request protocol and then determines how to process the request""" <|body_0|> def handle_geojson_request(query_string: str) -> Response: """Validate that request...
stack_v2_sparse_classes_36k_train_025031
4,038
no_license
[ { "docstring": "Handler looks at request protocol and then determines how to process the request", "name": "handle_map_request", "signature": "def handle_map_request(map_protocol: str, query_string: str) -> Response" }, { "docstring": "Validate that request if for a known geojson datasource, the...
5
stack_v2_sparse_classes_30k_train_009164
Implement the Python class `MapService` described below. Class description: Implement the MapService class. Method signatures and docstrings: - def handle_map_request(map_protocol: str, query_string: str) -> Response: Handler looks at request protocol and then determines how to process the request - def handle_geojso...
Implement the Python class `MapService` described below. Class description: Implement the MapService class. Method signatures and docstrings: - def handle_map_request(map_protocol: str, query_string: str) -> Response: Handler looks at request protocol and then determines how to process the request - def handle_geojso...
8c851d2f740100c43f7b033f64adfa5a0d563f39
<|skeleton|> class MapService: def handle_map_request(map_protocol: str, query_string: str) -> Response: """Handler looks at request protocol and then determines how to process the request""" <|body_0|> def handle_geojson_request(query_string: str) -> Response: """Validate that request...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MapService: def handle_map_request(map_protocol: str, query_string: str) -> Response: """Handler looks at request protocol and then determines how to process the request""" if map_protocol.lower() == 'wms': return MapService.proxy_request_to_geoserver(map_protocol, query_string) ...
the_stack_v2_python_sparse
server/services/mapping/map_service.py
thinkWhere/DMIS
train
4
33684d71c7d1159b255c60d12c74aa03f8e028b0
[ "self.s3_output_path = s3_output_path\nself.container_local_output_path = container_local_output_path\nself.hook_parameters = hook_parameters\nself.collection_configs = collection_configs", "debugger_hook_config_request = {'S3OutputPath': self.s3_output_path}\nif self.container_local_output_path is not None:\n ...
<|body_start_0|> self.s3_output_path = s3_output_path self.container_local_output_path = container_local_output_path self.hook_parameters = hook_parameters self.collection_configs = collection_configs <|end_body_0|> <|body_start_1|> debugger_hook_config_request = {'S3OutputPath'...
Create a Debugger hook configuration object to save the tensor for debugging. DebuggerHookConfig provides options to customize how debugging information is emitted and saved. This high-level DebuggerHookConfig class runs based on the `smdebug.SaveConfig <https://github.com/awslabs/sagemaker-debugger/blob/master/docs/ a...
DebuggerHookConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DebuggerHookConfig: """Create a Debugger hook configuration object to save the tensor for debugging. DebuggerHookConfig provides options to customize how debugging information is emitted and saved. This high-level DebuggerHookConfig class runs based on the `smdebug.SaveConfig <https://github.com/...
stack_v2_sparse_classes_36k_train_025032
42,015
permissive
[ { "docstring": "Initialize the DebuggerHookConfig instance. Args: s3_output_path (str or PipelineVariable): Optional. The location in Amazon S3 to store the output tensors. The default Debugger output path is created under the default output path of the :class:`~sagemaker.estimator.Estimator` class. For example...
2
stack_v2_sparse_classes_30k_test_001042
Implement the Python class `DebuggerHookConfig` described below. Class description: Create a Debugger hook configuration object to save the tensor for debugging. DebuggerHookConfig provides options to customize how debugging information is emitted and saved. This high-level DebuggerHookConfig class runs based on the `...
Implement the Python class `DebuggerHookConfig` described below. Class description: Create a Debugger hook configuration object to save the tensor for debugging. DebuggerHookConfig provides options to customize how debugging information is emitted and saved. This high-level DebuggerHookConfig class runs based on the `...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class DebuggerHookConfig: """Create a Debugger hook configuration object to save the tensor for debugging. DebuggerHookConfig provides options to customize how debugging information is emitted and saved. This high-level DebuggerHookConfig class runs based on the `smdebug.SaveConfig <https://github.com/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DebuggerHookConfig: """Create a Debugger hook configuration object to save the tensor for debugging. DebuggerHookConfig provides options to customize how debugging information is emitted and saved. This high-level DebuggerHookConfig class runs based on the `smdebug.SaveConfig <https://github.com/awslabs/sagem...
the_stack_v2_python_sparse
src/sagemaker/debugger/debugger.py
aws/sagemaker-python-sdk
train
2,050
48b7448c62d20140413ba9b699395f4e552895ce
[ "gray = []\nfor num in range(1 << n):\n gray.append(num ^ num >> 1)\nreturn gray", "gray = [0]\nfor i in range(1, 2 ** n):\n gray.append(gray[-1] ^ i & -i)\nreturn gray" ]
<|body_start_0|> gray = [] for num in range(1 << n): gray.append(num ^ num >> 1) return gray <|end_body_0|> <|body_start_1|> gray = [0] for i in range(1, 2 ** n): gray.append(gray[-1] ^ i & -i) return gray <|end_body_1|>
GrayCode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GrayCode: def generates(self, n: int) -> List[int]: """Approach: Bit Manipulation Time Complexity: O(N) Space Complexity: O(N) Formulae: i xor (i >> 1) :param n: :return:""" <|body_0|> def generate(self, n: int) -> List[int]: """Approach: Bit Manipulation Formulae: r...
stack_v2_sparse_classes_36k_train_025033
1,190
no_license
[ { "docstring": "Approach: Bit Manipulation Time Complexity: O(N) Space Complexity: O(N) Formulae: i xor (i >> 1) :param n: :return:", "name": "generates", "signature": "def generates(self, n: int) -> List[int]" }, { "docstring": "Approach: Bit Manipulation Formulae: res[-1] xor (Y & - Y) Time Co...
2
null
Implement the Python class `GrayCode` described below. Class description: Implement the GrayCode class. Method signatures and docstrings: - def generates(self, n: int) -> List[int]: Approach: Bit Manipulation Time Complexity: O(N) Space Complexity: O(N) Formulae: i xor (i >> 1) :param n: :return: - def generate(self,...
Implement the Python class `GrayCode` described below. Class description: Implement the GrayCode class. Method signatures and docstrings: - def generates(self, n: int) -> List[int]: Approach: Bit Manipulation Time Complexity: O(N) Space Complexity: O(N) Formulae: i xor (i >> 1) :param n: :return: - def generate(self,...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class GrayCode: def generates(self, n: int) -> List[int]: """Approach: Bit Manipulation Time Complexity: O(N) Space Complexity: O(N) Formulae: i xor (i >> 1) :param n: :return:""" <|body_0|> def generate(self, n: int) -> List[int]: """Approach: Bit Manipulation Formulae: r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GrayCode: def generates(self, n: int) -> List[int]: """Approach: Bit Manipulation Time Complexity: O(N) Space Complexity: O(N) Formulae: i xor (i >> 1) :param n: :return:""" gray = [] for num in range(1 << n): gray.append(num ^ num >> 1) return gray def generat...
the_stack_v2_python_sparse
revisited/math_and_strings/bitwise_operator/gray_code.py
Shiv2157k/leet_code
train
1
76f32816b81a2645b48c5f143d13198f86ec11e7
[ "if isinstance(value, unicode):\n return value.encode('utf-8')\nelif isinstance(value, field.SEQUENCE_TYPES):\n if value and len(value) == 1:\n value = value[0]\n elif not value:\n value = ''\n else:\n value = ''.join(value)\nif not isinstance(value, str):\n value = str(value)\nr...
<|body_start_0|> if isinstance(value, unicode): return value.encode('utf-8') elif isinstance(value, field.SEQUENCE_TYPES): if value and len(value) == 1: value = value[0] elif not value: value = '' else: value...
SFString field/event type base-class
_SFString
[ "GPL-1.0-or-later", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SFString: """SFString field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence o...
stack_v2_sparse_classes_36k_train_025034
34,853
permissive
[ { "docstring": "Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence of length > 1 where all elements are strings -> returns string.join( value, '')", "name": "...
2
stack_v2_sparse_classes_30k_train_011648
Implement the Python class `_SFString` described below. Class description: SFString field/event type base-class Method signatures and docstrings: - def coerce(self, value): Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where firs...
Implement the Python class `_SFString` described below. Class description: SFString field/event type base-class Method signatures and docstrings: - def coerce(self, value): Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where firs...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class _SFString: """SFString field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _SFString: """SFString field/event type base-class""" def coerce(self, value): """Coerce the given value to our type Allowable types: simple string -> unchanged unicode string -> utf-8 encoded sequence of length == 1 where first element is a string -> returns first element sequence of length > 1 ...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py
alexus37/AugmentedRealityChess
train
1
b6d751bee3e871bce59453d32b8c4bb19b1aa645
[ "self.parser = reqparse.RequestParser()\nself.parser.add_argument('vtSymbol')\nsuper(Tick, self).__init__()", "args = self.parser.parse_args()\nvtSymbol = args['vtSymbol']\ncontract = me.getContract(vtSymbol)\nif not contract:\n return {'result_code': 'error', 'message': 'contract error'}\nreq = VtSubscribeReq...
<|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('vtSymbol') super(Tick, self).__init__() <|end_body_0|> <|body_start_1|> args = self.parser.parse_args() vtSymbol = args['vtSymbol'] contract = me.getContract(vtSymbol) if not contra...
行情
Tick
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tick: """行情""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('vtSymbol') super(Tick, self).__init__(...
stack_v2_sparse_classes_36k_train_025035
24,002
permissive
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "订阅", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_000341
Implement the Python class `Tick` described below. Class description: 行情 Method signatures and docstrings: - def __init__(self): 初始化 - def post(self): 订阅
Implement the Python class `Tick` described below. Class description: 行情 Method signatures and docstrings: - def __init__(self): 初始化 - def post(self): 订阅 <|skeleton|> class Tick: """行情""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅""" <|body_1|> <|end...
c316649161086da2543d39bf0455d0f793cdd08f
<|skeleton|> class Tick: """行情""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tick: """行情""" def __init__(self): """初始化""" self.parser = reqparse.RequestParser() self.parser.add_argument('vtSymbol') super(Tick, self).__init__() def post(self): """订阅""" args = self.parser.parse_args() vtSymbol = args['vtSymbol'] c...
the_stack_v2_python_sparse
WebTrader/webServer.py
webclinic017/riskBacktestingPlatform
train
0
4c7151c381244afa91b1678239a2103fb64725fa
[ "super().__init__()\nself.cnn_layers = nn.Sequential()\nself.fc_layers = nn.Sequential()\nself.loss_criterion = None\nself.cnn_layers = nn.Sequential(nn.Conv2d(1, 10, kernel_size=5), nn.MaxPool2d(kernel_size=3), nn.ReLU(), nn.Conv2d(10, 20, kernel_size=5), nn.MaxPool2d(kernel_size=3), nn.ReLU())\nself.fc_layers = n...
<|body_start_0|> super().__init__() self.cnn_layers = nn.Sequential() self.fc_layers = nn.Sequential() self.loss_criterion = None self.cnn_layers = nn.Sequential(nn.Conv2d(1, 10, kernel_size=5), nn.MaxPool2d(kernel_size=3), nn.ReLU(), nn.Conv2d(10, 20, kernel_size=5), nn.MaxPool2...
SimpleNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleNet: def __init__(self): """Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means""" <|body_0|> def forward(self, x: torch.tensor) -> torch.tensor: """Perform t...
stack_v2_sparse_classes_36k_train_025036
2,085
no_license
[ { "docstring": "Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Perform the forward pass with the net Args: - x: t...
2
stack_v2_sparse_classes_30k_train_020511
Implement the Python class `SimpleNet` described below. Class description: Implement the SimpleNet class. Method signatures and docstrings: - def __init__(self): Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means -...
Implement the Python class `SimpleNet` described below. Class description: Implement the SimpleNet class. Method signatures and docstrings: - def __init__(self): Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means -...
79efc17404225c9d5f9845d6e7d8beea6a714a57
<|skeleton|> class SimpleNet: def __init__(self): """Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means""" <|body_0|> def forward(self, x: torch.tensor) -> torch.tensor: """Perform t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleNet: def __init__(self): """Init function to define the layers and loss function Note: Use 'sum' reduction in the loss_criterion. Read Pytorch documention to understand what it means""" super().__init__() self.cnn_layers = nn.Sequential() self.fc_layers = nn.Sequential() ...
the_stack_v2_python_sparse
Project6/simple_net.py
echen67/Computer-Vision
train
1
029f59df7a4007938fefed469693a8f5cedc34e5
[ "if gateway == 'admin_pay':\n request = Request(HttpRequest)\n try:\n setattr(request.user, 'id', orders.user_id)\n except Exception as e:\n return e\nresult = Wallet.update_balance(request=request, orders=orders, method=WALLET_ACTION_METHOD[0])\nif isinstance(result, Exception):\n return ...
<|body_start_0|> if gateway == 'admin_pay': request = Request(HttpRequest) try: setattr(request.user, 'id', orders.user_id) except Exception as e: return e result = Wallet.update_balance(request=request, orders=orders, method=WALLET_ACT...
钱包相关功能
WalletAction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WalletAction: """钱包相关功能""" def recharge(self, request, orders, gateway='auth', does_give_coupons=False): """充值""" <|body_0|> def orders_refund(self, request, orders, gateway='auth'): """订单退款(从订单的应付款中退款到钱包中) 适用场景:1.管理员取消用户的未核销订单(此时需要把订单的应付款返回到用户钱包中)""" <|b...
stack_v2_sparse_classes_36k_train_025037
14,801
no_license
[ { "docstring": "充值", "name": "recharge", "signature": "def recharge(self, request, orders, gateway='auth', does_give_coupons=False)" }, { "docstring": "订单退款(从订单的应付款中退款到钱包中) 适用场景:1.管理员取消用户的未核销订单(此时需要把订单的应付款返回到用户钱包中)", "name": "orders_refund", "signature": "def orders_refund(self, request,...
2
stack_v2_sparse_classes_30k_train_001876
Implement the Python class `WalletAction` described below. Class description: 钱包相关功能 Method signatures and docstrings: - def recharge(self, request, orders, gateway='auth', does_give_coupons=False): 充值 - def orders_refund(self, request, orders, gateway='auth'): 订单退款(从订单的应付款中退款到钱包中) 适用场景:1.管理员取消用户的未核销订单(此时需要把订单的应付款返回到...
Implement the Python class `WalletAction` described below. Class description: 钱包相关功能 Method signatures and docstrings: - def recharge(self, request, orders, gateway='auth', does_give_coupons=False): 充值 - def orders_refund(self, request, orders, gateway='auth'): 订单退款(从订单的应付款中退款到钱包中) 适用场景:1.管理员取消用户的未核销订单(此时需要把订单的应付款返回到...
5a0d42cf794b5e0cd127e625d36e6f8e96812ae5
<|skeleton|> class WalletAction: """钱包相关功能""" def recharge(self, request, orders, gateway='auth', does_give_coupons=False): """充值""" <|body_0|> def orders_refund(self, request, orders, gateway='auth'): """订单退款(从订单的应付款中退款到钱包中) 适用场景:1.管理员取消用户的未核销订单(此时需要把订单的应付款返回到用户钱包中)""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WalletAction: """钱包相关功能""" def recharge(self, request, orders, gateway='auth', does_give_coupons=False): """充值""" if gateway == 'admin_pay': request = Request(HttpRequest) try: setattr(request.user, 'id', orders.user_id) except Exception...
the_stack_v2_python_sparse
Consumer_App/cs_wallet/models.py
dennis1984/YSAdminApp
train
0
9309cdca58cb9dfcd11b68aeda042d44441594ef
[ "super(KeystoneSession, self).__init__()\nself.session = session\nself.endpoint = endpoint", "if not session:\n session = self.session\nif not session:\n session = ks_session.Session()\nif self.endpoint:\n if url:\n url = '/'.join([self.endpoint.rstrip('/'), url.lstrip('/')])\n else:\n u...
<|body_start_0|> super(KeystoneSession, self).__init__() self.session = session self.endpoint = endpoint <|end_body_0|> <|body_start_1|> if not session: session = self.session if not session: session = ks_session.Session() if self.endpoint: ...
Wrapper for the Keystone Session Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world.
KeystoneSession
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeystoneSession: """Wrapper for the Keystone Session Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world.""" def __init__(self, session=None, endpoint=None, **kwargs): ...
stack_v2_sparse_classes_36k_train_025038
9,762
permissive
[ { "docstring": "Base object that contains some common API objects and methods :param Session session: The default session to be used for making the HTTP API calls. :param string endpoint: The URL from the Service Catalog to be used as the base for API requests on this API.", "name": "__init__", "signatu...
2
stack_v2_sparse_classes_30k_train_010637
Implement the Python class `KeystoneSession` described below. Class description: Wrapper for the Keystone Session Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world. Method signatures and docst...
Implement the Python class `KeystoneSession` described below. Class description: Wrapper for the Keystone Session Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world. Method signatures and docst...
78988d1786c0634ee055714910d1e6187f941673
<|skeleton|> class KeystoneSession: """Wrapper for the Keystone Session Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world.""" def __init__(self, session=None, endpoint=None, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeystoneSession: """Wrapper for the Keystone Session Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world.""" def __init__(self, session=None, endpoint=None, **kwargs): """Ba...
the_stack_v2_python_sparse
openstackclient/api/api.py
openstack/python-openstackclient
train
286
ab7d94ff6509aac101925b1ab246dbb74581f0b3
[ "ret = 0\nsign = 1 if x > 0 else -1\nx = abs(x)\nwhile x:\n x, y = divmod(x, 10)\n ret = ret * 10 + y\nreturn ret * sign if -2 ** 31 <= ret <= 2 ** 31 - 1 else 0", "\"\"\"\n >>> s = Solution()\n >>> s.reverse(123)\n 321\n >>> s.reverse(-123)\n -321\n >>> s.reverse(1...
<|body_start_0|> ret = 0 sign = 1 if x > 0 else -1 x = abs(x) while x: x, y = divmod(x, 10) ret = ret * 10 + y return ret * sign if -2 ** 31 <= ret <= 2 ** 31 - 1 else 0 <|end_body_0|> <|body_start_1|> """ >>> s = Solution() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """>>> s = Solution() >>> s.reverse(123) 321 >>> s.reverse(-123) -321 >>> s.reverse(120) 21""" <|body_0|> def reverse2(self, x): """使用中间字符串""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = 0 sign = 1 if x...
stack_v2_sparse_classes_36k_train_025039
1,360
no_license
[ { "docstring": ">>> s = Solution() >>> s.reverse(123) 321 >>> s.reverse(-123) -321 >>> s.reverse(120) 21", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": "使用中间字符串", "name": "reverse2", "signature": "def reverse2(self, x)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): >>> s = Solution() >>> s.reverse(123) 321 >>> s.reverse(-123) -321 >>> s.reverse(120) 21 - def reverse2(self, x): 使用中间字符串
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): >>> s = Solution() >>> s.reverse(123) 321 >>> s.reverse(-123) -321 >>> s.reverse(120) 21 - def reverse2(self, x): 使用中间字符串 <|skeleton|> class Solution: ...
166d97f36bbeea74c84ec57466bd0a65b608ed09
<|skeleton|> class Solution: def reverse(self, x): """>>> s = Solution() >>> s.reverse(123) 321 >>> s.reverse(-123) -321 >>> s.reverse(120) 21""" <|body_0|> def reverse2(self, x): """使用中间字符串""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse(self, x): """>>> s = Solution() >>> s.reverse(123) 321 >>> s.reverse(-123) -321 >>> s.reverse(120) 21""" ret = 0 sign = 1 if x > 0 else -1 x = abs(x) while x: x, y = divmod(x, 10) ret = ret * 10 + y return ret * sign...
the_stack_v2_python_sparse
leetcode/reverse_interger.py
Activity00/Python
train
0
f3eda8bf55090abd0a7a46b70178b3a5cfef4317
[ "Utils.validate_uuid(id_body_zone)\nif not BodyZone.objects.filter(id=id_body_zone).exists():\n raise ValidationError('The body zone ' + id_body_zone + ' is not valid!')", "body_zones_list = QueryService.get_trigram_similarity_results(BodyZone, query)\npaginator = Paginator(body_zones_list, page_size)\nPaginat...
<|body_start_0|> Utils.validate_uuid(id_body_zone) if not BodyZone.objects.filter(id=id_body_zone).exists(): raise ValidationError('The body zone ' + id_body_zone + ' is not valid!') <|end_body_0|> <|body_start_1|> body_zones_list = QueryService.get_trigram_similarity_results(BodyZo...
Service class for body zone related operations
BodyZoneService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BodyZoneService: """Service class for body zone related operations""" def is_valid_body_zone(id_body_zone): """Checks if the specified body zone exists :param id_body_zone: ID of body zone to be checked""" <|body_0|> def list_body_zones(page_num, page_size, path, query='...
stack_v2_sparse_classes_36k_train_025040
1,706
no_license
[ { "docstring": "Checks if the specified body zone exists :param id_body_zone: ID of body zone to be checked", "name": "is_valid_body_zone", "signature": "def is_valid_body_zone(id_body_zone)" }, { "docstring": "Method to list body zones on the system :param page_num: Specified page number :param...
2
null
Implement the Python class `BodyZoneService` described below. Class description: Service class for body zone related operations Method signatures and docstrings: - def is_valid_body_zone(id_body_zone): Checks if the specified body zone exists :param id_body_zone: ID of body zone to be checked - def list_body_zones(pa...
Implement the Python class `BodyZoneService` described below. Class description: Service class for body zone related operations Method signatures and docstrings: - def is_valid_body_zone(id_body_zone): Checks if the specified body zone exists :param id_body_zone: ID of body zone to be checked - def list_body_zones(pa...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class BodyZoneService: """Service class for body zone related operations""" def is_valid_body_zone(id_body_zone): """Checks if the specified body zone exists :param id_body_zone: ID of body zone to be checked""" <|body_0|> def list_body_zones(page_num, page_size, path, query='...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BodyZoneService: """Service class for body zone related operations""" def is_valid_body_zone(id_body_zone): """Checks if the specified body zone exists :param id_body_zone: ID of body zone to be checked""" Utils.validate_uuid(id_body_zone) if not BodyZone.objects.filter(id=id_body...
the_stack_v2_python_sparse
backend/martin_helder/services/body_zone_service.py
JoaoAlvaroFerreira/FEUP-LGP
train
1
9f80b8fce268c87e43adbe8d3abc995e502b2d84
[ "main.clear_collections()\nresult = main.import_data('./data/', 'products', 'customers', 'rentals')\nself.assertEqual(result[1], 1000)\nself.assertEqual(result[2], 0)\nself.assertEqual(result[3], 1000)\nself.assertGreater(result[4], 0)", "function = main.show_available_products()\nproduct_1 = function['prd0018'][...
<|body_start_0|> main.clear_collections() result = main.import_data('./data/', 'products', 'customers', 'rentals') self.assertEqual(result[1], 1000) self.assertEqual(result[2], 0) self.assertEqual(result[3], 1000) self.assertGreater(result[4], 0) <|end_body_0|> <|body_st...
Class for testing HP Norton database
ModuleTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" <|body_0|> def test_show_available_products(self): """Test DB to show all available products as a Python diction...
stack_v2_sparse_classes_36k_train_025041
2,469
no_license
[ { "docstring": "Test CSV import and correct database insertion functionality", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Test DB to show all available products as a Python dictionary", "name": "test_show_available_products", "signature": "de...
3
stack_v2_sparse_classes_30k_train_013380
Implement the Python class `ModuleTests` described below. Class description: Class for testing HP Norton database Method signatures and docstrings: - def test_import_data(self): Test CSV import and correct database insertion functionality - def test_show_available_products(self): Test DB to show all available product...
Implement the Python class `ModuleTests` described below. Class description: Class for testing HP Norton database Method signatures and docstrings: - def test_import_data(self): Test CSV import and correct database insertion functionality - def test_show_available_products(self): Test DB to show all available product...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" <|body_0|> def test_show_available_products(self): """Test DB to show all available products as a Python diction...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModuleTests: """Class for testing HP Norton database""" def test_import_data(self): """Test CSV import and correct database insertion functionality""" main.clear_collections() result = main.import_data('./data/', 'products', 'customers', 'rentals') self.assertEqual(result[...
the_stack_v2_python_sparse
students/stellie/lesson07/assignment/test_parallel.py
JavaRod/SP_Python220B_2019
train
1
694945488381dbff153b8598b937ef45f9115d6a
[ "if self.is_api_request(request):\n try:\n parsed_session_uri = parse_session_id(request)\n if parsed_session_uri is not None:\n domain = get_domain(request)\n if parsed_session_uri['realm'] != domain:\n raise exceptions.PermissionDenied(_('Can not accept cookie...
<|body_start_0|> if self.is_api_request(request): try: parsed_session_uri = parse_session_id(request) if parsed_session_uri is not None: domain = get_domain(request) if parsed_session_uri['realm'] != domain: ...
Implement session through headers: http://www.w3.org/TR/WD-session-id TODO: Implement gateway protection, with permission options for usage of header sessions. With that in place the api can be used for both trusted and non trusted clients, see README.rst.
HeaderSessionMiddleware
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeaderSessionMiddleware: """Implement session through headers: http://www.w3.org/TR/WD-session-id TODO: Implement gateway protection, with permission options for usage of header sessions. With that in place the api can be used for both trusted and non trusted clients, see README.rst.""" def ...
stack_v2_sparse_classes_36k_train_025042
8,688
permissive
[ { "docstring": "Parse the session id from the 'Session-Id: ' header when using the api.", "name": "process_request", "signature": "def process_request(self, request)" }, { "docstring": "Add the 'Session-Id: ' header when using the api.", "name": "process_response", "signature": "def proc...
2
stack_v2_sparse_classes_30k_train_004378
Implement the Python class `HeaderSessionMiddleware` described below. Class description: Implement session through headers: http://www.w3.org/TR/WD-session-id TODO: Implement gateway protection, with permission options for usage of header sessions. With that in place the api can be used for both trusted and non truste...
Implement the Python class `HeaderSessionMiddleware` described below. Class description: Implement session through headers: http://www.w3.org/TR/WD-session-id TODO: Implement gateway protection, with permission options for usage of header sessions. With that in place the api can be used for both trusted and non truste...
79cecbc136cdf75c5f47beaf68fa7002e3c431ce
<|skeleton|> class HeaderSessionMiddleware: """Implement session through headers: http://www.w3.org/TR/WD-session-id TODO: Implement gateway protection, with permission options for usage of header sessions. With that in place the api can be used for both trusted and non trusted clients, see README.rst.""" def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HeaderSessionMiddleware: """Implement session through headers: http://www.w3.org/TR/WD-session-id TODO: Implement gateway protection, with permission options for usage of header sessions. With that in place the api can be used for both trusted and non trusted clients, see README.rst.""" def process_reque...
the_stack_v2_python_sparse
oscarapi/middleware.py
django-oscar/django-oscar-api
train
354
972e4fde2fa6cc544ab77f7b486b983b4782cda0
[ "self.gpus = gpus\ntransformer_primitive = []\ntransformer_primitive.append(T.Resize(size=i_shape))\nif h_flip > 0:\n transformer_primitive.append(T.RandomHorizontalFlip(p=h_flip))\nif t_crop:\n transformer_primitive.append(T.RandomCrop(size=i_shape))\ntransformer_primitive.append(T.ToTensor())\nif rea:\n ...
<|body_start_0|> self.gpus = gpus transformer_primitive = [] transformer_primitive.append(T.Resize(size=i_shape)) if h_flip > 0: transformer_primitive.append(T.RandomHorizontalFlip(p=h_flip)) if t_crop: transformer_primitive.append(T.RandomCrop(size=i_shap...
ClassedGenerator returns images only for the specified classes
ClassedGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassedGenerator: """ClassedGenerator returns images only for the specified classes""" def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0, h_flip=0.0, t_crop=False, rea=False, **kwargs): """Data ge...
stack_v2_sparse_classes_36k_train_025043
4,424
no_license
[ { "docstring": "Data generator for training and testing. Args: gpus (int): Number of GPUs i_shape (int, int): 2D Image shape normalization_mean (float): Value to pass as mean normalization parameter to pytorch Normalization normalization_std (float): Value to pass as std normalization parameter to pytorch Norma...
2
stack_v2_sparse_classes_30k_test_000767
Implement the Python class `ClassedGenerator` described below. Class description: ClassedGenerator returns images only for the specified classes Method signatures and docstrings: - def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0...
Implement the Python class `ClassedGenerator` described below. Class description: ClassedGenerator returns images only for the specified classes Method signatures and docstrings: - def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0...
4938936dbf08b5331275d4413dbad51acbaf7da9
<|skeleton|> class ClassedGenerator: """ClassedGenerator returns images only for the specified classes""" def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0, h_flip=0.0, t_crop=False, rea=False, **kwargs): """Data ge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassedGenerator: """ClassedGenerator returns images only for the specified classes""" def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0, h_flip=0.0, t_crop=False, rea=False, **kwargs): """Data generator for t...
the_stack_v2_python_sparse
generators/ClassedGenerator.py
asuprem/ODIN
train
7
6751dc18eb80c087c4d0fd7d2d111944670d0505
[ "ruleTableName = 'Rule %s %s Cross %s %s' % (crosserTable, crosserColumn, crosseeTable, crosseeColumn)\nRule.__init__(self, ruleTableName)\nif crosserTable == crosseeTable:\n self._selectQuery = 'select r.Date, r.Code, %s as Crosser, %s as Crossee from %s r' % (crosserColumn, crosseeColumn, crosserTable)\nelse:\...
<|body_start_0|> ruleTableName = 'Rule %s %s Cross %s %s' % (crosserTable, crosserColumn, crosseeTable, crosseeColumn) Rule.__init__(self, ruleTableName) if crosserTable == crosseeTable: self._selectQuery = 'select r.Date, r.Code, %s as Crosser, %s as Crossee from %s r' % (crosserCol...
Crossing Rule Class.
CrossingRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossingRule: """Crossing Rule Class.""" def __init__(self, crosserTable, crosserColumn, crosseeTable, crosseeColumn): """Class Constructor. :param crosserTable: :param crosserColumn: :param crosseeTable: :param crosseeColumn:""" <|body_0|> def evaluateRule(self, tickerC...
stack_v2_sparse_classes_36k_train_025044
3,295
no_license
[ { "docstring": "Class Constructor. :param crosserTable: :param crosserColumn: :param crosseeTable: :param crosseeColumn:", "name": "__init__", "signature": "def __init__(self, crosserTable, crosserColumn, crosseeTable, crosseeColumn)" }, { "docstring": "? :param tickerCode:", "name": "evalua...
2
stack_v2_sparse_classes_30k_train_008652
Implement the Python class `CrossingRule` described below. Class description: Crossing Rule Class. Method signatures and docstrings: - def __init__(self, crosserTable, crosserColumn, crosseeTable, crosseeColumn): Class Constructor. :param crosserTable: :param crosserColumn: :param crosseeTable: :param crosseeColumn: ...
Implement the Python class `CrossingRule` described below. Class description: Crossing Rule Class. Method signatures and docstrings: - def __init__(self, crosserTable, crosserColumn, crosseeTable, crosseeColumn): Class Constructor. :param crosserTable: :param crosserColumn: :param crosseeTable: :param crosseeColumn: ...
08b07b50ead69decd381cf5f866f4d8ffb80fa54
<|skeleton|> class CrossingRule: """Crossing Rule Class.""" def __init__(self, crosserTable, crosserColumn, crosseeTable, crosseeColumn): """Class Constructor. :param crosserTable: :param crosserColumn: :param crosseeTable: :param crosseeColumn:""" <|body_0|> def evaluateRule(self, tickerC...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrossingRule: """Crossing Rule Class.""" def __init__(self, crosserTable, crosserColumn, crosseeTable, crosseeColumn): """Class Constructor. :param crosserTable: :param crosserColumn: :param crosseeTable: :param crosseeColumn:""" ruleTableName = 'Rule %s %s Cross %s %s' % (crosserTable, c...
the_stack_v2_python_sparse
pyswing/objects/rules/crossingRule.py
garyjoy/pyswing
train
1
346a239096bad2bf87dd82454cc9178ca5cacf84
[ "self.enabled = enabled\nself.spare_serial = spare_serial\nself.uplink_mode = uplink_mode\nself.virtual_ip_1 = virtual_ip_1\nself.virtual_ip_2 = virtual_ip_2", "if dictionary is None:\n return None\nenabled = dictionary.get('enabled')\nspare_serial = dictionary.get('spareSerial')\nuplink_mode = dictionary.get(...
<|body_start_0|> self.enabled = enabled self.spare_serial = spare_serial self.uplink_mode = uplink_mode self.virtual_ip_1 = virtual_ip_1 self.virtual_ip_2 = virtual_ip_2 <|end_body_0|> <|body_start_1|> if dictionary is None: return None enabled = dict...
Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual or public virtual_ip_1 (string): The WAN 1 shared IP virtual_i...
UpdateNetworkWarmSpareSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkWarmSpareSettingsModel: """Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual...
stack_v2_sparse_classes_36k_train_025045
2,514
permissive
[ { "docstring": "Constructor for the UpdateNetworkWarmSpareSettingsModel class", "name": "__init__", "signature": "def __init__(self, enabled=None, spare_serial=None, uplink_mode=None, virtual_ip_1=None, virtual_ip_2=None)" }, { "docstring": "Creates an instance of this model from a dictionary Ar...
2
stack_v2_sparse_classes_30k_train_017998
Implement the Python class `UpdateNetworkWarmSpareSettingsModel` described below. Class description: Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mod...
Implement the Python class `UpdateNetworkWarmSpareSettingsModel` described below. Class description: Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mod...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkWarmSpareSettingsModel: """Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNetworkWarmSpareSettingsModel: """Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual or public vi...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_warm_spare_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
7e093e74310f5655cc8a651585324eae618aa8c2
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserLastSignInRecommendationInsightSetting()", "from .access_review_recommendation_insight_setting import AccessReviewRecommendationInsightSetting\nfrom .user_sign_in_recommendation_scope import UserSignInRecommendationScope\nfrom .acc...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserLastSignInRecommendationInsightSetting() <|end_body_0|> <|body_start_1|> from .access_review_recommendation_insight_setting import AccessReviewRecommendationInsightSetting from .user...
UserLastSignInRecommendationInsightSetting
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserLastSignInRecommendationInsightSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserLastSignInRecommendationInsightSetting: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to ...
stack_v2_sparse_classes_36k_train_025046
3,774
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: UserLastSignInRecommendationInsightSetting", "name": "create_from_discriminator_value", "signature": "def cr...
3
null
Implement the Python class `UserLastSignInRecommendationInsightSetting` described below. Class description: Implement the UserLastSignInRecommendationInsightSetting class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserLastSignInRecommendationInsig...
Implement the Python class `UserLastSignInRecommendationInsightSetting` described below. Class description: Implement the UserLastSignInRecommendationInsightSetting class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserLastSignInRecommendationInsig...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserLastSignInRecommendationInsightSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserLastSignInRecommendationInsightSetting: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserLastSignInRecommendationInsightSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserLastSignInRecommendationInsightSetting: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr...
the_stack_v2_python_sparse
msgraph/generated/models/user_last_sign_in_recommendation_insight_setting.py
microsoftgraph/msgraph-sdk-python
train
135
bed7f4fbb45a777fab13dbf5b3ecc15b5f78a2a7
[ "left, right = (0, len(nums) - 1)\nwhile left < right:\n mid = left + (right - left) // 2\n if nums[mid] > nums[right]:\n left = mid + 1\n else:\n right = mid\nreturn nums[left]", "if len(nums) <= 2:\n return min(nums)\nleft, right = (0, len(nums) - 1)\nmid = left + (right - left) // 2\n...
<|body_start_0|> left, right = (0, len(nums) - 1) while left < right: mid = left + (right - left) // 2 if nums[mid] > nums[right]: left = mid + 1 else: right = mid return nums[left] <|end_body_0|> <|body_start_1|> if le...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin_verbose(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left, right = (0, len(nums) - 1) whil...
stack_v2_sparse_classes_36k_train_025047
1,622
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin", "signature": "def findMin(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin_verbose", "signature": "def findMin_verbose(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): :type nums: List[int] :rtype: int - def findMin_verbose(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): :type nums: List[int] :rtype: int - def findMin_verbose(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def findMin(sel...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin_verbose(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" left, right = (0, len(nums) - 1) while left < right: mid = left + (right - left) // 2 if nums[mid] > nums[right]: left = mid + 1 else: right = ...
the_stack_v2_python_sparse
src/lt_153.py
oxhead/CodingYourWay
train
0
421631a880fc00fba21195c44ad4f7274292df31
[ "attrs = super().validate(attrs)\nerrors = {}\ncombiner = DataCombiner(self.instance, attrs)\nvalidators = (self._validate_related_trade_agreements,)\nfor validator in validators:\n errors.update(validator(combiner))\nif errors:\n raise serializers.ValidationError(errors)\nreturn attrs", "errors = {}\nrelat...
<|body_start_0|> attrs = super().validate(attrs) errors = {} combiner = DataCombiner(self.instance, attrs) validators = (self._validate_related_trade_agreements,) for validator in validators: errors.update(validator(combiner)) if errors: raise seri...
Event serialiser for V4 endpoint.
EventSerializerV4
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventSerializerV4: """Event serialiser for V4 endpoint.""" def validate(self, attrs): """Performs cross-field validation.""" <|body_0|> def _validate_related_trade_agreements(self, combiner): """Validates trade agreement state for consistency with has_related_tra...
stack_v2_sparse_classes_36k_train_025048
7,153
permissive
[ { "docstring": "Performs cross-field validation.", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Validates trade agreement state for consistency with has_related_trade_agreements", "name": "_validate_related_trade_agreements", "signature": "def _validate...
2
stack_v2_sparse_classes_30k_train_010635
Implement the Python class `EventSerializerV4` described below. Class description: Event serialiser for V4 endpoint. Method signatures and docstrings: - def validate(self, attrs): Performs cross-field validation. - def _validate_related_trade_agreements(self, combiner): Validates trade agreement state for consistency...
Implement the Python class `EventSerializerV4` described below. Class description: Event serialiser for V4 endpoint. Method signatures and docstrings: - def validate(self, attrs): Performs cross-field validation. - def _validate_related_trade_agreements(self, combiner): Validates trade agreement state for consistency...
a92faabf73fb93b5bfd94fd465eafc3e29aa6d8e
<|skeleton|> class EventSerializerV4: """Event serialiser for V4 endpoint.""" def validate(self, attrs): """Performs cross-field validation.""" <|body_0|> def _validate_related_trade_agreements(self, combiner): """Validates trade agreement state for consistency with has_related_tra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventSerializerV4: """Event serialiser for V4 endpoint.""" def validate(self, attrs): """Performs cross-field validation.""" attrs = super().validate(attrs) errors = {} combiner = DataCombiner(self.instance, attrs) validators = (self._validate_related_trade_agreeme...
the_stack_v2_python_sparse
datahub/event/serializers.py
cgsunkel/data-hub-api
train
0
be83dd97a38b8f2d477bc564c8631c612d1eb4fe
[ "self.env.revert_snapshot('deploy_ha_toolchain')\nself.helpers.emulate_whole_network_disaster(delay_before_recover=7 * 60)\nself.INFLUXDB_GRAFANA.wait_plugin_online()\nself.ELASTICSEARCH_KIBANA.wait_plugin_online()\nself.LMA_INFRASTRUCTURE_ALERTING.wait_plugin_online()\nself.helpers.run_ostf()", "self.env.revert_...
<|body_start_0|> self.env.revert_snapshot('deploy_ha_toolchain') self.helpers.emulate_whole_network_disaster(delay_before_recover=7 * 60) self.INFLUXDB_GRAFANA.wait_plugin_online() self.ELASTICSEARCH_KIBANA.wait_plugin_online() self.LMA_INFRASTRUCTURE_ALERTING.wait_plugin_online(...
Class for testing plugin failover after network disaster.
TestDestructiveToolchainPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDestructiveToolchainPlugin: """Class for testing plugin failover after network disaster.""" def check_cluster_outage_toolchain(self): """Verify that the backends and dashboards recover after a network outage of the whole cluster with plugins toolchain. Scenario: 1. Revert the sna...
stack_v2_sparse_classes_36k_train_025049
3,423
no_license
[ { "docstring": "Verify that the backends and dashboards recover after a network outage of the whole cluster with plugins toolchain. Scenario: 1. Revert the snapshot with 9 deployed nodes in HA configuration 2. Simulate a network outage of the whole cluster with plugins toolchain 3. Wait for at least 7 minutes b...
2
stack_v2_sparse_classes_30k_train_012095
Implement the Python class `TestDestructiveToolchainPlugin` described below. Class description: Class for testing plugin failover after network disaster. Method signatures and docstrings: - def check_cluster_outage_toolchain(self): Verify that the backends and dashboards recover after a network outage of the whole cl...
Implement the Python class `TestDestructiveToolchainPlugin` described below. Class description: Class for testing plugin failover after network disaster. Method signatures and docstrings: - def check_cluster_outage_toolchain(self): Verify that the backends and dashboards recover after a network outage of the whole cl...
179249df2d206eeabb3955c9dc8cb78cac3c36c6
<|skeleton|> class TestDestructiveToolchainPlugin: """Class for testing plugin failover after network disaster.""" def check_cluster_outage_toolchain(self): """Verify that the backends and dashboards recover after a network outage of the whole cluster with plugins toolchain. Scenario: 1. Revert the sna...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDestructiveToolchainPlugin: """Class for testing plugin failover after network disaster.""" def check_cluster_outage_toolchain(self): """Verify that the backends and dashboards recover after a network outage of the whole cluster with plugins toolchain. Scenario: 1. Revert the snapshot with 9 ...
the_stack_v2_python_sparse
stacklight_tests/toolchain/test_destructive.py
rkhozinov/stacklight-integration-tests
train
1
c79cf61afcfd06cb3761980662f5a548fa9b1760
[ "if not root:\n return ''\nleft_str = self.serialize(root.left)\nright_str = self.serialize(root.right)\nreturn str(root.val) + ' ' + left_str + ' ' + right_str", "q = [int(x) for x in data.split(' ') if x]\n\ndef dfs(q, min_, max_):\n if not q:\n return None\n if q[0] > min_ and q[0] < max_:\n ...
<|body_start_0|> if not root: return '' left_str = self.serialize(root.left) right_str = self.serialize(root.right) return str(root.val) + ' ' + left_str + ' ' + right_str <|end_body_0|> <|body_start_1|> q = [int(x) for x in data.split(' ') if x] def dfs(q, ...
Codec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_025050
2,234
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_019829
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
26fa64525c92e01dfbcdd7851f5b3a91f6ec203b
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return '' left_str = self.serialize(root.left) right_str = self.serialize(root.right) return str(root.val) + ' ' + left_str + ' ' + right_str def de...
the_stack_v2_python_sparse
daily_coding_challenge/october_2020/serialize_and_deserialize_BST_449.py
anjaligopi/leetcode
train
0
1a32627732d35ab00ee3dfa587cfb8ff55feb0a3
[ "if not p:\n return not s\nfirst_match = bool(s) and p[0] in {s[0], '.'}\nif len(p) >= 2 and p[1] == '*':\n return self.isMatch_recursive(s, p[2:]) or (first_match and self.isMatch_recursive(s[1:], p))\nelse:\n return first_match and self.isMatch_recursive(s[1:], p[1:])", "memo = {}\n\ndef dp(i, j):\n ...
<|body_start_0|> if not p: return not s first_match = bool(s) and p[0] in {s[0], '.'} if len(p) >= 2 and p[1] == '*': return self.isMatch_recursive(s, p[2:]) or (first_match and self.isMatch_recursive(s[1:], p)) else: return first_match and self.isMatc...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMatch_recursive(self, s, p): """:type s: str :type p: str :rtype: bool This is the recursive version, while it will TLE in leetcode""" <|body_0|> def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool revise the recursive version into DP t...
stack_v2_sparse_classes_36k_train_025051
2,313
no_license
[ { "docstring": ":type s: str :type p: str :rtype: bool This is the recursive version, while it will TLE in leetcode", "name": "isMatch_recursive", "signature": "def isMatch_recursive(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: bool revise the recursive version into DP top-d...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch_recursive(self, s, p): :type s: str :type p: str :rtype: bool This is the recursive version, while it will TLE in leetcode - def isMatch(self, s, p): :type s: str :ty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch_recursive(self, s, p): :type s: str :type p: str :rtype: bool This is the recursive version, while it will TLE in leetcode - def isMatch(self, s, p): :type s: str :ty...
4d340a45fb2e9459d47cbe179ebfa7a82e5f1b8c
<|skeleton|> class Solution: def isMatch_recursive(self, s, p): """:type s: str :type p: str :rtype: bool This is the recursive version, while it will TLE in leetcode""" <|body_0|> def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool revise the recursive version into DP t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isMatch_recursive(self, s, p): """:type s: str :type p: str :rtype: bool This is the recursive version, while it will TLE in leetcode""" if not p: return not s first_match = bool(s) and p[0] in {s[0], '.'} if len(p) >= 2 and p[1] == '*': re...
the_stack_v2_python_sparse
10_RegularExpressionMatching/solution.py
llgeek/leetcode
train
1
65d59a3d6ed579420ad3853458a05cb231ef9b92
[ "m, n = (len(matrix), len(matrix[0]))\ncount = 0\ndp = [[0] * n for _ in range(m)]\nfor i in range(m):\n for j in range(n):\n if matrix[i][j] == 1:\n if not i or not j:\n dp[i][j] = 1\n else:\n dp[i][j] = min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1])...
<|body_start_0|> m, n = (len(matrix), len(matrix[0])) count = 0 dp = [[0] * n for _ in range(m)] for i in range(m): for j in range(n): if matrix[i][j] == 1: if not i or not j: dp[i][j] = 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSquares(self, matrix: List[List[int]]) -> int: """思路:动态规划 dp[i][j] 表示,以 [i][j] 为右下角的 正方的边长, dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1 边界: 0< =i < M, 0<= j < N 优化:直接修改原始矩阵,不需要额外空间 1 1 1 0 1 1 0 1 1 [2] 1 [1] 0 [1] 1 [1] min(1, 1, 1) + 1 = 2 min(1, 0, 1) +...
stack_v2_sparse_classes_36k_train_025052
2,669
no_license
[ { "docstring": "思路:动态规划 dp[i][j] 表示,以 [i][j] 为右下角的 正方的边长, dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1 边界: 0< =i < M, 0<= j < N 优化:直接修改原始矩阵,不需要额外空间 1 1 1 0 1 1 0 1 1 [2] 1 [1] 0 [1] 1 [1] min(1, 1, 1) + 1 = 2 min(1, 0, 1) + 1 = 1 时间复杂度:O(mn) 空间复杂度:O(mn)", "name": "countSquares", "signature":...
2
stack_v2_sparse_classes_30k_train_011385
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSquares(self, matrix: List[List[int]]) -> int: 思路:动态规划 dp[i][j] 表示,以 [i][j] 为右下角的 正方的边长, dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1 边界: 0< =i < M, 0<= j < ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSquares(self, matrix: List[List[int]]) -> int: 思路:动态规划 dp[i][j] 表示,以 [i][j] 为右下角的 正方的边长, dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1 边界: 0< =i < M, 0<= j < ...
4994b8b19abcdbcc0bda2944350e325242fadfd1
<|skeleton|> class Solution: def countSquares(self, matrix: List[List[int]]) -> int: """思路:动态规划 dp[i][j] 表示,以 [i][j] 为右下角的 正方的边长, dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1 边界: 0< =i < M, 0<= j < N 优化:直接修改原始矩阵,不需要额外空间 1 1 1 0 1 1 0 1 1 [2] 1 [1] 0 [1] 1 [1] min(1, 1, 1) + 1 = 2 min(1, 0, 1) +...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countSquares(self, matrix: List[List[int]]) -> int: """思路:动态规划 dp[i][j] 表示,以 [i][j] 为右下角的 正方的边长, dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1 边界: 0< =i < M, 0<= j < N 优化:直接修改原始矩阵,不需要额外空间 1 1 1 0 1 1 0 1 1 [2] 1 [1] 0 [1] 1 [1] min(1, 1, 1) + 1 = 2 min(1, 0, 1) + 1 = 1 时间复杂度:O...
the_stack_v2_python_sparse
Week_04/countSquares.py
NanZhang715/AlgorithmCHUNZHAO
train
0
c0dd8063454ef6019609759601ca151b04c4be1d
[ "i = 1\nwhile i <= x / 2:\n if i * i > x:\n return i - 1\n elif i * i == x:\n return i\n i += 1", "if x == 1:\n return 1\ni = 0\nwhile i <= x / 2:\n if i * i > x:\n return i - 1\n elif i * i == x:\n return i\n i += 1\nreturn i - 1" ]
<|body_start_0|> i = 1 while i <= x / 2: if i * i > x: return i - 1 elif i * i == x: return i i += 1 <|end_body_0|> <|body_start_1|> if x == 1: return 1 i = 0 while i <= x / 2: if i * i >...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrtTimeLimit(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> i = 1 while i <= x / 2: if i * i > x: ...
stack_v2_sparse_classes_36k_train_025053
658
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "mySqrt", "signature": "def mySqrt(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "mySqrtTimeLimit", "signature": "def mySqrtTimeLimit(self, x)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrtTimeLimit(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrtTimeLimit(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def mySqrt(self, x): """:type x:...
b925bb22d1daa4a56c5a238a5758a926905559b4
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrtTimeLimit(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" i = 1 while i <= x / 2: if i * i > x: return i - 1 elif i * i == x: return i i += 1 def mySqrtTimeLimit(self, x): """:type x: int :rtype: int""...
the_stack_v2_python_sparse
69. Sqrt(x).py
beninghton/notGivenUpToG
train
0
c87b5f435ace6e515cb65a064ee8eecbaad7fad9
[ "yield (None, 'port grouping is determined by the global default.')\nyield (False, 'ports are not grouped in an additional record.')\nyield (re.compile('[a-zA-Z][a-zA-Z0-9_]*'), 'ports are grouped in a record with the specified name.')", "yield (None, 'port flattening is determined by the global default.')\nyield...
<|body_start_0|> yield (None, 'port grouping is determined by the global default.') yield (False, 'ports are not grouped in an additional record.') yield (re.compile('[a-zA-Z][a-zA-Z0-9_]*'), 'ports are grouped in a record with the specified name.') <|end_body_0|> <|body_start_1|> yield...
Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generics are flattened, but either can be overridd...
InterfaceConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceConfig: """Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generic...
stack_v2_sparse_classes_36k_train_025054
3,434
permissive
[ { "docstring": "Name of the group record used for ports, if any. The ports for any objects that share the same non-null `group` tag are combined into a single record pair (`in` and `out`).", "name": "group", "signature": "def group()" }, { "docstring": "Whether the ports for this object should b...
4
stack_v2_sparse_classes_30k_train_000045
Implement the Python class `InterfaceConfig` described below. Class description: Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by fie...
Implement the Python class `InterfaceConfig` described below. Class description: Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by fie...
d0417925cd72dfb973431d6948e65b662a75c5fa
<|skeleton|> class InterfaceConfig: """Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterfaceConfig: """Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generics are flatten...
the_stack_v2_python_sparse
vhdmmio/config/interface.py
abs-tudelft/vhdmmio
train
5
c902d62a7dfe7a5c47f97e34258ecdb136882ce5
[ "self.curr_round = 0\npayload = {'is_handshake': True}\nlst_replies = self.query_all_parties(payload)\nglobal_counts = self.global_reweighing(lst_replies)\npayload = {'global_weights': True, 'global_counts': global_counts}\nlst_replies = self.query_all_parties(payload)\nwhile not self.reach_termination_criteria(sel...
<|body_start_0|> self.curr_round = 0 payload = {'is_handshake': True} lst_replies = self.query_all_parties(payload) global_counts = self.global_reweighing(lst_replies) payload = {'global_weights': True, 'global_counts': global_counts} lst_replies = self.query_all_parties(...
Class for iterative averaging based fusion algorithms. An iterative fusion algorithm here referred to a fusion algorithm that sends out queries at each global round to registered parties for information, and use the collected information from parties to update the global model. The type of queries sent out at each roun...
ReweighFusionHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReweighFusionHandler: """Class for iterative averaging based fusion algorithms. An iterative fusion algorithm here referred to a fusion algorithm that sends out queries at each global round to registered parties for information, and use the collected information from parties to update the global ...
stack_v2_sparse_classes_36k_train_025055
4,100
permissive
[ { "docstring": "Starts an iterative global federated learning training process.", "name": "start_global_training", "signature": "def start_global_training(self)" }, { "docstring": ":param lst_replies: party response with local DP counts for weight calculation :type lst_replies: `dict` :return: g...
2
stack_v2_sparse_classes_30k_train_003807
Implement the Python class `ReweighFusionHandler` described below. Class description: Class for iterative averaging based fusion algorithms. An iterative fusion algorithm here referred to a fusion algorithm that sends out queries at each global round to registered parties for information, and use the collected informa...
Implement the Python class `ReweighFusionHandler` described below. Class description: Class for iterative averaging based fusion algorithms. An iterative fusion algorithm here referred to a fusion algorithm that sends out queries at each global round to registered parties for information, and use the collected informa...
64ffa2ee2e906b1bd6b3dd6aabcf6fc3de862608
<|skeleton|> class ReweighFusionHandler: """Class for iterative averaging based fusion algorithms. An iterative fusion algorithm here referred to a fusion algorithm that sends out queries at each global round to registered parties for information, and use the collected information from parties to update the global ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReweighFusionHandler: """Class for iterative averaging based fusion algorithms. An iterative fusion algorithm here referred to a fusion algorithm that sends out queries at each global round to registered parties for information, and use the collected information from parties to update the global model. The ty...
the_stack_v2_python_sparse
debugging-constructs/ibmfl/aggregator/fusion/reweigh_fusion_handler.py
SEED-VT/FedDebug
train
8
1669dd2973df3bb6a46cf842bdfebc0162ecbc12
[ "self.num_res = len(obj_dict)\nself.obj_dict = obj_dict\nself.res = dict()\ncnt = 0\nfor ip in self.obj_dict:\n obj_elem_dict = self.obj_dict.get(ip)\n drvr_obj = obj_elem_dict.get('drvr_obj')\n self.res[cnt] = {'mgmt_ip': ip, 'quota': drvr_obj.get_max_quota(), 'obj_dict': obj_elem_dict, 'used': 0, 'fw_id_...
<|body_start_0|> self.num_res = len(obj_dict) self.obj_dict = obj_dict self.res = dict() cnt = 0 for ip in self.obj_dict: obj_elem_dict = self.obj_dict.get(ip) drvr_obj = obj_elem_dict.get('drvr_obj') self.res[cnt] = {'mgmt_ip': ip, 'quota': dr...
Max Sched class. This scheduler will return the first firewall until it reaches its quota.
MaxSched
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaxSched: """Max Sched class. This scheduler will return the first firewall until it reaches its quota.""" def __init__(self, obj_dict): """Initialization.""" <|body_0|> def allocate_fw_dev(self, fw_id): """Allocate firewall device. Allocate the first Firewall de...
stack_v2_sparse_classes_36k_train_025056
9,983
permissive
[ { "docstring": "Initialization.", "name": "__init__", "signature": "def __init__(self, obj_dict)" }, { "docstring": "Allocate firewall device. Allocate the first Firewall device which has resources available.", "name": "allocate_fw_dev", "signature": "def allocate_fw_dev(self, fw_id)" ...
5
stack_v2_sparse_classes_30k_train_017517
Implement the Python class `MaxSched` described below. Class description: Max Sched class. This scheduler will return the first firewall until it reaches its quota. Method signatures and docstrings: - def __init__(self, obj_dict): Initialization. - def allocate_fw_dev(self, fw_id): Allocate firewall device. Allocate ...
Implement the Python class `MaxSched` described below. Class description: Max Sched class. This scheduler will return the first firewall until it reaches its quota. Method signatures and docstrings: - def __init__(self, obj_dict): Initialization. - def allocate_fw_dev(self, fw_id): Allocate firewall device. Allocate ...
3bd3f90b5ddb4553525abc5f87ba759bf2e7a2e5
<|skeleton|> class MaxSched: """Max Sched class. This scheduler will return the first firewall until it reaches its quota.""" def __init__(self, obj_dict): """Initialization.""" <|body_0|> def allocate_fw_dev(self, fw_id): """Allocate firewall device. Allocate the first Firewall de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaxSched: """Max Sched class. This scheduler will return the first firewall until it reaches its quota.""" def __init__(self, obj_dict): """Initialization.""" self.num_res = len(obj_dict) self.obj_dict = obj_dict self.res = dict() cnt = 0 for ip in self.obj...
the_stack_v2_python_sparse
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
sapcc/networking-cisco
train
3
28ef3042720c18426acc83bc6ccb448982e92ee5
[ "login_page.LoginPage(self.driver).login()\nsleep(2)\nlogin_page.LoginPage(self.driver)._open(url='/wujiaqu/')\nsleep(2)\npo = tenant_collection_page.TenantCollectionPage(self.driver)\nif po.title() == '收藏':\n po.collection()\nelse:\n po.collection()\n sleep(2)\n po.collection()\nfunction.insert_img(sel...
<|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) login_page.LoginPage(self.driver)._open(url='/wujiaqu/') sleep(2) po = tenant_collection_page.TenantCollectionPage(self.driver) if po.title() == '收藏': po.collection() else: ...
我的收藏
TestTenantCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTenantCollection: """我的收藏""" def test_a_collection(self): """五家渠收藏房源""" <|body_0|> def test_cancel_collection(self): """我的收藏——取消收藏""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) ...
stack_v2_sparse_classes_36k_train_025057
1,509
permissive
[ { "docstring": "五家渠收藏房源", "name": "test_a_collection", "signature": "def test_a_collection(self)" }, { "docstring": "我的收藏——取消收藏", "name": "test_cancel_collection", "signature": "def test_cancel_collection(self)" } ]
2
stack_v2_sparse_classes_30k_train_006880
Implement the Python class `TestTenantCollection` described below. Class description: 我的收藏 Method signatures and docstrings: - def test_a_collection(self): 五家渠收藏房源 - def test_cancel_collection(self): 我的收藏——取消收藏
Implement the Python class `TestTenantCollection` described below. Class description: 我的收藏 Method signatures and docstrings: - def test_a_collection(self): 五家渠收藏房源 - def test_cancel_collection(self): 我的收藏——取消收藏 <|skeleton|> class TestTenantCollection: """我的收藏""" def test_a_collection(self): """五家渠收藏...
192c70c49a8e9e072b9d0d0136f02c653c589410
<|skeleton|> class TestTenantCollection: """我的收藏""" def test_a_collection(self): """五家渠收藏房源""" <|body_0|> def test_cancel_collection(self): """我的收藏——取消收藏""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTenantCollection: """我的收藏""" def test_a_collection(self): """五家渠收藏房源""" login_page.LoginPage(self.driver).login() sleep(2) login_page.LoginPage(self.driver)._open(url='/wujiaqu/') sleep(2) po = tenant_collection_page.TenantCollectionPage(self.driver) ...
the_stack_v2_python_sparse
mayi/test_case/test_tenant_collection.py
18701016443/mayi
train
0
a7c7b3de78c499c6bd84626da89b6cf6674bb1ff
[ "size = len(nums)\nl, sum, ans = (0, 0, size + 1)\nfor i in range(0, size):\n sum += nums[i]\n while sum >= s:\n ans = min(ans, i - l + 1)\n sum -= nums[l]\n l += 1\nreturn 0 if ans == size + 1 else ans", "l, r, sum, ans, size = (0, 0, 0, len(nums) + 1, len(nums))\nwhile l < size and r ...
<|body_start_0|> size = len(nums) l, sum, ans = (0, 0, size + 1) for i in range(0, size): sum += nums[i] while sum >= s: ans = min(ans, i - l + 1) sum -= nums[l] l += 1 return 0 if ans == size + 1 else ans <|end_body...
SolutionMinimumSizeSubarraySum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionMinimumSizeSubarraySum: def minSubArrayLen_ON_1(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_0|> def minSubArrayLen_ON_2(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_1|> def minSubArra...
stack_v2_sparse_classes_36k_train_025058
1,796
no_license
[ { "docstring": ":type s: int :type nums: List[int] :rtype: int", "name": "minSubArrayLen_ON_1", "signature": "def minSubArrayLen_ON_1(self, s, nums)" }, { "docstring": ":type s: int :type nums: List[int] :rtype: int", "name": "minSubArrayLen_ON_2", "signature": "def minSubArrayLen_ON_2(s...
3
stack_v2_sparse_classes_30k_train_008159
Implement the Python class `SolutionMinimumSizeSubarraySum` described below. Class description: Implement the SolutionMinimumSizeSubarraySum class. Method signatures and docstrings: - def minSubArrayLen_ON_1(self, s, nums): :type s: int :type nums: List[int] :rtype: int - def minSubArrayLen_ON_2(self, s, nums): :type...
Implement the Python class `SolutionMinimumSizeSubarraySum` described below. Class description: Implement the SolutionMinimumSizeSubarraySum class. Method signatures and docstrings: - def minSubArrayLen_ON_1(self, s, nums): :type s: int :type nums: List[int] :rtype: int - def minSubArrayLen_ON_2(self, s, nums): :type...
a07d8b3cfd5eadb3c3b2f4383cb8ffc32d52f928
<|skeleton|> class SolutionMinimumSizeSubarraySum: def minSubArrayLen_ON_1(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_0|> def minSubArrayLen_ON_2(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_1|> def minSubArra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolutionMinimumSizeSubarraySum: def minSubArrayLen_ON_1(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" size = len(nums) l, sum, ans = (0, 0, size + 1) for i in range(0, size): sum += nums[i] while sum >= s: ans = min...
the_stack_v2_python_sparse
python/MinimumSizeSubarraySum.py
hellocomrade/happycoding
train
5
ca4ece80a17d014fc4c3c8632f02e5671d27b028
[ "self.name = 'contextual_model_multi_stimuli'\nself.figures = ['f3a.npz', 'f5.npz']\nself.target_data = 'label_dict'\nself.config = Config()\nself.output_size = [1, 10]\nself.im_size = (10, 51, 51, 75)\nself.repeats = 20\nself.model_input_image_size = [10, 51, 51, 75]\nself.default_loss_function = 'pearson'\nself.s...
<|body_start_0|> self.name = 'contextual_model_multi_stimuli' self.figures = ['f3a.npz', 'f5.npz'] self.target_data = 'label_dict' self.config = Config() self.output_size = [1, 10] self.im_size = (10, 51, 51, 75) self.repeats = 20 self.model_input_image_si...
Tilt-illusion from Contextual modeling paper (fig3a).
data_processing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class data_processing: """Tilt-illusion from Contextual modeling paper (fig3a).""" def __init__(self): """Init global variables for contextual circuit bp.""" <|body_0|> def flatten_and_pad_dict(self, d, flatten=False, constant=0.0): """Flatten each dict entry then pad ...
stack_v2_sparse_classes_36k_train_025059
4,213
no_license
[ { "docstring": "Init global variables for contextual circuit bp.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Flatten each dict entry then pad to the largest sized one.", "name": "flatten_and_pad_dict", "signature": "def flatten_and_pad_dict(self, d, flatten...
3
null
Implement the Python class `data_processing` described below. Class description: Tilt-illusion from Contextual modeling paper (fig3a). Method signatures and docstrings: - def __init__(self): Init global variables for contextual circuit bp. - def flatten_and_pad_dict(self, d, flatten=False, constant=0.0): Flatten each...
Implement the Python class `data_processing` described below. Class description: Tilt-illusion from Contextual modeling paper (fig3a). Method signatures and docstrings: - def __init__(self): Init global variables for contextual circuit bp. - def flatten_and_pad_dict(self, d, flatten=False, constant=0.0): Flatten each...
a277bc3146beaa4e3edd2134fc9fb8d3388a6013
<|skeleton|> class data_processing: """Tilt-illusion from Contextual modeling paper (fig3a).""" def __init__(self): """Init global variables for contextual circuit bp.""" <|body_0|> def flatten_and_pad_dict(self, d, flatten=False, constant=0.0): """Flatten each dict entry then pad ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class data_processing: """Tilt-illusion from Contextual modeling paper (fig3a).""" def __init__(self): """Init global variables for contextual circuit bp.""" self.name = 'contextual_model_multi_stimuli' self.figures = ['f3a.npz', 'f5.npz'] self.target_data = 'label_dict' ...
the_stack_v2_python_sparse
dataset_processing/contextual_model_multi_stimuli.py
dmely/contextual_circuit_bp
train
0
cbb24778f2380ac7ebddb317b14761a8b48f67e1
[ "super(GSGNN, self).__init__()\nself.n_in = n_in\nself.layers = nn.ModuleList()\nself.layers.append(nn.Linear(n_in, n_h))\nself.layers.append(nn.Dropout(dropout))\nself.layers.append(nn.ReLU())\nfor _ in range(n_layers):\n self.layers.append(nn.Linear(n_h, n_h))\n self.layers.append(nn.Dropout(dropout))\n ...
<|body_start_0|> super(GSGNN, self).__init__() self.n_in = n_in self.layers = nn.ModuleList() self.layers.append(nn.Linear(n_in, n_h)) self.layers.append(nn.Dropout(dropout)) self.layers.append(nn.ReLU()) for _ in range(n_layers): self.layers.append(nn...
GSGNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GSGNN: def __init__(self, n_in, n_h=100, n_layers=1, dropout=0.0): """FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:""" <|body_0|> def forward(self, x): """FIXME! briefly describe function :param x: :retur...
stack_v2_sparse_classes_36k_train_025060
1,740
permissive
[ { "docstring": "FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:", "name": "__init__", "signature": "def __init__(self, n_in, n_h=100, n_layers=1, dropout=0.0)" }, { "docstring": "FIXME! briefly describe function :param x: :returns: :rt...
2
stack_v2_sparse_classes_30k_train_001688
Implement the Python class `GSGNN` described below. Class description: Implement the GSGNN class. Method signatures and docstrings: - def __init__(self, n_in, n_h=100, n_layers=1, dropout=0.0): FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype: - def forward(s...
Implement the Python class `GSGNN` described below. Class description: Implement the GSGNN class. Method signatures and docstrings: - def __init__(self, n_in, n_h=100, n_layers=1, dropout=0.0): FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype: - def forward(s...
fc3fd121fbffb630e3652bacdc74d1b1bddab50e
<|skeleton|> class GSGNN: def __init__(self, n_in, n_h=100, n_layers=1, dropout=0.0): """FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:""" <|body_0|> def forward(self, x): """FIXME! briefly describe function :param x: :retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GSGNN: def __init__(self, n_in, n_h=100, n_layers=1, dropout=0.0): """FIXME! briefly describe function :param n_in: :param n_h: :param n_layers: :param dropout: :returns: :rtype:""" super(GSGNN, self).__init__() self.n_in = n_in self.layers = nn.ModuleList() self.layers...
the_stack_v2_python_sparse
src/classicalgsg/nn_models/models.py
kyrarivest/ACRES_REU_Project_2021
train
0
544d20a2eaab38d949ad8814f04420c79b50925b
[ "sql = \" select a.id, pbf.full_name as authorize_name, pbf.take_photo, a.mobile_number, a.relation_student from info_authorize a join info_people_basic_facts pbf on a.basic_id = pbf.id join info_student s on a.student_id = s.id join info_guardian g on g.student_id = s.id where g.login_user_id = :login_user_id ...
<|body_start_0|> sql = " select a.id, pbf.full_name as authorize_name, pbf.take_photo, a.mobile_number, a.relation_student from info_authorize a join info_people_basic_facts pbf on a.basic_id = pbf.id join info_student s on a.student_id = s.id join info_guardian g on g.student_id = s.id where g.login_user_id...
InfoAuthorize
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfoAuthorize: def query_auth_info(self, login_user_id): """获取授权人列表 :param login_user_id :return:""" <|body_0|> def query_sa_auth_tooltips(self, login_user_id, create_dt): """获取有无学生变更授权人 :param login_user_id :param create_dt :return:""" <|body_1|> def de...
stack_v2_sparse_classes_36k_train_025061
3,640
no_license
[ { "docstring": "获取授权人列表 :param login_user_id :return:", "name": "query_auth_info", "signature": "def query_auth_info(self, login_user_id)" }, { "docstring": "获取有无学生变更授权人 :param login_user_id :param create_dt :return:", "name": "query_sa_auth_tooltips", "signature": "def query_sa_auth_too...
4
stack_v2_sparse_classes_30k_train_008861
Implement the Python class `InfoAuthorize` described below. Class description: Implement the InfoAuthorize class. Method signatures and docstrings: - def query_auth_info(self, login_user_id): 获取授权人列表 :param login_user_id :return: - def query_sa_auth_tooltips(self, login_user_id, create_dt): 获取有无学生变更授权人 :param login_u...
Implement the Python class `InfoAuthorize` described below. Class description: Implement the InfoAuthorize class. Method signatures and docstrings: - def query_auth_info(self, login_user_id): 获取授权人列表 :param login_user_id :return: - def query_sa_auth_tooltips(self, login_user_id, create_dt): 获取有无学生变更授权人 :param login_u...
a7cf5a0b6daa372ed860dc43d92c55fcde764eb9
<|skeleton|> class InfoAuthorize: def query_auth_info(self, login_user_id): """获取授权人列表 :param login_user_id :return:""" <|body_0|> def query_sa_auth_tooltips(self, login_user_id, create_dt): """获取有无学生变更授权人 :param login_user_id :param create_dt :return:""" <|body_1|> def de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InfoAuthorize: def query_auth_info(self, login_user_id): """获取授权人列表 :param login_user_id :return:""" sql = " select a.id, pbf.full_name as authorize_name, pbf.take_photo, a.mobile_number, a.relation_student from info_authorize a join info_people_basic_facts pbf on a.basic_id = pbf.id join in...
the_stack_v2_python_sparse
python_project/smart_schoolBus_project/app/schoolbus_situation/models/info_authorize_model.py
malqch/aibus
train
0
9ad523a355f031dd2ff4c99b8e61cc6a9cdd1ec3
[ "super(Router, self).__init__()\nself.key_function = key_function\nself.routing_table = routing_table", "k = self.key_function(msg)\nkey = k[0] if isinstance(k, (tuple, list)) else k\nreturn self.routing_table[key]", "k = self.key_function(msg)\nif isinstance(k, (tuple, list)):\n key, args, kwargs = {1: tupl...
<|body_start_0|> super(Router, self).__init__() self.key_function = key_function self.routing_table = routing_table <|end_body_0|> <|body_start_1|> k = self.key_function(msg) key = k[0] if isinstance(k, (tuple, list)) else k return self.routing_table[key] <|end_body_1|> ...
Map a message to a handler function, using a **key function** and a **routing table** (dictionary). A *key function* digests a message down to a value. This value is treated as a key to the *routing table* to look up a corresponding handler function.
Router
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Router: """Map a message to a handler function, using a **key function** and a **routing table** (dictionary). A *key function* digests a message down to a value. This value is treated as a key to the *routing table* to look up a corresponding handler function.""" def __init__(self, key_func...
stack_v2_sparse_classes_36k_train_025062
40,889
permissive
[ { "docstring": ":param key_function: A function that takes one argument (the message) and returns one of the following: - a key to the routing table - a 1-tuple (key,) - a 2-tuple (key, (positional, arguments, ...)) - a 3-tuple (key, (positional, arguments, ...), {keyword: arguments, ...}) Extra arguments, if r...
3
stack_v2_sparse_classes_30k_train_004357
Implement the Python class `Router` described below. Class description: Map a message to a handler function, using a **key function** and a **routing table** (dictionary). A *key function* digests a message down to a value. This value is treated as a key to the *routing table* to look up a corresponding handler functi...
Implement the Python class `Router` described below. Class description: Map a message to a handler function, using a **key function** and a **routing table** (dictionary). A *key function* digests a message down to a value. This value is treated as a key to the *routing table* to look up a corresponding handler functi...
979ec1c7d50786939eb65ff779e3e03be950d595
<|skeleton|> class Router: """Map a message to a handler function, using a **key function** and a **routing table** (dictionary). A *key function* digests a message down to a value. This value is treated as a key to the *routing table* to look up a corresponding handler function.""" def __init__(self, key_func...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Router: """Map a message to a handler function, using a **key function** and a **routing table** (dictionary). A *key function* digests a message down to a value. This value is treated as a key to the *routing table* to look up a corresponding handler function.""" def __init__(self, key_function, routing...
the_stack_v2_python_sparse
amanobot/helper.py
AmanoTeam/amanobot
train
25
727a4cbb523001d73725c4e26f9462fd039c3b14
[ "if not route:\n route = '/'\nelse:\n route = route.strip()\nif methods and (not isinstance(methods, (list, tuple, set, frozenset))):\n raise TypeError('methods should be a list')\nself._route = route\nself._methods = methods or ['GET']", "if not inspect.isroutine(decorated_method):\n raise TypeError(...
<|body_start_0|> if not route: route = '/' else: route = route.strip() if methods and (not isinstance(methods, (list, tuple, set, frozenset))): raise TypeError('methods should be a list') self._route = route self._methods = methods or ['GET'] <...
Decorator indicating which route a method handles
Http
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Http: """Decorator indicating which route a method handles""" def __init__(self, route, methods=None): """:param route: Path handled by the method (beginning with a '/') :param methods: List of HTTP methods allowed (GET, POST, ...)""" <|body_0|> def __call__(self, decora...
stack_v2_sparse_classes_36k_train_025063
13,381
permissive
[ { "docstring": ":param route: Path handled by the method (beginning with a '/') :param methods: List of HTTP methods allowed (GET, POST, ...)", "name": "__init__", "signature": "def __init__(self, route, methods=None)" }, { "docstring": "Injects the HTTP_ROUTE_ATTRIBUTE to the decorated method t...
2
null
Implement the Python class `Http` described below. Class description: Decorator indicating which route a method handles Method signatures and docstrings: - def __init__(self, route, methods=None): :param route: Path handled by the method (beginning with a '/') :param methods: List of HTTP methods allowed (GET, POST, ...
Implement the Python class `Http` described below. Class description: Decorator indicating which route a method handles Method signatures and docstrings: - def __init__(self, route, methods=None): :param route: Path handled by the method (beginning with a '/') :param methods: List of HTTP methods allowed (GET, POST, ...
1d0add361ca219da8fdf72bb9ba8cb0ade01ad2f
<|skeleton|> class Http: """Decorator indicating which route a method handles""" def __init__(self, route, methods=None): """:param route: Path handled by the method (beginning with a '/') :param methods: List of HTTP methods allowed (GET, POST, ...)""" <|body_0|> def __call__(self, decora...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Http: """Decorator indicating which route a method handles""" def __init__(self, route, methods=None): """:param route: Path handled by the method (beginning with a '/') :param methods: List of HTTP methods allowed (GET, POST, ...)""" if not route: route = '/' else: ...
the_stack_v2_python_sparse
pelix/http/routing.py
tcalmant/ipopo
train
67
76cb1331f21c9546f2f0f5fa53341440a871eab7
[ "super().__init__()\nself.gru = rec_gru\nself.node = rec_node\nself.out = rec_output\nself.latent_dim = latent_dim", "h = torch.zeros(x.shape[0], self.latent_dim * 2).to(x.device)\ntps = torch.cat(((tps[0] - 0.01).unsqueeze(0), tps), 0)\nh_arr, r_fill_mask = (None, None)\nif mask is not None:\n h_arr = torch.z...
<|body_start_0|> super().__init__() self.gru = rec_gru self.node = rec_node self.out = rec_output self.latent_dim = latent_dim <|end_body_0|> <|body_start_1|> h = torch.zeros(x.shape[0], self.latent_dim * 2).to(x.device) tps = torch.cat(((tps[0] - 0.01).unsqueeze...
GRU with hidden dynamics represented by Neural ODE. Implements the GRU-ODE model in: https://arxiv.org/abs/1907.03907. Observations are encoded by a GRU. Between observations, the hidden state is evolved using a Neural ODE. Attributes: gru (nn.Module): GRU unit used to encode input data. node (nn.Module): Neural ODE us...
EncoderGRUODE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderGRUODE: """GRU with hidden dynamics represented by Neural ODE. Implements the GRU-ODE model in: https://arxiv.org/abs/1907.03907. Observations are encoded by a GRU. Between observations, the hidden state is evolved using a Neural ODE. Attributes: gru (nn.Module): GRU unit used to encode in...
stack_v2_sparse_classes_36k_train_025064
11,020
no_license
[ { "docstring": "Initialize GRU-ODE model. This module is intended for use as the encoder of a Latent ODE. Args: latent_dim (int): Dimension of latent state. rec_gru (nn.Module): GRU used to encoder input data. rec_node (nn.Module): NODE used to evolve state between GRU units. rec_output (nn.Module): Final linea...
4
stack_v2_sparse_classes_30k_train_004854
Implement the Python class `EncoderGRUODE` described below. Class description: GRU with hidden dynamics represented by Neural ODE. Implements the GRU-ODE model in: https://arxiv.org/abs/1907.03907. Observations are encoded by a GRU. Between observations, the hidden state is evolved using a Neural ODE. Attributes: gru ...
Implement the Python class `EncoderGRUODE` described below. Class description: GRU with hidden dynamics represented by Neural ODE. Implements the GRU-ODE model in: https://arxiv.org/abs/1907.03907. Observations are encoded by a GRU. Between observations, the hidden state is evolved using a Neural ODE. Attributes: gru ...
3a84121a33e7fa7a97f81a33c09a2369e613b700
<|skeleton|> class EncoderGRUODE: """GRU with hidden dynamics represented by Neural ODE. Implements the GRU-ODE model in: https://arxiv.org/abs/1907.03907. Observations are encoded by a GRU. Between observations, the hidden state is evolved using a Neural ODE. Attributes: gru (nn.Module): GRU unit used to encode in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderGRUODE: """GRU with hidden dynamics represented by Neural ODE. Implements the GRU-ODE model in: https://arxiv.org/abs/1907.03907. Observations are encoded by a GRU. Between observations, the hidden state is evolved using a Neural ODE. Attributes: gru (nn.Module): GRU unit used to encode input data. nod...
the_stack_v2_python_sparse
latode_model.py
IanShi1996/LatentSegmentedODE
train
2
02c5d18dede9dd26448811ea2bffc91ad73f2965
[ "methods = self.mapped('force_tax_rounding_method')\nif len(methods) > 1:\n raise ValidationError(_('> 1 force rounding method!'))\nif len(methods) == 1:\n self = self.with_context(force_tax_rounding_method=methods[0])\nreturn super(SaleOrder, self)._amount_all(field_name, arg)", "val = 0.0\nline_obj = self...
<|body_start_0|> methods = self.mapped('force_tax_rounding_method') if len(methods) > 1: raise ValidationError(_('> 1 force rounding method!')) if len(methods) == 1: self = self.with_context(force_tax_rounding_method=methods[0]) return super(SaleOrder, self)._amou...
SaleOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaleOrder: def _amount_all(self, field_name, arg): """Pass context when force_tax_rounding_method is set""" <|body_0|> def _amount_line_tax(self, cr, uid, line, context=None): """Overwrite, to add context to compute_all()""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_025065
1,437
no_license
[ { "docstring": "Pass context when force_tax_rounding_method is set", "name": "_amount_all", "signature": "def _amount_all(self, field_name, arg)" }, { "docstring": "Overwrite, to add context to compute_all()", "name": "_amount_line_tax", "signature": "def _amount_line_tax(self, cr, uid, ...
2
stack_v2_sparse_classes_30k_train_020958
Implement the Python class `SaleOrder` described below. Class description: Implement the SaleOrder class. Method signatures and docstrings: - def _amount_all(self, field_name, arg): Pass context when force_tax_rounding_method is set - def _amount_line_tax(self, cr, uid, line, context=None): Overwrite, to add context ...
Implement the Python class `SaleOrder` described below. Class description: Implement the SaleOrder class. Method signatures and docstrings: - def _amount_all(self, field_name, arg): Pass context when force_tax_rounding_method is set - def _amount_line_tax(self, cr, uid, line, context=None): Overwrite, to add context ...
e8c21082c187f4639373b29a7a0905d069d770f2
<|skeleton|> class SaleOrder: def _amount_all(self, field_name, arg): """Pass context when force_tax_rounding_method is set""" <|body_0|> def _amount_line_tax(self, cr, uid, line, context=None): """Overwrite, to add context to compute_all()""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaleOrder: def _amount_all(self, field_name, arg): """Pass context when force_tax_rounding_method is set""" methods = self.mapped('force_tax_rounding_method') if len(methods) > 1: raise ValidationError(_('> 1 force rounding method!')) if len(methods) == 1: ...
the_stack_v2_python_sparse
account_tax_force_rounding_method/models/sale.py
pabi2/pb2_addons
train
6
ed32bf2653aa8715fd18dcee636f620cc5f917b4
[ "QtGui.QWidget.__init__(self, parent)\nself.rowCount = 1\nself.colCount = 1\ngridLayout = QtGui.QGridLayout(self)\ngridLayout.setSpacing(0)\nself.setLayout(gridLayout)\nlabel = QVirtualCellLabel('')\nself.layout().addWidget(label, 0, 0, 1, 1, QtCore.Qt.AlignCenter)\nself.cells = [[label]]\nself.numCell = 1", "whi...
<|body_start_0|> QtGui.QWidget.__init__(self, parent) self.rowCount = 1 self.colCount = 1 gridLayout = QtGui.QGridLayout(self) gridLayout.setSpacing(0) self.setLayout(gridLayout) label = QVirtualCellLabel('') self.layout().addWidget(label, 0, 0, 1, 1, QtCo...
QVirtualCellConfiguration is a widget provide a virtual layout of the spreadsheet cell. Given a number of cells want to layout, it will let users interactively select where to put a cell in a table layout to construct a virtual cell out of that.
QVirtualCellConfiguration
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QVirtualCellConfiguration: """QVirtualCellConfiguration is a widget provide a virtual layout of the spreadsheet cell. Given a number of cells want to layout, it will let users interactively select where to put a cell in a table layout to construct a virtual cell out of that.""" def __init__(...
stack_v2_sparse_classes_36k_train_025066
25,543
permissive
[ { "docstring": "QVirtualCellConfiguration(parent: QWidget) -> QVirtualCellConfiguration Initialize the widget", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "clear() -> None Remove and delete all widgets in self.gridLayout", "name": "clear", "signa...
6
null
Implement the Python class `QVirtualCellConfiguration` described below. Class description: QVirtualCellConfiguration is a widget provide a virtual layout of the spreadsheet cell. Given a number of cells want to layout, it will let users interactively select where to put a cell in a table layout to construct a virtual ...
Implement the Python class `QVirtualCellConfiguration` described below. Class description: QVirtualCellConfiguration is a widget provide a virtual layout of the spreadsheet cell. Given a number of cells want to layout, it will let users interactively select where to put a cell in a table layout to construct a virtual ...
23ef56ec24b85c82416e1437a08381635328abe5
<|skeleton|> class QVirtualCellConfiguration: """QVirtualCellConfiguration is a widget provide a virtual layout of the spreadsheet cell. Given a number of cells want to layout, it will let users interactively select where to put a cell in a table layout to construct a virtual cell out of that.""" def __init__(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QVirtualCellConfiguration: """QVirtualCellConfiguration is a widget provide a virtual layout of the spreadsheet cell. Given a number of cells want to layout, it will let users interactively select where to put a cell in a table layout to construct a virtual cell out of that.""" def __init__(self, parent=...
the_stack_v2_python_sparse
vistrails_current/vistrails/gui/paramexplore/virtual_cell.py
lumig242/VisTrailsRecommendation
train
3
581b4545b1ecc60b756adea3486c6b03c95fb0d3
[ "super().__init__()\nself.gats = nn.ModuleList([GATConv(in_dim, out_dim, num_heads, dropout, dropout, activation=F.elu) for _ in range(num_metapaths)])\nself.semantic_attention = SemanticAttention(in_dim=num_heads * out_dim)", "zp = [gat(g, h).flatten(start_dim=1) for gat, g in zip(self.gats, gs)]\nzp = torch.sta...
<|body_start_0|> super().__init__() self.gats = nn.ModuleList([GATConv(in_dim, out_dim, num_heads, dropout, dropout, activation=F.elu) for _ in range(num_metapaths)]) self.semantic_attention = SemanticAttention(in_dim=num_heads * out_dim) <|end_body_0|> <|body_start_1|> zp = [gat(g, h)....
HANLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HANLayer: def __init__(self, num_metapaths, in_dim, out_dim, num_heads, dropout): """HAN层 :param num_metapaths: int 元路径个数 :param in_dim: int 输入特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param dropout: float Dropout概率""" <|body_0|> def forward(self, gs, h):...
stack_v2_sparse_classes_36k_train_025067
3,582
no_license
[ { "docstring": "HAN层 :param num_metapaths: int 元路径个数 :param in_dim: int 输入特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param dropout: float Dropout概率", "name": "__init__", "signature": "def __init__(self, num_metapaths, in_dim, out_dim, num_heads, dropout)" }, { "docstring": ":p...
2
null
Implement the Python class `HANLayer` described below. Class description: Implement the HANLayer class. Method signatures and docstrings: - def __init__(self, num_metapaths, in_dim, out_dim, num_heads, dropout): HAN层 :param num_metapaths: int 元路径个数 :param in_dim: int 输入特征维数 :param out_dim: int 输出特征维数 :param num_heads...
Implement the Python class `HANLayer` described below. Class description: Implement the HANLayer class. Method signatures and docstrings: - def __init__(self, num_metapaths, in_dim, out_dim, num_heads, dropout): HAN层 :param num_metapaths: int 元路径个数 :param in_dim: int 输入特征维数 :param out_dim: int 输出特征维数 :param num_heads...
b40071dc9f9fb20f081f4ed4944a7b65de919c18
<|skeleton|> class HANLayer: def __init__(self, num_metapaths, in_dim, out_dim, num_heads, dropout): """HAN层 :param num_metapaths: int 元路径个数 :param in_dim: int 输入特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param dropout: float Dropout概率""" <|body_0|> def forward(self, gs, h):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HANLayer: def __init__(self, num_metapaths, in_dim, out_dim, num_heads, dropout): """HAN层 :param num_metapaths: int 元路径个数 :param in_dim: int 输入特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param dropout: float Dropout概率""" super().__init__() self.gats = nn.ModuleList([G...
the_stack_v2_python_sparse
gnn/han/model.py
deepdumbo/pytorch-tutorial-1
train
0
6b73ac4b3bc78b60632af28d95923be1a41b7ded
[ "classstudy_obj = models.ClassStudyRecord.objects.all()\nprint(classstudy_obj)\nreturn render(request, 'jilu/classstudyrecord.html', {'classstudy_obj': classstudy_obj})", "action = request.POST.get('action')\nselected_id = request.POST.get('selected_id')\nif hasattr(self, action):\n print(1)\n getattr(self,...
<|body_start_0|> classstudy_obj = models.ClassStudyRecord.objects.all() print(classstudy_obj) return render(request, 'jilu/classstudyrecord.html', {'classstudy_obj': classstudy_obj}) <|end_body_0|> <|body_start_1|> action = request.POST.get('action') selected_id = request.POST.g...
ClassStudyRecord
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassStudyRecord: def get(self, request): """获取班级课程记录表的信息并将其呈现在网页上 :param request: :return:""" <|body_0|> def post(self, request): """从网页上获取用户进行的操作action :param request: :return:""" <|body_1|> def batch_delete(self, selected_id): """用户在班级课程页面上进行的...
stack_v2_sparse_classes_36k_train_025068
19,697
no_license
[ { "docstring": "获取班级课程记录表的信息并将其呈现在网页上 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "从网页上获取用户进行的操作action :param request: :return:", "name": "post", "signature": "def post(self, request)" }, { "docstring": "用户在班级课程页面上进行的操作的后台执行流程...
3
stack_v2_sparse_classes_30k_train_007805
Implement the Python class `ClassStudyRecord` described below. Class description: Implement the ClassStudyRecord class. Method signatures and docstrings: - def get(self, request): 获取班级课程记录表的信息并将其呈现在网页上 :param request: :return: - def post(self, request): 从网页上获取用户进行的操作action :param request: :return: - def batch_delete(...
Implement the Python class `ClassStudyRecord` described below. Class description: Implement the ClassStudyRecord class. Method signatures and docstrings: - def get(self, request): 获取班级课程记录表的信息并将其呈现在网页上 :param request: :return: - def post(self, request): 从网页上获取用户进行的操作action :param request: :return: - def batch_delete(...
8751baf67a744867a93ac02dc5ef96b70431e35c
<|skeleton|> class ClassStudyRecord: def get(self, request): """获取班级课程记录表的信息并将其呈现在网页上 :param request: :return:""" <|body_0|> def post(self, request): """从网页上获取用户进行的操作action :param request: :return:""" <|body_1|> def batch_delete(self, selected_id): """用户在班级课程页面上进行的...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassStudyRecord: def get(self, request): """获取班级课程记录表的信息并将其呈现在网页上 :param request: :return:""" classstudy_obj = models.ClassStudyRecord.objects.all() print(classstudy_obj) return render(request, 'jilu/classstudyrecord.html', {'classstudy_obj': classstudy_obj}) def post(sel...
the_stack_v2_python_sparse
crmtest/app01/views.py
jingdaonb/personal
train
0
7eefa4659b288fb2898642600fc25b5a02727a94
[ "super(CachingDescriptorSystem, self).__init__(self.load_item, resources_fs, error_tracker, render_template)\nself.modulestore = modulestore\nself.module_data = module_data\nself.default_class = default_class\nself.course_id = None\nself.cached_metadata = cached_metadata", "location = Location(location)\njson_dat...
<|body_start_0|> super(CachingDescriptorSystem, self).__init__(self.load_item, resources_fs, error_tracker, render_template) self.modulestore = modulestore self.module_data = module_data self.default_class = default_class self.course_id = None self.cached_metadata = cache...
A system that has a cache of module json that it will use to load modules from, with a backup of calling to the underlying modulestore for more data TODO (cdodge) when the 'split module store' work has been completed we can remove all references to metadata_inheritance_tree
CachingDescriptorSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachingDescriptorSystem: """A system that has a cache of module json that it will use to load modules from, with a backup of calling to the underlying modulestore for more data TODO (cdodge) when the 'split module store' work has been completed we can remove all references to metadata_inheritance...
stack_v2_sparse_classes_36k_train_025069
32,025
no_license
[ { "docstring": "modulestore: the module store that can be used to retrieve additional modules module_data: a dict mapping Location -> json that was cached from the underlying modulestore default_class: The default_class to use when loading an XModuleDescriptor from the module_data resources_fs: a filesystem, as...
2
null
Implement the Python class `CachingDescriptorSystem` described below. Class description: A system that has a cache of module json that it will use to load modules from, with a backup of calling to the underlying modulestore for more data TODO (cdodge) when the 'split module store' work has been completed we can remove...
Implement the Python class `CachingDescriptorSystem` described below. Class description: A system that has a cache of module json that it will use to load modules from, with a backup of calling to the underlying modulestore for more data TODO (cdodge) when the 'split module store' work has been completed we can remove...
5fa3a818c3d41bd9c3eb25122e1d376c8910269c
<|skeleton|> class CachingDescriptorSystem: """A system that has a cache of module json that it will use to load modules from, with a backup of calling to the underlying modulestore for more data TODO (cdodge) when the 'split module store' work has been completed we can remove all references to metadata_inheritance...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CachingDescriptorSystem: """A system that has a cache of module json that it will use to load modules from, with a backup of calling to the underlying modulestore for more data TODO (cdodge) when the 'split module store' work has been completed we can remove all references to metadata_inheritance_tree""" ...
the_stack_v2_python_sparse
ExtractFeatures/Data/pratik98/mongo.py
vivekaxl/LexisNexis
train
9
976a57487acd724d1d05916f81826fe8d3f65d92
[ "if map_kwargs is None:\n map_kwargs = {}\nsuper(MappedDataset, self).__init__(*args, **kwargs)\nself.map_function = map_function\nself.map_kwargs = map_kwargs\nself.transpose = transpose\nself.force2d = force2d", "if self.transpose or self.force2d:\n array_buf = numpy.zeros(shape=self.shape, dtype=self.dty...
<|body_start_0|> if map_kwargs is None: map_kwargs = {} super(MappedDataset, self).__init__(*args, **kwargs) self.map_function = map_function self.map_kwargs = map_kwargs self.transpose = transpose self.force2d = force2d <|end_body_0|> <|body_start_1|> ...
h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others.
MappedDataset
[ "BSD-3-Clause-LBNL", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MappedDataset: """h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others.""" def __init__(self, map_function=None, map_kwargs=None, transpose=False, force2d=False, *...
stack_v2_sparse_classes_36k_train_025070
10,579
permissive
[ { "docstring": "Configure a MappedDatset Attach a map function to a h5py.Dataset (or derivative) and store the arguments to be fed into that map function whenever this object gets sliced. Args: map_function (function): function to be called on the value returned when parent class is sliced map_kwargs (dict): kw...
2
stack_v2_sparse_classes_30k_train_001494
Implement the Python class `MappedDataset` described below. Class description: h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others. Method signatures and docstrings: - def __init__(self, m...
Implement the Python class `MappedDataset` described below. Class description: h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others. Method signatures and docstrings: - def __init__(self, m...
9e2f2f08742281c4550bf03d70fc96d8f02ea92b
<|skeleton|> class MappedDataset: """h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others.""" def __init__(self, map_function=None, map_kwargs=None, transpose=False, force2d=False, *...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MappedDataset: """h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others.""" def __init__(self, map_function=None, map_kwargs=None, transpose=False, force2d=False, *args, **kwarg...
the_stack_v2_python_sparse
tokio/connectors/_hdf5.py
NERSC/pytokio
train
25
a79f2b320a2c60c1959ab1d201676f48dcaa96a8
[ "input_shape = (64, 64, 3)\nlatent_size = 5\ninputs = Input(latent_size)\ngenerator = WGenerator(image_shape=input_shape)(inputs)\ngenerator = Model(inputs=inputs, outputs=generator)\nprior = tf.random.normal([1, latent_size])\npred = generator.predict(prior)\nassert np.all(pred <= 1)\nassert np.all(0 <= pred)", ...
<|body_start_0|> input_shape = (64, 64, 3) latent_size = 5 inputs = Input(latent_size) generator = WGenerator(image_shape=input_shape)(inputs) generator = Model(inputs=inputs, outputs=generator) prior = tf.random.normal([1, latent_size]) pred = generator.predict(p...
TestWGAN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestWGAN: def test_generator_output(self): """Generator should yield image with range [0, 1]""" <|body_0|> def test_discriminator_weight_updates(self): """Discriminator weights should be restrcited into constraint range""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_025071
3,384
no_license
[ { "docstring": "Generator should yield image with range [0, 1]", "name": "test_generator_output", "signature": "def test_generator_output(self)" }, { "docstring": "Discriminator weights should be restrcited into constraint range", "name": "test_discriminator_weight_updates", "signature":...
2
stack_v2_sparse_classes_30k_train_007337
Implement the Python class `TestWGAN` described below. Class description: Implement the TestWGAN class. Method signatures and docstrings: - def test_generator_output(self): Generator should yield image with range [0, 1] - def test_discriminator_weight_updates(self): Discriminator weights should be restrcited into con...
Implement the Python class `TestWGAN` described below. Class description: Implement the TestWGAN class. Method signatures and docstrings: - def test_generator_output(self): Generator should yield image with range [0, 1] - def test_discriminator_weight_updates(self): Discriminator weights should be restrcited into con...
5da5317cedd380c244f20a96213e883d6ef29de2
<|skeleton|> class TestWGAN: def test_generator_output(self): """Generator should yield image with range [0, 1]""" <|body_0|> def test_discriminator_weight_updates(self): """Discriminator weights should be restrcited into constraint range""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestWGAN: def test_generator_output(self): """Generator should yield image with range [0, 1]""" input_shape = (64, 64, 3) latent_size = 5 inputs = Input(latent_size) generator = WGenerator(image_shape=input_shape)(inputs) generator = Model(inputs=inputs, outputs...
the_stack_v2_python_sparse
Models/tf/Keras/_unittests/test_WGAN.py
MingRuey/mlbox
train
2
8830b92cf1f4d2413a1d2bd00a326583606ab299
[ "super().__init__(**kwargs)\nself.duration = self.template_args['duration']['default'] if not (isinstance(duration, int) and self.template_args['duration']['min'] > 0) else duration\nself.schema = 'https' if self.secure else 'http'\nself.headers = {'User-Agent': self.app_id, 'Content-Type': 'application/json'}\nsel...
<|body_start_0|> super().__init__(**kwargs) self.duration = self.template_args['duration']['default'] if not (isinstance(duration, int) and self.template_args['duration']['min'] > 0) else duration self.schema = 'https' if self.secure else 'http' self.headers = {'User-Agent': self.app_id,...
A wrapper for XBMC/KODI Notifications
NotifyXBMC
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifyXBMC: """A wrapper for XBMC/KODI Notifications""" def __init__(self, include_image=True, duration=None, **kwargs): """Initialize XBMC/KODI Object""" <|body_0|> def _payload_60(self, title, body, notify_type, **kwargs): """Builds payload for KODI API v6.0 Re...
stack_v2_sparse_classes_36k_train_025072
12,301
permissive
[ { "docstring": "Initialize XBMC/KODI Object", "name": "__init__", "signature": "def __init__(self, include_image=True, duration=None, **kwargs)" }, { "docstring": "Builds payload for KODI API v6.0 Returns (headers, payload)", "name": "_payload_60", "signature": "def _payload_60(self, tit...
6
stack_v2_sparse_classes_30k_train_005606
Implement the Python class `NotifyXBMC` described below. Class description: A wrapper for XBMC/KODI Notifications Method signatures and docstrings: - def __init__(self, include_image=True, duration=None, **kwargs): Initialize XBMC/KODI Object - def _payload_60(self, title, body, notify_type, **kwargs): Builds payload...
Implement the Python class `NotifyXBMC` described below. Class description: A wrapper for XBMC/KODI Notifications Method signatures and docstrings: - def __init__(self, include_image=True, duration=None, **kwargs): Initialize XBMC/KODI Object - def _payload_60(self, title, body, notify_type, **kwargs): Builds payload...
be3baed7e3d33bae973f1714df4ebbf65aa33f85
<|skeleton|> class NotifyXBMC: """A wrapper for XBMC/KODI Notifications""" def __init__(self, include_image=True, duration=None, **kwargs): """Initialize XBMC/KODI Object""" <|body_0|> def _payload_60(self, title, body, notify_type, **kwargs): """Builds payload for KODI API v6.0 Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotifyXBMC: """A wrapper for XBMC/KODI Notifications""" def __init__(self, include_image=True, duration=None, **kwargs): """Initialize XBMC/KODI Object""" super().__init__(**kwargs) self.duration = self.template_args['duration']['default'] if not (isinstance(duration, int) and sel...
the_stack_v2_python_sparse
apprise/plugins/NotifyXBMC.py
caronc/apprise
train
8,426
ad00c214a13b2dd22b621a5aef6234637fc6ceaa
[ "self.alphabet_size = alphabet_size\nself.ngram = ngram\nself.dictionary = {}", "if len(password) < self.ngram:\n return\nfor letter in password:\n if letter in ['\\t']:\n continue\n if letter in self.dictionary:\n self.dictionary[letter] += 1\n else:\n self.dictionary[letter] = 1...
<|body_start_0|> self.alphabet_size = alphabet_size self.ngram = ngram self.dictionary = {} <|end_body_0|> <|body_start_1|> if len(password) < self.ngram: return for letter in password: if letter in ['\t']: continue if letter i...
Class that generates and alphabet of the most common letters seen Making this a class so I can re-use trainer_file_io to read the passwords one at a time, and pass them into this
AlphabetGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphabetGenerator: """Class that generates and alphabet of the most common letters seen Making this a class so I can re-use trainer_file_io to read the passwords one at a time, and pass them into this""" def __init__(self, alphabet_size, ngram): """Initialize the alphabet generator V...
stack_v2_sparse_classes_36k_train_025073
2,752
no_license
[ { "docstring": "Initialize the alphabet generator Values: alphabet_size: The number of characters to save to the alphabet ngram: The ngram count for this grammar Used to identify the minimum size of passwords to train on", "name": "__init__", "signature": "def __init__(self, alphabet_size, ngram)" }, ...
3
stack_v2_sparse_classes_30k_train_003902
Implement the Python class `AlphabetGenerator` described below. Class description: Class that generates and alphabet of the most common letters seen Making this a class so I can re-use trainer_file_io to read the passwords one at a time, and pass them into this Method signatures and docstrings: - def __init__(self, a...
Implement the Python class `AlphabetGenerator` described below. Class description: Class that generates and alphabet of the most common letters seen Making this a class so I can re-use trainer_file_io to read the passwords one at a time, and pass them into this Method signatures and docstrings: - def __init__(self, a...
6fed1047838091edec7ce96679c3d0887073ed3b
<|skeleton|> class AlphabetGenerator: """Class that generates and alphabet of the most common letters seen Making this a class so I can re-use trainer_file_io to read the passwords one at a time, and pass them into this""" def __init__(self, alphabet_size, ngram): """Initialize the alphabet generator V...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlphabetGenerator: """Class that generates and alphabet of the most common letters seen Making this a class so I can re-use trainer_file_io to read the passwords one at a time, and pass them into this""" def __init__(self, alphabet_size, ngram): """Initialize the alphabet generator Values: alphab...
the_stack_v2_python_sparse
lib_trainer/omen/alphabet_generator.py
lakiw/pcfg_cracker
train
286
1dde1989edbc3ec619c4edf24ea611f8632a3b63
[ "super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_input, drop_rate)\nself.linear = tf.keras.layers.Dense(units=target_vocab)", "out1, _ = self.mha(x, x, x, mask)\nout1 = self.dropout1(out1, training=...
<|body_start_0|> super().__init__() self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate) self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_input, drop_rate) self.linear = tf.keras.layers.Dense(units=target_vocab) <|end_body_0|> <|body_start_1|> ...
DecoderBlock class
Transformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """DecoderBlock class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units...
stack_v2_sparse_classes_36k_train_025074
1,800
no_license
[ { "docstring": "Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully connected layer. drop_rate: (float) the dropout rate.", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, input_vocab, ta...
2
stack_v2_sparse_classes_30k_train_018092
Implement the Python class `Transformer` described below. Class description: DecoderBlock class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the ...
Implement the Python class `Transformer` described below. Class description: DecoderBlock class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the ...
75274394adb52d740f6cd4000cc00bbde44b9b72
<|skeleton|> class Transformer: """DecoderBlock class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transformer: """DecoderBlock class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/11-transformer.py
jdarangop/holbertonschool-machine_learning
train
2
87489201fd16eb33154ec958b656c835c9093e2e
[ "from sage.schemes.product_projective.space import is_ProductProjectiveSpaces\nif is_ProductProjectiveSpaces(self.codomain()):\n raise TypeError('this point must be a point on a subscheme of a product of projective spaces')\nreturn self.codomain().intersection_multiplicity(X, self)", "from sage.schemes.product...
<|body_start_0|> from sage.schemes.product_projective.space import is_ProductProjectiveSpaces if is_ProductProjectiveSpaces(self.codomain()): raise TypeError('this point must be a point on a subscheme of a product of projective spaces') return self.codomain().intersection_multiplicit...
ProductProjectiveSpaces_point_field
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductProjectiveSpaces_point_field: def intersection_multiplicity(self, X): """Return the intersection multiplicity of the codomain of this point and subscheme ``X`` at this point. This uses the subscheme implementation of intersection_multiplicity. This point must be a point on a subsc...
stack_v2_sparse_classes_36k_train_025075
19,274
no_license
[ { "docstring": "Return the intersection multiplicity of the codomain of this point and subscheme ``X`` at this point. This uses the subscheme implementation of intersection_multiplicity. This point must be a point on a subscheme of a product of projective spaces. INPUT: - ``X`` -- a subscheme in the same ambien...
2
stack_v2_sparse_classes_30k_train_008798
Implement the Python class `ProductProjectiveSpaces_point_field` described below. Class description: Implement the ProductProjectiveSpaces_point_field class. Method signatures and docstrings: - def intersection_multiplicity(self, X): Return the intersection multiplicity of the codomain of this point and subscheme ``X...
Implement the Python class `ProductProjectiveSpaces_point_field` described below. Class description: Implement the ProductProjectiveSpaces_point_field class. Method signatures and docstrings: - def intersection_multiplicity(self, X): Return the intersection multiplicity of the codomain of this point and subscheme ``X...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class ProductProjectiveSpaces_point_field: def intersection_multiplicity(self, X): """Return the intersection multiplicity of the codomain of this point and subscheme ``X`` at this point. This uses the subscheme implementation of intersection_multiplicity. This point must be a point on a subsc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductProjectiveSpaces_point_field: def intersection_multiplicity(self, X): """Return the intersection multiplicity of the codomain of this point and subscheme ``X`` at this point. This uses the subscheme implementation of intersection_multiplicity. This point must be a point on a subscheme of a prod...
the_stack_v2_python_sparse
sage/src/sage/schemes/product_projective/point.py
bopopescu/geosci
train
0
96724c43d250e93473a694c17134e1c7a1248d04
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MicrosoftAuthenticatorAuthenticationMethodConfiguration()", "from .authentication_method_configuration import AuthenticationMethodConfiguration\nfrom .microsoft_authenticator_authentication_method_target import MicrosoftAuthenticatorAu...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MicrosoftAuthenticatorAuthenticationMethodConfiguration() <|end_body_0|> <|body_start_1|> from .authentication_method_configuration import AuthenticationMethodConfiguration from .microso...
MicrosoftAuthenticatorAuthenticationMethodConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MicrosoftAuthenticatorAuthenticationMethodConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MicrosoftAuthenticatorAuthenticationMethodConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
stack_v2_sparse_classes_36k_train_025076
4,083
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: MicrosoftAuthenticatorAuthenticationMethodConfiguration", "name": "create_from_discriminator_value", "signat...
3
stack_v2_sparse_classes_30k_test_000314
Implement the Python class `MicrosoftAuthenticatorAuthenticationMethodConfiguration` described below. Class description: Implement the MicrosoftAuthenticatorAuthenticationMethodConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Microso...
Implement the Python class `MicrosoftAuthenticatorAuthenticationMethodConfiguration` described below. Class description: Implement the MicrosoftAuthenticatorAuthenticationMethodConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Microso...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MicrosoftAuthenticatorAuthenticationMethodConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MicrosoftAuthenticatorAuthenticationMethodConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MicrosoftAuthenticatorAuthenticationMethodConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MicrosoftAuthenticatorAuthenticationMethodConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse nod...
the_stack_v2_python_sparse
msgraph/generated/models/microsoft_authenticator_authentication_method_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
790e1bc996d03b7d6f4aeee8cb1f4bb932117324
[ "self.amount_total = 0.0\nfor data in self.commission_line:\n self.amount_total += data.amount", "account_jrnl_obj = self.env['account.journal'].search([('type', '=', 'purchase')], limit=1)\nfor data in self:\n inv_line_values = {'name': 'Commission For ' + data.number or '', 'analytic_account_id': data.ten...
<|body_start_0|> self.amount_total = 0.0 for data in self.commission_line: self.amount_total += data.amount <|end_body_0|> <|body_start_1|> account_jrnl_obj = self.env['account.journal'].search([('type', '=', 'purchase')], limit=1) for data in self: inv_line_valu...
CommissionInvoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommissionInvoice: def _amount_all(self): """Compute the total amounts of the SO.""" <|body_0|> def create_invoice(self): """This method is used to create supplier invoice. ------------------------------------------------------------ @param self: The object pointer""...
stack_v2_sparse_classes_36k_train_025077
11,342
no_license
[ { "docstring": "Compute the total amounts of the SO.", "name": "_amount_all", "signature": "def _amount_all(self)" }, { "docstring": "This method is used to create supplier invoice. ------------------------------------------------------------ @param self: The object pointer", "name": "create...
5
stack_v2_sparse_classes_30k_train_009711
Implement the Python class `CommissionInvoice` described below. Class description: Implement the CommissionInvoice class. Method signatures and docstrings: - def _amount_all(self): Compute the total amounts of the SO. - def create_invoice(self): This method is used to create supplier invoice. ------------------------...
Implement the Python class `CommissionInvoice` described below. Class description: Implement the CommissionInvoice class. Method signatures and docstrings: - def _amount_all(self): Compute the total amounts of the SO. - def create_invoice(self): This method is used to create supplier invoice. ------------------------...
163136f382faa8607db8fb6cda42a5ba07c4076b
<|skeleton|> class CommissionInvoice: def _amount_all(self): """Compute the total amounts of the SO.""" <|body_0|> def create_invoice(self): """This method is used to create supplier invoice. ------------------------------------------------------------ @param self: The object pointer""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommissionInvoice: def _amount_all(self): """Compute the total amounts of the SO.""" self.amount_total = 0.0 for data in self.commission_line: self.amount_total += data.amount def create_invoice(self): """This method is used to create supplier invoice. --------...
the_stack_v2_python_sparse
property_commission_ee/models/property_commission.py
maarejsys/Roya
train
0
41d0a4eeef47b8a2478b32980f723c1eab1456b0
[ "request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': unicode}, 'group_name': {'type': unicode}, 'role': {'type': unicode}})\nrest_utils.validate_inputs(request_dict)\nrole_name = request_dict.get('role')\nif role_name:\n rest_utils.verify_role(role_name)\nelse:\n role_name = constant...
<|body_start_0|> request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': unicode}, 'group_name': {'type': unicode}, 'role': {'type': unicode}}) rest_utils.validate_inputs(request_dict) role_name = request_dict.get('role') if role_name: rest_utils.verify_...
TenantGroups
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenantGroups: def put(self, multi_tenancy): """Add a group to a tenant""" <|body_0|> def patch(self, multi_tenancy): """Update role in group tenant association.""" <|body_1|> def delete(self, multi_tenancy): """Remove a group from a tenant""" ...
stack_v2_sparse_classes_36k_train_025078
9,658
permissive
[ { "docstring": "Add a group to a tenant", "name": "put", "signature": "def put(self, multi_tenancy)" }, { "docstring": "Update role in group tenant association.", "name": "patch", "signature": "def patch(self, multi_tenancy)" }, { "docstring": "Remove a group from a tenant", ...
3
stack_v2_sparse_classes_30k_train_007219
Implement the Python class `TenantGroups` described below. Class description: Implement the TenantGroups class. Method signatures and docstrings: - def put(self, multi_tenancy): Add a group to a tenant - def patch(self, multi_tenancy): Update role in group tenant association. - def delete(self, multi_tenancy): Remove...
Implement the Python class `TenantGroups` described below. Class description: Implement the TenantGroups class. Method signatures and docstrings: - def put(self, multi_tenancy): Add a group to a tenant - def patch(self, multi_tenancy): Update role in group tenant association. - def delete(self, multi_tenancy): Remove...
760affb83facbe154c35c6ce20acb9432daa8bbd
<|skeleton|> class TenantGroups: def put(self, multi_tenancy): """Add a group to a tenant""" <|body_0|> def patch(self, multi_tenancy): """Update role in group tenant association.""" <|body_1|> def delete(self, multi_tenancy): """Remove a group from a tenant""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenantGroups: def put(self, multi_tenancy): """Add a group to a tenant""" request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': unicode}, 'group_name': {'type': unicode}, 'role': {'type': unicode}}) rest_utils.validate_inputs(request_dict) role_name = re...
the_stack_v2_python_sparse
rest-service/manager_rest/rest/resources_v3/tenants.py
Metaswitch/cloudify-manager
train
0
8cd6b630fe3755d48fbd8218cc395b12b8528bff
[ "super().__init__()\nargs = parse_args()\nif args.model_name == 'faster_rcnn':\n self.model = models.detection.fasterrcnn_resnet50_fpn(pretrained=True).eval()\nelif args.model_name == 'yolov3':\n yolov3_url = 'https://github.com/ultralytics/yolov3/releases/download/v9.6.0/yolov3.pt'\n if not os.path.exists...
<|body_start_0|> super().__init__() args = parse_args() if args.model_name == 'faster_rcnn': self.model = models.detection.fasterrcnn_resnet50_fpn(pretrained=True).eval() elif args.model_name == 'yolov3': yolov3_url = 'https://github.com/ultralytics/yolov3/release...
python inference model
Predictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predictor: """python inference model""" def __init__(self): """model name""" <|body_0|> def forward(self, x): """model forward inference Args: x: input Returns: y_pred: output""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() ...
stack_v2_sparse_classes_36k_train_025079
6,047
no_license
[ { "docstring": "model name", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "model forward inference Args: x: input Returns: y_pred: output", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_009942
Implement the Python class `Predictor` described below. Class description: python inference model Method signatures and docstrings: - def __init__(self): model name - def forward(self, x): model forward inference Args: x: input Returns: y_pred: output
Implement the Python class `Predictor` described below. Class description: python inference model Method signatures and docstrings: - def __init__(self): model name - def forward(self, x): model forward inference Args: x: input Returns: y_pred: output <|skeleton|> class Predictor: """python inference model""" ...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class Predictor: """python inference model""" def __init__(self): """model name""" <|body_0|> def forward(self, x): """model forward inference Args: x: input Returns: y_pred: output""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Predictor: """python inference model""" def __init__(self): """model name""" super().__init__() args = parse_args() if args.model_name == 'faster_rcnn': self.model = models.detection.fasterrcnn_resnet50_fpn(pretrained=True).eval() elif args.model_name =...
the_stack_v2_python_sparse
inference/benchmark/python/torch/detection_benchmark.py
PaddlePaddle/PaddleTest
train
42
4e3e9e8730cfd84c5ebcbb0e960f2edca827b38f
[ "super(STSeqCls, self).__init__()\nself.enc = StarTransEnc(embed=embed, hidden_size=hidden_size, num_layers=num_layers, num_head=num_head, head_dim=head_dim, max_len=max_len, emb_dropout=emb_dropout, dropout=dropout)\nself.cls = _Cls(hidden_size, num_cls, cls_hidden_size, dropout=dropout)", "mask = seq_len_to_mas...
<|body_start_0|> super(STSeqCls, self).__init__() self.enc = StarTransEnc(embed=embed, hidden_size=hidden_size, num_layers=num_layers, num_head=num_head, head_dim=head_dim, max_len=max_len, emb_dropout=emb_dropout, dropout=dropout) self.cls = _Cls(hidden_size, num_cls, cls_hidden_size, dropout=d...
用于分类任务的Star-Transformer
STSeqCls
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class STSeqCls: """用于分类任务的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维...
stack_v2_sparse_classes_36k_train_025080
11,601
permissive
[ { "docstring": ":param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维度. 也可以传入 nn.Embedding 对象, 此时就以传入的对象作为embedding :param num_cls: 输出类别个数 :param hidden_size: 模型中特征维度. Default: 300 :param num_layers: 模型层数. Default: 4 :param num_head: 模型中multi-head的head个数. Default: 8 :param head_d...
3
stack_v2_sparse_classes_30k_train_008481
Implement the Python class `STSeqCls` described below. Class description: 用于分类任务的Star-Transformer Method signatures and docstrings: - def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): :param embed: 单词词典, 可以是 tupl...
Implement the Python class `STSeqCls` described below. Class description: 用于分类任务的Star-Transformer Method signatures and docstrings: - def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): :param embed: 单词词典, 可以是 tupl...
dffc7a06cdbff2671a3ca73d2398159d91a4a7db
<|skeleton|> class STSeqCls: """用于分类任务的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class STSeqCls: """用于分类任务的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维度. 也可以传入 nn.E...
the_stack_v2_python_sparse
phenobert/utils/fastNLP/models/star_transformer.py
TianlabTech/PhenoBERT
train
2
feae9baf17c6df0ae31df2687f79190cb2d9a611
[ "self._logger = logger\nif logger == None:\n self._logger = Logger('OneWireTemp', Logger.INFO)\nself._logger.debug('Initialize OneWireTemp')\nself._test = False", "device_folder = glob.glob(base_dir + '28*')[x]\ndevice_file = device_folder + '/w1_slave'\nself._logger.debug('{} {}, {} {}, {} {}'.format('In read...
<|body_start_0|> self._logger = logger if logger == None: self._logger = Logger('OneWireTemp', Logger.INFO) self._logger.debug('Initialize OneWireTemp') self._test = False <|end_body_0|> <|body_start_1|> device_folder = glob.glob(base_dir + '28*')[x] device_f...
OneWireTemp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OneWireTemp: def __init__(self, logger=None): """Create sensor object Args: None Returns: None Raises: None""" <|body_0|> def read_temp_raw(self, x): """Read sensor buffer Args: x: number of the sensor Returns: lines: lines read Raises: None""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_025081
2,998
no_license
[ { "docstring": "Create sensor object Args: None Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, logger=None)" }, { "docstring": "Read sensor buffer Args: x: number of the sensor Returns: lines: lines read Raises: None", "name": "read_temp_raw", "signatur...
3
stack_v2_sparse_classes_30k_train_017205
Implement the Python class `OneWireTemp` described below. Class description: Implement the OneWireTemp class. Method signatures and docstrings: - def __init__(self, logger=None): Create sensor object Args: None Returns: None Raises: None - def read_temp_raw(self, x): Read sensor buffer Args: x: number of the sensor R...
Implement the Python class `OneWireTemp` described below. Class description: Implement the OneWireTemp class. Method signatures and docstrings: - def __init__(self, logger=None): Create sensor object Args: None Returns: None Raises: None - def read_temp_raw(self, x): Read sensor buffer Args: x: number of the sensor R...
f93a15eaa81914f2041185dc3fbcc67036bd9d2a
<|skeleton|> class OneWireTemp: def __init__(self, logger=None): """Create sensor object Args: None Returns: None Raises: None""" <|body_0|> def read_temp_raw(self, x): """Read sensor buffer Args: x: number of the sensor Returns: lines: lines read Raises: None""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OneWireTemp: def __init__(self, logger=None): """Create sensor object Args: None Returns: None Raises: None""" self._logger = logger if logger == None: self._logger = Logger('OneWireTemp', Logger.INFO) self._logger.debug('Initialize OneWireTemp') self._test ...
the_stack_v2_python_sparse
MVP/python/OneWireTemp.py
webbhm/NerdFarm
train
1
eae7869fdc8163dce9c31051a4e39b7f98cc0330
[ "self.main_window = QtGui.QWidget()\nself.gui = Gui()\nself.gui.setupUi(self.main_window)\nself.gui.drawing_widget.mousePressEvent = self.mouse_press\nself.gui.drawing_widget.paintEvent = self.paint_event\nself.ttt = TicTacToeModel()", "w = self.gui.drawing_widget.width() // 3\nh = self.gui.drawing_widget.height(...
<|body_start_0|> self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) self.gui.drawing_widget.mousePressEvent = self.mouse_press self.gui.drawing_widget.paintEvent = self.paint_event self.ttt = TicTacToeModel() <|end_body_0|> <|body_star...
Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.
App
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" <|body_0|> def mouse_press(self, event): """Called automatically whenever the drawing wi...
stack_v2_sparse_classes_36k_train_025082
4,727
no_license
[ { "docstring": "Initialize the gui.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Called automatically whenever the drawing widget is clicked. :param PyQt.QtGui.QMouseEvent event: The event object from PyQt. :return: None", "name": "mouse_press", "signature":...
3
stack_v2_sparse_classes_30k_test_000717
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def mouse_press(self, event): Called automatically wh...
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def mouse_press(self, event): Called automatically wh...
0e3470085083012f893adb22aa46d46039016965
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" <|body_0|> def mouse_press(self, event): """Called automatically whenever the drawing wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) sel...
the_stack_v2_python_sparse
CS_210 (Introduction to Programming)/TicTacToe/DrawApp.py
JacobOrner/USAFA
train
0
e7f218f9bd56620e872389aa1adccae21993341a
[ "res = []\nif not root:\n return res\nqueue = [root, None]\nlevel = []\nwhile queue:\n node = queue.pop(0)\n if not node:\n if not level:\n break\n res.append(level.copy())\n level.clear()\n queue.append(None)\n continue\n level.append(node.val)\n if node...
<|body_start_0|> res = [] if not root: return res queue = [root, None] level = [] while queue: node = queue.pop(0) if not node: if not level: break res.append(level.copy()) lev...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def printFromTopToBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def printFromTopToBottom_2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res...
stack_v2_sparse_classes_36k_train_025083
2,922
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "printFromTopToBottom", "signature": "def printFromTopToBottom(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "printFromTopToBottom_2", "signature": "def printFromTopToBottom_2(...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printFromTopToBottom(self, root): :type root: TreeNode :rtype: List[List[int]] - def printFromTopToBottom_2(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printFromTopToBottom(self, root): :type root: TreeNode :rtype: List[List[int]] - def printFromTopToBottom_2(self, root): :type root: TreeNode :rtype: List[List[int]] <|skele...
967b0fbb40ae491b552bc3365a481e66324cb6f2
<|skeleton|> class Solution: def printFromTopToBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def printFromTopToBottom_2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def printFromTopToBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" res = [] if not root: return res queue = [root, None] level = [] while queue: node = queue.pop(0) if not node: ...
the_stack_v2_python_sparse
jianzhi_offer/26_分行从上到下打印二叉树.py
ryanatgz/data_structure_and_algorithm
train
0
907c79640dd9504afd7acba644f7f111948317d8
[ "data = DataObject()\ndata.add_value_string('ps_mode', ps_mode)\ndata.add_value_string('user_registry', user_registry)\ndata.add_value_string('admin_cert_lifetime', admin_cert_lifetime)\ndata.add_value_string('ssl_compliance', ssl_compliance)\ndata.add_value_string('admin_pwd', admin_password)\ndata.add_value_strin...
<|body_start_0|> data = DataObject() data.add_value_string('ps_mode', ps_mode) data.add_value_string('user_registry', user_registry) data.add_value_string('admin_cert_lifetime', admin_cert_lifetime) data.add_value_string('ssl_compliance', ssl_compliance) data.add_value_st...
RuntimeComponent10000
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuntimeComponent10000: def configure(self, ps_mode=None, user_registry=None, admin_password=None, ldap_password=None, admin_cert_lifetime=None, ssl_compliance=None, ldap_host=None, ldap_port=None, isam_domain=None, ldap_dn=None, ldap_suffix=None, ldap_ssl_db=None, ldap_ssl_label=None, isam_host=...
stack_v2_sparse_classes_36k_train_025084
19,491
permissive
[ { "docstring": "Configure the reverse proxy runtime component, including the policy server and user registry. Args: ps_mode (:obj:`str`): The mode for the policy server. Valid values are local and remote. user_registry (:obj:`str`): The type of user registry to be configured against. Valid values are local, lda...
2
null
Implement the Python class `RuntimeComponent10000` described below. Class description: Implement the RuntimeComponent10000 class. Method signatures and docstrings: - def configure(self, ps_mode=None, user_registry=None, admin_password=None, ldap_password=None, admin_cert_lifetime=None, ssl_compliance=None, ldap_host=...
Implement the Python class `RuntimeComponent10000` described below. Class description: Implement the RuntimeComponent10000 class. Method signatures and docstrings: - def configure(self, ps_mode=None, user_registry=None, admin_password=None, ldap_password=None, admin_cert_lifetime=None, ssl_compliance=None, ldap_host=...
168fe90d73e783fdc901c8da9c8a84644e9f8846
<|skeleton|> class RuntimeComponent10000: def configure(self, ps_mode=None, user_registry=None, admin_password=None, ldap_password=None, admin_cert_lifetime=None, ssl_compliance=None, ldap_host=None, ldap_port=None, isam_domain=None, ldap_dn=None, ldap_suffix=None, ldap_ssl_db=None, ldap_ssl_label=None, isam_host=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RuntimeComponent10000: def configure(self, ps_mode=None, user_registry=None, admin_password=None, ldap_password=None, admin_cert_lifetime=None, ssl_compliance=None, ldap_host=None, ldap_port=None, isam_domain=None, ldap_dn=None, ldap_suffix=None, ldap_ssl_db=None, ldap_ssl_label=None, isam_host=None, isam_por...
the_stack_v2_python_sparse
pyisva/core/web/runtimecomponent.py
lachlan-ibm/pyisva
train
0
d92774fea778843de6d1e1f3a2c76b4a48942e3f
[ "cnt = 0\nfor i in range(len(nums)):\n cur_sum = 0\n for j in range(i, -1, -1):\n cur_sum += nums[j]\n if cur_sum == k:\n cnt = cnt + 1\nreturn cnt", "cnt = 0\nsum_dict = {0: 1}\ncur_sum = 0\nfor i in range(len(nums)):\n cur_sum += nums[i]\n if sum_dict.get(cur_sum - k):\n ...
<|body_start_0|> cnt = 0 for i in range(len(nums)): cur_sum = 0 for j in range(i, -1, -1): cur_sum += nums[j] if cur_sum == k: cnt = cnt + 1 return cnt <|end_body_0|> <|body_start_1|> cnt = 0 sum_dict = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraySum(self, nums: List[int], k: int) -> int: """note:暴力求解 :param nums: :param k: :return:""" <|body_0|> def subarraySum2(self, nums: List[int], k: int) -> int: """note:sum([j,...,i]=k, pre[i]=sum([0,...,i]) , pre[i]-pre[j-1]=k :param nums: :param ...
stack_v2_sparse_classes_36k_train_025085
1,305
no_license
[ { "docstring": "note:暴力求解 :param nums: :param k: :return:", "name": "subarraySum", "signature": "def subarraySum(self, nums: List[int], k: int) -> int" }, { "docstring": "note:sum([j,...,i]=k, pre[i]=sum([0,...,i]) , pre[i]-pre[j-1]=k :param nums: :param k: :return:", "name": "subarraySum2",...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum(self, nums: List[int], k: int) -> int: note:暴力求解 :param nums: :param k: :return: - def subarraySum2(self, nums: List[int], k: int) -> int: note:sum([j,...,i]=k, p...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum(self, nums: List[int], k: int) -> int: note:暴力求解 :param nums: :param k: :return: - def subarraySum2(self, nums: List[int], k: int) -> int: note:sum([j,...,i]=k, p...
f7421522c437c952698736dbac8fb7ac6c0b8b88
<|skeleton|> class Solution: def subarraySum(self, nums: List[int], k: int) -> int: """note:暴力求解 :param nums: :param k: :return:""" <|body_0|> def subarraySum2(self, nums: List[int], k: int) -> int: """note:sum([j,...,i]=k, pre[i]=sum([0,...,i]) , pre[i]-pre[j-1]=k :param nums: :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subarraySum(self, nums: List[int], k: int) -> int: """note:暴力求解 :param nums: :param k: :return:""" cnt = 0 for i in range(len(nums)): cur_sum = 0 for j in range(i, -1, -1): cur_sum += nums[j] if cur_sum == k: ...
the_stack_v2_python_sparse
leetcode/daily_question/20200515_subarray_sum.py
whitepaper2/data_beauty
train
0
227cd1b352128c1d5120dc5da1d73ce8e9cdd9c0
[ "hash_set = set(words)\nfor word in words:\n for i in range(1, len(word)):\n if word[i:] in hash_set:\n hash_set.remove(word[i:])\nans = 0\nfor word in hash_set:\n ans += len(word) + 1\nreturn ans", "words = sorted((w[::-1] for w in words)) + ['']\nans = 0\nfor i in range(len(words) - 1):\...
<|body_start_0|> hash_set = set(words) for word in words: for i in range(1, len(word)): if word[i:] in hash_set: hash_set.remove(word[i:]) ans = 0 for word in hash_set: ans += len(word) + 1 return ans <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumLengthEncoding_MK1(self, words: List[str]) -> int: """暴力哈希""" <|body_0|> def minimumLengthEncoding_MK2(self, words: List[str]) -> int: """反转排序""" <|body_1|> def minimumLengthEncoding_MK3(self, words: List[str]) -> int: """Tri...
stack_v2_sparse_classes_36k_train_025086
1,219
no_license
[ { "docstring": "暴力哈希", "name": "minimumLengthEncoding_MK1", "signature": "def minimumLengthEncoding_MK1(self, words: List[str]) -> int" }, { "docstring": "反转排序", "name": "minimumLengthEncoding_MK2", "signature": "def minimumLengthEncoding_MK2(self, words: List[str]) -> int" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumLengthEncoding_MK1(self, words: List[str]) -> int: 暴力哈希 - def minimumLengthEncoding_MK2(self, words: List[str]) -> int: 反转排序 - def minimumLengthEncoding_MK3(self, word...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumLengthEncoding_MK1(self, words: List[str]) -> int: 暴力哈希 - def minimumLengthEncoding_MK2(self, words: List[str]) -> int: 反转排序 - def minimumLengthEncoding_MK3(self, word...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def minimumLengthEncoding_MK1(self, words: List[str]) -> int: """暴力哈希""" <|body_0|> def minimumLengthEncoding_MK2(self, words: List[str]) -> int: """反转排序""" <|body_1|> def minimumLengthEncoding_MK3(self, words: List[str]) -> int: """Tri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumLengthEncoding_MK1(self, words: List[str]) -> int: """暴力哈希""" hash_set = set(words) for word in words: for i in range(1, len(word)): if word[i:] in hash_set: hash_set.remove(word[i:]) ans = 0 for word ...
the_stack_v2_python_sparse
0820. Short Encoding of Words/Solution.py
faterazer/LeetCode
train
4
4f418842a5376a1bd7a9c0d3fbbb0887f9e8cdbf
[ "def removeInvalidRight(s, brackets='()'):\n count = 0\n ans = []\n for c in s:\n if c == brackets[0]:\n count += 1\n elif c == brackets[1]:\n count -= 1\n if count < 0:\n count += 1\n continue\n else:\n ans.append(c)\n r...
<|body_start_0|> def removeInvalidRight(s, brackets='()'): count = 0 ans = [] for c in s: if c == brackets[0]: count += 1 elif c == brackets[1]: count -= 1 if count < 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minRemoveToMakeValid(self, s): """:type s: str :rtype: str""" <|body_0|> def minRemoveToMakeValid2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> def removeInvalidRight(s, brackets='()'): ...
stack_v2_sparse_classes_36k_train_025087
2,824
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "minRemoveToMakeValid", "signature": "def minRemoveToMakeValid(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "minRemoveToMakeValid2", "signature": "def minRemoveToMakeValid2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minRemoveToMakeValid(self, s): :type s: str :rtype: str - def minRemoveToMakeValid2(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 minRemoveToMakeValid(self, s): :type s: str :rtype: str - def minRemoveToMakeValid2(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def minRemoveToMakeV...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def minRemoveToMakeValid(self, s): """:type s: str :rtype: str""" <|body_0|> def minRemoveToMakeValid2(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 minRemoveToMakeValid(self, s): """:type s: str :rtype: str""" def removeInvalidRight(s, brackets='()'): count = 0 ans = [] for c in s: if c == brackets[0]: count += 1 elif c == brackets[1]: ...
the_stack_v2_python_sparse
python_leetcode_2020/Python_Leetcode_2020/1249_min_remove_to_make_valid_parentheses.py
xiangcao/Leetcode
train
0
8dadf69a07909e886bb340691cf6cbd9a8e4868e
[ "for dtype in (tf.int32, tf.int64, tf.float32, tf.float64):\n identity_permutation = tf.range(10, dtype=dtype)\n random_shuffle_seed_1 = tff_rnd.stateless_random_shuffle(identity_permutation, seed=tf.constant((1, 42), tf.int64))\n random_shuffle_seed_2 = tff_rnd.stateless_random_shuffle(identity_permutatio...
<|body_start_0|> for dtype in (tf.int32, tf.int64, tf.float32, tf.float64): identity_permutation = tf.range(10, dtype=dtype) random_shuffle_seed_1 = tff_rnd.stateless_random_shuffle(identity_permutation, seed=tf.constant((1, 42), tf.int64)) random_shuffle_seed_2 = tff_rnd.sta...
StatelessRandomOpsTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatelessRandomOpsTest: def testOutputIsPermutation(self): """Checks that stateless_random_shuffle outputs a permutation.""" <|body_0|> def testOutputIsStateless(self): """Checks that stateless_random_shuffle is stateless.""" <|body_1|> def testOutputIsI...
stack_v2_sparse_classes_36k_train_025088
6,357
permissive
[ { "docstring": "Checks that stateless_random_shuffle outputs a permutation.", "name": "testOutputIsPermutation", "signature": "def testOutputIsPermutation(self)" }, { "docstring": "Checks that stateless_random_shuffle is stateless.", "name": "testOutputIsStateless", "signature": "def tes...
5
null
Implement the Python class `StatelessRandomOpsTest` described below. Class description: Implement the StatelessRandomOpsTest class. Method signatures and docstrings: - def testOutputIsPermutation(self): Checks that stateless_random_shuffle outputs a permutation. - def testOutputIsStateless(self): Checks that stateles...
Implement the Python class `StatelessRandomOpsTest` described below. Class description: Implement the StatelessRandomOpsTest class. Method signatures and docstrings: - def testOutputIsPermutation(self): Checks that stateless_random_shuffle outputs a permutation. - def testOutputIsStateless(self): Checks that stateles...
0d3a2193c0f2d320b65e602cf01d7a617da484df
<|skeleton|> class StatelessRandomOpsTest: def testOutputIsPermutation(self): """Checks that stateless_random_shuffle outputs a permutation.""" <|body_0|> def testOutputIsStateless(self): """Checks that stateless_random_shuffle is stateless.""" <|body_1|> def testOutputIsI...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StatelessRandomOpsTest: def testOutputIsPermutation(self): """Checks that stateless_random_shuffle outputs a permutation.""" for dtype in (tf.int32, tf.int64, tf.float32, tf.float64): identity_permutation = tf.range(10, dtype=dtype) random_shuffle_seed_1 = tff_rnd.state...
the_stack_v2_python_sparse
tf_quant_finance/math/random_ops/stateless_test.py
google/tf-quant-finance
train
4,165
0bda9f6572a872c51895eb44ebea3c386176da9a
[ "self._pt_1 = pt_3d_1\nself._pt_2 = pt_3d_2\nself._pt_3 = pt_3d_3", "def versor3d(pt_1, pt_2):\n \"\"\"\n\n :param pt_1:\n :param pt_2:\n :return:\n \"\"\"\n return Segment(pt_1, pt_2).vector().versor_full()\n\ndef is_pt_in_fascio(pt_1, pt_2, pt_3):\n \"\"\"\n\...
<|body_start_0|> self._pt_1 = pt_3d_1 self._pt_2 = pt_3d_2 self._pt_3 = pt_3d_3 <|end_body_0|> <|body_start_1|> def versor3d(pt_1, pt_2): """ :param pt_1: :param pt_2: :return: """ r...
CartesianTriangle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CartesianTriangle: def __init__(self, pt_3d_1, pt_3d_2, pt_3d_3): """:param pt_3d_1: :param pt_3d_2: :param pt_3d_3:""" <|body_0|> def is_pt_within(self, pt_3d): """:param pt_3d: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._pt_1 = ...
stack_v2_sparse_classes_36k_train_025089
18,232
no_license
[ { "docstring": ":param pt_3d_1: :param pt_3d_2: :param pt_3d_3:", "name": "__init__", "signature": "def __init__(self, pt_3d_1, pt_3d_2, pt_3d_3)" }, { "docstring": ":param pt_3d: :return:", "name": "is_pt_within", "signature": "def is_pt_within(self, pt_3d)" } ]
2
stack_v2_sparse_classes_30k_train_019402
Implement the Python class `CartesianTriangle` described below. Class description: Implement the CartesianTriangle class. Method signatures and docstrings: - def __init__(self, pt_3d_1, pt_3d_2, pt_3d_3): :param pt_3d_1: :param pt_3d_2: :param pt_3d_3: - def is_pt_within(self, pt_3d): :param pt_3d: :return:
Implement the Python class `CartesianTriangle` described below. Class description: Implement the CartesianTriangle class. Method signatures and docstrings: - def __init__(self, pt_3d_1, pt_3d_2, pt_3d_3): :param pt_3d_1: :param pt_3d_2: :param pt_3d_3: - def is_pt_within(self, pt_3d): :param pt_3d: :return: <|skelet...
b07ab23400b4ff4151555c2e81392a7adf99fc33
<|skeleton|> class CartesianTriangle: def __init__(self, pt_3d_1, pt_3d_2, pt_3d_3): """:param pt_3d_1: :param pt_3d_2: :param pt_3d_3:""" <|body_0|> def is_pt_within(self, pt_3d): """:param pt_3d: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CartesianTriangle: def __init__(self, pt_3d_1, pt_3d_2, pt_3d_3): """:param pt_3d_1: :param pt_3d_2: :param pt_3d_3:""" self._pt_1 = pt_3d_1 self._pt_2 = pt_3d_2 self._pt_3 = pt_3d_3 def is_pt_within(self, pt_3d): """:param pt_3d: :return:""" def versor3d(p...
the_stack_v2_python_sparse
pygsf/spatial/vectorial/meshes.py
mauroalberti/qgSurf
train
5
9ee58d9c3d533edbfef1cc1c36903fb204a22742
[ "self.id = id\nself.date = APIHelper.RFC3339DateTime(date) if date else None\nself.product_id = product_id\nself.description = description\nself.count = count\nself.customer_number = customer_number\nself.external_reference = external_reference\nself.department_id = department_id\nself.additional_properties = addit...
<|body_start_0|> self.id = id self.date = APIHelper.RFC3339DateTime(date) if date else None self.product_id = product_id self.description = description self.count = count self.customer_number = customer_number self.external_reference = external_reference s...
Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (string): Transaction ID date (datetime): The date for the transaction product_id (string): Product ID (SIGN, IDENTIFICATION etc) description (string): Transaction description count (int): Number of transactions for the selecte...
Transaction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transaction: """Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (string): Transaction ID date (datetime): The date for the transaction product_id (string): Product ID (SIGN, IDENTIFICATION etc) description (string): Transaction description count (int):...
stack_v2_sparse_classes_36k_train_025090
3,800
permissive
[ { "docstring": "Constructor for the Transaction class", "name": "__init__", "signature": "def __init__(self, id=None, date=None, product_id=None, description=None, count=None, customer_number=None, external_reference=None, department_id=None, additional_properties={})" }, { "docstring": "Creates...
2
stack_v2_sparse_classes_30k_train_007137
Implement the Python class `Transaction` described below. Class description: Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (string): Transaction ID date (datetime): The date for the transaction product_id (string): Product ID (SIGN, IDENTIFICATION etc) description (string...
Implement the Python class `Transaction` described below. Class description: Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (string): Transaction ID date (datetime): The date for the transaction product_id (string): Product ID (SIGN, IDENTIFICATION etc) description (string...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Transaction: """Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (string): Transaction ID date (datetime): The date for the transaction product_id (string): Product ID (SIGN, IDENTIFICATION etc) description (string): Transaction description count (int):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transaction: """Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (string): Transaction ID date (datetime): The date for the transaction product_id (string): Product ID (SIGN, IDENTIFICATION etc) description (string): Transaction description count (int): Number of tr...
the_stack_v2_python_sparse
idfy_rest_client/models/transaction.py
dealflowteam/Idfy
train
0
da25fbbe28fe1df1fc1952bb4bbd3d1ff74cb13b
[ "assert len(resultNodes) > 1\nqueryAttribute = queryNode.toDict()[attribute]\ntotalValue = relevanceScores[queryAttribute, resultNodes[0].toDict()[attribute]]\nfor i in xrange(1, len(resultNodes)):\n totalValue += relevanceScores[queryAttribute, resultNodes[i].toDict()[attribute]] / math.log(i + 1, 2)\nreturn to...
<|body_start_0|> assert len(resultNodes) > 1 queryAttribute = queryNode.toDict()[attribute] totalValue = relevanceScores[queryAttribute, resultNodes[0].toDict()[attribute]] for i in xrange(1, len(resultNodes)): totalValue += relevanceScores[queryAttribute, resultNodes[i].toDi...
Implements discounted cumulative gain, given some query (or queries) and relevance labels from 0 to 3 (least to most relevant).
CumulativeGainMeasures
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CumulativeGainMeasures: """Implements discounted cumulative gain, given some query (or queries) and relevance labels from 0 to 3 (least to most relevant).""" def discountedCumulativeGain(queryNode, resultNodes, relevanceScores, attribute='name'): """Computes the discounted cumulative...
stack_v2_sparse_classes_36k_train_025091
1,351
no_license
[ { "docstring": "Computes the discounted cumulative gain of some query", "name": "discountedCumulativeGain", "signature": "def discountedCumulativeGain(queryNode, resultNodes, relevanceScores, attribute='name')" }, { "docstring": "Calculate", "name": "normalizedDiscountedCumulativeGain", ...
2
null
Implement the Python class `CumulativeGainMeasures` described below. Class description: Implements discounted cumulative gain, given some query (or queries) and relevance labels from 0 to 3 (least to most relevant). Method signatures and docstrings: - def discountedCumulativeGain(queryNode, resultNodes, relevanceScor...
Implement the Python class `CumulativeGainMeasures` described below. Class description: Implements discounted cumulative gain, given some query (or queries) and relevance labels from 0 to 3 (least to most relevant). Method signatures and docstrings: - def discountedCumulativeGain(queryNode, resultNodes, relevanceScor...
253906f9a2fe4fb4d3451ebd1d3b51de51e0d239
<|skeleton|> class CumulativeGainMeasures: """Implements discounted cumulative gain, given some query (or queries) and relevance labels from 0 to 3 (least to most relevant).""" def discountedCumulativeGain(queryNode, resultNodes, relevanceScores, attribute='name'): """Computes the discounted cumulative...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CumulativeGainMeasures: """Implements discounted cumulative gain, given some query (or queries) and relevance labels from 0 to 3 (least to most relevant).""" def discountedCumulativeGain(queryNode, resultNodes, relevanceScores, attribute='name'): """Computes the discounted cumulative gain of some...
the_stack_v2_python_sparse
src/experiment/measure/CumulativeGainMeasures.py
wfnuser/RicherPathSIM
train
0
231b9c86fcad9a224466518886a8356e98813ff4
[ "for arg in self.non_number_values:\n self.assertRaises(TypeError, prev1.primes_list, arg)\nfor arg, val in self.primes_values:\n self.assertEqual(prev1.primes_list(arg), val)", "for arg in self.non_number_values:\n self.assertRaises(TypeError, prev1.primes_fun, arg)\nfor arg, val in self.primes_values:\...
<|body_start_0|> for arg in self.non_number_values: self.assertRaises(TypeError, prev1.primes_list, arg) for arg, val in self.primes_values: self.assertEqual(prev1.primes_list(arg), val) <|end_body_0|> <|body_start_1|> for arg in self.non_number_values: self....
TestPrimes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPrimes: def test_primes_list(self): """Testing primes_list function""" <|body_0|> def test_primes_fun(self): """Testing primes_fun function""" <|body_1|> def test_primes_map(self): """Testing primes_map function""" <|body_2|> def...
stack_v2_sparse_classes_36k_train_025092
8,451
no_license
[ { "docstring": "Testing primes_list function", "name": "test_primes_list", "signature": "def test_primes_list(self)" }, { "docstring": "Testing primes_fun function", "name": "test_primes_fun", "signature": "def test_primes_fun(self)" }, { "docstring": "Testing primes_map function...
4
stack_v2_sparse_classes_30k_train_005242
Implement the Python class `TestPrimes` described below. Class description: Implement the TestPrimes class. Method signatures and docstrings: - def test_primes_list(self): Testing primes_list function - def test_primes_fun(self): Testing primes_fun function - def test_primes_map(self): Testing primes_map function - d...
Implement the Python class `TestPrimes` described below. Class description: Implement the TestPrimes class. Method signatures and docstrings: - def test_primes_list(self): Testing primes_list function - def test_primes_fun(self): Testing primes_fun function - def test_primes_map(self): Testing primes_map function - d...
0cd4bbe3feb63b248d643303433f9fb2fc2def79
<|skeleton|> class TestPrimes: def test_primes_list(self): """Testing primes_list function""" <|body_0|> def test_primes_fun(self): """Testing primes_fun function""" <|body_1|> def test_primes_map(self): """Testing primes_map function""" <|body_2|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPrimes: def test_primes_list(self): """Testing primes_list function""" for arg in self.non_number_values: self.assertRaises(TypeError, prev1.primes_list, arg) for arg, val in self.primes_values: self.assertEqual(prev1.primes_list(arg), val) def test_pri...
the_stack_v2_python_sparse
Python - advanced course/Solutions/9/9.1.py
maxymilianz/CS-at-University-of-Wroclaw
train
0
ec06aacb55ae8a6fb88b3528b33fffcc2bdfc405
[ "queue = [root]\nret = []\nwhile queue:\n node = queue[0]\n queue = queue[1:]\n if not node:\n ret.append('null')\n continue\n ret.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\nreturn ','.join(ret)", "if not data or data == 'null':\n return None\nno...
<|body_start_0|> queue = [root] ret = [] while queue: node = queue[0] queue = queue[1:] if not node: ret.append('null') continue ret.append(str(node.val)) queue.append(node.left) queue.append(...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025093
1,649
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
9687f8e743a8b6396fff192f22b5256d1025f86b
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" queue = [root] ret = [] while queue: node = queue[0] queue = queue[1:] if not node: ret.append('null') ...
the_stack_v2_python_sparse
2022/practice/tree/xu-lie-hua-er-cha-shu-lcof.py
buhuipao/LeetCode
train
5
6bfd1fb98173ed4620edfc9ff4f1c0c88a59c8e1
[ "if basic_approximations is None:\n basic_approximations = generate_basic_approximations(basis_gates=['h', 't', 'tdg'], depth=10)\nself.basic_approximations = self.load_basic_approximations(basic_approximations)", "if isinstance(data, list):\n return data\nif isinstance(data, str):\n data = np.load(data,...
<|body_start_0|> if basic_approximations is None: basic_approximations = generate_basic_approximations(basis_gates=['h', 't', 'tdg'], depth=10) self.basic_approximations = self.load_basic_approximations(basic_approximations) <|end_body_0|> <|body_start_1|> if isinstance(data, list):...
The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information.
SolovayKitaevDecomposition
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolovayKitaevDecomposition: """The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information.""" def __init__(self, basic_approximations: str...
stack_v2_sparse_classes_36k_train_025094
8,166
permissive
[ { "docstring": "Args: basic_approximations: A specification of the basic SU(2) approximations in terms of discrete gates. At each iteration this algorithm, the remaining error is approximated with the closest sequence of gates in this set. If a ``str``, this specifies a ``.npy`` filename from which to load the ...
5
stack_v2_sparse_classes_30k_train_006031
Implement the Python class `SolovayKitaevDecomposition` described below. Class description: The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information. Method signa...
Implement the Python class `SolovayKitaevDecomposition` described below. Class description: The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information. Method signa...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class SolovayKitaevDecomposition: """The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information.""" def __init__(self, basic_approximations: str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolovayKitaevDecomposition: """The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information.""" def __init__(self, basic_approximations: str | dict[str, ...
the_stack_v2_python_sparse
qiskit/synthesis/discrete_basis/solovay_kitaev.py
1ucian0/qiskit-terra
train
6
84560eaf255e62046345ffe183427c23a1f61a47
[ "Parametre.__init__(self, 'liste', 'list')\nself.tronquer = True\nself.aide_courte = 'affiche les chambres libres'\nself.aide_longue = \"Cette commande permet de lister les chambres libres d'une auberge ainsi que leur prix au jour. Vous devez vous trouver auprès d'un aubergiste pour cela. Les chambres affichées son...
<|body_start_0|> Parametre.__init__(self, 'liste', 'list') self.tronquer = True self.aide_courte = 'affiche les chambres libres' self.aide_longue = "Cette commande permet de lister les chambres libres d'une auberge ainsi que leur prix au jour. Vous devez vous trouver auprès d'un aubergis...
Commande 'louer liste'
PrmListe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmListe: """Commande 'louer liste'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parame...
stack_v2_sparse_classes_36k_train_025095
4,343
permissive
[ { "docstring": "Constructeur du paramètre.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode d'interprétation de commande", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_006780
Implement the Python class `PrmListe` described below. Class description: Commande 'louer liste' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
Implement the Python class `PrmListe` described below. Class description: Commande 'louer liste' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande <|skeleton|> class PrmListe: """Commande 'loue...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmListe: """Commande 'louer liste'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmListe: """Commande 'louer liste'""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, 'liste', 'list') self.tronquer = True self.aide_courte = 'affiche les chambres libres' self.aide_longue = "Cette commande permet de lister les chamb...
the_stack_v2_python_sparse
src/secondaires/auberge/commandes/louer/liste.py
vincent-lg/tsunami
train
5
8f7b0b4aa4c06e4252afcf563cf9fdd7cfa09f76
[ "self.head = head\nn = 0\nhead = self.head\nwhile head:\n head = head.next\n n += 1\nself.length = n", "index = random.randint(0, self.length - 1)\nhead = self.head\nfor i in range(index):\n head = head.next\nreturn head.val" ]
<|body_start_0|> self.head = head n = 0 head = self.head while head: head = head.next n += 1 self.length = n <|end_body_0|> <|body_start_1|> index = random.randint(0, self.length - 1) head = self.head for i in range(index): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head: ListNode): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.""" <|body_0|> def getRandom(self) -> int: """Returns a random node's value.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_025096
1,645
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.", "name": "__init__", "signature": "def __init__(self, head: ListNode)" }, { "docstring": "Returns a random node's value.", "name": "getRandom", "signatu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. - def getRandom(self) -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. - def getRandom(self) -...
5be09b4a804cb600e61e24617b9b2a1cc78fab3f
<|skeleton|> class Solution: def __init__(self, head: ListNode): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.""" <|body_0|> def getRandom(self) -> int: """Returns a random node's value.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, head: ListNode): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.""" self.head = head n = 0 head = self.head while head: head = head.next n += 1...
the_stack_v2_python_sparse
382.py
aiifabbf/leetcode-memo
train
10
050355171af2ff18d5c1f598ae5913cb1222b63a
[ "self.count = 0\nself.alist = []\nself.wlist = []", "ndata = len(data)\nif self.count == 0:\n self.nchannels = ndata\n self.count += 1\n self.alist.append(data)\n self.wlist.append(wt)\nelif self.count > 0 and ndata != self.nchannels:\n print('accum:load - WARNING - number of points in spectrum doe...
<|body_start_0|> self.count = 0 self.alist = [] self.wlist = [] <|end_body_0|> <|body_start_1|> ndata = len(data) if self.count == 0: self.nchannels = ndata self.count += 1 self.alist.append(data) self.wlist.append(wt) elif...
Class to manage spectral averaging. All spectra to be averaged must be aligned in channel/index space. Weighted averages are possible using weight provided when spectrum is added to the stack.
Accum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Accum: """Class to manage spectral averaging. All spectra to be averaged must be aligned in channel/index space. Weighted averages are possible using weight provided when spectrum is added to the stack.""" def __init__(self): """Constructor for Accum class. Args: none Returns: none""...
stack_v2_sparse_classes_36k_train_025097
37,646
no_license
[ { "docstring": "Constructor for Accum class. Args: none Returns: none", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Loads a set of data to be averaged. Args: data (array): data array wt (float): weighting of data (default is 1) Returns: none", "name": "load", ...
3
stack_v2_sparse_classes_30k_train_019897
Implement the Python class `Accum` described below. Class description: Class to manage spectral averaging. All spectra to be averaged must be aligned in channel/index space. Weighted averages are possible using weight provided when spectrum is added to the stack. Method signatures and docstrings: - def __init__(self)...
Implement the Python class `Accum` described below. Class description: Class to manage spectral averaging. All spectra to be averaged must be aligned in channel/index space. Weighted averages are possible using weight provided when spectrum is added to the stack. Method signatures and docstrings: - def __init__(self)...
4064f6ca5d2807fbb99626838493d0f91cbd8748
<|skeleton|> class Accum: """Class to manage spectral averaging. All spectra to be averaged must be aligned in channel/index space. Weighted averages are possible using weight provided when spectrum is added to the stack.""" def __init__(self): """Constructor for Accum class. Args: none Returns: none""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Accum: """Class to manage spectral averaging. All spectra to be averaged must be aligned in channel/index space. Weighted averages are possible using weight provided when spectrum is added to the stack.""" def __init__(self): """Constructor for Accum class. Args: none Returns: none""" sel...
the_stack_v2_python_sparse
lmtslr/reduction/line_reduction.py
myunm82/SpectralLineReduction
train
0
3db7feb1de79faab52114f4bd7c60039622595ab
[ "cpu_state_proto = cpu_state_pb2.ArmV7mCpuState()\ncpu_state_info = exception_analyzer.CortexMExceptionAnalyzer(cpu_state_proto)\nself.assertFalse(cpu_state_info.is_fault_active())", "cpu_state_proto = cpu_state_pb2.ArmV7mCpuState()\ncpu_state_proto.cfsr = cortex_m_constants.PW_CORTEX_M_CFSR_STKOF_MASK | cortex_m...
<|body_start_0|> cpu_state_proto = cpu_state_pb2.ArmV7mCpuState() cpu_state_info = exception_analyzer.CortexMExceptionAnalyzer(cpu_state_proto) self.assertFalse(cpu_state_info.is_fault_active()) <|end_body_0|> <|body_start_1|> cpu_state_proto = cpu_state_pb2.ArmV7mCpuState() cpu...
Test basic fault analysis functions.
BasicFaultTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicFaultTest: """Test basic fault analysis functions.""" def test_empty_state(self): """Ensure an empty CPU state proto doesn't indicate an active fault.""" <|body_0|> def test_cfsr_fault(self): """Ensure a fault is active if CFSR bits are set.""" <|bod...
stack_v2_sparse_classes_36k_train_025098
9,689
permissive
[ { "docstring": "Ensure an empty CPU state proto doesn't indicate an active fault.", "name": "test_empty_state", "signature": "def test_empty_state(self)" }, { "docstring": "Ensure a fault is active if CFSR bits are set.", "name": "test_cfsr_fault", "signature": "def test_cfsr_fault(self)...
4
stack_v2_sparse_classes_30k_train_013135
Implement the Python class `BasicFaultTest` described below. Class description: Test basic fault analysis functions. Method signatures and docstrings: - def test_empty_state(self): Ensure an empty CPU state proto doesn't indicate an active fault. - def test_cfsr_fault(self): Ensure a fault is active if CFSR bits are ...
Implement the Python class `BasicFaultTest` described below. Class description: Test basic fault analysis functions. Method signatures and docstrings: - def test_empty_state(self): Ensure an empty CPU state proto doesn't indicate an active fault. - def test_cfsr_fault(self): Ensure a fault is active if CFSR bits are ...
7f3590b58e8398aad68c1e59702c459d2f8ca38e
<|skeleton|> class BasicFaultTest: """Test basic fault analysis functions.""" def test_empty_state(self): """Ensure an empty CPU state proto doesn't indicate an active fault.""" <|body_0|> def test_cfsr_fault(self): """Ensure a fault is active if CFSR bits are set.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicFaultTest: """Test basic fault analysis functions.""" def test_empty_state(self): """Ensure an empty CPU state proto doesn't indicate an active fault.""" cpu_state_proto = cpu_state_pb2.ArmV7mCpuState() cpu_state_info = exception_analyzer.CortexMExceptionAnalyzer(cpu_state_pr...
the_stack_v2_python_sparse
pw_cpu_exception_cortex_m/py/exception_analyzer_test.py
waelbarakat/pigweed
train
0
00eb25f819bddd566efd738bd13406b57ac48100
[ "self.canvas = canvas\nself.fig = canvas.fig\nself.tp = None\nself.hover_connection = None\nself.annot = None", "self.fig.clear()\nself.fig.ax = self.fig.add_subplot(1, 1, 1)\nself.fig.subplots_adjust(left=0.1, bottom=0.15, right=0.98, top=0.98, wspace=0.1, hspace=0)\ntemp, serial_time = meas.compute_time_series(...
<|body_start_0|> self.canvas = canvas self.fig = canvas.fig self.tp = None self.hover_connection = None self.annot = None <|end_body_0|> <|body_start_1|> self.fig.clear() self.fig.ax = self.fig.add_subplot(1, 1, 1) self.fig.subplots_adjust(left=0.1, botto...
Class to generate a time series graph of the ADCP temperature. Attributes ---------- canvas: MplCanvas Object of MplCanvas a FigureCanvas tp: list Reference to time series plot hover_connection: bool Switch to allow user to use the data cursor annot: Annotation Annotation object for data cursor
TemperatureTS
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain", "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemperatureTS: """Class to generate a time series graph of the ADCP temperature. Attributes ---------- canvas: MplCanvas Object of MplCanvas a FigureCanvas tp: list Reference to time series plot hover_connection: bool Switch to allow user to use the data cursor annot: Annotation Annotation object...
stack_v2_sparse_classes_36k_train_025099
6,879
permissive
[ { "docstring": "Initialize object using the specified canvas. Parameters ---------- canvas: MplCanvas Object of MplCanvas", "name": "__init__", "signature": "def __init__(self, canvas)" }, { "docstring": "Creates the figure on the canvas. Parameters ---------- meas: Measurement Object of class M...
5
null
Implement the Python class `TemperatureTS` described below. Class description: Class to generate a time series graph of the ADCP temperature. Attributes ---------- canvas: MplCanvas Object of MplCanvas a FigureCanvas tp: list Reference to time series plot hover_connection: bool Switch to allow user to use the data cur...
Implement the Python class `TemperatureTS` described below. Class description: Class to generate a time series graph of the ADCP temperature. Attributes ---------- canvas: MplCanvas Object of MplCanvas a FigureCanvas tp: list Reference to time series plot hover_connection: bool Switch to allow user to use the data cur...
d82e18bcd8183c16ed2a9f57639933fac133624b
<|skeleton|> class TemperatureTS: """Class to generate a time series graph of the ADCP temperature. Attributes ---------- canvas: MplCanvas Object of MplCanvas a FigureCanvas tp: list Reference to time series plot hover_connection: bool Switch to allow user to use the data cursor annot: Annotation Annotation object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemperatureTS: """Class to generate a time series graph of the ADCP temperature. Attributes ---------- canvas: MplCanvas Object of MplCanvas a FigureCanvas tp: list Reference to time series plot hover_connection: bool Switch to allow user to use the data cursor annot: Annotation Annotation object for data cur...
the_stack_v2_python_sparse
UI/TemperatureTS.py
ricorx7/QRevPy
train
0