blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
a86aaa32392ebd18a23c7cfbe689989e7dafcb08
[ "behavior_id = uuid4()\nself.registered_behaviors.append((self.event.create_behavior(json_payload['name'], json_payload['parameters']), self.event.create_criteria(json_payload['criteria']), behavior_id))\nreturn behavior_id", "for behavior, criteria, _ in self.registered_behaviors:\n if criteria.evaluate(attri...
<|body_start_0|> behavior_id = uuid4() self.registered_behaviors.append((self.event.create_behavior(json_payload['name'], json_payload['parameters']), self.event.create_criteria(json_payload['criteria']), behavior_id)) return behavior_id <|end_body_0|> <|body_start_1|> for behavior, cri...
A registry of behavior. :ivar EventDescription event: The event this registry is operating for. :ivar registered_behaviors: The set of criteria and behaviors to use for this event. Currently this is just a list of tuples of (behavior, criteria, and uuid).
BehaviorRegistry
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BehaviorRegistry: """A registry of behavior. :ivar EventDescription event: The event this registry is operating for. :ivar registered_behaviors: The set of criteria and behaviors to use for this event. Currently this is just a list of tuples of (behavior, criteria, and uuid).""" def register...
stack_v2_sparse_classes_36k_train_004800
13,532
permissive
[ { "docstring": "Register a behavior with the given JSON payload from a request.", "name": "register_from_json", "signature": "def register_from_json(self, json_payload)" }, { "docstring": "Retrive a previously-registered behavior given the set of attributes.", "name": "behavior_for_attribute...
3
stack_v2_sparse_classes_30k_train_009871
Implement the Python class `BehaviorRegistry` described below. Class description: A registry of behavior. :ivar EventDescription event: The event this registry is operating for. :ivar registered_behaviors: The set of criteria and behaviors to use for this event. Currently this is just a list of tuples of (behavior, cr...
Implement the Python class `BehaviorRegistry` described below. Class description: A registry of behavior. :ivar EventDescription event: The event this registry is operating for. :ivar registered_behaviors: The set of criteria and behaviors to use for this event. Currently this is just a list of tuples of (behavior, cr...
8e7eeed84ec5ae97863f9330023298845623c639
<|skeleton|> class BehaviorRegistry: """A registry of behavior. :ivar EventDescription event: The event this registry is operating for. :ivar registered_behaviors: The set of criteria and behaviors to use for this event. Currently this is just a list of tuples of (behavior, criteria, and uuid).""" def register...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BehaviorRegistry: """A registry of behavior. :ivar EventDescription event: The event this registry is operating for. :ivar registered_behaviors: The set of criteria and behaviors to use for this event. Currently this is just a list of tuples of (behavior, criteria, and uuid).""" def register_from_json(se...
the_stack_v2_python_sparse
mimic/model/behaviors.py
ranjithpeddi/mimic
train
1
8da51f09e33e31f14ca61ee376e0577d436807c9
[ "super().__init__()\nif p < 0 or p >= 1:\n raise ValueError('dropout probability has to be in [0, 1), but got {}'.format(p))\nself.p = p\nself.tie = tie\nself.transposed = transposed\nself.binomial = torch.distributions.binomial.Binomial(probs=1 - self.p)", "if self.training:\n if not self.transposed:\n ...
<|body_start_0|> super().__init__() if p < 0 or p >= 1: raise ValueError('dropout probability has to be in [0, 1), but got {}'.format(p)) self.p = p self.tie = tie self.transposed = transposed self.binomial = torch.distributions.binomial.Binomial(probs=1 - sel...
DropoutNd
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DropoutNd: def __init__(self, p: float=0.5, tie=True, transposed=True): """Initialize dropout module. tie: tie dropout mask across sequence lengths (Dropout1d/2d/3d)""" <|body_0|> def forward(self, X): """Forward pass. X: (batch, dim, lengths...)""" <|body_1|...
stack_v2_sparse_classes_36k_train_004801
13,449
permissive
[ { "docstring": "Initialize dropout module. tie: tie dropout mask across sequence lengths (Dropout1d/2d/3d)", "name": "__init__", "signature": "def __init__(self, p: float=0.5, tie=True, transposed=True)" }, { "docstring": "Forward pass. X: (batch, dim, lengths...)", "name": "forward", "s...
2
null
Implement the Python class `DropoutNd` described below. Class description: Implement the DropoutNd class. Method signatures and docstrings: - def __init__(self, p: float=0.5, tie=True, transposed=True): Initialize dropout module. tie: tie dropout mask across sequence lengths (Dropout1d/2d/3d) - def forward(self, X): ...
Implement the Python class `DropoutNd` described below. Class description: Implement the DropoutNd class. Method signatures and docstrings: - def __init__(self, p: float=0.5, tie=True, transposed=True): Initialize dropout module. tie: tie dropout mask across sequence lengths (Dropout1d/2d/3d) - def forward(self, X): ...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class DropoutNd: def __init__(self, p: float=0.5, tie=True, transposed=True): """Initialize dropout module. tie: tie dropout mask across sequence lengths (Dropout1d/2d/3d)""" <|body_0|> def forward(self, X): """Forward pass. X: (batch, dim, lengths...)""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DropoutNd: def __init__(self, p: float=0.5, tie=True, transposed=True): """Initialize dropout module. tie: tie dropout mask across sequence lengths (Dropout1d/2d/3d)""" super().__init__() if p < 0 or p >= 1: raise ValueError('dropout probability has to be in [0, 1), but got...
the_stack_v2_python_sparse
espnet2/asr/state_spaces/components.py
espnet/espnet
train
7,242
e7f25cfe7b82e2dad2f5c71309aed325189091a8
[ "kwargs['default'] = default\nkwargs['types'] = (Frame, tuple, list)\nsuper().__init__(**kwargs)", "if isinstance(value, Frame):\n return value\nvalue = super().parse(value)\nif value is UNDEF or value is None:\n return value\nif callable(value):\n return value\nreturn Frame(*value)" ]
<|body_start_0|> kwargs['default'] = default kwargs['types'] = (Frame, tuple, list) super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> if isinstance(value, Frame): return value value = super().parse(value) if value is UNDEF or value is None: ...
Defines a frame property. The value must be provided as a pero.Frame or as a tuple or list of four values for left x, top y, width and height.
FrameProperty
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrameProperty: """Defines a frame property. The value must be provided as a pero.Frame or as a tuple or list of four values for left x, top y, width and height.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance of MarkerProperty.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_004802
13,091
permissive
[ { "docstring": "Initializes a new instance of MarkerProperty.", "name": "__init__", "signature": "def __init__(self, default=UNDEF, **kwargs)" }, { "docstring": "Validates and converts given value.", "name": "parse", "signature": "def parse(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_010690
Implement the Python class `FrameProperty` described below. Class description: Defines a frame property. The value must be provided as a pero.Frame or as a tuple or list of four values for left x, top y, width and height. Method signatures and docstrings: - def __init__(self, default=UNDEF, **kwargs): Initializes a n...
Implement the Python class `FrameProperty` described below. Class description: Defines a frame property. The value must be provided as a pero.Frame or as a tuple or list of four values for left x, top y, width and height. Method signatures and docstrings: - def __init__(self, default=UNDEF, **kwargs): Initializes a n...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class FrameProperty: """Defines a frame property. The value must be provided as a pero.Frame or as a tuple or list of four values for left x, top y, width and height.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance of MarkerProperty.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FrameProperty: """Defines a frame property. The value must be provided as a pero.Frame or as a tuple or list of four values for left x, top y, width and height.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance of MarkerProperty.""" kwargs['default'] = default ...
the_stack_v2_python_sparse
pero/drawing/frame.py
xxao/pero
train
31
484d834f1066b5fbf67d373aa2266dc9afe32dcc
[ "self.name = name\nself.filepath = path\nself.numparam = numparam\nself.pre_exec_callback = pre_exec_callback\nself.post_exec_callback = post_exec_callback\nself.cwd = cwd\nif sys.version_info[0] == 2 and sys.platform == 'win32':\n self.filepath = self.filepath.encode(sys.getfilesystemencoding())", "if len(arg...
<|body_start_0|> self.name = name self.filepath = path self.numparam = numparam self.pre_exec_callback = pre_exec_callback self.post_exec_callback = post_exec_callback self.cwd = cwd if sys.version_info[0] == 2 and sys.platform == 'win32': self.filepat...
Hook by executable file Implements standard githooks(5) [0]: [0] http://www.kernel.org/pub/software/scm/git/docs/githooks.html
ShellHook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShellHook: """Hook by executable file Implements standard githooks(5) [0]: [0] http://www.kernel.org/pub/software/scm/git/docs/githooks.html""" def __init__(self, name, path, numparam, pre_exec_callback=None, post_exec_callback=None, cwd=None): """Setup shell hook definition :param n...
stack_v2_sparse_classes_36k_train_004803
5,353
permissive
[ { "docstring": "Setup shell hook definition :param name: name of hook for error messages :param path: absolute path to executable file :param numparam: number of requirements parameters :param pre_exec_callback: closure for setup before execution Defaults to None. Takes in the variable argument list from the ex...
2
stack_v2_sparse_classes_30k_train_020941
Implement the Python class `ShellHook` described below. Class description: Hook by executable file Implements standard githooks(5) [0]: [0] http://www.kernel.org/pub/software/scm/git/docs/githooks.html Method signatures and docstrings: - def __init__(self, name, path, numparam, pre_exec_callback=None, post_exec_callb...
Implement the Python class `ShellHook` described below. Class description: Hook by executable file Implements standard githooks(5) [0]: [0] http://www.kernel.org/pub/software/scm/git/docs/githooks.html Method signatures and docstrings: - def __init__(self, name, path, numparam, pre_exec_callback=None, post_exec_callb...
d59c99dcdcd280d7eec36a693dd80f8c8c831ea2
<|skeleton|> class ShellHook: """Hook by executable file Implements standard githooks(5) [0]: [0] http://www.kernel.org/pub/software/scm/git/docs/githooks.html""" def __init__(self, name, path, numparam, pre_exec_callback=None, post_exec_callback=None, cwd=None): """Setup shell hook definition :param n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShellHook: """Hook by executable file Implements standard githooks(5) [0]: [0] http://www.kernel.org/pub/software/scm/git/docs/githooks.html""" def __init__(self, name, path, numparam, pre_exec_callback=None, post_exec_callback=None, cwd=None): """Setup shell hook definition :param name: name of ...
the_stack_v2_python_sparse
modules/dbnd/src/dbnd/_vendor/dulwich/hooks.py
databand-ai/dbnd
train
257
c603b1eb378134cb24286dac58e27273084a8ee2
[ "if keys_to_features is None:\n keys_to_features = {names.TfRecordFields.image_encoded: tf.FixedLenFeature((), tf.string, default_value=''), names.TfRecordFields.object_bbox_ymin: tf.VarLenFeature(tf.float32), names.TfRecordFields.object_bbox_xmin: tf.VarLenFeature(tf.float32), names.TfRecordFields.object_bbox_y...
<|body_start_0|> if keys_to_features is None: keys_to_features = {names.TfRecordFields.image_encoded: tf.FixedLenFeature((), tf.string, default_value=''), names.TfRecordFields.object_bbox_ymin: tf.VarLenFeature(tf.float32), names.TfRecordFields.object_bbox_xmin: tf.VarLenFeature(tf.float32), names.T...
Data decoder implements a `decode` method that converts a serialized protobuf string into tensors of desired shape and type.
DataDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataDecoder: """Data decoder implements a `decode` method that converts a serialized protobuf string into tensors of desired shape and type.""" def __init__(self, keys_to_features=None, load_masks=False): """Constructor. Args: keys_to_features: dict or None, a dict mapping from tenso...
stack_v2_sparse_classes_36k_train_004804
4,706
no_license
[ { "docstring": "Constructor. Args: keys_to_features: dict or None, a dict mapping from tensor names to feature parsers. If None, a default mapping will be built. load_masks: bool scalar, whether to load instance masks.", "name": "__init__", "signature": "def __init__(self, keys_to_features=None, load_ma...
2
stack_v2_sparse_classes_30k_train_004106
Implement the Python class `DataDecoder` described below. Class description: Data decoder implements a `decode` method that converts a serialized protobuf string into tensors of desired shape and type. Method signatures and docstrings: - def __init__(self, keys_to_features=None, load_masks=False): Constructor. Args: ...
Implement the Python class `DataDecoder` described below. Class description: Data decoder implements a `decode` method that converts a serialized protobuf string into tensors of desired shape and type. Method signatures and docstrings: - def __init__(self, keys_to_features=None, load_masks=False): Constructor. Args: ...
5a53e02c690632bcf140d1b17327959609aab395
<|skeleton|> class DataDecoder: """Data decoder implements a `decode` method that converts a serialized protobuf string into tensors of desired shape and type.""" def __init__(self, keys_to_features=None, load_masks=False): """Constructor. Args: keys_to_features: dict or None, a dict mapping from tenso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataDecoder: """Data decoder implements a `decode` method that converts a serialized protobuf string into tensors of desired shape and type.""" def __init__(self, keys_to_features=None, load_masks=False): """Constructor. Args: keys_to_features: dict or None, a dict mapping from tensor names to fe...
the_stack_v2_python_sparse
data/data_decoder.py
chao-ji/tf-detection
train
2
ba2b116d6e45cf8fd91004590a1d2c1f5a3dd4ce
[ "params = self.properties[self.TEMPLATE_PARAMS]\nparams[self.TEMPLATE_NAME] = self.physical_resource_name()\nparams['description'] = self.properties.get('description')\nLOG.debug('Vitrage params for template add: %s', params)\nadded_templates = self.client().template.add(template_str=self.properties[self.TEMPLATE_F...
<|body_start_0|> params = self.properties[self.TEMPLATE_PARAMS] params[self.TEMPLATE_NAME] = self.physical_resource_name() params['description'] = self.properties.get('description') LOG.debug('Vitrage params for template add: %s', params) added_templates = self.client().template....
A resource for managing Vitrage templates. A Vitrage template defines conditions and actions, based on the Vitrage topology graph. For example, if there is an "instance down" alarm on an instance, then execute a Mistral healing workflow. The VitrageTemplate resource generates and adds to Vitrage a template based on the...
VitrageTemplate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VitrageTemplate: """A resource for managing Vitrage templates. A Vitrage template defines conditions and actions, based on the Vitrage topology graph. For example, if there is an "instance down" alarm on an instance, then execute a Mistral healing workflow. The VitrageTemplate resource generates ...
stack_v2_sparse_classes_36k_train_004805
4,889
permissive
[ { "docstring": "Create a Vitrage template.", "name": "handle_create", "signature": "def handle_create(self)" }, { "docstring": "Delete the Vitrage template.", "name": "handle_delete", "signature": "def handle_delete(self)" }, { "docstring": "Validate a Vitrage template.", "na...
3
stack_v2_sparse_classes_30k_train_013455
Implement the Python class `VitrageTemplate` described below. Class description: A resource for managing Vitrage templates. A Vitrage template defines conditions and actions, based on the Vitrage topology graph. For example, if there is an "instance down" alarm on an instance, then execute a Mistral healing workflow. ...
Implement the Python class `VitrageTemplate` described below. Class description: A resource for managing Vitrage templates. A Vitrage template defines conditions and actions, based on the Vitrage topology graph. For example, if there is an "instance down" alarm on an instance, then execute a Mistral healing workflow. ...
a4ac653e35f16a5787bc5a2c934736656294b9b6
<|skeleton|> class VitrageTemplate: """A resource for managing Vitrage templates. A Vitrage template defines conditions and actions, based on the Vitrage topology graph. For example, if there is an "instance down" alarm on an instance, then execute a Mistral healing workflow. The VitrageTemplate resource generates ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VitrageTemplate: """A resource for managing Vitrage templates. A Vitrage template defines conditions and actions, based on the Vitrage topology graph. For example, if there is an "instance down" alarm on an instance, then execute a Mistral healing workflow. The VitrageTemplate resource generates and adds to V...
the_stack_v2_python_sparse
heat/engine/resources/openstack/vitrage/vitrage_template.py
stackriot/heat
train
0
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/booking/abort/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/booking/abort/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_co...
<|body_start_0|> url = '/booking/abort/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/booking/abort/' self.client.login(username=self.adminUN, password='pass') response = s...
This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ============================== 29/10/2018 SE.
BookingAbortTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookingAbortTestCase: """This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ===========...
stack_v2_sparse_classes_36k_train_004806
26,818
permissive
[ { "docstring": "Test that the booking abort view will display an error whilst not logged in and no booking.", "name": "test_not_logged_in_no_booking", "signature": "def test_not_logged_in_no_booking(self)" }, { "docstring": "Test that the booking abort view will display an error whilst logged in...
3
null
Implement the Python class `BookingAbortTestCase` described below. Class description: This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the cu...
Implement the Python class `BookingAbortTestCase` described below. Class description: This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the cu...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class BookingAbortTestCase: """This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ===========...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookingAbortTestCase: """This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ========================...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
7e211fd2c0414dcfea889002ba45d2d8c6c78b07
[ "try:\n function = await self.application.objects.get(FunctionGenerator, id=int(function_id))\n await self.application.objects.delete(function)\n return self.json(JsonResponse(code=1, data={'functionId': function_id}))\nexcept FunctionGenerator.DoesNotExist:\n self.set_status(400)\n return self.json(...
<|body_start_0|> try: function = await self.application.objects.get(FunctionGenerator, id=int(function_id)) await self.application.objects.delete(function) return self.json(JsonResponse(code=1, data={'functionId': function_id})) except FunctionGenerator.DoesNotExist: ...
FunctionChangeHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionChangeHandler: async def delete(self, function_id, *args, **kwargs): """删除内置函数数据 :param function_id: 删除内置函数数据id""" <|body_0|> async def patch(self, function_id, *args, **kwargs): """更新内置函数数据 :param function_id: 更新内置函数数据的id""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_004807
17,374
permissive
[ { "docstring": "删除内置函数数据 :param function_id: 删除内置函数数据id", "name": "delete", "signature": "async def delete(self, function_id, *args, **kwargs)" }, { "docstring": "更新内置函数数据 :param function_id: 更新内置函数数据的id", "name": "patch", "signature": "async def patch(self, function_id, *args, **kwargs)...
2
stack_v2_sparse_classes_30k_train_016873
Implement the Python class `FunctionChangeHandler` described below. Class description: Implement the FunctionChangeHandler class. Method signatures and docstrings: - async def delete(self, function_id, *args, **kwargs): 删除内置函数数据 :param function_id: 删除内置函数数据id - async def patch(self, function_id, *args, **kwargs): 更新内...
Implement the Python class `FunctionChangeHandler` described below. Class description: Implement the FunctionChangeHandler class. Method signatures and docstrings: - async def delete(self, function_id, *args, **kwargs): 删除内置函数数据 :param function_id: 删除内置函数数据id - async def patch(self, function_id, *args, **kwargs): 更新内...
dc9b4c55f0b3ace180c30b7f080eb5d88bb38fdb
<|skeleton|> class FunctionChangeHandler: async def delete(self, function_id, *args, **kwargs): """删除内置函数数据 :param function_id: 删除内置函数数据id""" <|body_0|> async def patch(self, function_id, *args, **kwargs): """更新内置函数数据 :param function_id: 更新内置函数数据的id""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FunctionChangeHandler: async def delete(self, function_id, *args, **kwargs): """删除内置函数数据 :param function_id: 删除内置函数数据id""" try: function = await self.application.objects.get(FunctionGenerator, id=int(function_id)) await self.application.objects.delete(function) ...
the_stack_v2_python_sparse
apps/project/handlers.py
xiaoxiaolulu/MagicTestPlatform
train
5
27481856715f916d6c24c0199ed6a921390b783b
[ "stack = [0]\nresult = heights[0]\nheights = [0] + heights + [0]\nfor i in range(1, len(heights)):\n if heights[stack[-1]] < heights[i]:\n stack.append(i)\n elif heights[stack[-1]] == heights[i]:\n stack[-1] = i\n else:\n while stack and heights[stack[-1]] > heights[i]:\n mi...
<|body_start_0|> stack = [0] result = heights[0] heights = [0] + heights + [0] for i in range(1, len(heights)): if heights[stack[-1]] < heights[i]: stack.append(i) elif heights[stack[-1]] == heights[i]: stack[-1] = i els...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """单调栈 栈内元素对应的 heights 是从大到小(从栈顶到栈底)""" <|body_0|> def dp(self, heights): """尝试使用动态规划""" <|body_1|> <|end_skeleton|> <|body_start_0|> stack = [0] result = heights[0] heights = [0] + ...
stack_v2_sparse_classes_36k_train_004808
2,027
no_license
[ { "docstring": "单调栈 栈内元素对应的 heights 是从大到小(从栈顶到栈底)", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights)" }, { "docstring": "尝试使用动态规划", "name": "dp", "signature": "def dp(self, heights)" } ]
2
stack_v2_sparse_classes_30k_train_020560
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): 单调栈 栈内元素对应的 heights 是从大到小(从栈顶到栈底) - def dp(self, heights): 尝试使用动态规划
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): 单调栈 栈内元素对应的 heights 是从大到小(从栈顶到栈底) - def dp(self, heights): 尝试使用动态规划 <|skeleton|> class Solution: def largestRectangleArea(self, hei...
be46de7cdd29557c01d4b89f1c2f638e055b6d70
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """单调栈 栈内元素对应的 heights 是从大到小(从栈顶到栈底)""" <|body_0|> def dp(self, heights): """尝试使用动态规划""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestRectangleArea(self, heights): """单调栈 栈内元素对应的 heights 是从大到小(从栈顶到栈底)""" stack = [0] result = heights[0] heights = [0] + heights + [0] for i in range(1, len(heights)): if heights[stack[-1]] < heights[i]: stack.append(i) ...
the_stack_v2_python_sparse
python/No84.py
OhOHOh/LeetCodePractice
train
0
d2e06a0adebc7fe5a7f02aee935a55695c7562ff
[ "while i < j:\n if string[i] != string[j]:\n return False\n i += 1\n j -= 1\nreturn True", "if start == len(string):\n result.append(curr_res[:])\n return\nfor i in range(start, len(string)):\n if self.is_palindrome(string, start, i):\n curr_res.append(string[start:i + 1])\n ...
<|body_start_0|> while i < j: if string[i] != string[j]: return False i += 1 j -= 1 return True <|end_body_0|> <|body_start_1|> if start == len(string): result.append(curr_res[:]) return for i in range(start, le...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_palindrome(self, string, i, j): """Returns True if string from index i to j is a palindrome, False otherwise.""" <|body_0|> def find_partition(self, string, start, curr_res, result): """Helper function for function partition.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_004809
1,712
no_license
[ { "docstring": "Returns True if string from index i to j is a palindrome, False otherwise.", "name": "is_palindrome", "signature": "def is_palindrome(self, string, i, j)" }, { "docstring": "Helper function for function partition.", "name": "find_partition", "signature": "def find_partiti...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_palindrome(self, string, i, j): Returns True if string from index i to j is a palindrome, False otherwise. - def find_partition(self, string, start, curr_res, result): Hel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_palindrome(self, string, i, j): Returns True if string from index i to j is a palindrome, False otherwise. - def find_partition(self, string, start, curr_res, result): Hel...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def is_palindrome(self, string, i, j): """Returns True if string from index i to j is a palindrome, False otherwise.""" <|body_0|> def find_partition(self, string, start, curr_res, result): """Helper function for function partition.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def is_palindrome(self, string, i, j): """Returns True if string from index i to j is a palindrome, False otherwise.""" while i < j: if string[i] != string[j]: return False i += 1 j -= 1 return True def find_partition(s...
the_stack_v2_python_sparse
Backtracking/palindrome_partitioning.py
vladn90/Algorithms
train
0
832266a9b594fad872c40bc323f2563ee6432334
[ "stringX = format(x, 'b').zfill(32)\nstringY = format(y, 'b').zfill(32)\ndistance = 0\nfor i, chX in enumerate(stringX):\n chY = stringY[i]\n if chX != chY:\n distance += 1\nreturn distance", "totalDistance = 0\nfor i in xrange(len(nums)):\n for j in xrange(i + 1, len(nums)):\n x = nums[i]\...
<|body_start_0|> stringX = format(x, 'b').zfill(32) stringY = format(y, 'b').zfill(32) distance = 0 for i, chX in enumerate(stringX): chY = stringY[i] if chX != chY: distance += 1 return distance <|end_body_0|> <|body_start_1|> tot...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_0|> def totalHammingDistance(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> stringX = format(x, 'b').zfi...
stack_v2_sparse_classes_36k_train_004810
1,447
no_license
[ { "docstring": ":type x: int :type y: int :rtype: int", "name": "hammingDistance", "signature": "def hammingDistance(self, x, y)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "totalHammingDistance", "signature": "def totalHammingDistance(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int - def totalHammingDistance(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int - def totalHammingDistance(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
6fc170c04fadec6966fb7938a07474d4ee107b61
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" <|body_0|> def totalHammingDistance(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int""" stringX = format(x, 'b').zfill(32) stringY = format(y, 'b').zfill(32) distance = 0 for i, chX in enumerate(stringX): chY = stringY[i] if chX != chY: ...
the_stack_v2_python_sparse
leetcode477.py
JoshuaW1990/leetcode-session1
train
0
7ff20d2f3817695fbe07377b00deb27d0b3d0b72
[ "super().__init__(serialName, debug)\nself.bytesStuffed = 0\nself.createCOM(serialName)\nself.run()", "stop = False\nwhile not stop:\n print()\n self.getFile()\n self.checkBytes()\n self.buildHead()\n self.packet = self.head + self.fileBA + self.eop\n self.overhead = len(self.packet) / len(self....
<|body_start_0|> super().__init__(serialName, debug) self.bytesStuffed = 0 self.createCOM(serialName) self.run() <|end_body_0|> <|body_start_1|> stop = False while not stop: print() self.getFile() self.checkBytes() self.bui...
Client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: def __init__(self, serialName, debug): """Executed when the object is created. Used to create all needed attributes.""" <|body_0|> def run(self): """Runs all the logic needed to send a file and receive a response.""" <|body_1|> def checkBytes(sel...
stack_v2_sparse_classes_36k_train_004811
12,431
no_license
[ { "docstring": "Executed when the object is created. Used to create all needed attributes.", "name": "__init__", "signature": "def __init__(self, serialName, debug)" }, { "docstring": "Runs all the logic needed to send a file and receive a response.", "name": "run", "signature": "def run...
5
stack_v2_sparse_classes_30k_test_000229
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def __init__(self, serialName, debug): Executed when the object is created. Used to create all needed attributes. - def run(self): Runs all the logic needed to send a file and receiv...
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def __init__(self, serialName, debug): Executed when the object is created. Used to create all needed attributes. - def run(self): Runs all the logic needed to send a file and receiv...
e8c6ee9672ad33c568d97ec07c3faa6dbf9359ac
<|skeleton|> class Client: def __init__(self, serialName, debug): """Executed when the object is created. Used to create all needed attributes.""" <|body_0|> def run(self): """Runs all the logic needed to send a file and receive a response.""" <|body_1|> def checkBytes(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: def __init__(self, serialName, debug): """Executed when the object is created. Used to create all needed attributes.""" super().__init__(serialName, debug) self.bytesStuffed = 0 self.createCOM(serialName) self.run() def run(self): """Runs all the lo...
the_stack_v2_python_sparse
Projeto2/aplicacao.py
VFermat/CamadaFisica
train
1
e0d3fd0e0b7563cdde1016e0236299cb0d3b6369
[ "self.screen = turtle.Screen()\nself.screen.bgcolor('lightgrey')\nself.turtle = turtle.Turtle(shape='turtle')\nself.turtle.pensize(3)", "self.turtle.penup()\nself.turtle.setposition(x, y)\nself.turtle.pendown()\nself.turtle.color(color)\nself.turtle.pensize(10)\nself.turtle.circle(radius)", "positions = [(0, 0,...
<|body_start_0|> self.screen = turtle.Screen() self.screen.bgcolor('lightgrey') self.turtle = turtle.Turtle(shape='turtle') self.turtle.pensize(3) <|end_body_0|> <|body_start_1|> self.turtle.penup() self.turtle.setposition(x, y) self.turtle.pendown() self...
MyTurtle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTurtle: def __init__(self): """Turtle Constructor""" <|body_0|> def draw_circle(self, x, y, color, radius=50): """Moves the turtle to the correct position and draws a circle""" <|body_1|> def draw_olympic_symbol(self): """Iterates over a set of...
stack_v2_sparse_classes_36k_train_004812
1,583
permissive
[ { "docstring": "Turtle Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Moves the turtle to the correct position and draws a circle", "name": "draw_circle", "signature": "def draw_circle(self, x, y, color, radius=50)" }, { "docstring": "Itera...
4
stack_v2_sparse_classes_30k_train_008130
Implement the Python class `MyTurtle` described below. Class description: Implement the MyTurtle class. Method signatures and docstrings: - def __init__(self): Turtle Constructor - def draw_circle(self, x, y, color, radius=50): Moves the turtle to the correct position and draws a circle - def draw_olympic_symbol(self...
Implement the Python class `MyTurtle` described below. Class description: Implement the MyTurtle class. Method signatures and docstrings: - def __init__(self): Turtle Constructor - def draw_circle(self, x, y, color, radius=50): Moves the turtle to the correct position and draws a circle - def draw_olympic_symbol(self...
63b448a35c5668790720d0fe414600510b9fe61a
<|skeleton|> class MyTurtle: def __init__(self): """Turtle Constructor""" <|body_0|> def draw_circle(self, x, y, color, radius=50): """Moves the turtle to the correct position and draws a circle""" <|body_1|> def draw_olympic_symbol(self): """Iterates over a set of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyTurtle: def __init__(self): """Turtle Constructor""" self.screen = turtle.Screen() self.screen.bgcolor('lightgrey') self.turtle = turtle.Turtle(shape='turtle') self.turtle.pensize(3) def draw_circle(self, x, y, color, radius=50): """Moves the turtle to th...
the_stack_v2_python_sparse
algorithm/python-algorithm/other-tools/turtle-graphics/drawOlypicSymbol.py
wangdingqiao/programmer-evolution-plan
train
4
50d44d0369da919acc494f6e9d7c2a2383474c61
[ "contacts = self.load('contact_info', {})\ncontacts[message.sender.handle] = {'info': contact_info, 'name': message.sender.name}\nself.save('contact_info', contacts)\nself.say('Got it.', message=message)", "contacts = self.load('contact_info', {})\ncontext = {'contacts': contacts}\ncontact_html = rendered_templat...
<|body_start_0|> contacts = self.load('contact_info', {}) contacts[message.sender.handle] = {'info': contact_info, 'name': message.sender.name} self.save('contact_info', contacts) self.say('Got it.', message=message) <|end_body_0|> <|body_start_1|> contacts = self.load('contact_...
EmergencyContactsPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmergencyContactsPlugin: def set_my_info(self, message, contact_info=''): """set my contact info to ____: Set your emergency contact info.""" <|body_0|> def respond_to_contact_info(self, message): """contact info: Show everyone's emergency contact info.""" <|...
stack_v2_sparse_classes_36k_train_004813
1,049
permissive
[ { "docstring": "set my contact info to ____: Set your emergency contact info.", "name": "set_my_info", "signature": "def set_my_info(self, message, contact_info='')" }, { "docstring": "contact info: Show everyone's emergency contact info.", "name": "respond_to_contact_info", "signature":...
2
stack_v2_sparse_classes_30k_train_018581
Implement the Python class `EmergencyContactsPlugin` described below. Class description: Implement the EmergencyContactsPlugin class. Method signatures and docstrings: - def set_my_info(self, message, contact_info=''): set my contact info to ____: Set your emergency contact info. - def respond_to_contact_info(self, m...
Implement the Python class `EmergencyContactsPlugin` described below. Class description: Implement the EmergencyContactsPlugin class. Method signatures and docstrings: - def set_my_info(self, message, contact_info=''): set my contact info to ____: Set your emergency contact info. - def respond_to_contact_info(self, m...
27a23ce47e3ec11b94f3355c2d2ee94c1958679c
<|skeleton|> class EmergencyContactsPlugin: def set_my_info(self, message, contact_info=''): """set my contact info to ____: Set your emergency contact info.""" <|body_0|> def respond_to_contact_info(self, message): """contact info: Show everyone's emergency contact info.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmergencyContactsPlugin: def set_my_info(self, message, contact_info=''): """set my contact info to ____: Set your emergency contact info.""" contacts = self.load('contact_info', {}) contacts[message.sender.handle] = {'info': contact_info, 'name': message.sender.name} self.save...
the_stack_v2_python_sparse
will/plugins/devops/emergency_contacts.py
skoczen/will
train
359
cc6a00b13cb5b167ea90298332034e3927bc856b
[ "l_icd = InternetConnectionData()\nl_xml = p_pyhouse_obj.Xml.XmlRoot\ntry:\n l_xml = l_xml.find('ComputerDivision')\n if l_xml == None:\n return l_icd\n l_internet_sect_xml = l_xml.find('InternetSection')\nexcept AttributeError as e_err:\n l_internet_sect_xml = None\n LOG.error('Internet secti...
<|body_start_0|> l_icd = InternetConnectionData() l_xml = p_pyhouse_obj.Xml.XmlRoot try: l_xml = l_xml.find('ComputerDivision') if l_xml == None: return l_icd l_internet_sect_xml = l_xml.find('InternetSection') except AttributeError as ...
API
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class API: def read_internet_xml(self, p_pyhouse_obj): """Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element""" <|body_0|> def write_internet_xml(self, p_internet_obj): """Create a sub tree for...
stack_v2_sparse_classes_36k_train_004814
4,554
permissive
[ { "docstring": "Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element", "name": "read_internet_xml", "signature": "def read_internet_xml(self, p_pyhouse_obj)" }, { "docstring": "Create a sub tree for 'Internet' - the su...
2
stack_v2_sparse_classes_30k_train_012369
Implement the Python class `API` described below. Class description: Implement the API class. Method signatures and docstrings: - def read_internet_xml(self, p_pyhouse_obj): Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element - def write_i...
Implement the Python class `API` described below. Class description: Implement the API class. Method signatures and docstrings: - def read_internet_xml(self, p_pyhouse_obj): Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element - def write_i...
6444ed0b4c38ab59b9e419e4d54d65d598e6a54e
<|skeleton|> class API: def read_internet_xml(self, p_pyhouse_obj): """Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element""" <|body_0|> def write_internet_xml(self, p_internet_obj): """Create a sub tree for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class API: def read_internet_xml(self, p_pyhouse_obj): """Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element""" l_icd = InternetConnectionData() l_xml = p_pyhouse_obj.Xml.XmlRoot try: l_xml = ...
the_stack_v2_python_sparse
src/Modules/Computer/Internet/internet_xml.py
bopopescu/PyHouse_1
train
0
eeff7d8398e41d3b464f7fbe3240a59588c1cea5
[ "length = len(nums)\noutput = [1] * length\nleft = 1\nright = 1\nfor i in range(0, length - 1):\n left = left * nums[i]\n output[i + 1] = output[i + 1] * left\nfor i in range(length - 1, 0, -1):\n right = right * nums[i]\n output[i - 1] = output[i - 1] * right\nreturn output", "numForZero = 0\nproduct...
<|body_start_0|> length = len(nums) output = [1] * length left = 1 right = 1 for i in range(0, length - 1): left = left * nums[i] output[i + 1] = output[i + 1] * left for i in range(length - 1, 0, -1): right = right * nums[i] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf_1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(nums) ...
stack_v2_sparse_classes_36k_train_004815
1,925
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelf_1", "signature": "def productExceptSelf_1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_017980
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf_1(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf_1(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solu...
ba58ac60b32e261e43482d7e71b32587700e3719
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf_1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" length = len(nums) output = [1] * length left = 1 right = 1 for i in range(0, length - 1): left = left * nums[i] output[i + 1] = output[i + 1] * le...
the_stack_v2_python_sparse
python/238_product_of_array_except_self.py
lingng/Leetcode
train
0
9377d4901bc563fee6c99a6caadccba0f29b8907
[ "self.master = master\nmaster.grid_rowconfigure(0, weight=1)\nmaster.grid_columnconfigure(0, weight=1)\nself.main_frame = tkin.Frame(master, bg='#1e1e1e')\nself.main_frame.grid(row=0, column=0, sticky='nsew')\nself._invis_pic = tkin.PhotoImage(width=1, height=1)", "self.master.bind('<Tab>', self.toggle_menu)\nsel...
<|body_start_0|> self.master = master master.grid_rowconfigure(0, weight=1) master.grid_columnconfigure(0, weight=1) self.main_frame = tkin.Frame(master, bg='#1e1e1e') self.main_frame.grid(row=0, column=0, sticky='nsew') self._invis_pic = tkin.PhotoImage(width=1, height=1...
Class for easily importing a menu system.
MainWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainWindow: """Class for easily importing a menu system.""" def __init__(self, master): """Set default parameters on initialization.""" <|body_0|> def initialize_menu(self, title=''): """Create menu system.""" <|body_1|> def toggle_menu(self, event):...
stack_v2_sparse_classes_36k_train_004816
3,599
no_license
[ { "docstring": "Set default parameters on initialization.", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Create menu system.", "name": "initialize_menu", "signature": "def initialize_menu(self, title='')" }, { "docstring": "Toggle menu displaye...
3
stack_v2_sparse_classes_30k_train_020698
Implement the Python class `MainWindow` described below. Class description: Class for easily importing a menu system. Method signatures and docstrings: - def __init__(self, master): Set default parameters on initialization. - def initialize_menu(self, title=''): Create menu system. - def toggle_menu(self, event): Tog...
Implement the Python class `MainWindow` described below. Class description: Class for easily importing a menu system. Method signatures and docstrings: - def __init__(self, master): Set default parameters on initialization. - def initialize_menu(self, title=''): Create menu system. - def toggle_menu(self, event): Tog...
e452817429195593e9c7cd89fe052bd8ed89943a
<|skeleton|> class MainWindow: """Class for easily importing a menu system.""" def __init__(self, master): """Set default parameters on initialization.""" <|body_0|> def initialize_menu(self, title=''): """Create menu system.""" <|body_1|> def toggle_menu(self, event):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainWindow: """Class for easily importing a menu system.""" def __init__(self, master): """Set default parameters on initialization.""" self.master = master master.grid_rowconfigure(0, weight=1) master.grid_columnconfigure(0, weight=1) self.main_frame = tkin.Frame(...
the_stack_v2_python_sparse
project_timeline/assets/menu.py
Keiyrti/python_projects
train
0
2f7f96651680258aa1de5c4fc824f47e7c2f92cb
[ "Module.__init__(self)\nself.row = -1\nself.col = -1\nself.rowSpan = -1\nself.colSpan = -1\nself.sheetReference = None", "def set_row_col(row, col):\n try:\n self.col = ord(col) - ord('A')\n self.row = int(row) - 1\n except:\n raise ModuleError(self, 'ColumnRowAddress format error')\nre...
<|body_start_0|> Module.__init__(self) self.row = -1 self.col = -1 self.rowSpan = -1 self.colSpan = -1 self.sheetReference = None <|end_body_0|> <|body_start_1|> def set_row_col(row, col): try: self.col = ord(col) - ord('A') ...
CellLocation is a Vistrail Module that allow users to specify where to put a visualization on a sheet, i.e. row, column location
CellLocation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CellLocation: """CellLocation is a Vistrail Module that allow users to specify where to put a visualization on a sheet, i.e. row, column location""" def __init__(self): """CellLocation() -> CellLocation Instantiate an empty cell location, i.e. any available cell""" <|body_0|>...
stack_v2_sparse_classes_36k_train_004817
10,309
permissive
[ { "docstring": "CellLocation() -> CellLocation Instantiate an empty cell location, i.e. any available cell", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "compute() -> None Translate input ports into (row, column) location", "name": "compute", "signature": "def...
2
null
Implement the Python class `CellLocation` described below. Class description: CellLocation is a Vistrail Module that allow users to specify where to put a visualization on a sheet, i.e. row, column location Method signatures and docstrings: - def __init__(self): CellLocation() -> CellLocation Instantiate an empty cel...
Implement the Python class `CellLocation` described below. Class description: CellLocation is a Vistrail Module that allow users to specify where to put a visualization on a sheet, i.e. row, column location Method signatures and docstrings: - def __init__(self): CellLocation() -> CellLocation Instantiate an empty cel...
23ef56ec24b85c82416e1437a08381635328abe5
<|skeleton|> class CellLocation: """CellLocation is a Vistrail Module that allow users to specify where to put a visualization on a sheet, i.e. row, column location""" def __init__(self): """CellLocation() -> CellLocation Instantiate an empty cell location, i.e. any available cell""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CellLocation: """CellLocation is a Vistrail Module that allow users to specify where to put a visualization on a sheet, i.e. row, column location""" def __init__(self): """CellLocation() -> CellLocation Instantiate an empty cell location, i.e. any available cell""" Module.__init__(self) ...
the_stack_v2_python_sparse
vistrails_current/vistrails/packages/spreadsheet/basic_widgets.py
lumig242/VisTrailsRecommendation
train
3
341d162608288e729940124af1ae357f3ccc90e4
[ "page = request.args.get('page', 1, type=int)\nper_page = current_app.config['AWESOME_POST_PER_PAGE']\npagination = Post.query.with_parent(g.current_user).paginate(page, per_page)\nposts = pagination.items\ncurrent = url_for('.current_user_posts', page=page, _external=True)\nprev = None\nif pagination.has_prev:\n ...
<|body_start_0|> page = request.args.get('page', 1, type=int) per_page = current_app.config['AWESOME_POST_PER_PAGE'] pagination = Post.query.with_parent(g.current_user).paginate(page, per_page) posts = pagination.items current = url_for('.current_user_posts', page=page, _external...
CurrentUserPostsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrentUserPostsAPI: def get(self): """Get current user's all posts.""" <|body_0|> def post(self): """Create new post.""" <|body_1|> <|end_skeleton|> <|body_start_0|> page = request.args.get('page', 1, type=int) per_page = current_app.config...
stack_v2_sparse_classes_36k_train_004818
7,567
permissive
[ { "docstring": "Get current user's all posts.", "name": "get", "signature": "def get(self)" }, { "docstring": "Create new post.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_008380
Implement the Python class `CurrentUserPostsAPI` described below. Class description: Implement the CurrentUserPostsAPI class. Method signatures and docstrings: - def get(self): Get current user's all posts. - def post(self): Create new post.
Implement the Python class `CurrentUserPostsAPI` described below. Class description: Implement the CurrentUserPostsAPI class. Method signatures and docstrings: - def get(self): Get current user's all posts. - def post(self): Create new post. <|skeleton|> class CurrentUserPostsAPI: def get(self): """Get ...
dd5cf5f1ae9df0d2d25e41c113df50b16a8465e7
<|skeleton|> class CurrentUserPostsAPI: def get(self): """Get current user's all posts.""" <|body_0|> def post(self): """Create new post.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurrentUserPostsAPI: def get(self): """Get current user's all posts.""" page = request.args.get('page', 1, type=int) per_page = current_app.config['AWESOME_POST_PER_PAGE'] pagination = Post.query.with_parent(g.current_user).paginate(page, per_page) posts = pagination.it...
the_stack_v2_python_sparse
awesome_flask_webapp/apis/v1/resources.py
yeh-George/awesome-flask-webapp
train
0
e7085d064b12f79c494c6e711c10d8c47f98ac1b
[ "self.widgetConfigs = ConvertConfigsToDictionary(widgetConfigs)\nself.modConfigs = ConvertConfigsToDictionary(modConfigs)\nself.positioningConfigs = ConvertConfigsToDictionary(positioningConfigs)\nself.sizingConfigs = ConvertConfigsToDictionary(sizingConfigs)\nself.serviceConfigs = ConvertConfigsToDictionary(servic...
<|body_start_0|> self.widgetConfigs = ConvertConfigsToDictionary(widgetConfigs) self.modConfigs = ConvertConfigsToDictionary(modConfigs) self.positioningConfigs = ConvertConfigsToDictionary(positioningConfigs) self.sizingConfigs = ConvertConfigsToDictionary(sizingConfigs) self.se...
Represents the configuration for a knot package
PackageConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageConfig: """Represents the configuration for a knot package""" def __init__(self, widgetConfigs, modConfigs, positioningConfigs, sizingConfigs, serviceConfigs): """Initialize the widget config with its widgets, positioning policies and sizing policies""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_004819
957
no_license
[ { "docstring": "Initialize the widget config with its widgets, positioning policies and sizing policies", "name": "__init__", "signature": "def __init__(self, widgetConfigs, modConfigs, positioningConfigs, sizingConfigs, serviceConfigs)" }, { "docstring": "Set the package filename", "name": ...
2
stack_v2_sparse_classes_30k_train_004384
Implement the Python class `PackageConfig` described below. Class description: Represents the configuration for a knot package Method signatures and docstrings: - def __init__(self, widgetConfigs, modConfigs, positioningConfigs, sizingConfigs, serviceConfigs): Initialize the widget config with its widgets, positionin...
Implement the Python class `PackageConfig` described below. Class description: Represents the configuration for a knot package Method signatures and docstrings: - def __init__(self, widgetConfigs, modConfigs, positioningConfigs, sizingConfigs, serviceConfigs): Initialize the widget config with its widgets, positionin...
19b7bf08658ce329c7b076ce2014bae9f5f09268
<|skeleton|> class PackageConfig: """Represents the configuration for a knot package""" def __init__(self, widgetConfigs, modConfigs, positioningConfigs, sizingConfigs, serviceConfigs): """Initialize the widget config with its widgets, positioning policies and sizing policies""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PackageConfig: """Represents the configuration for a knot package""" def __init__(self, widgetConfigs, modConfigs, positioningConfigs, sizingConfigs, serviceConfigs): """Initialize the widget config with its widgets, positioning policies and sizing policies""" self.widgetConfigs = Convert...
the_stack_v2_python_sparse
src/knot/loader/config/package_config.py
cloew/Knot
train
1
f0bdc18bbdc65c9e968d24215b8e50bef2352cc7
[ "super(Conv1dSubsampling3, self).__init__()\nself.conv = torch.nn.Sequential(torch.nn.Conv1d(idim, odim, 3, 1), torch.nn.ReLU(), torch.nn.Conv1d(odim, odim, 5, 3), torch.nn.ReLU())\nself.out = torch.nn.Sequential(torch.nn.Linear(odim, odim), pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate)...
<|body_start_0|> super(Conv1dSubsampling3, self).__init__() self.conv = torch.nn.Sequential(torch.nn.Conv1d(idim, odim, 3, 1), torch.nn.ReLU(), torch.nn.Conv1d(odim, odim, 5, 3), torch.nn.ReLU()) self.out = torch.nn.Sequential(torch.nn.Linear(odim, odim), pos_enc if pos_enc is not None else Posi...
Convolutional 1D subsampling (to 1/3 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.
Conv1dSubsampling3
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv1dSubsampling3: """Convolutional 1D subsampling (to 1/3 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): ...
stack_v2_sparse_classes_36k_train_004820
14,351
permissive
[ { "docstring": "Construct an Conv1dSubsampling3 object.", "name": "__init__", "signature": "def __init__(self, idim, odim, dropout_rate, pos_enc=None)" }, { "docstring": "Subsample x. Args: x (torch.Tensor): Input tensor (#batch, time, idim). x_mask (torch.Tensor): Input mask (#batch, 1, time). ...
3
null
Implement the Python class `Conv1dSubsampling3` described below. Class description: Convolutional 1D subsampling (to 1/3 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer. Method signatures and docstr...
Implement the Python class `Conv1dSubsampling3` described below. Class description: Convolutional 1D subsampling (to 1/3 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer. Method signatures and docstr...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class Conv1dSubsampling3: """Convolutional 1D subsampling (to 1/3 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv1dSubsampling3: """Convolutional 1D subsampling (to 1/3 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): """Co...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/transformer/subsampling.py
espnet/espnet
train
7,242
50ca28b928217194aab707c2587d4deefde3e3b2
[ "v = 2.0\nr = utils.squared(v)\nself.assertTrue(r == 2.0 * 2.0)", "v = 2.0\nr = utils.cubed(v)\nself.assertTrue(r == 2.0 * 2.0 * 2.0)" ]
<|body_start_0|> v = 2.0 r = utils.squared(v) self.assertTrue(r == 2.0 * 2.0) <|end_body_0|> <|body_start_1|> v = 2.0 r = utils.cubed(v) self.assertTrue(r == 2.0 * 2.0 * 2.0) <|end_body_1|>
Unit tests to check utils
TestUtils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUtils: """Unit tests to check utils""" def test_squared(self): """test passable squaring""" <|body_0|> def test_cubed(self): """test passable cubing""" <|body_1|> <|end_skeleton|> <|body_start_0|> v = 2.0 r = utils.squared(v) ...
stack_v2_sparse_classes_36k_train_004821
529
permissive
[ { "docstring": "test passable squaring", "name": "test_squared", "signature": "def test_squared(self)" }, { "docstring": "test passable cubing", "name": "test_cubed", "signature": "def test_cubed(self)" } ]
2
stack_v2_sparse_classes_30k_train_015709
Implement the Python class `TestUtils` described below. Class description: Unit tests to check utils Method signatures and docstrings: - def test_squared(self): test passable squaring - def test_cubed(self): test passable cubing
Implement the Python class `TestUtils` described below. Class description: Unit tests to check utils Method signatures and docstrings: - def test_squared(self): test passable squaring - def test_cubed(self): test passable cubing <|skeleton|> class TestUtils: """Unit tests to check utils""" def test_squared(...
d95952d48c01866ee44ff40814c49e0fbd2489ad
<|skeleton|> class TestUtils: """Unit tests to check utils""" def test_squared(self): """test passable squaring""" <|body_0|> def test_cubed(self): """test passable cubing""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestUtils: """Unit tests to check utils""" def test_squared(self): """test passable squaring""" v = 2.0 r = utils.squared(v) self.assertTrue(r == 2.0 * 2.0) def test_cubed(self): """test passable cubing""" v = 2.0 r = utils.cubed(v) sel...
the_stack_v2_python_sparse
XcMath_Tests/test_utils.py
Iwan-Zotow/runEGS
train
2
739b536a345bfca29f875fc78d6b8a083759b866
[ "self.procfile = procfile\nself.interval = interval\nself._server = server\nself.lastresult = None\nserver.post_event(yapc.priv_callback(self), 0)", "if isinstance(event, yapc.priv_callback):\n output.vdbg(self.get_stat())\n self._server.post_event(yapc.priv_callback(self), self.interval)\nreturn True", "...
<|body_start_0|> self.procfile = procfile self.interval = interval self._server = server self.lastresult = None server.post_event(yapc.priv_callback(self), 0) <|end_body_0|> <|body_start_1|> if isinstance(event, yapc.priv_callback): output.vdbg(self.get_stat(...
Class to look at current statistics of interfaces @author ykk @date Auguest 2011
interface_stat
[ "LicenseRef-scancode-x11-stanford" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class interface_stat: """Class to look at current statistics of interfaces @author ykk @date Auguest 2011""" def __init__(self, server, interval=5, procfile='/proc/net/dev'): """Initialize @param server yapc core @param interval interval to look @param procfile file to look into""" ...
stack_v2_sparse_classes_36k_train_004822
8,177
permissive
[ { "docstring": "Initialize @param server yapc core @param interval interval to look @param procfile file to look into", "name": "__init__", "signature": "def __init__(self, server, interval=5, procfile='/proc/net/dev')" }, { "docstring": "Process event @param event event to process @return True"...
4
null
Implement the Python class `interface_stat` described below. Class description: Class to look at current statistics of interfaces @author ykk @date Auguest 2011 Method signatures and docstrings: - def __init__(self, server, interval=5, procfile='/proc/net/dev'): Initialize @param server yapc core @param interval inte...
Implement the Python class `interface_stat` described below. Class description: Class to look at current statistics of interfaces @author ykk @date Auguest 2011 Method signatures and docstrings: - def __init__(self, server, interval=5, procfile='/proc/net/dev'): Initialize @param server yapc core @param interval inte...
c3f5a31b74d5587671329eea9582ac8aed0c58a4
<|skeleton|> class interface_stat: """Class to look at current statistics of interfaces @author ykk @date Auguest 2011""" def __init__(self, server, interval=5, procfile='/proc/net/dev'): """Initialize @param server yapc core @param interval interval to look @param procfile file to look into""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class interface_stat: """Class to look at current statistics of interfaces @author ykk @date Auguest 2011""" def __init__(self, server, interval=5, procfile='/proc/net/dev'): """Initialize @param server yapc core @param interval interval to look @param procfile file to look into""" self.procfil...
the_stack_v2_python_sparse
yapc/local/networkstate.py
yapkke/yapc
train
1
30e3ca8b72cc31243d061348299db2db33ef26de
[ "self._quantile_value = quantile_value\nself._comparator_fn = comparator_fn\nself._error_loss_fn = functools.partial(loss_utils.pinball_loss, quantile=quantile)\nsuper(QuantileConstraint, self).__init__(time_step_spec, action_spec, constraint_network, error_loss_fn=self._error_loss_fn, name=name)", "predicted_qua...
<|body_start_0|> self._quantile_value = quantile_value self._comparator_fn = comparator_fn self._error_loss_fn = functools.partial(loss_utils.pinball_loss, quantile=quantile) super(QuantileConstraint, self).__init__(time_step_spec, action_spec, constraint_network, error_loss_fn=self._err...
Class for representing a trainable quantile constraint. This constraint class implements a quantile constraint such as ``` Q_tau(x) >= v ``` or ``` Q_tau(x) <= v ```
QuantileConstraint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantileConstraint: """Class for representing a trainable quantile constraint. This constraint class implements a quantile constraint such as ``` Q_tau(x) >= v ``` or ``` Q_tau(x) <= v ```""" def __init__(self, time_step_spec: types.TimeStep, action_spec: types.BoundedTensorSpec, constraint_...
stack_v2_sparse_classes_36k_train_004823
22,532
permissive
[ { "docstring": "Creates a trainable quantile constraint using a neural network. Args: time_step_spec: A `TimeStep` spec of the expected time_steps. action_spec: A nest of `BoundedTensorSpec` representing the actions. constraint_network: An instance of `tf_agents.network.Network` used to provide estimates of act...
2
null
Implement the Python class `QuantileConstraint` described below. Class description: Class for representing a trainable quantile constraint. This constraint class implements a quantile constraint such as ``` Q_tau(x) >= v ``` or ``` Q_tau(x) <= v ``` Method signatures and docstrings: - def __init__(self, time_step_spe...
Implement the Python class `QuantileConstraint` described below. Class description: Class for representing a trainable quantile constraint. This constraint class implements a quantile constraint such as ``` Q_tau(x) >= v ``` or ``` Q_tau(x) <= v ``` Method signatures and docstrings: - def __init__(self, time_step_spe...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class QuantileConstraint: """Class for representing a trainable quantile constraint. This constraint class implements a quantile constraint such as ``` Q_tau(x) >= v ``` or ``` Q_tau(x) <= v ```""" def __init__(self, time_step_spec: types.TimeStep, action_spec: types.BoundedTensorSpec, constraint_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuantileConstraint: """Class for representing a trainable quantile constraint. This constraint class implements a quantile constraint such as ``` Q_tau(x) >= v ``` or ``` Q_tau(x) <= v ```""" def __init__(self, time_step_spec: types.TimeStep, action_spec: types.BoundedTensorSpec, constraint_network: type...
the_stack_v2_python_sparse
tf_agents/bandits/policies/constraints.py
tensorflow/agents
train
2,755
82bb39dbb7391161dd61f37312a2e56b4923b0f9
[ "email = self.request.get('email')\npassword = self.request.get('password')\nif self.dstore.is_user_cloud_admin():\n success, message = self.helper.change_password(cgi.escape(email), cgi.escape(password))\nelse:\n success = False\n message = 'Only the cloud administrator can change passwords.'\nflash_messa...
<|body_start_0|> email = self.request.get('email') password = self.request.get('password') if self.dstore.is_user_cloud_admin(): success, message = self.helper.change_password(cgi.escape(email), cgi.escape(password)) else: success = False message = 'On...
Class to handle user password changes.
ChangePasswordPage
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangePasswordPage: """Class to handle user password changes.""" def post(self): """Handler for POST requests.""" <|body_0|> def get(self): """Handler for GET requests.""" <|body_1|> <|end_skeleton|> <|body_start_0|> email = self.request.get('em...
stack_v2_sparse_classes_36k_train_004824
37,207
permissive
[ { "docstring": "Handler for POST requests.", "name": "post", "signature": "def post(self)" }, { "docstring": "Handler for GET requests.", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_000036
Implement the Python class `ChangePasswordPage` described below. Class description: Class to handle user password changes. Method signatures and docstrings: - def post(self): Handler for POST requests. - def get(self): Handler for GET requests.
Implement the Python class `ChangePasswordPage` described below. Class description: Class to handle user password changes. Method signatures and docstrings: - def post(self): Handler for POST requests. - def get(self): Handler for GET requests. <|skeleton|> class ChangePasswordPage: """Class to handle user passw...
aa36e8dfaa295d53bec616ed07f91ec8c02fa4e1
<|skeleton|> class ChangePasswordPage: """Class to handle user password changes.""" def post(self): """Handler for POST requests.""" <|body_0|> def get(self): """Handler for GET requests.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChangePasswordPage: """Class to handle user password changes.""" def post(self): """Handler for POST requests.""" email = self.request.get('email') password = self.request.get('password') if self.dstore.is_user_cloud_admin(): success, message = self.helper.chan...
the_stack_v2_python_sparse
AppDashboard/dashboard.py
shatterednirvana/appscale
train
6
a81e15bfb0b8d4fe83832d10b6856ef22a314158
[ "self.datastore_not_unmounted_reason = datastore_not_unmounted_reason\nself.datastore_unmounted = datastore_unmounted\nself.destroy_cloned_entity_info_vec = destroy_cloned_entity_info_vec\nself.mtype = mtype\nself.view_deleted = view_deleted", "if dictionary is None:\n return None\ndatastore_not_unmounted_reas...
<|body_start_0|> self.datastore_not_unmounted_reason = datastore_not_unmounted_reason self.datastore_unmounted = datastore_unmounted self.destroy_cloned_entity_info_vec = destroy_cloned_entity_info_vec self.mtype = mtype self.view_deleted = view_deleted <|end_body_0|> <|body_sta...
Implementation of the 'DestroyClonedVMTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyClonedVMTaskInfoProto extension Location Extension =================================================================...
DestroyClonedVMTaskInfoProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestroyClonedVMTaskInfoProto: """Implementation of the 'DestroyClonedVMTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyClonedVMTaskInfoProto extension Location Extension =========...
stack_v2_sparse_classes_36k_train_004825
3,980
permissive
[ { "docstring": "Constructor for the DestroyClonedVMTaskInfoProto class", "name": "__init__", "signature": "def __init__(self, datastore_not_unmounted_reason=None, datastore_unmounted=None, destroy_cloned_entity_info_vec=None, mtype=None, view_deleted=None)" }, { "docstring": "Creates an instance...
2
stack_v2_sparse_classes_30k_train_019578
Implement the Python class `DestroyClonedVMTaskInfoProto` described below. Class description: Implementation of the 'DestroyClonedVMTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyClonedVMTaskInfoProto...
Implement the Python class `DestroyClonedVMTaskInfoProto` described below. Class description: Implementation of the 'DestroyClonedVMTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyClonedVMTaskInfoProto...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DestroyClonedVMTaskInfoProto: """Implementation of the 'DestroyClonedVMTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyClonedVMTaskInfoProto extension Location Extension =========...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DestroyClonedVMTaskInfoProto: """Implementation of the 'DestroyClonedVMTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyClonedVMTaskInfoProto extension Location Extension ======================...
the_stack_v2_python_sparse
cohesity_management_sdk/models/destroy_cloned_vm_task_info_proto.py
cohesity/management-sdk-python
train
24
62dc8751e5bdeb435927fa839742fb29507d4590
[ "self.row = 0\nself.col = 0\nself.vec2d = vec2d", "self.hasNext()\nresult = self.vec2d[self.row][self.col]\nself.col += 1\nreturn result", "while self.row < len(self.vec2d):\n if self.col < len(self.vec2d[self.row]):\n return True\n self.col = 0\n self.row += 1\nreturn False" ]
<|body_start_0|> self.row = 0 self.col = 0 self.vec2d = vec2d <|end_body_0|> <|body_start_1|> self.hasNext() result = self.vec2d[self.row][self.col] self.col += 1 return result <|end_body_1|> <|body_start_2|> while self.row < len(self.vec2d): ...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_004826
1,783
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
null
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.row = 0 self.col = 0 self.vec2d = vec2d def next(self): """:rtype: int""" self.hasNext() result = self.vec2d[self.row][self.col] ...
the_stack_v2_python_sparse
Python_leetcode/251_flatten_2d_vector.py
xiangcao/Leetcode
train
0
da363f0d53d4c8a2cbcf70b3d3f4aaa6253fcce3
[ "alarm = self.get_object()\ndate = alarm.alarm_time.strftime('%Y-%m-%d %H:%M:%S')\nreturn Response({'time': date})", "queryset = Alarm.objects.all()\nquery_date = self.request.query_params.get('date', None)\nquery_user = self.request.query_params.get('username', None)\nif query_date is not None:\n date = datet...
<|body_start_0|> alarm = self.get_object() date = alarm.alarm_time.strftime('%Y-%m-%d %H:%M:%S') return Response({'time': date}) <|end_body_0|> <|body_start_1|> queryset = Alarm.objects.all() query_date = self.request.query_params.get('date', None) query_user = self.requ...
AlarmViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlarmViewSet: def js_time(self, request, pk=None): """Returns datetimefield as js accepted time""" <|body_0|> def get_queryset(self): """Allows queryset to be filtered by alarms for given date""" <|body_1|> <|end_skeleton|> <|body_start_0|> alarm = ...
stack_v2_sparse_classes_36k_train_004827
14,885
no_license
[ { "docstring": "Returns datetimefield as js accepted time", "name": "js_time", "signature": "def js_time(self, request, pk=None)" }, { "docstring": "Allows queryset to be filtered by alarms for given date", "name": "get_queryset", "signature": "def get_queryset(self)" } ]
2
stack_v2_sparse_classes_30k_val_000408
Implement the Python class `AlarmViewSet` described below. Class description: Implement the AlarmViewSet class. Method signatures and docstrings: - def js_time(self, request, pk=None): Returns datetimefield as js accepted time - def get_queryset(self): Allows queryset to be filtered by alarms for given date
Implement the Python class `AlarmViewSet` described below. Class description: Implement the AlarmViewSet class. Method signatures and docstrings: - def js_time(self, request, pk=None): Returns datetimefield as js accepted time - def get_queryset(self): Allows queryset to be filtered by alarms for given date <|skelet...
bf0cffd77e0b745a625033134267b56e40595875
<|skeleton|> class AlarmViewSet: def js_time(self, request, pk=None): """Returns datetimefield as js accepted time""" <|body_0|> def get_queryset(self): """Allows queryset to be filtered by alarms for given date""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlarmViewSet: def js_time(self, request, pk=None): """Returns datetimefield as js accepted time""" alarm = self.get_object() date = alarm.alarm_time.strftime('%Y-%m-%d %H:%M:%S') return Response({'time': date}) def get_queryset(self): """Allows queryset to be filte...
the_stack_v2_python_sparse
sleepsite/views.py
gracez72/sleepAppBackend
train
0
a67513f277511b882cb7d915c72ee52d4a728f86
[ "self.img_width = img_width\nself.img_height = img_height\nself.flip_horiz = flip_horiz\nself.inter = inter", "crops = []\nheight, width = image.shape[:2]\ncorners = [[0, 0, self.img_width, self.img_height], [width - self.img_width, 0, width, self.img_height], [width - self.img_width, height - self.img_height, wi...
<|body_start_0|> self.img_width = img_width self.img_height = img_height self.flip_horiz = flip_horiz self.inter = inter <|end_body_0|> <|body_start_1|> crops = [] height, width = image.shape[:2] corners = [[0, 0, self.img_width, self.img_height], [width - self.i...
CropPreprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CropPreprocessor: def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): """Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired in...
stack_v2_sparse_classes_36k_train_004828
2,378
no_license
[ { "docstring": "Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired interpolation method", "name": "__init__", "signature": "def __init__(self, img_width, img_height, flip_h...
2
stack_v2_sparse_classes_30k_train_013294
Implement the Python class `CropPreprocessor` described below. Class description: Implement the CropPreprocessor class. Method signatures and docstrings: - def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): Initialise the class :param img_width: desired image width :param img_height: de...
Implement the Python class `CropPreprocessor` described below. Class description: Implement the CropPreprocessor class. Method signatures and docstrings: - def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): Initialise the class :param img_width: desired image width :param img_height: de...
e9f2010715fa06f50095d05684617c86e18ca661
<|skeleton|> class CropPreprocessor: def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): """Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CropPreprocessor: def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): """Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired interpolation me...
the_stack_v2_python_sparse
dltoolkit/preprocess/crop.py
GeoffBreemer/DLToolkit
train
2
ad817589c8a0344ed687beb385b63cad7b1757ab
[ "super().__init__()\nchannels, img_size, _ = img_shape\nmodel = [torch.nn.Conv2d(channels + c_dim, 64, 7, stride=1, padding=3, bias=False), torch.nn.InstanceNorm2d(64, affine=True, track_running_stats=True), torch.nn.ReLU(inplace=True)]\ncurr_dim = 64\nfor _ in range(2):\n model += [torch.nn.Conv2d(curr_dim, cur...
<|body_start_0|> super().__init__() channels, img_size, _ = img_shape model = [torch.nn.Conv2d(channels + c_dim, 64, 7, stride=1, padding=3, bias=False), torch.nn.InstanceNorm2d(64, affine=True, track_running_stats=True), torch.nn.ReLU(inplace=True)] curr_dim = 64 for _ in range(...
The Residual Generator
GeneratorResNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneratorResNet: """The Residual Generator""" def __init__(self, img_shape=(3, 128, 128), res_blocks=9, c_dim=5): """Parameters ---------- img_shape : tuple the shape of the generated images, should contain the channel dimension, but not the batch dimension res_blocks : int number of...
stack_v2_sparse_classes_36k_train_004829
6,187
permissive
[ { "docstring": "Parameters ---------- img_shape : tuple the shape of the generated images, should contain the channel dimension, but not the batch dimension res_blocks : int number of residual blocks c_dim : int size of the code dimension", "name": "__init__", "signature": "def __init__(self, img_shape=...
2
stack_v2_sparse_classes_30k_train_003036
Implement the Python class `GeneratorResNet` described below. Class description: The Residual Generator Method signatures and docstrings: - def __init__(self, img_shape=(3, 128, 128), res_blocks=9, c_dim=5): Parameters ---------- img_shape : tuple the shape of the generated images, should contain the channel dimensio...
Implement the Python class `GeneratorResNet` described below. Class description: The Residual Generator Method signatures and docstrings: - def __init__(self, img_shape=(3, 128, 128), res_blocks=9, c_dim=5): Parameters ---------- img_shape : tuple the shape of the generated images, should contain the channel dimensio...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class GeneratorResNet: """The Residual Generator""" def __init__(self, img_shape=(3, 128, 128), res_blocks=9, c_dim=5): """Parameters ---------- img_shape : tuple the shape of the generated images, should contain the channel dimension, but not the batch dimension res_blocks : int number of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeneratorResNet: """The Residual Generator""" def __init__(self, img_shape=(3, 128, 128), res_blocks=9, c_dim=5): """Parameters ---------- img_shape : tuple the shape of the generated images, should contain the channel dimension, but not the batch dimension res_blocks : int number of residual blo...
the_stack_v2_python_sparse
dlutils/models/gans/star/models.py
justusschock/dl-utils
train
15
1c7cc4ed9032d5b9e3b050b369f0c068b0598dcb
[ "self.error = error\nself.source = source\nself.stats = stats\nself.status = status\nself.task_end_time_usecs = task_end_time_usecs\nself.task_start_time_usecs = task_start_time_usecs", "if dictionary is None:\n return None\nerror = dictionary.get('error')\nsource = cohesity_management_sdk.models.protection_so...
<|body_start_0|> self.error = error self.source = source self.stats = stats self.status = status self.task_end_time_usecs = task_end_time_usecs self.task_start_time_usecs = task_start_time_usecs <|end_body_0|> <|body_start_1|> if dictionary is None: r...
Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is populated when the status is equal to 'kFailure'. sou...
CopySnapshotTaskStatus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopySnapshotTaskStatus: """Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is pop...
stack_v2_sparse_classes_36k_train_004830
4,290
permissive
[ { "docstring": "Constructor for the CopySnapshotTaskStatus class", "name": "__init__", "signature": "def __init__(self, error=None, source=None, stats=None, status=None, task_end_time_usecs=None, task_start_time_usecs=None)" }, { "docstring": "Creates an instance of this model from a dictionary ...
2
stack_v2_sparse_classes_30k_train_012259
Implement the Python class `CopySnapshotTaskStatus` described below. Class description: Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) whi...
Implement the Python class `CopySnapshotTaskStatus` described below. Class description: Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) whi...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CopySnapshotTaskStatus: """Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is pop...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CopySnapshotTaskStatus: """Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is populated when t...
the_stack_v2_python_sparse
cohesity_management_sdk/models/copy_snapshot_task_status.py
cohesity/management-sdk-python
train
24
875c9f8bb3f7db8aa1850977fab4a54aba129495
[ "if not root:\n return []\nres = []\n\ndef digui(root):\n if root:\n res.append(root.val)\n for i in root.children:\n digui(i)\ndigui(root)\nreturn res", "if not root:\n return []\nres = []\nstack = [root]\nwhile stack:\n node = stack.pop()\n res.append(node.val)\n stack...
<|body_start_0|> if not root: return [] res = [] def digui(root): if root: res.append(root.val) for i in root.children: digui(i) digui(root) return res <|end_body_0|> <|body_start_1|> if not roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorder(self, root: 'Node') -> List[int]: """递归""" <|body_0|> def preorder1(self, root: 'Node') -> List[int]: """迭代""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return [] res = [] def digui...
stack_v2_sparse_classes_36k_train_004831
1,083
no_license
[ { "docstring": "递归", "name": "preorder", "signature": "def preorder(self, root: 'Node') -> List[int]" }, { "docstring": "迭代", "name": "preorder1", "signature": "def preorder1(self, root: 'Node') -> List[int]" } ]
2
stack_v2_sparse_classes_30k_train_019410
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root: 'Node') -> List[int]: 递归 - def preorder1(self, root: 'Node') -> List[int]: 迭代
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root: 'Node') -> List[int]: 递归 - def preorder1(self, root: 'Node') -> List[int]: 迭代 <|skeleton|> class Solution: def preorder(self, root: 'Node') -> List...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def preorder(self, root: 'Node') -> List[int]: """递归""" <|body_0|> def preorder1(self, root: 'Node') -> List[int]: """迭代""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorder(self, root: 'Node') -> List[int]: """递归""" if not root: return [] res = [] def digui(root): if root: res.append(root.val) for i in root.children: digui(i) digui(root) ...
the_stack_v2_python_sparse
算法/Week_02/589. N叉树的前序遍历.py
RichieSong/algorithm
train
0
e4486b57c2cf1394aa0d4a34b3d1f12b0f7b50b5
[ "np.random.seed(rand_seed)\nself.w = {}\nself.b = {}\nself.z = {}\nself.a = {}\nself.dimensions = dimensions\nself.activation_funcs = activation_funcs\nself.loss_func = loss_func\nself.rand_seed = rand_seed\nself.num_layers = len(dimensions) - 1\nfor i in range(self.num_layers):\n self.w[i + 1] = np.random.randn...
<|body_start_0|> np.random.seed(rand_seed) self.w = {} self.b = {} self.z = {} self.a = {} self.dimensions = dimensions self.activation_funcs = activation_funcs self.loss_func = loss_func self.rand_seed = rand_seed self.num_layers = len(dim...
NN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NN: def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None): """Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number ...
stack_v2_sparse_classes_36k_train_004832
6,305
no_license
[ { "docstring": "Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number of rows and columns for the W at layer i+1. dimensions[0] is the dimension of the data. dime...
5
stack_v2_sparse_classes_30k_train_008139
Implement the Python class `NN` described below. Class description: Implement the NN class. Method signatures and docstrings: - def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None): Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. ...
Implement the Python class `NN` described below. Class description: Implement the NN class. Method signatures and docstrings: - def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None): Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. ...
ae4f9d5708fb5d732ec66b98ae600c20f32ccd04
<|skeleton|> class NN: def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None): """Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NN: def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None): """Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number of rows and co...
the_stack_v2_python_sparse
project_3/nn_released/src/problem2.py
7e11/CSE-326
train
1
1df7cefeddf8ce40214ed4c927b97e1129815d33
[ "self._host = host\nself._port = port\nself._login = login\nself._password = password\nself.data = None\nself.update()", "try:\n self.data = hpilo.Ilo(hostname=self._host, login=self._login, password=self._password, port=self._port)\nexcept (hpilo.IloError, hpilo.IloCommunicationError, hpilo.IloLoginFailed) as...
<|body_start_0|> self._host = host self._port = port self._login = login self._password = password self.data = None self.update() <|end_body_0|> <|body_start_1|> try: self.data = hpilo.Ilo(hostname=self._host, login=self._login, password=self._passwor...
Gets the latest data from HP iLO.
HpIloData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HpIloData: """Gets the latest data from HP iLO.""" def __init__(self, host, port, login, password): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from HP iLO.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004833
6,645
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, host, port, login, password)" }, { "docstring": "Get the latest data from HP iLO.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `HpIloData` described below. Class description: Gets the latest data from HP iLO. Method signatures and docstrings: - def __init__(self, host, port, login, password): Initialize the data object. - def update(self): Get the latest data from HP iLO.
Implement the Python class `HpIloData` described below. Class description: Gets the latest data from HP iLO. Method signatures and docstrings: - def __init__(self, host, port, login, password): Initialize the data object. - def update(self): Get the latest data from HP iLO. <|skeleton|> class HpIloData: """Gets ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class HpIloData: """Gets the latest data from HP iLO.""" def __init__(self, host, port, login, password): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from HP iLO.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HpIloData: """Gets the latest data from HP iLO.""" def __init__(self, host, port, login, password): """Initialize the data object.""" self._host = host self._port = port self._login = login self._password = password self.data = None self.update() ...
the_stack_v2_python_sparse
homeassistant/components/hp_ilo/sensor.py
home-assistant/core
train
35,501
96c970e45e25902152dcf6a1e4eb27ce9b081897
[ "N = len(nums) + 1\nfor i in range(0, len(nums)):\n if nums[i] < 0 or nums[i] >= N:\n nums[i] = 0\nnums.append(0)\nfor i in range(len(nums)):\n nums[nums[i] % N] += N\nfor i in range(1, len(nums)):\n if nums[i] < N:\n return i\nreturn N", "N = len(nums)\nif N == 0:\n return 1\nfor s in r...
<|body_start_0|> N = len(nums) + 1 for i in range(0, len(nums)): if nums[i] < 0 or nums[i] >= N: nums[i] = 0 nums.append(0) for i in range(len(nums)): nums[nums[i] % N] += N for i in range(1, len(nums)): if nums[i] < N: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """Storage is very limited so we do 3 tricks: - Remove elements that are <= 0 - Remove elements above N+1 - The remaining we re-arrange in a new array that is used as a hash table The solution is the first element of such table that has not...
stack_v2_sparse_classes_36k_train_004834
2,584
no_license
[ { "docstring": "Storage is very limited so we do 3 tricks: - Remove elements that are <= 0 - Remove elements above N+1 - The remaining we re-arrange in a new array that is used as a hash table The solution is the first element of such table that has not been filled", "name": "firstMissingPositive", "sig...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): Storage is very limited so we do 3 tricks: - Remove elements that are <= 0 - Remove elements above N+1 - The remaining we re-arrange in a ne...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): Storage is very limited so we do 3 tricks: - Remove elements that are <= 0 - Remove elements above N+1 - The remaining we re-arrange in a ne...
f4ac2609f8809ee543074a11dafc08726046f6a2
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """Storage is very limited so we do 3 tricks: - Remove elements that are <= 0 - Remove elements above N+1 - The remaining we re-arrange in a new array that is used as a hash table The solution is the first element of such table that has not...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstMissingPositive(self, nums): """Storage is very limited so we do 3 tricks: - Remove elements that are <= 0 - Remove elements above N+1 - The remaining we re-arrange in a new array that is used as a hash table The solution is the first element of such table that has not been filled""...
the_stack_v2_python_sparse
LeetCode/41_first-missing-positive.py
curiousTauseef/Algorithms_and_solutions
train
0
8683db29734d51b02179b94a78a9ac8c63c70a58
[ "log_file = os.path.join('logs', 'train-test.log')\nif os.path.exists(log_file):\n os.remove(log_file)\ncountry = 'brazil'\ndata_range = \"('2000-01-01', '2000-01-01')\"\neval_metric = {'rmse': 0.5}\nruntime = '00:00:01'\nmodel_version = 0.1\nmodel_version_note = 'test model'\nupdate_train_log(country, data_rang...
<|body_start_0|> log_file = os.path.join('logs', 'train-test.log') if os.path.exists(log_file): os.remove(log_file) country = 'brazil' data_range = "('2000-01-01', '2000-01-01')" eval_metric = {'rmse': 0.5} runtime = '00:00:01' model_version = 0.1 ...
test the essential functionality
LoggerTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoggerTest: """test the essential functionality""" def test_01_train(self): """ensure log file is created""" <|body_0|> def test_02_train(self): """ensure that content can be retrieved from log file""" <|body_1|> def test_03_predict(self): ""...
stack_v2_sparse_classes_36k_train_004835
3,141
no_license
[ { "docstring": "ensure log file is created", "name": "test_01_train", "signature": "def test_01_train(self)" }, { "docstring": "ensure that content can be retrieved from log file", "name": "test_02_train", "signature": "def test_02_train(self)" }, { "docstring": "ensure log file ...
4
stack_v2_sparse_classes_30k_train_010731
Implement the Python class `LoggerTest` described below. Class description: test the essential functionality Method signatures and docstrings: - def test_01_train(self): ensure log file is created - def test_02_train(self): ensure that content can be retrieved from log file - def test_03_predict(self): ensure log fil...
Implement the Python class `LoggerTest` described below. Class description: test the essential functionality Method signatures and docstrings: - def test_01_train(self): ensure log file is created - def test_02_train(self): ensure that content can be retrieved from log file - def test_03_predict(self): ensure log fil...
0b68917effa6128862d997c61dcae1d0df8ff109
<|skeleton|> class LoggerTest: """test the essential functionality""" def test_01_train(self): """ensure log file is created""" <|body_0|> def test_02_train(self): """ensure that content can be retrieved from log file""" <|body_1|> def test_03_predict(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoggerTest: """test the essential functionality""" def test_01_train(self): """ensure log file is created""" log_file = os.path.join('logs', 'train-test.log') if os.path.exists(log_file): os.remove(log_file) country = 'brazil' data_range = "('2000-01-01...
the_stack_v2_python_sparse
unittests/logger_tests.py
ryusat/capstonepeerreveiw
train
0
01a34991bbd044b99dcc65e1753a7bf438ebea07
[ "visited = set()\nself.old_color = image[source_row][source_col]\nself.image = image\n\ndef fill(sr, sc):\n if str(sr) + str(sc) in visited:\n return\n visited.add(str(sr) + str(sc))\n length = len(self.image)\n height = len(self.image[0])\n if 0 <= sr < length and 0 <= sc < height:\n i...
<|body_start_0|> visited = set() self.old_color = image[source_row][source_col] self.image = image def fill(sr, sc): if str(sr) + str(sc) in visited: return visited.add(str(sr) + str(sc)) length = len(self.image) height = l...
First take (uses unecessary set)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """First take (uses unecessary set)""" def floodFill(self, image, source_row, source_col, new_color): """:type image: List[List[int]] :type sr: int :type sc: int :type newColor: int :rtype: List[List[int]]""" <|body_0|> def floodFill(self, image, source_row, so...
stack_v2_sparse_classes_36k_train_004836
2,734
no_license
[ { "docstring": ":type image: List[List[int]] :type sr: int :type sc: int :type newColor: int :rtype: List[List[int]]", "name": "floodFill", "signature": "def floodFill(self, image, source_row, source_col, new_color)" }, { "docstring": ":type image: List[List[int]] :type sr: int :type sc: int :ty...
2
null
Implement the Python class `Solution` described below. Class description: First take (uses unecessary set) Method signatures and docstrings: - def floodFill(self, image, source_row, source_col, new_color): :type image: List[List[int]] :type sr: int :type sc: int :type newColor: int :rtype: List[List[int]] - def flood...
Implement the Python class `Solution` described below. Class description: First take (uses unecessary set) Method signatures and docstrings: - def floodFill(self, image, source_row, source_col, new_color): :type image: List[List[int]] :type sr: int :type sc: int :type newColor: int :rtype: List[List[int]] - def flood...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: """First take (uses unecessary set)""" def floodFill(self, image, source_row, source_col, new_color): """:type image: List[List[int]] :type sr: int :type sc: int :type newColor: int :rtype: List[List[int]]""" <|body_0|> def floodFill(self, image, source_row, so...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """First take (uses unecessary set)""" def floodFill(self, image, source_row, source_col, new_color): """:type image: List[List[int]] :type sr: int :type sc: int :type newColor: int :rtype: List[List[int]]""" visited = set() self.old_color = image[source_row][source_col]...
the_stack_v2_python_sparse
733-flood_fill.py
stevestar888/leetcode-problems
train
2
cb603965bb0b9eed8069c5f2c068d7d7053405ec
[ "dic_of_barcodes = {}\nif len(barcodes) < 3:\n return barcodes\nfor i in barcodes:\n if i not in dic_of_barcodes:\n dic_of_barcodes[i] = 1\n else:\n dic_of_barcodes[i] += 1\nkeys = list(dic_of_barcodes.keys())\nkeys = sorted(keys, key=lambda i: dic_of_barcodes[i], reverse=True)\nprint(keys)\n...
<|body_start_0|> dic_of_barcodes = {} if len(barcodes) < 3: return barcodes for i in barcodes: if i not in dic_of_barcodes: dic_of_barcodes[i] = 1 else: dic_of_barcodes[i] += 1 keys = list(dic_of_barcodes.keys()) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rearrangeBarcodes(self, barcodes): """:type barcodes: List[int] :rtype: List[int]""" <|body_0|> def rearrangeBarcodes2(self, barcodes): """:type barcodes: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> dic_...
stack_v2_sparse_classes_36k_train_004837
1,932
no_license
[ { "docstring": ":type barcodes: List[int] :rtype: List[int]", "name": "rearrangeBarcodes", "signature": "def rearrangeBarcodes(self, barcodes)" }, { "docstring": ":type barcodes: List[int] :rtype: List[int]", "name": "rearrangeBarcodes2", "signature": "def rearrangeBarcodes2(self, barcod...
2
stack_v2_sparse_classes_30k_train_005073
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rearrangeBarcodes(self, barcodes): :type barcodes: List[int] :rtype: List[int] - def rearrangeBarcodes2(self, barcodes): :type barcodes: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rearrangeBarcodes(self, barcodes): :type barcodes: List[int] :rtype: List[int] - def rearrangeBarcodes2(self, barcodes): :type barcodes: List[int] :rtype: List[int] <|skelet...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def rearrangeBarcodes(self, barcodes): """:type barcodes: List[int] :rtype: List[int]""" <|body_0|> def rearrangeBarcodes2(self, barcodes): """:type barcodes: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rearrangeBarcodes(self, barcodes): """:type barcodes: List[int] :rtype: List[int]""" dic_of_barcodes = {} if len(barcodes) < 3: return barcodes for i in barcodes: if i not in dic_of_barcodes: dic_of_barcodes[i] = 1 ...
the_stack_v2_python_sparse
rearrangeBarcodes.py
NeilWangziyu/Leetcode_py
train
2
83e36b97895007fc65a9883476f8c6b25e9b9095
[ "self.drive_vec = drive_vec\nself.object = object\nself.parent_site = parent_site", "if dictionary is None:\n return None\ndrive_vec = None\nif dictionary.get('driveVec') != None:\n drive_vec = list()\n for structure in dictionary.get('driveVec'):\n drive_vec.append(cohesity_management_sdk.models....
<|body_start_0|> self.drive_vec = drive_vec self.object = object self.parent_site = parent_site <|end_body_0|> <|body_start_1|> if dictionary is None: return None drive_vec = None if dictionary.get('driveVec') != None: drive_vec = list() ...
Implementation of the 'RestoreSiteParams_SiteOwner' model. TODO: type description here. Attributes: drive_vec (list of RestoreSiteParams_SiteOwner_Drive): The list of drives that are being restored. object (RestoreObject): This will store the details of the user whose drives is to be restored. parent_site (EntityProto)...
RestoreSiteParams_SiteOwner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreSiteParams_SiteOwner: """Implementation of the 'RestoreSiteParams_SiteOwner' model. TODO: type description here. Attributes: drive_vec (list of RestoreSiteParams_SiteOwner_Drive): The list of drives that are being restored. object (RestoreObject): This will store the details of the user wh...
stack_v2_sparse_classes_36k_train_004838
2,656
permissive
[ { "docstring": "Constructor for the RestoreSiteParams_SiteOwner class", "name": "__init__", "signature": "def __init__(self, drive_vec=None, object=None, parent_site=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represen...
2
stack_v2_sparse_classes_30k_train_020295
Implement the Python class `RestoreSiteParams_SiteOwner` described below. Class description: Implementation of the 'RestoreSiteParams_SiteOwner' model. TODO: type description here. Attributes: drive_vec (list of RestoreSiteParams_SiteOwner_Drive): The list of drives that are being restored. object (RestoreObject): Thi...
Implement the Python class `RestoreSiteParams_SiteOwner` described below. Class description: Implementation of the 'RestoreSiteParams_SiteOwner' model. TODO: type description here. Attributes: drive_vec (list of RestoreSiteParams_SiteOwner_Drive): The list of drives that are being restored. object (RestoreObject): Thi...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreSiteParams_SiteOwner: """Implementation of the 'RestoreSiteParams_SiteOwner' model. TODO: type description here. Attributes: drive_vec (list of RestoreSiteParams_SiteOwner_Drive): The list of drives that are being restored. object (RestoreObject): This will store the details of the user wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreSiteParams_SiteOwner: """Implementation of the 'RestoreSiteParams_SiteOwner' model. TODO: type description here. Attributes: drive_vec (list of RestoreSiteParams_SiteOwner_Drive): The list of drives that are being restored. object (RestoreObject): This will store the details of the user whose drives is...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_site_params_site_owner.py
cohesity/management-sdk-python
train
24
1712bf86a0e4a5119437ec0f657f5918bc41905e
[ "if klass == sql.UpdateQuery:\n return super().chain(PostgresUpdateQuery)\nif klass == sql.InsertQuery:\n return super().chain(PostgresInsertQuery)\nreturn super().chain(klass)", "for old_name, new_name in annotations.items():\n annotation = self.annotations.get(old_name)\n if not annotation:\n ...
<|body_start_0|> if klass == sql.UpdateQuery: return super().chain(PostgresUpdateQuery) if klass == sql.InsertQuery: return super().chain(PostgresInsertQuery) return super().chain(klass) <|end_body_0|> <|body_start_1|> for old_name, new_name in annotations.items(...
PostgresQuery
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostgresQuery: def chain(self, klass=None): """Chains this query to another. We override this so that we can make sure our subclassed query classes are used.""" <|body_0|> def rename_annotations(self, annotations) -> None: """Renames the aliases for the specified ann...
stack_v2_sparse_classes_36k_train_004839
7,372
permissive
[ { "docstring": "Chains this query to another. We override this so that we can make sure our subclassed query classes are used.", "name": "chain", "signature": "def chain(self, klass=None)" }, { "docstring": "Renames the aliases for the specified annotations: .annotate(myfield=F('somestuf__myfiel...
4
null
Implement the Python class `PostgresQuery` described below. Class description: Implement the PostgresQuery class. Method signatures and docstrings: - def chain(self, klass=None): Chains this query to another. We override this so that we can make sure our subclassed query classes are used. - def rename_annotations(sel...
Implement the Python class `PostgresQuery` described below. Class description: Implement the PostgresQuery class. Method signatures and docstrings: - def chain(self, klass=None): Chains this query to another. We override this so that we can make sure our subclassed query classes are used. - def rename_annotations(sel...
e5503cb3f3c1b7959bd55253d3a79296f4c8f0ef
<|skeleton|> class PostgresQuery: def chain(self, klass=None): """Chains this query to another. We override this so that we can make sure our subclassed query classes are used.""" <|body_0|> def rename_annotations(self, annotations) -> None: """Renames the aliases for the specified ann...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostgresQuery: def chain(self, klass=None): """Chains this query to another. We override this so that we can make sure our subclassed query classes are used.""" if klass == sql.UpdateQuery: return super().chain(PostgresUpdateQuery) if klass == sql.InsertQuery: r...
the_stack_v2_python_sparse
psqlextra/sql.py
SectorLabs/django-postgres-extra
train
645
b20098cafc2fc4ec4161a010f5bf0d2188865d5e
[ "if left is None:\n left = 0\nif right is None:\n right = 3 * opt\nself.opt = opt\nself.left = left\nself.right = right\nself.weight = weight", "opt = self.opt * density\nif value < opt:\n other = self.left * density\nelif value > opt:\n other = self.right * density\nelse:\n return 0\nfactor = (val...
<|body_start_0|> if left is None: left = 0 if right is None: right = 3 * opt self.opt = opt self.left = left self.right = right self.weight = weight <|end_body_0|> <|body_start_1|> opt = self.opt * density if value < opt: ...
a value rater - a cube rater has an optimal value, where the rate becomes zero - for a left (below the optimum) and a right value (above the optimum), the rating is value is set to 1 (modified by an overall weight factor for the rating) - the analytic form of the rating is cubic for both, the left and the right side of...
cube
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cube: """a value rater - a cube rater has an optimal value, where the rate becomes zero - for a left (below the optimum) and a right value (above the optimum), the rating is value is set to 1 (modified by an overall weight factor for the rating) - the analytic form of the rating is cubic for both...
stack_v2_sparse_classes_36k_train_004840
10,567
permissive
[ { "docstring": "initializes the rater - by default, left is set to zero, right is set to 3*opt - left should be smaller than opt, right should be bigger than opt - weight should be positive and is a factor multiplicated to the rates", "name": "__init__", "signature": "def __init__(self, opt, left=None, ...
2
stack_v2_sparse_classes_30k_train_008368
Implement the Python class `cube` described below. Class description: a value rater - a cube rater has an optimal value, where the rate becomes zero - for a left (below the optimum) and a right value (above the optimum), the rating is value is set to 1 (modified by an overall weight factor for the rating) - the analyt...
Implement the Python class `cube` described below. Class description: a value rater - a cube rater has an optimal value, where the rate becomes zero - for a left (below the optimum) and a right value (above the optimum), the rating is value is set to 1 (modified by an overall weight factor for the rating) - the analyt...
3a9693e37fd3afbd52001839966b0f2811fb4ccd
<|skeleton|> class cube: """a value rater - a cube rater has an optimal value, where the rate becomes zero - for a left (below the optimum) and a right value (above the optimum), the rating is value is set to 1 (modified by an overall weight factor for the rating) - the analytic form of the rating is cubic for both...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class cube: """a value rater - a cube rater has an optimal value, where the rate becomes zero - for a left (below the optimum) and a right value (above the optimum), the rating is value is set to 1 (modified by an overall weight factor for the rating) - the analytic form of the rating is cubic for both, the left an...
the_stack_v2_python_sparse
compiler/gdsMill/pyx/graph/axis/rater.py
kanokkorn/OpenRAM
train
0
10425653e5a0284cff59494dc06448447e5210b7
[ "lumMod = self._add_lumMod()\nlumMod.val = value\nreturn lumMod", "lumOff = self._add_lumOff()\nlumOff.val = value\nreturn lumOff", "self._remove_lumMod()\nself._remove_lumOff()\nreturn self" ]
<|body_start_0|> lumMod = self._add_lumMod() lumMod.val = value return lumMod <|end_body_0|> <|body_start_1|> lumOff = self._add_lumOff() lumOff.val = value return lumOff <|end_body_1|> <|body_start_2|> self._remove_lumMod() self._remove_lumOff() ...
Base class for <a:srgbClr> and <a:schemeClr> elements.
_BaseColorElement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BaseColorElement: """Base class for <a:srgbClr> and <a:schemeClr> elements.""" def add_lumMod(self, value): """Return a newly added <a:lumMod> child element.""" <|body_0|> def add_lumOff(self, value): """Return a newly added <a:lumOff> child element.""" ...
stack_v2_sparse_classes_36k_train_004841
2,024
permissive
[ { "docstring": "Return a newly added <a:lumMod> child element.", "name": "add_lumMod", "signature": "def add_lumMod(self, value)" }, { "docstring": "Return a newly added <a:lumOff> child element.", "name": "add_lumOff", "signature": "def add_lumOff(self, value)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_012284
Implement the Python class `_BaseColorElement` described below. Class description: Base class for <a:srgbClr> and <a:schemeClr> elements. Method signatures and docstrings: - def add_lumMod(self, value): Return a newly added <a:lumMod> child element. - def add_lumOff(self, value): Return a newly added <a:lumOff> child...
Implement the Python class `_BaseColorElement` described below. Class description: Base class for <a:srgbClr> and <a:schemeClr> elements. Method signatures and docstrings: - def add_lumMod(self, value): Return a newly added <a:lumMod> child element. - def add_lumOff(self, value): Return a newly added <a:lumOff> child...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class _BaseColorElement: """Base class for <a:srgbClr> and <a:schemeClr> elements.""" def add_lumMod(self, value): """Return a newly added <a:lumMod> child element.""" <|body_0|> def add_lumOff(self, value): """Return a newly added <a:lumOff> child element.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _BaseColorElement: """Base class for <a:srgbClr> and <a:schemeClr> elements.""" def add_lumMod(self, value): """Return a newly added <a:lumMod> child element.""" lumMod = self._add_lumMod() lumMod.val = value return lumMod def add_lumOff(self, value): """Retur...
the_stack_v2_python_sparse
Pdf_docx_pptx_xlsx_epub_png/source/pptx/oxml/dml/color.py
ryfeus/lambda-packs
train
1,283
1436eeb94d071103defcddc3abdb7610236b3b02
[ "if obj.sender:\n serializer = UserSerializer(obj.sender, context=self.context, fields=['id', 'username', 'email', 'name', 'last_name', 'second_last_name', 'photo', 'thumbnail'])\n return serializer.data", "if obj.target:\n serializer = NotificationTargetSerializer(obj, context=self.context)\n return ...
<|body_start_0|> if obj.sender: serializer = UserSerializer(obj.sender, context=self.context, fields=['id', 'username', 'email', 'name', 'last_name', 'second_last_name', 'photo', 'thumbnail']) return serializer.data <|end_body_0|> <|body_start_1|> if obj.target: seri...
Serializer class for the ```tandlr.notifications.models.Notification``` model.
NotificationV2Serializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationV2Serializer: """Serializer class for the ```tandlr.notifications.models.Notification``` model.""" def get_sender(self, obj): """Returns the notification's sender serialized with the minimal required fields.""" <|body_0|> def get_target(self, obj): ""...
stack_v2_sparse_classes_36k_train_004842
3,769
permissive
[ { "docstring": "Returns the notification's sender serialized with the minimal required fields.", "name": "get_sender", "signature": "def get_sender(self, obj)" }, { "docstring": "Returns the notification's target serialized with the minimal required fields.", "name": "get_target", "signa...
2
null
Implement the Python class `NotificationV2Serializer` described below. Class description: Serializer class for the ```tandlr.notifications.models.Notification``` model. Method signatures and docstrings: - def get_sender(self, obj): Returns the notification's sender serialized with the minimal required fields. - def g...
Implement the Python class `NotificationV2Serializer` described below. Class description: Serializer class for the ```tandlr.notifications.models.Notification``` model. Method signatures and docstrings: - def get_sender(self, obj): Returns the notification's sender serialized with the minimal required fields. - def g...
7349ce18f56658d67daedf5e1abb352b5c15a029
<|skeleton|> class NotificationV2Serializer: """Serializer class for the ```tandlr.notifications.models.Notification``` model.""" def get_sender(self, obj): """Returns the notification's sender serialized with the minimal required fields.""" <|body_0|> def get_target(self, obj): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationV2Serializer: """Serializer class for the ```tandlr.notifications.models.Notification``` model.""" def get_sender(self, obj): """Returns the notification's sender serialized with the minimal required fields.""" if obj.sender: serializer = UserSerializer(obj.sender,...
the_stack_v2_python_sparse
src/tandlr/notifications/serializers.py
shrmoud/schoolapp
train
0
6f04299c050564dc1dbac7eedee78161e389c0bb
[ "forest_predictions = self._base_estimator_predictions(X)\nif self._models_parameters.normalize_D:\n forest_predictions /= self._forest_norms\nreturn self._omp.predict(forest_predictions, forest_size)", "forest_predictions = self._base_estimator_predictions(X)\nif forest_size is not None:\n weights = self._...
<|body_start_0|> forest_predictions = self._base_estimator_predictions(X) if self._models_parameters.normalize_D: forest_predictions /= self._forest_norms return self._omp.predict(forest_predictions, forest_size) <|end_body_0|> <|body_start_1|> forest_predictions = self._bas...
NonNegativeOmpForestBinaryClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NonNegativeOmpForestBinaryClassifier: def predict(self, X, forest_size=None): """Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:""" <|body_0|> def predict_no_weights(self, X, forest_size=None): "...
stack_v2_sparse_classes_36k_train_004843
5,444
permissive
[ { "docstring": "Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:", "name": "predict", "signature": "def predict(self, X, forest_size=None)" }, { "docstring": "Make a prediction of the selected trees but without weight. If for...
3
stack_v2_sparse_classes_30k_test_000397
Implement the Python class `NonNegativeOmpForestBinaryClassifier` described below. Class description: Implement the NonNegativeOmpForestBinaryClassifier class. Method signatures and docstrings: - def predict(self, X, forest_size=None): Make prediction. If forest_size is None return the list of predictions of all inte...
Implement the Python class `NonNegativeOmpForestBinaryClassifier` described below. Class description: Implement the NonNegativeOmpForestBinaryClassifier class. Method signatures and docstrings: - def predict(self, X, forest_size=None): Make prediction. If forest_size is None return the list of predictions of all inte...
64ba63c01bd04f4f959d18aff27e245d8fff3403
<|skeleton|> class NonNegativeOmpForestBinaryClassifier: def predict(self, X, forest_size=None): """Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:""" <|body_0|> def predict_no_weights(self, X, forest_size=None): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NonNegativeOmpForestBinaryClassifier: def predict(self, X, forest_size=None): """Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:""" forest_predictions = self._base_estimator_predictions(X) if self._models_parameter...
the_stack_v2_python_sparse
code/bolsonaro/models/nn_omp_forest_classifier.py
swasun/RFOMT
train
2
29fc3d9269805e545c288fcc1c0e5e0d263c53db
[ "def remove(head):\n if not head:\n return (0, head)\n count, head.next = remove(head.next)\n return (count + 1, (head, head.next)[count + 1 == n])\nreturn remove(head)[1]", "def index(node):\n if not node:\n return 0\n count = index(node.next)\n if count >= n:\n node.next.v...
<|body_start_0|> def remove(head): if not head: return (0, head) count, head.next = remove(head.next) return (count + 1, (head, head.next)[count + 1 == n]) return remove(head)[1] <|end_body_0|> <|body_start_1|> def index(node): if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd1(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> def removeNthFromEnd3(self, head...
stack_v2_sparse_classes_36k_train_004844
1,401
no_license
[ { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd1", "signature": "def removeNthFromEnd1(self, head, n)" }, { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd2", "signature": "def removeNthFromEnd2(s...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd1(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): :type head: ListNode :type n: int :rtype: ListNod...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd1(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): :type head: ListNode :type n: int :rtype: ListNod...
8fb6c1d947046dabd58ff8482b2c0b41f39aa988
<|skeleton|> class Solution: def removeNthFromEnd1(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> def removeNthFromEnd3(self, head...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd1(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" def remove(head): if not head: return (0, head) count, head.next = remove(head.next) return (count + 1, (head, head.next)[count + 1 == n]...
the_stack_v2_python_sparse
Python/LeetCode/19.py
czx94/Algorithms-Collection
train
2
e9520b0229d51424a4fec399f32987722990a4f1
[ "location_columns = ['precinct', 'LOCATION_ZIPCODE', 'Latitude', 'Longitude']\ndescriptor = ['TYPE', 'REASON']\ndate_cols = ['open_dt', 'target_dt', 'closed_dt']\npunctual = ['OnTime_Status', 'CASE_STATUS']\nidentif = ['CASE_ENQUIRY_ID']\ndf[date_cols] = df[date_cols].apply(pd.to_datetime, errors='coerce')\ncomplet...
<|body_start_0|> location_columns = ['precinct', 'LOCATION_ZIPCODE', 'Latitude', 'Longitude'] descriptor = ['TYPE', 'REASON'] date_cols = ['open_dt', 'target_dt', 'closed_dt'] punctual = ['OnTime_Status', 'CASE_STATUS'] identif = ['CASE_ENQUIRY_ID'] df[date_cols] = df[dat...
three_one_one
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class three_one_one: def clean_transform_data(df): """Project data, and clean empty values""" <|body_0|> def execute(trial=False, custom_url=None): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_1|> def provenance(doc...
stack_v2_sparse_classes_36k_train_004845
5,946
no_license
[ { "docstring": "Project data, and clean empty values", "name": "clean_transform_data", "signature": "def clean_transform_data(df)" }, { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False, c...
3
stack_v2_sparse_classes_30k_train_003784
Implement the Python class `three_one_one` described below. Class description: Implement the three_one_one class. Method signatures and docstrings: - def clean_transform_data(df): Project data, and clean empty values - def execute(trial=False, custom_url=None): Retrieve some data sets (not using the API here for the ...
Implement the Python class `three_one_one` described below. Class description: Implement the three_one_one class. Method signatures and docstrings: - def clean_transform_data(df): Project data, and clean empty values - def execute(trial=False, custom_url=None): Retrieve some data sets (not using the API here for the ...
b5ccaad97f6e35f9580e645ca764f36eb3406f43
<|skeleton|> class three_one_one: def clean_transform_data(df): """Project data, and clean empty values""" <|body_0|> def execute(trial=False, custom_url=None): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_1|> def provenance(doc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class three_one_one: def clean_transform_data(df): """Project data, and clean empty values""" location_columns = ['precinct', 'LOCATION_ZIPCODE', 'Latitude', 'Longitude'] descriptor = ['TYPE', 'REASON'] date_cols = ['open_dt', 'target_dt', 'closed_dt'] punctual = ['OnTime_Sta...
the_stack_v2_python_sparse
kaidb_vilin/three_one_one.py
dwang1995/course-2018-spr-proj
train
1
0b4b9113fbb7bbf5084c3eb5939941f21c061014
[ "self.vocab_size = vocab_size\nself.vocab_name = 'vocab.%s' % self.vocab_size\nif not isinstance(training_dataset_filenames, list):\n training_dataset_filenames = [training_dataset_filenames]\nself.training_dataset_filenames = training_dataset_filenames", "data_set = [['', self.training_dataset_filenames]]\nso...
<|body_start_0|> self.vocab_size = vocab_size self.vocab_name = 'vocab.%s' % self.vocab_size if not isinstance(training_dataset_filenames, list): training_dataset_filenames = [training_dataset_filenames] self.training_dataset_filenames = training_dataset_filenames <|end_body_...
gen subword
GenSubword
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenSubword: """gen subword""" def __init__(self, vocab_size=8000, training_dataset_filenames='train.txt'): """:param vocab_size: :param vocab_name: :param training_dataset_filenames: list""" <|body_0|> def generate_data(self, data_dir, tmp_dir): """:param data_di...
stack_v2_sparse_classes_36k_train_004846
12,969
permissive
[ { "docstring": ":param vocab_size: :param vocab_name: :param training_dataset_filenames: list", "name": "__init__", "signature": "def __init__(self, vocab_size=8000, training_dataset_filenames='train.txt')" }, { "docstring": ":param data_dir: target dir(includes vocab file) :param tmp_dir: origi...
2
null
Implement the Python class `GenSubword` described below. Class description: gen subword Method signatures and docstrings: - def __init__(self, vocab_size=8000, training_dataset_filenames='train.txt'): :param vocab_size: :param vocab_name: :param training_dataset_filenames: list - def generate_data(self, data_dir, tmp...
Implement the Python class `GenSubword` described below. Class description: gen subword Method signatures and docstrings: - def __init__(self, vocab_size=8000, training_dataset_filenames='train.txt'): :param vocab_size: :param vocab_name: :param training_dataset_filenames: list - def generate_data(self, data_dir, tmp...
b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd
<|skeleton|> class GenSubword: """gen subword""" def __init__(self, vocab_size=8000, training_dataset_filenames='train.txt'): """:param vocab_size: :param vocab_name: :param training_dataset_filenames: list""" <|body_0|> def generate_data(self, data_dir, tmp_dir): """:param data_di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenSubword: """gen subword""" def __init__(self, vocab_size=8000, training_dataset_filenames='train.txt'): """:param vocab_size: :param vocab_name: :param training_dataset_filenames: list""" self.vocab_size = vocab_size self.vocab_name = 'vocab.%s' % self.vocab_size if not...
the_stack_v2_python_sparse
NLP/EMNLP2019-MAL/src/preprocess/problem.py
sserdoubleh/Research
train
10
db1c03e8d30c27e0111a82600b69cf4dbf00ed48
[ "super().__init__()\nif isinstance(output_size, int):\n output_size = (output_size, output_size)\nassert len(output_size) == 2\nassert isinstance(output_size[0], int) and isinstance(output_size[1], int)\nself.output_size = output_size\nif pooler_type == 'ROIAlign':\n self.level_poolers = [ROIAlign(output_size...
<|body_start_0|> super().__init__() if isinstance(output_size, int): output_size = (output_size, output_size) assert len(output_size) == 2 assert isinstance(output_size[0], int) and isinstance(output_size[1], int) self.output_size = output_size if pooler_type ...
Region of interest feature map pooler that supports pooling from one or more feature maps.
ROIPooler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ROIPooler: """Region of interest feature map pooler that supports pooling from one or more feature maps.""" def __init__(self, output_size, scales, sampling_ratio, pooler_type, canonical_box_size=224, canonical_level=4): """Args: output_size (int, tuple[int] or list[int]): output siz...
stack_v2_sparse_classes_36k_train_004847
7,279
permissive
[ { "docstring": "Args: output_size (int, tuple[int] or list[int]): output size of the pooled region, e.g., 14 x 14. If tuple or list is given, the length must be 2. scales (list[float]): The scale for each low-level pooling op relative to the input image. For a feature map with stride s relative to the input ima...
2
stack_v2_sparse_classes_30k_train_016944
Implement the Python class `ROIPooler` described below. Class description: Region of interest feature map pooler that supports pooling from one or more feature maps. Method signatures and docstrings: - def __init__(self, output_size, scales, sampling_ratio, pooler_type, canonical_box_size=224, canonical_level=4): Arg...
Implement the Python class `ROIPooler` described below. Class description: Region of interest feature map pooler that supports pooling from one or more feature maps. Method signatures and docstrings: - def __init__(self, output_size, scales, sampling_ratio, pooler_type, canonical_box_size=224, canonical_level=4): Arg...
ca03f633111d540ea91b3de75dbfa1da813647be
<|skeleton|> class ROIPooler: """Region of interest feature map pooler that supports pooling from one or more feature maps.""" def __init__(self, output_size, scales, sampling_ratio, pooler_type, canonical_box_size=224, canonical_level=4): """Args: output_size (int, tuple[int] or list[int]): output siz...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ROIPooler: """Region of interest feature map pooler that supports pooling from one or more feature maps.""" def __init__(self, output_size, scales, sampling_ratio, pooler_type, canonical_box_size=224, canonical_level=4): """Args: output_size (int, tuple[int] or list[int]): output size of the pool...
the_stack_v2_python_sparse
lib/modeling/poolers.py
SimeonZhang/detectron2_tensorflow
train
13
74241f8345dc12760b5fd3c97df0447c895b2078
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TeamsApp()", "from .entity import Entity\nfrom .teams_app_definition import TeamsAppDefinition\nfrom .teams_app_distribution_method import TeamsAppDistributionMethod\nfrom .entity import Entity\nfrom .teams_app_definition import TeamsA...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return TeamsApp() <|end_body_0|> <|body_start_1|> from .entity import Entity from .teams_app_definition import TeamsAppDefinition from .teams_app_distribution_method import TeamsAppDist...
TeamsApp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamsApp: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsApp: """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: TeamsApp...
stack_v2_sparse_classes_36k_train_004848
3,371
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: TeamsApp", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(pars...
3
null
Implement the Python class `TeamsApp` described below. Class description: Implement the TeamsApp class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsApp: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
Implement the Python class `TeamsApp` described below. Class description: Implement the TeamsApp class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsApp: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class TeamsApp: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsApp: """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: TeamsApp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeamsApp: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsApp: """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: TeamsApp""" if...
the_stack_v2_python_sparse
msgraph/generated/models/teams_app.py
microsoftgraph/msgraph-sdk-python
train
135
dc302e0aaac1a60300a15893b0fa0d373f2004ba
[ "self.host = host\nself.port = port\nself.info = info\nplatforms = []\nif any((asr.installed for asr in info.asr)):\n platforms.append(Platform.STT)\nif any((tts.installed for tts in info.tts)):\n platforms.append(Platform.TTS)\nif any((wake.installed for wake in info.wake)):\n platforms.append(Platform.WA...
<|body_start_0|> self.host = host self.port = port self.info = info platforms = [] if any((asr.installed for asr in info.asr)): platforms.append(Platform.STT) if any((tts.installed for tts in info.tts)): platforms.append(Platform.TTS) if an...
Hold info for Wyoming service.
WyomingService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WyomingService: """Hold info for Wyoming service.""" def __init__(self, host: str, port: int, info: Info) -> None: """Initialize Wyoming service.""" <|body_0|> async def create(cls, host: str, port: int) -> WyomingService | None: """Create a Wyoming service.""" ...
stack_v2_sparse_classes_36k_train_004849
2,321
permissive
[ { "docstring": "Initialize Wyoming service.", "name": "__init__", "signature": "def __init__(self, host: str, port: int, info: Info) -> None" }, { "docstring": "Create a Wyoming service.", "name": "create", "signature": "async def create(cls, host: str, port: int) -> WyomingService | Non...
2
null
Implement the Python class `WyomingService` described below. Class description: Hold info for Wyoming service. Method signatures and docstrings: - def __init__(self, host: str, port: int, info: Info) -> None: Initialize Wyoming service. - async def create(cls, host: str, port: int) -> WyomingService | None: Create a ...
Implement the Python class `WyomingService` described below. Class description: Hold info for Wyoming service. Method signatures and docstrings: - def __init__(self, host: str, port: int, info: Info) -> None: Initialize Wyoming service. - async def create(cls, host: str, port: int) -> WyomingService | None: Create a ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class WyomingService: """Hold info for Wyoming service.""" def __init__(self, host: str, port: int, info: Info) -> None: """Initialize Wyoming service.""" <|body_0|> async def create(cls, host: str, port: int) -> WyomingService | None: """Create a Wyoming service.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WyomingService: """Hold info for Wyoming service.""" def __init__(self, host: str, port: int, info: Info) -> None: """Initialize Wyoming service.""" self.host = host self.port = port self.info = info platforms = [] if any((asr.installed for asr in info.asr)...
the_stack_v2_python_sparse
homeassistant/components/wyoming/data.py
home-assistant/core
train
35,501
ce8cd1433ff91a6b83173b53dcdc62ddb8d66c01
[ "super(VMRuntimeInstanceFactory, self).__init__(request_data, 8 if runtime_config_getter().threadsafe else 1, 10)\nself._runtime_config_getter = runtime_config_getter\nself._module_configuration = module_configuration\nself._docker_client = containers.NewDockerClient(version='1.9', timeout=self.DOCKER_D_REQUEST_TIM...
<|body_start_0|> super(VMRuntimeInstanceFactory, self).__init__(request_data, 8 if runtime_config_getter().threadsafe else 1, 10) self._runtime_config_getter = runtime_config_getter self._module_configuration = module_configuration self._docker_client = containers.NewDockerClient(version...
A factory that creates new VM runtime Instances.
VMRuntimeInstanceFactory
[ "Apache-2.0", "LGPL-2.1-or-later", "BSD-3-Clause", "MIT", "GPL-2.0-or-later", "MPL-1.1", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VMRuntimeInstanceFactory: """A factory that creates new VM runtime Instances.""" def __init__(self, request_data, runtime_config_getter, module_configuration): """Initializer for VMRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will be provided w...
stack_v2_sparse_classes_36k_train_004850
4,064
permissive
[ { "docstring": "Initializer for VMRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will be provided with request information for use by API stubs. runtime_config_getter: A function that can be called without arguments and returns the runtime_config_pb2.Config containing the c...
2
null
Implement the Python class `VMRuntimeInstanceFactory` described below. Class description: A factory that creates new VM runtime Instances. Method signatures and docstrings: - def __init__(self, request_data, runtime_config_getter, module_configuration): Initializer for VMRuntimeInstanceFactory. Args: request_data: A ...
Implement the Python class `VMRuntimeInstanceFactory` described below. Class description: A factory that creates new VM runtime Instances. Method signatures and docstrings: - def __init__(self, request_data, runtime_config_getter, module_configuration): Initializer for VMRuntimeInstanceFactory. Args: request_data: A ...
d379afa2db3582d5c3be652165f0e9e2e0c154c6
<|skeleton|> class VMRuntimeInstanceFactory: """A factory that creates new VM runtime Instances.""" def __init__(self, request_data, runtime_config_getter, module_configuration): """Initializer for VMRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will be provided w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VMRuntimeInstanceFactory: """A factory that creates new VM runtime Instances.""" def __init__(self, request_data, runtime_config_getter, module_configuration): """Initializer for VMRuntimeInstanceFactory. Args: request_data: A wsgi_request_info.WSGIRequestInfo that will be provided with request i...
the_stack_v2_python_sparse
y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_factory.py
ychen820/microblog
train
0
e0a88edc742408be66c534e5ac106a4d0e723017
[ "if k <= 0:\n raise ValueError('k应该大于0.')\nnodeK = phead = head.next\ni = 1\nwhile nodeK and i < k:\n nodeK, i = (nodeK.next, i + 1)\nif i < k or not nodeK:\n raise ValueError('链表节点数小于k.')\nwhile nodeK.next:\n phead, nodeK = (phead.next, nodeK.next)\nreturn phead", "odd = even = head\nwhile even:\n ...
<|body_start_0|> if k <= 0: raise ValueError('k应该大于0.') nodeK = phead = head.next i = 1 while nodeK and i < k: nodeK, i = (nodeK.next, i + 1) if i < k or not nodeK: raise ValueError('链表节点数小于k.') while nodeK.next: phead, node...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def theLastKNode(self, head, k): """:type head:ListNode :type k:int :rtype:ListNode""" <|body_0|> def theMiddleNode1(self, head): """:type head:ListNode :rtype:ListNode""" <|body_1|> def theMiddleNode2(self, head): """:type head:ListNod...
stack_v2_sparse_classes_36k_train_004851
1,407
no_license
[ { "docstring": ":type head:ListNode :type k:int :rtype:ListNode", "name": "theLastKNode", "signature": "def theLastKNode(self, head, k)" }, { "docstring": ":type head:ListNode :rtype:ListNode", "name": "theMiddleNode1", "signature": "def theMiddleNode1(self, head)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_011639
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def theLastKNode(self, head, k): :type head:ListNode :type k:int :rtype:ListNode - def theMiddleNode1(self, head): :type head:ListNode :rtype:ListNode - def theMiddleNode2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def theLastKNode(self, head, k): :type head:ListNode :type k:int :rtype:ListNode - def theMiddleNode1(self, head): :type head:ListNode :rtype:ListNode - def theMiddleNode2(self, ...
42a15943394ae533dcd0d5bbf52e4366ab0756ab
<|skeleton|> class Solution: def theLastKNode(self, head, k): """:type head:ListNode :type k:int :rtype:ListNode""" <|body_0|> def theMiddleNode1(self, head): """:type head:ListNode :rtype:ListNode""" <|body_1|> def theMiddleNode2(self, head): """:type head:ListNod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def theLastKNode(self, head, k): """:type head:ListNode :type k:int :rtype:ListNode""" if k <= 0: raise ValueError('k应该大于0.') nodeK = phead = head.next i = 1 while nodeK and i < k: nodeK, i = (nodeK.next, i + 1) if i < k or not ...
the_stack_v2_python_sparse
test22.py
nihao-hit/jianzhiOffer
train
0
3aafd25d5d4eb023f194ab6e87c861f0a9cf8591
[ "self.description = description\nself.icap_uri = icap_uri\nself.tag = tag\nself.tag_id = tag_id", "if dictionary is None:\n return None\ndescription = dictionary.get('description')\nicap_uri = dictionary.get('icapUri')\ntag = dictionary.get('tag')\ntag_id = dictionary.get('tagId')\nreturn cls(description, icap...
<|body_start_0|> self.description = description self.icap_uri = icap_uri self.tag = tag self.tag_id = tag_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None description = dictionary.get('description') icap_uri = dictionary.get('icap...
Implementation of the 'AntivirusServiceConfig' model. Specifies configuration settings for antivirus service provider. Attributes: description (string): Specifies the description of the Antivirus service. This could be any additional information admin might associate with the Antivirus service. icap_uri (string, requir...
AntivirusServiceConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AntivirusServiceConfig: """Implementation of the 'AntivirusServiceConfig' model. Specifies configuration settings for antivirus service provider. Attributes: description (string): Specifies the description of the Antivirus service. This could be any additional information admin might associate wi...
stack_v2_sparse_classes_36k_train_004852
2,737
permissive
[ { "docstring": "Constructor for the AntivirusServiceConfig class", "name": "__init__", "signature": "def __init__(self, description=None, icap_uri=None, tag=None, tag_id=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repr...
2
stack_v2_sparse_classes_30k_train_001658
Implement the Python class `AntivirusServiceConfig` described below. Class description: Implementation of the 'AntivirusServiceConfig' model. Specifies configuration settings for antivirus service provider. Attributes: description (string): Specifies the description of the Antivirus service. This could be any addition...
Implement the Python class `AntivirusServiceConfig` described below. Class description: Implementation of the 'AntivirusServiceConfig' model. Specifies configuration settings for antivirus service provider. Attributes: description (string): Specifies the description of the Antivirus service. This could be any addition...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AntivirusServiceConfig: """Implementation of the 'AntivirusServiceConfig' model. Specifies configuration settings for antivirus service provider. Attributes: description (string): Specifies the description of the Antivirus service. This could be any additional information admin might associate wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AntivirusServiceConfig: """Implementation of the 'AntivirusServiceConfig' model. Specifies configuration settings for antivirus service provider. Attributes: description (string): Specifies the description of the Antivirus service. This could be any additional information admin might associate with the Antivi...
the_stack_v2_python_sparse
cohesity_management_sdk/models/antivirus_service_config.py
cohesity/management-sdk-python
train
24
dacff19333bff583f964a34b294d7e0f8a24ffbe
[ "errors = dict()\nrevisions = dict()\nfor line in trs_import.csv_lines():\n document_key = line['document_key']\n revision = int(line['revision'])\n if document_key not in revisions:\n revisions[document_key] = list()\n revisions[document_key].append(revision)\nlatest_revisions = Document.objects...
<|body_start_0|> errors = dict() revisions = dict() for line in trs_import.csv_lines(): document_key = line['document_key'] revision = int(line['revision']) if document_key not in revisions: revisions[document_key] = list() revision...
Global revision number validator.
RevisionsValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RevisionsValidator: """Global revision number validator.""" def validate(self, trs_import): """Validate the revision numbers. Multiple revisions of the same document can be created in a single csv. Because of that, we need to check that all the revisions to create will have following...
stack_v2_sparse_classes_36k_train_004853
11,148
permissive
[ { "docstring": "Validate the revision numbers. Multiple revisions of the same document can be created in a single csv. Because of that, we need to check that all the revisions to create will have following numbers.", "name": "validate", "signature": "def validate(self, trs_import)" }, { "docstri...
2
null
Implement the Python class `RevisionsValidator` described below. Class description: Global revision number validator. Method signatures and docstrings: - def validate(self, trs_import): Validate the revision numbers. Multiple revisions of the same document can be created in a single csv. Because of that, we need to c...
Implement the Python class `RevisionsValidator` described below. Class description: Global revision number validator. Method signatures and docstrings: - def validate(self, trs_import): Validate the revision numbers. Multiple revisions of the same document can be created in a single csv. Because of that, we need to c...
60ff6f37778971ae356c5b2b20e0d174a8288bfe
<|skeleton|> class RevisionsValidator: """Global revision number validator.""" def validate(self, trs_import): """Validate the revision numbers. Multiple revisions of the same document can be created in a single csv. Because of that, we need to check that all the revisions to create will have following...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RevisionsValidator: """Global revision number validator.""" def validate(self, trs_import): """Validate the revision numbers. Multiple revisions of the same document can be created in a single csv. Because of that, we need to check that all the revisions to create will have following numbers.""" ...
the_stack_v2_python_sparse
src/transmittals/validation.py
Talengi/phase
train
8
2c7ab504802770985868fb45a4c59d1f2a8b6c40
[ "qn = db.connection.ops.quote_name\nqs = _select_related_instances(Entry, 'section', [1], 'batch_select_entry', 'section_id')\ndb.reset_queries()\nlist(qs)\nsql = db.connection.queries[-1]['sql']\nself.failUnless(sql.startswith('SELECT (%s.%s) AS ' % (qn('batch_select_entry'), qn('section_id'))))", "section = Sec...
<|body_start_0|> qn = db.connection.ops.quote_name qs = _select_related_instances(Entry, 'section', [1], 'batch_select_entry', 'section_id') db.reset_queries() list(qs) sql = db.connection.queries[-1]['sql'] self.failUnless(sql.startswith('SELECT (%s.%s) AS ' % (qn('batch...
Ensure correct quoting of table and field names in queries
QuotingTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuotingTestCase: """Ensure correct quoting of table and field names in queries""" def test_uses_backend_specific_quoting(self): """Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test her...
stack_v2_sparse_classes_36k_train_004854
39,573
no_license
[ { "docstring": "Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test here is a bit trivial since a real-life test case with PostgreSQL schema tricks or other table/field name munging would be difficult.", "name"...
2
stack_v2_sparse_classes_30k_train_019716
Implement the Python class `QuotingTestCase` described below. Class description: Ensure correct quoting of table and field names in queries Method signatures and docstrings: - def test_uses_backend_specific_quoting(self): Backend-specific quotes should be used Table and field names should be quoted with the quote_nam...
Implement the Python class `QuotingTestCase` described below. Class description: Ensure correct quoting of table and field names in queries Method signatures and docstrings: - def test_uses_backend_specific_quoting(self): Backend-specific quotes should be used Table and field names should be quoted with the quote_nam...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class QuotingTestCase: """Ensure correct quoting of table and field names in queries""" def test_uses_backend_specific_quoting(self): """Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test her...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuotingTestCase: """Ensure correct quoting of table and field names in queries""" def test_uses_backend_specific_quoting(self): """Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test here is a bit tr...
the_stack_v2_python_sparse
repoData/lilspikey-django-batch-select/allPythonContent.py
aCoffeeYin/pyreco
train
0
862c8250b34df1a532ee8a8bd5b21dfb8afda9e9
[ "super().__init__()\nself.conv1 = SuperGATConv(in_dim, hidden_dim, num_heads, attn_type, neg_sample_ratio, feat_drop, attn_drop, negative_slope, F.elu)\nself.conv2 = SuperGATConv(num_heads * hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio, 0, attn_drop, negative_slope)", "h = self.conv1(g, feat).flatt...
<|body_start_0|> super().__init__() self.conv1 = SuperGATConv(in_dim, hidden_dim, num_heads, attn_type, neg_sample_ratio, feat_drop, attn_drop, negative_slope, F.elu) self.conv2 = SuperGATConv(num_heads * hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio, 0, attn_drop, negative_slope) ...
SuperGAT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperGAT: def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): """两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param ...
stack_v2_sparse_classes_36k_train_004855
5,266
no_license
[ { "docstring": "两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param attn_type: str 注意力类型,可选择GO, DP, SD和MX :param neg_sample_ratio: float, optional 负样本边数量占正样本边数量的比例,默认0.5 :param feat_drop: float, optional 输入特征Dropout概率,默认为0 :param at...
2
stack_v2_sparse_classes_30k_train_012577
Implement the Python class `SuperGAT` described below. Class description: Implement the SuperGAT class. Method signatures and docstrings: - def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): 两层SuperGAT模型 :param in_dim: int 输入特...
Implement the Python class `SuperGAT` described below. Class description: Implement the SuperGAT class. Method signatures and docstrings: - def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): 两层SuperGAT模型 :param in_dim: int 输入特...
b40071dc9f9fb20f081f4ed4944a7b65de919c18
<|skeleton|> class SuperGAT: def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): """两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperGAT: def __init__(self, in_dim, hidden_dim, out_dim, num_heads, attn_type, neg_sample_ratio=0.5, feat_drop=0.0, attn_drop=0.0, negative_slope=0.2): """两层SuperGAT模型 :param in_dim: int 输入特征维数 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param attn_type: str...
the_stack_v2_python_sparse
gnn/supergat/model.py
deepdumbo/pytorch-tutorial-1
train
0
99316f5465fb225bf04da7bfa63b27f5d4bace76
[ "if heuristics not in [-1, 1, 2]:\n print('Invalid value for heuristics parameter.' + 'Check python3 robinmax.py --help.')\nepsilon = utils.epsilon(graph)\nself.graph = graph\nself.thresh_budget = thresh_budget\nself.max_thresh_dev = max_thresh_dev\nself.weight_budget = weight_budget\nself.max_weight_dev = max_w...
<|body_start_0|> if heuristics not in [-1, 1, 2]: print('Invalid value for heuristics parameter.' + 'Check python3 robinmax.py --help.') epsilon = utils.epsilon(graph) self.graph = graph self.thresh_budget = thresh_budget self.max_thresh_dev = max_thresh_dev s...
The parameter class. Contains all the parameters necessary for the algorithm.
RobinmaxArgs
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RobinmaxArgs: """The parameter class. Contains all the parameters necessary for the algorithm.""" def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f): ...
stack_v2_sparse_classes_36k_train_004856
3,360
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f)" }, { "docstring": "Convert to string for pri...
2
stack_v2_sparse_classes_30k_train_007719
Implement the Python class `RobinmaxArgs` described below. Class description: The parameter class. Contains all the parameters necessary for the algorithm. Method signatures and docstrings: - def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds,...
Implement the Python class `RobinmaxArgs` described below. Class description: The parameter class. Contains all the parameters necessary for the algorithm. Method signatures and docstrings: - def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds,...
0745a09bcfa6f527817602433755afe6dea33f02
<|skeleton|> class RobinmaxArgs: """The parameter class. Contains all the parameters necessary for the algorithm.""" def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RobinmaxArgs: """The parameter class. Contains all the parameters necessary for the algorithm.""" def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f): """Construct...
the_stack_v2_python_sparse
robinmax_args.py
sartorg/robinmax
train
1
037c756c1c6721da6b1b95bcd77e54c144604b72
[ "self.anchor = anchor\nself.sentence = sentence\nself.event_domain = event_domain\nself.event_type = event_type\nself.score = 0\nself._allocate_arrays(max_sentence_length, neighbor_distance)", "int_type = 'int32'\nnum_labels = len(self.event_domain.event_types)\nself.label = np.zeros(num_labels, dtype=int_type)\n...
<|body_start_0|> self.anchor = anchor self.sentence = sentence self.event_domain = event_domain self.event_type = event_type self.score = 0 self._allocate_arrays(max_sentence_length, neighbor_distance) <|end_body_0|> <|body_start_1|> int_type = 'int32' nu...
EventTriggerExample
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventTriggerExample: def __init__(self, anchor, sentence, event_domain, max_sentence_length, neighbor_distance, event_type=None): """We are given a token, sentence as context, and event_type (present during training) :type anchor: nlplingo.text.text_span.Anchor :type sentence: nlplingo.t...
stack_v2_sparse_classes_36k_train_004857
36,438
permissive
[ { "docstring": "We are given a token, sentence as context, and event_type (present during training) :type anchor: nlplingo.text.text_span.Anchor :type sentence: nlplingo.text.text_span.Sentence :type event_domain: nlplingo.event.event_domain.EventDomain :type params: dict :type event_type: str", "name": "__...
2
stack_v2_sparse_classes_30k_train_006452
Implement the Python class `EventTriggerExample` described below. Class description: Implement the EventTriggerExample class. Method signatures and docstrings: - def __init__(self, anchor, sentence, event_domain, max_sentence_length, neighbor_distance, event_type=None): We are given a token, sentence as context, and ...
Implement the Python class `EventTriggerExample` described below. Class description: Implement the EventTriggerExample class. Method signatures and docstrings: - def __init__(self, anchor, sentence, event_domain, max_sentence_length, neighbor_distance, event_type=None): We are given a token, sentence as context, and ...
32ff17b1320937faa3d3ebe727032f4b3e7a353d
<|skeleton|> class EventTriggerExample: def __init__(self, anchor, sentence, event_domain, max_sentence_length, neighbor_distance, event_type=None): """We are given a token, sentence as context, and event_type (present during training) :type anchor: nlplingo.text.text_span.Anchor :type sentence: nlplingo.t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventTriggerExample: def __init__(self, anchor, sentence, event_domain, max_sentence_length, neighbor_distance, event_type=None): """We are given a token, sentence as context, and event_type (present during training) :type anchor: nlplingo.text.text_span.Anchor :type sentence: nlplingo.text.text_span....
the_stack_v2_python_sparse
nlplingo/sandbox/misc/event_trigger.py
BBN-E/nlplingo
train
3
f269327cb123dafd350fbf7b171333a5edd45f6d
[ "import collections\nimport itertools\nfrom __builtin__ import xrange\nf = collections.defaultdict(list)\nfor a, b, c in allowed:\n f[a + b].append(c)\nmemo = {}\n\ndef pyramid(bottom):\n if bottom not in memo:\n memo[bottom] = len(bottom) == 1 or any((pyramid(''.join(i)) for i in itertools.product(*(f...
<|body_start_0|> import collections import itertools from __builtin__ import xrange f = collections.defaultdict(list) for a, b, c in allowed: f[a + b].append(c) memo = {} def pyramid(bottom): if bottom not in memo: memo[bot...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" <|body_0|> def rewrite(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool DP, try them all!""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_004858
3,290
no_license
[ { "docstring": ":type bottom: str :type allowed: List[str] :rtype: bool", "name": "pyramidTransition", "signature": "def pyramidTransition(self, bottom, allowed)" }, { "docstring": ":type bottom: str :type allowed: List[str] :rtype: bool DP, try them all!", "name": "rewrite", "signature"...
2
stack_v2_sparse_classes_30k_train_007313
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pyramidTransition(self, bottom, allowed): :type bottom: str :type allowed: List[str] :rtype: bool - def rewrite(self, bottom, allowed): :type bottom: str :type allowed: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pyramidTransition(self, bottom, allowed): :type bottom: str :type allowed: List[str] :rtype: bool - def rewrite(self, bottom, allowed): :type bottom: str :type allowed: List[...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" <|body_0|> def rewrite(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool DP, try them all!""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" import collections import itertools from __builtin__ import xrange f = collections.defaultdict(list) for a, b, c in allowed: f[a + b...
the_stack_v2_python_sparse
depth-first-search/756_Pyramid_Transition_Matrix.py
vsdrun/lc_public
train
6
3fb02a72c2fecc7279f623365e73158935fac589
[ "self.ae = projetae.AutoEncodeur(2, 512, 128, 16, 0.01, 0.0012)\ninputdim = self.ae.input_dim\noutputdim = self.ae.decoder.output_dim\nself.assertEqual(inputdim, outputdim)", "self.ae = projetae.AutoEncodeur(2, 512, 128, 16, 0.01, 0.0012)\npremiere_couche = self.ae.encoder.c1.units\nderniere_couche = self.ae.deco...
<|body_start_0|> self.ae = projetae.AutoEncodeur(2, 512, 128, 16, 0.01, 0.0012) inputdim = self.ae.input_dim outputdim = self.ae.decoder.output_dim self.assertEqual(inputdim, outputdim) <|end_body_0|> <|body_start_1|> self.ae = projetae.AutoEncodeur(2, 512, 128, 16, 0.01, 0.0012...
Tests responsables de la confirmation que la k-eme et (n-k) couche ont la même dimension
TestSymmetrie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSymmetrie: """Tests responsables de la confirmation que la k-eme et (n-k) couche ont la même dimension""" def test_symmetrie(self): """Test de symmétrie: couche d'entrée et couche de sortie""" <|body_0|> def test_symmetrie_c1(self): """Test de symmétrie: prem...
stack_v2_sparse_classes_36k_train_004859
1,663
no_license
[ { "docstring": "Test de symmétrie: couche d'entrée et couche de sortie", "name": "test_symmetrie", "signature": "def test_symmetrie(self)" }, { "docstring": "Test de symmétrie: premiere couche apres entrée, derniere couche avant sortie", "name": "test_symmetrie_c1", "signature": "def tes...
4
stack_v2_sparse_classes_30k_train_006315
Implement the Python class `TestSymmetrie` described below. Class description: Tests responsables de la confirmation que la k-eme et (n-k) couche ont la même dimension Method signatures and docstrings: - def test_symmetrie(self): Test de symmétrie: couche d'entrée et couche de sortie - def test_symmetrie_c1(self): Te...
Implement the Python class `TestSymmetrie` described below. Class description: Tests responsables de la confirmation que la k-eme et (n-k) couche ont la même dimension Method signatures and docstrings: - def test_symmetrie(self): Test de symmétrie: couche d'entrée et couche de sortie - def test_symmetrie_c1(self): Te...
bad9fe47ef72b66fad289985484de4d5c58c48eb
<|skeleton|> class TestSymmetrie: """Tests responsables de la confirmation que la k-eme et (n-k) couche ont la même dimension""" def test_symmetrie(self): """Test de symmétrie: couche d'entrée et couche de sortie""" <|body_0|> def test_symmetrie_c1(self): """Test de symmétrie: prem...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSymmetrie: """Tests responsables de la confirmation que la k-eme et (n-k) couche ont la même dimension""" def test_symmetrie(self): """Test de symmétrie: couche d'entrée et couche de sortie""" self.ae = projetae.AutoEncodeur(2, 512, 128, 16, 0.01, 0.0012) inputdim = self.ae.in...
the_stack_v2_python_sparse
AutoencodeurProbabiliste/sourceae/test_symmetrie.py
Anastasija-Kuramzina/ProjetAutoencodeur
train
0
03c9bdc4e9a82386807ffa09b993f09e13e156b3
[ "self.assertTrue(anagram('dormitory', 'dirtyroom'))\nself.assertTrue(anagram('iceman', 'cinema'))\nself.assertTrue(anagram('star', 'rats'))\nself.assertFalse(anagram('cat', 'dog'))", "self.assertTrue(anagram_dd('dormitory', 'dirtyroom'))\nself.assertTrue(anagram_dd('iceman', 'cinema'))\nself.assertTrue(anagram_dd...
<|body_start_0|> self.assertTrue(anagram('dormitory', 'dirtyroom')) self.assertTrue(anagram('iceman', 'cinema')) self.assertTrue(anagram('star', 'rats')) self.assertFalse(anagram('cat', 'dog')) <|end_body_0|> <|body_start_1|> self.assertTrue(anagram_dd('dormitory', 'dirtyroom'))...
AnagramTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnagramTest: def test_anagram(self): """Testing the anagram function""" <|body_0|> def test_anagram_dd(self): """Testing the anagram default dict function""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.assertTrue(anagram('dormitory', 'dirtyroo...
stack_v2_sparse_classes_36k_train_004860
4,060
no_license
[ { "docstring": "Testing the anagram function", "name": "test_anagram", "signature": "def test_anagram(self)" }, { "docstring": "Testing the anagram default dict function", "name": "test_anagram_dd", "signature": "def test_anagram_dd(self)" } ]
2
stack_v2_sparse_classes_30k_train_004418
Implement the Python class `AnagramTest` described below. Class description: Implement the AnagramTest class. Method signatures and docstrings: - def test_anagram(self): Testing the anagram function - def test_anagram_dd(self): Testing the anagram default dict function
Implement the Python class `AnagramTest` described below. Class description: Implement the AnagramTest class. Method signatures and docstrings: - def test_anagram(self): Testing the anagram function - def test_anagram_dd(self): Testing the anagram default dict function <|skeleton|> class AnagramTest: def test_a...
79d3375b7b8db9236f51826623ffa1fd3966cce3
<|skeleton|> class AnagramTest: def test_anagram(self): """Testing the anagram function""" <|body_0|> def test_anagram_dd(self): """Testing the anagram default dict function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnagramTest: def test_anagram(self): """Testing the anagram function""" self.assertTrue(anagram('dormitory', 'dirtyroom')) self.assertTrue(anagram('iceman', 'cinema')) self.assertTrue(anagram('star', 'rats')) self.assertFalse(anagram('cat', 'dog')) def test_anagram...
the_stack_v2_python_sparse
HW07-fransabetpour.py
fs412/codingsamples
train
0
b406ab7188b6d69dec0609e85796b95dd6982bf4
[ "parser.add_argument('--group', help='Instance group name.', required=True)\nparser.add_argument('--action', help=\" Action to be performed on each instance. Currently only 'RECREATE' is\\n supported.\\n \", choices=['RECREATE'], default='RECREATE')\nparser.add_argument('--template', required=T...
<|body_start_0|> parser.add_argument('--group', help='Instance group name.', required=True) parser.add_argument('--action', help=" Action to be performed on each instance. Currently only 'RECREATE' is\n supported.\n ", choices=['RECREATE'], default='RECREATE') parser.add_arg...
Starts a new rolling update.
Start
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Start: """Starts a new rolling update.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""" ...
stack_v2_sparse_classes_36k_train_004861
7,955
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
3
null
Implement the Python class `Start` described below. Class description: Starts a new rolling update. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line afte...
Implement the Python class `Start` described below. Class description: Starts a new rolling update. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line afte...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class Start: """Starts a new rolling update.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Start: """Starts a new rolling update.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""" parser.ad...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/compute/rolling_updates/start.py
KaranToor/MA450
train
1
5926d20c572ca47764388d0aae517aa287246236
[ "if not os.path.isdir(modules_path):\n logging.error('No such directory: ' + modules_path)\nif not os.path.isdir(tests_directory_path):\n logging.error('No such directory: ' + tests_directory_path)\nself.modules_path = modules_path\nself.tests_directory = tests_directory_path\nself.default_template = 'puppet_...
<|body_start_0|> if not os.path.isdir(modules_path): logging.error('No such directory: ' + modules_path) if not os.path.isdir(tests_directory_path): logging.error('No such directory: ' + tests_directory_path) self.modules_path = modules_path self.tests_directory =...
Puppet Test Generator This is main class. It finds all modules in the given directory and creates tests for them. You should give constructor following arguments: - local_modules_path* Path to puppet modules which will be scanned for test files - tests_directory_path* Output directory where files will be written - debu...
PuppetTestGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PuppetTestGenerator: """Puppet Test Generator This is main class. It finds all modules in the given directory and creates tests for them. You should give constructor following arguments: - local_modules_path* Path to puppet modules which will be scanned for test files - tests_directory_path* Outp...
stack_v2_sparse_classes_36k_train_004862
5,110
permissive
[ { "docstring": "Constructor Constructor", "name": "__init__", "signature": "def __init__(self, tests_directory_path, modules_path)" }, { "docstring": "Find modules in library path Find all Puppet modules in module_library_path and create array of PuppetModule objects", "name": "find_modules"...
6
stack_v2_sparse_classes_30k_train_009735
Implement the Python class `PuppetTestGenerator` described below. Class description: Puppet Test Generator This is main class. It finds all modules in the given directory and creates tests for them. You should give constructor following arguments: - local_modules_path* Path to puppet modules which will be scanned for ...
Implement the Python class `PuppetTestGenerator` described below. Class description: Puppet Test Generator This is main class. It finds all modules in the given directory and creates tests for them. You should give constructor following arguments: - local_modules_path* Path to puppet modules which will be scanned for ...
178812b1971a900c49a8afc1688afd7475a6ffbb
<|skeleton|> class PuppetTestGenerator: """Puppet Test Generator This is main class. It finds all modules in the given directory and creates tests for them. You should give constructor following arguments: - local_modules_path* Path to puppet modules which will be scanned for test files - tests_directory_path* Outp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PuppetTestGenerator: """Puppet Test Generator This is main class. It finds all modules in the given directory and creates tests for them. You should give constructor following arguments: - local_modules_path* Path to puppet modules which will be scanned for test files - tests_directory_path* Output directory ...
the_stack_v2_python_sparse
fuelweb_test/puppet_tests/pp_testgenerator.py
mingj/fuel-main
train
0
130b616169f7318b61f47f3d6d3b8bed9408bb03
[ "self.TempSensor = TempSensorAdapterTask.TempSensorAdapterTask()\nself.looplimit = loop_param\nself.sleeptime = sleep_param", "i = 0\nself.TempSensor.sensorDataManager.SEND_EMAIL_NOTIFICATION = self.sendEmail\nif self.enableAdapter == False:\n return False\nwhile i < self.looplimit or self.LOOP_FOREVER == True...
<|body_start_0|> self.TempSensor = TempSensorAdapterTask.TempSensorAdapterTask() self.looplimit = loop_param self.sleeptime = sleep_param <|end_body_0|> <|body_start_1|> i = 0 self.TempSensor.sensorDataManager.SEND_EMAIL_NOTIFICATION = self.sendEmail if self.enableAdapte...
Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructor has a bunch of settings to control the program behavior with
TempSensorAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempSensorAdapter: """Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructor has a bunch of settings to control the program behavior with""" def __init__(self, loop_param=1, sleep_param=3): """Constructor""" <|body_0|> def run_temp_adapter...
stack_v2_sparse_classes_36k_train_004863
2,478
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, loop_param=1, sleep_param=3)" }, { "docstring": "Run method to run TempSensorAdapterTask and read temperature from the senseHAT", "name": "run_temp_adapter", "signature": "def run_temp_adapter(self) -> boo...
2
null
Implement the Python class `TempSensorAdapter` described below. Class description: Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructor has a bunch of settings to control the program behavior with Method signatures and docstrings: - def __init__(self, loop_param=1, sleep_param=3): Co...
Implement the Python class `TempSensorAdapter` described below. Class description: Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructor has a bunch of settings to control the program behavior with Method signatures and docstrings: - def __init__(self, loop_param=1, sleep_param=3): Co...
dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee
<|skeleton|> class TempSensorAdapter: """Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructor has a bunch of settings to control the program behavior with""" def __init__(self, loop_param=1, sleep_param=3): """Constructor""" <|body_0|> def run_temp_adapter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TempSensorAdapter: """Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructor has a bunch of settings to control the program behavior with""" def __init__(self, loop_param=1, sleep_param=3): """Constructor""" self.TempSensor = TempSensorAdapterTask.TempSenso...
the_stack_v2_python_sparse
apps/labs/module03/TempSensorAdapter.py
mnk400/iot-device
train
0
fb3af232f47e3a0c26bfb739b84c004280112591
[ "self.start = start\nself.home = home\nself.left_limit = left_limit\nself.right_limit = right_limit\nsuper().__init__(start, home)", "self.position += random.choice((-1, 1))\nif self.position < self.left_limit:\n self.position += 1\nelif self.position > self.right_limit:\n self.position -= 1\nelse:\n sel...
<|body_start_0|> self.start = start self.home = home self.left_limit = left_limit self.right_limit = right_limit super().__init__(start, home) <|end_body_0|> <|body_start_1|> self.position += random.choice((-1, 1)) if self.position < self.left_limit: ...
BoundedWalker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoundedWalker: def __init__(self, start, home, left_limit, right_limit): """Initialise the walker Arguments --------- start : int The walker's initial position home : int The walk ends when the walker reaches home left_limit : int The left boundary of walker movement right_limit : int Th...
stack_v2_sparse_classes_36k_train_004864
2,633
no_license
[ { "docstring": "Initialise the walker Arguments --------- start : int The walker's initial position home : int The walk ends when the walker reaches home left_limit : int The left boundary of walker movement right_limit : int The right boundary of walker movement", "name": "__init__", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_009700
Implement the Python class `BoundedWalker` described below. Class description: Implement the BoundedWalker class. Method signatures and docstrings: - def __init__(self, start, home, left_limit, right_limit): Initialise the walker Arguments --------- start : int The walker's initial position home : int The walk ends w...
Implement the Python class `BoundedWalker` described below. Class description: Implement the BoundedWalker class. Method signatures and docstrings: - def __init__(self, start, home, left_limit, right_limit): Initialise the walker Arguments --------- start : int The walker's initial position home : int The walk ends w...
527f908422b559e6afc1ec025c04336d7a13828d
<|skeleton|> class BoundedWalker: def __init__(self, start, home, left_limit, right_limit): """Initialise the walker Arguments --------- start : int The walker's initial position home : int The walk ends when the walker reaches home left_limit : int The left boundary of walker movement right_limit : int Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoundedWalker: def __init__(self, start, home, left_limit, right_limit): """Initialise the walker Arguments --------- start : int The walker's initial position home : int The walk ends when the walker reaches home left_limit : int The left boundary of walker movement right_limit : int The right bounda...
the_stack_v2_python_sparse
src/nicolai_munsterhjelm_ex/ex05/bounded_sim.py
Nicomunster/INF200-2019-Exercises
train
0
3019803152bc7807f566570960c2ce0e37966fce
[ "if sens_type not in self._sens_types:\n raise ValueError('illegal sensitivity type: \"{}\"'.format(sens_type))\nif isinstance(sig, HDLModulePort):\n sig = sig.signal\nelif sig is None and sens_type != 'any':\n raise ValueError('signal cannot be None')\nif not isinstance(sig, (HDLSignal, HDLSignalSlice, ty...
<|body_start_0|> if sens_type not in self._sens_types: raise ValueError('illegal sensitivity type: "{}"'.format(sens_type)) if isinstance(sig, HDLModulePort): sig = sig.signal elif sig is None and sens_type != 'any': raise ValueError('signal cannot be None') ...
Signal sensitivity descriptor.
HDLSensitivityDescriptor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HDLSensitivityDescriptor: """Signal sensitivity descriptor.""" def __init__(self, sens_type, sig=None): """Initialize.""" <|body_0|> def dumps(self): """Get representation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if sens_type not in self...
stack_v2_sparse_classes_36k_train_004865
2,166
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, sens_type, sig=None)" }, { "docstring": "Get representation.", "name": "dumps", "signature": "def dumps(self)" } ]
2
null
Implement the Python class `HDLSensitivityDescriptor` described below. Class description: Signal sensitivity descriptor. Method signatures and docstrings: - def __init__(self, sens_type, sig=None): Initialize. - def dumps(self): Get representation.
Implement the Python class `HDLSensitivityDescriptor` described below. Class description: Signal sensitivity descriptor. Method signatures and docstrings: - def __init__(self, sens_type, sig=None): Initialize. - def dumps(self): Get representation. <|skeleton|> class HDLSensitivityDescriptor: """Signal sensitivi...
463412cf6a72456acc8cb99569e7dc9c9d472f6d
<|skeleton|> class HDLSensitivityDescriptor: """Signal sensitivity descriptor.""" def __init__(self, sens_type, sig=None): """Initialize.""" <|body_0|> def dumps(self): """Get representation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HDLSensitivityDescriptor: """Signal sensitivity descriptor.""" def __init__(self, sens_type, sig=None): """Initialize.""" if sens_type not in self._sens_types: raise ValueError('illegal sensitivity type: "{}"'.format(sens_type)) if isinstance(sig, HDLModulePort): ...
the_stack_v2_python_sparse
hdltools/abshdl/sens.py
brunosmmm/hdltools
train
2
9eb6c1dae0d3fa4a63d952654441af02a645f4aa
[ "self._d_model = d_model\nself._dropout_rate = dropout_rate\nself._norm_epsilon = norm_epsilon\nself._sep_conv11x1 = transformer_layers.SeparableConv1DLayer(min_relative_pos=-10, max_relative_pos=0, output_size=int(2 * d_model), depthwise_filter_initializer_scale=initializer_scale, pointwise_filter_initializer_scal...
<|body_start_0|> self._d_model = d_model self._dropout_rate = dropout_rate self._norm_epsilon = norm_epsilon self._sep_conv11x1 = transformer_layers.SeparableConv1DLayer(min_relative_pos=-10, max_relative_pos=0, output_size=int(2 * d_model), depthwise_filter_initializer_scale=initializer...
The convolutional layers custom to the evolved transformer decoder. The input is passed through a 11x1 separable convolution followed by a ReLU on the left branch while it goes through a 7x1 separable convolution on the right branch. The outputs of the branches are summed and then passed through a layer norm. The outpu...
DecoderConvolutionalLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderConvolutionalLayer: """The convolutional layers custom to the evolved transformer decoder. The input is passed through a 11x1 separable convolution followed by a ReLU on the left branch while it goes through a 7x1 separable convolution on the right branch. The outputs of the branches are s...
stack_v2_sparse_classes_36k_train_004866
8,851
permissive
[ { "docstring": "Create an DecoderConvolutionalLayer. Args: d_model: a positive integer, the dimension of the model dim. dropout_rate: a float between 0 and 1. initializer_scale: a positive float, the scale for the initializers of the separable convolutional filters. norm_epsilon: a small positive float, the eps...
2
stack_v2_sparse_classes_30k_test_000502
Implement the Python class `DecoderConvolutionalLayer` described below. Class description: The convolutional layers custom to the evolved transformer decoder. The input is passed through a 11x1 separable convolution followed by a ReLU on the left branch while it goes through a 7x1 separable convolution on the right br...
Implement the Python class `DecoderConvolutionalLayer` described below. Class description: The convolutional layers custom to the evolved transformer decoder. The input is passed through a 11x1 separable convolution followed by a ReLU on the left branch while it goes through a 7x1 separable convolution on the right br...
fbf7b1e547e8b8cb134e81e1cd350c312c0b5a16
<|skeleton|> class DecoderConvolutionalLayer: """The convolutional layers custom to the evolved transformer decoder. The input is passed through a 11x1 separable convolution followed by a ReLU on the left branch while it goes through a 7x1 separable convolution on the right branch. The outputs of the branches are s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderConvolutionalLayer: """The convolutional layers custom to the evolved transformer decoder. The input is passed through a 11x1 separable convolution followed by a ReLU on the left branch while it goes through a 7x1 separable convolution on the right branch. The outputs of the branches are summed and the...
the_stack_v2_python_sparse
mesh_tensorflow/transformer/evolved_transformer.py
tensorflow/mesh
train
1,508
8a3e9d4242b3d6d14a099314dde1b9f17797ff14
[ "group = self._client.create(name=name, domain=domain, description=description)\nif check:\n self.check_group_presence(group, must_present=True)\n assert_that(group.name, equal_to(name))\n if domain:\n assert_that(group.domain, equal_to(domain))\n if description:\n assert_that(group.descri...
<|body_start_0|> group = self._client.create(name=name, domain=domain, description=description) if check: self.check_group_presence(group, must_present=True) assert_that(group.name, equal_to(name)) if domain: assert_that(group.domain, equal_to(domain))...
Group steps.
GroupSteps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupSteps: """Group steps.""" def create_group(self, name, domain=None, description=None, check=True): """Step to create a group. Args: name (str): the name of the group domain (str or class `keystoneclient.v3.domains.Domain`): the domain of the group description (str): the descript...
stack_v2_sparse_classes_36k_train_004867
4,589
no_license
[ { "docstring": "Step to create a group. Args: name (str): the name of the group domain (str or class `keystoneclient.v3.domains.Domain`): the domain of the group description (str): the description of the group Returns: keystoneclient.v3.groups.Group: the created group returned from server Raises: TimeoutExpired...
5
null
Implement the Python class `GroupSteps` described below. Class description: Group steps. Method signatures and docstrings: - def create_group(self, name, domain=None, description=None, check=True): Step to create a group. Args: name (str): the name of the group domain (str or class `keystoneclient.v3.domains.Domain`)...
Implement the Python class `GroupSteps` described below. Class description: Group steps. Method signatures and docstrings: - def create_group(self, name, domain=None, description=None, check=True): Step to create a group. Args: name (str): the name of the group domain (str or class `keystoneclient.v3.domains.Domain`)...
e7583444cd24893ec6ae237b47db7c605b99b0c5
<|skeleton|> class GroupSteps: """Group steps.""" def create_group(self, name, domain=None, description=None, check=True): """Step to create a group. Args: name (str): the name of the group domain (str or class `keystoneclient.v3.domains.Domain`): the domain of the group description (str): the descript...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupSteps: """Group steps.""" def create_group(self, name, domain=None, description=None, check=True): """Step to create a group. Args: name (str): the name of the group domain (str or class `keystoneclient.v3.domains.Domain`): the domain of the group description (str): the description of the gr...
the_stack_v2_python_sparse
stepler/keystone/steps/groups.py
Mirantis/stepler
train
16
ad7ab7242d76583f371031362955e4d18af5c04c
[ "plugins = plugins or []\nif not service_provider:\n return\nkeystone_idp_id = settings.KEYSTONE_PROVIDER_IDP_ID\nif service_provider == keystone_idp_id:\n return None\nfor plugin in plugins:\n unscoped_idp_auth = plugin.get_plugin(plugins=plugins, auth_url=auth_url, **kwargs)\n if unscoped_idp_auth:\n ...
<|body_start_0|> plugins = plugins or [] if not service_provider: return keystone_idp_id = settings.KEYSTONE_PROVIDER_IDP_ID if service_provider == keystone_idp_id: return None for plugin in plugins: unscoped_idp_auth = plugin.get_plugin(plugin...
K2KAuthPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class K2KAuthPlugin: def get_plugin(self, service_provider=None, auth_url=None, plugins=None, **kwargs): """Authenticate using keystone to keystone federation. This plugin uses other v3 plugins to authenticate a user to a identity provider in order to authenticate the user to a service provide...
stack_v2_sparse_classes_36k_train_004868
3,943
permissive
[ { "docstring": "Authenticate using keystone to keystone federation. This plugin uses other v3 plugins to authenticate a user to a identity provider in order to authenticate the user to a service provider :param service_provider: service provider ID :param auth_url: Keystone auth url :param plugins: list of open...
2
null
Implement the Python class `K2KAuthPlugin` described below. Class description: Implement the K2KAuthPlugin class. Method signatures and docstrings: - def get_plugin(self, service_provider=None, auth_url=None, plugins=None, **kwargs): Authenticate using keystone to keystone federation. This plugin uses other v3 plugin...
Implement the Python class `K2KAuthPlugin` described below. Class description: Implement the K2KAuthPlugin class. Method signatures and docstrings: - def get_plugin(self, service_provider=None, auth_url=None, plugins=None, **kwargs): Authenticate using keystone to keystone federation. This plugin uses other v3 plugin...
7896fd8c77a6766a1156a520946efaf792b76ca5
<|skeleton|> class K2KAuthPlugin: def get_plugin(self, service_provider=None, auth_url=None, plugins=None, **kwargs): """Authenticate using keystone to keystone federation. This plugin uses other v3 plugins to authenticate a user to a identity provider in order to authenticate the user to a service provide...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class K2KAuthPlugin: def get_plugin(self, service_provider=None, auth_url=None, plugins=None, **kwargs): """Authenticate using keystone to keystone federation. This plugin uses other v3 plugins to authenticate a user to a identity provider in order to authenticate the user to a service provider :param servi...
the_stack_v2_python_sparse
openstack_auth/plugin/k2k.py
openstack/horizon
train
1,060
4e52d4f0aa4670eac13826cab934920be18a5148
[ "super(DecoderRNN, self).__init__()\nself.embed = nn.Embedding(vocab_size, embed_size)\nself.lstm = nn.LSTM(embed_size, hidden_size, num_layers, batch_first=True)\nself.linear = nn.Linear(hidden_size, vocab_size)\nself.init_weights()", "self.embed.weight.data.uniform_(-0.1, 0.1)\nself.linear.weight.data.uniform_(...
<|body_start_0|> super(DecoderRNN, self).__init__() self.embed = nn.Embedding(vocab_size, embed_size) self.lstm = nn.LSTM(embed_size, hidden_size, num_layers, batch_first=True) self.linear = nn.Linear(hidden_size, vocab_size) self.init_weights() <|end_body_0|> <|body_start_1|> ...
DecoderRNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderRNN: def __init__(self, embed_size, hidden_size, vocab_size, num_layers): """Set the hyper-parameters and build the layers.""" <|body_0|> def init_weights(self): """Initialize weights.""" <|body_1|> def forward(self, features, captions, lengths): ...
stack_v2_sparse_classes_36k_train_004869
5,485
no_license
[ { "docstring": "Set the hyper-parameters and build the layers.", "name": "__init__", "signature": "def __init__(self, embed_size, hidden_size, vocab_size, num_layers)" }, { "docstring": "Initialize weights.", "name": "init_weights", "signature": "def init_weights(self)" }, { "doc...
4
stack_v2_sparse_classes_30k_train_014687
Implement the Python class `DecoderRNN` described below. Class description: Implement the DecoderRNN class. Method signatures and docstrings: - def __init__(self, embed_size, hidden_size, vocab_size, num_layers): Set the hyper-parameters and build the layers. - def init_weights(self): Initialize weights. - def forwar...
Implement the Python class `DecoderRNN` described below. Class description: Implement the DecoderRNN class. Method signatures and docstrings: - def __init__(self, embed_size, hidden_size, vocab_size, num_layers): Set the hyper-parameters and build the layers. - def init_weights(self): Initialize weights. - def forwar...
80150803ebe291db2b63db01115029b86f36a802
<|skeleton|> class DecoderRNN: def __init__(self, embed_size, hidden_size, vocab_size, num_layers): """Set the hyper-parameters and build the layers.""" <|body_0|> def init_weights(self): """Initialize weights.""" <|body_1|> def forward(self, features, captions, lengths): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderRNN: def __init__(self, embed_size, hidden_size, vocab_size, num_layers): """Set the hyper-parameters and build the layers.""" super(DecoderRNN, self).__init__() self.embed = nn.Embedding(vocab_size, embed_size) self.lstm = nn.LSTM(embed_size, hidden_size, num_layers, ba...
the_stack_v2_python_sparse
tag_walk/fachung/models/tagwalk_cnn_rnn.py
Antobiotics/tagWalk
train
2
7b0cc1b07082df37919b963436d467c10074364a
[ "if num == 0:\n return 0\nreturn (num - 1) % 9 + 1", "if num < 10:\n return num\nelse:\n res = 0\n for digit in str(num):\n res += int(digit)\n return self.addDigits(res)" ]
<|body_start_0|> if num == 0: return 0 return (num - 1) % 9 + 1 <|end_body_0|> <|body_start_1|> if num < 10: return num else: res = 0 for digit in str(num): res += int(digit) return self.addDigits(res) <|end_bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addDigits(self, num): """:type num: int :rtype: int""" <|body_0|> def addDigits_rec(self, num): """:type num: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if num == 0: return 0 return (num - 1) % ...
stack_v2_sparse_classes_36k_train_004870
735
no_license
[ { "docstring": ":type num: int :rtype: int", "name": "addDigits", "signature": "def addDigits(self, num)" }, { "docstring": ":type num: int :rtype: int", "name": "addDigits_rec", "signature": "def addDigits_rec(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num): :type num: int :rtype: int - def addDigits_rec(self, num): :type num: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num): :type num: int :rtype: int - def addDigits_rec(self, num): :type num: int :rtype: int <|skeleton|> class Solution: def addDigits(self, num): ...
92b4b7c6b69d39bf79a9e20a9fc947304c2a1de5
<|skeleton|> class Solution: def addDigits(self, num): """:type num: int :rtype: int""" <|body_0|> def addDigits_rec(self, num): """:type num: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addDigits(self, num): """:type num: int :rtype: int""" if num == 0: return 0 return (num - 1) % 9 + 1 def addDigits_rec(self, num): """:type num: int :rtype: int""" if num < 10: return num else: res = 0 ...
the_stack_v2_python_sparse
leet_0258_add_digits.py
kkaixiao/pythonalgo2
train
2
f087aaa10b71c9afcc2f3bd32bc392eb8f59d516
[ "cls._start_time = time.time()\nif not sys.stdout.isatty():\n return\nmax_length = cls.max_length - cls.indent - 3\nstring = string[:max_length]\nstring = ' ' * cls.indent + string + '...'\nsys.stdout.write(string)\nsys.stdout.flush()", "if cls.print_time:\n time_string = f'{time.time() - cls._start_time:.2...
<|body_start_0|> cls._start_time = time.time() if not sys.stdout.isatty(): return max_length = cls.max_length - cls.indent - 3 string = string[:max_length] string = ' ' * cls.indent + string + '...' sys.stdout.write(string) sys.stdout.flush() <|end_bod...
Class to nicely print out a command with timing info.
Command
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """Class to nicely print out a command with timing info.""" def start(cls, string): """Print the 'start command' string.""" <|body_0|> def end(cls, string): """Print the 'end of command' string.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004871
7,457
permissive
[ { "docstring": "Print the 'start command' string.", "name": "start", "signature": "def start(cls, string)" }, { "docstring": "Print the 'end of command' string.", "name": "end", "signature": "def end(cls, string)" } ]
2
null
Implement the Python class `Command` described below. Class description: Class to nicely print out a command with timing info. Method signatures and docstrings: - def start(cls, string): Print the 'start command' string. - def end(cls, string): Print the 'end of command' string.
Implement the Python class `Command` described below. Class description: Class to nicely print out a command with timing info. Method signatures and docstrings: - def start(cls, string): Print the 'start command' string. - def end(cls, string): Print the 'end of command' string. <|skeleton|> class Command: """Cl...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class Command: """Class to nicely print out a command with timing info.""" def start(cls, string): """Print the 'start command' string.""" <|body_0|> def end(cls, string): """Print the 'end of command' string.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: """Class to nicely print out a command with timing info.""" def start(cls, string): """Print the 'start command' string.""" cls._start_time = time.time() if not sys.stdout.isatty(): return max_length = cls.max_length - cls.indent - 3 string = s...
the_stack_v2_python_sparse
src/dials/util/command_line.py
dials/dials
train
71
b341a80d0b98d20bd612ab580d168513811c5f8f
[ "attr_d = source.AttrDict(zip('aeiou', range(1, 6)))\nattr_d.a = 0\nself.assertTrue('a' not in attr_d.__dict__, 'Wrong attribute assignment in AttrDict')\nself.assertEqual(attr_d['a'], 0, 'Wrong attribute assignment in AttrDict')\nself.assertEqual(attr_d.a, 0, 'Wrong attribute assignment in AttrDict')", "attr_d =...
<|body_start_0|> attr_d = source.AttrDict(zip('aeiou', range(1, 6))) attr_d.a = 0 self.assertTrue('a' not in attr_d.__dict__, 'Wrong attribute assignment in AttrDict') self.assertEqual(attr_d['a'], 0, 'Wrong attribute assignment in AttrDict') self.assertEqual(attr_d.a, 0, 'Wrong ...
Test exercise mod 06 AttrDict
TestAttrDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAttrDict: """Test exercise mod 06 AttrDict""" def test_setattr_existent(self): """Check __setattr__ customization of AttrDict. It must update a dictionary key only if it exists""" <|body_0|> def test_setattr_new(self): """Check __setattr__ customization of At...
stack_v2_sparse_classes_36k_train_004872
8,327
no_license
[ { "docstring": "Check __setattr__ customization of AttrDict. It must update a dictionary key only if it exists", "name": "test_setattr_existent", "signature": "def test_setattr_existent(self)" }, { "docstring": "Check __setattr__ customization of AttrDict. It must update a dictionary key only if...
4
stack_v2_sparse_classes_30k_train_017780
Implement the Python class `TestAttrDict` described below. Class description: Test exercise mod 06 AttrDict Method signatures and docstrings: - def test_setattr_existent(self): Check __setattr__ customization of AttrDict. It must update a dictionary key only if it exists - def test_setattr_new(self): Check __setattr_...
Implement the Python class `TestAttrDict` described below. Class description: Test exercise mod 06 AttrDict Method signatures and docstrings: - def test_setattr_existent(self): Check __setattr__ customization of AttrDict. It must update a dictionary key only if it exists - def test_setattr_new(self): Check __setattr_...
8f082201e24f0f2b991d9388500fdbf95d6f073d
<|skeleton|> class TestAttrDict: """Test exercise mod 06 AttrDict""" def test_setattr_existent(self): """Check __setattr__ customization of AttrDict. It must update a dictionary key only if it exists""" <|body_0|> def test_setattr_new(self): """Check __setattr__ customization of At...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAttrDict: """Test exercise mod 06 AttrDict""" def test_setattr_existent(self): """Check __setattr__ customization of AttrDict. It must update a dictionary key only if it exists""" attr_d = source.AttrDict(zip('aeiou', range(1, 6))) attr_d.a = 0 self.assertTrue('a' not ...
the_stack_v2_python_sparse
intermediate/exercises/mod_04_data_model/tests_mod_04.py
garciacastano09/pycourse
train
0
7fa046e92ae745dab30e1f6d57a67417b35c612c
[ "state_id = self.request.get('sid')\nif not state_id:\n self.ReportError('Missing required parameters.', status=400)\n return\nstate = ndb.Key(page_state.PageState, state_id).get()\nif not state:\n self.ReportError('Invalid sid.', status=400)\n return\nself.response.out.write(state.value)", "state = s...
<|body_start_0|> state_id = self.request.get('sid') if not state_id: self.ReportError('Missing required parameters.', status=400) return state = ndb.Key(page_state.PageState, state_id).get() if not state: self.ReportError('Invalid sid.', status=400) ...
Handles short URI.
ShortUriHandler
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShortUriHandler: """Handles short URI.""" def get(self): """Handles getting page states.""" <|body_0|> def post(self): """Handles saving page states and getting state id.""" <|body_1|> <|end_skeleton|> <|body_start_0|> state_id = self.request.ge...
stack_v2_sparse_classes_36k_train_004873
1,456
permissive
[ { "docstring": "Handles getting page states.", "name": "get", "signature": "def get(self)" }, { "docstring": "Handles saving page states and getting state id.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `ShortUriHandler` described below. Class description: Handles short URI. Method signatures and docstrings: - def get(self): Handles getting page states. - def post(self): Handles saving page states and getting state id.
Implement the Python class `ShortUriHandler` described below. Class description: Handles short URI. Method signatures and docstrings: - def get(self): Handles getting page states. - def post(self): Handles saving page states and getting state id. <|skeleton|> class ShortUriHandler: """Handles short URI.""" ...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ShortUriHandler: """Handles short URI.""" def get(self): """Handles getting page states.""" <|body_0|> def post(self): """Handles saving page states and getting state id.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShortUriHandler: """Handles short URI.""" def get(self): """Handles getting page states.""" state_id = self.request.get('sid') if not state_id: self.ReportError('Missing required parameters.', status=400) return state = ndb.Key(page_state.PageState,...
the_stack_v2_python_sparse
third_party/catapult/dashboard/dashboard/short_uri.py
metux/chromium-suckless
train
5
e261913ca6a92f5484f083f1a655151de3e7f054
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
This service allows management of links between Google Ads accounts and other accounts.
AccountLinkServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountLinkServiceServicer: """This service allows management of links between Google Ads accounts and other accounts.""" def GetAccountLink(self, request, context): """Returns the account link in full detail.""" <|body_0|> def MutateAccountLink(self, request, context): ...
stack_v2_sparse_classes_36k_train_004874
3,318
permissive
[ { "docstring": "Returns the account link in full detail.", "name": "GetAccountLink", "signature": "def GetAccountLink(self, request, context)" }, { "docstring": "Creates or removes an account link.", "name": "MutateAccountLink", "signature": "def MutateAccountLink(self, request, context)...
2
stack_v2_sparse_classes_30k_train_013679
Implement the Python class `AccountLinkServiceServicer` described below. Class description: This service allows management of links between Google Ads accounts and other accounts. Method signatures and docstrings: - def GetAccountLink(self, request, context): Returns the account link in full detail. - def MutateAccou...
Implement the Python class `AccountLinkServiceServicer` described below. Class description: This service allows management of links between Google Ads accounts and other accounts. Method signatures and docstrings: - def GetAccountLink(self, request, context): Returns the account link in full detail. - def MutateAccou...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class AccountLinkServiceServicer: """This service allows management of links between Google Ads accounts and other accounts.""" def GetAccountLink(self, request, context): """Returns the account link in full detail.""" <|body_0|> def MutateAccountLink(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountLinkServiceServicer: """This service allows management of links between Google Ads accounts and other accounts.""" def GetAccountLink(self, request, context): """Returns the account link in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details(...
the_stack_v2_python_sparse
google/ads/google_ads/v4/proto/services/account_link_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
4674d8f45aa15b975aafc585bdbdc28224470ad6
[ "if client is None:\n address = (self.host, self.port)\n self.socket = socket.socket()\n self.socket.connect(address)\nelse:\n self.socket = client\nreturn Connection.setup(self)", "assert self.poll and self.socket\nstring = pickle.dumps(message)\nsize = len(string)\npacket = self.format % (size, self...
<|body_start_0|> if client is None: address = (self.host, self.port) self.socket = socket.socket() self.socket.connect(address) else: self.socket = client return Connection.setup(self) <|end_body_0|> <|body_start_1|> assert self.poll and s...
Client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: def setup(self, client=None): """Connect to the given address. If a host connection object is not already listening on this address, this will not work.""" <|body_0|> def send(self, message): """Send a message across this connection. The message is converted ...
stack_v2_sparse_classes_36k_train_004875
5,772
no_license
[ { "docstring": "Connect to the given address. If a host connection object is not already listening on this address, this will not work.", "name": "setup", "signature": "def setup(self, client=None)" }, { "docstring": "Send a message across this connection. The message is converted to a string us...
3
stack_v2_sparse_classes_30k_train_005767
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def setup(self, client=None): Connect to the given address. If a host connection object is not already listening on this address, this will not work. - def send(self, message): Send ...
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def setup(self, client=None): Connect to the given address. If a host connection object is not already listening on this address, this will not work. - def send(self, message): Send ...
4a7485044b35c73bb4ecd0c6499fe1060d338c54
<|skeleton|> class Client: def setup(self, client=None): """Connect to the given address. If a host connection object is not already listening on this address, this will not work.""" <|body_0|> def send(self, message): """Send a message across this connection. The message is converted ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: def setup(self, client=None): """Connect to the given address. If a host connection object is not already listening on this address, this will not work.""" if client is None: address = (self.host, self.port) self.socket = socket.socket() self.socket....
the_stack_v2_python_sparse
network.py
kxgames/ClayPygeons
train
0
95108fbafc5973988bc322e247eddddd5d98999a
[ "transitions = model.transitions\nintent_logits, slots_logits = model.logits\ninput_intent_y, input_slots_y = model.input_y\nintent_score = tf.nn.softmax(intent_logits, name='intent_score')\nintent_preds = tf.argmax(intent_logits, axis=-1, name='intent_preds')\ny_intent_ground_truth = tf.argmax(input_intent_y, axis...
<|body_start_0|> transitions = model.transitions intent_logits, slots_logits = model.logits input_intent_y, input_slots_y = model.input_y intent_score = tf.nn.softmax(intent_logits, name='intent_score') intent_preds = tf.argmax(intent_logits, axis=-1, name='intent_preds') ...
Solver for NLU joint model.
RawNLUJointSolver
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RawNLUJointSolver: """Solver for NLU joint model.""" def build_output(self, model): """Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.""" <|body_0|> def build_export_output(self, mode...
stack_v2_sparse_classes_36k_train_004876
3,365
permissive
[ { "docstring": "Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.", "name": "build_output", "signature": "def build_output(self, model)" }, { "docstring": "Build the output of the model for export. `score` and ...
2
null
Implement the Python class `RawNLUJointSolver` described below. Class description: Solver for NLU joint model. Method signatures and docstrings: - def build_output(self, model): Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation. - de...
Implement the Python class `RawNLUJointSolver` described below. Class description: Solver for NLU joint model. Method signatures and docstrings: - def build_output(self, model): Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation. - de...
7eb4e3be578a680737616efff6858d280595ff48
<|skeleton|> class RawNLUJointSolver: """Solver for NLU joint model.""" def build_output(self, model): """Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.""" <|body_0|> def build_export_output(self, mode...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RawNLUJointSolver: """Solver for NLU joint model.""" def build_output(self, model): """Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.""" transitions = model.transitions intent_logits, slots_lo...
the_stack_v2_python_sparse
delta/utils/solver/raw_nlu_joint_solver.py
luffywalf/delta
train
1
11af807d4c795e1dc52c10bc098ecc1c3c2b8c65
[ "if delta_r is None:\n delta_r = 0\nif offset is None:\n offset = Point(0, 0, 0)\nif angle is None:\n angle = 0\nif weld_params is None:\n weld_params = WeldingState()\nself.offset = offset\nself.delta_r = delta_r\nself.angle = angle\nself.welding_parameters = weld_params", "if not mod.offset.is_zero(...
<|body_start_0|> if delta_r is None: delta_r = 0 if offset is None: offset = Point(0, 0, 0) if angle is None: angle = 0 if weld_params is None: weld_params = WeldingState() self.offset = offset self.delta_r = delta_r ...
Modification
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Modification: def __init__(self, offset=None, delta_r=None, angle=None, weld_params=None): """Initalize a Modification object Arguments: object {Modification} -- self Keyword Arguments: offset {Point} -- offset (x,y,z) in meters (default: Point(0,0,0)) delta_r {float} -- delta r angle (d...
stack_v2_sparse_classes_36k_train_004877
2,560
permissive
[ { "docstring": "Initalize a Modification object Arguments: object {Modification} -- self Keyword Arguments: offset {Point} -- offset (x,y,z) in meters (default: Point(0,0,0)) delta_r {float} -- delta r angle (default: 0) angle {float} -- torch angle (default: 0) weld_params {WeldingState} -- welding parameters ...
2
stack_v2_sparse_classes_30k_train_005147
Implement the Python class `Modification` described below. Class description: Implement the Modification class. Method signatures and docstrings: - def __init__(self, offset=None, delta_r=None, angle=None, weld_params=None): Initalize a Modification object Arguments: object {Modification} -- self Keyword Arguments: o...
Implement the Python class `Modification` described below. Class description: Implement the Modification class. Method signatures and docstrings: - def __init__(self, offset=None, delta_r=None, angle=None, weld_params=None): Initalize a Modification object Arguments: object {Modification} -- self Keyword Arguments: o...
7c39e1e5a6e98fc6c8dfcae6abf033f5d961b16c
<|skeleton|> class Modification: def __init__(self, offset=None, delta_r=None, angle=None, weld_params=None): """Initalize a Modification object Arguments: object {Modification} -- self Keyword Arguments: offset {Point} -- offset (x,y,z) in meters (default: Point(0,0,0)) delta_r {float} -- delta r angle (d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Modification: def __init__(self, offset=None, delta_r=None, angle=None, weld_params=None): """Initalize a Modification object Arguments: object {Modification} -- self Keyword Arguments: offset {Point} -- offset (x,y,z) in meters (default: Point(0,0,0)) delta_r {float} -- delta r angle (default: 0) ang...
the_stack_v2_python_sparse
src/rosweld/modification.py
HuaiLeiTang/rosweld_tools
train
0
4f3b0318c630b43da88388ca43e9262bd47dd651
[ "pmf = thinkbayes.MakePoissonPmf(r, high, step=step)\nthinkbayes.Suite.__init__(self, pmf, name=r)\nself.r = r\nself.f = f", "k = data\nn = hypo\np = self.f\nreturn thinkbayes.EvalBinomialPmf(k, n, p)", "total = 0\nfor hypo, prob in self.Items():\n like = self.Likelihood(data, hypo)\n total += prob * like...
<|body_start_0|> pmf = thinkbayes.MakePoissonPmf(r, high, step=step) thinkbayes.Suite.__init__(self, pmf, name=r) self.r = r self.f = f <|end_body_0|> <|body_start_1|> k = data n = hypo p = self.f return thinkbayes.EvalBinomialPmf(k, n, p) <|end_body_1|> ...
Represents hypotheses about n.
Detector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Detector: """Represents hypotheses about n.""" def __init__(self, r, f, high=500, step=5): """Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n""" <|body_0...
stack_v2_sparse_classes_36k_train_004878
5,605
permissive
[ { "docstring": "Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n", "name": "__init__", "signature": "def __init__(self, r, f, high=500, step=5)" }, { "docstring": "Likelihood...
3
stack_v2_sparse_classes_30k_train_020649
Implement the Python class `Detector` described below. Class description: Represents hypotheses about n. Method signatures and docstrings: - def __init__(self, r, f, high=500, step=5): Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step ...
Implement the Python class `Detector` described below. Class description: Represents hypotheses about n. Method signatures and docstrings: - def __init__(self, r, f, high=500, step=5): Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step ...
53c7ce7ca7da62c9fbb3d991ae9e4e34d07ece5f
<|skeleton|> class Detector: """Represents hypotheses about n.""" def __init__(self, r, f, high=500, step=5): """Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Detector: """Represents hypotheses about n.""" def __init__(self, r, f, high=500, step=5): """Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n""" pmf = thinkbayes.Make...
the_stack_v2_python_sparse
python/learn/thinkbayes/jaynes.py
qrsforever/workspace
train
2
a45bd42e3b29a6af758443782d1d7d411982823b
[ "super(Encoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",...
<|body_start_0|> super(Encoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, self.dm) self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N...
Encoder class for machine translation
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder class for machine translation""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] input_vocab ([type]): [...
stack_v2_sparse_classes_36k_train_004879
12,086
no_license
[ { "docstring": "[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] input_vocab ([type]): [description] max_seq_len ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.", "name": "__init__", "signat...
2
stack_v2_sparse_classes_30k_train_001961
Implement the Python class `Encoder` described below. Class description: Encoder class for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [descriptio...
Implement the Python class `Encoder` described below. Class description: Encoder class for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [descriptio...
5f86dee95f4d1c32014d0d74a368f342ff3ce6f7
<|skeleton|> class Encoder: """Encoder class for machine translation""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] input_vocab ([type]): [...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """Encoder class for machine translation""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] input_vocab ([type]): [description] ...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer.py
d1sd41n/holbertonschool-machine_learning
train
0
2d963f97e1d156da99ddb4473f36552dae6ae79b
[ "self.K = K\nif folder is not None:\n self.MoE_list = [None for k in range(K)]\n self.load(folder)\nelse:\n if type(N_exp_list) is int:\n N_exp_list = [N_exp_list for k in range(self.K)]\n if len(N_exp_list) != self.K:\n raise TypeError(\"Lenght of number of expters list doesn't match numb...
<|body_start_0|> self.K = K if folder is not None: self.MoE_list = [None for k in range(K)] self.load(folder) else: if type(N_exp_list) is int: N_exp_list = [N_exp_list for k in range(self.K)] if len(N_exp_list) != self.K: ...
This class contains a list of MoE models and deals with them easily. This might be useful for multidimensional regression where each target dimension is fitted separately by a MoE model. All models must have same input space dimensionality; they shall have same gating function model but might have different experts num...
MoE_list
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoE_list: """This class contains a list of MoE models and deals with them easily. This might be useful for multidimensional regression where each target dimension is fitted separately by a MoE model. All models must have same input space dimensionality; they shall have same gating function model ...
stack_v2_sparse_classes_36k_train_004880
4,450
permissive
[ { "docstring": "Initialise class. If folder is given, model is loaded from folder. Otherwise a softmax gating function model is built with the required dimensionality and number of experts. Input: K number of MoE models in MoE_list folder folder at which the model should be loaded from. (If None, nothing is loa...
6
stack_v2_sparse_classes_30k_train_018646
Implement the Python class `MoE_list` described below. Class description: This class contains a list of MoE models and deals with them easily. This might be useful for multidimensional regression where each target dimension is fitted separately by a MoE model. All models must have same input space dimensionality; they...
Implement the Python class `MoE_list` described below. Class description: This class contains a list of MoE models and deals with them easily. This might be useful for multidimensional regression where each target dimension is fitted separately by a MoE model. All models must have same input space dimensionality; they...
a786e9ce5845ba1f82980c5265307914c3c26e68
<|skeleton|> class MoE_list: """This class contains a list of MoE models and deals with them easily. This might be useful for multidimensional regression where each target dimension is fitted separately by a MoE model. All models must have same input space dimensionality; they shall have same gating function model ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoE_list: """This class contains a list of MoE models and deals with them easily. This might be useful for multidimensional regression where each target dimension is fitted separately by a MoE model. All models must have same input space dimensionality; they shall have same gating function model but might hav...
the_stack_v2_python_sparse
dev/tries_checks/routines/MoE_list.py
stefanoschmidt1995/MLGW
train
12
3d6095f593566bb252c83d23cc22d904bb93cbff
[ "rows = len(matrix)\ncols = len(matrix[0])\nresult = [[None] * rows for _ in range(cols)]\nfor i in range(rows):\n for j in range(cols):\n col = cols - i - 1\n result[j][col] = matrix[i][j]\nreturn result", "size = len(matrix)\nfor row in range(size):\n for column in range(row, size):\n ...
<|body_start_0|> rows = len(matrix) cols = len(matrix[0]) result = [[None] * rows for _ in range(cols)] for i in range(rows): for j in range(cols): col = cols - i - 1 result[j][col] = matrix[i][j] return result <|end_body_0|> <|body_st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate_1(self, matrix): """:type matrix: list of list of int :rtype: list of list of int""" <|body_0|> def rotate_2(self, matrix): """Do not return anything, modify matrix in-place instead.""" <|body_1|> def rotate(self, matrix): ""...
stack_v2_sparse_classes_36k_train_004881
2,528
no_license
[ { "docstring": ":type matrix: list of list of int :rtype: list of list of int", "name": "rotate_1", "signature": "def rotate_1(self, matrix)" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate_2", "signature": "def rotate_2(self, matrix)" }, ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_1(self, matrix): :type matrix: list of list of int :rtype: list of list of int - def rotate_2(self, matrix): Do not return anything, modify matrix in-place instead. - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_1(self, matrix): :type matrix: list of list of int :rtype: list of list of int - def rotate_2(self, matrix): Do not return anything, modify matrix in-place instead. - ...
ec48cbde4356208afac226d41752daffe674be2c
<|skeleton|> class Solution: def rotate_1(self, matrix): """:type matrix: list of list of int :rtype: list of list of int""" <|body_0|> def rotate_2(self, matrix): """Do not return anything, modify matrix in-place instead.""" <|body_1|> def rotate(self, matrix): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate_1(self, matrix): """:type matrix: list of list of int :rtype: list of list of int""" rows = len(matrix) cols = len(matrix[0]) result = [[None] * rows for _ in range(cols)] for i in range(rows): for j in range(cols): col =...
the_stack_v2_python_sparse
B2BSWE/Arrays/rotate_2d_array_90_degree_clockwise.py
librar127/PythonDS
train
0
0d9d0fcb29341f051b4b31640a98976da53f2422
[ "for id, op in vars(cls).items():\n if isinstance(op, IOperation) and op.is_valid(operator, left, right):\n if isinstance(op, BinaryOperation):\n return op.build(left, right)\n else:\n from boa3.model.type.type import Type\n operand = right if left is Type.none else...
<|body_start_0|> for id, op in vars(cls).items(): if isinstance(op, IOperation) and op.is_valid(operator, left, right): if isinstance(op, BinaryOperation): return op.build(left, right) else: from boa3.model.type.type import Type...
BinaryOp
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryOp: def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: """Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right opera...
stack_v2_sparse_classes_36k_train_004882
4,052
permissive
[ { "docstring": "Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right operand :return: The operation if exists. None otherwise; :rtype: BinaryOperation or None", "name": "validate_type", "...
3
stack_v2_sparse_classes_30k_train_011899
Implement the Python class `BinaryOp` described below. Class description: Implement the BinaryOp class. Method signatures and docstrings: - def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: Gets a binary operation given the operator and the operands types. :param oper...
Implement the Python class `BinaryOp` described below. Class description: Implement the BinaryOp class. Method signatures and docstrings: - def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: Gets a binary operation given the operator and the operands types. :param oper...
e4ef340744b5bd25ade26f847eac50789b97f3e9
<|skeleton|> class BinaryOp: def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: """Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right opera...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryOp: def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: """Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right operand :return: Th...
the_stack_v2_python_sparse
boa3/model/operation/binaryop.py
DanPopa46/neo3-boa
train
0
64dbd40925d5339305904116929bd29b19eab3e7
[ "interpol = pero.PowInterpol(power=2)\nself.assertAlmostEqual(interpol.normalize(50, 0, 100), 0.25, 10)\nself.assertAlmostEqual(interpol.denormalize(0.25, 0, 100), 50, 10)\nself.assertAlmostEqual(interpol.normalize(0.01, 1, 100), -0.0001, 10)\nself.assertAlmostEqual(interpol.denormalize(-0.0001, 1, 100), 0.01, 10)\...
<|body_start_0|> interpol = pero.PowInterpol(power=2) self.assertAlmostEqual(interpol.normalize(50, 0, 100), 0.25, 10) self.assertAlmostEqual(interpol.denormalize(0.25, 0, 100), 50, 10) self.assertAlmostEqual(interpol.normalize(0.01, 1, 100), -0.0001, 10) self.assertAlmostEqual(i...
Test case for power interpolator.
TestCase
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCase: """Test case for power interpolator.""" def test_pow(self): """Tests whether interpolator works with 2 exponent.""" <|body_0|> def test_sqrt(self): """Tests whether interpolator works with 1/2 exponent.""" <|body_1|> def test_arrays(self): ...
stack_v2_sparse_classes_36k_train_004883
2,120
permissive
[ { "docstring": "Tests whether interpolator works with 2 exponent.", "name": "test_pow", "signature": "def test_pow(self)" }, { "docstring": "Tests whether interpolator works with 1/2 exponent.", "name": "test_sqrt", "signature": "def test_sqrt(self)" }, { "docstring": "Tests whet...
3
null
Implement the Python class `TestCase` described below. Class description: Test case for power interpolator. Method signatures and docstrings: - def test_pow(self): Tests whether interpolator works with 2 exponent. - def test_sqrt(self): Tests whether interpolator works with 1/2 exponent. - def test_arrays(self): Test...
Implement the Python class `TestCase` described below. Class description: Test case for power interpolator. Method signatures and docstrings: - def test_pow(self): Tests whether interpolator works with 2 exponent. - def test_sqrt(self): Tests whether interpolator works with 1/2 exponent. - def test_arrays(self): Test...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class TestCase: """Test case for power interpolator.""" def test_pow(self): """Tests whether interpolator works with 2 exponent.""" <|body_0|> def test_sqrt(self): """Tests whether interpolator works with 1/2 exponent.""" <|body_1|> def test_arrays(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCase: """Test case for power interpolator.""" def test_pow(self): """Tests whether interpolator works with 2 exponent.""" interpol = pero.PowInterpol(power=2) self.assertAlmostEqual(interpol.normalize(50, 0, 100), 0.25, 10) self.assertAlmostEqual(interpol.denormalize(0...
the_stack_v2_python_sparse
unittests/scales/test_pow.py
xxao/pero
train
31
f589878f9056f5a44b4d6c0ac540962556174c79
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessReviewHistoryScheduleSettings()", "from .patterned_recurrence import PatternedRecurrence\nfrom .patterned_recurrence import PatternedRecurrence\nfields: Dict[str, Callable[[Any], None]] = {'@odata.type': lambda n: setattr(self, '...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessReviewHistoryScheduleSettings() <|end_body_0|> <|body_start_1|> from .patterned_recurrence import PatternedRecurrence from .patterned_recurrence import PatternedRecurrence ...
AccessReviewHistoryScheduleSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessReviewHistoryScheduleSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewHistoryScheduleSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr...
stack_v2_sparse_classes_36k_train_004884
3,414
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: AccessReviewHistoryScheduleSettings", "name": "create_from_discriminator_value", "signature": "def create_fr...
3
null
Implement the Python class `AccessReviewHistoryScheduleSettings` described below. Class description: Implement the AccessReviewHistoryScheduleSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewHistoryScheduleSettings: Creates a ...
Implement the Python class `AccessReviewHistoryScheduleSettings` described below. Class description: Implement the AccessReviewHistoryScheduleSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewHistoryScheduleSettings: Creates a ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessReviewHistoryScheduleSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewHistoryScheduleSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccessReviewHistoryScheduleSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewHistoryScheduleSettings: """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...
the_stack_v2_python_sparse
msgraph/generated/models/access_review_history_schedule_settings.py
microsoftgraph/msgraph-sdk-python
train
135
b34232f3efbb7c2a39774ced02fb876516e47467
[ "self.pv1_enabled = False\nself.pv2_enabled = False\nself.output1_enabled = False\nself.output2_enabled = False\nself.timestamp = None\nself.reading = []\nsuper().__init__()", "try:\n self.timestamp = None\n self.reading = []\n ts = _time.time()\n if self.pv1_enabled:\n pv1 = _air_udc.read_pv1(...
<|body_start_0|> self.pv1_enabled = False self.pv2_enabled = False self.output1_enabled = False self.output2_enabled = False self.timestamp = None self.reading = [] super().__init__() <|end_body_0|> <|body_start_1|> try: self.timestamp = None ...
Read values worker.
ReadValueWorker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadValueWorker: """Read values worker.""" def __init__(self): """Initialize object.""" <|body_0|> def run(self): """Read values from devices.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pv1_enabled = False self.pv2_enabled = Fa...
stack_v2_sparse_classes_36k_train_004885
5,163
no_license
[ { "docstring": "Initialize object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Read values from devices.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_003602
Implement the Python class `ReadValueWorker` described below. Class description: Read values worker. Method signatures and docstrings: - def __init__(self): Initialize object. - def run(self): Read values from devices.
Implement the Python class `ReadValueWorker` described below. Class description: Read values worker. Method signatures and docstrings: - def __init__(self): Initialize object. - def run(self): Read values from devices. <|skeleton|> class ReadValueWorker: """Read values worker.""" def __init__(self): ...
25a9256522ea82e181639294e6d23ab2372a76b4
<|skeleton|> class ReadValueWorker: """Read values worker.""" def __init__(self): """Initialize object.""" <|body_0|> def run(self): """Read values from devices.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadValueWorker: """Read values worker.""" def __init__(self): """Initialize object.""" self.pv1_enabled = False self.pv2_enabled = False self.output1_enabled = False self.output2_enabled = False self.timestamp = None self.reading = [] super...
the_stack_v2_python_sparse
hallbench/gui/airconditioningwidget.py
lnls-ima/hall-bench-control
train
1
1478d9fafae4c2fe36b83996707609d776611c9d
[ "serialized = []\n\ndef recurse(root):\n if root:\n serialized.append(str(root.val))\n recurse(root.left)\n recurse(root.right)\n else:\n serialized.append('#')\nrecurse(root)\nreturn ' '.join(serialized)", "def buildTree(vals):\n val = next(vals)\n if val == '#':\n ...
<|body_start_0|> serialized = [] def recurse(root): if root: serialized.append(str(root.val)) recurse(root.left) recurse(root.right) else: serialized.append('#') recurse(root) return ' '.join(seriali...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_004886
1,750
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
6de551327f96ec4d4b63d0045281b65bbb4f5d0f
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" serialized = [] def recurse(root): if root: serialized.append(str(root.val)) recurse(root.left) recurse(root.right) ...
the_stack_v2_python_sparse
serialize.py
JingweiTu/leetcode
train
0
8f628d9883f132531e7589e207ab2ae7091bff3e
[ "print(\"'%s' is a scalar value of type '%s'.\" % (expr, value.type))\nprint('%s = %s' % (expr, str(value)))\nif is_child:\n Explorer.return_to_parent_value_prompt()\n Explorer.return_to_parent_value()\nreturn False", "if datatype.code == gdb.TYPE_CODE_ENUM:\n if is_child:\n print(\"%s is of an en...
<|body_start_0|> print("'%s' is a scalar value of type '%s'." % (expr, value.type)) print('%s = %s' % (expr, str(value))) if is_child: Explorer.return_to_parent_value_prompt() Explorer.return_to_parent_value() return False <|end_body_0|> <|body_start_1|> ...
Internal class used to explore scalar values.
ScalarExplorer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScalarExplorer: """Internal class used to explore scalar values.""" def explore_expr(expr, value, is_child): """Function to explore scalar values. See Explorer.explore_expr and Explorer.is_scalar_type for more information.""" <|body_0|> def explore_type(name, datatype, i...
stack_v2_sparse_classes_36k_train_004887
26,692
permissive
[ { "docstring": "Function to explore scalar values. See Explorer.explore_expr and Explorer.is_scalar_type for more information.", "name": "explore_expr", "signature": "def explore_expr(expr, value, is_child)" }, { "docstring": "Function to explore scalar types. See Explorer.explore_type and Explo...
2
stack_v2_sparse_classes_30k_train_020372
Implement the Python class `ScalarExplorer` described below. Class description: Internal class used to explore scalar values. Method signatures and docstrings: - def explore_expr(expr, value, is_child): Function to explore scalar values. See Explorer.explore_expr and Explorer.is_scalar_type for more information. - de...
Implement the Python class `ScalarExplorer` described below. Class description: Internal class used to explore scalar values. Method signatures and docstrings: - def explore_expr(expr, value, is_child): Function to explore scalar values. See Explorer.explore_expr and Explorer.is_scalar_type for more information. - de...
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
<|skeleton|> class ScalarExplorer: """Internal class used to explore scalar values.""" def explore_expr(expr, value, is_child): """Function to explore scalar values. See Explorer.explore_expr and Explorer.is_scalar_type for more information.""" <|body_0|> def explore_type(name, datatype, i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScalarExplorer: """Internal class used to explore scalar values.""" def explore_expr(expr, value, is_child): """Function to explore scalar values. See Explorer.explore_expr and Explorer.is_scalar_type for more information.""" print("'%s' is a scalar value of type '%s'." % (expr, value.typ...
the_stack_v2_python_sparse
toolchain/riscv/Linux/share/gdb/python/gdb/command/explore.py
bouffalolab/bl_iot_sdk
train
244
e86d931933aee7d90c7745d2d0d90c8952bdb3d7
[ "coords, instructs = parse(filename)\nmax_x = 0\nmax_y = 0\nfor x, y in coords:\n max_x = max(x, max_x)\n max_y = max(y, max_y)\nif max_x == 1305:\n max_x = 1310\nif max_y == 893:\n max_y = 894\ngrid = np.zeros((max_y + 1, max_x + 1), dtype=int)\nfor x, y in coords:\n grid[y][x] = 1\nfor var, amt in ...
<|body_start_0|> coords, instructs = parse(filename) max_x = 0 max_y = 0 for x, y in coords: max_x = max(x, max_x) max_y = max(y, max_y) if max_x == 1305: max_x = 1310 if max_y == 893: max_y = 894 grid = np.zeros((ma...
AoC 2021 Day 13
Day13
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day13: """AoC 2021 Day 13""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 13 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2021 day 13 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004888
2,946
no_license
[ { "docstring": "Given a filename, solve 2021 day 13 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2021 day 13 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_011947
Implement the Python class `Day13` described below. Class description: AoC 2021 Day 13 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2021 day 13 part 1 - def part2(filename: str) -> int: Given a filename, solve 2021 day 13 part 2
Implement the Python class `Day13` described below. Class description: AoC 2021 Day 13 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2021 day 13 part 1 - def part2(filename: str) -> int: Given a filename, solve 2021 day 13 part 2 <|skeleton|> class Day13: """AoC 202...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day13: """AoC 2021 Day 13""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 13 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2021 day 13 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Day13: """AoC 2021 Day 13""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 13 part 1""" coords, instructs = parse(filename) max_x = 0 max_y = 0 for x, y in coords: max_x = max(x, max_x) max_y = max(y, max_y) if...
the_stack_v2_python_sparse
2021/python2021/aoc/day13.py
mreishus/aoc
train
16
57c4b6fb18cb2da88aadfed95fc5a616080a2b02
[ "super().__init__(parent)\nself.setupUi(self)\nself.name = 'Data'\nself.config = DataConfig()\nself.pixelScaleLineEdit.setValidator(QDoubleValidator(0.0, LARGE_FLOAT_VALUE_FOR_VALIDATOR, 5))\nself.sigmaScaleLineEdit.setValidator(QDoubleValidator(-LARGE_FLOAT_VALUE_FOR_VALIDATOR, LARGE_FLOAT_VALUE_FOR_VALIDATOR, 5))...
<|body_start_0|> super().__init__(parent) self.setupUi(self) self.name = 'Data' self.config = DataConfig() self.pixelScaleLineEdit.setValidator(QDoubleValidator(0.0, LARGE_FLOAT_VALUE_FOR_VALIDATOR, 5)) self.sigmaScaleLineEdit.setValidator(QDoubleValidator(-LARGE_FLOAT_VA...
Class that handles the data configuration tab. Attributes ---------- name : str The name for the tab widget.
DataConfigTab
[ "Python-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataConfigTab: """Class that handles the data configuration tab. Attributes ---------- name : str The name for the tab widget.""" def __init__(self, parent=None): """Initialize the class. Parameters ---------- parent : None, optional Top-level widget.""" <|body_0|> def g...
stack_v2_sparse_classes_36k_train_004889
3,230
permissive
[ { "docstring": "Initialize the class. Parameters ---------- parent : None, optional Top-level widget.", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Get the configuration parameter's from the tab's widgets. Returns ------- `config.DataConfig` The current ...
3
null
Implement the Python class `DataConfigTab` described below. Class description: Class that handles the data configuration tab. Attributes ---------- name : str The name for the tab widget. Method signatures and docstrings: - def __init__(self, parent=None): Initialize the class. Parameters ---------- parent : None, op...
Implement the Python class `DataConfigTab` described below. Class description: Class that handles the data configuration tab. Attributes ---------- name : str The name for the tab widget. Method signatures and docstrings: - def __init__(self, parent=None): Initialize the class. Parameters ---------- parent : None, op...
3d0242276198126240667ba13e95b7bdf901d053
<|skeleton|> class DataConfigTab: """Class that handles the data configuration tab. Attributes ---------- name : str The name for the tab widget.""" def __init__(self, parent=None): """Initialize the class. Parameters ---------- parent : None, optional Top-level widget.""" <|body_0|> def g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataConfigTab: """Class that handles the data configuration tab. Attributes ---------- name : str The name for the tab widget.""" def __init__(self, parent=None): """Initialize the class. Parameters ---------- parent : None, optional Top-level widget.""" super().__init__(parent) s...
the_stack_v2_python_sparse
spot_motion_monitor/views/data_config_tab.py
lsst-sitcom/spot_motion_monitor
train
0
01e83003debc5ad3df30a4bb95a10981412a4ddb
[ "from apysc.expression import expression_variables_util\nfrom apysc.expression.event_handler_scope import TemporaryNotHandlerScope\nwith TemporaryNotHandlerScope():\n result: CopyInterface = deepcopy(self)\n result.variable_name = expression_variables_util.get_next_variable_name(type_name=self.type_name)\n ...
<|body_start_0|> from apysc.expression import expression_variables_util from apysc.expression.event_handler_scope import TemporaryNotHandlerScope with TemporaryNotHandlerScope(): result: CopyInterface = deepcopy(self) result.variable_name = expression_variables_util.get_n...
CopyInterface
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopyInterface: def _copy(self) -> Any: """Make a deep copy of this instance. Returns ------- result : * Copied instance.""" <|body_0|> def _append_copy_expression(self, result_variable_name: str) -> None: """Append copy expression to file. Parameters ---------- resul...
stack_v2_sparse_classes_36k_train_004890
1,553
permissive
[ { "docstring": "Make a deep copy of this instance. Returns ------- result : * Copied instance.", "name": "_copy", "signature": "def _copy(self) -> Any" }, { "docstring": "Append copy expression to file. Parameters ---------- result_variable_name : str Copied value's variable name.", "name": ...
2
stack_v2_sparse_classes_30k_train_005305
Implement the Python class `CopyInterface` described below. Class description: Implement the CopyInterface class. Method signatures and docstrings: - def _copy(self) -> Any: Make a deep copy of this instance. Returns ------- result : * Copied instance. - def _append_copy_expression(self, result_variable_name: str) ->...
Implement the Python class `CopyInterface` described below. Class description: Implement the CopyInterface class. Method signatures and docstrings: - def _copy(self) -> Any: Make a deep copy of this instance. Returns ------- result : * Copied instance. - def _append_copy_expression(self, result_variable_name: str) ->...
5c6a4674e2e9684cb2cb1325dc9b070879d4d355
<|skeleton|> class CopyInterface: def _copy(self) -> Any: """Make a deep copy of this instance. Returns ------- result : * Copied instance.""" <|body_0|> def _append_copy_expression(self, result_variable_name: str) -> None: """Append copy expression to file. Parameters ---------- resul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CopyInterface: def _copy(self) -> Any: """Make a deep copy of this instance. Returns ------- result : * Copied instance.""" from apysc.expression import expression_variables_util from apysc.expression.event_handler_scope import TemporaryNotHandlerScope with TemporaryNotHandlerS...
the_stack_v2_python_sparse
apysc/type/copy_interface.py
TrendingTechnology/apysc
train
0
584268f75e9ca287fcc298e53a60aeddde4726ac
[ "m, n = (len(board), len(board[0]))\nfor i, j in product(range(m), range(n)):\n cnt = 0\n for di, dj in product(range(-1, 2), repeat=2):\n if di != 0 or dj != 0:\n ii, jj = (i + di, j + dj)\n if 0 <= ii < m and 0 <= jj < n:\n cnt += board[ii][jj] & 1\n if cnt == ...
<|body_start_0|> m, n = (len(board), len(board[0])) for i, j in product(range(m), range(n)): cnt = 0 for di, dj in product(range(-1, 2), repeat=2): if di != 0 or dj != 0: ii, jj = (i + di, j + dj) if 0 <= ii < m and 0 <= jj ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def gameOfLifeBit(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.""" <|body_0|> def gameOfLife(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board ...
stack_v2_sparse_classes_36k_train_004891
4,934
no_license
[ { "docstring": ":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.", "name": "gameOfLifeBit", "signature": "def gameOfLifeBit(self, board)" }, { "docstring": ":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place ins...
2
stack_v2_sparse_classes_30k_train_016730
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLifeBit(self, board): :type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead. - def gameOfLife(self, board): :type board: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLifeBit(self, board): :type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead. - def gameOfLife(self, board): :type board: List[...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def gameOfLifeBit(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.""" <|body_0|> def gameOfLife(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def gameOfLifeBit(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.""" m, n = (len(board), len(board[0])) for i, j in product(range(m), range(n)): cnt = 0 for di, dj in product(range(-1, 2...
the_stack_v2_python_sparse
G/GameOfLife.py
bssrdf/pyleet
train
2
89ef6e14d4646b1732802e0548ae21f484fe1055
[ "if not isinstance(K, Sequence) or len(K) != 3 or (not all((isinstance(x, Real) for x in K))):\n self.throw(ValueError, 'K must be a list or tuple of 3 real numbers, P, I, and D')\nself.K_P, self.K_I, self.K_D = K or DEFAULT_K\nself.P, self.I, self.D = (0.0, 0.0, 0.0)\nself.RC = RC\nself.dt = dt", "decay = sel...
<|body_start_0|> if not isinstance(K, Sequence) or len(K) != 3 or (not all((isinstance(x, Real) for x in K))): self.throw(ValueError, 'K must be a list or tuple of 3 real numbers, P, I, and D') self.K_P, self.K_I, self.K_D = K or DEFAULT_K self.P, self.I, self.D = (0.0, 0.0, 0.0) ...
PID: agent that plays a PID policy Todo: - Allow for variable time deltas
PID
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PID: """PID: agent that plays a PID policy Todo: - Allow for variable time deltas""" def __init__(self, K: Sequence[int]=None, RC: Real=0.5, dt: Real=0.03, **kwargs) -> None: """Description: initializes the PID agent Args: K (Sequence[int]): sequence of PID parameters RC (Real): deca...
stack_v2_sparse_classes_36k_train_004892
2,144
permissive
[ { "docstring": "Description: initializes the PID agent Args: K (Sequence[int]): sequence of PID parameters RC (Real): decay parameter dt (Real): time increment Returns: None", "name": "__init__", "signature": "def __init__(self, K: Sequence[int]=None, RC: Real=0.5, dt: Real=0.03, **kwargs) -> None" },...
2
stack_v2_sparse_classes_30k_train_016595
Implement the Python class `PID` described below. Class description: PID: agent that plays a PID policy Todo: - Allow for variable time deltas Method signatures and docstrings: - def __init__(self, K: Sequence[int]=None, RC: Real=0.5, dt: Real=0.03, **kwargs) -> None: Description: initializes the PID agent Args: K (S...
Implement the Python class `PID` described below. Class description: PID: agent that plays a PID policy Todo: - Allow for variable time deltas Method signatures and docstrings: - def __init__(self, K: Sequence[int]=None, RC: Real=0.5, dt: Real=0.03, **kwargs) -> None: Description: initializes the PID agent Args: K (S...
74ba003fb24cae78f86016f6e1de3aeeff25d89d
<|skeleton|> class PID: """PID: agent that plays a PID policy Todo: - Allow for variable time deltas""" def __init__(self, K: Sequence[int]=None, RC: Real=0.5, dt: Real=0.03, **kwargs) -> None: """Description: initializes the PID agent Args: K (Sequence[int]): sequence of PID parameters RC (Real): deca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PID: """PID: agent that plays a PID policy Todo: - Allow for variable time deltas""" def __init__(self, K: Sequence[int]=None, RC: Real=0.5, dt: Real=0.03, **kwargs) -> None: """Description: initializes the PID agent Args: K (Sequence[int]): sequence of PID parameters RC (Real): decay parameter d...
the_stack_v2_python_sparse
deluca/agents/_pid.py
MinRegret/deluca
train
27
7122c079cdfa9351606d8b53e4dcdd84f4978827
[ "power = 0\nfor dy in range(y, y + size - 1):\n power += self.cells[x + size - 1, dy]\nfor dx in range(x, x + size):\n power += self.cells[dx, y + size - 1]\nreturn power", "if size == 1:\n return self.cells[x, y]\nelse:\n border = self.get_border_power(x, y, size)\n return self.get_square_power(x,...
<|body_start_0|> power = 0 for dy in range(y, y + size - 1): power += self.cells[x + size - 1, dy] for dx in range(x, x + size): power += self.cells[dx, y + size - 1] return power <|end_body_0|> <|body_start_1|> if size == 1: return self.cells...
Grid with a cached square power calculation.
CachedGrid
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedGrid: """Grid with a cached square power calculation.""" def get_border_power(self, x: int, y: int, size: int) -> Power: """Calculate left and bottom area brims power.""" <|body_0|> def get_square_power(self, x: int, y: int, size: int) -> Power: """Calculat...
stack_v2_sparse_classes_36k_train_004893
1,549
permissive
[ { "docstring": "Calculate left and bottom area brims power.", "name": "get_border_power", "signature": "def get_border_power(self, x: int, y: int, size: int) -> Power" }, { "docstring": "Calculate a cell square sum power by caching previous calls.", "name": "get_square_power", "signature...
2
null
Implement the Python class `CachedGrid` described below. Class description: Grid with a cached square power calculation. Method signatures and docstrings: - def get_border_power(self, x: int, y: int, size: int) -> Power: Calculate left and bottom area brims power. - def get_square_power(self, x: int, y: int, size: in...
Implement the Python class `CachedGrid` described below. Class description: Grid with a cached square power calculation. Method signatures and docstrings: - def get_border_power(self, x: int, y: int, size: int) -> Power: Calculate left and bottom area brims power. - def get_square_power(self, x: int, y: int, size: in...
4b8ac6a97859b1320f77ba0ee91168b58db28cdb
<|skeleton|> class CachedGrid: """Grid with a cached square power calculation.""" def get_border_power(self, x: int, y: int, size: int) -> Power: """Calculate left and bottom area brims power.""" <|body_0|> def get_square_power(self, x: int, y: int, size: int) -> Power: """Calculat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CachedGrid: """Grid with a cached square power calculation.""" def get_border_power(self, x: int, y: int, size: int) -> Power: """Calculate left and bottom area brims power.""" power = 0 for dy in range(y, y + size - 1): power += self.cells[x + size - 1, dy] fo...
the_stack_v2_python_sparse
src/year2018/day11b.py
lancelote/advent_of_code
train
11
b4977bf7b14d7cb44640fd1652348c04a546afb7
[ "project, network, phases = cls._parse_args(network=network, phases=phases)\ndf = Pandas.export_data(network=network, phases=phases, join=True, delim=delim)\nif filename == '':\n filename = project.name\nfname = cls._parse_filename(filename=filename, ext='csv')\ndf.to_csv(fname, index=False)", "from pandas imp...
<|body_start_0|> project, network, phases = cls._parse_args(network=network, phases=phases) df = Pandas.export_data(network=network, phases=phases, join=True, delim=delim) if filename == '': filename = project.name fname = cls._parse_filename(filename=filename, ext='csv') ...
Reads and writes CSV (comma-separated-value files) containing pore and throat data Notes ----- There are a few rules governing how the data is be stored: 1. The first row of the file (column headers) must contain the property names. The subsequent rows contain the data. 2. The property names should be in the usual Open...
CSV
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSV: """Reads and writes CSV (comma-separated-value files) containing pore and throat data Notes ----- There are a few rules governing how the data is be stored: 1. The first row of the file (column headers) must contain the property names. The subsequent rows contain the data. 2. The property na...
stack_v2_sparse_classes_36k_train_004894
4,965
permissive
[ { "docstring": "Save all the pore and throat property data on the Network (and optionally on any Phases objects) to CSV files. Parameters ---------- network : OpenPNM Network The Network containing the data to be stored phases : list of OpenPNM Phases (optional) The Phases whose data should be stored. filename ...
2
stack_v2_sparse_classes_30k_train_020818
Implement the Python class `CSV` described below. Class description: Reads and writes CSV (comma-separated-value files) containing pore and throat data Notes ----- There are a few rules governing how the data is be stored: 1. The first row of the file (column headers) must contain the property names. The subsequent ro...
Implement the Python class `CSV` described below. Class description: Reads and writes CSV (comma-separated-value files) containing pore and throat data Notes ----- There are a few rules governing how the data is be stored: 1. The first row of the file (column headers) must contain the property names. The subsequent ro...
5ddd7f7317dd9c6d82e6db5256ec1800dd6eef5d
<|skeleton|> class CSV: """Reads and writes CSV (comma-separated-value files) containing pore and throat data Notes ----- There are a few rules governing how the data is be stored: 1. The first row of the file (column headers) must contain the property names. The subsequent rows contain the data. 2. The property na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSV: """Reads and writes CSV (comma-separated-value files) containing pore and throat data Notes ----- There are a few rules governing how the data is be stored: 1. The first row of the file (column headers) must contain the property names. The subsequent rows contain the data. 2. The property names should be...
the_stack_v2_python_sparse
openpnm/io/_csv.py
ma-sadeghi/OpenPNM
train
1
8b8f99308c08719fcdf6b9b418dac5dca68f25e9
[ "text = Formatter.format_block(self, block)\ntext = self.indent(text, 2)\ntext = '::\\n\\n' + text\nreturn text", "caption = elem.text\nif caption and caption.strip():\n caption = self.indent(textwrap.wrap(caption), 2)\n return '.. figure:: %s\\n\\n%s\\n' % (elem.get('filename'), caption)\nelse:\n return...
<|body_start_0|> text = Formatter.format_block(self, block) text = self.indent(text, 2) text = '::\n\n' + text return text <|end_body_0|> <|body_start_1|> caption = elem.text if caption and caption.strip(): caption = self.indent(textwrap.wrap(caption), 2) ...
Formatter for reST output.
ReSTFormatter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReSTFormatter: """Formatter for reST output.""" def format_block(self, block): """Format an <ipython-block> element.""" <|body_0|> def format_figure(self, elem): """Format a <figure> element.""" <|body_1|> def format_sheet(self, sheet): """Fo...
stack_v2_sparse_classes_36k_train_004895
2,064
no_license
[ { "docstring": "Format an <ipython-block> element.", "name": "format_block", "signature": "def format_block(self, block)" }, { "docstring": "Format a <figure> element.", "name": "format_figure", "signature": "def format_figure(self, elem)" }, { "docstring": "Format a reST sheet. ...
3
stack_v2_sparse_classes_30k_train_015467
Implement the Python class `ReSTFormatter` described below. Class description: Formatter for reST output. Method signatures and docstrings: - def format_block(self, block): Format an <ipython-block> element. - def format_figure(self, elem): Format a <figure> element. - def format_sheet(self, sheet): Format a reST she...
Implement the Python class `ReSTFormatter` described below. Class description: Formatter for reST output. Method signatures and docstrings: - def format_block(self, block): Format an <ipython-block> element. - def format_figure(self, elem): Format a <figure> element. - def format_sheet(self, sheet): Format a reST she...
9b32089282c94c706d819333a3a2388179e99e86
<|skeleton|> class ReSTFormatter: """Formatter for reST output.""" def format_block(self, block): """Format an <ipython-block> element.""" <|body_0|> def format_figure(self, elem): """Format a <figure> element.""" <|body_1|> def format_sheet(self, sheet): """Fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReSTFormatter: """Formatter for reST output.""" def format_block(self, block): """Format an <ipython-block> element.""" text = Formatter.format_block(self, block) text = self.indent(text, 2) text = '::\n\n' + text return text def format_figure(self, elem): ...
the_stack_v2_python_sparse
google-rkern/trunk/notabene/rest.py
minrk/ipython-svn-archive
train
0
a2a7e7af2e545214939ee908cc17f519ba7f50de
[ "model = CGCNN(in_node_dim, hidden_node_dim, in_edge_dim, num_conv, predictor_hidden_feats, n_tasks, mode, n_classes)\nif mode == 'regression':\n loss: Loss = L2Loss()\n output_types = ['prediction']\nelse:\n loss = SparseSoftmaxCrossEntropy()\n output_types = ['prediction', 'loss']\nsuper(CGCNNModel, s...
<|body_start_0|> model = CGCNN(in_node_dim, hidden_node_dim, in_edge_dim, num_conv, predictor_hidden_feats, n_tasks, mode, n_classes) if mode == 'regression': loss: Loss = L2Loss() output_types = ['prediction'] else: loss = SparseSoftmaxCrossEntropy() ...
Crystal Graph Convolutional Neural Network (CGCNN). Here is a simple example of code that uses the CGCNNModel with materials dataset. Examples -------- >>> import deepchem as dc >>> dataset_config = {"reload": False, "featurizer": dc.feat.CGCNNFeaturizer(), "transformers": []} >>> tasks, datasets, transformers = dc.mol...
CGCNNModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CGCNNModel: """Crystal Graph Convolutional Neural Network (CGCNN). Here is a simple example of code that uses the CGCNNModel with materials dataset. Examples -------- >>> import deepchem as dc >>> dataset_config = {"reload": False, "featurizer": dc.feat.CGCNNFeaturizer(), "transformers": []} >>> ...
stack_v2_sparse_classes_36k_train_004896
14,455
permissive
[ { "docstring": "This class accepts all the keyword arguments from TorchModel. Parameters ---------- in_node_dim: int, default 92 The length of the initial node feature vectors. The 92 is based on length of vectors in the atom_init.json. hidden_node_dim: int, default 64 The length of the hidden node feature vect...
2
null
Implement the Python class `CGCNNModel` described below. Class description: Crystal Graph Convolutional Neural Network (CGCNN). Here is a simple example of code that uses the CGCNNModel with materials dataset. Examples -------- >>> import deepchem as dc >>> dataset_config = {"reload": False, "featurizer": dc.feat.CGCN...
Implement the Python class `CGCNNModel` described below. Class description: Crystal Graph Convolutional Neural Network (CGCNN). Here is a simple example of code that uses the CGCNNModel with materials dataset. Examples -------- >>> import deepchem as dc >>> dataset_config = {"reload": False, "featurizer": dc.feat.CGCN...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class CGCNNModel: """Crystal Graph Convolutional Neural Network (CGCNN). Here is a simple example of code that uses the CGCNNModel with materials dataset. Examples -------- >>> import deepchem as dc >>> dataset_config = {"reload": False, "featurizer": dc.feat.CGCNNFeaturizer(), "transformers": []} >>> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CGCNNModel: """Crystal Graph Convolutional Neural Network (CGCNN). Here is a simple example of code that uses the CGCNNModel with materials dataset. Examples -------- >>> import deepchem as dc >>> dataset_config = {"reload": False, "featurizer": dc.feat.CGCNNFeaturizer(), "transformers": []} >>> tasks, datase...
the_stack_v2_python_sparse
deepchem/models/torch_models/cgcnn.py
deepchem/deepchem
train
4,876
7007de2fcf60e7f6c4ce3ba3aa18aa104a4dd5ed
[ "from numpy import array, dot, arccos, pi\nx = self.positionRelativeToSample(element)\nx = array(x)\nfrom . import units\nm = units.length.meter\ntry:\n x + m\n x /= m\nexcept:\n pass\nlx = vlen(x)\nbeam = self.request_coordinate_system().neutronBeamDirection\nlbeam = vlen(array(beam))\ncost = dot(x, beam)...
<|body_start_0|> from numpy import array, dot, arccos, pi x = self.positionRelativeToSample(element) x = array(x) from . import units m = units.length.meter try: x + m x /= m except: pass lx = vlen(x) beam = self...
A geometer that is most useful for inelastic direct-geometry chopper spectrometer.
ARCSGeometer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ARCSGeometer: """A geometer that is most useful for inelastic direct-geometry chopper spectrometer.""" def scatteringAngle(self, element): """scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: Th...
stack_v2_sparse_classes_36k_train_004897
4,790
no_license
[ { "docstring": "scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: The element or the element signature Output: scattering angle, in radian Exceptions: KeyError Notes: scattering angle means angle from moderator to sample t...
2
stack_v2_sparse_classes_30k_train_018389
Implement the Python class `ARCSGeometer` described below. Class description: A geometer that is most useful for inelastic direct-geometry chopper spectrometer. Method signatures and docstrings: - def scatteringAngle(self, element): scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle...
Implement the Python class `ARCSGeometer` described below. Class description: A geometer that is most useful for inelastic direct-geometry chopper spectrometer. Method signatures and docstrings: - def scatteringAngle(self, element): scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle...
7d6fb88e7ec8245c488ab7988a8518de57dd73df
<|skeleton|> class ARCSGeometer: """A geometer that is most useful for inelastic direct-geometry chopper spectrometer.""" def scatteringAngle(self, element): """scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ARCSGeometer: """A geometer that is most useful for inelastic direct-geometry chopper spectrometer.""" def scatteringAngle(self, element): """scatteringAngle( element) -> scattering angle in degrees Compute the scattering angle of the specified element in degrees. Inputs: element: The element or ...
the_stack_v2_python_sparse
instrument/geometers/ARCSGeometer.py
danse-inelastic/instrument
train
0
a6c281e8f305aa16daccbae177e1962225fcf450
[ "if not nums:\n return True\nsum_all = sum(nums)\nif sum_all & 1 == 1:\n return False\nsum_half = sum_all / 2\ndp = [[False for j in range(sum_half + 1)] for i in range(len(nums))]\nfor i in range(len(nums)):\n dp[i][0] = True\nfor i in range(1, len(nums)):\n for j in range(1, sum_half + 1):\n dp...
<|body_start_0|> if not nums: return True sum_all = sum(nums) if sum_all & 1 == 1: return False sum_half = sum_all / 2 dp = [[False for j in range(sum_half + 1)] for i in range(len(nums))] for i in range(len(nums)): dp[i][0] = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return True ...
stack_v2_sparse_classes_36k_train_004898
1,997
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007454
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def canPart...
8853f85214ac88db024d26e228f1848dd5acd933
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" if not nums: return True sum_all = sum(nums) if sum_all & 1 == 1: return False sum_half = sum_all / 2 dp = [[False for j in range(sum_half + 1)] for i in ran...
the_stack_v2_python_sparse
416-PartitionEqualSubsetSum/PartitionEqualSubsetSum.py
cqxmzhc/my_leetcode_solutions
train
2
5fa9ac74608547f6c0963b65e1831279d1e3dee6
[ "super(Decoder, self).__init__()\nself.example_size = example_size\nself.num_outputs = example_size[1] * example_size[0] * example_size[2]\nself.cuda_enabled = cuda_enabled\nfc1_output_size = 512\nfc2_output_size = 1024\nfc3_output_size = 4096\nfc4_output_size = 4096 * 3\nself.fc1 = nn.Linear(num_classes * output_u...
<|body_start_0|> super(Decoder, self).__init__() self.example_size = example_size self.num_outputs = example_size[1] * example_size[0] * example_size[2] self.cuda_enabled = cuda_enabled fc1_output_size = 512 fc2_output_size = 1024 fc3_output_size = 4096 fc...
Implement Decoder structure in section 4.1, Figure 2 to reconstruct a digit from the `DigitCaps` layer representation. The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reconstruct a [784,] size ...
Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Implement Decoder structure in section 4.1, Figure 2 to reconstruct a digit from the `DigitCaps` layer representation. The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder ne...
stack_v2_sparse_classes_36k_train_004899
3,631
permissive
[ { "docstring": "The decoder network consists of 3 fully connected layers, with 512, 1024, 784 neurons each.", "name": "__init__", "signature": "def __init__(self, num_classes, output_unit_size, cuda_enabled, example_size=(1, 28, 28))" }, { "docstring": "We send the outputs of the `DigitCaps` lay...
2
stack_v2_sparse_classes_30k_train_000230
Implement the Python class `Decoder` described below. Class description: Implement Decoder structure in section 4.1, Figure 2 to reconstruct a digit from the `DigitCaps` layer representation. The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and ...
Implement the Python class `Decoder` described below. Class description: Implement Decoder structure in section 4.1, Figure 2 to reconstruct a digit from the `DigitCaps` layer representation. The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and ...
0c6e7a6cccd7630751c8065befba14a0dbaeadd4
<|skeleton|> class Decoder: """Implement Decoder structure in section 4.1, Figure 2 to reconstruct a digit from the `DigitCaps` layer representation. The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder ne...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """Implement Decoder structure in section 4.1, Figure 2 to reconstruct a digit from the `DigitCaps` layer representation. The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reco...
the_stack_v2_python_sparse
src/org/campagnelab/dl/pytorch/images/models/capsules/decoder.py
fac2003/ureg
train
0