blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
4eb38b61c274f70a4d176d5b732ce1a770e58cc2
[ "kwargs = {'model_admin': self, 'parent_pk': instance_pk}\nview_class = AddChildNodeViewClass\nreturn view_class.as_view(**kwargs)(request)", "urls = super().get_admin_urls_for_registration()\nadd_child_url = re_path(self.url_helper.get_action_url_pattern('add_child'), self.add_child_view, name=self.url_helper.ge...
<|body_start_0|> kwargs = {'model_admin': self, 'parent_pk': instance_pk} view_class = AddChildNodeViewClass return view_class.as_view(**kwargs)(request) <|end_body_0|> <|body_start_1|> urls = super().get_admin_urls_for_registration() add_child_url = re_path(self.url_helper.get_...
Class for presenting taxonomies in admin using modeladmin.
NodeAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeAdmin: """Class for presenting taxonomies in admin using modeladmin.""" def add_child_view(self, request, instance_pk): """Generate a class-based view to provide 'add child' functionality.""" <|body_0|> def get_admin_urls_for_registration(self): """Add the ne...
stack_v2_sparse_classes_10k_train_008500
9,499
no_license
[ { "docstring": "Generate a class-based view to provide 'add child' functionality.", "name": "add_child_view", "signature": "def add_child_view(self, request, instance_pk)" }, { "docstring": "Add the new url for add child page to the registered URLs.", "name": "get_admin_urls_for_registration...
2
stack_v2_sparse_classes_30k_train_007230
Implement the Python class `NodeAdmin` described below. Class description: Class for presenting taxonomies in admin using modeladmin. Method signatures and docstrings: - def add_child_view(self, request, instance_pk): Generate a class-based view to provide 'add child' functionality. - def get_admin_urls_for_registrat...
Implement the Python class `NodeAdmin` described below. Class description: Class for presenting taxonomies in admin using modeladmin. Method signatures and docstrings: - def add_child_view(self, request, instance_pk): Generate a class-based view to provide 'add child' functionality. - def get_admin_urls_for_registrat...
b6bd6ecb85b281b03564eef4d7a6f74f59bbd31b
<|skeleton|> class NodeAdmin: """Class for presenting taxonomies in admin using modeladmin.""" def add_child_view(self, request, instance_pk): """Generate a class-based view to provide 'add child' functionality.""" <|body_0|> def get_admin_urls_for_registration(self): """Add the ne...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NodeAdmin: """Class for presenting taxonomies in admin using modeladmin.""" def add_child_view(self, request, instance_pk): """Generate a class-based view to provide 'add child' functionality.""" kwargs = {'model_admin': self, 'parent_pk': instance_pk} view_class = AddChildNodeVie...
the_stack_v2_python_sparse
taxonomy/models.py
fourfridays/umairabbasi.com
train
1
c779b3b2fe1aefbd73d28436290dc56c38c6cfd3
[ "if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\nreturn max(self.helper(nums[:-1]), self.helper(nums[1:]))", "if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\ndp = [0] * len(nums)\ndp[0] = nums[0]\ndp[1] = max(nums[0], nums[1])\nfor i in range(2, len(nums)):\n dp[i] = max...
<|body_start_0|> if not nums: return 0 if len(nums) == 1: return nums[0] return max(self.helper(nums[:-1]), self.helper(nums[1:])) <|end_body_0|> <|body_start_1|> if not nums: return 0 if len(nums) == 1: return nums[0] dp =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def helper(self, nums): """套用198题解题思路 :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 if le...
stack_v2_sparse_classes_10k_train_008501
909
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": "套用198题解题思路 :type nums: List[int] :rtype: int", "name": "helper", "signature": "def helper(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def helper(self, nums): 套用198题解题思路 :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def helper(self, nums): 套用198题解题思路 :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob(self, num...
6ae85bf79c5a21735e3c245c0c256f29c1c60926
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def helper(self, nums): """套用198题解题思路 :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 if len(nums) == 1: return nums[0] return max(self.helper(nums[:-1]), self.helper(nums[1:])) def helper(self, nums): """套用198题解题思路 :type nums: List[i...
the_stack_v2_python_sparse
algorithms/201-300/213.house-robber-ii.py
huilizhou/Leetcode-pyhton
train
8
9355c3cf48d3f7f9873a805d4c1be3cc53f9ad92
[ "super(CustomerJourney, self).__init__(*args, **kwargs)\nself.endpoint = 'customer-journeys'\nself.journey_id = None\nself.step_id = None", "self.journey_id = journey_id\nself.step_id = step_id\nif 'email_address' not in data:\n raise KeyError('The automation email queue must have an email_address')\ncheck_ema...
<|body_start_0|> super(CustomerJourney, self).__init__(*args, **kwargs) self.endpoint = 'customer-journeys' self.journey_id = None self.step_id = None <|end_body_0|> <|body_start_1|> self.journey_id = journey_id self.step_id = step_id if 'email_address' not in da...
Manage specific customer journeys in your Mailchimp account.
CustomerJourney
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerJourney: """Manage specific customer journeys in your Mailchimp account.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def trigger(self, journey_id, step_id, data): """Trigger a step in a customer journey. :param journey...
stack_v2_sparse_classes_10k_train_008502
1,605
permissive
[ { "docstring": "Initialize the endpoint", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Trigger a step in a customer journey. :param journey_id: The unique id for the Customer Journey :type journey_id: :py:class:`str` :param step_id: The unique id for ...
2
stack_v2_sparse_classes_30k_train_002035
Implement the Python class `CustomerJourney` described below. Class description: Manage specific customer journeys in your Mailchimp account. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def trigger(self, journey_id, step_id, data): Trigger a step in a customer jo...
Implement the Python class `CustomerJourney` described below. Class description: Manage specific customer journeys in your Mailchimp account. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def trigger(self, journey_id, step_id, data): Trigger a step in a customer jo...
bf61cd602dc44cbff32fbf6f6dcdd33cf6f782e8
<|skeleton|> class CustomerJourney: """Manage specific customer journeys in your Mailchimp account.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def trigger(self, journey_id, step_id, data): """Trigger a step in a customer journey. :param journey...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomerJourney: """Manage specific customer journeys in your Mailchimp account.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" super(CustomerJourney, self).__init__(*args, **kwargs) self.endpoint = 'customer-journeys' self.journey_id = None ...
the_stack_v2_python_sparse
mailchimp3/entities/customerjourney.py
VingtCinq/python-mailchimp
train
190
dbf4c6bb8984a5fb75df28f25a3c3cdad35c4ce1
[ "super(Vgg16, self).__init__(name=name)\nself._output_size = output_size\nself._hidden_channels = [64, 64, 128, 128, 128, 256, 256, 256, 512, 512, 512]\nself._num_layers = len(self._hidden_channels)\nself._kernel_shapes = [[3, 3]] * self._num_layers\nself._strides = [1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1]\nself._paddings...
<|body_start_0|> super(Vgg16, self).__init__(name=name) self._output_size = output_size self._hidden_channels = [64, 64, 128, 128, 128, 256, 256, 256, 512, 512, 512] self._num_layers = len(self._hidden_channels) self._kernel_shapes = [[3, 3]] * self._num_layers self._stri...
Vgg16
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vgg16: def __init__(self, output_size, name='vgg16', activation=tf.nn.relu, **extra_params): """Args: num_outputs (type): number of outputs of the module. name (type): module name. activation (type): activation used for the internal layers. **extra_params (type): alls the additional keyw...
stack_v2_sparse_classes_10k_train_008503
48,282
permissive
[ { "docstring": "Args: num_outputs (type): number of outputs of the module. name (type): module name. activation (type): activation used for the internal layers. **extra_params (type): alls the additional keyword arguments will be passed to the snt.Conv2D layers.", "name": "__init__", "signature": "def _...
2
null
Implement the Python class `Vgg16` described below. Class description: Implement the Vgg16 class. Method signatures and docstrings: - def __init__(self, output_size, name='vgg16', activation=tf.nn.relu, **extra_params): Args: num_outputs (type): number of outputs of the module. name (type): module name. activation (t...
Implement the Python class `Vgg16` described below. Class description: Implement the Vgg16 class. Method signatures and docstrings: - def __init__(self, output_size, name='vgg16', activation=tf.nn.relu, **extra_params): Args: num_outputs (type): number of outputs of the module. name (type): module name. activation (t...
a10c33346803239db8a64c104db7f22ec4e05bef
<|skeleton|> class Vgg16: def __init__(self, output_size, name='vgg16', activation=tf.nn.relu, **extra_params): """Args: num_outputs (type): number of outputs of the module. name (type): module name. activation (type): activation used for the internal layers. **extra_params (type): alls the additional keyw...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Vgg16: def __init__(self, output_size, name='vgg16', activation=tf.nn.relu, **extra_params): """Args: num_outputs (type): number of outputs of the module. name (type): module name. activation (type): activation used for the internal layers. **extra_params (type): alls the additional keyword arguments ...
the_stack_v2_python_sparse
argo/core/utils/utils_modules.py
ricvo/argo
train
0
69cced6a40f1ab605316883c24466efcb4abcb3b
[ "if self.public:\n return self.PUBLIC_URI_TEMPLATE.format(registry_alias=self.alias)\nreturn self.URI_TEMPLATE.format(aws_account_id=self.account_id, aws_region=self.region)", "values.setdefault('public', bool(values.get('alias')))\nif not values['public']:\n account_id = values.get('account_id')\n ctx: ...
<|body_start_0|> if self.public: return self.PUBLIC_URI_TEMPLATE.format(registry_alias=self.alias) return self.URI_TEMPLATE.format(aws_account_id=self.account_id, aws_region=self.region) <|end_body_0|> <|body_start_1|> values.setdefault('public', bool(values.get('alias'))) i...
AWS Elastic Container Registry.
ElasticContainerRegistry
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElasticContainerRegistry: """AWS Elastic Container Registry.""" def fqn(self) -> str: """Fully qualified ECR name.""" <|body_0|> def _set_defaults(cls, values: Dict[str, Any]) -> Dict[str, Any]: """Set default values based on other values.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_008504
4,059
permissive
[ { "docstring": "Fully qualified ECR name.", "name": "fqn", "signature": "def fqn(self) -> str" }, { "docstring": "Set default values based on other values.", "name": "_set_defaults", "signature": "def _set_defaults(cls, values: Dict[str, Any]) -> Dict[str, Any]" } ]
2
null
Implement the Python class `ElasticContainerRegistry` described below. Class description: AWS Elastic Container Registry. Method signatures and docstrings: - def fqn(self) -> str: Fully qualified ECR name. - def _set_defaults(cls, values: Dict[str, Any]) -> Dict[str, Any]: Set default values based on other values.
Implement the Python class `ElasticContainerRegistry` described below. Class description: AWS Elastic Container Registry. Method signatures and docstrings: - def fqn(self) -> str: Fully qualified ECR name. - def _set_defaults(cls, values: Dict[str, Any]) -> Dict[str, Any]: Set default values based on other values. <...
0763b06aee07d2cf3f037a49ca0cb81a048c5deb
<|skeleton|> class ElasticContainerRegistry: """AWS Elastic Container Registry.""" def fqn(self) -> str: """Fully qualified ECR name.""" <|body_0|> def _set_defaults(cls, values: Dict[str, Any]) -> Dict[str, Any]: """Set default values based on other values.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ElasticContainerRegistry: """AWS Elastic Container Registry.""" def fqn(self) -> str: """Fully qualified ECR name.""" if self.public: return self.PUBLIC_URI_TEMPLATE.format(registry_alias=self.alias) return self.URI_TEMPLATE.format(aws_account_id=self.account_id, aws_r...
the_stack_v2_python_sparse
runway/cfngin/hooks/docker/data_models.py
onicagroup/runway
train
156
de1b565ab92f8b99e1e726f62cb4d87d2a621710
[ "storage = get_storage()\nrole = storage.read_role(role_id)\nreturn jsonify(RoleSchema().dump(role))", "storage = get_storage()\nstorage.delete_role(role_id)\nreturn ('', 204)" ]
<|body_start_0|> storage = get_storage() role = storage.read_role(role_id) return jsonify(RoleSchema().dump(role)) <|end_body_0|> <|body_start_1|> storage = get_storage() storage.delete_role(role_id) return ('', 204) <|end_body_1|>
RoleView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleView: def get(self, role_id): """--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Un...
stack_v2_sparse_classes_10k_train_008505
5,492
permissive
[ { "docstring": "--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref: '#/components/response...
2
stack_v2_sparse_classes_30k_train_001631
Implement the Python class `RoleView` described below. Class description: Implement the RoleView class. Method signatures and docstrings: - def get(self, role_id): --- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: applicatio...
Implement the Python class `RoleView` described below. Class description: Implement the RoleView class. Method signatures and docstrings: - def get(self, role_id): --- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: applicatio...
280800c73eb7cfd49029462b352887e78f1ff91b
<|skeleton|> class RoleView: def get(self, role_id): """--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Un...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoleView: def get(self, role_id): """--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Unauthorized' 40...
the_stack_v2_python_sparse
sfa_api/roles.py
SolarArbiter/solarforecastarbiter-api
train
9
d69703e5b7abe34a2b22a9aea0ce0f4dc67a46fa
[ "formatter = NumPySupportedFormat.get_format_handler(fmt=file_format)\ntemp_directory = pathlib.Path(tempfile.mkdtemp())\ncls.add_future_clearing_path(path=temp_directory)\nfile_path = temp_directory / f'{key}.{file_format}'\nformatter.save(obj=obj, file_path=str(file_path), **save_kwargs)\nartifact = Artifact(key=...
<|body_start_0|> formatter = NumPySupportedFormat.get_format_handler(fmt=file_format) temp_directory = pathlib.Path(tempfile.mkdtemp()) cls.add_future_clearing_path(path=temp_directory) file_path = temp_directory / f'{key}.{file_format}' formatter.save(obj=obj, file_path=str(file...
A base packager for builtin python dictionaries and lists of numpy arrays as they share common artifact and file types.
_NumPyNDArrayCollectionPackager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _NumPyNDArrayCollectionPackager: """A base packager for builtin python dictionaries and lists of numpy arrays as they share common artifact and file types.""" def pack_file(cls, obj: NumPyArrayCollectionType, key: str, file_format: str=DEFAULT_NUMPPY_ARRAY_COLLECTION_FORMAT, **save_kwargs) -...
stack_v2_sparse_classes_10k_train_008506
22,927
permissive
[ { "docstring": "Pack an array collection as a file by the given format. :param obj: The aray collection to pack. :param key: The key to use for the artifact. :param file_format: The file format to save as. Default is npy. :param save_kwargs: Additional keyword arguments to pass to the numpy save functions. :ret...
2
stack_v2_sparse_classes_30k_train_000752
Implement the Python class `_NumPyNDArrayCollectionPackager` described below. Class description: A base packager for builtin python dictionaries and lists of numpy arrays as they share common artifact and file types. Method signatures and docstrings: - def pack_file(cls, obj: NumPyArrayCollectionType, key: str, file_...
Implement the Python class `_NumPyNDArrayCollectionPackager` described below. Class description: A base packager for builtin python dictionaries and lists of numpy arrays as they share common artifact and file types. Method signatures and docstrings: - def pack_file(cls, obj: NumPyArrayCollectionType, key: str, file_...
b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77
<|skeleton|> class _NumPyNDArrayCollectionPackager: """A base packager for builtin python dictionaries and lists of numpy arrays as they share common artifact and file types.""" def pack_file(cls, obj: NumPyArrayCollectionType, key: str, file_format: str=DEFAULT_NUMPPY_ARRAY_COLLECTION_FORMAT, **save_kwargs) -...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _NumPyNDArrayCollectionPackager: """A base packager for builtin python dictionaries and lists of numpy arrays as they share common artifact and file types.""" def pack_file(cls, obj: NumPyArrayCollectionType, key: str, file_format: str=DEFAULT_NUMPPY_ARRAY_COLLECTION_FORMAT, **save_kwargs) -> Tuple[Artif...
the_stack_v2_python_sparse
mlrun/package/packagers/numpy_packagers.py
mlrun/mlrun
train
1,093
a3d4a6ea94c95d0a12a0a2f8ed6f999bfcd4cbbf
[ "self.pump = Pump('127.0.0.1', 1)\nself.sensor = Sensor('127.0.0.2', 2)\nself.decider = Decider(300, 0.1)\nself.controller = Controller(self.sensor, self.pump, self.decider)", "self.sensor.measure = MagicMock(return_value=200)\nself.pump.get_state = MagicMock(return_value=Pump.PUMP_OFF)\nself.pump.set_state = Mag...
<|body_start_0|> self.pump = Pump('127.0.0.1', 1) self.sensor = Sensor('127.0.0.2', 2) self.decider = Decider(300, 0.1) self.controller = Controller(self.sensor, self.pump, self.decider) <|end_body_0|> <|body_start_1|> self.sensor.measure = MagicMock(return_value=200) se...
Unit tests for the Controller class
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Just some example syntax that you might use""" <|body_0|> def test_tick(self): """test for controller""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pump = Pump...
stack_v2_sparse_classes_10k_train_008507
2,566
no_license
[ { "docstring": "Just some example syntax that you might use", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test for controller", "name": "test_tick", "signature": "def test_tick(self)" } ]
2
stack_v2_sparse_classes_30k_train_000793
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): Just some example syntax that you might use - def test_tick(self): test for controller
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): Just some example syntax that you might use - def test_tick(self): test for controller <|skeleton|> class ControllerTests: """Unit tests for th...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Just some example syntax that you might use""" <|body_0|> def test_tick(self): """test for controller""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Just some example syntax that you might use""" self.pump = Pump('127.0.0.1', 1) self.sensor = Sensor('127.0.0.2', 2) self.decider = Decider(300, 0.1) self.controller = Controller(self.se...
the_stack_v2_python_sparse
students/AurelP/lesson6/water-regulation/waterregulation/test.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
bec6830c1157023a9cb882f277b89814383e8598
[ "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...
Missing associated documentation comment in .proto file.
InstanceServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceServiceServicer: """Missing associated documentation comment in .proto file.""" def Get(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def List(self, request, context): """Missing associated documentatio...
stack_v2_sparse_classes_10k_train_008508
5,203
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "List", "signature": "def List(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_train_005631
Implement the Python class `InstanceServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Get(self, request, context): Missing associated documentation comment in .proto file. - def List(self, request, context): Missing as...
Implement the Python class `InstanceServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Get(self, request, context): Missing associated documentation comment in .proto file. - def List(self, request, context): Missing as...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class InstanceServiceServicer: """Missing associated documentation comment in .proto file.""" def Get(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def List(self, request, context): """Missing associated documentatio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstanceServiceServicer: """Missing associated documentation comment in .proto file.""" def Get(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') ...
the_stack_v2_python_sparse
yandex/cloud/marketplace/licensemanager/v1/instance_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
6c51a1a6dec8f70409203c9dfaffc96d4ebb444d
[ "if not says_the_other or says_the_other.isspace():\n return 'Fine. Be that way!'\nelif self.is_yelling(says_the_other):\n return 'Woah, chill out!'\nelif says_the_other[-1] == '?':\n return 'Sure.'\nreturn 'Whatever.'", "letters = ''.join([c for c in text if c.isalpha()])\nif letters and letters.isupper...
<|body_start_0|> if not says_the_other or says_the_other.isspace(): return 'Fine. Be that way!' elif self.is_yelling(says_the_other): return 'Woah, chill out!' elif says_the_other[-1] == '?': return 'Sure.' return 'Whatever.' <|end_body_0|> <|body_sta...
A lackadaisical teenager
Bob
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bob: """A lackadaisical teenager""" def hey(self, says_the_other): """Bob's response to anything""" <|body_0|> def is_yelling(text): """Determines whether text contains yelling or not""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not says_t...
stack_v2_sparse_classes_10k_train_008509
948
no_license
[ { "docstring": "Bob's response to anything", "name": "hey", "signature": "def hey(self, says_the_other)" }, { "docstring": "Determines whether text contains yelling or not", "name": "is_yelling", "signature": "def is_yelling(text)" } ]
2
stack_v2_sparse_classes_30k_test_000167
Implement the Python class `Bob` described below. Class description: A lackadaisical teenager Method signatures and docstrings: - def hey(self, says_the_other): Bob's response to anything - def is_yelling(text): Determines whether text contains yelling or not
Implement the Python class `Bob` described below. Class description: A lackadaisical teenager Method signatures and docstrings: - def hey(self, says_the_other): Bob's response to anything - def is_yelling(text): Determines whether text contains yelling or not <|skeleton|> class Bob: """A lackadaisical teenager""...
be0e2f635a7558f56c61bc0b36c6146b01d1e6e6
<|skeleton|> class Bob: """A lackadaisical teenager""" def hey(self, says_the_other): """Bob's response to anything""" <|body_0|> def is_yelling(text): """Determines whether text contains yelling or not""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Bob: """A lackadaisical teenager""" def hey(self, says_the_other): """Bob's response to anything""" if not says_the_other or says_the_other.isspace(): return 'Fine. Be that way!' elif self.is_yelling(says_the_other): return 'Woah, chill out!' elif s...
the_stack_v2_python_sparse
all_data/exercism_data/python/bob/1ec7c55444a7459baab0444d070b314d.py
itsolutionscorp/AutoStyle-Clustering
train
4
1df6800ea70dd88fd38a98221015040fd29c3c01
[ "self.createform = forms.QuotationForm(request.POST)\nif self.createform.is_valid():\n req = {'name': self.createform.cleaned_data['name'], 'email': self.createform.cleaned_data['email'], 'phone': self.createform.cleaned_data['phone'], 'vehiculeModel': self.createform.cleaned_data['vehiculeModel'], 'vehiculeYear...
<|body_start_0|> self.createform = forms.QuotationForm(request.POST) if self.createform.is_valid(): req = {'name': self.createform.cleaned_data['name'], 'email': self.createform.cleaned_data['email'], 'phone': self.createform.cleaned_data['phone'], 'vehiculeModel': self.createform.cleaned_da...
Form for :model:`Quotation creation` Automtically generate the email TODO do this in the detail view
QuotationCreateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuotationCreateView: """Form for :model:`Quotation creation` Automtically generate the email TODO do this in the detail view""" def post(self, request): """Validate and send a post request to the API""" <|body_0|> def get(self, request): """Initialize the form fo...
stack_v2_sparse_classes_10k_train_008510
4,483
no_license
[ { "docstring": "Validate and send a post request to the API", "name": "post", "signature": "def post(self, request)" }, { "docstring": "Initialize the form for `:model:`Quotation creation via API", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_002139
Implement the Python class `QuotationCreateView` described below. Class description: Form for :model:`Quotation creation` Automtically generate the email TODO do this in the detail view Method signatures and docstrings: - def post(self, request): Validate and send a post request to the API - def get(self, request): I...
Implement the Python class `QuotationCreateView` described below. Class description: Form for :model:`Quotation creation` Automtically generate the email TODO do this in the detail view Method signatures and docstrings: - def post(self, request): Validate and send a post request to the API - def get(self, request): I...
f7ad1ece8ff4788f99f9cf6a0538c0aaa3653554
<|skeleton|> class QuotationCreateView: """Form for :model:`Quotation creation` Automtically generate the email TODO do this in the detail view""" def post(self, request): """Validate and send a post request to the API""" <|body_0|> def get(self, request): """Initialize the form fo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuotationCreateView: """Form for :model:`Quotation creation` Automtically generate the email TODO do this in the detail view""" def post(self, request): """Validate and send a post request to the API""" self.createform = forms.QuotationForm(request.POST) if self.createform.is_vali...
the_stack_v2_python_sparse
quotations/views.py
GuillaumeGSO/MotorQuotationLab
train
0
8830d03f7afc24bf42f2bbd190460924c67e853d
[ "self.nlabel = nlabel\nself.lamb = lamb\nself.value1 = value1\nself.value2 = value2\nself.niter = niter\nself.pairwise_cost = -self.value1 * self.lamb * np.eye(self.nlabel)\nself.pairwise_cost = self.pairwise_cost.astype(np.int32)", "assert unary_term.shape[1] == self.nlabel, 'Unary term have wrong labels'\nnvert...
<|body_start_0|> self.nlabel = nlabel self.lamb = lamb self.value1 = value1 self.value2 = value2 self.niter = niter self.pairwise_cost = -self.value1 * self.lamb * np.eye(self.nlabel) self.pairwise_cost = self.pairwise_cost.astype(np.int32) <|end_body_0|> <|body_...
DiscreteEnergyMinimize
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscreteEnergyMinimize: def __init__(self, nlabel, lamb, value1=100, value2=10000, niter=10): """Args: nlabel - int lamb - float should be positive value1 - int defaults to be 100 value2 - int defaults to be 10000""" <|body_0|> def solve(self, unary_term, pairwise_term, k): ...
stack_v2_sparse_classes_10k_train_008511
2,206
permissive
[ { "docstring": "Args: nlabel - int lamb - float should be positive value1 - int defaults to be 100 value2 - int defaults to be 10000", "name": "__init__", "signature": "def __init__(self, nlabel, lamb, value1=100, value2=10000, niter=10)" }, { "docstring": "Args : unary_term - Numpy 2d array [nv...
2
stack_v2_sparse_classes_30k_train_005533
Implement the Python class `DiscreteEnergyMinimize` described below. Class description: Implement the DiscreteEnergyMinimize class. Method signatures and docstrings: - def __init__(self, nlabel, lamb, value1=100, value2=10000, niter=10): Args: nlabel - int lamb - float should be positive value1 - int defaults to be 1...
Implement the Python class `DiscreteEnergyMinimize` described below. Class description: Implement the DiscreteEnergyMinimize class. Method signatures and docstrings: - def __init__(self, nlabel, lamb, value1=100, value2=10000, niter=10): Args: nlabel - int lamb - float should be positive value1 - int defaults to be 1...
62c811c37001302e6759a18d6143b8ad657e4910
<|skeleton|> class DiscreteEnergyMinimize: def __init__(self, nlabel, lamb, value1=100, value2=10000, niter=10): """Args: nlabel - int lamb - float should be positive value1 - int defaults to be 100 value2 - int defaults to be 10000""" <|body_0|> def solve(self, unary_term, pairwise_term, k): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DiscreteEnergyMinimize: def __init__(self, nlabel, lamb, value1=100, value2=10000, niter=10): """Args: nlabel - int lamb - float should be positive value1 - int defaults to be 100 value2 - int defaults to be 10000""" self.nlabel = nlabel self.lamb = lamb self.value1 = value1 ...
the_stack_v2_python_sparse
utils/pygco_op.py
snu-mllab/Deep-Hash-Table-CVPR19
train
12
a66bca88cd1b5b913c061a0a0be76a38fb34e3a4
[ "self.jobs = jobs\nself.logical_size_in_bytes = logical_size_in_bytes\nself.parent_source = parent_source\nself.protection_source_uid_list = protection_source_uid_list\nself.source = source\nself.uuid = uuid", "if dictionary is None:\n return None\njobs = None\nif dictionary.get('jobs') != None:\n jobs = li...
<|body_start_0|> self.jobs = jobs self.logical_size_in_bytes = logical_size_in_bytes self.parent_source = parent_source self.protection_source_uid_list = protection_source_uid_list self.source = source self.uuid = uuid <|end_body_0|> <|body_start_1|> if dictionar...
Implementation of the 'ProtectionSourceResponse' model. Specifies the information about the individual object from search api response. Attributes: jobs (list of ProtectionJobSummary): Specifies the list of Protection Jobs that protect the object. logical_size_in_bytes (long|int): Specifies the logical size of Protecti...
ProtectionSourceResponse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionSourceResponse: """Implementation of the 'ProtectionSourceResponse' model. Specifies the information about the individual object from search api response. Attributes: jobs (list of ProtectionJobSummary): Specifies the list of Protection Jobs that protect the object. logical_size_in_byte...
stack_v2_sparse_classes_10k_train_008512
3,960
permissive
[ { "docstring": "Constructor for the ProtectionSourceResponse class", "name": "__init__", "signature": "def __init__(self, jobs=None, logical_size_in_bytes=None, parent_source=None, protection_source_uid_list=None, source=None, uuid=None)" }, { "docstring": "Creates an instance of this model from...
2
stack_v2_sparse_classes_30k_train_004646
Implement the Python class `ProtectionSourceResponse` described below. Class description: Implementation of the 'ProtectionSourceResponse' model. Specifies the information about the individual object from search api response. Attributes: jobs (list of ProtectionJobSummary): Specifies the list of Protection Jobs that p...
Implement the Python class `ProtectionSourceResponse` described below. Class description: Implementation of the 'ProtectionSourceResponse' model. Specifies the information about the individual object from search api response. Attributes: jobs (list of ProtectionJobSummary): Specifies the list of Protection Jobs that p...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionSourceResponse: """Implementation of the 'ProtectionSourceResponse' model. Specifies the information about the individual object from search api response. Attributes: jobs (list of ProtectionJobSummary): Specifies the list of Protection Jobs that protect the object. logical_size_in_byte...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProtectionSourceResponse: """Implementation of the 'ProtectionSourceResponse' model. Specifies the information about the individual object from search api response. Attributes: jobs (list of ProtectionJobSummary): Specifies the list of Protection Jobs that protect the object. logical_size_in_bytes (long|int):...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_source_response.py
cohesity/management-sdk-python
train
24
a8912b3795c06205f2b078f4f558812c7c8e55d0
[ "super().__init__()\ntry:\n self.function = function\n self.dim = function.dim\n self.bounds = Tensor(function._bounds).t()\n self.scale = self.bounds[1] - self.bounds[0]\n self.l_bounds = self.bounds[0]\n self.w_samples = getattr(self.function, 'w_samples', None)\n self.weights = getattr(self....
<|body_start_0|> super().__init__() try: self.function = function self.dim = function.dim self.bounds = Tensor(function._bounds).t() self.scale = self.bounds[1] - self.bounds[0] self.l_bounds = self.bounds[0] self.w_samples = getatt...
the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.
StandardizedFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardizedFunction: """the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.""" def __init__(self, function: SyntheticTestFunction, negate: bool=True): """Initialize the function :param function: the function to sampl...
stack_v2_sparse_classes_10k_train_008513
2,712
no_license
[ { "docstring": "Initialize the function :param function: the function to sample from, initialized with relevant parameters :param negate: negates the function value. Typically needed for maximization.", "name": "__init__", "signature": "def __init__(self, function: SyntheticTestFunction, negate: bool=Tr...
3
stack_v2_sparse_classes_30k_train_005289
Implement the Python class `StandardizedFunction` described below. Class description: the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube. Method signatures and docstrings: - def __init__(self, function: SyntheticTestFunction, negate: bool=True): Initi...
Implement the Python class `StandardizedFunction` described below. Class description: the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube. Method signatures and docstrings: - def __init__(self, function: SyntheticTestFunction, negate: bool=True): Initi...
ba6326b26effba529d84d85a356001839a2eb910
<|skeleton|> class StandardizedFunction: """the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.""" def __init__(self, function: SyntheticTestFunction, negate: bool=True): """Initialize the function :param function: the function to sampl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StandardizedFunction: """the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.""" def __init__(self, function: SyntheticTestFunction, negate: bool=True): """Initialize the function :param function: the function to sample from, initi...
the_stack_v2_python_sparse
BoRisk/test_functions/standardized_function.py
602221422/BoRisk
train
0
9e4b268afffe19e25278214c982f35b872917655
[ "self.m = m\nself.k = k\nself.hashers = [HashFunction(seed=i, length=m) for i in range(len(hist_cols)) for j in range(self.k)]", "output = []\nfor idx, vc in enumerate(value_counts):\n hashers = self.hashers[idx * self.k:(idx + 1) * self.k]\n for h in hashers:\n hist = [0 for i in range(2 ** self.m)]...
<|body_start_0|> self.m = m self.k = k self.hashers = [HashFunction(seed=i, length=m) for i in range(len(hist_cols)) for j in range(self.k)] <|end_body_0|> <|body_start_1|> output = [] for idx, vc in enumerate(value_counts): hashers = self.hashers[idx * self.k:(idx +...
HistogramClones
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistogramClones: def __init__(self, m, k): """Arguments: m {int} -- hash function length (2 ** m) k {int} -- number of clones""" <|body_0|> def value_counts_to_hists(self, value_counts): """convert value counts of columns to histogram clones Arguments: value_counts {...
stack_v2_sparse_classes_10k_train_008514
4,897
no_license
[ { "docstring": "Arguments: m {int} -- hash function length (2 ** m) k {int} -- number of clones", "name": "__init__", "signature": "def __init__(self, m, k)" }, { "docstring": "convert value counts of columns to histogram clones Arguments: value_counts {list of Counters} Returns: [type] -- [desc...
3
stack_v2_sparse_classes_30k_train_004399
Implement the Python class `HistogramClones` described below. Class description: Implement the HistogramClones class. Method signatures and docstrings: - def __init__(self, m, k): Arguments: m {int} -- hash function length (2 ** m) k {int} -- number of clones - def value_counts_to_hists(self, value_counts): convert v...
Implement the Python class `HistogramClones` described below. Class description: Implement the HistogramClones class. Method signatures and docstrings: - def __init__(self, m, k): Arguments: m {int} -- hash function length (2 ** m) k {int} -- number of clones - def value_counts_to_hists(self, value_counts): convert v...
aa46c84169b8c6c4fb0deefb453e5d4d9e80dc0f
<|skeleton|> class HistogramClones: def __init__(self, m, k): """Arguments: m {int} -- hash function length (2 ** m) k {int} -- number of clones""" <|body_0|> def value_counts_to_hists(self, value_counts): """convert value counts of columns to histogram clones Arguments: value_counts {...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HistogramClones: def __init__(self, m, k): """Arguments: m {int} -- hash function length (2 ** m) k {int} -- number of clones""" self.m = m self.k = k self.hashers = [HashFunction(seed=i, length=m) for i in range(len(hist_cols)) for j in range(self.k)] def value_counts_to_...
the_stack_v2_python_sparse
histogram/compute_kl.py
Narkle/UGR_Experiments
train
0
cb4d280d91cefa328246ec822ca149d55a5c27a0
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('kobesay', 'kobesay')\nrepo.dropCollection('regionhospital')\nrepo.createCollection('regionhospital')\nitems = {}\nhospital = repo.kobesay.hospital.find()\nfor x in hospital:\n zipcode = x['zipcode'].s...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('kobesay', 'kobesay') repo.dropCollection('regionhospital') repo.createCollection('regionhospital') items = {} hospital = repo.kobe...
trans_hospital
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class trans_hospital: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_10k_train_008515
3,673
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_test_000321
Implement the Python class `trans_hospital` described below. Class description: Implement the trans_hospital class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
Implement the Python class `trans_hospital` described below. Class description: Implement the trans_hospital class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class trans_hospital: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class trans_hospital: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('kobesay', 'kobesay') repo.dr...
the_stack_v2_python_sparse
kobesay/trans_hospital.py
lingyigu/course-2017-spr-proj
train
0
31ffd7044c3a9e7b8704136acf1e536397557f2d
[ "self.num = 0\nself.n = n\nself.prices = {}\nself.discount = discount\nfor i, id_of_product in enumerate(products):\n self.prices[id_of_product] = prices[i]", "ret = 0\nself.num += 1\nfor i, id_of_product in enumerate(product):\n ret += self.prices[id_of_product] * amount[i]\nif self.num == self.n:\n ret...
<|body_start_0|> self.num = 0 self.n = n self.prices = {} self.discount = discount for i, id_of_product in enumerate(products): self.prices[id_of_product] = prices[i] <|end_body_0|> <|body_start_1|> ret = 0 self.num += 1 for i, id_of_product i...
Cashier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_10k_train_008516
943
no_license
[ { "docstring": ":type n: int :type discount: int :type products: List[int] :type prices: List[int]", "name": "__init__", "signature": "def __init__(self, n, discount, products, prices)" }, { "docstring": ":type product: List[int] :type amount: List[int] :rtype: float", "name": "getBill", ...
2
null
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" self.num = 0 self.n = n self.prices = {} self.discount = discount for i, id_of_product in enumerate(products): ...
the_stack_v2_python_sparse
python/leetcode/1357_Apply_Discount_Every_n_Orders.py
bobcaoge/my-code
train
0
4a2686406b220a6c21244889000fa0b7a858aa81
[ "tests = ['KIF.test1', 'KIF.test2']\nexpected = 'NAME:test1|test2'\nself.assertEqual(expected, test_apps.get_kif_test_filter(tests))", "tests = ['KIF.test1', 'KIF.test2']\nexpected = '-NAME:test1|test2'\nself.assertEqual(expected, test_apps.get_kif_test_filter(tests, invert=True))" ]
<|body_start_0|> tests = ['KIF.test1', 'KIF.test2'] expected = 'NAME:test1|test2' self.assertEqual(expected, test_apps.get_kif_test_filter(tests)) <|end_body_0|> <|body_start_1|> tests = ['KIF.test1', 'KIF.test2'] expected = '-NAME:test1|test2' self.assertEqual(expected,...
Tests for test_runner.get_kif_test_filter.
GetKIFTestFilterTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetKIFTestFilterTest: """Tests for test_runner.get_kif_test_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_10k_train_008517
1,492
permissive
[ { "docstring": "Ensures correctness of filter.", "name": "test_correct", "signature": "def test_correct(self)" }, { "docstring": "Ensures correctness of inverted filter.", "name": "test_correct_inverted", "signature": "def test_correct_inverted(self)" } ]
2
stack_v2_sparse_classes_30k_train_007039
Implement the Python class `GetKIFTestFilterTest` described below. Class description: Tests for test_runner.get_kif_test_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter.
Implement the Python class `GetKIFTestFilterTest` described below. Class description: Tests for test_runner.get_kif_test_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter. <|skeleton|> class Get...
64bee65c921db7e78e25d08f1e98da2668b57be5
<|skeleton|> class GetKIFTestFilterTest: """Tests for test_runner.get_kif_test_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GetKIFTestFilterTest: """Tests for test_runner.get_kif_test_filter.""" def test_correct(self): """Ensures correctness of filter.""" tests = ['KIF.test1', 'KIF.test2'] expected = 'NAME:test1|test2' self.assertEqual(expected, test_apps.get_kif_test_filter(tests)) def te...
the_stack_v2_python_sparse
ios/build/bots/scripts/test_apps_test.py
otcshare/chromium-src
train
18
798a6cefbbec2da6e0fe37f56d93a35a131dcef2
[ "if block_range is None:\n latest = SystemStatus.get_latest_block()\n if not latest:\n return None\n block_range = [latest - 28800, latest]\nquery = f\"\"\"\\n SELECT * \\n FROM (\\n SELECT req_posting_auths,\\n op_json -> 1 -> 'following'::te...
<|body_start_0|> if block_range is None: latest = SystemStatus.get_latest_block() if not latest: return None block_range = [latest - 28800, latest] query = f"""\n SELECT * \n FROM (\n SELECT req_posting_auths,\n ...
SearchOps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchOps: def follow(cls, follower_account=None, followed_account=None, block_range=None): """"follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]}""" <|body_0|> def reblog(cls, reblog_account=None, blog_author=None, blog_permlink=None, block_range=...
stack_v2_sparse_classes_10k_train_008518
2,841
permissive
[ { "docstring": "\"follow\" | {\"follower\":\"idwritershive\",\"following\":\"olgavita\",\"what\":[\"blog\"]}", "name": "follow", "signature": "def follow(cls, follower_account=None, followed_account=None, block_range=None)" }, { "docstring": "\"reblog\" | { \"account\":\"nataly2317\", \"author\"...
2
stack_v2_sparse_classes_30k_train_003568
Implement the Python class `SearchOps` described below. Class description: Implement the SearchOps class. Method signatures and docstrings: - def follow(cls, follower_account=None, followed_account=None, block_range=None): "follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]} - def reblog(cls...
Implement the Python class `SearchOps` described below. Class description: Implement the SearchOps class. Method signatures and docstrings: - def follow(cls, follower_account=None, followed_account=None, block_range=None): "follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]} - def reblog(cls...
db801ff856bf2feb68580317e79cfd6006053e2c
<|skeleton|> class SearchOps: def follow(cls, follower_account=None, followed_account=None, block_range=None): """"follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]}""" <|body_0|> def reblog(cls, reblog_account=None, blog_author=None, blog_permlink=None, block_range=...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SearchOps: def follow(cls, follower_account=None, followed_account=None, block_range=None): """"follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]}""" if block_range is None: latest = SystemStatus.get_latest_block() if not latest: ...
the_stack_v2_python_sparse
hive_plug_play/engine/plugs/follow.py
imwatsi/hive-plug-play
train
3
d71c8d3c1dfa3fdb5b5a6ba9b19102b9791ca71c
[ "janez = User.objects.create(username='Janez', password='geslo')\nTopic.objects.create(body='Recent topic', author=janez)\nTopic.objects.create(body='Old topic', author=janez, date=timezone.now() - datetime.timedelta(days=30))\nComment.objects.create(topic=Topic.objects.get(body='Recent topic'), body='Comment', aut...
<|body_start_0|> janez = User.objects.create(username='Janez', password='geslo') Topic.objects.create(body='Recent topic', author=janez) Topic.objects.create(body='Old topic', author=janez, date=timezone.now() - datetime.timedelta(days=30)) Comment.objects.create(topic=Topic.objects.get(...
Class representing tests connected to the forum app
ArticleTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleTests: """Class representing tests connected to the forum app""" def setUp(self): """Method that sets up all of the objects used in the test class""" <|body_0|> def test_if_recent(self): """Tests whether the is_recent topic works correctly""" <|bod...
stack_v2_sparse_classes_10k_train_008519
1,345
no_license
[ { "docstring": "Method that sets up all of the objects used in the test class", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests whether the is_recent topic works correctly", "name": "test_if_recent", "signature": "def test_if_recent(self)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_006516
Implement the Python class `ArticleTests` described below. Class description: Class representing tests connected to the forum app Method signatures and docstrings: - def setUp(self): Method that sets up all of the objects used in the test class - def test_if_recent(self): Tests whether the is_recent topic works corre...
Implement the Python class `ArticleTests` described below. Class description: Class representing tests connected to the forum app Method signatures and docstrings: - def setUp(self): Method that sets up all of the objects used in the test class - def test_if_recent(self): Tests whether the is_recent topic works corre...
88ea46883f95a87c5dce384e137848916e51d34e
<|skeleton|> class ArticleTests: """Class representing tests connected to the forum app""" def setUp(self): """Method that sets up all of the objects used in the test class""" <|body_0|> def test_if_recent(self): """Tests whether the is_recent topic works correctly""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArticleTests: """Class representing tests connected to the forum app""" def setUp(self): """Method that sets up all of the objects used in the test class""" janez = User.objects.create(username='Janez', password='geslo') Topic.objects.create(body='Recent topic', author=janez) ...
the_stack_v2_python_sparse
backend/forum/tests.py
aljazb/Website
train
0
2a22485845e27007b8d94fa51e2827223229abc5
[ "self.dict_1 = {'a': 1, 'b': 2, 'c': 3}\nself.dict_2 = {'b': 2, 'a': 1, 'c': 3}\nself.dict_3 = {'a': 4, 'b': 5, 'c': 6}\nself.dict_4 = {'d': 1, 'e': 2, 'f': 3}\nself.list_1 = [1, 2, 3, 9, 10]\nself.list_2 = [1, 3, 3, 4, 19]\nself.list_3 = [1, 5, 8, 3]\nself.list_4 = [-x for x in self.list_1]\nself.list_5 = [-x for ...
<|body_start_0|> self.dict_1 = {'a': 1, 'b': 2, 'c': 3} self.dict_2 = {'b': 2, 'a': 1, 'c': 3} self.dict_3 = {'a': 4, 'b': 5, 'c': 6} self.dict_4 = {'d': 1, 'e': 2, 'f': 3} self.list_1 = [1, 2, 3, 9, 10] self.list_2 = [1, 3, 3, 4, 19] self.list_3 = [1, 5, 8, 3] ...
Unit test class for ancillary utilities.
AncillaryUtilsTestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AncillaryUtilsTestCase: """Unit test class for ancillary utilities.""" def setUp(self): """Sets up attributes.""" <|body_0|> def test_compare_dict(self): """Test compare_dict function.""" <|body_1|> def test_nondecreasing(self): """Unit tests...
stack_v2_sparse_classes_10k_train_008520
2,664
permissive
[ { "docstring": "Sets up attributes.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test compare_dict function.", "name": "test_compare_dict", "signature": "def test_compare_dict(self)" }, { "docstring": "Unit tests for is_nondecreasing.", "name": "test_n...
6
stack_v2_sparse_classes_30k_train_001037
Implement the Python class `AncillaryUtilsTestCase` described below. Class description: Unit test class for ancillary utilities. Method signatures and docstrings: - def setUp(self): Sets up attributes. - def test_compare_dict(self): Test compare_dict function. - def test_nondecreasing(self): Unit tests for is_nondecr...
Implement the Python class `AncillaryUtilsTestCase` described below. Class description: Unit test class for ancillary utilities. Method signatures and docstrings: - def setUp(self): Sets up attributes. - def test_compare_dict(self): Test compare_dict function. - def test_nondecreasing(self): Unit tests for is_nondecr...
3eef7d30bcc2e56f2221a624bd8ec7f933f81e40
<|skeleton|> class AncillaryUtilsTestCase: """Unit test class for ancillary utilities.""" def setUp(self): """Sets up attributes.""" <|body_0|> def test_compare_dict(self): """Test compare_dict function.""" <|body_1|> def test_nondecreasing(self): """Unit tests...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AncillaryUtilsTestCase: """Unit test class for ancillary utilities.""" def setUp(self): """Sets up attributes.""" self.dict_1 = {'a': 1, 'b': 2, 'c': 3} self.dict_2 = {'b': 2, 'a': 1, 'c': 3} self.dict_3 = {'a': 4, 'b': 5, 'c': 6} self.dict_4 = {'d': 1, 'e': 2, 'f'...
the_stack_v2_python_sparse
dragonfly/utils/unittest_ancillary_utils.py
dragonfly/dragonfly
train
868
94631fa6e27eab8386b7f78752225f34382773a2
[ "n = len(nums)\nfor i in range(n - 1):\n smallest = nums[i]\n idx = i\n for j in range(i + 1, n):\n if nums[j] < smallest:\n smallest = nums[j]\n idx = j\n if smallest < nums[i]:\n nums[i], nums[idx] = (nums[idx], nums[i])\nreturn nums", "n = len(nums)\nfor i in ran...
<|body_start_0|> n = len(nums) for i in range(n - 1): smallest = nums[i] idx = i for j in range(i + 1, n): if nums[j] < smallest: smallest = nums[j] idx = j if smallest < nums[i]: nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortArray(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def sortArray(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def sortArray(self, nums): """:type nums: List[int] :rtype: List[int...
stack_v2_sparse_classes_10k_train_008521
2,326
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "sortArray", "signature": "def sortArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "sortArray", "signature": "def sortArray(self, nums)" }, { "docstring": ":type nums: List[i...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArray(self, nums): :type nums: List[int] :rtype: List[int] - def sortArray(self, nums): :type nums: List[int] :rtype: List[int] - def sortArray(self, nums): :type nums: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArray(self, nums): :type nums: List[int] :rtype: List[int] - def sortArray(self, nums): :type nums: List[int] :rtype: List[int] - def sortArray(self, nums): :type nums: L...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def sortArray(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def sortArray(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def sortArray(self, nums): """:type nums: List[int] :rtype: List[int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sortArray(self, nums): """:type nums: List[int] :rtype: List[int]""" n = len(nums) for i in range(n - 1): smallest = nums[i] idx = i for j in range(i + 1, n): if nums[j] < smallest: smallest = nums[j]...
the_stack_v2_python_sparse
0912_Sort_an_Array.py
bingli8802/leetcode
train
0
3c69d82bf70110373a00967ffdbbbe65837f441f
[ "serializer = serializers_anio.CreateSingleCursoSerializer(data=request.data)\ndata = {}\nif serializer.is_valid(raise_exception=True):\n get_object_or_404(Anio.objects.filter(carrera__institucion_id=request.user.institucion.id), pk=serializer.validated_data['anio'].pk)\n try:\n instance = serializer.c...
<|body_start_0|> serializer = serializers_anio.CreateSingleCursoSerializer(data=request.data) data = {} if serializer.is_valid(raise_exception=True): get_object_or_404(Anio.objects.filter(carrera__institucion_id=request.user.institucion.id), pk=serializer.validated_data['anio'].pk) ...
CursoViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CursoViewSet: def create(self, request): """Crear un curso""" <|body_0|> def destroy(self, request, pk=None): """Elimina un Curso""" <|body_1|> def update(self, request, pk=None): """Edita un curso""" <|body_2|> def get(self, request...
stack_v2_sparse_classes_10k_train_008522
9,416
no_license
[ { "docstring": "Crear un curso", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Elimina un Curso", "name": "destroy", "signature": "def destroy(self, request, pk=None)" }, { "docstring": "Edita un curso", "name": "update", "signature": "def ...
5
stack_v2_sparse_classes_30k_val_000137
Implement the Python class `CursoViewSet` described below. Class description: Implement the CursoViewSet class. Method signatures and docstrings: - def create(self, request): Crear un curso - def destroy(self, request, pk=None): Elimina un Curso - def update(self, request, pk=None): Edita un curso - def get(self, req...
Implement the Python class `CursoViewSet` described below. Class description: Implement the CursoViewSet class. Method signatures and docstrings: - def create(self, request): Crear un curso - def destroy(self, request, pk=None): Elimina un Curso - def update(self, request, pk=None): Edita un curso - def get(self, req...
be80b2d15f84a8eeba898e753efee348de6ce998
<|skeleton|> class CursoViewSet: def create(self, request): """Crear un curso""" <|body_0|> def destroy(self, request, pk=None): """Elimina un Curso""" <|body_1|> def update(self, request, pk=None): """Edita un curso""" <|body_2|> def get(self, request...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CursoViewSet: def create(self, request): """Crear un curso""" serializer = serializers_anio.CreateSingleCursoSerializer(data=request.data) data = {} if serializer.is_valid(raise_exception=True): get_object_or_404(Anio.objects.filter(carrera__institucion_id=request.u...
the_stack_v2_python_sparse
curricula/api/views/anio.py
Clear-Education/ontrack_backend
train
1
ead08274ad871624a9db2645fda9ec1c3b8b9fc9
[ "root = Node('*', True, None, None, None, None)\nif len(grid) == 1:\n root.isLeaf = True\n root.val = True if grid[0][0] == 1 else False\nif self.allValueSame(grid):\n root.isLeaf = True\n root.val = True if grid[0][0] == 1 else False\nelse:\n halfLength = len(grid) // 2\n root.isLeaf = False\n ...
<|body_start_0|> root = Node('*', True, None, None, None, None) if len(grid) == 1: root.isLeaf = True root.val = True if grid[0][0] == 1 else False if self.allValueSame(grid): root.isLeaf = True root.val = True if grid[0][0] == 1 else False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" <|body_0|> def allValueSame(self, grid): """:type grid: List[List[int]] :rtype: boolean""" <|body_1|> <|end_skeleton|> <|body_start_0|> root = Node('*', True, None, ...
stack_v2_sparse_classes_10k_train_008523
2,302
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: Node", "name": "construct", "signature": "def construct(self, grid)" }, { "docstring": ":type grid: List[List[int]] :rtype: boolean", "name": "allValueSame", "signature": "def allValueSame(self, grid)" } ]
2
stack_v2_sparse_classes_30k_train_001526
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid): :type grid: List[List[int]] :rtype: Node - def allValueSame(self, grid): :type grid: List[List[int]] :rtype: boolean
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid): :type grid: List[List[int]] :rtype: Node - def allValueSame(self, grid): :type grid: List[List[int]] :rtype: boolean <|skeleton|> class Solution: ...
c93f15bee2ee2eea2e6f276c4907280d110c0467
<|skeleton|> class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" <|body_0|> def allValueSame(self, grid): """:type grid: List[List[int]] :rtype: boolean""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def construct(self, grid): """:type grid: List[List[int]] :rtype: Node""" root = Node('*', True, None, None, None, None) if len(grid) == 1: root.isLeaf = True root.val = True if grid[0][0] == 1 else False if self.allValueSame(grid): ...
the_stack_v2_python_sparse
427. 建立四叉树.py
leesen934/leetcode_practices
train
0
8bb053396bfc84bed1b2e1f9f358852fc1435138
[ "super(SimulatedInteractionModule, self).__init__()\nself.pool_data, self.occ_data, self.start_end = (pool_data, occ_data, seq_start_end)\nself.traj_len, self.num_seqs = (obs.shape[0] - 1 + pred.shape[0], seq_start_end.shape[0])\nself.t, self.s = (0, 0)\nself.embedding, self.embedding_occ = (interaction_module.embe...
<|body_start_0|> super(SimulatedInteractionModule, self).__init__() self.pool_data, self.occ_data, self.start_end = (pool_data, occ_data, seq_start_end) self.traj_len, self.num_seqs = (obs.shape[0] - 1 + pred.shape[0], seq_start_end.shape[0]) self.t, self.s = (0, 0) self.embeddin...
Simulates the ShapeBasedPooling class (../interacion_modules/shape_based.py) to return pooling of of neighbour motion. The pooling data has been pre-computed, which is why this module simulates it. The module knows how many sequences there are, and sequentially returns the correct portion of the pooling data assuming t...
SimulatedInteractionModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatedInteractionModule: """Simulates the ShapeBasedPooling class (../interacion_modules/shape_based.py) to return pooling of of neighbour motion. The pooling data has been pre-computed, which is why this module simulates it. The module knows how many sequences there are, and sequentially retu...
stack_v2_sparse_classes_10k_train_008524
17,400
permissive
[ { "docstring": "Initialize the SimulatedInteractionModule with a batch of data :param obs: Tensor of shape (obs_len, num_peds, 2). Observed (past) trajectories :param pred: Tensor of shape (pred_len, num_peds, 2). Predicted (or future) trajectories :param seq_start_end: Tensor of shape (batch_size). Delimitting...
2
stack_v2_sparse_classes_30k_train_000040
Implement the Python class `SimulatedInteractionModule` described below. Class description: Simulates the ShapeBasedPooling class (../interacion_modules/shape_based.py) to return pooling of of neighbour motion. The pooling data has been pre-computed, which is why this module simulates it. The module knows how many seq...
Implement the Python class `SimulatedInteractionModule` described below. Class description: Simulates the ShapeBasedPooling class (../interacion_modules/shape_based.py) to return pooling of of neighbour motion. The pooling data has been pre-computed, which is why this module simulates it. The module knows how many seq...
1b9fbe6c89c74dc706fd8d3b11ea08977ba2c1d3
<|skeleton|> class SimulatedInteractionModule: """Simulates the ShapeBasedPooling class (../interacion_modules/shape_based.py) to return pooling of of neighbour motion. The pooling data has been pre-computed, which is why this module simulates it. The module knows how many sequences there are, and sequentially retu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimulatedInteractionModule: """Simulates the ShapeBasedPooling class (../interacion_modules/shape_based.py) to return pooling of of neighbour motion. The pooling data has been pre-computed, which is why this module simulates it. The module knows how many sequences there are, and sequentially returns the corre...
the_stack_v2_python_sparse
models/interaction_modules/train_aux.py
pedro-mgb/pedestrian-arc-lstm-smf
train
4
7896da76ccdf33988ab7f8cfad7f6bb289d78c7e
[ "if model._meta.app_label == 'whalesdb':\n return 'whalesdb'\nreturn None", "if model._meta.app_label == 'whalesdb':\n return 'whalesdb'\nreturn None", "if obj1._meta.app_label == 'whalesdb' and obj2._meta.app_label == 'whalesdb':\n return True\nelif 'whalesdb' not in [obj1._meta.app_label, obj2._meta....
<|body_start_0|> if model._meta.app_label == 'whalesdb': return 'whalesdb' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'whalesdb': return 'whalesdb' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label == 'whale...
WhaleDatabaseRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WhaleDatabaseRouter: def db_for_read(self, model, **hints): """Send all read operations on whalesdb app models to `whalesdb`.""" <|body_0|> def db_for_write(self, model, **hints): """Send all write operations on whalesdb app models to `whalesdb`.""" <|body_1|...
stack_v2_sparse_classes_10k_train_008525
1,977
no_license
[ { "docstring": "Send all read operations on whalesdb app models to `whalesdb`.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Send all write operations on whalesdb app models to `whalesdb`.", "name": "db_for_write", "signature": "def db_f...
4
stack_v2_sparse_classes_30k_train_005362
Implement the Python class `WhaleDatabaseRouter` described below. Class description: Implement the WhaleDatabaseRouter class. Method signatures and docstrings: - def db_for_read(self, model, **hints): Send all read operations on whalesdb app models to `whalesdb`. - def db_for_write(self, model, **hints): Send all wri...
Implement the Python class `WhaleDatabaseRouter` described below. Class description: Implement the WhaleDatabaseRouter class. Method signatures and docstrings: - def db_for_read(self, model, **hints): Send all read operations on whalesdb app models to `whalesdb`. - def db_for_write(self, model, **hints): Send all wri...
483f855b19876fd60c0017a270df74e076aa0d8b
<|skeleton|> class WhaleDatabaseRouter: def db_for_read(self, model, **hints): """Send all read operations on whalesdb app models to `whalesdb`.""" <|body_0|> def db_for_write(self, model, **hints): """Send all write operations on whalesdb app models to `whalesdb`.""" <|body_1|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WhaleDatabaseRouter: def db_for_read(self, model, **hints): """Send all read operations on whalesdb app models to `whalesdb`.""" if model._meta.app_label == 'whalesdb': return 'whalesdb' return None def db_for_write(self, model, **hints): """Send all write oper...
the_stack_v2_python_sparse
dm_apps/routers.py
yc-hu/dm_apps
train
0
549abcbcd6dd86d1b3a14005abf3afc34dabb89e
[ "inSpec = super(ValueDuration, cls).getInputSpecification()\ninSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True))\ninSpec.addSub(InputData.parameterInputFactory('bins', contentType=InputTypes.IntegerType))\nreturn inSpec", "super().__init__()\nself.dynam...
<|body_start_0|> inSpec = super(ValueDuration, cls).getInputSpecification() inSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True)) inSpec.addSub(InputData.parameterInputFactory('bins', contentType=InputTypes.IntegerType)) return i...
Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.
ValueDuration
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueDuration: """Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the cl...
stack_v2_sparse_classes_10k_train_008526
5,435
permissive
[ { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls.", "name": "getInputSpecification", "signatur...
6
stack_v2_sparse_classes_30k_test_000212
Implement the Python class `ValueDuration` described below. Class description: Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable. Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that ...
Implement the Python class `ValueDuration` described below. Class description: Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable. Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that ...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class ValueDuration: """Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the cl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ValueDuration: """Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which...
the_stack_v2_python_sparse
ravenframework/Models/PostProcessors/ValueDuration.py
idaholab/raven
train
201
01b1959a87e5d0745caeceb32d6188b53395ae79
[ "print('Enter the values for filters you want to apply (Press enter to skip)')\nfor key in self.FILTERS:\n while True:\n value = SelectFiles.validate(input(self.FILTERS[key]['description']), key)\n if value == '':\n break\n elif not isinstance(value, bool):\n self.FILTE...
<|body_start_0|> print('Enter the values for filters you want to apply (Press enter to skip)') for key in self.FILTERS: while True: value = SelectFiles.validate(input(self.FILTERS[key]['description']), key) if value == '': break ...
Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered
SelectFiles
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectFiles: """Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered""" def __init__(self): """Takes in arguments from the user for filtering files""" <|body_0|> def list_all_files(path): ...
stack_v2_sparse_classes_10k_train_008527
8,019
permissive
[ { "docstring": "Takes in arguments from the user for filtering files", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Returns a Dict object of all the files present at the path argument.", "name": "list_all_files", "signature": "def list_all_files(path)" }, ...
5
null
Implement the Python class `SelectFiles` described below. Class description: Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered Method signatures and docstrings: - def __init__(self): Takes in arguments from the user for filtering file...
Implement the Python class `SelectFiles` described below. Class description: Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered Method signatures and docstrings: - def __init__(self): Takes in arguments from the user for filtering file...
31fd3fb1233f39ea2252a7a44160ff8a2140f7bd
<|skeleton|> class SelectFiles: """Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered""" def __init__(self): """Takes in arguments from the user for filtering files""" <|body_0|> def list_all_files(path): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SelectFiles: """Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered""" def __init__(self): """Takes in arguments from the user for filtering files""" print('Enter the values for filters you want to apply (Pr...
the_stack_v2_python_sparse
Python/Bulk_File_Renamer/utils.py
HarshCasper/Rotten-Scripts
train
1,474
33354bceda75692810332b0fcdb42bde41e942c5
[ "ser = []\n\ndef preOrder(root):\n if not root:\n ser.append('#')\n else:\n ser.append(str(root.val))\n preOrder(root.left)\n preOrder(root.right)\npreOrder(root)\nreturn ' '.join(ser)", "vals = collections.deque([x for x in data.split()])\n\ndef build():\n if vals:\n v...
<|body_start_0|> ser = [] def preOrder(root): if not root: ser.append('#') else: ser.append(str(root.val)) preOrder(root.left) preOrder(root.right) preOrder(root) return ' '.join(ser) <|end_body_0|> ...
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|> def serialize(self, r...
stack_v2_sparse_classes_10k_train_008528
2,959
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...
4
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:...
a39280ab6bbbf3b688a024a71ef952be5010d98e
<|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|> def serialize(self, r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" ser = [] def preOrder(root): if not root: ser.append('#') else: ser.append(str(root.val)) preOrder(root.l...
the_stack_v2_python_sparse
297_Serialize_and_Deserialize_Binary_Tree.py
MarcelArthur/leetcode_collection
train
0
67353d2f386975f693ba9c68f5ba1fb5fca8c189
[ "if len(prices) < 2:\n return 0\nmin_price = float('inf')\nmax_price = 0\nfor v in prices:\n min_price = min(min_price, v)\n max_price = max(max_price, v - min_price)\nreturn max_price", "diff = [0]\nif len(prices) < 2:\n return 0\nfor i in range(1, len(prices)):\n diff.append(prices[i] - prices[i ...
<|body_start_0|> if len(prices) < 2: return 0 min_price = float('inf') max_price = 0 for v in prices: min_price = min(min_price, v) max_price = max(max_price, v - min_price) return max_price <|end_body_0|> <|body_start_1|> diff = [0] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(prices) < 2: return 0...
stack_v2_sparse_classes_10k_train_008529
851
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, prices)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def maxPro...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" if len(prices) < 2: return 0 min_price = float('inf') max_price = 0 for v in prices: min_price = min(min_price, v) max_price = max(max_price, v - min_pri...
the_stack_v2_python_sparse
4/121-Best_Time_to_Buy_and_Sell_Stock.py
ChangXiaodong/Leetcode-solutions
train
4
83a8f33f1e130c8e392c79c943b2cc4f12ff4d28
[ "if not prices or len(prices) < 1:\n return 0\nn = len(prices)\nbuy = [0] * (n + 1)\nsell = [0] * (n + 1)\nbuy[1] = -prices[0]\nfor i in range(2, n + 1):\n price = prices[i - 1]\n buy[i] = max(sell[i - 2] - price, buy[i - 1])\n sell[i] = max(buy[i - 1] + price, sell[i - 1])\nreturn sell[n]", "n = len(...
<|body_start_0|> if not prices or len(prices) < 1: return 0 n = len(prices) buy = [0] * (n + 1) sell = [0] * (n + 1) buy[1] = -prices[0] for i in range(2, n + 1): price = prices[i - 1] buy[i] = max(sell[i - 2] - price, buy[i - 1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g "buy, sell, buy" or "buy, cooldown, cooldown" sell[i]: The maximum profit can b...
stack_v2_sparse_classes_10k_train_008530
3,095
no_license
[ { "docstring": ":type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g \"buy, sell, buy\" or \"buy, cooldown, cooldown\" sell[i]: The maximum profit can be made if the first i days end with sell or wa...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g "buy, sell, buy" or "buy, cooldown, cooldown" sell[i]: The maximum profit can b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g "buy, sell, buy" or "buy, cooldown, cooldown" sell[i]: The maximum profit can be made if the ...
the_stack_v2_python_sparse
B/BestTimetoBuyandSellStockWithCooldown.py
bssrdf/pyleet
train
2
1a899aa5912589a9ab1edd407989fb8e5dde0d5e
[ "self.api_type = api_type\nself.IOLoop = tornado.ioloop\nself.mc = memcache.Client(MEMCACHE_HOST, debug=1)\nself.timer = TOKEN_TIMER * 1000\nself.default_rate = 0\nself.app_rates = {}\nself.scheduler = None\nif not self._token_init():\n raise Exception('TokenBucket token init fail')", "try:\n self.app_rates...
<|body_start_0|> self.api_type = api_type self.IOLoop = tornado.ioloop self.mc = memcache.Client(MEMCACHE_HOST, debug=1) self.timer = TOKEN_TIMER * 1000 self.default_rate = 0 self.app_rates = {} self.scheduler = None if not self._token_init(): ...
TokenBucket
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenBucket: def __init__(self, api_type): """初始化 :param api_type: (string)需要控制流量的接口类型 sms/mms/... :return:""" <|body_0|> def _token_init(self): """初始化各应用令牌数量 :return:""" <|body_1|> def _update_app_rate(self): """更新各应用速率 :return:""" <|bod...
stack_v2_sparse_classes_10k_train_008531
5,361
no_license
[ { "docstring": "初始化 :param api_type: (string)需要控制流量的接口类型 sms/mms/... :return:", "name": "__init__", "signature": "def __init__(self, api_type)" }, { "docstring": "初始化各应用令牌数量 :return:", "name": "_token_init", "signature": "def _token_init(self)" }, { "docstring": "更新各应用速率 :return:...
5
stack_v2_sparse_classes_30k_train_006600
Implement the Python class `TokenBucket` described below. Class description: Implement the TokenBucket class. Method signatures and docstrings: - def __init__(self, api_type): 初始化 :param api_type: (string)需要控制流量的接口类型 sms/mms/... :return: - def _token_init(self): 初始化各应用令牌数量 :return: - def _update_app_rate(self): 更新各应用...
Implement the Python class `TokenBucket` described below. Class description: Implement the TokenBucket class. Method signatures and docstrings: - def __init__(self, api_type): 初始化 :param api_type: (string)需要控制流量的接口类型 sms/mms/... :return: - def _token_init(self): 初始化各应用令牌数量 :return: - def _update_app_rate(self): 更新各应用...
75f83797885a05df038bc7aab29138ecef27fa06
<|skeleton|> class TokenBucket: def __init__(self, api_type): """初始化 :param api_type: (string)需要控制流量的接口类型 sms/mms/... :return:""" <|body_0|> def _token_init(self): """初始化各应用令牌数量 :return:""" <|body_1|> def _update_app_rate(self): """更新各应用速率 :return:""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TokenBucket: def __init__(self, api_type): """初始化 :param api_type: (string)需要控制流量的接口类型 sms/mms/... :return:""" self.api_type = api_type self.IOLoop = tornado.ioloop self.mc = memcache.Client(MEMCACHE_HOST, debug=1) self.timer = TOKEN_TIMER * 1000 self.default_ra...
the_stack_v2_python_sparse
OpenAPI/api_qos/api_token_bucket.py
ennismar/python
train
0
12938724e950f05f0bd0b87dfab8c700b0c916b5
[ "assert 0 <= start < n and 0 <= end < n\nself._n = n\nself._start = start\nself._end = end\nself._edges: List['Edge'] = []\nself._reGraph: List[List[int]] = [[] for _ in range(n)]\nself._dist = [INF] * n\nself._flow = [0] * n\nself._pre = [-1] * n", "self._edges.append(Edge(fromV, toV, cap, cost, 0))\nself._edges...
<|body_start_0|> assert 0 <= start < n and 0 <= end < n self._n = n self._start = start self._end = end self._edges: List['Edge'] = [] self._reGraph: List[List[int]] = [[] for _ in range(n)] self._dist = [INF] * n self._flow = [0] * n self._pre = [...
最小费用流的复杂度为流量*spfa的复杂度
MinCostMaxFlowEK
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinCostMaxFlowEK: """最小费用流的复杂度为流量*spfa的复杂度""" def __init__(self, n: int, start: int, end: int): """Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点""" <|body_0|> def addEdge(self, fromV: int, toV: int, cap: int, cost: int) -> None: """原边索引为i 反向边索引...
stack_v2_sparse_classes_10k_train_008532
9,685
no_license
[ { "docstring": "Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点", "name": "__init__", "signature": "def __init__(self, n: int, start: int, end: int)" }, { "docstring": "原边索引为i 反向边索引为i^1", "name": "addEdge", "signature": "def addEdge(self, fromV: int, toV: int, cap: int, ...
4
stack_v2_sparse_classes_30k_train_001525
Implement the Python class `MinCostMaxFlowEK` described below. Class description: 最小费用流的复杂度为流量*spfa的复杂度 Method signatures and docstrings: - def __init__(self, n: int, start: int, end: int): Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点 - def addEdge(self, fromV: int, toV: int, cap: int, cost: int) ...
Implement the Python class `MinCostMaxFlowEK` described below. Class description: 最小费用流的复杂度为流量*spfa的复杂度 Method signatures and docstrings: - def __init__(self, n: int, start: int, end: int): Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点 - def addEdge(self, fromV: int, toV: int, cap: int, cost: int) ...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class MinCostMaxFlowEK: """最小费用流的复杂度为流量*spfa的复杂度""" def __init__(self, n: int, start: int, end: int): """Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点""" <|body_0|> def addEdge(self, fromV: int, toV: int, cap: int, cost: int) -> None: """原边索引为i 反向边索引...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MinCostMaxFlowEK: """最小费用流的复杂度为流量*spfa的复杂度""" def __init__(self, n: int, start: int, end: int): """Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点""" assert 0 <= start < n and 0 <= end < n self._n = n self._start = start self._end = end sel...
the_stack_v2_python_sparse
7_graph/网络流/4-费用流/MinCostMaxFlow.py
981377660LMT/algorithm-study
train
225
16281d1b69f59ea377fe24472bf6017853af13c8
[ "super(_PyramidPoolingModule, self).__init__()\nself.features = []\nfor s in setting:\n self.features.append(nn.Sequential(nn.AdaptiveAvgPool2d(s), nn.Conv2d(in_dim, reduction_dim, kernel_size=1, bias=False), nn.BatchNorm2d(reduction_dim, momentum=0.95), nn.ReLU(inplace=True)))\nself.features = nn.ModuleList(sel...
<|body_start_0|> super(_PyramidPoolingModule, self).__init__() self.features = [] for s in setting: self.features.append(nn.Sequential(nn.AdaptiveAvgPool2d(s), nn.Conv2d(in_dim, reduction_dim, kernel_size=1, bias=False), nn.BatchNorm2d(reduction_dim, momentum=0.95), nn.ReLU(inplace=T...
Creates a pyramid pooling module
_PyramidPoolingModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _PyramidPoolingModule: """Creates a pyramid pooling module""" def __init__(self, in_dim, reduction_dim, setting): """Initializes the pyramid pooling module""" <|body_0|> def forward(self, x): """Computes a forward pass through the network. Parameters ---------- x...
stack_v2_sparse_classes_10k_train_008533
4,011
no_license
[ { "docstring": "Initializes the pyramid pooling module", "name": "__init__", "signature": "def __init__(self, in_dim, reduction_dim, setting)" }, { "docstring": "Computes a forward pass through the network. Parameters ---------- x : torch.Tensor Input features Returns: torch.Tensor Output featur...
2
stack_v2_sparse_classes_30k_train_001237
Implement the Python class `_PyramidPoolingModule` described below. Class description: Creates a pyramid pooling module Method signatures and docstrings: - def __init__(self, in_dim, reduction_dim, setting): Initializes the pyramid pooling module - def forward(self, x): Computes a forward pass through the network. Pa...
Implement the Python class `_PyramidPoolingModule` described below. Class description: Creates a pyramid pooling module Method signatures and docstrings: - def __init__(self, in_dim, reduction_dim, setting): Initializes the pyramid pooling module - def forward(self, x): Computes a forward pass through the network. Pa...
d833bc755cf10b16cc09038aae682387a1d1d936
<|skeleton|> class _PyramidPoolingModule: """Creates a pyramid pooling module""" def __init__(self, in_dim, reduction_dim, setting): """Initializes the pyramid pooling module""" <|body_0|> def forward(self, x): """Computes a forward pass through the network. Parameters ---------- x...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _PyramidPoolingModule: """Creates a pyramid pooling module""" def __init__(self, in_dim, reduction_dim, setting): """Initializes the pyramid pooling module""" super(_PyramidPoolingModule, self).__init__() self.features = [] for s in setting: self.features.appen...
the_stack_v2_python_sparse
core/models/backbone/pspnet.py
mhashas/Temples-Classifier
train
0
0ec9b615bcb7d1ec2f76f065e00fab27da08e0ae
[ "result = super().get_lookup_regex(viewset, lookup_prefix)\nlookup_fields = getattr(viewset, 'lookup_fields', None)\nif lookup_fields and (not self.multi):\n lookup_value = getattr(viewset, 'lookup_value_regex', '[^/.]+')\n for lookup_field in lookup_fields[1:]:\n result += f'/(?P<{lookup_field}>{looku...
<|body_start_0|> result = super().get_lookup_regex(viewset, lookup_prefix) lookup_fields = getattr(viewset, 'lookup_fields', None) if lookup_fields and (not self.multi): lookup_value = getattr(viewset, 'lookup_value_regex', '[^/.]+') for lookup_field in lookup_fields[1:]:...
Support multiple lookup keys e.g. /parent_pk/pk
MultiLookupRouter
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiLookupRouter: """Support multiple lookup keys e.g. /parent_pk/pk""" def get_lookup_regex(self, viewset, lookup_prefix=''): """Returns a lookup regex, this extends the default to allow for multiple lookup keys as defined by a viewset.lookup_fields property.""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_008534
7,050
permissive
[ { "docstring": "Returns a lookup regex, this extends the default to allow for multiple lookup keys as defined by a viewset.lookup_fields property.", "name": "get_lookup_regex", "signature": "def get_lookup_regex(self, viewset, lookup_prefix='')" }, { "docstring": "Return a list of URL regexs, th...
2
null
Implement the Python class `MultiLookupRouter` described below. Class description: Support multiple lookup keys e.g. /parent_pk/pk Method signatures and docstrings: - def get_lookup_regex(self, viewset, lookup_prefix=''): Returns a lookup regex, this extends the default to allow for multiple lookup keys as defined by...
Implement the Python class `MultiLookupRouter` described below. Class description: Support multiple lookup keys e.g. /parent_pk/pk Method signatures and docstrings: - def get_lookup_regex(self, viewset, lookup_prefix=''): Returns a lookup regex, this extends the default to allow for multiple lookup keys as defined by...
e5bdec91cb47179172b515bbcb91701262ff3377
<|skeleton|> class MultiLookupRouter: """Support multiple lookup keys e.g. /parent_pk/pk""" def get_lookup_regex(self, viewset, lookup_prefix=''): """Returns a lookup regex, this extends the default to allow for multiple lookup keys as defined by a viewset.lookup_fields property.""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiLookupRouter: """Support multiple lookup keys e.g. /parent_pk/pk""" def get_lookup_regex(self, viewset, lookup_prefix=''): """Returns a lookup regex, this extends the default to allow for multiple lookup keys as defined by a viewset.lookup_fields property.""" result = super().get_loo...
the_stack_v2_python_sparse
onadata/apps/api/urls/v1_urls.py
onaio/onadata
train
177
1b576beb7ed0ae60cc00d1ad100e17c81a2eb8ae
[ "self.run_time = run_time\nsuper().__init__(start_end_points, *args, **kwargs)\nself._next_dots_coords = {'x': self.x_funnel_center, 'y': self.y_point_bottom + self.y_bottom_shift * 2}", "current_coord = self._next_dots_coords.get('y')\nx_left_to_bottom_right = self.left_to_bottom_right.get_all_points()[-1][0]\nx...
<|body_start_0|> self.run_time = run_time super().__init__(start_end_points, *args, **kwargs) self._next_dots_coords = {'x': self.x_funnel_center, 'y': self.y_point_bottom + self.y_bottom_shift * 2} <|end_body_0|> <|body_start_1|> current_coord = self._next_dots_coords.get('y') ...
Overridden Funnel class to add 'movable' functionality
MovableFunnel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovableFunnel: """Overridden Funnel class to add 'movable' functionality""" def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): """Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points...
stack_v2_sparse_classes_10k_train_008535
5,092
no_license
[ { "docstring": "Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points (Tuple[tuple, tuple]): Left top and right top points. ((x1,y1), (x2,y2)). run_time (Union[int, float]): How quickly we need to animate dots.", "name": "__init__", "signature": "def __init...
3
stack_v2_sparse_classes_30k_train_006146
Implement the Python class `MovableFunnel` described below. Class description: Overridden Funnel class to add 'movable' functionality Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): Class initialization. It receives all param...
Implement the Python class `MovableFunnel` described below. Class description: Overridden Funnel class to add 'movable' functionality Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): Class initialization. It receives all param...
290bf56ef888283a0225939ed8b1f87445e506d0
<|skeleton|> class MovableFunnel: """Overridden Funnel class to add 'movable' functionality""" def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): """Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovableFunnel: """Overridden Funnel class to add 'movable' functionality""" def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): """Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points (Tuple[tuple...
the_stack_v2_python_sparse
classes/movable_funnel.py
mohovkm/habr_manim
train
0
84fdc216ac729bf8994f83bebcfbe0d1d5b566c5
[ "try:\n self.teaClass = []\n self.sqlhandler = None\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n if self.getTeaClass():\n self.write(json.dumps(self.teaClass) if len(self.teaClass) != 0 else '[]')\n self.finish()\n else:\n raise RuntimeError\ne...
<|body_start_0|> try: self.teaClass = [] self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return if self.getTeaClass(): self.write(json.dumps(self.teaClass) if len(self.teaClass) != 0 else '...
TeaGetClassListRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" <|body_0|> def getTeaClass(self): """返回老师的习题列表""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: self.teaClass = [] self.sqlhandler = None if...
stack_v2_sparse_classes_10k_train_008536
2,430
no_license
[ { "docstring": "获取练习题列表,返回给老师客户端", "name": "get", "signature": "def get(self)" }, { "docstring": "返回老师的习题列表", "name": "getTeaClass", "signature": "def getTeaClass(self)" } ]
2
stack_v2_sparse_classes_30k_train_006786
Implement the Python class `TeaGetClassListRequestHandler` described below. Class description: Implement the TeaGetClassListRequestHandler class. Method signatures and docstrings: - def get(self): 获取练习题列表,返回给老师客户端 - def getTeaClass(self): 返回老师的习题列表
Implement the Python class `TeaGetClassListRequestHandler` described below. Class description: Implement the TeaGetClassListRequestHandler class. Method signatures and docstrings: - def get(self): 获取练习题列表,返回给老师客户端 - def getTeaClass(self): 返回老师的习题列表 <|skeleton|> class TeaGetClassListRequestHandler: def get(self)...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" <|body_0|> def getTeaClass(self): """返回老师的习题列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" try: self.teaClass = [] self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return if self.getTeaClass(): ...
the_stack_v2_python_sparse
server/teacher/TeaGetClassListRequestHandler.py
lyh-ADT/edu-app
train
1
29be655c552af3053a04b4cd5b8b6ff9090ed901
[ "self.periodic_boundaries = periodic_boundaries\nself.axes = numpy.array(Space.AXES[axes])\nself.scale_factor = scale_factor\nself.offset = offset", "if len(A.shape) == 1:\n A = A.reshape(3, 1)\nif len(B.shape) == 1:\n B = B.reshape(3, 1)\nB = self.scale_factor * (B + self.offset)\nd = numpy.zeros((len(self...
<|body_start_0|> self.periodic_boundaries = periodic_boundaries self.axes = numpy.array(Space.AXES[axes]) self.scale_factor = scale_factor self.offset = offset <|end_body_0|> <|body_start_1|> if len(A.shape) == 1: A = A.reshape(3, 1) if len(B.shape) == 1: ...
Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions.
Space
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Space: """Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions.""" def __init__(self, axes=None, scale_factor=1.0, offset=0.0, periodic_boundaries=None): """axe...
stack_v2_sparse_classes_10k_train_008537
11,343
permissive
[ { "docstring": "axes -- if not supplied, then the 3D distance is calculated. If supplied, axes should be a string containing the axes to be used, e.g. 'x', or 'yz'. axes='xyz' is the same as axes=None. scale_factor -- it may be that the pre and post populations use different units for position, e.g. degrees and...
3
stack_v2_sparse_classes_30k_train_004402
Implement the Python class `Space` described below. Class description: Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions. Method signatures and docstrings: - def __init__(self, axes=None, sca...
Implement the Python class `Space` described below. Class description: Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions. Method signatures and docstrings: - def __init__(self, axes=None, sca...
04fa1eaf78778edea3ba3afa4c527d20c491718e
<|skeleton|> class Space: """Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions.""" def __init__(self, axes=None, scale_factor=1.0, offset=0.0, periodic_boundaries=None): """axe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Space: """Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions.""" def __init__(self, axes=None, scale_factor=1.0, offset=0.0, periodic_boundaries=None): """axes -- if not s...
the_stack_v2_python_sparse
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pyNN/space.py
Roboy/LSM_SpiNNaker_MyoArm
train
2
82589894bc21b5b625f212a845d33d0848d905da
[ "first_class = m_obj.__class__\nsubclass_ls = first_class.__subclasses__()\nif subclass_ls:\n for subcls in subclass_ls:\n try:\n m_obj = subcls(ls_entries)\n except MatrixError:\n pass\nif first_class == m_obj.__class__:\n return m_obj\nelse:\n return self.get_matrix_cl...
<|body_start_0|> first_class = m_obj.__class__ subclass_ls = first_class.__subclasses__() if subclass_ls: for subcls in subclass_ls: try: m_obj = subcls(ls_entries) except MatrixError: pass if first_class...
MatrixFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatrixFactory: def get_matrix_class(self, m_obj, ls_entries): """recursively loop through the subclasses to get the most relevant type""" <|body_0|> def __call__(self, ls_entries=None): """Returns the most relevant matrix type that exists.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k_train_008538
992
no_license
[ { "docstring": "recursively loop through the subclasses to get the most relevant type", "name": "get_matrix_class", "signature": "def get_matrix_class(self, m_obj, ls_entries)" }, { "docstring": "Returns the most relevant matrix type that exists.", "name": "__call__", "signature": "def _...
2
stack_v2_sparse_classes_30k_train_002329
Implement the Python class `MatrixFactory` described below. Class description: Implement the MatrixFactory class. Method signatures and docstrings: - def get_matrix_class(self, m_obj, ls_entries): recursively loop through the subclasses to get the most relevant type - def __call__(self, ls_entries=None): Returns the ...
Implement the Python class `MatrixFactory` described below. Class description: Implement the MatrixFactory class. Method signatures and docstrings: - def get_matrix_class(self, m_obj, ls_entries): recursively loop through the subclasses to get the most relevant type - def __call__(self, ls_entries=None): Returns the ...
339567a672e12ebc4847dfd97e9d1a2a7d45f655
<|skeleton|> class MatrixFactory: def get_matrix_class(self, m_obj, ls_entries): """recursively loop through the subclasses to get the most relevant type""" <|body_0|> def __call__(self, ls_entries=None): """Returns the most relevant matrix type that exists.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MatrixFactory: def get_matrix_class(self, m_obj, ls_entries): """recursively loop through the subclasses to get the most relevant type""" first_class = m_obj.__class__ subclass_ls = first_class.__subclasses__() if subclass_ls: for subcls in subclass_ls: ...
the_stack_v2_python_sparse
matrix/choose_matrix_type.py
KerimovEmil/HigherMathInvestigations
train
2
8ea10be7e90279738150fef38abf4d1c15cc0947
[ "self.bring_disks_online = bring_disks_online\nself.password = password\nself.target_source_id = target_source_id\nself.use_existing_agent = use_existing_agent\nself.username = username\nself.volume_names = volume_names", "if dictionary is None:\n return None\nbring_disks_online = dictionary.get('bringDisksOnl...
<|body_start_0|> self.bring_disks_online = bring_disks_online self.password = password self.target_source_id = target_source_id self.use_existing_agent = use_existing_agent self.username = username self.volume_names = volume_names <|end_body_0|> <|body_start_1|> ...
Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSourceId is specified, all disks are attached but ma...
MountVolumesParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MountVolumesParameters: """Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSo...
stack_v2_sparse_classes_10k_train_008539
4,644
permissive
[ { "docstring": "Constructor for the MountVolumesParameters class", "name": "__init__", "signature": "def __init__(self, bring_disks_online=None, password=None, target_source_id=None, use_existing_agent=None, username=None, volume_names=None)" }, { "docstring": "Creates an instance of this model ...
2
null
Implement the Python class `MountVolumesParameters` described below. Class description: Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountV...
Implement the Python class `MountVolumesParameters` described below. Class description: Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountV...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MountVolumesParameters: """Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MountVolumesParameters: """Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSourceId is spe...
the_stack_v2_python_sparse
cohesity_management_sdk/models/mount_volumes_parameters.py
cohesity/management-sdk-python
train
24
7c8441d86da1cf129006a3190c237b99dd5a6af8
[ "super(ProteinCNN, self).__init__()\nself.activation = get_activation_func(activation)\nself.pooling_dim = pooling_dim\nself.lin_kernels = nn.ModuleList([nn.Linear(dim * window, dim * window) for _ in range(num_layers - 1)])\nself.lin_kernels.append(nn.Linear(dim * window, dim))", "for kernel in self.lin_kernels:...
<|body_start_0|> super(ProteinCNN, self).__init__() self.activation = get_activation_func(activation) self.pooling_dim = pooling_dim self.lin_kernels = nn.ModuleList([nn.Linear(dim * window, dim * window) for _ in range(num_layers - 1)]) self.lin_kernels.append(nn.Linear(dim * wi...
Implements Protein CNN without Attention
ProteinCNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProteinCNN: """Implements Protein CNN without Attention""" def __init__(self, dim, window, activation='relu', num_layers=2, pooling_dim=1): """:param dim: int final dimension of the protein representation :param activation: non-linearity to apply to logits :param window: max size of ...
stack_v2_sparse_classes_10k_train_008540
27,873
permissive
[ { "docstring": ":param dim: int final dimension of the protein representation :param activation: non-linearity to apply to logits :param window: max size of grouped amino acids :param num_layers: int Number of convolution layers :param pooling_dim: int The dimension to be used in reducing protein segments to fo...
2
stack_v2_sparse_classes_30k_train_006434
Implement the Python class `ProteinCNN` described below. Class description: Implements Protein CNN without Attention Method signatures and docstrings: - def __init__(self, dim, window, activation='relu', num_layers=2, pooling_dim=1): :param dim: int final dimension of the protein representation :param activation: non...
Implement the Python class `ProteinCNN` described below. Class description: Implements Protein CNN without Attention Method signatures and docstrings: - def __init__(self, dim, window, activation='relu', num_layers=2, pooling_dim=1): :param dim: int final dimension of the protein representation :param activation: non...
f1ddd11fd769c782c354425967c3cc326b9adf69
<|skeleton|> class ProteinCNN: """Implements Protein CNN without Attention""" def __init__(self, dim, window, activation='relu', num_layers=2, pooling_dim=1): """:param dim: int final dimension of the protein representation :param activation: non-linearity to apply to logits :param window: max size of ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProteinCNN: """Implements Protein CNN without Attention""" def __init__(self, dim, window, activation='relu', num_layers=2, pooling_dim=1): """:param dim: int final dimension of the protein representation :param activation: non-linearity to apply to logits :param window: max size of grouped amino...
the_stack_v2_python_sparse
jova/nn/models.py
bbrighttaer/jova_baselines
train
2
fd638627f40b8529819621985418841132e7cb64
[ "ReplayBuffer.__init__(self, capacity, storage_unit)\nself._num_add_calls = 0\nself._num_evicted = 0", "self._num_timesteps_added += item.count\nself._num_timesteps_added_wrap += item.count\nself._num_add_calls += 1\nif self._num_timesteps_added < self.capacity:\n self._storage.append(item)\n self._est_size...
<|body_start_0|> ReplayBuffer.__init__(self, capacity, storage_unit) self._num_add_calls = 0 self._num_evicted = 0 <|end_body_0|> <|body_start_1|> self._num_timesteps_added += item.count self._num_timesteps_added_wrap += item.count self._num_add_calls += 1 if sel...
This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir".
ReservoirReplayBuffer
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReservoirReplayBuffer: """This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir".""" def __init__(self, capacity: int=10000, storage_unit: str='timesteps', **kwargs): """Initializes a ReservoirBuffer inst...
stack_v2_sparse_classes_10k_train_008541
4,533
permissive
[ { "docstring": "Initializes a ReservoirBuffer instance. Args: capacity: Max number of timesteps to store in the FIFO buffer. After reaching this number, older samples will be dropped to make space for new ones. storage_unit: Either 'timesteps', 'sequences' or 'episodes'. Specifies how experiences are stored.", ...
5
null
Implement the Python class `ReservoirReplayBuffer` described below. Class description: This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir". Method signatures and docstrings: - def __init__(self, capacity: int=10000, storage_unit: str='...
Implement the Python class `ReservoirReplayBuffer` described below. Class description: This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir". Method signatures and docstrings: - def __init__(self, capacity: int=10000, storage_unit: str='...
edba68c3e7cf255d1d6479329f305adb7fa4c3ed
<|skeleton|> class ReservoirReplayBuffer: """This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir".""" def __init__(self, capacity: int=10000, storage_unit: str='timesteps', **kwargs): """Initializes a ReservoirBuffer inst...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReservoirReplayBuffer: """This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir".""" def __init__(self, capacity: int=10000, storage_unit: str='timesteps', **kwargs): """Initializes a ReservoirBuffer instance. Args: c...
the_stack_v2_python_sparse
rllib/utils/replay_buffers/reservoir_replay_buffer.py
ray-project/ray
train
29,482
58223a5755289cb41d090f31f16a1f492c9f3b46
[ "sampleAtom = atoms[-1]\nself.atoms = []\nself.name = sampleAtom.resName\nself.chainID = sampleAtom.chainID\nself.resSeq = sampleAtom.resSeq\nself.iCode = sampleAtom.iCode\nself.fixed = 0\nself.ffname = 'WAT'\nself.map = {}\nself.reference = ref\nfor a in atoms:\n if a.name in ref.altnames:\n a.name = ref...
<|body_start_0|> sampleAtom = atoms[-1] self.atoms = [] self.name = sampleAtom.resName self.chainID = sampleAtom.chainID self.resSeq = sampleAtom.resSeq self.iCode = sampleAtom.iCode self.fixed = 0 self.ffname = 'WAT' self.map = {} self.ref...
Water class This class gives data about the Water object, and inherits off the base residue class.
WAT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WAT: """Water class This class gives data about the Water object, and inherits off the base residue class.""" def __init__(self, atoms, ref): """Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)""" <|body_0|> def createAtom(s...
stack_v2_sparse_classes_10k_train_008542
22,508
permissive
[ { "docstring": "Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)", "name": "__init__", "signature": "def __init__(self, atoms, ref)" }, { "docstring": "Create a water atom. Note the HETATM field. Parameters atomname: The name of the atom (string) ne...
3
null
Implement the Python class `WAT` described below. Class description: Water class This class gives data about the Water object, and inherits off the base residue class. Method signatures and docstrings: - def __init__(self, atoms, ref): Initialize the class Parameters atoms: A list of Atom objects to be stored in this...
Implement the Python class `WAT` described below. Class description: Water class This class gives data about the Water object, and inherits off the base residue class. Method signatures and docstrings: - def __init__(self, atoms, ref): Initialize the class Parameters atoms: A list of Atom objects to be stored in this...
a50f0b2f7104007c730baa51b4ec65c891008c47
<|skeleton|> class WAT: """Water class This class gives data about the Water object, and inherits off the base residue class.""" def __init__(self, atoms, ref): """Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)""" <|body_0|> def createAtom(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WAT: """Water class This class gives data about the Water object, and inherits off the base residue class.""" def __init__(self, atoms, ref): """Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)""" sampleAtom = atoms[-1] self.atoms = [...
the_stack_v2_python_sparse
mscreen/autodocktools_prepare_py3k/MolKit/pdb2pqr/src/aa.py
e-mayo/mscreen
train
10
1634ee8be39bbf84c34233d1e6b636da18dfca76
[ "self.path = root_dir\nself.feelMap = {'neg': 0, 'pos': 1}\nself.files = []\nself.doConvert = False\nmypath = os.path.join(self.path, 'input')\nif not os.path.exists(mypath) or not os.path.isdir(mypath):\n print('please check the root_dir!')\n raise ValueError\nfor root, _, filename in os.walk(mypath):\n f...
<|body_start_0|> self.path = root_dir self.feelMap = {'neg': 0, 'pos': 1} self.files = [] self.doConvert = False mypath = os.path.join(self.path, 'input') if not os.path.exists(mypath) or not os.path.isdir(mypath): print('please check the root_dir!') ...
preprocess MovieReview dataset
MovieReview
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieReview: """preprocess MovieReview dataset""" def __init__(self, root_dir, maxlen, split): """input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the wor...
stack_v2_sparse_classes_10k_train_008543
7,969
permissive
[ { "docstring": "input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the worker size: the worker num", "name": "__init__", "signature": "def __init__(self, root_dir, maxlen, spli...
5
stack_v2_sparse_classes_30k_train_002396
Implement the Python class `MovieReview` described below. Class description: preprocess MovieReview dataset Method signatures and docstrings: - def __init__(self, root_dir, maxlen, split): input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of tra...
Implement the Python class `MovieReview` described below. Class description: preprocess MovieReview dataset Method signatures and docstrings: - def __init__(self, root_dir, maxlen, split): input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of tra...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class MovieReview: """preprocess MovieReview dataset""" def __init__(self, root_dir, maxlen, split): """input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the wor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovieReview: """preprocess MovieReview dataset""" def __init__(self, root_dir, maxlen, split): """input: root_dir: the root directory path of the MR dataset maxlen: set the max length of the sentence split: set the ratio of training set to testing set rank: the logic order of the worker size: the...
the_stack_v2_python_sparse
research/nlp/textcnn/infer/sdk/predata.py
mindspore-ai/models
train
301
35e3dc56730612e0299c97f3686bb8e0ba37a776
[ "super().__init__(name=name)\nself.pool = pool\nself._queue = message_queue\nself.daemon = True\nself.idle = True\nself.started = time.time()", "if self.pool.name:\n time_in_queue = time.time() - queueing_time\n THREADPOOL_QUEUEING_TIME.RecordEvent(time_in_queue, fields=[self.pool.name])\n start_time = t...
<|body_start_0|> super().__init__(name=name) self.pool = pool self._queue = message_queue self.daemon = True self.idle = True self.started = time.time() <|end_body_0|> <|body_start_1|> if self.pool.name: time_in_queue = time.time() - queueing_time ...
The workers used in the ThreadPool class.
_WorkerThread
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _WorkerThread: """The workers used in the ThreadPool class.""" def __init__(self, message_queue, pool, name): """Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the work...
stack_v2_sparse_classes_10k_train_008544
18,809
permissive
[ { "docstring": "Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the workers. When a new task arrives, the ThreadPool notifies the workers by putting a message into this queue that has the format (t...
4
stack_v2_sparse_classes_30k_train_004090
Implement the Python class `_WorkerThread` described below. Class description: The workers used in the ThreadPool class. Method signatures and docstrings: - def __init__(self, message_queue, pool, name): Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object ...
Implement the Python class `_WorkerThread` described below. Class description: The workers used in the ThreadPool class. Method signatures and docstrings: - def __init__(self, message_queue, pool, name): Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object ...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class _WorkerThread: """The workers used in the ThreadPool class.""" def __init__(self, message_queue, pool, name): """Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the work...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _WorkerThread: """The workers used in the ThreadPool class.""" def __init__(self, message_queue, pool, name): """Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the workers. When a n...
the_stack_v2_python_sparse
grr/server/grr_response_server/threadpool.py
google/grr
train
4,683
76f61f0da683de1207955d6952826a9c99489868
[ "if not gas:\n return False\nif not cost:\n return True\nn = gas.__len__()\nstart = 0\ncur = 0\niter = 0\nwhile True:\n cur += gas[iter] - cost[iter]\n iter += 1\n if cur < 0:\n if iter <= start:\n start += 1\n else:\n start = iter\n cur = 0\n else:\n ...
<|body_start_0|> if not gas: return False if not cost: return True n = gas.__len__() start = 0 cur = 0 iter = 0 while True: cur += gas[iter] - cost[iter] iter += 1 if cur < 0: if iter <= s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_10k_train_008545
1,721
no_license
[ { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit1", "signature": "def canCo...
2
stack_v2_sparse_classes_30k_train_002174
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" if not gas: return False if not cost: return True n = gas.__len__() start = 0 cur = 0 iter = 0 while True: ...
the_stack_v2_python_sparse
4/134-Gas_Station.py
ChangXiaodong/Leetcode-solutions
train
4
8fe0b9f808eded3e83bdfd6d9e87e8e89fcdec9b
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_dict = talon.make_transcript_dict(cursor)\nconn.close()\nedges = (1, 2, 3)\ngene_ID, transcripts = talon.search_for_transcript_suffix(edges, transcript_dict)\nassert gene_ID == None", "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = talon.make_transcript_dict(cursor) conn.close() edges = (1, 2, 3) gene_ID, transcripts = talon.search_for_transcript_suffix(edges, transcript_dict) assert gene_ID == None <|end_b...
TestSearchForSuffix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSearchForSuffix: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one suffix match for the trans...
stack_v2_sparse_classes_10k_train_008546
2,506
permissive
[ { "docstring": "Example where the toy transcript database contains no matches for the edge set.", "name": "test_find_no_match", "signature": "def test_find_no_match(self)" }, { "docstring": "Example where the toy transcript database contains exactly one suffix match for the transcript.", "na...
4
stack_v2_sparse_classes_30k_train_002078
Implement the Python class `TestSearchForSuffix` described below. Class description: Implement the TestSearchForSuffix class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example where the...
Implement the Python class `TestSearchForSuffix` described below. Class description: Implement the TestSearchForSuffix class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example where the...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestSearchForSuffix: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one suffix match for the trans...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSearchForSuffix: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = talon.make_transcript_dict(cursor) conn.close() edges = ...
the_stack_v2_python_sparse
archived/qtests/test_search_for_suffix.py
kopardev/TALON
train
0
c9fe72e7ad5f51722deccaa06d2e4a3e7e3a0c16
[ "self.commit_id = commit_id\nself.repository = repository\nself.generated_by = generated_by\nself.project_id = project_id", "metadata_properties_request = dict()\nif self.commit_id:\n metadata_properties_request['CommitId'] = self.commit_id\nif self.repository:\n metadata_properties_request['Repository'] = ...
<|body_start_0|> self.commit_id = commit_id self.repository = repository self.generated_by = generated_by self.project_id = project_id <|end_body_0|> <|body_start_1|> metadata_properties_request = dict() if self.commit_id: metadata_properties_request['CommitI...
Accepts metadata properties parameters for conversion to request dict.
MetadataProperties
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetadataProperties: """Accepts metadata properties parameters for conversion to request dict.""" def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=None, generated_by: Optional[Union[str, PipelineVariable]]=None, proj...
stack_v2_sparse_classes_10k_train_008547
2,293
permissive
[ { "docstring": "Initialize a ``MetadataProperties`` instance and turn parameters into dict. # TODO: flesh out docstrings Args: commit_id (str or PipelineVariable): repository (str or PipelineVariable): generated_by (str or PipelineVariable): project_id (str or PipelineVariable):", "name": "__init__", "s...
2
null
Implement the Python class `MetadataProperties` described below. Class description: Accepts metadata properties parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=N...
Implement the Python class `MetadataProperties` described below. Class description: Accepts metadata properties parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=N...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class MetadataProperties: """Accepts metadata properties parameters for conversion to request dict.""" def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=None, generated_by: Optional[Union[str, PipelineVariable]]=None, proj...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MetadataProperties: """Accepts metadata properties parameters for conversion to request dict.""" def __init__(self, commit_id: Optional[Union[str, PipelineVariable]]=None, repository: Optional[Union[str, PipelineVariable]]=None, generated_by: Optional[Union[str, PipelineVariable]]=None, project_id: Optio...
the_stack_v2_python_sparse
src/sagemaker/metadata_properties.py
aws/sagemaker-python-sdk
train
2,050
68b7e1d666c8e12f2128e3e382243f1bafa60ee0
[ "super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length)\nself.displacements = dat.getDisplacements(frame, frame + dt, *self.particles, jump=jump)\nself.vmin, self.vmax = amplogwidth(self.displacements)\ntry:\n self.vmin = np...
<|body_start_0|> super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length) self.displacements = dat.getDisplacements(frame, frame + dt, *self.particles, jump=jump) self.vmin, self.vmax = amplogwidth(self.displa...
Plotting class specific to 'displacement' mode.
Displacement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Displacement: """Plotting class specific to 'displacement' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, dt=1, jump=1, label=False, **kwargs): """I...
stack_v2_sparse_classes_10k_train_008548
24,676
permissive
[ { "docstring": "Initialises and plots figure. Parameters ---------- dat : active_work.read.Dat Data object. frame : int Frame to render. box_size : float Length of the square box to render. centre : 2-uple like Centre of the box to render. arrow_width : float Width of the arrows. arrow_head_width : float Width ...
2
stack_v2_sparse_classes_30k_train_000971
Implement the Python class `Displacement` described below. Class description: Plotting class specific to 'displacement' mode. Method signatures and docstrings: - def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_co...
Implement the Python class `Displacement` described below. Class description: Plotting class specific to 'displacement' mode. Method signatures and docstrings: - def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_co...
99107a0d4935296b673f67469c1e2bd258954b9b
<|skeleton|> class Displacement: """Plotting class specific to 'displacement' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, dt=1, jump=1, label=False, **kwargs): """I...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Displacement: """Plotting class specific to 'displacement' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, dt=1, jump=1, label=False, **kwargs): """Initialises an...
the_stack_v2_python_sparse
frame.py
yketa/active_work
train
1
24de685695a38fe580ff96bbc2b7326f3a706915
[ "self.cloud_vtk_points = vtk.vtkPoints()\nself.cloud_vtk_polydata = vtk.vtkPolyData()\nself.cloud_octree = vtk.vtkOctreePointLocator()\nself.cloud_color = vtk.vtkUnsignedCharArray()\nself.cloud_actor = vtk.vtkActor()\nself.v_filter = vtk.vtkVertexGlyphFilter()\nself.mapper = vtk.vtkPolyDataMapper()", "self.np_clo...
<|body_start_0|> self.cloud_vtk_points = vtk.vtkPoints() self.cloud_vtk_polydata = vtk.vtkPolyData() self.cloud_octree = vtk.vtkOctreePointLocator() self.cloud_color = vtk.vtkUnsignedCharArray() self.cloud_actor = vtk.vtkActor() self.v_filter = vtk.vtkVertexGlyphFilter() ...
Cloud
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cloud: def __init__(self): """初始化变量""" <|body_0|> def initialize_car(self, path): """载入点云数据""" <|body_1|> def build_car(self): """汽车点云染色""" <|body_2|> def color_points(self, cloud_clipped_points): """对被切割点染色""" <|body...
stack_v2_sparse_classes_10k_train_008549
4,869
no_license
[ { "docstring": "初始化变量", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "载入点云数据", "name": "initialize_car", "signature": "def initialize_car(self, path)" }, { "docstring": "汽车点云染色", "name": "build_car", "signature": "def build_car(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_006743
Implement the Python class `Cloud` described below. Class description: Implement the Cloud class. Method signatures and docstrings: - def __init__(self): 初始化变量 - def initialize_car(self, path): 载入点云数据 - def build_car(self): 汽车点云染色 - def color_points(self, cloud_clipped_points): 对被切割点染色
Implement the Python class `Cloud` described below. Class description: Implement the Cloud class. Method signatures and docstrings: - def __init__(self): 初始化变量 - def initialize_car(self, path): 载入点云数据 - def build_car(self): 汽车点云染色 - def color_points(self, cloud_clipped_points): 对被切割点染色 <|skeleton|> class Cloud: ...
2f18e869bcc2dfb118da69f02a5e231ff2602a68
<|skeleton|> class Cloud: def __init__(self): """初始化变量""" <|body_0|> def initialize_car(self, path): """载入点云数据""" <|body_1|> def build_car(self): """汽车点云染色""" <|body_2|> def color_points(self, cloud_clipped_points): """对被切割点染色""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cloud: def __init__(self): """初始化变量""" self.cloud_vtk_points = vtk.vtkPoints() self.cloud_vtk_polydata = vtk.vtkPolyData() self.cloud_octree = vtk.vtkOctreePointLocator() self.cloud_color = vtk.vtkUnsignedCharArray() self.cloud_actor = vtk.vtkActor() sel...
the_stack_v2_python_sparse
wind_planes.py
baobaotang0/new_outline
train
0
8920ecfd443ead81f77ca84c73a87e410a21e397
[ "if isinstance(values, dict):\n self.validate_acl_data(values)\n email_names = self.parse_sync_service_acl(values)\n from ggrc.utils import user_generator as ug\n existing_people = {p.email: p for p in ug.load_people_with_emails(email_names)}\n absent_emails = set(email_names) - set(existing_people)\...
<|body_start_0|> if isinstance(values, dict): self.validate_acl_data(values) email_names = self.parse_sync_service_acl(values) from ggrc.utils import user_generator as ug existing_people = {p.email: p for p in ug.load_people_with_emails(email_names)} a...
Overrided Roleable mixin for Synchronizable models. It replace access_control_list setter to allow set ACL data in sync service format.
RoleableSynchronizable
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleableSynchronizable: """Overrided Roleable mixin for Synchronizable models. It replace access_control_list setter to allow set ACL data in sync service format.""" def access_control_list(self, values): """Setter function for access control list. Args: values: List of access contro...
stack_v2_sparse_classes_10k_train_008550
5,365
permissive
[ { "docstring": "Setter function for access control list. Args: values: List of access control roles or dicts containing json representation of custom attribute values.", "name": "access_control_list", "signature": "def access_control_list(self, values)" }, { "docstring": "Check if received data ...
4
stack_v2_sparse_classes_30k_train_002221
Implement the Python class `RoleableSynchronizable` described below. Class description: Overrided Roleable mixin for Synchronizable models. It replace access_control_list setter to allow set ACL data in sync service format. Method signatures and docstrings: - def access_control_list(self, values): Setter function for...
Implement the Python class `RoleableSynchronizable` described below. Class description: Overrided Roleable mixin for Synchronizable models. It replace access_control_list setter to allow set ACL data in sync service format. Method signatures and docstrings: - def access_control_list(self, values): Setter function for...
f99bfdaa11ad30643d7bc9af67bd84436d298cfa
<|skeleton|> class RoleableSynchronizable: """Overrided Roleable mixin for Synchronizable models. It replace access_control_list setter to allow set ACL data in sync service format.""" def access_control_list(self, values): """Setter function for access control list. Args: values: List of access contro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoleableSynchronizable: """Overrided Roleable mixin for Synchronizable models. It replace access_control_list setter to allow set ACL data in sync service format.""" def access_control_list(self, values): """Setter function for access control list. Args: values: List of access control roles or di...
the_stack_v2_python_sparse
src/ggrc/models/mixins/synchronizable.py
pavelglebov/ggrc-core
train
1
55bf3be67c5506a52b3163c99ad63b48446e3898
[ "reg = Registration.objects.filter(trips_year=self.trips_year, user=request.user).first()\nif reg:\n return HttpResponseRedirect(reverse('incoming:edit_registration'))\nreturn super().dispatch(request, *args, **kwargs)", "self.object = form.save(self.request.user)\nself.object.match()\nreturn HttpResponseRedir...
<|body_start_0|> reg = Registration.objects.filter(trips_year=self.trips_year, user=request.user).first() if reg: return HttpResponseRedirect(reverse('incoming:edit_registration')) return super().dispatch(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> self.object ...
Register for trips Redirect to the edit view if this incoming student has already registered.
Register
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Register: """Register for trips Redirect to the edit view if this incoming student has already registered.""" def dispatch(self, request, *args, **kwargs): """Redirect to edit existing application This is redundantly decorated with login_required to prevent user from being anonymous....
stack_v2_sparse_classes_10k_train_008551
17,349
no_license
[ { "docstring": "Redirect to edit existing application This is redundantly decorated with login_required to prevent user from being anonymous. Otherwise this gets called first in the MRO order *then* passed to the LoginRequiredMixin, which doesn't work.", "name": "dispatch", "signature": "def dispatch(se...
2
stack_v2_sparse_classes_30k_train_001560
Implement the Python class `Register` described below. Class description: Register for trips Redirect to the edit view if this incoming student has already registered. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Redirect to edit existing application This is redundantly decorated ...
Implement the Python class `Register` described below. Class description: Register for trips Redirect to the edit view if this incoming student has already registered. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Redirect to edit existing application This is redundantly decorated ...
59c1ffc0bff1adb4f86f1dcfaa66d8970ff55b72
<|skeleton|> class Register: """Register for trips Redirect to the edit view if this incoming student has already registered.""" def dispatch(self, request, *args, **kwargs): """Redirect to edit existing application This is redundantly decorated with login_required to prevent user from being anonymous....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Register: """Register for trips Redirect to the edit view if this incoming student has already registered.""" def dispatch(self, request, *args, **kwargs): """Redirect to edit existing application This is redundantly decorated with login_required to prevent user from being anonymous. Otherwise th...
the_stack_v2_python_sparse
fyt/incoming/views.py
rlmv/doc-trips
train
10
0eadfbfa1e83c474a949ac72b99f3851e324c0f4
[ "queue = self.messages.Queue(name=queue_ref.RelativeName(), retryConfig=retry_config, rateLimits=rate_limits, appEngineRoutingOverride=app_engine_routing_override, stackdriverLoggingConfig=stackdriver_logging_config)\nrequest = self.messages.CloudtasksProjectsLocationsQueuesCreateRequest(parent=parent_ref.RelativeN...
<|body_start_0|> queue = self.messages.Queue(name=queue_ref.RelativeName(), retryConfig=retry_config, rateLimits=rate_limits, appEngineRoutingOverride=app_engine_routing_override, stackdriverLoggingConfig=stackdriver_logging_config) request = self.messages.CloudtasksProjectsLocationsQueuesCreateRequest(...
Client for queues service in the Cloud Tasks API.
Queues
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Queues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None, stackdriver_logging_config=None): """Prepares and sends a Create request for creating a queue.""" <|b...
stack_v2_sparse_classes_10k_train_008552
19,528
permissive
[ { "docstring": "Prepares and sends a Create request for creating a queue.", "name": "Create", "signature": "def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None, stackdriver_logging_config=None)" }, { "docstring": "Prepares and sends a Pat...
2
null
Implement the Python class `Queues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None, stackdriver_logging_config=None): Prepares and se...
Implement the Python class `Queues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None, stackdriver_logging_config=None): Prepares and se...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Queues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None, stackdriver_logging_config=None): """Prepares and sends a Create request for creating a queue.""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Queues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_routing_override=None, stackdriver_logging_config=None): """Prepares and sends a Create request for creating a queue.""" queue = self.mes...
the_stack_v2_python_sparse
lib/googlecloudsdk/api_lib/tasks/queues.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
623e35e500898ec242295e4d2a2fe0d99d29a2d6
[ "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...
Proto file describing the Ad Group Label service. Service to manage labels on ad groups.
AdGroupLabelServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdGroupLabelServiceServicer: """Proto file describing the Ad Group Label service. Service to manage labels on ad groups.""" def GetAdGroupLabel(self, request, context): """Returns the requested ad group label in full detail.""" <|body_0|> def MutateAdGroupLabels(self, re...
stack_v2_sparse_classes_10k_train_008553
3,439
permissive
[ { "docstring": "Returns the requested ad group label in full detail.", "name": "GetAdGroupLabel", "signature": "def GetAdGroupLabel(self, request, context)" }, { "docstring": "Creates and removes ad group labels. Operation statuses are returned.", "name": "MutateAdGroupLabels", "signatur...
2
stack_v2_sparse_classes_30k_train_004380
Implement the Python class `AdGroupLabelServiceServicer` described below. Class description: Proto file describing the Ad Group Label service. Service to manage labels on ad groups. Method signatures and docstrings: - def GetAdGroupLabel(self, request, context): Returns the requested ad group label in full detail. - ...
Implement the Python class `AdGroupLabelServiceServicer` described below. Class description: Proto file describing the Ad Group Label service. Service to manage labels on ad groups. Method signatures and docstrings: - def GetAdGroupLabel(self, request, context): Returns the requested ad group label in full detail. - ...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class AdGroupLabelServiceServicer: """Proto file describing the Ad Group Label service. Service to manage labels on ad groups.""" def GetAdGroupLabel(self, request, context): """Returns the requested ad group label in full detail.""" <|body_0|> def MutateAdGroupLabels(self, re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdGroupLabelServiceServicer: """Proto file describing the Ad Group Label service. Service to manage labels on ad groups.""" def GetAdGroupLabel(self, request, context): """Returns the requested ad group label in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) conte...
the_stack_v2_python_sparse
google/ads/google_ads/v2/proto/services/ad_group_label_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
88abadaa99576e4fab999f949233a0d725b85dcf
[ "try:\n desc = '{:.1f} %'.format(self.ct_success / self.count * 100)\nexcept ZeroDivisionError:\n desc = '-'\nreturn desc", "if self.ct_success == 0:\n return 0\nreturn round(self.ms_success / self.ct_success)" ]
<|body_start_0|> try: desc = '{:.1f} %'.format(self.ct_success / self.count * 100) except ZeroDivisionError: desc = '-' return desc <|end_body_0|> <|body_start_1|> if self.ct_success == 0: return 0 return round(self.ms_success / self.ct_succes...
第三方请求统计
CountThirdApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CountThirdApi: """第三方请求统计""" def rate(self): """成功比例""" <|body_0|> def ms_avg(self): """成功平均响应时间(ms)""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: desc = '{:.1f} %'.format(self.ct_success / self.count * 100) except Zer...
stack_v2_sparse_classes_10k_train_008554
2,642
no_license
[ { "docstring": "成功比例", "name": "rate", "signature": "def rate(self)" }, { "docstring": "成功平均响应时间(ms)", "name": "ms_avg", "signature": "def ms_avg(self)" } ]
2
stack_v2_sparse_classes_30k_train_004740
Implement the Python class `CountThirdApi` described below. Class description: 第三方请求统计 Method signatures and docstrings: - def rate(self): 成功比例 - def ms_avg(self): 成功平均响应时间(ms)
Implement the Python class `CountThirdApi` described below. Class description: 第三方请求统计 Method signatures and docstrings: - def rate(self): 成功比例 - def ms_avg(self): 成功平均响应时间(ms) <|skeleton|> class CountThirdApi: """第三方请求统计""" def rate(self): """成功比例""" <|body_0|> def ms_avg(self): ...
b7ed6588e13d2916a4162d56509d2794742a1eb1
<|skeleton|> class CountThirdApi: """第三方请求统计""" def rate(self): """成功比例""" <|body_0|> def ms_avg(self): """成功平均响应时间(ms)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CountThirdApi: """第三方请求统计""" def rate(self): """成功比例""" try: desc = '{:.1f} %'.format(self.ct_success / self.count * 100) except ZeroDivisionError: desc = '-' return desc def ms_avg(self): """成功平均响应时间(ms)""" if self.ct_success =...
the_stack_v2_python_sparse
server/applibs/monitor/models/count_third.py
fanshuai/kubrick
train
0
116efe256c023310045547517a119a5d8f702552
[ "self.name = name\nself.hparams = hparams\nself.verbose = getattr(self.hparams, 'verbose', True)\nself.noise_std = getattr(self.hparams, 'noise_std', 0.005)\nself.eps = getattr(self.hparams, 'eps', 0.05)\nself.d_samples = getattr(self.hparams, 'd_samples', 300)\nself.optimizer = getattr(self.hparams, 'optimizer', '...
<|body_start_0|> self.name = name self.hparams = hparams self.verbose = getattr(self.hparams, 'verbose', True) self.noise_std = getattr(self.hparams, 'noise_std', 0.005) self.eps = getattr(self.hparams, 'eps', 0.05) self.d_samples = getattr(self.hparams, 'd_samples', 300)...
Parameter Noise Sampling algorithm based on adding noise to net params. Described in https://arxiv.org/abs/1706.01905
ParameterNoiseSampling
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterNoiseSampling: """Parameter Noise Sampling algorithm based on adding noise to net params. Described in https://arxiv.org/abs/1706.01905""" def __init__(self, name, hparams): """Creates the algorithm, and sets up the adaptive Gaussian noise.""" <|body_0|> def act...
stack_v2_sparse_classes_10k_train_008555
6,687
permissive
[ { "docstring": "Creates the algorithm, and sets up the adaptive Gaussian noise.", "name": "__init__", "signature": "def __init__(self, name, hparams)" }, { "docstring": "Selects action based on Thompson Sampling *after* adding noise.", "name": "action", "signature": "def action(self, con...
6
stack_v2_sparse_classes_30k_train_004794
Implement the Python class `ParameterNoiseSampling` described below. Class description: Parameter Noise Sampling algorithm based on adding noise to net params. Described in https://arxiv.org/abs/1706.01905 Method signatures and docstrings: - def __init__(self, name, hparams): Creates the algorithm, and sets up the ad...
Implement the Python class `ParameterNoiseSampling` described below. Class description: Parameter Noise Sampling algorithm based on adding noise to net params. Described in https://arxiv.org/abs/1706.01905 Method signatures and docstrings: - def __init__(self, name, hparams): Creates the algorithm, and sets up the ad...
a115d918f6894a69586174653172be0b5d1de952
<|skeleton|> class ParameterNoiseSampling: """Parameter Noise Sampling algorithm based on adding noise to net params. Described in https://arxiv.org/abs/1706.01905""" def __init__(self, name, hparams): """Creates the algorithm, and sets up the adaptive Gaussian noise.""" <|body_0|> def act...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParameterNoiseSampling: """Parameter Noise Sampling algorithm based on adding noise to net params. Described in https://arxiv.org/abs/1706.01905""" def __init__(self, name, hparams): """Creates the algorithm, and sets up the adaptive Gaussian noise.""" self.name = name self.hparam...
the_stack_v2_python_sparse
models/research/deep_contextual_bandits/bandits/algorithms/parameter_noise_sampling.py
finnickniu/tensorflow_object_detection_tflite
train
60
fcf033ec2657dcd111d12ade654fc39b0b58c3c4
[ "self.ai_settings = ai_settings\nself.reset_stats()\nself.game_active = False\nself.read_high_score()", "self.ships_left = self.ai_settings.ship_limit\nself.score = 0\nself.level = 1", "self.high_score = 0\nfilename = 'D:\\\\learnCode\\\\pythonBook\\\\project1_alien_invasion\\\\high_score.txt'\ntry:\n with o...
<|body_start_0|> self.ai_settings = ai_settings self.reset_stats() self.game_active = False self.read_high_score() <|end_body_0|> <|body_start_1|> self.ships_left = self.ai_settings.ship_limit self.score = 0 self.level = 1 <|end_body_1|> <|body_start_2|> ...
跟踪游戏的统计信息
GameStats
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能变化的统计信息""" <|body_1|> def read_high_score(self): """读取最高分""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_008556
992
no_license
[ { "docstring": "初始化统计信息", "name": "__init__", "signature": "def __init__(self, ai_settings)" }, { "docstring": "初始化在游戏运行期间可能变化的统计信息", "name": "reset_stats", "signature": "def reset_stats(self)" }, { "docstring": "读取最高分", "name": "read_high_score", "signature": "def read_h...
3
stack_v2_sparse_classes_30k_train_005302
Implement the Python class `GameStats` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, ai_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息 - def read_high_score(self): 读取最高分
Implement the Python class `GameStats` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, ai_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息 - def read_high_score(self): 读取最高分 <|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, a...
5c0b0577eb5dca48fa6c4cbce159302d43be0116
<|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能变化的统计信息""" <|body_1|> def read_high_score(self): """读取最高分""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GameStats: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" self.ai_settings = ai_settings self.reset_stats() self.game_active = False self.read_high_score() def reset_stats(self): """初始化在游戏运行期间可能变化的统计信息""" self.ships_left = self....
the_stack_v2_python_sparse
project1_alien_invasion/game_stats.py
JackKoLing/python_study_notes
train
0
bd723686feb9e1dbfee3b2dc61244ec117c43a2c
[ "PROVIDER_ID = kwargs.get('id')\nCONTRACT_ADDRESS = 'address'\nprovider = providerModel.ProviderModel.get_by_id(self.db.session, PROVIDER_ID)\nif not provider:\n raise HTTPNotFound(description='Entry not found', code=5)\npricingContract_list = pricingContractModel.PricingContractModel.get_generic(self.db.session...
<|body_start_0|> PROVIDER_ID = kwargs.get('id') CONTRACT_ADDRESS = 'address' provider = providerModel.ProviderModel.get_by_id(self.db.session, PROVIDER_ID) if not provider: raise HTTPNotFound(description='Entry not found', code=5) pricingContract_list = pricingContrac...
API Resource to set and get prices for each provider. This resource exposes an Option, GET, PATCH methods. This converts contracts data into/from DB models. All methods translate keystone URI to internal URI.
PriceRateResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PriceRateResource: """API Resource to set and get prices for each provider. This resource exposes an Option, GET, PATCH methods. This converts contracts data into/from DB models. All methods translate keystone URI to internal URI.""" def on_get(self, req, resp, **kwargs): """Get rate...
stack_v2_sparse_classes_10k_train_008557
6,049
permissive
[ { "docstring": "Get rate of provider's id --- summary: Fetches a rate practiced by provider's ID description: Endpoint that retrieves rate parameters: - in: path name: id description: id of provider schema: type: integer tags: - price_rate responses: 200: description: OK 404: description: Not found", "name"...
2
stack_v2_sparse_classes_30k_train_002758
Implement the Python class `PriceRateResource` described below. Class description: API Resource to set and get prices for each provider. This resource exposes an Option, GET, PATCH methods. This converts contracts data into/from DB models. All methods translate keystone URI to internal URI. Method signatures and docs...
Implement the Python class `PriceRateResource` described below. Class description: API Resource to set and get prices for each provider. This resource exposes an Option, GET, PATCH methods. This converts contracts data into/from DB models. All methods translate keystone URI to internal URI. Method signatures and docs...
e2c74c36d5eb8492764205fe99558b0818473cb7
<|skeleton|> class PriceRateResource: """API Resource to set and get prices for each provider. This resource exposes an Option, GET, PATCH methods. This converts contracts data into/from DB models. All methods translate keystone URI to internal URI.""" def on_get(self, req, resp, **kwargs): """Get rate...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PriceRateResource: """API Resource to set and get prices for each provider. This resource exposes an Option, GET, PATCH methods. This converts contracts data into/from DB models. All methods translate keystone URI to internal URI.""" def on_get(self, req, resp, **kwargs): """Get rate of provider'...
the_stack_v2_python_sparse
mobility-service-provider---service/msp/resources/pricerate.py
vicinityh2020/vicinity-vas-dreven
train
0
75881f6389deacd3568bc63be989856665e42b3e
[ "super().__init__()\nself._num_observations_per_parameter = 4\nself._posterior_samples = None", "if isinstance(parameters, torch.Tensor):\n parameters = utils.tensor2numpy(parameters)\nif parameters.ndim == 1:\n return self.simulate(parameters[np.newaxis, :])[0]\nnum_simulations = parameters.shape[0]\nself....
<|body_start_0|> super().__init__() self._num_observations_per_parameter = 4 self._posterior_samples = None <|end_body_0|> <|body_start_1|> if isinstance(parameters, torch.Tensor): parameters = utils.tensor2numpy(parameters) if parameters.ndim == 1: retur...
Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al.
NonlinearGaussianSimulator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NonlinearGaussianSimulator: """Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al.""" def __init__(self): """Set up simulator.""" <|body_0|> def __call__(self, parameters): ...
stack_v2_sparse_classes_10k_train_008558
7,303
no_license
[ { "docstring": "Set up simulator.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Generate observations from non-linear Gaussian model for the given batch of parameters. Arguments: parameters {torch.Tensor} -- Batch of parameters. Returns: torch.Tensor [batch size, 2 *...
3
stack_v2_sparse_classes_30k_train_004605
Implement the Python class `NonlinearGaussianSimulator` described below. Class description: Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al. Method signatures and docstrings: - def __init__(self): Set up simulator. - def ...
Implement the Python class `NonlinearGaussianSimulator` described below. Class description: Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al. Method signatures and docstrings: - def __init__(self): Set up simulator. - def ...
1bc2952f352a4b68d148b1a8d193c480b582b152
<|skeleton|> class NonlinearGaussianSimulator: """Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al.""" def __init__(self): """Set up simulator.""" <|body_0|> def __call__(self, parameters): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NonlinearGaussianSimulator: """Implemenation of nonlinear Gaussian simulator as described in section 5.2 and appendix A.1 of 'Sequential Neural Likelihood', Papamakarios et al.""" def __init__(self): """Set up simulator.""" super().__init__() self._num_observations_per_parameter =...
the_stack_v2_python_sparse
sbi/simulators/nonlinear_gaussian.py
boyali/sbi
train
0
3c087209d3808e433195f59f70d42a5253f8552a
[ "f = f'{self.site_id}:{self.staff_id}:'\nf += f'{quote(self.organ)}:{self.group_number}:{self.sort_order}:'\nf += f'{quote(self.member_types)}:{quote(self.role)}'\nreturn URIRef(_site_group_prefix + f)", "subject = self.uriref()\ngraph.add((subject, rdflib.RDF.type, _site_type_uri))\ngraph.add((subject, _site_ref...
<|body_start_0|> f = f'{self.site_id}:{self.staff_id}:' f += f'{quote(self.organ)}:{self.group_number}:{self.sort_order}:' f += f'{quote(self.member_types)}:{quote(self.role)}' return URIRef(_site_group_prefix + f) <|end_body_0|> <|body_start_1|> subject = self.uriref() ...
Attributes of a site that's a member of organizational group.
_Site
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Site: """Attributes of a site that's a member of organizational group.""" def uriref(self): """Return this site's subject URI.""" <|body_0|> def add_to_graph(self, graph): """Describe this site in the given ``graph``.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_10k_train_008559
6,009
permissive
[ { "docstring": "Return this site's subject URI.", "name": "uriref", "signature": "def uriref(self)" }, { "docstring": "Describe this site in the given ``graph``.", "name": "add_to_graph", "signature": "def add_to_graph(self, graph)" } ]
2
stack_v2_sparse_classes_30k_train_005747
Implement the Python class `_Site` described below. Class description: Attributes of a site that's a member of organizational group. Method signatures and docstrings: - def uriref(self): Return this site's subject URI. - def add_to_graph(self, graph): Describe this site in the given ``graph``.
Implement the Python class `_Site` described below. Class description: Attributes of a site that's a member of organizational group. Method signatures and docstrings: - def uriref(self): Return this site's subject URI. - def add_to_graph(self, graph): Describe this site in the given ``graph``. <|skeleton|> class _Si...
377d12260ca611a8950edc1b7bfe0bdb3d53c021
<|skeleton|> class _Site: """Attributes of a site that's a member of organizational group.""" def uriref(self): """Return this site's subject URI.""" <|body_0|> def add_to_graph(self, graph): """Describe this site in the given ``graph``.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Site: """Attributes of a site that's a member of organizational group.""" def uriref(self): """Return this site's subject URI.""" f = f'{self.site_id}:{self.staff_id}:' f += f'{quote(self.organ)}:{self.group_number}:{self.sort_order}:' f += f'{quote(self.member_types)}:{q...
the_stack_v2_python_sparse
src/edrn.rdf/edrn/rdf/membergrouprdfgenerator.py
EDRN/CancerDataExpo
train
0
4eca387528e53aa20835173db4bbc588aa27c96d
[ "super().__init__()\nself.smooth = smooth\nself.criterion = nn.KLDivLoss(size_average=False)\nself.confidence = 1 - smooth\nself.size = size\nself.paddingidx = paddingidx", "N = x.size(0)\ntrue_dist = x.data.clone()\ntrue_dist.fill_(self.smooth / (self.size - 2))\ntrue_dist.scatter_(1, y.unsqueeze(1), self.confid...
<|body_start_0|> super().__init__() self.smooth = smooth self.criterion = nn.KLDivLoss(size_average=False) self.confidence = 1 - smooth self.size = size self.paddingidx = paddingidx <|end_body_0|> <|body_start_1|> N = x.size(0) true_dist = x.data.clone() ...
LabelSmoothingLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelSmoothingLoss: def __init__(self, size, paddingidx, smooth=0): """size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label""" <|body_0|> def forward(self, x, y, normalizer): """x:(N,size): y:(N,):sparse ...
stack_v2_sparse_classes_10k_train_008560
11,927
no_license
[ { "docstring": "size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label", "name": "__init__", "signature": "def __init__(self, size, paddingidx, smooth=0)" }, { "docstring": "x:(N,size): y:(N,):sparse encoding this network first create ...
2
stack_v2_sparse_classes_30k_train_000972
Implement the Python class `LabelSmoothingLoss` described below. Class description: Implement the LabelSmoothingLoss class. Method signatures and docstrings: - def __init__(self, size, paddingidx, smooth=0): size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the ...
Implement the Python class `LabelSmoothingLoss` described below. Class description: Implement the LabelSmoothingLoss class. Method signatures and docstrings: - def __init__(self, size, paddingidx, smooth=0): size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the ...
24e60f24b6e442db22507adddd6bf3e2c343c013
<|skeleton|> class LabelSmoothingLoss: def __init__(self, size, paddingidx, smooth=0): """size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label""" <|body_0|> def forward(self, x, y, normalizer): """x:(N,size): y:(N,):sparse ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LabelSmoothingLoss: def __init__(self, size, paddingidx, smooth=0): """size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label""" super().__init__() self.smooth = smooth self.criterion = nn.KLDivLoss(size_average=False...
the_stack_v2_python_sparse
daily/8/pytorch_tutoral/nmt/model.py
mckjzhangxk/deepAI
train
1
60d04075d4949389c17eef2588fc43b016cc6be9
[ "if isinstance(value, (str, type(None))):\n return value\nassert isinstance(value, bytes)\ntry:\n return str(value, 'utf8')\nexcept:\n return value.encode('utf8').decode('utf8')", "if self.table:\n return\nself.table = {}\nfp = open(os.path.join(os.path.dirname(__file__), 'Mandarin.dat'))\nlines = fp....
<|body_start_0|> if isinstance(value, (str, type(None))): return value assert isinstance(value, bytes) try: return str(value, 'utf8') except: return value.encode('utf8').decode('utf8') <|end_body_0|> <|body_start_1|> if self.table: ...
docstring for Pinyin
Pinyin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pinyin: """docstring for Pinyin""" def to_unicode(self, value): """Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.""" <|body_0|> def ...
stack_v2_sparse_classes_10k_train_008561
1,930
no_license
[ { "docstring": "Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.", "name": "to_unicode", "signature": "def to_unicode(self, value)" }, { "docstring": "docstrin...
4
stack_v2_sparse_classes_30k_train_003390
Implement the Python class `Pinyin` described below. Class description: docstring for Pinyin Method signatures and docstrings: - def to_unicode(self, value): Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte strin...
Implement the Python class `Pinyin` described below. Class description: docstring for Pinyin Method signatures and docstrings: - def to_unicode(self, value): Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte strin...
49c31d9cce6ca451ff069697913b33fe55028a46
<|skeleton|> class Pinyin: """docstring for Pinyin""" def to_unicode(self, value): """Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.""" <|body_0|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Pinyin: """docstring for Pinyin""" def to_unicode(self, value): """Converts a string argument to a unicode string. If the argument is already a unicode string or None, it is returned unchanged. Otherwise it must be a byte string and is decoded as utf8.""" if isinstance(value, (str, type(N...
the_stack_v2_python_sparse
PaiDuiGuanJia/yiyun/libs/pinyin.py
haoweiking/image_tesseract_private
train
0
14ffce6d2708c2d36983f614fab4cd3256ce597d
[ "self.universe = universe\nself.typetable = typetable\nself.handler_table = handler_table", "if type(value) in self.typetable:\n return self.typetable[type(value)]\nelif type(value) in self.handler_table:\n return self.handler_table[type(value)](self.universe, value)\nelse:\n for cls in self.handler_tabl...
<|body_start_0|> self.universe = universe self.typetable = typetable self.handler_table = handler_table <|end_body_0|> <|body_start_1|> if type(value) in self.typetable: return self.typetable[type(value)] elif type(value) in self.handler_table: return sel...
ConstantTyper
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConstantTyper: def __init__(self, universe, typetable, handler_table): """Initialize to the given type universe""" <|body_0|> def typeof(self, value): """Get a concrete type given a python value. Return None f this ConstantTyper cannot type the constant""" <|...
stack_v2_sparse_classes_10k_train_008562
10,580
permissive
[ { "docstring": "Initialize to the given type universe", "name": "__init__", "signature": "def __init__(self, universe, typetable, handler_table)" }, { "docstring": "Get a concrete type given a python value. Return None f this ConstantTyper cannot type the constant", "name": "typeof", "si...
2
stack_v2_sparse_classes_30k_train_003385
Implement the Python class `ConstantTyper` described below. Class description: Implement the ConstantTyper class. Method signatures and docstrings: - def __init__(self, universe, typetable, handler_table): Initialize to the given type universe - def typeof(self, value): Get a concrete type given a python value. Retur...
Implement the Python class `ConstantTyper` described below. Class description: Implement the ConstantTyper class. Method signatures and docstrings: - def __init__(self, universe, typetable, handler_table): Initialize to the given type universe - def typeof(self, value): Get a concrete type given a python value. Retur...
35546517b27764a9120f6dfcd82eba7f4dd858cb
<|skeleton|> class ConstantTyper: def __init__(self, universe, typetable, handler_table): """Initialize to the given type universe""" <|body_0|> def typeof(self, value): """Get a concrete type given a python value. Return None f this ConstantTyper cannot type the constant""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConstantTyper: def __init__(self, universe, typetable, handler_table): """Initialize to the given type universe""" self.universe = universe self.typetable = typetable self.handler_table = handler_table def typeof(self, value): """Get a concrete type given a python ...
the_stack_v2_python_sparse
oldnumba/typesystem/itypesystem.py
laserson/numba
train
1
29b65a1f0bee220dada6a4a0c65e8e565ae998a6
[ "assert len(self.rotated_data) == len(other.rotated_data)\ndata = [self_row + other_row for self_row, other_row in zip(self.rotated_data, other.rotated_data)]\nreturn AssembledImage(data)", "assert len(self.rotated_data[0]) == len(other.rotated_data[0])\ndata = self.rotated_data + other.rotated_data\nreturn Assem...
<|body_start_0|> assert len(self.rotated_data) == len(other.rotated_data) data = [self_row + other_row for self_row, other_row in zip(self.rotated_data, other.rotated_data)] return AssembledImage(data) <|end_body_0|> <|body_start_1|> assert len(self.rotated_data[0]) == len(other.rotated...
The assembled image Public Class Methods: from_image_piece: Create instance from an image piece
AssembledImage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssembledImage: """The assembled image Public Class Methods: from_image_piece: Create instance from an image piece""" def __add__(self, other: AssembledImage) -> AssembledImage: """Horizontal concatenation""" <|body_0|> def __mul__(self, other: AssembledImage) -> Assembl...
stack_v2_sparse_classes_10k_train_008563
6,417
no_license
[ { "docstring": "Horizontal concatenation", "name": "__add__", "signature": "def __add__(self, other: AssembledImage) -> AssembledImage" }, { "docstring": "Vertical concatenation", "name": "__mul__", "signature": "def __mul__(self, other: AssembledImage) -> AssembledImage" }, { "d...
3
stack_v2_sparse_classes_30k_train_002281
Implement the Python class `AssembledImage` described below. Class description: The assembled image Public Class Methods: from_image_piece: Create instance from an image piece Method signatures and docstrings: - def __add__(self, other: AssembledImage) -> AssembledImage: Horizontal concatenation - def __mul__(self, o...
Implement the Python class `AssembledImage` described below. Class description: The assembled image Public Class Methods: from_image_piece: Create instance from an image piece Method signatures and docstrings: - def __add__(self, other: AssembledImage) -> AssembledImage: Horizontal concatenation - def __mul__(self, o...
bcca26134e0764f965a8486e67f61894dde3ba35
<|skeleton|> class AssembledImage: """The assembled image Public Class Methods: from_image_piece: Create instance from an image piece""" def __add__(self, other: AssembledImage) -> AssembledImage: """Horizontal concatenation""" <|body_0|> def __mul__(self, other: AssembledImage) -> Assembl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AssembledImage: """The assembled image Public Class Methods: from_image_piece: Create instance from an image piece""" def __add__(self, other: AssembledImage) -> AssembledImage: """Horizontal concatenation""" assert len(self.rotated_data) == len(other.rotated_data) data = [self_ro...
the_stack_v2_python_sparse
Day_20/utils/image.py
Mushinako/Advent-of-Code-2020
train
0
6e25cfa0fe1ee0c922d76a1c21fcdd8c31d02371
[ "for key, value in self.replacements.items():\n string = string.replace(key, value)\nreturn string", "if conversions:\n self.replacements.update(conversions)\ntry:\n self.validate(arguments)\n return {self.convert(key): val for key, val in arguments.items()}\nexcept SchemaError as e:\n logger.warni...
<|body_start_0|> for key, value in self.replacements.items(): string = string.replace(key, value) return string <|end_body_0|> <|body_start_1|> if conversions: self.replacements.update(conversions) try: self.validate(arguments) return {sel...
Extends `Schema` adapting it to PA scripts validation strategies. Adds predefined schemata as class variables to be used in scripts' validation schemas as well as `validate_user_input` method which acts as `Schema.validate` but returns a dictionary with converted keys ready to be used as function keyword arguments, e.g...
ScriptSchema
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScriptSchema: """Extends `Schema` adapting it to PA scripts validation strategies. Adds predefined schemata as class variables to be used in scripts' validation schemas as well as `validate_user_input` method which acts as `Schema.validate` but returns a dictionary with converted keys ready to be...
stack_v2_sparse_classes_10k_train_008564
4,382
permissive
[ { "docstring": "Removes cli argument notation characters ('--', '<', '>' etc.). :param string: cli argument key to be converted to fit Python argument syntax.", "name": "convert", "signature": "def convert(self, string)" }, { "docstring": "Calls `Schema.validate` on provided `arguments`. Returns...
2
stack_v2_sparse_classes_30k_train_002719
Implement the Python class `ScriptSchema` described below. Class description: Extends `Schema` adapting it to PA scripts validation strategies. Adds predefined schemata as class variables to be used in scripts' validation schemas as well as `validate_user_input` method which acts as `Schema.validate` but returns a dic...
Implement the Python class `ScriptSchema` described below. Class description: Extends `Schema` adapting it to PA scripts validation strategies. Adds predefined schemata as class variables to be used in scripts' validation schemas as well as `validate_user_input` method which acts as `Schema.validate` but returns a dic...
dff92d1c5f18f338847b3c371c07a73dd2642957
<|skeleton|> class ScriptSchema: """Extends `Schema` adapting it to PA scripts validation strategies. Adds predefined schemata as class variables to be used in scripts' validation schemas as well as `validate_user_input` method which acts as `Schema.validate` but returns a dictionary with converted keys ready to be...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScriptSchema: """Extends `Schema` adapting it to PA scripts validation strategies. Adds predefined schemata as class variables to be used in scripts' validation schemas as well as `validate_user_input` method which acts as `Schema.validate` but returns a dictionary with converted keys ready to be used as func...
the_stack_v2_python_sparse
pythonanywhere/scripts_commons.py
pythonanywhere/helper_scripts
train
34
b85b2cef95f3f2ca5f41259d76d1d881e0b404bf
[ "if orders_since is None:\n orders_since = timezone.now() - dt.timedelta(days=30)\nreturn Order.objects.filter(dispatched_at__gte=orders_since)", "orders = self.get_recent_orders(orders_since).filter(linnworks_order__isnull=True)\nwait_time = 60\nfor i, order in enumerate(orders):\n try:\n guid = get...
<|body_start_0|> if orders_since is None: orders_since = timezone.now() - dt.timedelta(days=30) return Order.objects.filter(dispatched_at__gte=orders_since) <|end_body_0|> <|body_start_1|> orders = self.get_recent_orders(orders_since).filter(linnworks_order__isnull=True) wai...
Model manager for the LinnworksOrder model.
LinnworksOrderManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinnworksOrderManager: """Model manager for the LinnworksOrder model.""" def get_recent_orders(self, orders_since=None): """Return orders dispatched after a datetime.""" <|body_0|> def update_order_guids(self, orders_since=None): """Add Linnworks order GUIDs to r...
stack_v2_sparse_classes_10k_train_008565
12,307
no_license
[ { "docstring": "Return orders dispatched after a datetime.", "name": "get_recent_orders", "signature": "def get_recent_orders(self, orders_since=None)" }, { "docstring": "Add Linnworks order GUIDs to recent orders.", "name": "update_order_guids", "signature": "def update_order_guids(self...
3
stack_v2_sparse_classes_30k_train_007015
Implement the Python class `LinnworksOrderManager` described below. Class description: Model manager for the LinnworksOrder model. Method signatures and docstrings: - def get_recent_orders(self, orders_since=None): Return orders dispatched after a datetime. - def update_order_guids(self, orders_since=None): Add Linnw...
Implement the Python class `LinnworksOrderManager` described below. Class description: Model manager for the LinnworksOrder model. Method signatures and docstrings: - def get_recent_orders(self, orders_since=None): Return orders dispatched after a datetime. - def update_order_guids(self, orders_since=None): Add Linnw...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class LinnworksOrderManager: """Model manager for the LinnworksOrder model.""" def get_recent_orders(self, orders_since=None): """Return orders dispatched after a datetime.""" <|body_0|> def update_order_guids(self, orders_since=None): """Add Linnworks order GUIDs to r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinnworksOrderManager: """Model manager for the LinnworksOrder model.""" def get_recent_orders(self, orders_since=None): """Return orders dispatched after a datetime.""" if orders_since is None: orders_since = timezone.now() - dt.timedelta(days=30) return Order.objects...
the_stack_v2_python_sparse
linnworks/models/orders.py
stcstores/stcadmin
train
0
a221aa851847a5a5125f2542b6173ee31971a31c
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AttackSimulationRoot()", "from .entity import Entity\nfrom .simulation import Simulation\nfrom .simulation_automation import SimulationAutomation\nfrom .entity import Entity\nfrom .simulation import Simulation\nfrom .simulation_automat...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AttackSimulationRoot() <|end_body_0|> <|body_start_1|> from .entity import Entity from .simulation import Simulation from .simulation_automation import SimulationAutomation ...
AttackSimulationRoot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttackSimulationRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationRoot: """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 ...
stack_v2_sparse_classes_10k_train_008566
2,783
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: AttackSimulationRoot", "name": "create_from_discriminator_value", "signature": "def create_from_discriminato...
3
stack_v2_sparse_classes_30k_train_005744
Implement the Python class `AttackSimulationRoot` described below. Class description: Implement the AttackSimulationRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationRoot: Creates a new instance of the appropriate class based o...
Implement the Python class `AttackSimulationRoot` described below. Class description: Implement the AttackSimulationRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationRoot: Creates a new instance of the appropriate class based o...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AttackSimulationRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationRoot: """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 ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttackSimulationRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttackSimulationRoot: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
the_stack_v2_python_sparse
msgraph/generated/models/attack_simulation_root.py
microsoftgraph/msgraph-sdk-python
train
135
b139fca755fec6f99cec0814e5aeeb77d9430818
[ "ImageProcessor.__init__(self, **kwargs)\nself.sigma = sigma\nself.order = order\nself.mode = mode\nself.cval = cval\nself.truncate = truncate", "img = image.copy()\nif img.data is None:\n log.warning('No data found in image.')\n return image\nimg.data = gaussian_filter(img.data, self.sigma, order=self.orde...
<|body_start_0|> ImageProcessor.__init__(self, **kwargs) self.sigma = sigma self.order = order self.mode = mode self.cval = cval self.truncate = truncate <|end_body_0|> <|body_start_1|> img = image.copy() if img.data is None: log.warning('No d...
smooth an image.
Smooth
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Smooth: """smooth an image.""" def __init__(self, sigma: float, order: int=0, mode: str='reflect', cval: float=0.0, truncate: float=4.0, **kwargs: Any): """Init a new smoothing pipeline step. Args: binning: Binning to apply to image.""" <|body_0|> async def __call__(self...
stack_v2_sparse_classes_10k_train_008567
1,406
permissive
[ { "docstring": "Init a new smoothing pipeline step. Args: binning: Binning to apply to image.", "name": "__init__", "signature": "def __init__(self, sigma: float, order: int=0, mode: str='reflect', cval: float=0.0, truncate: float=4.0, **kwargs: Any)" }, { "docstring": "Bin an image. Args: image...
2
stack_v2_sparse_classes_30k_train_003438
Implement the Python class `Smooth` described below. Class description: smooth an image. Method signatures and docstrings: - def __init__(self, sigma: float, order: int=0, mode: str='reflect', cval: float=0.0, truncate: float=4.0, **kwargs: Any): Init a new smoothing pipeline step. Args: binning: Binning to apply to ...
Implement the Python class `Smooth` described below. Class description: smooth an image. Method signatures and docstrings: - def __init__(self, sigma: float, order: int=0, mode: str='reflect', cval: float=0.0, truncate: float=4.0, **kwargs: Any): Init a new smoothing pipeline step. Args: binning: Binning to apply to ...
2d7a06e5485b61b6ca7e51d99b08651ea6021086
<|skeleton|> class Smooth: """smooth an image.""" def __init__(self, sigma: float, order: int=0, mode: str='reflect', cval: float=0.0, truncate: float=4.0, **kwargs: Any): """Init a new smoothing pipeline step. Args: binning: Binning to apply to image.""" <|body_0|> async def __call__(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Smooth: """smooth an image.""" def __init__(self, sigma: float, order: int=0, mode: str='reflect', cval: float=0.0, truncate: float=4.0, **kwargs: Any): """Init a new smoothing pipeline step. Args: binning: Binning to apply to image.""" ImageProcessor.__init__(self, **kwargs) self...
the_stack_v2_python_sparse
pyobs/images/processors/misc/smooth.py
pyobs/pyobs-core
train
9
9985ad5a9da7f1ecff015b98289933f01f11d8e2
[ "self_keys = {'name': self.name}\nnatural_keys = super(CategoryLevel, self).natural_key(self_keys)\nreturn natural_keys", "next_name = 'L{n}'.format(n=int(self.name[1:]) + 1)\ntry:\n level = CategoryLevel.objects.get(name=next_name)\nexcept ObjectDoesNotExist as e:\n level = CategoryLevel.objects.create_lev...
<|body_start_0|> self_keys = {'name': self.name} natural_keys = super(CategoryLevel, self).natural_key(self_keys) return natural_keys <|end_body_0|> <|body_start_1|> next_name = 'L{n}'.format(n=int(self.name[1:]) + 1) try: level = CategoryLevel.objects.get(name=next_...
Provide Category level table
CategoryLevel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryLevel: """Provide Category level table""" def natural_key(self, *args, **kwargs): """Overrides base class method :param args: :param kwargs: :return:""" <|body_0|> def next_level(self): """Returns next level :return:""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_008568
981
no_license
[ { "docstring": "Overrides base class method :param args: :param kwargs: :return:", "name": "natural_key", "signature": "def natural_key(self, *args, **kwargs)" }, { "docstring": "Returns next level :return:", "name": "next_level", "signature": "def next_level(self)" } ]
2
stack_v2_sparse_classes_30k_train_003882
Implement the Python class `CategoryLevel` described below. Class description: Provide Category level table Method signatures and docstrings: - def natural_key(self, *args, **kwargs): Overrides base class method :param args: :param kwargs: :return: - def next_level(self): Returns next level :return:
Implement the Python class `CategoryLevel` described below. Class description: Provide Category level table Method signatures and docstrings: - def natural_key(self, *args, **kwargs): Overrides base class method :param args: :param kwargs: :return: - def next_level(self): Returns next level :return: <|skeleton|> cla...
a93e0eee39e1f45fa73de84514ca254e235a17bd
<|skeleton|> class CategoryLevel: """Provide Category level table""" def natural_key(self, *args, **kwargs): """Overrides base class method :param args: :param kwargs: :return:""" <|body_0|> def next_level(self): """Returns next level :return:""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CategoryLevel: """Provide Category level table""" def natural_key(self, *args, **kwargs): """Overrides base class method :param args: :param kwargs: :return:""" self_keys = {'name': self.name} natural_keys = super(CategoryLevel, self).natural_key(self_keys) return natural_...
the_stack_v2_python_sparse
cashapp_models/models/CategoryLevelModel.py
dmitryshepelev/cashapp
train
0
3cba2bf9ffce1867df66c8754f9632e64a29af04
[ "time_elements_structure = self._GetValueFromStructure(structure, 'date_time')\nhttp_request = self._GetValueFromStructure(structure, 'http_request')\nif http_request:\n http_request = ' '.join(http_request)\nremote_name = self._GetValueFromStructure(structure, 'remote_name')\nif remote_name == '-':\n remote_...
<|body_start_0|> time_elements_structure = self._GetValueFromStructure(structure, 'date_time') http_request = self._GetValueFromStructure(structure, 'http_request') if http_request: http_request = ' '.join(http_request) remote_name = self._GetValueFromStructure(structure, 're...
Text parser plugin for Apache access log (access.log) files.
ApacheAccessLogTextPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApacheAccessLogTextPlugin: """Text parser plugin for Apache access log (access.log) files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, ...
stack_v2_sparse_classes_10k_train_008569
10,452
permissive
[ { "docstring": "Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. key (str): name of the parsed structure. structure (pyparsing.ParseResults): tokens from a parsed log line. Raises: ParseError: if the stru...
3
null
Implement the Python class `ApacheAccessLogTextPlugin` described below. Class description: Text parser plugin for Apache access log (access.log) files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, key, structure): Parses a pyparsing structure. Args: parser_mediator (ParserMediator): med...
Implement the Python class `ApacheAccessLogTextPlugin` described below. Class description: Text parser plugin for Apache access log (access.log) files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, key, structure): Parses a pyparsing structure. Args: parser_mediator (ParserMediator): med...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class ApacheAccessLogTextPlugin: """Text parser plugin for Apache access log (access.log) files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ApacheAccessLogTextPlugin: """Text parser plugin for Apache access log (access.log) files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as stora...
the_stack_v2_python_sparse
plaso/parsers/text_plugins/apache_access.py
log2timeline/plaso
train
1,506
36ebfbd99598734f82e688a20403ec0c57c577b6
[ "self.generic_visit(node)\nif isinstance(node.ctx, ast.Load):\n args = [node.value, ast.Str(node.attr)]\n return to_call(to_name('getattr'), args)\nreturn node", "self.generic_visit(node)\ntarget = get_single_target(node)\nif isinstance(target, ast.Attribute):\n args = [target.value, ast.Str(target.attr)...
<|body_start_0|> self.generic_visit(node) if isinstance(node.ctx, ast.Load): args = [node.value, ast.Str(node.attr)] return to_call(to_name('getattr'), args) return node <|end_body_0|> <|body_start_1|> self.generic_visit(node) target = get_single_target(n...
Replace attribute getters/setters with function calls. Namely, the functions `getattr`, `setattr`, and `delattr`.
AttributesToFunctions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttributesToFunctions: """Replace attribute getters/setters with function calls. Namely, the functions `getattr`, `setattr`, and `delattr`.""" def visit_Attribute(self, node): """Convert attribute access to `getattr` call.""" <|body_0|> def visit_Assign(self, node): ...
stack_v2_sparse_classes_10k_train_008570
15,969
permissive
[ { "docstring": "Convert attribute access to `getattr` call.", "name": "visit_Attribute", "signature": "def visit_Attribute(self, node)" }, { "docstring": "Convert assignment to attributes to `setattr` call.", "name": "visit_Assign", "signature": "def visit_Assign(self, node)" }, { ...
3
stack_v2_sparse_classes_30k_train_007193
Implement the Python class `AttributesToFunctions` described below. Class description: Replace attribute getters/setters with function calls. Namely, the functions `getattr`, `setattr`, and `delattr`. Method signatures and docstrings: - def visit_Attribute(self, node): Convert attribute access to `getattr` call. - de...
Implement the Python class `AttributesToFunctions` described below. Class description: Replace attribute getters/setters with function calls. Namely, the functions `getattr`, `setattr`, and `delattr`. Method signatures and docstrings: - def visit_Attribute(self, node): Convert attribute access to `getattr` call. - de...
a6097d36c8863925c774f04155e2af6cc8cb3859
<|skeleton|> class AttributesToFunctions: """Replace attribute getters/setters with function calls. Namely, the functions `getattr`, `setattr`, and `delattr`.""" def visit_Attribute(self, node): """Convert attribute access to `getattr` call.""" <|body_0|> def visit_Assign(self, node): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttributesToFunctions: """Replace attribute getters/setters with function calls. Namely, the functions `getattr`, `setattr`, and `delattr`.""" def visit_Attribute(self, node): """Convert attribute access to `getattr` call.""" self.generic_visit(node) if isinstance(node.ctx, ast.Lo...
the_stack_v2_python_sparse
flowgraph/trace/ast_transform.py
epatters/pyflowgraph
train
2
64c62c4beaa9f8f5643b9d8d8f3578ed24a1741e
[ "logout_button_sitem = self.locator_finder_by_id(self.logout_button_id)\nlogout_button_sitem.click()\nprint('Logout from the current user\\n')\nself.wait_for_ajax()", "elem = self.locator_finder_by_xpath('/html/body/div[2]/div/div[1]/div/ul[1]/li[2]/a[2]')\nself.progress('Health state:' + elem.text)\nreturn elem....
<|body_start_0|> logout_button_sitem = self.locator_finder_by_id(self.logout_button_id) logout_button_sitem.click() print('Logout from the current user\n') self.wait_for_ajax() <|end_body_0|> <|body_start_1|> elem = self.locator_finder_by_xpath('/html/body/div[2]/div/div[1]/div/...
Page object representing the user bar
UserBarPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserBarPage: """Page object representing the user bar""" def log_out(self): """click log out icon on the user bar and wait for""" <|body_0|> def get_health_state(self): """extract the health state in the upper right corner""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_008571
861
no_license
[ { "docstring": "click log out icon on the user bar and wait for", "name": "log_out", "signature": "def log_out(self)" }, { "docstring": "extract the health state in the upper right corner", "name": "get_health_state", "signature": "def get_health_state(self)" } ]
2
stack_v2_sparse_classes_30k_train_001425
Implement the Python class `UserBarPage` described below. Class description: Page object representing the user bar Method signatures and docstrings: - def log_out(self): click log out icon on the user bar and wait for - def get_health_state(self): extract the health state in the upper right corner
Implement the Python class `UserBarPage` described below. Class description: Page object representing the user bar Method signatures and docstrings: - def log_out(self): click log out icon on the user bar and wait for - def get_health_state(self): extract the health state in the upper right corner <|skeleton|> class...
4d4a0b049eb83625df41d86f2066ddb0c6c9c85b
<|skeleton|> class UserBarPage: """Page object representing the user bar""" def log_out(self): """click log out icon on the user bar and wait for""" <|body_0|> def get_health_state(self): """extract the health state in the upper right corner""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserBarPage: """Page object representing the user bar""" def log_out(self): """click log out icon on the user bar and wait for""" logout_button_sitem = self.locator_finder_by_id(self.logout_button_id) logout_button_sitem.click() print('Logout from the current user\n') ...
the_stack_v2_python_sparse
release_tester/selenium_ui_test/pages/user_bar_page.py
arangodb/release-test-automation
train
14
2d64146a0001a1efb3e5e98209c9553d882e14b9
[ "menu_item.MenuItem.__init__(self, main_menu, frame)\nself.create_menu_item_button('Help')\nself.menu_item_button['command'] = self.get_help_window", "self.gui.active_window.hide()\nself.associated_window = help_window.HelpWindow(self.gui)\nself.gui.active_window = self.associated_window\nself.gui.active_window.s...
<|body_start_0|> menu_item.MenuItem.__init__(self, main_menu, frame) self.create_menu_item_button('Help') self.menu_item_button['command'] = self.get_help_window <|end_body_0|> <|body_start_1|> self.gui.active_window.hide() self.associated_window = help_window.HelpWindow(self.gu...
This class is used to create a button that will bring the user to the Help menu.
HelpMenuItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HelpMenuItem: """This class is used to create a button that will bring the user to the Help menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window"""...
stack_v2_sparse_classes_10k_train_008572
994
no_license
[ { "docstring": "Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window", "name": "__init__", "signature": "def __init__(self, main_menu, frame)" }, { "docstring": "This function will hide everything on the activ...
2
stack_v2_sparse_classes_30k_train_005711
Implement the Python class `HelpMenuItem` described below. Class description: This class is used to create a button that will bring the user to the Help menu. Method signatures and docstrings: - def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu because it knows about...
Implement the Python class `HelpMenuItem` described below. Class description: This class is used to create a button that will bring the user to the Help menu. Method signatures and docstrings: - def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu because it knows about...
e26d9450b98fa0f372bcdf6eaf251a2c9dcba44e
<|skeleton|> class HelpMenuItem: """This class is used to create a button that will bring the user to the Help menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window"""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HelpMenuItem: """This class is used to create a button that will bring the user to the Help menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window""" menu...
the_stack_v2_python_sparse
user_interface/menu_items/help_menu_item.py
pucheng-tan/WordFlow
train
0
9cbf39ce399de6fa40b2ca1408bde875c2e80a08
[ "self.device = device\nself.alpha = alpha\nself.model = model.to(self.device)\nself.params = {n: p for n, p in self.model.named_parameters() if p.requires_grad}\nself._means = {}\nself._precision_matrices = {}\nfor n, p in deepcopy(self.params).items():\n p.data.zero_()\n self._precision_matrices[n] = p.data....
<|body_start_0|> self.device = device self.alpha = alpha self.model = model.to(self.device) self.params = {n: p for n, p in self.model.named_parameters() if p.requires_grad} self._means = {} self._precision_matrices = {} for n, p in deepcopy(self.params).items(): ...
OnlineEWC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OnlineEWC: def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5): """OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter""" ...
stack_v2_sparse_classes_10k_train_008573
3,611
no_license
[ { "docstring": "OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter", "name": "__init__", "signature": "def __init__(self, model: nn.Module, device='cuda:0...
3
stack_v2_sparse_classes_30k_train_004305
Implement the Python class `OnlineEWC` described below. Class description: Implement the OnlineEWC class. Method signatures and docstrings: - def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5): OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (stri...
Implement the Python class `OnlineEWC` described below. Class description: Implement the OnlineEWC class. Method signatures and docstrings: - def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5): OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (stri...
f1f9e9f4f85c7eb076e3c15e2390c9d612adabdf
<|skeleton|> class OnlineEWC: def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5): """OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OnlineEWC: def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5): """OnlineEWC is the class for implementing the online EWC method. Inputs: model : a Pytorch NN model device (string): the device to run the model on alpha (in [0,1) ): The online learning hyper-parameter""" self.devic...
the_stack_v2_python_sparse
utils/ewc_utils/onlineEWC.py
lihr04/corel2m
train
0
520386c909e26ad2d139e961a3a2d02ad3e1db31
[ "user = request.user\nclassroom_id = request.GET.get('classrm_id', None)\nklass_id = request.GET.get('klass_id', None)\nif classroom_id is None:\n classroom = Classroom.objects.filter(opener=user, klass_id=klass_id).order_by('-finish_time').first()\nelse:\n try:\n classroom = Classroom.objects.get(id=c...
<|body_start_0|> user = request.user classroom_id = request.GET.get('classrm_id', None) klass_id = request.GET.get('klass_id', None) if classroom_id is None: classroom = Classroom.objects.filter(opener=user, klass_id=klass_id).order_by('-finish_time').first() else: ...
ActivityDetailReportViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityDetailReportViewSet: def study_detail_abstractpage(self, request): """学情统计首页信息 :param request: { "classroom_id": 1 不传显示最近一堂课内容 "klass_id": 1 } :return:""" <|body_0|> def nearest_class(self, request): """最近课程学情列表 :param request: :return:""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_008574
21,391
no_license
[ { "docstring": "学情统计首页信息 :param request: { \"classroom_id\": 1 不传显示最近一堂课内容 \"klass_id\": 1 } :return:", "name": "study_detail_abstractpage", "signature": "def study_detail_abstractpage(self, request)" }, { "docstring": "最近课程学情列表 :param request: :return:", "name": "nearest_class", "signat...
2
null
Implement the Python class `ActivityDetailReportViewSet` described below. Class description: Implement the ActivityDetailReportViewSet class. Method signatures and docstrings: - def study_detail_abstractpage(self, request): 学情统计首页信息 :param request: { "classroom_id": 1 不传显示最近一堂课内容 "klass_id": 1 } :return: - def neares...
Implement the Python class `ActivityDetailReportViewSet` described below. Class description: Implement the ActivityDetailReportViewSet class. Method signatures and docstrings: - def study_detail_abstractpage(self, request): 学情统计首页信息 :param request: { "classroom_id": 1 不传显示最近一堂课内容 "klass_id": 1 } :return: - def neares...
4189fdcacc20795a4778b53c9d47d6fdd3e71811
<|skeleton|> class ActivityDetailReportViewSet: def study_detail_abstractpage(self, request): """学情统计首页信息 :param request: { "classroom_id": 1 不传显示最近一堂课内容 "klass_id": 1 } :return:""" <|body_0|> def nearest_class(self, request): """最近课程学情列表 :param request: :return:""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ActivityDetailReportViewSet: def study_detail_abstractpage(self, request): """学情统计首页信息 :param request: { "classroom_id": 1 不传显示最近一堂课内容 "klass_id": 1 } :return:""" user = request.user classroom_id = request.GET.get('classrm_id', None) klass_id = request.GET.get('klass_id', None)...
the_stack_v2_python_sparse
bigfish/apps/classrooms/views.py
hyu9999/bigfish
train
0
b38989d148a7bdbe085c2511acd1689c1b1fa96c
[ "if minfo is None:\n minfo = {}\nsuper(DumpPeerStatsMessage, self).__init__(minfo)\nself.IsSystemMessage = False\nself.IsForward = True\nself.IsReliable = True\nself.PeerIDList = minfo.get('PeerIDList', [])\nself.MetricList = minfo.get('MetricList', [])", "result = super(DumpPeerStatsMessage, self).dump()\nres...
<|body_start_0|> if minfo is None: minfo = {} super(DumpPeerStatsMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True self.PeerIDList = minfo.get('PeerIDList', []) self.MetricList = minfo.get('MetricL...
Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules. IsF...
DumpPeerStatsMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DumpPeerStatsMessage: """Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System me...
stack_v2_sparse_classes_10k_train_008575
13,482
permissive
[ { "docstring": "Constructor for the DumpPeerStatsMessage class. Args: minfo (dict): Dictionary of values for message fields.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Dumps a dict containing object attributes. Returns: dict: A mapping of object attrib...
2
stack_v2_sparse_classes_30k_train_000528
Implement the Python class `DumpPeerStatsMessage` described below. Class description: Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or ...
Implement the Python class `DumpPeerStatsMessage` described below. Class description: Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or ...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class DumpPeerStatsMessage: """Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System me...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DumpPeerStatsMessage: """Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have s...
the_stack_v2_python_sparse
validator/gossip/messages/gossip_debug.py
aludvik/sawtooth-core
train
0
14dbac7d934140293822ea5317f8a3c8ebf086a8
[ "self.high_time = None\nself.short_press_time = float(dev_cfg.get('Short_Press-Threshold', 0))\nself.long_press_time = float(dev_cfg.get('Long_Press-Threshold', 0))\ntry:\n self.state_when_pressed = GPIO.LOW if dev_cfg['Btn_Pressed_State'] == 'LOW' else GPIO.HIGH\nexcept KeyError:\n self.state_when_pressed = ...
<|body_start_0|> self.high_time = None self.short_press_time = float(dev_cfg.get('Short_Press-Threshold', 0)) self.long_press_time = float(dev_cfg.get('Long_Press-Threshold', 0)) try: self.state_when_pressed = GPIO.LOW if dev_cfg['Btn_Pressed_State'] == 'LOW' else GPIO.HIGH ...
stores all button related parameters
ButtonPressCfg
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ButtonPressCfg: """stores all button related parameters""" def __init__(self, dev_cfg, caller): """read optional button press related parametes from the config Parameters: - dev_cfg : the dictionary that stores the config values for a sensor - caller : the objetc of the calling senso...
stack_v2_sparse_classes_10k_train_008576
18,086
permissive
[ { "docstring": "read optional button press related parametes from the config Parameters: - dev_cfg : the dictionary that stores the config values for a sensor - caller : the objetc of the calling sensor", "name": "__init__", "signature": "def __init__(self, dev_cfg, caller)" }, { "docstring": "c...
2
stack_v2_sparse_classes_30k_train_004877
Implement the Python class `ButtonPressCfg` described below. Class description: stores all button related parameters Method signatures and docstrings: - def __init__(self, dev_cfg, caller): read optional button press related parametes from the config Parameters: - dev_cfg : the dictionary that stores the config value...
Implement the Python class `ButtonPressCfg` described below. Class description: stores all button related parameters Method signatures and docstrings: - def __init__(self, dev_cfg, caller): read optional button press related parametes from the config Parameters: - dev_cfg : the dictionary that stores the config value...
6f8888ddef413fb8d58ef0ebc8fe89144c914a22
<|skeleton|> class ButtonPressCfg: """stores all button related parameters""" def __init__(self, dev_cfg, caller): """read optional button press related parametes from the config Parameters: - dev_cfg : the dictionary that stores the config values for a sensor - caller : the objetc of the calling senso...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ButtonPressCfg: """stores all button related parameters""" def __init__(self, dev_cfg, caller): """read optional button press related parametes from the config Parameters: - dev_cfg : the dictionary that stores the config values for a sensor - caller : the objetc of the calling sensor""" ...
the_stack_v2_python_sparse
gpio/rpi_gpio.py
rkoshak/sensorReporter
train
104
ec33233536d7869246af2ec9a48aecbced517060
[ "category_list = [{'id': 0, 'name': 'dog'}, {'id': 1, 'name': 'cat'}]\nvideo_evaluator = coco_evaluation_all_frames.CocoEvaluationAllFrames(category_list)\nvideo_evaluator.add_single_ground_truth_image_info(image_id='image1', groundtruth_dict=[{standard_fields.InputDataFields.groundtruth_boxes: np.array([[50.0, 50....
<|body_start_0|> category_list = [{'id': 0, 'name': 'dog'}, {'id': 1, 'name': 'cat'}] video_evaluator = coco_evaluation_all_frames.CocoEvaluationAllFrames(category_list) video_evaluator.add_single_ground_truth_image_info(image_id='image1', groundtruth_dict=[{standard_fields.InputDataFields.groun...
CocoEvaluationAllFramesTest
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CocoEvaluationAllFramesTest: def testGroundtruthAndDetectionsDisagreeOnAllFrames(self): """Tests that mAP is calculated on several different frame results.""" <|body_0|> def testGroundtruthAndDetections(self): """Tests that mAP is calculated correctly on GT and Detec...
stack_v2_sparse_classes_10k_train_008577
6,730
permissive
[ { "docstring": "Tests that mAP is calculated on several different frame results.", "name": "testGroundtruthAndDetectionsDisagreeOnAllFrames", "signature": "def testGroundtruthAndDetectionsDisagreeOnAllFrames(self)" }, { "docstring": "Tests that mAP is calculated correctly on GT and Detections.",...
3
null
Implement the Python class `CocoEvaluationAllFramesTest` described below. Class description: Implement the CocoEvaluationAllFramesTest class. Method signatures and docstrings: - def testGroundtruthAndDetectionsDisagreeOnAllFrames(self): Tests that mAP is calculated on several different frame results. - def testGround...
Implement the Python class `CocoEvaluationAllFramesTest` described below. Class description: Implement the CocoEvaluationAllFramesTest class. Method signatures and docstrings: - def testGroundtruthAndDetectionsDisagreeOnAllFrames(self): Tests that mAP is calculated on several different frame results. - def testGround...
a115d918f6894a69586174653172be0b5d1de952
<|skeleton|> class CocoEvaluationAllFramesTest: def testGroundtruthAndDetectionsDisagreeOnAllFrames(self): """Tests that mAP is calculated on several different frame results.""" <|body_0|> def testGroundtruthAndDetections(self): """Tests that mAP is calculated correctly on GT and Detec...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CocoEvaluationAllFramesTest: def testGroundtruthAndDetectionsDisagreeOnAllFrames(self): """Tests that mAP is calculated on several different frame results.""" category_list = [{'id': 0, 'name': 'dog'}, {'id': 1, 'name': 'cat'}] video_evaluator = coco_evaluation_all_frames.CocoEvaluatio...
the_stack_v2_python_sparse
models/research/lstm_object_detection/metrics/coco_evaluation_all_frames_test.py
finnickniu/tensorflow_object_detection_tflite
train
60
3bfe2d2ac4caf5850c7559dc813b4619e24842a2
[ "self.__sqlSys = sqlSys\nself.__sql = sql\nself.__dboid = {}\nself.__log = Core.Log.File(debug=1, module='1[dmerce].Processor.DBOID')", "db = self.__sql.GetName()\ndbOid = DMS.SQL.DBOID(self.__sqlSys, self.__sql)\nif not self.__dboid.has_key(table):\n newId = self.__dboid[table] = dbOid[table]\n return newI...
<|body_start_0|> self.__sqlSys = sqlSys self.__sql = sql self.__dboid = {} self.__log = Core.Log.File(debug=1, module='1[dmerce].Processor.DBOID') <|end_body_0|> <|body_start_1|> db = self.__sql.GetName() dbOid = DMS.SQL.DBOID(self.__sqlSys, self.__sql) if not se...
manages retrival of (new) db oids from dmerce system database
DBOID
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBOID: """manages retrival of (new) db oids from dmerce system database""" def __init__(self, sqlSys, sql): """takes an instance of DMS.SQL.DBAPI to dmerce system database and the database we should work on as argument""" <|body_0|> def __getitem__(self, table): ...
stack_v2_sparse_classes_10k_train_008578
24,090
no_license
[ { "docstring": "takes an instance of DMS.SQL.DBAPI to dmerce system database and the database we should work on as argument", "name": "__init__", "signature": "def __init__(self, sqlSys, sql)" }, { "docstring": "try to look up DBOID for table in dictionary if we found one return it otherwise get...
2
stack_v2_sparse_classes_30k_train_001677
Implement the Python class `DBOID` described below. Class description: manages retrival of (new) db oids from dmerce system database Method signatures and docstrings: - def __init__(self, sqlSys, sql): takes an instance of DMS.SQL.DBAPI to dmerce system database and the database we should work on as argument - def __...
Implement the Python class `DBOID` described below. Class description: manages retrival of (new) db oids from dmerce system database Method signatures and docstrings: - def __init__(self, sqlSys, sql): takes an instance of DMS.SQL.DBAPI to dmerce system database and the database we should work on as argument - def __...
3cfcae894c165189cc3ff61e27ca284f09e87871
<|skeleton|> class DBOID: """manages retrival of (new) db oids from dmerce system database""" def __init__(self, sqlSys, sql): """takes an instance of DMS.SQL.DBAPI to dmerce system database and the database we should work on as argument""" <|body_0|> def __getitem__(self, table): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DBOID: """manages retrival of (new) db oids from dmerce system database""" def __init__(self, sqlSys, sql): """takes an instance of DMS.SQL.DBAPI to dmerce system database and the database we should work on as argument""" self.__sqlSys = sqlSys self.__sql = sql self.__dboi...
the_stack_v2_python_sparse
dmerce2/DTL/Processor.py
rbe/dmerce
train
0
4e7bfd3134bd5a68bf6189a8287b0bb5ff6b849f
[ "self.BELOW_LOW_THRESHOLD = -1\nself.BETWEEN_THRESHOLDS = -2\ntorch._assert(low_threshold <= high_threshold, 'low_threshold should be <= high_threshold')\nself.high_threshold = high_threshold\nself.low_threshold = low_threshold\nself.allow_low_quality_matches = allow_low_quality_matches", "if match_quality_matrix...
<|body_start_0|> self.BELOW_LOW_THRESHOLD = -1 self.BETWEEN_THRESHOLDS = -2 torch._assert(low_threshold <= high_threshold, 'low_threshold should be <= high_threshold') self.high_threshold = high_threshold self.low_threshold = low_threshold self.allow_low_quality_matches =...
This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be assigned to zero or more predicted elements. Matching is based on the MxN match_quality_matrix, that characterizes how well each (ground-tru...
Matcher
[ "BSD-3-Clause", "CC-BY-NC-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Matcher: """This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be assigned to zero or more predicted elements. Matching is based on the MxN match_quality_matrix, that char...
stack_v2_sparse_classes_10k_train_008579
22,127
permissive
[ { "docstring": "Args: high_threshold (float): quality values greater than or equal to this value are candidate matches. low_threshold (float): a lower quality threshold used to stratify matches into three levels: 1) matches >= high_threshold 2) BETWEEN_THRESHOLDS matches in [low_threshold, high_threshold) 3) BE...
3
null
Implement the Python class `Matcher` described below. Class description: This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be assigned to zero or more predicted elements. Matching is based on ...
Implement the Python class `Matcher` described below. Class description: This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be assigned to zero or more predicted elements. Matching is based on ...
1f94320d8db8d102214a7dc02c22fa65ee9ac58a
<|skeleton|> class Matcher: """This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be assigned to zero or more predicted elements. Matching is based on the MxN match_quality_matrix, that char...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Matcher: """This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be assigned to zero or more predicted elements. Matching is based on the MxN match_quality_matrix, that characterizes how...
the_stack_v2_python_sparse
torchvision/models/detection/_utils.py
pytorch/vision
train
15,620
be22ab7d9fc43eefa1755abb2e2b558fb773273a
[ "self.num_logical_bytes_transferred = num_logical_bytes_transferred\nself.num_physical_bytes_transferred = num_physical_bytes_transferred\nself.protection_job_name = protection_job_name\nself.storage_consumed = storage_consumed", "if dictionary is None:\n return None\nnum_logical_bytes_transferred = dictionary...
<|body_start_0|> self.num_logical_bytes_transferred = num_logical_bytes_transferred self.num_physical_bytes_transferred = num_physical_bytes_transferred self.protection_job_name = protection_job_name self.storage_consumed = storage_consumed <|end_body_0|> <|body_start_1|> if dic...
Implementation of the 'DataTransferToVaultPerProtectionJob' model. Specifies statistics about the transfer of data from this Cohesity Cluster to this Vault for a Protection Job. Attributes: num_logical_bytes_transferred (long|int): Specifies the total number of logical bytes that are transferred from this Cohesity Clus...
DataTransferToVaultPerProtectionJob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataTransferToVaultPerProtectionJob: """Implementation of the 'DataTransferToVaultPerProtectionJob' model. Specifies statistics about the transfer of data from this Cohesity Cluster to this Vault for a Protection Job. Attributes: num_logical_bytes_transferred (long|int): Specifies the total numbe...
stack_v2_sparse_classes_10k_train_008580
3,126
permissive
[ { "docstring": "Constructor for the DataTransferToVaultPerProtectionJob class", "name": "__init__", "signature": "def __init__(self, num_logical_bytes_transferred=None, num_physical_bytes_transferred=None, protection_job_name=None, storage_consumed=None)" }, { "docstring": "Creates an instance o...
2
stack_v2_sparse_classes_30k_train_003580
Implement the Python class `DataTransferToVaultPerProtectionJob` described below. Class description: Implementation of the 'DataTransferToVaultPerProtectionJob' model. Specifies statistics about the transfer of data from this Cohesity Cluster to this Vault for a Protection Job. Attributes: num_logical_bytes_transferre...
Implement the Python class `DataTransferToVaultPerProtectionJob` described below. Class description: Implementation of the 'DataTransferToVaultPerProtectionJob' model. Specifies statistics about the transfer of data from this Cohesity Cluster to this Vault for a Protection Job. Attributes: num_logical_bytes_transferre...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DataTransferToVaultPerProtectionJob: """Implementation of the 'DataTransferToVaultPerProtectionJob' model. Specifies statistics about the transfer of data from this Cohesity Cluster to this Vault for a Protection Job. Attributes: num_logical_bytes_transferred (long|int): Specifies the total numbe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataTransferToVaultPerProtectionJob: """Implementation of the 'DataTransferToVaultPerProtectionJob' model. Specifies statistics about the transfer of data from this Cohesity Cluster to this Vault for a Protection Job. Attributes: num_logical_bytes_transferred (long|int): Specifies the total number of logical ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/data_transfer_to_vault_per_protection_job.py
cohesity/management-sdk-python
train
24
606d8e82bb60d92136cc352b14378f20a830c894
[ "if LooseVersion(self.version) < LooseVersion('4.3'):\n self.cfg.update('configopts', '--enable-shared')\n if self.toolchain.options['pic']:\n self.cfg.update('configopts', '--with-pic')\n tup = (os.getenv('FFLAGS'), os.getenv('MPICC'), os.getenv('F90'))\n self.cfg.update('configopts', 'FCFLAGS=\...
<|body_start_0|> if LooseVersion(self.version) < LooseVersion('4.3'): self.cfg.update('configopts', '--enable-shared') if self.toolchain.options['pic']: self.cfg.update('configopts', '--with-pic') tup = (os.getenv('FFLAGS'), os.getenv('MPICC'), os.getenv('F90'...
Support for building/installing netCDF
EB_netCDF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EB_netCDF: """Support for building/installing netCDF""" def configure_step(self): """Configure build: set config options and configure""" <|body_0|> def sanity_check_step(self): """Custom sanity check for netCDF""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_10k_train_008581
4,968
no_license
[ { "docstring": "Configure build: set config options and configure", "name": "configure_step", "signature": "def configure_step(self)" }, { "docstring": "Custom sanity check for netCDF", "name": "sanity_check_step", "signature": "def sanity_check_step(self)" } ]
2
stack_v2_sparse_classes_30k_train_007231
Implement the Python class `EB_netCDF` described below. Class description: Support for building/installing netCDF Method signatures and docstrings: - def configure_step(self): Configure build: set config options and configure - def sanity_check_step(self): Custom sanity check for netCDF
Implement the Python class `EB_netCDF` described below. Class description: Support for building/installing netCDF Method signatures and docstrings: - def configure_step(self): Configure build: set config options and configure - def sanity_check_step(self): Custom sanity check for netCDF <|skeleton|> class EB_netCDF:...
3c5434f9a4193fbe4cf8107327faadda83d798ae
<|skeleton|> class EB_netCDF: """Support for building/installing netCDF""" def configure_step(self): """Configure build: set config options and configure""" <|body_0|> def sanity_check_step(self): """Custom sanity check for netCDF""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EB_netCDF: """Support for building/installing netCDF""" def configure_step(self): """Configure build: set config options and configure""" if LooseVersion(self.version) < LooseVersion('4.3'): self.cfg.update('configopts', '--enable-shared') if self.toolchain.options...
the_stack_v2_python_sparse
1.11.1/easyblock/easyblocks/n/netcdf.py
lsuhpchelp/easybuild_smic
train
0
6562a6bd483abd2b4095ed60c8df39c58e6a2f61
[ "super(Transformer, self).__init__()\nself.n_vocab = n_vocab\nself.enc_word_embed = nn.Embedding(n_vocab, d_model, padding_idx=pad)\nself.pos_embed = PositionEmbedding(d_model, dropout=dropout, max_len=512)\nif share_word_embedding:\n self.dec_word_embed = self.enc_word_embed\nelse:\n self.dec_word_embed = nn...
<|body_start_0|> super(Transformer, self).__init__() self.n_vocab = n_vocab self.enc_word_embed = nn.Embedding(n_vocab, d_model, padding_idx=pad) self.pos_embed = PositionEmbedding(d_model, dropout=dropout, max_len=512) if share_word_embedding: self.dec_word_embed = s...
Transformer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: def __init__(self, n_vocab, d_model=512, n_head=8, num_encoder_layers=6, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, max_len=512, share_word_embedding=False, pad=0): """Transformer Arguments: n_vocab {int} -- # of vocabulary Keyword Arguments: d_model {int} -- d...
stack_v2_sparse_classes_10k_train_008582
14,651
permissive
[ { "docstring": "Transformer Arguments: n_vocab {int} -- # of vocabulary Keyword Arguments: d_model {int} -- dimension of hidden state (default: {512}) n_head {int} -- # of heads used in multi-head attention (default: {8}) num_encoder_layers {int} -- # of transformer encoder layers (default: {6}) num_decoder_lay...
3
stack_v2_sparse_classes_30k_train_000681
Implement the Python class `Transformer` described below. Class description: Implement the Transformer class. Method signatures and docstrings: - def __init__(self, n_vocab, d_model=512, n_head=8, num_encoder_layers=6, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, max_len=512, share_word_embedding=False, p...
Implement the Python class `Transformer` described below. Class description: Implement the Transformer class. Method signatures and docstrings: - def __init__(self, n_vocab, d_model=512, n_head=8, num_encoder_layers=6, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, max_len=512, share_word_embedding=False, p...
f478b2a912c8c742da5ced510ac40da59217ddb3
<|skeleton|> class Transformer: def __init__(self, n_vocab, d_model=512, n_head=8, num_encoder_layers=6, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, max_len=512, share_word_embedding=False, pad=0): """Transformer Arguments: n_vocab {int} -- # of vocabulary Keyword Arguments: d_model {int} -- d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Transformer: def __init__(self, n_vocab, d_model=512, n_head=8, num_encoder_layers=6, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, max_len=512, share_word_embedding=False, pad=0): """Transformer Arguments: n_vocab {int} -- # of vocabulary Keyword Arguments: d_model {int} -- dimension of hi...
the_stack_v2_python_sparse
models/seq2seq_trs.py
zhongerqiandan/OpenDialog
train
0
2dbfc183a5864f6724f23a69cc44bc9a53a2156b
[ "res = {}\ntotal_capacity = 0.0\nfor rec in self:\n emp_bed = 0.0\n for bed in rec.bed_ids:\n if not bed.employee_id:\n emp_bed += 1\n rec.available_beds = emp_bed", "for rooms_rec in self:\n accomodation_id = rooms_rec.accommodation_id and rooms_rec.accommodation_id.id or False\n ...
<|body_start_0|> res = {} total_capacity = 0.0 for rec in self: emp_bed = 0.0 for bed in rec.bed_ids: if not bed.employee_id: emp_bed += 1 rec.available_beds = emp_bed <|end_body_0|> <|body_start_1|> for rooms_rec i...
room_room
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class room_room: def _beds_available(self): """This method is used to total calculate on available beds of employee -------------------------------------------------------------- @param self : Records set @multi : The decorator of multi""" <|body_0|> def check_bed_ids(self): ...
stack_v2_sparse_classes_10k_train_008583
24,603
no_license
[ { "docstring": "This method is used to total calculate on available beds of employee -------------------------------------------------------------- @param self : Records set @multi : The decorator of multi", "name": "_beds_available", "signature": "def _beds_available(self)" }, { "docstring": "T...
2
stack_v2_sparse_classes_30k_train_006010
Implement the Python class `room_room` described below. Class description: Implement the room_room class. Method signatures and docstrings: - def _beds_available(self): This method is used to total calculate on available beds of employee -------------------------------------------------------------- @param self : Rec...
Implement the Python class `room_room` described below. Class description: Implement the room_room class. Method signatures and docstrings: - def _beds_available(self): This method is used to total calculate on available beds of employee -------------------------------------------------------------- @param self : Rec...
46e15330b5d642053da61754247f3fbf9d02717e
<|skeleton|> class room_room: def _beds_available(self): """This method is used to total calculate on available beds of employee -------------------------------------------------------------- @param self : Records set @multi : The decorator of multi""" <|body_0|> def check_bed_ids(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class room_room: def _beds_available(self): """This method is used to total calculate on available beds of employee -------------------------------------------------------------- @param self : Records set @multi : The decorator of multi""" res = {} total_capacity = 0.0 for rec in sel...
the_stack_v2_python_sparse
core/sg_accommodation/models/accommodation_agreement.py
Muhammad-SF/Test
train
0
831041fa838f692f863f1f1f448cba013f1649c6
[ "mol = Molecule()\nself.assertEqual(mol.to_smiles(), '')\nself.assertEqual(mol.to_inchi(), '')", "mol = Molecule(smiles='[CH2-][N+]#N')\nwith self.assertRaisesRegex(ValueError, 'Unable to generate identifier type'):\n to_inchi(mol, backend='rdkit')\nmock_logging.error.assert_called_with('Unable to generate ide...
<|body_start_0|> mol = Molecule() self.assertEqual(mol.to_smiles(), '') self.assertEqual(mol.to_inchi(), '') <|end_body_0|> <|body_start_1|> mol = Molecule(smiles='[CH2-][N+]#N') with self.assertRaisesRegex(ValueError, 'Unable to generate identifier type'): to_inchi(...
TranslatorTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TranslatorTest: def test_empty_molecule(self): """Test that we can safely return a blank identifier for an empty molecule.""" <|body_0|> def test_failure_message(self, mock_logging): """Test that we log the molecule adjlist upon failure.""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k_train_008584
40,756
permissive
[ { "docstring": "Test that we can safely return a blank identifier for an empty molecule.", "name": "test_empty_molecule", "signature": "def test_empty_molecule(self)" }, { "docstring": "Test that we log the molecule adjlist upon failure.", "name": "test_failure_message", "signature": "de...
2
stack_v2_sparse_classes_30k_train_004389
Implement the Python class `TranslatorTest` described below. Class description: Implement the TranslatorTest class. Method signatures and docstrings: - def test_empty_molecule(self): Test that we can safely return a blank identifier for an empty molecule. - def test_failure_message(self, mock_logging): Test that we l...
Implement the Python class `TranslatorTest` described below. Class description: Implement the TranslatorTest class. Method signatures and docstrings: - def test_empty_molecule(self): Test that we can safely return a blank identifier for an empty molecule. - def test_failure_message(self, mock_logging): Test that we l...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class TranslatorTest: def test_empty_molecule(self): """Test that we can safely return a blank identifier for an empty molecule.""" <|body_0|> def test_failure_message(self, mock_logging): """Test that we log the molecule adjlist upon failure.""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TranslatorTest: def test_empty_molecule(self): """Test that we can safely return a blank identifier for an empty molecule.""" mol = Molecule() self.assertEqual(mol.to_smiles(), '') self.assertEqual(mol.to_inchi(), '') def test_failure_message(self, mock_logging): "...
the_stack_v2_python_sparse
rmgpy/molecule/translatorTest.py
CanePan-cc/CanePanWorkshop
train
2
99461a42ccc48cbb8fc9f6da454c4b1f92c321aa
[ "if not selector:\n return None\nif isinstance(selector, SelectorList):\n selector = selector[0]\nif isinstance(selector.root, str):\n return selector.root\nreturn ''.join([x.strip() for x in selector.xpath('.//text()').extract() if x.strip()])", "day = str(date.min)\nfor arg in args:\n if isinstance(...
<|body_start_0|> if not selector: return None if isinstance(selector, SelectorList): selector = selector[0] if isinstance(selector.root, str): return selector.root return ''.join([x.strip() for x in selector.xpath('.//text()').extract() if x.strip()]) ...
FieldExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FieldExtractor: def text(cls, selector: Union[Selector, SelectorList]) -> str: """解析出文本内容""" <|body_0|> def date(cls, *args) -> date: """解析出日期内容""" <|body_1|> def money(cls, selector: Union[scrapy.Selector, List[str]]): """解析出金额内容""" <|bo...
stack_v2_sparse_classes_10k_train_008585
17,949
no_license
[ { "docstring": "解析出文本内容", "name": "text", "signature": "def text(cls, selector: Union[Selector, SelectorList]) -> str" }, { "docstring": "解析出日期内容", "name": "date", "signature": "def date(cls, *args) -> date" }, { "docstring": "解析出金额内容", "name": "money", "signature": "def ...
3
null
Implement the Python class `FieldExtractor` described below. Class description: Implement the FieldExtractor class. Method signatures and docstrings: - def text(cls, selector: Union[Selector, SelectorList]) -> str: 解析出文本内容 - def date(cls, *args) -> date: 解析出日期内容 - def money(cls, selector: Union[scrapy.Selector, List[...
Implement the Python class `FieldExtractor` described below. Class description: Implement the FieldExtractor class. Method signatures and docstrings: - def text(cls, selector: Union[Selector, SelectorList]) -> str: 解析出文本内容 - def date(cls, *args) -> date: 解析出日期内容 - def money(cls, selector: Union[scrapy.Selector, List[...
7316880e2444a8af02e2f44af38dd7ae708ccbb6
<|skeleton|> class FieldExtractor: def text(cls, selector: Union[Selector, SelectorList]) -> str: """解析出文本内容""" <|body_0|> def date(cls, *args) -> date: """解析出日期内容""" <|body_1|> def money(cls, selector: Union[scrapy.Selector, List[str]]): """解析出金额内容""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FieldExtractor: def text(cls, selector: Union[Selector, SelectorList]) -> str: """解析出文本内容""" if not selector: return None if isinstance(selector, SelectorList): selector = selector[0] if isinstance(selector.root, str): return selector.root ...
the_stack_v2_python_sparse
fetch_scrapy/fetch/extractors.py
aiportal/zb123
train
0
b0ae18193055e40a5d1cdedc0db4ad428a7cc9c8
[ "def error(msg):\n return FetchResponse(status=FetchResponse.Status.ERROR, error_message=msg)\nhash_algo = _HASH_ALGO_MAPPING[request.hash_algo]\nif not impl.is_valid_hash_digest(hash_algo, request.file_hash):\n return error('Invalid hash digest format')\nservice = impl.get_cas_service()\nif service is None o...
<|body_start_0|> def error(msg): return FetchResponse(status=FetchResponse.Status.ERROR, error_message=msg) hash_algo = _HASH_ALGO_MAPPING[request.hash_algo] if not impl.is_valid_hash_digest(hash_algo, request.file_hash): return error('Invalid hash digest format') ...
Content addressable storage API.
CASServiceApi
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CASServiceApi: """Content addressable storage API.""" def fetch(self, request): """Returns a signed URL that can be used to fetch an object.""" <|body_0|> def begin_upload(self, request): """Initiates an upload operation if file is missing. Once initiated the cli...
stack_v2_sparse_classes_10k_train_008586
8,463
permissive
[ { "docstring": "Returns a signed URL that can be used to fetch an object.", "name": "fetch", "signature": "def fetch(self, request)" }, { "docstring": "Initiates an upload operation if file is missing. Once initiated the client is then responsible for uploading the file to temporary location (re...
3
stack_v2_sparse_classes_30k_train_001854
Implement the Python class `CASServiceApi` described below. Class description: Content addressable storage API. Method signatures and docstrings: - def fetch(self, request): Returns a signed URL that can be used to fetch an object. - def begin_upload(self, request): Initiates an upload operation if file is missing. O...
Implement the Python class `CASServiceApi` described below. Class description: Content addressable storage API. Method signatures and docstrings: - def fetch(self, request): Returns a signed URL that can be used to fetch an object. - def begin_upload(self, request): Initiates an upload operation if file is missing. O...
09064105713603f7bf75c772e8354800a1bfa256
<|skeleton|> class CASServiceApi: """Content addressable storage API.""" def fetch(self, request): """Returns a signed URL that can be used to fetch an object.""" <|body_0|> def begin_upload(self, request): """Initiates an upload operation if file is missing. Once initiated the cli...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CASServiceApi: """Content addressable storage API.""" def fetch(self, request): """Returns a signed URL that can be used to fetch an object.""" def error(msg): return FetchResponse(status=FetchResponse.Status.ERROR, error_message=msg) hash_algo = _HASH_ALGO_MAPPING[req...
the_stack_v2_python_sparse
appengine/chrome_infra_packages/cas/api.py
mcgreevy/chromium-infra
train
1
26a9d6bc23e34b42bc90e47cf5577c48a60dbc30
[ "self.enable_audit_logging = enable_audit_logging\nself.file_select_policy = file_select_policy\nself.file_size = file_size\nself.file_size_policy = file_size_policy\nself.hot_file_window = hot_file_window\nself.nfs_mount_path = nfs_mount_path\nself.num_file_access = num_file_access\nself.source_view_map = source_v...
<|body_start_0|> self.enable_audit_logging = enable_audit_logging self.file_select_policy = file_select_policy self.file_size = file_size self.file_size_policy = file_size_policy self.hot_file_window = hot_file_window self.nfs_mount_path = nfs_mount_path self.num_...
Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int): Gives the size criteria to be used for selecti...
FileUptieringParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileUptieringParams: """Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int):...
stack_v2_sparse_classes_10k_train_008587
5,284
permissive
[ { "docstring": "Constructor for the FileUptieringParams class", "name": "__init__", "signature": "def __init__(self, enable_audit_logging=None, file_select_policy=None, file_size=None, file_size_policy=None, hot_file_window=None, nfs_mount_path=None, num_file_access=None, source_view_map=None, source_vi...
2
null
Implement the Python class `FileUptieringParams` described below. Class description: Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file ac...
Implement the Python class `FileUptieringParams` described below. Class description: Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file ac...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FileUptieringParams: """Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileUptieringParams: """Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int): Gives the si...
the_stack_v2_python_sparse
cohesity_management_sdk/models/file_uptiering_params.py
cohesity/management-sdk-python
train
24
360344bffecce399a668c5a77d9d76a15d9dd637
[ "super().__init__(syncthru, name)\nself._name = f'{name} Drum {color}'\nself._color = color\nself._unit_of_measurement = PERCENTAGE\nself._id_suffix = f'_drum_{color}'", "if self.syncthru.is_online():\n self._attributes = self.syncthru.drum_status().get(self._color, {})\n self._state = self._attributes.get(...
<|body_start_0|> super().__init__(syncthru, name) self._name = f'{name} Drum {color}' self._color = color self._unit_of_measurement = PERCENTAGE self._id_suffix = f'_drum_{color}' <|end_body_0|> <|body_start_1|> if self.syncthru.is_online(): self._attributes ...
Implementation of a Samsung Printer toner sensor platform.
SyncThruDrumSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruDrumSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" <|body_...
stack_v2_sparse_classes_10k_train_008588
8,262
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, syncthru, name, color)" }, { "docstring": "Get the latest data from SyncThru and update the state.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `SyncThruDrumSensor` described below. Class description: Implementation of a Samsung Printer toner sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, color): Initialize the sensor. - def update(self): Get the latest data from SyncThru and update the stat...
Implement the Python class `SyncThruDrumSensor` described below. Class description: Implementation of a Samsung Printer toner sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, color): Initialize the sensor. - def update(self): Get the latest data from SyncThru and update the stat...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class SyncThruDrumSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" <|body_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SyncThruDrumSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" super().__init__(syncthru, name) self._name = f'{name} Drum {color}' self._color = color self._unit_of_measu...
the_stack_v2_python_sparse
homeassistant/components/syncthru/sensor.py
tchellomello/home-assistant
train
8
93fcea611e99e3137b1b6047c362ac72cb988275
[ "args = self.get_args.parse_args()\nnum_rows = args.get('rows') or 100\nquery = g.db.query(Machine)\nif args.get('realm', None) not in ('aws', 'local'):\n abort(http_client.BAD_REQUEST, description=\"realm must be 'aws' or 'local'\")\nif args['realm'] == 'local':\n query = query.filter(Machine.realm == 'local...
<|body_start_0|> args = self.get_args.parse_args() num_rows = args.get('rows') or 100 query = g.db.query(Machine) if args.get('realm', None) not in ('aws', 'local'): abort(http_client.BAD_REQUEST, description="realm must be 'aws' or 'local'") if args['realm'] == 'loca...
The interface to battleserver machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battleserver resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new publicIP address for example, it will ge...
MachinesAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachinesAPI: """The interface to battleserver machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battleserver resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new p...
stack_v2_sparse_classes_10k_train_008589
8,672
permissive
[ { "docstring": "Get a list of machines", "name": "get", "signature": "def get(self)" }, { "docstring": "Register a machine", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_val_000118
Implement the Python class `MachinesAPI` described below. Class description: The interface to battleserver machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battleserver resources. A machine is defined as a set of the parameters for the post ...
Implement the Python class `MachinesAPI` described below. Class description: The interface to battleserver machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battleserver resources. A machine is defined as a set of the parameters for the post ...
9825cb22b26b577b715f2ce95453363bf90ecc7e
<|skeleton|> class MachinesAPI: """The interface to battleserver machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battleserver resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MachinesAPI: """The interface to battleserver machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battleserver resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new publicIP addre...
the_stack_v2_python_sparse
driftbase/api/machines.py
dgnorth/drift-base
train
1
2054fc0ee98ac268f71744f7c2d8933d67eabee9
[ "self.resultList = [None] * len(deferredList)\nDeferred.__init__(self)\nif len(deferredList) == 0 and (not fireOnOneCallback):\n self.callback(self.resultList)\nself.fireOnOneCallback = fireOnOneCallback\nself.fireOnOneErrback = fireOnOneErrback\nself.consumeErrors = consumeErrors\nself.finishedCount = 0\nindex ...
<|body_start_0|> self.resultList = [None] * len(deferredList) Deferred.__init__(self) if len(deferredList) == 0 and (not fireOnOneCallback): self.callback(self.resultList) self.fireOnOneCallback = fireOnOneCallback self.fireOnOneErrback = fireOnOneErrback self...
I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it in a DeferredList. For example, you can...
DeferredList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeferredList: """I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it...
stack_v2_sparse_classes_10k_train_008590
3,907
permissive
[ { "docstring": "Initialize a DeferredList. @type deferredList: C{list} of L{Deferred}s @param deferredList: The list of deferreds to track. @param fireOnOneCallback: (keyword param) a flag indicating that only one callback needs to be fired for me to call my callback @param fireOnOneErrback: (keyword param) a f...
2
stack_v2_sparse_classes_30k_train_002755
Implement the Python class `DeferredList` described below. Class description: I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can s...
Implement the Python class `DeferredList` described below. Class description: I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can s...
bf9c26051e8dfd1325bdc63aab1c560dbad7f6b7
<|skeleton|> class DeferredList: """I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeferredList: """I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it in a Deferre...
the_stack_v2_python_sparse
Vertex/vertex/_unfortunate_defer_hack.py
feitianyiren/divmod.org
train
0
871d8ce3c2c6b715da49ecae34b674ca09abe802
[ "if m == 1 or n == 1:\n return 1\nreturn self.uniquePaths(m - 1, n) + self.uniquePaths(m, n - 1)", "ans = [[1 for _ in range(n)] for _ in range(m)]\nfor row in range(1, m):\n for col in range(1, n):\n ans[row][col] = ans[row - 1][col] + ans[row][col - 1]\nreturn ans[-1][-1]" ]
<|body_start_0|> if m == 1 or n == 1: return 1 return self.uniquePaths(m - 1, n) + self.uniquePaths(m, n - 1) <|end_body_0|> <|body_start_1|> ans = [[1 for _ in range(n)] for _ in range(m)] for row in range(1, m): for col in range(1, n): ans[row][...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePaths(self, m: int, n: int) -> int: """递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:""" <|body_0|> def uniquePaths_2(self, m: int, n: int) -> int: """动态规划思想 :param m: :param n: :return:""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_008591
919
no_license
[ { "docstring": "递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:", "name": "uniquePaths", "signature": "def uniquePaths(self, m: int, n: int) -> int" }, { "docstring": "动态规划思想 :param m: :param n: :return:", "name": "uniquePaths_2", "signature": "def uniquePaths_2(self, m: int, n:...
2
stack_v2_sparse_classes_30k_train_004729
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m: int, n: int) -> int: 递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return: - def uniquePaths_2(self, m: int, n: int) -> int: 动态规划思想 :param m: :param n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m: int, n: int) -> int: 递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return: - def uniquePaths_2(self, m: int, n: int) -> int: 动态规划思想 :param m: :param n...
f2c162654a83c51495ebd161f42a1d0b69caf72d
<|skeleton|> class Solution: def uniquePaths(self, m: int, n: int) -> int: """递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:""" <|body_0|> def uniquePaths_2(self, m: int, n: int) -> int: """动态规划思想 :param m: :param n: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePaths(self, m: int, n: int) -> int: """递归的思想,不过注意使用缓存,不然会大量重复计算,超时 :param m: :param n: :return:""" if m == 1 or n == 1: return 1 return self.uniquePaths(m - 1, n) + self.uniquePaths(m, n - 1) def uniquePaths_2(self, m: int, n: int) -> int: "...
the_stack_v2_python_sparse
62 uniquePaths.py
ABenxj/leetcode
train
1
d5fe262f36fab6d42d649fbc882387158f06b3be
[ "if value.org_unit_type in self.instance.form.org_unit_types.all():\n try:\n return OrgUnit.objects.filter_for_user_and_app_id(self.context['request'].user, None).get(pk=value.pk)\n except OrgUnit.DoesNotExist:\n pass\nraise serializers.ValidationError('Org unit type not assigned to this form or...
<|body_start_0|> if value.org_unit_type in self.instance.form.org_unit_types.all(): try: return OrgUnit.objects.filter_for_user_and_app_id(self.context['request'].user, None).get(pk=value.pk) except OrgUnit.DoesNotExist: pass raise serializers.Vali...
InstanceSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceSerializer: def validate_org_unit(self, value): """Check if user has acces to this org_unit.""" <|body_0|> def validate_period(self, value): """Check if period is of self.instance.form.period_type.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_008592
16,776
permissive
[ { "docstring": "Check if user has acces to this org_unit.", "name": "validate_org_unit", "signature": "def validate_org_unit(self, value)" }, { "docstring": "Check if period is of self.instance.form.period_type.", "name": "validate_period", "signature": "def validate_period(self, value)"...
2
null
Implement the Python class `InstanceSerializer` described below. Class description: Implement the InstanceSerializer class. Method signatures and docstrings: - def validate_org_unit(self, value): Check if user has acces to this org_unit. - def validate_period(self, value): Check if period is of self.instance.form.per...
Implement the Python class `InstanceSerializer` described below. Class description: Implement the InstanceSerializer class. Method signatures and docstrings: - def validate_org_unit(self, value): Check if user has acces to this org_unit. - def validate_period(self, value): Check if period is of self.instance.form.per...
4d3a9d3faa6b3ed3a2e08c728cc4f03e5a0bbcb6
<|skeleton|> class InstanceSerializer: def validate_org_unit(self, value): """Check if user has acces to this org_unit.""" <|body_0|> def validate_period(self, value): """Check if period is of self.instance.form.period_type.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstanceSerializer: def validate_org_unit(self, value): """Check if user has acces to this org_unit.""" if value.org_unit_type in self.instance.form.org_unit_types.all(): try: return OrgUnit.objects.filter_for_user_and_app_id(self.context['request'].user, None).get(...
the_stack_v2_python_sparse
iaso/api/instances.py
lpontis/iaso
train
0
c31219a6c5c2a065833616901fc1a767fbe86344
[ "if not S:\n return ''\ncontents = S.upper().replace('-', '')\nres = ''\nfor id in range(0, len(contents), K):\n res += contents[id:id + K]\n if len(contents) - id > K:\n res += '-'\nreturn res[::-1]", "S = S.upper().replace('-', '')\nsize = len(S)\nstart = K if size % K == 0 else size % K\nres = ...
<|body_start_0|> if not S: return '' contents = S.upper().replace('-', '') res = '' for id in range(0, len(contents), K): res += contents[id:id + K] if len(contents) - id > K: res += '-' return res[::-1] <|end_body_0|> <|body_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def licenseKeyFormatting(self, S, K): """:type S: str :type K: int :rtype: str""" <|body_0|> def licenseKeyFormatting2(self, S, K): """:type S: str :type K: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not S: ...
stack_v2_sparse_classes_10k_train_008593
2,168
no_license
[ { "docstring": ":type S: str :type K: int :rtype: str", "name": "licenseKeyFormatting", "signature": "def licenseKeyFormatting(self, S, K)" }, { "docstring": ":type S: str :type K: int :rtype: str", "name": "licenseKeyFormatting2", "signature": "def licenseKeyFormatting2(self, S, K)" }...
2
stack_v2_sparse_classes_30k_train_004503
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def licenseKeyFormatting(self, S, K): :type S: str :type K: int :rtype: str - def licenseKeyFormatting2(self, S, K): :type S: str :type K: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def licenseKeyFormatting(self, S, K): :type S: str :type K: int :rtype: str - def licenseKeyFormatting2(self, S, K): :type S: str :type K: int :rtype: str <|skeleton|> class Sol...
11d6bf2ba7b50c07e048df37c4e05c8f46b92241
<|skeleton|> class Solution: def licenseKeyFormatting(self, S, K): """:type S: str :type K: int :rtype: str""" <|body_0|> def licenseKeyFormatting2(self, S, K): """:type S: str :type K: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def licenseKeyFormatting(self, S, K): """:type S: str :type K: int :rtype: str""" if not S: return '' contents = S.upper().replace('-', '') res = '' for id in range(0, len(contents), K): res += contents[id:id + K] if len(con...
the_stack_v2_python_sparse
LeetCodes/Google/LicenseKeyFormatting.py
chutianwen/LeetCodes
train
0
f1477ea164b86833503dea253bee3313020ad4a9
[ "res = 0\ncount = 0\nfor ch in s:\n if ch == 'R':\n count += 1\n else:\n count -= 1\n if count == 0:\n res += 1\nreturn res", "if not s:\n return 0\nres = 0\nstackL = stackR = []\nnumL = numR = 0\nfor ch in s:\n if numL and numR and (numL == numR):\n res += 1\n st...
<|body_start_0|> res = 0 count = 0 for ch in s: if ch == 'R': count += 1 else: count -= 1 if count == 0: res += 1 return res <|end_body_0|> <|body_start_1|> if not s: return 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 count = 0 for ch in s: ...
stack_v2_sparse_classes_10k_train_008594
1,699
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit", "signature": "def balancedStringSplit(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit2", "signature": "def balancedStringSplit2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_000535
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit(self, s): :type s: str :rtype: int - def balancedStringSplit2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit(self, s): :type s: str :rtype: int - def balancedStringSplit2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def balancedStringSpli...
690b685048c8e89d26047b6bc48b5f9af7d59cbb
<|skeleton|> class Solution: def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def balancedStringSplit(self, s): """:type s: str :rtype: int""" res = 0 count = 0 for ch in s: if ch == 'R': count += 1 else: count -= 1 if count == 0: res += 1 return res ...
the_stack_v2_python_sparse
贪心/1221. 分割平衡字符串.py
SimmonsChen/LeetCode
train
0
76cab94880e642b3ad4a04f58dc67d98c5a8ec08
[ "for field in self.fields:\n if not field in self.UPDATE_FIELDS:\n if isinstance(self.fields[field], forms.ChoiceField):\n self.fields[field] = forms.CharField()\n self.fields[field].widget.attrs['readonly'] = True\nreturn self", "data = self.cleaned_data.copy()\nfor key in list(data.k...
<|body_start_0|> for field in self.fields: if not field in self.UPDATE_FIELDS: if isinstance(self.fields[field], forms.ChoiceField): self.fields[field] = forms.CharField() self.fields[field].widget.attrs['readonly'] = True return self <|end...
Custom base class for forms that need to support updating a subset of the field used to create the object
UpdateForm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateForm: """Custom base class for forms that need to support updating a subset of the field used to create the object""" def is_update(self): """Mark all fields not listed in UPDATE_FIELDS as readonly""" <|body_0|> def cleaned_update_data(self): """Get cleaned...
stack_v2_sparse_classes_10k_train_008595
12,765
permissive
[ { "docstring": "Mark all fields not listed in UPDATE_FIELDS as readonly", "name": "is_update", "signature": "def is_update(self)" }, { "docstring": "Get cleaned_data with only the keys listed in UPDATE_FIELDS", "name": "cleaned_update_data", "signature": "def cleaned_update_data(self)" ...
2
stack_v2_sparse_classes_30k_train_004785
Implement the Python class `UpdateForm` described below. Class description: Custom base class for forms that need to support updating a subset of the field used to create the object Method signatures and docstrings: - def is_update(self): Mark all fields not listed in UPDATE_FIELDS as readonly - def cleaned_update_da...
Implement the Python class `UpdateForm` described below. Class description: Custom base class for forms that need to support updating a subset of the field used to create the object Method signatures and docstrings: - def is_update(self): Mark all fields not listed in UPDATE_FIELDS as readonly - def cleaned_update_da...
c2e26d272bd7b8d54abdc2948193163537e31291
<|skeleton|> class UpdateForm: """Custom base class for forms that need to support updating a subset of the field used to create the object""" def is_update(self): """Mark all fields not listed in UPDATE_FIELDS as readonly""" <|body_0|> def cleaned_update_data(self): """Get cleaned...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateForm: """Custom base class for forms that need to support updating a subset of the field used to create the object""" def is_update(self): """Mark all fields not listed in UPDATE_FIELDS as readonly""" for field in self.fields: if not field in self.UPDATE_FIELDS: ...
the_stack_v2_python_sparse
django/mgmt/forms.py
jhuapl-boss/boss
train
20
0ddf629e462e6c0c541431709afac395813c010b
[ "path = []\nif root is None:\n return path\nstack = []\nstack.append(root)\nwhile stack:\n root = stack.pop()\n path.append(root.val)\n if root.right is not None:\n stack.append(root.right)\n if root.left is not None:\n stack.append(root.left)\nreturn path", "path = []\nif root is Non...
<|body_start_0|> path = [] if root is None: return path stack = [] stack.append(root) while stack: root = stack.pop() path.append(root.val) if root.right is not None: stack.append(root.right) if root.left...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def inorderTraversal(self, root): """:type root: Tree...
stack_v2_sparse_classes_10k_train_008596
3,018
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "postorderTraversal", "signature": "def postorderTraversal(self, root)" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def inorderTraversal(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def inorderTraversal(self...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def inorderTraversal(self, root): """:type root: Tree...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" path = [] if root is None: return path stack = [] stack.append(root) while stack: root = stack.pop() path.append(root.val) i...
the_stack_v2_python_sparse
binary_tree_traversals_using_stack/solution.py
kimmyoo/python_leetcode
train
1
7c9ff0b45db87c652e3861d436b59f59a5344f3d
[ "self.key = key\nself.subjectid = subjectid\nself.region_ids = set([])\nself.set_regions()", "d = _dictp(JSON_FILE)\nregions = d.getp(self.key).get('regions')\nfor key, region in regions.items():\n assert isinstance(region, dict)\n if self.subjectid is None:\n self.region_ids.add(key)\n else:\n ...
<|body_start_0|> self.key = key self.subjectid = subjectid self.region_ids = set([]) self.set_regions() <|end_body_0|> <|body_start_1|> d = _dictp(JSON_FILE) regions = d.getp(self.key).get('regions') for key, region in regions.items(): assert isinstan...
really a fish object, has many regions Should not be accessed directly. Iterate through the Images class subjects_generator. If no subjectid is used to initialise the class, then the iterator will ignore subject assignmensts, ie all regions are treated as belonging to the same subject (fish)
Subject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subject: """really a fish object, has many regions Should not be accessed directly. Iterate through the Images class subjects_generator. If no subjectid is used to initialise the class, then the iterator will ignore subject assignmensts, ie all regions are treated as belonging to the same subject...
stack_v2_sparse_classes_10k_train_008597
28,538
no_license
[ { "docstring": "(str, str) Key is the unique key for the image, subjectid is set as an integer to uniquely identify a subject", "name": "__init__", "signature": "def __init__(self, key, subjectid=None)" }, { "docstring": "Checks all regions defined on the image, regions which are defined on the ...
3
stack_v2_sparse_classes_30k_train_000505
Implement the Python class `Subject` described below. Class description: really a fish object, has many regions Should not be accessed directly. Iterate through the Images class subjects_generator. If no subjectid is used to initialise the class, then the iterator will ignore subject assignmensts, ie all regions are t...
Implement the Python class `Subject` described below. Class description: really a fish object, has many regions Should not be accessed directly. Iterate through the Images class subjects_generator. If no subjectid is used to initialise the class, then the iterator will ignore subject assignmensts, ie all regions are t...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class Subject: """really a fish object, has many regions Should not be accessed directly. Iterate through the Images class subjects_generator. If no subjectid is used to initialise the class, then the iterator will ignore subject assignmensts, ie all regions are treated as belonging to the same subject...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Subject: """really a fish object, has many regions Should not be accessed directly. Iterate through the Images class subjects_generator. If no subjectid is used to initialise the class, then the iterator will ignore subject assignmensts, ie all regions are treated as belonging to the same subject (fish)""" ...
the_stack_v2_python_sparse
opencvlib/imgpipes/vgg.py
gmonkman/python
train
0
2f020423c3c538a19808b68d7e34b1b48d39980b
[ "if not nums:\n return 0\nif len(nums) == 1:\n return 1\nans = 0\ntemp = [[] for _ in nums]\nfor i in range(len(nums) - 1):\n count = 0\n for j in range(ans):\n if nums[i] < max(temp[j]):\n count += 1\n else:\n break\n temp[count].append(nums[i])\n if count == a...
<|body_start_0|> if not nums: return 0 if len(nums) == 1: return 1 ans = 0 temp = [[] for _ in nums] for i in range(len(nums) - 1): count = 0 for j in range(ans): if nums[i] < max(temp[j]): count ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 if...
stack_v2_sparse_classes_10k_train_008598
1,564
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS2", "signature": "def lengthOfLIS2(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS2(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(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 lengthOfLIS2(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def lengthOfLI...
690b685048c8e89d26047b6bc48b5f9af7d59cbb
<|skeleton|> class Solution: def lengthOfLIS2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS2(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 if len(nums) == 1: return 1 ans = 0 temp = [[] for _ in nums] for i in range(len(nums) - 1): count = 0 for j in ...
the_stack_v2_python_sparse
哈希表/300. 最长上升子序列.py
SimmonsChen/LeetCode
train
0
1302e58baa08a2603260d5c737a9804ae140fa9a
[ "current_node = self.head\nwhile current_node is not None:\n if current_node.value[0] == key:\n return current_node.value[1]\n current_node = current_node.next_value\nreturn None", "if self.head is not None:\n current_node = self.head\n idx = 0\n while current_node is not None:\n if c...
<|body_start_0|> current_node = self.head while current_node is not None: if current_node.value[0] == key: return current_node.value[1] current_node = current_node.next_value return None <|end_body_0|> <|body_start_1|> if self.head is not None: ...
This class describes nodes for Hash Table
HashNodeList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashNodeList: """This class describes nodes for Hash Table""" def check_node_exist(self, key): """This method checks node exist in Hash Table""" <|body_0|> def delete_node(self, key): """This method removes node of Hash Table by key""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k_train_008599
2,293
no_license
[ { "docstring": "This method checks node exist in Hash Table", "name": "check_node_exist", "signature": "def check_node_exist(self, key)" }, { "docstring": "This method removes node of Hash Table by key", "name": "delete_node", "signature": "def delete_node(self, key)" } ]
2
stack_v2_sparse_classes_30k_train_002740
Implement the Python class `HashNodeList` described below. Class description: This class describes nodes for Hash Table Method signatures and docstrings: - def check_node_exist(self, key): This method checks node exist in Hash Table - def delete_node(self, key): This method removes node of Hash Table by key
Implement the Python class `HashNodeList` described below. Class description: This class describes nodes for Hash Table Method signatures and docstrings: - def check_node_exist(self, key): This method checks node exist in Hash Table - def delete_node(self, key): This method removes node of Hash Table by key <|skelet...
9e9fd6583ef4f586c3b4d8cae06c23bdff89c35a
<|skeleton|> class HashNodeList: """This class describes nodes for Hash Table""" def check_node_exist(self, key): """This method checks node exist in Hash Table""" <|body_0|> def delete_node(self, key): """This method removes node of Hash Table by key""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HashNodeList: """This class describes nodes for Hash Table""" def check_node_exist(self, key): """This method checks node exist in Hash Table""" current_node = self.head while current_node is not None: if current_node.value[0] == key: return current_nod...
the_stack_v2_python_sparse
data_structures/basic_data_structure/hash_table.py
Mariia-Kosorotykova/python-education
train
0