blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
76fc6c627410be98843fe619fbb1a26eea16a4d7 | [
"if trade_clone.aggregate != 0:\n msg = 'Cannot archive an aggregate trade: {0}.'\n raise Aggregation.CheckError(msg.format(trade_clone.trdnbr))\narchive_flag = 1 if archive_flag else 0\nchanged = False\nlinked = TradeAggregation.get_all_linked(trade_clone)\nfor key, data in linked.iteritems():\n for value... | <|body_start_0|>
if trade_clone.aggregate != 0:
msg = 'Cannot archive an aggregate trade: {0}.'
raise Aggregation.CheckError(msg.format(trade_clone.trdnbr))
archive_flag = 1 if archive_flag else 0
changed = False
linked = TradeAggregation.get_all_linked(trade_clon... | A general trade-based archivist. Contains methods common to trade oriented archiving. | TradeArchivist | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TradeArchivist:
"""A general trade-based archivist. Contains methods common to trade oriented archiving."""
def _set_entity_archived(self, trade_clone, archive_flag):
"""Set archived or nonarchived flag on the trade and it's linked objects. This requires a clone of the ael trade enti... | stack_v2_sparse_classes_75kplus_train_000100 | 33,978 | no_license | [
{
"docstring": "Set archived or nonarchived flag on the trade and it's linked objects. This requires a clone of the ael trade entity and does not commit any changes. Returns a bool flag indicating whether the trade needs to be commited afterwards.",
"name": "_set_entity_archived",
"signature": "def _set... | 2 | null | Implement the Python class `TradeArchivist` described below.
Class description:
A general trade-based archivist. Contains methods common to trade oriented archiving.
Method signatures and docstrings:
- def _set_entity_archived(self, trade_clone, archive_flag): Set archived or nonarchived flag on the trade and it's li... | Implement the Python class `TradeArchivist` described below.
Class description:
A general trade-based archivist. Contains methods common to trade oriented archiving.
Method signatures and docstrings:
- def _set_entity_archived(self, trade_clone, archive_flag): Set archived or nonarchived flag on the trade and it's li... | 5e7cc7de3495145501ca53deb9efee2233ab7e1c | <|skeleton|>
class TradeArchivist:
"""A general trade-based archivist. Contains methods common to trade oriented archiving."""
def _set_entity_archived(self, trade_clone, archive_flag):
"""Set archived or nonarchived flag on the trade and it's linked objects. This requires a clone of the ael trade enti... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TradeArchivist:
"""A general trade-based archivist. Contains methods common to trade oriented archiving."""
def _set_entity_archived(self, trade_clone, archive_flag):
"""Set archived or nonarchived flag on the trade and it's linked objects. This requires a clone of the ael trade entity and does n... | the_stack_v2_python_sparse | Python modules/aggregation.py | webclinic017/fa-absa-py3 | train | 0 |
71d4c1e9cbf26e07253fb71bb9586ae00bc63297 | [
"super().__init__()\nself.output_dim = output_dim\nself.hidden_dim = hidden_dim\nself.num_layers = num_layers\nself.dropout = dropout\nself.lstm = nn.LSTM(output_dim, hidden_dim, num_layers, batch_first=True, dropout=dropout)\nself.out = nn.Linear(hidden_dim, output_dim)",
"input = input.unsqueeze(1)\noutput, (hi... | <|body_start_0|>
super().__init__()
self.output_dim = output_dim
self.hidden_dim = hidden_dim
self.num_layers = num_layers
self.dropout = dropout
self.lstm = nn.LSTM(output_dim, hidden_dim, num_layers, batch_first=True, dropout=dropout)
self.out = nn.Linear(hidden... | The class for LSTM decoder | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""The class for LSTM decoder"""
def __init__(self, output_dim, hidden_dim, num_layers, dropout):
"""Initilize LSTM decoder Args: output_dim: int -- the size/dimensionality of the vectors that will be input to the decoder (output of encoder) hidden_dim: int -- the dimensiona... | stack_v2_sparse_classes_75kplus_train_000101 | 46,816 | no_license | [
{
"docstring": "Initilize LSTM decoder Args: output_dim: int -- the size/dimensionality of the vectors that will be input to the decoder (output of encoder) hidden_dim: int -- the dimensionality of the hidden and cell states num_layers: int -- the number of layers in the LSTM dropout: float -- the amount of dro... | 2 | stack_v2_sparse_classes_30k_val_001015 | Implement the Python class `Decoder` described below.
Class description:
The class for LSTM decoder
Method signatures and docstrings:
- def __init__(self, output_dim, hidden_dim, num_layers, dropout): Initilize LSTM decoder Args: output_dim: int -- the size/dimensionality of the vectors that will be input to the deco... | Implement the Python class `Decoder` described below.
Class description:
The class for LSTM decoder
Method signatures and docstrings:
- def __init__(self, output_dim, hidden_dim, num_layers, dropout): Initilize LSTM decoder Args: output_dim: int -- the size/dimensionality of the vectors that will be input to the deco... | d7e651024b07587b46497183d90934561a4839e2 | <|skeleton|>
class Decoder:
"""The class for LSTM decoder"""
def __init__(self, output_dim, hidden_dim, num_layers, dropout):
"""Initilize LSTM decoder Args: output_dim: int -- the size/dimensionality of the vectors that will be input to the decoder (output of encoder) hidden_dim: int -- the dimensiona... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Decoder:
"""The class for LSTM decoder"""
def __init__(self, output_dim, hidden_dim, num_layers, dropout):
"""Initilize LSTM decoder Args: output_dim: int -- the size/dimensionality of the vectors that will be input to the decoder (output of encoder) hidden_dim: int -- the dimensionality of the h... | the_stack_v2_python_sparse | model/autoencoder_multitask.py | SSF-climate/SSF | train | 7 |
b55798b5079ff47e5b7312df18b06c3ef7a72ad6 | [
"try:\n return_data = AutoMlRule().set_graph_type_list(graph_id, request.data)\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))",
"try:\n if graph_id == 'all':\n return_data = Aut... | <|body_start_0|>
try:
return_data = AutoMlRule().set_graph_type_list(graph_id, request.data)
return Response(json.dumps(return_data))
except Exception as e:
return_data = {'status': '404', 'result': str(e)}
return Response(json.dumps(return_data))
<|end_bo... | RunManagerAutoRule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunManagerAutoRule:
def post(self, request, graph_id):
"""- desc : insert cnn configuration data"""
<|body_0|>
def get(self, request, graph_id):
"""- desc : get cnn configuration data"""
<|body_1|>
def put(self, request, graph_id):
"""- desc ; up... | stack_v2_sparse_classes_75kplus_train_000102 | 2,006 | no_license | [
{
"docstring": "- desc : insert cnn configuration data",
"name": "post",
"signature": "def post(self, request, graph_id)"
},
{
"docstring": "- desc : get cnn configuration data",
"name": "get",
"signature": "def get(self, request, graph_id)"
},
{
"docstring": "- desc ; update cnn... | 4 | stack_v2_sparse_classes_30k_train_005981 | Implement the Python class `RunManagerAutoRule` described below.
Class description:
Implement the RunManagerAutoRule class.
Method signatures and docstrings:
- def post(self, request, graph_id): - desc : insert cnn configuration data
- def get(self, request, graph_id): - desc : get cnn configuration data
- def put(se... | Implement the Python class `RunManagerAutoRule` described below.
Class description:
Implement the RunManagerAutoRule class.
Method signatures and docstrings:
- def post(self, request, graph_id): - desc : insert cnn configuration data
- def get(self, request, graph_id): - desc : get cnn configuration data
- def put(se... | 9fda5e4487ccb6b1cbfea3066b8f1e18162aa090 | <|skeleton|>
class RunManagerAutoRule:
def post(self, request, graph_id):
"""- desc : insert cnn configuration data"""
<|body_0|>
def get(self, request, graph_id):
"""- desc : get cnn configuration data"""
<|body_1|>
def put(self, request, graph_id):
"""- desc ; up... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RunManagerAutoRule:
def post(self, request, graph_id):
"""- desc : insert cnn configuration data"""
try:
return_data = AutoMlRule().set_graph_type_list(graph_id, request.data)
return Response(json.dumps(return_data))
except Exception as e:
return_dat... | the_stack_v2_python_sparse | api/views/runmanager_auto_rule.py | JamieMoon/tensormsa | train | 0 | |
a96817139395f1d0c7a2e56eb28da07d7a7680dd | [
"self.x_grid = copy.copy(x_grid)\nself.scalar_product = scalar_product\nif exp_list is not None:\n self.basis_dict = np.power(np.outer(self.x_grid, np.ones((len(exp_list),))), exp_list).T\n self.basis_dict = np.divide(self.basis_dict.T, np.sqrt(self.scalar_product(self.basis_dict, self.basis_dict))).T\n se... | <|body_start_0|>
self.x_grid = copy.copy(x_grid)
self.scalar_product = scalar_product
if exp_list is not None:
self.basis_dict = np.power(np.outer(self.x_grid, np.ones((len(exp_list),))), exp_list).T
self.basis_dict = np.divide(self.basis_dict.T, np.sqrt(self.scalar_produ... | This class implements a version of greedy algorithm for reducing a function as linear combination of a small number of basis function. It requires a set of functions to be initialized - those function forming the dictionary of the algorithm. Then given a test function it computes the projection coefficents over the dic... | GA_reduction | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GA_reduction:
"""This class implements a version of greedy algorithm for reducing a function as linear combination of a small number of basis function. It requires a set of functions to be initialized - those function forming the dictionary of the algorithm. Then given a test function it computes... | stack_v2_sparse_classes_75kplus_train_000103 | 5,783 | permissive | [
{
"docstring": "Initialize the model with the specification of grid point at which every function is evaluated. A list of exponents can be given if one wants the basis functions to be in the form of phi = x**alpha. A scalar product among funcions must be specified. It must accept as arguments the two sets of fu... | 5 | stack_v2_sparse_classes_30k_train_030957 | Implement the Python class `GA_reduction` described below.
Class description:
This class implements a version of greedy algorithm for reducing a function as linear combination of a small number of basis function. It requires a set of functions to be initialized - those function forming the dictionary of the algorithm.... | Implement the Python class `GA_reduction` described below.
Class description:
This class implements a version of greedy algorithm for reducing a function as linear combination of a small number of basis function. It requires a set of functions to be initialized - those function forming the dictionary of the algorithm.... | a786e9ce5845ba1f82980c5265307914c3c26e68 | <|skeleton|>
class GA_reduction:
"""This class implements a version of greedy algorithm for reducing a function as linear combination of a small number of basis function. It requires a set of functions to be initialized - those function forming the dictionary of the algorithm. Then given a test function it computes... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GA_reduction:
"""This class implements a version of greedy algorithm for reducing a function as linear combination of a small number of basis function. It requires a set of functions to be initialized - those function forming the dictionary of the algorithm. Then given a test function it computes the projecti... | the_stack_v2_python_sparse | dev/tries_checks/routines/greedy_reduction.py | stefanoschmidt1995/MLGW | train | 12 |
fd684dbbb059174b17a5a6c311ac03cfda75c5a4 | [
"super().__init__()\nself.shared_net = nn.Sequential(nn.Linear(112, 128), nn.Tanh(), nn.Linear(128, 128), nn.Tanh(), nn.Linear(128, 64), nn.Tanh())\nself.lstm = nn.LSTMCell(64, 64)\nself.pi = nn.Linear(64, num_actions)\nself.v = nn.Linear(64, 1)\nself.num_actions = num_actions\nself.apply(atari_initializer)\nself.p... | <|body_start_0|>
super().__init__()
self.shared_net = nn.Sequential(nn.Linear(112, 128), nn.Tanh(), nn.Linear(128, 128), nn.Tanh(), nn.Linear(128, 64), nn.Tanh())
self.lstm = nn.LSTMCell(64, 64)
self.pi = nn.Linear(64, num_actions)
self.v = nn.Linear(64, 1)
self.num_actio... | A2CLSTM | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class A2CLSTM:
def __init__(self, num_actions):
"""Basic convolutional actor-critic network for Atari 2600 games Equivalent to the network in the original DQN paper. Args: - num_actions (int): the number of available discrete actions"""
<|body_0|>
def forward(self, conv_in, h, c):... | stack_v2_sparse_classes_75kplus_train_000104 | 7,848 | permissive | [
{
"docstring": "Basic convolutional actor-critic network for Atari 2600 games Equivalent to the network in the original DQN paper. Args: - num_actions (int): the number of available discrete actions",
"name": "__init__",
"signature": "def __init__(self, num_actions)"
},
{
"docstring": "Module fo... | 2 | stack_v2_sparse_classes_30k_train_010045 | Implement the Python class `A2CLSTM` described below.
Class description:
Implement the A2CLSTM class.
Method signatures and docstrings:
- def __init__(self, num_actions): Basic convolutional actor-critic network for Atari 2600 games Equivalent to the network in the original DQN paper. Args: - num_actions (int): the n... | Implement the Python class `A2CLSTM` described below.
Class description:
Implement the A2CLSTM class.
Method signatures and docstrings:
- def __init__(self, num_actions): Basic convolutional actor-critic network for Atari 2600 games Equivalent to the network in the original DQN paper. Args: - num_actions (int): the n... | bbe61592a3d85c00731e254edcd1108075c49b6f | <|skeleton|>
class A2CLSTM:
def __init__(self, num_actions):
"""Basic convolutional actor-critic network for Atari 2600 games Equivalent to the network in the original DQN paper. Args: - num_actions (int): the number of available discrete actions"""
<|body_0|>
def forward(self, conv_in, h, c):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class A2CLSTM:
def __init__(self, num_actions):
"""Basic convolutional actor-critic network for Atari 2600 games Equivalent to the network in the original DQN paper. Args: - num_actions (int): the number of available discrete actions"""
super().__init__()
self.shared_net = nn.Sequential(nn.L... | the_stack_v2_python_sparse | a2c/models.py | WeiChengTseng/DL_final_project | train | 9 | |
c39fd20c173d1cd9f611936ef7f3b3691d8d60e6 | [
"self.lg('%s STARTED' % self._testID)\nresponse = self.get_request_response(uri='/rules')\nself.lg('#. Get /rules, should succeed')\nself.assertEqual(response.status_code, 200)\nself.assertTrue(response.ok)\nself.lg('#. Check response headers, should succeed')\n[self.assertIn(header, response.headers.keys()) for he... | <|body_start_0|>
self.lg('%s STARTED' % self._testID)
response = self.get_request_response(uri='/rules')
self.lg('#. Get /rules, should succeed')
self.assertEqual(response.status_code, 200)
self.assertTrue(response.ok)
self.lg('#. Check response headers, should succeed')
... | TestFiles | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFiles:
def test001_get_rules(self):
"""TestCase-23: Test case for test get /rules.* **Test Scenario:** #. Get /rules, should succeed #. Check response headers, should succeed #. Check response body, should succeed"""
<|body_0|>
def test002_get_rule(self):
"""Test... | stack_v2_sparse_classes_75kplus_train_000105 | 3,976 | no_license | [
{
"docstring": "TestCase-23: Test case for test get /rules.* **Test Scenario:** #. Get /rules, should succeed #. Check response headers, should succeed #. Check response body, should succeed",
"name": "test001_get_rules",
"signature": "def test001_get_rules(self)"
},
{
"docstring": "TestCase-24:... | 2 | null | Implement the Python class `TestFiles` described below.
Class description:
Implement the TestFiles class.
Method signatures and docstrings:
- def test001_get_rules(self): TestCase-23: Test case for test get /rules.* **Test Scenario:** #. Get /rules, should succeed #. Check response headers, should succeed #. Check re... | Implement the Python class `TestFiles` described below.
Class description:
Implement the TestFiles class.
Method signatures and docstrings:
- def test001_get_rules(self): TestCase-23: Test case for test get /rules.* **Test Scenario:** #. Get /rules, should succeed #. Check response headers, should succeed #. Check re... | 9b25ce55fd44976b1b8afc1fb638c1a1b4d3589d | <|skeleton|>
class TestFiles:
def test001_get_rules(self):
"""TestCase-23: Test case for test get /rules.* **Test Scenario:** #. Get /rules, should succeed #. Check response headers, should succeed #. Check response body, should succeed"""
<|body_0|>
def test002_get_rule(self):
"""Test... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFiles:
def test001_get_rules(self):
"""TestCase-23: Test case for test get /rules.* **Test Scenario:** #. Get /rules, should succeed #. Check response headers, should succeed #. Check response body, should succeed"""
self.lg('%s STARTED' % self._testID)
response = self.get_request_... | the_stack_v2_python_sparse | mobile_api_testing/testsuite/test_014_rules.py | simplymahmoud/sss-scripts | train | 0 | |
d27934ad23b6d9d3fdbebb193e0a082bdb2ccc29 | [
"self.__app = app\nlogger.debug('Setting JSON encoder.')\napp.json_encoder = FlaskJSONEncoder\nlogger.debug('Setting common error handler for all error codes.')\nfor error_code in default_exceptions:\n app.register_error_handler(error_code, common_error_handler)\napp.register_error_handler(ProblemException, comm... | <|body_start_0|>
self.__app = app
logger.debug('Setting JSON encoder.')
app.json_encoder = FlaskJSONEncoder
logger.debug('Setting common error handler for all error codes.')
for error_code in default_exceptions:
app.register_error_handler(error_code, common_error_hand... | TODO: add description TODO: annotate class | Api | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Api:
"""TODO: add description TODO: annotate class"""
def __init__(self, app):
"""TODO: add description TODO: annotate function"""
<|body_0|>
def register(self, specification, base_path=None, arguments=None, validate_responses=True, strict_validation=True, resolver=None,... | stack_v2_sparse_classes_75kplus_train_000106 | 3,305 | no_license | [
{
"docstring": "TODO: add description TODO: annotate function",
"name": "__init__",
"signature": "def __init__(self, app)"
},
{
"docstring": "Adds an API to the application based on a swagger file",
"name": "register",
"signature": "def register(self, specification, base_path=None, argum... | 2 | stack_v2_sparse_classes_30k_train_040385 | Implement the Python class `Api` described below.
Class description:
TODO: add description TODO: annotate class
Method signatures and docstrings:
- def __init__(self, app): TODO: add description TODO: annotate function
- def register(self, specification, base_path=None, arguments=None, validate_responses=True, strict... | Implement the Python class `Api` described below.
Class description:
TODO: add description TODO: annotate class
Method signatures and docstrings:
- def __init__(self, app): TODO: add description TODO: annotate function
- def register(self, specification, base_path=None, arguments=None, validate_responses=True, strict... | e649c2c7a56b6f70a5dd9f9511bb0f38692cba9f | <|skeleton|>
class Api:
"""TODO: add description TODO: annotate class"""
def __init__(self, app):
"""TODO: add description TODO: annotate function"""
<|body_0|>
def register(self, specification, base_path=None, arguments=None, validate_responses=True, strict_validation=True, resolver=None,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Api:
"""TODO: add description TODO: annotate class"""
def __init__(self, app):
"""TODO: add description TODO: annotate function"""
self.__app = app
logger.debug('Setting JSON encoder.')
app.json_encoder = FlaskJSONEncoder
logger.debug('Setting common error handler ... | the_stack_v2_python_sparse | api/src/backend_common/api.py | mozilla-releng/shipit | train | 7 |
b3c2202fb0f69e212d906a31a41bd99815725666 | [
"self.name = 'FaceDataType'\nself.templatesubdivisiontype = 1\nself.drape = drape\nself.verticaldivisions1 = verticaldivisions1\nself.horizontaldivisions1 = horizontaldivisions1\nself.verticaldivisions2 = verticaldivisions2\nself.horizontaldivisions2 = horizontaldivisions2\nself.verticaldivisions3 = verticaldivisio... | <|body_start_0|>
self.name = 'FaceDataType'
self.templatesubdivisiontype = 1
self.drape = drape
self.verticaldivisions1 = verticaldivisions1
self.horizontaldivisions1 = horizontaldivisions1
self.verticaldivisions2 = verticaldivisions2
self.horizontaldivisions2 = h... | Face data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 on cell faces (templatesubdivisiontype = 2). Parameters ---------- drape : int Drape indicates how particles are treated when starting locations are specified for cells that are dry. If drape is 0, Particles are placed in ... | FaceDataType | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FaceDataType:
"""Face data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 on cell faces (templatesubdivisiontype = 2). Parameters ---------- drape : int Drape indicates how particles are treated when starting locations are specified for cells that are dry.... | stack_v2_sparse_classes_75kplus_train_000107 | 35,702 | permissive | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, drape=0, verticaldivisions1=3, horizontaldivisions1=3, verticaldivisions2=3, horizontaldivisions2=3, verticaldivisions3=3, horizontaldivisions3=3, verticaldivisions4=3, horizontaldivisions4=3, rowdivisions5=3, colum... | 2 | stack_v2_sparse_classes_30k_train_024520 | Implement the Python class `FaceDataType` described below.
Class description:
Face data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 on cell faces (templatesubdivisiontype = 2). Parameters ---------- drape : int Drape indicates how particles are treated when starting location... | Implement the Python class `FaceDataType` described below.
Class description:
Face data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 on cell faces (templatesubdivisiontype = 2). Parameters ---------- drape : int Drape indicates how particles are treated when starting location... | 7db7869f34b875c9f76d42b7a4801b0c23738448 | <|skeleton|>
class FaceDataType:
"""Face data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 on cell faces (templatesubdivisiontype = 2). Parameters ---------- drape : int Drape indicates how particles are treated when starting locations are specified for cells that are dry.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FaceDataType:
"""Face data type class to create a MODPATH 7 particle location template for input style 2, 3, and 4 on cell faces (templatesubdivisiontype = 2). Parameters ---------- drape : int Drape indicates how particles are treated when starting locations are specified for cells that are dry. If drape is ... | the_stack_v2_python_sparse | hataripy/modpath/mp7particledata.py | hatarilabs/hataripy | train | 4 |
acb83f03c8d760d3f16be11135a047cbfcfd08b3 | [
"super().__init__(**kwargs)\nself.id = str(uuid.uuid1())\nself.coupon = coupon\nself.bond_yield = bond_yield\nfor name, value in kwargs.items():\n self.__setattr__(name, value)",
"output = ''\noutput += self.stock_name + self.get_spaces(len(header[0]) - len(self.stock_name))\noutput += str(self.num_shares) + s... | <|body_start_0|>
super().__init__(**kwargs)
self.id = str(uuid.uuid1())
self.coupon = coupon
self.bond_yield = bond_yield
for name, value in kwargs.items():
self.__setattr__(name, value)
<|end_body_0|>
<|body_start_1|>
output = ''
output += self.stock... | A class for managing bonds. | Bond | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bond:
"""A class for managing bonds."""
def __init__(self, coupon=None, bond_yield=None, **kwargs):
"""Sets the initial variables. These are used for printing content and storing initial data."""
<|body_0|>
def print_output_row(self, header):
"""Prints individual... | stack_v2_sparse_classes_75kplus_train_000108 | 2,075 | no_license | [
{
"docstring": "Sets the initial variables. These are used for printing content and storing initial data.",
"name": "__init__",
"signature": "def __init__(self, coupon=None, bond_yield=None, **kwargs)"
},
{
"docstring": "Prints individual rows of bond data.",
"name": "print_output_row",
... | 2 | stack_v2_sparse_classes_30k_train_052697 | Implement the Python class `Bond` described below.
Class description:
A class for managing bonds.
Method signatures and docstrings:
- def __init__(self, coupon=None, bond_yield=None, **kwargs): Sets the initial variables. These are used for printing content and storing initial data.
- def print_output_row(self, heade... | Implement the Python class `Bond` described below.
Class description:
A class for managing bonds.
Method signatures and docstrings:
- def __init__(self, coupon=None, bond_yield=None, **kwargs): Sets the initial variables. These are used for printing content and storing initial data.
- def print_output_row(self, heade... | c6cf1d5367f2f5f8ee9cd63a8f7dd9a09fb07d6f | <|skeleton|>
class Bond:
"""A class for managing bonds."""
def __init__(self, coupon=None, bond_yield=None, **kwargs):
"""Sets the initial variables. These are used for printing content and storing initial data."""
<|body_0|>
def print_output_row(self, header):
"""Prints individual... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Bond:
"""A class for managing bonds."""
def __init__(self, coupon=None, bond_yield=None, **kwargs):
"""Sets the initial variables. These are used for printing content and storing initial data."""
super().__init__(**kwargs)
self.id = str(uuid.uuid1())
self.coupon = coupon
... | the_stack_v2_python_sparse | five/carterk_assignment5_bond.py | kylecarter/ict-4370-python-programming | train | 1 |
01e64b150bab16cb5c3ff4522d66128a2330b62f | [
"super(ThreadedTcp, self).__init__(port=port, host=host, receive_buffer_size=receive_buffer_size, logger=logger)\nself.pulling_thread = None\nself.moler_connection = moler_connection\nself.moler_connection.how2send = self.send",
"ret = super(ThreadedTcp, self).open()\ndone = threading.Event()\nself.pulling_thread... | <|body_start_0|>
super(ThreadedTcp, self).__init__(port=port, host=host, receive_buffer_size=receive_buffer_size, logger=logger)
self.pulling_thread = None
self.moler_connection = moler_connection
self.moler_connection.how2send = self.send
<|end_body_0|>
<|body_start_1|>
ret = s... | TCP connection feeding Moler's connection inside dedicated thread. This is external-IO usable for Moler since it has it's own runner (thread) that can work in background and pull data from TCP connection. | ThreadedTcp | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreadedTcp:
"""TCP connection feeding Moler's connection inside dedicated thread. This is external-IO usable for Moler since it has it's own runner (thread) that can work in background and pull data from TCP connection."""
def __init__(self, moler_connection, port, host='localhost', receive... | stack_v2_sparse_classes_75kplus_train_000109 | 7,624 | permissive | [
{
"docstring": "Initialization of TCP-threaded connection.",
"name": "__init__",
"signature": "def __init__(self, moler_connection, port, host='localhost', receive_buffer_size=64 * 4096, logger=None)"
},
{
"docstring": "Open TCP connection & start thread pulling data from it.",
"name": "open... | 4 | null | Implement the Python class `ThreadedTcp` described below.
Class description:
TCP connection feeding Moler's connection inside dedicated thread. This is external-IO usable for Moler since it has it's own runner (thread) that can work in background and pull data from TCP connection.
Method signatures and docstrings:
- ... | Implement the Python class `ThreadedTcp` described below.
Class description:
TCP connection feeding Moler's connection inside dedicated thread. This is external-IO usable for Moler since it has it's own runner (thread) that can work in background and pull data from TCP connection.
Method signatures and docstrings:
- ... | 5a7bb06807b6e0124c77040367d0c20f42849a4c | <|skeleton|>
class ThreadedTcp:
"""TCP connection feeding Moler's connection inside dedicated thread. This is external-IO usable for Moler since it has it's own runner (thread) that can work in background and pull data from TCP connection."""
def __init__(self, moler_connection, port, host='localhost', receive... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThreadedTcp:
"""TCP connection feeding Moler's connection inside dedicated thread. This is external-IO usable for Moler since it has it's own runner (thread) that can work in background and pull data from TCP connection."""
def __init__(self, moler_connection, port, host='localhost', receive_buffer_size=... | the_stack_v2_python_sparse | moler/io/raw/tcp.py | nokia/moler | train | 60 |
6cea090446aead390d1b10208f0bdb0a67c118c9 | [
"lines = {}\nfor i in range(0, len(height)):\n h = height[i]\n if h in lines:\n lines[h][1] = i\n else:\n lines[h] = [i, i]\nr = 0\nstart, stop = (len(height), -1)\nfor h in sorted(lines.keys(), reverse=True):\n if h * len(height) <= r:\n break\n start = min(start, lines[h][0])\n... | <|body_start_0|>
lines = {}
for i in range(0, len(height)):
h = height[i]
if h in lines:
lines[h][1] = i
else:
lines[h] = [i, i]
r = 0
start, stop = (len(height), -1)
for h in sorted(lines.keys(), reverse=True):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
lines = {}
for i in range(0, len(hei... | stack_v2_sparse_classes_75kplus_train_000110 | 3,050 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea",
"signature": "def maxArea(self, height)"
},
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea1",
"signature": "def maxArea1(self, height)"
}
] | 2 | stack_v2_sparse_classes_30k_train_042947 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): :type height: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): :type height: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxArea(se... | bbd0a26b2d301b19005fc7368a25732d01c8ae2b | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
lines = {}
for i in range(0, len(height)):
h = height[i]
if h in lines:
lines[h][1] = i
else:
lines[h] = [i, i]
r = 0
start... | the_stack_v2_python_sparse | problems_100/011_maxArea.py | txwjj33/leetcode | train | 0 | |
08758bc411afa93e0da2a2a96653a1443051dab8 | [
"super().__init__()\nself.fc1 = nn.LazyLinear(hidden_dim)\nself.ln1 = nn.LayerNorm(hidden_dim)\nself.fc2 = nn.LazyLinear(hidden_dim)\nself.ln2 = nn.LayerNorm(hidden_dim)\nself.fc3 = nn.LazyLinear(1)",
"x = F.relu(self.ln1(self.fc1(x)))\nx = F.relu(self.ln2(self.fc2(x)))\nx = self.fc3(x)\nreturn x"
] | <|body_start_0|>
super().__init__()
self.fc1 = nn.LazyLinear(hidden_dim)
self.ln1 = nn.LayerNorm(hidden_dim)
self.fc2 = nn.LazyLinear(hidden_dim)
self.ln2 = nn.LayerNorm(hidden_dim)
self.fc3 = nn.LazyLinear(1)
<|end_body_0|>
<|body_start_1|>
x = F.relu(self.ln1(s... | Critic network. The network follows the standard actor-critic architecture used in Deep Reinforcement Learning. The model is used in Counterfactual with Reinforcement Learning (CFRL) for both data modalities (images and tabular). The hidden dimension used for the all experiments is 256, which is a common choice in most... | Critic | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Critic:
"""Critic network. The network follows the standard actor-critic architecture used in Deep Reinforcement Learning. The model is used in Counterfactual with Reinforcement Learning (CFRL) for both data modalities (images and tabular). The hidden dimension used for the all experiments is 256... | stack_v2_sparse_classes_75kplus_train_000111 | 2,748 | permissive | [
{
"docstring": "Constructor. Parameters ---------- hidden_dim Hidden dimension.",
"name": "__init__",
"signature": "def __init__(self, hidden_dim: int)"
},
{
"docstring": "Forward pass. Parameters ---------- x Input tensor. Returns ------- Critic value.",
"name": "forward",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_024950 | Implement the Python class `Critic` described below.
Class description:
Critic network. The network follows the standard actor-critic architecture used in Deep Reinforcement Learning. The model is used in Counterfactual with Reinforcement Learning (CFRL) for both data modalities (images and tabular). The hidden dimens... | Implement the Python class `Critic` described below.
Class description:
Critic network. The network follows the standard actor-critic architecture used in Deep Reinforcement Learning. The model is used in Counterfactual with Reinforcement Learning (CFRL) for both data modalities (images and tabular). The hidden dimens... | 54d0c957fb01c7ebba4e2a0d28fcbde52d9c6718 | <|skeleton|>
class Critic:
"""Critic network. The network follows the standard actor-critic architecture used in Deep Reinforcement Learning. The model is used in Counterfactual with Reinforcement Learning (CFRL) for both data modalities (images and tabular). The hidden dimension used for the all experiments is 256... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Critic:
"""Critic network. The network follows the standard actor-critic architecture used in Deep Reinforcement Learning. The model is used in Counterfactual with Reinforcement Learning (CFRL) for both data modalities (images and tabular). The hidden dimension used for the all experiments is 256, which is a ... | the_stack_v2_python_sparse | alibi/models/pytorch/actor_critic.py | SeldonIO/alibi | train | 2,143 |
939bd31d5c3f3f835e85e5e233aa6abcbaf88200 | [
"if id is None:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects\nelse:\n self.id = id",
"filename = cls.__name__ + '.json'\nif os.path.exists(filename):\n inst_list = []\n with open(filename) as f:\n my_list = cls.from_json_string(f.read())\n for item in my_list:\n my_dict =... | <|body_start_0|>
if id is None:
Base.__nb_objects += 1
self.id = Base.__nb_objects
else:
self.id = id
<|end_body_0|>
<|body_start_1|>
filename = cls.__name__ + '.json'
if os.path.exists(filename):
inst_list = []
with open(filen... | The class Base | Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base:
"""The class Base"""
def __init__(self, id=None):
"""The Base constructor function"""
<|body_0|>
def load_from_file(cls):
"""A function that loads a list of class instances from a json file"""
<|body_1|>
def create(cls, **dictionary):
"... | stack_v2_sparse_classes_75kplus_train_000112 | 3,793 | no_license | [
{
"docstring": "The Base constructor function",
"name": "__init__",
"signature": "def __init__(self, id=None)"
},
{
"docstring": "A function that loads a list of class instances from a json file",
"name": "load_from_file",
"signature": "def load_from_file(cls)"
},
{
"docstring": ... | 6 | stack_v2_sparse_classes_30k_train_046654 | Implement the Python class `Base` described below.
Class description:
The class Base
Method signatures and docstrings:
- def __init__(self, id=None): The Base constructor function
- def load_from_file(cls): A function that loads a list of class instances from a json file
- def create(cls, **dictionary): A function th... | Implement the Python class `Base` described below.
Class description:
The class Base
Method signatures and docstrings:
- def __init__(self, id=None): The Base constructor function
- def load_from_file(cls): A function that loads a list of class instances from a json file
- def create(cls, **dictionary): A function th... | 5fad6ea9f28f845820b5a893feb20e83ed3fe7b4 | <|skeleton|>
class Base:
"""The class Base"""
def __init__(self, id=None):
"""The Base constructor function"""
<|body_0|>
def load_from_file(cls):
"""A function that loads a list of class instances from a json file"""
<|body_1|>
def create(cls, **dictionary):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Base:
"""The class Base"""
def __init__(self, id=None):
"""The Base constructor function"""
if id is None:
Base.__nb_objects += 1
self.id = Base.__nb_objects
else:
self.id = id
def load_from_file(cls):
"""A function that loads a lis... | the_stack_v2_python_sparse | 0x0C-python-almost_a_circle/models/base.py | Valinor13/holbertonschool-higher_level_programming | train | 0 |
3a20e7360b8ee1d2fa6578629b745517519b19cb | [
"assert isinstance(processExecution, ProcessExecution), 'Invalid processExecution type!'\nsuper(_ProcessExecutionThread, self).__init__()\nself.__processExecution = processExecution",
"self.__processExecution.execute()\nif self.__processExecution.exitStatus():\n raise LocalDispatcherExecutionError(self.__proce... | <|body_start_0|>
assert isinstance(processExecution, ProcessExecution), 'Invalid processExecution type!'
super(_ProcessExecutionThread, self).__init__()
self.__processExecution = processExecution
<|end_body_0|>
<|body_start_1|>
self.__processExecution.execute()
if self.__process... | Thread used to execute the sub-process. | _ProcessExecutionThread | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _ProcessExecutionThread:
"""Thread used to execute the sub-process."""
def __init__(self, processExecution):
"""Create a process execution thread."""
<|body_0|>
def run(self):
"""Run the thread."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
as... | stack_v2_sparse_classes_75kplus_train_000113 | 5,024 | permissive | [
{
"docstring": "Create a process execution thread.",
"name": "__init__",
"signature": "def __init__(self, processExecution)"
},
{
"docstring": "Run the thread.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | null | Implement the Python class `_ProcessExecutionThread` described below.
Class description:
Thread used to execute the sub-process.
Method signatures and docstrings:
- def __init__(self, processExecution): Create a process execution thread.
- def run(self): Run the thread. | Implement the Python class `_ProcessExecutionThread` described below.
Class description:
Thread used to execute the sub-process.
Method signatures and docstrings:
- def __init__(self, processExecution): Create a process execution thread.
- def run(self): Run the thread.
<|skeleton|>
class _ProcessExecutionThread:
... | 046dbb0c1b4ff20ea5f2e1679f8d89f3089b6aa4 | <|skeleton|>
class _ProcessExecutionThread:
"""Thread used to execute the sub-process."""
def __init__(self, processExecution):
"""Create a process execution thread."""
<|body_0|>
def run(self):
"""Run the thread."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _ProcessExecutionThread:
"""Thread used to execute the sub-process."""
def __init__(self, processExecution):
"""Create a process execution thread."""
assert isinstance(processExecution, ProcessExecution), 'Invalid processExecution type!'
super(_ProcessExecutionThread, self).__init... | the_stack_v2_python_sparse | src/lib/kombi/TaskHolder/Dispatcher/Local/LocalDispatcher.py | kombiHQ/kombi | train | 2 |
bf499d6c9a1c7f5dbc0a5f2fa7616b8e6f953814 | [
"if advancement:\n return {'value': {'module_hr_evaluation_ma': True}}\nreturn {}",
"if not evaluation_ma:\n return {'value': {'module_hr_advancement': False}}\nreturn {}"
] | <|body_start_0|>
if advancement:
return {'value': {'module_hr_evaluation_ma': True}}
return {}
<|end_body_0|>
<|body_start_1|>
if not evaluation_ma:
return {'value': {'module_hr_advancement': False}}
return {}
<|end_body_1|>
| hr_config_settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class hr_config_settings:
def onchange_hr_advancement(self, cr, uid, ids, advancement, context=None):
"""module_hr_advancement implies module_hr_evalution_ma"""
<|body_0|>
def onchange_hr_evaluation_ma(self, cr, uid, ids, evaluation_ma, context=None):
"""module_hr_advancem... | stack_v2_sparse_classes_75kplus_train_000114 | 1,316 | no_license | [
{
"docstring": "module_hr_advancement implies module_hr_evalution_ma",
"name": "onchange_hr_advancement",
"signature": "def onchange_hr_advancement(self, cr, uid, ids, advancement, context=None)"
},
{
"docstring": "module_hr_advancement implies module_hr_evalution_ma",
"name": "onchange_hr_e... | 2 | stack_v2_sparse_classes_30k_train_034455 | Implement the Python class `hr_config_settings` described below.
Class description:
Implement the hr_config_settings class.
Method signatures and docstrings:
- def onchange_hr_advancement(self, cr, uid, ids, advancement, context=None): module_hr_advancement implies module_hr_evalution_ma
- def onchange_hr_evaluation_... | Implement the Python class `hr_config_settings` described below.
Class description:
Implement the hr_config_settings class.
Method signatures and docstrings:
- def onchange_hr_advancement(self, cr, uid, ids, advancement, context=None): module_hr_advancement implies module_hr_evalution_ma
- def onchange_hr_evaluation_... | acad34a2f6d219cc7c99a4c066dd775501547e4e | <|skeleton|>
class hr_config_settings:
def onchange_hr_advancement(self, cr, uid, ids, advancement, context=None):
"""module_hr_advancement implies module_hr_evalution_ma"""
<|body_0|>
def onchange_hr_evaluation_ma(self, cr, uid, ids, evaluation_ma, context=None):
"""module_hr_advancem... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class hr_config_settings:
def onchange_hr_advancement(self, cr, uid, ids, advancement, context=None):
"""module_hr_advancement implies module_hr_evalution_ma"""
if advancement:
return {'value': {'module_hr_evaluation_ma': True}}
return {}
def onchange_hr_evaluation_ma(self, ... | the_stack_v2_python_sparse | hr_ma/res_config.py | ma-mission/openerp-addons | train | 0 | |
763050d8f94b9409bd29b0aa821787ab0c1e103c | [
"result = []\nif not root:\n return 0\nstackOfNode = [root]\nstackOfString = [root.val]\nwhile stackOfNode:\n currNode = stackOfNode.pop()\n currString = stackOfString.pop()\n if currNode.left:\n stackOfNode.append(currNode.left)\n stackOfString.append(currString * 10 + currNode.left.val)\... | <|body_start_0|>
result = []
if not root:
return 0
stackOfNode = [root]
stackOfString = [root.val]
while stackOfNode:
currNode = stackOfNode.pop()
currString = stackOfString.pop()
if currNode.left:
stackOfNode.append... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sumNumbers(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def sumNumbers_self(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
if not root:
... | stack_v2_sparse_classes_75kplus_train_000115 | 1,662 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "sumNumbers",
"signature": "def sumNumbers(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "sumNumbers_self",
"signature": "def sumNumbers_self(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_028531 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sumNumbers(self, root): :type root: TreeNode :rtype: int
- def sumNumbers_self(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sumNumbers(self, root): :type root: TreeNode :rtype: int
- def sumNumbers_self(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def sumNumbers... | ea492ec864b50547214ecbbb2cdeeac21e70229b | <|skeleton|>
class Solution:
def sumNumbers(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def sumNumbers_self(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def sumNumbers(self, root):
""":type root: TreeNode :rtype: int"""
result = []
if not root:
return 0
stackOfNode = [root]
stackOfString = [root.val]
while stackOfNode:
currNode = stackOfNode.pop()
currString = stackO... | the_stack_v2_python_sparse | 129_sum_root_to_leaf_numbers/sol.py | lianke123321/leetcode_sol | train | 0 | |
3bd98f5a6fa74cb053cd96ea35c8e5802c83ea03 | [
"super().__init__(dtype=dtype)\nassert type(max_action) == type(min_action), 'max_action and min_action must have same type'\nself.dqac_nets = dqac_nets\nself.max_action = max_action\nself.min_action = min_action\nself.df = df\nself.target_noise = target_noise\nself.noise_clip = noise_clip\nif isinstance(self.max_a... | <|body_start_0|>
super().__init__(dtype=dtype)
assert type(max_action) == type(min_action), 'max_action and min_action must have same type'
self.dqac_nets = dqac_nets
self.max_action = max_action
self.min_action = min_action
self.df = df
self.target_noise = target... | Implementation of a target computer for the TD3 algorithm. For more info read the paper https://arxiv.org/pdf/1802.09477.pdf | TD3TargetComputer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TD3TargetComputer:
"""Implementation of a target computer for the TD3 algorithm. For more info read the paper https://arxiv.org/pdf/1802.09477.pdf"""
def __init__(self, dqac_nets, max_action=1.0, min_action=None, df=0.99, target_noise=0.2, noise_clip=0.5, dtype=torch.float):
"""Insta... | stack_v2_sparse_classes_75kplus_train_000116 | 17,945 | permissive | [
{
"docstring": "Instantiate the TD3 target computer. Args: dqac_nets (core.deepq.deepqnetworks.DeepQActorCritic): The DeepQActorCritic containing the target critics and the actor that will be used to compute the target values. max_action (Union[float, numpy.ndarray, torch.Tensor]): Right-clipping value for targ... | 2 | null | Implement the Python class `TD3TargetComputer` described below.
Class description:
Implementation of a target computer for the TD3 algorithm. For more info read the paper https://arxiv.org/pdf/1802.09477.pdf
Method signatures and docstrings:
- def __init__(self, dqac_nets, max_action=1.0, min_action=None, df=0.99, ta... | Implement the Python class `TD3TargetComputer` described below.
Class description:
Implementation of a target computer for the TD3 algorithm. For more info read the paper https://arxiv.org/pdf/1802.09477.pdf
Method signatures and docstrings:
- def __init__(self, dqac_nets, max_action=1.0, min_action=None, df=0.99, ta... | f03f0e68577d45ec1b8a355f79283c8483dc96fc | <|skeleton|>
class TD3TargetComputer:
"""Implementation of a target computer for the TD3 algorithm. For more info read the paper https://arxiv.org/pdf/1802.09477.pdf"""
def __init__(self, dqac_nets, max_action=1.0, min_action=None, df=0.99, target_noise=0.2, noise_clip=0.5, dtype=torch.float):
"""Insta... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TD3TargetComputer:
"""Implementation of a target computer for the TD3 algorithm. For more info read the paper https://arxiv.org/pdf/1802.09477.pdf"""
def __init__(self, dqac_nets, max_action=1.0, min_action=None, df=0.99, target_noise=0.2, noise_clip=0.5, dtype=torch.float):
"""Instantiate the TD... | the_stack_v2_python_sparse | deepq/computations.py | fedetask/des-rl | train | 0 |
02b95a3d371a26e4a4d0d303f040d4fe4dad95bd | [
"super().__init__(num, parameters)\nassert self._num > 1, 'The number of qubits should be larger than 1.'\nself._layer = layer",
"assert self._param_shape == ((2 * self._num - 2) * self._layer,), 'The shape of parameters should be ((2 * num - 2) * layer,).'\nif self._num % 2 == 0:\n for j in range(self._layer)... | <|body_start_0|>
super().__init__(num, parameters)
assert self._num > 1, 'The number of qubits should be larger than 1.'
self._layer = layer
<|end_body_0|>
<|body_start_1|>
assert self._param_shape == ((2 * self._num - 2) * self._layer,), 'The shape of parameters should be ((2 * num - 2... | Real Alternating Layered Circuit class | RealAlternatingLayeredCircuit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RealAlternatingLayeredCircuit:
"""Real Alternating Layered Circuit class"""
def __init__(self, num: int, layer: int, parameters: np.ndarray):
"""The constructor of the RealAlternatingLayeredCircuit class Args: num (int): Number of qubits in this Ansatz layer (int): Number of layer fo... | stack_v2_sparse_classes_75kplus_train_000117 | 10,405 | permissive | [
{
"docstring": "The constructor of the RealAlternatingLayeredCircuit class Args: num (int): Number of qubits in this Ansatz layer (int): Number of layer for this Ansatz parameters (np.ndarray): Parameters of parameterized gates in this circuit, whose shape should be ``((2 * num - 2) * layer,)``",
"name": "_... | 2 | stack_v2_sparse_classes_30k_train_014247 | Implement the Python class `RealAlternatingLayeredCircuit` described below.
Class description:
Real Alternating Layered Circuit class
Method signatures and docstrings:
- def __init__(self, num: int, layer: int, parameters: np.ndarray): The constructor of the RealAlternatingLayeredCircuit class Args: num (int): Number... | Implement the Python class `RealAlternatingLayeredCircuit` described below.
Class description:
Real Alternating Layered Circuit class
Method signatures and docstrings:
- def __init__(self, num: int, layer: int, parameters: np.ndarray): The constructor of the RealAlternatingLayeredCircuit class Args: num (int): Number... | 8bc3c7238b5b6825eb63ded8d65afb08b389941f | <|skeleton|>
class RealAlternatingLayeredCircuit:
"""Real Alternating Layered Circuit class"""
def __init__(self, num: int, layer: int, parameters: np.ndarray):
"""The constructor of the RealAlternatingLayeredCircuit class Args: num (int): Number of qubits in this Ansatz layer (int): Number of layer fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RealAlternatingLayeredCircuit:
"""Real Alternating Layered Circuit class"""
def __init__(self, num: int, layer: int, parameters: np.ndarray):
"""The constructor of the RealAlternatingLayeredCircuit class Args: num (int): Number of qubits in this Ansatz layer (int): Number of layer for this Ansatz... | the_stack_v2_python_sparse | Extensions/QuantumApp/qcompute_qapp/circuit/parameterized_circuit_template.py | baidu/QCompute | train | 86 |
148e912260ea4629fb87446890458ed644fdef28 | [
"self.places = {}\nself.transitions = {}\nself.successful_firings = []",
"pn_copy = PetriNetModel()\nfor place in petri_net_model.places.values():\n pn_copy.add_place(place.tokens, place.place_id, place.label)\nfor t in petri_net_model.transitions.values():\n input_place_ids = [arc.place.place_id for arc in... | <|body_start_0|>
self.places = {}
self.transitions = {}
self.successful_firings = []
<|end_body_0|>
<|body_start_1|>
pn_copy = PetriNetModel()
for place in petri_net_model.places.values():
pn_copy.add_place(place.tokens, place.place_id, place.label)
for t in ... | PetriNetModel | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PetriNetModel:
def __init__(self):
"""Initialize an empty Petri net."""
<|body_0|>
def make_copy_of(petri_net_model):
"""Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied"""
<|body_1|>
def add_pl... | stack_v2_sparse_classes_75kplus_train_000118 | 15,780 | permissive | [
{
"docstring": "Initialize an empty Petri net.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied",
"name": "make_copy_of",
"signature": "def make_copy_of(... | 5 | stack_v2_sparse_classes_30k_train_020985 | Implement the Python class `PetriNetModel` described below.
Class description:
Implement the PetriNetModel class.
Method signatures and docstrings:
- def __init__(self): Initialize an empty Petri net.
- def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o... | Implement the Python class `PetriNetModel` described below.
Class description:
Implement the PetriNetModel class.
Method signatures and docstrings:
- def __init__(self): Initialize an empty Petri net.
- def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o... | 8e9a3a8151069757475808c48511c9d7486ea334 | <|skeleton|>
class PetriNetModel:
def __init__(self):
"""Initialize an empty Petri net."""
<|body_0|>
def make_copy_of(petri_net_model):
"""Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied"""
<|body_1|>
def add_pl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PetriNetModel:
def __init__(self):
"""Initialize an empty Petri net."""
self.places = {}
self.transitions = {}
self.successful_firings = []
def make_copy_of(petri_net_model):
"""Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of Petri... | the_stack_v2_python_sparse | HFPN model/utils/petri_nets.py | PN-Alzheimers-Parkinsons/PN_Alzheimers_Parkinsons | train | 0 | |
e484e38b72d98e7830e955d3e3093892784936e2 | [
"if not properties:\n return 0\nproperties.sort(key=lambda x: (-x[0], -x[1]))\ncur = None\nbar = -float('inf')\ni = 0\nret = 0\nwhile i < len(properties):\n c, m = properties[i]\n while i < len(properties) and properties[i][0] == c:\n if properties[i][1] < bar:\n ret += 1\n m = max... | <|body_start_0|>
if not properties:
return 0
properties.sort(key=lambda x: (-x[0], -x[1]))
cur = None
bar = -float('inf')
i = 0
ret = 0
while i < len(properties):
c, m = properties[i]
while i < len(properties) and properties[i][... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
"""09/18/2022 23:21"""
<|body_0|>
def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
"""09/18/2022 23:25"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_000119 | 2,750 | no_license | [
{
"docstring": "09/18/2022 23:21",
"name": "numberOfWeakCharacters",
"signature": "def numberOfWeakCharacters(self, properties: List[List[int]]) -> int"
},
{
"docstring": "09/18/2022 23:25",
"name": "numberOfWeakCharacters",
"signature": "def numberOfWeakCharacters(self, properties: List... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfWeakCharacters(self, properties: List[List[int]]) -> int: 09/18/2022 23:21
- def numberOfWeakCharacters(self, properties: List[List[int]]) -> int: 09/18/2022 23:25 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfWeakCharacters(self, properties: List[List[int]]) -> int: 09/18/2022 23:21
- def numberOfWeakCharacters(self, properties: List[List[int]]) -> int: 09/18/2022 23:25
<... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
"""09/18/2022 23:21"""
<|body_0|>
def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
"""09/18/2022 23:25"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
"""09/18/2022 23:21"""
if not properties:
return 0
properties.sort(key=lambda x: (-x[0], -x[1]))
cur = None
bar = -float('inf')
i = 0
ret = 0
while i < le... | the_stack_v2_python_sparse | leetcode/solved/2123_The_Number_of_Weak_Characters_in_the_Game/solution.py | sungminoh/algorithms | train | 0 | |
2c00786d0f21a606b4265578d74639727bbf923a | [
"if not uk_region_id or uk_region_id.lower().strip() == 'null':\n return None\nreturn UKRegion.objects.get(id=uk_region_id)",
"order = Order.objects.get(pk=row['order_id'])\nuk_region = self.get_region(row['uk_region_id'])\nif order.uk_region != uk_region:\n order.uk_region = uk_region\n if not simulate:... | <|body_start_0|>
if not uk_region_id or uk_region_id.lower().strip() == 'null':
return None
return UKRegion.objects.get(id=uk_region_id)
<|end_body_0|>
<|body_start_1|>
order = Order.objects.get(pk=row['order_id'])
uk_region = self.get_region(row['uk_region_id'])
if ... | Command to update order.uk_region. | Command | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""Command to update order.uk_region."""
def get_region(self, uk_region_id):
""":returns: instance of UKRegion with id == `uk_region_id` if it exists, None otherwise."""
<|body_0|>
def _process_row(self, row, simulate=False, **options):
"""Process one si... | stack_v2_sparse_classes_75kplus_train_000120 | 993 | no_license | [
{
"docstring": ":returns: instance of UKRegion with id == `uk_region_id` if it exists, None otherwise.",
"name": "get_region",
"signature": "def get_region(self, uk_region_id)"
},
{
"docstring": "Process one single row.",
"name": "_process_row",
"signature": "def _process_row(self, row, ... | 2 | null | Implement the Python class `Command` described below.
Class description:
Command to update order.uk_region.
Method signatures and docstrings:
- def get_region(self, uk_region_id): :returns: instance of UKRegion with id == `uk_region_id` if it exists, None otherwise.
- def _process_row(self, row, simulate=False, **opt... | Implement the Python class `Command` described below.
Class description:
Command to update order.uk_region.
Method signatures and docstrings:
- def get_region(self, uk_region_id): :returns: instance of UKRegion with id == `uk_region_id` if it exists, None otherwise.
- def _process_row(self, row, simulate=False, **opt... | 7f033fcbcfb2f7c1c0e10bec51620742d3d929df | <|skeleton|>
class Command:
"""Command to update order.uk_region."""
def get_region(self, uk_region_id):
""":returns: instance of UKRegion with id == `uk_region_id` if it exists, None otherwise."""
<|body_0|>
def _process_row(self, row, simulate=False, **options):
"""Process one si... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Command:
"""Command to update order.uk_region."""
def get_region(self, uk_region_id):
""":returns: instance of UKRegion with id == `uk_region_id` if it exists, None otherwise."""
if not uk_region_id or uk_region_id.lower().strip() == 'null':
return None
return UKRegion... | the_stack_v2_python_sparse | datahub/dbmaintenance/management/commands/update_omis_uk_regions.py | jakub-kozlowski/data-hub-leeloo | train | 0 |
f336cd96cf813ec8daa9f4ea73b96fa49779c260 | [
"super(Interface, self).__init__(name, line_number)\nself.lines = lines\nself.source = source_file",
"all_subroutines = []\nroutine_re = re.compile('^\\\\s*MODULE PROCEDURE ([A-Z0-9_]+)', re.IGNORECASE)\nvarying_string_re1 = re.compile('VSC*(Obj|Number|)[0-9]*$', re.IGNORECASE)\nvarying_string_re2 = re.compile('V... | <|body_start_0|>
super(Interface, self).__init__(name, line_number)
self.lines = lines
self.source = source_file
<|end_body_0|>
<|body_start_1|>
all_subroutines = []
routine_re = re.compile('^\\s*MODULE PROCEDURE ([A-Z0-9_]+)', re.IGNORECASE)
varying_string_re1 = re.comp... | Information on an interface | Interface | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
"""Information on an interface"""
def __init__(self, name, line_number, lines, source_file):
"""Initialise an interface Arguments: name -- Interface name line_number -- Line number where the interface starts lines -- Contents of interface as a list of lines source_file -- ... | stack_v2_sparse_classes_75kplus_train_000121 | 28,119 | no_license | [
{
"docstring": "Initialise an interface Arguments: name -- Interface name line_number -- Line number where the interface starts lines -- Contents of interface as a list of lines source_file -- Source file containing the interface",
"name": "__init__",
"signature": "def __init__(self, name, line_number, ... | 3 | stack_v2_sparse_classes_30k_train_009227 | Implement the Python class `Interface` described below.
Class description:
Information on an interface
Method signatures and docstrings:
- def __init__(self, name, line_number, lines, source_file): Initialise an interface Arguments: name -- Interface name line_number -- Line number where the interface starts lines --... | Implement the Python class `Interface` described below.
Class description:
Information on an interface
Method signatures and docstrings:
- def __init__(self, name, line_number, lines, source_file): Initialise an interface Arguments: name -- Interface name line_number -- Line number where the interface starts lines --... | 38c0755396efea44feb87a4c01b5e956d6736691 | <|skeleton|>
class Interface:
"""Information on an interface"""
def __init__(self, name, line_number, lines, source_file):
"""Initialise an interface Arguments: name -- Interface name line_number -- Line number where the interface starts lines -- Contents of interface as a list of lines source_file -- ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Interface:
"""Information on an interface"""
def __init__(self, name, line_number, lines, source_file):
"""Initialise an interface Arguments: name -- Interface name line_number -- Line number where the interface starts lines -- Contents of interface as a list of lines source_file -- Source file c... | the_stack_v2_python_sparse | bindings/generate_bindings/parse.py | OpenCMISS/iron | train | 10 |
21e2f7847a80b7a7154f17bc89f9540a211dad8f | [
"n = len(graph)\ncolor = [0] * n\n\ndef dfs(cur, col):\n if color[cur] != 0:\n return color[cur] == col\n color[cur] = col\n for i in graph[cur]:\n if not dfs(i, -1 * col):\n return False\n return True\nfor i in range(n):\n if color[i] == 0 and (not dfs(i, 1)):\n retur... | <|body_start_0|>
n = len(graph)
color = [0] * n
def dfs(cur, col):
if color[cur] != 0:
return color[cur] == col
color[cur] = col
for i in graph[cur]:
if not dfs(i, -1 * col):
return False
return ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBipartite(self, graph):
""":type graph: List[List[int]] :rtype: bool"""
<|body_0|>
def isBipartiteBFS(self, graph):
""":type graph: List[List[int]] :rtype: bool"""
<|body_1|>
def isBipartiteUF(self, graph):
""":type graph: List[Li... | stack_v2_sparse_classes_75kplus_train_000122 | 3,648 | no_license | [
{
"docstring": ":type graph: List[List[int]] :rtype: bool",
"name": "isBipartite",
"signature": "def isBipartite(self, graph)"
},
{
"docstring": ":type graph: List[List[int]] :rtype: bool",
"name": "isBipartiteBFS",
"signature": "def isBipartiteBFS(self, graph)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_054599 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBipartite(self, graph): :type graph: List[List[int]] :rtype: bool
- def isBipartiteBFS(self, graph): :type graph: List[List[int]] :rtype: bool
- def isBipartiteUF(self, gra... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBipartite(self, graph): :type graph: List[List[int]] :rtype: bool
- def isBipartiteBFS(self, graph): :type graph: List[List[int]] :rtype: bool
- def isBipartiteUF(self, gra... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def isBipartite(self, graph):
""":type graph: List[List[int]] :rtype: bool"""
<|body_0|>
def isBipartiteBFS(self, graph):
""":type graph: List[List[int]] :rtype: bool"""
<|body_1|>
def isBipartiteUF(self, graph):
""":type graph: List[Li... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isBipartite(self, graph):
""":type graph: List[List[int]] :rtype: bool"""
n = len(graph)
color = [0] * n
def dfs(cur, col):
if color[cur] != 0:
return color[cur] == col
color[cur] = col
for i in graph[cur]:
... | the_stack_v2_python_sparse | I/IsGraphBipartite.py | bssrdf/pyleet | train | 2 | |
d0fb03163a22b6906f8d653163f6ac4fab4bc9c7 | [
"langs = hnd.request.headers.get('Accept-Language', '').split(',')\nlangs = get_languages(langs)\nformencode.api.set_stdtranslation(domain='FormEncode', languages=langs)\nself.translate = get_gettextobject('aha', langs).ugettext\nself._ = self.translate\nsuper(ModelCRUDController, self).__init__(hnd, params)",
"q... | <|body_start_0|>
langs = hnd.request.headers.get('Accept-Language', '').split(',')
langs = get_languages(langs)
formencode.api.set_stdtranslation(domain='FormEncode', languages=langs)
self.translate = get_gettextobject('aha', langs).ugettext
self._ = self.translate
super(... | A controller that handles CRUD form of particular model. | ModelCRUDController | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelCRUDController:
"""A controller that handles CRUD form of particular model."""
def __init__(self, hnd, params={}):
"""Initialize method."""
<|body_0|>
def get_index_object(self, start, end):
"""A method to generate query, that gets bunch of object to show in... | stack_v2_sparse_classes_75kplus_train_000123 | 11,935 | permissive | [
{
"docstring": "Initialize method.",
"name": "__init__",
"signature": "def __init__(self, hnd, params={})"
},
{
"docstring": "A method to generate query, that gets bunch of object to show in the list",
"name": "get_index_object",
"signature": "def get_index_object(self, start, end)"
},... | 3 | stack_v2_sparse_classes_30k_train_040268 | Implement the Python class `ModelCRUDController` described below.
Class description:
A controller that handles CRUD form of particular model.
Method signatures and docstrings:
- def __init__(self, hnd, params={}): Initialize method.
- def get_index_object(self, start, end): A method to generate query, that gets bunch... | Implement the Python class `ModelCRUDController` described below.
Class description:
A controller that handles CRUD form of particular model.
Method signatures and docstrings:
- def __init__(self, hnd, params={}): Initialize method.
- def get_index_object(self, start, end): A method to generate query, that gets bunch... | e1209f7d44d1c59ff9d373b7d89d414f31a9c28b | <|skeleton|>
class ModelCRUDController:
"""A controller that handles CRUD form of particular model."""
def __init__(self, hnd, params={}):
"""Initialize method."""
<|body_0|>
def get_index_object(self, start, end):
"""A method to generate query, that gets bunch of object to show in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModelCRUDController:
"""A controller that handles CRUD form of particular model."""
def __init__(self, hnd, params={}):
"""Initialize method."""
langs = hnd.request.headers.get('Accept-Language', '').split(',')
langs = get_languages(langs)
formencode.api.set_stdtranslation... | the_stack_v2_python_sparse | aha/modelcontroller/crudcontroller.py | Letractively/aha-gae | train | 0 |
c93093898ececc4bff87d26529ef7f9498442048 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EducationRoot()",
"from .education_class import EducationClass\nfrom .education_school import EducationSchool\nfrom .education_user import EducationUser\nfrom .education_class import EducationClass\nfrom .education_school import Educat... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return EducationRoot()
<|end_body_0|>
<|body_start_1|>
from .education_class import EducationClass
from .education_school import EducationSchool
from .education_user import EducationUse... | EducationRoot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EducationRoot:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationRoot:
"""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... | stack_v2_sparse_classes_75kplus_train_000124 | 3,678 | 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: EducationRoot",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value... | 3 | stack_v2_sparse_classes_30k_train_041755 | Implement the Python class `EducationRoot` described below.
Class description:
Implement the EducationRoot class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationRoot: Creates a new instance of the appropriate class based on discriminator value... | Implement the Python class `EducationRoot` described below.
Class description:
Implement the EducationRoot class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationRoot: Creates a new instance of the appropriate class based on discriminator value... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class EducationRoot:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationRoot:
"""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... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EducationRoot:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EducationRoot:
"""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: EducationRoo... | the_stack_v2_python_sparse | msgraph/generated/models/education_root.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
d24680225649edf341ddabbc66b09f8ef0da99d0 | [
"self.stock_feature_dict = {}\nself.cal = MktCalendar()\nself.removed_symbols = []",
"symbol, line = feature_str.split(' ', 1)\nif symbol not in self.stock_feature_dict.keys():\n feature = StockFeature(symbol, self.cal)\n feature.create_rule(line)\n self.stock_feature_dict[symbol] = feature\nelse:\n s... | <|body_start_0|>
self.stock_feature_dict = {}
self.cal = MktCalendar()
self.removed_symbols = []
<|end_body_0|>
<|body_start_1|>
symbol, line = feature_str.split(' ', 1)
if symbol not in self.stock_feature_dict.keys():
feature = StockFeature(symbol, self.cal)
... | # TODO | MonitorAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonitorAPI:
"""# TODO"""
def __init__(self):
"""# TODO"""
<|body_0|>
def add_stock_feature(self, feature_str):
"""# TODO :param feature_str: :return:"""
<|body_1|>
def remove_stock_feature(self, symbol, rule_name):
"""# TODO :param symbol: :p... | stack_v2_sparse_classes_75kplus_train_000125 | 2,499 | no_license | [
{
"docstring": "# TODO",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "# TODO :param feature_str: :return:",
"name": "add_stock_feature",
"signature": "def add_stock_feature(self, feature_str)"
},
{
"docstring": "# TODO :param symbol: :param rule_name: ... | 6 | stack_v2_sparse_classes_30k_train_024012 | Implement the Python class `MonitorAPI` described below.
Class description:
# TODO
Method signatures and docstrings:
- def __init__(self): # TODO
- def add_stock_feature(self, feature_str): # TODO :param feature_str: :return:
- def remove_stock_feature(self, symbol, rule_name): # TODO :param symbol: :param rule_name:... | Implement the Python class `MonitorAPI` described below.
Class description:
# TODO
Method signatures and docstrings:
- def __init__(self): # TODO
- def add_stock_feature(self, feature_str): # TODO :param feature_str: :return:
- def remove_stock_feature(self, symbol, rule_name): # TODO :param symbol: :param rule_name:... | 5245cc35699e37492817cb24c09938c51cc1e74a | <|skeleton|>
class MonitorAPI:
"""# TODO"""
def __init__(self):
"""# TODO"""
<|body_0|>
def add_stock_feature(self, feature_str):
"""# TODO :param feature_str: :return:"""
<|body_1|>
def remove_stock_feature(self, symbol, rule_name):
"""# TODO :param symbol: :p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MonitorAPI:
"""# TODO"""
def __init__(self):
"""# TODO"""
self.stock_feature_dict = {}
self.cal = MktCalendar()
self.removed_symbols = []
def add_stock_feature(self, feature_str):
"""# TODO :param feature_str: :return:"""
symbol, line = feature_str.spl... | the_stack_v2_python_sparse | tools/mkt_monitor/monitorAPI.py | zz090923610/stock | train | 0 |
fc7494ac563806f38d2c287148f89ffc0f7d1147 | [
"profile_form = ProfileEditForm()\nkyc_form = KYCUploadForm()\ncontext = {'profile_form': profile_form, 'kyc_form': kyc_form, 'timezones': pytz.common_timezones}\nreturn render(request, self.template_name, context)",
"profile_form = ProfileEditForm(request.POST, request.FILES)\nkyc_form = KYCUploadForm(request.PO... | <|body_start_0|>
profile_form = ProfileEditForm()
kyc_form = KYCUploadForm()
context = {'profile_form': profile_form, 'kyc_form': kyc_form, 'timezones': pytz.common_timezones}
return render(request, self.template_name, context)
<|end_body_0|>
<|body_start_1|>
profile_form = Prof... | KYCUploadView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KYCUploadView:
def get(self, request, *args, **kwargs):
"""provide kyc forms to provide kyc details"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""kyc details uploading verifing the data and reconfirm by user"""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_000126 | 39,823 | no_license | [
{
"docstring": "provide kyc forms to provide kyc details",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "kyc details uploading verifing the data and reconfirm by user",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
... | 2 | stack_v2_sparse_classes_30k_train_047397 | Implement the Python class `KYCUploadView` described below.
Class description:
Implement the KYCUploadView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): provide kyc forms to provide kyc details
- def post(self, request, *args, **kwargs): kyc details uploading verifing the data an... | Implement the Python class `KYCUploadView` described below.
Class description:
Implement the KYCUploadView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): provide kyc forms to provide kyc details
- def post(self, request, *args, **kwargs): kyc details uploading verifing the data an... | 778d9a8fb95c8fe3214a8423905553c71ed7234a | <|skeleton|>
class KYCUploadView:
def get(self, request, *args, **kwargs):
"""provide kyc forms to provide kyc details"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""kyc details uploading verifing the data and reconfirm by user"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KYCUploadView:
def get(self, request, *args, **kwargs):
"""provide kyc forms to provide kyc details"""
profile_form = ProfileEditForm()
kyc_form = KYCUploadForm()
context = {'profile_form': profile_form, 'kyc_form': kyc_form, 'timezones': pytz.common_timezones}
return r... | the_stack_v2_python_sparse | apps/authentication/views.py | devmaster54/tixon | train | 0 | |
74d4254225644a5b1a14f0a45d3f7ce0f4fb4193 | [
"self.is_approved = is_approved\nself.is_ui_feature = is_ui_feature\nself.name = name\nself.reason = reason\nself.timestamp = timestamp",
"if dictionary is None:\n return None\nis_approved = dictionary.get('isApproved')\nis_ui_feature = dictionary.get('isUiFeature')\nname = dictionary.get('name')\nreason = dic... | <|body_start_0|>
self.is_approved = is_approved
self.is_ui_feature = is_ui_feature
self.name = name
self.reason = reason
self.timestamp = timestamp
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
is_approved = dictionary.get('isAppr... | Implementation of the 'FeatureFlag' model. Specify feature flag override status. Attributes: is_approved (bool): Specifies the overridden approval status. is_ui_feature (bool): Specifies if it's a front-end(UI) or back-end feature. name (string, required): Specifies name of the feature. reason (string): Specifies the r... | FeatureFlag | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeatureFlag:
"""Implementation of the 'FeatureFlag' model. Specify feature flag override status. Attributes: is_approved (bool): Specifies the overridden approval status. is_ui_feature (bool): Specifies if it's a front-end(UI) or back-end feature. name (string, required): Specifies name of the fe... | stack_v2_sparse_classes_75kplus_train_000127 | 2,269 | permissive | [
{
"docstring": "Constructor for the FeatureFlag class",
"name": "__init__",
"signature": "def __init__(self, is_approved=None, is_ui_feature=None, name=None, reason=None, timestamp=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict... | 2 | null | Implement the Python class `FeatureFlag` described below.
Class description:
Implementation of the 'FeatureFlag' model. Specify feature flag override status. Attributes: is_approved (bool): Specifies the overridden approval status. is_ui_feature (bool): Specifies if it's a front-end(UI) or back-end feature. name (stri... | Implement the Python class `FeatureFlag` described below.
Class description:
Implementation of the 'FeatureFlag' model. Specify feature flag override status. Attributes: is_approved (bool): Specifies the overridden approval status. is_ui_feature (bool): Specifies if it's a front-end(UI) or back-end feature. name (stri... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class FeatureFlag:
"""Implementation of the 'FeatureFlag' model. Specify feature flag override status. Attributes: is_approved (bool): Specifies the overridden approval status. is_ui_feature (bool): Specifies if it's a front-end(UI) or back-end feature. name (string, required): Specifies name of the fe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FeatureFlag:
"""Implementation of the 'FeatureFlag' model. Specify feature flag override status. Attributes: is_approved (bool): Specifies the overridden approval status. is_ui_feature (bool): Specifies if it's a front-end(UI) or back-end feature. name (string, required): Specifies name of the feature. reason... | the_stack_v2_python_sparse | cohesity_management_sdk/models/feature_flag.py | cohesity/management-sdk-python | train | 24 |
d927bccc803c6b6b58f88f3bc4198d404b6715e1 | [
"self.worst_bp = worst_bp\nself.pred_user_count_file_path = pred_user_count_file_path\nself.mu = mu\nself.lag = lag\nself.slot_iter = count(0)\nScale.__init__(self, sim=sim, scale_rate=scale_rate, startup_delay_func=startup_delay_func, shutdown_delay=shutdown_delay)\nself.capacity_plan = self.parse_pred_user_count_... | <|body_start_0|>
self.worst_bp = worst_bp
self.pred_user_count_file_path = pred_user_count_file_path
self.mu = mu
self.lag = lag
self.slot_iter = count(0)
Scale.__init__(self, sim=sim, scale_rate=scale_rate, startup_delay_func=startup_delay_func, shutdown_delay=shutdown_d... | Wake up periodically and Scale the cluster This scaler policy attempts to provision based on blocking probability predicted from the closed-form erlang B loss equation for an M/M/C queue. A threshold is used to request and release server resources from the cluster. This policy is designed for time-varying Poisson predi... | ErlangBFormulaDataPolicy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ErlangBFormulaDataPolicy:
"""Wake up periodically and Scale the cluster This scaler policy attempts to provision based on blocking probability predicted from the closed-form erlang B loss equation for an M/M/C queue. A threshold is used to request and release server resources from the cluster. Th... | stack_v2_sparse_classes_75kplus_train_000128 | 12,277 | no_license | [
{
"docstring": "Initializes a ErlangBFormulaDataPolicy object parameters: sim -- The Simulation containing a cluster cluster object this scale function is managing scale_rate -- The interarrival time between scale events in seconds startup_delay_func -- A callable that returns the time a server spends in the bo... | 4 | stack_v2_sparse_classes_30k_train_009235 | Implement the Python class `ErlangBFormulaDataPolicy` described below.
Class description:
Wake up periodically and Scale the cluster This scaler policy attempts to provision based on blocking probability predicted from the closed-form erlang B loss equation for an M/M/C queue. A threshold is used to request and releas... | Implement the Python class `ErlangBFormulaDataPolicy` described below.
Class description:
Wake up periodically and Scale the cluster This scaler policy attempts to provision based on blocking probability predicted from the closed-form erlang B loss equation for an M/M/C queue. A threshold is used to request and releas... | 30dc0702f6189307ff776525a2f3006ec471de47 | <|skeleton|>
class ErlangBFormulaDataPolicy:
"""Wake up periodically and Scale the cluster This scaler policy attempts to provision based on blocking probability predicted from the closed-form erlang B loss equation for an M/M/C queue. A threshold is used to request and release server resources from the cluster. Th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ErlangBFormulaDataPolicy:
"""Wake up periodically and Scale the cluster This scaler policy attempts to provision based on blocking probability predicted from the closed-form erlang B loss equation for an M/M/C queue. A threshold is used to request and release server resources from the cluster. This policy is ... | the_stack_v2_python_sparse | appsim/scaler/erlang_policy.py | bmbouter/vcl_simulation | train | 0 |
322f530171d7a90a037fefef5e62120a2d7ab130 | [
"if not isinstance(params, ZSpreadModelParameters):\n raise TypeError('Parameters have to be type of <ZSpreadModelParameters>.')\nif not isinstance(T, (int, float)):\n raise TypeError('T has to be type of <int> or <float>.')\nif not isinstance(n_step, int):\n raise TypeError('n_step has to be type of <int>... | <|body_start_0|>
if not isinstance(params, ZSpreadModelParameters):
raise TypeError('Parameters have to be type of <ZSpreadModelParameters>.')
if not isinstance(T, (int, float)):
raise TypeError('T has to be type of <int> or <float>.')
if not isinstance(n_step, int):
... | ZSpreadModelSolver | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZSpreadModelSolver:
def solve(params, T, n_step):
""":param params: :param T: :param n_step: :return:"""
<|body_0|>
def _solve_b(params, c_t, T, n_step):
""":param params: :param c: :param T: :param n_step: :return:"""
<|body_1|>
def _solve_c(params, T, ... | stack_v2_sparse_classes_75kplus_train_000129 | 5,077 | permissive | [
{
"docstring": ":param params: :param T: :param n_step: :return:",
"name": "solve",
"signature": "def solve(params, T, n_step)"
},
{
"docstring": ":param params: :param c: :param T: :param n_step: :return:",
"name": "_solve_b",
"signature": "def _solve_b(params, c_t, T, n_step)"
},
{... | 3 | null | Implement the Python class `ZSpreadModelSolver` described below.
Class description:
Implement the ZSpreadModelSolver class.
Method signatures and docstrings:
- def solve(params, T, n_step): :param params: :param T: :param n_step: :return:
- def _solve_b(params, c_t, T, n_step): :param params: :param c: :param T: :par... | Implement the Python class `ZSpreadModelSolver` described below.
Class description:
Implement the ZSpreadModelSolver class.
Method signatures and docstrings:
- def solve(params, T, n_step): :param params: :param T: :param n_step: :return:
- def _solve_b(params, c_t, T, n_step): :param params: :param c: :param T: :par... | 521017c6f099e1bd7ea0f31df918abd83a0c8be7 | <|skeleton|>
class ZSpreadModelSolver:
def solve(params, T, n_step):
""":param params: :param T: :param n_step: :return:"""
<|body_0|>
def _solve_b(params, c_t, T, n_step):
""":param params: :param c: :param T: :param n_step: :return:"""
<|body_1|>
def _solve_c(params, T, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZSpreadModelSolver:
def solve(params, T, n_step):
""":param params: :param T: :param n_step: :return:"""
if not isinstance(params, ZSpreadModelParameters):
raise TypeError('Parameters have to be type of <ZSpreadModelParameters>.')
if not isinstance(T, (int, float)):
... | the_stack_v2_python_sparse | src/optimal_controls/z_spread_model_solver.py | PontusHultkrantz/statarb | train | 0 | |
2e9a3a07b7d32bbe35ad945ef2f107fac83a362a | [
"source_map = defaultdict(lambda: 'USD')\ncost_models = CostModel.objects.all().values('uuid', 'currency').distinct()\ncm_to_currency = {row['uuid']: row['currency'] for row in cost_models}\nmapping = CostModelMap.objects.all().values('provider_uuid', 'cost_model_id')\nsource_map |= {row['provider_uuid']: cm_to_cur... | <|body_start_0|>
source_map = defaultdict(lambda: 'USD')
cost_models = CostModel.objects.all().values('uuid', 'currency').distinct()
cm_to_currency = {row['uuid']: row['currency'] for row in cost_models}
mapping = CostModelMap.objects.all().values('provider_uuid', 'cost_model_id')
... | OCP forecasting class. | OCPForecast | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OCPForecast:
"""OCP forecasting class."""
def source_to_currency_map(self):
"""OCP sources do not have costs associated, so we need to grab the base currency from the cost model, and create a mapping of source_uuid to currency. returns: dict: {source_uuid: currency}"""
<|body... | stack_v2_sparse_classes_75kplus_train_000130 | 26,653 | permissive | [
{
"docstring": "OCP sources do not have costs associated, so we need to grab the base currency from the cost model, and create a mapping of source_uuid to currency. returns: dict: {source_uuid: currency}",
"name": "source_to_currency_map",
"signature": "def source_to_currency_map(self)"
},
{
"do... | 2 | stack_v2_sparse_classes_30k_train_024042 | Implement the Python class `OCPForecast` described below.
Class description:
OCP forecasting class.
Method signatures and docstrings:
- def source_to_currency_map(self): OCP sources do not have costs associated, so we need to grab the base currency from the cost model, and create a mapping of source_uuid to currency.... | Implement the Python class `OCPForecast` described below.
Class description:
OCP forecasting class.
Method signatures and docstrings:
- def source_to_currency_map(self): OCP sources do not have costs associated, so we need to grab the base currency from the cost model, and create a mapping of source_uuid to currency.... | 0416e5216eb1ec4b41c8dd4999adde218b1ab2e1 | <|skeleton|>
class OCPForecast:
"""OCP forecasting class."""
def source_to_currency_map(self):
"""OCP sources do not have costs associated, so we need to grab the base currency from the cost model, and create a mapping of source_uuid to currency. returns: dict: {source_uuid: currency}"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OCPForecast:
"""OCP forecasting class."""
def source_to_currency_map(self):
"""OCP sources do not have costs associated, so we need to grab the base currency from the cost model, and create a mapping of source_uuid to currency. returns: dict: {source_uuid: currency}"""
source_map = defaul... | the_stack_v2_python_sparse | koku/forecast/forecast.py | project-koku/koku | train | 225 |
d947337fa68bea27d0f4f82d6162175fdd6e1ae7 | [
"self.missing_generated = False\nself.missing_remote = False\nself.conffile_name = conffile_name\nself.diff_lines = []\nif not exists(generated_file_name):\n self.missing_generated = True\nif not exists(remote_file_name):\n self.missing_remote = True\nif not self.missing_generated and (not self.missing_remote... | <|body_start_0|>
self.missing_generated = False
self.missing_remote = False
self.conffile_name = conffile_name
self.diff_lines = []
if not exists(generated_file_name):
self.missing_generated = True
if not exists(remote_file_name):
self.missing_remo... | Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file. | ConfFileDiff | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfFileDiff:
"""Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file."""
def __init__(self, remote_file_name, generated_file_name, conffile_name):
"""Compute whether the conffile with the given name has changed given a r... | stack_v2_sparse_classes_75kplus_train_000131 | 11,724 | permissive | [
{
"docstring": "Compute whether the conffile with the given name has changed given a remote and generate file copy.",
"name": "__init__",
"signature": "def __init__(self, remote_file_name, generated_file_name, conffile_name)"
},
{
"docstring": "Print the diff using pretty colors. If confab is us... | 3 | stack_v2_sparse_classes_30k_val_002778 | Implement the Python class `ConfFileDiff` described below.
Class description:
Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file.
Method signatures and docstrings:
- def __init__(self, remote_file_name, generated_file_name, conffile_name): Compute wheth... | Implement the Python class `ConfFileDiff` described below.
Class description:
Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file.
Method signatures and docstrings:
- def __init__(self, remote_file_name, generated_file_name, conffile_name): Compute wheth... | a39c3d7aae11b2f373b8911b4f3caa75548a00c6 | <|skeleton|>
class ConfFileDiff:
"""Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file."""
def __init__(self, remote_file_name, generated_file_name, conffile_name):
"""Compute whether the conffile with the given name has changed given a r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfFileDiff:
"""Encapsulation of the differences between the (locally copied) remote and generated versions of a configuration file."""
def __init__(self, remote_file_name, generated_file_name, conffile_name):
"""Compute whether the conffile with the given name has changed given a remote and gen... | the_stack_v2_python_sparse | confab/conffiles.py | locationlabs/confab | train | 3 |
c45493bda1bccf04b4e6a9d4b3e96b093b7eddb9 | [
"if isinstance(part, Permutation) and part.parent() is P:\n elt = part\n part = elt.cycle_type()\nelse:\n elt = P.element_in_conjugacy_classes(part)\nSymmetricGroupConjugacyClassMixin.__init__(self, range(1, P.n + 1), part)\nConjugacyClass.__init__(self, P, elt)",
"if self._set:\n for x in self._set:\... | <|body_start_0|>
if isinstance(part, Permutation) and part.parent() is P:
elt = part
part = elt.cycle_type()
else:
elt = P.element_in_conjugacy_classes(part)
SymmetricGroupConjugacyClassMixin.__init__(self, range(1, P.n + 1), part)
ConjugacyClass.__ini... | A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P`` | PermutationsConjugacyClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PermutationsConjugacyClass:
"""A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``"""
def __init__(self, P, part):
"""Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5... | stack_v2_sparse_classes_75kplus_train_000132 | 10,400 | no_license | [
{
"docstring": "Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5, 3]) sage: C = G.conjugacy_class(g) sage: TestSuite(C).run() sage: C = G.conjugacy_class(Partition([3,2])) sage: TestSuite(C).run()",
"name": "__init__",
"signature": "def __init__(self, P, part)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_053248 | Implement the Python class `PermutationsConjugacyClass` described below.
Class description:
A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``
Method signatures and docstrings:
- def __init__(self, P, part): Initialize ``self``. EXA... | Implement the Python class `PermutationsConjugacyClass` described below.
Class description:
A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``
Method signatures and docstrings:
- def __init__(self, P, part): Initialize ``self``. EXA... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class PermutationsConjugacyClass:
"""A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``"""
def __init__(self, P, part):
"""Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PermutationsConjugacyClass:
"""A conjugacy class of the permutations of `n`. INPUT: - ``P`` -- the permutations of `n` - ``part`` -- a partition or an element of ``P``"""
def __init__(self, P, part):
"""Initialize ``self``. EXAMPLES:: sage: G = Permutations(5) sage: g = G([2, 1, 4, 5, 3]) sage: C... | the_stack_v2_python_sparse | sage/src/sage/groups/perm_gps/symgp_conjugacy_class.py | bopopescu/geosci | train | 0 |
03edf1a97d3ec2e95b7a9500a951150bf5cbaf95 | [
"input_json = request.data\noutput_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None]))\ntry:\n json_params = input_json['APIParams']\n json_params['profile_... | <|body_start_0|>
input_json = request.data
output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None]))
try:
json_params = input_jso... | This API will create a notification | PopulateMyNotificationsAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PopulateMyNotificationsAPI:
"""This API will create a notification"""
def post(self, request):
"""Post function to crete a notification"""
<|body_0|>
def populate_my_notifications_json(self, request):
"""This API will create a notification :param request: { 'prof... | stack_v2_sparse_classes_75kplus_train_000133 | 3,021 | no_license | [
{
"docstring": "Post function to crete a notification",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "This API will create a notification :param request: { 'profile_id':277 } :return",
"name": "populate_my_notifications_json",
"signature": "def populate_my_not... | 2 | stack_v2_sparse_classes_30k_train_046957 | Implement the Python class `PopulateMyNotificationsAPI` described below.
Class description:
This API will create a notification
Method signatures and docstrings:
- def post(self, request): Post function to crete a notification
- def populate_my_notifications_json(self, request): This API will create a notification :p... | Implement the Python class `PopulateMyNotificationsAPI` described below.
Class description:
This API will create a notification
Method signatures and docstrings:
- def post(self, request): Post function to crete a notification
- def populate_my_notifications_json(self, request): This API will create a notification :p... | 36eb9931f330e64902354c6fc471be2adf4b7049 | <|skeleton|>
class PopulateMyNotificationsAPI:
"""This API will create a notification"""
def post(self, request):
"""Post function to crete a notification"""
<|body_0|>
def populate_my_notifications_json(self, request):
"""This API will create a notification :param request: { 'prof... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PopulateMyNotificationsAPI:
"""This API will create a notification"""
def post(self, request):
"""Post function to crete a notification"""
input_json = request.data
output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['A... | the_stack_v2_python_sparse | Generic/common/notifications_new/api/populate_my_notifications/views_populate_my_notifications.py | archiemb303/common_backend_django | train | 0 |
78ddf32c217138cbf93bc71a64e5422ea3453f6f | [
"super(fmnist_vae, self).__init__(batch_size, weight_decay)\nif weight_decay is not None:\n print('WARNING: Weight decay is non-zero but no weight decay is used', 'for this model.')",
"self.dataset = fmnist(self._batch_size)\nself.train_init_op = self.dataset.train_init_op\nself.train_eval_init_op = self.datas... | <|body_start_0|>
super(fmnist_vae, self).__init__(batch_size, weight_decay)
if weight_decay is not None:
print('WARNING: Weight decay is non-zero but no weight decay is used', 'for this model.')
<|end_body_0|>
<|body_start_1|>
self.dataset = fmnist(self._batch_size)
self.tra... | DeepOBS test problem class for a variational autoencoder (VAE) on Fashion-MNIST. The network has been adapted from the `here <https://towardsdatascience.com/teaching-a-variational-autoencoder-vae-to-draw-mnist-characters-978675c95776>`_ and consists of an encoder: - With three convolutional layers with each ``64`` filt... | fmnist_vae | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class fmnist_vae:
"""DeepOBS test problem class for a variational autoencoder (VAE) on Fashion-MNIST. The network has been adapted from the `here <https://towardsdatascience.com/teaching-a-variational-autoencoder-vae-to-draw-mnist-characters-978675c95776>`_ and consists of an encoder: - With three conv... | stack_v2_sparse_classes_75kplus_train_000134 | 3,510 | permissive | [
{
"docstring": "Create a new VAE test problem instance on Fashion-MNIST. Args: batch_size (int): Batch size to use. weight_decay (float): No weight decay (L2-regularization) is used in this test problem. Defaults to ``None`` and any input here is ignored.",
"name": "__init__",
"signature": "def __init__... | 2 | null | Implement the Python class `fmnist_vae` described below.
Class description:
DeepOBS test problem class for a variational autoencoder (VAE) on Fashion-MNIST. The network has been adapted from the `here <https://towardsdatascience.com/teaching-a-variational-autoencoder-vae-to-draw-mnist-characters-978675c95776>`_ and co... | Implement the Python class `fmnist_vae` described below.
Class description:
DeepOBS test problem class for a variational autoencoder (VAE) on Fashion-MNIST. The network has been adapted from the `here <https://towardsdatascience.com/teaching-a-variational-autoencoder-vae-to-draw-mnist-characters-978675c95776>`_ and co... | b41aafe8896223ba8dc8e61449656e82d42be1d8 | <|skeleton|>
class fmnist_vae:
"""DeepOBS test problem class for a variational autoencoder (VAE) on Fashion-MNIST. The network has been adapted from the `here <https://towardsdatascience.com/teaching-a-variational-autoencoder-vae-to-draw-mnist-characters-978675c95776>`_ and consists of an encoder: - With three conv... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class fmnist_vae:
"""DeepOBS test problem class for a variational autoencoder (VAE) on Fashion-MNIST. The network has been adapted from the `here <https://towardsdatascience.com/teaching-a-variational-autoencoder-vae-to-draw-mnist-characters-978675c95776>`_ and consists of an encoder: - With three convolutional lay... | the_stack_v2_python_sparse | deepobs/tensorflow/testproblems/fmnist_vae.py | fsschneider/DeepOBS | train | 105 |
00f409af0a1b4941c20b1e0ce9a77678165a64e1 | [
"user = User.create(email='foo@bar.com', access_type='editor')\nassert User.get_by_id(user.id).email == 'foo@bar.com'\nassert User.get_by_id(user.id).access_type == 'editor'",
"user = User('foo@bar.com')\nuser.save()\nassert User.get_by_id(user.id) is not None",
"user = User('foo@bar.com')\nuser.save()\nuser.de... | <|body_start_0|>
user = User.create(email='foo@bar.com', access_type='editor')
assert User.get_by_id(user.id).email == 'foo@bar.com'
assert User.get_by_id(user.id).access_type == 'editor'
<|end_body_0|>
<|body_start_1|>
user = User('foo@bar.com')
user.save()
assert User.... | CRUDMixin tests. | TestCRUDMixin | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCRUDMixin:
"""CRUDMixin tests."""
def test_create(self):
"""Test CRUD create."""
<|body_0|>
def test_create_save(self):
"""Test CRUD create with save."""
<|body_1|>
def test_delete_with_commit(self):
"""Test CRUD delete with commit."""
... | stack_v2_sparse_classes_75kplus_train_000135 | 1,833 | permissive | [
{
"docstring": "Test CRUD create.",
"name": "test_create",
"signature": "def test_create(self)"
},
{
"docstring": "Test CRUD create with save.",
"name": "test_create_save",
"signature": "def test_create_save(self)"
},
{
"docstring": "Test CRUD delete with commit.",
"name": "t... | 5 | stack_v2_sparse_classes_30k_train_004517 | Implement the Python class `TestCRUDMixin` described below.
Class description:
CRUDMixin tests.
Method signatures and docstrings:
- def test_create(self): Test CRUD create.
- def test_create_save(self): Test CRUD create with save.
- def test_delete_with_commit(self): Test CRUD delete with commit.
- def test_delete_wi... | Implement the Python class `TestCRUDMixin` described below.
Class description:
CRUDMixin tests.
Method signatures and docstrings:
- def test_create(self): Test CRUD create.
- def test_create_save(self): Test CRUD create with save.
- def test_delete_with_commit(self): Test CRUD delete with commit.
- def test_delete_wi... | 329e260217a6fad26a3fd60adaa3dec873378495 | <|skeleton|>
class TestCRUDMixin:
"""CRUDMixin tests."""
def test_create(self):
"""Test CRUD create."""
<|body_0|>
def test_create_save(self):
"""Test CRUD create with save."""
<|body_1|>
def test_delete_with_commit(self):
"""Test CRUD delete with commit."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestCRUDMixin:
"""CRUDMixin tests."""
def test_create(self):
"""Test CRUD create."""
user = User.create(email='foo@bar.com', access_type='editor')
assert User.get_by_id(user.id).email == 'foo@bar.com'
assert User.get_by_id(user.id).access_type == 'editor'
def test_cre... | the_stack_v2_python_sparse | backend/backend/integration_tests/test_database.py | JBEI/foldy | train | 13 |
d5a23850b547b1ffe0ee237c6db5ca8b4c3e4d0b | [
"self.processModel = Process()\nself.processModel.signalNamespace(self, 'processModel')\nself.registerMethodForRpc(self.uri + '/processModel.rowCount', self.processModel, lambda i: self.processModel.rowCount())\nself.registerMethodForRpc(self.uri + '/processModel.columnCount', self.processModel, lambda i: self.proc... | <|body_start_0|>
self.processModel = Process()
self.processModel.signalNamespace(self, 'processModel')
self.registerMethodForRpc(self.uri + '/processModel.rowCount', self.processModel, lambda i: self.processModel.rowCount())
self.registerMethodForRpc(self.uri + '/processModel.columnCount... | This is simple process monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection | ProcessMonitorServerProtocol | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessMonitorServerProtocol:
"""This is simple process monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection"""
def onSessionOpen(self):
"""When connection is established, we cr... | stack_v2_sparse_classes_75kplus_train_000136 | 2,551 | no_license | [
{
"docstring": "When connection is established, we create our model instances and register them for RPC. that's it.",
"name": "onSessionOpen",
"signature": "def onSessionOpen(self)"
},
{
"docstring": "When connection is gone (i.e. client close window, navigated away from the page), stop the mode... | 2 | null | Implement the Python class `ProcessMonitorServerProtocol` described below.
Class description:
This is simple process monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection
Method signatures and docstrings:
- def o... | Implement the Python class `ProcessMonitorServerProtocol` described below.
Class description:
This is simple process monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection
Method signatures and docstrings:
- def o... | 16d3284d83ad5f8bd5fb6aaa048d5b444892b31a | <|skeleton|>
class ProcessMonitorServerProtocol:
"""This is simple process monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection"""
def onSessionOpen(self):
"""When connection is established, we cr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProcessMonitorServerProtocol:
"""This is simple process monitor server protocol. As with other server classes model is created, when new connection is established, and deleted when client closes websocket connection"""
def onSessionOpen(self):
"""When connection is established, we create our mode... | the_stack_v2_python_sparse | src/web/server_process.py | vminakov/system-monitor | train | 0 |
f218a16813a9351c677fdbc7a6ebe9d0242e2284 | [
"TextAnswerFormRecord._init_map(self)\nFilesAnswerFormRecord._init_map(self)\nsuper(AnswerTextAndFilesMixin, self)._init_map()",
"TextAnswerFormRecord._init_metadata(self)\nFilesAnswerFormRecord._init_metadata(self)\nsuper(AnswerTextAndFilesMixin, self)._init_metadata()"
] | <|body_start_0|>
TextAnswerFormRecord._init_map(self)
FilesAnswerFormRecord._init_map(self)
super(AnswerTextAndFilesMixin, self)._init_map()
<|end_body_0|>
<|body_start_1|>
TextAnswerFormRecord._init_metadata(self)
FilesAnswerFormRecord._init_metadata(self)
super(AnswerT... | Mixin class to make the two classes compatible with super() for _init_map and _init_metadata | AnswerTextAndFilesMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnswerTextAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
<|body_0|>
def _init_metadata(self):
"""stub"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_000137 | 22,562 | permissive | [
{
"docstring": "stub",
"name": "_init_map",
"signature": "def _init_map(self)"
},
{
"docstring": "stub",
"name": "_init_metadata",
"signature": "def _init_metadata(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052759 | Implement the Python class `AnswerTextAndFilesMixin` described below.
Class description:
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
Method signatures and docstrings:
- def _init_map(self): stub
- def _init_metadata(self): stub | Implement the Python class `AnswerTextAndFilesMixin` described below.
Class description:
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
Method signatures and docstrings:
- def _init_map(self): stub
- def _init_metadata(self): stub
<|skeleton|>
class AnswerTextAndFilesMix... | 445f968a175d61c8d92c0f617a3c17dc1dc7c584 | <|skeleton|>
class AnswerTextAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
<|body_0|>
def _init_metadata(self):
"""stub"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnswerTextAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
TextAnswerFormRecord._init_map(self)
FilesAnswerFormRecord._init_map(self)
super(AnswerTextAndFilesMixin, self)._init... | the_stack_v2_python_sparse | dlkit/records/assessment/basic/simple_records.py | mitsei/dlkit | train | 2 |
152f4a228e4bad22e71b5c1b4469cce54a2d6255 | [
"basedir = os.path.dirname(os.path.abspath(__file__))\nlog_path = os.path.join(basedir, log_dir)\nif not os.path.isdir(log_path):\n os.mkdir(log_path)",
"logging.config.dictConfig(LOGGING_DIC)\nif name:\n logger = logging.getLogger(name)\nelse:\n logger = logging.getLogger(__name__)\nreturn logger"
] | <|body_start_0|>
basedir = os.path.dirname(os.path.abspath(__file__))
log_path = os.path.join(basedir, log_dir)
if not os.path.isdir(log_path):
os.mkdir(log_path)
<|end_body_0|>
<|body_start_1|>
logging.config.dictConfig(LOGGING_DIC)
if name:
logger = log... | Log | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Log:
def isdir_logs():
"""判断日志文件是否存在,不存在则创建 :return:"""
<|body_0|>
def make_logger(name=None):
"""1. 如果不传name,则根据__name__去loggers里查找__name__对应的logger配置(__name__为调用文件名) 获取logger对象通过方法logging.getLogger(__name__),不同的文件__name__不同,这保证了打印日志时标识信息不同, 2. 如果传name,则根据name获取logg... | stack_v2_sparse_classes_75kplus_train_000138 | 4,731 | no_license | [
{
"docstring": "判断日志文件是否存在,不存在则创建 :return:",
"name": "isdir_logs",
"signature": "def isdir_logs()"
},
{
"docstring": "1. 如果不传name,则根据__name__去loggers里查找__name__对应的logger配置(__name__为调用文件名) 获取logger对象通过方法logging.getLogger(__name__),不同的文件__name__不同,这保证了打印日志时标识信息不同, 2. 如果传name,则根据name获取loggers对象 3. ... | 2 | null | Implement the Python class `Log` described below.
Class description:
Implement the Log class.
Method signatures and docstrings:
- def isdir_logs(): 判断日志文件是否存在,不存在则创建 :return:
- def make_logger(name=None): 1. 如果不传name,则根据__name__去loggers里查找__name__对应的logger配置(__name__为调用文件名) 获取logger对象通过方法logging.getLogger(__name__),不... | Implement the Python class `Log` described below.
Class description:
Implement the Log class.
Method signatures and docstrings:
- def isdir_logs(): 判断日志文件是否存在,不存在则创建 :return:
- def make_logger(name=None): 1. 如果不传name,则根据__name__去loggers里查找__name__对应的logger配置(__name__为调用文件名) 获取logger对象通过方法logging.getLogger(__name__),不... | 6a5b86ac4ad4ee5ae110e63a916d167e3ee47890 | <|skeleton|>
class Log:
def isdir_logs():
"""判断日志文件是否存在,不存在则创建 :return:"""
<|body_0|>
def make_logger(name=None):
"""1. 如果不传name,则根据__name__去loggers里查找__name__对应的logger配置(__name__为调用文件名) 获取logger对象通过方法logging.getLogger(__name__),不同的文件__name__不同,这保证了打印日志时标识信息不同, 2. 如果传name,则根据name获取logg... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Log:
def isdir_logs():
"""判断日志文件是否存在,不存在则创建 :return:"""
basedir = os.path.dirname(os.path.abspath(__file__))
log_path = os.path.join(basedir, log_dir)
if not os.path.isdir(log_path):
os.mkdir(log_path)
def make_logger(name=None):
"""1. 如果不传name,则根据__nam... | the_stack_v2_python_sparse | myproject/learn-python3/package/5_logging_conf.py | laoqiukantianxia/PythonSource | train | 0 | |
df4ea4d2c92528ca2a3c8af7c4ac627e5d563437 | [
"if n == 0:\n return 1\nif x == 0:\n if n > 0:\n return 0\n else:\n return inf\nres = 1\nflag = 1\nif n < 0:\n flag = -1\n n = abs(n)\nfor i in range(n):\n res *= x\nreturn res if flag == 1 else 1 / res",
"if n == 0:\n return 1\nif x == 0:\n if n > 0:\n return 0\n e... | <|body_start_0|>
if n == 0:
return 1
if x == 0:
if n > 0:
return 0
else:
return inf
res = 1
flag = 1
if n < 0:
flag = -1
n = abs(n)
for i in range(n):
res *= x
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def myPow1(self, x: float, n: int) -> float:
"""思路:迭代 时间复杂度:O(N)"""
<|body_0|>
def myPow2(self, x: float, n: int) -> float:
"""执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.05%的用户 思路:快速幂 1、首先,任何数的0次幂都是 2、负数的n次幂,为这个数绝对值的n次幂的倒数 3... | stack_v2_sparse_classes_75kplus_train_000139 | 2,333 | no_license | [
{
"docstring": "思路:迭代 时间复杂度:O(N)",
"name": "myPow1",
"signature": "def myPow1(self, x: float, n: int) -> float"
},
{
"docstring": "执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.05%的用户 思路:快速幂 1、首先,任何数的0次幂都是 2、负数的n次幂,为这个数绝对值的n次幂的倒数 3、将n转化为2进制,如10对应的二进制为:1010,即n=1*(2**... | 2 | stack_v2_sparse_classes_30k_train_036175 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow1(self, x: float, n: int) -> float: 思路:迭代 时间复杂度:O(N)
- def myPow2(self, x: float, n: int) -> float: 执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow1(self, x: float, n: int) -> float: 思路:迭代 时间复杂度:O(N)
- def myPow2(self, x: float, n: int) -> float: 执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def myPow1(self, x: float, n: int) -> float:
"""思路:迭代 时间复杂度:O(N)"""
<|body_0|>
def myPow2(self, x: float, n: int) -> float:
"""执行用时 :28 ms, 在所有 Python3 提交中击败了94.37%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了5.05%的用户 思路:快速幂 1、首先,任何数的0次幂都是 2、负数的n次幂,为这个数绝对值的n次幂的倒数 3... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def myPow1(self, x: float, n: int) -> float:
"""思路:迭代 时间复杂度:O(N)"""
if n == 0:
return 1
if x == 0:
if n > 0:
return 0
else:
return inf
res = 1
flag = 1
if n < 0:
flag = -1
... | the_stack_v2_python_sparse | LeetCode/快速幂/50. Pow(x, n).py | yiming1012/MyLeetCode | train | 2 | |
740ec3a924d08100f6fc19da9bbd53f0cc1391d4 | [
"self.error = 0\nself.errorPrevious = 0\nself.eP = 0\nself.eI = 0\nself.eD = 0\nself.kP = kp\nself.kI = ki\nself.kD = kd\nself.u = 0",
"self.errorPrevious = self.error\nif abs(error) < 90:\n self.error = error\nelse:\n pass\nself.eP = self.error\nself.eD = self.error - self.errorPrevious\nself.eI = self.eI ... | <|body_start_0|>
self.error = 0
self.errorPrevious = 0
self.eP = 0
self.eI = 0
self.eD = 0
self.kP = kp
self.kI = ki
self.kD = kd
self.u = 0
<|end_body_0|>
<|body_start_1|>
self.errorPrevious = self.error
if abs(error) < 90:
... | PIDController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PIDController:
def __init__(self, kp, ki, kd):
"""Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain"""
<|body_0|>
def update(self, error, dt=None):
"""Update the PID controller wi... | stack_v2_sparse_classes_75kplus_train_000140 | 1,428 | no_license | [
{
"docstring": "Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain",
"name": "__init__",
"signature": "def __init__(self, kp, ki, kd)"
},
{
"docstring": "Update the PID controller with new error values. :param... | 2 | stack_v2_sparse_classes_30k_train_051675 | Implement the Python class `PIDController` described below.
Class description:
Implement the PIDController class.
Method signatures and docstrings:
- def __init__(self, kp, ki, kd): Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gai... | Implement the Python class `PIDController` described below.
Class description:
Implement the PIDController class.
Method signatures and docstrings:
- def __init__(self, kp, ki, kd): Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gai... | e6c9686c440486831ce5ea246ab05af5b4f6ea01 | <|skeleton|>
class PIDController:
def __init__(self, kp, ki, kd):
"""Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain"""
<|body_0|>
def update(self, error, dt=None):
"""Update the PID controller wi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PIDController:
def __init__(self, kp, ki, kd):
"""Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain"""
self.error = 0
self.errorPrevious = 0
self.eP = 0
self.eI = 0
self.eD =... | the_stack_v2_python_sparse | Controllers/PIDController.py | augustusellis/balance_bot | train | 1 | |
a1d8254c5eac458e2824f9d6a472f098b9fcb162 | [
"add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25)\nadd_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10)\nadd_furniture('invoice.csv', 'Alex Gonzales', 'BR02', 'Queen Mattress', 17)\nwith open('invoice.csv', 'r') as csvfile:\n rentals = []\n for row in csvfile:\n ... | <|body_start_0|>
add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25)
add_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10)
add_furniture('invoice.csv', 'Alex Gonzales', 'BR02', 'Queen Mattress', 17)
with open('invoice.csv', 'r') as csvfile:
... | Class to test inventory module. | TestIventory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestIventory:
"""Class to test inventory module."""
def test_add_furniture(self):
"""Function to test add furniture functionality."""
<|body_0|>
def test_single_customer(self):
"""Tests single customer functionality."""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_000141 | 1,649 | no_license | [
{
"docstring": "Function to test add furniture functionality.",
"name": "test_add_furniture",
"signature": "def test_add_furniture(self)"
},
{
"docstring": "Tests single customer functionality.",
"name": "test_single_customer",
"signature": "def test_single_customer(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_040845 | Implement the Python class `TestIventory` described below.
Class description:
Class to test inventory module.
Method signatures and docstrings:
- def test_add_furniture(self): Function to test add furniture functionality.
- def test_single_customer(self): Tests single customer functionality. | Implement the Python class `TestIventory` described below.
Class description:
Class to test inventory module.
Method signatures and docstrings:
- def test_add_furniture(self): Function to test add furniture functionality.
- def test_single_customer(self): Tests single customer functionality.
<|skeleton|>
class TestI... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class TestIventory:
"""Class to test inventory module."""
def test_add_furniture(self):
"""Function to test add furniture functionality."""
<|body_0|>
def test_single_customer(self):
"""Tests single customer functionality."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestIventory:
"""Class to test inventory module."""
def test_add_furniture(self):
"""Function to test add furniture functionality."""
add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25)
add_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10)
... | the_stack_v2_python_sparse | students/N0vA/lesson08/assignment/test_inventory.py | JavaRod/SP_Python220B_2019 | train | 1 |
0d83a8cc01eacea4b7c278b5d1090ff15d7917b0 | [
"self.source = source\nself.destination = destination\nself.classification = classification",
"if valid_to is None:\n valid_to = dt.timedelta(days=1)\nif valid_from is None:\n valid_from = dt.timedelta(seconds=0)\nself.valid_from = dt.datetime.now() + valid_from\nself.valid_to = dt.datetime.now() + valid_to... | <|body_start_0|>
self.source = source
self.destination = destination
self.classification = classification
<|end_body_0|>
<|body_start_1|>
if valid_to is None:
valid_to = dt.timedelta(days=1)
if valid_from is None:
valid_from = dt.timedelta(seconds=0)
... | A message sent between devices. | Message | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Message:
"""A message sent between devices."""
def __init__(self, source, destination, classification):
"""Create an instance."""
<|body_0|>
def set_datetime(self, valid_from: dt.timedelta=None, valid_to: dt.timedelta=None):
"""Set the valid_from and valid_to dat... | stack_v2_sparse_classes_75kplus_train_000142 | 1,308 | permissive | [
{
"docstring": "Create an instance.",
"name": "__init__",
"signature": "def __init__(self, source, destination, classification)"
},
{
"docstring": "Set the valid_from and valid_to dates. Input must be a timedelta object.",
"name": "set_datetime",
"signature": "def set_datetime(self, vali... | 2 | stack_v2_sparse_classes_30k_train_026822 | Implement the Python class `Message` described below.
Class description:
A message sent between devices.
Method signatures and docstrings:
- def __init__(self, source, destination, classification): Create an instance.
- def set_datetime(self, valid_from: dt.timedelta=None, valid_to: dt.timedelta=None): Set the valid_... | Implement the Python class `Message` described below.
Class description:
A message sent between devices.
Method signatures and docstrings:
- def __init__(self, source, destination, classification): Create an instance.
- def set_datetime(self, valid_from: dt.timedelta=None, valid_to: dt.timedelta=None): Set the valid_... | 7d37690a8c42091a5892aa45518bfe6003728a18 | <|skeleton|>
class Message:
"""A message sent between devices."""
def __init__(self, source, destination, classification):
"""Create an instance."""
<|body_0|>
def set_datetime(self, valid_from: dt.timedelta=None, valid_to: dt.timedelta=None):
"""Set the valid_from and valid_to dat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Message:
"""A message sent between devices."""
def __init__(self, source, destination, classification):
"""Create an instance."""
self.source = source
self.destination = destination
self.classification = classification
def set_datetime(self, valid_from: dt.timedelta=N... | the_stack_v2_python_sparse | database/fm_database/models/message.py | nstoik/farm_monitor | train | 0 |
19838ef99664b74301d17dd03f3deb227f421bba | [
"article = Article.objects.filter(article_slug=slug).first()\nfinal = dict()\nserializer = ArticleAuthorSerializer(article)\nfinal.update(serializer.data)\nfinal.update({'rating': article.rating})\nfinal.update({'read_time': estimate_time(serializer.data.get('body', ''))})\nmessage = {'message': 'Article found.', '... | <|body_start_0|>
article = Article.objects.filter(article_slug=slug).first()
final = dict()
serializer = ArticleAuthorSerializer(article)
final.update(serializer.data)
final.update({'rating': article.rating})
final.update({'read_time': estimate_time(serializer.data.get('b... | Class for handling a single article. | SpecificArticleAPIView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecificArticleAPIView:
"""Class for handling a single article."""
def retrieve(self, request, slug):
"""Method for getting one article."""
<|body_0|>
def update(self, request, slug):
"""Method for editing an article."""
<|body_1|>
def delete(self, r... | stack_v2_sparse_classes_75kplus_train_000143 | 10,766 | permissive | [
{
"docstring": "Method for getting one article.",
"name": "retrieve",
"signature": "def retrieve(self, request, slug)"
},
{
"docstring": "Method for editing an article.",
"name": "update",
"signature": "def update(self, request, slug)"
},
{
"docstring": "Delete a specific item.",... | 3 | stack_v2_sparse_classes_30k_train_011199 | Implement the Python class `SpecificArticleAPIView` described below.
Class description:
Class for handling a single article.
Method signatures and docstrings:
- def retrieve(self, request, slug): Method for getting one article.
- def update(self, request, slug): Method for editing an article.
- def delete(self, reque... | Implement the Python class `SpecificArticleAPIView` described below.
Class description:
Class for handling a single article.
Method signatures and docstrings:
- def retrieve(self, request, slug): Method for getting one article.
- def update(self, request, slug): Method for editing an article.
- def delete(self, reque... | c199e6dd432bdb4a5e1152f90cb1716b09af2c4e | <|skeleton|>
class SpecificArticleAPIView:
"""Class for handling a single article."""
def retrieve(self, request, slug):
"""Method for getting one article."""
<|body_0|>
def update(self, request, slug):
"""Method for editing an article."""
<|body_1|>
def delete(self, r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpecificArticleAPIView:
"""Class for handling a single article."""
def retrieve(self, request, slug):
"""Method for getting one article."""
article = Article.objects.filter(article_slug=slug).first()
final = dict()
serializer = ArticleAuthorSerializer(article)
fina... | the_stack_v2_python_sparse | authors/apps/articles/views/articles.py | andela/ah-technocrats | train | 1 |
ec519a1c496314ad1b2b1b63e25995e2d26098a4 | [
"res = []\nif not self.checkWordBreak(s, wordDict):\n return res\nqueue = [(0, '')]\nslen = len(s)\nlenList = [l for l in set(map(len, wordDict))]\nwhile queue:\n tmpqueue = []\n for q in queue:\n start, path = q\n for l in lenList:\n if start + l <= slen and s[start:start + l] in ... | <|body_start_0|>
res = []
if not self.checkWordBreak(s, wordDict):
return res
queue = [(0, '')]
slen = len(s)
lenList = [l for l in set(map(len, wordDict))]
while queue:
tmpqueue = []
for q in queue:
start, path = q
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: Set[str] :rtype: List[str]"""
<|body_0|>
def checkWordBreak(self, s, wordDict):
""":type s: str :type wordDict: Set[str] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_75kplus_train_000144 | 3,451 | no_license | [
{
"docstring": ":type s: str :type wordDict: Set[str] :rtype: List[str]",
"name": "wordBreak",
"signature": "def wordBreak(self, s, wordDict)"
},
{
"docstring": ":type s: str :type wordDict: Set[str] :rtype: bool",
"name": "checkWordBreak",
"signature": "def checkWordBreak(self, s, wordD... | 2 | stack_v2_sparse_classes_30k_train_049423 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s, wordDict): :type s: str :type wordDict: Set[str] :rtype: List[str]
- def checkWordBreak(self, s, wordDict): :type s: str :type wordDict: Set[str] :rtype: b... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s, wordDict): :type s: str :type wordDict: Set[str] :rtype: List[str]
- def checkWordBreak(self, s, wordDict): :type s: str :type wordDict: Set[str] :rtype: b... | 2d2482efe1699a88894dc52ac610b5055f2485b7 | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: Set[str] :rtype: List[str]"""
<|body_0|>
def checkWordBreak(self, s, wordDict):
""":type s: str :type wordDict: Set[str] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: Set[str] :rtype: List[str]"""
res = []
if not self.checkWordBreak(s, wordDict):
return res
queue = [(0, '')]
slen = len(s)
lenList = [l for l in set(map(len, wordDict))]
... | the_stack_v2_python_sparse | lc-all-solutions-master/140.word-break-ii/word-break-ii.py | vishnoiprem/pvdata | train | 0 | |
ca85bad96c97c8755b5b30c4979d2fec5814a81a | [
"now = utcnow()\ncutoffs = {ActiveUserPeriods.twenty_four_hours: now - timedelta(hours=24), ActiveUserPeriods.seven_days: now - timedelta(days=7), ActiveUserPeriods.thirty_days: now - timedelta(days=30)}\nfor period, cutoff in cutoffs.items():\n value = self.db.query(orm.User).filter(orm.User.last_activity >= cu... | <|body_start_0|>
now = utcnow()
cutoffs = {ActiveUserPeriods.twenty_four_hours: now - timedelta(hours=24), ActiveUserPeriods.seven_days: now - timedelta(days=7), ActiveUserPeriods.thirty_days: now - timedelta(days=30)}
for period, cutoff in cutoffs.items():
value = self.db.query(orm.... | Collect metrics to be calculated periodically | PeriodicMetricsCollector | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PeriodicMetricsCollector:
"""Collect metrics to be calculated periodically"""
def update_active_users(self):
"""Update active users metrics."""
<|body_0|>
def start(self):
"""Start the periodic update process"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_000145 | 8,820 | permissive | [
{
"docstring": "Update active users metrics.",
"name": "update_active_users",
"signature": "def update_active_users(self)"
},
{
"docstring": "Start the periodic update process",
"name": "start",
"signature": "def start(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053722 | Implement the Python class `PeriodicMetricsCollector` described below.
Class description:
Collect metrics to be calculated periodically
Method signatures and docstrings:
- def update_active_users(self): Update active users metrics.
- def start(self): Start the periodic update process | Implement the Python class `PeriodicMetricsCollector` described below.
Class description:
Collect metrics to be calculated periodically
Method signatures and docstrings:
- def update_active_users(self): Update active users metrics.
- def start(self): Start the periodic update process
<|skeleton|>
class PeriodicMetri... | 7757dea8a463e75d8a540e85deee45c1635dd273 | <|skeleton|>
class PeriodicMetricsCollector:
"""Collect metrics to be calculated periodically"""
def update_active_users(self):
"""Update active users metrics."""
<|body_0|>
def start(self):
"""Start the periodic update process"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PeriodicMetricsCollector:
"""Collect metrics to be calculated periodically"""
def update_active_users(self):
"""Update active users metrics."""
now = utcnow()
cutoffs = {ActiveUserPeriods.twenty_four_hours: now - timedelta(hours=24), ActiveUserPeriods.seven_days: now - timedelta(d... | the_stack_v2_python_sparse | jupyterhub/metrics.py | jupyterhub/jupyterhub | train | 6,751 |
93c118d07aca89ade452a6f1dae898e4b8a4de75 | [
"if name is None:\n name = self.__class__.__name__\nsuper(sppasBaseSclite, self).__init__(name)\nself.software = 'SCTK'\nself._accept_multi_tiers = True\nself._accept_no_tiers = True\nself._accept_metadata = False\nself._accept_ctrl_vocab = False\nself._accept_media = True\nself._accept_hierarchy = False\nself._... | <|body_start_0|>
if name is None:
name = self.__class__.__name__
super(sppasBaseSclite, self).__init__(name)
self.software = 'SCTK'
self._accept_multi_tiers = True
self._accept_no_tiers = True
self._accept_metadata = False
self._accept_ctrl_vocab = Fal... | SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support alternations. * * * * * | sppasBaseSclite | [
"MIT",
"GFDL-1.1-or-later",
"GPL-3.0-only",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class sppasBaseSclite:
"""SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support al... | stack_v2_sparse_classes_75kplus_train_000146 | 28,430 | permissive | [
{
"docstring": "Initialize a new sppasBaseSclite instance. :param name: (str) This transcription name.",
"name": "__init__",
"signature": "def __init__(self, name=None)"
},
{
"docstring": "The localization is a time value, so always a float.",
"name": "make_point",
"signature": "def make... | 2 | stack_v2_sparse_classes_30k_val_002709 | Implement the Python class `sppasBaseSclite` described below.
Class description:
SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Cu... | Implement the Python class `sppasBaseSclite` described below.
Class description:
SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Cu... | 3167b65f576abcc27a8767d24c274a04712bd948 | <|skeleton|>
class sppasBaseSclite:
"""SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support al... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class sppasBaseSclite:
"""SPPAS base Sclite reader and writer. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi * * * * * Current version does not fully support alternations. *... | the_stack_v2_python_sparse | sppas/sppas/src/anndata/aio/sclite.py | mirfan899/MTTS | train | 0 |
304b60ccff99c14662851016ad56d41130a1b426 | [
"self._n_soldiers = n_soldiers\nself._n_commanders = n_commanders\nself._n_commander_comms = n_commander_comms\nself._n_family_mem_per_person = n_family_mem_per_person\nself._inblock_soldier_p = inblock_prob[0]\nself._inblock_commander_p = inblock_prob[1]\nself._inblock_family_p = inblock_prob[2]\nself._crossblock_... | <|body_start_0|>
self._n_soldiers = n_soldiers
self._n_commanders = n_commanders
self._n_commander_comms = n_commander_comms
self._n_family_mem_per_person = n_family_mem_per_person
self._inblock_soldier_p = inblock_prob[0]
self._inblock_commander_p = inblock_prob[1]
... | StaticMilitaryGraph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StaticMilitaryGraph:
def __init__(self, n_soldiers, n_commanders, n_commander_comms, n_family_mem_per_person, inblock_prob, crossblock_prob, commander_to_soldier_p, to_family_p):
"""Initialize the StaticMilitaryGraph Args: n_soldiers: number of soldiers n_commanders: number of commanders... | stack_v2_sparse_classes_75kplus_train_000147 | 3,411 | no_license | [
{
"docstring": "Initialize the StaticMilitaryGraph Args: n_soldiers: number of soldiers n_commanders: number of commanders n_commander_comms: number of commander communities n_family_mem_per_person: number of family members per person inblock_prob: list of inblock probability for soldiers, commanders and family... | 2 | stack_v2_sparse_classes_30k_train_006528 | Implement the Python class `StaticMilitaryGraph` described below.
Class description:
Implement the StaticMilitaryGraph class.
Method signatures and docstrings:
- def __init__(self, n_soldiers, n_commanders, n_commander_comms, n_family_mem_per_person, inblock_prob, crossblock_prob, commander_to_soldier_p, to_family_p)... | Implement the Python class `StaticMilitaryGraph` described below.
Class description:
Implement the StaticMilitaryGraph class.
Method signatures and docstrings:
- def __init__(self, n_soldiers, n_commanders, n_commander_comms, n_family_mem_per_person, inblock_prob, crossblock_prob, commander_to_soldier_p, to_family_p)... | d4e2f8626c312b11178cc4ad4763d24bc27425c7 | <|skeleton|>
class StaticMilitaryGraph:
def __init__(self, n_soldiers, n_commanders, n_commander_comms, n_family_mem_per_person, inblock_prob, crossblock_prob, commander_to_soldier_p, to_family_p):
"""Initialize the StaticMilitaryGraph Args: n_soldiers: number of soldiers n_commanders: number of commanders... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StaticMilitaryGraph:
def __init__(self, n_soldiers, n_commanders, n_commander_comms, n_family_mem_per_person, inblock_prob, crossblock_prob, commander_to_soldier_p, to_family_p):
"""Initialize the StaticMilitaryGraph Args: n_soldiers: number of soldiers n_commanders: number of commanders n_commander_c... | the_stack_v2_python_sparse | DynamicGEM/dynamicgem/graph_generation/static_military_call_graph_v1.py | YinlongQian/EECS576-Project | train | 2 | |
a30adf2c8ba8b7a61cd5a086d4c6b6a8a619f578 | [
"nums1 = set(nums1)\nnums2 = set(nums2)\nreturn list(nums1 & nums2)",
"result_num = []\nfor i in range(len(nums2)):\n for j in range(len(nums1)):\n if nums2[i] in result_num:\n continue\n if nums2[i] == nums1[j]:\n result_num.append(nums2[i])\nreturn result_num",
"result_i... | <|body_start_0|>
nums1 = set(nums1)
nums2 = set(nums2)
return list(nums1 & nums2)
<|end_body_0|>
<|body_start_1|>
result_num = []
for i in range(len(nums2)):
for j in range(len(nums1)):
if nums2[i] in result_num:
continue
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def intersection(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: List[int]"""
<|body_0|>
def intersection_work1(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: List[int]"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_000148 | 2,444 | no_license | [
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]",
"name": "intersection",
"signature": "def intersection(self, nums1, nums2)"
},
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]",
"name": "intersection_work1",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_043691 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def intersection(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int]
- def intersection_work1(self, nums1, nums2): :type nums1: List[int] :type n... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def intersection(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int]
- def intersection_work1(self, nums1, nums2): :type nums1: List[int] :type n... | 3f0ffd519404165fd1a735441b212c801fd1ad1e | <|skeleton|>
class Solution:
def intersection(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: List[int]"""
<|body_0|>
def intersection_work1(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: List[int]"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def intersection(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: List[int]"""
nums1 = set(nums1)
nums2 = set(nums2)
return list(nums1 & nums2)
def intersection_work1(self, nums1, nums2):
""":type nums1: List[int] :type nums2:... | the_stack_v2_python_sparse | Problems/0300_0399/0349_Intersection_of_Two_Arrays/Project_Python3/Intersection_of_Two_Arrays.py | NobuyukiInoue/LeetCode | train | 0 | |
3ee22194458206821785f50f4e2be33924dd2dde | [
"self.settings = settings\nself.database = database\nself.table_reader: TableReader = None\nTable.__init__(self, competition_folder, self.settings['groups_template'])",
"filename = filename or self.settings['groups_output']\ntry:\n self.table_reader = TableReader.from_settings(self, self.settings, 'groups')\n ... | <|body_start_0|>
self.settings = settings
self.database = database
self.table_reader: TableReader = None
Table.__init__(self, competition_folder, self.settings['groups_template'])
<|end_body_0|>
<|body_start_1|>
filename = filename or self.settings['groups_output']
try:
... | Tabelle der Riegenübersicht | GroupReportTable | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupReportTable:
"""Tabelle der Riegenübersicht"""
def __init__(self, competition_folder: str, settings: SettingsTable, database: Database):
"""Konstruktor Args: competition_folder (str): Ordner settings (SettingsTable): Einstellungen database (Database): Datenbank"""
<|body... | stack_v2_sparse_classes_75kplus_train_000149 | 2,404 | no_license | [
{
"docstring": "Konstruktor Args: competition_folder (str): Ordner settings (SettingsTable): Einstellungen database (Database): Datenbank",
"name": "__init__",
"signature": "def __init__(self, competition_folder: str, settings: SettingsTable, database: Database)"
},
{
"docstring": "Schreiben der... | 3 | null | Implement the Python class `GroupReportTable` described below.
Class description:
Tabelle der Riegenübersicht
Method signatures and docstrings:
- def __init__(self, competition_folder: str, settings: SettingsTable, database: Database): Konstruktor Args: competition_folder (str): Ordner settings (SettingsTable): Einst... | Implement the Python class `GroupReportTable` described below.
Class description:
Tabelle der Riegenübersicht
Method signatures and docstrings:
- def __init__(self, competition_folder: str, settings: SettingsTable, database: Database): Konstruktor Args: competition_folder (str): Ordner settings (SettingsTable): Einst... | 349aad3f5a71374f062a7a3b50d827dbf8e99bfe | <|skeleton|>
class GroupReportTable:
"""Tabelle der Riegenübersicht"""
def __init__(self, competition_folder: str, settings: SettingsTable, database: Database):
"""Konstruktor Args: competition_folder (str): Ordner settings (SettingsTable): Einstellungen database (Database): Datenbank"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupReportTable:
"""Tabelle der Riegenübersicht"""
def __init__(self, competition_folder: str, settings: SettingsTable, database: Database):
"""Konstruktor Args: competition_folder (str): Ordner settings (SettingsTable): Einstellungen database (Database): Datenbank"""
self.settings = set... | the_stack_v2_python_sparse | reports/group_report_table.py | RobFro96/Talentiadeverwaltung | train | 0 |
3e5f1255c2276781a1a4f553bef9fa53919a388e | [
"beta = parameters['beta'].value\ngamma = parameters['gamma'].value\nsigma = parameters['sigma'].value\neta = parameters['eta'].value\nT_quarantine = parameters['T'].value\nK = parameters['K'].value\nassert len(y) == 6 * K, f'Error: SEIRCM states not organized into {K} age groups!'\ndydt = [0] * len(y)\n\ndef epsil... | <|body_start_0|>
beta = parameters['beta'].value
gamma = parameters['gamma'].value
sigma = parameters['sigma'].value
eta = parameters['eta'].value
T_quarantine = parameters['T'].value
K = parameters['K'].value
assert len(y) == 6 * K, f'Error: SEIRCM states not org... | Age-structured SEIRCM Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf | SEIRCMAgeStratified | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SEIRCMAgeStratified:
"""Age-structured SEIRCM Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf"""
def calibrate(cls, y: list, t: float, parameters: Parameters) -> list:
"""SEIR model derivatives at t. :param y: variables that we are solving for i.e. [... | stack_v2_sparse_classes_75kplus_train_000150 | 29,649 | permissive | [
{
"docstring": "SEIR model derivatives at t. :param y: variables that we are solving for i.e. [S]usceptible, [E]xposed, [I]nfected, [R]emoved, [C]ases, [M]ortality :param t: time parameter :param parameters: parameters of the model (not including initial conditions) i.e. beta, gamma, sigma, eta, epsilon :return... | 2 | stack_v2_sparse_classes_30k_train_051404 | Implement the Python class `SEIRCMAgeStratified` described below.
Class description:
Age-structured SEIRCM Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf
Method signatures and docstrings:
- def calibrate(cls, y: list, t: float, parameters: Parameters) -> list: SEIR model derivatives... | Implement the Python class `SEIRCMAgeStratified` described below.
Class description:
Age-structured SEIRCM Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf
Method signatures and docstrings:
- def calibrate(cls, y: list, t: float, parameters: Parameters) -> list: SEIR model derivatives... | 4cf8ec75c4d85b16ec08371c46cc1a9ede9d72a2 | <|skeleton|>
class SEIRCMAgeStratified:
"""Age-structured SEIRCM Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf"""
def calibrate(cls, y: list, t: float, parameters: Parameters) -> list:
"""SEIR model derivatives at t. :param y: variables that we are solving for i.e. [... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SEIRCMAgeStratified:
"""Age-structured SEIRCM Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf"""
def calibrate(cls, y: list, t: float, parameters: Parameters) -> list:
"""SEIR model derivatives at t. :param y: variables that we are solving for i.e. [S]usceptible,... | the_stack_v2_python_sparse | gs_quant/models/epidemiology.py | goldmansachs/gs-quant | train | 2,088 |
cee2e8568aa7b67d2ce5726e2c87294f62a3d761 | [
"super().__init__(name=name, **kwargs)\nassert len(fixed_image_size) == 3\nself._fixed_image_size = fixed_image_size\nself._num_steps = num_steps\nself._warping = Warping(fixed_image_size=fixed_image_size)",
"ddf = inputs / 2 ** self._num_steps\nfor _ in range(self._num_steps):\n ddf += self._warping(inputs=[d... | <|body_start_0|>
super().__init__(name=name, **kwargs)
assert len(fixed_image_size) == 3
self._fixed_image_size = fixed_image_size
self._num_steps = num_steps
self._warping = Warping(fixed_image_size=fixed_image_size)
<|end_body_0|>
<|body_start_1|>
ddf = inputs / 2 ** s... | Integrate DVF to get DDF. Reference: - integrate_vec of neuron https://github.com/adalca/neurite/blob/legacy/neuron/utils.py | IntDVF | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntDVF:
"""Integrate DVF to get DDF. Reference: - integrate_vec of neuron https://github.com/adalca/neurite/blob/legacy/neuron/utils.py"""
def __init__(self, fixed_image_size: tuple, num_steps: int=7, name: str='int_dvf', **kwargs):
"""Init. :param fixed_image_size: tuple, (f_dim1, f... | stack_v2_sparse_classes_75kplus_train_000151 | 20,226 | permissive | [
{
"docstring": "Init. :param fixed_image_size: tuple, (f_dim1, f_dim2, f_dim3) :param num_steps: int, number of steps for integration :param name: name of the layer :param kwargs: additional arguments.",
"name": "__init__",
"signature": "def __init__(self, fixed_image_size: tuple, num_steps: int=7, name... | 3 | null | Implement the Python class `IntDVF` described below.
Class description:
Integrate DVF to get DDF. Reference: - integrate_vec of neuron https://github.com/adalca/neurite/blob/legacy/neuron/utils.py
Method signatures and docstrings:
- def __init__(self, fixed_image_size: tuple, num_steps: int=7, name: str='int_dvf', **... | Implement the Python class `IntDVF` described below.
Class description:
Integrate DVF to get DDF. Reference: - integrate_vec of neuron https://github.com/adalca/neurite/blob/legacy/neuron/utils.py
Method signatures and docstrings:
- def __init__(self, fixed_image_size: tuple, num_steps: int=7, name: str='int_dvf', **... | 650a2f1a88ad3c6932be305d6a98a36e26feedc6 | <|skeleton|>
class IntDVF:
"""Integrate DVF to get DDF. Reference: - integrate_vec of neuron https://github.com/adalca/neurite/blob/legacy/neuron/utils.py"""
def __init__(self, fixed_image_size: tuple, num_steps: int=7, name: str='int_dvf', **kwargs):
"""Init. :param fixed_image_size: tuple, (f_dim1, f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IntDVF:
"""Integrate DVF to get DDF. Reference: - integrate_vec of neuron https://github.com/adalca/neurite/blob/legacy/neuron/utils.py"""
def __init__(self, fixed_image_size: tuple, num_steps: int=7, name: str='int_dvf', **kwargs):
"""Init. :param fixed_image_size: tuple, (f_dim1, f_dim2, f_dim3... | the_stack_v2_python_sparse | deepreg/model/layer.py | DeepRegNet/DeepReg | train | 509 |
4c789d3aaf59833e3509a944bc93a2fd328711d8 | [
"Qs = self.broadening.broaden(atmos, eqPops)\nif vBroad is None:\n vBroad = self.atom.vBroad(atmos)\ncDop = self.lambda0_m / (4.0 * np.pi)\naDamp = (Qs.natural + Qs.Qelast) * cDop / vBroad\nreturn (aDamp, Qs.Qelast)",
"vBroad = self.atom.vBroad(state.atmos) if state.vBroad is None else state.vBroad\naDamp, Qel... | <|body_start_0|>
Qs = self.broadening.broaden(atmos, eqPops)
if vBroad is None:
vBroad = self.atom.vBroad(atmos)
cDop = self.lambda0_m / (4.0 * np.pi)
aDamp = (Qs.natural + Qs.Qelast) * cDop / vBroad
return (aDamp, Qs.Qelast)
<|end_body_0|>
<|body_start_1|>
v... | Specialised line profile for the default case of a Voigt profile. | VoigtLine | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VoigtLine:
"""Specialised line profile for the default case of a Voigt profile."""
def damping(self, atmos: 'Atmosphere', eqPops: 'SpeciesStateTable', vBroad: Optional[np.ndarray]=None):
"""Computes the damping parameter and elastic collision rate. Parameters ---------- atmos : Atmos... | stack_v2_sparse_classes_75kplus_train_000152 | 24,494 | permissive | [
{
"docstring": "Computes the damping parameter and elastic collision rate. Parameters ---------- atmos : Atmosphere The atmosphere to consider. eqPops : SpeciesStateTable The populations in this atmosphere. vBroad : np.ndarray, optional The broadening velocity, will be used if passed, or computed using atom.vBr... | 2 | stack_v2_sparse_classes_30k_train_033750 | Implement the Python class `VoigtLine` described below.
Class description:
Specialised line profile for the default case of a Voigt profile.
Method signatures and docstrings:
- def damping(self, atmos: 'Atmosphere', eqPops: 'SpeciesStateTable', vBroad: Optional[np.ndarray]=None): Computes the damping parameter and el... | Implement the Python class `VoigtLine` described below.
Class description:
Specialised line profile for the default case of a Voigt profile.
Method signatures and docstrings:
- def damping(self, atmos: 'Atmosphere', eqPops: 'SpeciesStateTable', vBroad: Optional[np.ndarray]=None): Computes the damping parameter and el... | 91ba3656446ae2962039a99064a5d519684f1572 | <|skeleton|>
class VoigtLine:
"""Specialised line profile for the default case of a Voigt profile."""
def damping(self, atmos: 'Atmosphere', eqPops: 'SpeciesStateTable', vBroad: Optional[np.ndarray]=None):
"""Computes the damping parameter and elastic collision rate. Parameters ---------- atmos : Atmos... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VoigtLine:
"""Specialised line profile for the default case of a Voigt profile."""
def damping(self, atmos: 'Atmosphere', eqPops: 'SpeciesStateTable', vBroad: Optional[np.ndarray]=None):
"""Computes the damping parameter and elastic collision rate. Parameters ---------- atmos : Atmosphere The atm... | the_stack_v2_python_sparse | lightweaver/atomic_model.py | Goobley/Lightweaver | train | 19 |
e60abb33bc779105c62ab212eaa255cd189b0d9f | [
"request_json = request.json\ntry:\n operation = operation_schema.load(request_json)\nexcept ValidationError as val_er:\n return (jsonify(val_er.messages), 400)\nservices = OperationServices(db.connection, user_id=user_id)\ntry:\n operation_return = services.create_operation(operation)\nexcept EntityDoesNo... | <|body_start_0|>
request_json = request.json
try:
operation = operation_schema.load(request_json)
except ValidationError as val_er:
return (jsonify(val_er.messages), 400)
services = OperationServices(db.connection, user_id=user_id)
try:
operati... | class for add, delete, update, get operation | OperationView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OperationView:
"""class for add, delete, update, get operation"""
def post(self, user_id):
"""add operation :param user_id: id user in session :return: transaction data in the format json"""
<|body_0|>
def patch(self, operation_id, user_id):
"""update operation :... | stack_v2_sparse_classes_75kplus_train_000153 | 3,837 | no_license | [
{
"docstring": "add operation :param user_id: id user in session :return: transaction data in the format json",
"name": "post",
"signature": "def post(self, user_id)"
},
{
"docstring": "update operation :param operation_id: id transfer operation :param user_id: id user in session :return: transa... | 4 | stack_v2_sparse_classes_30k_train_031799 | Implement the Python class `OperationView` described below.
Class description:
class for add, delete, update, get operation
Method signatures and docstrings:
- def post(self, user_id): add operation :param user_id: id user in session :return: transaction data in the format json
- def patch(self, operation_id, user_id... | Implement the Python class `OperationView` described below.
Class description:
class for add, delete, update, get operation
Method signatures and docstrings:
- def post(self, user_id): add operation :param user_id: id user in session :return: transaction data in the format json
- def patch(self, operation_id, user_id... | d29c9c7c7ce9b33b495086e806d40ab6e2f59aab | <|skeleton|>
class OperationView:
"""class for add, delete, update, get operation"""
def post(self, user_id):
"""add operation :param user_id: id user in session :return: transaction data in the format json"""
<|body_0|>
def patch(self, operation_id, user_id):
"""update operation :... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OperationView:
"""class for add, delete, update, get operation"""
def post(self, user_id):
"""add operation :param user_id: id user in session :return: transaction data in the format json"""
request_json = request.json
try:
operation = operation_schema.load(request_jso... | the_stack_v2_python_sparse | src/blueprint/operation.py | Split174/financial-accounting | train | 0 |
442d47f6534be61d6159a4833395dccce010f7c1 | [
"KratosMultiphysics.Process.__init__(self)\ndefault_settings = KratosMultiphysics.Parameters('\\n {\\n \"help\" : \"This process allows to do a simple mapping using the SimpleMortarMapperProcess\",\\n \"origin_model_part_name\" : \"please_specify_mo... | <|body_start_0|>
KratosMultiphysics.Process.__init__(self)
default_settings = KratosMultiphysics.Parameters('\n {\n "help" : "This process allows to do a simple mapping using the SimpleMortarMapperProcess",\n "origin_model_part_name" : "... | This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings. | BasicMappingProcess | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicMappingProcess:
"""This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver ... | stack_v2_sparse_classes_75kplus_train_000154 | 4,664 | permissive | [
{
"docstring": "The default constructor of the class Keyword arguments: self -- It signifies an instance of a class. Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.",
"name": "__init__",
"signature": "def __init__(self, Model, settings)"
}... | 2 | stack_v2_sparse_classes_30k_train_051997 | Implement the Python class `BasicMappingProcess` described below.
Class description:
This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings ... | Implement the Python class `BasicMappingProcess` described below.
Class description:
This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings ... | 366949ec4e3651702edc6ac3061d2988f10dd271 | <|skeleton|>
class BasicMappingProcess:
"""This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicMappingProcess:
"""This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings."""
... | the_stack_v2_python_sparse | applications/ContactStructuralMechanicsApplication/python_scripts/basic_mapping_process.py | KratosMultiphysics/Kratos | train | 994 |
5dc4e213daef57cb10919bb09b98075aeb004d7a | [
"dummy = ListNode(float('-inf'))\nfor i in lists:\n dummy = self.merge_two(dummy, i)\nreturn dummy.next",
"curr = dummy = ListNode('X')\nwhile l1 and l2:\n if l1.val < l2.val:\n curr.next, l1 = (l1, l1.next)\n else:\n curr.next, l2 = (l2, l2.next)\n curr = curr.next\ncurr.next = l1 or l2... | <|body_start_0|>
dummy = ListNode(float('-inf'))
for i in lists:
dummy = self.merge_two(dummy, i)
return dummy.next
<|end_body_0|>
<|body_start_1|>
curr = dummy = ListNode('X')
while l1 and l2:
if l1.val < l2.val:
curr.next, l1 = (l1, l1.n... | SolutionC1 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
<|body_0|>
def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Helper for Solution C1 and C2 (now set o... | stack_v2_sparse_classes_75kplus_train_000155 | 4,145 | permissive | [
{
"docstring": "use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists: List[ListNode]) -> ListNode"
},
{
"docstring": "Helper for Solution C1 and C2 (now set out side of the Solution) merge two sorted linked... | 2 | stack_v2_sparse_classes_30k_train_045980 | Implement the Python class `SolutionC1` described below.
Class description:
Implement the SolutionC1 class.
Method signatures and docstrings:
- def mergeKLists(self, lists: List[ListNode]) -> ListNode: use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了
- def merge_two(self, l1: ListNode, l2: ... | Implement the Python class `SolutionC1` described below.
Class description:
Implement the SolutionC1 class.
Method signatures and docstrings:
- def mergeKLists(self, lists: List[ListNode]) -> ListNode: use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了
- def merge_two(self, l1: ListNode, l2: ... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
<|body_0|>
def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Helper for Solution C1 and C2 (now set o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
dummy = ListNode(float('-inf'))
for i in lists:
dummy = self.merge_two(dummy, i)
return dummy.next
def merge_... | the_stack_v2_python_sparse | LeetCode/LC023_merge_k_sorted_list.py | jxie0755/Learning_Python | train | 0 | |
9be32d014cbbaa6e65c658bd834a61a64eb9da43 | [
"client = action.client\nexec_results = []\nfor run_cmd in run_cmds:\n cmd = run_cmd.cmd\n cmd_user = run_cmd.user\n log.debug('Creating exec command in container %s with user %s: %s.', c_name, cmd_user, cmd)\n ec_kwargs = self.get_exec_create_kwargs(action, c_name, cmd, cmd_user)\n create_result = c... | <|body_start_0|>
client = action.client
exec_results = []
for run_cmd in run_cmds:
cmd = run_cmd.cmd
cmd_user = run_cmd.user
log.debug('Creating exec command in container %s with user %s: %s.', c_name, cmd_user, cmd)
ec_kwargs = self.get_exec_creat... | Utility mixin for executing configured commands inside containers. | ExecMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExecMixin:
"""Utility mixin for executing configured commands inside containers."""
def exec_commands(self, action, c_name, run_cmds, **kwargs):
"""Runs a single command inside a container. :param action: Action configuration. :type action: dockermap.map.runner.ActionConfig :param c_... | stack_v2_sparse_classes_75kplus_train_000156 | 2,879 | permissive | [
{
"docstring": "Runs a single command inside a container. :param action: Action configuration. :type action: dockermap.map.runner.ActionConfig :param c_name: Container name. :type c_name: unicode | str :param run_cmds: Commands to run. :type run_cmds: list[dockermap.map.input.ExecCommand] :return: List of exec ... | 2 | stack_v2_sparse_classes_30k_train_022081 | Implement the Python class `ExecMixin` described below.
Class description:
Utility mixin for executing configured commands inside containers.
Method signatures and docstrings:
- def exec_commands(self, action, c_name, run_cmds, **kwargs): Runs a single command inside a container. :param action: Action configuration. ... | Implement the Python class `ExecMixin` described below.
Class description:
Utility mixin for executing configured commands inside containers.
Method signatures and docstrings:
- def exec_commands(self, action, c_name, run_cmds, **kwargs): Runs a single command inside a container. :param action: Action configuration. ... | 54e325595fc0b6b9d154dacc790a222f957895da | <|skeleton|>
class ExecMixin:
"""Utility mixin for executing configured commands inside containers."""
def exec_commands(self, action, c_name, run_cmds, **kwargs):
"""Runs a single command inside a container. :param action: Action configuration. :type action: dockermap.map.runner.ActionConfig :param c_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExecMixin:
"""Utility mixin for executing configured commands inside containers."""
def exec_commands(self, action, c_name, run_cmds, **kwargs):
"""Runs a single command inside a container. :param action: Action configuration. :type action: dockermap.map.runner.ActionConfig :param c_name: Contain... | the_stack_v2_python_sparse | dockermap/map/runner/cmd.py | merll/docker-map | train | 85 |
6a429770fd82f913e50cd76a6e46f868f1e18969 | [
"super().__init__(main_collector, connection)\nself._connection = connection\nself._record = MemCpuRecord(connection.hostname, self)",
"try:\n cpu_data = self._collect_cpu()\n mem_data = self._collect_mem()\n process_data = self._collect_process_mem()\n timestamp = datetime.utcnow().isoformat()\n s... | <|body_start_0|>
super().__init__(main_collector, connection)
self._connection = connection
self._record = MemCpuRecord(connection.hostname, self)
<|end_body_0|>
<|body_start_1|>
try:
cpu_data = self._collect_cpu()
mem_data = self._collect_mem()
proce... | Holds the needed functionality and information for each node. Extends INodeCollector. | MemCpuNodeCollector | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MemCpuNodeCollector:
"""Holds the needed functionality and information for each node. Extends INodeCollector."""
def __init__(self, main_collector, connection):
"""Initialize node collector."""
<|body_0|>
def _try_collect(self):
"""Call data collection and ingest... | stack_v2_sparse_classes_75kplus_train_000157 | 2,764 | permissive | [
{
"docstring": "Initialize node collector.",
"name": "__init__",
"signature": "def __init__(self, main_collector, connection)"
},
{
"docstring": "Call data collection and ingestion methods.",
"name": "_try_collect",
"signature": "def _try_collect(self)"
},
{
"docstring": "Collect... | 5 | stack_v2_sparse_classes_30k_train_047120 | Implement the Python class `MemCpuNodeCollector` described below.
Class description:
Holds the needed functionality and information for each node. Extends INodeCollector.
Method signatures and docstrings:
- def __init__(self, main_collector, connection): Initialize node collector.
- def _try_collect(self): Call data ... | Implement the Python class `MemCpuNodeCollector` described below.
Class description:
Holds the needed functionality and information for each node. Extends INodeCollector.
Method signatures and docstrings:
- def __init__(self, main_collector, connection): Initialize node collector.
- def _try_collect(self): Call data ... | adc47d0eb4985a16b82a96a2033eded779c0f3b7 | <|skeleton|>
class MemCpuNodeCollector:
"""Holds the needed functionality and information for each node. Extends INodeCollector."""
def __init__(self, main_collector, connection):
"""Initialize node collector."""
<|body_0|>
def _try_collect(self):
"""Call data collection and ingest... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MemCpuNodeCollector:
"""Holds the needed functionality and information for each node. Extends INodeCollector."""
def __init__(self, main_collector, connection):
"""Initialize node collector."""
super().__init__(main_collector, connection)
self._connection = connection
self... | the_stack_v2_python_sparse | datacollector/collector/memcpunodecollector.py | nokia/5GDrones-data-collector | train | 2 |
79620dbb7cc09d39adaf7616c97357feaee746d6 | [
"create_container_rsa_data['private_key_passphrase'] = None\ncontainer = self.barbicanclient.containers.create_rsa(**create_container_rsa_data)\ncontainer_ref = self.cleanup.add_entity(container)\nself.assertIsNotNone(container_ref)\ncontainer_resp = self.barbicanclient.containers.get(container_ref)\nself.assertIsN... | <|body_start_0|>
create_container_rsa_data['private_key_passphrase'] = None
container = self.barbicanclient.containers.create_rsa(**create_container_rsa_data)
container_ref = self.cleanup.add_entity(container)
self.assertIsNotNone(container_ref)
container_resp = self.barbicanclie... | RSAContainersTestCase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RSAContainersTestCase:
def test_create_containers_rsa_no_passphrase(self):
"""Covers creating an rsa container without a passphrase."""
<|body_0|>
def test_create_container_rsa_name(self, name):
"""Covers creating rsa containers with various names."""
<|body_... | stack_v2_sparse_classes_75kplus_train_000158 | 13,936 | permissive | [
{
"docstring": "Covers creating an rsa container without a passphrase.",
"name": "test_create_containers_rsa_no_passphrase",
"signature": "def test_create_containers_rsa_no_passphrase(self)"
},
{
"docstring": "Covers creating rsa containers with various names.",
"name": "test_create_containe... | 5 | stack_v2_sparse_classes_30k_train_023036 | Implement the Python class `RSAContainersTestCase` described below.
Class description:
Implement the RSAContainersTestCase class.
Method signatures and docstrings:
- def test_create_containers_rsa_no_passphrase(self): Covers creating an rsa container without a passphrase.
- def test_create_container_rsa_name(self, na... | Implement the Python class `RSAContainersTestCase` described below.
Class description:
Implement the RSAContainersTestCase class.
Method signatures and docstrings:
- def test_create_containers_rsa_no_passphrase(self): Covers creating an rsa container without a passphrase.
- def test_create_container_rsa_name(self, na... | 7d9c28ab17fec88a93be202bd74f3715195c29e4 | <|skeleton|>
class RSAContainersTestCase:
def test_create_containers_rsa_no_passphrase(self):
"""Covers creating an rsa container without a passphrase."""
<|body_0|>
def test_create_container_rsa_name(self, name):
"""Covers creating rsa containers with various names."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RSAContainersTestCase:
def test_create_containers_rsa_no_passphrase(self):
"""Covers creating an rsa container without a passphrase."""
create_container_rsa_data['private_key_passphrase'] = None
container = self.barbicanclient.containers.create_rsa(**create_container_rsa_data)
... | the_stack_v2_python_sparse | functionaltests/client/v1/functional/test_containers.py | openstack/python-barbicanclient | train | 37 | |
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_75kplus_train_000159 | 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_026087 | 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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | 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 |
b0f7473b5387043ecb040ede04506630850022a2 | [
"super(PPO_ActorNetwork, self).__init__()\nxp_input = L.Placeholder((None, D_obs))\nxp = L.Linear(hidden_sizes[0])(xp_input)\nxp = L.ReLU()(xp)\nxp = L.Linear(hidden_sizes[1])(xp)\nxp = L.ReLU()(xp)\nxp = L.Linear(D_act)(xp)\nxp = L.Tanh()(xp)\nself.model = L.Functional(inputs=xp_input, outputs=xp)\nself.model.buil... | <|body_start_0|>
super(PPO_ActorNetwork, self).__init__()
xp_input = L.Placeholder((None, D_obs))
xp = L.Linear(hidden_sizes[0])(xp_input)
xp = L.ReLU()(xp)
xp = L.Linear(hidden_sizes[1])(xp)
xp = L.ReLU()(xp)
xp = L.Linear(D_act)(xp)
xp = L.Tanh()(xp)
... | PPO custom actor network structure | PPO_ActorNetwork | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PPO_ActorNetwork:
"""PPO custom actor network structure"""
def __init__(self, D_obs, D_act, hidden_sizes=[64, 64], init_log_sig=0):
"""Constructor for PPO actor network Args: D_obs: observation space dimension, scalar D_act: action space dimension, scalar hidden_sizes: list of fully ... | stack_v2_sparse_classes_75kplus_train_000160 | 5,859 | permissive | [
{
"docstring": "Constructor for PPO actor network Args: D_obs: observation space dimension, scalar D_act: action space dimension, scalar hidden_sizes: list of fully connected dimension init_log_sig: initial value for log standard deviation parameter",
"name": "__init__",
"signature": "def __init__(self,... | 2 | stack_v2_sparse_classes_30k_train_004064 | Implement the Python class `PPO_ActorNetwork` described below.
Class description:
PPO custom actor network structure
Method signatures and docstrings:
- def __init__(self, D_obs, D_act, hidden_sizes=[64, 64], init_log_sig=0): Constructor for PPO actor network Args: D_obs: observation space dimension, scalar D_act: ac... | Implement the Python class `PPO_ActorNetwork` described below.
Class description:
PPO custom actor network structure
Method signatures and docstrings:
- def __init__(self, D_obs, D_act, hidden_sizes=[64, 64], init_log_sig=0): Constructor for PPO actor network Args: D_obs: observation space dimension, scalar D_act: ac... | 2556bd9c362a53e0a94da914ba59b5d4621c4081 | <|skeleton|>
class PPO_ActorNetwork:
"""PPO custom actor network structure"""
def __init__(self, D_obs, D_act, hidden_sizes=[64, 64], init_log_sig=0):
"""Constructor for PPO actor network Args: D_obs: observation space dimension, scalar D_act: action space dimension, scalar hidden_sizes: list of fully ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PPO_ActorNetwork:
"""PPO custom actor network structure"""
def __init__(self, D_obs, D_act, hidden_sizes=[64, 64], init_log_sig=0):
"""Constructor for PPO actor network Args: D_obs: observation space dimension, scalar D_act: action space dimension, scalar hidden_sizes: list of fully connected dim... | the_stack_v2_python_sparse | surreal/model/model_builders/builders.py | PeihongYu/surreal | train | 0 |
3a8814bcf94b4eff79670a6ccdaeeb907563b375 | [
"for proj in GC_PROJECTDOWNLOADS:\n self.feed = feedparser.parse(GC_PROJECTDOWNLOADS_URL % proj)\n for entry in self.feed.entries:\n d = entry.updated_parsed\n sc = GoogleCodeProjectDownload(date_updated=datetime(d[0], d[1], d[2], d[3], d[4], d[5], d[6]), subtitle=entry.subtitle, link=entry.link... | <|body_start_0|>
for proj in GC_PROJECTDOWNLOADS:
self.feed = feedparser.parse(GC_PROJECTDOWNLOADS_URL % proj)
for entry in self.feed.entries:
d = entry.updated_parsed
sc = GoogleCodeProjectDownload(date_updated=datetime(d[0], d[1], d[2], d[3], d[4], d[5],... | GoogleCodeSyncr objects sync Google Code feeds with the Django backend. As now only Downloads list and SVN commits log can be sync | GoogleCodeSyncr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleCodeSyncr:
"""GoogleCodeSyncr objects sync Google Code feeds with the Django backend. As now only Downloads list and SVN commits log can be sync"""
def syncProjectDownloads(self):
"""Synchronize Downloads list from a Google Code project with the Django backend"""
<|body... | stack_v2_sparse_classes_75kplus_train_000161 | 3,460 | no_license | [
{
"docstring": "Synchronize Downloads list from a Google Code project with the Django backend",
"name": "syncProjectDownloads",
"signature": "def syncProjectDownloads(self)"
},
{
"docstring": "Synchronize SVN commits from a Google Code project with the Django backend",
"name": "syncSvnChange... | 2 | stack_v2_sparse_classes_30k_train_013360 | Implement the Python class `GoogleCodeSyncr` described below.
Class description:
GoogleCodeSyncr objects sync Google Code feeds with the Django backend. As now only Downloads list and SVN commits log can be sync
Method signatures and docstrings:
- def syncProjectDownloads(self): Synchronize Downloads list from a Goog... | Implement the Python class `GoogleCodeSyncr` described below.
Class description:
GoogleCodeSyncr objects sync Google Code feeds with the Django backend. As now only Downloads list and SVN commits log can be sync
Method signatures and docstrings:
- def syncProjectDownloads(self): Synchronize Downloads list from a Goog... | 8d3c815d69c544daf2045d8d903b62c92ecacab3 | <|skeleton|>
class GoogleCodeSyncr:
"""GoogleCodeSyncr objects sync Google Code feeds with the Django backend. As now only Downloads list and SVN commits log can be sync"""
def syncProjectDownloads(self):
"""Synchronize Downloads list from a Google Code project with the Django backend"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GoogleCodeSyncr:
"""GoogleCodeSyncr objects sync Google Code feeds with the Django backend. As now only Downloads list and SVN commits log can be sync"""
def syncProjectDownloads(self):
"""Synchronize Downloads list from a Google Code project with the Django backend"""
for proj in GC_PROJ... | the_stack_v2_python_sparse | syncr/app/.svn/text-base/googlecode.py.svn-base | samuelclay/samuelclay | train | 4 |
4fdc7dc2e6da9b9c716d8db4246677efdfd1226e | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CloudCommunications()",
"from .call import Call\nfrom .call_records.call_record import CallRecord\nfrom .online_meeting import OnlineMeeting\nfrom .presence import Presence\nfrom .call import Call\nfrom .call_records.call_record import... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return CloudCommunications()
<|end_body_0|>
<|body_start_1|>
from .call import Call
from .call_records.call_record import CallRecord
from .online_meeting import OnlineMeeting
fr... | CloudCommunications | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CloudCommunications:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CloudCommunications:
"""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 ob... | stack_v2_sparse_classes_75kplus_train_000162 | 3,871 | 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: CloudCommunications",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator... | 3 | null | Implement the Python class `CloudCommunications` described below.
Class description:
Implement the CloudCommunications class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CloudCommunications: Creates a new instance of the appropriate class based on d... | Implement the Python class `CloudCommunications` described below.
Class description:
Implement the CloudCommunications class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CloudCommunications: Creates a new instance of the appropriate class based on d... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class CloudCommunications:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CloudCommunications:
"""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 ob... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CloudCommunications:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CloudCommunications:
"""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: ... | the_stack_v2_python_sparse | msgraph/generated/models/cloud_communications.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
366f3f0d1f986e2295e98e43040a59f550e8ce43 | [
"path = urls.TRAIL_LOG['GET_ALL']\nparams = {'limit': limit, 'offset': offset}\nif username:\n params['username'] = username\nif start_time:\n params['start_time'] = start_time\nif end_time:\n params['end_time'] = end_time\nif description:\n params['description'] = description\nif target:\n params['t... | <|body_start_0|>
path = urls.TRAIL_LOG['GET_ALL']
params = {'limit': limit, 'offset': offset}
if username:
params['username'] = username
if start_time:
params['start_time'] = start_time
if end_time:
params['end_time'] = end_time
if desc... | Get the audit logs and event logs with the functions in this class. | Audit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Audit:
"""Get the audit logs and event logs with the functions in this class."""
def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None):
""... | stack_v2_sparse_classes_75kplus_train_000163 | 7,915 | permissive | [
{
"docstring": "Get audit logs, sort by time in in reverse chronological order. This API returns the first 10,000 results only. Please use filter in the API for more relevant results. MSP Customer Would see logs of MSP's and tenants as well. :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an... | 4 | stack_v2_sparse_classes_30k_train_036582 | Implement the Python class `Audit` described below.
Class description:
Get the audit logs and event logs with the functions in this class.
Method signatures and docstrings:
- def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification... | Implement the Python class `Audit` described below.
Class description:
Get the audit logs and event logs with the functions in this class.
Method signatures and docstrings:
- def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification... | d938396a18193473afbe54e6cc6697d2bd4954a7 | <|skeleton|>
class Audit:
"""Get the audit logs and event logs with the functions in this class."""
def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Audit:
"""Get the audit logs and event logs with the functions in this class."""
def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None):
"""Get audit lo... | the_stack_v2_python_sparse | pycentral/audit_logs.py | jayp193/pycentral | train | 0 |
4598309b2e0bb69c66234cd1ce91c49417fc285b | [
"self.entity = entity\nself.job_id = job_id\nself.job_uid = job_uid",
"if dictionary is None:\n return None\nentity = cohesity_management_sdk.models.entity_proto.EntityProto.from_dictionary(dictionary.get('entity')) if dictionary.get('entity') else None\njob_id = dictionary.get('jobId')\njob_uid = cohesity_man... | <|body_start_0|>
self.entity = entity
self.job_id = job_id
self.job_uid = job_uid
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
entity = cohesity_management_sdk.models.entity_proto.EntityProto.from_dictionary(dictionary.get('entity')) if dictiona... | Implementation of the 'MagnetoObjectId' model. TODO: type description here. Attributes: entity (EntityProto): Entity proto that represents the object being snapshotted. job_id (long|int): The id of the local job that the object belongs to, which may or may not match the object_id field in job_uid below depending on whe... | MagnetoObjectId | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MagnetoObjectId:
"""Implementation of the 'MagnetoObjectId' model. TODO: type description here. Attributes: entity (EntityProto): Entity proto that represents the object being snapshotted. job_id (long|int): The id of the local job that the object belongs to, which may or may not match the object... | stack_v2_sparse_classes_75kplus_train_000164 | 2,558 | permissive | [
{
"docstring": "Constructor for the MagnetoObjectId class",
"name": "__init__",
"signature": "def __init__(self, entity=None, job_id=None, job_uid=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the objec... | 2 | stack_v2_sparse_classes_30k_train_036327 | Implement the Python class `MagnetoObjectId` described below.
Class description:
Implementation of the 'MagnetoObjectId' model. TODO: type description here. Attributes: entity (EntityProto): Entity proto that represents the object being snapshotted. job_id (long|int): The id of the local job that the object belongs to... | Implement the Python class `MagnetoObjectId` described below.
Class description:
Implementation of the 'MagnetoObjectId' model. TODO: type description here. Attributes: entity (EntityProto): Entity proto that represents the object being snapshotted. job_id (long|int): The id of the local job that the object belongs to... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class MagnetoObjectId:
"""Implementation of the 'MagnetoObjectId' model. TODO: type description here. Attributes: entity (EntityProto): Entity proto that represents the object being snapshotted. job_id (long|int): The id of the local job that the object belongs to, which may or may not match the object... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MagnetoObjectId:
"""Implementation of the 'MagnetoObjectId' model. TODO: type description here. Attributes: entity (EntityProto): Entity proto that represents the object being snapshotted. job_id (long|int): The id of the local job that the object belongs to, which may or may not match the object_id field in ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/magneto_object_id.py | cohesity/management-sdk-python | train | 24 |
78bb4a44deb0635e3ec849aacf44cc585d67483c | [
"part_train_eval_fn, part_val_fn, unpart_fn, test_fn = trainer_utils.create_federated_eval_fns(tff_model_builder=tff_model_builder, metrics_builder=metrics_builder, part_train_eval_cd=create_federated_cd(), part_val_cd=create_federated_cd(), unpart_cd=create_federated_cd(), test_cd=create_federated_cd() if use_test... | <|body_start_0|>
part_train_eval_fn, part_val_fn, unpart_fn, test_fn = trainer_utils.create_federated_eval_fns(tff_model_builder=tff_model_builder, metrics_builder=metrics_builder, part_train_eval_cd=create_federated_cd(), part_val_cd=create_federated_cd(), unpart_cd=create_federated_cd(), test_cd=create_federa... | CreateEvalFnsTest | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateEvalFnsTest:
def test_create_federated_eval_fns(self, use_test_cd):
"""Test for create_federated_eval_fns."""
<|body_0|>
def test_create_federated_eval_fns_skips_rounds(self, rounds_per_eval, round_num):
"""Test that create_federated_eval_fns skips the appropri... | stack_v2_sparse_classes_75kplus_train_000165 | 6,847 | permissive | [
{
"docstring": "Test for create_federated_eval_fns.",
"name": "test_create_federated_eval_fns",
"signature": "def test_create_federated_eval_fns(self, use_test_cd)"
},
{
"docstring": "Test that create_federated_eval_fns skips the appropriate rounds.",
"name": "test_create_federated_eval_fns_... | 3 | stack_v2_sparse_classes_30k_train_026897 | Implement the Python class `CreateEvalFnsTest` described below.
Class description:
Implement the CreateEvalFnsTest class.
Method signatures and docstrings:
- def test_create_federated_eval_fns(self, use_test_cd): Test for create_federated_eval_fns.
- def test_create_federated_eval_fns_skips_rounds(self, rounds_per_ev... | Implement the Python class `CreateEvalFnsTest` described below.
Class description:
Implement the CreateEvalFnsTest class.
Method signatures and docstrings:
- def test_create_federated_eval_fns(self, use_test_cd): Test for create_federated_eval_fns.
- def test_create_federated_eval_fns_skips_rounds(self, rounds_per_ev... | 329e60fa56b87f691303638ceb9dfa1fc5083953 | <|skeleton|>
class CreateEvalFnsTest:
def test_create_federated_eval_fns(self, use_test_cd):
"""Test for create_federated_eval_fns."""
<|body_0|>
def test_create_federated_eval_fns_skips_rounds(self, rounds_per_eval, round_num):
"""Test that create_federated_eval_fns skips the appropri... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateEvalFnsTest:
def test_create_federated_eval_fns(self, use_test_cd):
"""Test for create_federated_eval_fns."""
part_train_eval_fn, part_val_fn, unpart_fn, test_fn = trainer_utils.create_federated_eval_fns(tff_model_builder=tff_model_builder, metrics_builder=metrics_builder, part_train_eva... | the_stack_v2_python_sparse | generalization/utils/trainer_utils_test.py | google-research/federated | train | 595 | |
2e9f8274d9900e8da900bec930d75504154ae560 | [
"lookup = {}\nfor i, num in enumerate(nums):\n if target - num in lookup:\n return [lookup[target - num], i]\n break\n lookup[num] = i\nreturn []",
"k = 0\nfor i in nums:\n k += 1\n if target - i in nums[k:]:\n return (k - 1, nums[k:].index(target - i) + k)"
] | <|body_start_0|>
lookup = {}
for i, num in enumerate(nums):
if target - num in lookup:
return [lookup[target - num], i]
break
lookup[num] = i
return []
<|end_body_0|>
<|body_start_1|>
k = 0
for i in nums:
k += 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_000166 | 773 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum2",
"signature": "def twoSum2(self, nums, target)"
}... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | 030f2d48d20341a16f6ca57715ff1f06a59a20ec | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
lookup = {}
for i, num in enumerate(nums):
if target - num in lookup:
return [lookup[target - num], i]
break
lookup[num] = i... | the_stack_v2_python_sparse | Code/Two Sum.py | zolars/LeetCode-Solution | train | 0 | |
31b154925f9a604c62bb35e5799899b58b3f24d8 | [
"self.shared_state_key = kwargs.pop('shared_state_key', None)\nif self.shared_state_key is None:\n raise ValueError('No shared_state_key provided!')\nsuper().__init__(**kwargs)",
"data = self.context.shared_state.get(self.shared_state_key, b'{}')\nformatted_data = self._format_data(data)\nreturn formatted_data... | <|body_start_0|>
self.shared_state_key = kwargs.pop('shared_state_key', None)
if self.shared_state_key is None:
raise ValueError('No shared_state_key provided!')
super().__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
data = self.context.shared_state.get(self.shared_state... | This class defines a strategy for the agent. | Strategy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Strategy:
"""This class defines a strategy for the agent."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize the strategy of the agent. :param kwargs: keyword arguments"""
<|body_0|>
def collect_from_data_source(self) -> Dict[str, str]:
"""Build the data... | stack_v2_sparse_classes_75kplus_train_000167 | 2,518 | permissive | [
{
"docstring": "Initialize the strategy of the agent. :param kwargs: keyword arguments",
"name": "__init__",
"signature": "def __init__(self, **kwargs: Any) -> None"
},
{
"docstring": "Build the data payload. :return: a dict of the data found in the shared state.",
"name": "collect_from_data... | 3 | stack_v2_sparse_classes_30k_train_015260 | Implement the Python class `Strategy` described below.
Class description:
This class defines a strategy for the agent.
Method signatures and docstrings:
- def __init__(self, **kwargs: Any) -> None: Initialize the strategy of the agent. :param kwargs: keyword arguments
- def collect_from_data_source(self) -> Dict[str,... | Implement the Python class `Strategy` described below.
Class description:
This class defines a strategy for the agent.
Method signatures and docstrings:
- def __init__(self, **kwargs: Any) -> None: Initialize the strategy of the agent. :param kwargs: keyword arguments
- def collect_from_data_source(self) -> Dict[str,... | bec49adaeba661d8d0f03ac9935dc89f39d95a0d | <|skeleton|>
class Strategy:
"""This class defines a strategy for the agent."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize the strategy of the agent. :param kwargs: keyword arguments"""
<|body_0|>
def collect_from_data_source(self) -> Dict[str, str]:
"""Build the data... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Strategy:
"""This class defines a strategy for the agent."""
def __init__(self, **kwargs: Any) -> None:
"""Initialize the strategy of the agent. :param kwargs: keyword arguments"""
self.shared_state_key = kwargs.pop('shared_state_key', None)
if self.shared_state_key is None:
... | the_stack_v2_python_sparse | packages/fetchai/skills/simple_seller/strategy.py | fetchai/agents-aea | train | 192 |
095f269281f9dbf28dedb2e1bf49b6ec9df257e9 | [
"self.url_list = url_list\nself.satellite_url_list = satellite_url_list\nself.swath = swath\nself.username = username\nself.password = password\nself.polarization = polarization\nself.local_paths = local_paths\nsuper(DataFetcher, self).__init__(verbose=verbose)",
"num_images = len(self.url_list)\nif num_images !=... | <|body_start_0|>
self.url_list = url_list
self.satellite_url_list = satellite_url_list
self.swath = swath
self.username = username
self.password = password
self.polarization = polarization
self.local_paths = local_paths
super(DataFetcher, self).__init__(ve... | DataFetcher for retrieving Sentinel SLC data | DataFetcher | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataFetcher:
"""DataFetcher for retrieving Sentinel SLC data"""
def __init__(self, url_list, satellite_url_list, username, password, swath, polarization='VV', local_paths=False, verbose=True):
"""Initialize Sentinel Data Fetcher @param url_list: List of urls of SLC data @param satell... | stack_v2_sparse_classes_75kplus_train_000168 | 5,424 | permissive | [
{
"docstring": "Initialize Sentinel Data Fetcher @param url_list: List of urls of SLC data @param satellite_url_list: List of satellite urls @param username: Username for downloading data @param password: Password for downloading data @param swath: Swath number (1, 2, or 3) @param polarization: Polarization of ... | 2 | stack_v2_sparse_classes_30k_train_001694 | Implement the Python class `DataFetcher` described below.
Class description:
DataFetcher for retrieving Sentinel SLC data
Method signatures and docstrings:
- def __init__(self, url_list, satellite_url_list, username, password, swath, polarization='VV', local_paths=False, verbose=True): Initialize Sentinel Data Fetche... | Implement the Python class `DataFetcher` described below.
Class description:
DataFetcher for retrieving Sentinel SLC data
Method signatures and docstrings:
- def __init__(self, url_list, satellite_url_list, username, password, swath, polarization='VV', local_paths=False, verbose=True): Initialize Sentinel Data Fetche... | 935bfd54149abd9542fe38e77b7eabab48b1c3a1 | <|skeleton|>
class DataFetcher:
"""DataFetcher for retrieving Sentinel SLC data"""
def __init__(self, url_list, satellite_url_list, username, password, swath, polarization='VV', local_paths=False, verbose=True):
"""Initialize Sentinel Data Fetcher @param url_list: List of urls of SLC data @param satell... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataFetcher:
"""DataFetcher for retrieving Sentinel SLC data"""
def __init__(self, url_list, satellite_url_list, username, password, swath, polarization='VV', local_paths=False, verbose=True):
"""Initialize Sentinel Data Fetcher @param url_list: List of urls of SLC data @param satellite_url_list:... | the_stack_v2_python_sparse | skdaccess/geo/sentinel_1/cache/data_fetcher.py | MITHaystack/scikit-dataaccess | train | 41 |
9fbb84d6de7b8bf5b511679f073997c55d306611 | [
"self.url = url\nself.make_soup()\nself.get_title()\nself.get_image()\nself.get_ingredients()\nself.get_contents()\nself.get_portions()",
"try:\n self.title = self.soup.find(class_='recipe__title').text.strip()\nexcept Exception:\n current_app.logger.error(f'Could not extract title: {traceback.format_exc()}... | <|body_start_0|>
self.url = url
self.make_soup()
self.get_title()
self.get_image()
self.get_ingredients()
self.get_contents()
self.get_portions()
<|end_body_0|>
<|body_start_1|>
try:
self.title = self.soup.find(class_='recipe__title').text.str... | Parser for recipes at mittkok.expressen.se. | MittkokParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MittkokParser:
"""Parser for recipes at mittkok.expressen.se."""
def __init__(self, url):
"""Init the parser."""
<|body_0|>
def get_title(self):
"""Get recipe title."""
<|body_1|>
def get_image(self):
"""Get recipe main image."""
<|bo... | stack_v2_sparse_classes_75kplus_train_000169 | 2,754 | permissive | [
{
"docstring": "Init the parser.",
"name": "__init__",
"signature": "def __init__(self, url)"
},
{
"docstring": "Get recipe title.",
"name": "get_title",
"signature": "def get_title(self)"
},
{
"docstring": "Get recipe main image.",
"name": "get_image",
"signature": "def ... | 6 | stack_v2_sparse_classes_30k_train_014491 | Implement the Python class `MittkokParser` described below.
Class description:
Parser for recipes at mittkok.expressen.se.
Method signatures and docstrings:
- def __init__(self, url): Init the parser.
- def get_title(self): Get recipe title.
- def get_image(self): Get recipe main image.
- def get_ingredients(self): G... | Implement the Python class `MittkokParser` described below.
Class description:
Parser for recipes at mittkok.expressen.se.
Method signatures and docstrings:
- def __init__(self, url): Init the parser.
- def get_title(self): Get recipe title.
- def get_image(self): Get recipe main image.
- def get_ingredients(self): G... | df3ca44eeefb1c3c3f4c54272f63059be47990bf | <|skeleton|>
class MittkokParser:
"""Parser for recipes at mittkok.expressen.se."""
def __init__(self, url):
"""Init the parser."""
<|body_0|>
def get_title(self):
"""Get recipe title."""
<|body_1|>
def get_image(self):
"""Get recipe main image."""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MittkokParser:
"""Parser for recipes at mittkok.expressen.se."""
def __init__(self, url):
"""Init the parser."""
self.url = url
self.make_soup()
self.get_title()
self.get_image()
self.get_ingredients()
self.get_contents()
self.get_portions()... | the_stack_v2_python_sparse | recapi/html_parsers/mittkokparser.py | anne17/recapi | train | 2 |
7f744fde0ed20bc756384653ad65d4bb2cf9d3bc | [
"prev_pointer = None\nslow_pointer = head\nfast_pointer = head\nwhile fast_pointer and fast_pointer.next:\n prev_pointer = slow_pointer\n slow_pointer = slow_pointer.next\n fast_pointer = fast_pointer.next.next\nif prev_pointer:\n prev_pointer.next = None\nreturn slow_pointer",
"if not head:\n retu... | <|body_start_0|>
prev_pointer = None
slow_pointer = head
fast_pointer = head
while fast_pointer and fast_pointer.next:
prev_pointer = slow_pointer
slow_pointer = slow_pointer.next
fast_pointer = fast_pointer.next.next
if prev_pointer:
... | Converter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Converter:
def find_mid_node(self, head: TreeNode) -> TreeNode:
"""Finds the mid node of the linked list. :param head: :return:"""
<|body_0|>
def sorted_linked_list_to_height_balanced_bst(self, head: ListNode) -> TreeNode:
"""Approach: Recursion Time Complexity: O(N ... | stack_v2_sparse_classes_75kplus_train_000170 | 3,993 | no_license | [
{
"docstring": "Finds the mid node of the linked list. :param head: :return:",
"name": "find_mid_node",
"signature": "def find_mid_node(self, head: TreeNode) -> TreeNode"
},
{
"docstring": "Approach: Recursion Time Complexity: O(N log N) Space Complexity: O(log N) :param head: :return:",
"na... | 6 | stack_v2_sparse_classes_30k_train_029544 | Implement the Python class `Converter` described below.
Class description:
Implement the Converter class.
Method signatures and docstrings:
- def find_mid_node(self, head: TreeNode) -> TreeNode: Finds the mid node of the linked list. :param head: :return:
- def sorted_linked_list_to_height_balanced_bst(self, head: Li... | Implement the Python class `Converter` described below.
Class description:
Implement the Converter class.
Method signatures and docstrings:
- def find_mid_node(self, head: TreeNode) -> TreeNode: Finds the mid node of the linked list. :param head: :return:
- def sorted_linked_list_to_height_balanced_bst(self, head: Li... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Converter:
def find_mid_node(self, head: TreeNode) -> TreeNode:
"""Finds the mid node of the linked list. :param head: :return:"""
<|body_0|>
def sorted_linked_list_to_height_balanced_bst(self, head: ListNode) -> TreeNode:
"""Approach: Recursion Time Complexity: O(N ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Converter:
def find_mid_node(self, head: TreeNode) -> TreeNode:
"""Finds the mid node of the linked list. :param head: :return:"""
prev_pointer = None
slow_pointer = head
fast_pointer = head
while fast_pointer and fast_pointer.next:
prev_pointer = slow_point... | the_stack_v2_python_sparse | data_structures/tree_node/linked_list_to_bst.py | Shiv2157k/leet_code | train | 1 | |
3d24fd6755f714a54ea8a3c0add0fed752b9608c | [
"discount = 0.0\nif move_line.purchase_line_id.id:\n discount = move_line.purchase_line_id.discount\nelif move_line.sale_line_id.id:\n discount = move_line.sale_line_id.discount\nreturn discount",
"discount = 0.0\nif move_line.purchase_line_id.id:\n discount = move_line.purchase_line_id.discount2\nelif m... | <|body_start_0|>
discount = 0.0
if move_line.purchase_line_id.id:
discount = move_line.purchase_line_id.discount
elif move_line.sale_line_id.id:
discount = move_line.sale_line_id.discount
return discount
<|end_body_0|>
<|body_start_1|>
discount = 0.0
... | stock_picking | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stock_picking:
def _get_discount_invoice(self, cr, uid, move_line):
"""Return the discount for the move line"""
<|body_0|>
def _get_discount2_invoice(self, cr, uid, move_line):
"""Return the discount for the move line"""
<|body_1|>
def _get_price_unit_in... | stack_v2_sparse_classes_75kplus_train_000171 | 3,397 | no_license | [
{
"docstring": "Return the discount for the move line",
"name": "_get_discount_invoice",
"signature": "def _get_discount_invoice(self, cr, uid, move_line)"
},
{
"docstring": "Return the discount for the move line",
"name": "_get_discount2_invoice",
"signature": "def _get_discount2_invoic... | 4 | stack_v2_sparse_classes_30k_train_050957 | Implement the Python class `stock_picking` described below.
Class description:
Implement the stock_picking class.
Method signatures and docstrings:
- def _get_discount_invoice(self, cr, uid, move_line): Return the discount for the move line
- def _get_discount2_invoice(self, cr, uid, move_line): Return the discount f... | Implement the Python class `stock_picking` described below.
Class description:
Implement the stock_picking class.
Method signatures and docstrings:
- def _get_discount_invoice(self, cr, uid, move_line): Return the discount for the move line
- def _get_discount2_invoice(self, cr, uid, move_line): Return the discount f... | 78fc164679b690bcf84866987266838de134bc2f | <|skeleton|>
class stock_picking:
def _get_discount_invoice(self, cr, uid, move_line):
"""Return the discount for the move line"""
<|body_0|>
def _get_discount2_invoice(self, cr, uid, move_line):
"""Return the discount for the move line"""
<|body_1|>
def _get_price_unit_in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class stock_picking:
def _get_discount_invoice(self, cr, uid, move_line):
"""Return the discount for the move line"""
discount = 0.0
if move_line.purchase_line_id.id:
discount = move_line.purchase_line_id.discount
elif move_line.sale_line_id.id:
discount = mov... | the_stack_v2_python_sparse | openforce_pricelist_discount_line/stock/stock_picking.py | alessandrocamilli/7-openforce-addons | train | 1 | |
b774a4c328d8efddba3aa98bcd64d7a3c5da1b18 | [
"self.k = data_splits[0]\nself.reader = Reader(file_name)\nself.df = self.reader.df\nself.normalize()\nif classification_type == 'classification':\n self.one_hot_encode()\nself.tuning_set = self.df.iloc[0:int(data_splits[1] * self.df.shape[0]), :]\nself.train_test_set = self.df.iloc[int(data_splits[1] * self.df.... | <|body_start_0|>
self.k = data_splits[0]
self.reader = Reader(file_name)
self.df = self.reader.df
self.normalize()
if classification_type == 'classification':
self.one_hot_encode()
self.tuning_set = self.df.iloc[0:int(data_splits[1] * self.df.shape[0]), :]
... | The data class is responsible for reading in, processing, storing, and manipulating data. An instance of the data class is passed into the algorithm so the algorithm has access to all data | DataClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataClass:
"""The data class is responsible for reading in, processing, storing, and manipulating data. An instance of the data class is passed into the algorithm so the algorithm has access to all data"""
def __init__(self, file_name, data_splits, classification_type):
"""Initializa... | stack_v2_sparse_classes_75kplus_train_000172 | 4,572 | no_license | [
{
"docstring": "Initialization method that normalizes all real values and creates value difference metrics for the categorical features as well as splitting data into tuning and train/test sets.",
"name": "__init__",
"signature": "def __init__(self, file_name, data_splits, classification_type)"
},
{... | 5 | stack_v2_sparse_classes_30k_train_026746 | Implement the Python class `DataClass` described below.
Class description:
The data class is responsible for reading in, processing, storing, and manipulating data. An instance of the data class is passed into the algorithm so the algorithm has access to all data
Method signatures and docstrings:
- def __init__(self,... | Implement the Python class `DataClass` described below.
Class description:
The data class is responsible for reading in, processing, storing, and manipulating data. An instance of the data class is passed into the algorithm so the algorithm has access to all data
Method signatures and docstrings:
- def __init__(self,... | 85b17bce4bef8de1bad52b66d9e9759432cb792a | <|skeleton|>
class DataClass:
"""The data class is responsible for reading in, processing, storing, and manipulating data. An instance of the data class is passed into the algorithm so the algorithm has access to all data"""
def __init__(self, file_name, data_splits, classification_type):
"""Initializa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataClass:
"""The data class is responsible for reading in, processing, storing, and manipulating data. An instance of the data class is passed into the algorithm so the algorithm has access to all data"""
def __init__(self, file_name, data_splits, classification_type):
"""Initialization method t... | the_stack_v2_python_sparse | proj3/DataClass.py | benholmgren/csci447 | train | 0 |
adcdcacbe23177ce6da0b52e8d9bca3eba65918f | [
"self.percentage = self.units = 0.0\nif widthUnit:\n self.percentage = float(widthNum) * 0.01\nelif widthNum:\n self.units = float(widthNum)\nelse:\n self.units = 1.0\nself.align = align or ''\nself.overlay = overlay or ''\nslideLexer.lineno = lineno\nself.children = slideParser.parse(content, slideLexer)\... | <|body_start_0|>
self.percentage = self.units = 0.0
if widthUnit:
self.percentage = float(widthNum) * 0.01
elif widthNum:
self.units = float(widthNum)
else:
self.units = 1.0
self.align = align or ''
self.overlay = overlay or ''
... | Column | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Column:
def lateInit(self, widthNum, widthUnit, align, overlay, content, lineno, **kw):
"""Identify column width specification, parse contents"""
<|body_0|>
def resolve(cls, docList):
"""Traverse given hierarchy collection and join adjacent columns in column environm... | stack_v2_sparse_classes_75kplus_train_000173 | 29,071 | permissive | [
{
"docstring": "Identify column width specification, parse contents",
"name": "lateInit",
"signature": "def lateInit(self, widthNum, widthUnit, align, overlay, content, lineno, **kw)"
},
{
"docstring": "Traverse given hierarchy collection and join adjacent columns in column environments; idistri... | 2 | stack_v2_sparse_classes_30k_train_014815 | Implement the Python class `Column` described below.
Class description:
Implement the Column class.
Method signatures and docstrings:
- def lateInit(self, widthNum, widthUnit, align, overlay, content, lineno, **kw): Identify column width specification, parse contents
- def resolve(cls, docList): Traverse given hierar... | Implement the Python class `Column` described below.
Class description:
Implement the Column class.
Method signatures and docstrings:
- def lateInit(self, widthNum, widthUnit, align, overlay, content, lineno, **kw): Identify column width specification, parse contents
- def resolve(cls, docList): Traverse given hierar... | fbd2c7a72ed2b6347a131a5b54740e7b15bf1624 | <|skeleton|>
class Column:
def lateInit(self, widthNum, widthUnit, align, overlay, content, lineno, **kw):
"""Identify column width specification, parse contents"""
<|body_0|>
def resolve(cls, docList):
"""Traverse given hierarchy collection and join adjacent columns in column environm... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Column:
def lateInit(self, widthNum, widthUnit, align, overlay, content, lineno, **kw):
"""Identify column width specification, parse contents"""
self.percentage = self.units = 0.0
if widthUnit:
self.percentage = float(widthNum) * 0.01
elif widthNum:
sel... | the_stack_v2_python_sparse | beamr/interpreters/hierarchical.py | teonistor/beamr | train | 5 | |
bdb54a8cdff4a07fed558b9bad66b15b1a379d33 | [
"query = Query(Faction.collection, service_id=self._client.service_id)\nquery.add_term(field=Faction.id_field, value=self.data.faction_id)\nreturn InstanceProxy(Faction, query, client=self._client)",
"query = Query(Item.collection, service_id=self._client.service_id)\nquery.add_term(field=Item.id_field, value=sel... | <|body_start_0|>
query = Query(Faction.collection, service_id=self._client.service_id)
query.add_term(field=Faction.id_field, value=self.data.faction_id)
return InstanceProxy(Faction, query, client=self._client)
<|end_body_0|>
<|body_start_1|>
query = Query(Item.collection, service_id=s... | Links vehicles to the items and attachments they support. .. attribute:: id :type: int The item that is being attached. In the API payload, this field is called ``vehicle_attachment_id``. .. attribute:: vehicle_id :type: int The ID of the :class:`Vehicle` the item may be attached to. .. seealso:: :meth:`vehicle` -- The... | VehicleAttachment | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VehicleAttachment:
"""Links vehicles to the items and attachments they support. .. attribute:: id :type: int The item that is being attached. In the API payload, this field is called ``vehicle_attachment_id``. .. attribute:: vehicle_id :type: int The ID of the :class:`Vehicle` the item may be att... | stack_v2_sparse_classes_75kplus_train_000174 | 6,898 | permissive | [
{
"docstring": "Return the faction this attachment is available to. This returns an :class:`auraxium.InstanceProxy`.",
"name": "faction",
"signature": "def faction(self) -> InstanceProxy[Faction]"
},
{
"docstring": "Return the attachable item for the vehicle. This returns an :class:`auraxium.Ins... | 3 | null | Implement the Python class `VehicleAttachment` described below.
Class description:
Links vehicles to the items and attachments they support. .. attribute:: id :type: int The item that is being attached. In the API payload, this field is called ``vehicle_attachment_id``. .. attribute:: vehicle_id :type: int The ID of t... | Implement the Python class `VehicleAttachment` described below.
Class description:
Links vehicles to the items and attachments they support. .. attribute:: id :type: int The item that is being attached. In the API payload, this field is called ``vehicle_attachment_id``. .. attribute:: vehicle_id :type: int The ID of t... | 23dcf927a199c8d7c917d89fe96b470a34cf4bba | <|skeleton|>
class VehicleAttachment:
"""Links vehicles to the items and attachments they support. .. attribute:: id :type: int The item that is being attached. In the API payload, this field is called ``vehicle_attachment_id``. .. attribute:: vehicle_id :type: int The ID of the :class:`Vehicle` the item may be att... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VehicleAttachment:
"""Links vehicles to the items and attachments they support. .. attribute:: id :type: int The item that is being attached. In the API payload, this field is called ``vehicle_attachment_id``. .. attribute:: vehicle_id :type: int The ID of the :class:`Vehicle` the item may be attached to. .. ... | the_stack_v2_python_sparse | auraxium/ps2/_vehicle.py | leonhard-s/auraxium | train | 29 |
523180d9ca36ae28f02cb325e7ff8bdde9ad6886 | [
"with mock.patch('os.path.exists', return_value=False):\n tested._defaultArgpath = ['initial']\n tested._handle_site_scons_dir('top/dir')\n self.assertEqual(tested._defaultArgpath, ['initial'])",
"with mock.patch('os.path.exists', return_value=True):\n tested._defaultArgpath = ['initial']\n tested.... | <|body_start_0|>
with mock.patch('os.path.exists', return_value=False):
tested._defaultArgpath = ['initial']
tested._handle_site_scons_dir('top/dir')
self.assertEqual(tested._defaultArgpath, ['initial'])
<|end_body_0|>
<|body_start_1|>
with mock.patch('os.path.exists... | Test__handle_site_scons_dir | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test__handle_site_scons_dir:
def test__handle_site_scons_dir_1(self):
"""Test SConsArguments.Importer._handle_site_scons_dir()"""
<|body_0|>
def test__handle_site_scons_dir_2(self):
"""Test SConsArguments.Importer._handle_site_scons_dir()"""
<|body_1|>
d... | stack_v2_sparse_classes_75kplus_train_000175 | 42,804 | permissive | [
{
"docstring": "Test SConsArguments.Importer._handle_site_scons_dir()",
"name": "test__handle_site_scons_dir_1",
"signature": "def test__handle_site_scons_dir_1(self)"
},
{
"docstring": "Test SConsArguments.Importer._handle_site_scons_dir()",
"name": "test__handle_site_scons_dir_2",
"sig... | 4 | stack_v2_sparse_classes_30k_train_017618 | Implement the Python class `Test__handle_site_scons_dir` described below.
Class description:
Implement the Test__handle_site_scons_dir class.
Method signatures and docstrings:
- def test__handle_site_scons_dir_1(self): Test SConsArguments.Importer._handle_site_scons_dir()
- def test__handle_site_scons_dir_2(self): Te... | Implement the Python class `Test__handle_site_scons_dir` described below.
Class description:
Implement the Test__handle_site_scons_dir class.
Method signatures and docstrings:
- def test__handle_site_scons_dir_1(self): Test SConsArguments.Importer._handle_site_scons_dir()
- def test__handle_site_scons_dir_2(self): Te... | f4b783fc79fe3fc16e8d0f58308099a67752d299 | <|skeleton|>
class Test__handle_site_scons_dir:
def test__handle_site_scons_dir_1(self):
"""Test SConsArguments.Importer._handle_site_scons_dir()"""
<|body_0|>
def test__handle_site_scons_dir_2(self):
"""Test SConsArguments.Importer._handle_site_scons_dir()"""
<|body_1|>
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test__handle_site_scons_dir:
def test__handle_site_scons_dir_1(self):
"""Test SConsArguments.Importer._handle_site_scons_dir()"""
with mock.patch('os.path.exists', return_value=False):
tested._defaultArgpath = ['initial']
tested._handle_site_scons_dir('top/dir')
... | the_stack_v2_python_sparse | unit_tests/SConsArgumentsT/ImporterTests.py | mcqueen256/scons-arguments | train | 0 | |
f5fa6950f3dafdb60e1bab066acf5293bd52c15d | [
"self.cond = threading.Condition(threading.Lock())\nself.parties = parties\nself.waiting = 0\nself.generation = 0\nself.broken = False",
"with self.cond:\n if self.broken:\n return\n gen = self.generation\n self.waiting += 1\n if self.waiting == self.parties:\n self.waiting = 0\n ... | <|body_start_0|>
self.cond = threading.Condition(threading.Lock())
self.parties = parties
self.waiting = 0
self.generation = 0
self.broken = False
<|end_body_0|>
<|body_start_1|>
with self.cond:
if self.broken:
return
gen = self.ge... | Implements a lightweight Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and simultaneously return once they have all made that call. # Implementation adopted from boost/thread/barrier.hpp | Barrier | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Barrier:
"""Implements a lightweight Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and simultaneously return once they have all made that call. # Implementation adopted from boost/thread/barrier.hpp"""
def __init__(self... | stack_v2_sparse_classes_75kplus_train_000176 | 8,387 | permissive | [
{
"docstring": "Create a barrier, initialised to 'parties' threads.",
"name": "__init__",
"signature": "def __init__(self, parties)"
},
{
"docstring": "Wait for the barrier.",
"name": "wait",
"signature": "def wait(self)"
},
{
"docstring": "Clear existing barrier and disable this... | 3 | null | Implement the Python class `Barrier` described below.
Class description:
Implements a lightweight Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and simultaneously return once they have all made that call. # Implementation adopted from boost/threa... | Implement the Python class `Barrier` described below.
Class description:
Implements a lightweight Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and simultaneously return once they have all made that call. # Implementation adopted from boost/threa... | c8e97df0d4d3d0c1020b98391c526df12371fc30 | <|skeleton|>
class Barrier:
"""Implements a lightweight Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and simultaneously return once they have all made that call. # Implementation adopted from boost/thread/barrier.hpp"""
def __init__(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Barrier:
"""Implements a lightweight Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and simultaneously return once they have all made that call. # Implementation adopted from boost/thread/barrier.hpp"""
def __init__(self, parties):
... | the_stack_v2_python_sparse | scripts/tf_cnn_benchmarks/cnn_util.py | tensorflow/benchmarks | train | 1,182 |
9394d67a29d433dff78521d16930b7fd2f035c38 | [
"super(UserRegisterForm, self).clean()\npassword1 = self.cleaned_data.get('password1')\npassword2 = self.cleaned_data.get('password2')\nif password1 != password2:\n raise forms.ValidationError('You must enter matching passwords.')\ntry:\n password_validation.validate_password(password=password1, user=get_user... | <|body_start_0|>
super(UserRegisterForm, self).clean()
password1 = self.cleaned_data.get('password1')
password2 = self.cleaned_data.get('password2')
if password1 != password2:
raise forms.ValidationError('You must enter matching passwords.')
try:
password_... | UserRegisterForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserRegisterForm:
def clean(self):
"""Validate attributes, including password constraints, before persisting the user to the database."""
<|body_0|>
def save(self, commit=True):
"""Save the provided password in hashed format. :param commit: If True, changes to the in... | stack_v2_sparse_classes_75kplus_train_000177 | 1,743 | permissive | [
{
"docstring": "Validate attributes, including password constraints, before persisting the user to the database.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Save the provided password in hashed format. :param commit: If True, changes to the instance will be saved to the ... | 2 | stack_v2_sparse_classes_30k_train_010923 | Implement the Python class `UserRegisterForm` described below.
Class description:
Implement the UserRegisterForm class.
Method signatures and docstrings:
- def clean(self): Validate attributes, including password constraints, before persisting the user to the database.
- def save(self, commit=True): Save the provided... | Implement the Python class `UserRegisterForm` described below.
Class description:
Implement the UserRegisterForm class.
Method signatures and docstrings:
- def clean(self): Validate attributes, including password constraints, before persisting the user to the database.
- def save(self, commit=True): Save the provided... | d03b56f5b1878dc981d866e108dbb05deb120266 | <|skeleton|>
class UserRegisterForm:
def clean(self):
"""Validate attributes, including password constraints, before persisting the user to the database."""
<|body_0|>
def save(self, commit=True):
"""Save the provided password in hashed format. :param commit: If True, changes to the in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserRegisterForm:
def clean(self):
"""Validate attributes, including password constraints, before persisting the user to the database."""
super(UserRegisterForm, self).clean()
password1 = self.cleaned_data.get('password1')
password2 = self.cleaned_data.get('password2')
... | the_stack_v2_python_sparse | myproject/auth/forms/userregistrationform.py | alexdlaird/django-bootstrap-authentication-template-project | train | 3 | |
638672242061fa593c2f91ef81d24c19e27122e1 | [
"if data['image_id'] < 0:\n raise ValidationError('Image id is incorrect.')\nreturn data['image_id']",
"if data['organism_id'] < 0:\n raise ValidationError('Organism id is incorrect.')\nreturn data['organism_id']"
] | <|body_start_0|>
if data['image_id'] < 0:
raise ValidationError('Image id is incorrect.')
return data['image_id']
<|end_body_0|>
<|body_start_1|>
if data['organism_id'] < 0:
raise ValidationError('Organism id is incorrect.')
return data['organism_id']
<|end_body_... | FormCleaningUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormCleaningUtil:
def clean_image_id(data):
"""Cleans an image id ensuring that it is a positive integer."""
<|body_0|>
def clean_organism_id(data):
"""Cleans an organism id ensuring that it is a positive integer."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_000178 | 6,553 | no_license | [
{
"docstring": "Cleans an image id ensuring that it is a positive integer.",
"name": "clean_image_id",
"signature": "def clean_image_id(data)"
},
{
"docstring": "Cleans an organism id ensuring that it is a positive integer.",
"name": "clean_organism_id",
"signature": "def clean_organism_... | 2 | stack_v2_sparse_classes_30k_train_039310 | Implement the Python class `FormCleaningUtil` described below.
Class description:
Implement the FormCleaningUtil class.
Method signatures and docstrings:
- def clean_image_id(data): Cleans an image id ensuring that it is a positive integer.
- def clean_organism_id(data): Cleans an organism id ensuring that it is a po... | Implement the Python class `FormCleaningUtil` described below.
Class description:
Implement the FormCleaningUtil class.
Method signatures and docstrings:
- def clean_image_id(data): Cleans an image id ensuring that it is a positive integer.
- def clean_organism_id(data): Cleans an organism id ensuring that it is a po... | 22c1ce3c5a8e4ed99c2f014672d60ad3c5a4003c | <|skeleton|>
class FormCleaningUtil:
def clean_image_id(data):
"""Cleans an image id ensuring that it is a positive integer."""
<|body_0|>
def clean_organism_id(data):
"""Cleans an organism id ensuring that it is a positive integer."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FormCleaningUtil:
def clean_image_id(data):
"""Cleans an image id ensuring that it is a positive integer."""
if data['image_id'] < 0:
raise ValidationError('Image id is incorrect.')
return data['image_id']
def clean_organism_id(data):
"""Cleans an organism id e... | the_stack_v2_python_sparse | biodig/rest/v2/ImageOrganisms/forms.py | asmariyaz23/BioDIG | train | 0 | |
6a686bff9cb07eda65d69d24799c3d1c2154a1bd | [
"m, n = (len(mat), len(mat[0]))\nfor i in range(m):\n for j in range(n):\n if mat[i][j] and i > 0:\n mat[i][j] += mat[i - 1][j]\nans = 0\nfor i in range(m):\n stack = []\n cnt = 0\n for j in range(n):\n while stack and mat[i][stack[-1]] > mat[i][j]:\n jj = stack.pop()... | <|body_start_0|>
m, n = (len(mat), len(mat[0]))
for i in range(m):
for j in range(n):
if mat[i][j] and i > 0:
mat[i][j] += mat[i - 1][j]
ans = 0
for i in range(m):
stack = []
cnt = 0
for j in range(n):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSubmat(self, mat):
""":type mat: List[List[int]] :rtype: int"""
<|body_0|>
def numSubmat2(self, mat):
""":type mat: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
m, n = (len(mat), len(mat[0]))
f... | stack_v2_sparse_classes_75kplus_train_000179 | 3,210 | no_license | [
{
"docstring": ":type mat: List[List[int]] :rtype: int",
"name": "numSubmat",
"signature": "def numSubmat(self, mat)"
},
{
"docstring": ":type mat: List[List[int]] :rtype: int",
"name": "numSubmat2",
"signature": "def numSubmat2(self, mat)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047741 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubmat(self, mat): :type mat: List[List[int]] :rtype: int
- def numSubmat2(self, mat): :type mat: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubmat(self, mat): :type mat: List[List[int]] :rtype: int
- def numSubmat2(self, mat): :type mat: List[List[int]] :rtype: int
<|skeleton|>
class Solution:
def numSub... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def numSubmat(self, mat):
""":type mat: List[List[int]] :rtype: int"""
<|body_0|>
def numSubmat2(self, mat):
""":type mat: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numSubmat(self, mat):
""":type mat: List[List[int]] :rtype: int"""
m, n = (len(mat), len(mat[0]))
for i in range(m):
for j in range(n):
if mat[i][j] and i > 0:
mat[i][j] += mat[i - 1][j]
ans = 0
for i in rang... | the_stack_v2_python_sparse | C/CountSubmatricesWithAllOnes.py | bssrdf/pyleet | train | 2 | |
c48fcabd4d75bb0e3a45c363c1129ab5e7bd68d4 | [
"nums.sort()\nres = []\nlookup = {}\nwhile nums:\n a = nums.pop()\n if a in lookup:\n continue\n r = self.twoSum(nums, -a)\n j = [t + [a] for t in r]\n res = res + j\n lookup[a] = True\nreturn res",
"lookup = {}\nres = []\nfor num in nums:\n remain = lookup.get(target - num)\n if re... | <|body_start_0|>
nums.sort()
res = []
lookup = {}
while nums:
a = nums.pop()
if a in lookup:
continue
r = self.twoSum(nums, -a)
j = [t + [a] for t in r]
res = res + j
lookup[a] = True
return r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSum(self, nums: list):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
num... | stack_v2_sparse_classes_75kplus_train_000180 | 960 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum",
"signature": "def threeSum(self, nums: list)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
}
] | 2 | stack_v2_sparse_classes_30k_test_002758 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum(self, nums: list): :type nums: List[int] :rtype: List[List[int]]
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum(self, nums: list): :type nums: List[int] :rtype: List[List[int]]
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
<|skele... | 3766b78c23ff33d68d8c90edddee823ebc559259 | <|skeleton|>
class Solution:
def threeSum(self, nums: list):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def threeSum(self, nums: list):
""":type nums: List[int] :rtype: List[List[int]]"""
nums.sort()
res = []
lookup = {}
while nums:
a = nums.pop()
if a in lookup:
continue
r = self.twoSum(nums, -a)
j... | the_stack_v2_python_sparse | Python/three-sum.py | Waka-Entertain/Let-code-everyday | train | 0 | |
e33c271ff2a2937260d3d073d6a687d52b09c50e | [
"array = [1, 2, 3, 3, 4, 3, 2, 3]\nremove_element(array, 3)\nself.assertEqual(array, [1, 2, 2, 4])",
"array = [4, 3, 6, 2, 10, 10, 4, 6, 28, 34, 2, 9, 3, 5, 4, 2, 3, 2, 3, 10]\nremove_element(array, 10)\nself.assertEqual(array, [4, 3, 6, 2, 3, 2, 4, 6, 28, 34, 2, 9, 3, 5, 4, 2, 3])",
"array = [1, 1, 1, 1, 1, 1,... | <|body_start_0|>
array = [1, 2, 3, 3, 4, 3, 2, 3]
remove_element(array, 3)
self.assertEqual(array, [1, 2, 2, 4])
<|end_body_0|>
<|body_start_1|>
array = [4, 3, 6, 2, 10, 10, 4, 6, 28, 34, 2, 9, 3, 5, 4, 2, 3, 2, 3, 10]
remove_element(array, 10)
self.assertEqual(array, [4... | TestRemoveElement | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestRemoveElement:
def test_removes_in_short_array_in_place(self):
"""Takes in a short array and removes a value in place in short array"""
<|body_0|>
def test_removes_in_long_array_in_place(self):
"""Takes in a long array and removes a value in place in a long array... | stack_v2_sparse_classes_75kplus_train_000181 | 1,009 | permissive | [
{
"docstring": "Takes in a short array and removes a value in place in short array",
"name": "test_removes_in_short_array_in_place",
"signature": "def test_removes_in_short_array_in_place(self)"
},
{
"docstring": "Takes in a long array and removes a value in place in a long array",
"name": "... | 3 | stack_v2_sparse_classes_30k_train_006640 | Implement the Python class `TestRemoveElement` described below.
Class description:
Implement the TestRemoveElement class.
Method signatures and docstrings:
- def test_removes_in_short_array_in_place(self): Takes in a short array and removes a value in place in short array
- def test_removes_in_long_array_in_place(sel... | Implement the Python class `TestRemoveElement` described below.
Class description:
Implement the TestRemoveElement class.
Method signatures and docstrings:
- def test_removes_in_short_array_in_place(self): Takes in a short array and removes a value in place in short array
- def test_removes_in_long_array_in_place(sel... | 27ffb6b32d6d18d279c51cfa45bf305a409be5c2 | <|skeleton|>
class TestRemoveElement:
def test_removes_in_short_array_in_place(self):
"""Takes in a short array and removes a value in place in short array"""
<|body_0|>
def test_removes_in_long_array_in_place(self):
"""Takes in a long array and removes a value in place in a long array... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestRemoveElement:
def test_removes_in_short_array_in_place(self):
"""Takes in a short array and removes a value in place in short array"""
array = [1, 2, 3, 3, 4, 3, 2, 3]
remove_element(array, 3)
self.assertEqual(array, [1, 2, 2, 4])
def test_removes_in_long_array_in_pla... | the_stack_v2_python_sparse | src/leetcode/easy/remove-element/test_remove_element.py | nwthomas/code-challenges | train | 2 | |
1f41b2ff53dceda45cacc7f853c6647e5ae570de | [
"if root == None:\n return False\n\ndef judge(root, sum):\n if root == None and sum != 0:\n return False\n if root.left == None and root.right == None and (root.val == sum):\n return True\n elif root.left == None and root.right != None:\n return judge(root.right, sum - root.val)\n ... | <|body_start_0|>
if root == None:
return False
def judge(root, sum):
if root == None and sum != 0:
return False
if root.left == None and root.right == None and (root.val == sum):
return True
elif root.left == None and root.... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasPathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: bool"""
<|body_0|>
def pathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_000182 | 1,940 | no_license | [
{
"docstring": ":type root: TreeNode :type sum: int :rtype: bool",
"name": "hasPathSum",
"signature": "def hasPathSum(self, root, sum)"
},
{
"docstring": ":type root: TreeNode :type sum: int :rtype: List[List[int]]",
"name": "pathSum",
"signature": "def pathSum(self, root, sum)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005489 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool
- def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool
- def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: List[List[int]]
<|s... | 2418b3eed1ab85cfd9cac039c6cfdc1a349ad345 | <|skeleton|>
class Solution:
def hasPathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: bool"""
<|body_0|>
def pathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hasPathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: bool"""
if root == None:
return False
def judge(root, sum):
if root == None and sum != 0:
return False
if root.left == None and root.right == N... | the_stack_v2_python_sparse | leetcode-first_time/leetcode112(path sum).py | HopeCheung/leetcode | train | 0 | |
0a5b89f0b86a8831e5291a270d789161ea7f8056 | [
"keep = (input,)\nctx.num_classes = num_classes\nctx.dim = dim\ndata = input[:, :-num_classes]\nsegmentation = input[:, -num_classes:]\nclass_index = torch.argmax(segmentation, dim=1)\nbatch_indices = torch.unique(data[:, dim])\nkeep += (class_index, batch_indices)\noutput = []\nfor b in batch_indices:\n batch_i... | <|body_start_0|>
keep = (input,)
ctx.num_classes = num_classes
ctx.dim = dim
data = input[:, :-num_classes]
segmentation = input[:, -num_classes:]
class_index = torch.argmax(segmentation, dim=1)
batch_indices = torch.unique(data[:, dim])
keep += (class_ind... | DBScanFunction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBScanFunction:
def forward(ctx, input, epsilon, minPoints, num_classes, dim):
"""input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D"""
<|body_0|>
def backward(ctx, *g... | stack_v2_sparse_classes_75kplus_train_000183 | 12,354 | no_license | [
{
"docstring": "input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D",
"name": "forward",
"signature": "def forward(ctx, input, epsilon, minPoints, num_classes, dim)"
},
{
"docstring": "len(... | 2 | stack_v2_sparse_classes_30k_train_033401 | Implement the Python class `DBScanFunction` described below.
Class description:
Implement the DBScanFunction class.
Method signatures and docstrings:
- def forward(ctx, input, epsilon, minPoints, num_classes, dim): input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan n... | Implement the Python class `DBScanFunction` described below.
Class description:
Implement the DBScanFunction class.
Method signatures and docstrings:
- def forward(ctx, input, epsilon, minPoints, num_classes, dim): input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan n... | 9f022c9204741273ae451e8b3ed40385e676c6e8 | <|skeleton|>
class DBScanFunction:
def forward(ctx, input, epsilon, minPoints, num_classes, dim):
"""input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D"""
<|body_0|>
def backward(ctx, *g... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DBScanFunction:
def forward(ctx, input, epsilon, minPoints, num_classes, dim):
"""input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D"""
keep = (input,)
ctx.num_classes = num_clas... | the_stack_v2_python_sparse | mlreco/models/layers/dbscan.py | francois-drielsma/lartpc_mlreco3d | train | 0 | |
ae09d0d5153be3695db55eafd04bfd8af1b5c315 | [
"ImageProcessor.__init__(self, **kwargs)\nself._max_cache_size = max_cache_size\nself._max_days_bias = max_days_bias\nself._max_days_dark = max_days_dark\nself._max_days_flat = max_days_flat\nself._require_bias = require_bias\nself._require_dark = require_dark\nself._require_flat = require_flat\nself._archive = get... | <|body_start_0|>
ImageProcessor.__init__(self, **kwargs)
self._max_cache_size = max_cache_size
self._max_days_bias = max_days_bias
self._max_days_dark = max_days_dark
self._max_days_flat = max_days_flat
self._require_bias = require_bias
self._require_dark = requir... | Calibrate an image. | Calibration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Calibration:
"""Calibrate an image."""
def __init__(self, archive: Union[Dict[str, Any], Archive], max_cache_size: int=20, require_bias: bool=True, require_dark: bool=True, require_flat: bool=True, max_days_bias: Optional[float]=None, max_days_dark: Optional[float]=None, max_days_flat: Optio... | stack_v2_sparse_classes_75kplus_train_000184 | 6,281 | permissive | [
{
"docstring": "Init a new image calibration pipeline step. Args: archive: Archive to fetch calibration frames from.",
"name": "__init__",
"signature": "def __init__(self, archive: Union[Dict[str, Any], Archive], max_cache_size: int=20, require_bias: bool=True, require_dark: bool=True, require_flat: boo... | 3 | stack_v2_sparse_classes_30k_train_045505 | Implement the Python class `Calibration` described below.
Class description:
Calibrate an image.
Method signatures and docstrings:
- def __init__(self, archive: Union[Dict[str, Any], Archive], max_cache_size: int=20, require_bias: bool=True, require_dark: bool=True, require_flat: bool=True, max_days_bias: Optional[fl... | Implement the Python class `Calibration` described below.
Class description:
Calibrate an image.
Method signatures and docstrings:
- def __init__(self, archive: Union[Dict[str, Any], Archive], max_cache_size: int=20, require_bias: bool=True, require_dark: bool=True, require_flat: bool=True, max_days_bias: Optional[fl... | 2d7a06e5485b61b6ca7e51d99b08651ea6021086 | <|skeleton|>
class Calibration:
"""Calibrate an image."""
def __init__(self, archive: Union[Dict[str, Any], Archive], max_cache_size: int=20, require_bias: bool=True, require_dark: bool=True, require_flat: bool=True, max_days_bias: Optional[float]=None, max_days_dark: Optional[float]=None, max_days_flat: Optio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Calibration:
"""Calibrate an image."""
def __init__(self, archive: Union[Dict[str, Any], Archive], max_cache_size: int=20, require_bias: bool=True, require_dark: bool=True, require_flat: bool=True, max_days_bias: Optional[float]=None, max_days_dark: Optional[float]=None, max_days_flat: Optional[float]=No... | the_stack_v2_python_sparse | pyobs/images/processors/misc/calibration.py | pyobs/pyobs-core | train | 9 |
a6762622db2b160476f1601c208a8db490db4e91 | [
"def verifyPostorderByRange(i, j):\n if i >= j:\n return True\n p = i\n while postorder[p] < postorder[j]:\n p += 1\n m = p\n while postorder[p] > postorder[j]:\n p += 1\n return p == j and verifyPostorderByRange(i, m - 1) and verifyPostorderByRange(m, j - 1)\nreturn verifyPos... | <|body_start_0|>
def verifyPostorderByRange(i, j):
if i >= j:
return True
p = i
while postorder[p] < postorder[j]:
p += 1
m = p
while postorder[p] > postorder[j]:
p += 1
return p == j and veri... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
"""根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表"""
<|body_0|>
def verifyPostor... | stack_v2_sparse_classes_75kplus_train_000185 | 2,965 | no_license | [
{
"docstring": "根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表",
"name": "verifyPostorder",
"signature": "def verifyPostorder(self, postorder: List[int]) -> bool"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_023845 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPostorder(self, postorder: List[int]) -> bool: 根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPostorder(self, postorder: List[int]) -> bool: 根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况... | 32941ee052d0985a9569441d314378700ff4d225 | <|skeleton|>
class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
"""根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表"""
<|body_0|>
def verifyPostor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
"""根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表"""
def verifyPostorderByRange(i, j):
... | the_stack_v2_python_sparse | cecilia-python/剑指offer/chapter-4/VerifyPostorder.py | Cecilia520/algorithmic-learning-leetcode | train | 7 | |
897a5b25f1ee712c2048b3ec66837a56cdfc0bf5 | [
"pip_manager = PipManager.get_singleton()\npip_manager.install_pip(lazy=True, op=op)\nadd_command_line_sys_path()\ndependency_install_command = [_get_python_exe_path(), '-m', 'pip', 'install', '--no-cache-dir', self.package_name]\nlog_report('INFO', f'Installing dependency with {dependency_install_command}', op)\ns... | <|body_start_0|>
pip_manager = PipManager.get_singleton()
pip_manager.install_pip(lazy=True, op=op)
add_command_line_sys_path()
dependency_install_command = [_get_python_exe_path(), '-m', 'pip', 'install', '--no-cache-dir', self.package_name]
log_report('INFO', f'Installing depen... | Class that describes an optional Python dependency of the addon. | OptionalDependency | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptionalDependency:
"""Class that describes an optional Python dependency of the addon."""
def install(self, op=None):
"""Install this dependency."""
<|body_0|>
def uninstall(self, remove_sys_path=True, op=None):
"""Uninstall this dependency."""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_000186 | 14,831 | permissive | [
{
"docstring": "Install this dependency.",
"name": "install",
"signature": "def install(self, op=None)"
},
{
"docstring": "Uninstall this dependency.",
"name": "uninstall",
"signature": "def uninstall(self, remove_sys_path=True, op=None)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001819 | Implement the Python class `OptionalDependency` described below.
Class description:
Class that describes an optional Python dependency of the addon.
Method signatures and docstrings:
- def install(self, op=None): Install this dependency.
- def uninstall(self, remove_sys_path=True, op=None): Uninstall this dependency. | Implement the Python class `OptionalDependency` described below.
Class description:
Class that describes an optional Python dependency of the addon.
Method signatures and docstrings:
- def install(self, op=None): Install this dependency.
- def uninstall(self, remove_sys_path=True, op=None): Uninstall this dependency.... | da404ebf8d4412196c2740f0b569cbf9e542952d | <|skeleton|>
class OptionalDependency:
"""Class that describes an optional Python dependency of the addon."""
def install(self, op=None):
"""Install this dependency."""
<|body_0|>
def uninstall(self, remove_sys_path=True, op=None):
"""Uninstall this dependency."""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OptionalDependency:
"""Class that describes an optional Python dependency of the addon."""
def install(self, op=None):
"""Install this dependency."""
pip_manager = PipManager.get_singleton()
pip_manager.install_pip(lazy=True, op=op)
add_command_line_sys_path()
depe... | the_stack_v2_python_sparse | photogrammetry_importer/preferences/dependency.py | SBCV/Blender-Addon-Photogrammetry-Importer | train | 718 |
b11191c0d69b66ef7cd72c030f8e4619bc90c4ba | [
"super().__init__()\nself.num_queries = num_queries\nself.transformer = transformer\nhidden_dim = transformer.d_model\nself.class_embed = nn.Linear(hidden_dim, num_classes + 1)\nself.bsegment_embed = MLP(hidden_dim, hidden_dim, 2, 3)\nself.input_proj = nn.Conv1d(backbone.num_channels, hidden_dim, kernel_size=1)\nse... | <|body_start_0|>
super().__init__()
self.num_queries = num_queries
self.transformer = transformer
hidden_dim = transformer.d_model
self.class_embed = nn.Linear(hidden_dim, num_classes + 1)
self.bsegment_embed = MLP(hidden_dim, hidden_dim, 2, 3)
self.input_proj = n... | This is the DETR module that performs translocation detection | DETR | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DETR:
"""This is the DETR module that performs translocation detection"""
def __init__(self, backbone, transformer, num_classes, num_queries):
"""Initializes the model. Parameters: backbone: torch module of the backbone to be used. See backbone.py transformer: torch module of the tra... | stack_v2_sparse_classes_75kplus_train_000187 | 11,449 | permissive | [
{
"docstring": "Initializes the model. Parameters: backbone: torch module of the backbone to be used. See backbone.py transformer: torch module of the transformer architecture. See transformer.py num_classes: number of translocation classes num_queries: number of translocation queries, ie detection slot. This i... | 2 | stack_v2_sparse_classes_30k_train_050884 | Implement the Python class `DETR` described below.
Class description:
This is the DETR module that performs translocation detection
Method signatures and docstrings:
- def __init__(self, backbone, transformer, num_classes, num_queries): Initializes the model. Parameters: backbone: torch module of the backbone to be u... | Implement the Python class `DETR` described below.
Class description:
This is the DETR module that performs translocation detection
Method signatures and docstrings:
- def __init__(self, backbone, transformer, num_classes, num_queries): Initializes the model. Parameters: backbone: torch module of the backbone to be u... | 24c559869cee32487539fa3febc9f96919035278 | <|skeleton|>
class DETR:
"""This is the DETR module that performs translocation detection"""
def __init__(self, backbone, transformer, num_classes, num_queries):
"""Initializes the model. Parameters: backbone: torch module of the backbone to be used. See backbone.py transformer: torch module of the tra... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DETR:
"""This is the DETR module that performs translocation detection"""
def __init__(self, backbone, transformer, num_classes, num_queries):
"""Initializes the model. Parameters: backbone: torch module of the backbone to be used. See backbone.py transformer: torch module of the transformer arch... | the_stack_v2_python_sparse | Translocations_Detector/models/detr.py | dariodematties/NANOPORE_TRANSLOCATIONS | train | 0 |
cddb41a9ce7c3c418e15b9d610dd649c1cd961e7 | [
"study_id = filter_params.pop('study_id', None)\nparticipant_id = filter_params.pop('participant_id', None)\nq = FamilyRelationship.query_all_relationships(participant_kf_id=participant_id, model_filter_params=filter_params)\nif study_id:\n from dataservice.api.participant.models import Participant\n q = q.fi... | <|body_start_0|>
study_id = filter_params.pop('study_id', None)
participant_id = filter_params.pop('participant_id', None)
q = FamilyRelationship.query_all_relationships(participant_kf_id=participant_id, model_filter_params=filter_params)
if study_id:
from dataservice.api.par... | FamilyRelationship REST API | FamilyRelationshipListAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FamilyRelationshipListAPI:
"""FamilyRelationship REST API"""
def get(self, filter_params, after, limit):
"""Get all family_relationships --- description: Get all family_relationships template: path: get_list.yml properties: resource: FamilyRelationship"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_000188 | 5,385 | permissive | [
{
"docstring": "Get all family_relationships --- description: Get all family_relationships template: path: get_list.yml properties: resource: FamilyRelationship",
"name": "get",
"signature": "def get(self, filter_params, after, limit)"
},
{
"docstring": "Create a new family_relationship --- temp... | 2 | stack_v2_sparse_classes_30k_train_041323 | Implement the Python class `FamilyRelationshipListAPI` described below.
Class description:
FamilyRelationship REST API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get all family_relationships --- description: Get all family_relationships template: path: get_list.yml properties: res... | Implement the Python class `FamilyRelationshipListAPI` described below.
Class description:
FamilyRelationship REST API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get all family_relationships --- description: Get all family_relationships template: path: get_list.yml properties: res... | 36ee3fc3d1ba9d1a177274d051fb175c56dd898e | <|skeleton|>
class FamilyRelationshipListAPI:
"""FamilyRelationship REST API"""
def get(self, filter_params, after, limit):
"""Get all family_relationships --- description: Get all family_relationships template: path: get_list.yml properties: resource: FamilyRelationship"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FamilyRelationshipListAPI:
"""FamilyRelationship REST API"""
def get(self, filter_params, after, limit):
"""Get all family_relationships --- description: Get all family_relationships template: path: get_list.yml properties: resource: FamilyRelationship"""
study_id = filter_params.pop('stu... | the_stack_v2_python_sparse | dataservice/api/family_relationship/resources.py | kids-first/kf-api-dataservice | train | 9 |
78fa1fd8b0a087ac852921d289b6be6d3cad53e0 | [
"super().__init__(cost_multiplier=cost_multiplier)\nstate_count = forbidden_states.shape[0]\ncost_evaluation_count, _ = np.divmod(system_eval_count - 1, cost_eval_step)\nself.cost_normalization_constant = cost_evaluation_count * state_count\nself.forbidden_states_count = np.array([forbidden_states_.shape[0] for for... | <|body_start_0|>
super().__init__(cost_multiplier=cost_multiplier)
state_count = forbidden_states.shape[0]
cost_evaluation_count, _ = np.divmod(system_eval_count - 1, cost_eval_step)
self.cost_normalization_constant = cost_evaluation_count * state_count
self.forbidden_states_coun... | This cost penalizes the occupation of a set of forbidden states. Fields: cost_multiplier cost_normalization_constant forbidden_states_count forbidden_states_dagger name requires_step_evalution | ForbidStates | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForbidStates:
"""This cost penalizes the occupation of a set of forbidden states. Fields: cost_multiplier cost_normalization_constant forbidden_states_count forbidden_states_dagger name requires_step_evalution"""
def __init__(self, forbidden_states, system_eval_count, cost_eval_step=1, cost_... | stack_v2_sparse_classes_75kplus_train_000189 | 2,668 | permissive | [
{
"docstring": "See class fields for arguments not listed here. Arguments: cost_eval_step forbidden_states system_eval_count",
"name": "__init__",
"signature": "def __init__(self, forbidden_states, system_eval_count, cost_eval_step=1, cost_multiplier=1.0)"
},
{
"docstring": "Compute the penalty.... | 2 | null | Implement the Python class `ForbidStates` described below.
Class description:
This cost penalizes the occupation of a set of forbidden states. Fields: cost_multiplier cost_normalization_constant forbidden_states_count forbidden_states_dagger name requires_step_evalution
Method signatures and docstrings:
- def __init_... | Implement the Python class `ForbidStates` described below.
Class description:
This cost penalizes the occupation of a set of forbidden states. Fields: cost_multiplier cost_normalization_constant forbidden_states_count forbidden_states_dagger name requires_step_evalution
Method signatures and docstrings:
- def __init_... | 36d615170effc1b705d4543d92f979e511edfec2 | <|skeleton|>
class ForbidStates:
"""This cost penalizes the occupation of a set of forbidden states. Fields: cost_multiplier cost_normalization_constant forbidden_states_count forbidden_states_dagger name requires_step_evalution"""
def __init__(self, forbidden_states, system_eval_count, cost_eval_step=1, cost_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ForbidStates:
"""This cost penalizes the occupation of a set of forbidden states. Fields: cost_multiplier cost_normalization_constant forbidden_states_count forbidden_states_dagger name requires_step_evalution"""
def __init__(self, forbidden_states, system_eval_count, cost_eval_step=1, cost_multiplier=1.... | the_stack_v2_python_sparse | qoc/standard/costs/forbidstates.py | SchusterLab/qoc | train | 12 |
e02c942eeafb7056dd1a61260fb7c555ddf0dfcd | [
"table = TableHandler().get_table(request.user, table_id)\nTokenHandler().check_table_permissions(request, 'read', table, False)\nmodel = table.get_model()\nsearch = request.GET.get('search')\norder_by = request.GET.get('order_by')\nqueryset = model.objects.all().enhance_by_fields().order_by('id')\nif search:\n ... | <|body_start_0|>
table = TableHandler().get_table(request.user, table_id)
TokenHandler().check_table_permissions(request, 'read', table, False)
model = table.get_model()
search = request.GET.get('search')
order_by = request.GET.get('order_by')
queryset = model.objects.all... | RowsView | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RowsView:
def get(self, request, table_id):
"""Lists all the rows of the given table id paginated. It is also possible to provide a search query."""
<|body_0|>
def post(self, request, table_id):
"""Creates a new row for the given table_id. Also the post data is valid... | stack_v2_sparse_classes_75kplus_train_000190 | 17,481 | permissive | [
{
"docstring": "Lists all the rows of the given table id paginated. It is also possible to provide a search query.",
"name": "get",
"signature": "def get(self, request, table_id)"
},
{
"docstring": "Creates a new row for the given table_id. Also the post data is validated according to the tables... | 2 | stack_v2_sparse_classes_30k_train_003965 | Implement the Python class `RowsView` described below.
Class description:
Implement the RowsView class.
Method signatures and docstrings:
- def get(self, request, table_id): Lists all the rows of the given table id paginated. It is also possible to provide a search query.
- def post(self, request, table_id): Creates ... | Implement the Python class `RowsView` described below.
Class description:
Implement the RowsView class.
Method signatures and docstrings:
- def get(self, request, table_id): Lists all the rows of the given table id paginated. It is also possible to provide a search query.
- def post(self, request, table_id): Creates ... | 8426793bd6eccb49c58415f0e3566b5befebb4d2 | <|skeleton|>
class RowsView:
def get(self, request, table_id):
"""Lists all the rows of the given table id paginated. It is also possible to provide a search query."""
<|body_0|>
def post(self, request, table_id):
"""Creates a new row for the given table_id. Also the post data is valid... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RowsView:
def get(self, request, table_id):
"""Lists all the rows of the given table id paginated. It is also possible to provide a search query."""
table = TableHandler().get_table(request.user, table_id)
TokenHandler().check_table_permissions(request, 'read', table, False)
mo... | the_stack_v2_python_sparse | backend/src/baserow/contrib/database/api/rows/views.py | maktec/baserow | train | 0 | |
091722318315f83f81e68c83b522fef60b7c255f | [
"self.params = {}\nself.params['weight'] = np.random.normal(0, 0.0001, (out_features, in_features))\nself.params['bias'] = np.zeros((1, out_features))\nself.grads = {}\nself.grads['weight'] = np.zeros((out_features, in_features))\nself.grads['bias'] = np.zeros((1, out_features))\nself.intermediate = {}\nself.interm... | <|body_start_0|>
self.params = {}
self.params['weight'] = np.random.normal(0, 0.0001, (out_features, in_features))
self.params['bias'] = np.zeros((1, out_features))
self.grads = {}
self.grads['weight'] = np.zeros((out_features, in_features))
self.grads['bias'] = np.zeros(... | Linear module. Applies a linear transformation to the input data. | LinearModule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearModule:
"""Linear module. Applies a linear transformation to the input data."""
def __init__(self, in_features, out_features):
"""Initializes the parameters of the module. Args: in_features: size of each input sample out_features: size of each output sample TODO: Initialize wei... | stack_v2_sparse_classes_75kplus_train_000191 | 8,057 | permissive | [
{
"docstring": "Initializes the parameters of the module. Args: in_features: size of each input sample out_features: size of each output sample TODO: Initialize weights self.params['weight'] using normal distribution with mean = 0 and std = 0.0001. Initialize biases self.params['bias'] with 0. Also, initialize ... | 3 | stack_v2_sparse_classes_30k_train_033213 | Implement the Python class `LinearModule` described below.
Class description:
Linear module. Applies a linear transformation to the input data.
Method signatures and docstrings:
- def __init__(self, in_features, out_features): Initializes the parameters of the module. Args: in_features: size of each input sample out_... | Implement the Python class `LinearModule` described below.
Class description:
Linear module. Applies a linear transformation to the input data.
Method signatures and docstrings:
- def __init__(self, in_features, out_features): Initializes the parameters of the module. Args: in_features: size of each input sample out_... | 8b4b1c3092afb1411c2d5d95cafc768c77d26688 | <|skeleton|>
class LinearModule:
"""Linear module. Applies a linear transformation to the input data."""
def __init__(self, in_features, out_features):
"""Initializes the parameters of the module. Args: in_features: size of each input sample out_features: size of each output sample TODO: Initialize wei... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinearModule:
"""Linear module. Applies a linear transformation to the input data."""
def __init__(self, in_features, out_features):
"""Initializes the parameters of the module. Args: in_features: size of each input sample out_features: size of each output sample TODO: Initialize weights self.par... | the_stack_v2_python_sparse | assignment_1/code/modules.py | nilsleh/deepLearning2020 | train | 0 |
20ee31d1471e0d8b666b2fabc9d982494caafc22 | [
"if request.user.user_type == User.developer or request.user.user_type == User.admin or request.user.user_type == User.accounts:\n qs = self.get_queryset()\nelse:\n qs = self.get_queryset().filter(user_id__exact=request.user)\nserializer = LorryReceiptSerializer(qs, many=True)\nreturn Response(serializer.data... | <|body_start_0|>
if request.user.user_type == User.developer or request.user.user_type == User.admin or request.user.user_type == User.accounts:
qs = self.get_queryset()
else:
qs = self.get_queryset().filter(user_id__exact=request.user)
serializer = LorryReceiptSerializer... | LorryReceiptList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LorryReceiptList:
def get(self, request, *args, **kwargs):
"""Overriding the get method"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Overriding the post method"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if request.user.user_type =... | stack_v2_sparse_classes_75kplus_train_000192 | 14,344 | no_license | [
{
"docstring": "Overriding the get method",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Overriding the post method",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052346 | Implement the Python class `LorryReceiptList` described below.
Class description:
Implement the LorryReceiptList class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Overriding the get method
- def post(self, request, *args, **kwargs): Overriding the post method | Implement the Python class `LorryReceiptList` described below.
Class description:
Implement the LorryReceiptList class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Overriding the get method
- def post(self, request, *args, **kwargs): Overriding the post method
<|skeleton|>
class Lorr... | b76b9b0f3f3b70928c38856a24f963654f2139dc | <|skeleton|>
class LorryReceiptList:
def get(self, request, *args, **kwargs):
"""Overriding the get method"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Overriding the post method"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LorryReceiptList:
def get(self, request, *args, **kwargs):
"""Overriding the get method"""
if request.user.user_type == User.developer or request.user.user_type == User.admin or request.user.user_type == User.accounts:
qs = self.get_queryset()
else:
qs = self.ge... | the_stack_v2_python_sparse | operations/views.py | nileshnagarwal/NimbusApp | train | 0 | |
4a4cc255744e146858be6d225953a97818f50972 | [
"self.capacity = capacity\nself.keytoNodeDict = defaultdict()\nself.counttoOrderedDict = defaultdict(OrderedDict)\nself.minCount = -1",
"if key not in self.keytoNodeDict:\n return -1\nnode = self.keytoNodeDict[key]\nordered = self.counttoOrderedDict[node.count]\ndel ordered[key]\nif not ordered and node.count ... | <|body_start_0|>
self.capacity = capacity
self.keytoNodeDict = defaultdict()
self.counttoOrderedDict = defaultdict(OrderedDict)
self.minCount = -1
<|end_body_0|>
<|body_start_1|>
if key not in self.keytoNodeDict:
return -1
node = self.keytoNodeDict[key]
... | LFUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_000193 | 6,349 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: None",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_034580 | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None
<|sk... | 38615779eb43d147587467e11dc22761ac0726cb | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.keytoNodeDict = defaultdict()
self.counttoOrderedDict = defaultdict(OrderedDict)
self.minCount = -1
def get(self, key):
""":type key: int :rtype: int"""
... | the_stack_v2_python_sparse | VMware/LFU.py | Blossomyyh/leetcode | train | 2 | |
da3e17185f9575429b96e8f1cd541f1bc9a45d9f | [
"mini, maxa = (0, len(S))\nret = []\nfor c in S:\n if c == 'I':\n ret.append(mini)\n mini += 1\n else:\n ret.append(maxa)\n maxa -= 1\nret.append(mini)\nreturn ret",
"ret = [0]\nfor c in S:\n if c == 'I':\n ret.append(ret[-1] + 1)\n else:\n ret.append(ret[-1] ... | <|body_start_0|>
mini, maxa = (0, len(S))
ret = []
for c in S:
if c == 'I':
ret.append(mini)
mini += 1
else:
ret.append(maxa)
maxa -= 1
ret.append(mini)
return ret
<|end_body_0|>
<|body_start... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def diStringMatch(self, S: str) -> List[int]:
"""Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decrese from the max"""
<|body_0|>
def diStringMatchErrror(self, S: str) -> List[int]:
... | stack_v2_sparse_classes_75kplus_train_000194 | 1,464 | no_license | [
{
"docstring": "Looking at prev rather than cur If \"I\", then put smallest as prev. Increase from the min If \"D\", then put the largest as prev. Decrese from the max",
"name": "diStringMatch",
"signature": "def diStringMatch(self, S: str) -> List[int]"
},
{
"docstring": "start with 0, then add... | 2 | stack_v2_sparse_classes_30k_train_013060 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def diStringMatch(self, S: str) -> List[int]: Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decre... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def diStringMatch(self, S: str) -> List[int]: Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decre... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution:
def diStringMatch(self, S: str) -> List[int]:
"""Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decrese from the max"""
<|body_0|>
def diStringMatchErrror(self, S: str) -> List[int]:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def diStringMatch(self, S: str) -> List[int]:
"""Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decrese from the max"""
mini, maxa = (0, len(S))
ret = []
for c in S:
if c == 'I... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/942 DI String Match.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
e48ac31f3bf396712a9ee8b36c5064b423a5e5c0 | [
"if tolerance_in_millis > MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS:\n warnings.warn('Provided tolerance value {} exceeds the maximum allowed value {}. Maximum value will be used instead'.format(tolerance_in_millis, MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS))\n tolerance_in_millis = MAX_NORMAL_REQUEST_TOLERANCE_IN_... | <|body_start_0|>
if tolerance_in_millis > MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS:
warnings.warn('Provided tolerance value {} exceeds the maximum allowed value {}. Maximum value will be used instead'.format(tolerance_in_millis, MAX_NORMAL_REQUEST_TOLERANCE_IN_MILLIS))
tolerance_in_millis ... | Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as... | TimestampVerifier | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimestampVerifier:
"""Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon.... | stack_v2_sparse_classes_75kplus_train_000195 | 22,604 | permissive | [
{
"docstring": "Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here: https://developer.amazon.com/docs/custom-skills... | 2 | stack_v2_sparse_classes_30k_train_001799 | Implement the Python class `TimestampVerifier` described below.
Class description:
Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism exp... | Implement the Python class `TimestampVerifier` described below.
Class description:
Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism exp... | 7e13ca69b240985584dff6ec633a27598a154ca1 | <|skeleton|>
class TimestampVerifier:
"""Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TimestampVerifier:
"""Verifier that performs request timestamp verification. This is a concrete implementation of :py:class:`AbstractVerifier` class, handling the request timestamp verification of the input request. The verification follows the mechanism explained here : https://developer.amazon.com/docs/cust... | the_stack_v2_python_sparse | ask-sdk-webservice-support/ask_sdk_webservice_support/verifier.py | alexa/alexa-skills-kit-sdk-for-python | train | 560 |
53164e19a35cb504e347207fc5c6d28819da125e | [
"self.pitch = pitch\nself.frame_center = frame_center\nheight, width, channels = frame_shape\nself.return_circle_contours = return_circle_contours\nself.ball_tracker = BallTracker((0, width, 0, height), 0, pitch, calibration)\nself.circle_tracker = RobotTracker(['yellow', 'blue'], ['green', 'pink'], (0, width, 0, h... | <|body_start_0|>
self.pitch = pitch
self.frame_center = frame_center
height, width, channels = frame_shape
self.return_circle_contours = return_circle_contours
self.ball_tracker = BallTracker((0, width, 0, height), 0, pitch, calibration)
self.circle_tracker = RobotTracker... | Locate objects on the pitch. | Vision | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vision:
"""Locate objects on the pitch."""
def __init__(self, pitch, frame_shape, frame_center, calibration, robots, trackers_out, return_circle_contours=False, using_matlab=False):
"""Initialize the vision system. Params: [int] pitch pitch number (0 or 1) [string] color color of our... | stack_v2_sparse_classes_75kplus_train_000196 | 6,060 | no_license | [
{
"docstring": "Initialize the vision system. Params: [int] pitch pitch number (0 or 1) [string] color color of our robot [string] our_side our side [boolean] return_circle_contours - will return circle contours as well as calculated robot locations. Made for color calibration GUI. [boolean] using_matlab - will... | 3 | stack_v2_sparse_classes_30k_train_007170 | Implement the Python class `Vision` described below.
Class description:
Locate objects on the pitch.
Method signatures and docstrings:
- def __init__(self, pitch, frame_shape, frame_center, calibration, robots, trackers_out, return_circle_contours=False, using_matlab=False): Initialize the vision system. Params: [int... | Implement the Python class `Vision` described below.
Class description:
Locate objects on the pitch.
Method signatures and docstrings:
- def __init__(self, pitch, frame_shape, frame_center, calibration, robots, trackers_out, return_circle_contours=False, using_matlab=False): Initialize the vision system. Params: [int... | d3bf4195144240412d3696bbe9e1055e58f46c0d | <|skeleton|>
class Vision:
"""Locate objects on the pitch."""
def __init__(self, pitch, frame_shape, frame_center, calibration, robots, trackers_out, return_circle_contours=False, using_matlab=False):
"""Initialize the vision system. Params: [int] pitch pitch number (0 or 1) [string] color color of our... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vision:
"""Locate objects on the pitch."""
def __init__(self, pitch, frame_shape, frame_center, calibration, robots, trackers_out, return_circle_contours=False, using_matlab=False):
"""Initialize the vision system. Params: [int] pitch pitch number (0 or 1) [string] color color of our robot [strin... | the_stack_v2_python_sparse | vision.py | jsren/sdp-vision | train | 2 |
affe38a5d9fe6eec60007447d21ca353245f4f56 | [
"super(Block, self).__init__(source_info)\nself.stmts = []\nself.trace_event = 'block'",
"if self.frozen:\n return\nstmt.set_parent(self)\nself.stmts.append(stmt)",
"for stmt in self.stmts:\n if not isinstance(stmt, (ForLoop, IfScope, HighLevelAPIScope)):\n TikSourceInfo.register_source_info(source... | <|body_start_0|>
super(Block, self).__init__(source_info)
self.stmts = []
self.trace_event = 'block'
<|end_body_0|>
<|body_start_1|>
if self.frozen:
return
stmt.set_parent(self)
self.stmts.append(stmt)
<|end_body_1|>
<|body_start_2|>
for stmt in self... | Class Block inherits from STMT A block of statement. | Block | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Block:
"""Class Block inherits from STMT A block of statement."""
def __init__(self, source_info=''):
"""Initalize class Block. Parameters ---------- source_info:str Information of debugger Returns ---------- No returns"""
<|body_0|>
def add_stmt(self, stmt):
"""... | stack_v2_sparse_classes_75kplus_train_000197 | 42,515 | no_license | [
{
"docstring": "Initalize class Block. Parameters ---------- source_info:str Information of debugger Returns ---------- No returns",
"name": "__init__",
"signature": "def __init__(self, source_info='')"
},
{
"docstring": "Add stmt node to current node Parameters ---------- stmt:instance of STMT ... | 3 | stack_v2_sparse_classes_30k_train_042806 | Implement the Python class `Block` described below.
Class description:
Class Block inherits from STMT A block of statement.
Method signatures and docstrings:
- def __init__(self, source_info=''): Initalize class Block. Parameters ---------- source_info:str Information of debugger Returns ---------- No returns
- def a... | Implement the Python class `Block` described below.
Class description:
Class Block inherits from STMT A block of statement.
Method signatures and docstrings:
- def __init__(self, source_info=''): Initalize class Block. Parameters ---------- source_info:str Information of debugger Returns ---------- No returns
- def a... | 148511a31bfd195df889291946c43bb585acb546 | <|skeleton|>
class Block:
"""Class Block inherits from STMT A block of statement."""
def __init__(self, source_info=''):
"""Initalize class Block. Parameters ---------- source_info:str Information of debugger Returns ---------- No returns"""
<|body_0|>
def add_stmt(self, stmt):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Block:
"""Class Block inherits from STMT A block of statement."""
def __init__(self, source_info=''):
"""Initalize class Block. Parameters ---------- source_info:str Information of debugger Returns ---------- No returns"""
super(Block, self).__init__(source_info)
self.stmts = []
... | the_stack_v2_python_sparse | convertor/huawei/te/tik/debug/statement.py | jizhuoran/caffe-huawei-atlas-convertor | train | 4 |
b820b982d0de0643a0e782133ce27cbde15f55c5 | [
"self._headers = headers\nself._query_args = query_args\nself._data = data",
"if not self._headers:\n raise ValueError('This endpoint is not configured with a header model.')\nreturn self._headers",
"if not self._query_args:\n raise ValueError('This endpoint is not configured with a query args model.')\nr... | <|body_start_0|>
self._headers = headers
self._query_args = query_args
self._data = data
<|end_body_0|>
<|body_start_1|>
if not self._headers:
raise ValueError('This endpoint is not configured with a header model.')
return self._headers
<|end_body_1|>
<|body_start_2... | The class for parsed HTTP requests. | HTTPParsedRequest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTTPParsedRequest:
"""The class for parsed HTTP requests."""
def __init__(self, headers: Optional['Model']=None, query_args: Optional['Model']=None, data: Optional['Model']=None):
"""Initializes a parsed HTTP request. A parsed HTTP request includes the headers, query arguments, and p... | stack_v2_sparse_classes_75kplus_train_000198 | 8,821 | permissive | [
{
"docstring": "Initializes a parsed HTTP request. A parsed HTTP request includes the headers, query arguments, and payload of incoming request parsed in accordance with the data models specified with the receiving endpoint. Args: headers (Optional[Model]): The headers of the request. query_args (Optional[Model... | 4 | stack_v2_sparse_classes_30k_train_019557 | Implement the Python class `HTTPParsedRequest` described below.
Class description:
The class for parsed HTTP requests.
Method signatures and docstrings:
- def __init__(self, headers: Optional['Model']=None, query_args: Optional['Model']=None, data: Optional['Model']=None): Initializes a parsed HTTP request. A parsed ... | Implement the Python class `HTTPParsedRequest` described below.
Class description:
The class for parsed HTTP requests.
Method signatures and docstrings:
- def __init__(self, headers: Optional['Model']=None, query_args: Optional['Model']=None, data: Optional['Model']=None): Initializes a parsed HTTP request. A parsed ... | 32e84f072d03a6b3eff33920c929546c81969a64 | <|skeleton|>
class HTTPParsedRequest:
"""The class for parsed HTTP requests."""
def __init__(self, headers: Optional['Model']=None, query_args: Optional['Model']=None, data: Optional['Model']=None):
"""Initializes a parsed HTTP request. A parsed HTTP request includes the headers, query arguments, and p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HTTPParsedRequest:
"""The class for parsed HTTP requests."""
def __init__(self, headers: Optional['Model']=None, query_args: Optional['Model']=None, data: Optional['Model']=None):
"""Initializes a parsed HTTP request. A parsed HTTP request includes the headers, query arguments, and payload of inc... | the_stack_v2_python_sparse | src/nanopie/services/http/io.py | michaelawyu/nanopie | train | 1 |
4faf6a9397b8ae03356f9b4ee0714a22cd02e084 | [
"if root is None:\n return root\nmax_num = self.searchNode(root, 0)\nprint(max_num)\nreturn root",
"if node.right:\n right_total_value = self.searchNode(node.right, add_value)\n node.val += right_total_value\nelse:\n node.val += add_value\nreturn self.searchNode(node.left, node.val) if node.left else ... | <|body_start_0|>
if root is None:
return root
max_num = self.searchNode(root, 0)
print(max_num)
return root
<|end_body_0|>
<|body_start_1|>
if node.right:
right_total_value = self.searchNode(node.right, add_value)
node.val += right_total_value... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def convertBST(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def searchNode(self, node, add_value):
""":type node: TreeNode :type add_value: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is N... | stack_v2_sparse_classes_75kplus_train_000199 | 2,394 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "convertBST",
"signature": "def convertBST(self, root)"
},
{
"docstring": ":type node: TreeNode :type add_value: int :rtype: int",
"name": "searchNode",
"signature": "def searchNode(self, node, add_value)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def convertBST(self, root): :type root: TreeNode :rtype: TreeNode
- def searchNode(self, node, add_value): :type node: TreeNode :type add_value: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def convertBST(self, root): :type root: TreeNode :rtype: TreeNode
- def searchNode(self, node, add_value): :type node: TreeNode :type add_value: int :rtype: int
<|skeleton|>
cla... | f832227c4d0e0b1c0cc326561187004ef24e2a68 | <|skeleton|>
class Solution:
def convertBST(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def searchNode(self, node, add_value):
""":type node: TreeNode :type add_value: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def convertBST(self, root):
""":type root: TreeNode :rtype: TreeNode"""
if root is None:
return root
max_num = self.searchNode(root, 0)
print(max_num)
return root
def searchNode(self, node, add_value):
""":type node: TreeNode :type add... | the_stack_v2_python_sparse | 538.py | Gackle/leetcode_practice | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.