blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
337bb0cb814fbcaa2b38156ace0b0437b8059f7f
[ "super().__init__()\nself.num_classes = num_classes\nself.num_features = self.embed_dim = embed_dim\nself.num_tokens = 2 if distilled else 1\nnorm_layer = norm_layer or partial(nn.LayerNorm, eps=1e-06)\nact_layer = act_layer or GELU\nself.patch_embed = embed_layer(img_size=img_size, patch_size=patch_size, in_chans=...
<|body_start_0|> super().__init__() self.num_classes = num_classes self.num_features = self.embed_dim = embed_dim self.num_tokens = 2 if distilled else 1 norm_layer = norm_layer or partial(nn.LayerNorm, eps=1e-06) act_layer = act_layer or GELU self.patch_embed = e...
Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: int :param num_classes: number of class for cla...
VisionTransformer
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisionTransformer: """Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: in...
stack_v2_sparse_classes_10k_train_005900
9,222
permissive
[ { "docstring": "Construct the VisionTransformer class.", "name": "__init__", "signature": "def __init__(self, img_size=224, patch_size=16, in_chans=3, num_classes=1000, embed_dim=768, depth=12, num_heads=12, mlp_ratio=4.0, qkv_bias=True, qk_scale=None, representation_size=None, distilled=False, drop_rat...
2
stack_v2_sparse_classes_30k_train_001497
Implement the Python class `VisionTransformer` described below. Class description: Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: numb...
Implement the Python class `VisionTransformer` described below. Class description: Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: numb...
12e37a1991eb6771a2999fe0a46ddda920c47948
<|skeleton|> class VisionTransformer: """Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VisionTransformer: """Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: int :param num_...
the_stack_v2_python_sparse
vega/networks/pytorch/transformer/vit.py
huawei-noah/vega
train
850
0bb1de370d90ab6d6850b0a97fc631b8662c076a
[ "if not root:\n return str([])\nans = [root.val]\nqueue = [root]\nwhile queue:\n node = queue.pop(0)\n if node.left:\n queue.append(node.left)\n ans.append(node.left.val)\n else:\n ans.append(None)\n if node.right:\n queue.append(node.right)\n ans.append(node.right....
<|body_start_0|> if not root: return str([]) ans = [root.val] queue = [root] while queue: node = queue.pop(0) if node.left: queue.append(node.left) ans.append(node.left.val) else: ans.append(N...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_005901
1,762
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
54d777e11b91c5debe49c1aef723234c66a5d2cc
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return str([]) ans = [root.val] queue = [root] while queue: node = queue.pop(0) if node.left: que...
the_stack_v2_python_sparse
leetcode_solution/tree/#297.Serialize_and_Deserialize_Binary_Tree.py
HsiangHung/Code-Challenges
train
0
4e795d4488a814ebc494485f02c8f499cea11005
[ "user_id = get_jwt_identity()\nif user_id is None:\n query = Blog.select().where(Blog.published)\nelse:\n query = Blog.select()\nreturn paginate(query, pagination)", "blog = Blog(**args)\nblog.date = datetime.utcnow()\nuser_id = get_jwt_identity()\ntry:\n user = User.get()\nexcept User.DoesNotExist:\n ...
<|body_start_0|> user_id = get_jwt_identity() if user_id is None: query = Blog.select().where(Blog.published) else: query = Blog.select() return paginate(query, pagination) <|end_body_0|> <|body_start_1|> blog = Blog(**args) blog.date = datetime.u...
BlogListAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogListAPI: def get(self, pagination): """List blog posts""" <|body_0|> def post(self, pagination, args): """Create blog post""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_id = get_jwt_identity() if user_id is None: query...
stack_v2_sparse_classes_10k_train_005902
4,891
permissive
[ { "docstring": "List blog posts", "name": "get", "signature": "def get(self, pagination)" }, { "docstring": "Create blog post", "name": "post", "signature": "def post(self, pagination, args)" } ]
2
stack_v2_sparse_classes_30k_train_004699
Implement the Python class `BlogListAPI` described below. Class description: Implement the BlogListAPI class. Method signatures and docstrings: - def get(self, pagination): List blog posts - def post(self, pagination, args): Create blog post
Implement the Python class `BlogListAPI` described below. Class description: Implement the BlogListAPI class. Method signatures and docstrings: - def get(self, pagination): List blog posts - def post(self, pagination, args): Create blog post <|skeleton|> class BlogListAPI: def get(self, pagination): """...
dffc3b1e16c24dd49e516e36aaa731a8dd299e66
<|skeleton|> class BlogListAPI: def get(self, pagination): """List blog posts""" <|body_0|> def post(self, pagination, args): """Create blog post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BlogListAPI: def get(self, pagination): """List blog posts""" user_id = get_jwt_identity() if user_id is None: query = Blog.select().where(Blog.published) else: query = Blog.select() return paginate(query, pagination) def post(self, paginati...
the_stack_v2_python_sparse
tilda/api/blog.py
tilda-center/backend
train
0
3e67135375e8e9ffc5c02e10c0562c42049e6251
[ "user = request.user\naddress = Address.objects.get_default_address(user)\nreturn render(request, 'user_center_site.html', {'page': 'address', 'address': address})", "receiver = request.POST.get('receiver')\naddr = request.POST.get('addr')\nzip_code = request.POST.get('zip_code')\nphone = request.POST.get('phone'...
<|body_start_0|> user = request.user address = Address.objects.get_default_address(user) return render(request, 'user_center_site.html', {'page': 'address', 'address': address}) <|end_body_0|> <|body_start_1|> receiver = request.POST.get('receiver') addr = request.POST.get('addr...
用户中心-地址页
AddressView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddressView: """用户中心-地址页""" def get(self, request): """显示""" <|body_0|> def post(self, request): """地址的添加""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = request.user address = Address.objects.get_default_address(user) ret...
stack_v2_sparse_classes_10k_train_005903
11,775
no_license
[ { "docstring": "显示", "name": "get", "signature": "def get(self, request)" }, { "docstring": "地址的添加", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `AddressView` described below. Class description: 用户中心-地址页 Method signatures and docstrings: - def get(self, request): 显示 - def post(self, request): 地址的添加
Implement the Python class `AddressView` described below. Class description: 用户中心-地址页 Method signatures and docstrings: - def get(self, request): 显示 - def post(self, request): 地址的添加 <|skeleton|> class AddressView: """用户中心-地址页""" def get(self, request): """显示""" <|body_0|> def post(self,...
91293b05eb28697f5dec7f99a0f608904f6a0b1f
<|skeleton|> class AddressView: """用户中心-地址页""" def get(self, request): """显示""" <|body_0|> def post(self, request): """地址的添加""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddressView: """用户中心-地址页""" def get(self, request): """显示""" user = request.user address = Address.objects.get_default_address(user) return render(request, 'user_center_site.html', {'page': 'address', 'address': address}) def post(self, request): """地址的添加""" ...
the_stack_v2_python_sparse
dailyfresh/apps/user/views.py
IronmanJay/Python_Project
train
15
f1120224241851c19baa225fddf63173832d53ab
[ "try:\n serializer = PatientHistoryFilesSerializers(PatientHistoryFiles.objects.all(), many=True)\n return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200)\nexcept Exception as e:\n info_message = 'Internal Server Error'\n logger.error(info_message, e)\n return JsonRespons...
<|body_start_0|> try: serializer = PatientHistoryFilesSerializers(PatientHistoryFiles.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) except Exception as e: info_message = 'Internal Server Error' ...
PatientHistoryFilesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatientHistoryFilesView: def get(self, request): """Get all patients""" <|body_0|> def post(self, request): """Save patient data""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: serializer = PatientHistoryFilesSerializers(PatientHist...
stack_v2_sparse_classes_10k_train_005904
12,219
no_license
[ { "docstring": "Get all patients", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Save patient data", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_002896
Implement the Python class `PatientHistoryFilesView` described below. Class description: Implement the PatientHistoryFilesView class. Method signatures and docstrings: - def get(self, request): Get all patients - def post(self, request): Save patient data
Implement the Python class `PatientHistoryFilesView` described below. Class description: Implement the PatientHistoryFilesView class. Method signatures and docstrings: - def get(self, request): Get all patients - def post(self, request): Save patient data <|skeleton|> class PatientHistoryFilesView: def get(self...
b63849983a592fd6a1f654191020fd86aa0787ae
<|skeleton|> class PatientHistoryFilesView: def get(self, request): """Get all patients""" <|body_0|> def post(self, request): """Save patient data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PatientHistoryFilesView: def get(self, request): """Get all patients""" try: serializer = PatientHistoryFilesSerializers(PatientHistoryFiles.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) except Exce...
the_stack_v2_python_sparse
patient/views.py
RupeshKurlekar/biocare
train
1
0504d39c19d4a0d19ef084e4f71ae35eb99d31bc
[ "super(RelationalPointerNet, self).__init__()\nself.hidden_size = hidden_size\ninitializer = nn.initializer.TruncatedNormal(std=init_range)\nself.q = _build_linear(hidden_size, hidden_size, new_name(name, 'query_fc'), initializer)\nself.k = _build_linear(hidden_size, hidden_size, new_name(name, 'key_fc'), initializ...
<|body_start_0|> super(RelationalPointerNet, self).__init__() self.hidden_size = hidden_size initializer = nn.initializer.TruncatedNormal(std=init_range) self.q = _build_linear(hidden_size, hidden_size, new_name(name, 'query_fc'), initializer) self.k = _build_linear(hidden_size, ...
Pointer Netword with Relations
RelationalPointerNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelationalPointerNet: """Pointer Netword with Relations""" def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): """init of class Args: cfg (TYPE): NULL""" <|body_0|> def forward(self, queries, keys, relations, attn_bias=None): """relational...
stack_v2_sparse_classes_10k_train_005905
15,933
permissive
[ { "docstring": "init of class Args: cfg (TYPE): NULL", "name": "__init__", "signature": "def __init__(self, hidden_size, num_relations, init_range=0.02, name=None)" }, { "docstring": "relational attention forward. seq_len in `shape` means num queries/keys/values of attention Args: queries (TYPE)...
2
null
Implement the Python class `RelationalPointerNet` described below. Class description: Pointer Netword with Relations Method signatures and docstrings: - def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): init of class Args: cfg (TYPE): NULL - def forward(self, queries, keys, relations, attn_b...
Implement the Python class `RelationalPointerNet` described below. Class description: Pointer Netword with Relations Method signatures and docstrings: - def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): init of class Args: cfg (TYPE): NULL - def forward(self, queries, keys, relations, attn_b...
b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd
<|skeleton|> class RelationalPointerNet: """Pointer Netword with Relations""" def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): """init of class Args: cfg (TYPE): NULL""" <|body_0|> def forward(self, queries, keys, relations, attn_bias=None): """relational...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RelationalPointerNet: """Pointer Netword with Relations""" def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): """init of class Args: cfg (TYPE): NULL""" super(RelationalPointerNet, self).__init__() self.hidden_size = hidden_size initializer = nn.in...
the_stack_v2_python_sparse
NLP/Text2SQL-BASELINE/text2sql/models/relational_transformer.py
sserdoubleh/Research
train
10
81566d03b343c74dfea384fb5bcdd5eb05be66be
[ "index = 'test_index'\nsketch_id = 1\nanalyzer = SessionizerSketchPlugin(index, sketch_id)\nanalyzer.datastore.client = mock.Mock()\ndatastore = analyzer.datastore\n_create_mock_event(datastore, 0, 3, time_diffs=[3000, 400000000])\nmessage = analyzer.run()\nself.assertEqual(message, 'Sessionizing completed, number ...
<|body_start_0|> index = 'test_index' sketch_id = 1 analyzer = SessionizerSketchPlugin(index, sketch_id) analyzer.datastore.client = mock.Mock() datastore = analyzer.datastore _create_mock_event(datastore, 0, 3, time_diffs=[3000, 400000000]) message = analyzer.run...
Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.
TestSessionizerPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSessionizerPlugin: """Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.""" def test_multiple_sessions(self): """Test multiple events, two of which are in the same session and one in a different session.""" <|body_0|> def test_zero_t...
stack_v2_sparse_classes_10k_train_005906
4,019
permissive
[ { "docstring": "Test multiple events, two of which are in the same session and one in a different session.", "name": "test_multiple_sessions", "signature": "def test_multiple_sessions(self)" }, { "docstring": "Test events with no time difference between them are allocated correctly.", "name"...
4
stack_v2_sparse_classes_30k_train_003903
Implement the Python class `TestSessionizerPlugin` described below. Class description: Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases. Method signatures and docstrings: - def test_multiple_sessions(self): Test multiple events, two of which are in the same session and one in a diff...
Implement the Python class `TestSessionizerPlugin` described below. Class description: Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases. Method signatures and docstrings: - def test_multiple_sessions(self): Test multiple events, two of which are in the same session and one in a diff...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class TestSessionizerPlugin: """Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.""" def test_multiple_sessions(self): """Test multiple events, two of which are in the same session and one in a different session.""" <|body_0|> def test_zero_t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSessionizerPlugin: """Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.""" def test_multiple_sessions(self): """Test multiple events, two of which are in the same session and one in a different session.""" index = 'test_index' sketch_id = 1 ...
the_stack_v2_python_sparse
timesketch/lib/analyzers/sessionizer_test.py
google/timesketch
train
2,263
3316157bbfd1532827ce99a1bce30a30dfb37d54
[ "if not re.search('^[a-zA-Z0-9._]+$', v):\n raise ValueError('must be alphanumeric')\nreturn v", "if not values.get('password_old'):\n raise ValueError('old password is required')\nreturn v", "if not values.get('password_new_1') or v != values['password_new_1']:\n raise ValueError('passwords do not mat...
<|body_start_0|> if not re.search('^[a-zA-Z0-9._]+$', v): raise ValueError('must be alphanumeric') return v <|end_body_0|> <|body_start_1|> if not values.get('password_old'): raise ValueError('old password is required') return v <|end_body_1|> <|body_start_2|> ...
User update schema.
UpdateUserIn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateUserIn: """User update schema.""" def username_valid(cls, v: Any) -> Any: """Username validator. Args: v (Any): Username value. Raises: ValueError: Username invalid. Returns: Any: Username valid.""" <|body_0|> def passwords_match_1(cls, v: Any, values: Any, **kwarg...
stack_v2_sparse_classes_10k_train_005907
4,438
no_license
[ { "docstring": "Username validator. Args: v (Any): Username value. Raises: ValueError: Username invalid. Returns: Any: Username valid.", "name": "username_valid", "signature": "def username_valid(cls, v: Any) -> Any" }, { "docstring": "Check if filled password_new_1 and password_old. Args: v (An...
3
stack_v2_sparse_classes_30k_train_001462
Implement the Python class `UpdateUserIn` described below. Class description: User update schema. Method signatures and docstrings: - def username_valid(cls, v: Any) -> Any: Username validator. Args: v (Any): Username value. Raises: ValueError: Username invalid. Returns: Any: Username valid. - def passwords_match_1(c...
Implement the Python class `UpdateUserIn` described below. Class description: User update schema. Method signatures and docstrings: - def username_valid(cls, v: Any) -> Any: Username validator. Args: v (Any): Username value. Raises: ValueError: Username invalid. Returns: Any: Username valid. - def passwords_match_1(c...
8082d3ce9c999c79228a36aa160b4171140440cb
<|skeleton|> class UpdateUserIn: """User update schema.""" def username_valid(cls, v: Any) -> Any: """Username validator. Args: v (Any): Username value. Raises: ValueError: Username invalid. Returns: Any: Username valid.""" <|body_0|> def passwords_match_1(cls, v: Any, values: Any, **kwarg...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateUserIn: """User update schema.""" def username_valid(cls, v: Any) -> Any: """Username validator. Args: v (Any): Username value. Raises: ValueError: Username invalid. Returns: Any: Username valid.""" if not re.search('^[a-zA-Z0-9._]+$', v): raise ValueError('must be alpha...
the_stack_v2_python_sparse
app/users/schemas.py
douglaspands/api-server-py
train
2
d15d3c0d50820b63dd4b4dee44cd473f17f6cdce
[ "super(ProjectQueueManager, self).__init__()\nself.zk_client = zk_client\nself.project_id = project_id\nproject_dsn_node = '/appscale/projects/{}/postgres_dsn'.format(project_id)\nglobal_dsn_node = '/appscale/tasks/postgres_dsn'\nif self.zk_client.exists(project_dsn_node):\n pg_dsn = self.zk_client.get(project_d...
<|body_start_0|> super(ProjectQueueManager, self).__init__() self.zk_client = zk_client self.project_id = project_id project_dsn_node = '/appscale/projects/{}/postgres_dsn'.format(project_id) global_dsn_node = '/appscale/tasks/postgres_dsn' if self.zk_client.exists(projec...
Keeps track of queue configuration details for a single project.
ProjectQueueManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectQueueManager: """Keeps track of queue configuration details for a single project.""" def __init__(self, zk_client, project_id): """Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.""" <|body_0|> def up...
stack_v2_sparse_classes_10k_train_005908
7,391
permissive
[ { "docstring": "Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.", "name": "__init__", "signature": "def __init__(self, zk_client, project_id)" }, { "docstring": "Caches new configuration details and cleans up old state. Args: queue...
6
null
Implement the Python class `ProjectQueueManager` described below. Class description: Keeps track of queue configuration details for a single project. Method signatures and docstrings: - def __init__(self, zk_client, project_id): Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string s...
Implement the Python class `ProjectQueueManager` described below. Class description: Keeps track of queue configuration details for a single project. Method signatures and docstrings: - def __init__(self, zk_client, project_id): Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string s...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class ProjectQueueManager: """Keeps track of queue configuration details for a single project.""" def __init__(self, zk_client, project_id): """Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.""" <|body_0|> def up...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProjectQueueManager: """Keeps track of queue configuration details for a single project.""" def __init__(self, zk_client, project_id): """Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.""" super(ProjectQueueManager, self).__...
the_stack_v2_python_sparse
AppTaskQueue/appscale/taskqueue/queue_manager.py
obino/appscale
train
1
5d1d15bc365c7fbe007055020eac9e62c690077f
[ "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!')", "conte...
<|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...
DataBusServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBusServicer: def Publish(self, request, context): """Declares the intention to write data to a topic, must be called once before any Write.""" <|body_0|> def Subscribe(self, request, context): """Declares the intention to read data from a topic, must be called on...
stack_v2_sparse_classes_10k_train_005909
6,014
no_license
[ { "docstring": "Declares the intention to write data to a topic, must be called once before any Write.", "name": "Publish", "signature": "def Publish(self, request, context)" }, { "docstring": "Declares the intention to read data from a topic, must be called once before any Read.", "name": "...
6
stack_v2_sparse_classes_30k_train_000622
Implement the Python class `DataBusServicer` described below. Class description: Implement the DataBusServicer class. Method signatures and docstrings: - def Publish(self, request, context): Declares the intention to write data to a topic, must be called once before any Write. - def Subscribe(self, request, context):...
Implement the Python class `DataBusServicer` described below. Class description: Implement the DataBusServicer class. Method signatures and docstrings: - def Publish(self, request, context): Declares the intention to write data to a topic, must be called once before any Write. - def Subscribe(self, request, context):...
090b9bd6af1fdf012afc4b7cc19c3c80e4651dba
<|skeleton|> class DataBusServicer: def Publish(self, request, context): """Declares the intention to write data to a topic, must be called once before any Write.""" <|body_0|> def Subscribe(self, request, context): """Declares the intention to read data from a topic, must be called on...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataBusServicer: def Publish(self, request, context): """Declares the intention to write data to a topic, must be called once before any Write.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method no...
the_stack_v2_python_sparse
NativeAPI/Native-API/Tools/DataConversion/python/metamoto/services/data_bus_pb2_grpc.py
Huzefa-Kagalwala/OpenCAV-Metamoto
train
0
5a467c98604adea269491366bc99eb4cdf316c88
[ "for extension_id, extension in sorted(settings_dict.items()):\n try:\n install_time = int(extension.get(u'install_time', u'0'), 10)\n except ValueError as exception:\n logging.warning(u'Extension ID {0:s} is missing timestamp: {1:s}'.format(extension_id, exception))\n continue\n manif...
<|body_start_0|> for extension_id, extension in sorted(settings_dict.items()): try: install_time = int(extension.get(u'install_time', u'0'), 10) except ValueError as exception: logging.warning(u'Extension ID {0:s} is missing timestamp: {1:s}'.format(extens...
Parses Chrome Preferences files.
ChromePreferencesParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromePreferencesParser: """Parses Chrome Preferences files.""" def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): """Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser medi...
stack_v2_sparse_classes_10k_train_005910
4,285
permissive
[ { "docstring": "Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser mediator object (instance of ParserMediator).", "name": "_ExtractExtensionInstallEvents", "signature": "def _ExtractExtensionInstallEvents(self, sett...
2
stack_v2_sparse_classes_30k_train_002801
Implement the Python class `ChromePreferencesParser` described below. Class description: Parses Chrome Preferences files. Method signatures and docstrings: - def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): Extract extension installation events. Args: settings_dict: A dictionary of settings d...
Implement the Python class `ChromePreferencesParser` described below. Class description: Parses Chrome Preferences files. Method signatures and docstrings: - def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): Extract extension installation events. Args: settings_dict: A dictionary of settings d...
0ee446ebf03d17c515f76a666bd3795e91a2dd17
<|skeleton|> class ChromePreferencesParser: """Parses Chrome Preferences files.""" def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): """Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser medi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChromePreferencesParser: """Parses Chrome Preferences files.""" def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): """Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser mediator object (...
the_stack_v2_python_sparse
plaso/parsers/chrome_preferences.py
aarontp/plaso
train
1
059f6039c91304e330752a684b56e9cd88eeaebf
[ "super().__init__(kernel_size, erosion_iters=0)\nself.prob_threshold = prob_threshold\nself.__erosion_iters = erosion_iters", "filter_mask = prob_filter(mask=mask, prob_threshold=self.prob_threshold)\ntrimap = super(TrimapGenerator, self).__call__(original_image, filter_mask)\nnew_trimap = prob_as_unknown_area(tr...
<|body_start_0|> super().__init__(kernel_size, erosion_iters=0) self.prob_threshold = prob_threshold self.__erosion_iters = erosion_iters <|end_body_0|> <|body_start_1|> filter_mask = prob_filter(mask=mask, prob_threshold=self.prob_threshold) trimap = super(TrimapGenerator, self...
TrimapGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrimapGenerator: def __init__(self, prob_threshold: int=231, kernel_size: int=30, erosion_iters: int=5): """Initialize a TrimapGenerator instance Args: prob_threshold: Probability threshold at which the prob_filter and prob_as_unknown_area operations will be applied kernel_size: The size...
stack_v2_sparse_classes_10k_train_005911
1,955
permissive
[ { "docstring": "Initialize a TrimapGenerator instance Args: prob_threshold: Probability threshold at which the prob_filter and prob_as_unknown_area operations will be applied kernel_size: The size of the offset from the object mask in pixels when an unknown area is detected in the trimap erosion_iters: The numb...
2
stack_v2_sparse_classes_30k_train_005518
Implement the Python class `TrimapGenerator` described below. Class description: Implement the TrimapGenerator class. Method signatures and docstrings: - def __init__(self, prob_threshold: int=231, kernel_size: int=30, erosion_iters: int=5): Initialize a TrimapGenerator instance Args: prob_threshold: Probability thre...
Implement the Python class `TrimapGenerator` described below. Class description: Implement the TrimapGenerator class. Method signatures and docstrings: - def __init__(self, prob_threshold: int=231, kernel_size: int=30, erosion_iters: int=5): Initialize a TrimapGenerator instance Args: prob_threshold: Probability thre...
2935e4655d2c0260195e22ac08af6c43b5969fdd
<|skeleton|> class TrimapGenerator: def __init__(self, prob_threshold: int=231, kernel_size: int=30, erosion_iters: int=5): """Initialize a TrimapGenerator instance Args: prob_threshold: Probability threshold at which the prob_filter and prob_as_unknown_area operations will be applied kernel_size: The size...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TrimapGenerator: def __init__(self, prob_threshold: int=231, kernel_size: int=30, erosion_iters: int=5): """Initialize a TrimapGenerator instance Args: prob_threshold: Probability threshold at which the prob_filter and prob_as_unknown_area operations will be applied kernel_size: The size of the offset...
the_stack_v2_python_sparse
carvekit/trimap/generator.py
OPHoperHPO/image-background-remove-tool
train
1,029
e25fab7c14a8ec487c117e48e4a7c55e5b285c36
[ "inSpec = super(FastFourierTransform, cls).getInputSpecification()\ninSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True))\nreturn inSpec", "super().__init__()\nself.dynamic = True\nself.targets = None\nself.indices = None", "super()._handleInput(paramIn...
<|body_start_0|> inSpec = super(FastFourierTransform, cls).getInputSpecification() inSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True)) return inSpec <|end_body_0|> <|body_start_1|> super().__init__() self.dynamic = Tru...
Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target
FastFourierTransform
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastFourierTransform: """Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the ...
stack_v2_sparse_classes_10k_train_005912
6,142
permissive
[ { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls.", "name": "getInputSpecification", "signatur...
6
null
Implement the Python class `FastFourierTransform` described below. Class description: Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class tha...
Implement the Python class `FastFourierTransform` described below. Class description: Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class tha...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class FastFourierTransform: """Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FastFourierTransform: """Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for whi...
the_stack_v2_python_sparse
ravenframework/Models/PostProcessors/FastFourierTransform.py
idaholab/raven
train
201
bfda53fbb253e99a8aa1086af9e69c1c83720e8e
[ "def traverse_longest(row, col, prev_num):\n if not (0 <= row < m and 0 <= col < n):\n return 0\n current_num = matrix[row][col]\n if current_num <= prev_num:\n return 0\n up = traverse_longest(row - 1, col, current_num)\n down = traverse_longest(row + 1, col, current_num)\n left = t...
<|body_start_0|> def traverse_longest(row, col, prev_num): if not (0 <= row < m and 0 <= col < n): return 0 current_num = matrix[row][col] if current_num <= prev_num: return 0 up = traverse_longest(row - 1, col, current_num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" <|body_0|> def longestIncreasingPath(self, matrix: List[List[int]]) -> int: """memoization""" <|body_1|> <|end_skeleton|> <|body_start_0|> def traverse_longest(row,...
stack_v2_sparse_classes_10k_train_005913
1,958
no_license
[ { "docstring": "DFS", "name": "longestIncreasingPath", "signature": "def longestIncreasingPath(self, matrix: list[list[int]]) -> int" }, { "docstring": "memoization", "name": "longestIncreasingPath", "signature": "def longestIncreasingPath(self, matrix: List[List[int]]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix: list[list[int]]) -> int: DFS - def longestIncreasingPath(self, matrix: List[List[int]]) -> int: memoization
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix: list[list[int]]) -> int: DFS - def longestIncreasingPath(self, matrix: List[List[int]]) -> int: memoization <|skeleton|> class Solution: ...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" <|body_0|> def longestIncreasingPath(self, matrix: List[List[int]]) -> int: """memoization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" def traverse_longest(row, col, prev_num): if not (0 <= row < m and 0 <= col < n): return 0 current_num = matrix[row][col] if current_num <= prev_num: ...
the_stack_v2_python_sparse
Leetcode/329. Longest Increasing Path in a Matrix.py
brlala/Educative-Grokking-Coding-Exercise
train
3
a5428b1a799611dac61e81dbc7ee2f8a16a80f57
[ "if str2bool(value):\n return queryset.filter(allocated__gte=F('quantity'))\nelse:\n return queryset.filter(allocated__lt=F('quantity'))", "flt = Q(quantity__lte=F('total_available_stock') + F('allocated'))\nif str2bool(value):\n return queryset.filter(flt)\nelse:\n return queryset.exclude(flt)" ]
<|body_start_0|> if str2bool(value): return queryset.filter(allocated__gte=F('quantity')) else: return queryset.filter(allocated__lt=F('quantity')) <|end_body_0|> <|body_start_1|> flt = Q(quantity__lte=F('total_available_stock') + F('allocated')) if str2bool(valu...
Custom filterset for the BuildLine API endpoint.
BuildLineFilter
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildLineFilter: """Custom filterset for the BuildLine API endpoint.""" def filter_allocated(self, queryset, name, value): """Filter by whether each BuildLine is fully allocated""" <|body_0|> def filter_available(self, queryset, name, value): """Filter by whether...
stack_v2_sparse_classes_10k_train_005914
20,912
permissive
[ { "docstring": "Filter by whether each BuildLine is fully allocated", "name": "filter_allocated", "signature": "def filter_allocated(self, queryset, name, value)" }, { "docstring": "Filter by whether there is sufficient stock available for each BuildLine: To determine this, we need to know: - Th...
2
null
Implement the Python class `BuildLineFilter` described below. Class description: Custom filterset for the BuildLine API endpoint. Method signatures and docstrings: - def filter_allocated(self, queryset, name, value): Filter by whether each BuildLine is fully allocated - def filter_available(self, queryset, name, valu...
Implement the Python class `BuildLineFilter` described below. Class description: Custom filterset for the BuildLine API endpoint. Method signatures and docstrings: - def filter_allocated(self, queryset, name, value): Filter by whether each BuildLine is fully allocated - def filter_available(self, queryset, name, valu...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class BuildLineFilter: """Custom filterset for the BuildLine API endpoint.""" def filter_allocated(self, queryset, name, value): """Filter by whether each BuildLine is fully allocated""" <|body_0|> def filter_available(self, queryset, name, value): """Filter by whether...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BuildLineFilter: """Custom filterset for the BuildLine API endpoint.""" def filter_allocated(self, queryset, name, value): """Filter by whether each BuildLine is fully allocated""" if str2bool(value): return queryset.filter(allocated__gte=F('quantity')) else: ...
the_stack_v2_python_sparse
InvenTree/build/api.py
inventree/InvenTree
train
3,077
062cb0a03e9e0d28a433e76ce216ab3434960fbf
[ "if n == 1:\n return x\nif n == 0:\n return 1\nflag = 1 if n > 0 else -1\nn = abs(n)\nresult = x\ni = 1\nwhile 2 * i <= n:\n result *= result\n i *= 2\nif i < n:\n result = result * self.myPow(x, n - i)\nreturn result if flag == 1 else 1 / result", "if x == 0:\n return 0\nif n == 0:\n return ...
<|body_start_0|> if n == 1: return x if n == 0: return 1 flag = 1 if n > 0 else -1 n = abs(n) result = x i = 1 while 2 * i <= n: result *= result i *= 2 if i < n: result = result * self.myPow(x, n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_0|> def myPow1(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 1: return x ...
stack_v2_sparse_classes_10k_train_005915
1,123
no_license
[ { "docstring": ":type x: float :type n: int :rtype: float", "name": "myPow", "signature": "def myPow(self, x, n)" }, { "docstring": ":type x: float :type n: int :rtype: float", "name": "myPow1", "signature": "def myPow1(self, x, n)" } ]
2
stack_v2_sparse_classes_30k_train_006814
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow(self, x, n): :type x: float :type n: int :rtype: float - def myPow1(self, x, n): :type x: float :type n: int :rtype: float
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow(self, x, n): :type x: float :type n: int :rtype: float - def myPow1(self, x, n): :type x: float :type n: int :rtype: float <|skeleton|> class Solution: def myPow(...
707829268535a80cfe0ffa1dc0623520c3fcbecf
<|skeleton|> class Solution: def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_0|> def myPow1(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" if n == 1: return x if n == 0: return 1 flag = 1 if n > 0 else -1 n = abs(n) result = x i = 1 while 2 * i <= n: result *= result ...
the_stack_v2_python_sparse
leetcode/1-50/_50_my_pow.py
blackwings001/algorithm
train
0
3bfa569bd9e828d08fb8a64bb2baf36d19cdd4c2
[ "def isPalindrome(s):\n return s == s[::-1]\nmemo = {}\n\ndef helper(s):\n if not s:\n return [[]]\n if s in memo:\n return memo[s]\n res = []\n for i in range(len(s)):\n if isPalindrome(s[:i + 1]):\n cur = [s[:i + 1]]\n pars = helper(s[i + 1:])\n ...
<|body_start_0|> def isPalindrome(s): return s == s[::-1] memo = {} def helper(s): if not s: return [[]] if s in memo: return memo[s] res = [] for i in range(len(s)): if isPalindrome(s[:i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def partitionDP(self, s): """:type s: str :rtype: List[List[str]]""" <|body_0|> def partition(self, s): """:type s: str :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def isPalindrome(s): return s == s[...
stack_v2_sparse_classes_10k_train_005916
2,078
no_license
[ { "docstring": ":type s: str :rtype: List[List[str]]", "name": "partitionDP", "signature": "def partitionDP(self, s)" }, { "docstring": ":type s: str :rtype: List[List[str]]", "name": "partition", "signature": "def partition(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partitionDP(self, s): :type s: str :rtype: List[List[str]] - def partition(self, s): :type s: str :rtype: List[List[str]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partitionDP(self, s): :type s: str :rtype: List[List[str]] - def partition(self, s): :type s: str :rtype: List[List[str]] <|skeleton|> class Solution: def partitionDP(s...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def partitionDP(self, s): """:type s: str :rtype: List[List[str]]""" <|body_0|> def partition(self, s): """:type s: str :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def partitionDP(self, s): """:type s: str :rtype: List[List[str]]""" def isPalindrome(s): return s == s[::-1] memo = {} def helper(s): if not s: return [[]] if s in memo: return memo[s] r...
the_stack_v2_python_sparse
P/PalindromePartitioning.py
bssrdf/pyleet
train
2
f5c5a18915ab0e0258610c43e7a7109d16e7bf9a
[ "Parametre.__init__(self, 'boire', 'drink')\nself.tronquer = True\nself.schema = '<nom_familier>'\nself.aide_courte = 'demande à un familier de boire'\nself.aide_longue = \"Cette commande demande au familier dont le nom est précisé en paramètre de boire dans la salle où vous vous trouvez. Les familiers peuvent boir...
<|body_start_0|> Parametre.__init__(self, 'boire', 'drink') self.tronquer = True self.schema = '<nom_familier>' self.aide_courte = 'demande à un familier de boire' self.aide_longue = "Cette commande demande au familier dont le nom est précisé en paramètre de boire dans la salle o...
Commande 'familier boire'.
PrmBoire
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmBoire: """Commande 'familier boire'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__...
stack_v2_sparse_classes_10k_train_005917
3,357
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmBoire` described below. Class description: Commande 'familier boire'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmBoire` described below. Class description: Commande 'familier boire'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmBoire: """Commande 'familier b...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmBoire: """Commande 'familier boire'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrmBoire: """Commande 'familier boire'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'boire', 'drink') self.tronquer = True self.schema = '<nom_familier>' self.aide_courte = 'demande à un familier de boire' self.aide_longu...
the_stack_v2_python_sparse
src/secondaires/familier/commandes/familier/boire.py
vincent-lg/tsunami
train
5
c0568e744e921152adc81bb20b5c56296d1e42d8
[ "if root is None:\n return True\nreturn self.isSameTree(root.left, root.right)", "if left is None and right is None:\n return True\nif left is not None and right is None or (left is None and right is not None):\n return False\nif left.val != right.val:\n return False\nelse:\n return self.isSameTree...
<|body_start_0|> if root is None: return True return self.isSameTree(root.left, root.right) <|end_body_0|> <|body_start_1|> if left is None and right is None: return True if left is not None and right is None or (left is None and right is not None): r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, left, right): """rType: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: return True return self....
stack_v2_sparse_classes_10k_train_005918
978
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isSymmetric", "signature": "def isSymmetric(self, root)" }, { "docstring": "rType: bool", "name": "isSameTree", "signature": "def isSameTree(self, left, right)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: bool - def isSameTree(self, left, right): rType: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: bool - def isSameTree(self, left, right): rType: bool <|skeleton|> class Solution: def isSymmetric(self, root): ...
0821af55eca60084b503b5f751301048c55e4381
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isSameTree(self, left, right): """rType: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: bool""" if root is None: return True return self.isSameTree(root.left, root.right) def isSameTree(self, left, right): """rType: bool""" if left is None and right is None: ...
the_stack_v2_python_sparse
Easy/LC101SymmetricTree_S2.py
shuowenwei/LeetCodePython
train
2
85e7427e530ede4a43da2a2ee54dd9a962d3faef
[ "if await self.check_user_guild(guild_id, user.id):\n return\nasync with aiosqlite.connect(self.resolved_db_path) as db:\n if not await self.check_global_user(user.id):\n await db.execute('INSERT INTO Users (id, name) VALUES (?, ?)', (user.id, user.name))\n await db.execute('INSERT INTO Users_Guilds...
<|body_start_0|> if await self.check_user_guild(guild_id, user.id): return async with aiosqlite.connect(self.resolved_db_path) as db: if not await self.check_global_user(user.id): await db.execute('INSERT INTO Users (id, name) VALUES (?, ?)', (user.id, user.name))...
UserRepository
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRepository: async def add_user(self, user: discord.Member, guild_id: int) -> None: """Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)""" <|body_0|> async def check_global_user(self, user_id: int) -...
stack_v2_sparse_classes_10k_train_005919
1,912
permissive
[ { "docstring": "Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)", "name": "add_user", "signature": "async def add_user(self, user: discord.Member, guild_id: int) -> None" }, { "docstring": "Checks if the user is in the glo...
3
stack_v2_sparse_classes_30k_train_004388
Implement the Python class `UserRepository` described below. Class description: Implement the UserRepository class. Method signatures and docstrings: - async def add_user(self, user: discord.Member, guild_id: int) -> None: Adds a User to the global users table and/or to the guild specific user tables Args: user (disc...
Implement the Python class `UserRepository` described below. Class description: Implement the UserRepository class. Method signatures and docstrings: - async def add_user(self, user: discord.Member, guild_id: int) -> None: Adds a User to the global users table and/or to the guild specific user tables Args: user (disc...
2f8b45f06abb510029f3461ab5e39535a5eb3385
<|skeleton|> class UserRepository: async def add_user(self, user: discord.Member, guild_id: int) -> None: """Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)""" <|body_0|> async def check_global_user(self, user_id: int) -...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserRepository: async def add_user(self, user: discord.Member, guild_id: int) -> None: """Adds a User to the global users table and/or to the guild specific user tables Args: user (discord.Member) guild_id (int)""" if await self.check_user_guild(guild_id, user.id): return a...
the_stack_v2_python_sparse
bot/data/user_repository.py
new-zelind/ClemBot
train
1
e9b8e24fe6ad82416d65ccf6a39742bf7257fbeb
[ "if base == tgt:\n a = tmp[:]\n lst.append(a)\n return\nfor i in xrange(depth, len(ref)):\n if base + ref[i] <= tgt:\n tmp.append(ref[i])\n self.CS(base + ref[i], tgt, lst, ref, tmp, i)\n tmp.pop()", "candidates.sort()\nres, tmp = ([], [])\nself.CS(0, target, res, candidates, tmp,...
<|body_start_0|> if base == tgt: a = tmp[:] lst.append(a) return for i in xrange(depth, len(ref)): if base + ref[i] <= tgt: tmp.append(ref[i]) self.CS(base + ref[i], tgt, lst, ref, tmp, i) tmp.pop() <|end_bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def CS(self, base, tgt, lst, ref, tmp, depth): """base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int...
stack_v2_sparse_classes_10k_train_005920
3,337
no_license
[ { "docstring": "base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数", "name": "CS", "signature": "def CS(self, base, tgt, lst, ref, tmp, depth)" }, { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[in...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CS(self, base, tgt, lst, ref, tmp, depth): base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数 - def combina...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CS(self, base, tgt, lst, ref, tmp, depth): base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数 - def combina...
507ed2efeff7818ca9cf53a8ee7fb80d3c530d67
<|skeleton|> class Solution: def CS(self, base, tgt, lst, ref, tmp, depth): """base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def CS(self, base, tgt, lst, ref, tmp, depth): """base: value already calculated tgt: target number lst: result List ref: candidates List tmp: one answer depth: 到了第几个数""" if base == tgt: a = tmp[:] lst.append(a) return for i in xrange(depth...
the_stack_v2_python_sparse
Leetcode/Backtracking/#39-Combination Sum/main.py
qizongjun/Algorithms-1
train
0
dab0dea68b9be9f10c1eab6194d1621fde193094
[ "if not args_lateral:\n args_lateral = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}\nif not args_longitudinal:\n args_longitudinal = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}\nself._lon_controller = PIDLongitudinalController(**args_longitudinal)\nself._lat_controller = PIDLateralController(**args_lateral)", "throttle = ...
<|body_start_0|> if not args_lateral: args_lateral = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0} if not args_longitudinal: args_longitudinal = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0} self._lon_controller = PIDLongitudinalController(**args_longitudinal) self._lat_controller ...
VehiclePIDController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VehiclePIDController: def __init__(self, args_lateral=None, args_longitudinal=None): """:param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitu...
stack_v2_sparse_classes_10k_train_005921
6,840
no_license
[ { "docstring": ":param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitudinal: dictionary of arguments to set the longitudinal PID controller using the following semant...
2
stack_v2_sparse_classes_30k_train_005987
Implement the Python class `VehiclePIDController` described below. Class description: Implement the VehiclePIDController class. Method signatures and docstrings: - def __init__(self, args_lateral=None, args_longitudinal=None): :param args_lateral: dictionary of arguments to set the lateral PID controller using the fo...
Implement the Python class `VehiclePIDController` described below. Class description: Implement the VehiclePIDController class. Method signatures and docstrings: - def __init__(self, args_lateral=None, args_longitudinal=None): :param args_lateral: dictionary of arguments to set the lateral PID controller using the fo...
0f5cd710a6fff1c19795662f8032cb9e22575bd7
<|skeleton|> class VehiclePIDController: def __init__(self, args_lateral=None, args_longitudinal=None): """:param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VehiclePIDController: def __init__(self, args_lateral=None, args_longitudinal=None): """:param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitudinal: diction...
the_stack_v2_python_sparse
planning/trajectory_planner/trajectory_planner/controller.py
feiyuxiaoThu/IITS
train
0
3de7e65d8aff5eeabe000b15a93114d834d21ec2
[ "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!')", "conte...
<|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...
The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and is only used as a communication medium. In order to build an ...
ContentAddressableStorageServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentAddressableStorageServicer: """The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and ...
stack_v2_sparse_classes_10k_train_005922
24,490
no_license
[ { "docstring": "Determine if blobs are present in the CAS. Clients can use this API before uploading blobs to determine which ones are already present in the CAS and do not need to be uploaded again. There are no method-specific errors.", "name": "FindMissingBlobs", "signature": "def FindMissingBlobs(se...
3
stack_v2_sparse_classes_30k_train_003378
Implement the Python class `ContentAddressableStorageServicer` described below. Class description: The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS ...
Implement the Python class `ContentAddressableStorageServicer` described below. Class description: The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS ...
d7424d21aa0dc121acc4d64b427ba365a3581a20
<|skeleton|> class ContentAddressableStorageServicer: """The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContentAddressableStorageServicer: """The CAS (content-addressable storage) is used to store the inputs to and outputs from the execution service. Each piece of content is addressed by the digest of its binary data. Most of the binary data stored in the CAS is opaque to the execution engine, and is only used ...
the_stack_v2_python_sparse
google/devtools/remoteexecution/v1test/remote_execution_pb2_grpc.py
msachtler/bazel-event-protocol-parser
train
1
a707f7bc33a7190670796ae04b2a01a3c4be5472
[ "cur_sum = 0\nways = 0\nif len(nums) == 0:\n return ways\nways = self.dfs(nums, cur_sum, S)\nreturn ways", "ways = 0\nnums_length = len(nums)\nif nums_length == 0:\n if cur_sum == S:\n return 1\n return 0\nmultiple = [1, -1]\nfor value in multiple:\n new_num = nums[nums_length - 1]\n new_num...
<|body_start_0|> cur_sum = 0 ways = 0 if len(nums) == 0: return ways ways = self.dfs(nums, cur_sum, S) return ways <|end_body_0|> <|body_start_1|> ways = 0 nums_length = len(nums) if nums_length == 0: if cur_sum == S: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays(self, nums, S): """find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int""" <|body_0|> def dfs(self, nums, cur_sum, S): """depth first search the target ...
stack_v2_sparse_classes_10k_train_005923
2,744
no_license
[ { "docstring": "find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums, S)" }, { "docstring": "depth first search the target num :param n...
2
stack_v2_sparse_classes_30k_train_002586
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums, S): find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums, S): find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int - de...
37710292b2cfc6060098363c8d5f8881a4c22b26
<|skeleton|> class Solution: def findTargetSumWays(self, nums, S): """find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int""" <|body_0|> def dfs(self, nums, cur_sum, S): """depth first search the target ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays(self, nums, S): """find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int""" cur_sum = 0 ways = 0 if len(nums) == 0: return ways ways = self.dfs(...
the_stack_v2_python_sparse
python/pyleetcode/queue_and_stack/targetSum.py
yudongnan23/algorithmRoad
train
0
9591dbcf659188b0ac6a3d826ec5202e6382be19
[ "super().__init__()\nself.nr_points = 5500\nself.acq_rate = 'FAcq'\nself.timeout_bpms = 10\nself.ch_kick = 5\nself.cv_kick = 5\nself.rf_kick = 5\nself.delay_corrs = 0.05\nself.delay_rf = 0.2\nself.exc_duration = 5\nself.exc_rf = 4\nfreqs = self.find_primes(16, start=120)\nself.ch_freqs = freqs[1::2][:6]\nself.cv_fr...
<|body_start_0|> super().__init__() self.nr_points = 5500 self.acq_rate = 'FAcq' self.timeout_bpms = 10 self.ch_kick = 5 self.cv_kick = 5 self.rf_kick = 5 self.delay_corrs = 0.05 self.delay_rf = 0.2 self.exc_duration = 5 self.exc_rf...
.
ACORMParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ACORMParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> def find_primes(n_primes, start=3): """.""" <|body_2|> <|end_skeleton|> <|body_start_0|> super().__init__() self.nr_po...
stack_v2_sparse_classes_10k_train_005924
38,752
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ".", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": ".", "name": "find_primes", "signature": "def find_primes(n_primes, start=3)" } ]
3
stack_v2_sparse_classes_30k_train_001883
Implement the Python class `ACORMParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): . - def find_primes(n_primes, start=3): .
Implement the Python class `ACORMParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): . - def find_primes(n_primes, start=3): . <|skeleton|> class ACORMParams: """.""" def __init__(self): """.""" <|body_0|> def __st...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class ACORMParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> def find_primes(n_primes, start=3): """.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ACORMParams: """.""" def __init__(self): """.""" super().__init__() self.nr_points = 5500 self.acq_rate = 'FAcq' self.timeout_bpms = 10 self.ch_kick = 5 self.cv_kick = 5 self.rf_kick = 5 self.delay_corrs = 0.05 self.delay_rf ...
the_stack_v2_python_sparse
apsuite/commisslib/meas_ac_orm.py
lnls-fac/apsuite
train
1
0258983c9b059ccec072195ce6e1f212887933f0
[ "if context is None:\n context = {}\nsuper(building_fill_insurance, self).view_init(cr, uid, fields_list, context=context)\nif len(context.get('active_ids', [])) > 1:\n raise osv.except_osv(_('Error!'), _('You cannot perform this operation on more than one building.'))\nif context.get('active_id', False):\n ...
<|body_start_0|> if context is None: context = {} super(building_fill_insurance, self).view_init(cr, uid, fields_list, context=context) if len(context.get('active_ids', [])) > 1: raise osv.except_osv(_('Error!'), _('You cannot perform this operation on more than one build...
building_fill_insurance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class building_fill_insurance: def view_init(self, cr, uid, fields_list, context=None): """Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @...
stack_v2_sparse_classes_10k_train_005925
4,027
no_license
[ { "docstring": "Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view with new columns.", "name": "view_init", "signature": "def v...
2
null
Implement the Python class `building_fill_insurance` described below. Class description: Implement the building_fill_insurance class. Method signatures and docstrings: - def view_init(self, cr, uid, fields_list, context=None): Creates view dynamically and adding fields at runtime. @param self: The object pointer. @pa...
Implement the Python class `building_fill_insurance` described below. Class description: Implement the building_fill_insurance class. Method signatures and docstrings: - def view_init(self, cr, uid, fields_list, context=None): Creates view dynamically and adding fields at runtime. @param self: The object pointer. @pa...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class building_fill_insurance: def view_init(self, cr, uid, fields_list, context=None): """Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class building_fill_insurance: def view_init(self, cr, uid, fields_list, context=None): """Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New ar...
the_stack_v2_python_sparse
v_7/GDS/shamil_v3/building_management_6.1/wizard/building_fill_insurance.py
musabahmed/baba
train
0
2d9b0e4ac0596a74cd5b7d4f4f3be33a071d72ad
[ "fieldsets = super().get_fieldsets(request, obj)\nfieldsets += ((_('Extra info'), {'fields': ['created', 'modified']}),)\nreturn fieldsets", "readonly_fields = super().get_readonly_fields(request, obj)\nreadonly_fields = readonly_fields + ('created', 'modified')\nif not self.create_only_fields or not obj:\n re...
<|body_start_0|> fieldsets = super().get_fieldsets(request, obj) fieldsets += ((_('Extra info'), {'fields': ['created', 'modified']}),) return fieldsets <|end_body_0|> <|body_start_1|> readonly_fields = super().get_readonly_fields(request, obj) readonly_fields = readonly_fields ...
Base admin representation.
BaseAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAdmin: """Base admin representation.""" def get_fieldsets(self, request, obj=None): """Add created and modified to fieldsets.""" <|body_0|> def get_readonly_fields(self, request, obj=None): """Add created and modified to readonly_fields. Also if create_only_f...
stack_v2_sparse_classes_10k_train_005926
1,885
no_license
[ { "docstring": "Add created and modified to fieldsets.", "name": "get_fieldsets", "signature": "def get_fieldsets(self, request, obj=None)" }, { "docstring": "Add created and modified to readonly_fields. Also if create_only_fields were specified add them to readonly_fields, if user is working on...
2
stack_v2_sparse_classes_30k_train_005545
Implement the Python class `BaseAdmin` described below. Class description: Base admin representation. Method signatures and docstrings: - def get_fieldsets(self, request, obj=None): Add created and modified to fieldsets. - def get_readonly_fields(self, request, obj=None): Add created and modified to readonly_fields. ...
Implement the Python class `BaseAdmin` described below. Class description: Base admin representation. Method signatures and docstrings: - def get_fieldsets(self, request, obj=None): Add created and modified to fieldsets. - def get_readonly_fields(self, request, obj=None): Add created and modified to readonly_fields. ...
0879ade24685b628624dce06698f8a0afd042000
<|skeleton|> class BaseAdmin: """Base admin representation.""" def get_fieldsets(self, request, obj=None): """Add created and modified to fieldsets.""" <|body_0|> def get_readonly_fields(self, request, obj=None): """Add created and modified to readonly_fields. Also if create_only_f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseAdmin: """Base admin representation.""" def get_fieldsets(self, request, obj=None): """Add created and modified to fieldsets.""" fieldsets = super().get_fieldsets(request, obj) fieldsets += ((_('Extra info'), {'fields': ['created', 'modified']}),) return fieldsets ...
the_stack_v2_python_sparse
project_template/apps/core/admin.py
rhanmar/oi_projects_summer_2021
train
0
c09dd5c06160b9e5c00ea28e0610d0f0268def4d
[ "if level is None:\n self.logLevel = logging.INFO\nelse:\n pass", "logger = logging.getLogger(_name)\nlogger.setLevel(self.logLevel)\nhandler = logging.FileHandler('output_files/log_examp.log')\nhandler.setLevel(self.logLevel)\nformatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(messag...
<|body_start_0|> if level is None: self.logLevel = logging.INFO else: pass <|end_body_0|> <|body_start_1|> logger = logging.getLogger(_name) logger.setLevel(self.logLevel) handler = logging.FileHandler('output_files/log_examp.log') handler.setLeve...
DOCSTRING.
CfgLogger
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CfgLogger: """DOCSTRING.""" def __init__(self, level=None): """DOCSTRING.""" <|body_0|> def create_logger(self, _name): """DOCSTRING.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if level is None: self.logLevel = logging.INFO ...
stack_v2_sparse_classes_10k_train_005927
836
no_license
[ { "docstring": "DOCSTRING.", "name": "__init__", "signature": "def __init__(self, level=None)" }, { "docstring": "DOCSTRING.", "name": "create_logger", "signature": "def create_logger(self, _name)" } ]
2
stack_v2_sparse_classes_30k_train_001805
Implement the Python class `CfgLogger` described below. Class description: DOCSTRING. Method signatures and docstrings: - def __init__(self, level=None): DOCSTRING. - def create_logger(self, _name): DOCSTRING.
Implement the Python class `CfgLogger` described below. Class description: DOCSTRING. Method signatures and docstrings: - def __init__(self, level=None): DOCSTRING. - def create_logger(self, _name): DOCSTRING. <|skeleton|> class CfgLogger: """DOCSTRING.""" def __init__(self, level=None): """DOCSTRIN...
4c4b8fb381c8d98980e119f7f73f393034393468
<|skeleton|> class CfgLogger: """DOCSTRING.""" def __init__(self, level=None): """DOCSTRING.""" <|body_0|> def create_logger(self, _name): """DOCSTRING.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CfgLogger: """DOCSTRING.""" def __init__(self, level=None): """DOCSTRING.""" if level is None: self.logLevel = logging.INFO else: pass def create_logger(self, _name): """DOCSTRING.""" logger = logging.getLogger(_name) logger.set...
the_stack_v2_python_sparse
Python_Scripts/config/log.py
jommysmoth/ECE_Music
train
0
e997c1f2b04618bc041ea64344df7098fce80640
[ "self.name = name\nself.args = []\nfor arg in args:\n self.args.append(arg)", "s = self.name\nfor arg in self.args:\n s += ' '\n s += str(arg)\nreturn s", "s = self.name.encode()\nfor arg in self.args:\n s += ESCAPE_CHARACTER + arg.encode()\ns += b'\\n'\ntry:\n verbose('Internal: Sending [', s.de...
<|body_start_0|> self.name = name self.args = [] for arg in args: self.args.append(arg) <|end_body_0|> <|body_start_1|> s = self.name for arg in self.args: s += ' ' s += str(arg) return s <|end_body_1|> <|body_start_2|> s = se...
Message
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: def __init__(self, name, *args): """Instantiates a new Message. :param name: The name of the command. :param args: The parameters of the command.""" <|body_0|> def __str__(self) -> str: """Converts this object to a String object. :return: This object as a St...
stack_v2_sparse_classes_10k_train_005928
1,167
permissive
[ { "docstring": "Instantiates a new Message. :param name: The name of the command. :param args: The parameters of the command.", "name": "__init__", "signature": "def __init__(self, name, *args)" }, { "docstring": "Converts this object to a String object. :return: This object as a String.", "...
3
stack_v2_sparse_classes_30k_train_006279
Implement the Python class `Message` described below. Class description: Implement the Message class. Method signatures and docstrings: - def __init__(self, name, *args): Instantiates a new Message. :param name: The name of the command. :param args: The parameters of the command. - def __str__(self) -> str: Converts ...
Implement the Python class `Message` described below. Class description: Implement the Message class. Method signatures and docstrings: - def __init__(self, name, *args): Instantiates a new Message. :param name: The name of the command. :param args: The parameters of the command. - def __str__(self) -> str: Converts ...
57660ec8ed3b431779524bd40540acf1cb212f6f
<|skeleton|> class Message: def __init__(self, name, *args): """Instantiates a new Message. :param name: The name of the command. :param args: The parameters of the command.""" <|body_0|> def __str__(self) -> str: """Converts this object to a String object. :return: This object as a St...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Message: def __init__(self, name, *args): """Instantiates a new Message. :param name: The name of the command. :param args: The parameters of the command.""" self.name = name self.args = [] for arg in args: self.args.append(arg) def __str__(self) -> str: ...
the_stack_v2_python_sparse
server/src/network/message.py
CLOVIS-AI/ccg2lambda-qa-assistant
train
2
740462d93d94264c1f8d97f55cc55c93d0172a6d
[ "self.config = config.setup()\nself.log = logging.getLogger(__name__)\nserver = self.config.get('IMAP', 'server')\nport = int(self.config.get('IMAP', 'port', 143))\nself.user = self.config.get('IMAP', 'user')\npassword = self.config.get('IMAP', 'password')\nself.mailbox_group = self.config.get('IMAP', 'mailbox_grou...
<|body_start_0|> self.config = config.setup() self.log = logging.getLogger(__name__) server = self.config.get('IMAP', 'server') port = int(self.config.get('IMAP', 'port', 143)) self.user = self.config.get('IMAP', 'user') password = self.config.get('IMAP', 'password') ...
Provide CRUD methods to Cyrus IMAP mailboxes
SpokeMbx
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpokeMbx: """Provide CRUD methods to Cyrus IMAP mailboxes""" def __init__(self): """Get config, setup logging and cyrus connection.""" <|body_0|> def _validate_mailbox_name(self, mailbox_name): """Ensure input is a valid email address format.""" <|body_1|...
stack_v2_sparse_classes_10k_train_005929
3,866
permissive
[ { "docstring": "Get config, setup logging and cyrus connection.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Ensure input is a valid email address format.", "name": "_validate_mailbox_name", "signature": "def _validate_mailbox_name(self, mailbox_name)" }, ...
5
stack_v2_sparse_classes_30k_train_003134
Implement the Python class `SpokeMbx` described below. Class description: Provide CRUD methods to Cyrus IMAP mailboxes Method signatures and docstrings: - def __init__(self): Get config, setup logging and cyrus connection. - def _validate_mailbox_name(self, mailbox_name): Ensure input is a valid email address format....
Implement the Python class `SpokeMbx` described below. Class description: Provide CRUD methods to Cyrus IMAP mailboxes Method signatures and docstrings: - def __init__(self): Get config, setup logging and cyrus connection. - def _validate_mailbox_name(self, mailbox_name): Ensure input is a valid email address format....
077d45750643a38b1062a9199800de9c9de900ae
<|skeleton|> class SpokeMbx: """Provide CRUD methods to Cyrus IMAP mailboxes""" def __init__(self): """Get config, setup logging and cyrus connection.""" <|body_0|> def _validate_mailbox_name(self, mailbox_name): """Ensure input is a valid email address format.""" <|body_1|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpokeMbx: """Provide CRUD methods to Cyrus IMAP mailboxes""" def __init__(self): """Get config, setup logging and cyrus connection.""" self.config = config.setup() self.log = logging.getLogger(__name__) server = self.config.get('IMAP', 'server') port = int(self.con...
the_stack_v2_python_sparse
spoke/lib/mbx.py
KrisSaxton/spoke
train
0
0dbd7c11be62197540c652848ca26a367fbb1505
[ "cls.dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), 'temp'))\nos.makedirs(os.path.join(cls.dirname, 'pdep'))\ntest_family = 'R_Recombination'\ncls.rmg = RMG()\nfrom rmgpy.rmg.input import set_global_rmg, pressure_dependence\nset_global_rmg(cls.rmg)\npressure_dependence(method='modified strong col...
<|body_start_0|> cls.dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), 'temp')) os.makedirs(os.path.join(cls.dirname, 'pdep')) test_family = 'R_Recombination' cls.rmg = RMG() from rmgpy.rmg.input import set_global_rmg, pressure_dependence set_global_rmg(cl...
Contains unit tests for CoreEdgeReactionModel.enlarge.
TestEnlarge
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEnlarge: """Contains unit tests for CoreEdgeReactionModel.enlarge.""" def setUpClass(cls): """A method that is run ONCE before all unit tests in this class.""" <|body_0|> def test_enlarge_1_add_nonreactive_species(self): """Test that we can add a nonreactive ...
stack_v2_sparse_classes_10k_train_005930
34,780
permissive
[ { "docstring": "A method that is run ONCE before all unit tests in this class.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Test that we can add a nonreactive species to CERM", "name": "test_enlarge_1_add_nonreactive_species", "signature": "def test_enlar...
6
stack_v2_sparse_classes_30k_train_000553
Implement the Python class `TestEnlarge` described below. Class description: Contains unit tests for CoreEdgeReactionModel.enlarge. Method signatures and docstrings: - def setUpClass(cls): A method that is run ONCE before all unit tests in this class. - def test_enlarge_1_add_nonreactive_species(self): Test that we c...
Implement the Python class `TestEnlarge` described below. Class description: Contains unit tests for CoreEdgeReactionModel.enlarge. Method signatures and docstrings: - def setUpClass(cls): A method that is run ONCE before all unit tests in this class. - def test_enlarge_1_add_nonreactive_species(self): Test that we c...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class TestEnlarge: """Contains unit tests for CoreEdgeReactionModel.enlarge.""" def setUpClass(cls): """A method that is run ONCE before all unit tests in this class.""" <|body_0|> def test_enlarge_1_add_nonreactive_species(self): """Test that we can add a nonreactive ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestEnlarge: """Contains unit tests for CoreEdgeReactionModel.enlarge.""" def setUpClass(cls): """A method that is run ONCE before all unit tests in this class.""" cls.dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), 'temp')) os.makedirs(os.path.join(cls.dirname, ...
the_stack_v2_python_sparse
rmgpy/rmg/modelTest.py
CanePan-cc/CanePanWorkshop
train
2
af00d63970ed50f846ba6bb2be62bc662bc00015
[ "queue = deque()\nqueue.append(root)\nwhile queue:\n size = len(queue)\n self.value = queue[0].val\n for _ in range(size):\n node = queue.popleft()\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\nreturn self.value", "queue ...
<|body_start_0|> queue = deque() queue.append(root) while queue: size = len(queue) self.value = queue[0].val for _ in range(size): node = queue.popleft() if node.left: queue.append(node.left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findBottomLeftValue(self, root: TreeNode) -> int: """BFS""" <|body_0|> def findBottomLeftValue_1(self, root: TreeNode) -> int: """改进版BFS""" <|body_1|> def findBottomLeftValue_2(self, root: TreeNode) -> int: """DFS""" <|body_...
stack_v2_sparse_classes_10k_train_005931
1,622
no_license
[ { "docstring": "BFS", "name": "findBottomLeftValue", "signature": "def findBottomLeftValue(self, root: TreeNode) -> int" }, { "docstring": "改进版BFS", "name": "findBottomLeftValue_1", "signature": "def findBottomLeftValue_1(self, root: TreeNode) -> int" }, { "docstring": "DFS", ...
3
stack_v2_sparse_classes_30k_val_000312
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findBottomLeftValue(self, root: TreeNode) -> int: BFS - def findBottomLeftValue_1(self, root: TreeNode) -> int: 改进版BFS - def findBottomLeftValue_2(self, root: TreeNode) -> in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findBottomLeftValue(self, root: TreeNode) -> int: BFS - def findBottomLeftValue_1(self, root: TreeNode) -> int: 改进版BFS - def findBottomLeftValue_2(self, root: TreeNode) -> in...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def findBottomLeftValue(self, root: TreeNode) -> int: """BFS""" <|body_0|> def findBottomLeftValue_1(self, root: TreeNode) -> int: """改进版BFS""" <|body_1|> def findBottomLeftValue_2(self, root: TreeNode) -> int: """DFS""" <|body_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findBottomLeftValue(self, root: TreeNode) -> int: """BFS""" queue = deque() queue.append(root) while queue: size = len(queue) self.value = queue[0].val for _ in range(size): node = queue.popleft() ...
the_stack_v2_python_sparse
algorithm/leetcode/bfs/13-找树左下角的值.py
lxconfig/UbuntuCode_bak
train
0
3f57ee985d79ce69b0e510aff3a59a90e31c59d9
[ "super(CNN_Text, self).__init__()\nself.args = args\nembed_num = args.embed_num\nembed_dim = args.embed_dim\nclass_num = args.class_num\nchannel_num = args.kernel_num\nkernel_size = args.kernel_sizes\nself.embedding = nn.Embedding(embed_num, embed_dim)\nself.conv = nn.ModuleList([nn.Conv2d(1, channel_num, (K, embed...
<|body_start_0|> super(CNN_Text, self).__init__() self.args = args embed_num = args.embed_num embed_dim = args.embed_dim class_num = args.class_num channel_num = args.kernel_num kernel_size = args.kernel_sizes self.embedding = nn.Embedding(embed_num, embed...
CNN_Text
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNN_Text: def __init__(self, args): """Your code here. Define a text CNN structure. Note that args.kernel_sizes is a list, so you may need to use nn.ModuleList.""" <|body_0|> def forward(self, x): """Your code here. Give the forward pass of the model. With multiple k...
stack_v2_sparse_classes_10k_train_005932
1,450
no_license
[ { "docstring": "Your code here. Define a text CNN structure. Note that args.kernel_sizes is a list, so you may need to use nn.ModuleList.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Your code here. Give the forward pass of the model. With multiple kernel size...
2
stack_v2_sparse_classes_30k_train_000952
Implement the Python class `CNN_Text` described below. Class description: Implement the CNN_Text class. Method signatures and docstrings: - def __init__(self, args): Your code here. Define a text CNN structure. Note that args.kernel_sizes is a list, so you may need to use nn.ModuleList. - def forward(self, x): Your c...
Implement the Python class `CNN_Text` described below. Class description: Implement the CNN_Text class. Method signatures and docstrings: - def __init__(self, args): Your code here. Define a text CNN structure. Note that args.kernel_sizes is a list, so you may need to use nn.ModuleList. - def forward(self, x): Your c...
f1af0599ac8c3c8be4852472838dca775a22aa53
<|skeleton|> class CNN_Text: def __init__(self, args): """Your code here. Define a text CNN structure. Note that args.kernel_sizes is a list, so you may need to use nn.ModuleList.""" <|body_0|> def forward(self, x): """Your code here. Give the forward pass of the model. With multiple k...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CNN_Text: def __init__(self, args): """Your code here. Define a text CNN structure. Note that args.kernel_sizes is a list, so you may need to use nn.ModuleList.""" super(CNN_Text, self).__init__() self.args = args embed_num = args.embed_num embed_dim = args.embed_dim ...
the_stack_v2_python_sparse
homework5/HuaiyuanYing/model.py
Lukeming-tsinghua/pytorch-NLP-guidance
train
12
01aad50b5e7ac76aa13671e1e6209ad65cdcae1f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsFirewallNetworkProfile()", "from .state_management_setting import StateManagementSetting\nfrom .state_management_setting import StateManagementSetting\nfields: Dict[str, Callable[[Any], None]] = {'authorizedApplicationRulesFromG...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WindowsFirewallNetworkProfile() <|end_body_0|> <|body_start_1|> from .state_management_setting import StateManagementSetting from .state_management_setting import StateManagementSetting ...
Windows Firewall Profile Policies.
WindowsFirewallNetworkProfile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsFirewallNetworkProfile: """Windows Firewall Profile Policies.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsFirewallNetworkProfile: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pa...
stack_v2_sparse_classes_10k_train_005933
9,152
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: WindowsFirewallNetworkProfile", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
null
Implement the Python class `WindowsFirewallNetworkProfile` described below. Class description: Windows Firewall Profile Policies. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsFirewallNetworkProfile: Creates a new instance of the appropriate cl...
Implement the Python class `WindowsFirewallNetworkProfile` described below. Class description: Windows Firewall Profile Policies. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsFirewallNetworkProfile: Creates a new instance of the appropriate cl...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WindowsFirewallNetworkProfile: """Windows Firewall Profile Policies.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsFirewallNetworkProfile: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WindowsFirewallNetworkProfile: """Windows Firewall Profile Policies.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsFirewallNetworkProfile: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to u...
the_stack_v2_python_sparse
msgraph/generated/models/windows_firewall_network_profile.py
microsoftgraph/msgraph-sdk-python
train
135
93965f7990b3f3f128d051b99b6e550b136ab733
[ "if not (is_scalar(prior) or isinstance(prior, Beta) or is_any_numeric_map(prior) or is_any_beta_map(prior)):\n raise ValueError('wrong type for prior')\nif not (is_scalar(likelihood) or isinstance(likelihood, Beta) or is_any_numeric_map(likelihood) or is_any_beta_map(likelihood)):\n raise ValueError('wrong t...
<|body_start_0|> if not (is_scalar(prior) or isinstance(prior, Beta) or is_any_numeric_map(prior) or is_any_beta_map(prior)): raise ValueError('wrong type for prior') if not (is_scalar(likelihood) or isinstance(likelihood, Beta) or is_any_numeric_map(likelihood) or is_any_beta_map(likelihood...
Class for testing one or more binary hypotheses using Bayes Rule.
BinaryBayesRule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryBayesRule: """Class for testing one or more binary hypotheses using Bayes Rule.""" def __init__(self, prior: Union[float, Beta, AnyFloatMap, AnyBetaMap], likelihood: Union[float, Beta, AnyFloatMap, AnyBetaMap]): """Create a new Bayes Rule object from: - the prior P(A) - the lik...
stack_v2_sparse_classes_10k_train_005934
2,366
permissive
[ { "docstring": "Create a new Bayes Rule object from: - the prior P(A) - the likelihood P(B|A) - the evidence P(B) :param prior: Single figure or Beta-distributed probability representing the hypothesis. :param likelihood: Series with values of Dirichlet likelihoods.", "name": "__init__", "signature": "d...
2
stack_v2_sparse_classes_30k_val_000129
Implement the Python class `BinaryBayesRule` described below. Class description: Class for testing one or more binary hypotheses using Bayes Rule. Method signatures and docstrings: - def __init__(self, prior: Union[float, Beta, AnyFloatMap, AnyBetaMap], likelihood: Union[float, Beta, AnyFloatMap, AnyBetaMap]): Create...
Implement the Python class `BinaryBayesRule` described below. Class description: Class for testing one or more binary hypotheses using Bayes Rule. Method signatures and docstrings: - def __init__(self, prior: Union[float, Beta, AnyFloatMap, AnyBetaMap], likelihood: Union[float, Beta, AnyFloatMap, AnyBetaMap]): Create...
ff3f5434d3da0d46b127b02cf733699e5a43c904
<|skeleton|> class BinaryBayesRule: """Class for testing one or more binary hypotheses using Bayes Rule.""" def __init__(self, prior: Union[float, Beta, AnyFloatMap, AnyBetaMap], likelihood: Union[float, Beta, AnyFloatMap, AnyBetaMap]): """Create a new Bayes Rule object from: - the prior P(A) - the lik...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BinaryBayesRule: """Class for testing one or more binary hypotheses using Bayes Rule.""" def __init__(self, prior: Union[float, Beta, AnyFloatMap, AnyBetaMap], likelihood: Union[float, Beta, AnyFloatMap, AnyBetaMap]): """Create a new Bayes Rule object from: - the prior P(A) - the likelihood P(B|A...
the_stack_v2_python_sparse
probability/calculations/bayes_rule/binary_bayes_rule.py
vahndi/probability
train
3
8a28e6f1a47ccd01a5138b32bf227f706803b5e4
[ "decorator_name = ''.join(('@', OpenCL.__name__.lower()))\nself.decorator_name = decorator_name\nself.args = args\nself.kwargs = kwargs\nself.scope = CONTEXT.in_pycompss()\nself.core_element = None\nself.core_element_configured = False\nif self.scope:\n check_arguments(MANDATORY_ARGUMENTS, DEPRECATED_ARGUMENTS, ...
<|body_start_0|> decorator_name = ''.join(('@', OpenCL.__name__.lower())) self.decorator_name = decorator_name self.args = args self.kwargs = kwargs self.scope = CONTEXT.in_pycompss() self.core_element = None self.core_element_configured = False if self.sc...
OpenCL decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on opencl task creation.
OpenCL
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenCL: """OpenCL decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on opencl task creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorator. self = its...
stack_v2_sparse_classes_10k_train_005935
5,902
permissive
[ { "docstring": "Store arguments passed to the decorator. self = itself. args = not used. kwargs = dictionary with the given constraints. :param args: Arguments. :param kwargs: Keyword arguments.", "name": "__init__", "signature": "def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None" },...
3
stack_v2_sparse_classes_30k_val_000142
Implement the Python class `OpenCL` described below. Class description: OpenCL decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on opencl task creation. Method signatures and docstrings: - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> ...
Implement the Python class `OpenCL` described below. Class description: OpenCL decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on opencl task creation. Method signatures and docstrings: - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> ...
5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092
<|skeleton|> class OpenCL: """OpenCL decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on opencl task creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorator. self = its...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OpenCL: """OpenCL decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on opencl task creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorator. self = itself. args = n...
the_stack_v2_python_sparse
compss/programming_model/bindings/python/src/pycompss/api/opencl.py
bsc-wdc/compss
train
39
b0590c699b913ada5ada8d0325d30990cf8e32d8
[ "cliente = get_cliente_id(id_cliente)\nif not cliente:\n api.abort(404)\nelse:\n return cliente", "data = request.json\ncliente = update_cliente(id_cliente, data)\nif not cliente:\n api.abort(404)\nelse:\n return cliente", "cliente = delete_cliente(id_cliente)\nif not cliente:\n api.abort(404)\ne...
<|body_start_0|> cliente = get_cliente_id(id_cliente) if not cliente: api.abort(404) else: return cliente <|end_body_0|> <|body_start_1|> data = request.json cliente = update_cliente(id_cliente, data) if not cliente: api.abort(404) ...
Cliente
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cliente: def get(self, id_cliente): """get a cliente given its identifier""" <|body_0|> def put(self, id_cliente): """update a cliente given its identifier""" <|body_1|> def delete(self, id_cliente): """delete a cliente given its identifier""" ...
stack_v2_sparse_classes_10k_train_005936
1,821
no_license
[ { "docstring": "get a cliente given its identifier", "name": "get", "signature": "def get(self, id_cliente)" }, { "docstring": "update a cliente given its identifier", "name": "put", "signature": "def put(self, id_cliente)" }, { "docstring": "delete a cliente given its identifier...
3
stack_v2_sparse_classes_30k_train_003774
Implement the Python class `Cliente` described below. Class description: Implement the Cliente class. Method signatures and docstrings: - def get(self, id_cliente): get a cliente given its identifier - def put(self, id_cliente): update a cliente given its identifier - def delete(self, id_cliente): delete a cliente gi...
Implement the Python class `Cliente` described below. Class description: Implement the Cliente class. Method signatures and docstrings: - def get(self, id_cliente): get a cliente given its identifier - def put(self, id_cliente): update a cliente given its identifier - def delete(self, id_cliente): delete a cliente gi...
e3e6d716102280e73932e5eba65b2ff27eec45e0
<|skeleton|> class Cliente: def get(self, id_cliente): """get a cliente given its identifier""" <|body_0|> def put(self, id_cliente): """update a cliente given its identifier""" <|body_1|> def delete(self, id_cliente): """delete a cliente given its identifier""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cliente: def get(self, id_cliente): """get a cliente given its identifier""" cliente = get_cliente_id(id_cliente) if not cliente: api.abort(404) else: return cliente def put(self, id_cliente): """update a cliente given its identifier""" ...
the_stack_v2_python_sparse
app/main/controller/cliente_controller.py
Team-3-TCS/api-my-store
train
1
5118e334b175e78c1f828bc487961e8d46eba801
[ "LOGGER.debug(f'Copying {self.archive_path} to {self.duplicate_path}')\nshutil.copyfile(self.archive_path, self.duplicate_path)\nLOGGER.debug(f'Copied {self.archive_path} to {self.duplicate_path}')\nwith DataExplorer(self.duplicate_path, allow_edits=True) as data:\n for step in self.preprocessing_steps:\n ...
<|body_start_0|> LOGGER.debug(f'Copying {self.archive_path} to {self.duplicate_path}') shutil.copyfile(self.archive_path, self.duplicate_path) LOGGER.debug(f'Copied {self.archive_path} to {self.duplicate_path}') with DataExplorer(self.duplicate_path, allow_edits=True) as data: ...
Coordinate multiple steps of processing.
ProcessCoordinator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessCoordinator: """Coordinate multiple steps of processing.""" def run_preprocess(self, debug: bool=False) -> None: """Run the pre-processing steps.""" <|body_0|> def run_process(self, debug: bool=False) -> None: """Run the processing steps.""" <|body...
stack_v2_sparse_classes_10k_train_005937
12,852
permissive
[ { "docstring": "Run the pre-processing steps.", "name": "run_preprocess", "signature": "def run_preprocess(self, debug: bool=False) -> None" }, { "docstring": "Run the processing steps.", "name": "run_process", "signature": "def run_process(self, debug: bool=False) -> None" }, { ...
3
stack_v2_sparse_classes_30k_train_005583
Implement the Python class `ProcessCoordinator` described below. Class description: Coordinate multiple steps of processing. Method signatures and docstrings: - def run_preprocess(self, debug: bool=False) -> None: Run the pre-processing steps. - def run_process(self, debug: bool=False) -> None: Run the processing ste...
Implement the Python class `ProcessCoordinator` described below. Class description: Coordinate multiple steps of processing. Method signatures and docstrings: - def run_preprocess(self, debug: bool=False) -> None: Run the pre-processing steps. - def run_process(self, debug: bool=False) -> None: Run the processing ste...
1c2b5b861849ccf76b5ea6aaf0fcbf429aa6bfcf
<|skeleton|> class ProcessCoordinator: """Coordinate multiple steps of processing.""" def run_preprocess(self, debug: bool=False) -> None: """Run the pre-processing steps.""" <|body_0|> def run_process(self, debug: bool=False) -> None: """Run the processing steps.""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProcessCoordinator: """Coordinate multiple steps of processing.""" def run_preprocess(self, debug: bool=False) -> None: """Run the pre-processing steps.""" LOGGER.debug(f'Copying {self.archive_path} to {self.duplicate_path}') shutil.copyfile(self.archive_path, self.duplicate_path)...
the_stack_v2_python_sparse
shabanipy/utils/data_processing.py
jnt299/shabanipy
train
1
c8ec9d0f6b13b349ed565761a9edee521b00c1b8
[ "answer = ''\nfor s in strs:\n answer += str(len(s)) + ':' + s\nreturn answer", "strs = []\nwhile s:\n i = s.find(':')\n length = int(s[:i])\n s = s[i + 1:]\n strs.append(s[:length])\n s = s[length:]\nreturn strs" ]
<|body_start_0|> answer = '' for s in strs: answer += str(len(s)) + ':' + s return answer <|end_body_0|> <|body_start_1|> strs = [] while s: i = s.find(':') length = int(s[:i]) s = s[i + 1:] strs.append(s[:length]) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_005938
2,430
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_003758
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
eb6b11f97a022b66716cb3890cc56c58f62e8aa4
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" answer = '' for s in strs: answer += str(len(s)) + ':' + s return answer def decode(self, s): """Decodes a single string to a list of st...
the_stack_v2_python_sparse
problemSets/top75/271.py
Th3Lourde/l33tcode
train
0
39c40f6306e92855a045c0841c63d574ffe680c0
[ "binning = '1,1' if hdu is None else self.get_meta_value(self.get_headarr(hdu), 'binning')\ndetector_dict = dict(binning=binning, det=1, dataext=1, specaxis=0, specflip=False, spatflip=False, platescale=0.22, darkcurr=0.0, saturation=65535.0, nonlinear=0.76, mincounts=-10000000000.0, numamplifiers=1, gain=np.atleas...
<|body_start_0|> binning = '1,1' if hdu is None else self.get_meta_value(self.get_headarr(hdu), 'binning') detector_dict = dict(binning=binning, det=1, dataext=1, specaxis=0, specflip=False, spatflip=False, platescale=0.22, darkcurr=0.0, saturation=65535.0, nonlinear=0.76, mincounts=-10000000000.0, numa...
Child to handle WHT/ISISr red specific code
WHTISISRedSpectrograph
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WHTISISRedSpectrograph: """Child to handle WHT/ISISr red specific code""" def get_detector_par(self, det, hdu=None): """Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with th...
stack_v2_sparse_classes_10k_train_005939
16,230
permissive
[ { "docstring": "Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with the raw image of interest. If not provided, frame-dependent parameters are set to a default. Returns: :class:`~pypeit.images.detector_...
4
stack_v2_sparse_classes_30k_train_002782
Implement the Python class `WHTISISRedSpectrograph` described below. Class description: Child to handle WHT/ISISr red specific code Method signatures and docstrings: - def get_detector_par(self, det, hdu=None): Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy...
Implement the Python class `WHTISISRedSpectrograph` described below. Class description: Child to handle WHT/ISISr red specific code Method signatures and docstrings: - def get_detector_par(self, det, hdu=None): Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy...
0d2e2196afc6904050b1af4d572f5c643bb07e38
<|skeleton|> class WHTISISRedSpectrograph: """Child to handle WHT/ISISr red specific code""" def get_detector_par(self, det, hdu=None): """Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WHTISISRedSpectrograph: """Child to handle WHT/ISISr red specific code""" def get_detector_par(self, det, hdu=None): """Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with the raw image o...
the_stack_v2_python_sparse
pypeit/spectrographs/wht_isis.py
pypeit/PypeIt
train
136
ea22d79ee64901bf2d21eddd8dc8681b74016a02
[ "if uuidutils.is_uuid_like(segment_uuid):\n LOG.debug('Fetching failover segment by uuid %s', segment_uuid)\n segment = objects.FailoverSegment.get_by_uuid(context, segment_uuid)\nelse:\n LOG.debug('Failed to fetch failover segment by uuid %s', segment_uuid)\n raise exception.FailoverSegmentNotFound(id=...
<|body_start_0|> if uuidutils.is_uuid_like(segment_uuid): LOG.debug('Fetching failover segment by uuid %s', segment_uuid) segment = objects.FailoverSegment.get_by_uuid(context, segment_uuid) else: LOG.debug('Failed to fetch failover segment by uuid %s', segment_uuid) ...
FailoverSegmentAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FailoverSegmentAPI: def get_segment(self, context, segment_uuid): """Get a single failover segment with the given segment_uuid.""" <|body_0|> def get_all(self, context, filters=None, sort_keys=None, sort_dirs=None, limit=None, marker=None): """Get all failover segmen...
stack_v2_sparse_classes_10k_train_005940
17,673
permissive
[ { "docstring": "Get a single failover segment with the given segment_uuid.", "name": "get_segment", "signature": "def get_segment(self, context, segment_uuid)" }, { "docstring": "Get all failover segments filtered by one of the given parameters. If there is no filter it will retrieve all segment...
5
stack_v2_sparse_classes_30k_train_001992
Implement the Python class `FailoverSegmentAPI` described below. Class description: Implement the FailoverSegmentAPI class. Method signatures and docstrings: - def get_segment(self, context, segment_uuid): Get a single failover segment with the given segment_uuid. - def get_all(self, context, filters=None, sort_keys=...
Implement the Python class `FailoverSegmentAPI` described below. Class description: Implement the FailoverSegmentAPI class. Method signatures and docstrings: - def get_segment(self, context, segment_uuid): Get a single failover segment with the given segment_uuid. - def get_all(self, context, filters=None, sort_keys=...
bad1f2fe6e5b4cc1f04c8723d9aba8c4cfffb164
<|skeleton|> class FailoverSegmentAPI: def get_segment(self, context, segment_uuid): """Get a single failover segment with the given segment_uuid.""" <|body_0|> def get_all(self, context, filters=None, sort_keys=None, sort_dirs=None, limit=None, marker=None): """Get all failover segmen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FailoverSegmentAPI: def get_segment(self, context, segment_uuid): """Get a single failover segment with the given segment_uuid.""" if uuidutils.is_uuid_like(segment_uuid): LOG.debug('Fetching failover segment by uuid %s', segment_uuid) segment = objects.FailoverSegment....
the_stack_v2_python_sparse
masakari/ha/api.py
openstack/masakari
train
74
d2cc412e30fb8ab6432776ebfa83e70e630a5bec
[ "super().__init__(cv)\nself._nextrocket = 0\nself._time = 0\nself._cv = cv\nself._pos = pos", "super().update(dt)\nself._time = self._time + dt\nif self._time > self._nextrocket:\n r = RocketRocket(self._cv, self._pos, 1000, ['red', 'blue', 'yellow', 'chartreuse2'], [500, 500], 3, 3)\n entities.append(r)\n ...
<|body_start_0|> super().__init__(cv) self._nextrocket = 0 self._time = 0 self._cv = cv self._pos = pos <|end_body_0|> <|body_start_1|> super().update(dt) self._time = self._time + dt if self._time > self._nextrocket: r = RocketRocket(self._cv...
RocketRocketLauncher
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RocketRocketLauncher: def __init__(self, cv, pos): """Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old roc...
stack_v2_sparse_classes_10k_train_005941
16,427
permissive
[ { "docstring": "Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket", "name": "__init__", "signature": "def __init__(s...
2
stack_v2_sparse_classes_30k_train_003961
Implement the Python class `RocketRocketLauncher` described below. Class description: Implement the RocketRocketLauncher class. Method signatures and docstrings: - def __init__(self, cv, pos): Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow}...
Implement the Python class `RocketRocketLauncher` described below. Class description: Implement the RocketRocketLauncher class. Method signatures and docstrings: - def __init__(self, cv, pos): Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow}...
c6b6d80e9d59f5d115ca8b8fc020fcd6cb030af8
<|skeleton|> class RocketRocketLauncher: def __init__(self, cv, pos): """Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old roc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RocketRocketLauncher: def __init__(self, cv, pos): """Barrages the skies with a relentless series of badass explosions. (repetadly executes RocketRocket) Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket""" ...
the_stack_v2_python_sparse
scripts/sheet9/9.2.py
LennartElbe/PythOnline
train
0
9c65e59fb9e599af4d73de79e758e4c0032588e0
[ "petition = self._petition(confirmation)\nmobile = petition.owner.relation_dict.get('mobile')\nif not mobile:\n raise ValueError('Missing mobile number')\nconfirmation.data['mobile'] = mobile\ndc_update(confirmation, expires=iso_now_offset(datetime.timedelta(minutes=5)))\nself.build_token(confirmation, petition)...
<|body_start_0|> petition = self._petition(confirmation) mobile = petition.owner.relation_dict.get('mobile') if not mobile: raise ValueError('Missing mobile number') confirmation.data['mobile'] = mobile dc_update(confirmation, expires=iso_now_offset(datetime.timedelta...
SMS confirmation handler for petitions
PetitionSMSHandler
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PetitionSMSHandler: """SMS confirmation handler for petitions""" def _create(self, confirmation): """Send an SMS with the confirmation id""" <|body_0|> def _confirm(self, confirmation, petition=None): """Confirms the mobile number on the petition If the mobile nu...
stack_v2_sparse_classes_10k_train_005942
11,319
permissive
[ { "docstring": "Send an SMS with the confirmation id", "name": "_create", "signature": "def _create(self, confirmation)" }, { "docstring": "Confirms the mobile number on the petition If the mobile number on the owner relation matches the mobile number of this confirmation the mobile_trusted flag...
2
stack_v2_sparse_classes_30k_train_004613
Implement the Python class `PetitionSMSHandler` described below. Class description: SMS confirmation handler for petitions Method signatures and docstrings: - def _create(self, confirmation): Send an SMS with the confirmation id - def _confirm(self, confirmation, petition=None): Confirms the mobile number on the peti...
Implement the Python class `PetitionSMSHandler` described below. Class description: SMS confirmation handler for petitions Method signatures and docstrings: - def _create(self, confirmation): Send an SMS with the confirmation id - def _confirm(self, confirmation, petition=None): Confirms the mobile number on the peti...
680aadb1d9dd02e031b1902a4f9ef19440959465
<|skeleton|> class PetitionSMSHandler: """SMS confirmation handler for petitions""" def _create(self, confirmation): """Send an SMS with the confirmation id""" <|body_0|> def _confirm(self, confirmation, petition=None): """Confirms the mobile number on the petition If the mobile nu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PetitionSMSHandler: """SMS confirmation handler for petitions""" def _create(self, confirmation): """Send an SMS with the confirmation id""" petition = self._petition(confirmation) mobile = petition.owner.relation_dict.get('mobile') if not mobile: raise ValueEr...
the_stack_v2_python_sparse
src/iris/service/content/petition/confirmation.py
iris-dni/iris-service
train
3
e9ed6f8f1b581c28c38fd86f5cb450d64c318a10
[ "payload = {'data': data, 'timestamp': int(time.time() * 1000)}\njwt_token = jwt.encode(payload, 'testingplatformhs256', algorithm='HS256')\nreturn bytes.decode(jwt_token)", "try:\n return jwt.decode(jwt_token, verify=False)\nexcept DecodeError:\n return None" ]
<|body_start_0|> payload = {'data': data, 'timestamp': int(time.time() * 1000)} jwt_token = jwt.encode(payload, 'testingplatformhs256', algorithm='HS256') return bytes.decode(jwt_token) <|end_body_0|> <|body_start_1|> try: return jwt.decode(jwt_token, verify=False) e...
Security
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Security: def encode(data): """生成 jwt token""" <|body_0|> def decode(jwt_token): """解析 jwt token""" <|body_1|> <|end_skeleton|> <|body_start_0|> payload = {'data': data, 'timestamp': int(time.time() * 1000)} jwt_token = jwt.encode(payload, '...
stack_v2_sparse_classes_10k_train_005943
1,417
permissive
[ { "docstring": "生成 jwt token", "name": "encode", "signature": "def encode(data)" }, { "docstring": "解析 jwt token", "name": "decode", "signature": "def decode(jwt_token)" } ]
2
stack_v2_sparse_classes_30k_train_003089
Implement the Python class `Security` described below. Class description: Implement the Security class. Method signatures and docstrings: - def encode(data): 生成 jwt token - def decode(jwt_token): 解析 jwt token
Implement the Python class `Security` described below. Class description: Implement the Security class. Method signatures and docstrings: - def encode(data): 生成 jwt token - def decode(jwt_token): 解析 jwt token <|skeleton|> class Security: def encode(data): """生成 jwt token""" <|body_0|> def d...
d7008343c25ec7f47acb670ae5c9b9b5f0593d63
<|skeleton|> class Security: def encode(data): """生成 jwt token""" <|body_0|> def decode(jwt_token): """解析 jwt token""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Security: def encode(data): """生成 jwt token""" payload = {'data': data, 'timestamp': int(time.time() * 1000)} jwt_token = jwt.encode(payload, 'testingplatformhs256', algorithm='HS256') return bytes.decode(jwt_token) def decode(jwt_token): """解析 jwt token""" ...
the_stack_v2_python_sparse
backend/util/jwt_token.py
felixu1992/testing-platform
train
0
15f39eab02c2098df36033b90b43c0ea373a7cd1
[ "n = len(prices)\ndp = [[0, -prices[0]]] + [[0, 0] for _ in range(n - 1)]\nfor i in range(1, n):\n dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i] - fee)\n dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - prices[i])\nreturn dp[-1][0]", "if not prices:\n return 0\nn = len(prices)\ndp0 = 0\ndp1 = -prices[...
<|body_start_0|> n = len(prices) dp = [[0, -prices[0]]] + [[0, 0] for _ in range(n - 1)] for i in range(1, n): dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i] - fee) dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - prices[i]) return dp[-1][0] <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices, fee): """:type prices: List[int] :type fee: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(prices) ...
stack_v2_sparse_classes_10k_train_005944
1,003
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices, fee)" }, { "docstring": ":type prices: List[int] :type fee: int :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices, fee)" } ]
2
stack_v2_sparse_classes_30k_train_003627
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices, fee): :type prices: List[int] :rtype: int - def maxProfit(self, prices, fee): :type prices: List[int] :type fee: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices, fee): :type prices: List[int] :rtype: int - def maxProfit(self, prices, fee): :type prices: List[int] :type fee: int :rtype: int <|skeleton|> class S...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices, fee): """:type prices: List[int] :type fee: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :rtype: int""" n = len(prices) dp = [[0, -prices[0]]] + [[0, 0] for _ in range(n - 1)] for i in range(1, n): dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i] - fee) dp[i][1] = ma...
the_stack_v2_python_sparse
0714_Best_Time_to_Buy_and_Sell_Stock_with_Transaction_Fee.py
bingli8802/leetcode
train
0
f5428f29ec127bbb92eccb4e5c65ea1e4deba769
[ "Attachment = self.env['ir.attachment']\ninputs = Attachment.browse()\nif path.path not in conn:\n return\nnot_consumed = []\nfor _r, fs in batched(conn[path.path], self._BATCH_SIZE):\n attachment_data = []\n for f in fs:\n if not fnmatch.fnmatch(f['name'], path.glob):\n not_consumed.appe...
<|body_start_0|> Attachment = self.env['ir.attachment'] inputs = Attachment.browse() if path.path not in conn: return not_consumed = [] for _r, fs in batched(conn[path.path], self._BATCH_SIZE): attachment_data = [] for f in fs: ...
EDI XML-RPC connection An EDI XML-RPC connection is initiated by external code via the Odoo XML-RPC interface.
EdiConnectionXMLRPC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdiConnectionXMLRPC: """EDI XML-RPC connection An EDI XML-RPC connection is initiated by external code via the Odoo XML-RPC interface.""" def receive_inputs(self, conn, path, _transfer): """Receive input attachments""" <|body_0|> def send_outputs(self, conn, path, transf...
stack_v2_sparse_classes_10k_train_005945
2,798
no_license
[ { "docstring": "Receive input attachments", "name": "receive_inputs", "signature": "def receive_inputs(self, conn, path, _transfer)" }, { "docstring": "Send output attachments", "name": "send_outputs", "signature": "def send_outputs(self, conn, path, transfer)" } ]
2
stack_v2_sparse_classes_30k_train_005686
Implement the Python class `EdiConnectionXMLRPC` described below. Class description: EDI XML-RPC connection An EDI XML-RPC connection is initiated by external code via the Odoo XML-RPC interface. Method signatures and docstrings: - def receive_inputs(self, conn, path, _transfer): Receive input attachments - def send_...
Implement the Python class `EdiConnectionXMLRPC` described below. Class description: EDI XML-RPC connection An EDI XML-RPC connection is initiated by external code via the Odoo XML-RPC interface. Method signatures and docstrings: - def receive_inputs(self, conn, path, _transfer): Receive input attachments - def send_...
d6d55fbf8abecb0b8201384921833868ae849920
<|skeleton|> class EdiConnectionXMLRPC: """EDI XML-RPC connection An EDI XML-RPC connection is initiated by external code via the Odoo XML-RPC interface.""" def receive_inputs(self, conn, path, _transfer): """Receive input attachments""" <|body_0|> def send_outputs(self, conn, path, transf...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EdiConnectionXMLRPC: """EDI XML-RPC connection An EDI XML-RPC connection is initiated by external code via the Odoo XML-RPC interface.""" def receive_inputs(self, conn, path, _transfer): """Receive input attachments""" Attachment = self.env['ir.attachment'] inputs = Attachment.bro...
the_stack_v2_python_sparse
addons/edi/models/edi_connection_xmlrpc.py
unipartdigital/odoo-edi
train
9
e96945fababa77d483574550ab01855da9d66d98
[ "permission = AdministerOrganizationPermission(orgname)\nif permission.can():\n organization = model.organization.get_organization(orgname)\n query = model.organization_skus.get_org_subscriptions(organization.id)\n if query:\n subscriptions = list(query.dicts())\n for subscription in subscrip...
<|body_start_0|> permission = AdministerOrganizationPermission(orgname) if permission.can(): organization = model.organization.get_organization(orgname) query = model.organization_skus.get_org_subscriptions(organization.id) if query: subscriptions = li...
Resource for managing an organization's RH SKU
OrganizationRhSku
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationRhSku: """Resource for managing an organization's RH SKU""" def get(self, orgname): """Get sku assigned to org""" <|body_0|> def post(self, orgname): """Assigns a sku to an org""" <|body_1|> <|end_skeleton|> <|body_start_0|> permissi...
stack_v2_sparse_classes_10k_train_005946
33,890
permissive
[ { "docstring": "Get sku assigned to org", "name": "get", "signature": "def get(self, orgname)" }, { "docstring": "Assigns a sku to an org", "name": "post", "signature": "def post(self, orgname)" } ]
2
stack_v2_sparse_classes_30k_train_002049
Implement the Python class `OrganizationRhSku` described below. Class description: Resource for managing an organization's RH SKU Method signatures and docstrings: - def get(self, orgname): Get sku assigned to org - def post(self, orgname): Assigns a sku to an org
Implement the Python class `OrganizationRhSku` described below. Class description: Resource for managing an organization's RH SKU Method signatures and docstrings: - def get(self, orgname): Get sku assigned to org - def post(self, orgname): Assigns a sku to an org <|skeleton|> class OrganizationRhSku: """Resourc...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class OrganizationRhSku: """Resource for managing an organization's RH SKU""" def get(self, orgname): """Get sku assigned to org""" <|body_0|> def post(self, orgname): """Assigns a sku to an org""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OrganizationRhSku: """Resource for managing an organization's RH SKU""" def get(self, orgname): """Get sku assigned to org""" permission = AdministerOrganizationPermission(orgname) if permission.can(): organization = model.organization.get_organization(orgname) ...
the_stack_v2_python_sparse
endpoints/api/billing.py
quay/quay
train
2,363
34c44257a98ee3941af3424f64baee7f5150444f
[ "if not nums:\n return True\nn = len(nums)\ncount0 = nums.count(nums[0])\nif n % 3 != 0 and count0 == 2 and (self.isHu(nums[2:]) == True):\n return True\nif count0 == 3 and self.isHu(nums[3:]) == True:\n return True\nif nums[0] + 1 in nums and nums[0] + 2 in nums:\n last_nums = nums.copy()\n last_num...
<|body_start_0|> if not nums: return True n = len(nums) count0 = nums.count(nums[0]) if n % 3 != 0 and count0 == 2 and (self.isHu(nums[2:]) == True): return True if count0 == 3 and self.isHu(nums[3:]) == True: return True if nums[0] + 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHu(self, nums): """判断是否能胡牌""" <|body_0|> def add_card_main(self, array): """建立每个元素与数目的字典映射""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return True n = len(nums) count0 = nums.count(nums[0]...
stack_v2_sparse_classes_10k_train_005947
2,884
no_license
[ { "docstring": "判断是否能胡牌", "name": "isHu", "signature": "def isHu(self, nums)" }, { "docstring": "建立每个元素与数目的字典映射", "name": "add_card_main", "signature": "def add_card_main(self, array)" } ]
2
stack_v2_sparse_classes_30k_val_000367
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHu(self, nums): 判断是否能胡牌 - def add_card_main(self, array): 建立每个元素与数目的字典映射
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHu(self, nums): 判断是否能胡牌 - def add_card_main(self, array): 建立每个元素与数目的字典映射 <|skeleton|> class Solution: def isHu(self, nums): """判断是否能胡牌""" <|body_0|> ...
4e4f739402b95691f6c91411da26d7d3bfe042b6
<|skeleton|> class Solution: def isHu(self, nums): """判断是否能胡牌""" <|body_0|> def add_card_main(self, array): """建立每个元素与数目的字典映射""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isHu(self, nums): """判断是否能胡牌""" if not nums: return True n = len(nums) count0 = nums.count(nums[0]) if n % 3 != 0 and count0 == 2 and (self.isHu(nums[2:]) == True): return True if count0 == 3 and self.isHu(nums[3:]) == True:...
the_stack_v2_python_sparse
Interview/practice/tt_03.雀魂启动.py
hugechuanqi/Algorithms-and-Data-Structures
train
3
4becf18393dc157d266e77c022864c96567ad973
[ "super(CenterLineAtYAxis, self).__init__(dim)\nself.output_size = output_size\nself.output_spacing = output_spacing", "if self.dim == 2:\n return self.get_2d(**kwargs)\nelif self.dim == 3:\n return self.get_3d(**kwargs)", "input_image = kwargs.get('image')\nline = kwargs.get('line')\noutput_size = kwargs....
<|body_start_0|> super(CenterLineAtYAxis, self).__init__(dim) self.output_size = output_size self.output_spacing = output_spacing <|end_body_0|> <|body_start_1|> if self.dim == 2: return self.get_2d(**kwargs) elif self.dim == 3: return self.get_3d(**kwarg...
A composite transformation that centers a given line at the y axis. Used in the bone generators.
CenterLineAtYAxis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CenterLineAtYAxis: """A composite transformation that centers a given line at the y axis. Used in the bone generators.""" def __init__(self, dim, output_size, output_spacing): """Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param outpu...
stack_v2_sparse_classes_10k_train_005948
7,141
no_license
[ { "docstring": "Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param output_spacing: The output image spacing in mm.", "name": "__init__", "signature": "def __init__(self, dim, output_size, output_spacing)" }, { "docstring": "Returns the sitk transf...
4
stack_v2_sparse_classes_30k_train_004406
Implement the Python class `CenterLineAtYAxis` described below. Class description: A composite transformation that centers a given line at the y axis. Used in the bone generators. Method signatures and docstrings: - def __init__(self, dim, output_size, output_spacing): Initializer. :param dim: The dimension. :param o...
Implement the Python class `CenterLineAtYAxis` described below. Class description: A composite transformation that centers a given line at the y axis. Used in the bone generators. Method signatures and docstrings: - def __init__(self, dim, output_size, output_spacing): Initializer. :param dim: The dimension. :param o...
ef6cee91264ba1fe6b40d9823a07647b95bcc2c4
<|skeleton|> class CenterLineAtYAxis: """A composite transformation that centers a given line at the y axis. Used in the bone generators.""" def __init__(self, dim, output_size, output_spacing): """Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param outpu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CenterLineAtYAxis: """A composite transformation that centers a given line at the y axis. Used in the bone generators.""" def __init__(self, dim, output_size, output_spacing): """Initializer. :param dim: The dimension. :param output_size: The output image size in pixels. :param output_spacing: Th...
the_stack_v2_python_sparse
transformations/spatial/center_line_at_y_axis.py
XiaoweiXu/MedicalDataAugmentationTool
train
1
c5a7613b0bb497ee9afaf672fd1ded36f1afebfb
[ "if isinstance(value, bytes):\n value = value.decode('utf-8')\nreturn value", "if isinstance(value, bytes):\n value = value.decode('utf-8')\nresult = repr(value)\nif six.PY2 and result.startswith('u'):\n result = result[1:].decode('unicode-escape')\nreturn result" ]
<|body_start_0|> if isinstance(value, bytes): value = value.decode('utf-8') return value <|end_body_0|> <|body_start_1|> if isinstance(value, bytes): value = value.decode('utf-8') result = repr(value) if six.PY2 and result.startswith('u'): res...
Base class for serialization for strings. This will encode to a string, and ensure the results are consistent across Python 2 and 3. Version Added: 2.2
StringSerialization
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringSerialization: """Base class for serialization for strings. This will encode to a string, and ensure the results are consistent across Python 2 and 3. Version Added: 2.2""" def serialize_to_signature(cls, value): """Serialize a string to JSON-compatible string. Args: value (byt...
stack_v2_sparse_classes_10k_train_005949
30,104
permissive
[ { "docstring": "Serialize a string to JSON-compatible string. Args: value (bytes or unicode): The string to serialize. If a byte string, it's expected to contain UTF-8 data. Returns: unicode: The resulting string.", "name": "serialize_to_signature", "signature": "def serialize_to_signature(cls, value)" ...
2
stack_v2_sparse_classes_30k_train_006507
Implement the Python class `StringSerialization` described below. Class description: Base class for serialization for strings. This will encode to a string, and ensure the results are consistent across Python 2 and 3. Version Added: 2.2 Method signatures and docstrings: - def serialize_to_signature(cls, value): Seria...
Implement the Python class `StringSerialization` described below. Class description: Base class for serialization for strings. This will encode to a string, and ensure the results are consistent across Python 2 and 3. Version Added: 2.2 Method signatures and docstrings: - def serialize_to_signature(cls, value): Seria...
756eedeacc41f77111a557fc13dee559cb94f433
<|skeleton|> class StringSerialization: """Base class for serialization for strings. This will encode to a string, and ensure the results are consistent across Python 2 and 3. Version Added: 2.2""" def serialize_to_signature(cls, value): """Serialize a string to JSON-compatible string. Args: value (byt...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StringSerialization: """Base class for serialization for strings. This will encode to a string, and ensure the results are consistent across Python 2 and 3. Version Added: 2.2""" def serialize_to_signature(cls, value): """Serialize a string to JSON-compatible string. Args: value (bytes or unicode...
the_stack_v2_python_sparse
django_evolution/serialization.py
beanbaginc/django-evolution
train
22
0f19f99ae1f59521485aa0c56c44f5cbb97d71f1
[ "start = 0\nend = len(nums) - 1\nwhile start <= end:\n mid = (start + end) / 2\n if nums[mid - 1] != nums[mid] != nums[mid + 1]:\n return nums[mid]\n elif nums[mid - 1] == nums[mid]:\n end = mid - 1\n else:\n start = mid + 1", "if len(nums) < 3:\n return nums[0]\nstart = 0\nend...
<|body_start_0|> start = 0 end = len(nums) - 1 while start <= end: mid = (start + end) / 2 if nums[mid - 1] != nums[mid] != nums[mid + 1]: return nums[mid] elif nums[mid - 1] == nums[mid]: end = mid - 1 else: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _singleNonDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNonDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> start = 0 end = len(nu...
stack_v2_sparse_classes_10k_train_005950
2,085
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "_singleNonDuplicate", "signature": "def _singleNonDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNonDuplicate", "signature": "def singleNonDuplicate(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _singleNonDuplicate(self, nums): :type nums: List[int] :rtype: int - def singleNonDuplicate(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _singleNonDuplicate(self, nums): :type nums: List[int] :rtype: int - def singleNonDuplicate(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _singleNonDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNonDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def _singleNonDuplicate(self, nums): """:type nums: List[int] :rtype: int""" start = 0 end = len(nums) - 1 while start <= end: mid = (start + end) / 2 if nums[mid - 1] != nums[mid] != nums[mid + 1]: return nums[mid] ...
the_stack_v2_python_sparse
540.single-element-in-a-sorted-array.py
windard/leeeeee
train
0
d40cea7d00ccf04245c49739e51ff52e3aad4cf3
[ "super(TempBase, self).__init__(*args, **kwargs)\nforbidden = []\nfor i in self.FORBIDDEN_COLUMN_LIST:\n forbidden.append(self.__tablename__ + '.' + i)\nself.FORBIDDEN_COLUMN_LIST = forbidden\nshow = []\nfor k in self.SHOW_COLUMN_LIST:\n show.append(self.__tablename__ + '.' + k)\nself.SHOW_COLUMN_LIST = show"...
<|body_start_0|> super(TempBase, self).__init__(*args, **kwargs) forbidden = [] for i in self.FORBIDDEN_COLUMN_LIST: forbidden.append(self.__tablename__ + '.' + i) self.FORBIDDEN_COLUMN_LIST = forbidden show = [] for k in self.SHOW_COLUMN_LIST: sho...
基类
TempBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempBase: """基类""" def __init__(self, *args, **kwargs): """初始化""" <|body_0|> def to_dict(self): """序列化""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(TempBase, self).__init__(*args, **kwargs) forbidden = [] for i in self.F...
stack_v2_sparse_classes_10k_train_005951
22,283
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "序列化", "name": "to_dict", "signature": "def to_dict(self)" } ]
2
null
Implement the Python class `TempBase` described below. Class description: 基类 Method signatures and docstrings: - def __init__(self, *args, **kwargs): 初始化 - def to_dict(self): 序列化
Implement the Python class `TempBase` described below. Class description: 基类 Method signatures and docstrings: - def __init__(self, *args, **kwargs): 初始化 - def to_dict(self): 序列化 <|skeleton|> class TempBase: """基类""" def __init__(self, *args, **kwargs): """初始化""" <|body_0|> def to_dict(...
c50def8cde58fd4663032b860eb058302cbac6da
<|skeleton|> class TempBase: """基类""" def __init__(self, *args, **kwargs): """初始化""" <|body_0|> def to_dict(self): """序列化""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TempBase: """基类""" def __init__(self, *args, **kwargs): """初始化""" super(TempBase, self).__init__(*args, **kwargs) forbidden = [] for i in self.FORBIDDEN_COLUMN_LIST: forbidden.append(self.__tablename__ + '.' + i) self.FORBIDDEN_COLUMN_LIST = forbidden ...
the_stack_v2_python_sparse
src/workers/preprocess/models/models.py
fan1018wen/Alpha
train
0
274d4086461a02d0f7413b391359524619e32c4c
[ "if not root:\n return []\nstack = []\nres = []\ncur = root\nstack.append(cur)\nwhile stack:\n cur = stack.pop()\n res.append(cur.val)\n if cur.right:\n stack.append(cur.right)\n if cur.left:\n stack.append(cur.left)\nreturn res", "if root is None:\n return []\nres = []\n\ndef trav...
<|body_start_0|> if not root: return [] stack = [] res = [] cur = root stack.append(cur) while stack: cur = stack.pop() res.append(cur.val) if cur.right: stack.append(cur.right) if cur.left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存""" <|body_0|> def preorderTraversal1(self, root): """:type root: TreeNode :rtype: List[int] 算法:递归""" ...
stack_v2_sparse_classes_10k_train_005952
1,705
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int] 算法:递归", "name": "preorderTra...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存 - def preorderTraversal1(self, ro...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存 - def preorderTraversal1(self, ro...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存""" <|body_0|> def preorderTraversal1(self, root): """:type root: TreeNode :rtype: List[int] 算法:递归""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int] 算法:迭代 基本思想: 前序遍历顺序:中左右 所以先将root节点入栈,然后出栈并保存, 再将其右节点入栈,左节点入栈,然后依次pop并保存""" if not root: return [] stack = [] res = [] cur = root stack.append(cur) while sta...
the_stack_v2_python_sparse
out/production/leetcode/144.二叉树的前序遍历.py
yangyuxiang1996/leetcode
train
0
76f68093fbb8927100b7ad2af0d984fc4c166a9e
[ "if self.codeable_concept:\n return 'Performer {0.reference_txt} {0.codeable_concept}'.format(self)\nreturn 'Performer {0.reference_txt}'.format(self)", "if self.codeable_concept:\n return {'actor': self.reference_txt, 'role': self.codeable_concept.as_fhir()}\nreturn self.reference_txt", "instance = cls()...
<|body_start_0|> if self.codeable_concept: return 'Performer {0.reference_txt} {0.codeable_concept}'.format(self) return 'Performer {0.reference_txt}'.format(self) <|end_body_0|> <|body_start_1|> if self.codeable_concept: return {'actor': self.reference_txt, 'role': self...
ORM for FHIR Performer - performers table
Performer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Performer: """ORM for FHIR Performer - performers table""" def __str__(self): """Print friendly format for logging, etc.""" <|body_0|> def as_fhir(self): """Return self in JSON FHIR formatted string FHIR is not currently consistant in performer inclusion. For exa...
stack_v2_sparse_classes_10k_train_005953
4,146
permissive
[ { "docstring": "Print friendly format for logging, etc.", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Return self in JSON FHIR formatted string FHIR is not currently consistant in performer inclusion. For example, Observation.performer is simply a list of Reference res...
4
stack_v2_sparse_classes_30k_train_002410
Implement the Python class `Performer` described below. Class description: ORM for FHIR Performer - performers table Method signatures and docstrings: - def __str__(self): Print friendly format for logging, etc. - def as_fhir(self): Return self in JSON FHIR formatted string FHIR is not currently consistant in perform...
Implement the Python class `Performer` described below. Class description: ORM for FHIR Performer - performers table Method signatures and docstrings: - def __str__(self): Print friendly format for logging, etc. - def as_fhir(self): Return self in JSON FHIR formatted string FHIR is not currently consistant in perform...
622e90f54692c6fc9c84468f489ab6f297af0feb
<|skeleton|> class Performer: """ORM for FHIR Performer - performers table""" def __str__(self): """Print friendly format for logging, etc.""" <|body_0|> def as_fhir(self): """Return self in JSON FHIR formatted string FHIR is not currently consistant in performer inclusion. For exa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Performer: """ORM for FHIR Performer - performers table""" def __str__(self): """Print friendly format for logging, etc.""" if self.codeable_concept: return 'Performer {0.reference_txt} {0.codeable_concept}'.format(self) return 'Performer {0.reference_txt}'.format(self...
the_stack_v2_python_sparse
portal/models/performer.py
pep8speaks/true_nth_usa_portal
train
1
0163054dd5e092f954f7f7bbfde502a0d55d41df
[ "def recur(i, j):\n if j == 0 or i == j:\n return 1\n else:\n return recur(i - 1, j - 1) + recur(i - 1, j)\nres = []\nfor i in range(numRows):\n tmp = []\n for j in range(i + 1):\n if j == 0 or i == j:\n tmp.append(1)\n else:\n tmp.append(recur(i - 1, j ...
<|body_start_0|> def recur(i, j): if j == 0 or i == j: return 1 else: return recur(i - 1, j - 1) + recur(i - 1, j) res = [] for i in range(numRows): tmp = [] for j in range(i + 1): if j == 0 or i == j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate_1(self, numRows: int) -> List[List[int]]: """递归 时间复杂度:O(numRows^3) 空间复杂度:O(numRows^2) :param numRows: :return:""" <|body_0|> def generate_2(self, numRows: int) -> List[List[int]]: """动态规划 时间复杂度:O(numRows^2) 空间复杂度:O(numRows^2) :param numRows: :r...
stack_v2_sparse_classes_10k_train_005954
1,669
no_license
[ { "docstring": "递归 时间复杂度:O(numRows^3) 空间复杂度:O(numRows^2) :param numRows: :return:", "name": "generate_1", "signature": "def generate_1(self, numRows: int) -> List[List[int]]" }, { "docstring": "动态规划 时间复杂度:O(numRows^2) 空间复杂度:O(numRows^2) :param numRows: :return:", "name": "generate_2", "s...
2
stack_v2_sparse_classes_30k_train_004121
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate_1(self, numRows: int) -> List[List[int]]: 递归 时间复杂度:O(numRows^3) 空间复杂度:O(numRows^2) :param numRows: :return: - def generate_2(self, numRows: int) -> List[List[int]]: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate_1(self, numRows: int) -> List[List[int]]: 递归 时间复杂度:O(numRows^3) 空间复杂度:O(numRows^2) :param numRows: :return: - def generate_2(self, numRows: int) -> List[List[int]]: ...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def generate_1(self, numRows: int) -> List[List[int]]: """递归 时间复杂度:O(numRows^3) 空间复杂度:O(numRows^2) :param numRows: :return:""" <|body_0|> def generate_2(self, numRows: int) -> List[List[int]]: """动态规划 时间复杂度:O(numRows^2) 空间复杂度:O(numRows^2) :param numRows: :r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def generate_1(self, numRows: int) -> List[List[int]]: """递归 时间复杂度:O(numRows^3) 空间复杂度:O(numRows^2) :param numRows: :return:""" def recur(i, j): if j == 0 or i == j: return 1 else: return recur(i - 1, j - 1) + recur(i - 1, j) ...
the_stack_v2_python_sparse
软件开发岗刷题(华为笔试准备)/递归/generate.py
MaoningGuan/LeetCode
train
3
76cd6aabee6122feb7811b641799bc8b292e3529
[ "nums.sort()\nresults = []\nfor i in range(len(nums) - 3):\n if i == 0 or nums[i] != nums[i - 1]:\n threeResult = self.threeSum(nums[i + 1:], target - nums[i])\n for item in threeResult:\n results.append([nums[i]] + item)\nreturn results", "res = []\nnums.sort()\nfor i in range(len(num...
<|body_start_0|> nums.sort() results = [] for i in range(len(nums) - 3): if i == 0 or nums[i] != nums[i - 1]: threeResult = self.threeSum(nums[i + 1:], target - nums[i]) for item in threeResult: results.append([nums[i]] + item) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)""" <|body_0|> def threeSum(self, nums, target): """第15...
stack_v2_sparse_classes_10k_train_005955
3,097
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": "第15题 :type nums: List[int]...
2
stack_v2_sparse_classes_30k_train_000592
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-...
0b3bc77cbfe0e45e62c3c8f244e9e3d2421e6121
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)""" <|body_0|> def threeSum(self, nums, target): """第15...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)""" nums.sort() results = [] for i in range(len(nums) - 3): ...
the_stack_v2_python_sparse
18.py
lailianqi/LeetCodeByPython
train
0
189ee5e58d0b3a6d7b98ef016260f6f1f35350f8
[ "random.seed(1)\nself.grid_lat = np.random.rand(1000) * 5 * random.choice([-1, 1]) + -59.1868\nself.grid_long = np.random.rand(1000) * 5 * random.choice([-1, 1]) + 57.1794\nself.grid_dates = np.random.rand(1000) * 5 * random.choice([-1, 1]) + 5.1083 * 10 ** 3\nself.grid_z_values = np.random.rand(1000) * 5 * random....
<|body_start_0|> random.seed(1) self.grid_lat = np.random.rand(1000) * 5 * random.choice([-1, 1]) + -59.1868 self.grid_long = np.random.rand(1000) * 5 * random.choice([-1, 1]) + 57.1794 self.grid_dates = np.random.rand(1000) * 5 * random.choice([-1, 1]) + 5.1083 * 10 ** 3 self.gr...
Test cases for find_besthist function
FindBestHistTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindBestHistTestCase: """Test cases for find_besthist function""" def setUp(self): """Set up for the tests. Creates 1000 historical random data points that are the float data points +/- 5. This could fail randomly if, by pure chance, none of the generated data is in the ellipse, so u...
stack_v2_sparse_classes_10k_train_005956
5,447
no_license
[ { "docstring": "Set up for the tests. Creates 1000 historical random data points that are the float data points +/- 5. This could fail randomly if, by pure chance, none of the generated data is in the ellipse, so use pseudo random numbers just in case :return: nothing", "name": "setUp", "signature": "de...
5
stack_v2_sparse_classes_30k_train_004576
Implement the Python class `FindBestHistTestCase` described below. Class description: Test cases for find_besthist function Method signatures and docstrings: - def setUp(self): Set up for the tests. Creates 1000 historical random data points that are the float data points +/- 5. This could fail randomly if, by pure c...
Implement the Python class `FindBestHistTestCase` described below. Class description: Test cases for find_besthist function Method signatures and docstrings: - def setUp(self): Set up for the tests. Creates 1000 historical random data points that are the float data points +/- 5. This could fail randomly if, by pure c...
3944e9783d58422d2d10bbc95f9706e168550034
<|skeleton|> class FindBestHistTestCase: """Test cases for find_besthist function""" def setUp(self): """Set up for the tests. Creates 1000 historical random data points that are the float data points +/- 5. This could fail randomly if, by pure chance, none of the generated data is in the ellipse, so u...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FindBestHistTestCase: """Test cases for find_besthist function""" def setUp(self): """Set up for the tests. Creates 1000 historical random data points that are the float data points +/- 5. This could fail randomly if, by pure chance, none of the generated data is in the ellipse, so use pseudo ran...
the_stack_v2_python_sparse
ow_calibration/find_besthist/find_besthist_test.py
gmaze/argodmqc_owc
train
0
0101cb4e170a8d168a24134fee231c0d44274d44
[ "session = db_apis.get_session()\nwith session.begin():\n db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID])\namphorae = {amp.id: amp for amp in db_lb.amphorae}\nupdated_ports = {}\nhandle_delta = HandleNetworkDelta()\nfor amp_id, delta in deltas.items():\n ret = handle_de...
<|body_start_0|> session = db_apis.get_session() with session.begin(): db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID]) amphorae = {amp.id: amp for amp in db_lb.amphorae} updated_ports = {} handle_delta = HandleNetworkDelta() ...
Task to plug and unplug networks Loop through the deltas and plug or unplug networks based on delta
HandleNetworkDeltas
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandleNetworkDeltas: """Task to plug and unplug networks Loop through the deltas and plug or unplug networks based on delta""" def execute(self, deltas, loadbalancer): """Handle network plugging based off deltas.""" <|body_0|> def revert(self, result, deltas, *args, **kw...
stack_v2_sparse_classes_10k_train_005957
44,034
permissive
[ { "docstring": "Handle network plugging based off deltas.", "name": "execute", "signature": "def execute(self, deltas, loadbalancer)" }, { "docstring": "Handle a network plug or unplug failures.", "name": "revert", "signature": "def revert(self, result, deltas, *args, **kwargs)" } ]
2
null
Implement the Python class `HandleNetworkDeltas` described below. Class description: Task to plug and unplug networks Loop through the deltas and plug or unplug networks based on delta Method signatures and docstrings: - def execute(self, deltas, loadbalancer): Handle network plugging based off deltas. - def revert(s...
Implement the Python class `HandleNetworkDeltas` described below. Class description: Task to plug and unplug networks Loop through the deltas and plug or unplug networks based on delta Method signatures and docstrings: - def execute(self, deltas, loadbalancer): Handle network plugging based off deltas. - def revert(s...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class HandleNetworkDeltas: """Task to plug and unplug networks Loop through the deltas and plug or unplug networks based on delta""" def execute(self, deltas, loadbalancer): """Handle network plugging based off deltas.""" <|body_0|> def revert(self, result, deltas, *args, **kw...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HandleNetworkDeltas: """Task to plug and unplug networks Loop through the deltas and plug or unplug networks based on delta""" def execute(self, deltas, loadbalancer): """Handle network plugging based off deltas.""" session = db_apis.get_session() with session.begin(): ...
the_stack_v2_python_sparse
octavia/controller/worker/v2/tasks/network_tasks.py
openstack/octavia
train
147
c97bdc9758500115d00dd12e74d8b9f2a1772596
[ "self.groups: set[LcnAddr] = set()\nself.groups_known = asyncio.Event()\nsuper().__init__(addr_conn, num_tries, timeout_msec)", "if isinstance(inp, inputs.ModStatusGroups):\n if not inp.dynamic:\n self.groups.update(inp.groups)\n self.groups_known.set()\n await self.cancel()", "if not fa...
<|body_start_0|> self.groups: set[LcnAddr] = set() self.groups_known = asyncio.Event() super().__init__(addr_conn, num_tries, timeout_msec) <|end_body_0|> <|body_start_1|> if isinstance(inp, inputs.ModStatusGroups): if not inp.dynamic: self.groups.update(inp....
Request handler to request static group membership of a module.
GroupMembershipStaticRequestHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupMembershipStaticRequestHandler: """Request handler to request static group membership of a module.""" def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): """Initialize class instance.""" <|body_0|> async def async_process_input...
stack_v2_sparse_classes_10k_train_005958
24,302
permissive
[ { "docstring": "Initialize class instance.", "name": "__init__", "signature": "def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500)" }, { "docstring": "Process incoming input object. Method to handle incoming commands for this specific request handler.", ...
4
stack_v2_sparse_classes_30k_train_004147
Implement the Python class `GroupMembershipStaticRequestHandler` described below. Class description: Request handler to request static group membership of a module. Method signatures and docstrings: - def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): Initialize class instance....
Implement the Python class `GroupMembershipStaticRequestHandler` described below. Class description: Request handler to request static group membership of a module. Method signatures and docstrings: - def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): Initialize class instance....
00b45d5dcec8fccd4b13d218ac56194f44959e68
<|skeleton|> class GroupMembershipStaticRequestHandler: """Request handler to request static group membership of a module.""" def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): """Initialize class instance.""" <|body_0|> async def async_process_input...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GroupMembershipStaticRequestHandler: """Request handler to request static group membership of a module.""" def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): """Initialize class instance.""" self.groups: set[LcnAddr] = set() self.groups_know...
the_stack_v2_python_sparse
pypck/request_handlers.py
alengwenus/pypck
train
6
f42d522c7b847f447ad3707a8fec16c9ff32ea99
[ "sm = get_storage_manager()\nwith sm.transaction():\n role = sm.get(models.Role, None, filters={'name': role_name})\n already_exists = models.Permission.query.filter_by(role=role, name=permission_name).first()\n if already_exists:\n raise manager_exceptions.ConflictError(f'{role_name} already has pe...
<|body_start_0|> sm = get_storage_manager() with sm.transaction(): role = sm.get(models.Role, None, filters={'name': role_name}) already_exists = models.Permission.query.filter_by(role=role, name=permission_name).first() if already_exists: raise manage...
PermissionsRoleId
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionsRoleId: def put(self, role_name, permission_name): """Allow role_name the permission permission_name""" <|body_0|> def delete(self, role_name, permission_name): """Disallow role_name the permission permission_name""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_005959
3,208
permissive
[ { "docstring": "Allow role_name the permission permission_name", "name": "put", "signature": "def put(self, role_name, permission_name)" }, { "docstring": "Disallow role_name the permission permission_name", "name": "delete", "signature": "def delete(self, role_name, permission_name)" ...
2
null
Implement the Python class `PermissionsRoleId` described below. Class description: Implement the PermissionsRoleId class. Method signatures and docstrings: - def put(self, role_name, permission_name): Allow role_name the permission permission_name - def delete(self, role_name, permission_name): Disallow role_name the...
Implement the Python class `PermissionsRoleId` described below. Class description: Implement the PermissionsRoleId class. Method signatures and docstrings: - def put(self, role_name, permission_name): Allow role_name the permission permission_name - def delete(self, role_name, permission_name): Disallow role_name the...
c0de6442e1d7653fad824d75e571802a74eee605
<|skeleton|> class PermissionsRoleId: def put(self, role_name, permission_name): """Allow role_name the permission permission_name""" <|body_0|> def delete(self, role_name, permission_name): """Disallow role_name the permission permission_name""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PermissionsRoleId: def put(self, role_name, permission_name): """Allow role_name the permission permission_name""" sm = get_storage_manager() with sm.transaction(): role = sm.get(models.Role, None, filters={'name': role_name}) already_exists = models.Permission....
the_stack_v2_python_sparse
rest-service/manager_rest/rest/resources_v3_1/permissions.py
cloudify-cosmo/cloudify-manager
train
146
a00d5ddef611e1319e745dbe5ae4f910280cd417
[ "super(ClassificationHead, self).__init__()\nself.dense1 = PointNetDenseLayer(512, momentum)\nself.dense2 = PointNetDenseLayer(256, momentum)\nself.dropout = tf.keras.layers.Dropout(dropout_rate)\nself.dense3 = tf.keras.layers.Dense(num_classes, activation='linear')", "x = self.dense1(inputs, training)\nx = self....
<|body_start_0|> super(ClassificationHead, self).__init__() self.dense1 = PointNetDenseLayer(512, momentum) self.dense2 = PointNetDenseLayer(256, momentum) self.dropout = tf.keras.layers.Dropout(dropout_rate) self.dense3 = tf.keras.layers.Dense(num_classes, activation='linear') <...
The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.
ClassificationHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationHead: """The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.""" def __init__(self, num_classes: int=40, momen...
stack_v2_sparse_classes_10k_train_005960
9,332
permissive
[ { "docstring": "Constructor. Args: num_classes: the number of classes to classify. momentum: the momentum used for the batch normalization layer. dropout_rate: the dropout rate for fully connected layer", "name": "__init__", "signature": "def __init__(self, num_classes: int=40, momentum: float=0.5, drop...
2
stack_v2_sparse_classes_30k_train_001433
Implement the Python class `ClassificationHead` described below. Class description: The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes. Method signat...
Implement the Python class `ClassificationHead` described below. Class description: The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes. Method signat...
1b0203eb538f2b6a1013ec7736d0d548416f059a
<|skeleton|> class ClassificationHead: """The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.""" def __init__(self, num_classes: int=40, momen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassificationHead: """The PointNet classification head. The head consists of 2x PointNetDenseLayer layers (512 and 256 channels) followed by a dropout layer (drop rate=30%) a dense linear layer producing the logits of the num_classes classes.""" def __init__(self, num_classes: int=40, momentum: float=0....
the_stack_v2_python_sparse
tensorflow_graphics/nn/layer/pointnet.py
tensorflow/graphics
train
2,920
f88335f1626945df598ec5e619c88df3c14f83ef
[ "app = self.request.app\napp.logger.debug(f'Chat command {cmd}')\nif cmd == '/clear':\n await app.objects.execute(Message.delete().where(Message.room == self.room))\n app.logger.debug(f'Removed {count} messages')\n for peer in app.wslist[self.room.id].values():\n peer.send_json({'cmd': 'empty'})\nel...
<|body_start_0|> app = self.request.app app.logger.debug(f'Chat command {cmd}') if cmd == '/clear': await app.objects.execute(Message.delete().where(Message.room == self.room)) app.logger.debug(f'Removed {count} messages') for peer in app.wslist[self.room.id]....
Вспомогательный класс для всяких нужных методов для работы с вебсокетами, что бы не засорять хелпер
WebSocketMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebSocketMixin: """Вспомогательный класс для всяких нужных методов для работы с вебсокетами, что бы не засорять хелпер""" async def command_line(self, cmd: str) -> Dict[str, str]: """Некоторые управляющие команды""" <|body_0|> async def broadcast(self, message: Message) ...
stack_v2_sparse_classes_10k_train_005961
4,826
no_license
[ { "docstring": "Некоторые управляющие команды", "name": "command_line", "signature": "async def command_line(self, cmd: str) -> Dict[str, str]" }, { "docstring": "Рассылка сообщениий по всей комнате", "name": "broadcast", "signature": "async def broadcast(self, message: Message) -> None"...
2
stack_v2_sparse_classes_30k_train_002138
Implement the Python class `WebSocketMixin` described below. Class description: Вспомогательный класс для всяких нужных методов для работы с вебсокетами, что бы не засорять хелпер Method signatures and docstrings: - async def command_line(self, cmd: str) -> Dict[str, str]: Некоторые управляющие команды - async def br...
Implement the Python class `WebSocketMixin` described below. Class description: Вспомогательный класс для всяких нужных методов для работы с вебсокетами, что бы не засорять хелпер Method signatures and docstrings: - async def command_line(self, cmd: str) -> Dict[str, str]: Некоторые управляющие команды - async def br...
b7760f05e1d00f28a06b07bcd120c4af0237ce94
<|skeleton|> class WebSocketMixin: """Вспомогательный класс для всяких нужных методов для работы с вебсокетами, что бы не засорять хелпер""" async def command_line(self, cmd: str) -> Dict[str, str]: """Некоторые управляющие команды""" <|body_0|> async def broadcast(self, message: Message) ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WebSocketMixin: """Вспомогательный класс для всяких нужных методов для работы с вебсокетами, что бы не засорять хелпер""" async def command_line(self, cmd: str) -> Dict[str, str]: """Некоторые управляющие команды""" app = self.request.app app.logger.debug(f'Chat command {cmd}') ...
the_stack_v2_python_sparse
src/chat_take_aiohttp/web/chat_handlers.py
Tsvetov/chat_take_aiohttp
train
0
f258f0dd77fa1a80fae83317c33d2a91b673b9cb
[ "self.dic = collections.defaultdict(set)\nfor s in dictionary:\n key = s\n if len(s) > 2:\n key = s[0] + str(len(s) - 2) + s[-1]\n self.dic[key].add(s)", "key = word\nif len(key) > 2:\n key = word[0] + str(len(word) - 2) + word[-1]\nreturn len(self.dic[key]) == 0 or (len(self.dic[key]) == 1 and...
<|body_start_0|> self.dic = collections.defaultdict(set) for s in dictionary: key = s if len(s) > 2: key = s[0] + str(len(s) - 2) + s[-1] self.dic[key].add(s) <|end_body_0|> <|body_start_1|> key = word if len(key) > 2: key ...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_10k_train_005962
864
no_license
[ { "docstring": "initialize your data structure here. :type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": "check if a word is unique. :type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" ...
2
stack_v2_sparse_classes_30k_train_007341
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
024c1b5c98a9e85706e110fc2be8dcebf0f460c3
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" self.dic = collections.defaultdict(set) for s in dictionary: key = s if len(s) > 2: key = s[0] + str(len(s) - 2) + s[-1] ...
the_stack_v2_python_sparse
288.UniqueWordAbbreviation.py
yao9208/lc
train
0
4978fb5a079afb2dd6b06393d85195e21b6e5159
[ "app_id_list = get_cc_app_id_by_user()\nstart = self.request.query_params.get('start_time', None)\nstop = self.request.query_params.get('stop_time', None)\nif start and stop:\n return TaskRecord.objects.filter(app_id__in=app_id_list).filter(create_time__range=[start, stop]).order_by('-create_time')\nreturn TaskR...
<|body_start_0|> app_id_list = get_cc_app_id_by_user() start = self.request.query_params.get('start_time', None) stop = self.request.query_params.get('stop_time', None) if start and stop: return TaskRecord.objects.filter(app_id__in=app_id_list).filter(create_time__range=[star...
执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据
TaskRecordViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskRecordViewSet: """执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据""" def get_queryset(self): """重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离""" <|body_0|> def get_task_sum_group_by_db(self, request, *args, **kwargs): """输出各db组件的的执行记录数""" <|body_1|> def get_task(se...
stack_v2_sparse_classes_10k_train_005963
4,384
no_license
[ { "docstring": "重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "输出各db组件的的执行记录数", "name": "get_task_sum_group_by_db", "signature": "def get_task_sum_group_by_db(self, request, *args, **kwargs)" }, { "docstri...
4
stack_v2_sparse_classes_30k_train_004709
Implement the Python class `TaskRecordViewSet` described below. Class description: 执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据 Method signatures and docstrings: - def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离 - def get_task_sum_group_by_db(self, request, *args, **kwargs): 输出各db组件的的执行记录数 - def get_task(self, ...
Implement the Python class `TaskRecordViewSet` described below. Class description: 执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据 Method signatures and docstrings: - def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离 - def get_task_sum_group_by_db(self, request, *args, **kwargs): 输出各db组件的的执行记录数 - def get_task(self, ...
97cfac2ba94d67980d837f0b541caae70b68a595
<|skeleton|> class TaskRecordViewSet: """执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据""" def get_queryset(self): """重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离""" <|body_0|> def get_task_sum_group_by_db(self, request, *args, **kwargs): """输出各db组件的的执行记录数""" <|body_1|> def get_task(se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TaskRecordViewSet: """执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据""" def get_queryset(self): """重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离""" app_id_list = get_cc_app_id_by_user() start = self.request.query_params.get('start_time', None) stop = self.request.query_params.get('stop_time...
the_stack_v2_python_sparse
apps/globalview/views.py
sdgdsffdsfff/bk-dop
train
0
e12f36c4fdfe164205d9e207fee538cae27ef937
[ "self.command_output = ''\nself.browsers = []\nself.data = ''\nself.current_path = os.getcwd()", "ret_data = {'List of Installed Browsers': []}\nself.command_output = os.popen(\"apropos 'web browser'\").read()\nself.browsers = self.command_output.split('\\n')\nself.browsers.pop()\nself.browsers = [i[:i.find('(') ...
<|body_start_0|> self.command_output = '' self.browsers = [] self.data = '' self.current_path = os.getcwd() <|end_body_0|> <|body_start_1|> ret_data = {'List of Installed Browsers': []} self.command_output = os.popen("apropos 'web browser'").read() self.browsers ...
********* THIS SCRIPT RETURNS A LIST CONTAINING BROWSERS INSTALLED ON USER'S LINUX SYSTEM ********* CLASS get_browsers DOCINFO: get_browsers HAVE TWO FUNCTIONS I.E., 1) __init__ 2) work() __init__ DOCFILE: __init__ BLOCK SERVES THE INITIALIZATION FUNCTION, CONTAINING INITIALIZED VARIABLES WHICH IS GOING TO BE USED LATE...
get_browsers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class get_browsers: """********* THIS SCRIPT RETURNS A LIST CONTAINING BROWSERS INSTALLED ON USER'S LINUX SYSTEM ********* CLASS get_browsers DOCINFO: get_browsers HAVE TWO FUNCTIONS I.E., 1) __init__ 2) work() __init__ DOCFILE: __init__ BLOCK SERVES THE INITIALIZATION FUNCTION, CONTAINING INITIALIZED ...
stack_v2_sparse_classes_10k_train_005964
2,883
permissive
[ { "docstring": "__init__ DOCFILE: __init__ BLOCK SERVES THE INITIALIZATION FUNCTION, CONTAINING INITIALIZED VARIABLES WHICH IS GOING TO BE USED LATER BY OTHER MEMBER FUNCTION.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "WORK() DOCFILE: THE FUNCTION WORKS IN FOLLOWI...
2
stack_v2_sparse_classes_30k_train_003309
Implement the Python class `get_browsers` described below. Class description: ********* THIS SCRIPT RETURNS A LIST CONTAINING BROWSERS INSTALLED ON USER'S LINUX SYSTEM ********* CLASS get_browsers DOCINFO: get_browsers HAVE TWO FUNCTIONS I.E., 1) __init__ 2) work() __init__ DOCFILE: __init__ BLOCK SERVES THE INITIALIZ...
Implement the Python class `get_browsers` described below. Class description: ********* THIS SCRIPT RETURNS A LIST CONTAINING BROWSERS INSTALLED ON USER'S LINUX SYSTEM ********* CLASS get_browsers DOCINFO: get_browsers HAVE TWO FUNCTIONS I.E., 1) __init__ 2) work() __init__ DOCFILE: __init__ BLOCK SERVES THE INITIALIZ...
256149b6f22828ac668a68e8cac17f86925ccd5c
<|skeleton|> class get_browsers: """********* THIS SCRIPT RETURNS A LIST CONTAINING BROWSERS INSTALLED ON USER'S LINUX SYSTEM ********* CLASS get_browsers DOCINFO: get_browsers HAVE TWO FUNCTIONS I.E., 1) __init__ 2) work() __init__ DOCFILE: __init__ BLOCK SERVES THE INITIALIZATION FUNCTION, CONTAINING INITIALIZED ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class get_browsers: """********* THIS SCRIPT RETURNS A LIST CONTAINING BROWSERS INSTALLED ON USER'S LINUX SYSTEM ********* CLASS get_browsers DOCINFO: get_browsers HAVE TWO FUNCTIONS I.E., 1) __init__ 2) work() __init__ DOCFILE: __init__ BLOCK SERVES THE INITIALIZATION FUNCTION, CONTAINING INITIALIZED VARIABLES WHI...
the_stack_v2_python_sparse
lib/linux/get_browsers.py
chavarera/Cinfo
train
9
7dd716d0ff7099f1188f3fcf9610367c7c3ac02a
[ "self.Wz = np.random.normal(size=(i + h, h))\nself.Wr = np.random.normal(size=(i + h, h))\nself.Wh = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(h, o))\nself.bz = np.zeros((1, h))\nself.br = np.zeros((1, h))\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))", "U = np.hstack((h_prev, ...
<|body_start_0|> self.Wz = np.random.normal(size=(i + h, h)) self.Wr = np.random.normal(size=(i + h, h)) self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bz = np.zeros((1, h)) self.br = np.zeros((1, h)) self.bh = np.zeros((1...
GRU cell class
GRUCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRUCell: """GRU cell class""" def __init__(self, i, h, o): """Constructor""" <|body_0|> def forward(self, h_prev, x_t): """Method that performs forward propagation for one time step""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.Wz = np.ra...
stack_v2_sparse_classes_10k_train_005965
1,172
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "Method that performs forward propagation for one time step", "name": "forward", "signature": "def forward(self, h_prev, x_t)" } ]
2
stack_v2_sparse_classes_30k_train_003725
Implement the Python class `GRUCell` described below. Class description: GRU cell class Method signatures and docstrings: - def __init__(self, i, h, o): Constructor - def forward(self, h_prev, x_t): Method that performs forward propagation for one time step
Implement the Python class `GRUCell` described below. Class description: GRU cell class Method signatures and docstrings: - def __init__(self, i, h, o): Constructor - def forward(self, h_prev, x_t): Method that performs forward propagation for one time step <|skeleton|> class GRUCell: """GRU cell class""" d...
131be8fcf61aafb5a4ddc0b3853ba625560eb786
<|skeleton|> class GRUCell: """GRU cell class""" def __init__(self, i, h, o): """Constructor""" <|body_0|> def forward(self, h_prev, x_t): """Method that performs forward propagation for one time step""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GRUCell: """GRU cell class""" def __init__(self, i, h, o): """Constructor""" self.Wz = np.random.normal(size=(i + h, h)) self.Wr = np.random.normal(size=(i + h, h)) self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bz ...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/2-gru_cell.py
zahraaassaad/holbertonschool-machine_learning
train
1
11880cd44aa1d64196dce6fb7dd065e124fb4ef3
[ "if i == n:\n result.append(list(map(''.join, board)))\n return\nfor j in range(n):\n if j not in cols and j - i not in left_diags and (n - 1 - j - i not in right_diags):\n cols.add(j)\n left_diags.add(j - i)\n right_diags.add(n - 1 - j - i)\n board[i][j] = 'Q'\n self.fin...
<|body_start_0|> if i == n: result.append(list(map(''.join, board))) return for j in range(n): if j not in cols and j - i not in left_diags and (n - 1 - j - i not in right_diags): cols.add(j) left_diags.add(j - i) right_...
Short and optimized version of the above algorithm.
SolutionShort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionShort: """Short and optimized version of the above algorithm.""" def find_places(self, board, n, i, result, cols, left_diags, right_diags): """Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm.""" <|body_0|> d...
stack_v2_sparse_classes_10k_train_005966
5,871
no_license
[ { "docstring": "Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm.", "name": "find_places", "signature": "def find_places(self, board, n, i, result, cols, left_diags, right_diags)" }, { "docstring": "Returns a list of boards, where each board...
2
stack_v2_sparse_classes_30k_train_007322
Implement the Python class `SolutionShort` described below. Class description: Short and optimized version of the above algorithm. Method signatures and docstrings: - def find_places(self, board, n, i, result, cols, left_diags, right_diags): Finds all possible board n x n board combinations with n queens on it. Backt...
Implement the Python class `SolutionShort` described below. Class description: Short and optimized version of the above algorithm. Method signatures and docstrings: - def find_places(self, board, n, i, result, cols, left_diags, right_diags): Finds all possible board n x n board combinations with n queens on it. Backt...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class SolutionShort: """Short and optimized version of the above algorithm.""" def find_places(self, board, n, i, result, cols, left_diags, right_diags): """Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm.""" <|body_0|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SolutionShort: """Short and optimized version of the above algorithm.""" def find_places(self, board, n, i, result, cols, left_diags, right_diags): """Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm.""" if i == n: result....
the_stack_v2_python_sparse
Backtracking/n_queens.py
vladn90/Algorithms
train
0
a2c38667236635c3e06674c183b0a89060446ce8
[ "if n <= 0:\n return False\nn = math.log2(n)\nif n == int(n):\n return True\nreturn False", "if n <= 0:\n return False\nreturn not n & n - 1" ]
<|body_start_0|> if n <= 0: return False n = math.log2(n) if n == int(n): return True return False <|end_body_0|> <|body_start_1|> if n <= 0: return False return not n & n - 1 <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPowerOfTwo1(self, n): """:type n: int :rtype: bool""" <|body_0|> def isPowerOfTwo(self, n): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n <= 0: return False n = math.log2(n) ...
stack_v2_sparse_classes_10k_train_005967
560
no_license
[ { "docstring": ":type n: int :rtype: bool", "name": "isPowerOfTwo1", "signature": "def isPowerOfTwo1(self, n)" }, { "docstring": ":type n: int :rtype: bool", "name": "isPowerOfTwo", "signature": "def isPowerOfTwo(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfTwo1(self, n): :type n: int :rtype: bool - def isPowerOfTwo(self, n): :type n: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfTwo1(self, n): :type n: int :rtype: bool - def isPowerOfTwo(self, n): :type n: int :rtype: bool <|skeleton|> class Solution: def isPowerOfTwo1(self, n): ...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def isPowerOfTwo1(self, n): """:type n: int :rtype: bool""" <|body_0|> def isPowerOfTwo(self, n): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isPowerOfTwo1(self, n): """:type n: int :rtype: bool""" if n <= 0: return False n = math.log2(n) if n == int(n): return True return False def isPowerOfTwo(self, n): """:type n: int :rtype: bool""" if n <= 0: ...
the_stack_v2_python_sparse
python/leetcode/231_Power_of_Two.py
bobcaoge/my-code
train
0
deebaff45b12c9ca011e660f33feb8bfd5b7bb35
[ "develop.initialize_options(self)\nself.no_npm = None\nself.with_doc_deps = None\nself.use_npm_cache = None", "if self.no_deps:\n develop.install_for_development(self)\n return\nself._run_pip(['install', '-e', '.'])\nself._run_pip(['install', '-r', 'dev-requirements.txt'])\nif self.with_doc_deps:\n self....
<|body_start_0|> develop.initialize_options(self) self.no_npm = None self.with_doc_deps = None self.use_npm_cache = None <|end_body_0|> <|body_start_1|> if self.no_deps: develop.install_for_development(self) return self._run_pip(['install', '-e', ...
Installs Review Board in developer mode. This will install all standard and development dependencies (using Python wheels and node.js packages from npm) and add the source tree to the Python module search path. That includes updating the versions of pip and setuptools on the system. To speed up subsequent runs, callers...
DevelopCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DevelopCommand: """Installs Review Board in developer mode. This will install all standard and development dependencies (using Python wheels and node.js packages from npm) and add the source tree to the Python module search path. That includes updating the versions of pip and setuptools on the sy...
stack_v2_sparse_classes_10k_train_005968
14,185
permissive
[ { "docstring": "Initialize options for the command.", "name": "initialize_options", "signature": "def initialize_options(self)" }, { "docstring": "Install the package for development. This takes care of the work of installing all dependencies.", "name": "install_for_development", "signat...
3
null
Implement the Python class `DevelopCommand` described below. Class description: Installs Review Board in developer mode. This will install all standard and development dependencies (using Python wheels and node.js packages from npm) and add the source tree to the Python module search path. That includes updating the v...
Implement the Python class `DevelopCommand` described below. Class description: Installs Review Board in developer mode. This will install all standard and development dependencies (using Python wheels and node.js packages from npm) and add the source tree to the Python module search path. That includes updating the v...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class DevelopCommand: """Installs Review Board in developer mode. This will install all standard and development dependencies (using Python wheels and node.js packages from npm) and add the source tree to the Python module search path. That includes updating the versions of pip and setuptools on the sy...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DevelopCommand: """Installs Review Board in developer mode. This will install all standard and development dependencies (using Python wheels and node.js packages from npm) and add the source tree to the Python module search path. That includes updating the versions of pip and setuptools on the system. To spee...
the_stack_v2_python_sparse
setup.py
reviewboard/reviewboard
train
1,141
2238757765430213ab6e26b875d4e1ef3d185747
[ "if data is empty:\n return True\nreturn not any(json.loads(data).values())", "if self.is_empty_i18n_data(data) and self.required:\n self.fail('required')\nreturn super().validate_empty_values(data)" ]
<|body_start_0|> if data is empty: return True return not any(json.loads(data).values()) <|end_body_0|> <|body_start_1|> if self.is_empty_i18n_data(data) and self.required: self.fail('required') return super().validate_empty_values(data) <|end_body_1|>
I18nCharField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class I18nCharField: def is_empty_i18n_data(data): """check for values in each language empty value example: {"en":""}""" <|body_0|> def validate_empty_values(self, data): """Empty i18n fields have the following format: {"en":""}, we have to decode json and check empty str...
stack_v2_sparse_classes_10k_train_005969
759
no_license
[ { "docstring": "check for values in each language empty value example: {\"en\":\"\"}", "name": "is_empty_i18n_data", "signature": "def is_empty_i18n_data(data)" }, { "docstring": "Empty i18n fields have the following format: {\"en\":\"\"}, we have to decode json and check empty strings for langu...
2
stack_v2_sparse_classes_30k_train_002265
Implement the Python class `I18nCharField` described below. Class description: Implement the I18nCharField class. Method signatures and docstrings: - def is_empty_i18n_data(data): check for values in each language empty value example: {"en":""} - def validate_empty_values(self, data): Empty i18n fields have the follo...
Implement the Python class `I18nCharField` described below. Class description: Implement the I18nCharField class. Method signatures and docstrings: - def is_empty_i18n_data(data): check for values in each language empty value example: {"en":""} - def validate_empty_values(self, data): Empty i18n fields have the follo...
338fd6396dbdce971bc542718fbb9608bdcfc2a7
<|skeleton|> class I18nCharField: def is_empty_i18n_data(data): """check for values in each language empty value example: {"en":""}""" <|body_0|> def validate_empty_values(self, data): """Empty i18n fields have the following format: {"en":""}, we have to decode json and check empty str...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class I18nCharField: def is_empty_i18n_data(data): """check for values in each language empty value example: {"en":""}""" if data is empty: return True return not any(json.loads(data).values()) def validate_empty_values(self, data): """Empty i18n fields have the foll...
the_stack_v2_python_sparse
api/custom_fields.py
sai9912/mypyton
train
0
bd0abd8fbc0bbebdff3449441c30c40894361cae
[ "words.sort(key=len)\nwordset = set()\nres = []\n\ndef dfs(s, wset):\n if not wset:\n return False\n dp = {}\n\n def helper(s):\n if not s:\n return True\n if s in dp:\n return dp[s]\n for i in range(len(s)):\n if s[0:i + 1] in wset:\n ...
<|body_start_0|> words.sort(key=len) wordset = set() res = [] def dfs(s, wset): if not wset: return False dp = {} def helper(s): if not s: return True if s in dp: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findAllConcatenatedWordsInADict(self, words): """:type words: List[str] :rtype: List[str]""" <|body_0|> def findAllConcatenatedWordsInADictTLE(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> def findAllConcatenatedWo...
stack_v2_sparse_classes_10k_train_005970
3,879
no_license
[ { "docstring": ":type words: List[str] :rtype: List[str]", "name": "findAllConcatenatedWordsInADict", "signature": "def findAllConcatenatedWordsInADict(self, words)" }, { "docstring": ":type words: List[str] :rtype: List[str]", "name": "findAllConcatenatedWordsInADictTLE", "signature": "...
3
stack_v2_sparse_classes_30k_train_002846
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAllConcatenatedWordsInADict(self, words): :type words: List[str] :rtype: List[str] - def findAllConcatenatedWordsInADictTLE(self, words): :type words: List[str] :rtype: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAllConcatenatedWordsInADict(self, words): :type words: List[str] :rtype: List[str] - def findAllConcatenatedWordsInADictTLE(self, words): :type words: List[str] :rtype: L...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def findAllConcatenatedWordsInADict(self, words): """:type words: List[str] :rtype: List[str]""" <|body_0|> def findAllConcatenatedWordsInADictTLE(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> def findAllConcatenatedWo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findAllConcatenatedWordsInADict(self, words): """:type words: List[str] :rtype: List[str]""" words.sort(key=len) wordset = set() res = [] def dfs(s, wset): if not wset: return False dp = {} def helper(s...
the_stack_v2_python_sparse
C/ConcatenatedWords.py
bssrdf/pyleet
train
2
7be8667b460c88fb3cc502f3a9583e0b0f872255
[ "prefixs = collections.defaultdict(list)\nfor word in words:\n prefixs[word[0]].append(iter(word[1:]))\nfor c in S:\n for it in prefixs.pop(c, ()):\n prefixs[next(it, None)].append(it)\nreturn len(prefixs[None])", "def match(word):\n i, j = (len(S) - 1, len(word) - 1)\n while i >= 0 and j >= 0:...
<|body_start_0|> prefixs = collections.defaultdict(list) for word in words: prefixs[word[0]].append(iter(word[1:])) for c in S: for it in prefixs.pop(c, ()): prefixs[next(it, None)].append(it) return len(prefixs[None]) <|end_body_0|> <|body_start_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numMatchingSubseq(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_0|> def numMatchingSubseq_TLE(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_005971
2,891
no_license
[ { "docstring": ":type S: str :type words: List[str] :rtype: int", "name": "numMatchingSubseq", "signature": "def numMatchingSubseq(self, S, words)" }, { "docstring": ":type S: str :type words: List[str] :rtype: int", "name": "numMatchingSubseq_TLE", "signature": "def numMatchingSubseq_TL...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S, words): :type S: str :type words: List[str] :rtype: int - def numMatchingSubseq_TLE(self, S, words): :type S: str :type words: List[str] :rtype: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S, words): :type S: str :type words: List[str] :rtype: int - def numMatchingSubseq_TLE(self, S, words): :type S: str :type words: List[str] :rtype: in...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def numMatchingSubseq(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_0|> def numMatchingSubseq_TLE(self, S, words): """:type S: str :type words: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numMatchingSubseq(self, S, words): """:type S: str :type words: List[str] :rtype: int""" prefixs = collections.defaultdict(list) for word in words: prefixs[word[0]].append(iter(word[1:])) for c in S: for it in prefixs.pop(c, ()): ...
the_stack_v2_python_sparse
src/lt_792.py
oxhead/CodingYourWay
train
0
7bc1783af65e3191d92d49d03a6a53ff5acd504c
[ "super().__init__()\nself.dense_h_h4 = nn.Linear(n_hidden, n_hidden * 4)\nself.activation = nn.GELU()\nself.dense_h4_h = nn.Linear(n_hidden * 4, n_hidden)", "x = self.dense_h_h4(x)\nx = self.activation(x)\nx = self.dense_h4_h(x)\nreturn x" ]
<|body_start_0|> super().__init__() self.dense_h_h4 = nn.Linear(n_hidden, n_hidden * 4) self.activation = nn.GELU() self.dense_h4_h = nn.Linear(n_hidden * 4, n_hidden) <|end_body_0|> <|body_start_1|> x = self.dense_h_h4(x) x = self.activation(x) x = self.dense_h4...
## Feedforward Network
FFNLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FFNLayer: """## Feedforward Network""" def __init__(self, n_hidden: int=6144): """:param n_hidden: is the embedding size""" <|body_0|> def forward(self, x: torch.Tensor): """:param x: has shape `[batch_size, seq_len, n_hidden]`""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k_train_005972
13,522
no_license
[ { "docstring": ":param n_hidden: is the embedding size", "name": "__init__", "signature": "def __init__(self, n_hidden: int=6144)" }, { "docstring": ":param x: has shape `[batch_size, seq_len, n_hidden]`", "name": "forward", "signature": "def forward(self, x: torch.Tensor)" } ]
2
null
Implement the Python class `FFNLayer` described below. Class description: ## Feedforward Network Method signatures and docstrings: - def __init__(self, n_hidden: int=6144): :param n_hidden: is the embedding size - def forward(self, x: torch.Tensor): :param x: has shape `[batch_size, seq_len, n_hidden]`
Implement the Python class `FFNLayer` described below. Class description: ## Feedforward Network Method signatures and docstrings: - def __init__(self, n_hidden: int=6144): :param n_hidden: is the embedding size - def forward(self, x: torch.Tensor): :param x: has shape `[batch_size, seq_len, n_hidden]` <|skeleton|> ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class FFNLayer: """## Feedforward Network""" def __init__(self, n_hidden: int=6144): """:param n_hidden: is the embedding size""" <|body_0|> def forward(self, x: torch.Tensor): """:param x: has shape `[batch_size, seq_len, n_hidden]`""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FFNLayer: """## Feedforward Network""" def __init__(self, n_hidden: int=6144): """:param n_hidden: is the embedding size""" super().__init__() self.dense_h_h4 = nn.Linear(n_hidden, n_hidden * 4) self.activation = nn.GELU() self.dense_h4_h = nn.Linear(n_hidden * 4, ...
the_stack_v2_python_sparse
generated/test_labmlai_neox.py
jansel/pytorch-jit-paritybench
train
35
360d109e764ead839b15e772f7f034d271543b6c
[ "serializer = self.get_serializer(data=self.clean_data(request.data))\nserializer.is_valid(raise_exception=True)\nself.perform_create(serializer)\nheaders = self.get_success_headers(serializer.data)\nreturn Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)", "partial = kwargs.pop('partial...
<|body_start_0|> serializer = self.get_serializer(data=self.clean_data(request.data)) serializer.is_valid(raise_exception=True) self.perform_create(serializer) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=status.HTTP_201_CREATED, hea...
Model mixin class which cleans inputs using the Mozilla bleach tools.
CleanMixin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CleanMixin: """Model mixin class which cleans inputs using the Mozilla bleach tools.""" def create(self, request, *args, **kwargs): """Override to clean data before processing it.""" <|body_0|> def update(self, request, *args, **kwargs): """Override to clean data...
stack_v2_sparse_classes_10k_train_005973
6,138
permissive
[ { "docstring": "Override to clean data before processing it.", "name": "create", "signature": "def create(self, request, *args, **kwargs)" }, { "docstring": "Override to clean data before processing it.", "name": "update", "signature": "def update(self, request, *args, **kwargs)" }, ...
4
null
Implement the Python class `CleanMixin` described below. Class description: Model mixin class which cleans inputs using the Mozilla bleach tools. Method signatures and docstrings: - def create(self, request, *args, **kwargs): Override to clean data before processing it. - def update(self, request, *args, **kwargs): O...
Implement the Python class `CleanMixin` described below. Class description: Model mixin class which cleans inputs using the Mozilla bleach tools. Method signatures and docstrings: - def create(self, request, *args, **kwargs): Override to clean data before processing it. - def update(self, request, *args, **kwargs): O...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class CleanMixin: """Model mixin class which cleans inputs using the Mozilla bleach tools.""" def create(self, request, *args, **kwargs): """Override to clean data before processing it.""" <|body_0|> def update(self, request, *args, **kwargs): """Override to clean data...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CleanMixin: """Model mixin class which cleans inputs using the Mozilla bleach tools.""" def create(self, request, *args, **kwargs): """Override to clean data before processing it.""" serializer = self.get_serializer(data=self.clean_data(request.data)) serializer.is_valid(raise_exc...
the_stack_v2_python_sparse
InvenTree/InvenTree/mixins.py
inventree/InvenTree
train
3,077
c5afd837def6a6ec93ab77a5746a49b3d3ffd86d
[ "assert padding in ['SAME', 'VALID', 'REFLECT'], 'Error: unsupported padding'\nself._padding = padding\nwith tf.variable_scope(name):\n if isinstance(stride, int):\n stride = [1, stride, stride, 1]\n else:\n assert len(stride) == 0, 'stride is either an int or a 2-tuple'\n stride = [1, st...
<|body_start_0|> assert padding in ['SAME', 'VALID', 'REFLECT'], 'Error: unsupported padding' self._padding = padding with tf.variable_scope(name): if isinstance(stride, int): stride = [1, stride, stride, 1] else: assert len(stride) == 0, '...
Convolution layer with support for equalized learning.
LayerConv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerConv: """Convolution layer with support for equalized learning.""" def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. w: int o...
stack_v2_sparse_classes_10k_train_005974
13,442
permissive
[ { "docstring": "Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. w: int or 2-tuple, width of the convolution kernel. n: 2-tuple of ints, input and output channel depths. padding: string, the padding method. {SAME, VALID, REFLECT}. use_scaling: bool, w...
2
stack_v2_sparse_classes_30k_train_005948
Implement the Python class `LayerConv` described below. Class description: Convolution layer with support for equalized learning. Method signatures and docstrings: - def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): Layer constructor. Args: name: string, layer name. stride: in...
Implement the Python class `LayerConv` described below. Class description: Convolution layer with support for equalized learning. Method signatures and docstrings: - def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): Layer constructor. Args: name: string, layer name. stride: in...
091d6ae9e087cf5a6e18b00bce7d8f7ede9d9d08
<|skeleton|> class LayerConv: """Convolution layer with support for equalized learning.""" def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. w: int o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LayerConv: """Convolution layer with support for equalized learning.""" def __init__(self, name, w, n, stride, padding='SAME', use_scaling=False, relu_slope=1.0): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. w: int or 2-tuple, wi...
the_stack_v2_python_sparse
layers.py
MoustafaMeshry/StEP
train
6
c7f289f030458cc4a3f694f93b361fc691f606ff
[ "tofAxis = timeHistogram.axisFromName('tof')\ntofVector = tofAxis.storage()\nenergyAxis = energyHistogram.axisFromName('energy')\nenergyVector = energyAxis.storage()\nself._calcor(pixelDist, tofVector, energyVector)\nreturn", "from reduction.vectorCompat.EBinCalcor import EBinCalcor\nself._calcor = EBinCalcor(dat...
<|body_start_0|> tofAxis = timeHistogram.axisFromName('tof') tofVector = tofAxis.storage() energyAxis = energyHistogram.axisFromName('energy') energyVector = energyAxis.storage() self._calcor(pixelDist, tofVector, energyVector) return <|end_body_0|> <|body_start_1|> ...
energy bin calculator calculate energy bins out of tof bins
EBinCalcor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EBinCalcor: """energy bin calculator calculate energy bins out of tof bins""" def __call__(self, pixelDist, timeHistogram, energyHistogram): """ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel dist...
stack_v2_sparse_classes_10k_train_005975
2,138
no_license
[ { "docstring": "ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel distance and histogram with tof axis. inputs: pixelDist: distance from sample to pixel (float) timeHistogram (instance of Histogram with axis \"tof\") energyHis...
2
null
Implement the Python class `EBinCalcor` described below. Class description: energy bin calculator calculate energy bins out of tof bins Method signatures and docstrings: - def __call__(self, pixelDist, timeHistogram, energyHistogram): ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin b...
Implement the Python class `EBinCalcor` described below. Class description: energy bin calculator calculate energy bins out of tof bins Method signatures and docstrings: - def __call__(self, pixelDist, timeHistogram, energyHistogram): ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin b...
7ba4ce07a5a4645942192b4b81f7afcae505db90
<|skeleton|> class EBinCalcor: """energy bin calculator calculate energy bins out of tof bins""" def __call__(self, pixelDist, timeHistogram, energyHistogram): """ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel dist...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EBinCalcor: """energy bin calculator calculate energy bins out of tof bins""" def __call__(self, pixelDist, timeHistogram, energyHistogram): """ebincalcor( pixelDist, tBinBoundsVec, eBinBoundsVec) -> None Calculate energy bin boundaries for histogram with energy axis given pixel distance and hist...
the_stack_v2_python_sparse
histogrammode/reduction/histCompat/EBinCalcor.py
danse-inelastic/DrChops
train
0
59ed44b3400534bd42e93de074e2aed52fbf383a
[ "self.cluster_info = cluster_info\nself.collection_info = collection_info\nself.database_info = database_info\nself.name = name\nself.mtype = mtype\nself.uuid = uuid", "if dictionary is None:\n return None\ncluster_info = cohesity_management_sdk.models.mongo_db_cluster.MongoDBCluster.from_dictionary(dictionary...
<|body_start_0|> self.cluster_info = cluster_info self.collection_info = collection_info self.database_info = database_info self.name = name self.mtype = mtype self.uuid = uuid <|end_body_0|> <|body_start_1|> if dictionary is None: return None ...
Implementation of the 'MongoDBProtectionSource' model. Specifies an Object representing MongoDB. Attributes: cluster_info (MongoDBCluster): Information of a mongodb cluster, only valid for an entity of type kCluster. collection_info (MongoDBCollection): Information about a mongodb collection, only valid for an entity o...
MongoDBProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MongoDBProtectionSource: """Implementation of the 'MongoDBProtectionSource' model. Specifies an Object representing MongoDB. Attributes: cluster_info (MongoDBCluster): Information of a mongodb cluster, only valid for an entity of type kCluster. collection_info (MongoDBCollection): Information abo...
stack_v2_sparse_classes_10k_train_005976
3,661
permissive
[ { "docstring": "Constructor for the MongoDBProtectionSource class", "name": "__init__", "signature": "def __init__(self, cluster_info=None, collection_info=None, database_info=None, name=None, mtype=None, uuid=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: di...
2
null
Implement the Python class `MongoDBProtectionSource` described below. Class description: Implementation of the 'MongoDBProtectionSource' model. Specifies an Object representing MongoDB. Attributes: cluster_info (MongoDBCluster): Information of a mongodb cluster, only valid for an entity of type kCluster. collection_in...
Implement the Python class `MongoDBProtectionSource` described below. Class description: Implementation of the 'MongoDBProtectionSource' model. Specifies an Object representing MongoDB. Attributes: cluster_info (MongoDBCluster): Information of a mongodb cluster, only valid for an entity of type kCluster. collection_in...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MongoDBProtectionSource: """Implementation of the 'MongoDBProtectionSource' model. Specifies an Object representing MongoDB. Attributes: cluster_info (MongoDBCluster): Information of a mongodb cluster, only valid for an entity of type kCluster. collection_info (MongoDBCollection): Information abo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MongoDBProtectionSource: """Implementation of the 'MongoDBProtectionSource' model. Specifies an Object representing MongoDB. Attributes: cluster_info (MongoDBCluster): Information of a mongodb cluster, only valid for an entity of type kCluster. collection_info (MongoDBCollection): Information about a mongodb ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/mongo_db_protection_source.py
cohesity/management-sdk-python
train
24
93cc5b0bea185453dfe6b0eb4d22455884e07111
[ "my_employee = Employee('justin', 'williams', 80000)\nmy_employee.format_name_salary()\nself.assertEqual(my_employee.format_name_salary(), 'Justin Williams 80000')", "my_employee = Employee('justin', 'williams', 80000)\nmy_employee.give_raise()\nself.assertEqual(my_employee.salary, 85000)", "my_employee = Emplo...
<|body_start_0|> my_employee = Employee('justin', 'williams', 80000) my_employee.format_name_salary() self.assertEqual(my_employee.format_name_salary(), 'Justin Williams 80000') <|end_body_0|> <|body_start_1|> my_employee = Employee('justin', 'williams', 80000) my_employee.give_...
Tests for the class Employee
TestEmployee
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEmployee: """Tests for the class Employee""" def test_format_name_salary(self): """Tests if name and salary are formatted corrctly""" <|body_0|> def test_give_default_raise(self): """Tests if default raise works""" <|body_1|> def test_give_custom...
stack_v2_sparse_classes_10k_train_005977
1,428
no_license
[ { "docstring": "Tests if name and salary are formatted corrctly", "name": "test_format_name_salary", "signature": "def test_format_name_salary(self)" }, { "docstring": "Tests if default raise works", "name": "test_give_default_raise", "signature": "def test_give_default_raise(self)" },...
3
stack_v2_sparse_classes_30k_train_000738
Implement the Python class `TestEmployee` described below. Class description: Tests for the class Employee Method signatures and docstrings: - def test_format_name_salary(self): Tests if name and salary are formatted corrctly - def test_give_default_raise(self): Tests if default raise works - def test_give_custom_rai...
Implement the Python class `TestEmployee` described below. Class description: Tests for the class Employee Method signatures and docstrings: - def test_format_name_salary(self): Tests if name and salary are formatted corrctly - def test_give_default_raise(self): Tests if default raise works - def test_give_custom_rai...
77ecd59829324807279bb0abd06f55c322dbf328
<|skeleton|> class TestEmployee: """Tests for the class Employee""" def test_format_name_salary(self): """Tests if name and salary are formatted corrctly""" <|body_0|> def test_give_default_raise(self): """Tests if default raise works""" <|body_1|> def test_give_custom...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestEmployee: """Tests for the class Employee""" def test_format_name_salary(self): """Tests if name and salary are formatted corrctly""" my_employee = Employee('justin', 'williams', 80000) my_employee.format_name_salary() self.assertEqual(my_employee.format_name_salary(),...
the_stack_v2_python_sparse
chp11/test_employee.py
justinm0rgan/python_work
train
0
287e0a912440098489d420c807f79bae48e26798
[ "lHead, lTail, rHead, rTail = (None, None, None, None)\nwhile head:\n if head.val < x:\n if lHead == None:\n lHead = head\n lTail = head\n else:\n lTail.next = head\n lTail = lTail.next\n elif rHead == None:\n rHead = head\n rTail = head\...
<|body_start_0|> lHead, lTail, rHead, rTail = (None, None, None, None) while head: if head.val < x: if lHead == None: lHead = head lTail = head else: lTail.next = head lTail = lTai...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def partition(self, head, x): """:type head: ListNode :type x: int :rtype: ListNode""" <|body_0|> def partition2(self, head, x): """:type head: ListNode :type x: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> lHead, l...
stack_v2_sparse_classes_10k_train_005978
1,836
no_license
[ { "docstring": ":type head: ListNode :type x: int :rtype: ListNode", "name": "partition", "signature": "def partition(self, head, x)" }, { "docstring": ":type head: ListNode :type x: int :rtype: ListNode", "name": "partition2", "signature": "def partition2(self, head, x)" } ]
2
stack_v2_sparse_classes_30k_train_000562
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode - def partition2(self, head, x): :type head: ListNode :type x: int :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode - def partition2(self, head, x): :type head: ListNode :type x: int :rtype: ListNode <|skeleton|>...
ab49373ff3fc306a03a90de02e1801b8cbe520d7
<|skeleton|> class Solution: def partition(self, head, x): """:type head: ListNode :type x: int :rtype: ListNode""" <|body_0|> def partition2(self, head, x): """:type head: ListNode :type x: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def partition(self, head, x): """:type head: ListNode :type x: int :rtype: ListNode""" lHead, lTail, rHead, rTail = (None, None, None, None) while head: if head.val < x: if lHead == None: lHead = head lTail =...
the_stack_v2_python_sparse
explore/list/086.py
yiguid/LeetCodePractise
train
0
956f9e60f465d4f1a98167191b3b818c37ad776d
[ "super().__init__(*args, **kwargs)\nif ext_args == {}:\n self._freq = 1\nelse:\n self._freq = ext_args.freq", "if engine.rank != 0:\n for k in engine.log_buffer:\n engine.log_buffer[k].clear()\n return\nfor k, v in engine.log_buffer['scalar'].items():\n setattr(engine.monitor, k, v)\nengine....
<|body_start_0|> super().__init__(*args, **kwargs) if ext_args == {}: self._freq = 1 else: self._freq = ext_args.freq <|end_body_0|> <|body_start_1|> if engine.rank != 0: for k in engine.log_buffer: engine.log_buffer[k].clear() ...
Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position
LogShowHook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogShowHook: """Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_ar...
stack_v2_sparse_classes_10k_train_005979
15,244
permissive
[ { "docstring": "Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.freq to set freq", "name": "__init__", "signature": "def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None" }, { "docstring": "Overview: Show log, update record an...
2
null
Implement the Python class `LogShowHook` described below. Class description: Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position Method signatures and docstrings: - def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init LogShowHook Arguments...
Implement the Python class `LogShowHook` described below. Class description: Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position Method signatures and docstrings: - def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init LogShowHook Arguments...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class LogShowHook: """Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_ar...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LogShowHook: """Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.freq to se...
the_stack_v2_python_sparse
ding/worker/learner/learner_hook.py
shengxuesun/DI-engine
train
1
a393bf71ef60f5cec5577944e7b7debde696ad99
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('CancelTask', params, headers=headers)\n response = json.loads(body)\n model = models.CancelTaskResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as e:\n if isinstance(e,...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('CancelTask', params, headers=headers) response = json.loads(body) model = models.CancelTaskResponse() model._deserialize(response['Response']) ...
VmClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VmClient: def CancelTask(self, request): """可使用该接口取消审核任务,成功取消后,该接口返回已取消任务的TaskId。<br> 默认接口请求频率限制:**20次/秒**。 :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20201229.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20201229.models.CancelT...
stack_v2_sparse_classes_10k_train_005980
9,114
permissive
[ { "docstring": "可使用该接口取消审核任务,成功取消后,该接口返回已取消任务的TaskId。<br> 默认接口请求频率限制:**20次/秒**。 :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20201229.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20201229.models.CancelTaskResponse`", "name": "CancelTask", "signat...
4
null
Implement the Python class `VmClient` described below. Class description: Implement the VmClient class. Method signatures and docstrings: - def CancelTask(self, request): 可使用该接口取消审核任务,成功取消后,该接口返回已取消任务的TaskId。<br> 默认接口请求频率限制:**20次/秒**。 :param request: Request instance for CancelTask. :type request: :class:`tencentclou...
Implement the Python class `VmClient` described below. Class description: Implement the VmClient class. Method signatures and docstrings: - def CancelTask(self, request): 可使用该接口取消审核任务,成功取消后,该接口返回已取消任务的TaskId。<br> 默认接口请求频率限制:**20次/秒**。 :param request: Request instance for CancelTask. :type request: :class:`tencentclou...
6baf00a5a56ba58b6a1123423e0a1422d17a0201
<|skeleton|> class VmClient: def CancelTask(self, request): """可使用该接口取消审核任务,成功取消后,该接口返回已取消任务的TaskId。<br> 默认接口请求频率限制:**20次/秒**。 :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20201229.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20201229.models.CancelT...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VmClient: def CancelTask(self, request): """可使用该接口取消审核任务,成功取消后,该接口返回已取消任务的TaskId。<br> 默认接口请求频率限制:**20次/秒**。 :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20201229.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20201229.models.CancelTaskResponse`""...
the_stack_v2_python_sparse
tencentcloud/vm/v20201229/vm_client.py
TencentCloud/tencentcloud-sdk-python
train
594
0ec9cdf1b298f5e9f5fb1e95d35e7630cc30a3c1
[ "super().__init__(input_size=input_size, hidden_size=hidden_size, bias=bias)\nassert 0 <= dropout <= 1, 'Dropout rate must be in the range [0, 1]'\nassert 0 <= recurrent_dropout <= 1, 'Dropout rate must be in the range [0, 1]'\nself._dropout = dropout\nself._recurrent_dropout = recurrent_dropout", "if hx is None:...
<|body_start_0|> super().__init__(input_size=input_size, hidden_size=hidden_size, bias=bias) assert 0 <= dropout <= 1, 'Dropout rate must be in the range [0, 1]' assert 0 <= recurrent_dropout <= 1, 'Dropout rate must be in the range [0, 1]' self._dropout = dropout self._recurrent...
A wrapper around torch.nn.GRUCell that adds dropout to inputs and hidden. This wrapper makes the implementation more in-line with that of tf.keras.layers.GRUCell It doesn't accomplish it entirely, because: 1) the base GRU cell is different (the ordering of when the reset gate is applied is different between torch and t...
DropoutGRUCell
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DropoutGRUCell: """A wrapper around torch.nn.GRUCell that adds dropout to inputs and hidden. This wrapper makes the implementation more in-line with that of tf.keras.layers.GRUCell It doesn't accomplish it entirely, because: 1) the base GRU cell is different (the ordering of when the reset gate i...
stack_v2_sparse_classes_10k_train_005981
20,187
permissive
[ { "docstring": "Args: input_size: Dimensionality of the input to the GRUCell hidden_size: Dimensionality of the hidden dimension of the GRUCell bias (optional): If False, then the layer does not use bias weights b_ih and b_hh. Defaults to True. dropout (optional): Fraction of the units to drop for the linear tr...
2
stack_v2_sparse_classes_30k_train_004241
Implement the Python class `DropoutGRUCell` described below. Class description: A wrapper around torch.nn.GRUCell that adds dropout to inputs and hidden. This wrapper makes the implementation more in-line with that of tf.keras.layers.GRUCell It doesn't accomplish it entirely, because: 1) the base GRU cell is different...
Implement the Python class `DropoutGRUCell` described below. Class description: A wrapper around torch.nn.GRUCell that adds dropout to inputs and hidden. This wrapper makes the implementation more in-line with that of tf.keras.layers.GRUCell It doesn't accomplish it entirely, because: 1) the base GRU cell is different...
8fa75e67c0db8f632b135379740051cd10ff31f2
<|skeleton|> class DropoutGRUCell: """A wrapper around torch.nn.GRUCell that adds dropout to inputs and hidden. This wrapper makes the implementation more in-line with that of tf.keras.layers.GRUCell It doesn't accomplish it entirely, because: 1) the base GRU cell is different (the ordering of when the reset gate i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DropoutGRUCell: """A wrapper around torch.nn.GRUCell that adds dropout to inputs and hidden. This wrapper makes the implementation more in-line with that of tf.keras.layers.GRUCell It doesn't accomplish it entirely, because: 1) the base GRU cell is different (the ordering of when the reset gate is applied is ...
the_stack_v2_python_sparse
rlo/src/rlo/model/layers.py
tomjaguarpaw/knossos-ksc
train
0
9dff19832ffc2e73d7da91c593a43dbae11123fd
[ "super(LSTMAttention, self).__init__()\nself.input_size = input_size\nself.hidden_size = hidden_size\nself.batch_first = batch_first\nself.lstm_cell = nn.LSTMCell(input_size, hidden_size)\nif attn_type == 'soft':\n self.attention_layer = SoftDotAttention(hidden_size)\nelif attn_type == 'mlp':\n self.attention...
<|body_start_0|> super(LSTMAttention, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.batch_first = batch_first self.lstm_cell = nn.LSTMCell(input_size, hidden_size) if attn_type == 'soft': self.attention_layer = SoftDotAttent...
A long short-term memory (LSTM) cell with attention.
LSTMAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMAttention: """A long short-term memory (LSTM) cell with attention.""" def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): """Initialize params.""" <|body_0|> def forward(self, input, hidden, ctx, ctx_mask=None, return_logattn=False): ...
stack_v2_sparse_classes_10k_train_005982
8,483
permissive
[ { "docstring": "Initialize params.", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft')" }, { "docstring": "Propagate input through the network.", "name": "forward", "signature": "def forward(self, input, hidden, ctx, ctx_mas...
2
stack_v2_sparse_classes_30k_train_007308
Implement the Python class `LSTMAttention` described below. Class description: A long short-term memory (LSTM) cell with attention. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): Initialize params. - def forward(self, input, hidden, ctx, ctx_mask=N...
Implement the Python class `LSTMAttention` described below. Class description: A long short-term memory (LSTM) cell with attention. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): Initialize params. - def forward(self, input, hidden, ctx, ctx_mask=N...
c530c9af647d521262b56b717bcc38b0cfc5f1b8
<|skeleton|> class LSTMAttention: """A long short-term memory (LSTM) cell with attention.""" def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): """Initialize params.""" <|body_0|> def forward(self, input, hidden, ctx, ctx_mask=None, return_logattn=False): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LSTMAttention: """A long short-term memory (LSTM) cell with attention.""" def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): """Initialize params.""" super(LSTMAttention, self).__init__() self.input_size = input_size self.hidden_size = hidden_...
the_stack_v2_python_sparse
stanza/models/common/seq2seq_modules.py
stanfordnlp/stanza
train
4,281
863ec30c381cea0e13045bab89b662271773de83
[ "self._text_maze = text_maze\nself._wall_char = wall_char\nself._make_odd_sized_walls = make_odd_sized_walls\nself._covered = np.full(text_maze.shape, False, dtype=np.bool)\nself._maze_size = GridCoordinates(*text_maze.shape)\nself._next_start = GridCoordinates(0, 0)\nself._calculated = False\nself._walls = ()", ...
<|body_start_0|> self._text_maze = text_maze self._wall_char = wall_char self._make_odd_sized_walls = make_odd_sized_walls self._covered = np.full(text_maze.shape, False, dtype=np.bool) self._maze_size = GridCoordinates(*text_maze.shape) self._next_start = GridCoordinates...
Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a significantly smaller number of geoms than if each cell ...
_MazeWallCoveringContext
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _MazeWallCoveringContext: """Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a sign...
stack_v2_sparse_classes_10k_train_005983
5,466
permissive
[ { "docstring": "Initializes this _MazeWallCoveringContext. Args: text_maze: A `labmaze.TextGrid` instance. wall_char: (optional) The character that signifies a wall. make_odd_sized_walls: (optional) A boolean, if `True` all wall sections generated span odd numbers of grid cells. This option exists primarily to ...
5
stack_v2_sparse_classes_30k_train_004801
Implement the Python class `_MazeWallCoveringContext` described below. Class description: Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, bu...
Implement the Python class `_MazeWallCoveringContext` described below. Class description: Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, bu...
33d3ea2682409ee82bf9c5129ceaf06ab01cd48e
<|skeleton|> class _MazeWallCoveringContext: """Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a sign...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _MazeWallCoveringContext: """Calculates a covering of text mazes with overlapping rectangular walls. This class uses a greedy algorithm to try and minimize the number of geoms generated to create a given maze. The solution is not guaranteed to be optimal, but in most cases should result in a significantly sma...
the_stack_v2_python_sparse
src/env/dm_control/dm_control/locomotion/arenas/covering.py
nicklashansen/svea-vit
train
16
6a9a6ac588b3fbdf635e50e4e09503872308054c
[ "tokens = self.input.split(' ', 2)\nif not self.bot.callsign in tokens[0].lower():\n return False\ntry:\n command = tokens[1].lower()\nexcept IndexError:\n return False\nif not command:\n return False\ntry:\n argument = tokens[2]\nexcept IndexError:\n argument = ''\ntry:\n f = getattr(self, 'cm...
<|body_start_0|> tokens = self.input.split(' ', 2) if not self.bot.callsign in tokens[0].lower(): return False try: command = tokens[1].lower() except IndexError: return False if not command: return False try: ar...
Base class to process IRC events containing commands to the bot. Events that get handled is in the formats: `bot_name command [argument]` for channel messages, `command [argument]` for private ones. Read on BaseContext's .send() for how you should send back text. Usage: ------ You shouldn't need to override any of the ...
BaseCommandContext
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseCommandContext: """Base class to process IRC events containing commands to the bot. Events that get handled is in the formats: `bot_name command [argument]` for channel messages, `command [argument]` for private ones. Read on BaseContext's .send() for how you should send back text. Usage: ---...
stack_v2_sparse_classes_10k_train_005984
8,615
permissive
[ { "docstring": "Dispatch a public event to a cmd__public or cmd_ method", "name": "do_public", "signature": "def do_public(self)" }, { "docstring": "Dispatch a private event to a cmd__private or cmd_ method", "name": "do_private", "signature": "def do_private(self)" } ]
2
stack_v2_sparse_classes_30k_train_006858
Implement the Python class `BaseCommandContext` described below. Class description: Base class to process IRC events containing commands to the bot. Events that get handled is in the formats: `bot_name command [argument]` for channel messages, `command [argument]` for private ones. Read on BaseContext's .send() for ho...
Implement the Python class `BaseCommandContext` described below. Class description: Base class to process IRC events containing commands to the bot. Events that get handled is in the formats: `bot_name command [argument]` for channel messages, `command [argument]` for private ones. Read on BaseContext's .send() for ho...
61d97a7255300ddc0b3067cd2da43e059d48600e
<|skeleton|> class BaseCommandContext: """Base class to process IRC events containing commands to the bot. Events that get handled is in the formats: `bot_name command [argument]` for channel messages, `command [argument]` for private ones. Read on BaseContext's .send() for how you should send back text. Usage: ---...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseCommandContext: """Base class to process IRC events containing commands to the bot. Events that get handled is in the formats: `bot_name command [argument]` for channel messages, `command [argument]` for private ones. Read on BaseContext's .send() for how you should send back text. Usage: ------ You shoul...
the_stack_v2_python_sparse
src/modules/basemodule.py
nickraptis/fidibot
train
0
a7b8fd4e6774328310b57477e1679f2c9ad9b88c
[ "indices = [1, 2, 3]\nK = 2\nresult = k_folds(indices, K)\nexpected = [[2, 3], [1], [3], [1, 2]]\nself.assertEqual(result, expected)", "indices = [1, 2, 3, 4, 5]\nK = 3\nresult = k_folds(indices, K)\nexpected = [[1, 2], [3, 4, 5], [3, 4], [1, 2, 5], [5], [1, 2, 3, 4]]\nself.assertEqual(result, expected)" ]
<|body_start_0|> indices = [1, 2, 3] K = 2 result = k_folds(indices, K) expected = [[2, 3], [1], [3], [1, 2]] self.assertEqual(result, expected) <|end_body_0|> <|body_start_1|> indices = [1, 2, 3, 4, 5] K = 3 result = k_folds(indices, K) expected ...
Test cases that helped validating the solution.
TestSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSolution: """Test cases that helped validating the solution.""" def test_solution_k_2(self): """Simple test case K = 2.""" <|body_0|> def test_solution_k_3(self): """Simple test case K = 3.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ind...
stack_v2_sparse_classes_10k_train_005985
1,472
no_license
[ { "docstring": "Simple test case K = 2.", "name": "test_solution_k_2", "signature": "def test_solution_k_2(self)" }, { "docstring": "Simple test case K = 3.", "name": "test_solution_k_3", "signature": "def test_solution_k_3(self)" } ]
2
stack_v2_sparse_classes_30k_train_003237
Implement the Python class `TestSolution` described below. Class description: Test cases that helped validating the solution. Method signatures and docstrings: - def test_solution_k_2(self): Simple test case K = 2. - def test_solution_k_3(self): Simple test case K = 3.
Implement the Python class `TestSolution` described below. Class description: Test cases that helped validating the solution. Method signatures and docstrings: - def test_solution_k_2(self): Simple test case K = 2. - def test_solution_k_3(self): Simple test case K = 3. <|skeleton|> class TestSolution: """Test ca...
712508a79f9620b7b9ab75ef51000efbad387e18
<|skeleton|> class TestSolution: """Test cases that helped validating the solution.""" def test_solution_k_2(self): """Simple test case K = 2.""" <|body_0|> def test_solution_k_3(self): """Simple test case K = 3.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSolution: """Test cases that helped validating the solution.""" def test_solution_k_2(self): """Simple test case K = 2.""" indices = [1, 2, 3] K = 2 result = k_folds(indices, K) expected = [[2, 3], [1], [3], [1, 2]] self.assertEqual(result, expected) ...
the_stack_v2_python_sparse
code-questions/kfolds.py
fberanizo/mle-interview
train
1
e3040cef11a8a41dc73c20b319768b85ac1f5024
[ "for v in variables:\n if v.systematics_funcs == 'suffix':\n v.fillSystematicsSuffix(systematics)\nself.variables_dict = OrderedDict([(v.name, v) for v in variables])", "ret = OrderedDict()\nfor vname, v in self.variables_dict.items():\n if schema in v.schema:\n ret[vname] = v.getValue(event, ...
<|body_start_0|> for v in variables: if v.systematics_funcs == 'suffix': v.fillSystematicsSuffix(systematics) self.variables_dict = OrderedDict([(v.name, v) for v in variables]) <|end_body_0|> <|body_start_1|> ret = OrderedDict() for vname, v in self.variable...
Event description with varying systematics Attributes: variables_dict (dict of string->Var): Variables in the event
Desc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Desc: """Event description with varying systematics Attributes: variables_dict (dict of string->Var): Variables in the event""" def __init__(self, systematics, variables=[]): """Creates the event description based on a list of variables Args: systematics (list of string): systematics...
stack_v2_sparse_classes_10k_train_005986
34,880
no_license
[ { "docstring": "Creates the event description based on a list of variables Args: systematics (list of string): systematics to use for variable lookup variables (list, optional): Variables to use", "name": "__init__", "signature": "def __init__(self, systematics, variables=[])" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_005485
Implement the Python class `Desc` described below. Class description: Event description with varying systematics Attributes: variables_dict (dict of string->Var): Variables in the event Method signatures and docstrings: - def __init__(self, systematics, variables=[]): Creates the event description based on a list of ...
Implement the Python class `Desc` described below. Class description: Event description with varying systematics Attributes: variables_dict (dict of string->Var): Variables in the event Method signatures and docstrings: - def __init__(self, systematics, variables=[]): Creates the event description based on a list of ...
d33786f405792cafee22658b40d04f59e37f799b
<|skeleton|> class Desc: """Event description with varying systematics Attributes: variables_dict (dict of string->Var): Variables in the event""" def __init__(self, systematics, variables=[]): """Creates the event description based on a list of variables Args: systematics (list of string): systematics...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Desc: """Event description with varying systematics Attributes: variables_dict (dict of string->Var): Variables in the event""" def __init__(self, systematics, variables=[]): """Creates the event description based on a list of variables Args: systematics (list of string): systematics to use for v...
the_stack_v2_python_sparse
Plotting/python/joosep/sparsinator.py
jpata/tthbb13
train
2
20666abb1b47f877da668f4cc41ae5db09b00e04
[ "a, b = (q, p)\nwhile not (a & 1 or b & 1):\n a >>= 1\n b >>= 1\nif not a & 1:\n return 0\nelif b & 1:\n return 1\nelse:\n return 2", "g = gcd(p, q)\na, b = (q // g, p // g)\nif not a & 1:\n return 0\nelif b & 1:\n return 1\nelse:\n return 2" ]
<|body_start_0|> a, b = (q, p) while not (a & 1 or b & 1): a >>= 1 b >>= 1 if not a & 1: return 0 elif b & 1: return 1 else: return 2 <|end_body_0|> <|body_start_1|> g = gcd(p, q) a, b = (q // g, p // g)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mirrorReflection(self, p: int, q: int) -> int: """Extend the original box to mutiple boxes in order to simulate the reflections as follows (p = 3, q = 2): See pics/mirror_reflection.png. So in the end the ray will meet the point where ap == bq. The easiest match is to set a...
stack_v2_sparse_classes_10k_train_005987
1,515
no_license
[ { "docstring": "Extend the original box to mutiple boxes in order to simulate the reflections as follows (p = 3, q = 2): See pics/mirror_reflection.png. So in the end the ray will meet the point where ap == bq. The easiest match is to set a = q and b = p to match the above equation. Now consider the following c...
2
stack_v2_sparse_classes_30k_train_002892
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mirrorReflection(self, p: int, q: int) -> int: Extend the original box to mutiple boxes in order to simulate the reflections as follows (p = 3, q = 2): See pics/mirror_reflec...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mirrorReflection(self, p: int, q: int) -> int: Extend the original box to mutiple boxes in order to simulate the reflections as follows (p = 3, q = 2): See pics/mirror_reflec...
edb870f83f0c4568cce0cacec04ee70cf6b545bf
<|skeleton|> class Solution: def mirrorReflection(self, p: int, q: int) -> int: """Extend the original box to mutiple boxes in order to simulate the reflections as follows (p = 3, q = 2): See pics/mirror_reflection.png. So in the end the ray will meet the point where ap == bq. The easiest match is to set a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mirrorReflection(self, p: int, q: int) -> int: """Extend the original box to mutiple boxes in order to simulate the reflections as follows (p = 3, q = 2): See pics/mirror_reflection.png. So in the end the ray will meet the point where ap == bq. The easiest match is to set a = q and b = p...
the_stack_v2_python_sparse
2020/mirror_reflection.py
eronekogin/leetcode
train
0
4e839ba3808743ba8c8785079521bbfa02a0e34f
[ "id = request.GET.get('id', None)\nif id is None:\n fields_of_study = FieldOfStudy.objects.all()\n serializer = FieldOfStudySerializer(fields_of_study, many=True)\n return JsonResponse({'fields_of_study': serializer.data}, safe=False)\nelse:\n field_of_study = get_object_or_404(FieldOfStudy, id=id)\n ...
<|body_start_0|> id = request.GET.get('id', None) if id is None: fields_of_study = FieldOfStudy.objects.all() serializer = FieldOfStudySerializer(fields_of_study, many=True) return JsonResponse({'fields_of_study': serializer.data}, safe=False) else: ...
专业方向view
FieldsOfStudy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FieldsOfStudy: """专业方向view""" def get(self, request): """查询专业方向""" <|body_0|> def put(self, request): """修改专业方向""" <|body_1|> def post(self, request): """增加专业方向""" <|body_2|> def delete(self, request): """删除专业方向""" ...
stack_v2_sparse_classes_10k_train_005988
15,061
permissive
[ { "docstring": "查询专业方向", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改专业方向", "name": "put", "signature": "def put(self, request)" }, { "docstring": "增加专业方向", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除专...
4
stack_v2_sparse_classes_30k_train_003272
Implement the Python class `FieldsOfStudy` described below. Class description: 专业方向view Method signatures and docstrings: - def get(self, request): 查询专业方向 - def put(self, request): 修改专业方向 - def post(self, request): 增加专业方向 - def delete(self, request): 删除专业方向
Implement the Python class `FieldsOfStudy` described below. Class description: 专业方向view Method signatures and docstrings: - def get(self, request): 查询专业方向 - def put(self, request): 修改专业方向 - def post(self, request): 增加专业方向 - def delete(self, request): 删除专业方向 <|skeleton|> class FieldsOfStudy: """专业方向view""" d...
7aaa1be773718de1beb3ce0080edca7c4114b7ad
<|skeleton|> class FieldsOfStudy: """专业方向view""" def get(self, request): """查询专业方向""" <|body_0|> def put(self, request): """修改专业方向""" <|body_1|> def post(self, request): """增加专业方向""" <|body_2|> def delete(self, request): """删除专业方向""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FieldsOfStudy: """专业方向view""" def get(self, request): """查询专业方向""" id = request.GET.get('id', None) if id is None: fields_of_study = FieldOfStudy.objects.all() serializer = FieldOfStudySerializer(fields_of_study, many=True) return JsonResponse({...
the_stack_v2_python_sparse
plan/views.py
MIXISAMA/MIS-backend
train
0
b1097aff807464567e7df884146279f2fe3384e7
[ "print(self.id_card)\nparam = {'idcard': self.id_card, 'username': 'api' + self.id_card + '_1', 'nationality': '汉族', 'maritalstatus': 0, 'level': 1, 'contact1': '15212365478', 'residenceaddress': '5101090201', 'address': '测试详细地址', 'emergencycontact1name': '测试', 'emergencycontact1address': '测试地址', 'emergencycontact1...
<|body_start_0|> print(self.id_card) param = {'idcard': self.id_card, 'username': 'api' + self.id_card + '_1', 'nationality': '汉族', 'maritalstatus': 0, 'level': 1, 'contact1': '15212365478', 'residenceaddress': '5101090201', 'address': '测试详细地址', 'emergencycontact1name': '测试', 'emergencycontact1address':...
TestBusiness1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBusiness1: def test_001(self): """添加人员-级别为:普通老人""" <|body_0|> def test_002(self): """政府端:根据身份证号查询UID""" <|body_1|> def test_003(self): """积分充值""" <|body_2|> def test_004(self): """服务订单生成""" <|body_3|> <|end_skele...
stack_v2_sparse_classes_10k_train_005989
3,118
no_license
[ { "docstring": "添加人员-级别为:普通老人", "name": "test_001", "signature": "def test_001(self)" }, { "docstring": "政府端:根据身份证号查询UID", "name": "test_002", "signature": "def test_002(self)" }, { "docstring": "积分充值", "name": "test_003", "signature": "def test_003(self)" }, { "d...
4
stack_v2_sparse_classes_30k_train_002260
Implement the Python class `TestBusiness1` described below. Class description: Implement the TestBusiness1 class. Method signatures and docstrings: - def test_001(self): 添加人员-级别为:普通老人 - def test_002(self): 政府端:根据身份证号查询UID - def test_003(self): 积分充值 - def test_004(self): 服务订单生成
Implement the Python class `TestBusiness1` described below. Class description: Implement the TestBusiness1 class. Method signatures and docstrings: - def test_001(self): 添加人员-级别为:普通老人 - def test_002(self): 政府端:根据身份证号查询UID - def test_003(self): 积分充值 - def test_004(self): 服务订单生成 <|skeleton|> class TestBusiness1: ...
024bb8f0e8be7d19abfb14b405ef79bd85cc6b7b
<|skeleton|> class TestBusiness1: def test_001(self): """添加人员-级别为:普通老人""" <|body_0|> def test_002(self): """政府端:根据身份证号查询UID""" <|body_1|> def test_003(self): """积分充值""" <|body_2|> def test_004(self): """服务订单生成""" <|body_3|> <|end_skele...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestBusiness1: def test_001(self): """添加人员-级别为:普通老人""" print(self.id_card) param = {'idcard': self.id_card, 'username': 'api' + self.id_card + '_1', 'nationality': '汉族', 'maritalstatus': 0, 'level': 1, 'contact1': '15212365478', 'residenceaddress': '5101090201', 'address': '测试详细地址', 'e...
the_stack_v2_python_sparse
test_case/test_business/test_business_1_flow.py
cjuan123/auto_api
train
0
f1b240251721a2af5c350b82e2f8c6b25198787b
[ "try:\n result = single_run(nnid, ver, node)\n return Response(json.dumps(result))\nexcept Exception as e:\n traceback.print_exc()\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))", "try:\n return_data = ''\n return Response(json.dumps(return_data...
<|body_start_0|> try: result = single_run(nnid, ver, node) return Response(json.dumps(result)) except Exception as e: traceback.print_exc() return_data = {'status': '404', 'result': str(e)} return Response(json.dumps(return_data)) <|end_body_0|...
RunManagerSingleRequest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunManagerSingleRequest: def post(self, request, nnid, ver, node): """We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_005990
2,307
permissive
[ { "docstring": "We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed", "name": "post", "signature": "def post(self, request, nnid, ver, node)" }, { "docstrin...
3
null
Implement the Python class `RunManagerSingleRequest` described below. Class description: Implement the RunManagerSingleRequest class. Method signatures and docstrings: - def post(self, request, nnid, ver, node): We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # C...
Implement the Python class `RunManagerSingleRequest` described below. Class description: Implement the RunManagerSingleRequest class. Method signatures and docstrings: - def post(self, request, nnid, ver, node): We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # C...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class RunManagerSingleRequest: def post(self, request, nnid, ver, node): """We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RunManagerSingleRequest: def post(self, request, nnid, ver, node): """We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed""" try: result = sin...
the_stack_v2_python_sparse
api/views/runmanager_single_request.py
yurimkoo/tensormsa
train
1
dc3d247bb1098d297aad529bf34ae5dfd0af6d33
[ "new_prop = 'user_prop'\nnew_prop_value = rand_name('new_prop_value')\nimage = self.images_behavior.create_image_via_task()\nresponse = self.images_client.update_image(image.id_, add={new_prop: new_prop_value})\nself.assertEqual(response.status_code, 200)\nupdated_image = response.entity\nself.assertIn(new_prop, up...
<|body_start_0|> new_prop = 'user_prop' new_prop_value = rand_name('new_prop_value') image = self.images_behavior.create_image_via_task() response = self.images_client.update_image(image.id_, add={new_prop: new_prop_value}) self.assertEqual(response.status_code, 200) upda...
TestUpdateImagePositive
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that ...
stack_v2_sparse_classes_10k_train_005991
6,204
permissive
[ { "docstring": "@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that the new property's value is correct", "name": "test_update_image_add_additional_prope...
4
null
Implement the Python class `TestUpdateImagePositive` described below. Class description: Implement the TestUpdateImagePositive class. Method signatures and docstrings: - def test_update_image_add_additional_property(self): @summary: Update image add additional property 1) Create image 2) Update image adding a new pro...
Implement the Python class `TestUpdateImagePositive` described below. Class description: Implement the TestUpdateImagePositive class. Method signatures and docstrings: - def test_update_image_add_additional_property(self): @summary: Update image add additional property 1) Create image 2) Update image adding a new pro...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that the new proper...
the_stack_v2_python_sparse
cloudroast/images/v2/functional/test_update_image_positive.py
RULCSoft/cloudroast
train
1
fad880e928937a6e4c537c2bf66e62120d904775
[ "self.device_name = None\nself.device_type = None\nself.device_name_abbrev = None\nself.compatible = None\nself.device_address = None\nself.vendor = 'al'\nself.device_attributes = None\nself.attrWriteCommBytes = None\nself.attrWriteComm = None\nself.attributeWriteOffsets = None\nself.initComm = None\nself.initCommB...
<|body_start_0|> self.device_name = None self.device_type = None self.device_name_abbrev = None self.compatible = None self.device_address = None self.vendor = 'al' self.device_attributes = None self.attrWriteCommBytes = None self.attrWriteComm = N...
The configuration for the driver being generated.
DriverConfig
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriverConfig: """The configuration for the driver being generated.""" def __init__(self): """Initialize driver configuration.""" <|body_0|> def parse_json(json_filepath): """Parse JSON file into driver configuration. Parameters ---------- json_filepath : str file...
stack_v2_sparse_classes_10k_train_005992
4,564
permissive
[ { "docstring": "Initialize driver configuration.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Parse JSON file into driver configuration. Parameters ---------- json_filepath : str file path to JSON configuration file Returns ------- DriverConfig Returns an instance o...
2
stack_v2_sparse_classes_30k_train_000002
Implement the Python class `DriverConfig` described below. Class description: The configuration for the driver being generated. Method signatures and docstrings: - def __init__(self): Initialize driver configuration. - def parse_json(json_filepath): Parse JSON file into driver configuration. Parameters ---------- jso...
Implement the Python class `DriverConfig` described below. Class description: The configuration for the driver being generated. Method signatures and docstrings: - def __init__(self): Initialize driver configuration. - def parse_json(json_filepath): Parse JSON file into driver configuration. Parameters ---------- jso...
090576504c721ea18d1cc09fadfe9873c0e1f96c
<|skeleton|> class DriverConfig: """The configuration for the driver being generated.""" def __init__(self): """Initialize driver configuration.""" <|body_0|> def parse_json(json_filepath): """Parse JSON file into driver configuration. Parameters ---------- json_filepath : str file...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DriverConfig: """The configuration for the driver being generated.""" def __init__(self): """Initialize driver configuration.""" self.device_name = None self.device_type = None self.device_name_abbrev = None self.compatible = None self.device_address = None...
the_stack_v2_python_sparse
device_drivers/driver_config.py
fpga-open-speech-tools/simulink_codegen
train
2
4422acca830f4a9655593caba658adf316d3a8c7
[ "image_file = StringIO.StringIO(temp_image.read())\nimage = Image.open(image_file)\nreturn image", "try:\n for orientation in ExifTags.TAGS.keys():\n if ExifTags.TAGS[orientation] == 'Orientation':\n exif = dict(image._getexif().items())\n if exif[orientation] == 3:\n ...
<|body_start_0|> image_file = StringIO.StringIO(temp_image.read()) image = Image.open(image_file) return image <|end_body_0|> <|body_start_1|> try: for orientation in ExifTags.TAGS.keys(): if ExifTags.TAGS[orientation] == 'Orientation': ex...
Assisting methods to help with file upload processes.
PhotoUpload
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhotoUpload: """Assisting methods to help with file upload processes.""" def open_image(temp_image): """Open a this image using StringIO.""" <|body_0|> def check_image_orientation(image): """Digital photo devices attach EXIF data to an image when a photo is taken...
stack_v2_sparse_classes_10k_train_005993
3,690
no_license
[ { "docstring": "Open a this image using StringIO.", "name": "open_image", "signature": "def open_image(temp_image)" }, { "docstring": "Digital photo devices attach EXIF data to an image when a photo is taken. In order to display an image appropriately without it getting rotated, we need to check...
6
stack_v2_sparse_classes_30k_train_007012
Implement the Python class `PhotoUpload` described below. Class description: Assisting methods to help with file upload processes. Method signatures and docstrings: - def open_image(temp_image): Open a this image using StringIO. - def check_image_orientation(image): Digital photo devices attach EXIF data to an image ...
Implement the Python class `PhotoUpload` described below. Class description: Assisting methods to help with file upload processes. Method signatures and docstrings: - def open_image(temp_image): Open a this image using StringIO. - def check_image_orientation(image): Digital photo devices attach EXIF data to an image ...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class PhotoUpload: """Assisting methods to help with file upload processes.""" def open_image(temp_image): """Open a this image using StringIO.""" <|body_0|> def check_image_orientation(image): """Digital photo devices attach EXIF data to an image when a photo is taken...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PhotoUpload: """Assisting methods to help with file upload processes.""" def open_image(temp_image): """Open a this image using StringIO.""" image_file = StringIO.StringIO(temp_image.read()) image = Image.open(image_file) return image def check_image_orientation(image...
the_stack_v2_python_sparse
common/service/photo_upload.py
wcirillo/ten
train
0
a0cbe4ae7b5fbbff15dfa0293319b376abaac5f1
[ "N = prior.size\nself.lims = (-1, 1)\nself.pdf_ref, self.bins = np.histogram(prior, bins=N, range=self.lims)", "if np.min(x) < self.lims[0]:\n tqdm.write('XHAT MIN WAS LOWER THAN X MIN: %g' % np.min(x))\nif np.max(x) > self.lims[1]:\n tqdm.write('XHAT MAX WAS HIGHER THAN X MAX: %g' % np.max(x))\nreturn np.h...
<|body_start_0|> N = prior.size self.lims = (-1, 1) self.pdf_ref, self.bins = np.histogram(prior, bins=N, range=self.lims) <|end_body_0|> <|body_start_1|> if np.min(x) < self.lims[0]: tqdm.write('XHAT MIN WAS LOWER THAN X MIN: %g' % np.min(x)) if np.max(x) > self.lim...
Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like bin locations used for construction of ...
pdf_default
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pdf_default: """Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like ...
stack_v2_sparse_classes_10k_train_005994
9,248
no_license
[ { "docstring": "Note that prior should be normalized between lims=(-1, 1).", "name": "__init__", "signature": "def __init__(self, prior)" }, { "docstring": "Estimate the pdf of x. Parameters ---------- x : array_like Signal to get pdf estimate of. Returns ------- array_like Histogram of x. Notes...
2
stack_v2_sparse_classes_30k_train_001959
Implement the Python class `pdf_default` described below. Class description: Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to c...
Implement the Python class `pdf_default` described below. Class description: Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to c...
08cb43dcf53fd6fddd3304e3514a608842310a34
<|skeleton|> class pdf_default: """Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class pdf_default: """Picklable object for computing pdfs. Uses histogram to estimate pdf. Attributes ---------- N : int Size of signal. lims : array_like or tuple Upper and lower bounds for range of histogram. pdf_ref : array_like pdf estimate of prior. Used to compare to pdf(xhat). bins : array_like bin locations...
the_stack_v2_python_sparse
mr_utils/cs/ordinator.py
zongjg/mr_utils
train
0
f5ed6dd93b755b0389868391f22c184c9a552a79
[ "val_s = Stack()\ncur_node = headnode\nwhile cur_node:\n val_s.push(cur_node.val)\n cur_node = cur_node.next\nwhile not val_s.empty():\n print(val_s.pop())", "curnode = headnode\nif curnode:\n self.solve2(curnode.next)\n print(curnode.val)" ]
<|body_start_0|> val_s = Stack() cur_node = headnode while cur_node: val_s.push(cur_node.val) cur_node = cur_node.next while not val_s.empty(): print(val_s.pop()) <|end_body_0|> <|body_start_1|> curnode = headnode if curnode: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def solve(self, headnode): """思路:用一个栈保存所有节点,之后一个一个 pop""" <|body_0|> def solve2(self, headnode): """能用栈就可以使用递归。这一点需要能联想到""" <|body_1|> <|end_skeleton|> <|body_start_0|> val_s = Stack() cur_node = headnode while cur_node: ...
stack_v2_sparse_classes_10k_train_005995
1,362
permissive
[ { "docstring": "思路:用一个栈保存所有节点,之后一个一个 pop", "name": "solve", "signature": "def solve(self, headnode)" }, { "docstring": "能用栈就可以使用递归。这一点需要能联想到", "name": "solve2", "signature": "def solve2(self, headnode)" } ]
2
stack_v2_sparse_classes_30k_train_002946
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solve(self, headnode): 思路:用一个栈保存所有节点,之后一个一个 pop - def solve2(self, headnode): 能用栈就可以使用递归。这一点需要能联想到
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solve(self, headnode): 思路:用一个栈保存所有节点,之后一个一个 pop - def solve2(self, headnode): 能用栈就可以使用递归。这一点需要能联想到 <|skeleton|> class Solution: def solve(self, headnode): """思路...
3469a79c34b6c08ae52797c3974b49fbfa8cca51
<|skeleton|> class Solution: def solve(self, headnode): """思路:用一个栈保存所有节点,之后一个一个 pop""" <|body_0|> def solve2(self, headnode): """能用栈就可以使用递归。这一点需要能联想到""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def solve(self, headnode): """思路:用一个栈保存所有节点,之后一个一个 pop""" val_s = Stack() cur_node = headnode while cur_node: val_s.push(cur_node.val) cur_node = cur_node.next while not val_s.empty(): print(val_s.pop()) def solve2(self...
the_stack_v2_python_sparse
剑指offer/05_PrintListInReversedOrder(从尾到头打印链表).py
Mark24Code/python_data_structures_and_algorithms
train
1
00d29ece7956092f851a618109135ab23461c543
[ "if not self.named_regexp:\n self.log.warning('Regular expression not provided for plugin. Run with `--help-all` flag for more information.')\n return None\nmatch = re.match(self.named_regexp, filename)\nif not match or not match.groups():\n self.log.warning(\"Regular expression '{}' did not match anything...
<|body_start_0|> if not self.named_regexp: self.log.warning('Regular expression not provided for plugin. Run with `--help-all` flag for more information.') return None match = re.match(self.named_regexp, filename) if not match or not match.groups(): self.log.w...
Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class.
FileNameCollectorPlugin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileNameCollectorPlugin: """Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class.""" def _match(self, filename: str) -> Optional[dict]: """Match the named group regular expression to t...
stack_v2_sparse_classes_10k_train_005996
7,151
permissive
[ { "docstring": "Match the named group regular expression to the beginning of the filename and return the match groupdict or None if no match.", "name": "_match", "signature": "def _match(self, filename: str) -> Optional[dict]" }, { "docstring": "This is the main function called by the :class:`~n...
2
stack_v2_sparse_classes_30k_train_000295
Implement the Python class `FileNameCollectorPlugin` described below. Class description: Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class. Method signatures and docstrings: - def _match(self, filename: str) -> Opti...
Implement the Python class `FileNameCollectorPlugin` described below. Class description: Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class. Method signatures and docstrings: - def _match(self, filename: str) -> Opti...
6db380039dab377157620516ae49eafcf7537fc8
<|skeleton|> class FileNameCollectorPlugin: """Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class.""" def _match(self, filename: str) -> Optional[dict]: """Match the named group regular expression to t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileNameCollectorPlugin: """Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class.""" def _match(self, filename: str) -> Optional[dict]: """Match the named group regular expression to the beginning ...
the_stack_v2_python_sparse
nbgrader/plugins/zipcollect.py
jupyter/nbgrader
train
1,274
3d41406e71ebc01b4e5e9a129fc5d76fc4176518
[ "self.k = k\nheapq.heapify(nums)\nself.heap = nums\nwhile len(self.heap) > k:\n heapq.heappop(self.heap)", "if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\nelse:\n heapq.heappushpop(self.heap, val)\nreturn self.heap[0]" ]
<|body_start_0|> self.k = k heapq.heapify(nums) self.heap = nums while len(self.heap) > k: heapq.heappop(self.heap) <|end_body_0|> <|body_start_1|> if len(self.heap) < self.k: heapq.heappush(self.heap, val) else: heapq.heappushpop(self...
KthLargest2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest2: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k heapq.heapify(nums) self.heap ...
stack_v2_sparse_classes_10k_train_005997
2,963
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_005521
Implement the Python class `KthLargest2` described below. Class description: Implement the KthLargest2 class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest2` described below. Class description: Implement the KthLargest2 class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest2: def __init__(self, k,...
3e50f6a936b98ad75c47d7c1719e69163c648235
<|skeleton|> class KthLargest2: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KthLargest2: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k heapq.heapify(nums) self.heap = nums while len(self.heap) > k: heapq.heappop(self.heap) def add(self, val): """:type val: int :rtype: int""" if...
the_stack_v2_python_sparse
LeetcodeNew/Heap/LC_703_Kth_Largest_Element_in_a_Stream.py
Taoge123/OptimizedLeetcode
train
9
e4872b61312de0115e7f6ed0ff00135a457dd4cc
[ "self.dynamic_network_pool_config = dynamic_network_pool_config\nself.groupnet = groupnet\nself.smb_credentials = smb_credentials\nself.static_network_pool_config = static_network_pool_config", "if dictionary is None:\n return None\ndynamic_network_pool_config = cohesity_management_sdk.models.isilon_env_params...
<|body_start_0|> self.dynamic_network_pool_config = dynamic_network_pool_config self.groupnet = groupnet self.smb_credentials = smb_credentials self.static_network_pool_config = static_network_pool_config <|end_body_0|> <|body_start_1|> if dictionary is None: return ...
Implementation of the 'IsilonEnvParams_ZoneConfig' model. TODO: type description here. Attributes: dynamic_network_pool_config (IsilonEnvParams_ZoneConfig_NetworkPoolConfig): Dynamic network pool configuration for the access zone. Dynamic pool is used for stateless protocols, e.g. NFSv3. groupnet (string): Name of the ...
IsilonEnvParams_ZoneConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsilonEnvParams_ZoneConfig: """Implementation of the 'IsilonEnvParams_ZoneConfig' model. TODO: type description here. Attributes: dynamic_network_pool_config (IsilonEnvParams_ZoneConfig_NetworkPoolConfig): Dynamic network pool configuration for the access zone. Dynamic pool is used for stateless ...
stack_v2_sparse_classes_10k_train_005998
3,492
permissive
[ { "docstring": "Constructor for the IsilonEnvParams_ZoneConfig class", "name": "__init__", "signature": "def __init__(self, dynamic_network_pool_config=None, groupnet=None, smb_credentials=None, static_network_pool_config=None)" }, { "docstring": "Creates an instance of this model from a diction...
2
null
Implement the Python class `IsilonEnvParams_ZoneConfig` described below. Class description: Implementation of the 'IsilonEnvParams_ZoneConfig' model. TODO: type description here. Attributes: dynamic_network_pool_config (IsilonEnvParams_ZoneConfig_NetworkPoolConfig): Dynamic network pool configuration for the access zo...
Implement the Python class `IsilonEnvParams_ZoneConfig` described below. Class description: Implementation of the 'IsilonEnvParams_ZoneConfig' model. TODO: type description here. Attributes: dynamic_network_pool_config (IsilonEnvParams_ZoneConfig_NetworkPoolConfig): Dynamic network pool configuration for the access zo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class IsilonEnvParams_ZoneConfig: """Implementation of the 'IsilonEnvParams_ZoneConfig' model. TODO: type description here. Attributes: dynamic_network_pool_config (IsilonEnvParams_ZoneConfig_NetworkPoolConfig): Dynamic network pool configuration for the access zone. Dynamic pool is used for stateless ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IsilonEnvParams_ZoneConfig: """Implementation of the 'IsilonEnvParams_ZoneConfig' model. TODO: type description here. Attributes: dynamic_network_pool_config (IsilonEnvParams_ZoneConfig_NetworkPoolConfig): Dynamic network pool configuration for the access zone. Dynamic pool is used for stateless protocols, e....
the_stack_v2_python_sparse
cohesity_management_sdk/models/isilon_env_params_zone_config.py
cohesity/management-sdk-python
train
24
9fa6f4fcc902ec6f654df3cbcfff050e01c1e997
[ "client = test_client.TestClient(context.node['baseurl'])\npid = object_info.identifier.value()\nresponse = client.get(context.TOKEN, pid)\nchecksum_from_get = test_utilities.calculate_checksum_on_string(response, object_info.checksum.algorithm)\nassert object_info.checksum.value() == checksum_from_get\nresponse = ...
<|body_start_0|> client = test_client.TestClient(context.node['baseurl']) pid = object_info.identifier.value() response = client.get(context.TOKEN, pid) checksum_from_get = test_utilities.calculate_checksum_on_string(response, object_info.checksum.algorithm) assert object_info.ch...
Test050Get
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" <|body_0|> def test_010_get_object_by_invalid_pid(self): """404 NotFound when attempting to get non-existing object.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_005999
2,629
permissive
[ { "docstring": "Get object and verify retrieved information against its ObjectInfo.", "name": "validate_object", "signature": "def validate_object(self, object_info)" }, { "docstring": "404 NotFound when attempting to get non-existing object.", "name": "test_010_get_object_by_invalid_pid", ...
3
null
Implement the Python class `Test050Get` described below. Class description: Implement the Test050Get class. Method signatures and docstrings: - def validate_object(self, object_info): Get object and verify retrieved information against its ObjectInfo. - def test_010_get_object_by_invalid_pid(self): 404 NotFound when ...
Implement the Python class `Test050Get` described below. Class description: Implement the Test050Get class. Method signatures and docstrings: - def validate_object(self, object_info): Get object and verify retrieved information against its ObjectInfo. - def test_010_get_object_by_invalid_pid(self): 404 NotFound when ...
d72a9461894d9be7d71178fb7310101b8ef9066a
<|skeleton|> class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" <|body_0|> def test_010_get_object_by_invalid_pid(self): """404 NotFound when attempting to get non-existing object.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" client = test_client.TestClient(context.node['baseurl']) pid = object_info.identifier.value() response = client.get(context.TOKEN, pid) checksum...
the_stack_v2_python_sparse
test_utilities/src/d1_test/stress_tester/projects/_unit_test_bases_for_stress_tests/tier_1_mn_read_get.py
DataONEorg/d1_python
train
15