blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
8bfb89f555e4c86c8fcb3d7a40f5e305e55e39ab
[ "has_lot_seq = lot_num is not None and sequence_num is not None\nowner_entropy = _Bip38EcUtils.OwnerEntropyWithLotSeq(lot_num, sequence_num) if has_lot_seq else _Bip38EcUtils.OwnerEntropyNoLotSeq()\npassfactor = _Bip38EcUtils.PassFactor(passphrase, owner_entropy, has_lot_seq)\npasspoint = _Bip38EcUtils.PassPoint(pa...
<|body_start_0|> has_lot_seq = lot_num is not None and sequence_num is not None owner_entropy = _Bip38EcUtils.OwnerEntropyWithLotSeq(lot_num, sequence_num) if has_lot_seq else _Bip38EcUtils.OwnerEntropyNoLotSeq() passfactor = _Bip38EcUtils.PassFactor(passphrase, owner_entropy, has_lot_seq) ...
BIP38 keys generator class. It generates intermediate codes and private keys using the algorithm specified in BIP38 with EC multiplication.
Bip38EcKeysGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bip38EcKeysGenerator: """BIP38 keys generator class. It generates intermediate codes and private keys using the algorithm specified in BIP38 with EC multiplication.""" def GenerateIntermediatePassphrase(passphrase: str, lot_num: Optional[int]=None, sequence_num: Optional[int]=None) -> str: ...
stack_v2_sparse_classes_75kplus_train_000900
20,821
permissive
[ { "docstring": "Generate an intermediate passphrase from the user passphrase as specified in BIP38. Args: passphrase (str) : Passphrase lot_num (int, optional) : Lot number sequence_num (int, optional): Sequence number Returns: str: Intermediate passphrase encoded in base58", "name": "GenerateIntermediatePa...
4
stack_v2_sparse_classes_30k_train_051064
Implement the Python class `Bip38EcKeysGenerator` described below. Class description: BIP38 keys generator class. It generates intermediate codes and private keys using the algorithm specified in BIP38 with EC multiplication. Method signatures and docstrings: - def GenerateIntermediatePassphrase(passphrase: str, lot_...
Implement the Python class `Bip38EcKeysGenerator` described below. Class description: BIP38 keys generator class. It generates intermediate codes and private keys using the algorithm specified in BIP38 with EC multiplication. Method signatures and docstrings: - def GenerateIntermediatePassphrase(passphrase: str, lot_...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class Bip38EcKeysGenerator: """BIP38 keys generator class. It generates intermediate codes and private keys using the algorithm specified in BIP38 with EC multiplication.""" def GenerateIntermediatePassphrase(passphrase: str, lot_num: Optional[int]=None, sequence_num: Optional[int]=None) -> str: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bip38EcKeysGenerator: """BIP38 keys generator class. It generates intermediate codes and private keys using the algorithm specified in BIP38 with EC multiplication.""" def GenerateIntermediatePassphrase(passphrase: str, lot_num: Optional[int]=None, sequence_num: Optional[int]=None) -> str: """Gen...
the_stack_v2_python_sparse
bip_utils/bip/bip38/bip38_ec.py
ebellocchia/bip_utils
train
244
056976f8bdf1d4dfa3e0c2c25b3932d3f4a73a6b
[ "audiofiletype_serializer = self.serializer_class(data=self.request.data)\naudiofiletype_serializer.is_valid(raise_exception=True)\naudiofiletype = audiofiletype_serializer.validated_data['audiofiletype']\nreturn self.audio_type_serializer_model_mapping[audiofiletype]['serializer']", "serializer_class = self.get_...
<|body_start_0|> audiofiletype_serializer = self.serializer_class(data=self.request.data) audiofiletype_serializer.is_valid(raise_exception=True) audiofiletype = audiofiletype_serializer.validated_data['audiofiletype'] return self.audio_type_serializer_model_mapping[audiofiletype]['seria...
Create an Audio File Record in the specified audio type
AudioFileCreateAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioFileCreateAPIView: """Create an Audio File Record in the specified audio type""" def get_serializer_class(self): """Check which audiofiletype is passed and choose a serializer for the same from the defined mapping""" <|body_0|> def create(self, request, *args, **kwa...
stack_v2_sparse_classes_75kplus_train_000901
2,418
no_license
[ { "docstring": "Check which audiofiletype is passed and choose a serializer for the same from the defined mapping", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Create a record in table of the deduced audiofiletype", "name": "create", "...
2
stack_v2_sparse_classes_30k_train_000355
Implement the Python class `AudioFileCreateAPIView` described below. Class description: Create an Audio File Record in the specified audio type Method signatures and docstrings: - def get_serializer_class(self): Check which audiofiletype is passed and choose a serializer for the same from the defined mapping - def cr...
Implement the Python class `AudioFileCreateAPIView` described below. Class description: Create an Audio File Record in the specified audio type Method signatures and docstrings: - def get_serializer_class(self): Check which audiofiletype is passed and choose a serializer for the same from the defined mapping - def cr...
55ebdc0ae27f3e1dbf2be98ec8b8248a23111d4a
<|skeleton|> class AudioFileCreateAPIView: """Create an Audio File Record in the specified audio type""" def get_serializer_class(self): """Check which audiofiletype is passed and choose a serializer for the same from the defined mapping""" <|body_0|> def create(self, request, *args, **kwa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AudioFileCreateAPIView: """Create an Audio File Record in the specified audio type""" def get_serializer_class(self): """Check which audiofiletype is passed and choose a serializer for the same from the defined mapping""" audiofiletype_serializer = self.serializer_class(data=self.request....
the_stack_v2_python_sparse
src/core/views.py
vishaltanwar96/audio-file-api
train
1
2fea7567d11e9044b1ac6cf5d4bc9abb56cd4536
[ "if cls.app is None:\n cls.app = lux.App(cls.config_file, **cls.config_params)\nreturn cls.app", "out = out or Stream()\napp = self.application()\ncmd = app.get_command(command, stdout=out)\nself.assertTrue(cmd.logger)\nself.assertEqual(cmd.name, command)\nreturn cmd" ]
<|body_start_0|> if cls.app is None: cls.app = lux.App(cls.config_file, **cls.config_params) return cls.app <|end_body_0|> <|body_start_1|> out = out or Stream() app = self.application() cmd = app.get_command(command, stdout=out) self.assertTrue(cmd.logger) ...
TestCase class for lux tests. It provides several utilities methods.
TestCase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCase: """TestCase class for lux tests. It provides several utilities methods.""" def application(cls): """Return an application for testing. Override if needed.""" <|body_0|> def fetch_command(self, command, out=None): """Fetch a command.""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_000902
1,586
permissive
[ { "docstring": "Return an application for testing. Override if needed.", "name": "application", "signature": "def application(cls)" }, { "docstring": "Fetch a command.", "name": "fetch_command", "signature": "def fetch_command(self, command, out=None)" } ]
2
stack_v2_sparse_classes_30k_train_023092
Implement the Python class `TestCase` described below. Class description: TestCase class for lux tests. It provides several utilities methods. Method signatures and docstrings: - def application(cls): Return an application for testing. Override if needed. - def fetch_command(self, command, out=None): Fetch a command.
Implement the Python class `TestCase` described below. Class description: TestCase class for lux tests. It provides several utilities methods. Method signatures and docstrings: - def application(cls): Return an application for testing. Override if needed. - def fetch_command(self, command, out=None): Fetch a command....
b30062268104bc9350b5ed36a6f5fe070eca4cf7
<|skeleton|> class TestCase: """TestCase class for lux tests. It provides several utilities methods.""" def application(cls): """Return an application for testing. Override if needed.""" <|body_0|> def fetch_command(self, command, out=None): """Fetch a command.""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCase: """TestCase class for lux tests. It provides several utilities methods.""" def application(cls): """Return an application for testing. Override if needed.""" if cls.app is None: cls.app = lux.App(cls.config_file, **cls.config_params) return cls.app def f...
the_stack_v2_python_sparse
lux/utils/test.py
pombredanne/lux
train
0
9f44765518ce70b7b0adc98269f254e02d652436
[ "if request.user.has_perm(VIEW_TEAMTYPE):\n group_types = TeamType.objects.all()\n serializer = TeamTypeSerializer(group_types, many=True)\n return Response(serializer.data)\nelse:\n return Response(status=status.HTTP_401_UNAUTHORIZED)", "if request.user.has_perm(ADD_TEAMTYPE):\n serializer = TeamT...
<|body_start_0|> if request.user.has_perm(VIEW_TEAMTYPE): group_types = TeamType.objects.all() serializer = TeamTypeSerializer(group_types, many=True) return Response(serializer.data) else: return Response(status=status.HTTP_401_UNAUTHORIZED) <|end_body_0|...
# List all the team types or create a new one. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all team types and return the data POST request : - create a new team type, send HTTP 201. If the request is not valid, send HTTP 400. ...
TeamTypesList
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamTypesList: """# List all the team types or create a new one. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all team types and return the data POST request : - create a new team type, send HTTP 201. If ...
stack_v2_sparse_classes_75kplus_train_000903
6,650
permissive
[ { "docstring": "docstring.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "docstring.", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_032186
Implement the Python class `TeamTypesList` described below. Class description: # List all the team types or create a new one. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all team types and return the data POST request : - cre...
Implement the Python class `TeamTypesList` described below. Class description: # List all the team types or create a new one. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all team types and return the data POST request : - cre...
56511ebac83a5dc1fb8768a98bc675e88530a447
<|skeleton|> class TeamTypesList: """# List all the team types or create a new one. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all team types and return the data POST request : - create a new team type, send HTTP 201. If ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TeamTypesList: """# List all the team types or create a new one. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all team types and return the data POST request : - create a new team type, send HTTP 201. If the request i...
the_stack_v2_python_sparse
usersmanagement/views/views_teamtypes.py
Open-CMMS/openCMMS_backend
train
4
21958b9c814a63786afc44eaccdbcdff6ffead09
[ "store = []\n\ndef inorder(node):\n if not node:\n return\n store.append(str(node.val))\n if node.left:\n inorder(node.left)\n if node.right:\n inorder(node.right)\ninorder(root)\nprint(store)\nreturn '-'.join(store)", "def insert(root, node):\n if not root:\n return Tre...
<|body_start_0|> store = [] def inorder(node): if not node: return store.append(str(node.val)) if node.left: inorder(node.left) if node.right: inorder(node.right) inorder(root) print(store) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> store = [] ...
stack_v2_sparse_classes_75kplus_train_000904
1,550
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_050926
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
f273c655f37da643a605cc5bebcda6660e702445
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" store = [] def inorder(node): if not node: return store.append(str(node.val)) if node.left: inorder(node.left) if...
the_stack_v2_python_sparse
Tree/449. Serialize and Deserialize BST(Med).py
nerohuang/LeetCode
train
0
59b209d85e5b7893cfc6be2d95712108abe8f813
[ "node_list = []\nnode = head\nwhile node:\n if node:\n node_list.append(node)\n node = node.next\nreturn node_list[len(node_list) // 2]", "slow = fast = head\nwhile fast and fast.next:\n slow = slow.next\n fast = fast.next.next\nreturn slow" ]
<|body_start_0|> node_list = [] node = head while node: if node: node_list.append(node) node = node.next return node_list[len(node_list) // 2] <|end_body_0|> <|body_start_1|> slow = fast = head while fast and fast.next: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def middleNodeArray(self, head: ListNode) -> ListNode: """链表转换数组""" <|body_0|> def middleNode(self, head: ListNode) -> List: """快慢指针""" <|body_1|> <|end_skeleton|> <|body_start_0|> node_list = [] node = head while node: ...
stack_v2_sparse_classes_75kplus_train_000905
1,239
no_license
[ { "docstring": "链表转换数组", "name": "middleNodeArray", "signature": "def middleNodeArray(self, head: ListNode) -> ListNode" }, { "docstring": "快慢指针", "name": "middleNode", "signature": "def middleNode(self, head: ListNode) -> List" } ]
2
stack_v2_sparse_classes_30k_train_007640
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def middleNodeArray(self, head: ListNode) -> ListNode: 链表转换数组 - def middleNode(self, head: ListNode) -> List: 快慢指针
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def middleNodeArray(self, head: ListNode) -> ListNode: 链表转换数组 - def middleNode(self, head: ListNode) -> List: 快慢指针 <|skeleton|> class Solution: def middleNodeArray(self, he...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def middleNodeArray(self, head: ListNode) -> ListNode: """链表转换数组""" <|body_0|> def middleNode(self, head: ListNode) -> List: """快慢指针""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def middleNodeArray(self, head: ListNode) -> ListNode: """链表转换数组""" node_list = [] node = head while node: if node: node_list.append(node) node = node.next return node_list[len(node_list) // 2] def middleNode(self, ...
the_stack_v2_python_sparse
876.链表的中间结点/solution.py
QtTao/daily_leetcode
train
0
42bd1fe6b96b363bee615d27a24cc645cfa427fe
[ "super(TaskBundleManager, self).__init__()\nself.getters.update({'name': 'get_general', 'description': 'get_general', 'tasks': 'get_tasks_from_task_bundle'})\nself.setters.update({'name': 'set_general', 'description': 'set_general', 'tasks': 'set_tasks_for_task_bundle'})\nself.my_django_model = facade.models.TaskBu...
<|body_start_0|> super(TaskBundleManager, self).__init__() self.getters.update({'name': 'get_general', 'description': 'get_general', 'tasks': 'get_tasks_from_task_bundle'}) self.setters.update({'name': 'set_general', 'description': 'set_general', 'tasks': 'set_tasks_for_task_bundle'}) se...
Manage Task Bundles in the Power Reg system
TaskBundleManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskBundleManager: """Manage Task Bundles in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, name, description, tasks): """Creates a new task bundle :param name: user-visible name of the task bundle :type name...
stack_v2_sparse_classes_75kplus_train_000906
2,310
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Creates a new task bundle :param name: user-visible name of the task bundle :type name: string :param description: description of the task bundle :type description: string :param tasks: list of...
2
stack_v2_sparse_classes_30k_train_032899
Implement the Python class `TaskBundleManager` described below. Class description: Manage Task Bundles in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, name, description, tasks): Creates a new task bundle :param name: user-visible name of the t...
Implement the Python class `TaskBundleManager` described below. Class description: Manage Task Bundles in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, name, description, tasks): Creates a new task bundle :param name: user-visible name of the t...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class TaskBundleManager: """Manage Task Bundles in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, name, description, tasks): """Creates a new task bundle :param name: user-visible name of the task bundle :type name...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskBundleManager: """Manage Task Bundles in the Power Reg system""" def __init__(self): """constructor""" super(TaskBundleManager, self).__init__() self.getters.update({'name': 'get_general', 'description': 'get_general', 'tasks': 'get_tasks_from_task_bundle'}) self.sette...
the_stack_v2_python_sparse
pr_services/credential_system/task_bundle_manager.py
ninemoreminutes/openassign-server
train
0
6886fba10bdf115c4faf2c56c6f7f24405dd76dc
[ "self.all_under_hierarchy = all_under_hierarchy\nself.compact_version = compact_version\nself.consecutive_failures = consecutive_failures\nself.environment = environment\nself.exclude_users_within_alert_threshold = exclude_users_within_alert_threshold\nself.group_by = group_by\nself.health_status = health_status\ns...
<|body_start_0|> self.all_under_hierarchy = all_under_hierarchy self.compact_version = compact_version self.consecutive_failures = consecutive_failures self.environment = environment self.exclude_users_within_alert_threshold = exclude_users_within_alert_threshold self.gro...
Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters' model. TODO: type description here. Attributes: all_under_hierarchy (bool): Specifies if subtenants of the given tenants should be considered for report generation. compact_version (string): Specifies the Cohe...
SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters: """Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters' model. TODO: type description here. Attributes: all_under_hierarchy (bool): Specifies if subten...
stack_v2_sparse_classes_75kplus_train_000907
8,990
permissive
[ { "docstring": "Constructor for the SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters class", "name": "__init__", "signature": "def __init__(self, all_under_hierarchy=None, compact_version=None, consecutive_failures=None, environment=None, exclude_users_within_alert_...
2
stack_v2_sparse_classes_30k_train_046576
Implement the Python class `SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters` described below. Class description: Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters' model. TODO: type description here. Attributes: all_unde...
Implement the Python class `SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters` described below. Class description: Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters' model. TODO: type description here. Attributes: all_unde...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters: """Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters' model. TODO: type description here. Attributes: all_under_hierarchy (bool): Specifies if subten...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters: """Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report_Parameters' model. TODO: type description here. Attributes: all_under_hierarchy (bool): Specifies if subtenants of the g...
the_stack_v2_python_sparse
cohesity_management_sdk/models/scheduler_proto_scheduler_job_schedule_job_parameters_report_job_parameter_report_parameters.py
cohesity/management-sdk-python
train
24
1e355e32f09d4aaeb7f755e55e7c95da330b3f70
[ "try:\n tree = ast.parse(expr)\nexcept SyntaxError:\n raise ValueError(_('Illegal syntax in equation'))\nself.visit(tree)", "if node.func.id in allowedFunctions:\n super().generic_visit(node)\nelse:\n raise ValueError(_('Illegal function present: {0}').format(node.func.id))", "if type(node).__name__...
<|body_start_0|> try: tree = ast.parse(expr) except SyntaxError: raise ValueError(_('Illegal syntax in equation')) self.visit(tree) <|end_body_0|> <|body_start_1|> if node.func.id in allowedFunctions: super().generic_visit(node) else: ...
Class to check that only safe functions are used in an eval expression. Raises a ValueError if unsafe or non-numeric operations are present. Ref. stackoverflow.com questions 10661079 and 12523516
SafeEvalChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SafeEvalChecker: """Class to check that only safe functions are used in an eval expression. Raises a ValueError if unsafe or non-numeric operations are present. Ref. stackoverflow.com questions 10661079 and 12523516""" def check(self, expr): """Check the given expression for non-nume...
stack_v2_sparse_classes_75kplus_train_000908
21,625
no_license
[ { "docstring": "Check the given expression for non-numeric operations. Arguments: expr -- the expression string to check", "name": "check", "signature": "def check(self, expr)" }, { "docstring": "Check for allowed functions only. Arguments: node -- the ast node being checked", "name": "visit...
3
stack_v2_sparse_classes_30k_train_037720
Implement the Python class `SafeEvalChecker` described below. Class description: Class to check that only safe functions are used in an eval expression. Raises a ValueError if unsafe or non-numeric operations are present. Ref. stackoverflow.com questions 10661079 and 12523516 Method signatures and docstrings: - def c...
Implement the Python class `SafeEvalChecker` described below. Class description: Class to check that only safe functions are used in an eval expression. Raises a ValueError if unsafe or non-numeric operations are present. Ref. stackoverflow.com questions 10661079 and 12523516 Method signatures and docstrings: - def c...
c9429496e8ed15116746a23f3a90f262cf54f755
<|skeleton|> class SafeEvalChecker: """Class to check that only safe functions are used in an eval expression. Raises a ValueError if unsafe or non-numeric operations are present. Ref. stackoverflow.com questions 10661079 and 12523516""" def check(self, expr): """Check the given expression for non-nume...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SafeEvalChecker: """Class to check that only safe functions are used in an eval expression. Raises a ValueError if unsafe or non-numeric operations are present. Ref. stackoverflow.com questions 10661079 and 12523516""" def check(self, expr): """Check the given expression for non-numeric operation...
the_stack_v2_python_sparse
source/matheval.py
doug-101/TreeLine
train
121
82f08ea102e9fdd8022048f6cca8fbabbf4324f3
[ "n = len(nums)\nif n == 0:\n return 0\ndp = [0] * n\ndp[0] = 1\nmax_len = 1\nfor i in range(1, n):\n max_val = 0\n for j in range(i):\n if nums[i] > nums[j]:\n max_val = max(max_val, dp[j])\n dp[i] = max_val + 1\n max_len = max(max_len, dp[i])\nreturn max_len", "n = len(nums)\nif ...
<|body_start_0|> n = len(nums) if n == 0: return 0 dp = [0] * n dp[0] = 1 max_len = 1 for i in range(1, n): max_val = 0 for j in range(i): if nums[i] > nums[j]: max_val = max(max_val, dp[j]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """input| nums: List[int] output| int""" <|body_0|> def lengthOfLIS_bisec(self, nums): """input| nums: List[int] output| int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) if n == 0: ...
stack_v2_sparse_classes_75kplus_train_000909
1,740
no_license
[ { "docstring": "input| nums: List[int] output| int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": "input| nums: List[int] output| int", "name": "lengthOfLIS_bisec", "signature": "def lengthOfLIS_bisec(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_053167
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): input| nums: List[int] output| int - def lengthOfLIS_bisec(self, nums): input| nums: List[int] output| int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): input| nums: List[int] output| int - def lengthOfLIS_bisec(self, nums): input| nums: List[int] output| int <|skeleton|> class Solution: def len...
8290ad1c763d9f7c7f7bed63426b4769b34fd2fc
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """input| nums: List[int] output| int""" <|body_0|> def lengthOfLIS_bisec(self, nums): """input| nums: List[int] output| int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lengthOfLIS(self, nums): """input| nums: List[int] output| int""" n = len(nums) if n == 0: return 0 dp = [0] * n dp[0] = 1 max_len = 1 for i in range(1, n): max_val = 0 for j in range(i): ...
the_stack_v2_python_sparse
dp_300_lengthOfLIS.py
screnary/Algorithm_python
train
0
a79e5de7854b46710b57fcd83a8dabe7b0b69fe7
[ "self.user = user\nself.auth = passwordMD5\nself.enc = passwordDES\nself.host = host\nself.port = port", "if number:\n oid += '.' + str(number)\ntry:\n errorIndication, errorStatus, errorIndex, varBinds = next(getCmd(SnmpEngine(), UsmUserData(self.user, self.auth, self.enc), UdpTransportTarget((self.host, s...
<|body_start_0|> self.user = user self.auth = passwordMD5 self.enc = passwordDES self.host = host self.port = port <|end_body_0|> <|body_start_1|> if number: oid += '.' + str(number) try: errorIndication, errorStatus, errorIndex, varBinds ...
SnmpWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnmpWrapper: def __init__(self, host, user, passwordMD5, passwordDES, port=161): """Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used...
stack_v2_sparse_classes_75kplus_train_000910
7,826
permissive
[ { "docstring": "Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used for the snmp connection :type port: int :param user: User used for the snmp connection :typ...
3
stack_v2_sparse_classes_30k_test_000975
Implement the Python class `SnmpWrapper` described below. Class description: Implement the SnmpWrapper class. Method signatures and docstrings: - def __init__(self, host, user, passwordMD5, passwordDES, port=161): Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification a...
Implement the Python class `SnmpWrapper` described below. Class description: Implement the SnmpWrapper class. Method signatures and docstrings: - def __init__(self, host, user, passwordMD5, passwordDES, port=161): Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification a...
e4c552023334f709b9586f664b7e049036133d33
<|skeleton|> class SnmpWrapper: def __init__(self, host, user, passwordMD5, passwordDES, port=161): """Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SnmpWrapper: def __init__(self, host, user, passwordMD5, passwordDES, port=161): """Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used for the snmp ...
the_stack_v2_python_sparse
src/insalata/helper/SnmpWrapper.py
tumi8/INSALATA
train
6
f2ab0baafcf21bf6dc1e3bfda234c637c301cbf3
[ "tag_slug = slug.capitalize()\ntry:\n tag = Tag.objects.get(TagSlug=tag_slug)\nexcept:\n self.NOT_FOUND_RESP = Response({tag_slug: 'Tag Not Found'}, status=status.HTTP_404_NOT_FOUND)\n return None\nreturn tag", "tag = self.get_object(slug)\nif tag is None:\n return self.NOT_FOUND_RESP\nserializer = Ta...
<|body_start_0|> tag_slug = slug.capitalize() try: tag = Tag.objects.get(TagSlug=tag_slug) except: self.NOT_FOUND_RESP = Response({tag_slug: 'Tag Not Found'}, status=status.HTTP_404_NOT_FOUND) return None return tag <|end_body_0|> <|body_start_1|> ...
Inhereits APIView class to encapsulate Read(GET), Update(PUT) and Delete(DELETE) operations on the model/table Tag given a specific tag id(unique) or tag name (unique).
TagViewForSlug
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagViewForSlug: """Inhereits APIView class to encapsulate Read(GET), Update(PUT) and Delete(DELETE) operations on the model/table Tag given a specific tag id(unique) or tag name (unique).""" def get_object(self, slug): """Fetch an instance based on its primary key ie slug from the Ta...
stack_v2_sparse_classes_75kplus_train_000911
20,756
no_license
[ { "docstring": "Fetch an instance based on its primary key ie slug from the Tag table If not found return None :param id: slug of the instance which needs to be fetched :return: Tag instance with given tag_slug. If not found returns None", "name": "get_object", "signature": "def get_object(self, slug)" ...
4
null
Implement the Python class `TagViewForSlug` described below. Class description: Inhereits APIView class to encapsulate Read(GET), Update(PUT) and Delete(DELETE) operations on the model/table Tag given a specific tag id(unique) or tag name (unique). Method signatures and docstrings: - def get_object(self, slug): Fetch...
Implement the Python class `TagViewForSlug` described below. Class description: Inhereits APIView class to encapsulate Read(GET), Update(PUT) and Delete(DELETE) operations on the model/table Tag given a specific tag id(unique) or tag name (unique). Method signatures and docstrings: - def get_object(self, slug): Fetch...
83d4abe6966f0ed51b288b3910b4dc28e564af0a
<|skeleton|> class TagViewForSlug: """Inhereits APIView class to encapsulate Read(GET), Update(PUT) and Delete(DELETE) operations on the model/table Tag given a specific tag id(unique) or tag name (unique).""" def get_object(self, slug): """Fetch an instance based on its primary key ie slug from the Ta...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TagViewForSlug: """Inhereits APIView class to encapsulate Read(GET), Update(PUT) and Delete(DELETE) operations on the model/table Tag given a specific tag id(unique) or tag name (unique).""" def get_object(self, slug): """Fetch an instance based on its primary key ie slug from the Tag table If no...
the_stack_v2_python_sparse
NGKARTAPI/product/views.py
SmrutiRanjan-Ai/django
train
0
d5604ada7e78e07f2205c8a5118f62c18e8075e2
[ "interpolation = EnvironmentAwareInterpolation()\nkwargs['interpolation'] = interpolation\nConfigParser.__init__(self, *args, **kwargs)", "result = ConfigParser.read(self, filenames)\nfor section in self.sections():\n original_section = section\n matches = self.r.search(section)\n while matches:\n ...
<|body_start_0|> interpolation = EnvironmentAwareInterpolation() kwargs['interpolation'] = interpolation ConfigParser.__init__(self, *args, **kwargs) <|end_body_0|> <|body_start_1|> result = ConfigParser.read(self, filenames) for section in self.sections(): original_...
A subclass of ConfigParser which allows %env:VAR% interpolation via the get method.
EnvironmentAwareConfigParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentAwareConfigParser: """A subclass of ConfigParser which allows %env:VAR% interpolation via the get method.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Init with our specific interpolation class (for Python 3)""" <|body_0|> def read(self, filena...
stack_v2_sparse_classes_75kplus_train_000912
2,766
permissive
[ { "docstring": "Init with our specific interpolation class (for Python 3)", "name": "__init__", "signature": "def __init__(self, *args: Any, **kwargs: Any) -> None" }, { "docstring": "Load a config file and do environment variable interpolation on the section names.", "name": "read", "si...
2
stack_v2_sparse_classes_30k_train_010639
Implement the Python class `EnvironmentAwareConfigParser` described below. Class description: A subclass of ConfigParser which allows %env:VAR% interpolation via the get method. Method signatures and docstrings: - def __init__(self, *args: Any, **kwargs: Any) -> None: Init with our specific interpolation class (for P...
Implement the Python class `EnvironmentAwareConfigParser` described below. Class description: A subclass of ConfigParser which allows %env:VAR% interpolation via the get method. Method signatures and docstrings: - def __init__(self, *args: Any, **kwargs: Any) -> None: Init with our specific interpolation class (for P...
925cb9802c55a6da1c75eb946c2cee47b9c522fc
<|skeleton|> class EnvironmentAwareConfigParser: """A subclass of ConfigParser which allows %env:VAR% interpolation via the get method.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Init with our specific interpolation class (for Python 3)""" <|body_0|> def read(self, filena...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EnvironmentAwareConfigParser: """A subclass of ConfigParser which allows %env:VAR% interpolation via the get method.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Init with our specific interpolation class (for Python 3)""" interpolation = EnvironmentAwareInterpolation() ...
the_stack_v2_python_sparse
simplemonitor/util/envconfig.py
jamesoff/simplemonitor
train
412
88e125f438ae3090f38e8b5781fbac7aa9b9bb5a
[ "N = len(s)\nif N == 0:\n return ''\nP = [[False for _ in range(N)] for _ in range(N)]\nmaxLen = 1\nstart = 0\nfor i in range(N):\n if i + 1 < N and s[i] == s[i + 1]:\n P[i][i + 1] = True\n start = i\n maxLen = 2\n P[i][i] = True\ni = 0\nj = 2\nwhile j < N:\n ii, jj = (i, j)\n wh...
<|body_start_0|> N = len(s) if N == 0: return '' P = [[False for _ in range(N)] for _ in range(N)] maxLen = 1 start = 0 for i in range(N): if i + 1 < N and s[i] == s[i + 1]: P[i][i + 1] = True start = i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """中心扩展法""" <|body_1|> <|end_skeleton|> <|body_start_0|> N = len(s) if N == 0: return '' P = [[False for...
stack_v2_sparse_classes_75kplus_train_000913
1,978
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": "中心扩展法", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_027701
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): 中心扩展法
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): 中心扩展法 <|skeleton|> class Solution: def longestPalindrome(self, s): """:t...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """中心扩展法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" N = len(s) if N == 0: return '' P = [[False for _ in range(N)] for _ in range(N)] maxLen = 1 start = 0 for i in range(N): if i + 1 < N and s[i] == s[i + 1]: ...
the_stack_v2_python_sparse
字节/最长回文子串.py
2226171237/Algorithmpractice
train
0
d8a8fff0da5e5825219ba76be5d2832f41b8caee
[ "self.master = master\nself.mode = Tk.StringVar()\nself.mode_list = ['Create Level', 'Edit Existing Level']\nself.mode_string = ''\nself.lw = Tk.StringVar()\nself.newFrame = None\nself.createWidgets()", "textLabel = Tk.Label(self.master, text='Select Editor Mode:')\ndropDown = Tk.OptionMenu(self.master, self.mode...
<|body_start_0|> self.master = master self.mode = Tk.StringVar() self.mode_list = ['Create Level', 'Edit Existing Level'] self.mode_string = '' self.lw = Tk.StringVar() self.newFrame = None self.createWidgets() <|end_body_0|> <|body_start_1|> textLabel = ...
mainGUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mainGUI: def __init__(self, master): """Initialisation params: master -> root window""" <|body_0|> def createWidgets(self): """Create widgets for frontend. The widgets are: -> An OptionMenu for choosing between the NEW and EDIT modes -> A field for entering level wid...
stack_v2_sparse_classes_75kplus_train_000914
3,921
no_license
[ { "docstring": "Initialisation params: master -> root window", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Create widgets for frontend. The widgets are: -> An OptionMenu for choosing between the NEW and EDIT modes -> A field for entering level width -> Variou...
6
stack_v2_sparse_classes_30k_train_025938
Implement the Python class `mainGUI` described below. Class description: Implement the mainGUI class. Method signatures and docstrings: - def __init__(self, master): Initialisation params: master -> root window - def createWidgets(self): Create widgets for frontend. The widgets are: -> An OptionMenu for choosing betw...
Implement the Python class `mainGUI` described below. Class description: Implement the mainGUI class. Method signatures and docstrings: - def __init__(self, master): Initialisation params: master -> root window - def createWidgets(self): Create widgets for frontend. The widgets are: -> An OptionMenu for choosing betw...
b5ef6160b958ece204edf68bad21f8ae39441fa7
<|skeleton|> class mainGUI: def __init__(self, master): """Initialisation params: master -> root window""" <|body_0|> def createWidgets(self): """Create widgets for frontend. The widgets are: -> An OptionMenu for choosing between the NEW and EDIT modes -> A field for entering level wid...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class mainGUI: def __init__(self, master): """Initialisation params: master -> root window""" self.master = master self.mode = Tk.StringVar() self.mode_list = ['Create Level', 'Edit Existing Level'] self.mode_string = '' self.lw = Tk.StringVar() self.newFrame ...
the_stack_v2_python_sparse
worldShifter/levelEditor/ed_GUI.py
sanskarchand/python-projects
train
0
1e12abe768d49dc83d9be7a54e613fd872dbd4dd
[ "idx: Dict[int, Dict[str, Union[int, List[int]]]] = {}\nfor i, v in enumerate(numbers):\n if v not in idx:\n idx[v] = {'count': 1, 'index': [i]}\n else:\n idx[v]['count'] += 1\n idx[v]['index'].append(i)\nindex1, index2 = (0, 0)\nfor k in idx.keys():\n dif = target - k\n if dif in i...
<|body_start_0|> idx: Dict[int, Dict[str, Union[int, List[int]]]] = {} for i, v in enumerate(numbers): if v not in idx: idx[v] = {'count': 1, 'index': [i]} else: idx[v]['count'] += 1 idx[v]['index'].append(i) index1, index2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: """哈希表。""" <|body_0|> def twoSum2(self, numbers: List[int], target: int) -> List[int]: """二分查找。""" <|body_1|> def twoSum3(self, numbers: List[int], target: int) -> List[int]: ...
stack_v2_sparse_classes_75kplus_train_000915
4,429
no_license
[ { "docstring": "哈希表。", "name": "twoSum", "signature": "def twoSum(self, numbers: List[int], target: int) -> List[int]" }, { "docstring": "二分查找。", "name": "twoSum2", "signature": "def twoSum2(self, numbers: List[int], target: int) -> List[int]" }, { "docstring": "双指针。", "name"...
3
stack_v2_sparse_classes_30k_train_050025
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers: List[int], target: int) -> List[int]: 哈希表。 - def twoSum2(self, numbers: List[int], target: int) -> List[int]: 二分查找。 - def twoSum3(self, numbers: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers: List[int], target: int) -> List[int]: 哈希表。 - def twoSum2(self, numbers: List[int], target: int) -> List[int]: 二分查找。 - def twoSum3(self, numbers: List[in...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: """哈希表。""" <|body_0|> def twoSum2(self, numbers: List[int], target: int) -> List[int]: """二分查找。""" <|body_1|> def twoSum3(self, numbers: List[int], target: int) -> List[int]: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: """哈希表。""" idx: Dict[int, Dict[str, Union[int, List[int]]]] = {} for i, v in enumerate(numbers): if v not in idx: idx[v] = {'count': 1, 'index': [i]} else: ...
the_stack_v2_python_sparse
0167_two-sum-ii-input-array-is-sorted.py
Nigirimeshi/leetcode
train
0
f2263da1efa2f3c54374278435ca6b894b9a57de
[ "if not root:\n return 0\nnodes = [root.left, root.right]\nif not any(nodes):\n return 1\nmin_depth = float(inf)\nfor node in nodes:\n if node:\n min_depth = min(self.get_depth(node), min_depth)\nreturn min_depth", "if not root:\n return 0\nelse:\n stack, min_depth = ([(root.left, root.right...
<|body_start_0|> if not root: return 0 nodes = [root.left, root.right] if not any(nodes): return 1 min_depth = float(inf) for node in nodes: if node: min_depth = min(self.get_depth(node), min_depth) return min_depth <|en...
MinimumDepth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinimumDepth: def get_min_depth(self, root: TreeNode) -> int: """Approach: Recursion using DFS. Time Complexity: O(n) Space Complexity: O(log n) :param root: :return:""" <|body_0|> def get_min_depth_(self, root: TreeNode) -> int: """Approach: Iterative using DFS Time...
stack_v2_sparse_classes_75kplus_train_000916
1,967
no_license
[ { "docstring": "Approach: Recursion using DFS. Time Complexity: O(n) Space Complexity: O(log n) :param root: :return:", "name": "get_min_depth", "signature": "def get_min_depth(self, root: TreeNode) -> int" }, { "docstring": "Approach: Iterative using DFS Time Complexity: O(n) Space Complexity: ...
3
stack_v2_sparse_classes_30k_train_025814
Implement the Python class `MinimumDepth` described below. Class description: Implement the MinimumDepth class. Method signatures and docstrings: - def get_min_depth(self, root: TreeNode) -> int: Approach: Recursion using DFS. Time Complexity: O(n) Space Complexity: O(log n) :param root: :return: - def get_min_depth_...
Implement the Python class `MinimumDepth` described below. Class description: Implement the MinimumDepth class. Method signatures and docstrings: - def get_min_depth(self, root: TreeNode) -> int: Approach: Recursion using DFS. Time Complexity: O(n) Space Complexity: O(log n) :param root: :return: - def get_min_depth_...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class MinimumDepth: def get_min_depth(self, root: TreeNode) -> int: """Approach: Recursion using DFS. Time Complexity: O(n) Space Complexity: O(log n) :param root: :return:""" <|body_0|> def get_min_depth_(self, root: TreeNode) -> int: """Approach: Iterative using DFS Time...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MinimumDepth: def get_min_depth(self, root: TreeNode) -> int: """Approach: Recursion using DFS. Time Complexity: O(n) Space Complexity: O(log n) :param root: :return:""" if not root: return 0 nodes = [root.left, root.right] if not any(nodes): return 1 ...
the_stack_v2_python_sparse
data_structures/tree_node/min_depth_of_bt.py
Shiv2157k/leet_code
train
1
ecc3be5a2b181f74b4e1fe0bdcb3588478a0684f
[ "if isinstance(waitkeyval, tuple):\n waitkeyval = waitkeyval[0]\nif is_raw:\n i = waitkeyval & 255\nreturn KeyBoardInput._key_dic[i]", "if isinstance(waitkeyval, (tuple, dict, set)):\n for x in waitkeyval:\n if isinstance(waitkeyval, int):\n waitkeyval = x\n break\nspecial = ...
<|body_start_0|> if isinstance(waitkeyval, tuple): waitkeyval = waitkeyval[0] if is_raw: i = waitkeyval & 255 return KeyBoardInput._key_dic[i] <|end_body_0|> <|body_start_1|> if isinstance(waitkeyval, (tuple, dict, set)): for x in waitkeyval: ...
user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'
KeyBoardInput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyBoardInput: """user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'""" def get_pressed_key(waitkeyval, is_raw=True): """(int, bool) -> s...
stack_v2_sparse_classes_75kplus_train_000917
2,605
no_license
[ { "docstring": "(int, bool) -> str Pass in waitkey result, returning the string representation of the key. i: return value of waitkey is_raw: if true, is the raw return value otherwise assumes already converted to the character ord value, e.g. from view.show() Returns: string representation of keypress, also: '...
2
stack_v2_sparse_classes_30k_train_051933
Implement the Python class `KeyBoardInput` described below. Class description: user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none' Method signatures and docstrings: - def g...
Implement the Python class `KeyBoardInput` described below. Class description: user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none' Method signatures and docstrings: - def g...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class KeyBoardInput: """user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'""" def get_pressed_key(waitkeyval, is_raw=True): """(int, bool) -> s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KeyBoardInput: """user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'""" def get_pressed_key(waitkeyval, is_raw=True): """(int, bool) -> str Pass in wa...
the_stack_v2_python_sparse
opencvlib/display_utils.py
gmonkman/python
train
0
aca94b38994dc8519c694dbc68e165ce2bad0d2b
[ "if not matrix or matrix == []:\n self.n = 0\n self.m = 0\n return\nn = len(matrix)\nm = len(matrix[0])\ns = [[0] * (m + 1) for i in xrange(n + 1)]\nfor i in xrange(n):\n for j in xrange(m):\n if i == 0 and j == 0:\n s[1][1] = matrix[0][0]\n elif i == 0:\n s[1][j + 1]...
<|body_start_0|> if not matrix or matrix == []: self.n = 0 self.m = 0 return n = len(matrix) m = len(matrix[0]) s = [[0] * (m + 1) for i in xrange(n + 1)] for i in xrange(n): for j in xrange(m): if i == 0 and j == 0:...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_75kplus_train_000918
2,158
no_license
[ { "docstring": "initialize your data structure here. :type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp...
2
stack_v2_sparse_classes_30k_train_038465
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
588a86282b8cc74fa14d810eb3a532c5c3e6de81
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" if not matrix or matrix == []: self.n = 0 self.m = 0 return n = len(matrix) m = len(matrix[0]) s = [[0] * (m + 1) for i in...
the_stack_v2_python_sparse
solutions/RangeSumQuery2DImmutable.py
howardhe0329/leetcode
train
0
9e7198773e890ea71b2e20a49e20088106d647cc
[ "super(TargetGroup, self).__init__()\nself.arn = None\nself.region = vpc.region\nself.name = 'pkb-%s' % FLAGS.run_uri\nself.protocol = 'TCP'\nself.port = port\nself.vpc_id = vpc.id", "create_cmd = util.AWS_PREFIX + ['--region', self.region, 'elbv2', 'create-target-group', '--target-type', 'ip', '--name', self.nam...
<|body_start_0|> super(TargetGroup, self).__init__() self.arn = None self.region = vpc.region self.name = 'pkb-%s' % FLAGS.run_uri self.protocol = 'TCP' self.port = port self.vpc_id = vpc.id <|end_body_0|> <|body_start_1|> create_cmd = util.AWS_PREFIX + [...
Class represeting an AWS target group.
TargetGroup
[ "Classpath-exception-2.0", "BSD-3-Clause", "AGPL-3.0-only", "MIT", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TargetGroup: """Class represeting an AWS target group.""" def __init__(self, vpc, port): """Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port that the load balancer connects to.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_000919
4,687
permissive
[ { "docstring": "Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port that the load balancer connects to.", "name": "__init__", "signature": "def __init__(self, vpc, port)" }, { "docstring": "Create the target group.",...
3
stack_v2_sparse_classes_30k_train_001873
Implement the Python class `TargetGroup` described below. Class description: Class represeting an AWS target group. Method signatures and docstrings: - def __init__(self, vpc, port): Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port tha...
Implement the Python class `TargetGroup` described below. Class description: Class represeting an AWS target group. Method signatures and docstrings: - def __init__(self, vpc, port): Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port tha...
d0699f32998898757b036704fba39e5471641f01
<|skeleton|> class TargetGroup: """Class represeting an AWS target group.""" def __init__(self, vpc, port): """Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port that the load balancer connects to.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TargetGroup: """Class represeting an AWS target group.""" def __init__(self, vpc, port): """Initializes the TargetGroup object. Args: vpc: AwsVpc object which contains the targets for load balancing. port: The internal port that the load balancer connects to.""" super(TargetGroup, self)._...
the_stack_v2_python_sparse
perfkitbenchmarker/providers/aws/aws_load_balancer.py
GoogleCloudPlatform/PerfKitBenchmarker
train
1,923
029f983c1c0e3a0df9262e61b26d7df8f58ca8b1
[ "if window_size_in_steps < 1:\n raise ValueError('window_size_in_steps has to be >= 1.')\nif abs(x) <= window_size_in_steps / 2:\n return 1.0\nelse:\n return 0.0", "if window_size_in_steps < 1:\n raise ValueError('window_size_in_steps has to be >= 1.')\nreturn max(0.0, window_size_in_steps / 2 - abs(x...
<|body_start_0|> if window_size_in_steps < 1: raise ValueError('window_size_in_steps has to be >= 1.') if abs(x) <= window_size_in_steps / 2: return 1.0 else: return 0.0 <|end_body_0|> <|body_start_1|> if window_size_in_steps < 1: raise Va...
Kernel function to use for smoothing.
SmoothingKernel
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmoothingKernel: """Kernel function to use for smoothing.""" def rectangular_kernel(self, x, window_size_in_steps): """Rectangular kernel for moving window average. All values in window are equally weighted. Args: x: Distance to kernel center in steps. window_size_in_steps: Size of t...
stack_v2_sparse_classes_75kplus_train_000920
17,872
permissive
[ { "docstring": "Rectangular kernel for moving window average. All values in window are equally weighted. Args: x: Distance to kernel center in steps. window_size_in_steps: Size of the window to average over. Returns: Unnormalized weight to use for averaging, e.g. in `np.average()`. Raises: ValueError: If window...
3
null
Implement the Python class `SmoothingKernel` described below. Class description: Kernel function to use for smoothing. Method signatures and docstrings: - def rectangular_kernel(self, x, window_size_in_steps): Rectangular kernel for moving window average. All values in window are equally weighted. Args: x: Distance t...
Implement the Python class `SmoothingKernel` described below. Class description: Kernel function to use for smoothing. Method signatures and docstrings: - def rectangular_kernel(self, x, window_size_in_steps): Rectangular kernel for moving window average. All values in window are equally weighted. Args: x: Distance t...
320a49f768cea27200044c0d12f394aa6c795feb
<|skeleton|> class SmoothingKernel: """Kernel function to use for smoothing.""" def rectangular_kernel(self, x, window_size_in_steps): """Rectangular kernel for moving window average. All values in window are equally weighted. Args: x: Distance to kernel center in steps. window_size_in_steps: Size of t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SmoothingKernel: """Kernel function to use for smoothing.""" def rectangular_kernel(self, x, window_size_in_steps): """Rectangular kernel for moving window average. All values in window are equally weighted. Args: x: Distance to kernel center in steps. window_size_in_steps: Size of the window to ...
the_stack_v2_python_sparse
aqt/utils/report_utils.py
afcarl/google-research
train
1
7bd87f386cc2cd3f38d1b8a78386c0c119b0db3c
[ "self.name = name\nself.account = account\nself.balance = Decimal(0)", "if self.balance >= 0 and amount >= 0:\n self.balance = self.balance + Decimal(amount)\nelse:\n raise ValueError('balance and amount must be positive')", "if amount <= self.balance:\n self.balance -= Decimal(amount)\nelse:\n rais...
<|body_start_0|> self.name = name self.account = account self.balance = Decimal(0) <|end_body_0|> <|body_start_1|> if self.balance >= 0 and amount >= 0: self.balance = self.balance + Decimal(amount) else: raise ValueError('balance and amount must be posit...
A class that represents a customer (python docs follows Numpy/Scipy format) ... Attributes ---------- name: str customer name account: str customer's account balance: decimal.Decimal customer's balance Methods ------- deposit(amount) a customer deposits money withdraw(amount) a customer withdraw money
Customer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Customer: """A class that represents a customer (python docs follows Numpy/Scipy format) ... Attributes ---------- name: str customer name account: str customer's account balance: decimal.Decimal customer's balance Methods ------- deposit(amount) a customer deposits money withdraw(amount) a custo...
stack_v2_sparse_classes_75kplus_train_000921
1,891
no_license
[ { "docstring": "Parameters ---------- name: str customer name account: str customer's account balance: decimal.Decimal customer's balance", "name": "__init__", "signature": "def __init__(self, name, account)" }, { "docstring": "Deposit money Parameters ---------- amount: float amount of money th...
3
stack_v2_sparse_classes_30k_train_002694
Implement the Python class `Customer` described below. Class description: A class that represents a customer (python docs follows Numpy/Scipy format) ... Attributes ---------- name: str customer name account: str customer's account balance: decimal.Decimal customer's balance Methods ------- deposit(amount) a customer ...
Implement the Python class `Customer` described below. Class description: A class that represents a customer (python docs follows Numpy/Scipy format) ... Attributes ---------- name: str customer name account: str customer's account balance: decimal.Decimal customer's balance Methods ------- deposit(amount) a customer ...
11ef8a7885d1e5a1f16788a934f3bb8d62a01dc2
<|skeleton|> class Customer: """A class that represents a customer (python docs follows Numpy/Scipy format) ... Attributes ---------- name: str customer name account: str customer's account balance: decimal.Decimal customer's balance Methods ------- deposit(amount) a customer deposits money withdraw(amount) a custo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Customer: """A class that represents a customer (python docs follows Numpy/Scipy format) ... Attributes ---------- name: str customer name account: str customer's account balance: decimal.Decimal customer's balance Methods ------- deposit(amount) a customer deposits money withdraw(amount) a customer withdraw ...
the_stack_v2_python_sparse
exam/1/python-ci-gitlab/cathay/sample/customer.py
daniel-qa/Python
train
0
326e9dc664a17bc35cf07a23e0cf61b8bc552c25
[ "if not matrix or not matrix[0]:\n return False\nm, n = (len(matrix), len(matrix[0]))\n\ndef binary_search(matrix, target, start, vertical):\n low = start\n high = len(matrix[0]) - 1 if vertical else len(matrix) - 1\n while low <= high:\n mid = low + high >> 1\n if vertical:\n i...
<|body_start_0|> if not matrix or not matrix[0]: return False m, n = (len(matrix), len(matrix[0])) def binary_search(matrix, target, start, vertical): low = start high = len(matrix[0]) - 1 if vertical else len(matrix) - 1 while low <= high: ...
Solution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix_v2(self, matrix, target): """Divide and conquer""" <|body_1|> def searchMatrix_v3(self, matrix, target): ...
stack_v2_sparse_classes_75kplus_train_000922
3,598
permissive
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": "Divide and conquer", "name": "searchMatrix_v2", "signature": "def searchMatrix_v2(self, matrix, target)" }, ...
3
stack_v2_sparse_classes_30k_train_013066
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix_v2(self, matrix, target): Divide and conquer - def searchM...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix_v2(self, matrix, target): Divide and conquer - def searchM...
226cecde136531341ce23cdf88529345be1912fc
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix_v2(self, matrix, target): """Divide and conquer""" <|body_1|> def searchMatrix_v3(self, matrix, target): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" if not matrix or not matrix[0]: return False m, n = (len(matrix), len(matrix[0])) def binary_search(matrix, target, start, vertical): lo...
the_stack_v2_python_sparse
Leetcode/Intermediate/Sort and search/240_Search_a_2D_Matrix_II.py
ZR-Huang/AlgorithmsPractices
train
1
cabcec521549e3ec11f22cad761fb02c2191fedf
[ "super().__init__(config=config, parent=tool, **kwargs)\nif self.output_path is None:\n raise ValueError('Please specify an output path to save pedestal file')\nself.ped_obj = TCPedestalMaker(self.n_tms, self.n_blocks, self.n_samples, self.diagnosis, self.std)\nself.ped_stats = None", "telid = 0\nwaveforms = e...
<|body_start_0|> super().__init__(config=config, parent=tool, **kwargs) if self.output_path is None: raise ValueError('Please specify an output path to save pedestal file') self.ped_obj = TCPedestalMaker(self.n_tms, self.n_blocks, self.n_samples, self.diagnosis, self.std) sel...
PedestalMaker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PedestalMaker: def __init__(self, config, tool, **kwargs): """Generator of Pedestal files. Parameters ---------- config : traitlets.loader.Config Configuration specified by config file or cmdline arguments. Used to set traitlet values. Set to None if no configuration to pass. tool : ctap...
stack_v2_sparse_classes_75kplus_train_000923
7,556
no_license
[ { "docstring": "Generator of Pedestal files. Parameters ---------- config : traitlets.loader.Config Configuration specified by config file or cmdline arguments. Used to set traitlet values. Set to None if no configuration to pass. tool : ctapipe.core.Tool Tool executable that is calling this component. Passes t...
3
stack_v2_sparse_classes_30k_train_048960
Implement the Python class `PedestalMaker` described below. Class description: Implement the PedestalMaker class. Method signatures and docstrings: - def __init__(self, config, tool, **kwargs): Generator of Pedestal files. Parameters ---------- config : traitlets.loader.Config Configuration specified by config file o...
Implement the Python class `PedestalMaker` described below. Class description: Implement the PedestalMaker class. Method signatures and docstrings: - def __init__(self, config, tool, **kwargs): Generator of Pedestal files. Parameters ---------- config : traitlets.loader.Config Configuration specified by config file o...
7238646f0793f9d9b0544be6723152d540b061a3
<|skeleton|> class PedestalMaker: def __init__(self, config, tool, **kwargs): """Generator of Pedestal files. Parameters ---------- config : traitlets.loader.Config Configuration specified by config file or cmdline arguments. Used to set traitlet values. Set to None if no configuration to pass. tool : ctap...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PedestalMaker: def __init__(self, config, tool, **kwargs): """Generator of Pedestal files. Parameters ---------- config : traitlets.loader.Config Configuration specified by config file or cmdline arguments. Used to set traitlet values. Set to None if no configuration to pass. tool : ctapipe.core.Tool ...
the_stack_v2_python_sparse
targetpipe/calib/camera/makers.py
watsonjj/targetpipe
train
0
eae4089a43a2dcbe6b7c68a01ce7d96711c48aba
[ "self.bit = x\nfor i in range(len(x)):\n j = i | i + 1\n if j < len(x):\n x[j] += x[i]", "while idx < len(self.bit):\n self.bit[idx] += x\n idx |= idx + 1", "x = 0\nwhile end:\n x += self.bit[end - 1]\n end &= end - 1\nreturn x", "idx = -1\nfor d in reversed(range(len(self.bit).bit_le...
<|body_start_0|> self.bit = x for i in range(len(x)): j = i | i + 1 if j < len(x): x[j] += x[i] <|end_body_0|> <|body_start_1|> while idx < len(self.bit): self.bit[idx] += x idx |= idx + 1 <|end_body_1|> <|body_start_2|> x...
FenwickTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FenwickTree: def __init__(self, x): """transform list into BIT""" <|body_0|> def update(self, idx, x): """updates bit[idx] += x""" <|body_1|> def query(self, end): """calc sum(bit[:end])""" <|body_2|> def find_kth_smallest(self, k): ...
stack_v2_sparse_classes_75kplus_train_000924
2,618
no_license
[ { "docstring": "transform list into BIT", "name": "__init__", "signature": "def __init__(self, x)" }, { "docstring": "updates bit[idx] += x", "name": "update", "signature": "def update(self, idx, x)" }, { "docstring": "calc sum(bit[:end])", "name": "query", "signature": "...
4
stack_v2_sparse_classes_30k_train_035322
Implement the Python class `FenwickTree` described below. Class description: Implement the FenwickTree class. Method signatures and docstrings: - def __init__(self, x): transform list into BIT - def update(self, idx, x): updates bit[idx] += x - def query(self, end): calc sum(bit[:end]) - def find_kth_smallest(self, k...
Implement the Python class `FenwickTree` described below. Class description: Implement the FenwickTree class. Method signatures and docstrings: - def __init__(self, x): transform list into BIT - def update(self, idx, x): updates bit[idx] += x - def query(self, end): calc sum(bit[:end]) - def find_kth_smallest(self, k...
57f473ca84735f9312913967e20a3ac0da32baa8
<|skeleton|> class FenwickTree: def __init__(self, x): """transform list into BIT""" <|body_0|> def update(self, idx, x): """updates bit[idx] += x""" <|body_1|> def query(self, end): """calc sum(bit[:end])""" <|body_2|> def find_kth_smallest(self, k): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FenwickTree: def __init__(self, x): """transform list into BIT""" self.bit = x for i in range(len(x)): j = i | i + 1 if j < len(x): x[j] += x[i] def update(self, idx, x): """updates bit[idx] += x""" while idx < len(self.bit):...
the_stack_v2_python_sparse
codeforces/current/c1354d/task.py
x3mka/code-contests-python
train
0
8fe039124424c07db37838c0d9e9b4cee4f1c452
[ "base.Action.__init__(self, self.__loadColourMap)\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx", "import wx\napp = wx.GetApp()\nloadDir = fslsettings.read('fsleyes.loadcolourmapdir', os.getcwd())\ndlg = wx.FileDialog(app.GetTopWindow(), defaultDir=loadDir, message=strings.messages[self, 'load...
<|body_start_0|> base.Action.__init__(self, self.__loadColourMap) self.__overlayList = overlayList self.__displayCtx = displayCtx <|end_body_0|> <|body_start_1|> import wx app = wx.GetApp() loadDir = fslsettings.read('fsleyes.loadcolourmapdir', os.getcwd()) dlg =...
The ``LoadColourMapAction`` allows the user to select a colour map file and give it a name. The loaded colour map is then registered with the :mod:`.colourmaps` module. The user is also given the option to permanently save the loaded colour map in *FSLeyes*.
LoadColourMapAction
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadColourMapAction: """The ``LoadColourMapAction`` allows the user to select a colour map file and give it a name. The loaded colour map is then registered with the :mod:`.colourmaps` module. The user is also given the option to permanently save the loaded colour map in *FSLeyes*.""" def __...
stack_v2_sparse_classes_75kplus_train_000925
4,121
permissive
[ { "docstring": "Create a ``LoadColourMapAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`.", "name": "__init__", "signature": "def __init__(self, overlayList, displayCtx)" }, { "docstring": "This method does the following: 1. Prompts the user to...
2
stack_v2_sparse_classes_30k_train_034751
Implement the Python class `LoadColourMapAction` described below. Class description: The ``LoadColourMapAction`` allows the user to select a colour map file and give it a name. The loaded colour map is then registered with the :mod:`.colourmaps` module. The user is also given the option to permanently save the loaded ...
Implement the Python class `LoadColourMapAction` described below. Class description: The ``LoadColourMapAction`` allows the user to select a colour map file and give it a name. The loaded colour map is then registered with the :mod:`.colourmaps` module. The user is also given the option to permanently save the loaded ...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class LoadColourMapAction: """The ``LoadColourMapAction`` allows the user to select a colour map file and give it a name. The loaded colour map is then registered with the :mod:`.colourmaps` module. The user is also given the option to permanently save the loaded colour map in *FSLeyes*.""" def __...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoadColourMapAction: """The ``LoadColourMapAction`` allows the user to select a colour map file and give it a name. The loaded colour map is then registered with the :mod:`.colourmaps` module. The user is also given the option to permanently save the loaded colour map in *FSLeyes*.""" def __init__(self, ...
the_stack_v2_python_sparse
fsleyes/actions/loadcolourmap.py
sanjayankur31/fsleyes
train
1
2fec4ee9ce3ded47e52c00c37b63a97f8cc07fe4
[ "from .search import AsyncSearch\ns = AsyncSearch(client=self, index_name=index_name)\nreturn s", "from .graph import AsyncGraph\ng = AsyncGraph(client=self, name=index_name)\nreturn g" ]
<|body_start_0|> from .search import AsyncSearch s = AsyncSearch(client=self, index_name=index_name) return s <|end_body_0|> <|body_start_1|> from .graph import AsyncGraph g = AsyncGraph(client=self, name=index_name) return g <|end_body_1|>
AsyncRedisModuleCommands
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncRedisModuleCommands: def ft(self, index_name='idx'): """Access the search namespace, providing support for redis search.""" <|body_0|> def graph(self, index_name='idx'): """Access the graph namespace, providing support for redis graph data.""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_000926
2,454
permissive
[ { "docstring": "Access the search namespace, providing support for redis search.", "name": "ft", "signature": "def ft(self, index_name='idx')" }, { "docstring": "Access the graph namespace, providing support for redis graph data.", "name": "graph", "signature": "def graph(self, index_nam...
2
stack_v2_sparse_classes_30k_train_053666
Implement the Python class `AsyncRedisModuleCommands` described below. Class description: Implement the AsyncRedisModuleCommands class. Method signatures and docstrings: - def ft(self, index_name='idx'): Access the search namespace, providing support for redis search. - def graph(self, index_name='idx'): Access the g...
Implement the Python class `AsyncRedisModuleCommands` described below. Class description: Implement the AsyncRedisModuleCommands class. Method signatures and docstrings: - def ft(self, index_name='idx'): Access the search namespace, providing support for redis search. - def graph(self, index_name='idx'): Access the g...
e3de026a90ef2cc35a5b68934029a0ef2a5b2f53
<|skeleton|> class AsyncRedisModuleCommands: def ft(self, index_name='idx'): """Access the search namespace, providing support for redis search.""" <|body_0|> def graph(self, index_name='idx'): """Access the graph namespace, providing support for redis graph data.""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AsyncRedisModuleCommands: def ft(self, index_name='idx'): """Access the search namespace, providing support for redis search.""" from .search import AsyncSearch s = AsyncSearch(client=self, index_name=index_name) return s def graph(self, index_name='idx'): """Acces...
the_stack_v2_python_sparse
redis/commands/redismodules.py
redis/redis-py
train
2,213
efbc6c26430848fcfa68f46bfd4e68c41043a680
[ "self.client.login(username=TEST_LOGIN_USERNAME, password=TEST_LOGIN_PASSWORD)\nresponse = self.client.post(reverse('edit_request_priority'), {'request_path': reverse('home'), 'request_priority': 1}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')\npriority_entry = RequestPriorityEntry.objects.get(pk=1)\nself.client.get(re...
<|body_start_0|> self.client.login(username=TEST_LOGIN_USERNAME, password=TEST_LOGIN_PASSWORD) response = self.client.post(reverse('edit_request_priority'), {'request_path': reverse('home'), 'request_priority': 1}, HTTP_X_REQUESTED_WITH='XMLHttpRequest') priority_entry = RequestPriorityEntry.obj...
TestChangeRequestPriority
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestChangeRequestPriority: def test_ajax_edition_priority_valid(self): """Test for valid data submission""" <|body_0|> def test_ajax_edition_priority_invalid(self): """Test for invalid data submission""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_000927
11,236
no_license
[ { "docstring": "Test for valid data submission", "name": "test_ajax_edition_priority_valid", "signature": "def test_ajax_edition_priority_valid(self)" }, { "docstring": "Test for invalid data submission", "name": "test_ajax_edition_priority_invalid", "signature": "def test_ajax_edition_p...
2
stack_v2_sparse_classes_30k_train_012828
Implement the Python class `TestChangeRequestPriority` described below. Class description: Implement the TestChangeRequestPriority class. Method signatures and docstrings: - def test_ajax_edition_priority_valid(self): Test for valid data submission - def test_ajax_edition_priority_invalid(self): Test for invalid data...
Implement the Python class `TestChangeRequestPriority` described below. Class description: Implement the TestChangeRequestPriority class. Method signatures and docstrings: - def test_ajax_edition_priority_valid(self): Test for valid data submission - def test_ajax_edition_priority_invalid(self): Test for invalid data...
ad157bc53f250959daca5f100fc746cbe8e94193
<|skeleton|> class TestChangeRequestPriority: def test_ajax_edition_priority_valid(self): """Test for valid data submission""" <|body_0|> def test_ajax_edition_priority_invalid(self): """Test for invalid data submission""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestChangeRequestPriority: def test_ajax_edition_priority_valid(self): """Test for valid data submission""" self.client.login(username=TEST_LOGIN_USERNAME, password=TEST_LOGIN_PASSWORD) response = self.client.post(reverse('edit_request_priority'), {'request_path': reverse('home'), 'req...
the_stack_v2_python_sparse
pyta/tests.py
TTask/cups42
train
0
1a7f0598d93ab83e7cac77ffa0c7c811e0bab141
[ "tests = ('AAPL', 'AMZN', 'CSCO', 'GOOGL', 'IBM', 'MSFT', 'ORCL')\nfor test in tests:\n fundamentals = Fundamentals(test)\n self.assertTrue(isinstance(fundamentals, Fundamentals))", "Test = collections.namedtuple('Test', 'date field expected_value')\ntests = (Test('2013-05-03', 'total_debt', 14460465000), T...
<|body_start_0|> tests = ('AAPL', 'AMZN', 'CSCO', 'GOOGL', 'IBM', 'MSFT', 'ORCL') for test in tests: fundamentals = Fundamentals(test) self.assertTrue(isinstance(fundamentals, Fundamentals)) <|end_body_0|> <|body_start_1|> Test = collections.namedtuple('Test', 'date fiel...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def test_construction_and_file_layouts(self): """test all issuers""" <|body_0|> def test_get_ok(self): """test just AAPL""" <|body_1|> def test_get_bad(self): """test just AAPL""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_000928
4,022
no_license
[ { "docstring": "test all issuers", "name": "test_construction_and_file_layouts", "signature": "def test_construction_and_file_layouts(self)" }, { "docstring": "test just AAPL", "name": "test_get_ok", "signature": "def test_get_ok(self)" }, { "docstring": "test just AAPL", "na...
3
stack_v2_sparse_classes_30k_test_002387
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_construction_and_file_layouts(self): test all issuers - def test_get_ok(self): test just AAPL - def test_get_bad(self): test just AAPL
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_construction_and_file_layouts(self): test all issuers - def test_get_ok(self): test just AAPL - def test_get_bad(self): test just AAPL <|skeleton|> class Test: def test_co...
3535bd46bff602fc3ba35c080d38b30e75a97fe7
<|skeleton|> class Test: def test_construction_and_file_layouts(self): """test all issuers""" <|body_0|> def test_get_ok(self): """test just AAPL""" <|body_1|> def test_get_bad(self): """test just AAPL""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test: def test_construction_and_file_layouts(self): """test all issuers""" tests = ('AAPL', 'AMZN', 'CSCO', 'GOOGL', 'IBM', 'MSFT', 'ORCL') for test in tests: fundamentals = Fundamentals(test) self.assertTrue(isinstance(fundamentals, Fundamentals)) def test...
the_stack_v2_python_sparse
seven/Fundamentals.py
rlowrance/test7
train
2
a36dc2e0645ab9f77162c1f386572ee23bd06ed7
[ "visit = set()\nwhile head:\n if head not in visit:\n visit.add(head)\n else:\n return True\n head = head.next\nreturn False", "pslow = head\npfast = head\nwhile pfast and pfast.next:\n pslow = pslow.next\n pfast = pfast.next.next\n if pslow == pfast:\n return True\nreturn F...
<|body_start_0|> visit = set() while head: if head not in visit: visit.add(head) else: return True head = head.next return False <|end_body_0|> <|body_start_1|> pslow = head pfast = head while pfast and ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> visit = set() while head: if h...
stack_v2_sparse_classes_75kplus_train_000929
3,101
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle2", "signature": "def hasCycle2(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_037734
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycle2(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycle2(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def hasCycle(self, h...
fcf79f4f7354454a28b60ef3c845dd6defddbf42
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" visit = set() while head: if head not in visit: visit.add(head) else: return True head = head.next return False def hasCycle2(sel...
the_stack_v2_python_sparse
python_data_structure/python_List/leetcode.py
liunlll/LiuLeetCode
train
0
7c3f55e49c21ef73190fc2778eb1d36ff10ffde9
[ "def dfs(i, remains: List[int]):\n if i == n + 1:\n return 1\n cnt = 0\n for j in range(1, n + 1):\n if remains[j] is None and (i % j == 0 or j % i == 0):\n remains[j] = i\n cnt += dfs(i + 1, remains)\n remains[j] = None\n return cnt\nreturn dfs(1, [None] *...
<|body_start_0|> def dfs(i, remains: List[int]): if i == n + 1: return 1 cnt = 0 for j in range(1, n + 1): if remains[j] is None and (i % j == 0 or j % i == 0): remains[j] = i cnt += dfs(i + 1, remains) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countArrangement(self, n: int) -> int: """DFS using a list""" <|body_0|> def countArrangement(self, n: int) -> int: """DFS using a binary number to make argument hashable for caching""" <|body_1|> def countArrangement(self, n: int) -> int: ...
stack_v2_sparse_classes_75kplus_train_000930
2,867
no_license
[ { "docstring": "DFS using a list", "name": "countArrangement", "signature": "def countArrangement(self, n: int) -> int" }, { "docstring": "DFS using a binary number to make argument hashable for caching", "name": "countArrangement", "signature": "def countArrangement(self, n: int) -> int...
3
stack_v2_sparse_classes_30k_train_026368
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countArrangement(self, n: int) -> int: DFS using a list - def countArrangement(self, n: int) -> int: DFS using a binary number to make argument hashable for caching - def cou...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countArrangement(self, n: int) -> int: DFS using a list - def countArrangement(self, n: int) -> int: DFS using a binary number to make argument hashable for caching - def cou...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def countArrangement(self, n: int) -> int: """DFS using a list""" <|body_0|> def countArrangement(self, n: int) -> int: """DFS using a binary number to make argument hashable for caching""" <|body_1|> def countArrangement(self, n: int) -> int: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countArrangement(self, n: int) -> int: """DFS using a list""" def dfs(i, remains: List[int]): if i == n + 1: return 1 cnt = 0 for j in range(1, n + 1): if remains[j] is None and (i % j == 0 or j % i == 0): ...
the_stack_v2_python_sparse
leetcode/solved/526_Beautiful_Arrangement/solution.py
sungminoh/algorithms
train
0
2704c06c675e5399e382153e58b1c61b38180c88
[ "self.sleeptime = sleep_param\nself.looplimit = looplimit\nself.temperatureTask = TempSensorEmulatorTask.TempSensorEmulator()", "i = 0\nif self.sleeptime < 0 or self.looplimit < 0:\n logging.error('looplimit or sleeptime is less than 0')\n return False\nif self.enableTempEmulatorAdapter == True:\n while ...
<|body_start_0|> self.sleeptime = sleep_param self.looplimit = looplimit self.temperatureTask = TempSensorEmulatorTask.TempSensorEmulator() <|end_body_0|> <|body_start_1|> i = 0 if self.sleeptime < 0 or self.looplimit < 0: logging.error('looplimit or sleeptime is les...
This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations
TempEmulatorAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempEmulatorAdapter: """This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations""" def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault): """Constructor which sets...
stack_v2_sparse_classes_75kplus_train_000931
1,894
no_license
[ { "docstring": "Constructor which sets the sleep timer for the thread, and a looplimit if needed.", "name": "__init__", "signature": "def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault)" }, { "docstring": "This method runs the emulation if enableTempEmulatorAdapter is set to True...
2
stack_v2_sparse_classes_30k_train_048324
Implement the Python class `TempEmulatorAdapter` described below. Class description: This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations Method signatures and docstrings: - def __init__(self, sleep_param=sle...
Implement the Python class `TempEmulatorAdapter` described below. Class description: This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations Method signatures and docstrings: - def __init__(self, sleep_param=sle...
dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee
<|skeleton|> class TempEmulatorAdapter: """This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations""" def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault): """Constructor which sets...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TempEmulatorAdapter: """This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations""" def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault): """Constructor which sets the sleep ti...
the_stack_v2_python_sparse
apps/labs/module02/TempEmulatorAdapter.py
mnk400/iot-device
train
0
b7e74093c18b7634df7dea95aec4fa6b204e422f
[ "stop_words = read_stop_words(stop_word_file) if stop_word_file is not None else []\nself.input_fields = frozenset(input_fields)\nself.nlp = SpacyTextParser(model_name, stop_words=stop_words, remove_punct=remove_punct, sent_split=False, keep_only_alpha_num=keep_only_alpha_num, lower_case=lower_case, enable_pos=enab...
<|body_start_0|> stop_words = read_stop_words(stop_word_file) if stop_word_file is not None else [] self.input_fields = frozenset(input_fields) self.nlp = SpacyTextParser(model_name, stop_words=stop_words, remove_punct=remove_punct, sent_split=False, keep_only_alpha_num=keep_only_alpha_num, lowe...
SpacyTextProcessor
[ "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpacyTextProcessor: def __init__(self, input_fields: list, model_name, stop_word_file=None, remove_punct=True, keep_only_alpha_num=False, lower_case=True, enable_pos=True): """Constructor. :param input_fields: a list of field names to process :param model_name a name of the spacy model t...
stack_v2_sparse_classes_75kplus_train_000932
3,075
permissive
[ { "docstring": "Constructor. :param input_fields: a list of field names to process :param model_name a name of the spacy model to use, e.g., en_core_web_sm :param stop_word_file the name of the stop word file :param remove_punct a bool flag indicating if the punctuation tokens need to be removed :param keep_onl...
2
null
Implement the Python class `SpacyTextProcessor` described below. Class description: Implement the SpacyTextProcessor class. Method signatures and docstrings: - def __init__(self, input_fields: list, model_name, stop_word_file=None, remove_punct=True, keep_only_alpha_num=False, lower_case=True, enable_pos=True): Const...
Implement the Python class `SpacyTextProcessor` described below. Class description: Implement the SpacyTextProcessor class. Method signatures and docstrings: - def __init__(self, input_fields: list, model_name, stop_word_file=None, remove_punct=True, keep_only_alpha_num=False, lower_case=True, enable_pos=True): Const...
0bd3e06735ff705731fb6cee62d3486276beccdf
<|skeleton|> class SpacyTextProcessor: def __init__(self, input_fields: list, model_name, stop_word_file=None, remove_punct=True, keep_only_alpha_num=False, lower_case=True, enable_pos=True): """Constructor. :param input_fields: a list of field names to process :param model_name a name of the spacy model t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpacyTextProcessor: def __init__(self, input_fields: list, model_name, stop_word_file=None, remove_punct=True, keep_only_alpha_num=False, lower_case=True, enable_pos=True): """Constructor. :param input_fields: a list of field names to process :param model_name a name of the spacy model to use, e.g., e...
the_stack_v2_python_sparse
flexneuart/ir_datasets/spacy.py
oaqa/FlexNeuART
train
156
3fc43052b05e733fc669cfd053336b2825dc65f9
[ "version_url = self._get_base_version_url()\nresp, body = self.raw_request(version_url, 'GET')\nself._error_checker(resp, body)\nself.expected_success(300, resp.status)\nbody = json.loads(body)\nreturn rest_client.ResponseBody(resp, body)", "version = 'v%s' % version\nsupported = ['SUPPORTED', 'CURRENT']\nversion...
<|body_start_0|> version_url = self._get_base_version_url() resp, body = self.raw_request(version_url, 'GET') self._error_checker(resp, body) self.expected_success(300, resp.status) body = json.loads(body) return rest_client.ResponseBody(resp, body) <|end_body_0|> <|body...
VersionsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionsClient: def list_versions(self): """List API versions""" <|body_0|> def has_version(self, version): """Return True if a version is supported.""" <|body_1|> <|end_skeleton|> <|body_start_0|> version_url = self._get_base_version_url() ...
stack_v2_sparse_classes_75kplus_train_000933
1,531
permissive
[ { "docstring": "List API versions", "name": "list_versions", "signature": "def list_versions(self)" }, { "docstring": "Return True if a version is supported.", "name": "has_version", "signature": "def has_version(self, version)" } ]
2
stack_v2_sparse_classes_30k_train_042348
Implement the Python class `VersionsClient` described below. Class description: Implement the VersionsClient class. Method signatures and docstrings: - def list_versions(self): List API versions - def has_version(self, version): Return True if a version is supported.
Implement the Python class `VersionsClient` described below. Class description: Implement the VersionsClient class. Method signatures and docstrings: - def list_versions(self): List API versions - def has_version(self, version): Return True if a version is supported. <|skeleton|> class VersionsClient: def list_...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class VersionsClient: def list_versions(self): """List API versions""" <|body_0|> def has_version(self, version): """Return True if a version is supported.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VersionsClient: def list_versions(self): """List API versions""" version_url = self._get_base_version_url() resp, body = self.raw_request(version_url, 'GET') self._error_checker(resp, body) self.expected_success(300, resp.status) body = json.loads(body) ...
the_stack_v2_python_sparse
tempest/lib/services/image/v2/versions_client.py
openstack/tempest
train
270
d1adea77ae57d3868dbe4b890712420fb8cda2cd
[ "self.max_proba = max_proba\nself.confident_threshold = confident_threshold\nself.top_n = top_n", "if self.confident_threshold:\n return [list(np.where(np.array(d) > self.confident_threshold)[0]) for d in data]\nelif self.max_proba:\n return [np.argmax(d) for d in data]\nelif self.top_n:\n return [np.arg...
<|body_start_0|> self.max_proba = max_proba self.confident_threshold = confident_threshold self.top_n = top_n <|end_body_0|> <|body_start_1|> if self.confident_threshold: return [list(np.where(np.array(d) > self.confident_threshold)[0]) for d in data] elif self.max_p...
Class implements probability to labels processing using the following ways: choosing one or top_n indices with maximal probability or choosing any number of indices which probabilities to belong with are higher than given confident threshold Args: max_proba: whether to choose label with maximal probability confident_th...
Proba2Labels
[ "Python-2.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Proba2Labels: """Class implements probability to labels processing using the following ways: choosing one or top_n indices with maximal probability or choosing any number of indices which probabilities to belong with are higher than given confident threshold Args: max_proba: whether to choose lab...
stack_v2_sparse_classes_75kplus_train_000934
3,194
permissive
[ { "docstring": "Initialize class with given parameters", "name": "__init__", "signature": "def __init__(self, max_proba: bool=None, confident_threshold: float=None, top_n: int=None, **kwargs) -> None" }, { "docstring": "Process probabilities to labels Args: data: list of vectors with probability...
2
stack_v2_sparse_classes_30k_train_053696
Implement the Python class `Proba2Labels` described below. Class description: Class implements probability to labels processing using the following ways: choosing one or top_n indices with maximal probability or choosing any number of indices which probabilities to belong with are higher than given confident threshold...
Implement the Python class `Proba2Labels` described below. Class description: Class implements probability to labels processing using the following ways: choosing one or top_n indices with maximal probability or choosing any number of indices which probabilities to belong with are higher than given confident threshold...
65f69dfb898f5444cc2c98ae03ec7b3f44266df2
<|skeleton|> class Proba2Labels: """Class implements probability to labels processing using the following ways: choosing one or top_n indices with maximal probability or choosing any number of indices which probabilities to belong with are higher than given confident threshold Args: max_proba: whether to choose lab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Proba2Labels: """Class implements probability to labels processing using the following ways: choosing one or top_n indices with maximal probability or choosing any number of indices which probabilities to belong with are higher than given confident threshold Args: max_proba: whether to choose label with maxim...
the_stack_v2_python_sparse
deeppavlov/models/classifiers/proba2labels.py
vintagexav/DeepPavlov
train
2
9499948812698af51adb743a2b7d7b81c35dc7ea
[ "super(MultiTverskyLoss, self).__init__()\nself.alpha = alpha\nself.beta = beta\nself.gamma = gamma\nself.weights = weights", "targets = targets.unsqueeze(1)\nnum_class = inputs.size(1)\nweight_losses = 0.0\nif self.weights is not None:\n assert len(self.weights) == num_class, 'number of classes should be equa...
<|body_start_0|> super(MultiTverskyLoss, self).__init__() self.alpha = alpha self.beta = beta self.gamma = gamma self.weights = weights <|end_body_0|> <|body_start_1|> targets = targets.unsqueeze(1) num_class = inputs.size(1) weight_losses = 0.0 i...
Tversky Loss for segmentation adaptive with multi class segmentation
MultiTverskyLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiTverskyLoss: """Tversky Loss for segmentation adaptive with multi class segmentation""" def __init__(self, alpha=0.5, beta=0.5, gamma=1.0, weights=None): """:param alpha (Tensor, float, optional): controls the penalty for false positives. :param beta (Tensor, float, optional): c...
stack_v2_sparse_classes_75kplus_train_000935
10,977
permissive
[ { "docstring": ":param alpha (Tensor, float, optional): controls the penalty for false positives. :param beta (Tensor, float, optional): controls the penalty for false negative. :param gamma (Tensor, float, optional): focal coefficient :param weights (Tensor, optional): a manual rescaling weight given to each c...
2
stack_v2_sparse_classes_30k_train_013794
Implement the Python class `MultiTverskyLoss` described below. Class description: Tversky Loss for segmentation adaptive with multi class segmentation Method signatures and docstrings: - def __init__(self, alpha=0.5, beta=0.5, gamma=1.0, weights=None): :param alpha (Tensor, float, optional): controls the penalty for ...
Implement the Python class `MultiTverskyLoss` described below. Class description: Tversky Loss for segmentation adaptive with multi class segmentation Method signatures and docstrings: - def __init__(self, alpha=0.5, beta=0.5, gamma=1.0, weights=None): :param alpha (Tensor, float, optional): controls the penalty for ...
d83c9f6dfcfe36573fe77fbdfec4fda23ded9180
<|skeleton|> class MultiTverskyLoss: """Tversky Loss for segmentation adaptive with multi class segmentation""" def __init__(self, alpha=0.5, beta=0.5, gamma=1.0, weights=None): """:param alpha (Tensor, float, optional): controls the penalty for false positives. :param beta (Tensor, float, optional): c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiTverskyLoss: """Tversky Loss for segmentation adaptive with multi class segmentation""" def __init__(self, alpha=0.5, beta=0.5, gamma=1.0, weights=None): """:param alpha (Tensor, float, optional): controls the penalty for false positives. :param beta (Tensor, float, optional): controls the p...
the_stack_v2_python_sparse
utils/criterions.py
thanhhau097/brats-dmf-bifpn
train
4
3c377f2d4253f4f70d94bd3d010c48886e8edddf
[ "redis_conn = get_redis_connection(settings.HISTORY_CACHE_ALIAS)\nuser_id = request.user.id\nhistory_browse_key = RedisKey.HISTORY_BROWSE_KEY.format(user_id=user_id)\nsku_ids = redis_conn.lrange(history_browse_key, 0, -1)\nskus = []\nfor sku_id in sku_ids:\n sku = SKU.objects.get(id=sku_id)\n skus.append({'id...
<|body_start_0|> redis_conn = get_redis_connection(settings.HISTORY_CACHE_ALIAS) user_id = request.user.id history_browse_key = RedisKey.HISTORY_BROWSE_KEY.format(user_id=user_id) sku_ids = redis_conn.lrange(history_browse_key, 0, -1) skus = [] for sku_id in sku_ids: ...
用户浏览记录
UserBrowseHistory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserBrowseHistory: """用户浏览记录""" def get(self, request): """获取用户浏览记录""" <|body_0|> def post(self, request): """保存用户浏览记录""" <|body_1|> <|end_skeleton|> <|body_start_0|> redis_conn = get_redis_connection(settings.HISTORY_CACHE_ALIAS) user_i...
stack_v2_sparse_classes_75kplus_train_000936
21,636
permissive
[ { "docstring": "获取用户浏览记录", "name": "get", "signature": "def get(self, request)" }, { "docstring": "保存用户浏览记录", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_046215
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览记录 Method signatures and docstrings: - def get(self, request): 获取用户浏览记录 - def post(self, request): 保存用户浏览记录
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览记录 Method signatures and docstrings: - def get(self, request): 获取用户浏览记录 - def post(self, request): 保存用户浏览记录 <|skeleton|> class UserBrowseHistory: """用户浏览记录""" def get(self, request): """获取用户浏览记录""" <|body_...
b1aa6da9e3d0af3e6aa7ff2587148845469aefad
<|skeleton|> class UserBrowseHistory: """用户浏览记录""" def get(self, request): """获取用户浏览记录""" <|body_0|> def post(self, request): """保存用户浏览记录""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserBrowseHistory: """用户浏览记录""" def get(self, request): """获取用户浏览记录""" redis_conn = get_redis_connection(settings.HISTORY_CACHE_ALIAS) user_id = request.user.id history_browse_key = RedisKey.HISTORY_BROWSE_KEY.format(user_id=user_id) sku_ids = redis_conn.lrange(his...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/views.py
HuiDBK/meiduo_project
train
0
ea3f3eaec893a324aea469678def793c22ab8495
[ "self.parser = templateparser.Parser()\nself.parse = self.parser.ParseString\nself.tmpl = templateparser.Template", "self.parser['template'] = self.tmpl('This is a subtemplate by [name].')\ntemplate = '{{ inline template }}'\nexpected = 'This is a subtemplate by Elmer.'\nself.assertEqual(self.parse(template, name...
<|body_start_0|> self.parser = templateparser.Parser() self.parse = self.parser.ParseString self.tmpl = templateparser.Template <|end_body_0|> <|body_start_1|> self.parser['template'] = self.tmpl('This is a subtemplate by [name].') template = '{{ inline template }}' expe...
TemplateParser properly handles the include statement.
TemplateInlining
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateInlining: """TemplateParser properly handles the include statement.""" def setUp(self): """Sets up a testbed.""" <|body_0|> def testInlineExisting(self): """{{ inline }} Parser will inline an already existing template reference""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_000937
37,443
permissive
[ { "docstring": "Sets up a testbed.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "{{ inline }} Parser will inline an already existing template reference", "name": "testInlineExisting", "signature": "def testInlineExisting(self)" }, { "docstring": "{{ inline ...
3
stack_v2_sparse_classes_30k_train_047376
Implement the Python class `TemplateInlining` described below. Class description: TemplateParser properly handles the include statement. Method signatures and docstrings: - def setUp(self): Sets up a testbed. - def testInlineExisting(self): {{ inline }} Parser will inline an already existing template reference - def ...
Implement the Python class `TemplateInlining` described below. Class description: TemplateParser properly handles the include statement. Method signatures and docstrings: - def setUp(self): Sets up a testbed. - def testInlineExisting(self): {{ inline }} Parser will inline an already existing template reference - def ...
6ee9b512b9a42ef313032e7b79f779b44da3c319
<|skeleton|> class TemplateInlining: """TemplateParser properly handles the include statement.""" def setUp(self): """Sets up a testbed.""" <|body_0|> def testInlineExisting(self): """{{ inline }} Parser will inline an already existing template reference""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TemplateInlining: """TemplateParser properly handles the include statement.""" def setUp(self): """Sets up a testbed.""" self.parser = templateparser.Parser() self.parse = self.parser.ParseString self.tmpl = templateparser.Template def testInlineExisting(self): ...
the_stack_v2_python_sparse
newweb/test_templateparser.py
edelooff/newWeb
train
0
31dea531356445cca76fdb37e2fad0f7969500ab
[ "date = timezone.now()\norder = BuyProduct(full_name='Full Name Test', phone_number='123', country='TheCountry', postcode='902180', town_or_city='TheCity', street_address1='TheStreet', street_address2='TheStreetPart2', county='TheCounty', date=date)\nself.assertEqual(order.full_name, 'Full Name Test')\nself.assertE...
<|body_start_0|> date = timezone.now() order = BuyProduct(full_name='Full Name Test', phone_number='123', country='TheCountry', postcode='902180', town_or_city='TheCity', street_address1='TheStreet', street_address2='TheStreetPart2', county='TheCounty', date=date) self.assertEqual(order.full_nam...
TestCheckoutModels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCheckoutModels: def test_buy_product(self): """Tests if the BuyProduct model really takes in the correct user information for an order""" <|body_0|> def test_order_as_string(self): """Tests if the string function of the BuyProduct model returns the right output""...
stack_v2_sparse_classes_75kplus_train_000938
3,582
no_license
[ { "docstring": "Tests if the BuyProduct model really takes in the correct user information for an order", "name": "test_buy_product", "signature": "def test_buy_product(self)" }, { "docstring": "Tests if the string function of the BuyProduct model returns the right output", "name": "test_ord...
4
stack_v2_sparse_classes_30k_val_001122
Implement the Python class `TestCheckoutModels` described below. Class description: Implement the TestCheckoutModels class. Method signatures and docstrings: - def test_buy_product(self): Tests if the BuyProduct model really takes in the correct user information for an order - def test_order_as_string(self): Tests if...
Implement the Python class `TestCheckoutModels` described below. Class description: Implement the TestCheckoutModels class. Method signatures and docstrings: - def test_buy_product(self): Tests if the BuyProduct model really takes in the correct user information for an order - def test_order_as_string(self): Tests if...
4b2d560b4df459f36bb804f28eb488391a99b514
<|skeleton|> class TestCheckoutModels: def test_buy_product(self): """Tests if the BuyProduct model really takes in the correct user information for an order""" <|body_0|> def test_order_as_string(self): """Tests if the string function of the BuyProduct model returns the right output""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCheckoutModels: def test_buy_product(self): """Tests if the BuyProduct model really takes in the correct user information for an order""" date = timezone.now() order = BuyProduct(full_name='Full Name Test', phone_number='123', country='TheCountry', postcode='902180', town_or_city='...
the_stack_v2_python_sparse
checkout/test_models.py
Code-Institute-Submissions/Milestone4-6
train
0
fd200e4e0a8447a13e13fca06c73fd5904729cb0
[ "departments = Department.query.join(Employee, isouter=True).group_by(Department.id).with_entities(func.round(func.ifnull(func.avg(Employee.salary), 0), 2).label('avg')).add_columns(Department.id.label('id'), Department.name.label('name')).all()\nlogger.info('List of departments: %s', departments)\nresponse = make_...
<|body_start_0|> departments = Department.query.join(Employee, isouter=True).group_by(Department.id).with_entities(func.round(func.ifnull(func.avg(Employee.salary), 0), 2).label('avg')).add_columns(Department.id.label('id'), Department.name.label('name')).all() logger.info('List of departments: %s', dep...
Resource class
DepartmentsResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepartmentsResource: """Resource class""" def get(): """This static method exposes GET HTTP method. Request processing include select existing record from the database :return: response with HTML content""" <|body_0|> def post(): """This static method exposes POS...
stack_v2_sparse_classes_75kplus_train_000939
1,994
permissive
[ { "docstring": "This static method exposes GET HTTP method. Request processing include select existing record from the database :return: response with HTML content", "name": "get", "signature": "def get()" }, { "docstring": "This static method exposes POST HTTP method. Request processing include...
2
stack_v2_sparse_classes_30k_train_048548
Implement the Python class `DepartmentsResource` described below. Class description: Resource class Method signatures and docstrings: - def get(): This static method exposes GET HTTP method. Request processing include select existing record from the database :return: response with HTML content - def post(): This stat...
Implement the Python class `DepartmentsResource` described below. Class description: Resource class Method signatures and docstrings: - def get(): This static method exposes GET HTTP method. Request processing include select existing record from the database :return: response with HTML content - def post(): This stat...
5e6e1620179f70dd13fbdaf2cabbefe5fac95aeb
<|skeleton|> class DepartmentsResource: """Resource class""" def get(): """This static method exposes GET HTTP method. Request processing include select existing record from the database :return: response with HTML content""" <|body_0|> def post(): """This static method exposes POS...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DepartmentsResource: """Resource class""" def get(): """This static method exposes GET HTTP method. Request processing include select existing record from the database :return: response with HTML content""" departments = Department.query.join(Employee, isouter=True).group_by(Department.id...
the_stack_v2_python_sparse
department-app/service/department/departments.py
V1ckeyR/department
train
2
98db11a1656cd611de44141938d7b25bbca452eb
[ "num_fractions = 16\nBED = np.array([range(num_fractions + 1)])\nx = BEDPredictorUpperBoundCorrect(BED)\nestimated = x.estimate(granularity=4)\nself.assertEqual(np.all(np.equal(estimated[0], range(num_fractions + 1))), True)", "BED = np.array([[0, 20, 38, 54, 68, 80, 90, 98, 104, 108, 110, 111, 111, 111, 111, 111...
<|body_start_0|> num_fractions = 16 BED = np.array([range(num_fractions + 1)]) x = BEDPredictorUpperBoundCorrect(BED) estimated = x.estimate(granularity=4) self.assertEqual(np.all(np.equal(estimated[0], range(num_fractions + 1))), True) <|end_body_0|> <|body_start_1|> BE...
BEDPredictorUpperBoundCorrectTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BEDPredictorUpperBoundCorrectTest: def test_case_BED_linear(self): """Testing BED approximation when BED values are linear.""" <|body_0|> def test_case_BED_concave(self): """Testing BED approximation when BED values are arbitrary convex.""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_000940
1,700
no_license
[ { "docstring": "Testing BED approximation when BED values are linear.", "name": "test_case_BED_linear", "signature": "def test_case_BED_linear(self)" }, { "docstring": "Testing BED approximation when BED values are arbitrary convex.", "name": "test_case_BED_concave", "signature": "def te...
2
stack_v2_sparse_classes_30k_train_048749
Implement the Python class `BEDPredictorUpperBoundCorrectTest` described below. Class description: Implement the BEDPredictorUpperBoundCorrectTest class. Method signatures and docstrings: - def test_case_BED_linear(self): Testing BED approximation when BED values are linear. - def test_case_BED_concave(self): Testing...
Implement the Python class `BEDPredictorUpperBoundCorrectTest` described below. Class description: Implement the BEDPredictorUpperBoundCorrectTest class. Method signatures and docstrings: - def test_case_BED_linear(self): Testing BED approximation when BED values are linear. - def test_case_BED_concave(self): Testing...
413b9e4aaea5a641aa36ab7f29528468a0c13196
<|skeleton|> class BEDPredictorUpperBoundCorrectTest: def test_case_BED_linear(self): """Testing BED approximation when BED values are linear.""" <|body_0|> def test_case_BED_concave(self): """Testing BED approximation when BED values are arbitrary convex.""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BEDPredictorUpperBoundCorrectTest: def test_case_BED_linear(self): """Testing BED approximation when BED values are linear.""" num_fractions = 16 BED = np.array([range(num_fractions + 1)]) x = BEDPredictorUpperBoundCorrect(BED) estimated = x.estimate(granularity=4) ...
the_stack_v2_python_sparse
proton/test_estimator.py
IDmy/proton
train
0
e1b1fc79abd30b449f2ffe706df43fdaf35f4d2d
[ "self.num_intentions = num_intentions\nself.alpha = alpha\nself.logger = logger", "assert Q.dim() == action_log_prob.dim()\nif self.logger is not None:\n self.logger.add_scalar(tag='Loss/entropy', scalar_value=(self.alpha * action_log_prob).mean())\n self.logger.add_scalar(tag='Loss/Q', scalar_value=(-Q).me...
<|body_start_0|> self.num_intentions = num_intentions self.alpha = alpha self.logger = logger <|end_body_0|> <|body_start_1|> assert Q.dim() == action_log_prob.dim() if self.logger is not None: self.logger.add_scalar(tag='Loss/entropy', scalar_value=(self.alpha * act...
ActorLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActorLoss: def __init__(self, num_intentions, alpha=0, logger=None): """Loss function for the actor. Args: alpha: entropy regularization parameter.""" <|body_0|> def __call__(self, Q, action_log_prob): """Computes the loss of the actor according to L = 𝔼_π [Q(a,s) -...
stack_v2_sparse_classes_75kplus_train_000941
4,656
no_license
[ { "docstring": "Loss function for the actor. Args: alpha: entropy regularization parameter.", "name": "__init__", "signature": "def __init__(self, num_intentions, alpha=0, logger=None)" }, { "docstring": "Computes the loss of the actor according to L = 𝔼_π [Q(a,s) - α log(π(a|s)] Args: Q: Q(a,s...
2
stack_v2_sparse_classes_30k_test_002964
Implement the Python class `ActorLoss` described below. Class description: Implement the ActorLoss class. Method signatures and docstrings: - def __init__(self, num_intentions, alpha=0, logger=None): Loss function for the actor. Args: alpha: entropy regularization parameter. - def __call__(self, Q, action_log_prob): ...
Implement the Python class `ActorLoss` described below. Class description: Implement the ActorLoss class. Method signatures and docstrings: - def __init__(self, num_intentions, alpha=0, logger=None): Loss function for the actor. Args: alpha: entropy regularization parameter. - def __call__(self, Q, action_log_prob): ...
99c99c952bdf9997f240cf0fb7637a327c81424e
<|skeleton|> class ActorLoss: def __init__(self, num_intentions, alpha=0, logger=None): """Loss function for the actor. Args: alpha: entropy regularization parameter.""" <|body_0|> def __call__(self, Q, action_log_prob): """Computes the loss of the actor according to L = 𝔼_π [Q(a,s) -...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActorLoss: def __init__(self, num_intentions, alpha=0, logger=None): """Loss function for the actor. Args: alpha: entropy regularization parameter.""" self.num_intentions = num_intentions self.alpha = alpha self.logger = logger def __call__(self, Q, action_log_prob): ...
the_stack_v2_python_sparse
sac_x/loss_fn.py
DenisBless/ScheduledAuxiliaryControl
train
1
9805039ed80b415f06348d2180c36158d26ca0d2
[ "self.rerank_top = rerank_top\nself.duoBERT_score_transform = DuoBERT_Scorer_Transform(checkpoint_dir, **kwargs)\nself.doc_resolver_transform = Document_Resolver_Transform(get_doc_fn, fields=[('d_idA', 'docA'), ('d_idB', 'docB')])\nself.duoBERT_numericalise_transform = DuoBERT_Numericalise_Transform(**kwargs)", "...
<|body_start_0|> self.rerank_top = rerank_top self.duoBERT_score_transform = DuoBERT_Scorer_Transform(checkpoint_dir, **kwargs) self.doc_resolver_transform = Document_Resolver_Transform(get_doc_fn, fields=[('d_idA', 'docA'), ('d_idB', 'docB')]) self.duoBERT_numericalise_transform = DuoBE...
DuoBERT_ReRanker_Transform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DuoBERT_ReRanker_Transform: def __init__(self, checkpoint_dir, get_doc_fn, rerank_top=10, **kwargs): """A Transform that reorders a list pairwise. checkpoint_path: str: path to only the state dict of the model, loaded with load_state_dict""" <|body_0|> def __call__(self, sam...
stack_v2_sparse_classes_75kplus_train_000942
24,876
no_license
[ { "docstring": "A Transform that reorders a list pairwise. checkpoint_path: str: path to only the state dict of the model, loaded with load_state_dict", "name": "__init__", "signature": "def __init__(self, checkpoint_dir, get_doc_fn, rerank_top=10, **kwargs)" }, { "docstring": "samples: [dict]: ...
2
stack_v2_sparse_classes_30k_train_036724
Implement the Python class `DuoBERT_ReRanker_Transform` described below. Class description: Implement the DuoBERT_ReRanker_Transform class. Method signatures and docstrings: - def __init__(self, checkpoint_dir, get_doc_fn, rerank_top=10, **kwargs): A Transform that reorders a list pairwise. checkpoint_path: str: path...
Implement the Python class `DuoBERT_ReRanker_Transform` described below. Class description: Implement the DuoBERT_ReRanker_Transform class. Method signatures and docstrings: - def __init__(self, checkpoint_dir, get_doc_fn, rerank_top=10, **kwargs): A Transform that reorders a list pairwise. checkpoint_path: str: path...
92dd4d41ad6f2be5b5c4e296e2a355bb14b9a1db
<|skeleton|> class DuoBERT_ReRanker_Transform: def __init__(self, checkpoint_dir, get_doc_fn, rerank_top=10, **kwargs): """A Transform that reorders a list pairwise. checkpoint_path: str: path to only the state dict of the model, loaded with load_state_dict""" <|body_0|> def __call__(self, sam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DuoBERT_ReRanker_Transform: def __init__(self, checkpoint_dir, get_doc_fn, rerank_top=10, **kwargs): """A Transform that reorders a list pairwise. checkpoint_path: str: path to only the state dict of the model, loaded with load_state_dict""" self.rerank_top = rerank_top self.duoBERT_sc...
the_stack_v2_python_sparse
notebooks/src/models_and_transforms/complex_transforms.py
carlos-gemmell/Glasgow-NLP
train
0
eedd648db0b8811eaf7d67435b4645201ef1cee8
[ "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.
DocumentAnnotatorServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentAnnotatorServicer: """Missing associated documentation comment in .proto file.""" def AnnotateDocument(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def AnswerDocumentQuestion(self, request, context): "...
stack_v2_sparse_classes_75kplus_train_000943
4,705
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "AnnotateDocument", "signature": "def AnnotateDocument(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "AnswerDocumentQuestion", "signature": ...
2
stack_v2_sparse_classes_30k_train_054272
Implement the Python class `DocumentAnnotatorServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def AnnotateDocument(self, request, context): Missing associated documentation comment in .proto file. - def AnswerDocumentQuestion(se...
Implement the Python class `DocumentAnnotatorServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def AnnotateDocument(self, request, context): Missing associated documentation comment in .proto file. - def AnswerDocumentQuestion(se...
8de6749dd32ee2ff84f16780fdb7669a534e6f67
<|skeleton|> class DocumentAnnotatorServicer: """Missing associated documentation comment in .proto file.""" def AnnotateDocument(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def AnswerDocumentQuestion(self, request, context): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DocumentAnnotatorServicer: """Missing associated documentation comment in .proto file.""" def AnnotateDocument(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
the_stack_v2_python_sparse
gen/python/ssn/annotator/v1/annotator_pb2_grpc.py
e-conomic/vmlapis
train
1
2e77eb4d29fe1c87b52b1f9a05decb4429463b58
[ "assert not np.isinf(domain[1])\nx_pts, self.dx = get_asymmetric_interval_points(domain, max_nof_coefficients, interval_type=interval_type, get_spacing=True, **kwargs)\nself.mid = (x_pts[:-1] + x_pts[1:]) / 2\nself.J = J\ntry:\n self.ignore_zeros = kwargs['ignore_zeros']\nexcept KeyError:\n self.ignore_zeros ...
<|body_start_0|> assert not np.isinf(domain[1]) x_pts, self.dx = get_asymmetric_interval_points(domain, max_nof_coefficients, interval_type=interval_type, get_spacing=True, **kwargs) self.mid = (x_pts[:-1] + x_pts[1:]) / 2 self.J = J try: self.ignore_zeros = kwargs['i...
GKQuadDiscretizedAsymmetricBath
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GKQuadDiscretizedAsymmetricBath: def __init__(self, J, domain, max_nof_coefficients=100, interval_type='lin', **kwargs): """Generates direct discretization coefficients from a spectral density J, by computing the integrals: gamma_i = sqrt(int_i^i+1 J(x) dx) xi_i = int_i^i+1 J(x) * x dx/ ...
stack_v2_sparse_classes_75kplus_train_000944
3,938
permissive
[ { "docstring": "Generates direct discretization coefficients from a spectral density J, by computing the integrals: gamma_i = sqrt(int_i^i+1 J(x) dx) xi_i = int_i^i+1 J(x) * x dx/ gamma_i^2 :param J: Spectral density. A function defined on 'domain', must be >0 in the inner part of domain :param domain: List/tup...
2
stack_v2_sparse_classes_30k_train_023661
Implement the Python class `GKQuadDiscretizedAsymmetricBath` described below. Class description: Implement the GKQuadDiscretizedAsymmetricBath class. Method signatures and docstrings: - def __init__(self, J, domain, max_nof_coefficients=100, interval_type='lin', **kwargs): Generates direct discretization coefficients...
Implement the Python class `GKQuadDiscretizedAsymmetricBath` described below. Class description: Implement the GKQuadDiscretizedAsymmetricBath class. Method signatures and docstrings: - def __init__(self, J, domain, max_nof_coefficients=100, interval_type='lin', **kwargs): Generates direct discretization coefficients...
daf37f522f8acb6af2285d44f39cab31f34b01a4
<|skeleton|> class GKQuadDiscretizedAsymmetricBath: def __init__(self, J, domain, max_nof_coefficients=100, interval_type='lin', **kwargs): """Generates direct discretization coefficients from a spectral density J, by computing the integrals: gamma_i = sqrt(int_i^i+1 J(x) dx) xi_i = int_i^i+1 J(x) * x dx/ ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GKQuadDiscretizedAsymmetricBath: def __init__(self, J, domain, max_nof_coefficients=100, interval_type='lin', **kwargs): """Generates direct discretization coefficients from a spectral density J, by computing the integrals: gamma_i = sqrt(int_i^i+1 J(x) dx) xi_i = int_i^i+1 J(x) * x dx/ gamma_i^2 :par...
the_stack_v2_python_sparse
mapping/star/discretized_bath/asymmetric_gk_quad.py
fhoeb/py-mapping
train
2
a34f3ccf39e26284b732ad07ab7b06e28eb89808
[ "if estimate and self.mol_obj is None:\n raise CgbindCritical('Cannot estimate charges without a rdkit molecule object')\nif estimate:\n try:\n rdPartialCharges.ComputeGasteigerCharges(self.mol_obj)\n charges = [float(self.mol_obj.GetAtomWithIdx(i).GetProp('_GasteigerCharge')) for i in range(sel...
<|body_start_0|> if estimate and self.mol_obj is None: raise CgbindCritical('Cannot estimate charges without a rdkit molecule object') if estimate: try: rdPartialCharges.ComputeGasteigerCharges(self.mol_obj) charges = [float(self.mol_obj.GetAtomWit...
Molecule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Molecule: def get_charges(self, estimate=False): """Get the partial atomic charges using either XTB or estimate with RDKit using the Gasteiger charge scheme :param estimate: (bool) :param guess: (bool) :return:""" <|body_0|> def _init_smiles(self, smiles, use_etdg_confs=Fals...
stack_v2_sparse_classes_75kplus_train_000945
11,350
permissive
[ { "docstring": "Get the partial atomic charges using either XTB or estimate with RDKit using the Gasteiger charge scheme :param estimate: (bool) :param guess: (bool) :return:", "name": "get_charges", "signature": "def get_charges(self, estimate=False)" }, { "docstring": "Initialise a Molecule ob...
3
stack_v2_sparse_classes_30k_train_045553
Implement the Python class `Molecule` described below. Class description: Implement the Molecule class. Method signatures and docstrings: - def get_charges(self, estimate=False): Get the partial atomic charges using either XTB or estimate with RDKit using the Gasteiger charge scheme :param estimate: (bool) :param gue...
Implement the Python class `Molecule` described below. Class description: Implement the Molecule class. Method signatures and docstrings: - def get_charges(self, estimate=False): Get the partial atomic charges using either XTB or estimate with RDKit using the Gasteiger charge scheme :param estimate: (bool) :param gue...
cfa47c06a42cd63bef8a9ac6af9c3403773c47ca
<|skeleton|> class Molecule: def get_charges(self, estimate=False): """Get the partial atomic charges using either XTB or estimate with RDKit using the Gasteiger charge scheme :param estimate: (bool) :param guess: (bool) :return:""" <|body_0|> def _init_smiles(self, smiles, use_etdg_confs=Fals...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Molecule: def get_charges(self, estimate=False): """Get the partial atomic charges using either XTB or estimate with RDKit using the Gasteiger charge scheme :param estimate: (bool) :param guess: (bool) :return:""" if estimate and self.mol_obj is None: raise CgbindCritical('Cannot e...
the_stack_v2_python_sparse
cgbind/molecule.py
duartegroup/cgbind
train
9
cadc0cbca54d1d8bb1e933ece189bf032ada710d
[ "super(MTLSTM, self).__init__()\nself.word_embedding = word_embedding\nself.rnn = nn.LSTM(300, 300, num_layers=2, bidirectional=True, batch_first=True)\ndata_handler = DataHandler(cache_path=CachePath.PRETRAINED_VECTOR)\ncove_weight_path = data_handler.read(pretrained_path, return_path=True)\nif torch.cuda.is_avail...
<|body_start_0|> super(MTLSTM, self).__init__() self.word_embedding = word_embedding self.rnn = nn.LSTM(300, 300, num_layers=2, bidirectional=True, batch_first=True) data_handler = DataHandler(cache_path=CachePath.PRETRAINED_VECTOR) cove_weight_path = data_handler.read(pretrained...
MTLSTM
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MTLSTM: def __init__(self, word_embedding, pretrained_path=None, requires_grad=False, residual_embeddings=False): """Initialize an MTLSTM. Arguments: n_vocab (bool): If not None, initialize MTLSTM with an embedding matrix with n_vocab vectors vectors (Float Tensor): If not None, initiapi...
stack_v2_sparse_classes_75kplus_train_000946
2,325
permissive
[ { "docstring": "Initialize an MTLSTM. Arguments: n_vocab (bool): If not None, initialize MTLSTM with an embedding matrix with n_vocab vectors vectors (Float Tensor): If not None, initiapize embedding matrix with specified vectors residual_embedding (bool): If True, concatenate the input embeddings with MTLSTM o...
2
null
Implement the Python class `MTLSTM` described below. Class description: Implement the MTLSTM class. Method signatures and docstrings: - def __init__(self, word_embedding, pretrained_path=None, requires_grad=False, residual_embeddings=False): Initialize an MTLSTM. Arguments: n_vocab (bool): If not None, initialize MTL...
Implement the Python class `MTLSTM` described below. Class description: Implement the MTLSTM class. Method signatures and docstrings: - def __init__(self, word_embedding, pretrained_path=None, requires_grad=False, residual_embeddings=False): Initialize an MTLSTM. Arguments: n_vocab (bool): If not None, initialize MTL...
89b3e5c5ec0486886876ea3bac381508c6a6bf58
<|skeleton|> class MTLSTM: def __init__(self, word_embedding, pretrained_path=None, requires_grad=False, residual_embeddings=False): """Initialize an MTLSTM. Arguments: n_vocab (bool): If not None, initialize MTLSTM with an embedding matrix with n_vocab vectors vectors (Float Tensor): If not None, initiapi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MTLSTM: def __init__(self, word_embedding, pretrained_path=None, requires_grad=False, residual_embeddings=False): """Initialize an MTLSTM. Arguments: n_vocab (bool): If not None, initialize MTLSTM with an embedding matrix with n_vocab vectors vectors (Float Tensor): If not None, initiapize embedding m...
the_stack_v2_python_sparse
claf/tokens/cove.py
srlee-ai/claf
train
0
0229bec03ca65c0881390e7ec44f22405501cb91
[ "WHITE, GREY, BLACK = (0, 1, 2)\nstack = [course]\ncolor_mapping = {}\nseen = []\nwhile stack:\n course = stack.pop()\n seen.append(course)\n if course not in graph or course in explored:\n continue\n if color_mapping[course] == GREY:\n color_mapping[course] = BLACK\n else:\n col...
<|body_start_0|> WHITE, GREY, BLACK = (0, 1, 2) stack = [course] color_mapping = {} seen = [] while stack: course = stack.pop() seen.append(course) if course not in graph or course in explored: continue if color_mapp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def detect_cycle(self, graph, course, explored): """>>> s = Solution() # >>> graph = {0: [1], 1:[0]} # >>> s.detect_cycle(graph, 0, []) # True # >>> s.detect_cycle(graph, 1, []) # True # >>> graph = {0:[1]} # >>> s.detect_cycle(graph, 0, []) # False # >>> s.detect_cycle(graph, ...
stack_v2_sparse_classes_75kplus_train_000947
3,567
no_license
[ { "docstring": ">>> s = Solution() # >>> graph = {0: [1], 1:[0]} # >>> s.detect_cycle(graph, 0, []) # True # >>> s.detect_cycle(graph, 1, []) # True # >>> graph = {0:[1]} # >>> s.detect_cycle(graph, 0, []) # False # >>> s.detect_cycle(graph, 1, []) # False # >>> graph = {0:[1], 1:[2]} # >>> s.detect_cycle(graph...
2
stack_v2_sparse_classes_30k_train_007636
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detect_cycle(self, graph, course, explored): >>> s = Solution() # >>> graph = {0: [1], 1:[0]} # >>> s.detect_cycle(graph, 0, []) # True # >>> s.detect_cycle(graph, 1, []) # T...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detect_cycle(self, graph, course, explored): >>> s = Solution() # >>> graph = {0: [1], 1:[0]} # >>> s.detect_cycle(graph, 0, []) # True # >>> s.detect_cycle(graph, 1, []) # T...
3b13a02f9c8273f9794a57b948d2655792707f37
<|skeleton|> class Solution: def detect_cycle(self, graph, course, explored): """>>> s = Solution() # >>> graph = {0: [1], 1:[0]} # >>> s.detect_cycle(graph, 0, []) # True # >>> s.detect_cycle(graph, 1, []) # True # >>> graph = {0:[1]} # >>> s.detect_cycle(graph, 0, []) # False # >>> s.detect_cycle(graph, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def detect_cycle(self, graph, course, explored): """>>> s = Solution() # >>> graph = {0: [1], 1:[0]} # >>> s.detect_cycle(graph, 0, []) # True # >>> s.detect_cycle(graph, 1, []) # True # >>> graph = {0:[1]} # >>> s.detect_cycle(graph, 0, []) # False # >>> s.detect_cycle(graph, 1, []) # False...
the_stack_v2_python_sparse
course_schedule.py
gsy/leetcode
train
1
a7c6de54e0b4448064476e07c284c9ace13e00fd
[ "cnt = [0] * 2\nleft, right = (0, 0)\nres = 0\nwhile right < len(nums):\n cnt[nums[right]] += 1\n if nums[right] == 0:\n while cnt[0] > k:\n cnt[nums[left]] -= 1\n left += 1\n if cnt[0] <= k:\n while right + 1 < len(nums) and nums[right + 1] == 1:\n right += 1...
<|body_start_0|> cnt = [0] * 2 left, right = (0, 0) res = 0 while right < len(nums): cnt[nums[right]] += 1 if nums[right] == 0: while cnt[0] > k: cnt[nums[left]] -= 1 left += 1 if cnt[0] <= k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestOnes(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def longestOnes2(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt = [0] * ...
stack_v2_sparse_classes_75kplus_train_000948
1,278
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "longestOnes", "signature": "def longestOnes(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "longestOnes2", "signature": "def longestOnes2(self, nums, k)" } ]
2
stack_v2_sparse_classes_30k_train_033624
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestOnes(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def longestOnes2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestOnes(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def longestOnes2(self, nums, k): :type nums: List[int] :type k: int :rtype: int <|skeleton|> cla...
a32a1add8720de35e0ddc0c51efe781fb04c9d4a
<|skeleton|> class Solution: def longestOnes(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def longestOnes2(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestOnes(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" cnt = [0] * 2 left, right = (0, 0) res = 0 while right < len(nums): cnt[nums[right]] += 1 if nums[right] == 0: while cnt[0] > k: ...
the_stack_v2_python_sparse
双指针/leetcode_1004_Max_Consecutive_Ones_III.py
cleverer123/Algorithm
train
0
ee7e731ea65d9247b90afcf0268e36a468e7415e
[ "self.size = 0\nself.capacity = capacity\nself.node = dict()\nself.freq = collections.defaultdict(DLinkedList)\nself.minfreq = 0", "freq = node.freq\nself.freq[freq].pop(node)\nif self.minfreq == freq and (not self.freq[freq]):\n self.minfreq += 1\nnode.freq += 1\nfreq = node.freq\nself.freq[freq].append(node)...
<|body_start_0|> self.size = 0 self.capacity = capacity self.node = dict() self.freq = collections.defaultdict(DLinkedList) self.minfreq = 0 <|end_body_0|> <|body_start_1|> freq = node.freq self.freq[freq].pop(node) if self.minfreq == freq and (not self.f...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """Three things to maintain: 1. a dict, named as `self.node`, for the reference of all nodes given key. That is, O(1) time to retrieve node given a key. 2. Each frequency has a doubly linked list, store in `self.freq`, where key is the frequency, a...
stack_v2_sparse_classes_75kplus_train_000949
13,553
no_license
[ { "docstring": "Three things to maintain: 1. a dict, named as `self.node`, for the reference of all nodes given key. That is, O(1) time to retrieve node given a key. 2. Each frequency has a doubly linked list, store in `self.freq`, where key is the frequency, and value is an object of `DLinkedList` 3. The min f...
4
stack_v2_sparse_classes_30k_train_048835
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): Three things to maintain: 1. a dict, named as `self.node`, for the reference of all nodes given key. That is, O(1) time to retrieve node given a key...
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): Three things to maintain: 1. a dict, named as `self.node`, for the reference of all nodes given key. That is, O(1) time to retrieve node given a key...
a4d8b54d3004866fd304e732707eef4401dfdb0a
<|skeleton|> class LFUCache: def __init__(self, capacity): """Three things to maintain: 1. a dict, named as `self.node`, for the reference of all nodes given key. That is, O(1) time to retrieve node given a key. 2. Each frequency has a doubly linked list, store in `self.freq`, where key is the frequency, a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LFUCache: def __init__(self, capacity): """Three things to maintain: 1. a dict, named as `self.node`, for the reference of all nodes given key. That is, O(1) time to retrieve node given a key. 2. Each frequency has a doubly linked list, store in `self.freq`, where key is the frequency, and value is an...
the_stack_v2_python_sparse
LeetcodeNew/python/LC_460.py
derrickweiruluo/OptimizedLeetcode-1
train
0
57cf1e5d65824b638cdc1ce852ebc3591192e864
[ "levels = sorted(box_outputs.keys())\nbox_losses = []\nfor level in levels:\n box_losses.append(self._rpn_box_loss(box_outputs[level], labels[level], delta=self.delta))\nrpn_box_loss = jnp.sum(jnp.array(box_losses))\nreturn rpn_box_loss", "mask = box_targets != 0.0\nbox_loss = huber_loss(box_outputs, box_targe...
<|body_start_0|> levels = sorted(box_outputs.keys()) box_losses = [] for level in levels: box_losses.append(self._rpn_box_loss(box_outputs[level], labels[level], delta=self.delta)) rpn_box_loss = jnp.sum(jnp.array(box_losses)) return rpn_box_loss <|end_body_0|> <|bod...
Region Proposal Network box regression loss function. Attributes: delta: The delta of box Huber loss.
RpnBoxLoss
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RpnBoxLoss: """Region Proposal Network box regression loss function. Attributes: delta: The delta of box Huber loss.""" def __call__(self, box_outputs, labels): """Computes and gathers RPN box losses from all levels. Args: box_outputs: A dictionary with keys representing levels and v...
stack_v2_sparse_classes_75kplus_train_000950
20,333
permissive
[ { "docstring": "Computes and gathers RPN box losses from all levels. Args: box_outputs: A dictionary with keys representing levels and values representing box regression targets in [batch_size, height, width, num_anchors * 4]. labels: A dictionary returned from dataloader with keys representing levels and value...
2
stack_v2_sparse_classes_30k_val_002692
Implement the Python class `RpnBoxLoss` described below. Class description: Region Proposal Network box regression loss function. Attributes: delta: The delta of box Huber loss. Method signatures and docstrings: - def __call__(self, box_outputs, labels): Computes and gathers RPN box losses from all levels. Args: box_...
Implement the Python class `RpnBoxLoss` described below. Class description: Region Proposal Network box regression loss function. Attributes: delta: The delta of box Huber loss. Method signatures and docstrings: - def __call__(self, box_outputs, labels): Computes and gathers RPN box losses from all levels. Args: box_...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class RpnBoxLoss: """Region Proposal Network box regression loss function. Attributes: delta: The delta of box Huber loss.""" def __call__(self, box_outputs, labels): """Computes and gathers RPN box losses from all levels. Args: box_outputs: A dictionary with keys representing levels and v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RpnBoxLoss: """Region Proposal Network box regression loss function. Attributes: delta: The delta of box Huber loss.""" def __call__(self, box_outputs, labels): """Computes and gathers RPN box losses from all levels. Args: box_outputs: A dictionary with keys representing levels and values represe...
the_stack_v2_python_sparse
moe_mtl/losses/maskrcnn_losses.py
Jimmy-INL/google-research
train
1
cfbb3e99d6a2bb48aa8f8cbf643127e85bb5aa2a
[ "super(Sim_Attn, self).__init__()\nself.encoder_size = encoder_size\nself.decoder_size = decoder_size\nself.num_labels = num_labels\nself.hidden_size = hidden_size\nself.e_mlp = nn.Sequential(nn.Linear(encoder_size, hidden_size), nn.SELU(), nn.Linear(hidden_size, K), nn.SELU()) if MLP_Layer == 2 else nn.Sequential(...
<|body_start_0|> super(Sim_Attn, self).__init__() self.encoder_size = encoder_size self.decoder_size = decoder_size self.num_labels = num_labels self.hidden_size = hidden_size self.e_mlp = nn.Sequential(nn.Linear(encoder_size, hidden_size), nn.SELU(), nn.Linear(hidden_siz...
Sim_Attn
[ "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sim_Attn: def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): """num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。 if LAYER_NORM_USE: edus = self.edu_norm(edus)""" <|body_...
stack_v2_sparse_classes_75kplus_train_000951
16,149
permissive
[ { "docstring": "num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。 if LAYER_NORM_USE: edus = self.edu_norm(edus)", "name": "__init__", "signature": "def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SI...
2
stack_v2_sparse_classes_30k_train_052622
Implement the Python class `Sim_Attn` described below. Class description: Implement the Sim_Attn class. Method signatures and docstrings: - def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即...
Implement the Python class `Sim_Attn` described below. Class description: Implement the Sim_Attn class. Method signatures and docstrings: - def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即...
fd71b353c59bcb82ec2cd0bebf943040756faa63
<|skeleton|> class Sim_Attn: def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): """num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。 if LAYER_NORM_USE: edus = self.edu_norm(edus)""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sim_Attn: def __init__(self, encoder_size, decoder_size, num_labels=1, hidden_size=HIDDEN_SIZE): """num_labels 代表当前节点到各个节点之间做的 bi_affine attention 分配给各个节点的向量维度, 因为子句分割是分割点选择任务,所以每个分割点的维度设置为1即可,一组标量的 soft_max 概率即 为边界标签的选择结果。 if LAYER_NORM_USE: edus = self.edu_norm(edus)""" super(Sim_Attn, self)...
the_stack_v2_python_sparse
CDTB_Seg/model/ENC_DEC_GCN/model.py
NLP-Discourse-SoochowU/segmenter2020
train
0
19823ae82390e2d9123df87592f349b979b727e1
[ "if len(seed_bytes) != CardanoByronLegacyMstKeyGeneratorConst.SEED_BYTE_LEN:\n raise ValueError(f'Invalid seed length ({len(seed_bytes)})')\nreturn cls.__HashRepeatedly(cbor2.dumps(seed_bytes), 1)", "il_bytes, ir_bytes = HmacSha512.QuickDigestHalves(data_bytes, CardanoByronLegacyMstKeyGeneratorConst.HMAC_MESSA...
<|body_start_0|> if len(seed_bytes) != CardanoByronLegacyMstKeyGeneratorConst.SEED_BYTE_LEN: raise ValueError(f'Invalid seed length ({len(seed_bytes)})') return cls.__HashRepeatedly(cbor2.dumps(seed_bytes), 1) <|end_body_0|> <|body_start_1|> il_bytes, ir_bytes = HmacSha512.QuickDige...
Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).
CardanoByronLegacyMstKeyGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CardanoByronLegacyMstKeyGenerator: """Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a mast...
stack_v2_sparse_classes_75kplus_train_000952
4,310
permissive
[ { "docstring": "Generate a master key from the specified seed. Args: seed_bytes (bytes): Seed bytes Returns: tuple[bytes, bytes]: Private key bytes (index 0) and chain code bytes (index 1) Raises: Bip32KeyError: If the seed is not suitable for master key generation ValueError: If seed length is not valid", ...
3
stack_v2_sparse_classes_30k_train_025721
Implement the Python class `CardanoByronLegacyMstKeyGenerator` described below. Class description: Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus). Method signatures and docstrings: - def GenerateFromSeed(cls, s...
Implement the Python class `CardanoByronLegacyMstKeyGenerator` described below. Class description: Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus). Method signatures and docstrings: - def GenerateFromSeed(cls, s...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class CardanoByronLegacyMstKeyGenerator: """Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a mast...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CardanoByronLegacyMstKeyGenerator: """Cardano Byron legacy master key generator class. It allows master keys generation in according to Cardano Byron (legacy, used by old versions of Daedalus).""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a master key from t...
the_stack_v2_python_sparse
bip_utils/cardano/bip32/cardano_byron_legacy_mst_key_generator.py
ebellocchia/bip_utils
train
244
70cd8bfedc35afc1d79db5e2748d10e634c70261
[ "if self.get_argument('type', None) == 'province':\n ret = {'status': True, 'rows': '', 'summary': ''}\n try:\n province_id = self.get_argument('province_id', None)\n if not province_id:\n ret['status'] = False\n ret['summary'] = '请指定省份ID'\n else:\n region...
<|body_start_0|> if self.get_argument('type', None) == 'province': ret = {'status': True, 'rows': '', 'summary': ''} try: province_id = self.get_argument('province_id', None) if not province_id: ret['status'] = False ...
CityHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CityHandler: def get(self, *args, **kwargs): """获取 :param args: :param kwargs: :return:""" <|body_0|> def post(self, *args, **kwargs): """添加 :param args: :param kwargs: :return:""" <|body_1|> def put(self, *args, **kwargs): """更新 :param args: :pa...
stack_v2_sparse_classes_75kplus_train_000953
13,334
no_license
[ { "docstring": "获取 :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "添加 :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, *args, **kwargs)" }, { "docstring": "更新 :param args: :p...
4
stack_v2_sparse_classes_30k_train_010654
Implement the Python class `CityHandler` described below. Class description: Implement the CityHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): 获取 :param args: :param kwargs: :return: - def post(self, *args, **kwargs): 添加 :param args: :param kwargs: :return: - def put(self, *args, **...
Implement the Python class `CityHandler` described below. Class description: Implement the CityHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): 获取 :param args: :param kwargs: :return: - def post(self, *args, **kwargs): 添加 :param args: :param kwargs: :return: - def put(self, *args, **...
0056d8edb9b8912e28b0332b3202e8a8d50f7157
<|skeleton|> class CityHandler: def get(self, *args, **kwargs): """获取 :param args: :param kwargs: :return:""" <|body_0|> def post(self, *args, **kwargs): """添加 :param args: :param kwargs: :return:""" <|body_1|> def put(self, *args, **kwargs): """更新 :param args: :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CityHandler: def get(self, *args, **kwargs): """获取 :param args: :param kwargs: :return:""" if self.get_argument('type', None) == 'province': ret = {'status': True, 'rows': '', 'summary': ''} try: province_id = self.get_argument('province_id', None) ...
the_stack_v2_python_sparse
UIAdmin/Controllers/Region.py
kevin-light/Jd-shop
train
0
e0ae544a730e81eee7ecc97803ee144a586ce760
[ "self.graph = graph\nif not self._is_eulerian():\n raise ValueError('the graph is not eulerian')\nself.eulerian_cycle = list()\nself._graph_copy = self.graph.copy()", "if source is None:\n source = next(self.graph.iternodes())\nnode = source\nself.eulerian_cycle.append(node)\nwhile self._graph_copy.outdegre...
<|body_start_0|> self.graph = graph if not self._is_eulerian(): raise ValueError('the graph is not eulerian') self.eulerian_cycle = list() self._graph_copy = self.graph.copy() <|end_body_0|> <|body_start_1|> if source is None: source = next(self.graph.ite...
Fleury's algorithm for finding an Eulerian cycle (multigraphs). Complexity O(V*E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eulerian_path
FleuryDFS
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FleuryDFS: """Fleury's algorithm for finding an Eulerian cycle (multigraphs). Complexity O(V*E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eulerian_p...
stack_v2_sparse_classes_75kplus_train_000954
9,406
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None)" }, { "docstring": "Bridge test.", "name": "_is_bridge", "signa...
4
stack_v2_sparse_classes_30k_train_011113
Implement the Python class `FleuryDFS` described below. Class description: Fleury's algorithm for finding an Eulerian cycle (multigraphs). Complexity O(V*E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private Notes ----- Based on the description from: h...
Implement the Python class `FleuryDFS` described below. Class description: Fleury's algorithm for finding an Eulerian cycle (multigraphs). Complexity O(V*E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private Notes ----- Based on the description from: h...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class FleuryDFS: """Fleury's algorithm for finding an Eulerian cycle (multigraphs). Complexity O(V*E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eulerian_p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FleuryDFS: """Fleury's algorithm for finding an Eulerian cycle (multigraphs). Complexity O(V*E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eulerian_path""" d...
the_stack_v2_python_sparse
graphtheory/eulerian/fleury.py
kgashok/graphs-dict
train
0
7db13e19468a4ea79509d8a6f317fba0d86beff2
[ "self.n_cv_flt = n_cv_flt\nself.n_cv_ln = n_cv_ln\nself.cv_activation = cv_activation\nsuper().__init__(l=l)", "n_cv_flt, n_cv_ln = (self.n_cv_flt, self.n_cv_ln)\ncv_activation = self.cv_activation\nmodel = Sequential()\nprint('n_cv_flt, n_cv_ln, cv_activation', n_cv_flt, n_cv_ln, cv_activation)\nmodel.add(Convol...
<|body_start_0|> self.n_cv_flt = n_cv_flt self.n_cv_ln = n_cv_ln self.cv_activation = cv_activation super().__init__(l=l) <|end_body_0|> <|body_start_1|> n_cv_flt, n_cv_ln = (self.n_cv_flt, self.n_cv_ln) cv_activation = self.cv_activation model = Sequential() ...
CNNC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNNC: def __init__(self, n_cv_flt=2, n_cv_ln=3, cv_activation='relu', l=[49, 30, 10, 3]): """Convolutional neural networks""" <|body_0|> def modeling(self, l=[49, 30, 10, 3]): """generate model""" <|body_1|> def X_reshape(self, X_train_2D, X_val_2D=None)...
stack_v2_sparse_classes_75kplus_train_000955
7,760
permissive
[ { "docstring": "Convolutional neural networks", "name": "__init__", "signature": "def __init__(self, n_cv_flt=2, n_cv_ln=3, cv_activation='relu', l=[49, 30, 10, 3])" }, { "docstring": "generate model", "name": "modeling", "signature": "def modeling(self, l=[49, 30, 10, 3])" }, { ...
3
stack_v2_sparse_classes_30k_train_008848
Implement the Python class `CNNC` described below. Class description: Implement the CNNC class. Method signatures and docstrings: - def __init__(self, n_cv_flt=2, n_cv_ln=3, cv_activation='relu', l=[49, 30, 10, 3]): Convolutional neural networks - def modeling(self, l=[49, 30, 10, 3]): generate model - def X_reshape(...
Implement the Python class `CNNC` described below. Class description: Implement the CNNC class. Method signatures and docstrings: - def __init__(self, n_cv_flt=2, n_cv_ln=3, cv_activation='relu', l=[49, 30, 10, 3]): Convolutional neural networks - def modeling(self, l=[49, 30, 10, 3]): generate model - def X_reshape(...
b7e3c860280581e37c7b5254e18ff4b19c112ded
<|skeleton|> class CNNC: def __init__(self, n_cv_flt=2, n_cv_ln=3, cv_activation='relu', l=[49, 30, 10, 3]): """Convolutional neural networks""" <|body_0|> def modeling(self, l=[49, 30, 10, 3]): """generate model""" <|body_1|> def X_reshape(self, X_train_2D, X_val_2D=None)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CNNC: def __init__(self, n_cv_flt=2, n_cv_ln=3, cv_activation='relu', l=[49, 30, 10, 3]): """Convolutional neural networks""" self.n_cv_flt = n_cv_flt self.n_cv_ln = n_cv_ln self.cv_activation = cv_activation super().__init__(l=l) def modeling(self, l=[49, 30, 10, ...
the_stack_v2_python_sparse
repository/_kkeras_r0.py
jskDr/jamespy_py3
train
5
82f669b07bba9c834ad75fb19995066f081cbb86
[ "if not isinstance(personRepo, PersonRepository):\n raise NABException('The given repository of people is not valid.')\nif not isinstance(activityRepo, ActivityRepository):\n raise NABException('The given repository of activities is not valid.')\nself.__personRepo = personRepo\nself.__activityRepo = activityR...
<|body_start_0|> if not isinstance(personRepo, PersonRepository): raise NABException('The given repository of people is not valid.') if not isinstance(activityRepo, ActivityRepository): raise NABException('The given repository of activities is not valid.') self.__personRe...
Class used for handling the operations regarding statistics.
StatsController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatsController: """Class used for handling the operations regarding statistics.""" def __init__(self, personRepo, activityRepo): """Constructor for the class StatsController. :param personRepo: PersonRepository - repository containing people :param activityRepo: ActivityRepository- ...
stack_v2_sparse_classes_75kplus_train_000956
4,851
no_license
[ { "docstring": "Constructor for the class StatsController. :param personRepo: PersonRepository - repository containing people :param activityRepo: ActivityRepository- repository containing activities :exception NABException: if one of the parameters is not valid", "name": "__init__", "signature": "def _...
6
null
Implement the Python class `StatsController` described below. Class description: Class used for handling the operations regarding statistics. Method signatures and docstrings: - def __init__(self, personRepo, activityRepo): Constructor for the class StatsController. :param personRepo: PersonRepository - repository co...
Implement the Python class `StatsController` described below. Class description: Class used for handling the operations regarding statistics. Method signatures and docstrings: - def __init__(self, personRepo, activityRepo): Constructor for the class StatsController. :param personRepo: PersonRepository - repository co...
fc0f59ae78a6000d0fc1f63edb52ca7e3b840548
<|skeleton|> class StatsController: """Class used for handling the operations regarding statistics.""" def __init__(self, personRepo, activityRepo): """Constructor for the class StatsController. :param personRepo: PersonRepository - repository containing people :param activityRepo: ActivityRepository- ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StatsController: """Class used for handling the operations regarding statistics.""" def __init__(self, personRepo, activityRepo): """Constructor for the class StatsController. :param personRepo: PersonRepository - repository containing people :param activityRepo: ActivityRepository- repository co...
the_stack_v2_python_sparse
sem1/fp/labs/lab12-13/NABManagement/controller/StatsController.py
mirceadino/CollegeAssignments
train
1
634f4bdc8758b11a597d8affefd13e27a1b2636a
[ "title = rs_track.get('title', '')\nif not title:\n return []\nartist, track = re.match(\"^(.+)\\\\,\\\\s'?(.+)'?$\", title).groups()\nreturn [artist, track.rstrip(\"'\")]", "tracks = []\nresp = requests.get(page_url, headers=self.headers, cookies=cookies)\nitems = json.loads(resp.text).get('items', [])\nfor i...
<|body_start_0|> title = rs_track.get('title', '') if not title: return [] artist, track = re.match("^(.+)\\,\\s'?(.+)'?$", title).groups() return [artist, track.rstrip("'")] <|end_body_0|> <|body_start_1|> tracks = [] resp = requests.get(page_url, headers=se...
Rolling stone 5000 greatest songs requestor
RS500Requestor
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RS500Requestor: """Rolling stone 5000 greatest songs requestor""" def normalize_item(rs_track): """Normalize track name""" <|body_0|> def get_tracks(self, page_url, cookies): """Get tracks from single page""" <|body_1|> def get_all(self): """...
stack_v2_sparse_classes_75kplus_train_000957
7,415
permissive
[ { "docstring": "Normalize track name", "name": "normalize_item", "signature": "def normalize_item(rs_track)" }, { "docstring": "Get tracks from single page", "name": "get_tracks", "signature": "def get_tracks(self, page_url, cookies)" }, { "docstring": "Get tracks from all pages"...
3
stack_v2_sparse_classes_30k_train_033170
Implement the Python class `RS500Requestor` described below. Class description: Rolling stone 5000 greatest songs requestor Method signatures and docstrings: - def normalize_item(rs_track): Normalize track name - def get_tracks(self, page_url, cookies): Get tracks from single page - def get_all(self): Get tracks from...
Implement the Python class `RS500Requestor` described below. Class description: Rolling stone 5000 greatest songs requestor Method signatures and docstrings: - def normalize_item(rs_track): Normalize track name - def get_tracks(self, page_url, cookies): Get tracks from single page - def get_all(self): Get tracks from...
3e35a25cfcf982a3871cf0d819bae4374ee31ecf
<|skeleton|> class RS500Requestor: """Rolling stone 5000 greatest songs requestor""" def normalize_item(rs_track): """Normalize track name""" <|body_0|> def get_tracks(self, page_url, cookies): """Get tracks from single page""" <|body_1|> def get_all(self): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RS500Requestor: """Rolling stone 5000 greatest songs requestor""" def normalize_item(rs_track): """Normalize track name""" title = rs_track.get('title', '') if not title: return [] artist, track = re.match("^(.+)\\,\\s'?(.+)'?$", title).groups() return ...
the_stack_v2_python_sparse
voiceplay/player/tasks/top.py
tb0hdan/voiceplay
train
4
f44b0c8b93a32cde2118a066c67f5afc252dcf27
[ "def recursive(i, j):\n if i > j:\n return 0\n count = Counter(s[i:j + 1])\n for m in range(i, j + 1):\n if count[s[m]] >= k:\n continue\n n = m + 1\n while n <= j and count[s[n]] < k:\n n += 1\n return max(recursive(i, m - 1), recursive(n, j))\n ...
<|body_start_0|> def recursive(i, j): if i > j: return 0 count = Counter(s[i:j + 1]) for m in range(i, j + 1): if count[s[m]] >= k: continue n = m + 1 while n <= j and count[s[n]] < k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def recursive(i, j): ...
stack_v2_sparse_classes_75kplus_train_000958
1,891
no_license
[ { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring", "signature": "def longestSubstring(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring", "signature": "def longestSubstring(self, s, k)" } ]
2
stack_v2_sparse_classes_30k_train_008717
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int <|skeleton|> class Solution: ...
63b7eedc720c1ce14880b80744dcd5ef7107065c
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" def recursive(i, j): if i > j: return 0 count = Counter(s[i:j + 1]) for m in range(i, j + 1): if count[s[m]] >= k: con...
the_stack_v2_python_sparse
problems/longestSubstring.py
joddiy/leetcode
train
1
8720ec9c64c995aaabc54db0c0d4ead0ac61a467
[ "if isinstance(key, int):\n return CGAType(key)\nif key not in CGAType._member_map_:\n return extend_enum(CGAType, key, default)\nreturn CGAType[key]", "if not (isinstance(value, int) and 0 <= value <= 340282366920938463463374607431768211455):\n raise ValueError('%r is not a valid %s' % (value, cls.__nam...
<|body_start_0|> if isinstance(key, int): return CGAType(key) if key not in CGAType._member_map_: return extend_enum(CGAType, key, default) return CGAType[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 3402823669209384634633...
[CGAType] CGA Extension Type Tags
CGAType
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CGAType: """[CGAType] CGA Extension Type Tags""" def get(key: 'int | str', default: 'int'=-1) -> 'CGAType': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def _missing_(cls, value...
stack_v2_sparse_classes_75kplus_train_000959
2,568
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'CGAType'" }, { "docstring": "Lookup function used when value is not found. Arg...
2
stack_v2_sparse_classes_30k_val_001533
Implement the Python class `CGAType` described below. Class description: [CGAType] CGA Extension Type Tags Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'CGAType': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta pri...
Implement the Python class `CGAType` described below. Class description: [CGAType] CGA Extension Type Tags Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'CGAType': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta pri...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class CGAType: """[CGAType] CGA Extension Type Tags""" def get(key: 'int | str', default: 'int'=-1) -> 'CGAType': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def _missing_(cls, value...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CGAType: """[CGAType] CGA Extension Type Tags""" def get(key: 'int | str', default: 'int'=-1) -> 'CGAType': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int): return CGAType(k...
the_stack_v2_python_sparse
pcapkit/const/mh/cga_type.py
JarryShaw/PyPCAPKit
train
204
7ac523f9bdaf166d52b283394f60a78bc912ef30
[ "visited = set()\nwhile p:\n visited.add(p)\n p = p.parent\nwhile q:\n if q in visited:\n return q\n q = q.parent\nreturn None", "n1, n2 = (p, q)\nwhile n1 != n2:\n n1 = n1.parent if n1.parent else p\n n2 = n2.parent if n2.parent else q\nreturn n1" ]
<|body_start_0|> visited = set() while p: visited.add(p) p = p.parent while q: if q in visited: return q q = q.parent return None <|end_body_0|> <|body_start_1|> n1, n2 = (p, q) while n1 != n2: n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node': """방문한 노드를 기록 O(H) / O(H)""" <|body_0|> def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node': """Cycle 찾듯이 반복하면, LCA에서 겹치게됨. LCA보다 위에서 겹치는 경우는 없다. O(H) / O(1)""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_000960
952
no_license
[ { "docstring": "방문한 노드를 기록 O(H) / O(H)", "name": "lowestCommonAncestor_1", "signature": "def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node'" }, { "docstring": "Cycle 찾듯이 반복하면, LCA에서 겹치게됨. LCA보다 위에서 겹치는 경우는 없다. O(H) / O(1)", "name": "lowestCommonAncestor", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_051367
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node': 방문한 노드를 기록 O(H) / O(H) - def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node': Cycle 찾듯이 반복하면, LCA에서 겹...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node': 방문한 노드를 기록 O(H) / O(H) - def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node': Cycle 찾듯이 반복하면, LCA에서 겹...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node': """방문한 노드를 기록 O(H) / O(H)""" <|body_0|> def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node': """Cycle 찾듯이 반복하면, LCA에서 겹치게됨. LCA보다 위에서 겹치는 경우는 없다. O(H) / O(1)""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node': """방문한 노드를 기록 O(H) / O(H)""" visited = set() while p: visited.add(p) p = p.parent while q: if q in visited: return q q = q.parent ...
the_stack_v2_python_sparse
Leetcode/1650.py
hanwgyu/algorithm_problem_solving
train
5
df88bf0fac6811b2ea391a48114f5f1b06af83c6
[ "super().__init__()\nself.bias = bias\nself.win_len = window_size\nself.channels = channels\nself.average = False\nif reduction == 'mean':\n self.average = True\nwin1d = gaussian(window_size, 1.5).unsqueeze(1)\nwin2d = win1d.mm(win1d.t()).float().unsqueeze(0).unsqueeze(0)\nself.window = torch.Tensor(win2d.expand...
<|body_start_0|> super().__init__() self.bias = bias self.win_len = window_size self.channels = channels self.average = False if reduction == 'mean': self.average = True win1d = gaussian(window_size, 1.5).unsqueeze(1) win2d = win1d.mm(win1d.t()...
SSimLoss. This is an implementation of structural similarity (SSIM) loss. This code is modified from https://github.com/Po-Hsun-Su/pytorch-ssim.
SSimLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSimLoss: """SSimLoss. This is an implementation of structural similarity (SSIM) loss. This code is modified from https://github.com/Po-Hsun-Su/pytorch-ssim.""" def __init__(self, bias: float=6.0, window_size: int=11, channels: int=1, reduction: str='none'): """Initialization. Args: ...
stack_v2_sparse_classes_75kplus_train_000961
9,540
permissive
[ { "docstring": "Initialization. Args: bias (float, optional): value of the bias. Defaults to 6.0. window_size (int, optional): Window size. Defaults to 11. channels (int, optional): Number of channels. Defaults to 1. reduction (str, optional): Type of reduction during the loss calculation. Defaults to \"none\"....
3
null
Implement the Python class `SSimLoss` described below. Class description: SSimLoss. This is an implementation of structural similarity (SSIM) loss. This code is modified from https://github.com/Po-Hsun-Su/pytorch-ssim. Method signatures and docstrings: - def __init__(self, bias: float=6.0, window_size: int=11, channe...
Implement the Python class `SSimLoss` described below. Class description: SSimLoss. This is an implementation of structural similarity (SSIM) loss. This code is modified from https://github.com/Po-Hsun-Su/pytorch-ssim. Method signatures and docstrings: - def __init__(self, bias: float=6.0, window_size: int=11, channe...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class SSimLoss: """SSimLoss. This is an implementation of structural similarity (SSIM) loss. This code is modified from https://github.com/Po-Hsun-Su/pytorch-ssim.""" def __init__(self, bias: float=6.0, window_size: int=11, channels: int=1, reduction: str='none'): """Initialization. Args: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSimLoss: """SSimLoss. This is an implementation of structural similarity (SSIM) loss. This code is modified from https://github.com/Po-Hsun-Su/pytorch-ssim.""" def __init__(self, bias: float=6.0, window_size: int=11, channels: int=1, reduction: str='none'): """Initialization. Args: bias (float, ...
the_stack_v2_python_sparse
espnet2/tts/prodiff/loss.py
espnet/espnet
train
7,242
0c348a6fed32245193be6c23da985a8aa4b701d1
[ "self.timeline = timeline\nif not now:\n self.now = today.as_seconds\nelse:\n try:\n self.now = self.timeline[str(now)].as_seconds\n except KeyError:\n self.now = int(now)", "for pattern in parser.patterns:\n m = pattern.match(expression)\n if m:\n return datetime.from_seconds(...
<|body_start_0|> self.timeline = timeline if not now: self.now = today.as_seconds else: try: self.now = self.timeline[str(now)].as_seconds except KeyError: self.now = int(now) <|end_body_0|> <|body_start_1|> for pattern...
A lexical date expression parser that can understand various relative dates. Some examples: 2 days before 3.3206.3.36 11 spans later than now yesterday tomorrow 2 days after tomorrow 11 spans later than now yesterday 1000 years ago on 1.193.1.1 at 2.4839.7.22 If initialized with a timeline, the parser will also support...
parser
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class parser: """A lexical date expression parser that can understand various relative dates. Some examples: 2 days before 3.3206.3.36 11 spans later than now yesterday tomorrow 2 days after tomorrow 11 spans later than now yesterday 1000 years ago on 1.193.1.1 at 2.4839.7.22 If initialized with a time...
stack_v2_sparse_classes_75kplus_train_000962
26,385
permissive
[ { "docstring": "Constructor Args: now (datetime): the date against which calculate the relative date timeline (dict): a dictionary of event datetimes keyed by description", "name": "__init__", "signature": "def __init__(self, now=None, timeline={})" }, { "docstring": "Parse an expression and ret...
6
null
Implement the Python class `parser` described below. Class description: A lexical date expression parser that can understand various relative dates. Some examples: 2 days before 3.3206.3.36 11 spans later than now yesterday tomorrow 2 days after tomorrow 11 spans later than now yesterday 1000 years ago on 1.193.1.1 at...
Implement the Python class `parser` described below. Class description: A lexical date expression parser that can understand various relative dates. Some examples: 2 days before 3.3206.3.36 11 spans later than now yesterday tomorrow 2 days after tomorrow 11 spans later than now yesterday 1000 years ago on 1.193.1.1 at...
4152de28ed03afecb579c6065414439146b8b169
<|skeleton|> class parser: """A lexical date expression parser that can understand various relative dates. Some examples: 2 days before 3.3206.3.36 11 spans later than now yesterday tomorrow 2 days after tomorrow 11 spans later than now yesterday 1000 years ago on 1.193.1.1 at 2.4839.7.22 If initialized with a time...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class parser: """A lexical date expression parser that can understand various relative dates. Some examples: 2 days before 3.3206.3.36 11 spans later than now yesterday tomorrow 2 days after tomorrow 11 spans later than now yesterday 1000 years ago on 1.193.1.1 at 2.4839.7.22 If initialized with a timeline, the par...
the_stack_v2_python_sparse
telisar/reckoning/telisaran.py
evilchili/telisar
train
1
e03bb58b24774d695efaaa1e9efd72944748a01d
[ "if environment is not None and utils.version_lt(self._version, '1.25'):\n raise errors.InvalidVersion('Setting environment for exec is not supported in API < 1.25')\nif isinstance(cmd, str):\n cmd = utils.split_command(cmd)\nif isinstance(environment, dict):\n environment = utils.utils.format_environment(...
<|body_start_0|> if environment is not None and utils.version_lt(self._version, '1.25'): raise errors.InvalidVersion('Setting environment for exec is not supported in API < 1.25') if isinstance(cmd, str): cmd = utils.split_command(cmd) if isinstance(environment, dict): ...
ExecApiMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExecApiMixin: def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): """Sets up an exec instance in a running container. Args: container (str): Target container where exec insta...
stack_v2_sparse_classes_75kplus_train_000963
6,224
permissive
[ { "docstring": "Sets up an exec instance in a running container. Args: container (str): Target container where exec instance will be created cmd (str or list): Command to be executed stdout (bool): Attach to stdout. Default: ``True`` stderr (bool): Attach to stderr. Default: ``True`` stdin (bool): Attach to std...
4
stack_v2_sparse_classes_30k_train_006899
Implement the Python class `ExecApiMixin` described below. Class description: Implement the ExecApiMixin class. Method signatures and docstrings: - def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): Sets...
Implement the Python class `ExecApiMixin` described below. Class description: Implement the ExecApiMixin class. Method signatures and docstrings: - def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): Sets...
c38656dc7894363f32317affecc3e4279e1163f8
<|skeleton|> class ExecApiMixin: def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): """Sets up an exec instance in a running container. Args: container (str): Target container where exec insta...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExecApiMixin: def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): """Sets up an exec instance in a running container. Args: container (str): Target container where exec instance will be cr...
the_stack_v2_python_sparse
docker/api/exec_api.py
docker/docker-py
train
6,473
c77345d5ba511683f93e85e494bf18806faf1002
[ "C = self.COEFFS[imt]\nmag = rup.mag - 6\nd = np.sqrt(dists.rjb ** 2 + C['c7'] ** 2)\nmean = np.zeros_like(d)\nmean += C['c1'] + C['c2'] * mag + C['c3'] * mag ** 2 + C['c6']\nidx = d <= 100.0\nmean[idx] = mean[idx] + C['c5'] * np.log10(d[idx])\nidx = d > 100.0\nmean[idx] = mean[idx] + C['c5'] * np.log10(100.0) - np...
<|body_start_0|> C = self.COEFFS[imt] mag = rup.mag - 6 d = np.sqrt(dists.rjb ** 2 + C['c7'] ** 2) mean = np.zeros_like(d) mean += C['c1'] + C['c2'] * mag + C['c3'] * mag ** 2 + C['c6'] idx = d <= 100.0 mean[idx] = mean[idx] + C['c5'] * np.log10(d[idx]) id...
Implement equation used by the Geological Survey of Canada (GSC) for the 2010 Western Canada National Seismic Hazard Model. The class implements the model of David M. Boore, William B. Joyner, and Thomas E. Fumal ("Estimation of Response Spectra and Peak Accelerations from Western North American Earthquakes: An Interim...
BooreEtAl1993GSCBest
[ "BSD-3-Clause", "AGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BooreEtAl1993GSCBest: """Implement equation used by the Geological Survey of Canada (GSC) for the 2010 Western Canada National Seismic Hazard Model. The class implements the model of David M. Boore, William B. Joyner, and Thomas E. Fumal ("Estimation of Response Spectra and Peak Accelerations fro...
stack_v2_sparse_classes_75kplus_train_000964
7,227
permissive
[ { "docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Return total standa...
2
stack_v2_sparse_classes_30k_train_001754
Implement the Python class `BooreEtAl1993GSCBest` described below. Class description: Implement equation used by the Geological Survey of Canada (GSC) for the 2010 Western Canada National Seismic Hazard Model. The class implements the model of David M. Boore, William B. Joyner, and Thomas E. Fumal ("Estimation of Resp...
Implement the Python class `BooreEtAl1993GSCBest` described below. Class description: Implement equation used by the Geological Survey of Canada (GSC) for the 2010 Western Canada National Seismic Hazard Model. The class implements the model of David M. Boore, William B. Joyner, and Thomas E. Fumal ("Estimation of Resp...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class BooreEtAl1993GSCBest: """Implement equation used by the Geological Survey of Canada (GSC) for the 2010 Western Canada National Seismic Hazard Model. The class implements the model of David M. Boore, William B. Joyner, and Thomas E. Fumal ("Estimation of Response Spectra and Peak Accelerations fro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BooreEtAl1993GSCBest: """Implement equation used by the Geological Survey of Canada (GSC) for the 2010 Western Canada National Seismic Hazard Model. The class implements the model of David M. Boore, William B. Joyner, and Thomas E. Fumal ("Estimation of Response Spectra and Peak Accelerations from Western Nor...
the_stack_v2_python_sparse
openquake/hazardlib/gsim/boore_1993.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
83d30966b61bc220354410a654bca38fd81de339
[ "members = ctx.guild.members\nassert len(members) >= 4, 'Member count must be more than 4'\ngenerator = randint(0, len(members) - 1)\nself.members = ctx.guild.members[generator:generator + 4]\nmissing = (len(self.members) - 4) * -1\nfor i in range(missing):\n self.members.append(members[i])\ndel members\nself.ct...
<|body_start_0|> members = ctx.guild.members assert len(members) >= 4, 'Member count must be more than 4' generator = randint(0, len(members) - 1) self.members = ctx.guild.members[generator:generator + 4] missing = (len(self.members) - 4) * -1 for i in range(missing): ...
GuessAvatar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuessAvatar: def __init__(self, ctx) -> None: """Creates a 'guess what avatar this belongs to' game""" <|body_0|> async def start(self) -> bool: """begin""" <|body_1|> <|end_skeleton|> <|body_start_0|> members = ctx.guild.members assert len(...
stack_v2_sparse_classes_75kplus_train_000965
17,718
permissive
[ { "docstring": "Creates a 'guess what avatar this belongs to' game", "name": "__init__", "signature": "def __init__(self, ctx) -> None" }, { "docstring": "begin", "name": "start", "signature": "async def start(self) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_034059
Implement the Python class `GuessAvatar` described below. Class description: Implement the GuessAvatar class. Method signatures and docstrings: - def __init__(self, ctx) -> None: Creates a 'guess what avatar this belongs to' game - async def start(self) -> bool: begin
Implement the Python class `GuessAvatar` described below. Class description: Implement the GuessAvatar class. Method signatures and docstrings: - def __init__(self, ctx) -> None: Creates a 'guess what avatar this belongs to' game - async def start(self) -> bool: begin <|skeleton|> class GuessAvatar: def __init_...
b5309b91b9da49a2a5cee1596084d450b987c17a
<|skeleton|> class GuessAvatar: def __init__(self, ctx) -> None: """Creates a 'guess what avatar this belongs to' game""" <|body_0|> async def start(self) -> bool: """begin""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GuessAvatar: def __init__(self, ctx) -> None: """Creates a 'guess what avatar this belongs to' game""" members = ctx.guild.members assert len(members) >= 4, 'Member count must be more than 4' generator = randint(0, len(members) - 1) self.members = ctx.guild.members[gene...
the_stack_v2_python_sparse
framework/games.py
alexshcer/username601
train
0
a666a2fad9632507ee471472ecd54d77aa49bde7
[ "super(PropertiesList, self).__init__(step_name, path, shape_name)\nself.shape_name = shape_name\nself.service_name = service_name\nself._items: Dict[Union[int, str], Properties] = dict()", "if item not in self._items.keys():\n shape = Properties._shapes_map.get(self.service_name, {}).get(self.shape_name)\n ...
<|body_start_0|> super(PropertiesList, self).__init__(step_name, path, shape_name) self.shape_name = shape_name self.service_name = service_name self._items: Dict[Union[int, str], Properties] = dict() <|end_body_0|> <|body_start_1|> if item not in self._items.keys(): ...
PropertiesList for use in workflow expressions.
PropertiesList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropertiesList: """PropertiesList for use in workflow expressions.""" def __init__(self, step_name: str, path: str, shape_name: str=None, service_name: str='sagemaker'): """Create a PropertiesList instance representing the given shape. Args: step_name (str): The name of the Step this...
stack_v2_sparse_classes_75kplus_train_000966
8,233
permissive
[ { "docstring": "Create a PropertiesList instance representing the given shape. Args: step_name (str): The name of the Step this Property belongs to. path (str): The relative path of this Property value. shape_name (str): The botocore service model shape name. service_name (str): The botocore service name.", ...
2
stack_v2_sparse_classes_30k_train_032976
Implement the Python class `PropertiesList` described below. Class description: PropertiesList for use in workflow expressions. Method signatures and docstrings: - def __init__(self, step_name: str, path: str, shape_name: str=None, service_name: str='sagemaker'): Create a PropertiesList instance representing the give...
Implement the Python class `PropertiesList` described below. Class description: PropertiesList for use in workflow expressions. Method signatures and docstrings: - def __init__(self, step_name: str, path: str, shape_name: str=None, service_name: str='sagemaker'): Create a PropertiesList instance representing the give...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class PropertiesList: """PropertiesList for use in workflow expressions.""" def __init__(self, step_name: str, path: str, shape_name: str=None, service_name: str='sagemaker'): """Create a PropertiesList instance representing the given shape. Args: step_name (str): The name of the Step this...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PropertiesList: """PropertiesList for use in workflow expressions.""" def __init__(self, step_name: str, path: str, shape_name: str=None, service_name: str='sagemaker'): """Create a PropertiesList instance representing the given shape. Args: step_name (str): The name of the Step this Property bel...
the_stack_v2_python_sparse
src/sagemaker/workflow/properties.py
aws/sagemaker-python-sdk
train
2,050
3c745dcf5506eb16e0f79c6683374a25a18387a6
[ "self.name = name + ':'\nself.fwd_lstm = LSTM(fwd_weight_tensors, activation=activation, activation_params=activation_params, name=self.name + 'fwd_lstm')\nself.bwd_lstm = LSTM(bwd_weight_tensors, activation=activation, activation_params=activation_params, name=self.name + 'bwd_lstm')", "fwd_outputs, fwd_state = ...
<|body_start_0|> self.name = name + ':' self.fwd_lstm = LSTM(fwd_weight_tensors, activation=activation, activation_params=activation_params, name=self.name + 'fwd_lstm') self.bwd_lstm = LSTM(bwd_weight_tensors, activation=activation, activation_params=activation_params, name=self.name + 'bwd_lst...
BidirectionalLSTM
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalLSTM: def __init__(self, fwd_weight_tensors, bwd_weight_tensors, activation='tanh', activation_params=dict(), name='bidir_lstm'): """A bidirectional LSTM layer. Args: fwd_weight_tensors: weights used for the forward LSTM. bwd_weight_tensors: weights used for the backward LST...
stack_v2_sparse_classes_75kplus_train_000967
6,227
permissive
[ { "docstring": "A bidirectional LSTM layer. Args: fwd_weight_tensors: weights used for the forward LSTM. bwd_weight_tensors: weights used for the backward LSTM. activation/activation_params: See in the LSTM class.", "name": "__init__", "signature": "def __init__(self, fwd_weight_tensors, bwd_weight_tens...
2
null
Implement the Python class `BidirectionalLSTM` described below. Class description: Implement the BidirectionalLSTM class. Method signatures and docstrings: - def __init__(self, fwd_weight_tensors, bwd_weight_tensors, activation='tanh', activation_params=dict(), name='bidir_lstm'): A bidirectional LSTM layer. Args: fw...
Implement the Python class `BidirectionalLSTM` described below. Class description: Implement the BidirectionalLSTM class. Method signatures and docstrings: - def __init__(self, fwd_weight_tensors, bwd_weight_tensors, activation='tanh', activation_params=dict(), name='bidir_lstm'): A bidirectional LSTM layer. Args: fw...
01ef7892bb25cb08c13cea6125efc1528a8de260
<|skeleton|> class BidirectionalLSTM: def __init__(self, fwd_weight_tensors, bwd_weight_tensors, activation='tanh', activation_params=dict(), name='bidir_lstm'): """A bidirectional LSTM layer. Args: fwd_weight_tensors: weights used for the forward LSTM. bwd_weight_tensors: weights used for the backward LST...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BidirectionalLSTM: def __init__(self, fwd_weight_tensors, bwd_weight_tensors, activation='tanh', activation_params=dict(), name='bidir_lstm'): """A bidirectional LSTM layer. Args: fwd_weight_tensors: weights used for the forward LSTM. bwd_weight_tensors: weights used for the backward LSTM. activation/...
the_stack_v2_python_sparse
smaug/python/ops/recurrent.py
mrbeann/smaug
train
0
286ec5fbbed7a877cc04dff967dff3bc804d7a71
[ "super(self.__class__, self).__init__()\nself.hash = hash_f\nself.key_len = key_len\nself.key = ''\nself.key_gen = key_gen", "if self.key_gen is None:\n self.key = random_string(self.key_len)\nelse:\n self.key = self.key_gen()\nreturn self.key", "x1, x2 = x\nif x1 == x2 or self.hash(self.key, x1) == None:...
<|body_start_0|> super(self.__class__, self).__init__() self.hash = hash_f self.key_len = key_len self.key = '' self.key_gen = key_gen <|end_body_0|> <|body_start_1|> if self.key_gen is None: self.key = random_string(self.key_len) else: se...
This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.
GameCR
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameCR: """This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.""" def __init__(self, hash_f, key_len, key_gen=None): """:param hash_f: T...
stack_v2_sparse_classes_75kplus_train_000968
1,745
no_license
[ { "docstring": ":param hash_f: This is the hash function that the adversary is playing against. It must take two parameters, a key of length key_len and a message. :param key_len: Length of key used by hash function.", "name": "__init__", "signature": "def __init__(self, hash_f, key_len, key_gen=None)" ...
3
stack_v2_sparse_classes_30k_train_053448
Implement the Python class `GameCR` described below. Class description: This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function. Method signatures and docstrings: - def __init...
Implement the Python class `GameCR` described below. Class description: This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function. Method signatures and docstrings: - def __init...
9014f5a9bf7021bef9f5cc4aa5b16424ca83dee9
<|skeleton|> class GameCR: """This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.""" def __init__(self, hash_f, key_len, key_gen=None): """:param hash_f: T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GameCR: """This game is used to test the collision resistance of hash functions. Adversaries playing this game do not have access to any oracles however they do have access to the key used by the hash function.""" def __init__(self, hash_f, key_len, key_gen=None): """:param hash_f: This is the ha...
the_stack_v2_python_sparse
src/playcrypt/games/game_cr.py
UCSDCSE107/playcrypt
train
2
27e37ed6be765abaa07ff4a912dfa1972a82dc2e
[ "self.end_time_usecs = end_time_usecs\nself.environment = environment\nself.job_uids = job_uids\nself.protection_source_id = protection_source_id\nself.start_time_usecs = start_time_usecs", "if dictionary is None:\n return None\nend_time_usecs = dictionary.get('endTimeUsecs')\nenvironment = dictionary.get('env...
<|body_start_0|> self.end_time_usecs = end_time_usecs self.environment = environment self.job_uids = job_uids self.protection_source_id = protection_source_id self.start_time_usecs = start_time_usecs <|end_body_0|> <|body_start_1|> if dictionary is None: retu...
Implementation of the 'RestorePointsForTimeRangeParam' model. Specifies the request parameters to restore points for time range API. Attributes: end_time_usecs (long|int): Specifies the end time specified as a Unix epoch Timestamp (in microseconds). environment (EnvironmentRestorePointsForTimeRangeParamEnum): Specifies...
RestorePointsForTimeRangeParam
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestorePointsForTimeRangeParam: """Implementation of the 'RestorePointsForTimeRangeParam' model. Specifies the request parameters to restore points for time range API. Attributes: end_time_usecs (long|int): Specifies the end time specified as a Unix epoch Timestamp (in microseconds). environment ...
stack_v2_sparse_classes_75kplus_train_000969
6,957
permissive
[ { "docstring": "Constructor for the RestorePointsForTimeRangeParam class", "name": "__init__", "signature": "def __init__(self, end_time_usecs=None, environment=None, job_uids=None, protection_source_id=None, start_time_usecs=None)" }, { "docstring": "Creates an instance of this model from a dic...
2
stack_v2_sparse_classes_30k_train_025997
Implement the Python class `RestorePointsForTimeRangeParam` described below. Class description: Implementation of the 'RestorePointsForTimeRangeParam' model. Specifies the request parameters to restore points for time range API. Attributes: end_time_usecs (long|int): Specifies the end time specified as a Unix epoch Ti...
Implement the Python class `RestorePointsForTimeRangeParam` described below. Class description: Implementation of the 'RestorePointsForTimeRangeParam' model. Specifies the request parameters to restore points for time range API. Attributes: end_time_usecs (long|int): Specifies the end time specified as a Unix epoch Ti...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestorePointsForTimeRangeParam: """Implementation of the 'RestorePointsForTimeRangeParam' model. Specifies the request parameters to restore points for time range API. Attributes: end_time_usecs (long|int): Specifies the end time specified as a Unix epoch Timestamp (in microseconds). environment ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RestorePointsForTimeRangeParam: """Implementation of the 'RestorePointsForTimeRangeParam' model. Specifies the request parameters to restore points for time range API. Attributes: end_time_usecs (long|int): Specifies the end time specified as a Unix epoch Timestamp (in microseconds). environment (EnvironmentR...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_points_for_time_range_param.py
cohesity/management-sdk-python
train
24
15baddc4eac9f5b77a5e9bf7fdc2787716fa6825
[ "self.latitude = latitude\nself.longitude = longitude\nself.headers = {USER_AGENT: HA_USER_AGENT}\nself.threshold = int(threshold)\nself.is_visible = None\nself.is_visible_text = None\nself.visibility_level = None", "try:\n self.visibility_level = self.get_aurora_forecast()\n if int(self.visibility_level) >...
<|body_start_0|> self.latitude = latitude self.longitude = longitude self.headers = {USER_AGENT: HA_USER_AGENT} self.threshold = int(threshold) self.is_visible = None self.is_visible_text = None self.visibility_level = None <|end_body_0|> <|body_start_1|> ...
Get aurora forecast.
AuroraData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuroraData: """Get aurora forecast.""" def __init__(self, latitude, longitude, threshold): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from the Aurora service.""" <|body_1|> def get_aurora_forecast(self): ...
stack_v2_sparse_classes_75kplus_train_000970
4,922
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, latitude, longitude, threshold)" }, { "docstring": "Get the latest data from the Aurora service.", "name": "update", "signature": "def update(self)" }, { "docstring": "Get forecast ...
3
stack_v2_sparse_classes_30k_train_048739
Implement the Python class `AuroraData` described below. Class description: Get aurora forecast. Method signatures and docstrings: - def __init__(self, latitude, longitude, threshold): Initialize the data object. - def update(self): Get the latest data from the Aurora service. - def get_aurora_forecast(self): Get for...
Implement the Python class `AuroraData` described below. Class description: Get aurora forecast. Method signatures and docstrings: - def __init__(self, latitude, longitude, threshold): Initialize the data object. - def update(self): Get the latest data from the Aurora service. - def get_aurora_forecast(self): Get for...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class AuroraData: """Get aurora forecast.""" def __init__(self, latitude, longitude, threshold): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from the Aurora service.""" <|body_1|> def get_aurora_forecast(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuroraData: """Get aurora forecast.""" def __init__(self, latitude, longitude, threshold): """Initialize the data object.""" self.latitude = latitude self.longitude = longitude self.headers = {USER_AGENT: HA_USER_AGENT} self.threshold = int(threshold) self....
the_stack_v2_python_sparse
homeassistant/components/aurora/binary_sensor.py
tchellomello/home-assistant
train
8
5d31725e2e365272579c381749a397c815d54153
[ "try:\n validate_email(email)\nexcept ValidationError:\n raise ValueError('Invalid email address, please try again.')\nuser = self.model(email=self.normalize_email(email))\nif password:\n user.set_password(password)\nelse:\n user.set_unusable_password()\nuser.save(using=self._db)\nreturn user", "user ...
<|body_start_0|> try: validate_email(email) except ValidationError: raise ValueError('Invalid email address, please try again.') user = self.model(email=self.normalize_email(email)) if password: user.set_password(password) else: use...
RinkUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_75kplus_train_000971
9,151
no_license
[ { "docstring": "Creates and saves a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email and password.", "name": "create_superuser", "signature": "...
2
stack_v2_sparse_classes_30k_train_005685
Implement the Python class `RinkUserManager` described below. Class description: Implement the RinkUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
Implement the Python class `RinkUserManager` described below. Class description: Implement the RinkUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
e3eebf1a9bce85616df698f7e33a01688929fe53
<|skeleton|> class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" try: validate_email(email) except ValidationError: raise ValueError('Invalid email address, please try again.') user = self.mo...
the_stack_v2_python_sparse
rink/users/models.py
MadisonRollerDerby/rink
train
0
da1d1184ef77c3d4f4f8389cdd4213f0d1aaac29
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_step = self.get_step()\n y_step = self.get_step()\n if x_step == 0 and y_step == 0:\n continue\n next_x = self.x_values[-1] + x_step\n next_y = self.y_values[-1] + y_ste...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_step = self.get_step() y_step = self.get_step() if x_step == 0 and y_step == 0: ...
一个生产随机漫步数据的类
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """一个生产随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> def get_step(self): """获取每次漫步的距离和方向""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_000972
1,452
no_license
[ { "docstring": "初始化随机漫步的属性", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "计算随机漫步包含的所有点", "name": "fill_walk", "signature": "def fill_walk(self)" }, { "docstring": "获取每次漫步的距离和方向", "name": "get_step", "signature": "def get_step(s...
3
stack_v2_sparse_classes_30k_train_039731
Implement the Python class `RandomWalk` described below. Class description: 一个生产随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点 - def get_step(self): 获取每次漫步的距离和方向
Implement the Python class `RandomWalk` described below. Class description: 一个生产随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点 - def get_step(self): 获取每次漫步的距离和方向 <|skeleton|> class RandomWalk: """一个生产随机漫步数据的类""" def __init__(s...
6f91fe5e7cbedcdf4b8f7baa7641fd615b4d6141
<|skeleton|> class RandomWalk: """一个生产随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> def get_step(self): """获取每次漫步的距离和方向""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomWalk: """一个生产随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """计算随机漫步包含的所有点""" while len(self.x_values) < self.num_points: x_...
the_stack_v2_python_sparse
demos/data-analysis/data_visual_by_generate/random_walk.py
romanticair/python
train
0
cd35bc9d28049344fd3cfaaf3b6885ad02ac5583
[ "profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.feed.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Feed', self, '')\nself.activateFeed = settings.BooleanSetting().getFromValue('Activate Feed:', self,...
<|body_start_0|> profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.feed.html', self) self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Feed', self, '') self.activateFeed = settings.BooleanSetting().ge...
A class to handle the feed settings.
FeedRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeedRepository: """A class to handle the feed settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Feed button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_000973
8,389
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Feed button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_011266
Implement the Python class `FeedRepository` described below. Class description: A class to handle the feed settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Feed button has been clicked.
Implement the Python class `FeedRepository` described below. Class description: A class to handle the feed settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Feed button has been clicked. <|skeleton|> class FeedRepositor...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class FeedRepository: """A class to handle the feed settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Feed button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeedRepository: """A class to handle the feed settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.feed.html', self) self.fileNameInput = settings.FileNameInput().g...
the_stack_v2_python_sparse
skeinforge_tools/craft_plugins/feed.py
bmander/skeinforge
train
34
7d1fac98740f1012214e7d7e9f6a51fc05d8a1c5
[ "super(SimpleEncoderDecoder, self).__init__(params)\nself.max_length = params['max_length']\nself.input_voc_size = params['input_voc_size']\nself.hidden_size = params['hidden_size']\nself.encoder_bidirectional = params['encoder_bidirectional']\nself.encoder = EncoderRNN(input_voc_size=self.input_voc_size, hidden_si...
<|body_start_0|> super(SimpleEncoderDecoder, self).__init__(params) self.max_length = params['max_length'] self.input_voc_size = params['input_voc_size'] self.hidden_size = params['hidden_size'] self.encoder_bidirectional = params['encoder_bidirectional'] self.encoder = E...
Sequence to Sequence model based on EncoderRNN & DecoderRNN.
SimpleEncoderDecoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleEncoderDecoder: """Sequence to Sequence model based on EncoderRNN & DecoderRNN.""" def __init__(self, params): """Initializes the Encoder-Decoder network. :param params: dict containing the main parameters set: - max_length: maximal length of the input / output sequence of word...
stack_v2_sparse_classes_75kplus_train_000974
12,975
permissive
[ { "docstring": "Initializes the Encoder-Decoder network. :param params: dict containing the main parameters set: - max_length: maximal length of the input / output sequence of words: i.e, max length of the sentences to translate -> upper limit of seq_length - input_voc_size: should correspond to the length of t...
3
stack_v2_sparse_classes_30k_test_001788
Implement the Python class `SimpleEncoderDecoder` described below. Class description: Sequence to Sequence model based on EncoderRNN & DecoderRNN. Method signatures and docstrings: - def __init__(self, params): Initializes the Encoder-Decoder network. :param params: dict containing the main parameters set: - max_leng...
Implement the Python class `SimpleEncoderDecoder` described below. Class description: Sequence to Sequence model based on EncoderRNN & DecoderRNN. Method signatures and docstrings: - def __init__(self, params): Initializes the Encoder-Decoder network. :param params: dict containing the main parameters set: - max_leng...
c655c88cc6aec4d0724c19ea95209f1c2dd6770d
<|skeleton|> class SimpleEncoderDecoder: """Sequence to Sequence model based on EncoderRNN & DecoderRNN.""" def __init__(self, params): """Initializes the Encoder-Decoder network. :param params: dict containing the main parameters set: - max_length: maximal length of the input / output sequence of word...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleEncoderDecoder: """Sequence to Sequence model based on EncoderRNN & DecoderRNN.""" def __init__(self, params): """Initializes the Encoder-Decoder network. :param params: dict containing the main parameters set: - max_length: maximal length of the input / output sequence of words: i.e, max l...
the_stack_v2_python_sparse
models/text2text/simple_encoder_decoder.py
aasseman/mi-prometheus
train
0
b8fba8cbe306db11fa935145005cf588ef4a9f39
[ "self.user = get_object_or_404(User, username=kwargs['username'])\nself.profile = self.user.profile\nreturn super(ProfileView, self).dispatch(request, *args, **kwargs)", "context = super(ProfileView, self).get_context_data(**kwargs)\ncontext['profile'] = self.profile\nreturn context", "initial = super(ProfileVi...
<|body_start_0|> self.user = get_object_or_404(User, username=kwargs['username']) self.profile = self.user.profile return super(ProfileView, self).dispatch(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> context = super(ProfileView, self).get_context_data(**kwargs) con...
ProfileView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileView: def dispatch(self, request, *args, **kwargs): """check if user is exist else raise 404 :param request: :param args: :param kwargs:""" <|body_0|> def get_context_data(self, **kwargs): """add the profile instance to the context data :param kwargs: :return:...
stack_v2_sparse_classes_75kplus_train_000975
2,780
no_license
[ { "docstring": "check if user is exist else raise 404 :param request: :param args: :param kwargs:", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "add the profile instance to the context data :param kwargs: :return:", "name": "get_context_d...
5
null
Implement the Python class `ProfileView` described below. Class description: Implement the ProfileView class. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): check if user is exist else raise 404 :param request: :param args: :param kwargs: - def get_context_data(self, **kwargs): add ...
Implement the Python class `ProfileView` described below. Class description: Implement the ProfileView class. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): check if user is exist else raise 404 :param request: :param args: :param kwargs: - def get_context_data(self, **kwargs): add ...
de5e9e9887dee857e6169184aa9c7b74f31d32c4
<|skeleton|> class ProfileView: def dispatch(self, request, *args, **kwargs): """check if user is exist else raise 404 :param request: :param args: :param kwargs:""" <|body_0|> def get_context_data(self, **kwargs): """add the profile instance to the context data :param kwargs: :return:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProfileView: def dispatch(self, request, *args, **kwargs): """check if user is exist else raise 404 :param request: :param args: :param kwargs:""" self.user = get_object_or_404(User, username=kwargs['username']) self.profile = self.user.profile return super(ProfileView, self).d...
the_stack_v2_python_sparse
todo/views/profile_views.py
AmrAnwar/ToDoList
train
0
06caf0cb733db96dfbba5c34355065cb61dd2747
[ "self.db_url = _mask_uri(db_url)\nself.client = MDBClient(db_url)\nself.db = self.client.get()\nself._query_collection = self.db[CatalogConstants.catalog_collections['query']]\nself._feature_collection = self.db[CatalogConstants.catalog_collections['feature']]\nself._model_collection = self.db[CatalogConstants.cata...
<|body_start_0|> self.db_url = _mask_uri(db_url) self.client = MDBClient(db_url) self.db = self.client.get() self._query_collection = self.db[CatalogConstants.catalog_collections['query']] self._feature_collection = self.db[CatalogConstants.catalog_collections['feature']] ...
Catalog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Catalog: def __init__(self, db_url: str): """initiates catalog and collection for storing features and queries Args: db_url(str): mongodb url""" <|body_0|> def save(self, dev_id: str, data_type: str, data: dict): """Args: def_id(str): dev identifier data_type(str): f...
stack_v2_sparse_classes_75kplus_train_000976
2,944
no_license
[ { "docstring": "initiates catalog and collection for storing features and queries Args: db_url(str): mongodb url", "name": "__init__", "signature": "def __init__(self, db_url: str)" }, { "docstring": "Args: def_id(str): dev identifier data_type(str): feature, query or model object data(dict): ca...
3
stack_v2_sparse_classes_30k_train_005948
Implement the Python class `Catalog` described below. Class description: Implement the Catalog class. Method signatures and docstrings: - def __init__(self, db_url: str): initiates catalog and collection for storing features and queries Args: db_url(str): mongodb url - def save(self, dev_id: str, data_type: str, data...
Implement the Python class `Catalog` described below. Class description: Implement the Catalog class. Method signatures and docstrings: - def __init__(self, db_url: str): initiates catalog and collection for storing features and queries Args: db_url(str): mongodb url - def save(self, dev_id: str, data_type: str, data...
d9b72831510b8a9e7004d3ccfac073e3ef3c1f52
<|skeleton|> class Catalog: def __init__(self, db_url: str): """initiates catalog and collection for storing features and queries Args: db_url(str): mongodb url""" <|body_0|> def save(self, dev_id: str, data_type: str, data: dict): """Args: def_id(str): dev identifier data_type(str): f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Catalog: def __init__(self, db_url: str): """initiates catalog and collection for storing features and queries Args: db_url(str): mongodb url""" self.db_url = _mask_uri(db_url) self.client = MDBClient(db_url) self.db = self.client.get() self._query_collection = self.db[...
the_stack_v2_python_sparse
feature_store/catalog.py
miararoy/feature_store
train
0
aca5702934631c9b9d20219d191ff13ddee7b3ed
[ "role = db.Role.find_one(Role.role_id == roleId)\nif not role:\n return self.make_response('No such role found', HTTP.NOT_FOUND)\nreturn self.make_response({'role': role})", "self.reqparse.add_argument('color', type=str, required=True)\nargs = self.reqparse.parse_args()\nrole = db.Role.find_one(Role.role_id ==...
<|body_start_0|> role = db.Role.find_one(Role.role_id == roleId) if not role: return self.make_response('No such role found', HTTP.NOT_FOUND) return self.make_response({'role': role}) <|end_body_0|> <|body_start_1|> self.reqparse.add_argument('color', type=str, required=True...
RoleGet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleGet: def get(self, roleId): """Get a specific role information""" <|body_0|> def put(self, roleId): """Update a user role""" <|body_1|> def delete(self, roleId): """Delete a user role""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_000977
3,193
permissive
[ { "docstring": "Get a specific role information", "name": "get", "signature": "def get(self, roleId)" }, { "docstring": "Update a user role", "name": "put", "signature": "def put(self, roleId)" }, { "docstring": "Delete a user role", "name": "delete", "signature": "def de...
3
null
Implement the Python class `RoleGet` described below. Class description: Implement the RoleGet class. Method signatures and docstrings: - def get(self, roleId): Get a specific role information - def put(self, roleId): Update a user role - def delete(self, roleId): Delete a user role
Implement the Python class `RoleGet` described below. Class description: Implement the RoleGet class. Method signatures and docstrings: - def get(self, roleId): Get a specific role information - def put(self, roleId): Update a user role - def delete(self, roleId): Delete a user role <|skeleton|> class RoleGet: ...
29a26c705381fdba3538b4efedb25b9e09b387ed
<|skeleton|> class RoleGet: def get(self, roleId): """Get a specific role information""" <|body_0|> def put(self, roleId): """Update a user role""" <|body_1|> def delete(self, roleId): """Delete a user role""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RoleGet: def get(self, roleId): """Get a specific role information""" role = db.Role.find_one(Role.role_id == roleId) if not role: return self.make_response('No such role found', HTTP.NOT_FOUND) return self.make_response({'role': role}) def put(self, roleId): ...
the_stack_v2_python_sparse
backend/cloud_inquisitor/plugins/views/roles.py
RiotGames/cloud-inquisitor
train
468
de36d7f1dd04276393eff0162a8fc4b9868748f5
[ "currX = self.xcor()\ncurrY = self.ycor()\ndXactual = x - currX\ndYactual = y - currY\nlength = math.hypot(dXactual, dYactual)\ntry:\n self.dx = dXactual / length * speed\n self.dy = dYactual / length * speed\nexcept:\n self.dx, self.dy = (0, 0)", "try:\n newX = self.xcor() + self.dx\n newY = self....
<|body_start_0|> currX = self.xcor() currY = self.ycor() dXactual = x - currX dYactual = y - currY length = math.hypot(dXactual, dYactual) try: self.dx = dXactual / length * speed self.dy = dYactual / length * speed except: self...
Creature
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Creature: def setNormalizedDirection(self, x, y, speed): """set turtle t's dx and dy to go towards x,y at the given speed The turtle t need not have dx and dy attributes already set. The cool thing is that turtles don't normally HAVE a dx and a dy attribute When you set them, though, the...
stack_v2_sparse_classes_75kplus_train_000978
3,726
no_license
[ { "docstring": "set turtle t's dx and dy to go towards x,y at the given speed The turtle t need not have dx and dy attributes already set. The cool thing is that turtles don't normally HAVE a dx and a dy attribute When you set them, though, they are there to use.", "name": "setNormalizedDirection", "sig...
2
stack_v2_sparse_classes_30k_train_030725
Implement the Python class `Creature` described below. Class description: Implement the Creature class. Method signatures and docstrings: - def setNormalizedDirection(self, x, y, speed): set turtle t's dx and dy to go towards x,y at the given speed The turtle t need not have dx and dy attributes already set. The cool...
Implement the Python class `Creature` described below. Class description: Implement the Creature class. Method signatures and docstrings: - def setNormalizedDirection(self, x, y, speed): set turtle t's dx and dy to go towards x,y at the given speed The turtle t need not have dx and dy attributes already set. The cool...
8b6875036dd0faa6607cfb9d02dd03bc33f6a8a4
<|skeleton|> class Creature: def setNormalizedDirection(self, x, y, speed): """set turtle t's dx and dy to go towards x,y at the given speed The turtle t need not have dx and dy attributes already set. The cool thing is that turtles don't normally HAVE a dx and a dy attribute When you set them, though, the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Creature: def setNormalizedDirection(self, x, y, speed): """set turtle t's dx and dy to go towards x,y at the given speed The turtle t need not have dx and dy attributes already set. The cool thing is that turtles don't normally HAVE a dx and a dy attribute When you set them, though, they are there to...
the_stack_v2_python_sparse
32 - Turtle Creatures/Code before 2016-12-05/creature-2016-12-01.py
mars-wilson/mat2110
train
0
bf9a09e222c6a89d94340b1ad4db3508fab709bd
[ "attachment_data = self.env['ir.attachment'].read_group([('res_model', '=', 'ocean.member.form1'), ('res_id', 'in', self.ids)], ['res_id'], ['res_id'])\nattachment = dict(((data['res_id'], data['res_id_count']) for data in attachment_data))\nfor expense in self:\n expense.attachment_number = attachment.get(expen...
<|body_start_0|> attachment_data = self.env['ir.attachment'].read_group([('res_model', '=', 'ocean.member.form1'), ('res_id', 'in', self.ids)], ['res_id'], ['res_id']) attachment = dict(((data['res_id'], data['res_id_count']) for data in attachment_data)) for expense in self: expense...
MemberOceanMagazeum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemberOceanMagazeum: def _compute_attachment_number(self): """附件上传""" <|body_0|> def action_get_attachment_view(self): """附件上传动作视图""" <|body_1|> <|end_skeleton|> <|body_start_0|> attachment_data = self.env['ir.attachment'].read_group([('res_model', ...
stack_v2_sparse_classes_75kplus_train_000979
2,689
no_license
[ { "docstring": "附件上传", "name": "_compute_attachment_number", "signature": "def _compute_attachment_number(self)" }, { "docstring": "附件上传动作视图", "name": "action_get_attachment_view", "signature": "def action_get_attachment_view(self)" } ]
2
null
Implement the Python class `MemberOceanMagazeum` described below. Class description: Implement the MemberOceanMagazeum class. Method signatures and docstrings: - def _compute_attachment_number(self): 附件上传 - def action_get_attachment_view(self): 附件上传动作视图
Implement the Python class `MemberOceanMagazeum` described below. Class description: Implement the MemberOceanMagazeum class. Method signatures and docstrings: - def _compute_attachment_number(self): 附件上传 - def action_get_attachment_view(self): 附件上传动作视图 <|skeleton|> class MemberOceanMagazeum: def _compute_attac...
9e55a72f988261fc937f305aa4a9e1687fab5052
<|skeleton|> class MemberOceanMagazeum: def _compute_attachment_number(self): """附件上传""" <|body_0|> def action_get_attachment_view(self): """附件上传动作视图""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MemberOceanMagazeum: def _compute_attachment_number(self): """附件上传""" attachment_data = self.env['ir.attachment'].read_group([('res_model', '=', 'ocean.member.form1'), ('res_id', 'in', self.ids)], ['res_id'], ['res_id']) attachment = dict(((data['res_id'], data['res_id_count']) for dat...
the_stack_v2_python_sparse
ocean_member_form/models/member_ocean_form1.py
A-you/myaddons
train
1
686136ad0690d407166c4d7614390e870668b8a5
[ "record = {}\nvid = [bytes(row['id']).decode('utf-8')]\nrecord[self.alias] = vid\nreturn record", "record = dict()\nrecord[self.alias] = []\nfor instance in batch:\n record[self.alias].extend(instance[self.alias])\nreturn record" ]
<|body_start_0|> record = {} vid = [bytes(row['id']).decode('utf-8')] record[self.alias] = vid return record <|end_body_0|> <|body_start_1|> record = dict() record[self.alias] = [] for instance in batch: record[self.alias].extend(instance[self.alias])...
VidParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VidParser: def parse(self, row, training=False): """:param row: raw feature map {key1: raw_feature1, key2: raw_feature2, ...} :param training: training or not can behave different :return: id feature with {self.alias: feature}""" <|body_0|> def collate(self, batch): ...
stack_v2_sparse_classes_75kplus_train_000980
5,031
no_license
[ { "docstring": ":param row: raw feature map {key1: raw_feature1, key2: raw_feature2, ...} :param training: training or not can behave different :return: id feature with {self.alias: feature}", "name": "parse", "signature": "def parse(self, row, training=False)" }, { "docstring": ":param batch: l...
2
stack_v2_sparse_classes_30k_train_000309
Implement the Python class `VidParser` described below. Class description: Implement the VidParser class. Method signatures and docstrings: - def parse(self, row, training=False): :param row: raw feature map {key1: raw_feature1, key2: raw_feature2, ...} :param training: training or not can behave different :return: i...
Implement the Python class `VidParser` described below. Class description: Implement the VidParser class. Method signatures and docstrings: - def parse(self, row, training=False): :param row: raw feature map {key1: raw_feature1, key2: raw_feature2, ...} :param training: training or not can behave different :return: i...
6c28ee71417eb12e637ea362dfbc8057ba88c9c8
<|skeleton|> class VidParser: def parse(self, row, training=False): """:param row: raw feature map {key1: raw_feature1, key2: raw_feature2, ...} :param training: training or not can behave different :return: id feature with {self.alias: feature}""" <|body_0|> def collate(self, batch): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VidParser: def parse(self, row, training=False): """:param row: raw feature map {key1: raw_feature1, key2: raw_feature2, ...} :param training: training or not can behave different :return: id feature with {self.alias: feature}""" record = {} vid = [bytes(row['id']).decode('utf-8')] ...
the_stack_v2_python_sparse
module/feature_parser.py
jiyt17/qq_transformer
train
1
710fea9c8cb9ca215d255f212994b7883675edf2
[ "self.__logger = get_logger(__name__)\nself.__logger.info('Creating decorator ')\nself.__topics_receive__ = []\nself.__topics_send__ = []\nself.__connection__ = None\nself.cls = None", "self.__logger.info('Adding host')\nparent = self\n\ndef inner(cls):\n parent.__logger.info(f'Creating class: {cls}')\n\n c...
<|body_start_0|> self.__logger = get_logger(__name__) self.__logger.info('Creating decorator ') self.__topics_receive__ = [] self.__topics_send__ = [] self.__connection__ = None self.cls = None <|end_body_0|> <|body_start_1|> self.__logger.info('Adding host') ...
Wrap pykafka functions. Define the decorators and hold the comunication data
KafkaDecorator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KafkaDecorator: """Wrap pykafka functions. Define the decorators and hold the comunication data""" def __init__(self): """Create a KafkaDecorator.""" <|body_0|> def host(self, *args, **kargs): """Set the conenction data. Create a new version of the decorated clas...
stack_v2_sparse_classes_75kplus_train_000981
5,207
permissive
[ { "docstring": "Create a KafkaDecorator.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Set the conenction data. Create a new version of the decorated class that inherits from kafka_client_decorators.client.Client class Parameters ---------- *args A list of arguments ...
5
stack_v2_sparse_classes_30k_train_017856
Implement the Python class `KafkaDecorator` described below. Class description: Wrap pykafka functions. Define the decorators and hold the comunication data Method signatures and docstrings: - def __init__(self): Create a KafkaDecorator. - def host(self, *args, **kargs): Set the conenction data. Create a new version ...
Implement the Python class `KafkaDecorator` described below. Class description: Wrap pykafka functions. Define the decorators and hold the comunication data Method signatures and docstrings: - def __init__(self): Create a KafkaDecorator. - def host(self, *args, **kargs): Set the conenction data. Create a new version ...
f2c958df88c5698148aae4c5314dd39e31e995c3
<|skeleton|> class KafkaDecorator: """Wrap pykafka functions. Define the decorators and hold the comunication data""" def __init__(self): """Create a KafkaDecorator.""" <|body_0|> def host(self, *args, **kargs): """Set the conenction data. Create a new version of the decorated clas...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KafkaDecorator: """Wrap pykafka functions. Define the decorators and hold the comunication data""" def __init__(self): """Create a KafkaDecorator.""" self.__logger = get_logger(__name__) self.__logger.info('Creating decorator ') self.__topics_receive__ = [] self.__...
the_stack_v2_python_sparse
kafka_client_decorators/decorators.py
cdsedson/kafka-decorator
train
1
60d1b0c10846ca92121547c174e02f4cb035778b
[ "nin = self.observation_space.shape[0] + self.action_space.shape[0]\nself.fc1 = nn.Linear(nin, 32)\nself.fc2 = nn.Linear(32, 32)\nself.fc3 = nn.Linear(32, 32)\nself.qvalue = nn.Linear(32, 1)", "x = F.relu(self.fc1(torch.cat([x, a], dim=1)))\nx = F.relu(self.fc2(x))\nx = F.relu(self.fc3(x))\nreturn self.qvalue(x)"...
<|body_start_0|> nin = self.observation_space.shape[0] + self.action_space.shape[0] self.fc1 = nn.Linear(nin, 32) self.fc2 = nn.Linear(32, 32) self.fc3 = nn.Linear(32, 32) self.qvalue = nn.Linear(32, 1) <|end_body_0|> <|body_start_1|> x = F.relu(self.fc1(torch.cat([x, a]...
Q network.
QFBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QFBase: """Q network.""" def build(self): """Build Network.""" <|body_0|> def forward(self, x, a): """Forward.""" <|body_1|> <|end_skeleton|> <|body_start_0|> nin = self.observation_space.shape[0] + self.action_space.shape[0] self.fc1 = ...
stack_v2_sparse_classes_75kplus_train_000982
14,308
no_license
[ { "docstring": "Build Network.", "name": "build", "signature": "def build(self)" }, { "docstring": "Forward.", "name": "forward", "signature": "def forward(self, x, a)" } ]
2
stack_v2_sparse_classes_30k_test_000825
Implement the Python class `QFBase` described below. Class description: Q network. Method signatures and docstrings: - def build(self): Build Network. - def forward(self, x, a): Forward.
Implement the Python class `QFBase` described below. Class description: Q network. Method signatures and docstrings: - def build(self): Build Network. - def forward(self, x, a): Forward. <|skeleton|> class QFBase: """Q network.""" def build(self): """Build Network.""" <|body_0|> def for...
e71c4b12955b01bfb907aa31c91ded6bcd8aaec8
<|skeleton|> class QFBase: """Q network.""" def build(self): """Build Network.""" <|body_0|> def forward(self, x, a): """Forward.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QFBase: """Q network.""" def build(self): """Build Network.""" nin = self.observation_space.shape[0] + self.action_space.shape[0] self.fc1 = nn.Linear(nin, 32) self.fc2 = nn.Linear(32, 32) self.fc3 = nn.Linear(32, 32) self.qvalue = nn.Linear(32, 1) def...
the_stack_v2_python_sparse
dl/rl/algorithms/ddpg.py
cbschaff/dl
train
1
d0ee64a91e7e9fd5c126afeef26dd6352f7f34c7
[ "if fname:\n if not fname.endswith('.pkl'):\n fname = fname + '.pkl'\n ifile = open(fname, 'rb')\n self._archive = pkl.load(ifile)\n ifile.close()\nelse:\n self._archive = None\nself._fname = fname\nself._pulled = {}\nself._new = {}\nif kwds:\n for key, value in list(kwds.items(...
<|body_start_0|> if fname: if not fname.endswith('.pkl'): fname = fname + '.pkl' ifile = open(fname, 'rb') self._archive = pkl.load(ifile) ifile.close() else: self._archive = None self._fname = fname ...
A container class that provides lazy persistance of instance attributes as a Python pickle. This is doubly lazy: attributes are not placed in the namespace until actually requested, and they are not saved to the archive until the AttrStore is explicitly saved. If only NumPy arrays are to be stored, ArrayStore may be mo...
AttrStore
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttrStore: """A container class that provides lazy persistance of instance attributes as a Python pickle. This is doubly lazy: attributes are not placed in the namespace until actually requested, and they are not saved to the archive until the AttrStore is explicitly saved. If only NumPy arrays a...
stack_v2_sparse_classes_75kplus_train_000983
14,154
no_license
[ { "docstring": "Prepare to load attributes from storage if a file name is provided; otherwise support saving of arrays assigned as attributes.", "name": "__init__", "signature": "def __init__(self, fname=None, **kwds)" }, { "docstring": "Catch references to attributes that have not yet been load...
5
stack_v2_sparse_classes_30k_train_048991
Implement the Python class `AttrStore` described below. Class description: A container class that provides lazy persistance of instance attributes as a Python pickle. This is doubly lazy: attributes are not placed in the namespace until actually requested, and they are not saved to the archive until the AttrStore is e...
Implement the Python class `AttrStore` described below. Class description: A container class that provides lazy persistance of instance attributes as a Python pickle. This is doubly lazy: attributes are not placed in the namespace until actually requested, and they are not saved to the archive until the AttrStore is e...
215de4e93b5cf79a1e9f380047b4db92bfeaf45c
<|skeleton|> class AttrStore: """A container class that provides lazy persistance of instance attributes as a Python pickle. This is doubly lazy: attributes are not placed in the namespace until actually requested, and they are not saved to the archive until the AttrStore is explicitly saved. If only NumPy arrays a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttrStore: """A container class that provides lazy persistance of instance attributes as a Python pickle. This is doubly lazy: attributes are not placed in the namespace until actually requested, and they are not saved to the archive until the AttrStore is explicitly saved. If only NumPy arrays are to be stor...
the_stack_v2_python_sparse
package/inference/utils/ioutils.py
tloredo/inference
train
3
fff466408e2ab14ad9e2cf4db573eaba802fe930
[ "self.logger = Log()\nself.logger.info('########################### TestWaybillConfirm START ###########################')\nconfig = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue()\napp_package = config['appPackage_chezhu']\napp_activity = config['appActivity_chezhu']\nself.mobile = config...
<|body_start_0|> self.logger = Log() self.logger.info('########################### TestWaybillConfirm START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = co...
凯京车主APP 确认发车
TestWaybillConfirm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestWaybillConfirm: """凯京车主APP 确认发车""" def setUp(self): """前置条件准备""" <|body_0|> def tearDown(self): """测试环境重置""" <|body_1|> def test_bvt_waybill_confirm(self): """确认发车操作""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.l...
stack_v2_sparse_classes_75kplus_train_000984
2,925
no_license
[ { "docstring": "前置条件准备", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "测试环境重置", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "确认发车操作", "name": "test_bvt_waybill_confirm", "signature": "def test_bvt_waybill_confirm(self)" }...
3
stack_v2_sparse_classes_30k_train_041491
Implement the Python class `TestWaybillConfirm` described below. Class description: 凯京车主APP 确认发车 Method signatures and docstrings: - def setUp(self): 前置条件准备 - def tearDown(self): 测试环境重置 - def test_bvt_waybill_confirm(self): 确认发车操作
Implement the Python class `TestWaybillConfirm` described below. Class description: 凯京车主APP 确认发车 Method signatures and docstrings: - def setUp(self): 前置条件准备 - def tearDown(self): 测试环境重置 - def test_bvt_waybill_confirm(self): 确认发车操作 <|skeleton|> class TestWaybillConfirm: """凯京车主APP 确认发车""" def setUp(self): ...
4112ee34827a68289ba95a30518c4b1ecf38a3b2
<|skeleton|> class TestWaybillConfirm: """凯京车主APP 确认发车""" def setUp(self): """前置条件准备""" <|body_0|> def tearDown(self): """测试环境重置""" <|body_1|> def test_bvt_waybill_confirm(self): """确认发车操作""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestWaybillConfirm: """凯京车主APP 确认发车""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info('########################### TestWaybillConfirm START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() ...
the_stack_v2_python_sparse
BVT/chezhuAPP/driver_register/test_case/test_waybill_confirm_chezhu.py
penny1205/AppUI
train
0
3b0b7ec40fab6545921022d0553699f6c2c6dbb1
[ "super(Model, self).__init__()\nself.w2v_size = param['embedding'].shape[1]\nself.vocab_size = param['embedding'].shape[0]\nself.embedding_type = param['embedding_type']\nself.embedding_is_training = param['embedding_is_training']\nself.mode = param['mode']\nself.hidden_size = param['hidden_size']\nself.dropout_p =...
<|body_start_0|> super(Model, self).__init__() self.w2v_size = param['embedding'].shape[1] self.vocab_size = param['embedding'].shape[0] self.embedding_type = param['embedding_type'] self.embedding_is_training = param['embedding_is_training'] self.mode = param['mode'] ...
match-lstm model for machine comprehension
Model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """match-lstm model for machine comprehension""" def __init__(self, param): """:param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num""" <|body_0|> def forward(self, batch): """:param batch: [content, q...
stack_v2_sparse_classes_75kplus_train_000985
3,371
no_license
[ { "docstring": ":param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num", "name": "__init__", "signature": "def __init__(self, param)" }, { "docstring": ":param batch: [content, question, answer_start, answer_end] :return: ans_range (2, batch_...
2
stack_v2_sparse_classes_30k_train_019771
Implement the Python class `Model` described below. Class description: match-lstm model for machine comprehension Method signatures and docstrings: - def __init__(self, param): :param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num - def forward(self, batch): :par...
Implement the Python class `Model` described below. Class description: match-lstm model for machine comprehension Method signatures and docstrings: - def __init__(self, param): :param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num - def forward(self, batch): :par...
4aaca6397c94ee62ef62e6436c649507ceb1e69b
<|skeleton|> class Model: """match-lstm model for machine comprehension""" def __init__(self, param): """:param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num""" <|body_0|> def forward(self, batch): """:param batch: [content, q...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Model: """match-lstm model for machine comprehension""" def __init__(self, param): """:param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num""" super(Model, self).__init__() self.w2v_size = param['embedding'].shape[1] s...
the_stack_v2_python_sparse
modules/match_lstm.py
xy09Player/rd_opinion
train
2
09ab232296c98b5313a90983234befc0750598ed
[ "self.__file = allel.read_vcf(filename, fields=VCFFile.LAYERS + VCFFile.ANNOTATIONS)\nself.sorting = None\nself.n_high_quality_variants = 0\nself.set_quality_threshold(quality_threshold)", "if quality_threshold is not None:\n q = self.__file[self.QUAL]\n low_quality = q < quality_threshold\n self.n_high_...
<|body_start_0|> self.__file = allel.read_vcf(filename, fields=VCFFile.LAYERS + VCFFile.ANNOTATIONS) self.sorting = None self.n_high_quality_variants = 0 self.set_quality_threshold(quality_threshold) <|end_body_0|> <|body_start_1|> if quality_threshold is not None: q...
Class representing vcf file
VCFFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VCFFile: """Class representing vcf file""" def __init__(self, filename: str, quality_threshold: Optional[int]=None): """Representation for VCF gile Args: filename: path to the vcf file quality_threshold: when set, variants above this thresholds come first""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_000986
6,090
no_license
[ { "docstring": "Representation for VCF gile Args: filename: path to the vcf file quality_threshold: when set, variants above this thresholds come first", "name": "__init__", "signature": "def __init__(self, filename: str, quality_threshold: Optional[int]=None)" }, { "docstring": "Set quality thr...
5
null
Implement the Python class `VCFFile` described below. Class description: Class representing vcf file Method signatures and docstrings: - def __init__(self, filename: str, quality_threshold: Optional[int]=None): Representation for VCF gile Args: filename: path to the vcf file quality_threshold: when set, variants abov...
Implement the Python class `VCFFile` described below. Class description: Class representing vcf file Method signatures and docstrings: - def __init__(self, filename: str, quality_threshold: Optional[int]=None): Representation for VCF gile Args: filename: path to the vcf file quality_threshold: when set, variants abov...
a14dee58aaf96cb432bebe4003c12a7e32b7a6cc
<|skeleton|> class VCFFile: """Class representing vcf file""" def __init__(self, filename: str, quality_threshold: Optional[int]=None): """Representation for VCF gile Args: filename: path to the vcf file quality_threshold: when set, variants above this thresholds come first""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VCFFile: """Class representing vcf file""" def __init__(self, filename: str, quality_threshold: Optional[int]=None): """Representation for VCF gile Args: filename: path to the vcf file quality_threshold: when set, variants above this thresholds come first""" self.__file = allel.read_vcf(f...
the_stack_v2_python_sparse
h5/create/dna.py
haochenz96/mosaic
train
0
3d3fee05b3c34f18debfffdc3d62614041cf3ab4
[ "BaseDbManager.__init__(self, db_connection)\nself.config_lock = BoundedSemaphore(1)\nself.config = self.get_config()", "value = ''\nself.config_lock.acquire()\ntry:\n self.check_db()\n value = self.get_config()\nfinally:\n self.config_lock.release()\nreturn value", "self.config_lock.acquire()\ntry:\n ...
<|body_start_0|> BaseDbManager.__init__(self, db_connection) self.config_lock = BoundedSemaphore(1) self.config = self.get_config() <|end_body_0|> <|body_start_1|> value = '' self.config_lock.acquire() try: self.check_db() value = self.get_config(...
Class that represents the handler object use to manage Alerts in MongoDB :param db_connection: DbConnection instance to handle MongoDb connection :type db_connection: data_manager.managers.DbConnection
ConfigDbManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigDbManager: """Class that represents the handler object use to manage Alerts in MongoDB :param db_connection: DbConnection instance to handle MongoDb connection :type db_connection: data_manager.managers.DbConnection""" def __init__(self, db_connection): """Constructor""" ...
stack_v2_sparse_classes_75kplus_train_000987
3,170
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, db_connection)" }, { "docstring": "Getter for the config attribute :return: Current config in DB :rtype: dict", "name": "config", "signature": "def config(self)" }, { "docstring": "Setter for confi...
5
stack_v2_sparse_classes_30k_train_053449
Implement the Python class `ConfigDbManager` described below. Class description: Class that represents the handler object use to manage Alerts in MongoDB :param db_connection: DbConnection instance to handle MongoDb connection :type db_connection: data_manager.managers.DbConnection Method signatures and docstrings: -...
Implement the Python class `ConfigDbManager` described below. Class description: Class that represents the handler object use to manage Alerts in MongoDB :param db_connection: DbConnection instance to handle MongoDb connection :type db_connection: data_manager.managers.DbConnection Method signatures and docstrings: -...
dc0d84e1f62be38868718410006fed98fb7763a5
<|skeleton|> class ConfigDbManager: """Class that represents the handler object use to manage Alerts in MongoDB :param db_connection: DbConnection instance to handle MongoDb connection :type db_connection: data_manager.managers.DbConnection""" def __init__(self, db_connection): """Constructor""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigDbManager: """Class that represents the handler object use to manage Alerts in MongoDB :param db_connection: DbConnection instance to handle MongoDb connection :type db_connection: data_manager.managers.DbConnection""" def __init__(self, db_connection): """Constructor""" BaseDbManag...
the_stack_v2_python_sparse
data_manager/managers/db_managers/config_db_manager.py
victorgrubio/sonda-data-manager
train
0
b3bd00e3ce0d3b73e80f4933b8d6187d3f90f8c3
[ "facility = logging.handlers.SysLogHandler.LOG_DAEMON\nself.logger = logger.Logger(name='google-networking', debug=debug, facility=facility)\nself.ip_aliases = ip_aliases\nself.ip_forwarding_enabled = ip_forwarding_enabled\nself.network_setup_enabled = network_setup_enabled\nself.target_instance_ips = target_instan...
<|body_start_0|> facility = logging.handlers.SysLogHandler.LOG_DAEMON self.logger = logger.Logger(name='google-networking', debug=debug, facility=facility) self.ip_aliases = ip_aliases self.ip_forwarding_enabled = ip_forwarding_enabled self.network_setup_enabled = network_setup_e...
Manage networking based on changes to network metadata.
NetworkDaemon
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkDaemon: """Manage networking based on changes to network metadata.""" def __init__(self, ip_forwarding_enabled, proto_id, ip_aliases, target_instance_ips, dhclient_script, dhcp_command, network_setup_enabled, debug=False): """Constructor. Args: ip_forwarding_enabled: bool, Tru...
stack_v2_sparse_classes_75kplus_train_000988
7,254
permissive
[ { "docstring": "Constructor. Args: ip_forwarding_enabled: bool, True if ip forwarding is enabled. proto_id: string, the routing protocol identifier for Google IP changes. ip_aliases: bool, True if the guest should configure IP alias routes. target_instance_ips: bool, True supports internal IP load balancing. dh...
3
stack_v2_sparse_classes_30k_train_040650
Implement the Python class `NetworkDaemon` described below. Class description: Manage networking based on changes to network metadata. Method signatures and docstrings: - def __init__(self, ip_forwarding_enabled, proto_id, ip_aliases, target_instance_ips, dhclient_script, dhcp_command, network_setup_enabled, debug=Fa...
Implement the Python class `NetworkDaemon` described below. Class description: Manage networking based on changes to network metadata. Method signatures and docstrings: - def __init__(self, ip_forwarding_enabled, proto_id, ip_aliases, target_instance_ips, dhclient_script, dhcp_command, network_setup_enabled, debug=Fa...
cf4b33214f770da2299923a5fa73d3d95f66ec35
<|skeleton|> class NetworkDaemon: """Manage networking based on changes to network metadata.""" def __init__(self, ip_forwarding_enabled, proto_id, ip_aliases, target_instance_ips, dhclient_script, dhcp_command, network_setup_enabled, debug=False): """Constructor. Args: ip_forwarding_enabled: bool, Tru...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetworkDaemon: """Manage networking based on changes to network metadata.""" def __init__(self, ip_forwarding_enabled, proto_id, ip_aliases, target_instance_ips, dhclient_script, dhcp_command, network_setup_enabled, debug=False): """Constructor. Args: ip_forwarding_enabled: bool, True if ip forwa...
the_stack_v2_python_sparse
packages/python-google-compute-engine/google_compute_engine/networking/network_daemon.py
GoogleCloudPlatform/compute-image-packages
train
329
4cee7a401b7bf864752d86b0923e2a281bd8afbd
[ "self.board = Board(self, width, height)\nself.board.place_mines(num_mines)\nself.start = time.time()", "while True:\n try:\n move = input(\"Move (col row, like 'ab' - %d left) > \" % self.board.left)\n col = ord(move[0].upper()) - ord('A')\n row = ord(move[1].upper()) - ord('A')\n ...
<|body_start_0|> self.board = Board(self, width, height) self.board.place_mines(num_mines) self.start = time.time() <|end_body_0|> <|body_start_1|> while True: try: move = input("Move (col row, like 'ab' - %d left) > " % self.board.left) col =...
Minesweeper.
Game
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """Minesweeper.""" def __init__(self, width=11, height=11, num_mines=11): """Initialize game. - Set up bord - Place mines - Note time (so at game end the delta can be shown)""" <|body_0|> def get_move(self): """Get a move, looping until we get a legal move"...
stack_v2_sparse_classes_75kplus_train_000989
5,366
no_license
[ { "docstring": "Initialize game. - Set up bord - Place mines - Note time (so at game end the delta can be shown)", "name": "__init__", "signature": "def __init__(self, width=11, height=11, num_mines=11)" }, { "docstring": "Get a move, looping until we get a legal move", "name": "get_move", ...
3
stack_v2_sparse_classes_30k_train_041583
Implement the Python class `Game` described below. Class description: Minesweeper. Method signatures and docstrings: - def __init__(self, width=11, height=11, num_mines=11): Initialize game. - Set up bord - Place mines - Note time (so at game end the delta can be shown) - def get_move(self): Get a move, looping until...
Implement the Python class `Game` described below. Class description: Minesweeper. Method signatures and docstrings: - def __init__(self, width=11, height=11, num_mines=11): Initialize game. - Set up bord - Place mines - Note time (so at game end the delta can be shown) - def get_move(self): Get a move, looping until...
2244d63607be13c70c531a6e3064f85074111ca7
<|skeleton|> class Game: """Minesweeper.""" def __init__(self, width=11, height=11, num_mines=11): """Initialize game. - Set up bord - Place mines - Note time (so at game end the delta can be shown)""" <|body_0|> def get_move(self): """Get a move, looping until we get a legal move"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Game: """Minesweeper.""" def __init__(self, width=11, height=11, num_mines=11): """Initialize game. - Set up bord - Place mines - Note time (so at game end the delta can be shown)""" self.board = Board(self, width, height) self.board.place_mines(num_mines) self.start = tim...
the_stack_v2_python_sparse
HARD/minesweeper/minesweeper.py
jenihuang/hb_challenges
train
2
c4f7bf8753f15a3c51925286c32d8e47832015af
[ "if treeSize == 0:\n return (None, head)\nif treeSize == 1:\n return (TreeNode(head.val), head.next)\nleftTreeSize = treeSize // 2\nrightTreeSize = treeSize - 1 - leftTreeSize\nleftRoot, rootListNode = self.sortedListToBSTHelper(head, leftTreeSize)\nroot = TreeNode(rootListNode.val)\nrightHead = rootListNode....
<|body_start_0|> if treeSize == 0: return (None, head) if treeSize == 1: return (TreeNode(head.val), head.next) leftTreeSize = treeSize // 2 rightTreeSize = treeSize - 1 - leftTreeSize leftRoot, rootListNode = self.sortedListToBSTHelper(head, leftTreeSize)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedListToBSTHelper(self, head, treeSize): """Moves head forward, and build a balanced tree with the iterated list nodes return a pair (treeRoot, newHead)""" <|body_0|> def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" ...
stack_v2_sparse_classes_75kplus_train_000990
1,535
no_license
[ { "docstring": "Moves head forward, and build a balanced tree with the iterated list nodes return a pair (treeRoot, newHead)", "name": "sortedListToBSTHelper", "signature": "def sortedListToBSTHelper(self, head, treeSize)" }, { "docstring": ":type head: ListNode :rtype: TreeNode", "name": "s...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBSTHelper(self, head, treeSize): Moves head forward, and build a balanced tree with the iterated list nodes return a pair (treeRoot, newHead) - def sortedListToBS...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBSTHelper(self, head, treeSize): Moves head forward, and build a balanced tree with the iterated list nodes return a pair (treeRoot, newHead) - def sortedListToBS...
6e051eb554d9cf6f424f1e0a77f3072adf7f64c4
<|skeleton|> class Solution: def sortedListToBSTHelper(self, head, treeSize): """Moves head forward, and build a balanced tree with the iterated list nodes return a pair (treeRoot, newHead)""" <|body_0|> def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sortedListToBSTHelper(self, head, treeSize): """Moves head forward, and build a balanced tree with the iterated list nodes return a pair (treeRoot, newHead)""" if treeSize == 0: return (None, head) if treeSize == 1: return (TreeNode(head.val), head...
the_stack_v2_python_sparse
109. Convert Sorted List to Binary Search Tree.py
vincent-kangzhou/LeetCode-Python
train
0
761d059bc51ee29c9b235411e3002479972c7202
[ "adm = ProjectAdministration()\nproposal = Grading.from_dict(api.payload)\nif proposal is not None:\n 'Wir verwenden Grading_id und Grade des Proposals für die Erzeugung eines Grading-Objektes.'\n grad = adm.create_grading(proposal.get_grade(), proposal.get_participation_id())\n return (grad, 200)\nelse:\n...
<|body_start_0|> adm = ProjectAdministration() proposal = Grading.from_dict(api.payload) if proposal is not None: 'Wir verwenden Grading_id und Grade des Proposals für die Erzeugung eines Grading-Objektes.' grad = adm.create_grading(proposal.get_grade(), proposal.get_part...
GradingOperations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradingOperations: def post(self): """Anlegen eines neuen Grading-Objekts""" <|body_0|> def put(self): """Update eines bestimmten Grading-Objekts.""" <|body_1|> <|end_skeleton|> <|body_start_0|> adm = ProjectAdministration() proposal = Gradi...
stack_v2_sparse_classes_75kplus_train_000991
44,493
no_license
[ { "docstring": "Anlegen eines neuen Grading-Objekts", "name": "post", "signature": "def post(self)" }, { "docstring": "Update eines bestimmten Grading-Objekts.", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_037300
Implement the Python class `GradingOperations` described below. Class description: Implement the GradingOperations class. Method signatures and docstrings: - def post(self): Anlegen eines neuen Grading-Objekts - def put(self): Update eines bestimmten Grading-Objekts.
Implement the Python class `GradingOperations` described below. Class description: Implement the GradingOperations class. Method signatures and docstrings: - def post(self): Anlegen eines neuen Grading-Objekts - def put(self): Update eines bestimmten Grading-Objekts. <|skeleton|> class GradingOperations: def po...
4b2826225525ae855e15e1174f5cf90466097021
<|skeleton|> class GradingOperations: def post(self): """Anlegen eines neuen Grading-Objekts""" <|body_0|> def put(self): """Update eines bestimmten Grading-Objekts.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GradingOperations: def post(self): """Anlegen eines neuen Grading-Objekts""" adm = ProjectAdministration() proposal = Grading.from_dict(api.payload) if proposal is not None: 'Wir verwenden Grading_id und Grade des Proposals für die Erzeugung eines Grading-Objektes.'...
the_stack_v2_python_sparse
src/main.py
KieserChristian/SW_Praktikum_Gruppe1
train
0
984fe6c68213718ea8a4b362e68067059b5680aa
[ "i = m - 1\nj = n - 1\nidx = len(nums1) - 1\nwhile i >= 0 or j >= 0:\n if i >= 0 and j >= 0:\n if nums1[i] < nums2[j]:\n nums1[idx] = nums2[j]\n idx -= 1\n j -= 1\n elif nums1[i] >= nums2[j]:\n nums1[idx] = nums1[i]\n idx -= 1\n i -=...
<|body_start_0|> i = m - 1 j = n - 1 idx = len(nums1) - 1 while i >= 0 or j >= 0: if i >= 0 and j >= 0: if nums1[i] < nums2[j]: nums1[idx] = nums2[j] idx -= 1 j -= 1 elif nums1[i] >= n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, nums1, m, nums2, n): """:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge(self, nums1: [int], m: int, nums2: [int], n: int) -> None: ...
stack_v2_sparse_classes_75kplus_train_000992
1,946
no_license
[ { "docstring": ":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.", "name": "merge", "signature": "def merge(self, nums1, m, nums2, n)" }, { "docstring": "Do not return anything, modify nums1 in-place inste...
2
stack_v2_sparse_classes_30k_train_049428
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead. -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead. -...
ae8bb8bf4ae4026ccaf1dce323b4098547dd35ec
<|skeleton|> class Solution: def merge(self, nums1, m, nums2, n): """:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge(self, nums1: [int], m: int, nums2: [int], n: int) -> None: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def merge(self, nums1, m, nums2, n): """:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.""" i = m - 1 j = n - 1 idx = len(nums1) - 1 while i >= 0 or j >= 0: ...
the_stack_v2_python_sparse
leet_code/88. Merge Sorted Array.py
roiei/algo
train
0
d1318c0a4d41d52a0bb8be4bd0e6cc0b8ff99f4a
[ "if n < 2:\n return 0\nif n == 2:\n return 1\nif n == 3:\n return 2\nporduct = [0] * (n + 1)\nporduct[0] = 0\nporduct[1] = 1\nporduct[2] = 2\nporduct[3] = 3\nres = 0\nfor i in range(4, n + 1):\n maxs = 0\n for j in range(1, i // 2 + 1):\n pro = porduct[j] * porduct[i - j]\n maxs = max(m...
<|body_start_0|> if n < 2: return 0 if n == 2: return 1 if n == 3: return 2 porduct = [0] * (n + 1) porduct[0] = 0 porduct[1] = 1 porduct[2] = 2 porduct[3] = 3 res = 0 for i in range(4, n + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def cuttingRope1(self, n): """dp,f(n) = max(f(i)*f(n-i)) 由于必须剪一刀,所以对n<=3单独考虑""" <|body_0|> def cuttingRope2(self, n): """贪婪法,当""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 2: return 0 if n == 2: re...
stack_v2_sparse_classes_75kplus_train_000993
1,202
no_license
[ { "docstring": "dp,f(n) = max(f(i)*f(n-i)) 由于必须剪一刀,所以对n<=3单独考虑", "name": "cuttingRope1", "signature": "def cuttingRope1(self, n)" }, { "docstring": "贪婪法,当", "name": "cuttingRope2", "signature": "def cuttingRope2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_030080
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope1(self, n): dp,f(n) = max(f(i)*f(n-i)) 由于必须剪一刀,所以对n<=3单独考虑 - def cuttingRope2(self, n): 贪婪法,当
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope1(self, n): dp,f(n) = max(f(i)*f(n-i)) 由于必须剪一刀,所以对n<=3单独考虑 - def cuttingRope2(self, n): 贪婪法,当 <|skeleton|> class Solution: def cuttingRope1(self, n): ...
1c963f69d8542f7741f7a07ff28e4de18d0f1377
<|skeleton|> class Solution: def cuttingRope1(self, n): """dp,f(n) = max(f(i)*f(n-i)) 由于必须剪一刀,所以对n<=3单独考虑""" <|body_0|> def cuttingRope2(self, n): """贪婪法,当""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def cuttingRope1(self, n): """dp,f(n) = max(f(i)*f(n-i)) 由于必须剪一刀,所以对n<=3单独考虑""" if n < 2: return 0 if n == 2: return 1 if n == 3: return 2 porduct = [0] * (n + 1) porduct[0] = 0 porduct[1] = 1 porduct...
the_stack_v2_python_sparse
14_CuttingRope.py
VCloser/CodingInterviewChinese2-python
train
0
51bf63a5476320866fe9b1a519617e8f602d86e0
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConditionalAccessUsers()", "from .conditional_access_guests_or_external_users import ConditionalAccessGuestsOrExternalUsers\nfrom .conditional_access_guests_or_external_users import ConditionalAccessGuestsOrExternalUsers\nfields: Dict[...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ConditionalAccessUsers() <|end_body_0|> <|body_start_1|> from .conditional_access_guests_or_external_users import ConditionalAccessGuestsOrExternalUsers from .conditional_access_guests_o...
ConditionalAccessUsers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionalAccessUsers: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessUsers: """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 ...
stack_v2_sparse_classes_75kplus_train_000994
5,400
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: ConditionalAccessUsers", "name": "create_from_discriminator_value", "signature": "def create_from_discrimina...
3
stack_v2_sparse_classes_30k_train_053024
Implement the Python class `ConditionalAccessUsers` described below. Class description: Implement the ConditionalAccessUsers class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessUsers: Creates a new instance of the appropriate class b...
Implement the Python class `ConditionalAccessUsers` described below. Class description: Implement the ConditionalAccessUsers class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessUsers: Creates a new instance of the appropriate class b...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ConditionalAccessUsers: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessUsers: """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 ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConditionalAccessUsers: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessUsers: """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 Ret...
the_stack_v2_python_sparse
msgraph/generated/models/conditional_access_users.py
microsoftgraph/msgraph-sdk-python
train
135
e45b19d283a19e1481e4bb4fd4799eb77dd719b0
[ "self.full_course_name = full_course_name\nself.course_name = course_name\nself.course_visibility = course_visibility\nself.begin_day = begin_day\nself.begin_month = begin_month\nself.begin_year = begin_year\nself.end_day = end_day\nself.end_month = end_month\nself.end_year = end_year\nself.id_course = id_course\ns...
<|body_start_0|> self.full_course_name = full_course_name self.course_name = course_name self.course_visibility = course_visibility self.begin_day = begin_day self.begin_month = begin_month self.begin_year = begin_year self.end_day = end_day self.end_month...
CreateCourse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateCourse: def __init__(self, full_course_name=None, course_name=None, course_visibility=None, begin_day=None, begin_month=None, begin_year=None, end_day=None, end_month=None, end_year=None, id_course=None, description_field=None, image_url=None, group_mode=None, forced_group_mode=None, tags_...
stack_v2_sparse_classes_75kplus_train_000995
2,824
permissive
[ { "docstring": "Construct data.", "name": "__init__", "signature": "def __init__(self, full_course_name=None, course_name=None, course_visibility=None, begin_day=None, begin_month=None, begin_year=None, end_day=None, end_month=None, end_year=None, id_course=None, description_field=None, image_url=None, ...
2
stack_v2_sparse_classes_30k_train_007733
Implement the Python class `CreateCourse` described below. Class description: Implement the CreateCourse class. Method signatures and docstrings: - def __init__(self, full_course_name=None, course_name=None, course_visibility=None, begin_day=None, begin_month=None, begin_year=None, end_day=None, end_month=None, end_y...
Implement the Python class `CreateCourse` described below. Class description: Implement the CreateCourse class. Method signatures and docstrings: - def __init__(self, full_course_name=None, course_name=None, course_visibility=None, begin_day=None, begin_month=None, begin_year=None, end_day=None, end_month=None, end_y...
8cd0a53fffe797c47d3b14cc3300c610467432e3
<|skeleton|> class CreateCourse: def __init__(self, full_course_name=None, course_name=None, course_visibility=None, begin_day=None, begin_month=None, begin_year=None, end_day=None, end_month=None, end_year=None, id_course=None, description_field=None, image_url=None, group_mode=None, forced_group_mode=None, tags_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateCourse: def __init__(self, full_course_name=None, course_name=None, course_visibility=None, begin_day=None, begin_month=None, begin_year=None, end_day=None, end_month=None, end_year=None, id_course=None, description_field=None, image_url=None, group_mode=None, forced_group_mode=None, tags_courses=None):...
the_stack_v2_python_sparse
models/create_course.py
KKashpovski/test_moodle_project
train
0
69b1db7930589fd859762ce88faf24ad9f1f5254
[ "if not image_key:\n image_key = 'image/encoded'\nsuper(Image, self).__init__([image_key])\nself._image_key = image_key\nself._shape = shape\nself._channels = channels\nself._dtype = dtype\nself._repeated = repeated", "image_buffer = keys_to_tensors[self._image_key]\nif self._repeated:\n return functional_o...
<|body_start_0|> if not image_key: image_key = 'image/encoded' super(Image, self).__init__([image_key]) self._image_key = image_key self._shape = shape self._channels = channels self._dtype = dtype self._repeated = repeated <|end_body_0|> <|body_start...
Image
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Image: def __init__(self, image_key=None, format_key=None, shape=None, channels=3, dtype=tf.uint8, repeated=False): """Initializes the image. Args: image_key: the name of the TF-Example feature in which the encoded image is stored. shape: the output shape of the image as 1-D `Tensor` [he...
stack_v2_sparse_classes_75kplus_train_000996
5,647
permissive
[ { "docstring": "Initializes the image. Args: image_key: the name of the TF-Example feature in which the encoded image is stored. shape: the output shape of the image as 1-D `Tensor` [height, width, channels]. If provided, the image is reshaped accordingly. If left as None, no reshaping is done. A shape should b...
3
stack_v2_sparse_classes_30k_train_014329
Implement the Python class `Image` described below. Class description: Implement the Image class. Method signatures and docstrings: - def __init__(self, image_key=None, format_key=None, shape=None, channels=3, dtype=tf.uint8, repeated=False): Initializes the image. Args: image_key: the name of the TF-Example feature ...
Implement the Python class `Image` described below. Class description: Implement the Image class. Method signatures and docstrings: - def __init__(self, image_key=None, format_key=None, shape=None, channels=3, dtype=tf.uint8, repeated=False): Initializes the image. Args: image_key: the name of the TF-Example feature ...
5f7a17e527edb30480fb7c7783e968956b409b0b
<|skeleton|> class Image: def __init__(self, image_key=None, format_key=None, shape=None, channels=3, dtype=tf.uint8, repeated=False): """Initializes the image. Args: image_key: the name of the TF-Example feature in which the encoded image is stored. shape: the output shape of the image as 1-D `Tensor` [he...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Image: def __init__(self, image_key=None, format_key=None, shape=None, channels=3, dtype=tf.uint8, repeated=False): """Initializes the image. Args: image_key: the name of the TF-Example feature in which the encoded image is stored. shape: the output shape of the image as 1-D `Tensor` [height, width, c...
the_stack_v2_python_sparse
script/dataset_debug/reader.py
ki-lm/blueoil
train
0
2cdf1cd40eb37da4cb5e9849beaabb1f2a35ea32
[ "if max_subspace <= 2 or max_iterations <= 0 or eps <= 0:\n raise ValueError('Invalid values for max_subspace, max_iterations and/ or eps: ({}, {}, {}).'.format(max_subspace, max_iterations, eps))\nself.max_subspace = max_subspace\nself.max_iterations = max_iterations\nself.eps = eps\nself.real_only = real_only"...
<|body_start_0|> if max_subspace <= 2 or max_iterations <= 0 or eps <= 0: raise ValueError('Invalid values for max_subspace, max_iterations and/ or eps: ({}, {}, {}).'.format(max_subspace, max_iterations, eps)) self.max_subspace = max_subspace self.max_iterations = max_iterations ...
Davidson algorithm iteration options.
DavidsonOptions
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DavidsonOptions: """Davidson algorithm iteration options.""" def __init__(self, max_subspace=100, max_iterations=300, eps=1e-06, real_only=False): """Args: max_subspace(int): Max number of vectors in the auxiliary subspace. max_iterations(int): Max number of iterations. eps(float): T...
stack_v2_sparse_classes_75kplus_train_000997
19,388
permissive
[ { "docstring": "Args: max_subspace(int): Max number of vectors in the auxiliary subspace. max_iterations(int): Max number of iterations. eps(float): The max error for eigen vector error's elements during iterations: linear_operator * v - v * lambda. real_only(bool): Desired eigenvectors are real only or not. Wh...
2
stack_v2_sparse_classes_30k_train_004497
Implement the Python class `DavidsonOptions` described below. Class description: Davidson algorithm iteration options. Method signatures and docstrings: - def __init__(self, max_subspace=100, max_iterations=300, eps=1e-06, real_only=False): Args: max_subspace(int): Max number of vectors in the auxiliary subspace. max...
Implement the Python class `DavidsonOptions` described below. Class description: Davidson algorithm iteration options. Method signatures and docstrings: - def __init__(self, max_subspace=100, max_iterations=300, eps=1e-06, real_only=False): Args: max_subspace(int): Max number of vectors in the auxiliary subspace. max...
788481753c798a72c5cb3aa9f2aa9da3ce3190b0
<|skeleton|> class DavidsonOptions: """Davidson algorithm iteration options.""" def __init__(self, max_subspace=100, max_iterations=300, eps=1e-06, real_only=False): """Args: max_subspace(int): Max number of vectors in the auxiliary subspace. max_iterations(int): Max number of iterations. eps(float): T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DavidsonOptions: """Davidson algorithm iteration options.""" def __init__(self, max_subspace=100, max_iterations=300, eps=1e-06, real_only=False): """Args: max_subspace(int): Max number of vectors in the auxiliary subspace. max_iterations(int): Max number of iterations. eps(float): The max error ...
the_stack_v2_python_sparse
src/openfermion/linalg/davidson.py
quantumlib/OpenFermion
train
1,481
78eb557cc6892e4804fda13c4dd94944f6d59141
[ "max_len = 0\nfor i in range(len(string)):\n for j in range(i, len(string)):\n curr = string[i:j + 1]\n if len(curr) == len(set(curr)):\n max_len = max(max_len, j - i + 1)\nreturn max_len", "letters = set()\nmax_len = 0\ni = 0\nfor j, char in enumerate(string):\n while letters and c...
<|body_start_0|> max_len = 0 for i in range(len(string)): for j in range(i, len(string)): curr = string[i:j + 1] if len(curr) == len(set(curr)): max_len = max(max_len, j - i + 1) return max_len <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longest_nonrepeat_brute(self, string): """Returns length of longest nonrepeating substring. Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(string).""" <|body_0|> def longest_nonrepeat(self, string): """Returns length ...
stack_v2_sparse_classes_75kplus_train_000998
3,247
no_license
[ { "docstring": "Returns length of longest nonrepeating substring. Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(string).", "name": "longest_nonrepeat_brute", "signature": "def longest_nonrepeat_brute(self, string)" }, { "docstring": "Returns length of longest...
4
stack_v2_sparse_classes_30k_train_007054
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_nonrepeat_brute(self, string): Returns length of longest nonrepeating substring. Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(st...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_nonrepeat_brute(self, string): Returns length of longest nonrepeating substring. Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(st...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def longest_nonrepeat_brute(self, string): """Returns length of longest nonrepeating substring. Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(string).""" <|body_0|> def longest_nonrepeat(self, string): """Returns length ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longest_nonrepeat_brute(self, string): """Returns length of longest nonrepeating substring. Brute force algorithm. Time complexity: O(n ^ 2). Space complexity: O(1), n is len(string).""" max_len = 0 for i in range(len(string)): for j in range(i, len(string)): ...
the_stack_v2_python_sparse
Hashing/longest_nonrepeating_substring.py
vladn90/Algorithms
train
0
cf8e9badaf81b60e2599a5b52c4d28a36488f679
[ "user_name = input('\\nEnter your email: ')\ndevice_name = input('Enter the name of your phone: ')\nreturn self.search(user_name, device_name)", "while True:\n device_address = None\n print('Searching for device..')\n time.sleep(2)\n nearby_devices = bluetooth.discover_devices()\n for mac_address i...
<|body_start_0|> user_name = input('\nEnter your email: ') device_name = input('Enter the name of your phone: ') return self.search(user_name, device_name) <|end_body_0|> <|body_start_1|> while True: device_address = None print('Searching for device..') ...
Class to listen for mac address using bluetooth
BluetoothIOT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BluetoothIOT: """Class to listen for mac address using bluetooth""" def main(self): """Main function""" <|body_0|> def search(self, user_name, device_name): """Function to search for device with device_name""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_000999
1,463
no_license
[ { "docstring": "Main function", "name": "main", "signature": "def main(self)" }, { "docstring": "Function to search for device with device_name", "name": "search", "signature": "def search(self, user_name, device_name)" } ]
2
stack_v2_sparse_classes_30k_train_023991
Implement the Python class `BluetoothIOT` described below. Class description: Class to listen for mac address using bluetooth Method signatures and docstrings: - def main(self): Main function - def search(self, user_name, device_name): Function to search for device with device_name
Implement the Python class `BluetoothIOT` described below. Class description: Class to listen for mac address using bluetooth Method signatures and docstrings: - def main(self): Main function - def search(self, user_name, device_name): Function to search for device with device_name <|skeleton|> class BluetoothIOT: ...
8a54132766ce38a7e338218cc70fd58093edd820
<|skeleton|> class BluetoothIOT: """Class to listen for mac address using bluetooth""" def main(self): """Main function""" <|body_0|> def search(self, user_name, device_name): """Function to search for device with device_name""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BluetoothIOT: """Class to listen for mac address using bluetooth""" def main(self): """Main function""" user_name = input('\nEnter your email: ') device_name = input('Enter the name of your phone: ') return self.search(user_name, device_name) def search(self, user_nam...
the_stack_v2_python_sparse
AgentPi/bluetoothIOT.py
chrisho251/Car-Share-IoT-Application
train
0