blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7516c7e8e0caf4cd21414a5115f631fec7b5693f | [
"q = deque([root])\nret = []\nwhile q:\n node = q.popleft()\n if node is None:\n ret.append(None)\n else:\n ret.append(node.val)\n q.extend([node.left, node.right])\nwhile ret and ret[-1] is None:\n ret.pop()\nreturn str(ret)",
"data = deque(eval(data))\nif len(data) == 0:\n re... | <|body_start_0|>
q = deque([root])
ret = []
while q:
node = q.popleft()
if node is None:
ret.append(None)
else:
ret.append(node.val)
q.extend([node.left, node.right])
while ret and ret[-1] is None:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_023800 | 1,700 | 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 | stack_v2_sparse_classes_30k_train_000543 | 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:... | f5686fc2e1774dd101a3acb1b2a7c017fe2cd9d5 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
q = deque([root])
ret = []
while q:
node = q.popleft()
if node is None:
ret.append(None)
else:
ret.app... | the_stack_v2_python_sparse | 0297-Serialize_and_Deserialize_Binary_Tree.py | kshen91/LeetCodeSolutions | train | 0 | |
8b4a69ec0dfe2de9119db6dab4736a865473aeed | [
"if 'codice' not in self.data:\n return queryset.filter(data_apertura__gte=value)\nelse:\n return queryset",
"if 'codice' not in self.data:\n return queryset.filter(data_apertura__lte=value)\nelse:\n return queryset"
] | <|body_start_0|>
if 'codice' not in self.data:
return queryset.filter(data_apertura__gte=value)
else:
return queryset
<|end_body_0|>
<|body_start_1|>
if 'codice' not in self.data:
return queryset.filter(data_apertura__lte=value)
else:
retu... | CommessaFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommessaFilter:
def filtra_da(self, queryset, value):
"""Applica il filtro sul campo 'data_apertura' solo se il filtro 'codice' non è valorizzato."""
<|body_0|>
def filtra_a(self, queryset, value):
"""Applica il filtro sul campo 'data_apertura' solo se il filtro 'cod... | stack_v2_sparse_classes_36k_train_023801 | 10,203 | no_license | [
{
"docstring": "Applica il filtro sul campo 'data_apertura' solo se il filtro 'codice' non è valorizzato.",
"name": "filtra_da",
"signature": "def filtra_da(self, queryset, value)"
},
{
"docstring": "Applica il filtro sul campo 'data_apertura' solo se il filtro 'codice' non è valorizzato.",
... | 2 | null | Implement the Python class `CommessaFilter` described below.
Class description:
Implement the CommessaFilter class.
Method signatures and docstrings:
- def filtra_da(self, queryset, value): Applica il filtro sul campo 'data_apertura' solo se il filtro 'codice' non è valorizzato.
- def filtra_a(self, queryset, value):... | Implement the Python class `CommessaFilter` described below.
Class description:
Implement the CommessaFilter class.
Method signatures and docstrings:
- def filtra_da(self, queryset, value): Applica il filtro sul campo 'data_apertura' solo se il filtro 'codice' non è valorizzato.
- def filtra_a(self, queryset, value):... | 07a97e6136637830ca99ae0bb06d944755eab87c | <|skeleton|>
class CommessaFilter:
def filtra_da(self, queryset, value):
"""Applica il filtro sul campo 'data_apertura' solo se il filtro 'codice' non è valorizzato."""
<|body_0|>
def filtra_a(self, queryset, value):
"""Applica il filtro sul campo 'data_apertura' solo se il filtro 'cod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommessaFilter:
def filtra_da(self, queryset, value):
"""Applica il filtro sul campo 'data_apertura' solo se il filtro 'codice' non è valorizzato."""
if 'codice' not in self.data:
return queryset.filter(data_apertura__gte=value)
else:
return queryset
def fi... | the_stack_v2_python_sparse | anagrafiche/api/apiFilters.py | ghiblin/wms2 | train | 0 | |
653d0e56877183e3b3e47cb2230dc65a5d0e150e | [
"scrolled.ScrolledPanel.__init__(self, parent, -1, size=(100, 500))\nself.visualizer = visualizer\nself.mode = mode\nself.sizer = wx.GridBagSizer()\nself.projectionBox = wx.RadioBox(self, -1, 'View projection', choices=['Max. IP', 'Avg. IP'], majorDimension=1, style=wx.RA_SPECIFY_COLS)\nself.updateButton = wx.Butto... | <|body_start_0|>
scrolled.ScrolledPanel.__init__(self, parent, -1, size=(100, 500))
self.visualizer = visualizer
self.mode = mode
self.sizer = wx.GridBagSizer()
self.projectionBox = wx.RadioBox(self, -1, 'View projection', choices=['Max. IP', 'Avg. IP'], majorDimension=1, style=w... | A configuration panel for the projection view | SimpleConfigurationPanel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleConfigurationPanel:
"""A configuration panel for the projection view"""
def __init__(self, parent, visualizer, mode, **kws):
"""Initialization"""
<|body_0|>
def onSetProjectionMode(self, event):
"""Configure what projection to show"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_023802 | 6,623 | no_license | [
{
"docstring": "Initialization",
"name": "__init__",
"signature": "def __init__(self, parent, visualizer, mode, **kws)"
},
{
"docstring": "Configure what projection to show",
"name": "onSetProjectionMode",
"signature": "def onSetProjectionMode(self, event)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003611 | Implement the Python class `SimpleConfigurationPanel` described below.
Class description:
A configuration panel for the projection view
Method signatures and docstrings:
- def __init__(self, parent, visualizer, mode, **kws): Initialization
- def onSetProjectionMode(self, event): Configure what projection to show | Implement the Python class `SimpleConfigurationPanel` described below.
Class description:
A configuration panel for the projection view
Method signatures and docstrings:
- def __init__(self, parent, visualizer, mode, **kws): Initialization
- def onSetProjectionMode(self, event): Configure what projection to show
<|s... | ea8bafa073de5090bd8f83fb4f5ca16669d0211f | <|skeleton|>
class SimpleConfigurationPanel:
"""A configuration panel for the projection view"""
def __init__(self, parent, visualizer, mode, **kws):
"""Initialization"""
<|body_0|>
def onSetProjectionMode(self, event):
"""Configure what projection to show"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimpleConfigurationPanel:
"""A configuration panel for the projection view"""
def __init__(self, parent, visualizer, mode, **kws):
"""Initialization"""
scrolled.ScrolledPanel.__init__(self, parent, -1, size=(100, 500))
self.visualizer = visualizer
self.mode = mode
... | the_stack_v2_python_sparse | Graphs/LX-2/molecule_otsu = False/BioImageXD-1.0/Modules/Visualization/Simple.py | giacomo21/Image-analysis | train | 1 |
95f93e26d599f39ee32c4eff286b4b4841b64b3f | [
"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... | data transfer service | DataTransferServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataTransferServiceServicer:
"""data transfer service"""
def push(self, request_iterator, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def pull(self, request, context):
"""Missing associated documentation comment in .proto f... | stack_v2_sparse_classes_36k_train_023803 | 9,317 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "push",
"signature": "def push(self, request_iterator, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "pull",
"signature": "def pull(self, request, context)... | 4 | null | Implement the Python class `DataTransferServiceServicer` described below.
Class description:
data transfer service
Method signatures and docstrings:
- def push(self, request_iterator, context): Missing associated documentation comment in .proto file.
- def pull(self, request, context): Missing associated documentatio... | Implement the Python class `DataTransferServiceServicer` described below.
Class description:
data transfer service
Method signatures and docstrings:
- def push(self, request_iterator, context): Missing associated documentation comment in .proto file.
- def pull(self, request, context): Missing associated documentatio... | 8767db5ec0cb93784f64b290bc39b7b545c530fb | <|skeleton|>
class DataTransferServiceServicer:
"""data transfer service"""
def push(self, request_iterator, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def pull(self, request, context):
"""Missing associated documentation comment in .proto f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataTransferServiceServicer:
"""data transfer service"""
def push(self, request_iterator, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplem... | the_stack_v2_python_sparse | python/fate_arch/protobuf/python/proxy_pb2_grpc.py | FederatedAI/FATE | train | 4,942 |
4ba45abfc04df51a33511a440850ae2216912ae5 | [
"super().__init__()\nif __debug__:\n logger.info('Initializing DS Client on %s:%s', master_ip, master_port)\nself.master_ip = master_ip\nself.master_port = int(str(master_port))\nself.running = True\nself.requests = None\nself.requests = queue.Queue()",
"if __debug__:\n logger.info('DS Client started')\nwhi... | <|body_start_0|>
super().__init__()
if __debug__:
logger.info('Initializing DS Client on %s:%s', master_ip, master_port)
self.master_ip = master_ip
self.master_port = int(str(master_port))
self.running = True
self.requests = None
self.requests = queue.... | Distro Stream Client definition. Attributes: - master_ip: Master IP address. + type: string - master_port: Master port. + type: int - running: Whether the client thread is running or not + type: boolean - requests: Queue of pending client requests + type: Queue.Queue | DistroStreamClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DistroStreamClient:
"""Distro Stream Client definition. Attributes: - master_ip: Master IP address. + type: string - master_port: Master port. + type: int - running: Whether the client thread is running or not + type: boolean - requests: Queue of pending client requests + type: Queue.Queue"""
... | stack_v2_sparse_classes_36k_train_023804 | 7,117 | permissive | [
{
"docstring": "Create a new Client associated to the given master properties. :param master_ip: Master IP address. :param master_port: Master port.",
"name": "__init__",
"signature": "def __init__(self, master_ip: typing.Optional[str], master_port: typing.Optional[str]) -> None"
},
{
"docstring... | 4 | stack_v2_sparse_classes_30k_train_015104 | Implement the Python class `DistroStreamClient` described below.
Class description:
Distro Stream Client definition. Attributes: - master_ip: Master IP address. + type: string - master_port: Master port. + type: int - running: Whether the client thread is running or not + type: boolean - requests: Queue of pending cli... | Implement the Python class `DistroStreamClient` described below.
Class description:
Distro Stream Client definition. Attributes: - master_ip: Master IP address. + type: string - master_port: Master port. + type: int - running: Whether the client thread is running or not + type: boolean - requests: Queue of pending cli... | 5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092 | <|skeleton|>
class DistroStreamClient:
"""Distro Stream Client definition. Attributes: - master_ip: Master IP address. + type: string - master_port: Master port. + type: int - running: Whether the client thread is running or not + type: boolean - requests: Queue of pending client requests + type: Queue.Queue"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DistroStreamClient:
"""Distro Stream Client definition. Attributes: - master_ip: Master IP address. + type: string - master_port: Master port. + type: int - running: Whether the client thread is running or not + type: boolean - requests: Queue of pending client requests + type: Queue.Queue"""
def __init_... | the_stack_v2_python_sparse | compss/programming_model/bindings/python/src/pycompss/streams/components/distro_stream_client.py | bsc-wdc/compss | train | 39 |
402ecd186a749ac08e36f2967067feb7d659e4a6 | [
"self.login.loginFunc()\nself.driver.implicitly_wait(30)\nself.findElement(*self.files1_loc).click()\nself.findElement(*self.shareBtn_loc).click()\nsleep(0.5)\nself.findElement(*self.shareInput_loc).send_keys('userdemo')\nsleep(1)\nself.findElement(*self.shareSelect_loc).click()\nself.driver.implicitly_wait(10)\nsh... | <|body_start_0|>
self.login.loginFunc()
self.driver.implicitly_wait(30)
self.findElement(*self.files1_loc).click()
self.findElement(*self.shareBtn_loc).click()
sleep(0.5)
self.findElement(*self.shareInput_loc).send_keys('userdemo')
sleep(1)
self.findElemen... | 共享功能测试 | ShareTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShareTest:
"""共享功能测试"""
def test_01shareuser(self):
"""分享文件给用户"""
<|body_0|>
def test_02sharegroup(self):
"""分享给用户组"""
<|body_1|>
def test_03sharedepartment(self):
"""分享文件给部门"""
<|body_2|>
def test_04treeshare(self):
"""树... | stack_v2_sparse_classes_36k_train_023805 | 7,193 | no_license | [
{
"docstring": "分享文件给用户",
"name": "test_01shareuser",
"signature": "def test_01shareuser(self)"
},
{
"docstring": "分享给用户组",
"name": "test_02sharegroup",
"signature": "def test_02sharegroup(self)"
},
{
"docstring": "分享文件给部门",
"name": "test_03sharedepartment",
"signature": ... | 6 | stack_v2_sparse_classes_30k_train_004826 | Implement the Python class `ShareTest` described below.
Class description:
共享功能测试
Method signatures and docstrings:
- def test_01shareuser(self): 分享文件给用户
- def test_02sharegroup(self): 分享给用户组
- def test_03sharedepartment(self): 分享文件给部门
- def test_04treeshare(self): 树形分享给内部用户
- def test_05sharecancel(self): 取消分享
- def... | Implement the Python class `ShareTest` described below.
Class description:
共享功能测试
Method signatures and docstrings:
- def test_01shareuser(self): 分享文件给用户
- def test_02sharegroup(self): 分享给用户组
- def test_03sharedepartment(self): 分享文件给部门
- def test_04treeshare(self): 树形分享给内部用户
- def test_05sharecancel(self): 取消分享
- def... | e7e6ad0187fb13e798aad230682c46125df26be9 | <|skeleton|>
class ShareTest:
"""共享功能测试"""
def test_01shareuser(self):
"""分享文件给用户"""
<|body_0|>
def test_02sharegroup(self):
"""分享给用户组"""
<|body_1|>
def test_03sharedepartment(self):
"""分享文件给部门"""
<|body_2|>
def test_04treeshare(self):
"""树... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShareTest:
"""共享功能测试"""
def test_01shareuser(self):
"""分享文件给用户"""
self.login.loginFunc()
self.driver.implicitly_wait(30)
self.findElement(*self.files1_loc).click()
self.findElement(*self.shareBtn_loc).click()
sleep(0.5)
self.findElement(*self.shareI... | the_stack_v2_python_sparse | retail/test_case/i_share_sta.py | huenping/Security_WP_retail | train | 2 |
9faa4dd585d4c61be615e7049196ef74e913ccf3 | [
"i, j = (0, len(height) - 1)\nmx = 0\nwhile i < j:\n tmp = (j - i) * min(height[i], height[j])\n mx = tmp if tmp > mx else mx\n if height[i] > height[j]:\n j -= 1\n else:\n i += 1\nreturn mx",
"i, j = (0, len(height) - 1)\nmx = 0\nwhile i < j:\n tmp = (j - i) * min(height[i], height[j... | <|body_start_0|>
i, j = (0, len(height) - 1)
mx = 0
while i < j:
tmp = (j - i) * min(height[i], height[j])
mx = tmp if tmp > mx else mx
if height[i] > height[j]:
j -= 1
else:
i += 1
return mx
<|end_body_0|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea2(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i, j = (0, len(height) - 1)
mx = 0
... | stack_v2_sparse_classes_36k_train_023806 | 1,696 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea",
"signature": "def maxArea(self, height)"
},
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea2",
"signature": "def maxArea2(self, height)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003344 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea2(self, height): :type height: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea2(self, height): :type height: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxArea(se... | 166d97f36bbeea74c84ec57466bd0a65b608ed09 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea2(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
i, j = (0, len(height) - 1)
mx = 0
while i < j:
tmp = (j - i) * min(height[i], height[j])
mx = tmp if tmp > mx else mx
if height[i] > height[j]:
j ... | the_stack_v2_python_sparse | leetcode/container_with_most_water.py | Activity00/Python | train | 0 | |
b84118e0c28658f9c39bee3e2e490c3cee9cebd8 | [
"tfds_name = 'glue/' + name\ndataset_builder = tfds.builder(tfds_name, try_gcs=try_gcs, data_dir=data_dir)\nsuper().__init__(name=tfds_name, dataset_builder=dataset_builder, split=split, is_training=is_training, shuffle_buffer_size=shuffle_buffer_size, num_parallel_parser_calls=num_parallel_parser_calls, fingerprin... | <|body_start_0|>
tfds_name = 'glue/' + name
dataset_builder = tfds.builder(tfds_name, try_gcs=try_gcs, data_dir=data_dir)
super().__init__(name=tfds_name, dataset_builder=dataset_builder, split=split, is_training=is_training, shuffle_buffer_size=shuffle_buffer_size, num_parallel_parser_calls=num... | GLUE dataset builder abstract class. | _GlueDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _GlueDataset:
"""GLUE dataset builder abstract class."""
def __init__(self, name: str, split: str, shuffle_buffer_size: Optional[int]=None, num_parallel_parser_calls: int=64, try_gcs: bool=False, download_data: bool=False, data_dir: Optional[str]=None, is_training: Optional[bool]=None):
... | stack_v2_sparse_classes_36k_train_023807 | 6,152 | permissive | [
{
"docstring": "Create a GLUE tf.data.Dataset builder. Args: name: the name of this dataset, 'glue/' will be prepended to get the dataset from TFDS. split: a dataset split, either a custom tfds.Split or one of the tfds.Split enums [TRAIN, VALIDAITON, TEST] or their lowercase string names. shuffle_buffer_size: t... | 2 | null | Implement the Python class `_GlueDataset` described below.
Class description:
GLUE dataset builder abstract class.
Method signatures and docstrings:
- def __init__(self, name: str, split: str, shuffle_buffer_size: Optional[int]=None, num_parallel_parser_calls: int=64, try_gcs: bool=False, download_data: bool=False, d... | Implement the Python class `_GlueDataset` described below.
Class description:
GLUE dataset builder abstract class.
Method signatures and docstrings:
- def __init__(self, name: str, split: str, shuffle_buffer_size: Optional[int]=None, num_parallel_parser_calls: int=64, try_gcs: bool=False, download_data: bool=False, d... | f5f6f50f82bd441339c9d9efbef3f09e72c5fef6 | <|skeleton|>
class _GlueDataset:
"""GLUE dataset builder abstract class."""
def __init__(self, name: str, split: str, shuffle_buffer_size: Optional[int]=None, num_parallel_parser_calls: int=64, try_gcs: bool=False, download_data: bool=False, data_dir: Optional[str]=None, is_training: Optional[bool]=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _GlueDataset:
"""GLUE dataset builder abstract class."""
def __init__(self, name: str, split: str, shuffle_buffer_size: Optional[int]=None, num_parallel_parser_calls: int=64, try_gcs: bool=False, download_data: bool=False, data_dir: Optional[str]=None, is_training: Optional[bool]=None):
"""Create... | the_stack_v2_python_sparse | uncertainty_baselines/datasets/glue.py | google/uncertainty-baselines | train | 1,235 |
12db096aedf15b066c5ec0ae75a80ee760694486 | [
"dummy = ListNode(0)\ndummy.next = head\ncurr = head\nposition = 0\nwhile curr:\n position += 1\n curr = curr.next\nposition -= n\ncurr = dummy\nwhile position > 0:\n position -= 1\n curr = curr.next\ncurr.next = curr.next.next\nreturn dummy.next",
"dummy = ListNode(0)\ndummy.next = head\nfirst = dumm... | <|body_start_0|>
dummy = ListNode(0)
dummy.next = head
curr = head
position = 0
while curr:
position += 1
curr = curr.next
position -= n
curr = dummy
while position > 0:
position -= 1
curr = curr.next
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""Two pass solution"""
<|body_0|>
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""One pass solution, maintaining an (n + 1) gap b/w two pointers"""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k_train_023808 | 1,243 | no_license | [
{
"docstring": "Two pass solution",
"name": "removeNthFromEnd",
"signature": "def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode"
},
{
"docstring": "One pass solution, maintaining an (n + 1) gap b/w two pointers",
"name": "removeNthFromEnd",
"signature": "def removeNthFromEnd... | 2 | stack_v2_sparse_classes_30k_train_018915 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Two pass solution
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: One pass solution, maintaining... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Two pass solution
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: One pass solution, maintaining... | f33d004d7629d46fbc5670f5b384f8a604d7f1e7 | <|skeleton|>
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""Two pass solution"""
<|body_0|>
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""One pass solution, maintaining an (n + 1) gap b/w two pointers"""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""Two pass solution"""
dummy = ListNode(0)
dummy.next = head
curr = head
position = 0
while curr:
position += 1
curr = curr.next
position -= n
curr... | the_stack_v2_python_sparse | Remove Nth Node From End of List.py | aulee888/LeetCode | train | 0 | |
ee0ab1ed4fbee5cbaad6498406550bd1cafa0d43 | [
"token = get_token(['/api/movie'])\nurl = 'https://dynamic6.scrape.cuiqingcai.com/api/movie/?limit=10&offset=0&token={}'.format(token)\nyield scrapy.Request(url)",
"results = json.loads(response.text)\nif not results:\n return\nres_list = results.get('results')\nfor data in res_list:\n uuid = data.get('id',... | <|body_start_0|>
token = get_token(['/api/movie'])
url = 'https://dynamic6.scrape.cuiqingcai.com/api/movie/?limit=10&offset=0&token={}'.format(token)
yield scrapy.Request(url)
<|end_body_0|>
<|body_start_1|>
results = json.loads(response.text)
if not results:
return
... | ScrapeMovieSpider | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScrapeMovieSpider:
def start_requests(self):
"""请求列表页"""
<|body_0|>
def parse(self, response):
"""列表页解析+列表页翻页"""
<|body_1|>
def parse_detail(self, response):
"""解析详情页"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
token = get_t... | stack_v2_sparse_classes_36k_train_023809 | 1,879 | permissive | [
{
"docstring": "请求列表页",
"name": "start_requests",
"signature": "def start_requests(self)"
},
{
"docstring": "列表页解析+列表页翻页",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "解析详情页",
"name": "parse_detail",
"signature": "def parse_detail(self, res... | 3 | stack_v2_sparse_classes_30k_train_010064 | Implement the Python class `ScrapeMovieSpider` described below.
Class description:
Implement the ScrapeMovieSpider class.
Method signatures and docstrings:
- def start_requests(self): 请求列表页
- def parse(self, response): 列表页解析+列表页翻页
- def parse_detail(self, response): 解析详情页 | Implement the Python class `ScrapeMovieSpider` described below.
Class description:
Implement the ScrapeMovieSpider class.
Method signatures and docstrings:
- def start_requests(self): 请求列表页
- def parse(self, response): 列表页解析+列表页翻页
- def parse_detail(self, response): 解析详情页
<|skeleton|>
class ScrapeMovieSpider:
d... | 5922e39bee47bf4114ab06670f49e32eb1bc4b1d | <|skeleton|>
class ScrapeMovieSpider:
def start_requests(self):
"""请求列表页"""
<|body_0|>
def parse(self, response):
"""列表页解析+列表页翻页"""
<|body_1|>
def parse_detail(self, response):
"""解析详情页"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScrapeMovieSpider:
def start_requests(self):
"""请求列表页"""
token = get_token(['/api/movie'])
url = 'https://dynamic6.scrape.cuiqingcai.com/api/movie/?limit=10&offset=0&token={}'.format(token)
yield scrapy.Request(url)
def parse(self, response):
"""列表页解析+列表页翻页"""
... | the_stack_v2_python_sparse | credit_china/spiders/scrape_movie.py | pythonyhd/reverse_spider | train | 9 | |
813362b8df0c6241ec1d8bcdce7750e4b2355363 | [
"def inorder(root):\n if not root:\n return\n inorder(root.left)\n ans.append(root.val)\n inorder(root.right)\nans = []\ninorder(root)\nreturn ans",
"def preorder(root):\n if not root:\n return\n ans.append(root)\n preorder(root.left)\n preorder(root.right)\nans = []\npreorde... | <|body_start_0|>
def inorder(root):
if not root:
return
inorder(root.left)
ans.append(root.val)
inorder(root.right)
ans = []
inorder(root)
return ans
<|end_body_0|>
<|body_start_1|>
def preorder(root):
i... | Solution1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution1:
def inorderTraversal(self, root):
"""采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]"""
<|body_0|>
def preorderTraversal(self, root):
"""采用递归方法实现 先序遍历 :param root: TreeNode :return: List[int]"""
<|body_1|>
def postorderTraversal(self, r... | stack_v2_sparse_classes_36k_train_023810 | 1,981 | no_license | [
{
"docstring": "采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]",
"name": "inorderTraversal",
"signature": "def inorderTraversal(self, root)"
},
{
"docstring": "采用递归方法实现 先序遍历 :param root: TreeNode :return: List[int]",
"name": "preorderTraversal",
"signature": "def preorderTraversa... | 3 | stack_v2_sparse_classes_30k_val_000798 | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def inorderTraversal(self, root): 采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]
- def preorderTraversal(self, root): 采用递归方法实现 先序遍历 :param root: TreeNode :return: List[... | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def inorderTraversal(self, root): 采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]
- def preorderTraversal(self, root): 采用递归方法实现 先序遍历 :param root: TreeNode :return: List[... | e03b8a324e816fee9c8440552de825be07132170 | <|skeleton|>
class Solution1:
def inorderTraversal(self, root):
"""采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]"""
<|body_0|>
def preorderTraversal(self, root):
"""采用递归方法实现 先序遍历 :param root: TreeNode :return: List[int]"""
<|body_1|>
def postorderTraversal(self, r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution1:
def inorderTraversal(self, root):
"""采用递归方法实现 中序遍历 :param root: TreeNode :return: List[int]"""
def inorder(root):
if not root:
return
inorder(root.left)
ans.append(root.val)
inorder(root.right)
ans = []
... | the_stack_v2_python_sparse | Leetcode0094.py | ThompsonHe/LeetCode-Python | train | 0 | |
5a426ff2d3bcc34a6ab0dab14b3931f27f543cfe | [
"form = self.form_class(request.POST)\nif form.is_valid():\n form.save()\n return HttpResponseRedirect(self.get_success_url())\nelse:\n return self.form_invalid(form)",
"if self.request.META['QUERY_STRING']:\n return '%s?%s' % (reverse('login'), self.request.META['QUERY_STRING'])\nelse:\n return re... | <|body_start_0|>
form = self.form_class(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(self.get_success_url())
else:
return self.form_invalid(form)
<|end_body_0|>
<|body_start_1|>
if self.request.META['QUERY_STRING']:
... | Would help to render the sign up form and create new user. | SignUpPageView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SignUpPageView:
"""Would help to render the sign up form and create new user."""
def post(self, request, *args, **kwargs):
"""Would help to create user."""
<|body_0|>
def get_success_url(self):
"""Would return the success url depending on the whether query url is... | stack_v2_sparse_classes_36k_train_023811 | 12,613 | no_license | [
{
"docstring": "Would help to create user.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "Would return the success url depending on the whether query url is available.",
"name": "get_success_url",
"signature": "def get_success_url(self)"
},... | 3 | stack_v2_sparse_classes_30k_train_005380 | Implement the Python class `SignUpPageView` described below.
Class description:
Would help to render the sign up form and create new user.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Would help to create user.
- def get_success_url(self): Would return the success url depending on the... | Implement the Python class `SignUpPageView` described below.
Class description:
Would help to render the sign up form and create new user.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Would help to create user.
- def get_success_url(self): Would return the success url depending on the... | c8e89f21887e9a260f0f1f8cb57fb5c8539ccce8 | <|skeleton|>
class SignUpPageView:
"""Would help to render the sign up form and create new user."""
def post(self, request, *args, **kwargs):
"""Would help to create user."""
<|body_0|>
def get_success_url(self):
"""Would return the success url depending on the whether query url is... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SignUpPageView:
"""Would help to render the sign up form and create new user."""
def post(self, request, *args, **kwargs):
"""Would help to create user."""
form = self.form_class(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(self... | the_stack_v2_python_sparse | client/views.py | jeezybrick/ad_f_my | train | 0 |
82538a4576d08100583c46aa593b218dbe36934e | [
"proc = _RpcProcessor(resolver, netutils.GetDaemonPort(constants.NODED), lock_monitor_cb=lock_monitor_cb)\nself._proc = compat.partial(proc, _req_process_fn=_req_process_fn)\nself._encoder = compat.partial(self._EncodeArg, encoder_fn)",
"argkind, value = arg\nif argkind is None:\n return value\nelse:\n retu... | <|body_start_0|>
proc = _RpcProcessor(resolver, netutils.GetDaemonPort(constants.NODED), lock_monitor_cb=lock_monitor_cb)
self._proc = compat.partial(proc, _req_process_fn=_req_process_fn)
self._encoder = compat.partial(self._EncodeArg, encoder_fn)
<|end_body_0|>
<|body_start_1|>
argkin... | _RpcClientBase | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _RpcClientBase:
def __init__(self, resolver, encoder_fn, lock_monitor_cb=None, _req_process_fn=None):
"""Initializes this class."""
<|body_0|>
def _EncodeArg(encoder_fn, node, arg):
"""Encode argument."""
<|body_1|>
def _Call(self, cdef, node_list, args)... | stack_v2_sparse_classes_36k_train_023812 | 33,673 | permissive | [
{
"docstring": "Initializes this class.",
"name": "__init__",
"signature": "def __init__(self, resolver, encoder_fn, lock_monitor_cb=None, _req_process_fn=None)"
},
{
"docstring": "Encode argument.",
"name": "_EncodeArg",
"signature": "def _EncodeArg(encoder_fn, node, arg)"
},
{
... | 3 | null | Implement the Python class `_RpcClientBase` described below.
Class description:
Implement the _RpcClientBase class.
Method signatures and docstrings:
- def __init__(self, resolver, encoder_fn, lock_monitor_cb=None, _req_process_fn=None): Initializes this class.
- def _EncodeArg(encoder_fn, node, arg): Encode argument... | Implement the Python class `_RpcClientBase` described below.
Class description:
Implement the _RpcClientBase class.
Method signatures and docstrings:
- def __init__(self, resolver, encoder_fn, lock_monitor_cb=None, _req_process_fn=None): Initializes this class.
- def _EncodeArg(encoder_fn, node, arg): Encode argument... | 456ea285a7583183c2c8e5bcffe9006ec8a9d658 | <|skeleton|>
class _RpcClientBase:
def __init__(self, resolver, encoder_fn, lock_monitor_cb=None, _req_process_fn=None):
"""Initializes this class."""
<|body_0|>
def _EncodeArg(encoder_fn, node, arg):
"""Encode argument."""
<|body_1|>
def _Call(self, cdef, node_list, args)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _RpcClientBase:
def __init__(self, resolver, encoder_fn, lock_monitor_cb=None, _req_process_fn=None):
"""Initializes this class."""
proc = _RpcProcessor(resolver, netutils.GetDaemonPort(constants.NODED), lock_monitor_cb=lock_monitor_cb)
self._proc = compat.partial(proc, _req_process_fn... | the_stack_v2_python_sparse | lib/rpc/node.py | ganeti/ganeti | train | 465 | |
37a42eb06c40785ad733ae1b6111362f3e46e5ab | [
"assert ConfHelper.loaded\nif method.upper() not in HTTP.METHOD:\n return cls.DUMMY_RESPONSE\nelse:\n args['method'] = method.upper()\n return BaseHelper.forward(cls, url, args, ConfHelper.LBMP_SENDER_CONF.url, HTTP.METHOD.POST)",
"assert ConfHelper.loaded\n\ndef _callback(response):\n if isinstance(r... | <|body_start_0|>
assert ConfHelper.loaded
if method.upper() not in HTTP.METHOD:
return cls.DUMMY_RESPONSE
else:
args['method'] = method.upper()
return BaseHelper.forward(cls, url, args, ConfHelper.LBMP_SENDER_CONF.url, HTTP.METHOD.POST)
<|end_body_0|>
<|body_... | /le: cellid /gv: get location_name /ge: convert longitude and latitude /gv_query: query the POI from LBMP | LbmpSenderHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LbmpSenderHelper:
"""/le: cellid /gv: get location_name /ge: convert longitude and latitude /gv_query: query the POI from LBMP"""
def forward(cls, url, args, method=HTTP.METHOD.POST):
"""Forward the request in block most (sync mode) to sender. This means I will wait for the response ... | stack_v2_sparse_classes_36k_train_023813 | 3,365 | no_license | [
{
"docstring": "Forward the request in block most (sync mode) to sender. This means I will wait for the response from sender, which would block following requests. This should be avoided in uweb.",
"name": "forward",
"signature": "def forward(cls, url, args, method=HTTP.METHOD.POST)"
},
{
"docst... | 2 | null | Implement the Python class `LbmpSenderHelper` described below.
Class description:
/le: cellid /gv: get location_name /ge: convert longitude and latitude /gv_query: query the POI from LBMP
Method signatures and docstrings:
- def forward(cls, url, args, method=HTTP.METHOD.POST): Forward the request in block most (sync ... | Implement the Python class `LbmpSenderHelper` described below.
Class description:
/le: cellid /gv: get location_name /ge: convert longitude and latitude /gv_query: query the POI from LBMP
Method signatures and docstrings:
- def forward(cls, url, args, method=HTTP.METHOD.POST): Forward the request in block most (sync ... | 3b095a325581b1fc48497c234f0ad55e928586a1 | <|skeleton|>
class LbmpSenderHelper:
"""/le: cellid /gv: get location_name /ge: convert longitude and latitude /gv_query: query the POI from LBMP"""
def forward(cls, url, args, method=HTTP.METHOD.POST):
"""Forward the request in block most (sync mode) to sender. This means I will wait for the response ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LbmpSenderHelper:
"""/le: cellid /gv: get location_name /ge: convert longitude and latitude /gv_query: query the POI from LBMP"""
def forward(cls, url, args, method=HTTP.METHOD.POST):
"""Forward the request in block most (sync mode) to sender. This means I will wait for the response from sender, ... | the_stack_v2_python_sparse | libs/helpers/lbmpsenderhelper.py | jcsy521/ydws | train | 0 |
a40e07cf86d5e5e9fcaf2ad6b159c90d02679ccc | [
"buildingCount = len(buildings)\nif buildingCount == 0:\n return []\ncorners = [[L, H, R] for L, R, H in buildings]\ncorners += [[R, None, 0] for L, R, H in buildings]\ncorners.sort()\nskyline = []\nshift = corners[0][0] - 1\nskylineheight = -1\nh = [[0, float('inf')]]\nfor c in corners:\n if c[0] > shift:\n ... | <|body_start_0|>
buildingCount = len(buildings)
if buildingCount == 0:
return []
corners = [[L, H, R] for L, R, H in buildings]
corners += [[R, None, 0] for L, R, H in buildings]
corners.sort()
skyline = []
shift = corners[0][0] - 1
skylineheig... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getSkyline(self, buildings):
""":type buildings: List[List[int]] :rtype: List[List[int]]"""
<|body_0|>
def _getSkyline(self, buildings):
"""https://discuss.leetcode.com/topic/34119/10-line-python-solution-104-ms/2 credit : kitt"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_023814 | 2,450 | no_license | [
{
"docstring": ":type buildings: List[List[int]] :rtype: List[List[int]]",
"name": "getSkyline",
"signature": "def getSkyline(self, buildings)"
},
{
"docstring": "https://discuss.leetcode.com/topic/34119/10-line-python-solution-104-ms/2 credit : kitt",
"name": "_getSkyline",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_002249 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSkyline(self, buildings): :type buildings: List[List[int]] :rtype: List[List[int]]
- def _getSkyline(self, buildings): https://discuss.leetcode.com/topic/34119/10-line-pyt... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSkyline(self, buildings): :type buildings: List[List[int]] :rtype: List[List[int]]
- def _getSkyline(self, buildings): https://discuss.leetcode.com/topic/34119/10-line-pyt... | a2841fdb624548fdc6ef430e23ca46f3300e0558 | <|skeleton|>
class Solution:
def getSkyline(self, buildings):
""":type buildings: List[List[int]] :rtype: List[List[int]]"""
<|body_0|>
def _getSkyline(self, buildings):
"""https://discuss.leetcode.com/topic/34119/10-line-python-solution-104-ms/2 credit : kitt"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getSkyline(self, buildings):
""":type buildings: List[List[int]] :rtype: List[List[int]]"""
buildingCount = len(buildings)
if buildingCount == 0:
return []
corners = [[L, H, R] for L, R, H in buildings]
corners += [[R, None, 0] for L, R, H in b... | the_stack_v2_python_sparse | getSkyLine.py | sfeng77/myleetcode | train | 1 | |
884cb8ed4dff73082c402a2c8a0f5ceafa19c8bf | [
"result = []\n\ndef preOrder(root):\n if not root:\n return None\n result.append(str(root.val))\n preOrder(root.left)\n preOrder(root.right)\npreOrder(root)\nreturn ' '.join(result)",
"vals = [int(val) for val in data.split()]\n\ndef build(minVal: int, maxVal: int) -> TreeNode:\n if vals and... | <|body_start_0|>
result = []
def preOrder(root):
if not root:
return None
result.append(str(root.val))
preOrder(root.left)
preOrder(root.right)
preOrder(root)
return ' '.join(result)
<|end_body_0|>
<|body_start_1|>
... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
... | stack_v2_sparse_classes_36k_train_023815 | 1,078 | permissive | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | 8a10b23335d8e9f080e5c39715b38bcc2916ff00 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
result = []
def preOrder(root):
if not root:
return None
result.append(str(root.val))
preOrder(root.left)
preOrder(root.right)
... | the_stack_v2_python_sparse | Leetcode/449. Serialize and Deserialize BST/solution1.py | hi0t/Outtalent | train | 0 | |
3dac367a3362f4812aad0a6a9e6ecacb204e91b7 | [
"self.out = output\nself.active = False\nself.bgcolor = bgcolor\nself.bg = {}\nself.hide_cursor = hide_cursor\nself.alt_buf = alt_buf",
"if not self.active:\n print('screen not initialised')\n sys.exit()\nprint(string, file=self.out, end='')",
"self.active = True\nif self.alt_buf:\n self.write('\\x1b[?... | <|body_start_0|>
self.out = output
self.active = False
self.bgcolor = bgcolor
self.bg = {}
self.hide_cursor = hide_cursor
self.alt_buf = alt_buf
<|end_body_0|>
<|body_start_1|>
if not self.active:
print('screen not initialised')
sys.exit()... | A context manager for writing to the terminal. When entered the screen is prepared to show graphics, and when exited it always returns the screen to a usable state | ConsoleGraphics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConsoleGraphics:
"""A context manager for writing to the terminal. When entered the screen is prepared to show graphics, and when exited it always returns the screen to a usable state"""
def __init__(self, output=sys.stdout, bgcolor=DEFAULT, hide_cursor=True, alt_buf=True):
"""output... | stack_v2_sparse_classes_36k_train_023816 | 2,248 | no_license | [
{
"docstring": "output: the file-like object to print to bgcolor: the color to initialise the background to hide_cursor: whether or not to hide the cursor. Can be useful for debugging alt_buf: whether or not to switch to the alternate buffer. Useful for debugging",
"name": "__init__",
"signature": "def ... | 4 | stack_v2_sparse_classes_30k_train_013113 | Implement the Python class `ConsoleGraphics` described below.
Class description:
A context manager for writing to the terminal. When entered the screen is prepared to show graphics, and when exited it always returns the screen to a usable state
Method signatures and docstrings:
- def __init__(self, output=sys.stdout,... | Implement the Python class `ConsoleGraphics` described below.
Class description:
A context manager for writing to the terminal. When entered the screen is prepared to show graphics, and when exited it always returns the screen to a usable state
Method signatures and docstrings:
- def __init__(self, output=sys.stdout,... | d0fffddfed1dfddea4e17487ffb21dba79e83a75 | <|skeleton|>
class ConsoleGraphics:
"""A context manager for writing to the terminal. When entered the screen is prepared to show graphics, and when exited it always returns the screen to a usable state"""
def __init__(self, output=sys.stdout, bgcolor=DEFAULT, hide_cursor=True, alt_buf=True):
"""output... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConsoleGraphics:
"""A context manager for writing to the terminal. When entered the screen is prepared to show graphics, and when exited it always returns the screen to a usable state"""
def __init__(self, output=sys.stdout, bgcolor=DEFAULT, hide_cursor=True, alt_buf=True):
"""output: the file-li... | the_stack_v2_python_sparse | consolegraphics.py | MageJohn/PROM | train | 0 |
9bcfc6ff45a499fa854aea7edd01b64ad718e20b | [
"super(ListLaunchConfigTest, cls).setUpClass()\ncls.lc_disk_config = 'AUTO'\ncls.lc_personality = [{'path': '/root/.ssh/authorized_keys', 'contents': 'DQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp'}]\ncls.lc_metadata = {'lc_meta_key_1': 'lc_meta_value_1', 'lc_meta_key_2': 'lc_meta_value_2'}\ncls.lc_networks = [{'uuid': ... | <|body_start_0|>
super(ListLaunchConfigTest, cls).setUpClass()
cls.lc_disk_config = 'AUTO'
cls.lc_personality = [{'path': '/root/.ssh/authorized_keys', 'contents': 'DQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp'}]
cls.lc_metadata = {'lc_meta_key_1': 'lc_meta_value_1', 'lc_meta_key_2': 'lc_met... | Verify launch config. | ListLaunchConfigTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListLaunchConfigTest:
"""Verify launch config."""
def setUpClass(cls):
"""Creates a scaling group."""
<|body_0|>
def test_list_launch_config_response(self):
"""Verify the list config call for response code, headers and data."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_023817 | 4,090 | permissive | [
{
"docstring": "Creates a scaling group.",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "Verify the list config call for response code, headers and data.",
"name": "test_list_launch_config_response",
"signature": "def test_list_launch_config_response(self)"
... | 2 | stack_v2_sparse_classes_30k_train_006652 | Implement the Python class `ListLaunchConfigTest` described below.
Class description:
Verify launch config.
Method signatures and docstrings:
- def setUpClass(cls): Creates a scaling group.
- def test_list_launch_config_response(self): Verify the list config call for response code, headers and data. | Implement the Python class `ListLaunchConfigTest` described below.
Class description:
Verify launch config.
Method signatures and docstrings:
- def setUpClass(cls): Creates a scaling group.
- def test_list_launch_config_response(self): Verify the list config call for response code, headers and data.
<|skeleton|>
cla... | 7199cdd67255fe116dbcbedea660c13453671134 | <|skeleton|>
class ListLaunchConfigTest:
"""Verify launch config."""
def setUpClass(cls):
"""Creates a scaling group."""
<|body_0|>
def test_list_launch_config_response(self):
"""Verify the list config call for response code, headers and data."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ListLaunchConfigTest:
"""Verify launch config."""
def setUpClass(cls):
"""Creates a scaling group."""
super(ListLaunchConfigTest, cls).setUpClass()
cls.lc_disk_config = 'AUTO'
cls.lc_personality = [{'path': '/root/.ssh/authorized_keys', 'contents': 'DQoiQSBjbG91ZCBkb2VzIG5... | the_stack_v2_python_sparse | autoscale_cloudroast/test_repo/autoscale/functional/launch_config/test_list_launch_config.py | rackerlabs/otter | train | 20 |
3452e571594f7b69ab6b13cd39f4d0b8da463814 | [
"@lru_cache(None)\ndef dp(i):\n if i == len(s):\n return 1\n if s[i] == '0':\n return 0\n ans = dp(i + 1)\n if i + 1 < len(s) and int(s[i:i + 2]) < 27:\n ans += dp(i + 2)\n return ans\nreturn dp(0)",
"valid_two = {str(x) for x in range(10, 27)}\n\n@cache\ndef dp(s: str) -> int:... | <|body_start_0|>
@lru_cache(None)
def dp(i):
if i == len(s):
return 1
if s[i] == '0':
return 0
ans = dp(i + 1)
if i + 1 < len(s) and int(s[i:i + 2]) < 27:
ans += dp(i + 2)
return ans
retur... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numDecodings(self, s: str) -> int:
"""2021/8/18 269 / 269 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.6 MB :param s: :return:"""
<|body_0|>
def numDecodings2(self, s: str) -> int:
"""2022-10-01 Runtime: 37 ms, faster than 87.73% ... | stack_v2_sparse_classes_36k_train_023818 | 2,017 | permissive | [
{
"docstring": "2021/8/18 269 / 269 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.6 MB :param s: :return:",
"name": "numDecodings",
"signature": "def numDecodings(self, s: str) -> int"
},
{
"docstring": "2022-10-01 Runtime: 37 ms, faster than 87.73% Memory Usage: 14.5 MB, l... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDecodings(self, s: str) -> int: 2021/8/18 269 / 269 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.6 MB :param s: :return:
- def numDecodings2(self, s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDecodings(self, s: str) -> int: 2021/8/18 269 / 269 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.6 MB :param s: :return:
- def numDecodings2(self, s... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def numDecodings(self, s: str) -> int:
"""2021/8/18 269 / 269 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.6 MB :param s: :return:"""
<|body_0|>
def numDecodings2(self, s: str) -> int:
"""2022-10-01 Runtime: 37 ms, faster than 87.73% ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numDecodings(self, s: str) -> int:
"""2021/8/18 269 / 269 test cases passed. Status: Accepted Runtime: 36 ms Memory Usage: 14.6 MB :param s: :return:"""
@lru_cache(None)
def dp(i):
if i == len(s):
return 1
if s[i] == '0':
... | the_stack_v2_python_sparse | src/91-DecodeWays.py | Jiezhi/myleetcode | train | 1 | |
b458b6bec737a62066c065012afb89550dbb6a78 | [
"self.callbacks = callbacks\nself.skip_tags = skip_tags\nself.parse_email = parse_email\nself.url_re = url_re\nself.email_re = email_re\nself.parser = html5lib_shim.BleachHTMLParser(tags=html5lib_shim.HTML_TAGS, strip=False, consume_entities=True, namespaceHTMLElements=False)\nself.walker = html5lib_shim.getTreeWal... | <|body_start_0|>
self.callbacks = callbacks
self.skip_tags = skip_tags
self.parse_email = parse_email
self.url_re = url_re
self.email_re = email_re
self.parser = html5lib_shim.BleachHTMLParser(tags=html5lib_shim.HTML_TAGS, strip=False, consume_entities=True, namespaceHTML... | Convert URL-like strings in an HTML fragment to links This function converts strings that look like URLs, domain names and email addresses in text that may be an HTML fragment to links, while preserving: 1. links already in the string 2. urls found in attributes 3. email addresses linkify does a best-effort approach an... | Linker | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Linker:
"""Convert URL-like strings in an HTML fragment to links This function converts strings that look like URLs, domain names and email addresses in text that may be an HTML fragment to links, while preserving: 1. links already in the string 2. urls found in attributes 3. email addresses link... | stack_v2_sparse_classes_36k_train_023819 | 19,432 | permissive | [
{
"docstring": "Creates a Linker instance :arg list callbacks: list of callbacks to run when adjusting tag attributes; defaults to ``bleach.linkifier.DEFAULT_CALLBACKS`` :arg list skip_tags: list of tags that you don't want to linkify the contents of; for example, you could set this to ``['pre']`` to skip linki... | 2 | null | Implement the Python class `Linker` described below.
Class description:
Convert URL-like strings in an HTML fragment to links This function converts strings that look like URLs, domain names and email addresses in text that may be an HTML fragment to links, while preserving: 1. links already in the string 2. urls foun... | Implement the Python class `Linker` described below.
Class description:
Convert URL-like strings in an HTML fragment to links This function converts strings that look like URLs, domain names and email addresses in text that may be an HTML fragment to links, while preserving: 1. links already in the string 2. urls foun... | 1ad7ec05fb1e3676ac879585296c513c3ee50ef9 | <|skeleton|>
class Linker:
"""Convert URL-like strings in an HTML fragment to links This function converts strings that look like URLs, domain names and email addresses in text that may be an HTML fragment to links, while preserving: 1. links already in the string 2. urls found in attributes 3. email addresses link... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Linker:
"""Convert URL-like strings in an HTML fragment to links This function converts strings that look like URLs, domain names and email addresses in text that may be an HTML fragment to links, while preserving: 1. links already in the string 2. urls found in attributes 3. email addresses linkify does a be... | the_stack_v2_python_sparse | Library/lib/python3.7/site-packages/bleach/linkifier.py | holzschu/Carnets | train | 541 |
7f9a2b359c9ebfc98dfb9b3ffb294e55f64c586d | [
"M = 1000000007\ndp = [[0] * (k + 1) for _ in range(n + 1)]\ndp[0][0] = 1\nfor i in range(1, n + 1):\n dp[i][0] = 1\n for j in range(1, k + 1):\n dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % M\n if j >= i:\n dp[i][j] = (dp[i][j] - dp[i - 1][j - i] + M) % M\nprint(dp)\nreturn dp[n][k]",
... | <|body_start_0|>
M = 1000000007
dp = [[0] * (k + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
dp[i][0] = 1
for j in range(1, k + 1):
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % M
if j >= i:
dp[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kInversePairs(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_0|>
def kInversePairs2(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_1|>
def kInversePairs3(self, n, k):
""":type n: int :type k: int :r... | stack_v2_sparse_classes_36k_train_023820 | 3,029 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: int",
"name": "kInversePairs",
"signature": "def kInversePairs(self, n, k)"
},
{
"docstring": ":type n: int :type k: int :rtype: int",
"name": "kInversePairs2",
"signature": "def kInversePairs2(self, n, k)"
},
{
"docstring": ":typ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kInversePairs(self, n, k): :type n: int :type k: int :rtype: int
- def kInversePairs2(self, n, k): :type n: int :type k: int :rtype: int
- def kInversePairs3(self, n, k): :ty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kInversePairs(self, n, k): :type n: int :type k: int :rtype: int
- def kInversePairs2(self, n, k): :type n: int :type k: int :rtype: int
- def kInversePairs3(self, n, k): :ty... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Solution:
def kInversePairs(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_0|>
def kInversePairs2(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_1|>
def kInversePairs3(self, n, k):
""":type n: int :type k: int :r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def kInversePairs(self, n, k):
""":type n: int :type k: int :rtype: int"""
M = 1000000007
dp = [[0] * (k + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
dp[i][0] = 1
for j in range(1, k + 1):
dp[i][j] ... | the_stack_v2_python_sparse | code629KInversePairsArray.py | cybelewang/leetcode-python | train | 0 | |
5eae4fc521669e25024b4e7526a1b103c984d9a4 | [
"srcdir = tf_cfg.cfg.get('Tempesta', 'srcdir')\nworkdir = tf_cfg.cfg.get('Tempesta', 'workdir')\ntemplate = '%s/etc/js_challenge.tpl' % srcdir\njs_code = '%s/etc/js_challenge.js.tpl' % srcdir\nremote.tempesta.run_cmd('cp %s %s' % (js_code, workdir))\nremote.tempesta.run_cmd('cp %s %s/js1.tpl' % (template, workdir))... | <|body_start_0|>
srcdir = tf_cfg.cfg.get('Tempesta', 'srcdir')
workdir = tf_cfg.cfg.get('Tempesta', 'workdir')
template = '%s/etc/js_challenge.tpl' % srcdir
js_code = '%s/etc/js_challenge.js.tpl' % srcdir
remote.tempesta.run_cmd('cp %s %s' % (js_code, workdir))
remote.tem... | Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived. | JSChallengeDefVhostInherit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JSChallengeDefVhostInherit:
"""Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived."""
def prepare_js_templates(self):
"""Templates for JS challenge are modified by start script, create a copy of default template for ea... | stack_v2_sparse_classes_36k_train_023821 | 24,777 | no_license | [
{
"docstring": "Templates for JS challenge are modified by start script, create a copy of default template for each vhost.",
"name": "prepare_js_templates",
"signature": "def prepare_js_templates(self)"
},
{
"docstring": "Clients send the validating request just in time and pass the challenge.",... | 2 | stack_v2_sparse_classes_30k_train_012634 | Implement the Python class `JSChallengeDefVhostInherit` described below.
Class description:
Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived.
Method signatures and docstrings:
- def prepare_js_templates(self): Templates for JS challenge are modified ... | Implement the Python class `JSChallengeDefVhostInherit` described below.
Class description:
Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived.
Method signatures and docstrings:
- def prepare_js_templates(self): Templates for JS challenge are modified ... | d56358ea653dbb367624937197ce5e489abf0b00 | <|skeleton|>
class JSChallengeDefVhostInherit:
"""Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived."""
def prepare_js_templates(self):
"""Templates for JS challenge are modified by start script, create a copy of default template for ea... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JSChallengeDefVhostInherit:
"""Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived."""
def prepare_js_templates(self):
"""Templates for JS challenge are modified by start script, create a copy of default template for each vhost."""
... | the_stack_v2_python_sparse | sessions/test_js_challenge.py | tempesta-tech/tempesta-test | train | 13 |
90f1b0df8e7a084a641605e530906a2c8078e3cb | [
"desired_samples = model_settings['desired_samples']\nself.wav_filename_placeholder_ = tf.placeholder(tf.string, [])\nwav_loader = io_ops.read_file(self.wav_filename_placeholder_)\nwav_decoder = contrib_audio.decode_wav(wav_loader, desired_channels=1, desired_samples=desired_samples)\nself.foreground_volume_placeho... | <|body_start_0|>
desired_samples = model_settings['desired_samples']
self.wav_filename_placeholder_ = tf.placeholder(tf.string, [])
wav_loader = io_ops.read_file(self.wav_filename_placeholder_)
wav_decoder = contrib_audio.decode_wav(wav_loader, desired_channels=1, desired_samples=desired... | AudioProcessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AudioProcessor:
def prepare_processing_graph(self, model_settings):
"""Builds a TensorFlow graph to apply the input distortions. Creates a graph that loads a WAVE file, decodes it, scales the volume, shifts it in time, adds in background noise, calculates a spectrogram, and then builds a... | stack_v2_sparse_classes_36k_train_023822 | 7,375 | no_license | [
{
"docstring": "Builds a TensorFlow graph to apply the input distortions. Creates a graph that loads a WAVE file, decodes it, scales the volume, shifts it in time, adds in background noise, calculates a spectrogram, and then builds an MFCC fingerprint from that. This must be called with an active TensorFlow ses... | 3 | stack_v2_sparse_classes_30k_train_011915 | Implement the Python class `AudioProcessor` described below.
Class description:
Implement the AudioProcessor class.
Method signatures and docstrings:
- def prepare_processing_graph(self, model_settings): Builds a TensorFlow graph to apply the input distortions. Creates a graph that loads a WAVE file, decodes it, scal... | Implement the Python class `AudioProcessor` described below.
Class description:
Implement the AudioProcessor class.
Method signatures and docstrings:
- def prepare_processing_graph(self, model_settings): Builds a TensorFlow graph to apply the input distortions. Creates a graph that loads a WAVE file, decodes it, scal... | 053e5842ada4a6e0b63b9a6281bf823b15b1d645 | <|skeleton|>
class AudioProcessor:
def prepare_processing_graph(self, model_settings):
"""Builds a TensorFlow graph to apply the input distortions. Creates a graph that loads a WAVE file, decodes it, scales the volume, shifts it in time, adds in background noise, calculates a spectrogram, and then builds a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AudioProcessor:
def prepare_processing_graph(self, model_settings):
"""Builds a TensorFlow graph to apply the input distortions. Creates a graph that loads a WAVE file, decodes it, scales the volume, shifts it in time, adds in background noise, calculates a spectrogram, and then builds an MFCC fingerp... | the_stack_v2_python_sparse | 呼吸声音识别呼吸系统疾病/src/audio_processor.py | yphacker/ai_yanxishe | train | 30 | |
14f3446ba3484d9aadd407c666e59499342d7654 | [
"if not self.args.score:\n return\nformatting.print_title('Scoring tests for {}'.format(self.assignment['name']))\nself.scores = OrderedDict()\nif self._grade_all():\n display_breakdown(self.scores)",
"formatting.underline('Scoring tests for ' + test.name)\nprint()\npoints, passed, total = score(test, self.... | <|body_start_0|>
if not self.args.score:
return
formatting.print_title('Scoring tests for {}'.format(self.assignment['name']))
self.scores = OrderedDict()
if self._grade_all():
display_breakdown(self.scores)
<|end_body_0|>
<|body_start_1|>
formatting.unde... | A Protocol that runs tests, formats results, and reports a student's score. | ScoringProtocol | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScoringProtocol:
"""A Protocol that runs tests, formats results, and reports a student's score."""
def on_interact(self):
"""Run gradeable tests and print results."""
<|body_0|>
def _handle_test(self, test):
"""Grades a single Test."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_023823 | 3,491 | permissive | [
{
"docstring": "Run gradeable tests and print results.",
"name": "on_interact",
"signature": "def on_interact(self)"
},
{
"docstring": "Grades a single Test.",
"name": "_handle_test",
"signature": "def _handle_test(self, test)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007169 | Implement the Python class `ScoringProtocol` described below.
Class description:
A Protocol that runs tests, formats results, and reports a student's score.
Method signatures and docstrings:
- def on_interact(self): Run gradeable tests and print results.
- def _handle_test(self, test): Grades a single Test. | Implement the Python class `ScoringProtocol` described below.
Class description:
A Protocol that runs tests, formats results, and reports a student's score.
Method signatures and docstrings:
- def on_interact(self): Run gradeable tests and print results.
- def _handle_test(self, test): Grades a single Test.
<|skelet... | 492a077a06a36644177092f26c3a003fd86c2595 | <|skeleton|>
class ScoringProtocol:
"""A Protocol that runs tests, formats results, and reports a student's score."""
def on_interact(self):
"""Run gradeable tests and print results."""
<|body_0|>
def _handle_test(self, test):
"""Grades a single Test."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScoringProtocol:
"""A Protocol that runs tests, formats results, and reports a student's score."""
def on_interact(self):
"""Run gradeable tests and print results."""
if not self.args.score:
return
formatting.print_title('Scoring tests for {}'.format(self.assignment['n... | the_stack_v2_python_sparse | client/protocols/scoring.py | hpec/ok | train | 0 |
49515a71bf2c852204a373d1c405803164f30d86 | [
"selectors = response.xpath('//div[@class=\"el\"]')\nfor selector in selectors:\n urls = selector.xpath('./p[contains(@class,\"t1\")]/span/a/@href').get()\n if urls:\n yield scrapy.Request(urls, callback=self.parseDetail)",
"title = response.xpath('//div[@class=\"cn\"]/h1/text()').get()\nsalary = res... | <|body_start_0|>
selectors = response.xpath('//div[@class="el"]')
for selector in selectors:
urls = selector.xpath('./p[contains(@class,"t1")]/span/a/@href').get()
if urls:
yield scrapy.Request(urls, callback=self.parseDetail)
<|end_body_0|>
<|body_start_1|>
... | JobSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobSpider:
def parse(self, response):
""":response 网站返回的数据"""
<|body_0|>
def parseDetail(self, response):
"""处理详情页数据"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
selectors = response.xpath('//div[@class="el"]')
for selector in selectors:
... | stack_v2_sparse_classes_36k_train_023824 | 1,261 | no_license | [
{
"docstring": ":response 网站返回的数据",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "处理详情页数据",
"name": "parseDetail",
"signature": "def parseDetail(self, response)"
}
] | 2 | null | Implement the Python class `JobSpider` described below.
Class description:
Implement the JobSpider class.
Method signatures and docstrings:
- def parse(self, response): :response 网站返回的数据
- def parseDetail(self, response): 处理详情页数据 | Implement the Python class `JobSpider` described below.
Class description:
Implement the JobSpider class.
Method signatures and docstrings:
- def parse(self, response): :response 网站返回的数据
- def parseDetail(self, response): 处理详情页数据
<|skeleton|>
class JobSpider:
def parse(self, response):
""":response 网站返回... | 5a0fe16f367876ab5f63aa7737a9e0a0efdb3b09 | <|skeleton|>
class JobSpider:
def parse(self, response):
""":response 网站返回的数据"""
<|body_0|>
def parseDetail(self, response):
"""处理详情页数据"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobSpider:
def parse(self, response):
""":response 网站返回的数据"""
selectors = response.xpath('//div[@class="el"]')
for selector in selectors:
urls = selector.xpath('./p[contains(@class,"t1")]/span/a/@href').get()
if urls:
yield scrapy.Request(urls, c... | the_stack_v2_python_sparse | scrapy框架/jobSpider/jobSpider/spiders/job.py | onism7/spider | train | 1 | |
1457765821fb3bb34a5656efa0bdc4d9225358d0 | [
"announcement = self.kwargs['announcement']\nsender = announcement.created_by.full_name\nif announcement.from_group:\n sender = announcement.from_group.name\nreturn self._delay_mail(to_email=self.user.email_address, context={'first_name': self.user.first_name, 'sender': sender, 'message': announcement.message}, ... | <|body_start_0|>
announcement = self.kwargs['announcement']
sender = announcement.created_by.full_name
if announcement.from_group:
sender = announcement.from_group.name
return self._delay_mail(to_email=self.user.email_address, context={'first_name': self.user.first_name, 'sen... | Sent a notification to one recipient of an Announcement. The base class verifies the user settings. | AnnouncementNotification | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnnouncementNotification:
"""Sent a notification to one recipient of an Announcement. The base class verifies the user settings."""
def generate_mail(self):
"""Generate the email message the user should receive."""
<|body_0|>
def generate_push(self):
"""Generate ... | stack_v2_sparse_classes_36k_train_023825 | 1,567 | permissive | [
{
"docstring": "Generate the email message the user should receive.",
"name": "generate_mail",
"signature": "def generate_mail(self)"
},
{
"docstring": "Generate the push message the user should receive on his/her phone.",
"name": "generate_push",
"signature": "def generate_push(self)"
... | 2 | stack_v2_sparse_classes_30k_train_003462 | Implement the Python class `AnnouncementNotification` described below.
Class description:
Sent a notification to one recipient of an Announcement. The base class verifies the user settings.
Method signatures and docstrings:
- def generate_mail(self): Generate the email message the user should receive.
- def generate_... | Implement the Python class `AnnouncementNotification` described below.
Class description:
Sent a notification to one recipient of an Announcement. The base class verifies the user settings.
Method signatures and docstrings:
- def generate_mail(self): Generate the email message the user should receive.
- def generate_... | 2c1909fd84fe3b3e0a9d3792c4bcc51089ad5a87 | <|skeleton|>
class AnnouncementNotification:
"""Sent a notification to one recipient of an Announcement. The base class verifies the user settings."""
def generate_mail(self):
"""Generate the email message the user should receive."""
<|body_0|>
def generate_push(self):
"""Generate ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnnouncementNotification:
"""Sent a notification to one recipient of an Announcement. The base class verifies the user settings."""
def generate_mail(self):
"""Generate the email message the user should receive."""
announcement = self.kwargs['announcement']
sender = announcement.c... | the_stack_v2_python_sparse | lego/apps/notifications/notifications.py | webkom/lego | train | 53 |
4afee0b10b982e669613e4a8b4a2fb402612665f | [
"actionlist = [1, 2, 3, 4, 5]\nfor action in actionlist:\n if action == 1:\n val = getColumnSelection(action)\n self.assertEqual(val, 'bookID')\n if action == 2:\n val = getColumnSelection(action)\n self.assertEqual(val, 'bookAuthor')\n if action == 3:\n val = getColumnSe... | <|body_start_0|>
actionlist = [1, 2, 3, 4, 5]
for action in actionlist:
if action == 1:
val = getColumnSelection(action)
self.assertEqual(val, 'bookID')
if action == 2:
val = getColumnSelection(action)
self.assertEqu... | Test for getting action solution | TestgetColumnSelection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestgetColumnSelection:
"""Test for getting action solution"""
def testGetColumnSolution(self):
"""This a True test to see if the column is selected"""
<|body_0|>
def testBadGetColumnSolution(self):
"""This a False test to see if the column is selected"""
... | stack_v2_sparse_classes_36k_train_023826 | 1,495 | no_license | [
{
"docstring": "This a True test to see if the column is selected",
"name": "testGetColumnSolution",
"signature": "def testGetColumnSolution(self)"
},
{
"docstring": "This a False test to see if the column is selected",
"name": "testBadGetColumnSolution",
"signature": "def testBadGetColu... | 2 | stack_v2_sparse_classes_30k_train_016531 | Implement the Python class `TestgetColumnSelection` described below.
Class description:
Test for getting action solution
Method signatures and docstrings:
- def testGetColumnSolution(self): This a True test to see if the column is selected
- def testBadGetColumnSolution(self): This a False test to see if the column i... | Implement the Python class `TestgetColumnSelection` described below.
Class description:
Test for getting action solution
Method signatures and docstrings:
- def testGetColumnSolution(self): This a True test to see if the column is selected
- def testBadGetColumnSolution(self): This a False test to see if the column i... | c9fc7f312f9d73fef6af6d13459ea4a69b16cdca | <|skeleton|>
class TestgetColumnSelection:
"""Test for getting action solution"""
def testGetColumnSolution(self):
"""This a True test to see if the column is selected"""
<|body_0|>
def testBadGetColumnSolution(self):
"""This a False test to see if the column is selected"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestgetColumnSelection:
"""Test for getting action solution"""
def testGetColumnSolution(self):
"""This a True test to see if the column is selected"""
actionlist = [1, 2, 3, 4, 5]
for action in actionlist:
if action == 1:
val = getColumnSelection(actio... | the_stack_v2_python_sparse | IT - 412/databaseAssignment/testcases/testGetColumnSelection.py | vifezue/PythonWork | train | 0 |
28c0c57fef07c94ff880fe00eabff1d62060c27c | [
"if not api.cinder.is_volume_service_enabled(request):\n raise rest_utils.AjaxError(501, _('Service Cinder is disabled.'))\nquota_set = api.cinder.default_quota_get(request, request.user.tenant_id)\nresult = [{'display_name': quotas.QUOTA_NAMES.get(quota.name, quota.name.replace('_', ' ').title()) + '', 'name': ... | <|body_start_0|>
if not api.cinder.is_volume_service_enabled(request):
raise rest_utils.AjaxError(501, _('Service Cinder is disabled.'))
quota_set = api.cinder.default_quota_get(request, request.user.tenant_id)
result = [{'display_name': quotas.QUOTA_NAMES.get(quota.name, quota.name.... | API for getting default quotas for cinder | DefaultQuotaSets | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultQuotaSets:
"""API for getting default quotas for cinder"""
def get(self, request):
"""Get the values for Cinder specific quotas Example GET: http://localhost/api/cinder/quota-sets/defaults/"""
<|body_0|>
def patch(self, request):
"""Update the values for C... | stack_v2_sparse_classes_36k_train_023827 | 14,440 | permissive | [
{
"docstring": "Get the values for Cinder specific quotas Example GET: http://localhost/api/cinder/quota-sets/defaults/",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Update the values for Cinder specific quotas This method returns HTTP 204 (no content) on success.",
... | 2 | stack_v2_sparse_classes_30k_train_005046 | Implement the Python class `DefaultQuotaSets` described below.
Class description:
API for getting default quotas for cinder
Method signatures and docstrings:
- def get(self, request): Get the values for Cinder specific quotas Example GET: http://localhost/api/cinder/quota-sets/defaults/
- def patch(self, request): Up... | Implement the Python class `DefaultQuotaSets` described below.
Class description:
API for getting default quotas for cinder
Method signatures and docstrings:
- def get(self, request): Get the values for Cinder specific quotas Example GET: http://localhost/api/cinder/quota-sets/defaults/
- def patch(self, request): Up... | 7896fd8c77a6766a1156a520946efaf792b76ca5 | <|skeleton|>
class DefaultQuotaSets:
"""API for getting default quotas for cinder"""
def get(self, request):
"""Get the values for Cinder specific quotas Example GET: http://localhost/api/cinder/quota-sets/defaults/"""
<|body_0|>
def patch(self, request):
"""Update the values for C... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DefaultQuotaSets:
"""API for getting default quotas for cinder"""
def get(self, request):
"""Get the values for Cinder specific quotas Example GET: http://localhost/api/cinder/quota-sets/defaults/"""
if not api.cinder.is_volume_service_enabled(request):
raise rest_utils.AjaxEr... | the_stack_v2_python_sparse | openstack_dashboard/api/rest/cinder.py | openstack/horizon | train | 1,060 |
f64b6e42ae452ed8b84390f49de81c34e67e081c | [
"try:\n output = self.get_object()\nexcept ObjectDoesNotExist:\n return self.jp_error_response('HTTP_400_BAD_REQUEST', 'UNKNOWN_QUERY', ['Project output not found'])\nelse:\n year = request.GET.get('year', '')\n serializer = self.get_serializer(output, context={'request': request, 'year': year})\nreturn... | <|body_start_0|>
try:
output = self.get_object()
except ObjectDoesNotExist:
return self.jp_error_response('HTTP_400_BAD_REQUEST', 'UNKNOWN_QUERY', ['Project output not found'])
else:
year = request.GET.get('year', '')
serializer = self.get_serializ... | OutputViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OutputViewSet:
def retrieve(self, request, *args, **kwargs):
"""Project details :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def list(self, request, *args, **kwargs):
"""List Projects. :param request: :param args: :param kwargs: :return:"""
... | stack_v2_sparse_classes_36k_train_023828 | 34,498 | permissive | [
{
"docstring": "Project details :param request: :param args: :param kwargs: :return:",
"name": "retrieve",
"signature": "def retrieve(self, request, *args, **kwargs)"
},
{
"docstring": "List Projects. :param request: :param args: :param kwargs: :return:",
"name": "list",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_021472 | Implement the Python class `OutputViewSet` described below.
Class description:
Implement the OutputViewSet class.
Method signatures and docstrings:
- def retrieve(self, request, *args, **kwargs): Project details :param request: :param args: :param kwargs: :return:
- def list(self, request, *args, **kwargs): List Proj... | Implement the Python class `OutputViewSet` described below.
Class description:
Implement the OutputViewSet class.
Method signatures and docstrings:
- def retrieve(self, request, *args, **kwargs): Project details :param request: :param args: :param kwargs: :return:
- def list(self, request, *args, **kwargs): List Proj... | 692e4f745fa2d9b734cea07c5a9670a2d5862616 | <|skeleton|>
class OutputViewSet:
def retrieve(self, request, *args, **kwargs):
"""Project details :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def list(self, request, *args, **kwargs):
"""List Projects. :param request: :param args: :param kwargs: :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OutputViewSet:
def retrieve(self, request, *args, **kwargs):
"""Project details :param request: :param args: :param kwargs: :return:"""
try:
output = self.get_object()
except ObjectDoesNotExist:
return self.jp_error_response('HTTP_400_BAD_REQUEST', 'UNKNOWN_QUER... | the_stack_v2_python_sparse | transparencyportal/transparencyportal/undp_outputs/api_views.py | franckdesales/cipython | train | 0 | |
23f5559faf5a09478fd67e2bab0df661a7574516 | [
"if (nvars + 1) % 2 != 0:\n raise ProblemError('setup requires nvars = 2^p - 1')\nsuper().__init__((nvars, None, np.dtype('float64')))\nself._makeAttributeAndRegister('nvars', 'nu', 'lambda0', 'newton_maxiter', 'newton_tol', 'interval', 'stop_at_nan', localVars=locals(), readOnly=True)\nself.dx = (self.interval[... | <|body_start_0|>
if (nvars + 1) % 2 != 0:
raise ProblemError('setup requires nvars = 2^p - 1')
super().__init__((nvars, None, np.dtype('float64')))
self._makeAttributeAndRegister('nvars', 'nu', 'lambda0', 'newton_maxiter', 'newton_tol', 'interval', 'stop_at_nan', localVars=locals(), ... | Example implementing the generalized Fisher's equation in 1D with finite differences Attributes: A: second-order FD discretization of the 1D laplace operator dx: distance between two spatial nodes | generalized_fisher | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class generalized_fisher:
"""Example implementing the generalized Fisher's equation in 1D with finite differences Attributes: A: second-order FD discretization of the 1D laplace operator dx: distance between two spatial nodes"""
def __init__(self, nvars=127, nu=1.0, lambda0=2.0, newton_maxiter=100... | stack_v2_sparse_classes_36k_train_023829 | 5,961 | permissive | [
{
"docstring": "Initialization routine",
"name": "__init__",
"signature": "def __init__(self, nvars=127, nu=1.0, lambda0=2.0, newton_maxiter=100, newton_tol=1e-12, interval=(-5, 5), stop_at_nan=True)"
},
{
"docstring": "Simple Newton solver. Parameters ---------- rhs : dtype_f Right-hand side fo... | 4 | null | Implement the Python class `generalized_fisher` described below.
Class description:
Example implementing the generalized Fisher's equation in 1D with finite differences Attributes: A: second-order FD discretization of the 1D laplace operator dx: distance between two spatial nodes
Method signatures and docstrings:
- d... | Implement the Python class `generalized_fisher` described below.
Class description:
Example implementing the generalized Fisher's equation in 1D with finite differences Attributes: A: second-order FD discretization of the 1D laplace operator dx: distance between two spatial nodes
Method signatures and docstrings:
- d... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class generalized_fisher:
"""Example implementing the generalized Fisher's equation in 1D with finite differences Attributes: A: second-order FD discretization of the 1D laplace operator dx: distance between two spatial nodes"""
def __init__(self, nvars=127, nu=1.0, lambda0=2.0, newton_maxiter=100... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class generalized_fisher:
"""Example implementing the generalized Fisher's equation in 1D with finite differences Attributes: A: second-order FD discretization of the 1D laplace operator dx: distance between two spatial nodes"""
def __init__(self, nvars=127, nu=1.0, lambda0=2.0, newton_maxiter=100, newton_tol=... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/GeneralizedFisher_1D_FD_implicit.py | Parallel-in-Time/pySDC | train | 30 |
de81d8e5e85f6f355fc69c7b010d515a5abe6757 | [
"if len(point_list) < 3:\n raise ValueError('small number of points')\nself.point_list = point_list\nself.convex_hull = []",
"p_min = min(self.point_list, key=lambda p: (p.y, p.x))\nself.point_list.sort(key=lambda p: ((p - p_min).alpha(), (p - p_min) * (p - p_min)))\nfor point in self.point_list:\n while le... | <|body_start_0|>
if len(point_list) < 3:
raise ValueError('small number of points')
self.point_list = point_list
self.convex_hull = []
<|end_body_0|>
<|body_start_1|>
p_min = min(self.point_list, key=lambda p: (p.y, p.x))
self.point_list.sort(key=lambda p: ((p - p_mi... | Graham's scan algorithm for finding the convex hull of points. https://en.wikipedia.org/wiki/Graham_scan | GrahamScan1 | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GrahamScan1:
"""Graham's scan algorithm for finding the convex hull of points. https://en.wikipedia.org/wiki/Graham_scan"""
def __init__(self, point_list):
"""The algorithm initialization."""
<|body_0|>
def run(self):
"""Executable pseudocode."""
<|body_1... | stack_v2_sparse_classes_36k_train_023830 | 2,863 | permissive | [
{
"docstring": "The algorithm initialization.",
"name": "__init__",
"signature": "def __init__(self, point_list)"
},
{
"docstring": "Executable pseudocode.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000322 | Implement the Python class `GrahamScan1` described below.
Class description:
Graham's scan algorithm for finding the convex hull of points. https://en.wikipedia.org/wiki/Graham_scan
Method signatures and docstrings:
- def __init__(self, point_list): The algorithm initialization.
- def run(self): Executable pseudocode... | Implement the Python class `GrahamScan1` described below.
Class description:
Graham's scan algorithm for finding the convex hull of points. https://en.wikipedia.org/wiki/Graham_scan
Method signatures and docstrings:
- def __init__(self, point_list): The algorithm initialization.
- def run(self): Executable pseudocode... | 93417f2de3ec1694b5a63b1d77b96138bf8db20d | <|skeleton|>
class GrahamScan1:
"""Graham's scan algorithm for finding the convex hull of points. https://en.wikipedia.org/wiki/Graham_scan"""
def __init__(self, point_list):
"""The algorithm initialization."""
<|body_0|>
def run(self):
"""Executable pseudocode."""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GrahamScan1:
"""Graham's scan algorithm for finding the convex hull of points. https://en.wikipedia.org/wiki/Graham_scan"""
def __init__(self, point_list):
"""The algorithm initialization."""
if len(point_list) < 3:
raise ValueError('small number of points')
self.point... | the_stack_v2_python_sparse | planegeometry/hulls/graham.py | ufkapano/planegeometry | train | 1 |
192561fc66246fdd6f91ec1a7cc412d39734c356 | [
"super(SimSiam, self).__init__()\nself.encoder = base_encoder(num_classes=dim, zero_init_residual=True)\nprev_dim = self.encoder.fc.weight.shape[1]\nself.encoder.fc = nn.Sequential(nn.Linear(prev_dim, prev_dim, bias=False), nn.BatchNorm1d(prev_dim), nn.ReLU(inplace=True), nn.Linear(prev_dim, prev_dim, bias=False), ... | <|body_start_0|>
super(SimSiam, self).__init__()
self.encoder = base_encoder(num_classes=dim, zero_init_residual=True)
prev_dim = self.encoder.fc.weight.shape[1]
self.encoder.fc = nn.Sequential(nn.Linear(prev_dim, prev_dim, bias=False), nn.BatchNorm1d(prev_dim), nn.ReLU(inplace=True), nn... | Build a SimSiam model. | SimSiam | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimSiam:
"""Build a SimSiam model."""
def __init__(self, base_encoder, dim=2048, pred_dim=512):
"""dim: feature dimension (default: 2048) pred_dim: hidden dimension of the predictor (default: 512)"""
<|body_0|>
def forward(self, x1, x2):
"""Input: x1: first views... | stack_v2_sparse_classes_36k_train_023831 | 2,880 | no_license | [
{
"docstring": "dim: feature dimension (default: 2048) pred_dim: hidden dimension of the predictor (default: 512)",
"name": "__init__",
"signature": "def __init__(self, base_encoder, dim=2048, pred_dim=512)"
},
{
"docstring": "Input: x1: first views of images x2: second views of images Output: p... | 2 | stack_v2_sparse_classes_30k_train_010217 | Implement the Python class `SimSiam` described below.
Class description:
Build a SimSiam model.
Method signatures and docstrings:
- def __init__(self, base_encoder, dim=2048, pred_dim=512): dim: feature dimension (default: 2048) pred_dim: hidden dimension of the predictor (default: 512)
- def forward(self, x1, x2): I... | Implement the Python class `SimSiam` described below.
Class description:
Build a SimSiam model.
Method signatures and docstrings:
- def __init__(self, base_encoder, dim=2048, pred_dim=512): dim: feature dimension (default: 2048) pred_dim: hidden dimension of the predictor (default: 512)
- def forward(self, x1, x2): I... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class SimSiam:
"""Build a SimSiam model."""
def __init__(self, base_encoder, dim=2048, pred_dim=512):
"""dim: feature dimension (default: 2048) pred_dim: hidden dimension of the predictor (default: 512)"""
<|body_0|>
def forward(self, x1, x2):
"""Input: x1: first views... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimSiam:
"""Build a SimSiam model."""
def __init__(self, base_encoder, dim=2048, pred_dim=512):
"""dim: feature dimension (default: 2048) pred_dim: hidden dimension of the predictor (default: 512)"""
super(SimSiam, self).__init__()
self.encoder = base_encoder(num_classes=dim, zero... | the_stack_v2_python_sparse | generated/test_facebookresearch_simsiam.py | jansel/pytorch-jit-paritybench | train | 35 |
eb4ed989f04dcdce30a03f0b2cce08868ac1a1de | [
"super(Inception5a, self).__init__()\nself.branch1 = ConvBNLayer(num_channels=num_channels, num_filters=ch1x1, filter_size=1, stride=1, padding=0)\nself.branch2 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=0), ConvBNLayer(num_channels=ch3x3... | <|body_start_0|>
super(Inception5a, self).__init__()
self.branch1 = ConvBNLayer(num_channels=num_channels, num_filters=ch1x1, filter_size=1, stride=1, padding=0)
self.branch2 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=... | Inception5a | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inception5a:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num... | stack_v2_sparse_classes_36k_train_023832 | 23,805 | permissive | [
{
"docstring": "@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv doublech3x3reduced : channel numbers of 1x1 conv before the double 3x3 ... | 2 | null | Implement the Python class `Inception5a` described below.
Class description:
Implement the Inception5a class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5a` @Parameters num_channels : c... | Implement the Python class `Inception5a` described below.
Class description:
Implement the Inception5a class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5a` @Parameters num_channels : c... | 78ff3c3ab3906012a0f4a612251347632aa493a7 | <|skeleton|>
class Inception5a:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Inception5a:
def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj):
"""@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 co... | the_stack_v2_python_sparse | ECO/paddle2.0/model/ECO.py | thinkall/Contrib | train | 1 | |
242007547d8c4860ac39086b35e39c80f89f1e6b | [
"try:\n with self.get_keycloak_client() as kc:\n resp = kc.get_realm_roles(user_name)\n roles = [r['name'] for r in resp]\n roles = filter_roles(roles)\n if role_name is None:\n return Response(roles, status=200)\n else:\n exists = role_name in roles\n ... | <|body_start_0|>
try:
with self.get_keycloak_client() as kc:
resp = kc.get_realm_roles(user_name)
roles = [r['name'] for r in resp]
roles = filter_roles(roles)
if role_name is None:
return Response(roles, status=200)... | View to assign role to users | BossUserRole | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BossUserRole:
"""View to assign role to users"""
def get(self, request, user_name, role_name=None):
"""Multi-function method 1) If role_name is None, return all roles assigned to the user 2) If role_name is not None, return True/False if the user is assigned the given role Args: requ... | stack_v2_sparse_classes_36k_train_023833 | 11,158 | permissive | [
{
"docstring": "Multi-function method 1) If role_name is None, return all roles assigned to the user 2) If role_name is not None, return True/False if the user is assigned the given role Args: request: Django rest framework request user_name: User name of the user to check role_name: Name of the role to check, ... | 3 | null | Implement the Python class `BossUserRole` described below.
Class description:
View to assign role to users
Method signatures and docstrings:
- def get(self, request, user_name, role_name=None): Multi-function method 1) If role_name is None, return all roles assigned to the user 2) If role_name is not None, return Tru... | Implement the Python class `BossUserRole` described below.
Class description:
View to assign role to users
Method signatures and docstrings:
- def get(self, request, user_name, role_name=None): Multi-function method 1) If role_name is None, return all roles assigned to the user 2) If role_name is not None, return Tru... | c2e26d272bd7b8d54abdc2948193163537e31291 | <|skeleton|>
class BossUserRole:
"""View to assign role to users"""
def get(self, request, user_name, role_name=None):
"""Multi-function method 1) If role_name is None, return all roles assigned to the user 2) If role_name is not None, return True/False if the user is assigned the given role Args: requ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BossUserRole:
"""View to assign role to users"""
def get(self, request, user_name, role_name=None):
"""Multi-function method 1) If role_name is None, return all roles assigned to the user 2) If role_name is not None, return True/False if the user is assigned the given role Args: request: Django r... | the_stack_v2_python_sparse | django/sso/views/views_user.py | jhuapl-boss/boss | train | 20 |
4c614bd8ded3c714845842d1c9e8ee7499a28fe4 | [
"try:\n filters = {key: Filter(**filter_) for key, filter_ in data.get('filters', {}).items()}\nexcept TypeError as e:\n raise ValidationError(f'Filter: {e}')\ntry:\n paging = Paging(**data.get('paging', {}))\nexcept TypeError as e:\n raise ValidationError(f'Paging: {e}')\ntry:\n sort = [Sort(**sort)... | <|body_start_0|>
try:
filters = {key: Filter(**filter_) for key, filter_ in data.get('filters', {}).items()}
except TypeError as e:
raise ValidationError(f'Filter: {e}')
try:
paging = Paging(**data.get('paging', {}))
except TypeError as e:
... | GridSettings | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GridSettings:
def from_dict(cls, data: Dict[str, Any]) -> 'GridSettings':
"""Create from deserialized json"""
<|body_0|>
def to_args(self) -> Dict[str, Any]:
"""Convert grid parameters to request args format"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_023834 | 3,882 | permissive | [
{
"docstring": "Create from deserialized json",
"name": "from_dict",
"signature": "def from_dict(cls, data: Dict[str, Any]) -> 'GridSettings'"
},
{
"docstring": "Convert grid parameters to request args format",
"name": "to_args",
"signature": "def to_args(self) -> Dict[str, Any]"
}
] | 2 | stack_v2_sparse_classes_30k_train_017289 | Implement the Python class `GridSettings` described below.
Class description:
Implement the GridSettings class.
Method signatures and docstrings:
- def from_dict(cls, data: Dict[str, Any]) -> 'GridSettings': Create from deserialized json
- def to_args(self) -> Dict[str, Any]: Convert grid parameters to request args f... | Implement the Python class `GridSettings` described below.
Class description:
Implement the GridSettings class.
Method signatures and docstrings:
- def from_dict(cls, data: Dict[str, Any]) -> 'GridSettings': Create from deserialized json
- def to_args(self) -> Dict[str, Any]: Convert grid parameters to request args f... | d0353e584925b80c7e07736f8a024f0eeef60dc5 | <|skeleton|>
class GridSettings:
def from_dict(cls, data: Dict[str, Any]) -> 'GridSettings':
"""Create from deserialized json"""
<|body_0|>
def to_args(self) -> Dict[str, Any]:
"""Convert grid parameters to request args format"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GridSettings:
def from_dict(cls, data: Dict[str, Any]) -> 'GridSettings':
"""Create from deserialized json"""
try:
filters = {key: Filter(**filter_) for key, filter_ in data.get('filters', {}).items()}
except TypeError as e:
raise ValidationError(f'Filter: {e}')... | the_stack_v2_python_sparse | webgrid/types.py | level12/webgrid | train | 13 | |
7ac868cd9b089d2cfb71642de7af7b03db0b1e3c | [
"constants = np.array([4.0, 9.0, 16.0])\ninitial_values = np.ones(len(constants))\n\ndef objective_and_gradient(values):\n objective = values ** 2 - constants\n gradient = 2.0 * values\n return (objective, gradient)\nroot_values, converged, failed = self.evaluate(newton_root(objective_and_gradient, initial... | <|body_start_0|>
constants = np.array([4.0, 9.0, 16.0])
initial_values = np.ones(len(constants))
def objective_and_gradient(values):
objective = values ** 2 - constants
gradient = 2.0 * values
return (objective, gradient)
root_values, converged, faile... | Tests for methods in root_finder_newton module. | RootFinderNewtonTest | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RootFinderNewtonTest:
"""Tests for methods in root_finder_newton module."""
def test_newton_root(self):
"""Tests that the newton root finder works on a square root example."""
<|body_0|>
def test_failure_and_non_convergence(self):
"""Tests that we can determine w... | stack_v2_sparse_classes_36k_train_023835 | 4,237 | permissive | [
{
"docstring": "Tests that the newton root finder works on a square root example.",
"name": "test_newton_root",
"signature": "def test_newton_root(self)"
},
{
"docstring": "Tests that we can determine when the root finder has failed.",
"name": "test_failure_and_non_convergence",
"signatu... | 3 | null | Implement the Python class `RootFinderNewtonTest` described below.
Class description:
Tests for methods in root_finder_newton module.
Method signatures and docstrings:
- def test_newton_root(self): Tests that the newton root finder works on a square root example.
- def test_failure_and_non_convergence(self): Tests th... | Implement the Python class `RootFinderNewtonTest` described below.
Class description:
Tests for methods in root_finder_newton module.
Method signatures and docstrings:
- def test_newton_root(self): Tests that the newton root finder works on a square root example.
- def test_failure_and_non_convergence(self): Tests th... | 0d3a2193c0f2d320b65e602cf01d7a617da484df | <|skeleton|>
class RootFinderNewtonTest:
"""Tests for methods in root_finder_newton module."""
def test_newton_root(self):
"""Tests that the newton root finder works on a square root example."""
<|body_0|>
def test_failure_and_non_convergence(self):
"""Tests that we can determine w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RootFinderNewtonTest:
"""Tests for methods in root_finder_newton module."""
def test_newton_root(self):
"""Tests that the newton root finder works on a square root example."""
constants = np.array([4.0, 9.0, 16.0])
initial_values = np.ones(len(constants))
def objective_an... | the_stack_v2_python_sparse | tf_quant_finance/math/root_search/newton_test.py | google/tf-quant-finance | train | 4,165 |
e24408eaacadad5351b7586dd9456db3eda5c912 | [
"if not is_basic_identifier(object_type.name):\n raise BadRequest('Invalid object_type name: %s' % object_type.name)\nif not is_yaml_string_valid(object_type.definition):\n raise BadRequest('Invalid YAML definition')\nobject_type_id, version = self.clients.resource_registry.create(object_type)\nreturn object_... | <|body_start_0|>
if not is_basic_identifier(object_type.name):
raise BadRequest('Invalid object_type name: %s' % object_type.name)
if not is_yaml_string_valid(object_type.definition):
raise BadRequest('Invalid YAML definition')
object_type_id, version = self.clients.resou... | A service for defining and managing object types used as resource, messages, etc. | ObjectManagementService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectManagementService:
"""A service for defining and managing object types used as resource, messages, etc."""
def create_object_type(self, object_type=None):
"""Should receive an ObjectType object"""
<|body_0|>
def update_object_type(self, object_type=None):
"... | stack_v2_sparse_classes_36k_train_023836 | 2,353 | no_license | [
{
"docstring": "Should receive an ObjectType object",
"name": "create_object_type",
"signature": "def create_object_type(self, object_type=None)"
},
{
"docstring": "Should receive an ObjectType object",
"name": "update_object_type",
"signature": "def update_object_type(self, object_type=... | 4 | stack_v2_sparse_classes_30k_train_006837 | Implement the Python class `ObjectManagementService` described below.
Class description:
A service for defining and managing object types used as resource, messages, etc.
Method signatures and docstrings:
- def create_object_type(self, object_type=None): Should receive an ObjectType object
- def update_object_type(se... | Implement the Python class `ObjectManagementService` described below.
Class description:
A service for defining and managing object types used as resource, messages, etc.
Method signatures and docstrings:
- def create_object_type(self, object_type=None): Should receive an ObjectType object
- def update_object_type(se... | 1693081ddaacd4e72c75ab47c0289a04f08ca6c9 | <|skeleton|>
class ObjectManagementService:
"""A service for defining and managing object types used as resource, messages, etc."""
def create_object_type(self, object_type=None):
"""Should receive an ObjectType object"""
<|body_0|>
def update_object_type(self, object_type=None):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ObjectManagementService:
"""A service for defining and managing object types used as resource, messages, etc."""
def create_object_type(self, object_type=None):
"""Should receive an ObjectType object"""
if not is_basic_identifier(object_type.name):
raise BadRequest('Invalid ob... | the_stack_v2_python_sparse | ion/services/coi/object_management_service.py | sfoley/coi-services | train | 1 |
934df61e0e1e89c3636aa1520b2e4aaa73192589 | [
"if '0' in (num1, num2):\n return '0'\nN1 = len(num1)\nN2 = len(num2)\nif N1 >= N2:\n t_max, t_min = (num1, num2)\n n_max, n_min = (N1, N2)\nelse:\n t_max, t_min = (num2, num1)\n n_max, n_min = (N2, N1)\nres = [0]\nfor i in xrange(1, n_min + 1):\n m = int(t_min[-i])\n carry = 0\n tmp_res = [... | <|body_start_0|>
if '0' in (num1, num2):
return '0'
N1 = len(num1)
N2 = len(num2)
if N1 >= N2:
t_max, t_min = (num1, num2)
n_max, n_min = (N1, N2)
else:
t_max, t_min = (num2, num1)
n_max, n_min = (N2, N1)
res = [... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_0|>
def add(self, num1, num2):
""":type num1: list of reversed int :type num2: list of reversed int :rtype: list of reversed int"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_023837 | 1,726 | no_license | [
{
"docstring": ":type num1: str :type num2: str :rtype: str",
"name": "multiply",
"signature": "def multiply(self, num1, num2)"
},
{
"docstring": ":type num1: list of reversed int :type num2: list of reversed int :rtype: list of reversed int",
"name": "add",
"signature": "def add(self, n... | 2 | stack_v2_sparse_classes_30k_train_011155 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply(self, num1, num2): :type num1: str :type num2: str :rtype: str
- def add(self, num1, num2): :type num1: list of reversed int :type num2: list of reversed int :rtype:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply(self, num1, num2): :type num1: str :type num2: str :rtype: str
- def add(self, num1, num2): :type num1: list of reversed int :type num2: list of reversed int :rtype:... | a1d1ee3ab38f7f496143adceb102a1955367d249 | <|skeleton|>
class Solution:
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_0|>
def add(self, num1, num2):
""":type num1: list of reversed int :type num2: list of reversed int :rtype: list of reversed int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
if '0' in (num1, num2):
return '0'
N1 = len(num1)
N2 = len(num2)
if N1 >= N2:
t_max, t_min = (num1, num2)
n_max, n_min = (N1, N2)
else... | the_stack_v2_python_sparse | leetcode/43_multiply-strings.py | JoySnow/Algorithm | train | 0 | |
cbbd44b544098974d73327dafc4a251b0803c0bf | [
"obj = getattr(cls, '_instance_', None)\nif obj is not None:\n return obj\nelse:\n obj = super(Reception, cls).__new__(cls)\n cls._instance_ = obj\n return obj",
"self.log = log\nif plugin_path is not None:\n self.checkin(plugin_path)",
"if plugin_path not in sys.path:\n sys.path.insert(0, plu... | <|body_start_0|>
obj = getattr(cls, '_instance_', None)
if obj is not None:
return obj
else:
obj = super(Reception, cls).__new__(cls)
cls._instance_ = obj
return obj
<|end_body_0|>
<|body_start_1|>
self.log = log
if plugin_path is ... | Singleton class which holds information about known plugins. Currently a singleton, and even a class, seems to be overkill for this, but maybe we'll add some more functionality later. | Reception | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reception:
"""Singleton class which holds information about known plugins. Currently a singleton, and even a class, seems to be overkill for this, but maybe we'll add some more functionality later."""
def __new__(cls, *args, **kwargs):
"""Creates the singleton."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_023838 | 2,512 | permissive | [
{
"docstring": "Creates the singleton.",
"name": "__new__",
"signature": "def __new__(cls, *args, **kwargs)"
},
{
"docstring": "Initializes the class and checks in if a path is provided.",
"name": "__init__",
"signature": "def __init__(self, plugin_path=None, log=None)"
},
{
"doc... | 4 | stack_v2_sparse_classes_30k_train_003425 | Implement the Python class `Reception` described below.
Class description:
Singleton class which holds information about known plugins. Currently a singleton, and even a class, seems to be overkill for this, but maybe we'll add some more functionality later.
Method signatures and docstrings:
- def __new__(cls, *args,... | Implement the Python class `Reception` described below.
Class description:
Singleton class which holds information about known plugins. Currently a singleton, and even a class, seems to be overkill for this, but maybe we'll add some more functionality later.
Method signatures and docstrings:
- def __new__(cls, *args,... | a7f91352296be8751fb7e35475580b80fd5a30af | <|skeleton|>
class Reception:
"""Singleton class which holds information about known plugins. Currently a singleton, and even a class, seems to be overkill for this, but maybe we'll add some more functionality later."""
def __new__(cls, *args, **kwargs):
"""Creates the singleton."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Reception:
"""Singleton class which holds information about known plugins. Currently a singleton, and even a class, seems to be overkill for this, but maybe we'll add some more functionality later."""
def __new__(cls, *args, **kwargs):
"""Creates the singleton."""
obj = getattr(cls, '_ins... | the_stack_v2_python_sparse | coherence/extern/simple_plugin.py | opacam/Cohen3 | train | 73 |
424e7a1611839fac2f055283fe87facc8c932570 | [
"regressor = DecisionTreeRegressor(max_depth=regressor_depth)\nfor w_index, window in enumerate(window_seq):\n samples = tuple(((i,) for i in range(len(window))))\n regressor.fit(samples, window)\n predicted = regressor.predict(samples)\n if normalize_predicted:\n predicted = self._normalize(pred... | <|body_start_0|>
regressor = DecisionTreeRegressor(max_depth=regressor_depth)
for w_index, window in enumerate(window_seq):
samples = tuple(((i,) for i in range(len(window))))
regressor.fit(samples, window)
predicted = regressor.predict(samples)
if normali... | Sliding window filter that based on DecisionTreeRegressor. Let set the initial samples and data: >>> sample_list = list([i] for i in range(10)) >>> sample_list [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] >>> data_list = list(i for i in range(10)) >>> data_list [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] The DecisionTreeRegre... | DecisionTreeRegressorSWFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DecisionTreeRegressorSWFilter:
"""Sliding window filter that based on DecisionTreeRegressor. Let set the initial samples and data: >>> sample_list = list([i] for i in range(10)) >>> sample_list [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] >>> data_list = list(i for i in range(10)) >>> data_... | stack_v2_sparse_classes_36k_train_023839 | 4,853 | permissive | [
{
"docstring": "Reduce sliding windows into values :param collections.Iterable[SlidingWindow] window_seq: sequence of sliding windows :param int regressor_depth: the depth of the regression tree in `DecisionTreeRegressor`, :param bool normalize_predicted: :param bool mark_joint: :param kwargs: ignores it and pa... | 2 | null | Implement the Python class `DecisionTreeRegressorSWFilter` described below.
Class description:
Sliding window filter that based on DecisionTreeRegressor. Let set the initial samples and data: >>> sample_list = list([i] for i in range(10)) >>> sample_list [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] >>> data_list... | Implement the Python class `DecisionTreeRegressorSWFilter` described below.
Class description:
Sliding window filter that based on DecisionTreeRegressor. Let set the initial samples and data: >>> sample_list = list([i] for i in range(10)) >>> sample_list [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] >>> data_list... | 617ff45c9c3c96bbd9a975aef15f1b2697282b9c | <|skeleton|>
class DecisionTreeRegressorSWFilter:
"""Sliding window filter that based on DecisionTreeRegressor. Let set the initial samples and data: >>> sample_list = list([i] for i in range(10)) >>> sample_list [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] >>> data_list = list(i for i in range(10)) >>> data_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DecisionTreeRegressorSWFilter:
"""Sliding window filter that based on DecisionTreeRegressor. Let set the initial samples and data: >>> sample_list = list([i] for i in range(10)) >>> sample_list [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] >>> data_list = list(i for i in range(10)) >>> data_list [0, 1, 2... | the_stack_v2_python_sparse | shot_detector/filters/sliding_window/decision_tree_regressor_swfilter.py | w495/python-video-shot-detector | train | 20 |
4a10c9acd1e120037f209fc0b785774b4e0004b5 | [
"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... | TimeSeriesStreamingServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeSeriesStreamingServicer:
def MetaDataCoordination(self, request, context):
"""Back-and-forth needed to coordinate server with client"""
<|body_0|>
def RealTimeSeries(self, request, context):
"""Signal consisting of a stream of real-valued samples"""
<|bod... | stack_v2_sparse_classes_36k_train_023840 | 3,225 | no_license | [
{
"docstring": "Back-and-forth needed to coordinate server with client",
"name": "MetaDataCoordination",
"signature": "def MetaDataCoordination(self, request, context)"
},
{
"docstring": "Signal consisting of a stream of real-valued samples",
"name": "RealTimeSeries",
"signature": "def R... | 3 | stack_v2_sparse_classes_30k_train_006157 | Implement the Python class `TimeSeriesStreamingServicer` described below.
Class description:
Implement the TimeSeriesStreamingServicer class.
Method signatures and docstrings:
- def MetaDataCoordination(self, request, context): Back-and-forth needed to coordinate server with client
- def RealTimeSeries(self, request,... | Implement the Python class `TimeSeriesStreamingServicer` described below.
Class description:
Implement the TimeSeriesStreamingServicer class.
Method signatures and docstrings:
- def MetaDataCoordination(self, request, context): Back-and-forth needed to coordinate server with client
- def RealTimeSeries(self, request,... | 7760c23893968aed84d9659b082932c97c20460e | <|skeleton|>
class TimeSeriesStreamingServicer:
def MetaDataCoordination(self, request, context):
"""Back-and-forth needed to coordinate server with client"""
<|body_0|>
def RealTimeSeries(self, request, context):
"""Signal consisting of a stream of real-valued samples"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeSeriesStreamingServicer:
def MetaDataCoordination(self, request, context):
"""Back-and-forth needed to coordinate server with client"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not imple... | the_stack_v2_python_sparse | signal_server_to_client/time_series_streaming_pb2_grpc.py | iansmorrison/gRPC_Python_API | train | 0 | |
0145583c62075cd4d4baaa61a746f33d0397f943 | [
"orders = []\n\ndef inorder(node):\n if node:\n inorder(node.left)\n orders.append(node.val)\n inorder(node.right)\ninorder(root)\nreturn orders",
"res, stack = ([], [])\ncur = root\nwhile cur or len(stack) != 0:\n while cur:\n '\\n 对一节点执行左根右的遍历,其实就是不断地去寻找节点的左子... | <|body_start_0|>
orders = []
def inorder(node):
if node:
inorder(node.left)
orders.append(node.val)
inorder(node.right)
inorder(root)
return orders
<|end_body_0|>
<|body_start_1|>
res, stack = ([], [])
cur = ro... | 94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右"""
def inorder_traversal(self, root):
""":type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要... | stack_v2_sparse_classes_36k_train_023841 | 2,703 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要被访问两遍,因此时间复杂度为O(n),空间上如果除了子节点外所有结点都具有左、右子节点,则空间复杂度为 O(n),平均下来为O(logn) 时间复杂度:O(n) 空间复杂度:O(logn)",
"name": "inorder_traversal",
"signature": "d... | 2 | null | Implement the Python class `Solution` described below.
Class description:
94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右
Method signatures and docstrings:
- def inorder_traversal(self, root): :type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来... | Implement the Python class `Solution` described below.
Class description:
94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右
Method signatures and docstrings:
- def inorder_traversal(self, root): :type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来... | 2c534185854c1a6f5ffdb2698f9db9989f30a25b | <|skeleton|>
class Solution:
"""94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右"""
def inorder_traversal(self, root):
""":type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右"""
def inorder_traversal(self, root):
""":type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要被访问两遍,因此时间复杂度... | the_stack_v2_python_sparse | Week 02/id_668/leetcode_94_668.py | Carryours/algorithm004-03 | train | 2 |
efb8513451ff07317b4456adc0bc05d4546c727d | [
"from CortexDataLake import Client\nif exception:\n with pytest.raises(DemistoException):\n Client._backoff_strategy(integration_context)\nelse:\n Client._backoff_strategy(integration_context)",
"from CortexDataLake import Client\nupdated_ic = Client._cache_failure_times(integration_context.copy())\n... | <|body_start_0|>
from CortexDataLake import Client
if exception:
with pytest.raises(DemistoException):
Client._backoff_strategy(integration_context)
else:
Client._backoff_strategy(integration_context)
<|end_body_0|>
<|body_start_1|>
from CortexDat... | A class to test the backoff strategy mechanism | TestBackoffStrategy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBackoffStrategy:
"""A class to test the backoff strategy mechanism"""
def test_backoff_strategy(self, integration_context, exception):
"""Given: - An integration context that represents a try to fetch in the 1st hour & 1st minute window - An integration context that represents a ... | stack_v2_sparse_classes_36k_train_023842 | 15,019 | permissive | [
{
"docstring": "Given: - An integration context that represents a try to fetch in the 1st hour & 1st minute window - An integration context that represents a try to fetch in the first 48 hours & 10 minutes window - An integration context that represents a try to fetch after 48 hours & 60 minutes window - An int... | 3 | stack_v2_sparse_classes_30k_train_015340 | Implement the Python class `TestBackoffStrategy` described below.
Class description:
A class to test the backoff strategy mechanism
Method signatures and docstrings:
- def test_backoff_strategy(self, integration_context, exception): Given: - An integration context that represents a try to fetch in the 1st hour & 1st ... | Implement the Python class `TestBackoffStrategy` described below.
Class description:
A class to test the backoff strategy mechanism
Method signatures and docstrings:
- def test_backoff_strategy(self, integration_context, exception): Given: - An integration context that represents a try to fetch in the 1st hour & 1st ... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestBackoffStrategy:
"""A class to test the backoff strategy mechanism"""
def test_backoff_strategy(self, integration_context, exception):
"""Given: - An integration context that represents a try to fetch in the 1st hour & 1st minute window - An integration context that represents a ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestBackoffStrategy:
"""A class to test the backoff strategy mechanism"""
def test_backoff_strategy(self, integration_context, exception):
"""Given: - An integration context that represents a try to fetch in the 1st hour & 1st minute window - An integration context that represents a try to fetch ... | the_stack_v2_python_sparse | Packs/CortexDataLake/Integrations/CortexDataLake/CortexDataLake_test.py | demisto/content | train | 1,023 |
05dc71bb312fa184ceb8e4f1e3ade6552287802c | [
"self.__bind = bind\nself.__connect = connect\nself.__status = False\nself.__thread = False\nself.__lock = _thread.allocate_lock()",
"self.__lock.acquire()\nself.__status = True\nif not self.__thread:\n self.__thread = True\n _thread.start_new_thread(self.__proxy, ())\nself.__lock.release()",
"self.__lock... | <|body_start_0|>
self.__bind = bind
self.__connect = connect
self.__status = False
self.__thread = False
self.__lock = _thread.allocate_lock()
<|end_body_0|>
<|body_start_1|>
self.__lock.acquire()
self.__status = True
if not self.__thread:
sel... | Proxy(bind, connect) -> Proxy | Proxy | [
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Proxy:
"""Proxy(bind, connect) -> Proxy"""
def __init__(self, bind, connect):
"""Initialize the Proxy object."""
<|body_0|>
def start(self):
"""Start the Proxy object."""
<|body_1|>
def stop(self):
"""Stop the Proxy object."""
<|body_... | stack_v2_sparse_classes_36k_train_023843 | 2,567 | permissive | [
{
"docstring": "Initialize the Proxy object.",
"name": "__init__",
"signature": "def __init__(self, bind, connect)"
},
{
"docstring": "Start the Proxy object.",
"name": "start",
"signature": "def start(self)"
},
{
"docstring": "Stop the Proxy object.",
"name": "stop",
"si... | 5 | null | Implement the Python class `Proxy` described below.
Class description:
Proxy(bind, connect) -> Proxy
Method signatures and docstrings:
- def __init__(self, bind, connect): Initialize the Proxy object.
- def start(self): Start the Proxy object.
- def stop(self): Stop the Proxy object.
- def __proxy(self): Private clas... | Implement the Python class `Proxy` described below.
Class description:
Proxy(bind, connect) -> Proxy
Method signatures and docstrings:
- def __init__(self, bind, connect): Initialize the Proxy object.
- def start(self): Start the Proxy object.
- def stop(self): Stop the Proxy object.
- def __proxy(self): Private clas... | d097ca0ad6a6aee2180d32dce6a3322621f655fd | <|skeleton|>
class Proxy:
"""Proxy(bind, connect) -> Proxy"""
def __init__(self, bind, connect):
"""Initialize the Proxy object."""
<|body_0|>
def start(self):
"""Start the Proxy object."""
<|body_1|>
def stop(self):
"""Stop the Proxy object."""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Proxy:
"""Proxy(bind, connect) -> Proxy"""
def __init__(self, bind, connect):
"""Initialize the Proxy object."""
self.__bind = bind
self.__connect = connect
self.__status = False
self.__thread = False
self.__lock = _thread.allocate_lock()
def start(sel... | the_stack_v2_python_sparse | recipes/Python/502204_Module_Running_Simple/recipe-502204.py | betty29/code-1 | train | 0 |
570b2f4e88abddf3a99a2d74c23081fcdede4d01 | [
"game = Game(user=user, board='---------', message=message, game_over=False)\ngame.put()\nreturn game",
"form = GameForm()\nform.urlsafe_key = self.key.urlsafe()\nform.user_name = self.user.get().name\nform.game_over = self.game_over\nform.message = self.message\nform.board = self.board\nform.winner = self.winner... | <|body_start_0|>
game = Game(user=user, board='---------', message=message, game_over=False)
game.put()
return game
<|end_body_0|>
<|body_start_1|>
form = GameForm()
form.urlsafe_key = self.key.urlsafe()
form.user_name = self.user.get().name
form.game_over = self... | Game object | Game | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
"""Game object"""
def new_game(cls, user, message):
"""Creates and returns a new game"""
<|body_0|>
def to_form(self):
"""Returns a GameForm representation of the Game"""
<|body_1|>
def end_game(self, winner, message):
"""Ends the game ... | stack_v2_sparse_classes_36k_train_023844 | 6,081 | no_license | [
{
"docstring": "Creates and returns a new game",
"name": "new_game",
"signature": "def new_game(cls, user, message)"
},
{
"docstring": "Returns a GameForm representation of the Game",
"name": "to_form",
"signature": "def to_form(self)"
},
{
"docstring": "Ends the game - if won is... | 3 | stack_v2_sparse_classes_30k_val_000281 | Implement the Python class `Game` described below.
Class description:
Game object
Method signatures and docstrings:
- def new_game(cls, user, message): Creates and returns a new game
- def to_form(self): Returns a GameForm representation of the Game
- def end_game(self, winner, message): Ends the game - if won is Tru... | Implement the Python class `Game` described below.
Class description:
Game object
Method signatures and docstrings:
- def new_game(cls, user, message): Creates and returns a new game
- def to_form(self): Returns a GameForm representation of the Game
- def end_game(self, winner, message): Ends the game - if won is Tru... | 787556cdc2932d3cc92e8ccabbc15e928078f1a5 | <|skeleton|>
class Game:
"""Game object"""
def new_game(cls, user, message):
"""Creates and returns a new game"""
<|body_0|>
def to_form(self):
"""Returns a GameForm representation of the Game"""
<|body_1|>
def end_game(self, winner, message):
"""Ends the game ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Game:
"""Game object"""
def new_game(cls, user, message):
"""Creates and returns a new game"""
game = Game(user=user, board='---------', message=message, game_over=False)
game.put()
return game
def to_form(self):
"""Returns a GameForm representation of the Gam... | the_stack_v2_python_sparse | TicTacToe/models.py | chinaq/FSND-P4-Design-A-Game | train | 0 |
06d6bffe2f90495eabda0f709bfa13d1ab5b3098 | [
"if not prices:\n return 0\nn = len(prices)\nif maxK > n // 2:\n return self.maxProfit_inf_k(prices)\ndp = [[[0] * 2 for _ in range(maxK + 1)] for _ in range(n)]\nfor i in range(n):\n for k in range(maxK, 0, -1):\n if i == 0:\n dp[i][k][0], dp[i][k][1] = (0, -prices[i])\n else:\n ... | <|body_start_0|>
if not prices:
return 0
n = len(prices)
if maxK > n // 2:
return self.maxProfit_inf_k(prices)
dp = [[[0] * 2 for _ in range(maxK + 1)] for _ in range(n)]
for i in range(n):
for k in range(maxK, 0, -1):
if i == 0... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, maxK: int, prices: list) -> int:
"""动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])"""
<|body_0|>
def maxProfit_inf_k(... | stack_v2_sparse_classes_36k_train_023845 | 2,396 | no_license | [
{
"docstring": "动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])",
"name": "maxProfit",
"signature": "def maxProfit(self, maxK: int, prices: list) -> int"
},
{
"docstring... | 2 | stack_v2_sparse_classes_30k_train_000430 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, maxK: int, prices: list) -> int: 动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, maxK: int, prices: list) -> int: 动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] ... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def maxProfit(self, maxK: int, prices: list) -> int:
"""动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])"""
<|body_0|>
def maxProfit_inf_k(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, maxK: int, prices: list) -> int:
"""动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])"""
if not prices:
return 0
n = le... | the_stack_v2_python_sparse | algorithm/leetcode/dp/11-买卖股票的最佳时机Ⅳ.py | lxconfig/UbuntuCode_bak | train | 0 | |
7bc8fcefad5c9c7badac3ce46a01619c4ce35c25 | [
"if year < _Persian.START_YEAR or year > _Persian.END_YEAR:\n return None\nday = 21\nif year % 4 == 1 and year >= 2029 or (year % 4 == 2 and year >= 2062) or (year % 4 == 3 and year >= 2095) or (year % 4 == 0 and 1996 <= year <= 2096):\n day = 20\nelif year % 4 == 2 and year <= 1926 or (year % 4 == 3 and year... | <|body_start_0|>
if year < _Persian.START_YEAR or year > _Persian.END_YEAR:
return None
day = 21
if year % 4 == 1 and year >= 2029 or (year % 4 == 2 and year >= 2062) or (year % 4 == 3 and year >= 2095) or (year % 4 == 0 and 1996 <= year <= 2096):
day = 20
elif ye... | Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar | _Persian | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Persian:
"""Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar"""
def new_year_date(self, year: int) -> Optional[date]:
"""Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_023846 | 1,855 | permissive | [
{
"docstring": "Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year.",
"name": "new_year_date",
"signature": "def new_year_date(self, year: int) -> Optional[date]"
},
{
"docstring": "Return Gregorian date of Persian day and month in a given Gregorian year.",
"na... | 2 | stack_v2_sparse_classes_30k_train_006962 | Implement the Python class `_Persian` described below.
Class description:
Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar
Method signatures and docstrings:
- def new_year_date(self, year: int) -> Optional[date]: Return Gregorian date of Persian new year (1 Farvar... | Implement the Python class `_Persian` described below.
Class description:
Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar
Method signatures and docstrings:
- def new_year_date(self, year: int) -> Optional[date]: Return Gregorian date of Persian new year (1 Farvar... | f8c90952bf409703d0af5d89a202e21a90e2317f | <|skeleton|>
class _Persian:
"""Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar"""
def new_year_date(self, year: int) -> Optional[date]:
"""Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _Persian:
"""Persian calendar (Solar Hijri) for 1901-2100 years. https://en.wikipedia.org/wiki/Solar_Hijri_calendar"""
def new_year_date(self, year: int) -> Optional[date]:
"""Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year."""
if year < _Persian.START_YE... | the_stack_v2_python_sparse | holidays/calendars/persian.py | dr-prodigy/python-holidays | train | 919 |
ab138fde2857cb53d0dd8b9c5e3d0dc61b3681da | [
"self._parent = parent\nsuper().__init__(self._parent)\nprint('\\tgui/ScriptFileValidator parent: ', self._parent, ' -> self: ', self) if oPB.PRINTHIER else None\nself._field = field",
"if p_str == '':\n return (ScriptFileValidator.Intermediate, p_str, p_int)\nif os.path.exists(Helper.concat_path_native(self._... | <|body_start_0|>
self._parent = parent
super().__init__(self._parent)
print('\tgui/ScriptFileValidator parent: ', self._parent, ' -> self: ', self) if oPB.PRINTHIER else None
self._field = field
<|end_body_0|>
<|body_start_1|>
if p_str == '':
return (ScriptFileValida... | Validator to check for existing files | ScriptFileValidator | [
"MIT-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScriptFileValidator:
"""Validator to check for existing files"""
def __init__(self, parent, field):
"""Constructor of ScriptFileValidator :param parent: parent window :param field: field object to validate"""
<|body_0|>
def validate(self, p_str, p_int):
"""Valida... | stack_v2_sparse_classes_36k_train_023847 | 29,282 | permissive | [
{
"docstring": "Constructor of ScriptFileValidator :param parent: parent window :param field: field object to validate",
"name": "__init__",
"signature": "def __init__(self, parent, field)"
},
{
"docstring": "Validator method :param p_str: script full pathname to validate :param p_int: (not used... | 2 | stack_v2_sparse_classes_30k_train_001974 | Implement the Python class `ScriptFileValidator` described below.
Class description:
Validator to check for existing files
Method signatures and docstrings:
- def __init__(self, parent, field): Constructor of ScriptFileValidator :param parent: parent window :param field: field object to validate
- def validate(self, ... | Implement the Python class `ScriptFileValidator` described below.
Class description:
Validator to check for existing files
Method signatures and docstrings:
- def __init__(self, parent, field): Constructor of ScriptFileValidator :param parent: parent window :param field: field object to validate
- def validate(self, ... | f6c86cc95218216cbd0f548b508d0c5fde11520e | <|skeleton|>
class ScriptFileValidator:
"""Validator to check for existing files"""
def __init__(self, parent, field):
"""Constructor of ScriptFileValidator :param parent: parent window :param field: field object to validate"""
<|body_0|>
def validate(self, p_str, p_int):
"""Valida... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScriptFileValidator:
"""Validator to check for existing files"""
def __init__(self, parent, field):
"""Constructor of ScriptFileValidator :param parent: parent window :param field: field object to validate"""
self._parent = parent
super().__init__(self._parent)
print('\tgu... | the_stack_v2_python_sparse | oPB/gui/utilities.py | pandel/opsiPackageBuilder | train | 10 |
b237319759db97fe256952d750a2f154decc69fc | [
"if isinstance(udf, Column) or not hasattr(udf, 'func') or udf.evalType != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF:\n raise ValueError('Invalid udf: the udf argument must be a pandas_udf of type GROUPED_MAP.')\nwarnings.warn(\"It is preferred to use 'applyInPandas' over this API. This API will be deprecated in... | <|body_start_0|>
if isinstance(udf, Column) or not hasattr(udf, 'func') or udf.evalType != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF:
raise ValueError('Invalid udf: the udf argument must be a pandas_udf of type GROUPED_MAP.')
warnings.warn("It is preferred to use 'applyInPandas' over this AP... | Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class. | PandasGroupedOpsMixin | [
"BSD-3-Clause",
"CC0-1.0",
"CDDL-1.1",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"LGPL-2.0-or-later",
"Python-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PandasGroupedOpsMixin:
"""Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class."""
def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame:
"""It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes ... | stack_v2_sparse_classes_36k_train_023848 | 21,716 | permissive | [
{
"docstring": "It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes a :meth:`pyspark.sql.functions.pandas_udf` whereas :meth:`pyspark.sql.GroupedData.applyInPandas` takes a Python native function. .. versionadded:: 2.3.0 .. versionchanged:: 3.4.0 Support Spark Connect. Parameters ... | 4 | stack_v2_sparse_classes_30k_train_016207 | Implement the Python class `PandasGroupedOpsMixin` described below.
Class description:
Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class.
Method signatures and docstrings:
- def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame: It is an alias of :meth:`p... | Implement the Python class `PandasGroupedOpsMixin` described below.
Class description:
Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class.
Method signatures and docstrings:
- def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame: It is an alias of :meth:`p... | 60d8fc49bec5dae1b8cf39a0670cb640b430f520 | <|skeleton|>
class PandasGroupedOpsMixin:
"""Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class."""
def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame:
"""It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PandasGroupedOpsMixin:
"""Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class."""
def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame:
"""It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes a :meth:`pysp... | the_stack_v2_python_sparse | python/pyspark/sql/pandas/group_ops.py | apache/spark | train | 39,983 |
5a67480a3dc085a3ccde932a0bb8a1585e4a596c | [
"self.act_f = activation\nself.dtype = dtype\nself.rnn_idx: np.ndarray = rnn_idx\nself.n_inputs: int = len(input_idx)\nself.n_hidden: int = len(hidden_idx)\nself.n_rnn: int = len(rnn_idx)\nself.n_outputs: int = len(output_idx)\nself.bs: int = batch_size\nrnn_map_temp = []\nfor i, m in enumerate(rnn_map):\n rnn_m... | <|body_start_0|>
self.act_f = activation
self.dtype = dtype
self.rnn_idx: np.ndarray = rnn_idx
self.n_inputs: int = len(input_idx)
self.n_hidden: int = len(hidden_idx)
self.n_rnn: int = len(rnn_idx)
self.n_outputs: int = len(output_idx)
self.bs: int = batc... | Custom representation of a feedforward network used by the genomes to make predictions. | FeedForwardNet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeedForwardNet:
"""Custom representation of a feedforward network used by the genomes to make predictions."""
def __init__(self, input_idx: np.ndarray, hidden_idx: np.ndarray, rnn_idx: np.ndarray, output_idx: np.ndarray, in2hid: tuple, in2out: tuple, hid2hid: tuple, hid2out: tuple, hidden_bi... | stack_v2_sparse_classes_36k_train_023849 | 16,851 | permissive | [
{
"docstring": "Create a simple feedforward network used as the control-mechanism for the drones. :param input_idx: Input indices (sensors) :param hidden_idx: Hidden simple-node indices (DefaultGeneNode) in the network :param rnn_idx: Hidden RNN-node indices (DefaultGeneNode) in the network :param output_idx: O... | 3 | stack_v2_sparse_classes_30k_train_002462 | Implement the Python class `FeedForwardNet` described below.
Class description:
Custom representation of a feedforward network used by the genomes to make predictions.
Method signatures and docstrings:
- def __init__(self, input_idx: np.ndarray, hidden_idx: np.ndarray, rnn_idx: np.ndarray, output_idx: np.ndarray, in2... | Implement the Python class `FeedForwardNet` described below.
Class description:
Custom representation of a feedforward network used by the genomes to make predictions.
Method signatures and docstrings:
- def __init__(self, input_idx: np.ndarray, hidden_idx: np.ndarray, rnn_idx: np.ndarray, output_idx: np.ndarray, in2... | 818a4ce941536611c0f1780f7c4a6238f0e1884e | <|skeleton|>
class FeedForwardNet:
"""Custom representation of a feedforward network used by the genomes to make predictions."""
def __init__(self, input_idx: np.ndarray, hidden_idx: np.ndarray, rnn_idx: np.ndarray, output_idx: np.ndarray, in2hid: tuple, in2out: tuple, hid2hid: tuple, hid2out: tuple, hidden_bi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeedForwardNet:
"""Custom representation of a feedforward network used by the genomes to make predictions."""
def __init__(self, input_idx: np.ndarray, hidden_idx: np.ndarray, rnn_idx: np.ndarray, output_idx: np.ndarray, in2hid: tuple, in2out: tuple, hid2hid: tuple, hid2out: tuple, hidden_biases: np.ndar... | the_stack_v2_python_sparse | population/utils/network_util/feed_forward_net.py | RubenPants/EvolvableRNN | train | 1 |
50826f3b46679394d20b51871a15055e3995b33f | [
"self.home_team = home_team\nself.away_team = away_team\nself.games = []\nself.dates_scheduled = self._init_schedule_each_game_in_the_series(number_of_games=number_of_games, date_range=date_range)\nfor team in (home_team, away_team):\n team.season.schedule.upcoming_series.append(self)",
"if self.dates_schedule... | <|body_start_0|>
self.home_team = home_team
self.away_team = away_team
self.games = []
self.dates_scheduled = self._init_schedule_each_game_in_the_series(number_of_games=number_of_games, date_range=date_range)
for team in (home_team, away_team):
team.season.schedule.u... | A series of baseball games between two teams. | Series | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Series:
"""A series of baseball games between two teams."""
def __init__(self, home_team, away_team, number_of_games, date_range):
"""Initialize a Series object."""
<|body_0|>
def __str__(self):
"""Return string representation."""
<|body_1|>
def _ini... | stack_v2_sparse_classes_36k_train_023850 | 17,124 | no_license | [
{
"docstring": "Initialize a Series object.",
"name": "__init__",
"signature": "def __init__(self, home_team, away_team, number_of_games, date_range)"
},
{
"docstring": "Return string representation.",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Schedul... | 4 | stack_v2_sparse_classes_30k_train_002556 | Implement the Python class `Series` described below.
Class description:
A series of baseball games between two teams.
Method signatures and docstrings:
- def __init__(self, home_team, away_team, number_of_games, date_range): Initialize a Series object.
- def __str__(self): Return string representation.
- def _init_sc... | Implement the Python class `Series` described below.
Class description:
A series of baseball games between two teams.
Method signatures and docstrings:
- def __init__(self, home_team, away_team, number_of_games, date_range): Initialize a Series object.
- def __str__(self): Return string representation.
- def _init_sc... | 78a9df3ff66d4956f817397c82be0b4e4176e73d | <|skeleton|>
class Series:
"""A series of baseball games between two teams."""
def __init__(self, home_team, away_team, number_of_games, date_range):
"""Initialize a Series object."""
<|body_0|>
def __str__(self):
"""Return string representation."""
<|body_1|>
def _ini... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Series:
"""A series of baseball games between two teams."""
def __init__(self, home_team, away_team, number_of_games, date_range):
"""Initialize a Series object."""
self.home_team = home_team
self.away_team = away_team
self.games = []
self.dates_scheduled = self._i... | the_stack_v2_python_sparse | baseball/schedule.py | hanok2/national_pastime | train | 1 |
1eeb59334fe6e03977e0ca1cc29e07c68d98149d | [
"self.driver = driver\nself.comp_name = comp_name\nself.element = self.get_component()",
"lis = self.find_elems('.dwbw')\nfor li in lis:\n if li.text == name:\n li.click()\n break\n else:\n print('not found element %s' % name)",
"lis = self.find_elems('.dwwc .dw-li.dw-v')\ndate = []\n... | <|body_start_0|>
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
<|end_body_0|>
<|body_start_1|>
lis = self.find_elems('.dwbw')
for li in lis:
if li.text == name:
li.click()
break
else:
... | 日期选择框控件 | DatePhonePage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatePhonePage:
"""日期选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def click_date_button(self, name):
"""日历选择框按钮"""
<|body_1|>
def get_now_date(self):
"""获取当前日期"""
<|body_2|>
def select_start_date(self):
... | stack_v2_sparse_classes_36k_train_023851 | 3,884 | no_license | [
{
"docstring": "类初始化执行",
"name": "__init__",
"signature": "def __init__(self, driver, comp_name)"
},
{
"docstring": "日历选择框按钮",
"name": "click_date_button",
"signature": "def click_date_button(self, name)"
},
{
"docstring": "获取当前日期",
"name": "get_now_date",
"signature": "d... | 6 | null | Implement the Python class `DatePhonePage` described below.
Class description:
日期选择框控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def click_date_button(self, name): 日历选择框按钮
- def get_now_date(self): 获取当前日期
- def select_start_date(self): 选择开始时间
- def get_up_button(self): 获取向上箭头... | Implement the Python class `DatePhonePage` described below.
Class description:
日期选择框控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def click_date_button(self, name): 日历选择框按钮
- def get_now_date(self): 获取当前日期
- def select_start_date(self): 选择开始时间
- def get_up_button(self): 获取向上箭头... | 78768989a79a14013b983024cf6e4838d51ed595 | <|skeleton|>
class DatePhonePage:
"""日期选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def click_date_button(self, name):
"""日历选择框按钮"""
<|body_1|>
def get_now_date(self):
"""获取当前日期"""
<|body_2|>
def select_start_date(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatePhonePage:
"""日期选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
def click_date_button(self, name):
"""日历选择框按钮"""
lis = self.find_elems('.dwbw')
... | the_stack_v2_python_sparse | test_case/page_obj/form/date_field_page.py | pylk/pythonSelenium | train | 0 |
89f0a09e8b9a4be32c6062f42be4abe7115bd6f2 | [
"for const_name in const_names:\n try:\n const_val = getattr(win32security, const_name)\n except AttributeError:\n try:\n const_val = getattr(ntsecuritycon, const_name)\n except AttributeError:\n try:\n const_val = getattr(winnt, const_name)\n ... | <|body_start_0|>
for const_name in const_names:
try:
const_val = getattr(win32security, const_name)
except AttributeError:
try:
const_val = getattr(ntsecuritycon, const_name)
except AttributeError:
tr... | Enum | [
"PSF-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Enum:
def __init__(self, *const_names):
"""Accepts variable number of constant names that can be found in either win32security, ntsecuritycon, or winnt."""
<|body_0|>
def lookup_name(self, const_val):
"""Looks up the name of a particular value."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_023852 | 9,455 | permissive | [
{
"docstring": "Accepts variable number of constant names that can be found in either win32security, ntsecuritycon, or winnt.",
"name": "__init__",
"signature": "def __init__(self, *const_names)"
},
{
"docstring": "Looks up the name of a particular value.",
"name": "lookup_name",
"signat... | 3 | null | Implement the Python class `Enum` described below.
Class description:
Implement the Enum class.
Method signatures and docstrings:
- def __init__(self, *const_names): Accepts variable number of constant names that can be found in either win32security, ntsecuritycon, or winnt.
- def lookup_name(self, const_val): Looks ... | Implement the Python class `Enum` described below.
Class description:
Implement the Enum class.
Method signatures and docstrings:
- def __init__(self, *const_names): Accepts variable number of constant names that can be found in either win32security, ntsecuritycon, or winnt.
- def lookup_name(self, const_val): Looks ... | 2a7137f21965013020ef9e4f27565db6dea59003 | <|skeleton|>
class Enum:
def __init__(self, *const_names):
"""Accepts variable number of constant names that can be found in either win32security, ntsecuritycon, or winnt."""
<|body_0|>
def lookup_name(self, const_val):
"""Looks up the name of a particular value."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Enum:
def __init__(self, *const_names):
"""Accepts variable number of constant names that can be found in either win32security, ntsecuritycon, or winnt."""
for const_name in const_names:
try:
const_val = getattr(win32security, const_name)
except Attribut... | the_stack_v2_python_sparse | win32/Demos/security/security_enums.py | mhammond/pywin32 | train | 4,757 | |
e8cf816e779fa625fa3f530a75311cfbdfcf19ad | [
"if not nums:\n return 0\nfor i in range(1, len(nums) - 1):\n if nums[i] < nums[i - 1] and nums[i] < nums[i + 1]:\n return nums[i]",
"if not nums:\n return None\ni, j = (0, len(nums) - 1)\nwhile i < j:\n m = i + int((j - i) / 2)\n if nums[m] > nums[j]:\n i = m + 1\n elif nums[m] < ... | <|body_start_0|>
if not nums:
return 0
for i in range(1, len(nums) - 1):
if nums[i] < nums[i - 1] and nums[i] < nums[i + 1]:
return nums[i]
<|end_body_0|>
<|body_start_1|>
if not nums:
return None
i, j = (0, len(nums) - 1)
whil... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def MinNumberInRotateArray(self, nums):
"""查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(N)"""
<|body_0|>
def MinNumberInRotateArrayPlus(self, nums):
"""查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(logN)"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_36k_train_023853 | 3,014 | no_license | [
{
"docstring": "查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(N)",
"name": "MinNumberInRotateArray",
"signature": "def MinNumberInRotateArray(self, nums)"
},
{
"docstring": "查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(logN)",
"name": "MinNumberInRotateArrayPlus",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_021205 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def MinNumberInRotateArray(self, nums): 查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(N)
- def MinNumberInRotateArrayPlus(self, nums): 查找旋转数组中最小的元素 :param nums: :return: 时间复杂... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def MinNumberInRotateArray(self, nums): 查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(N)
- def MinNumberInRotateArrayPlus(self, nums): 查找旋转数组中最小的元素 :param nums: :return: 时间复杂... | 32941ee052d0985a9569441d314378700ff4d225 | <|skeleton|>
class Solution:
def MinNumberInRotateArray(self, nums):
"""查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(N)"""
<|body_0|>
def MinNumberInRotateArrayPlus(self, nums):
"""查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(logN)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def MinNumberInRotateArray(self, nums):
"""查找旋转数组中最小的元素 :param nums: :return: 时间复杂度分析:时间复杂度O(N)"""
if not nums:
return 0
for i in range(1, len(nums) - 1):
if nums[i] < nums[i - 1] and nums[i] < nums[i + 1]:
return nums[i]
def MinNu... | the_stack_v2_python_sparse | cecilia-python/剑指offer/chapter-2/MinNumberInRotateArray.py | Cecilia520/algorithmic-learning-leetcode | train | 7 | |
dd60017317397bffe70c4f533ce9bfd359ca7eab | [
"import collections\nmemo = collections.defaultdict(list)\n\ndef search(node, i):\n if not node:\n return\n memo[i].append(node)\n search(node.left, i + 1)\n search(node.right, i + 1)\nans = []\nfor i in memo:\n ans += memo[i]\nreturn ans",
"if not data:\n return\nans = TreeNode(-10001)\n... | <|body_start_0|>
import collections
memo = collections.defaultdict(list)
def search(node, i):
if not node:
return
memo[i].append(node)
search(node.left, i + 1)
search(node.right, i + 1)
ans = []
for i in memo:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_023854 | 1,276 | 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:... | b6708b03c92ec92e89fc7ecf13f1995dee346657 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
import collections
memo = collections.defaultdict(list)
def search(node, i):
if not node:
return
memo[i].append(node)
... | the_stack_v2_python_sparse | 297.py | yuzumei/leetcode | train | 0 | |
4055a0fddf260426ea44d429cc36846f033a63ac | [
"initNode = ListNode(None)\ninitNode.next = head\nslow, fast = (initNode, initNode)\nwhile fast and fast.next:\n slow, fast = (slow.next, fast.next.next)\n if slow == fast:\n while initNode != slow:\n initNode, slow = (initNode.next, slow.next)\n return slow\nreturn None",
"try:\n ... | <|body_start_0|>
initNode = ListNode(None)
initNode.next = head
slow, fast = (initNode, initNode)
while fast and fast.next:
slow, fast = (slow.next, fast.next.next)
if slow == fast:
while initNode != slow:
initNode, slow = (init... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def detectCycle(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def detectCycle_2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
initNode = ListNode(None)
i... | stack_v2_sparse_classes_36k_train_023855 | 3,141 | permissive | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "detectCycle",
"signature": "def detectCycle(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "detectCycle_2",
"signature": "def detectCycle_2(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007942 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def detectCycle(self, head): :type head: ListNode :rtype: ListNode
- def detectCycle_2(self, head): :type head: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def detectCycle(self, head): :type head: ListNode :rtype: ListNode
- def detectCycle_2(self, head): :type head: ListNode :rtype: ListNode
<|skeleton|>
class Solution:
def d... | 64863d9d284a72fa23bed40640f7229a0d904f5b | <|skeleton|>
class Solution:
def detectCycle(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def detectCycle_2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def detectCycle(self, head):
""":type head: ListNode :rtype: ListNode"""
initNode = ListNode(None)
initNode.next = head
slow, fast = (initNode, initNode)
while fast and fast.next:
slow, fast = (slow.next, fast.next.next)
if slow == fast... | the_stack_v2_python_sparse | Linked List Cycle II.py | happyandy2017/LeetCode | train | 0 | |
a71dc3de2f560d8fc10e9a77e02967ac0aba6e83 | [
"base_cmd = ['ceph', 'orch']\nif config.get('base_cmd_args'):\n base_cmd_args_str = config_dict_to_string(config.get('base_cmd_args'))\n base_cmd.append(base_cmd_args_str)\nbase_cmd.extend(['device', 'zap'])\npos_args = config['pos_args']\nnode = pos_args[0]\nhost_id = get_node_by_id(self.cluster, node)\nhost... | <|body_start_0|>
base_cmd = ['ceph', 'orch']
if config.get('base_cmd_args'):
base_cmd_args_str = config_dict_to_string(config.get('base_cmd_args'))
base_cmd.append(base_cmd_args_str)
base_cmd.extend(['device', 'zap'])
pos_args = config['pos_args']
node = p... | Device | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Device:
def zap(self, config: Dict) -> None:
"""Zap particular device Args: config (Dict): Zap configs Returns: output (Str), error (Str) returned by the command. Example:: command: zap base_cmd_args: verbose: true pos_args: - "node1" - "/dev/vdb" args: force: true"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_023856 | 2,556 | permissive | [
{
"docstring": "Zap particular device Args: config (Dict): Zap configs Returns: output (Str), error (Str) returned by the command. Example:: command: zap base_cmd_args: verbose: true pos_args: - \"node1\" - \"/dev/vdb\" args: force: true",
"name": "zap",
"signature": "def zap(self, config: Dict) -> None... | 2 | null | Implement the Python class `Device` described below.
Class description:
Implement the Device class.
Method signatures and docstrings:
- def zap(self, config: Dict) -> None: Zap particular device Args: config (Dict): Zap configs Returns: output (Str), error (Str) returned by the command. Example:: command: zap base_cm... | Implement the Python class `Device` described below.
Class description:
Implement the Device class.
Method signatures and docstrings:
- def zap(self, config: Dict) -> None: Zap particular device Args: config (Dict): Zap configs Returns: output (Str), error (Str) returned by the command. Example:: command: zap base_cm... | 0691fbaf8fca2a9cd051c5049c83758c65301654 | <|skeleton|>
class Device:
def zap(self, config: Dict) -> None:
"""Zap particular device Args: config (Dict): Zap configs Returns: output (Str), error (Str) returned by the command. Example:: command: zap base_cmd_args: verbose: true pos_args: - "node1" - "/dev/vdb" args: force: true"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Device:
def zap(self, config: Dict) -> None:
"""Zap particular device Args: config (Dict): Zap configs Returns: output (Str), error (Str) returned by the command. Example:: command: zap base_cmd_args: verbose: true pos_args: - "node1" - "/dev/vdb" args: force: true"""
base_cmd = ['ceph', 'orch... | the_stack_v2_python_sparse | ceph/ceph_admin/device.py | red-hat-storage/cephci | train | 28 | |
f6c09b1bc696e6442fc5cadacc3cfb9f90e04232 | [
"self.times = times\nself.maxperson = persons[[0]]\nself.maxvote = [1]\nself.rec = {persons[0]: 1}\nfor i in range(1, len(times)):\n if persons[i] in self.rec:\n self.rec[persons[i]] += 1\n else:\n self.rec[persons[i]] = 1\n if self.rec[persons[i]] >= self.maxvote[i - 1]:\n self.maxvot... | <|body_start_0|>
self.times = times
self.maxperson = persons[[0]]
self.maxvote = [1]
self.rec = {persons[0]: 1}
for i in range(1, len(times)):
if persons[i] in self.rec:
self.rec[persons[i]] += 1
else:
self.rec[persons[i]] =... | TopVotedCandidate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.times = times
self.maxpe... | stack_v2_sparse_classes_36k_train_023857 | 2,492 | no_license | [
{
"docstring": ":type persons: List[int] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, persons, times)"
},
{
"docstring": ":type t: int :rtype: int",
"name": "q",
"signature": "def q(self, t)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011567 | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def q(self, t): :type t: int :rtype: int | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def q(self, t): :type t: int :rtype: int
<|skeleton|>
class TopVotedCandi... | f41348fd7da3b7af9f9b2df7c01457c7bed8ce0c | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
self.times = times
self.maxperson = persons[[0]]
self.maxvote = [1]
self.rec = {persons[0]: 1}
for i in range(1, len(times)):
if persons[i] i... | the_stack_v2_python_sparse | LeetCode/Array/Online Election.py | mrunalhirve12/Python_CTCI-practise | train | 3 | |
da22399d92212c0be8c22adfd67d186592213355 | [
"format_convert = {'headsUp': ['invite', 'Heads Up'], 'available': ['invite', 'Available?'], 'leave': ['leave', 'Left?'], 'return': ['return', 'Returned?'], 'info': ['info', None], 'broadcast': ['broadcast', None], 'test': ['test', 'Test']}\ninitial = {}\ninitial['author'] = self.request.user.pk\ninitial['type'] = ... | <|body_start_0|>
format_convert = {'headsUp': ['invite', 'Heads Up'], 'available': ['invite', 'Available?'], 'leave': ['leave', 'Left?'], 'return': ['return', 'Returned?'], 'info': ['info', None], 'broadcast': ['broadcast', None], 'test': ['test', 'Test']}
initial = {}
initial['author'] = self.r... | MessageCreateBaseView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MessageCreateBaseView:
def get_queryset(self):
"""Return context for standard paging."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Add additional useful information."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
format_convert = {'headsU... | stack_v2_sparse_classes_36k_train_023858 | 19,625 | permissive | [
{
"docstring": "Return context for standard paging.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Add additional useful information.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002713 | Implement the Python class `MessageCreateBaseView` described below.
Class description:
Implement the MessageCreateBaseView class.
Method signatures and docstrings:
- def get_queryset(self): Return context for standard paging.
- def get_context_data(self, **kwargs): Add additional useful information. | Implement the Python class `MessageCreateBaseView` described below.
Class description:
Implement the MessageCreateBaseView class.
Method signatures and docstrings:
- def get_queryset(self): Return context for standard paging.
- def get_context_data(self, **kwargs): Add additional useful information.
<|skeleton|>
cla... | b988b6e41c786448c4a8a76c11397d195f802a26 | <|skeleton|>
class MessageCreateBaseView:
def get_queryset(self):
"""Return context for standard paging."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Add additional useful information."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MessageCreateBaseView:
def get_queryset(self):
"""Return context for standard paging."""
format_convert = {'headsUp': ['invite', 'Heads Up'], 'available': ['invite', 'Available?'], 'leave': ['leave', 'Left?'], 'return': ['return', 'Returned?'], 'info': ['info', None], 'broadcast': ['broadcast'... | the_stack_v2_python_sparse | main/views/message_views.py | BAMRU-Tech/bamru_net | train | 7 | |
86ef465c498e6512a8882563a753d6b876e12146 | [
"super().__init__(n_var=search.num_vars, n_obj=search.num_obj, n_constr=search.search_params.num_constraints, xl=search.vars_lower, xu=search.vars_upper, type_var=search.type_var)\nself._search = search\nself._search_records = search.search_records\nself._elasticity_handler = self._search._elasticity_ctrl.multi_ela... | <|body_start_0|>
super().__init__(n_var=search.num_vars, n_obj=search.num_obj, n_constr=search.search_params.num_constraints, xl=search.vars_lower, xu=search.vars_upper, type_var=search.type_var)
self._search = search
self._search_records = search.search_records
self._elasticity_handler ... | Pymoo problem with design variables and evaluation methods. | SearchProblem | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchProblem:
"""Pymoo problem with design variables and evaluation methods."""
def __init__(self, search: SearchAlgorithm):
"""Initializes search problem :param search: search algorithm."""
<|body_0|>
def _evaluate(self, x: List[float], out: Dict[str, Any], *args, **ka... | stack_v2_sparse_classes_36k_train_023859 | 23,022 | permissive | [
{
"docstring": "Initializes search problem :param search: search algorithm.",
"name": "__init__",
"signature": "def __init__(self, search: SearchAlgorithm)"
},
{
"docstring": "Evaluates a population of sub-networks. :param x: set of sub-networks to evaluate. :param out: measurements obtained by ... | 3 | null | Implement the Python class `SearchProblem` described below.
Class description:
Pymoo problem with design variables and evaluation methods.
Method signatures and docstrings:
- def __init__(self, search: SearchAlgorithm): Initializes search problem :param search: search algorithm.
- def _evaluate(self, x: List[float], ... | Implement the Python class `SearchProblem` described below.
Class description:
Pymoo problem with design variables and evaluation methods.
Method signatures and docstrings:
- def __init__(self, search: SearchAlgorithm): Initializes search problem :param search: search algorithm.
- def _evaluate(self, x: List[float], ... | c027c8b43c4865d46b8de01d8350dd338ec5a874 | <|skeleton|>
class SearchProblem:
"""Pymoo problem with design variables and evaluation methods."""
def __init__(self, search: SearchAlgorithm):
"""Initializes search problem :param search: search algorithm."""
<|body_0|>
def _evaluate(self, x: List[float], out: Dict[str, Any], *args, **ka... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SearchProblem:
"""Pymoo problem with design variables and evaluation methods."""
def __init__(self, search: SearchAlgorithm):
"""Initializes search problem :param search: search algorithm."""
super().__init__(n_var=search.num_vars, n_obj=search.num_obj, n_constr=search.search_params.num_c... | the_stack_v2_python_sparse | nncf/experimental/torch/nas/bootstrapNAS/search/search.py | openvinotoolkit/nncf | train | 558 |
97f609308acef6f319d15ca528eb04389b2f4d44 | [
"s = ''\nqueue = [root]\nwhile queue:\n node = queue.pop(0)\n if node:\n s += str(node.val)\n queue.append(node.left)\n queue.append(node.right)\n else:\n s += '#'\n s += ' '\nreturn s",
"s = data.split(',')\nif s[0] == '#':\n return None\nroot = TreeNode(int(s[0]))\nque... | <|body_start_0|>
s = ''
queue = [root]
while queue:
node = queue.pop(0)
if node:
s += str(node.val)
queue.append(node.left)
queue.append(node.right)
else:
s += '#'
s += ' '
ret... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_023860 | 4,066 | 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 | stack_v2_sparse_classes_30k_train_009707 | 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:... | 967b0fbb40ae491b552bc3365a481e66324cb6f2 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
s = ''
queue = [root]
while queue:
node = queue.pop(0)
if node:
s += str(node.val)
queue.append(node.left)
... | the_stack_v2_python_sparse | leetcode/4_二叉树专题/10_二叉树的序列化与反序列化.py | ryanatgz/data_structure_and_algorithm | train | 0 | |
9dd439a6460486272b6c8148cee620a926b5507a | [
"for i in xrange(1, len(nums)):\n if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]):\n nums[i], nums[i - 1] = (nums[i - 1], nums[i])",
"nums.sort()\nfor i in xrange((len(nums) - 1) / 2):\n nums[2 * i + 1], nums[2 * i + 2] = (nums[2 * i + 2], nums[2 * i + 1])"
] | <|body_start_0|>
for i in xrange(1, len(nums)):
if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]):
nums[i], nums[i - 1] = (nums[i - 1], nums[i])
<|end_body_0|>
<|body_start_1|>
nums.sort()
for i in xrange((len(nums) - 1) / 2):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_nlogn(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instea... | stack_v2_sparse_classes_36k_train_023861 | 718 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wiggleSort",
"signature": "def wiggleSort(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wi... | 2 | stack_v2_sparse_classes_30k_train_008644 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_nlogn(self, nums): :type nums: List[int] :rt... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_nlogn(self, nums): :type nums: List[int] :rt... | ed15eb27936b39980d4cb5fb61cd937ec7ddcb6a | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_nlogn(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instea... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
for i in xrange(1, len(nums)):
if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]):
nums[i], nums[i - 1... | the_stack_v2_python_sparse | alice/LC280.py | AliceTTXu/LeetCode | train | 0 | |
0101cb4e170a8d168a24134fee231c0d44274d44 | [
"LOG.debug('Plumbing VIP for loadbalancer id: %s', loadbalancer[constants.LOADBALANCER_ID])\nsession = db_apis.get_session()\nwith session.begin():\n db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID])\namps_data = self.network_driver.plug_vip(db_lb, db_lb.vip)\nreturn [amp.to... | <|body_start_0|>
LOG.debug('Plumbing VIP for loadbalancer id: %s', loadbalancer[constants.LOADBALANCER_ID])
session = db_apis.get_session()
with session.begin():
db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID])
amps_data = self.network_d... | Task to plumb a VIP. | PlugVIP | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlugVIP:
"""Task to plumb a VIP."""
def execute(self, loadbalancer):
"""Plumb a vip to an amphora."""
<|body_0|>
def revert(self, result, loadbalancer, *args, **kwargs):
"""Handle a failure to plumb a vip."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_023862 | 44,034 | permissive | [
{
"docstring": "Plumb a vip to an amphora.",
"name": "execute",
"signature": "def execute(self, loadbalancer)"
},
{
"docstring": "Handle a failure to plumb a vip.",
"name": "revert",
"signature": "def revert(self, result, loadbalancer, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003008 | Implement the Python class `PlugVIP` described below.
Class description:
Task to plumb a VIP.
Method signatures and docstrings:
- def execute(self, loadbalancer): Plumb a vip to an amphora.
- def revert(self, result, loadbalancer, *args, **kwargs): Handle a failure to plumb a vip. | Implement the Python class `PlugVIP` described below.
Class description:
Task to plumb a VIP.
Method signatures and docstrings:
- def execute(self, loadbalancer): Plumb a vip to an amphora.
- def revert(self, result, loadbalancer, *args, **kwargs): Handle a failure to plumb a vip.
<|skeleton|>
class PlugVIP:
"""... | 0426285a41464a5015494584f109eed35a0d44db | <|skeleton|>
class PlugVIP:
"""Task to plumb a VIP."""
def execute(self, loadbalancer):
"""Plumb a vip to an amphora."""
<|body_0|>
def revert(self, result, loadbalancer, *args, **kwargs):
"""Handle a failure to plumb a vip."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PlugVIP:
"""Task to plumb a VIP."""
def execute(self, loadbalancer):
"""Plumb a vip to an amphora."""
LOG.debug('Plumbing VIP for loadbalancer id: %s', loadbalancer[constants.LOADBALANCER_ID])
session = db_apis.get_session()
with session.begin():
db_lb = self.l... | the_stack_v2_python_sparse | octavia/controller/worker/v2/tasks/network_tasks.py | openstack/octavia | train | 147 |
d2ebcd1db5a97e0d6b5f975d96d71b12d9fbcfa5 | [
"if root == None:\n return []\nself.result = []\n\ndef dfs(root):\n if root.left:\n dfs(root.left)\n if root.right:\n dfs(root.right)\n self.result.append(root.val)\ndfs(root)\nreturn self.result",
"if not root:\n return []\nstack = [root]\nres = []\nwhile stack:\n node = stack.pop... | <|body_start_0|>
if root == None:
return []
self.result = []
def dfs(root):
if root.left:
dfs(root.left)
if root.right:
dfs(root.right)
self.result.append(root.val)
dfs(root)
return self.result
<|end... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int] 32ms"""
<|body_0|>
def postorderTraversal_1(self, root):
""":type root: TreeNode :rtype: List[int] 35ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root =... | stack_v2_sparse_classes_36k_train_023863 | 1,509 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int] 32ms",
"name": "postorderTraversal",
"signature": "def postorderTraversal(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int] 35ms",
"name": "postorderTraversal_1",
"signature": "def postorderTraversal_1(self, root... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 32ms
- def postorderTraversal_1(self, root): :type root: TreeNode :rtype: List[int] 35ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] 32ms
- def postorderTraversal_1(self, root): :type root: TreeNode :rtype: List[int] 35ms
<|skeleton|>
... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int] 32ms"""
<|body_0|>
def postorderTraversal_1(self, root):
""":type root: TreeNode :rtype: List[int] 35ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int] 32ms"""
if root == None:
return []
self.result = []
def dfs(root):
if root.left:
dfs(root.left)
if root.right:
dfs(root.r... | the_stack_v2_python_sparse | BinaryTreePostorderTraversal_HARD_145.py | 953250587/leetcode-python | train | 2 | |
19e99262d23ee6ce91c7c10710212dc0c1f9c538 | [
"super(DirectEncodingModelTrainable, self).__init__(trainable=True, dtype=dtype)\nself.run_eagerly = run_eagerly\nnodes, connections, node_dependencies = _process_genotype(genotype)\nself.topology_levels = tuple(toposort(node_dependencies))\nnode_coordinates = _create_node_coordinates(self.topology_levels)\nself.cu... | <|body_start_0|>
super(DirectEncodingModelTrainable, self).__init__(trainable=True, dtype=dtype)
self.run_eagerly = run_eagerly
nodes, connections, node_dependencies = _process_genotype(genotype)
self.topology_levels = tuple(toposort(node_dependencies))
node_coordinates = _create... | Tensorflow model that builds a (exclusively) feed-forward topology with custom set connection weights and node biases/activations from the supplied genotype in the constructor. The built Tensorflow model is fully compatible with the rest of the Tensorflow infrastructure and supports static-graph building, auto-gradient... | DirectEncodingModelTrainable | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DirectEncodingModelTrainable:
"""Tensorflow model that builds a (exclusively) feed-forward topology with custom set connection weights and node biases/activations from the supplied genotype in the constructor. The built Tensorflow model is fully compatible with the rest of the Tensorflow infrastr... | stack_v2_sparse_classes_36k_train_023864 | 17,744 | no_license | [
{
"docstring": "Creates the trainable feed-forward Tensorflow model out of the supplied genotype with custom parameters :param genotype: genotype dict with the keys being the gene-ids and the values being the genes :param dtype: Tensorflow datatype of the model :param run_eagerly: bool flag if model should be r... | 2 | null | Implement the Python class `DirectEncodingModelTrainable` described below.
Class description:
Tensorflow model that builds a (exclusively) feed-forward topology with custom set connection weights and node biases/activations from the supplied genotype in the constructor. The built Tensorflow model is fully compatible w... | Implement the Python class `DirectEncodingModelTrainable` described below.
Class description:
Tensorflow model that builds a (exclusively) feed-forward topology with custom set connection weights and node biases/activations from the supplied genotype in the constructor. The built Tensorflow model is fully compatible w... | 21b290cf548e82ca91b761a6a7bd876e136e429b | <|skeleton|>
class DirectEncodingModelTrainable:
"""Tensorflow model that builds a (exclusively) feed-forward topology with custom set connection weights and node biases/activations from the supplied genotype in the constructor. The built Tensorflow model is fully compatible with the rest of the Tensorflow infrastr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DirectEncodingModelTrainable:
"""Tensorflow model that builds a (exclusively) feed-forward topology with custom set connection weights and node biases/activations from the supplied genotype in the constructor. The built Tensorflow model is fully compatible with the rest of the Tensorflow infrastructure and su... | the_stack_v2_python_sparse | ML/Tensorflow-Neuroevolution-master/neuroevolution/encodings/direct/direct_encoding_model.py | actuarial-tools/PythonStuff | train | 0 |
3205407c2ea11c8216c971e2491bac6e221987ab | [
"self.l = []\ni = 0\nwhile i < max(len(v1), len(v2)):\n if i < len(v1):\n self.l.append(v1[i])\n if i < len(v2):\n self.l.append(v2[i])\n i = i + 1\nself.index = 0",
"nextEle = self.l[self.index]\nself.index = self.index + 1\nreturn nextEle",
"if self.index < len(self.l):\n return True... | <|body_start_0|>
self.l = []
i = 0
while i < max(len(v1), len(v2)):
if i < len(v1):
self.l.append(v1[i])
if i < len(v2):
self.l.append(v2[i])
i = i + 1
self.index = 0
<|end_body_0|>
<|body_start_1|>
nextEle = se... | ZigzagIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_36k_train_023865 | 970 | no_license | [
{
"docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]",
"name": "__init__",
"signature": "def __init__(self, v1, v2)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"name"... | 3 | null | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | 0a2e0e4a5176c02910d7718c42903d10a6c47a5f | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
self.l = []
i = 0
while i < max(len(v1), len(v2)):
if i < len(v1):
self.l.append(v1[i])
if i < len(v2):
... | the_stack_v2_python_sparse | Zigzag_Iterator.py | baichuan/Leetcode | train | 0 | |
448f28490b971ebb275ae907aaebf4bf24574612 | [
"super(TriggerablePlatform, self).__init__(*groups)\nself.bouncepwr = bpwr\nif bouncy:\n self.activeimg = platgen.generate(size, 32, image)\nelse:\n self.activeimg = platgen.generate(size, 0, image)\nself.inactiveimg = platgen.generate(size, 64, image)\nif active:\n self.image = self.activeimg\nelse:\n ... | <|body_start_0|>
super(TriggerablePlatform, self).__init__(*groups)
self.bouncepwr = bpwr
if bouncy:
self.activeimg = platgen.generate(size, 32, image)
else:
self.activeimg = platgen.generate(size, 0, image)
self.inactiveimg = platgen.generate(size, 64, im... | Represents a mobile platform that can be triggered inherits properties from MobilePlatform | TriggerablePlatform | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerablePlatform:
"""Represents a mobile platform that can be triggered inherits properties from MobilePlatform"""
def __init__(self, x, y, vertical, bpwr, spd, size, active, identifier, *groups, game, bouncy=False, image):
"""Default Constructor Keyword Arguments: - x: The x coor... | stack_v2_sparse_classes_36k_train_023866 | 3,467 | permissive | [
{
"docstring": "Default Constructor Keyword Arguments: - x: The x coord of the top left corner - y: The y coord of the top left corner - *groups: A collection of sprite groups to add the item to. - game: The game istance. Returns: - Nothing",
"name": "__init__",
"signature": "def __init__(self, x, y, ve... | 2 | stack_v2_sparse_classes_30k_train_009192 | Implement the Python class `TriggerablePlatform` described below.
Class description:
Represents a mobile platform that can be triggered inherits properties from MobilePlatform
Method signatures and docstrings:
- def __init__(self, x, y, vertical, bpwr, spd, size, active, identifier, *groups, game, bouncy=False, image... | Implement the Python class `TriggerablePlatform` described below.
Class description:
Represents a mobile platform that can be triggered inherits properties from MobilePlatform
Method signatures and docstrings:
- def __init__(self, x, y, vertical, bpwr, spd, size, active, identifier, *groups, game, bouncy=False, image... | 0363fc368af205d1e829b2556ad70797930c10bd | <|skeleton|>
class TriggerablePlatform:
"""Represents a mobile platform that can be triggered inherits properties from MobilePlatform"""
def __init__(self, x, y, vertical, bpwr, spd, size, active, identifier, *groups, game, bouncy=False, image):
"""Default Constructor Keyword Arguments: - x: The x coor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TriggerablePlatform:
"""Represents a mobile platform that can be triggered inherits properties from MobilePlatform"""
def __init__(self, x, y, vertical, bpwr, spd, size, active, identifier, *groups, game, bouncy=False, image):
"""Default Constructor Keyword Arguments: - x: The x coord of the top ... | the_stack_v2_python_sparse | Game/components/triggerableplatform.py | Penaz91/Glitch_Heaven | train | 2 |
0504f41290485fdeb5307414196794355a805cd1 | [
"if n == 0:\n return\nif n == 1:\n matrix[y][x] = count\n return\nfor i in range(x, x + n):\n matrix[y][i] = count\n count += 1\nfor i in range(y + 1, y + n - 1):\n matrix[i][x + n - 1] = count\n count += 1\nfor i in range(x, x + n)[::-1]:\n matrix[y + n - 1][i] = count\n count += 1\nfor ... | <|body_start_0|>
if n == 0:
return
if n == 1:
matrix[y][x] = count
return
for i in range(x, x + n):
matrix[y][i] = count
count += 1
for i in range(y + 1, y + n - 1):
matrix[i][x + n - 1] = count
count += ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generateSubMatrix(self, x, y, n, count, matrix):
""":type i: int :type j: int :type n: int :type index: int :type matrix: List[List[int]]"""
<|body_0|>
def generateMatrix(self, n):
""":type n: int :rtype: List[List[int]]"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_023867 | 1,093 | no_license | [
{
"docstring": ":type i: int :type j: int :type n: int :type index: int :type matrix: List[List[int]]",
"name": "generateSubMatrix",
"signature": "def generateSubMatrix(self, x, y, n, count, matrix)"
},
{
"docstring": ":type n: int :rtype: List[List[int]]",
"name": "generateMatrix",
"sig... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateSubMatrix(self, x, y, n, count, matrix): :type i: int :type j: int :type n: int :type index: int :type matrix: List[List[int]]
- def generateMatrix(self, n): :type n:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateSubMatrix(self, x, y, n, count, matrix): :type i: int :type j: int :type n: int :type index: int :type matrix: List[List[int]]
- def generateMatrix(self, n): :type n:... | 052bd7915257679877dbe55b60ed1abb7528eaa2 | <|skeleton|>
class Solution:
def generateSubMatrix(self, x, y, n, count, matrix):
""":type i: int :type j: int :type n: int :type index: int :type matrix: List[List[int]]"""
<|body_0|>
def generateMatrix(self, n):
""":type n: int :rtype: List[List[int]]"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def generateSubMatrix(self, x, y, n, count, matrix):
""":type i: int :type j: int :type n: int :type index: int :type matrix: List[List[int]]"""
if n == 0:
return
if n == 1:
matrix[y][x] = count
return
for i in range(x, x + n):
... | the_stack_v2_python_sparse | python_solution/Array/59_SpiralMatrixII.py | Dimen61/leetcode | train | 4 | |
e578a369edf64f61418bc0d07009cb278ce335b9 | [
"if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.ModeID = ModeID\nself.ModeType = ModeType\nsuper(RadarModeType, self).__init__(**kwargs)",
"mode = self.ModeType\nif mode == 'SPOTLIGHT':\n return 'SL'\nelif mode == '... | <|body_start_0|>
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwargs:
self._xml_ns_key = kwargs['_xml_ns_key']
self.ModeID = ModeID
self.ModeType = ModeType
super(RadarModeType, self).__init__(**kwargs)
<|end_body_0|>
<|bod... | Radar mode type container class | RadarModeType | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RadarModeType:
"""Radar mode type container class"""
def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs):
"""Parameters ---------- ModeType : str ModeID : None|str kwargs"""
<|body_0|>
def get_mode_abbreviation(self) -> str:
"""Get the mo... | stack_v2_sparse_classes_36k_train_023868 | 5,859 | permissive | [
{
"docstring": "Parameters ---------- ModeType : str ModeID : None|str kwargs",
"name": "__init__",
"signature": "def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs)"
},
{
"docstring": "Get the mode abbreviation for the suggested name. Returns ------- str",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_021668 | Implement the Python class `RadarModeType` described below.
Class description:
Radar mode type container class
Method signatures and docstrings:
- def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs): Parameters ---------- ModeType : str ModeID : None|str kwargs
- def get_mode_abbreviation(sel... | Implement the Python class `RadarModeType` described below.
Class description:
Radar mode type container class
Method signatures and docstrings:
- def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs): Parameters ---------- ModeType : str ModeID : None|str kwargs
- def get_mode_abbreviation(sel... | de1b1886f161a83b6c89aadc7a2c7cfc4892ef81 | <|skeleton|>
class RadarModeType:
"""Radar mode type container class"""
def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs):
"""Parameters ---------- ModeType : str ModeID : None|str kwargs"""
<|body_0|>
def get_mode_abbreviation(self) -> str:
"""Get the mo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RadarModeType:
"""Radar mode type container class"""
def __init__(self, ModeType: str=None, ModeID: Optional[str]=None, **kwargs):
"""Parameters ---------- ModeType : str ModeID : None|str kwargs"""
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_k... | the_stack_v2_python_sparse | sarpy/io/complex/sicd_elements/CollectionInfo.py | ngageoint/sarpy | train | 192 |
facb5ecea462c1055b90074afe0e5eee2dc35a9c | [
"super(SelfAttnLayer, self).__init__()\nself.channel_in = in_dim\nself.query_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim // 8, kernel_size=1)\nself.key_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim // 8, kernel_size=1)\nself.value_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim, ker... | <|body_start_0|>
super(SelfAttnLayer, self).__init__()
self.channel_in = in_dim
self.query_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim // 8, kernel_size=1)
self.key_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim // 8, kernel_size=1)
self.value_conv = nn.Con... | Self-Attention Layer This type of layer was proposed by: Zhang et al., "Self-Attention Generative Adversarial Networks", 2018 https://arxiv.org/abs/1805.08318 The goal is to capture global correlations in convolutional networks (such as generators and discriminators in GANs). | SelfAttnLayer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttnLayer:
"""Self-Attention Layer This type of layer was proposed by: Zhang et al., "Self-Attention Generative Adversarial Networks", 2018 https://arxiv.org/abs/1805.08318 The goal is to capture global correlations in convolutional networks (such as generators and discriminators in GANs)."""... | stack_v2_sparse_classes_36k_train_023869 | 11,615 | permissive | [
{
"docstring": "Initialize self-attention layer. Args: in_dim: Number of input channels (C). use_spectral_norm: Enable spectral normalization for all 1x1 conv. layers.",
"name": "__init__",
"signature": "def __init__(self, in_dim, use_spectral_norm)"
},
{
"docstring": "Compute and apply attentio... | 2 | stack_v2_sparse_classes_30k_train_015660 | Implement the Python class `SelfAttnLayer` described below.
Class description:
Self-Attention Layer This type of layer was proposed by: Zhang et al., "Self-Attention Generative Adversarial Networks", 2018 https://arxiv.org/abs/1805.08318 The goal is to capture global correlations in convolutional networks (such as gen... | Implement the Python class `SelfAttnLayer` described below.
Class description:
Self-Attention Layer This type of layer was proposed by: Zhang et al., "Self-Attention Generative Adversarial Networks", 2018 https://arxiv.org/abs/1805.08318 The goal is to capture global correlations in convolutional networks (such as gen... | e32567889f772f8de783a437ff0beb2d426bc7b6 | <|skeleton|>
class SelfAttnLayer:
"""Self-Attention Layer This type of layer was proposed by: Zhang et al., "Self-Attention Generative Adversarial Networks", 2018 https://arxiv.org/abs/1805.08318 The goal is to capture global correlations in convolutional networks (such as generators and discriminators in GANs)."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SelfAttnLayer:
"""Self-Attention Layer This type of layer was proposed by: Zhang et al., "Self-Attention Generative Adversarial Networks", 2018 https://arxiv.org/abs/1805.08318 The goal is to capture global correlations in convolutional networks (such as generators and discriminators in GANs)."""
def __i... | the_stack_v2_python_sparse | utils/self_attention_layer.py | chrhenning/hypercl | train | 148 |
6f5f9de9c3ff9f3ff37e76660fd3d93a701d479f | [
"self.mb_dir_path.mkdir(parents=True, exist_ok=True)\nfor i in range(self.n_boxes):\n mb_path = self.path_to_mailbox(i)\n with mb_path.open('w') as fh:\n fh.write(header)",
"if index_name is None:\n start = '\\t'\nelse:\n start = f'{index_name}\\t'\ncolstring = '\\t'.join(columns)\nself.mb_dir_... | <|body_start_0|>
self.mb_dir_path.mkdir(parents=True, exist_ok=True)
for i in range(self.n_boxes):
mb_path = self.path_to_mailbox(i)
with mb_path.open('w') as fh:
fh.write(header)
<|end_body_0|>
<|body_start_1|>
if index_name is None:
start = ... | Pass data to and from on-disk FIFOs. | DataMailboxes | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataMailboxes:
"""Pass data to and from on-disk FIFOs."""
def write_headers(self, header):
"""Initialize the mailboxes, writing a free-form header."""
<|body_0|>
def write_tsv_headers(self, columns, index_name=None):
"""Initialize the mailboxes, writing a tab-sep... | stack_v2_sparse_classes_36k_train_023870 | 7,728 | permissive | [
{
"docstring": "Initialize the mailboxes, writing a free-form header.",
"name": "write_headers",
"signature": "def write_headers(self, header)"
},
{
"docstring": "Initialize the mailboxes, writing a tab-separated header.",
"name": "write_tsv_headers",
"signature": "def write_tsv_headers(... | 6 | stack_v2_sparse_classes_30k_train_018936 | Implement the Python class `DataMailboxes` described below.
Class description:
Pass data to and from on-disk FIFOs.
Method signatures and docstrings:
- def write_headers(self, header): Initialize the mailboxes, writing a free-form header.
- def write_tsv_headers(self, columns, index_name=None): Initialize the mailbox... | Implement the Python class `DataMailboxes` described below.
Class description:
Pass data to and from on-disk FIFOs.
Method signatures and docstrings:
- def write_headers(self, header): Initialize the mailboxes, writing a free-form header.
- def write_tsv_headers(self, columns, index_name=None): Initialize the mailbox... | 90b6f52d9208458053001e49a9537cd9870c5f15 | <|skeleton|>
class DataMailboxes:
"""Pass data to and from on-disk FIFOs."""
def write_headers(self, header):
"""Initialize the mailboxes, writing a free-form header."""
<|body_0|>
def write_tsv_headers(self, columns, index_name=None):
"""Initialize the mailboxes, writing a tab-sep... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataMailboxes:
"""Pass data to and from on-disk FIFOs."""
def write_headers(self, header):
"""Initialize the mailboxes, writing a free-form header."""
self.mb_dir_path.mkdir(parents=True, exist_ok=True)
for i in range(self.n_boxes):
mb_path = self.path_to_mailbox(i)
... | the_stack_v2_python_sparse | azulejo/mailboxes.py | legumeinfo/azulejo | train | 0 |
514d681b79e1811b3d17e3d565fc98414f59eedf | [
"if not s:\n return False\nss = (s + s)[1:-1]\nreturn ss.find(s) != -1",
"if not s:\n return False\nsub, j = (s[0], 0)\nfor i, c in enumerate(s):\n if c == sub[j % len(sub)]:\n j += 1\n else:\n sub = s[:i + 1]\n j = 0\nreturn len(sub) < len(s) and j % len(sub) == 0",
"if not s:\... | <|body_start_0|>
if not s:
return False
ss = (s + s)[1:-1]
return ss.find(s) != -1
<|end_body_0|>
<|body_start_1|>
if not s:
return False
sub, j = (s[0], 0)
for i, c in enumerate(s):
if c == sub[j % len(sub)]:
j += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def repeatedSubstringPattern2(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def repeatedSubstringPattern3(self, s):
""":type s: str :rtype: bool"""... | stack_v2_sparse_classes_36k_train_023871 | 3,316 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "repeatedSubstringPattern",
"signature": "def repeatedSubstringPattern(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "repeatedSubstringPattern2",
"signature": "def repeatedSubstringPattern2(self, s)"
},
{
"doc... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def repeatedSubstringPattern2(self, s): :type s: str :rtype: bool
- def repeatedSubstringPattern3(self, s): :ty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def repeatedSubstringPattern2(self, s): :type s: str :rtype: bool
- def repeatedSubstringPattern3(self, s): :ty... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def repeatedSubstringPattern2(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def repeatedSubstringPattern3(self, s):
""":type s: str :rtype: bool"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
if not s:
return False
ss = (s + s)[1:-1]
return ss.find(s) != -1
def repeatedSubstringPattern2(self, s):
""":type s: str :rtype: bool"""
if not s:
retu... | the_stack_v2_python_sparse | code459RepeatedSubstringPattern.py | cybelewang/leetcode-python | train | 0 | |
115881270c9a6b91a26525ad132683a72c43199d | [
"session = Session()\ntry:\n organization_it_asset = find_organization_it_asset(it_asset_instance_id, organization_code, session)\n if organization_it_asset is None:\n raise falcon.HTTPNotFound()\n query = session.query(OrganizationItAssetControl).join(OrganizationITAsset).join(MitigationControl).fi... | <|body_start_0|>
session = Session()
try:
organization_it_asset = find_organization_it_asset(it_asset_instance_id, organization_code, session)
if organization_it_asset is None:
raise falcon.HTTPNotFound()
query = session.query(OrganizationItAssetContro... | GET and POST mitigation controls for organization IT assets. | Collection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Collection:
"""GET and POST mitigation controls for organization IT assets."""
def on_get(self, req, resp, organization_code, it_asset_instance_id):
"""List mitigation controls for an organization IT asset. :param req: See Falcon Request documentation. :param resp: See Falcon Respons... | stack_v2_sparse_classes_36k_train_023872 | 6,975 | no_license | [
{
"docstring": "List mitigation controls for an organization IT asset. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. :param organization_code: The code of the organization. :param it_asset_instance_id: The id of the IT asset instance.",
"name": "on_get",
"... | 2 | stack_v2_sparse_classes_30k_train_017288 | Implement the Python class `Collection` described below.
Class description:
GET and POST mitigation controls for organization IT assets.
Method signatures and docstrings:
- def on_get(self, req, resp, organization_code, it_asset_instance_id): List mitigation controls for an organization IT asset. :param req: See Falc... | Implement the Python class `Collection` described below.
Class description:
GET and POST mitigation controls for organization IT assets.
Method signatures and docstrings:
- def on_get(self, req, resp, organization_code, it_asset_instance_id): List mitigation controls for an organization IT asset. :param req: See Falc... | 62723133595829230e5b589431a32cda3b092460 | <|skeleton|>
class Collection:
"""GET and POST mitigation controls for organization IT assets."""
def on_get(self, req, resp, organization_code, it_asset_instance_id):
"""List mitigation controls for an organization IT asset. :param req: See Falcon Request documentation. :param resp: See Falcon Respons... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Collection:
"""GET and POST mitigation controls for organization IT assets."""
def on_get(self, req, resp, organization_code, it_asset_instance_id):
"""List mitigation controls for an organization IT asset. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentati... | the_stack_v2_python_sparse | knoweak/api/resources/organization_it_asset_control.py | psvaiter/knoweak-api | train | 0 |
9124c4aad50d04b9f2c93ede29828cd02f3fe9e9 | [
"bboxes = []\nfor i in range(len(ocr_results['text'])):\n detected_text = ocr_results['text'][i]\n if detected_text:\n bbox = {'left': ocr_results['left'][i], 'top': ocr_results['top'][i], 'width': ocr_results['width'][i], 'height': ocr_results['height'][i], 'conf': float(ocr_results['conf'][i]), 'labe... | <|body_start_0|>
bboxes = []
for i in range(len(ocr_results['text'])):
detected_text = ocr_results['text'][i]
if detected_text:
bbox = {'left': ocr_results['left'][i], 'top': ocr_results['top'][i], 'width': ocr_results['width'][i], 'height': ocr_results['height'][... | Common module for general bounding box operators. | BboxProcessor | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"BSD-3-Clause",
"Unlicense",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-warranty-disclaimer",
"CNRI-Python",
"MIT",
"LicenseRef-scancode-secret-labs-2011",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BboxProcessor:
"""Common module for general bounding box operators."""
def get_bboxes_from_ocr_results(self, ocr_results: Dict[str, List[Union[int, str]]]) -> List[Dict[str, Union[int, float, str]]]:
"""Get bounding boxes on padded image for all detected words from ocr_results. :para... | stack_v2_sparse_classes_36k_train_023873 | 4,970 | permissive | [
{
"docstring": "Get bounding boxes on padded image for all detected words from ocr_results. :param ocr_results: Raw results from OCR. :return: Bounding box information per word.",
"name": "get_bboxes_from_ocr_results",
"signature": "def get_bboxes_from_ocr_results(self, ocr_results: Dict[str, List[Union... | 4 | null | Implement the Python class `BboxProcessor` described below.
Class description:
Common module for general bounding box operators.
Method signatures and docstrings:
- def get_bboxes_from_ocr_results(self, ocr_results: Dict[str, List[Union[int, str]]]) -> List[Dict[str, Union[int, float, str]]]: Get bounding boxes on pa... | Implement the Python class `BboxProcessor` described below.
Class description:
Common module for general bounding box operators.
Method signatures and docstrings:
- def get_bboxes_from_ocr_results(self, ocr_results: Dict[str, List[Union[int, str]]]) -> List[Dict[str, Union[int, float, str]]]: Get bounding boxes on pa... | 3effc1467b8714714d5112ef7b627889507ea83d | <|skeleton|>
class BboxProcessor:
"""Common module for general bounding box operators."""
def get_bboxes_from_ocr_results(self, ocr_results: Dict[str, List[Union[int, str]]]) -> List[Dict[str, Union[int, float, str]]]:
"""Get bounding boxes on padded image for all detected words from ocr_results. :para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BboxProcessor:
"""Common module for general bounding box operators."""
def get_bboxes_from_ocr_results(self, ocr_results: Dict[str, List[Union[int, str]]]) -> List[Dict[str, Union[int, float, str]]]:
"""Get bounding boxes on padded image for all detected words from ocr_results. :param ocr_results... | the_stack_v2_python_sparse | presidio-image-redactor/presidio_image_redactor/bbox.py | microsoft/presidio | train | 2,092 |
531ce051d2812f664f6547071c342c7ce61a77e3 | [
"super(DialogComControlDeviceExecute1, self).__init__(parent)\nself.setupUi(self)\nself.flag = 1",
"try:\n self.setWindowTitle(title)\n self.textBrowser_contents.setText(contents)\n if os.path.isfile(img_file_path) and os.access(img_file_path, os.W_OK):\n self.label_img.setPixmap(QtGui.QPixmap(img... | <|body_start_0|>
super(DialogComControlDeviceExecute1, self).__init__(parent)
self.setupUi(self)
self.flag = 1
<|end_body_0|>
<|body_start_1|>
try:
self.setWindowTitle(title)
self.textBrowser_contents.setText(contents)
if os.path.isfile(img_file_path)... | Class documentation goes here. | DialogComControlDeviceExecute1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DialogComControlDeviceExecute1:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor @param parent reference to the parent widget @type QWidget"""
<|body_0|>
def set_contents(self, title, contents, img_file_path):
"""set gui displa... | stack_v2_sparse_classes_36k_train_023874 | 3,242 | no_license | [
{
"docstring": "Constructor @param parent reference to the parent widget @type QWidget",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "set gui display information :param title: dialog window title :param contents: dialog content browser information :param ... | 4 | stack_v2_sparse_classes_30k_train_004009 | Implement the Python class `DialogComControlDeviceExecute1` described below.
Class description:
Class documentation goes here.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor @param parent reference to the parent widget @type QWidget
- def set_contents(self, title, contents, img_file_... | Implement the Python class `DialogComControlDeviceExecute1` described below.
Class description:
Class documentation goes here.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor @param parent reference to the parent widget @type QWidget
- def set_contents(self, title, contents, img_file_... | 57dd2197e7d91b8ad8fb2bd0e3503f10afa08544 | <|skeleton|>
class DialogComControlDeviceExecute1:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor @param parent reference to the parent widget @type QWidget"""
<|body_0|>
def set_contents(self, title, contents, img_file_path):
"""set gui displa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DialogComControlDeviceExecute1:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor @param parent reference to the parent widget @type QWidget"""
super(DialogComControlDeviceExecute1, self).__init__(parent)
self.setupUi(self)
self.flag = 1
... | the_stack_v2_python_sparse | modules/com_control_device_new/COM_CONTROL_DEVICE_EXECUTE1.py | gaoxingyu-hub/54testframework-master-e284 | train | 0 |
2f8d532beb5cc70f39190ce76123811416b0c7ad | [
"super(BasicSt, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass)\nK_sp = self.get_parameter_from_exponent('K_stochastic_sp', raise_error=False)\nK_ss = self.get_parameter_from_exponent('K_stochastic_ss', raise_error=False)\nlinear_diffusivity = self._length_factor **... | <|body_start_0|>
super(BasicSt, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass)
K_sp = self.get_parameter_from_exponent('K_stochastic_sp', raise_error=False)
K_ss = self.get_parameter_from_exponent('K_stochastic_ss', raise_error=False)
li... | A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node. | BasicSt | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicSt:
"""A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node."""
def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None):
"""Initialize the StochasticDis... | stack_v2_sparse_classes_36k_train_023875 | 6,932 | permissive | [
{
"docstring": "Initialize the StochasticDischargeHortonianModel.",
"name": "__init__",
"signature": "def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None)"
},
{
"docstring": "Calculate runoff rate and discharge; return runoff.",
"name": "calc_runoff_and_discharge",
... | 3 | stack_v2_sparse_classes_30k_val_000207 | Implement the Python class `BasicSt` described below.
Class description:
A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node.
Method signatures and docstrings:
- def __init__(self, input_file=None, params=None, ... | Implement the Python class `BasicSt` described below.
Class description:
A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node.
Method signatures and docstrings:
- def __init__(self, input_file=None, params=None, ... | 1b756477b8a8ab6a8f1275b1b30ec84855c840ea | <|skeleton|>
class BasicSt:
"""A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node."""
def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None):
"""Initialize the StochasticDis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicSt:
"""A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node."""
def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None):
"""Initialize the StochasticDischargeHortoni... | the_stack_v2_python_sparse | terrainbento/derived_models/model_100_basicSt/model_100_basicSt.py | mcflugen/terrainbento | train | 0 |
8af40f54ae1e25fee10666d8b576f84e25c4620e | [
"d = {'}': '{', ']': '[', ')': '('}\nstack = []\nfor i in s:\n if d.get(i) is not None:\n if len(stack) == 0 or stack.pop() != d[i]:\n return False\n else:\n stack.append(i)\nif len(stack) == 0:\n return True\nelse:\n return False",
"d = {'}': '{', ']': '[', ')': '('}\nl = lis... | <|body_start_0|>
d = {'}': '{', ']': '[', ')': '('}
stack = []
for i in s:
if d.get(i) is not None:
if len(stack) == 0 or stack.pop() != d[i]:
return False
else:
stack.append(i)
if len(stack) == 0:
re... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def other(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d = {'}': '{', ']': '[', ')': '('}
stack = []
for i in s:
... | stack_v2_sparse_classes_36k_train_023876 | 956 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "other",
"signature": "def other(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014640 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def other(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def other(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :... | e178f91ebffff06977e8c231de12786a72b3b13d | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def other(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
d = {'}': '{', ']': '[', ')': '('}
stack = []
for i in s:
if d.get(i) is not None:
if len(stack) == 0 or stack.pop() != d[i]:
return False
else:
... | the_stack_v2_python_sparse | iamsochun/Leetcode20.py | moonlight035/algorithm | train | 0 | |
82ea97fda35a73a90211cce9eddc296271183195 | [
"for i in range(self.start, len(self.A)):\n if self.A[i].state == state:\n return self.A[i]",
"for i in range(self.start, len(self.A)):\n if self.A[i].state == node.state:\n return True"
] | <|body_start_0|>
for i in range(self.start, len(self.A)):
if self.A[i].state == state:
return self.A[i]
<|end_body_0|>
<|body_start_1|>
for i in range(self.start, len(self.A)):
if self.A[i].state == node.state:
return True
<|end_body_1|>
| MyFIFOQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyFIFOQueue:
def getNode(self, state):
"""Returns node in queue with matching state"""
<|body_0|>
def __contains__(self, node):
"""Returns boolean if there is node in queue with matching state. The implementation in utils.py is very slow."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k_train_023877 | 4,831 | no_license | [
{
"docstring": "Returns node in queue with matching state",
"name": "getNode",
"signature": "def getNode(self, state)"
},
{
"docstring": "Returns boolean if there is node in queue with matching state. The implementation in utils.py is very slow.",
"name": "__contains__",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_020870 | Implement the Python class `MyFIFOQueue` described below.
Class description:
Implement the MyFIFOQueue class.
Method signatures and docstrings:
- def getNode(self, state): Returns node in queue with matching state
- def __contains__(self, node): Returns boolean if there is node in queue with matching state. The imple... | Implement the Python class `MyFIFOQueue` described below.
Class description:
Implement the MyFIFOQueue class.
Method signatures and docstrings:
- def getNode(self, state): Returns node in queue with matching state
- def __contains__(self, node): Returns boolean if there is node in queue with matching state. The imple... | 6f774d6e2d8051ba76d3c25cbf247bdbe4849ff3 | <|skeleton|>
class MyFIFOQueue:
def getNode(self, state):
"""Returns node in queue with matching state"""
<|body_0|>
def __contains__(self, node):
"""Returns boolean if there is node in queue with matching state. The implementation in utils.py is very slow."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyFIFOQueue:
def getNode(self, state):
"""Returns node in queue with matching state"""
for i in range(self.start, len(self.A)):
if self.A[i].state == state:
return self.A[i]
def __contains__(self, node):
"""Returns boolean if there is node in queue with... | the_stack_v2_python_sparse | weekly_inclass_coding/week9/maps/bidirectional.py | iamzhanghao/AI_Projects | train | 2 | |
116e3bbeeca9757070add1533ca0a34779a6ee66 | [
"student_id = g.user_id\nargs = request.args\nprint(args)\ntry:\n args = MonthDaySchema().load(args)\nexcept marshmallow.exceptions.ValidationError as e:\n print(e.messages)\n return ({'message': '파라미터 값이 유효하지 않습니다.'}, 400)\nstudent, school = get_identify() or (None, None)\nif student is None:\n return ... | <|body_start_0|>
student_id = g.user_id
args = request.args
print(args)
try:
args = MonthDaySchema().load(args)
except marshmallow.exceptions.ValidationError as e:
print(e.messages)
return ({'message': '파라미터 값이 유효하지 않습니다.'}, 400)
studen... | RatingFavoriteAll | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RatingFavoriteAll:
def get(self):
"""모든 즐겨찾기 리스트 보여줌 :return: 200 : OK 400 : 파라미터 무효 401 : 회원정보 이상"""
<|body_0|>
def delete(self):
"""모든 즐겨찾기 삭제 :return: 200 : OK 401 : 회원정보 이상 404 : 좋아하는 메뉴가 없었음"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
stude... | stack_v2_sparse_classes_36k_train_023878 | 3,023 | no_license | [
{
"docstring": "모든 즐겨찾기 리스트 보여줌 :return: 200 : OK 400 : 파라미터 무효 401 : 회원정보 이상",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "모든 즐겨찾기 삭제 :return: 200 : OK 401 : 회원정보 이상 404 : 좋아하는 메뉴가 없었음",
"name": "delete",
"signature": "def delete(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013542 | Implement the Python class `RatingFavoriteAll` described below.
Class description:
Implement the RatingFavoriteAll class.
Method signatures and docstrings:
- def get(self): 모든 즐겨찾기 리스트 보여줌 :return: 200 : OK 400 : 파라미터 무효 401 : 회원정보 이상
- def delete(self): 모든 즐겨찾기 삭제 :return: 200 : OK 401 : 회원정보 이상 404 : 좋아하는 메뉴가 없었음 | Implement the Python class `RatingFavoriteAll` described below.
Class description:
Implement the RatingFavoriteAll class.
Method signatures and docstrings:
- def get(self): 모든 즐겨찾기 리스트 보여줌 :return: 200 : OK 400 : 파라미터 무효 401 : 회원정보 이상
- def delete(self): 모든 즐겨찾기 삭제 :return: 200 : OK 401 : 회원정보 이상 404 : 좋아하는 메뉴가 없었음
... | 6195b3e6b5ac7e5b5f1b6c23c14393b3d85b9b61 | <|skeleton|>
class RatingFavoriteAll:
def get(self):
"""모든 즐겨찾기 리스트 보여줌 :return: 200 : OK 400 : 파라미터 무효 401 : 회원정보 이상"""
<|body_0|>
def delete(self):
"""모든 즐겨찾기 삭제 :return: 200 : OK 401 : 회원정보 이상 404 : 좋아하는 메뉴가 없었음"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RatingFavoriteAll:
def get(self):
"""모든 즐겨찾기 리스트 보여줌 :return: 200 : OK 400 : 파라미터 무효 401 : 회원정보 이상"""
student_id = g.user_id
args = request.args
print(args)
try:
args = MonthDaySchema().load(args)
except marshmallow.exceptions.ValidationError as e:
... | the_stack_v2_python_sparse | app/meals/v1/api/RatingFavoriteAll.py | ApertureInDimigo/meal-backend | train | 0 | |
0d52b4124a32a9b2b5601e1aeb8b955765c9cdd9 | [
"if not head:\n return False\nfirst = head\nsecond = head.next.next if head.next else None\nif not second:\n return False\nwhile first != second:\n first = first.next\n second = second.next.next if second.next else None\n if not second:\n return False\nreturn True",
"fwd = ohead = head\ncnt ... | <|body_start_0|>
if not head:
return False
first = head
second = head.next.next if head.next else None
if not second:
return False
while first != second:
first = first.next
second = second.next.next if second.next else None
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def rewrite(self, head):
""":type head: ListNode :rtype: bool Best solution :-)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
return Fa... | stack_v2_sparse_classes_36k_train_023879 | 2,391 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle",
"signature": "def hasCycle(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool Best solution :-)",
"name": "rewrite",
"signature": "def rewrite(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019140 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def rewrite(self, head): :type head: ListNode :rtype: bool Best solution :-) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def rewrite(self, head): :type head: ListNode :rtype: bool Best solution :-)
<|skeleton|>
class Solution:
def ... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def rewrite(self, head):
""":type head: ListNode :rtype: bool Best solution :-)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
if not head:
return False
first = head
second = head.next.next if head.next else None
if not second:
return False
while first != second:
first = first... | the_stack_v2_python_sparse | co_amazon/141_Linked_List_Cycle.py | vsdrun/lc_public | train | 6 | |
27998c531f0fd37079bbe846fa6d6991952f214e | [
"self.M_min = -20\nself.M_max = -18\nself.fluid_number = fluid_number\nself.names = names\nself.int_lim = int_lim",
"M = 1000.0 * rng.rand()\nM = dnest4.wrap(M, self.M_min, self.M_max)\nM = np.array([M])\nfluids = [rng.rand() for i in range(0, fluid_number)]\nif self.int_lim:\n int_terms = np.zeros(len(self.in... | <|body_start_0|>
self.M_min = -20
self.M_max = -18
self.fluid_number = fluid_number
self.names = names
self.int_lim = int_lim
<|end_body_0|>
<|body_start_1|>
M = 1000.0 * rng.rand()
M = dnest4.wrap(M, self.M_min, self.M_max)
M = np.array([M])
flui... | Specify the model in Python. | Model | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
"""Specify the model in Python."""
def __init__(self, names, int_lim, fluid_number):
"""Parameter values *are not* stored inside the class"""
<|body_0|>
def from_prior(self):
"""Unlike in C++, this must *return* a numpy array of parameters."""
<|bo... | stack_v2_sparse_classes_36k_train_023880 | 10,743 | permissive | [
{
"docstring": "Parameter values *are not* stored inside the class",
"name": "__init__",
"signature": "def __init__(self, names, int_lim, fluid_number)"
},
{
"docstring": "Unlike in C++, this must *return* a numpy array of parameters.",
"name": "from_prior",
"signature": "def from_prior(... | 4 | stack_v2_sparse_classes_30k_train_004849 | Implement the Python class `Model` described below.
Class description:
Specify the model in Python.
Method signatures and docstrings:
- def __init__(self, names, int_lim, fluid_number): Parameter values *are not* stored inside the class
- def from_prior(self): Unlike in C++, this must *return* a numpy array of parame... | Implement the Python class `Model` described below.
Class description:
Specify the model in Python.
Method signatures and docstrings:
- def __init__(self, names, int_lim, fluid_number): Parameter values *are not* stored inside the class
- def from_prior(self): Unlike in C++, this must *return* a numpy array of parame... | c355d18021467cf92546cf2fc9cb1d1abe59b8d8 | <|skeleton|>
class Model:
"""Specify the model in Python."""
def __init__(self, names, int_lim, fluid_number):
"""Parameter values *are not* stored inside the class"""
<|body_0|>
def from_prior(self):
"""Unlike in C++, this must *return* a numpy array of parameters."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Model:
"""Specify the model in Python."""
def __init__(self, names, int_lim, fluid_number):
"""Parameter values *are not* stored inside the class"""
self.M_min = -20
self.M_max = -18
self.fluid_number = fluid_number
self.names = names
self.int_lim = int_lim... | the_stack_v2_python_sparse | Models/Bfactor.py | lefthandedroo/Cosmodels | train | 1 |
d2ce1408439d638630d6405f2bab8aab497f7a1c | [
"self.n_actions = n_actions\nself.eps_initials = np.array(eps_initials)\nself.eps_final = np.array(eps_final)\nself.eps_probs = np.array(eps_probs)\nself.eps_annealing_frames = eps_annealing_frames\nself.eps_evaluation = eps_evaluation\nself.slopes = np.array([-(self.eps_initials[i] - self.eps_final[i]) / self.eps_... | <|body_start_0|>
self.n_actions = n_actions
self.eps_initials = np.array(eps_initials)
self.eps_final = np.array(eps_final)
self.eps_probs = np.array(eps_probs)
self.eps_annealing_frames = eps_annealing_frames
self.eps_evaluation = eps_evaluation
self.slopes = np.... | According to the papaer: Asynchronous methods for RL, I implement 3 epsilons annealing at different rates and at each iteration sample from them. determines an action according to an epsilon greedy strategy with annealing epsilon Modify the annealing and exploration as desired.. | ActionGetter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionGetter:
"""According to the papaer: Asynchronous methods for RL, I implement 3 epsilons annealing at different rates and at each iteration sample from them. determines an action according to an epsilon greedy strategy with annealing epsilon Modify the annealing and exploration as desired.."... | stack_v2_sparse_classes_36k_train_023881 | 19,841 | no_license | [
{
"docstring": ":param n_actions: int, number of possible actions :param eps_initials: float, list of initial exploration probabilies :param eps_final : final exploration probability after eps_annealing_frames frames :param eps_evaluation: float, exploration probability during evaluation :param eps_annealing_fr... | 2 | null | Implement the Python class `ActionGetter` described below.
Class description:
According to the papaer: Asynchronous methods for RL, I implement 3 epsilons annealing at different rates and at each iteration sample from them. determines an action according to an epsilon greedy strategy with annealing epsilon Modify the ... | Implement the Python class `ActionGetter` described below.
Class description:
According to the papaer: Asynchronous methods for RL, I implement 3 epsilons annealing at different rates and at each iteration sample from them. determines an action according to an epsilon greedy strategy with annealing epsilon Modify the ... | 5d4dbde8d570623fe785e78a3e45cd05ea80aa08 | <|skeleton|>
class ActionGetter:
"""According to the papaer: Asynchronous methods for RL, I implement 3 epsilons annealing at different rates and at each iteration sample from them. determines an action according to an epsilon greedy strategy with annealing epsilon Modify the annealing and exploration as desired.."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActionGetter:
"""According to the papaer: Asynchronous methods for RL, I implement 3 epsilons annealing at different rates and at each iteration sample from them. determines an action according to an epsilon greedy strategy with annealing epsilon Modify the annealing and exploration as desired.."""
def _... | the_stack_v2_python_sparse | Reinforcement-Learning/double_doueling1step_DQN_uniformReply.py | behrouzmadahian/python | train | 1 |
63b053836e35d692a928e418c1a9c90b94038c30 | [
"if not s:\n return True\nresult = False\nfor word in wordDict:\n if s.startswith(word):\n result |= self.wordBreak(s[len(word):], wordDict)\n if result:\n break\nreturn result",
"d = [False] * len(s)\nfor i in range(len(s)):\n for w in wordDict:\n if w == s[i - len(w) + 1... | <|body_start_0|>
if not s:
return True
result = False
for word in wordDict:
if s.startswith(word):
result |= self.wordBreak(s[len(word):], wordDict)
if result:
break
return result
<|end_body_0|>
<|body_start_1|>... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
"""TimeLimit Exceed :type s: str :type wordDict: List[str] :rtype: bool"""
<|body_0|>
def wordBreak2(self, s, wordDict):
"""https://discuss.leetcode.com/topic/8109/simple-dp-solution-in-python-with-description/2 :param s: :... | stack_v2_sparse_classes_36k_train_023882 | 1,541 | no_license | [
{
"docstring": "TimeLimit Exceed :type s: str :type wordDict: List[str] :rtype: bool",
"name": "wordBreak",
"signature": "def wordBreak(self, s, wordDict)"
},
{
"docstring": "https://discuss.leetcode.com/topic/8109/simple-dp-solution-in-python-with-description/2 :param s: :param wordDict:",
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s, wordDict): TimeLimit Exceed :type s: str :type wordDict: List[str] :rtype: bool
- def wordBreak2(self, s, wordDict): https://discuss.leetcode.com/topic/810... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s, wordDict): TimeLimit Exceed :type s: str :type wordDict: List[str] :rtype: bool
- def wordBreak2(self, s, wordDict): https://discuss.leetcode.com/topic/810... | 2526f8c0dec7101123123740e146ee4081e979ee | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
"""TimeLimit Exceed :type s: str :type wordDict: List[str] :rtype: bool"""
<|body_0|>
def wordBreak2(self, s, wordDict):
"""https://discuss.leetcode.com/topic/8109/simple-dp-solution-in-python-with-description/2 :param s: :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def wordBreak(self, s, wordDict):
"""TimeLimit Exceed :type s: str :type wordDict: List[str] :rtype: bool"""
if not s:
return True
result = False
for word in wordDict:
if s.startswith(word):
result |= self.wordBreak(s[len(word):... | the_stack_v2_python_sparse | 139. Word Break.py | zhangpengGenedock/leetcode_python | train | 1 | |
1ea6e542a3f778e5c83642d88ffb023a4c7d5807 | [
"with self.schema.table('steps') as table:\n table.string('status', 20).default('No Run').change()\n pass",
"with self.schema.table('steps') as table:\n table.string('status', 20).default('No Run').change()\n pass"
] | <|body_start_0|>
with self.schema.table('steps') as table:
table.string('status', 20).default('No Run').change()
pass
<|end_body_0|>
<|body_start_1|>
with self.schema.table('steps') as table:
table.string('status', 20).default('No Run').change()
pass
<|en... | AlterTestStatusStepsDefaultValue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlterTestStatusStepsDefaultValue:
def up(self):
"""Run the migrations."""
<|body_0|>
def down(self):
"""Revert the migrations."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
with self.schema.table('steps') as table:
table.string('status... | stack_v2_sparse_classes_36k_train_023883 | 506 | no_license | [
{
"docstring": "Run the migrations.",
"name": "up",
"signature": "def up(self)"
},
{
"docstring": "Revert the migrations.",
"name": "down",
"signature": "def down(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003928 | Implement the Python class `AlterTestStatusStepsDefaultValue` described below.
Class description:
Implement the AlterTestStatusStepsDefaultValue class.
Method signatures and docstrings:
- def up(self): Run the migrations.
- def down(self): Revert the migrations. | Implement the Python class `AlterTestStatusStepsDefaultValue` described below.
Class description:
Implement the AlterTestStatusStepsDefaultValue class.
Method signatures and docstrings:
- def up(self): Run the migrations.
- def down(self): Revert the migrations.
<|skeleton|>
class AlterTestStatusStepsDefaultValue:
... | 8033c98d7dc13cf5b53e5e4293083db8419809d1 | <|skeleton|>
class AlterTestStatusStepsDefaultValue:
def up(self):
"""Run the migrations."""
<|body_0|>
def down(self):
"""Revert the migrations."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlterTestStatusStepsDefaultValue:
def up(self):
"""Run the migrations."""
with self.schema.table('steps') as table:
table.string('status', 20).default('No Run').change()
pass
def down(self):
"""Revert the migrations."""
with self.schema.table('steps... | the_stack_v2_python_sparse | migrations/2017_12_26_033253_alter_test_status_steps_default_value.py | nuraizatif/pavoGUI | train | 0 | |
5b6a515377fa2237a04e1f8feb6e7769dcab8f3f | [
"data = req.data.keys()[0]\ndata = simplejson.loads(data)\ntitle = data.get('title')\ncategory = data.get('category')\nitems = data.get('items')\nis_active = data.get('is_active')\nactive_time = data.get('active_time')\nposter = GoodShelf()\nif title:\n poster.title = title\nif category:\n poster.category = c... | <|body_start_0|>
data = req.data.keys()[0]
data = simplejson.loads(data)
title = data.get('title')
category = data.get('category')
items = data.get('items')
is_active = data.get('is_active')
active_time = data.get('active_time')
poster = GoodShelf()
... | PosterViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PosterViewSet:
def create(self, req, *args, **kwargs):
"""POST /rest/v2/poster"""
<|body_0|>
def update(self, req, *args, **kwargs):
"""PUT /rest/v2/poster/<id>"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data = req.data.keys()[0]
data =... | stack_v2_sparse_classes_36k_train_023884 | 2,665 | no_license | [
{
"docstring": "POST /rest/v2/poster",
"name": "create",
"signature": "def create(self, req, *args, **kwargs)"
},
{
"docstring": "PUT /rest/v2/poster/<id>",
"name": "update",
"signature": "def update(self, req, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015096 | Implement the Python class `PosterViewSet` described below.
Class description:
Implement the PosterViewSet class.
Method signatures and docstrings:
- def create(self, req, *args, **kwargs): POST /rest/v2/poster
- def update(self, req, *args, **kwargs): PUT /rest/v2/poster/<id> | Implement the Python class `PosterViewSet` described below.
Class description:
Implement the PosterViewSet class.
Method signatures and docstrings:
- def create(self, req, *args, **kwargs): POST /rest/v2/poster
- def update(self, req, *args, **kwargs): PUT /rest/v2/poster/<id>
<|skeleton|>
class PosterViewSet:
... | be58dc8f1f0630d3a04e551911f66d9091bedc45 | <|skeleton|>
class PosterViewSet:
def create(self, req, *args, **kwargs):
"""POST /rest/v2/poster"""
<|body_0|>
def update(self, req, *args, **kwargs):
"""PUT /rest/v2/poster/<id>"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PosterViewSet:
def create(self, req, *args, **kwargs):
"""POST /rest/v2/poster"""
data = req.data.keys()[0]
data = simplejson.loads(data)
title = data.get('title')
category = data.get('category')
items = data.get('items')
is_active = data.get('is_active'... | the_stack_v2_python_sparse | flashsale/restpro/v2/views/poster.py | nidepuzi/ndpuzsys | train | 1 | |
536df71401a84e09bfde81ec684ace3abfcdf8b1 | [
"super().__init__()\nself.generator = generator_cls(latent_dim, n_classes, code_dim, img_size, num_channels)\nself.discriminator = discriminator_cls(code_dim, n_classes, num_channels, img_size)\nself._n_classes = n_classes\nself._latent_dim = latent_dim\nself._code_dim = code_dim\nself.lambda_cat = lambda_cat\nself... | <|body_start_0|>
super().__init__()
self.generator = generator_cls(latent_dim, n_classes, code_dim, img_size, num_channels)
self.discriminator = discriminator_cls(code_dim, n_classes, num_channels, img_size)
self._n_classes = n_classes
self._latent_dim = latent_dim
self._... | Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this network into its parts ... | InfoGAN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoGAN:
"""Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to... | stack_v2_sparse_classes_36k_train_023885 | 6,693 | permissive | [
{
"docstring": "Parameters ---------- latent_dim : int the size of the latent dimension n_classes : int the number of classes code_dim : int the size of the code dimension img_size : int the number of pixels per image side num_channels : int number of image channels lambda_cat : float weighting factor specifyin... | 2 | stack_v2_sparse_classes_30k_train_019118 | Implement the Python class `InfoGAN` described below.
Class description:
Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an alread... | Implement the Python class `InfoGAN` described below.
Class description:
Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an alread... | 1078f5030b8aac2bf022daf5fa14d66f74c3c893 | <|skeleton|>
class InfoGAN:
"""Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InfoGAN:
"""Class implementing the Information Maximization Generative Adversarial Networks. References ---------- `Paper <https://arxiv.org/abs/1606.03657>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this n... | the_stack_v2_python_sparse | dlutils/models/gans/info/info_gan.py | justusschock/dl-utils | train | 15 |
e6bb83e59a9e423d76f580473df5618233398072 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | A set of methods for async voice recognition. | AsyncRecognizerServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsyncRecognizerServicer:
"""A set of methods for async voice recognition."""
def RecognizeFile(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetRecognition(self, request, context):
"""Missing associated doc... | stack_v2_sparse_classes_36k_train_023886 | 7,372 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "RecognizeFile",
"signature": "def RecognizeFile(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetRecognition",
"signature": "def GetRecogn... | 2 | null | Implement the Python class `AsyncRecognizerServicer` described below.
Class description:
A set of methods for async voice recognition.
Method signatures and docstrings:
- def RecognizeFile(self, request, context): Missing associated documentation comment in .proto file.
- def GetRecognition(self, request, context): M... | Implement the Python class `AsyncRecognizerServicer` described below.
Class description:
A set of methods for async voice recognition.
Method signatures and docstrings:
- def RecognizeFile(self, request, context): Missing associated documentation comment in .proto file.
- def GetRecognition(self, request, context): M... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class AsyncRecognizerServicer:
"""A set of methods for async voice recognition."""
def RecognizeFile(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetRecognition(self, request, context):
"""Missing associated doc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AsyncRecognizerServicer:
"""A set of methods for async voice recognition."""
def RecognizeFile(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | yandex/cloud/ai/stt/v3/stt_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
50928e0030d2aad28bf9af8b6d18a935a2f36a23 | [
"position = 10\nmy_investment = investment.investment(position)\nself.assertEqual(my_investment.position_value, 100.0)",
"positions = [1, 10, 100, 1000]\nmy_investment = investment.investment(positions)\nle2000 = np.all(my_investment.gamble() <= 2000)\nge0 = np.all(my_investment.gamble() >= 0)\nself.assertEqual(T... | <|body_start_0|>
position = 10
my_investment = investment.investment(position)
self.assertEqual(my_investment.position_value, 100.0)
<|end_body_0|>
<|body_start_1|>
positions = [1, 10, 100, 1000]
my_investment = investment.investment(positions)
le2000 = np.all(my_investm... | Test | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test:
def investmentTest(self):
"""Tests whether investment positions and position_value are correctly associated"""
<|body_0|>
def gambleTest(self):
"""Tests whether gamble function outputs are within reasonable bounds."""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_36k_train_023887 | 845 | no_license | [
{
"docstring": "Tests whether investment positions and position_value are correctly associated",
"name": "investmentTest",
"signature": "def investmentTest(self)"
},
{
"docstring": "Tests whether gamble function outputs are within reasonable bounds.",
"name": "gambleTest",
"signature": "... | 2 | null | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- def investmentTest(self): Tests whether investment positions and position_value are correctly associated
- def gambleTest(self): Tests whether gamble function outputs are within reasonab... | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- def investmentTest(self): Tests whether investment positions and position_value are correctly associated
- def gambleTest(self): Tests whether gamble function outputs are within reasonab... | 5b904060e8bced7f91547ad7f7819773a7450a1e | <|skeleton|>
class Test:
def investmentTest(self):
"""Tests whether investment positions and position_value are correctly associated"""
<|body_0|>
def gambleTest(self):
"""Tests whether gamble function outputs are within reasonable bounds."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test:
def investmentTest(self):
"""Tests whether investment positions and position_value are correctly associated"""
position = 10
my_investment = investment.investment(position)
self.assertEqual(my_investment.position_value, 100.0)
def gambleTest(self):
"""Tests w... | the_stack_v2_python_sparse | jt2276/investment_package/investment_tests.py | ds-ga-1007/assignment8 | train | 1 | |
df2a23695b28525efe6dbfca2fb93d66802d16d9 | [
"self.lti_msg = msg\nself.lti_log = log\nreturn redirect(self.build_return_url())",
"self.lti_errormsg = errormsg\nself.lti_errorlog = errorlog\nreturn redirect(self.build_return_url())"
] | <|body_start_0|>
self.lti_msg = msg
self.lti_log = log
return redirect(self.build_return_url())
<|end_body_0|>
<|body_start_1|>
self.lti_errormsg = errormsg
self.lti_errorlog = errorlog
return redirect(self.build_return_url())
<|end_body_1|>
| OAuth ToolProvider that works with Django requests. | DjangoToolProvider | [
"MIT",
"LGPL-2.0-or-later",
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.1-only",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DjangoToolProvider:
"""OAuth ToolProvider that works with Django requests."""
def success_redirect(self, msg='', log=''):
"""Shortcut redirecting view to LTI Consumer with messages."""
<|body_0|>
def error_redirect(self, errormsg='', errorlog=''):
"""Shortcut for... | stack_v2_sparse_classes_36k_train_023888 | 5,385 | permissive | [
{
"docstring": "Shortcut redirecting view to LTI Consumer with messages.",
"name": "success_redirect",
"signature": "def success_redirect(self, msg='', log='')"
},
{
"docstring": "Shortcut for redirecting view to LTI Consumer with errors.",
"name": "error_redirect",
"signature": "def err... | 2 | null | Implement the Python class `DjangoToolProvider` described below.
Class description:
OAuth ToolProvider that works with Django requests.
Method signatures and docstrings:
- def success_redirect(self, msg='', log=''): Shortcut redirecting view to LTI Consumer with messages.
- def error_redirect(self, errormsg='', error... | Implement the Python class `DjangoToolProvider` described below.
Class description:
OAuth ToolProvider that works with Django requests.
Method signatures and docstrings:
- def success_redirect(self, msg='', log=''): Shortcut redirecting view to LTI Consumer with messages.
- def error_redirect(self, errormsg='', error... | c432745dfff932cbe7397100422d49df78f0a882 | <|skeleton|>
class DjangoToolProvider:
"""OAuth ToolProvider that works with Django requests."""
def success_redirect(self, msg='', log=''):
"""Shortcut redirecting view to LTI Consumer with messages."""
<|body_0|>
def error_redirect(self, errormsg='', errorlog=''):
"""Shortcut for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DjangoToolProvider:
"""OAuth ToolProvider that works with Django requests."""
def success_redirect(self, msg='', log=''):
"""Shortcut redirecting view to LTI Consumer with messages."""
self.lti_msg = msg
self.lti_log = log
return redirect(self.build_return_url())
def ... | the_stack_v2_python_sparse | ontask/lti/tool_provider.py | abelardopardo/ontask_b | train | 43 |
ad6d42d53bef09c03f42de185cbce3d17cf8165f | [
"self.window = window\nself.window_rect = self.window.get_rect()\nself.bomb_number = 3\nself.bomb_image = pygame.image.load('images/bomb.png')\nself.bomb_rect_list = []\nfor i in range(self.bomb_number):\n bomb_rect = self.bomb_image.get_rect()\n bomb_rect.bottom = self.window_rect.height - constants.MARGIN\n... | <|body_start_0|>
self.window = window
self.window_rect = self.window.get_rect()
self.bomb_number = 3
self.bomb_image = pygame.image.load('images/bomb.png')
self.bomb_rect_list = []
for i in range(self.bomb_number):
bomb_rect = self.bomb_image.get_rect()
... | 可视化炸弹组 | VisualBombGroup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VisualBombGroup:
"""可视化炸弹组"""
def __init__(self, window):
"""初始化可视化炸弹组"""
<|body_0|>
def play_explode_sound(self):
"""播放炸弹爆炸的声音"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.window = window
self.window_rect = self.window.get_rect(... | stack_v2_sparse_classes_36k_train_023889 | 1,643 | no_license | [
{
"docstring": "初始化可视化炸弹组",
"name": "__init__",
"signature": "def __init__(self, window)"
},
{
"docstring": "播放炸弹爆炸的声音",
"name": "play_explode_sound",
"signature": "def play_explode_sound(self)"
}
] | 2 | null | Implement the Python class `VisualBombGroup` described below.
Class description:
可视化炸弹组
Method signatures and docstrings:
- def __init__(self, window): 初始化可视化炸弹组
- def play_explode_sound(self): 播放炸弹爆炸的声音 | Implement the Python class `VisualBombGroup` described below.
Class description:
可视化炸弹组
Method signatures and docstrings:
- def __init__(self, window): 初始化可视化炸弹组
- def play_explode_sound(self): 播放炸弹爆炸的声音
<|skeleton|>
class VisualBombGroup:
"""可视化炸弹组"""
def __init__(self, window):
"""初始化可视化炸弹组"""
... | 66f7f801e1395207778484e1543ea26309d4b354 | <|skeleton|>
class VisualBombGroup:
"""可视化炸弹组"""
def __init__(self, window):
"""初始化可视化炸弹组"""
<|body_0|>
def play_explode_sound(self):
"""播放炸弹爆炸的声音"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VisualBombGroup:
"""可视化炸弹组"""
def __init__(self, window):
"""初始化可视化炸弹组"""
self.window = window
self.window_rect = self.window.get_rect()
self.bomb_number = 3
self.bomb_image = pygame.image.load('images/bomb.png')
self.bomb_rect_list = []
for i in ra... | the_stack_v2_python_sparse | python/practise/PlaneWar/visual_bomb_group.py | anzhihe/learning | train | 1,443 |
52997b71e2d928cd315df8a64ee48a08cd332729 | [
"n = len(A)\nif n < 3:\n return 0\nd = [A[i] - A[i - 1] for i in range(1, n)]\ni = 0\nj = 0\ncnts = []\nm = n - 1\nwhile i <= j and j < m:\n while j < m and d[j] == d[i]:\n j += 1\n if j == m:\n cnt = m - 1 - i + 2\n if cnt >= 3:\n cnts.append(cnt)\n break\n cnt = ... | <|body_start_0|>
n = len(A)
if n < 3:
return 0
d = [A[i] - A[i - 1] for i in range(1, n)]
i = 0
j = 0
cnts = []
m = n - 1
while i <= j and j < m:
while j < m and d[j] == d[i]:
j += 1
if j == m:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numberOfArithmeticSlices(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def nas(self, n):
"""return number of arithmetic sequence for [1,2,...,n]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(A)
if n < 3:
... | stack_v2_sparse_classes_36k_train_023890 | 2,973 | no_license | [
{
"docstring": ":type A: List[int] :rtype: int",
"name": "numberOfArithmeticSlices",
"signature": "def numberOfArithmeticSlices(self, A)"
},
{
"docstring": "return number of arithmetic sequence for [1,2,...,n]",
"name": "nas",
"signature": "def nas(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012437 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfArithmeticSlices(self, A): :type A: List[int] :rtype: int
- def nas(self, n): return number of arithmetic sequence for [1,2,...,n] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfArithmeticSlices(self, A): :type A: List[int] :rtype: int
- def nas(self, n): return number of arithmetic sequence for [1,2,...,n]
<|skeleton|>
class Solution:
... | e00cf94c5b86c8cca27e3bee69ad21e727b7679b | <|skeleton|>
class Solution:
def numberOfArithmeticSlices(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def nas(self, n):
"""return number of arithmetic sequence for [1,2,...,n]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numberOfArithmeticSlices(self, A):
""":type A: List[int] :rtype: int"""
n = len(A)
if n < 3:
return 0
d = [A[i] - A[i - 1] for i in range(1, n)]
i = 0
j = 0
cnts = []
m = n - 1
while i <= j and j < m:
... | the_stack_v2_python_sparse | dp/prob413.py | binchen15/leet-python | train | 1 | |
82a5222ed5ca6cfb6f44614fb395b9dd66302e42 | [
"event_times_template = np.array([1.0], dtype=np.float64)\nmode_sequence_template = np.array([0], dtype=np.uintp)\nreturn helper.get_event_times_and_mode_sequence(0, duration, event_times_template, mode_sequence_template)",
"max_linear_velocity_x = 0.5\nmax_linear_velocity_y = 0.5\nmax_euler_angle_derivative_z = ... | <|body_start_0|>
event_times_template = np.array([1.0], dtype=np.float64)
mode_sequence_template = np.array([0], dtype=np.uintp)
return helper.get_event_times_and_mode_sequence(0, duration, event_times_template, mode_sequence_template)
<|end_body_0|>
<|body_start_1|>
max_linear_velocity... | Ballbot MPC-Net. Adds robot-specific methods for the MPC-Net training. | BallbotMpcnet | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BallbotMpcnet:
"""Ballbot MPC-Net. Adds robot-specific methods for the MPC-Net training."""
def get_default_event_times_and_mode_sequence(duration: float) -> Tuple[np.ndarray, np.ndarray]:
"""Get the event times and mode sequence describing the default mode schedule. Creates the defa... | stack_v2_sparse_classes_36k_train_023891 | 6,804 | permissive | [
{
"docstring": "Get the event times and mode sequence describing the default mode schedule. Creates the default event times and mode sequence for a certain time duration. Args: duration: The duration of the mode schedule given by a float. Returns: A tuple containing the components of the mode schedule. - event_... | 4 | stack_v2_sparse_classes_30k_train_020078 | Implement the Python class `BallbotMpcnet` described below.
Class description:
Ballbot MPC-Net. Adds robot-specific methods for the MPC-Net training.
Method signatures and docstrings:
- def get_default_event_times_and_mode_sequence(duration: float) -> Tuple[np.ndarray, np.ndarray]: Get the event times and mode sequen... | Implement the Python class `BallbotMpcnet` described below.
Class description:
Ballbot MPC-Net. Adds robot-specific methods for the MPC-Net training.
Method signatures and docstrings:
- def get_default_event_times_and_mode_sequence(duration: float) -> Tuple[np.ndarray, np.ndarray]: Get the event times and mode sequen... | ebde452b10d0eceaac45364f7bb8f0ac1038b637 | <|skeleton|>
class BallbotMpcnet:
"""Ballbot MPC-Net. Adds robot-specific methods for the MPC-Net training."""
def get_default_event_times_and_mode_sequence(duration: float) -> Tuple[np.ndarray, np.ndarray]:
"""Get the event times and mode sequence describing the default mode schedule. Creates the defa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BallbotMpcnet:
"""Ballbot MPC-Net. Adds robot-specific methods for the MPC-Net training."""
def get_default_event_times_and_mode_sequence(duration: float) -> Tuple[np.ndarray, np.ndarray]:
"""Get the event times and mode sequence describing the default mode schedule. Creates the default event tim... | the_stack_v2_python_sparse | ocs2_mpcnet/ocs2_ballbot_mpcnet/python/ocs2_ballbot_mpcnet/mpcnet.py | scmwang/ocs2 | train | 0 |
2ea96482745dcc4cfd6c3417777055c6044370f7 | [
"self.host = host\nself.port = port\nself.verbose = verbose\nself.opts = opts\nself.flags = flags\nself.connect()",
"context = zmq.Context()\npuller = context.socket(zmq.PULL)\nfor opt in self.opts:\n puller.setsockopt(opt, 1)\nprint('Puller: tcp://{0}:{1}'.format(self.host, self.port))\npuller.bind('tcp://{0}... | <|body_start_0|>
self.host = host
self.port = port
self.verbose = verbose
self.opts = opts
self.flags = flags
self.connect()
<|end_body_0|>
<|body_start_1|>
context = zmq.Context()
puller = context.socket(zmq.PULL)
for opt in self.opts:
... | ZMQPullBind | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZMQPullBind:
def __init__(self, host, port, opts=[], flags=0, verbose=False):
"""create a Default ZMQ Pull socket"""
<|body_0|>
def connect(self):
"""open ZMQ pull socket return receiver object"""
<|body_1|>
def receive(self):
"""receive and retu... | stack_v2_sparse_classes_36k_train_023892 | 12,974 | no_license | [
{
"docstring": "create a Default ZMQ Pull socket",
"name": "__init__",
"signature": "def __init__(self, host, port, opts=[], flags=0, verbose=False)"
},
{
"docstring": "open ZMQ pull socket return receiver object",
"name": "connect",
"signature": "def connect(self)"
},
{
"docstri... | 4 | null | Implement the Python class `ZMQPullBind` described below.
Class description:
Implement the ZMQPullBind class.
Method signatures and docstrings:
- def __init__(self, host, port, opts=[], flags=0, verbose=False): create a Default ZMQ Pull socket
- def connect(self): open ZMQ pull socket return receiver object
- def rec... | Implement the Python class `ZMQPullBind` described below.
Class description:
Implement the ZMQPullBind class.
Method signatures and docstrings:
- def __init__(self, host, port, opts=[], flags=0, verbose=False): create a Default ZMQ Pull socket
- def connect(self): open ZMQ pull socket return receiver object
- def rec... | 55041e6947b888242ff01cb18bd5f1ee4c4c8f28 | <|skeleton|>
class ZMQPullBind:
def __init__(self, host, port, opts=[], flags=0, verbose=False):
"""create a Default ZMQ Pull socket"""
<|body_0|>
def connect(self):
"""open ZMQ pull socket return receiver object"""
<|body_1|>
def receive(self):
"""receive and retu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZMQPullBind:
def __init__(self, host, port, opts=[], flags=0, verbose=False):
"""create a Default ZMQ Pull socket"""
self.host = host
self.port = port
self.verbose = verbose
self.opts = opts
self.flags = flags
self.connect()
def connect(self):
... | the_stack_v2_python_sparse | NPC/gui/ZmqSockets.py | coquellen/NanoPeakCell | train | 6 | |
d8c9423f4772bdfc90b9b520be5caabc707a90ca | [
"\"\"\"获取repo信息 这里的owner就是gitlab中的namespace\"\"\"\nAsyncApiHelper.setRepo(owner, repo)\nAsyncApiHelper.setRepoId(repo_id)\nt1 = datetime.now()\nstatistic = statisticsHelper()\nstatistic.startTime = t1\n'异步多协程爬虫爬取pull-request信息'\nloop = asyncio.get_event_loop()\ntask = [asyncio.ensure_future(AsyncProjectAllDataFetc... | <|body_start_0|>
"""获取repo信息 这里的owner就是gitlab中的namespace"""
AsyncApiHelper.setRepo(owner, repo)
AsyncApiHelper.setRepoId(repo_id)
t1 = datetime.now()
statistic = statisticsHelper()
statistic.startTime = t1
'异步多协程爬虫爬取pull-request信息'
loop = asyncio.get_even... | AsyncProjectAllDataFetcher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsyncProjectAllDataFetcher:
def getDataForRepository(repo_id, owner, repo, limit, start):
"""指定目标owner/repo 获取start到 start - limit编号的pull-request相关评审信息"""
<|body_0|>
async def preProcess(loop, limit, start, statistic):
"""准备工作"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_023893 | 2,411 | no_license | [
{
"docstring": "指定目标owner/repo 获取start到 start - limit编号的pull-request相关评审信息",
"name": "getDataForRepository",
"signature": "def getDataForRepository(repo_id, owner, repo, limit, start)"
},
{
"docstring": "准备工作",
"name": "preProcess",
"signature": "async def preProcess(loop, limit, start, ... | 2 | stack_v2_sparse_classes_30k_train_010791 | Implement the Python class `AsyncProjectAllDataFetcher` described below.
Class description:
Implement the AsyncProjectAllDataFetcher class.
Method signatures and docstrings:
- def getDataForRepository(repo_id, owner, repo, limit, start): 指定目标owner/repo 获取start到 start - limit编号的pull-request相关评审信息
- async def preProces... | Implement the Python class `AsyncProjectAllDataFetcher` described below.
Class description:
Implement the AsyncProjectAllDataFetcher class.
Method signatures and docstrings:
- def getDataForRepository(repo_id, owner, repo, limit, start): 指定目标owner/repo 获取start到 start - limit编号的pull-request相关评审信息
- async def preProces... | 36a29804294344f75db115ac38da2fdab0d6fa4b | <|skeleton|>
class AsyncProjectAllDataFetcher:
def getDataForRepository(repo_id, owner, repo, limit, start):
"""指定目标owner/repo 获取start到 start - limit编号的pull-request相关评审信息"""
<|body_0|>
async def preProcess(loop, limit, start, statistic):
"""准备工作"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AsyncProjectAllDataFetcher:
def getDataForRepository(repo_id, owner, repo, limit, start):
"""指定目标owner/repo 获取start到 start - limit编号的pull-request相关评审信息"""
"""获取repo信息 这里的owner就是gitlab中的namespace"""
AsyncApiHelper.setRepo(owner, repo)
AsyncApiHelper.setRepoId(repo_id)
t... | the_stack_v2_python_sparse | source/data/service/AsyncProjectAllDataFetcher.py | soilerl/HuaweiProject | train | 0 | |
d661a27d6086beaca12f726338b2af02292fac66 | [
"if not session_id:\n raise RedisKeyError('construct session_key required session_id')\nsession_key = self.key[session_id]\nif isinstance(session_key, bytes):\n session_key = session_key.decode('utf8')\nself.db.api.set(session_key, session_data)\nself.db.api.expire(session_key, timeout)",
"if not session_id... | <|body_start_0|>
if not session_id:
raise RedisKeyError('construct session_key required session_id')
session_key = self.key[session_id]
if isinstance(session_key, bytes):
session_key = session_key.decode('utf8')
self.db.api.set(session_key, session_data)
s... | session信息 | SessionModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionModel:
"""session信息"""
def set(self, session_id, session_data, timeout):
"""设置session信息"""
<|body_0|>
def get(self, session_id):
"""获取session信息"""
<|body_1|>
def delete(self, session_id):
"""删除session信息"""
<|body_2|>
<|end_ske... | stack_v2_sparse_classes_36k_train_023894 | 1,691 | permissive | [
{
"docstring": "设置session信息",
"name": "set",
"signature": "def set(self, session_id, session_data, timeout)"
},
{
"docstring": "获取session信息",
"name": "get",
"signature": "def get(self, session_id)"
},
{
"docstring": "删除session信息",
"name": "delete",
"signature": "def delet... | 3 | stack_v2_sparse_classes_30k_train_008641 | Implement the Python class `SessionModel` described below.
Class description:
session信息
Method signatures and docstrings:
- def set(self, session_id, session_data, timeout): 设置session信息
- def get(self, session_id): 获取session信息
- def delete(self, session_id): 删除session信息 | Implement the Python class `SessionModel` described below.
Class description:
session信息
Method signatures and docstrings:
- def set(self, session_id, session_data, timeout): 设置session信息
- def get(self, session_id): 获取session信息
- def delete(self, session_id): 删除session信息
<|skeleton|>
class SessionModel:
"""sessio... | 9999d70429d9f773501f9a11910997343ff2df93 | <|skeleton|>
class SessionModel:
"""session信息"""
def set(self, session_id, session_data, timeout):
"""设置session信息"""
<|body_0|>
def get(self, session_id):
"""获取session信息"""
<|body_1|>
def delete(self, session_id):
"""删除session信息"""
<|body_2|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SessionModel:
"""session信息"""
def set(self, session_id, session_data, timeout):
"""设置session信息"""
if not session_id:
raise RedisKeyError('construct session_key required session_id')
session_key = self.key[session_id]
if isinstance(session_key, bytes):
... | the_stack_v2_python_sparse | api/model/redis/session.py | bopopescu/smp | train | 0 |
77e5a76db2ae23811be058a7db3f2900aa38b920 | [
"flag = None\nif isinstance(str_one, str):\n str_one = str_one.encode('unicode-escape').decode('string_escape')\n return operator(str_one, str_two)\nif str_one in str_two:\n flag = True\nelse:\n flag = False\nreturn flag",
"if isinstance(dict_one, str):\n dict_one = json.loads(dict_one)\n print(... | <|body_start_0|>
flag = None
if isinstance(str_one, str):
str_one = str_one.encode('unicode-escape').decode('string_escape')
return operator(str_one, str_two)
if str_one in str_two:
flag = True
else:
flag = False
return flag
<|end_b... | CommonUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonUtil:
def is_contain(self, str_one, str_two):
"""判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串"""
<|body_0|>
def is_equal_dict(self, dict_one, dict_two):
"""判断两个字典是否相等"""
<|body_1|>
def is_json(self, data):
"""判断是否json格式"""
<|bo... | stack_v2_sparse_classes_36k_train_023895 | 1,480 | no_license | [
{
"docstring": "判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串",
"name": "is_contain",
"signature": "def is_contain(self, str_one, str_two)"
},
{
"docstring": "判断两个字典是否相等",
"name": "is_equal_dict",
"signature": "def is_equal_dict(self, dict_one, dict_two)"
},
{
"docstring": "判... | 3 | stack_v2_sparse_classes_30k_train_002458 | Implement the Python class `CommonUtil` described below.
Class description:
Implement the CommonUtil class.
Method signatures and docstrings:
- def is_contain(self, str_one, str_two): 判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串
- def is_equal_dict(self, dict_one, dict_two): 判断两个字典是否相等
- def is_json(self, data):... | Implement the Python class `CommonUtil` described below.
Class description:
Implement the CommonUtil class.
Method signatures and docstrings:
- def is_contain(self, str_one, str_two): 判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串
- def is_equal_dict(self, dict_one, dict_two): 判断两个字典是否相等
- def is_json(self, data):... | 7e84a4a93d7e7774b7f5bcc71beeba4fb4a5334b | <|skeleton|>
class CommonUtil:
def is_contain(self, str_one, str_two):
"""判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串"""
<|body_0|>
def is_equal_dict(self, dict_one, dict_two):
"""判断两个字典是否相等"""
<|body_1|>
def is_json(self, data):
"""判断是否json格式"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommonUtil:
def is_contain(self, str_one, str_two):
"""判断一个字符串是否再另外一个字符串中 str_one:查找的字符串 str_two:被查找的字符串"""
flag = None
if isinstance(str_one, str):
str_one = str_one.encode('unicode-escape').decode('string_escape')
return operator(str_one, str_two)
if s... | the_stack_v2_python_sparse | util/common_util.py | yuzj1113/APIAutoTestForUp360 | train | 5 | |
b1fc0e9b12bdeb9f6d449d533596fd9731daadc6 | [
"if not s:\n return 0\n\ndef is_pal_str(x):\n return x == x[::-1]\nn = len(s)\ndp = [0] * n\ndp[0] = 1\nfor i in range(1, n):\n for j in range(i, -1, -1):\n if is_pal_str(s[j:i + 1]):\n dp[i] += 1\nreturn sum(dp)",
"n = len(s)\ndp = [[0] * n for _ in range(n)]\nfor i in range(n):\n d... | <|body_start_0|>
if not s:
return 0
def is_pal_str(x):
return x == x[::-1]
n = len(s)
dp = [0] * n
dp[0] = 1
for i in range(1, n):
for j in range(i, -1, -1):
if is_pal_str(s[j:i + 1]):
dp[i] += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countSubstrings(self, s):
"""dp[i]:以i结尾新增加的回文子串 时间复杂度n^2,空间复杂度n :type s: str :rtype: int"""
<|body_0|>
def countSubstrings2(self, s):
"""方法二 dp[i][j]表示s[i~j]是否是回文串 自定向下dp递推表达式: dp[i][j] = s[i] == s[j] if i ==j+1; dp[i][j] = dp[i+1][j-1] && s[i]==[j] :pa... | stack_v2_sparse_classes_36k_train_023896 | 2,443 | no_license | [
{
"docstring": "dp[i]:以i结尾新增加的回文子串 时间复杂度n^2,空间复杂度n :type s: str :rtype: int",
"name": "countSubstrings",
"signature": "def countSubstrings(self, s)"
},
{
"docstring": "方法二 dp[i][j]表示s[i~j]是否是回文串 自定向下dp递推表达式: dp[i][j] = s[i] == s[j] if i ==j+1; dp[i][j] = dp[i+1][j-1] && s[i]==[j] :param s: :retu... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countSubstrings(self, s): dp[i]:以i结尾新增加的回文子串 时间复杂度n^2,空间复杂度n :type s: str :rtype: int
- def countSubstrings2(self, s): 方法二 dp[i][j]表示s[i~j]是否是回文串 自定向下dp递推表达式: dp[i][j] = s[i]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countSubstrings(self, s): dp[i]:以i结尾新增加的回文子串 时间复杂度n^2,空间复杂度n :type s: str :rtype: int
- def countSubstrings2(self, s): 方法二 dp[i][j]表示s[i~j]是否是回文串 自定向下dp递推表达式: dp[i][j] = s[i]... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def countSubstrings(self, s):
"""dp[i]:以i结尾新增加的回文子串 时间复杂度n^2,空间复杂度n :type s: str :rtype: int"""
<|body_0|>
def countSubstrings2(self, s):
"""方法二 dp[i][j]表示s[i~j]是否是回文串 自定向下dp递推表达式: dp[i][j] = s[i] == s[j] if i ==j+1; dp[i][j] = dp[i+1][j-1] && s[i]==[j] :pa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def countSubstrings(self, s):
"""dp[i]:以i结尾新增加的回文子串 时间复杂度n^2,空间复杂度n :type s: str :rtype: int"""
if not s:
return 0
def is_pal_str(x):
return x == x[::-1]
n = len(s)
dp = [0] * n
dp[0] = 1
for i in range(1, n):
... | the_stack_v2_python_sparse | 647_回文子串.py | lovehhf/LeetCode | train | 0 | |
2c1ce9b33fc0b7ac96c0e683692982322e64f2ae | [
"try:\n q = quantity.Concentration(1.0, 'm^-3')\n self.fail('Allowed invalid unit type \"m^-3\".')\nexcept quantity.QuantityError:\n pass",
"q = quantity.Concentration(1.0, 'mol/m^3')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)\nself.assertEqual(q.units,... | <|body_start_0|>
try:
q = quantity.Concentration(1.0, 'm^-3')
self.fail('Allowed invalid unit type "m^-3".')
except quantity.QuantityError:
pass
<|end_body_0|>
<|body_start_1|>
q = quantity.Concentration(1.0, 'mol/m^3')
self.assertAlmostEqual(q.value,... | Contains unit tests of the Concentration unit type object. | TestConcentration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestConcentration:
"""Contains unit tests of the Concentration unit type object."""
def test_perm3(self):
"""Test the creation of an concentration quantity with units of m^-3."""
<|body_0|>
def test_molperm3(self):
"""Test the creation of an concentration quantit... | stack_v2_sparse_classes_36k_train_023897 | 33,010 | permissive | [
{
"docstring": "Test the creation of an concentration quantity with units of m^-3.",
"name": "test_perm3",
"signature": "def test_perm3(self)"
},
{
"docstring": "Test the creation of an concentration quantity with units of mol/m^3.",
"name": "test_molperm3",
"signature": "def test_molper... | 3 | stack_v2_sparse_classes_30k_train_001572 | Implement the Python class `TestConcentration` described below.
Class description:
Contains unit tests of the Concentration unit type object.
Method signatures and docstrings:
- def test_perm3(self): Test the creation of an concentration quantity with units of m^-3.
- def test_molperm3(self): Test the creation of an ... | Implement the Python class `TestConcentration` described below.
Class description:
Contains unit tests of the Concentration unit type object.
Method signatures and docstrings:
- def test_perm3(self): Test the creation of an concentration quantity with units of m^-3.
- def test_molperm3(self): Test the creation of an ... | 0937b2e0a955dcf21b79674a4e89f43941c0dd85 | <|skeleton|>
class TestConcentration:
"""Contains unit tests of the Concentration unit type object."""
def test_perm3(self):
"""Test the creation of an concentration quantity with units of m^-3."""
<|body_0|>
def test_molperm3(self):
"""Test the creation of an concentration quantit... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestConcentration:
"""Contains unit tests of the Concentration unit type object."""
def test_perm3(self):
"""Test the creation of an concentration quantity with units of m^-3."""
try:
q = quantity.Concentration(1.0, 'm^-3')
self.fail('Allowed invalid unit type "m^-... | the_stack_v2_python_sparse | rmgpy/quantityTest.py | vrlambert/RMG-Py | train | 1 |
51c894d1a4c736e8046b8097e8fda978168833eb | [
"if label is None:\n label = title\nif info is None:\n info = title\nif c is None:\n c = current.request.controller\nif label is None:\n if t is None:\n t = '%s_%s' % (c, f)\n if m == 'create':\n label = get_crud_string(t, 'label_create')\n elif m == 'update':\n label = get_cr... | <|body_start_0|>
if label is None:
label = title
if info is None:
info = title
if c is None:
c = current.request.controller
if label is None:
if t is None:
t = '%s_%s' % (c, f)
if m == 'create':
l... | Links in form fields comments to show a form for adding a new foreign key record. | S3PopupLink | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S3PopupLink:
"""Links in form fields comments to show a form for adding a new foreign key record."""
def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None):
"""Constructor @param c: the target controller @param f:... | stack_v2_sparse_classes_36k_train_023898 | 26,788 | permissive | [
{
"docstring": "Constructor @param c: the target controller @param f: the target function @param t: the target table (defaults to c_f) @param m: the URL method (will be appended to args) @param args: the argument list @param vars: the request vars (format=\"popup\" will be added automatically) @param label: the... | 3 | stack_v2_sparse_classes_30k_train_003630 | Implement the Python class `S3PopupLink` described below.
Class description:
Links in form fields comments to show a form for adding a new foreign key record.
Method signatures and docstrings:
- def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=Non... | Implement the Python class `S3PopupLink` described below.
Class description:
Links in form fields comments to show a form for adding a new foreign key record.
Method signatures and docstrings:
- def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=Non... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class S3PopupLink:
"""Links in form fields comments to show a form for adding a new foreign key record."""
def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None):
"""Constructor @param c: the target controller @param f:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class S3PopupLink:
"""Links in form fields comments to show a form for adding a new foreign key record."""
def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None):
"""Constructor @param c: the target controller @param f: the target f... | the_stack_v2_python_sparse | modules/s3layouts.py | nursix/drkcm | train | 3 |
fd46c06e63c9ee482189c3c1a51951da9e6ce8aa | [
"tests_by_testcase = {}\nfor tests in (self.successes, self.failures, self.errors, self.skipped):\n for test_info in tests:\n testcase = type(test_info.test_method)\n module = testcase.__module__ + '.'\n if module == '__main__.':\n module = ''\n testcase_name = module + tes... | <|body_start_0|>
tests_by_testcase = {}
for tests in (self.successes, self.failures, self.errors, self.skipped):
for test_info in tests:
testcase = type(test_info.test_method)
module = testcase.__module__ + '.'
if module == '__main__.':
... | A test result class that can express test results in a XML report. | _XMLTestResult | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _XMLTestResult:
"""A test result class that can express test results in a XML report."""
def _get_info_by_testcase(self):
"""This method organizes test results by TestCase module. This information is used during the report generation, where a XML report will be generated for each Tes... | stack_v2_sparse_classes_36k_train_023899 | 7,409 | permissive | [
{
"docstring": "This method organizes test results by TestCase module. This information is used during the report generation, where a XML report will be generated for each TestCase.",
"name": "_get_info_by_testcase",
"signature": "def _get_info_by_testcase(self)"
},
{
"docstring": "Appends the t... | 5 | stack_v2_sparse_classes_30k_train_001411 | Implement the Python class `_XMLTestResult` described below.
Class description:
A test result class that can express test results in a XML report.
Method signatures and docstrings:
- def _get_info_by_testcase(self): This method organizes test results by TestCase module. This information is used during the report gene... | Implement the Python class `_XMLTestResult` described below.
Class description:
A test result class that can express test results in a XML report.
Method signatures and docstrings:
- def _get_info_by_testcase(self): This method organizes test results by TestCase module. This information is used during the report gene... | 8dc5e2bc740cc519dcb82a20b52d8af030e92517 | <|skeleton|>
class _XMLTestResult:
"""A test result class that can express test results in a XML report."""
def _get_info_by_testcase(self):
"""This method organizes test results by TestCase module. This information is used during the report generation, where a XML report will be generated for each Tes... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _XMLTestResult:
"""A test result class that can express test results in a XML report."""
def _get_info_by_testcase(self):
"""This method organizes test results by TestCase module. This information is used during the report generation, where a XML report will be generated for each TestCase."""
... | the_stack_v2_python_sparse | mule/runners/xml.py | sabertooth304/mule | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.