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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b4e24d6440b2c99c0d6c73619dd7000195279b6 | [
"self.graph = graph\nself.nodes_heap = self.create_nodes_heap(graph)\nself.src = self.nodes_heap[self.nodes_heap.index(src)]\nself.dest = self.nodes_heap[self.nodes_heap.index(dest)]\nself.src.distance = 0\nheapify(self.nodes_heap)",
"min_heap = []\nfor label, node in self.graph.nodes.items():\n node_container... | <|body_start_0|>
self.graph = graph
self.nodes_heap = self.create_nodes_heap(graph)
self.src = self.nodes_heap[self.nodes_heap.index(src)]
self.dest = self.nodes_heap[self.nodes_heap.index(dest)]
self.src.distance = 0
heapify(self.nodes_heap)
<|end_body_0|>
<|body_start_... | DijkstrasAlgorithm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DijkstrasAlgorithm:
def __init__(self, graph, src, dest):
"""Input: graph (AdjacencyMatrix) = AdjacencyMatrix to find shortest path/distance src (int): Source node to start search from dest (int): Destination node to end search at Output: DijkstrasAlgorithm"""
<|body_0|>
def... | stack_v2_sparse_classes_36k_train_005000 | 5,273 | no_license | [
{
"docstring": "Input: graph (AdjacencyMatrix) = AdjacencyMatrix to find shortest path/distance src (int): Source node to start search from dest (int): Destination node to end search at Output: DijkstrasAlgorithm",
"name": "__init__",
"signature": "def __init__(self, graph, src, dest)"
},
{
"doc... | 5 | stack_v2_sparse_classes_30k_train_013306 | Implement the Python class `DijkstrasAlgorithm` described below.
Class description:
Implement the DijkstrasAlgorithm class.
Method signatures and docstrings:
- def __init__(self, graph, src, dest): Input: graph (AdjacencyMatrix) = AdjacencyMatrix to find shortest path/distance src (int): Source node to start search f... | Implement the Python class `DijkstrasAlgorithm` described below.
Class description:
Implement the DijkstrasAlgorithm class.
Method signatures and docstrings:
- def __init__(self, graph, src, dest): Input: graph (AdjacencyMatrix) = AdjacencyMatrix to find shortest path/distance src (int): Source node to start search f... | 933e5db88fc0a19eeb8f78b0e7857cb3ab6a1048 | <|skeleton|>
class DijkstrasAlgorithm:
def __init__(self, graph, src, dest):
"""Input: graph (AdjacencyMatrix) = AdjacencyMatrix to find shortest path/distance src (int): Source node to start search from dest (int): Destination node to end search at Output: DijkstrasAlgorithm"""
<|body_0|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DijkstrasAlgorithm:
def __init__(self, graph, src, dest):
"""Input: graph (AdjacencyMatrix) = AdjacencyMatrix to find shortest path/distance src (int): Source node to start search from dest (int): Destination node to end search at Output: DijkstrasAlgorithm"""
self.graph = graph
self.n... | the_stack_v2_python_sparse | algorithms/search/dijkstras_algorithm/dijkstras_algorithm.py | scottberke/algorithms | train | 0 | |
850b8b538a5726fce250ed268ee87b763c69599b | [
"tags = ['tag1', 'tag2']\nfeed_url_to_config = {'https://ipstack.com': {'fieldnames': ['value'], 'indicator_type': 'IP'}}\nwith open('test_data/ip_ranges.txt') as ip_ranges_txt:\n ip_ranges = ip_ranges_txt.read().encode('utf8')\nwith requests_mock.Mocker() as m:\n itype = 'IP'\n args = {'indicator_type': i... | <|body_start_0|>
tags = ['tag1', 'tag2']
feed_url_to_config = {'https://ipstack.com': {'fieldnames': ['value'], 'indicator_type': 'IP'}}
with open('test_data/ip_ranges.txt') as ip_ranges_txt:
ip_ranges = ip_ranges_txt.read().encode('utf8')
with requests_mock.Mocker() as m:
... | TestTagsParam | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestTagsParam:
def test_tags_exists(self):
"""Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags"""
<|body_0|>
def test_tags_not_exists(self):
"""Given: - No tags param When: - Runn... | stack_v2_sparse_classes_36k_train_005001 | 16,849 | permissive | [
{
"docstring": "Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags",
"name": "test_tags_exists",
"signature": "def test_tags_exists(self)"
},
{
"docstring": "Given: - No tags param When: - Running get indicator... | 2 | stack_v2_sparse_classes_30k_train_000007 | Implement the Python class `TestTagsParam` described below.
Class description:
Implement the TestTagsParam class.
Method signatures and docstrings:
- def test_tags_exists(self): Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags
- d... | Implement the Python class `TestTagsParam` described below.
Class description:
Implement the TestTagsParam class.
Method signatures and docstrings:
- def test_tags_exists(self): Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags
- d... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestTagsParam:
def test_tags_exists(self):
"""Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags"""
<|body_0|>
def test_tags_not_exists(self):
"""Given: - No tags param When: - Runn... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestTagsParam:
def test_tags_exists(self):
"""Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags"""
tags = ['tag1', 'tag2']
feed_url_to_config = {'https://ipstack.com': {'fieldnames': ['value'], 'indi... | the_stack_v2_python_sparse | Packs/ApiModules/Scripts/CSVFeedApiModule/CSVFeedApiModule_test.py | demisto/content | train | 1,023 | |
468ef08dbe770ad1249cdf7c90a660d371313340 | [
"if not nums:\n return [nums]\nsub = self.subsets(nums[1:])\nreturn sub + [[nums[0]] + x for x in sub]",
"output = [[]]\nfor n in nums:\n output += [[n] + sub for sub in output]\nreturn output"
] | <|body_start_0|>
if not nums:
return [nums]
sub = self.subsets(nums[1:])
return sub + [[nums[0]] + x for x in sub]
<|end_body_0|>
<|body_start_1|>
output = [[]]
for n in nums:
output += [[n] + sub for sub in output]
return output
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subsets(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def subsets_sequential(sefl, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
... | stack_v2_sparse_classes_36k_train_005002 | 1,270 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "subsets",
"signature": "def subsets(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "subsets_sequential",
"signature": "def subsets_sequential(sefl, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def subsets_sequential(sefl, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def subsets_sequential(sefl, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class Sol... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def subsets(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def subsets_sequential(sefl, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def subsets(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
if not nums:
return [nums]
sub = self.subsets(nums[1:])
return sub + [[nums[0]] + x for x in sub]
def subsets_sequential(sefl, nums):
""":type nums: List[int] :rtype:... | the_stack_v2_python_sparse | src/lt_78.py | oxhead/CodingYourWay | train | 0 | |
c82234b343658c7d8bf70cd96f01797368480f6f | [
"if not root:\n return []\nres = []\nres += self.postorderTravel(root.left)\nres += self.postorderTravel(root.right)\nres.append(root.val)\nreturn res",
"res, stack = ([], [])\nwhile root is not None or stack:\n while root:\n stack.append(root)\n root = root.left if root.left else root.right\n... | <|body_start_0|>
if not root:
return []
res = []
res += self.postorderTravel(root.left)
res += self.postorderTravel(root.right)
res.append(root.val)
return res
<|end_body_0|>
<|body_start_1|>
res, stack = ([], [])
while root is not None or sta... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def postorderTravel(self, root: TreeNode) -> list[int]:
"""递归解法"""
<|body_0|>
def postorderTravel2(self, root: TreeNode) -> list[int]:
"""迭代解法"""
<|body_1|>
def postorderTravel3(self, root: TreeNode) -> list[int]:
"""利用自带的queue模块来解决问题""... | stack_v2_sparse_classes_36k_train_005003 | 1,370 | no_license | [
{
"docstring": "递归解法",
"name": "postorderTravel",
"signature": "def postorderTravel(self, root: TreeNode) -> list[int]"
},
{
"docstring": "迭代解法",
"name": "postorderTravel2",
"signature": "def postorderTravel2(self, root: TreeNode) -> list[int]"
},
{
"docstring": "利用自带的queue模块来解决问... | 3 | stack_v2_sparse_classes_30k_train_008495 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTravel(self, root: TreeNode) -> list[int]: 递归解法
- def postorderTravel2(self, root: TreeNode) -> list[int]: 迭代解法
- def postorderTravel3(self, root: TreeNode) -> list[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTravel(self, root: TreeNode) -> list[int]: 递归解法
- def postorderTravel2(self, root: TreeNode) -> list[int]: 迭代解法
- def postorderTravel3(self, root: TreeNode) -> list[... | bb02714b312d5a8368d7e4f4c35bb66eaaff36b9 | <|skeleton|>
class Solution:
def postorderTravel(self, root: TreeNode) -> list[int]:
"""递归解法"""
<|body_0|>
def postorderTravel2(self, root: TreeNode) -> list[int]:
"""迭代解法"""
<|body_1|>
def postorderTravel3(self, root: TreeNode) -> list[int]:
"""利用自带的queue模块来解决问题""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def postorderTravel(self, root: TreeNode) -> list[int]:
"""递归解法"""
if not root:
return []
res = []
res += self.postorderTravel(root.left)
res += self.postorderTravel(root.right)
res.append(root.val)
return res
def postorderTrav... | the_stack_v2_python_sparse | 数据结构/树/0012postorderTravel.py | AndongWen/leetcode | train | 0 | |
d4f89c0e3a6b0652f84b552b2e65580d71f5af8f | [
"self.request_id = request_id\nself.audit_id = audit_id\nself.signers_valid = signers_valid\nself.seal = seal\nself.signers = signers\nself.summary = summary\nself.validation_error = validation_error\nself.signed_data = signed_data\nself.additional_properties = additional_properties",
"if dictionary is None:\n ... | <|body_start_0|>
self.request_id = request_id
self.audit_id = audit_id
self.signers_valid = signers_valid
self.seal = seal
self.signers = signers
self.summary = summary
self.validation_error = validation_error
self.signed_data = signed_data
self.ad... | Implementation of the 'ParseSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. audit_id (uuid|string): Reference to audit log signers_valid (bool): Is the signatures valid seal (Seal): Is the sealing of the SDO valid signers (list of SDOSigners): Signers... | ParseSDOResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParseSDOResponse:
"""Implementation of the 'ParseSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. audit_id (uuid|string): Reference to audit log signers_valid (bool): Is the signatures valid seal (Seal): Is the sealing of the SDO... | stack_v2_sparse_classes_36k_train_005004 | 4,088 | permissive | [
{
"docstring": "Constructor for the ParseSDOResponse class",
"name": "__init__",
"signature": "def __init__(self, request_id=None, audit_id=None, signers_valid=None, seal=None, signers=None, summary=None, validation_error=None, signed_data=None, additional_properties={})"
},
{
"docstring": "Crea... | 2 | stack_v2_sparse_classes_30k_train_017526 | Implement the Python class `ParseSDOResponse` described below.
Class description:
Implementation of the 'ParseSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. audit_id (uuid|string): Reference to audit log signers_valid (bool): Is the signatures valid... | Implement the Python class `ParseSDOResponse` described below.
Class description:
Implementation of the 'ParseSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. audit_id (uuid|string): Reference to audit log signers_valid (bool): Is the signatures valid... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class ParseSDOResponse:
"""Implementation of the 'ParseSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. audit_id (uuid|string): Reference to audit log signers_valid (bool): Is the signatures valid seal (Seal): Is the sealing of the SDO... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParseSDOResponse:
"""Implementation of the 'ParseSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. audit_id (uuid|string): Reference to audit log signers_valid (bool): Is the signatures valid seal (Seal): Is the sealing of the SDO valid signer... | the_stack_v2_python_sparse | idfy_rest_client/models/parse_sdo_response.py | dealflowteam/Idfy | train | 0 |
ce8b70a2da60622d214f158b5d920502b8ba2f45 | [
"dict_letter = dict()\nfor i in range(len(S)):\n c = S[i]\n if c in dict_letter:\n dict_letter[c].end = i\n else:\n dict_letter[c] = Letter(c, i, i)\ndist_list = []\nstart = 0\nend = 0\nfor k, v in dict_letter.items():\n if v.start > end:\n distance = end - start + 1\n dist_l... | <|body_start_0|>
dict_letter = dict()
for i in range(len(S)):
c = S[i]
if c in dict_letter:
dict_letter[c].end = i
else:
dict_letter[c] = Letter(c, i, i)
dist_list = []
start = 0
end = 0
for k, v in dict_... | https://leetcode.com/problems/partition-labels/ | PartitionLabels | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PartitionLabels:
"""https://leetcode.com/problems/partition-labels/"""
def partitionLabels(self, S: str) -> List[int]:
"""Time complexity: O(n) Space complexity: O(1), dict_letter contains no more than all alphabet letters :param S: :return:"""
<|body_0|>
def partitionLa... | stack_v2_sparse_classes_36k_train_005005 | 2,307 | no_license | [
{
"docstring": "Time complexity: O(n) Space complexity: O(1), dict_letter contains no more than all alphabet letters :param S: :return:",
"name": "partitionLabels",
"signature": "def partitionLabels(self, S: str) -> List[int]"
},
{
"docstring": "Time complexity: O(n) Space complexity: O(1) :para... | 2 | stack_v2_sparse_classes_30k_train_004619 | Implement the Python class `PartitionLabels` described below.
Class description:
https://leetcode.com/problems/partition-labels/
Method signatures and docstrings:
- def partitionLabels(self, S: str) -> List[int]: Time complexity: O(n) Space complexity: O(1), dict_letter contains no more than all alphabet letters :par... | Implement the Python class `PartitionLabels` described below.
Class description:
https://leetcode.com/problems/partition-labels/
Method signatures and docstrings:
- def partitionLabels(self, S: str) -> List[int]: Time complexity: O(n) Space complexity: O(1), dict_letter contains no more than all alphabet letters :par... | 112e403d2cbe703ed595c8af0c82a578190f5d52 | <|skeleton|>
class PartitionLabels:
"""https://leetcode.com/problems/partition-labels/"""
def partitionLabels(self, S: str) -> List[int]:
"""Time complexity: O(n) Space complexity: O(1), dict_letter contains no more than all alphabet letters :param S: :return:"""
<|body_0|>
def partitionLa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PartitionLabels:
"""https://leetcode.com/problems/partition-labels/"""
def partitionLabels(self, S: str) -> List[int]:
"""Time complexity: O(n) Space complexity: O(1), dict_letter contains no more than all alphabet letters :param S: :return:"""
dict_letter = dict()
for i in range(... | the_stack_v2_python_sparse | python3/algorithms/leetcode/partition_labels.py | raychenon/algorithms | train | 1 |
d21a0b20bafa1ef0f56e89da5d72ff55a074ad17 | [
"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... | ## API Overview Manages Identity and Access Management (IAM) policies. Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface. ## Data model Access control is applied when a principal (user or service account), takes some action on a resource exposed by a servi... | IAMPolicyServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IAMPolicyServicer:
"""## API Overview Manages Identity and Access Management (IAM) policies. Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface. ## Data model Access control is applied when a principal (user or service account), takes... | stack_v2_sparse_classes_36k_train_005006 | 6,619 | permissive | [
{
"docstring": "Sets the access control policy on the specified resource. Replaces any existing policy.",
"name": "SetIamPolicy",
"signature": "def SetIamPolicy(self, request, context)"
},
{
"docstring": "Gets the access control policy for a resource. Returns an empty policy if the resource exis... | 3 | null | Implement the Python class `IAMPolicyServicer` described below.
Class description:
## API Overview Manages Identity and Access Management (IAM) policies. Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface. ## Data model Access control is applied when a pri... | Implement the Python class `IAMPolicyServicer` described below.
Class description:
## API Overview Manages Identity and Access Management (IAM) policies. Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface. ## Data model Access control is applied when a pri... | c40f9f12ed4c066d4f42095e96e9a87a8581d99d | <|skeleton|>
class IAMPolicyServicer:
"""## API Overview Manages Identity and Access Management (IAM) policies. Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface. ## Data model Access control is applied when a principal (user or service account), takes... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IAMPolicyServicer:
"""## API Overview Manages Identity and Access Management (IAM) policies. Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface. ## Data model Access control is applied when a principal (user or service account), takes some action ... | the_stack_v2_python_sparse | src/lib/google/iam/v1/iam_policy_pb2_grpc.py | martbhell/wasthereannhlgamelastnight | train | 5 |
b944d90d4784de8c2f92b8ac1bae26e5718db186 | [
"super(convDecoderNet, self).__init__()\nif len(out_dim) not in (1, 2, 3):\n raise ValueError('The output dimensions must be (length,) for 1D data and ' + '(height, width) or (height, width, channel) for 2D data')\ndim = 2 if len(out_dim) > 1 else 1\nc = out_dim[-1] if len(out_dim) > 2 else 1\nself.fc_linear = n... | <|body_start_0|>
super(convDecoderNet, self).__init__()
if len(out_dim) not in (1, 2, 3):
raise ValueError('The output dimensions must be (length,) for 1D data and ' + '(height, width) or (height, width, channel) for 2D data')
dim = 2 if len(out_dim) > 1 else 1
c = out_dim[-1... | Convolutional decoder network (for variational autoencoder) Args: out_dim: Output dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions associated with images content num_layers: number of fully connected layers hidden_dim: numbe... | convDecoderNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class convDecoderNet:
"""Convolutional decoder network (for variational autoencoder) Args: out_dim: Output dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions associated with images content num_layers: number o... | stack_v2_sparse_classes_36k_train_005007 | 28,462 | permissive | [
{
"docstring": "Initializes network parameters",
"name": "__init__",
"signature": "def __init__(self, out_dim: Tuple[int], latent_dim: int, num_layers: int=2, hidden_dim: int=32, **kwargs: float) -> None"
},
{
"docstring": "Forward pass",
"name": "forward",
"signature": "def forward(self... | 2 | stack_v2_sparse_classes_30k_train_014358 | Implement the Python class `convDecoderNet` described below.
Class description:
Convolutional decoder network (for variational autoencoder) Args: out_dim: Output dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions associated w... | Implement the Python class `convDecoderNet` described below.
Class description:
Convolutional decoder network (for variational autoencoder) Args: out_dim: Output dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions associated w... | 6d187296074143d017ca8fc60302364cd946b180 | <|skeleton|>
class convDecoderNet:
"""Convolutional decoder network (for variational autoencoder) Args: out_dim: Output dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions associated with images content num_layers: number o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class convDecoderNet:
"""Convolutional decoder network (for variational autoencoder) Args: out_dim: Output dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions associated with images content num_layers: number of fully conne... | the_stack_v2_python_sparse | atomai/nets/ed.py | pycroscopy/atomai | train | 157 |
c23d576f66f6178e1dc929a3dcd8a6cb49d33fcb | [
"query = self.db.query(UsersFavorites).filter(UsersFavorites.Fuser_id == kwargs.get('user_id'), UsersFavorites.Ffavorites_id == kwargs.get('favorite_id'), UsersFavorites.Ffavorites_type == kwargs.get('favorite_type', ''))\nif query.count() > 0:\n query.update({'Fdeleted': 0})\nelse:\n user_favorite = UsersFav... | <|body_start_0|>
query = self.db.query(UsersFavorites).filter(UsersFavorites.Fuser_id == kwargs.get('user_id'), UsersFavorites.Ffavorites_id == kwargs.get('favorite_id'), UsersFavorites.Ffavorites_type == kwargs.get('favorite_type', ''))
if query.count() > 0:
query.update({'Fdeleted': 0})
... | FavoritesService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FavoritesService:
def create_favorite(self, **kwargs):
"""todo:创建收藏 :param kwargs: :return:"""
<|body_0|>
def query_favorite(self, **kwargs):
"""todo:查询收藏 :param kwargs: :return:"""
<|body_1|>
def update_favorite(self, **kwargs):
"""todo:删除收藏 :pa... | stack_v2_sparse_classes_36k_train_005008 | 2,860 | no_license | [
{
"docstring": "todo:创建收藏 :param kwargs: :return:",
"name": "create_favorite",
"signature": "def create_favorite(self, **kwargs)"
},
{
"docstring": "todo:查询收藏 :param kwargs: :return:",
"name": "query_favorite",
"signature": "def query_favorite(self, **kwargs)"
},
{
"docstring": "... | 3 | null | Implement the Python class `FavoritesService` described below.
Class description:
Implement the FavoritesService class.
Method signatures and docstrings:
- def create_favorite(self, **kwargs): todo:创建收藏 :param kwargs: :return:
- def query_favorite(self, **kwargs): todo:查询收藏 :param kwargs: :return:
- def update_favori... | Implement the Python class `FavoritesService` described below.
Class description:
Implement the FavoritesService class.
Method signatures and docstrings:
- def create_favorite(self, **kwargs): todo:创建收藏 :param kwargs: :return:
- def query_favorite(self, **kwargs): todo:查询收藏 :param kwargs: :return:
- def update_favori... | 0596bcb429674b75243d343c73e0f022b6d86820 | <|skeleton|>
class FavoritesService:
def create_favorite(self, **kwargs):
"""todo:创建收藏 :param kwargs: :return:"""
<|body_0|>
def query_favorite(self, **kwargs):
"""todo:查询收藏 :param kwargs: :return:"""
<|body_1|>
def update_favorite(self, **kwargs):
"""todo:删除收藏 :pa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FavoritesService:
def create_favorite(self, **kwargs):
"""todo:创建收藏 :param kwargs: :return:"""
query = self.db.query(UsersFavorites).filter(UsersFavorites.Fuser_id == kwargs.get('user_id'), UsersFavorites.Ffavorites_id == kwargs.get('favorite_id'), UsersFavorites.Ffavorites_type == kwargs.get(... | the_stack_v2_python_sparse | source/services/favorites/favorites_services.py | cash2one/gongzhuhao | train | 0 | |
846689aee8a6ab66cb683e71d5fa8946d7213a76 | [
"loader = self.loader(self)\nobj = loader.get_object_from_aws(self.app.pargs.pk)\nobj = cast(Service, obj)\ncommand = get_task(obj, self.app.pargs.command)\ntail_task_logs(self.app, command, sleep=self.app.pargs.sleep, mark=self.app.pargs.mark, filter_pattern=self.app.pargs.filter_pattern)",
"loader = self.loader... | <|body_start_0|>
loader = self.loader(self)
obj = loader.get_object_from_aws(self.app.pargs.pk)
obj = cast(Service, obj)
command = get_task(obj, self.app.pargs.command)
tail_task_logs(self.app, command, sleep=self.app.pargs.sleep, mark=self.app.pargs.mark, filter_pattern=self.app... | ECSServiceCommandLogs | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ECSServiceCommandLogs:
def tail(self) -> None:
"""If a ServiceHelperTask uses "awslogs" as its logDriver, tail the logs for that ServiceHelperTask."""
<|body_0|>
def list(self) -> None:
"""If a ServiceHelperTask uses "awslogs" as its logDriver, tail the logs for that... | stack_v2_sparse_classes_36k_train_005009 | 15,554 | permissive | [
{
"docstring": "If a ServiceHelperTask uses \"awslogs\" as its logDriver, tail the logs for that ServiceHelperTask.",
"name": "tail",
"signature": "def tail(self) -> None"
},
{
"docstring": "If a ServiceHelperTask uses \"awslogs\" as its logDriver, tail the logs for that ServiceHelperTask.",
... | 2 | stack_v2_sparse_classes_30k_val_000232 | Implement the Python class `ECSServiceCommandLogs` described below.
Class description:
Implement the ECSServiceCommandLogs class.
Method signatures and docstrings:
- def tail(self) -> None: If a ServiceHelperTask uses "awslogs" as its logDriver, tail the logs for that ServiceHelperTask.
- def list(self) -> None: If a... | Implement the Python class `ECSServiceCommandLogs` described below.
Class description:
Implement the ECSServiceCommandLogs class.
Method signatures and docstrings:
- def tail(self) -> None: If a ServiceHelperTask uses "awslogs" as its logDriver, tail the logs for that ServiceHelperTask.
- def list(self) -> None: If a... | caa4698da812f5291a47366f307c1abebb4a989c | <|skeleton|>
class ECSServiceCommandLogs:
def tail(self) -> None:
"""If a ServiceHelperTask uses "awslogs" as its logDriver, tail the logs for that ServiceHelperTask."""
<|body_0|>
def list(self) -> None:
"""If a ServiceHelperTask uses "awslogs" as its logDriver, tail the logs for that... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ECSServiceCommandLogs:
def tail(self) -> None:
"""If a ServiceHelperTask uses "awslogs" as its logDriver, tail the logs for that ServiceHelperTask."""
loader = self.loader(self)
obj = loader.get_object_from_aws(self.app.pargs.pk)
obj = cast(Service, obj)
command = get_t... | the_stack_v2_python_sparse | deployfish/controllers/commands.py | caltechads/deployfish | train | 98 | |
a0fb879d811c76b7479fc90ced8ee33251c7cb8b | [
"from mstrio.object_management.search_operations import full_search\nif self._OBJECT_TYPE == ObjectTypes.NOT_SUPPORTED:\n raise NotSupportedError(f'Listing dependents is not supported for unsupported object with ID {self.id}.')\nproject = project or self.connection.project_id\nif project is None:\n raise Attr... | <|body_start_0|>
from mstrio.object_management.search_operations import full_search
if self._OBJECT_TYPE == ObjectTypes.NOT_SUPPORTED:
raise NotSupportedError(f'Listing dependents is not supported for unsupported object with ID {self.id}.')
project = project or self.connection.projec... | DependenceMixin class adds functionality of listing dependents and dependencies. Must be mixedin with Entity or its subclasses. | DependenceMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DependenceMixin:
"""DependenceMixin class adds functionality of listing dependents and dependencies. Must be mixedin with Entity or its subclasses."""
def list_dependents(self: 'Entity', project: Union['Project', str] | None=None, name: str | None=None, pattern: Union['SearchPattern', int]=4... | stack_v2_sparse_classes_36k_train_005010 | 8,325 | permissive | [
{
"docstring": "List dependents of an object. Args: project (string): `Project` object or ID name(string): Value the search pattern is set to, which will be applied to the names of object types being searched. For example, search for all report objects (type) whose name begins with (pattern) B (name). pattern(i... | 2 | null | Implement the Python class `DependenceMixin` described below.
Class description:
DependenceMixin class adds functionality of listing dependents and dependencies. Must be mixedin with Entity or its subclasses.
Method signatures and docstrings:
- def list_dependents(self: 'Entity', project: Union['Project', str] | None... | Implement the Python class `DependenceMixin` described below.
Class description:
DependenceMixin class adds functionality of listing dependents and dependencies. Must be mixedin with Entity or its subclasses.
Method signatures and docstrings:
- def list_dependents(self: 'Entity', project: Union['Project', str] | None... | c6cea33b15bcd876ded4de25138b3f5e5165cd6d | <|skeleton|>
class DependenceMixin:
"""DependenceMixin class adds functionality of listing dependents and dependencies. Must be mixedin with Entity or its subclasses."""
def list_dependents(self: 'Entity', project: Union['Project', str] | None=None, name: str | None=None, pattern: Union['SearchPattern', int]=4... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DependenceMixin:
"""DependenceMixin class adds functionality of listing dependents and dependencies. Must be mixedin with Entity or its subclasses."""
def list_dependents(self: 'Entity', project: Union['Project', str] | None=None, name: str | None=None, pattern: Union['SearchPattern', int]=4, domain: Uni... | the_stack_v2_python_sparse | mstrio/utils/dependence_mixin.py | MicroStrategy/mstrio-py | train | 84 |
119b74f71b3c5ea6cb08394e9f0a39f645977335 | [
"self.__host = host\nself.__port = port\nurl = create_product_url(protocol, host, port, uri)\nself.transport = None\ntry:\n self.transport = THttpClient.THttpClient(url)\nexcept ValueError:\n pass\nself._validate_proxy_format()\nself.protocol = TJSONProtocol.TJSONProtocol(self.transport)\nself.client = None\n... | <|body_start_0|>
self.__host = host
self.__port = port
url = create_product_url(protocol, host, port, uri)
self.transport = None
try:
self.transport = THttpClient.THttpClient(url)
except ValueError:
pass
self._validate_proxy_format()
... | BaseClientHelper | [
"LLVM-exception",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseClientHelper:
def __init__(self, protocol, host, port, uri, session_token=None, get_new_token=None):
"""@param get_new_token: a function which can generate a new token."""
<|body_0|>
def _validate_proxy_format(self):
"""Validate the proxy settings. If the proxy s... | stack_v2_sparse_classes_36k_train_005011 | 3,017 | permissive | [
{
"docstring": "@param get_new_token: a function which can generate a new token.",
"name": "__init__",
"signature": "def __init__(self, protocol, host, port, uri, session_token=None, get_new_token=None)"
},
{
"docstring": "Validate the proxy settings. If the proxy settings are invalid, it will p... | 4 | stack_v2_sparse_classes_30k_train_013260 | Implement the Python class `BaseClientHelper` described below.
Class description:
Implement the BaseClientHelper class.
Method signatures and docstrings:
- def __init__(self, protocol, host, port, uri, session_token=None, get_new_token=None): @param get_new_token: a function which can generate a new token.
- def _val... | Implement the Python class `BaseClientHelper` described below.
Class description:
Implement the BaseClientHelper class.
Method signatures and docstrings:
- def __init__(self, protocol, host, port, uri, session_token=None, get_new_token=None): @param get_new_token: a function which can generate a new token.
- def _val... | f912cf0ccc7059240ae389823faf35225e6cabc8 | <|skeleton|>
class BaseClientHelper:
def __init__(self, protocol, host, port, uri, session_token=None, get_new_token=None):
"""@param get_new_token: a function which can generate a new token."""
<|body_0|>
def _validate_proxy_format(self):
"""Validate the proxy settings. If the proxy s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseClientHelper:
def __init__(self, protocol, host, port, uri, session_token=None, get_new_token=None):
"""@param get_new_token: a function which can generate a new token."""
self.__host = host
self.__port = port
url = create_product_url(protocol, host, port, uri)
self... | the_stack_v2_python_sparse | web/client/codechecker_client/helpers/base.py | Ericsson/codechecker | train | 2,028 | |
a9cebafc33846c8daeaa7bd9981d61d1fffa2021 | [
"self.port = 8303\nself.processCommand()\nserver = HTTPServer(('localhost', self.port), Handler)\nprint('Addition service listening on port ' + str(self.port))\ntry:\n server.serve_forever()\nexcept KeyboardInterrupt:\n server.shutdown()\n server.server_close()",
"parser = ArgumentParser()\nparser.add_ar... | <|body_start_0|>
self.port = 8303
self.processCommand()
server = HTTPServer(('localhost', self.port), Handler)
print('Addition service listening on port ' + str(self.port))
try:
server.serve_forever()
except KeyboardInterrupt:
server.shutdown()
... | Start server for addition service. | AdditionService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdditionService:
"""Start server for addition service."""
def __init__(self):
"""Set port and start server"""
<|body_0|>
def processCommand(self):
"""Get port from command line arguments."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.port... | stack_v2_sparse_classes_36k_train_005012 | 3,656 | permissive | [
{
"docstring": "Set port and start server",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get port from command line arguments.",
"name": "processCommand",
"signature": "def processCommand(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014182 | Implement the Python class `AdditionService` described below.
Class description:
Start server for addition service.
Method signatures and docstrings:
- def __init__(self): Set port and start server
- def processCommand(self): Get port from command line arguments. | Implement the Python class `AdditionService` described below.
Class description:
Start server for addition service.
Method signatures and docstrings:
- def __init__(self): Set port and start server
- def processCommand(self): Get port from command line arguments.
<|skeleton|>
class AdditionService:
"""Start serv... | d6e8ca06c70e31bff0e56f7d94bfa0bd835bf61c | <|skeleton|>
class AdditionService:
"""Start server for addition service."""
def __init__(self):
"""Set port and start server"""
<|body_0|>
def processCommand(self):
"""Get port from command line arguments."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdditionService:
"""Start server for addition service."""
def __init__(self):
"""Set port and start server"""
self.port = 8303
self.processCommand()
server = HTTPServer(('localhost', self.port), Handler)
print('Addition service listening on port ' + str(self.port))... | the_stack_v2_python_sparse | chapter7/additionService.py | MikeBeaulieu/ujs-book-materials | train | 0 |
23ebeeab9485926e5e9068ca601a02bc46d51487 | [
"self.metadata = MetadataCatalog.get(cfg.DATASETS.TEST[0] if len(cfg.DATASETS.TEST) else '__unused')\nself.cpu_device = torch.device('cpu')\nself.instance_mode = instance_mode\nself.predictor = BatchPredictor(cfg)",
"vis_output = None\nall_predictions = self.predictor(image_list)\nif visualize:\n predictions =... | <|body_start_0|>
self.metadata = MetadataCatalog.get(cfg.DATASETS.TEST[0] if len(cfg.DATASETS.TEST) else '__unused')
self.cpu_device = torch.device('cpu')
self.instance_mode = instance_mode
self.predictor = BatchPredictor(cfg)
<|end_body_0|>
<|body_start_1|>
vis_output = None
... | VisualizationDemo | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VisualizationDemo:
def __init__(self, cfg, instance_mode=ColorMode.IMAGE):
"""Args: cfg (CfgNode): instance_mode (ColorMode):"""
<|body_0|>
def run_on_image(self, image_list, visualize=0):
"""Args: image (np.ndarray): an image of shape (H, W, C) (in BGR order). This ... | stack_v2_sparse_classes_36k_train_005013 | 8,707 | permissive | [
{
"docstring": "Args: cfg (CfgNode): instance_mode (ColorMode):",
"name": "__init__",
"signature": "def __init__(self, cfg, instance_mode=ColorMode.IMAGE)"
},
{
"docstring": "Args: image (np.ndarray): an image of shape (H, W, C) (in BGR order). This is the format used by OpenCV. Returns: predict... | 2 | stack_v2_sparse_classes_30k_train_019544 | Implement the Python class `VisualizationDemo` described below.
Class description:
Implement the VisualizationDemo class.
Method signatures and docstrings:
- def __init__(self, cfg, instance_mode=ColorMode.IMAGE): Args: cfg (CfgNode): instance_mode (ColorMode):
- def run_on_image(self, image_list, visualize=0): Args:... | Implement the Python class `VisualizationDemo` described below.
Class description:
Implement the VisualizationDemo class.
Method signatures and docstrings:
- def __init__(self, cfg, instance_mode=ColorMode.IMAGE): Args: cfg (CfgNode): instance_mode (ColorMode):
- def run_on_image(self, image_list, visualize=0): Args:... | 999639b58ef2b5b6fcc5a8b27cba8777452a7f1f | <|skeleton|>
class VisualizationDemo:
def __init__(self, cfg, instance_mode=ColorMode.IMAGE):
"""Args: cfg (CfgNode): instance_mode (ColorMode):"""
<|body_0|>
def run_on_image(self, image_list, visualize=0):
"""Args: image (np.ndarray): an image of shape (H, W, C) (in BGR order). This ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VisualizationDemo:
def __init__(self, cfg, instance_mode=ColorMode.IMAGE):
"""Args: cfg (CfgNode): instance_mode (ColorMode):"""
self.metadata = MetadataCatalog.get(cfg.DATASETS.TEST[0] if len(cfg.DATASETS.TEST) else '__unused')
self.cpu_device = torch.device('cpu')
self.instan... | the_stack_v2_python_sparse | Object-Goal-Navigation/agents/utils/semantic_prediction.py | haokuanluo/Object-Goal-Navigation | train | 3 | |
555a63e5f144891b5bae20501841a74ac1937e8c | [
"self.name = name\nself.age = age\nself.favourite_food = food\nself.mood = 'Happy'",
"if self.favourite_food == food:\n self.mood = 'ecstatic'\n print('Ah, this is my favourite!')"
] | <|body_start_0|>
self.name = name
self.age = age
self.favourite_food = food
self.mood = 'Happy'
<|end_body_0|>
<|body_start_1|>
if self.favourite_food == food:
self.mood = 'ecstatic'
print('Ah, this is my favourite!')
<|end_body_1|>
| Person | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Person:
def __init__(self, name, age, food):
"""(Person, string, int, string) -> NoneType Create new Person object with given, name, age, and favourite foood."""
<|body_0|>
def eat(self, food):
"""Person, string) -> NoneType Make this person eat the food. Change the ... | stack_v2_sparse_classes_36k_train_005014 | 678 | permissive | [
{
"docstring": "(Person, string, int, string) -> NoneType Create new Person object with given, name, age, and favourite foood.",
"name": "__init__",
"signature": "def __init__(self, name, age, food)"
},
{
"docstring": "Person, string) -> NoneType Make this person eat the food. Change the mood of... | 2 | stack_v2_sparse_classes_30k_train_009574 | Implement the Python class `Person` described below.
Class description:
Implement the Person class.
Method signatures and docstrings:
- def __init__(self, name, age, food): (Person, string, int, string) -> NoneType Create new Person object with given, name, age, and favourite foood.
- def eat(self, food): Person, str... | Implement the Python class `Person` described below.
Class description:
Implement the Person class.
Method signatures and docstrings:
- def __init__(self, name, age, food): (Person, string, int, string) -> NoneType Create new Person object with given, name, age, and favourite foood.
- def eat(self, food): Person, str... | 37009dfdbef9a15c2851bcca2a4e029267e6a02d | <|skeleton|>
class Person:
def __init__(self, name, age, food):
"""(Person, string, int, string) -> NoneType Create new Person object with given, name, age, and favourite foood."""
<|body_0|>
def eat(self, food):
"""Person, string) -> NoneType Make this person eat the food. Change the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Person:
def __init__(self, name, age, food):
"""(Person, string, int, string) -> NoneType Create new Person object with given, name, age, and favourite foood."""
self.name = name
self.age = age
self.favourite_food = food
self.mood = 'Happy'
def eat(self, food):
... | the_stack_v2_python_sparse | uoft/CSC148H1F Intro to Comp Sci/@week1_object_oriented/@@playground/class.py | Reginald-Lee/biji-ben | train | 0 | |
7810307f9a306072243ba7fdcc23ffbdfd17ece4 | [
"bucket_url, bucket_metadata = self.GetSingleBucketUrlFromArg(self.args[0], bucket_fields=['logging'])\nif bucket_url.scheme == 's3':\n text_util.print_to_fd(self.gsutil_api.XmlPassThroughGetLogging(bucket_url, provider=bucket_url.scheme), end='')\nelif bucket_metadata.logging and bucket_metadata.logging.logBuck... | <|body_start_0|>
bucket_url, bucket_metadata = self.GetSingleBucketUrlFromArg(self.args[0], bucket_fields=['logging'])
if bucket_url.scheme == 's3':
text_util.print_to_fd(self.gsutil_api.XmlPassThroughGetLogging(bucket_url, provider=bucket_url.scheme), end='')
elif bucket_metadata.lo... | Implementation of gsutil logging command. | LoggingCommand | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoggingCommand:
"""Implementation of gsutil logging command."""
def _Get(self):
"""Gets logging configuration for a bucket."""
<|body_0|>
def _Enable(self):
"""Enables logging configuration for a bucket."""
<|body_1|>
def _Disable(self):
"""D... | stack_v2_sparse_classes_36k_train_005015 | 10,742 | permissive | [
{
"docstring": "Gets logging configuration for a bucket.",
"name": "_Get",
"signature": "def _Get(self)"
},
{
"docstring": "Enables logging configuration for a bucket.",
"name": "_Enable",
"signature": "def _Enable(self)"
},
{
"docstring": "Disables logging configuration for a bu... | 4 | null | Implement the Python class `LoggingCommand` described below.
Class description:
Implementation of gsutil logging command.
Method signatures and docstrings:
- def _Get(self): Gets logging configuration for a bucket.
- def _Enable(self): Enables logging configuration for a bucket.
- def _Disable(self): Disables logging... | Implement the Python class `LoggingCommand` described below.
Class description:
Implementation of gsutil logging command.
Method signatures and docstrings:
- def _Get(self): Gets logging configuration for a bucket.
- def _Enable(self): Enables logging configuration for a bucket.
- def _Disable(self): Disables logging... | 53102de187a48ac2cfc241fef54dcbc29c453a8e | <|skeleton|>
class LoggingCommand:
"""Implementation of gsutil logging command."""
def _Get(self):
"""Gets logging configuration for a bucket."""
<|body_0|>
def _Enable(self):
"""Enables logging configuration for a bucket."""
<|body_1|>
def _Disable(self):
"""D... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoggingCommand:
"""Implementation of gsutil logging command."""
def _Get(self):
"""Gets logging configuration for a bucket."""
bucket_url, bucket_metadata = self.GetSingleBucketUrlFromArg(self.args[0], bucket_fields=['logging'])
if bucket_url.scheme == 's3':
text_util.... | the_stack_v2_python_sparse | third_party/gsutil/gslib/commands/logging.py | catapult-project/catapult | train | 2,032 |
0d182a49ef4792f09733ea99b3b1e92bf39d2e5b | [
"if not root:\n return False\nif not root.left and (not root.right):\n return sum == root.val\nreturn self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val)",
"def preOrder(node, path):\n if not node:\n return False\n path.append(node.val)\n if sum(path) ==... | <|body_start_0|>
if not root:
return False
if not root.left and (not root.right):
return sum == root.val
return self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val)
<|end_body_0|>
<|body_start_1|>
def preOrder(node, path):
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasPathSum(self, root: TreeNode, sum: int) -> bool:
"""dfs"""
<|body_0|>
def hasPathSum1(self, root: TreeNode, targetSum: int) -> bool:
"""回溯"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return False
... | stack_v2_sparse_classes_36k_train_005016 | 2,099 | permissive | [
{
"docstring": "dfs",
"name": "hasPathSum",
"signature": "def hasPathSum(self, root: TreeNode, sum: int) -> bool"
},
{
"docstring": "回溯",
"name": "hasPathSum1",
"signature": "def hasPathSum1(self, root: TreeNode, targetSum: int) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root: TreeNode, sum: int) -> bool: dfs
- def hasPathSum1(self, root: TreeNode, targetSum: int) -> bool: 回溯 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root: TreeNode, sum: int) -> bool: dfs
- def hasPathSum1(self, root: TreeNode, targetSum: int) -> bool: 回溯
<|skeleton|>
class Solution:
def hasPathSum(... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def hasPathSum(self, root: TreeNode, sum: int) -> bool:
"""dfs"""
<|body_0|>
def hasPathSum1(self, root: TreeNode, targetSum: int) -> bool:
"""回溯"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasPathSum(self, root: TreeNode, sum: int) -> bool:
"""dfs"""
if not root:
return False
if not root.left and (not root.right):
return sum == root.val
return self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - roo... | the_stack_v2_python_sparse | 112-path-sum.py | yuenliou/leetcode | train | 0 | |
cde03a07abf5a2d532e2aff819c7220ed7054e02 | [
"query = TypeDescriptor.get_query(info=info)\nquery = query.filter(ModelDescriptor.ui == ui)\nquery = apply_requested_fields(info=info, query=query, orm_class=ModelDescriptor)\nobj = query.first()\nreturn obj",
"session = info.context.get('session')\nquery = session.query(ModelDescriptor)\nquery = query.join(Mode... | <|body_start_0|>
query = TypeDescriptor.get_query(info=info)
query = query.filter(ModelDescriptor.ui == ui)
query = apply_requested_fields(info=info, query=query, orm_class=ModelDescriptor)
obj = query.first()
return obj
<|end_body_0|>
<|body_start_1|>
session = info.con... | TypeDescriptors | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TypeDescriptors:
def resolve_by_ui(args: dict, info: graphene.ResolveInfo, ui: str) -> ModelDescriptor:
"""Retrieves a `ModelDescriptor` object through its UI. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The resolver info. ui (str): The UI of the `ModelDescrip... | stack_v2_sparse_classes_36k_train_005017 | 6,202 | no_license | [
{
"docstring": "Retrieves a `ModelDescriptor` object through its UI. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The resolver info. ui (str): The UI of the `ModelDescriptor` to retrieve. Returns: DescriptorModel: The retrieved `ModelDescriptor` object or `None` if no match was not fo... | 3 | null | Implement the Python class `TypeDescriptors` described below.
Class description:
Implement the TypeDescriptors class.
Method signatures and docstrings:
- def resolve_by_ui(args: dict, info: graphene.ResolveInfo, ui: str) -> ModelDescriptor: Retrieves a `ModelDescriptor` object through its UI. Args: args (dict): The r... | Implement the Python class `TypeDescriptors` described below.
Class description:
Implement the TypeDescriptors class.
Method signatures and docstrings:
- def resolve_by_ui(args: dict, info: graphene.ResolveInfo, ui: str) -> ModelDescriptor: Retrieves a `ModelDescriptor` object through its UI. Args: args (dict): The r... | 275d0f5f437e09cb477600f48080d921301238e6 | <|skeleton|>
class TypeDescriptors:
def resolve_by_ui(args: dict, info: graphene.ResolveInfo, ui: str) -> ModelDescriptor:
"""Retrieves a `ModelDescriptor` object through its UI. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The resolver info. ui (str): The UI of the `ModelDescrip... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TypeDescriptors:
def resolve_by_ui(args: dict, info: graphene.ResolveInfo, ui: str) -> ModelDescriptor:
"""Retrieves a `ModelDescriptor` object through its UI. Args: args (dict): The resolver arguments. info (graphene.ResolveInfo): The resolver info. ui (str): The UI of the `ModelDescriptor` to retrie... | the_stack_v2_python_sparse | ffgraphql/types/descriptors.py | bearnd/fightfor-graphql | train | 0 | |
3ff5716f5e3d1f877d70f8c4b49d662f9420f836 | [
"ids_with_two = 0\nids_with_three = 0\nfor id in self.lines:\n counts = set(Counter(id).values())\n if 2 in counts:\n ids_with_two += 1\n if 3 in counts:\n ids_with_three += 1\nchecksum = ids_with_three * ids_with_two\nprint(f'Checksum: {checksum}')",
"match_possibilities = set()\nfor id in... | <|body_start_0|>
ids_with_two = 0
ids_with_three = 0
for id in self.lines:
counts = set(Counter(id).values())
if 2 in counts:
ids_with_two += 1
if 3 in counts:
ids_with_three += 1
checksum = ids_with_three * ids_with_two... | Day 2 challenges | Challenge | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challenge 1"""
<|body_0|>
def challenge2(self):
"""Day 2 challenge 2"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ids_with_two = 0
ids_with_three = 0
for id in s... | stack_v2_sparse_classes_36k_train_005018 | 1,234 | permissive | [
{
"docstring": "Day 2 challenge 1",
"name": "challenge1",
"signature": "def challenge1(self)"
},
{
"docstring": "Day 2 challenge 2",
"name": "challenge2",
"signature": "def challenge2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015716 | Implement the Python class `Challenge` described below.
Class description:
Day 2 challenges
Method signatures and docstrings:
- def challenge1(self): Day 2 challenge 1
- def challenge2(self): Day 2 challenge 2 | Implement the Python class `Challenge` described below.
Class description:
Day 2 challenges
Method signatures and docstrings:
- def challenge1(self): Day 2 challenge 1
- def challenge2(self): Day 2 challenge 2
<|skeleton|>
class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challe... | 6671ef8c16a837f697bb3fb91004d1bd892814ba | <|skeleton|>
class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challenge 1"""
<|body_0|>
def challenge2(self):
"""Day 2 challenge 2"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challenge 1"""
ids_with_two = 0
ids_with_three = 0
for id in self.lines:
counts = set(Counter(id).values())
if 2 in counts:
ids_with_two += 1
if 3 in counts... | the_stack_v2_python_sparse | 2018/day2/challenge.py | ericgreveson/adventofcode | train | 0 |
e64ce26364641f51de5f1171393bccd0aabb955d | [
"record_list = [0] * len(nums)\ndeplicate = 0\nfor ele in nums:\n if record_list[ele - 1] != 0:\n deplicate = ele\n else:\n record_list[ele - 1] = 1\nerror = record_list.index(0)\nreturn [deplicate, error + 1]",
"dep = err = 0\nnums = sorted(nums)\nfor i in range(0, len(nums) - 1):\n if num... | <|body_start_0|>
record_list = [0] * len(nums)
deplicate = 0
for ele in nums:
if record_list[ele - 1] != 0:
deplicate = ele
else:
record_list[ele - 1] = 1
error = record_list.index(0)
return [deplicate, error + 1]
<|end_body... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
"""建立长度为n的list 遍历nums, 遍历元素在list对应index中+1 value=0, 说明是error值 value=1, 正常 value=2, 重复, 也可以直接if保存 :param nums: :return:"""
<|body_0|>
def findErrorNums(self, nums: List[int]) -> List[int]:
"""桶排序 需要一次sor... | stack_v2_sparse_classes_36k_train_005019 | 2,249 | no_license | [
{
"docstring": "建立长度为n的list 遍历nums, 遍历元素在list对应index中+1 value=0, 说明是error值 value=1, 正常 value=2, 重复, 也可以直接if保存 :param nums: :return:",
"name": "findErrorNums",
"signature": "def findErrorNums(self, nums: List[int]) -> List[int]"
},
{
"docstring": "桶排序 需要一次sort :param nums: :return:",
"name": ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findErrorNums(self, nums: List[int]) -> List[int]: 建立长度为n的list 遍历nums, 遍历元素在list对应index中+1 value=0, 说明是error值 value=1, 正常 value=2, 重复, 也可以直接if保存 :param nums: :return:
- def f... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findErrorNums(self, nums: List[int]) -> List[int]: 建立长度为n的list 遍历nums, 遍历元素在list对应index中+1 value=0, 说明是error值 value=1, 正常 value=2, 重复, 也可以直接if保存 :param nums: :return:
- def f... | b1680014ce3f55ba952a1e64241c0cbb783cc436 | <|skeleton|>
class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
"""建立长度为n的list 遍历nums, 遍历元素在list对应index中+1 value=0, 说明是error值 value=1, 正常 value=2, 重复, 也可以直接if保存 :param nums: :return:"""
<|body_0|>
def findErrorNums(self, nums: List[int]) -> List[int]:
"""桶排序 需要一次sor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
"""建立长度为n的list 遍历nums, 遍历元素在list对应index中+1 value=0, 说明是error值 value=1, 正常 value=2, 重复, 也可以直接if保存 :param nums: :return:"""
record_list = [0] * len(nums)
deplicate = 0
for ele in nums:
if record_list[ele... | the_stack_v2_python_sparse | a_645.py | sun510001/leetcode_jianzhi_offer_2 | train | 0 | |
c95e93c2e3c56c229525c9ea63aed06235f215b5 | [
"response = self.client.get('/bag/')\nself.assertEqual(response.status_code, 200)\nself.assertTemplateUsed(response, 'bag/bag.html')",
"product = Product(name='Create a Test', price=1, euro_shipping=False)\nproduct.save()\nsession = self.client.session\nsession['bag'] = {product.id: 1}\nsession.save()\nuser = Use... | <|body_start_0|>
response = self.client.get('/bag/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'bag/bag.html')
<|end_body_0|>
<|body_start_1|>
product = Product(name='Create a Test', price=1, euro_shipping=False)
product.save()
session... | TestView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestView:
def test_bag(self):
"""testing if the bag page works and template used"""
<|body_0|>
def test_deliverable(self):
"""testing if the bag page does display the info that product is not deliverable in case necessary"""
<|body_1|>
def test_add_to_ba... | stack_v2_sparse_classes_36k_train_005020 | 4,499 | no_license | [
{
"docstring": "testing if the bag page works and template used",
"name": "test_bag",
"signature": "def test_bag(self)"
},
{
"docstring": "testing if the bag page does display the info that product is not deliverable in case necessary",
"name": "test_deliverable",
"signature": "def test_... | 5 | stack_v2_sparse_classes_30k_train_019063 | Implement the Python class `TestView` described below.
Class description:
Implement the TestView class.
Method signatures and docstrings:
- def test_bag(self): testing if the bag page works and template used
- def test_deliverable(self): testing if the bag page does display the info that product is not deliverable in... | Implement the Python class `TestView` described below.
Class description:
Implement the TestView class.
Method signatures and docstrings:
- def test_bag(self): testing if the bag page works and template used
- def test_deliverable(self): testing if the bag page does display the info that product is not deliverable in... | e61dde21f68e84c312016fd2672c138b60b76344 | <|skeleton|>
class TestView:
def test_bag(self):
"""testing if the bag page works and template used"""
<|body_0|>
def test_deliverable(self):
"""testing if the bag page does display the info that product is not deliverable in case necessary"""
<|body_1|>
def test_add_to_ba... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestView:
def test_bag(self):
"""testing if the bag page works and template used"""
response = self.client.get('/bag/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'bag/bag.html')
def test_deliverable(self):
"""testing if the bag p... | the_stack_v2_python_sparse | bag/tests_views.py | Code-Institute-Submissions/furnitart | train | 0 | |
7dc915abfedfdea7c60528e998901a8a275fbbb7 | [
"json_input = request.get_json()\nlocation = json_input.get('location')\nentity_type = json_input.get('entity_type_cd')\nrequest_action = json_input.get('request_action_cd')\nif not validate_name_request(location, entity_type, request_action):\n return ({'error': 'Invalid Name Request.'}, HTTPStatus.BAD_REQUEST)... | <|body_start_0|>
json_input = request.get_json()
location = json_input.get('location')
entity_type = json_input.get('entity_type_cd')
request_action = json_input.get('request_action_cd')
if not validate_name_request(location, entity_type, request_action):
return ({'er... | Wrapper service for Name analyzer. | NameAnalysisResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NameAnalysisResource:
"""Wrapper service for Name analyzer."""
def post():
"""Posts a name analysis request to the name analyzer. Returns a identifier if the request is successful."""
<|body_0|>
def get(identifier):
"""Retrieve the status of a name analysis reque... | stack_v2_sparse_classes_36k_train_005021 | 7,287 | permissive | [
{
"docstring": "Posts a name analysis request to the name analyzer. Returns a identifier if the request is successful.",
"name": "post",
"signature": "def post()"
},
{
"docstring": "Retrieve the status of a name analysis request from the name analyzer.",
"name": "get",
"signature": "def ... | 3 | null | Implement the Python class `NameAnalysisResource` described below.
Class description:
Wrapper service for Name analyzer.
Method signatures and docstrings:
- def post(): Posts a name analysis request to the name analyzer. Returns a identifier if the request is successful.
- def get(identifier): Retrieve the status of ... | Implement the Python class `NameAnalysisResource` described below.
Class description:
Wrapper service for Name analyzer.
Method signatures and docstrings:
- def post(): Posts a name analysis request to the name analyzer. Returns a identifier if the request is successful.
- def get(identifier): Retrieve the status of ... | 773c9ced6b5688ba6612f87712e611e55c149b85 | <|skeleton|>
class NameAnalysisResource:
"""Wrapper service for Name analyzer."""
def post():
"""Posts a name analysis request to the name analyzer. Returns a identifier if the request is successful."""
<|body_0|>
def get(identifier):
"""Retrieve the status of a name analysis reque... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NameAnalysisResource:
"""Wrapper service for Name analyzer."""
def post():
"""Posts a name analysis request to the name analyzer. Returns a identifier if the request is successful."""
json_input = request.get_json()
location = json_input.get('location')
entity_type = json_... | the_stack_v2_python_sparse | api/namex/resources/auto_analyse_v2/name_analysis.py | thorwolpert/namex | train | 0 |
02dc41908a73d6059bf7488221c67f328c3f7b15 | [
"if lists == []:\n return None\nresult = lists[0]\nfor index in range(1, len(lists)):\n result = self.mergeTwoLists(result, lists[index])\nreturn result",
"if l1 is None:\n return l2\nif l2 is None:\n return l1\nresult = l1\nif l1.val <= l2.val:\n result = l1\n l1 = l1.next\nelse:\n result = ... | <|body_start_0|>
if lists == []:
return None
result = lists[0]
for index in range(1, len(lists)):
result = self.mergeTwoLists(result, lists[index])
return result
<|end_body_0|>
<|body_start_1|>
if l1 is None:
return l2
if l2 is None:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if lists... | stack_v2_sparse_classes_36k_train_005022 | 1,818 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005249 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
<|skeleton|>... | fb695e489606a5e5eba000705caf77e40483c20e | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
if lists == []:
return None
result = lists[0]
for index in range(1, len(lists)):
result = self.mergeTwoLists(result, lists[index])
return result
def m... | the_stack_v2_python_sparse | 23_merge_k_sorted_lists.py | jjgyy/py_practice | train | 1 | |
770c3e0c20234fad7c9c757e094da8e742e41e2a | [
"self.nb_channels = nb_channels\nself.name = name\nself.rate = rate\nself.system_rate = system_rate\nself.sample = ceil(rate / self.system_rate)\nself.range = None\nself.raw_data = []\nself.data_window = data_window if data_window else int(rate)\nself.new_data = None",
"if len(self.raw_data) == 0:\n self.raw_d... | <|body_start_0|>
self.nb_channels = nb_channels
self.name = name
self.rate = rate
self.system_rate = system_rate
self.sample = ceil(rate / self.system_rate)
self.range = None
self.raw_data = []
self.data_window = data_window if data_window else int(rate)
... | Param | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Param:
def __init__(self, nb_channels: int, name: str=None, rate: float=None, system_rate: float=100, data_window: int=None):
"""initialize the parameter class Parameters ---------- nb_channels : int number of channels of the parameter name : str name of the parameter rate : float rate o... | stack_v2_sparse_classes_36k_train_005023 | 14,244 | permissive | [
{
"docstring": "initialize the parameter class Parameters ---------- nb_channels : int number of channels of the parameter name : str name of the parameter rate : float rate of the parameter system_rate : float rate of the system data_window : int size of the data window",
"name": "__init__",
"signature... | 2 | stack_v2_sparse_classes_30k_train_018387 | Implement the Python class `Param` described below.
Class description:
Implement the Param class.
Method signatures and docstrings:
- def __init__(self, nb_channels: int, name: str=None, rate: float=None, system_rate: float=100, data_window: int=None): initialize the parameter class Parameters ---------- nb_channels ... | Implement the Python class `Param` described below.
Class description:
Implement the Param class.
Method signatures and docstrings:
- def __init__(self, nb_channels: int, name: str=None, rate: float=None, system_rate: float=100, data_window: int=None): initialize the parameter class Parameters ---------- nb_channels ... | 1f09785605ed5e4eaa78bd203ec118c3b2794732 | <|skeleton|>
class Param:
def __init__(self, nb_channels: int, name: str=None, rate: float=None, system_rate: float=100, data_window: int=None):
"""initialize the parameter class Parameters ---------- nb_channels : int number of channels of the parameter name : str name of the parameter rate : float rate o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Param:
def __init__(self, nb_channels: int, name: str=None, rate: float=None, system_rate: float=100, data_window: int=None):
"""initialize the parameter class Parameters ---------- nb_channels : int number of channels of the parameter name : str name of the parameter rate : float rate of the paramete... | the_stack_v2_python_sparse | biosiglive/interfaces/param.py | aceglia/biosiglive | train | 6 | |
ef01ccde3a31ce3b1c777be2df51d1304e45a667 | [
"super(Simple6, self).__init__()\ndim2 = 128\nact_func = 'ReLU'\nself.num_layers = num_layers\nself.num_dim = 500\nself.weight_layers = torch.nn.Parameter(torch.ones(self.num_layers), requires_grad=True)\nself.weight_dimension = torch.nn.Parameter(torch.randn(self.num_dim), requires_grad=True)\nself.sf = torch.nn.S... | <|body_start_0|>
super(Simple6, self).__init__()
dim2 = 128
act_func = 'ReLU'
self.num_layers = num_layers
self.num_dim = 500
self.weight_layers = torch.nn.Parameter(torch.ones(self.num_layers), requires_grad=True)
self.weight_dimension = torch.nn.Parameter(torch.... | more layers input distance base 1: with nn 讨论一下,是什么原因造成的testset的结果比trainingset的差那么多,如果是同一年的数据,是否这种差距会缩小,如果是的话,是否可以通过一部分数据的预训练来提升结果。 | Simple6 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Simple6:
"""more layers input distance base 1: with nn 讨论一下,是什么原因造成的testset的结果比trainingset的差那么多,如果是同一年的数据,是否这种差距会缩小,如果是的话,是否可以通过一部分数据的预训练来提升结果。"""
def __init__(self, num_layers=2):
"""当li输出为1维时效果很差,说明一个维度并不足以表达足够的信息。。"""
<|body_0|>
def forward(self, s1, s2, ref):
... | stack_v2_sparse_classes_36k_train_005024 | 19,717 | no_license | [
{
"docstring": "当li输出为1维时效果很差,说明一个维度并不足以表达足够的信息。。",
"name": "__init__",
"signature": "def __init__(self, num_layers=2)"
},
{
"docstring": "input1: sent Embeddings input2: original target",
"name": "forward",
"signature": "def forward(self, s1, s2, ref)"
}
] | 2 | null | Implement the Python class `Simple6` described below.
Class description:
more layers input distance base 1: with nn 讨论一下,是什么原因造成的testset的结果比trainingset的差那么多,如果是同一年的数据,是否这种差距会缩小,如果是的话,是否可以通过一部分数据的预训练来提升结果。
Method signatures and docstrings:
- def __init__(self, num_layers=2): 当li输出为1维时效果很差,说明一个维度并不足以表达足够的信息。。
- def for... | Implement the Python class `Simple6` described below.
Class description:
more layers input distance base 1: with nn 讨论一下,是什么原因造成的testset的结果比trainingset的差那么多,如果是同一年的数据,是否这种差距会缩小,如果是的话,是否可以通过一部分数据的预训练来提升结果。
Method signatures and docstrings:
- def __init__(self, num_layers=2): 当li输出为1维时效果很差,说明一个维度并不足以表达足够的信息。。
- def for... | be85ee0c1fa915ae08ffb857643f9429a7749c0e | <|skeleton|>
class Simple6:
"""more layers input distance base 1: with nn 讨论一下,是什么原因造成的testset的结果比trainingset的差那么多,如果是同一年的数据,是否这种差距会缩小,如果是的话,是否可以通过一部分数据的预训练来提升结果。"""
def __init__(self, num_layers=2):
"""当li输出为1维时效果很差,说明一个维度并不足以表达足够的信息。。"""
<|body_0|>
def forward(self, s1, s2, ref):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Simple6:
"""more layers input distance base 1: with nn 讨论一下,是什么原因造成的testset的结果比trainingset的差那么多,如果是同一年的数据,是否这种差距会缩小,如果是的话,是否可以通过一部分数据的预训练来提升结果。"""
def __init__(self, num_layers=2):
"""当li输出为1维时效果很差,说明一个维度并不足以表达足够的信息。。"""
super(Simple6, self).__init__()
dim2 = 128
act_func ... | the_stack_v2_python_sparse | models/LinearModel.py | HuangYiran/MasterArbeit | train | 1 |
ecabc9886fa79310e177369c541ac253b6e8315e | [
"head = ListNode(Arr[0])\np = head\nfor i in range(1, len(Arr)):\n if i == 2:\n p.next = ListNode(Arr[i])\n p = p.next\n q = p\n else:\n p.next = ListNode(Arr[i])\n p = p.next\np.next = q\nreturn head",
"head = ListNode(Arr[0])\np = head\nfor i in range(1, len(Arr)):\n ... | <|body_start_0|>
head = ListNode(Arr[0])
p = head
for i in range(1, len(Arr)):
if i == 2:
p.next = ListNode(Arr[i])
p = p.next
q = p
else:
p.next = ListNode(Arr[i])
p = p.next
p.next =... | 建立链表 | List | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class List:
"""建立链表"""
def buildListLoop(self, Arr):
"""建立链表环结构"""
<|body_0|>
def buildList(self, Arr):
"""建立链表"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
head = ListNode(Arr[0])
p = head
for i in range(1, len(Arr)):
i... | stack_v2_sparse_classes_36k_train_005025 | 5,548 | no_license | [
{
"docstring": "建立链表环结构",
"name": "buildListLoop",
"signature": "def buildListLoop(self, Arr)"
},
{
"docstring": "建立链表",
"name": "buildList",
"signature": "def buildList(self, Arr)"
}
] | 2 | null | Implement the Python class `List` described below.
Class description:
建立链表
Method signatures and docstrings:
- def buildListLoop(self, Arr): 建立链表环结构
- def buildList(self, Arr): 建立链表 | Implement the Python class `List` described below.
Class description:
建立链表
Method signatures and docstrings:
- def buildListLoop(self, Arr): 建立链表环结构
- def buildList(self, Arr): 建立链表
<|skeleton|>
class List:
"""建立链表"""
def buildListLoop(self, Arr):
"""建立链表环结构"""
<|body_0|>
def buildList(... | 4e4f739402b95691f6c91411da26d7d3bfe042b6 | <|skeleton|>
class List:
"""建立链表"""
def buildListLoop(self, Arr):
"""建立链表环结构"""
<|body_0|>
def buildList(self, Arr):
"""建立链表"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class List:
"""建立链表"""
def buildListLoop(self, Arr):
"""建立链表环结构"""
head = ListNode(Arr[0])
p = head
for i in range(1, len(Arr)):
if i == 2:
p.next = ListNode(Arr[i])
p = p.next
q = p
else:
p.... | the_stack_v2_python_sparse | 剑指offer/55、链表中环的入口节点.py | hugechuanqi/Algorithms-and-Data-Structures | train | 3 |
4659a5cc2f4c81be3915805866dc354eeab5a006 | [
"self.dic = collections.defaultdict(list)\nfor i, word in enumerate(words):\n self.dic[word].append(i)\nself.max = len(words)",
"i1_list = self.dic[word1]\ni2_list = self.dic[word2]\ni1 = 0\ni2 = 0\nresult = self.max\nwhile i1 < len(i1_list) and i2 < len(i2_list):\n if i1_list[i1] > i2_list[i2]:\n re... | <|body_start_0|>
self.dic = collections.defaultdict(list)
for i, word in enumerate(words):
self.dic[word].append(i)
self.max = len(words)
<|end_body_0|>
<|body_start_1|>
i1_list = self.dic[word1]
i2_list = self.dic[word2]
i1 = 0
i2 = 0
result ... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.dic = collections.defaultdict(li... | stack_v2_sparse_classes_36k_train_005026 | 982 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | null | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance:
... | 801beb43235872b2419a92b11c4eb05f7ea2adab | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
self.dic = collections.defaultdict(list)
for i, word in enumerate(words):
self.dic[word].append(i)
self.max = len(words)
def shortest(self, word1, word2):
""":type word1: str :type wo... | the_stack_v2_python_sparse | Python/244__Shortest_Word_Distance_II.py | FIRESTROM/Leetcode | train | 2 | |
1a1727d14dacaf7b2061fc5a6f6ce161be1e5396 | [
"checker = [1]\nfor j in range(1, len(s) + 1):\n temp = False\n for i in range(j):\n temp |= checker[i] & (s[i:j] in wordDict)\n checker.append(temp)\nreturn checker[-1]",
"s_map = dict()\n\ndef getWord(s):\n if s in wordDict:\n return True\n if s in s_map:\n return s_map[s]\n ... | <|body_start_0|>
checker = [1]
for j in range(1, len(s) + 1):
temp = False
for i in range(j):
temp |= checker[i] & (s[i:j] in wordDict)
checker.append(temp)
return checker[-1]
<|end_body_0|>
<|body_start_1|>
s_map = dict()
def... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
<|body_0|>
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_005027 | 1,259 | no_license | [
{
"docstring": ":type s: str :type wordDict: List[str] :rtype: bool",
"name": "wordBreak",
"signature": "def wordBreak(self, s, wordDict)"
},
{
"docstring": ":type s: str :type wordDict: List[str] :rtype: bool",
"name": "wordBreak",
"signature": "def wordBreak(self, s, 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): :type s: str :type wordDict: List[str] :rtype: bool
- def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
- def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
<|s... | 2ecaeed38178819480388b5742bc2ea12009ae16 | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
<|body_0|>
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
checker = [1]
for j in range(1, len(s) + 1):
temp = False
for i in range(j):
temp |= checker[i] & (s[i:j] in wordDict)
checker.appen... | the_stack_v2_python_sparse | 139.word-break.py | LouisYLWang/leetcode_python | train | 0 | |
6d30ef48c30e8857b67f36dfeb971554d7d9f7ce | [
"super().__init__(root)\nself._videos, self._gt = self.parse_annotation(positive)\nself._videos, self._distract, self._meta, self._fc = self.read_metadata()",
"annotation = json.load(open(f'{self.root}/dataset/annotation.json', 'r'))\nvideos = set()\ngt = defaultdict(list)\nfor q, ann in annotation.items():\n ... | <|body_start_0|>
super().__init__(root)
self._videos, self._gt = self.parse_annotation(positive)
self._videos, self._distract, self._meta, self._fc = self.read_metadata()
<|end_body_0|>
<|body_start_1|>
annotation = json.load(open(f'{self.root}/dataset/annotation.json', 'r'))
vi... | FIVR | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FIVR:
def __init__(self, root, positive=('ND', 'DS')):
"""'ND': Near-Duplicate - These are a special case of DSVs (all candidate scenes are duplicates with the query scenes). 'DS': Duplicate Scene - DSVs are annotated with this label. 'CS': Complementary Scene - CSVs are annotated with t... | stack_v2_sparse_classes_36k_train_005028 | 2,269 | no_license | [
{
"docstring": "'ND': Near-Duplicate - These are a special case of DSVs (all candidate scenes are duplicates with the query scenes). 'DS': Duplicate Scene - DSVs are annotated with this label. 'CS': Complementary Scene - CSVs are annotated with this label. 'IS': Incident Scene - ISVs are annotated with this lab... | 2 | stack_v2_sparse_classes_30k_train_001694 | Implement the Python class `FIVR` described below.
Class description:
Implement the FIVR class.
Method signatures and docstrings:
- def __init__(self, root, positive=('ND', 'DS')): 'ND': Near-Duplicate - These are a special case of DSVs (all candidate scenes are duplicates with the query scenes). 'DS': Duplicate Scen... | Implement the Python class `FIVR` described below.
Class description:
Implement the FIVR class.
Method signatures and docstrings:
- def __init__(self, root, positive=('ND', 'DS')): 'ND': Near-Duplicate - These are a special case of DSVs (all candidate scenes are duplicates with the query scenes). 'DS': Duplicate Scen... | 1230a628befc58b83951d4c899e191682165d8de | <|skeleton|>
class FIVR:
def __init__(self, root, positive=('ND', 'DS')):
"""'ND': Near-Duplicate - These are a special case of DSVs (all candidate scenes are duplicates with the query scenes). 'DS': Duplicate Scene - DSVs are annotated with this label. 'CS': Complementary Scene - CSVs are annotated with t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FIVR:
def __init__(self, root, positive=('ND', 'DS')):
"""'ND': Near-Duplicate - These are a special case of DSVs (all candidate scenes are duplicates with the query scenes). 'DS': Duplicate Scene - DSVs are annotated with this label. 'CS': Complementary Scene - CSVs are annotated with this label. 'IS... | the_stack_v2_python_sparse | soruce_code/VCD/datasets/fivr.py | ttyon/CSE6463_term_project | train | 0 | |
669e3e0aefdd316cde52ab54baf39da693c12c54 | [
"self.k = k\nself.heap = nums\nheapq.heapify(self.heap)\nreduce = len(nums) - k\nwhile reduce > 0:\n heapq.heappop(self.heap)\n reduce -= 1",
"heapq.heappush(self.heap, val)\nif len(self.heap) > self.k:\n heapq.heappop(self.heap)\nreturn self.heap[0]"
] | <|body_start_0|>
self.k = k
self.heap = nums
heapq.heapify(self.heap)
reduce = len(nums) - k
while reduce > 0:
heapq.heappop(self.heap)
reduce -= 1
<|end_body_0|>
<|body_start_1|>
heapq.heappush(self.heap, val)
if len(self.heap) > self.k:
... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.heap = nums
heapq.heapify(... | stack_v2_sparse_classes_36k_train_005029 | 875 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | null | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | 85128e7d26157b3c36eb43868269de42ea2fcb98 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.heap = nums
heapq.heapify(self.heap)
reduce = len(nums) - k
while reduce > 0:
heapq.heappop(self.heap)
reduce -= 1
def add(self, val):
... | the_stack_v2_python_sparse | src/KthLargest.py | jsdiuf/leetcode | train | 1 | |
52b95326eb5183ab8628d0a34c59b46b9fe72bec | [
"if len(inputFiles) == 0:\n self.inputFiles = glob.glob('z_ls-R_contents-*.txt')\nelse:\n self.inputFiles = list(inputFiles)\nself.process()",
"for i, inputFile in enumerate(self.inputFiles):\n seqInputFile = i + 1\n print(str(seqInputFile) + ' Processing ' + inputFile)\n newText = ''\n saveAppl... | <|body_start_0|>
if len(inputFiles) == 0:
self.inputFiles = glob.glob('z_ls-R_contents-*.txt')
else:
self.inputFiles = list(inputFiles)
self.process()
<|end_body_0|>
<|body_start_1|>
for i, inputFile in enumerate(self.inputFiles):
seqInputFile = i + 1... | FileSizeMinimizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileSizeMinimizer:
def __init__(self, inputFiles=[]):
""":param inputFiles:"""
<|body_0|>
def process(self):
""":return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(inputFiles) == 0:
self.inputFiles = glob.glob('z_ls-R_content... | stack_v2_sparse_classes_36k_train_005030 | 3,244 | no_license | [
{
"docstring": ":param inputFiles:",
"name": "__init__",
"signature": "def __init__(self, inputFiles=[])"
},
{
"docstring": ":return:",
"name": "process",
"signature": "def process(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019221 | Implement the Python class `FileSizeMinimizer` described below.
Class description:
Implement the FileSizeMinimizer class.
Method signatures and docstrings:
- def __init__(self, inputFiles=[]): :param inputFiles:
- def process(self): :return: | Implement the Python class `FileSizeMinimizer` described below.
Class description:
Implement the FileSizeMinimizer class.
Method signatures and docstrings:
- def __init__(self, inputFiles=[]): :param inputFiles:
- def process(self): :return:
<|skeleton|>
class FileSizeMinimizer:
def __init__(self, inputFiles=[]... | b4c5642c8d5843846d529630f8d93a7103676539 | <|skeleton|>
class FileSizeMinimizer:
def __init__(self, inputFiles=[]):
""":param inputFiles:"""
<|body_0|>
def process(self):
""":return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileSizeMinimizer:
def __init__(self, inputFiles=[]):
""":param inputFiles:"""
if len(inputFiles) == 0:
self.inputFiles = glob.glob('z_ls-R_contents-*.txt')
else:
self.inputFiles = list(inputFiles)
self.process()
def process(self):
""":retur... | the_stack_v2_python_sparse | uTubeCompressContentsTxt.py | alclass/bin | train | 0 | |
4f7f5caa66680656ab52cea86c52a5ea24f860aa | [
"self.cassandra_additional_info = cassandra_additional_info\nself.cassandra_source_version = cassandra_source_version\nself.selected_data_center_vec = selected_data_center_vec\nself.staging_directory_vec = staging_directory_vec\nself.suffix = suffix",
"if dictionary is None:\n return None\ncassandra_additional... | <|body_start_0|>
self.cassandra_additional_info = cassandra_additional_info
self.cassandra_source_version = cassandra_source_version
self.selected_data_center_vec = selected_data_center_vec
self.staging_directory_vec = staging_directory_vec
self.suffix = suffix
<|end_body_0|>
<|... | Implementation of the 'CassandraRecoverJobParams' model. Contains any additional cassandra environment specific params for the recover job. Attributes: cassandra_additional_info (CassandraAdditionalParams): Additional parameters required for Cassandra recovery. TODO (faizan.khan) : Remove this. cassandra_source_version... | CassandraRecoverJobParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CassandraRecoverJobParams:
"""Implementation of the 'CassandraRecoverJobParams' model. Contains any additional cassandra environment specific params for the recover job. Attributes: cassandra_additional_info (CassandraAdditionalParams): Additional parameters required for Cassandra recovery. TODO ... | stack_v2_sparse_classes_36k_train_005031 | 3,238 | permissive | [
{
"docstring": "Constructor for the CassandraRecoverJobParams class",
"name": "__init__",
"signature": "def __init__(self, cassandra_additional_info=None, cassandra_source_version=None, selected_data_center_vec=None, staging_directory_vec=None, suffix=None)"
},
{
"docstring": "Creates an instanc... | 2 | stack_v2_sparse_classes_30k_train_015040 | Implement the Python class `CassandraRecoverJobParams` described below.
Class description:
Implementation of the 'CassandraRecoverJobParams' model. Contains any additional cassandra environment specific params for the recover job. Attributes: cassandra_additional_info (CassandraAdditionalParams): Additional parameters... | Implement the Python class `CassandraRecoverJobParams` described below.
Class description:
Implementation of the 'CassandraRecoverJobParams' model. Contains any additional cassandra environment specific params for the recover job. Attributes: cassandra_additional_info (CassandraAdditionalParams): Additional parameters... | 0093194d125fc6746f55b8499da1270c64f473fc | <|skeleton|>
class CassandraRecoverJobParams:
"""Implementation of the 'CassandraRecoverJobParams' model. Contains any additional cassandra environment specific params for the recover job. Attributes: cassandra_additional_info (CassandraAdditionalParams): Additional parameters required for Cassandra recovery. TODO ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CassandraRecoverJobParams:
"""Implementation of the 'CassandraRecoverJobParams' model. Contains any additional cassandra environment specific params for the recover job. Attributes: cassandra_additional_info (CassandraAdditionalParams): Additional parameters required for Cassandra recovery. TODO (faizan.khan)... | the_stack_v2_python_sparse | cohesity_management_sdk/models/cassandra_recover_job_params.py | hsantoyo2/management-sdk-python | train | 0 |
f49af14e14b8ed8676b981bfc5188d02a4aa2bc7 | [
"l, i = (len(nums), 0)\nif l > 1:\n n = 0\n while i < l:\n if nums[i] != 0:\n nums[n], nums[i] = (nums[i], nums[n])\n n += 1\n i += 1",
"l, i = (len(nums), 0)\nif l > 1:\n n = 0\n while i < l:\n if nums[i] != 0:\n if i != n:\n nums[n... | <|body_start_0|>
l, i = (len(nums), 0)
if l > 1:
n = 0
while i < l:
if nums[i] != 0:
nums[n], nums[i] = (nums[i], nums[n])
n += 1
i += 1
<|end_body_0|>
<|body_start_1|>
l, i = (len(nums), 0)
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes2(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k_train_005032 | 1,640 | permissive | [
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes",
"signature": "def moveZeroes(self, nums: List[int]) -> None"
},
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes2",
"signature": "def moveZeroes2(self,... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead.
- def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, mod... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead.
- def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, mod... | f15d1f8435cf7b6c7746b42139225e5102a2e401 | <|skeleton|>
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes2(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
l, i = (len(nums), 0)
if l > 1:
n = 0
while i < l:
if nums[i] != 0:
nums[n], nums[i] = (nums[i], nums[n])
... | the_stack_v2_python_sparse | src/283.move-zeroes/283.move-zeroes.py | AnestLarry/LeetCodeAnswer | train | 0 | |
8b59c05981957880efe0e835a5022b301bc4801e | [
"guess_str = (str(parent_hash) + str(merkle_root) + str(nonce)).encode('utf8')\nguess_hash = FuncUtil.hashfunc_sha256(guess_str)\nreturn guess_hash[:difficulty] == '0' * difficulty",
"nonce = 0\nwhile POW.valid_proof(parent_hash, merkle_root, nonce) is False:\n nonce += 1\nreturn nonce"
] | <|body_start_0|>
guess_str = (str(parent_hash) + str(merkle_root) + str(nonce)).encode('utf8')
guess_hash = FuncUtil.hashfunc_sha256(guess_str)
return guess_hash[:difficulty] == '0' * difficulty
<|end_body_0|>
<|body_start_1|>
nonce = 0
while POW.valid_proof(parent_hash, merkle_... | Proof-of-Work consenses mechanism | POW | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class POW:
"""Proof-of-Work consenses mechanism"""
def valid_proof(parent_hash, merkle_root, nonce, difficulty=MINING_DIFFICULTY):
"""Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: The hash of parent block @ merkle_root: merkle tree root of transa... | stack_v2_sparse_classes_36k_train_005033 | 3,326 | no_license | [
{
"docstring": "Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: The hash of parent block @ merkle_root: merkle tree root of transactions in block @ nonce: the random number used in PoW guess",
"name": "valid_proof",
"signature": "def valid_proof(parent_hash, mer... | 2 | null | Implement the Python class `POW` described below.
Class description:
Proof-of-Work consenses mechanism
Method signatures and docstrings:
- def valid_proof(parent_hash, merkle_root, nonce, difficulty=MINING_DIFFICULTY): Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: The hash ... | Implement the Python class `POW` described below.
Class description:
Proof-of-Work consenses mechanism
Method signatures and docstrings:
- def valid_proof(parent_hash, merkle_root, nonce, difficulty=MINING_DIFFICULTY): Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: The hash ... | 03ff57e6fe0114ffd2dd953e79a73a893a6bc0ad | <|skeleton|>
class POW:
"""Proof-of-Work consenses mechanism"""
def valid_proof(parent_hash, merkle_root, nonce, difficulty=MINING_DIFFICULTY):
"""Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: The hash of parent block @ merkle_root: merkle tree root of transa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class POW:
"""Proof-of-Work consenses mechanism"""
def valid_proof(parent_hash, merkle_root, nonce, difficulty=MINING_DIFFICULTY):
"""Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: The hash of parent block @ merkle_root: merkle tree root of transactions in blo... | the_stack_v2_python_sparse | Security/py_dev/VDF_chain/consensus/consensus.py | samuelxu999/Research | train | 1 |
335b790afd62be3cfc82a768f6915eca8270463b | [
"Parametre.__init__(self, 'bug', 'bug')\nself.groupe = 'joueur'\nself.schema = '(<message>)'\nself.aide_courte = 'crée un rapport de bug'\nself.aide_longue = \"Cette commande permet de créer un nouveau rapport de bug. Vous devez préciser en argument le titre du rapport à créer. Un éditeur s'ouvrira alors pour vous ... | <|body_start_0|>
Parametre.__init__(self, 'bug', 'bug')
self.groupe = 'joueur'
self.schema = '(<message>)'
self.aide_courte = 'crée un rapport de bug'
self.aide_longue = "Cette commande permet de créer un nouveau rapport de bug. Vous devez préciser en argument le titre du rapport... | Commande 'rapport bug' | PrmBug | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmBug:
"""Commande 'rapport bug'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parametr... | stack_v2_sparse_classes_36k_train_005034 | 3,531 | permissive | [
{
"docstring": "Constructeur du paramètre.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Méthode d'interprétation de commande",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001363 | Implement the Python class `PrmBug` described below.
Class description:
Commande 'rapport bug'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande | Implement the Python class `PrmBug` described below.
Class description:
Commande 'rapport bug'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
<|skeleton|>
class PrmBug:
"""Commande 'rapport ... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmBug:
"""Commande 'rapport bug'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrmBug:
"""Commande 'rapport bug'"""
def __init__(self):
"""Constructeur du paramètre."""
Parametre.__init__(self, 'bug', 'bug')
self.groupe = 'joueur'
self.schema = '(<message>)'
self.aide_courte = 'crée un rapport de bug'
self.aide_longue = "Cette command... | the_stack_v2_python_sparse | src/secondaires/rapport/commandes/rapport/bug.py | vincent-lg/tsunami | train | 5 |
5a5321c6f1fa9b65ee59756fcf018ad763ec19f4 | [
"connection_created.connect(self.activate_pragmas_per_connection)\nself.activate_pragmas_on_start()\nlogger.info('Running Kolibri with the following settings: {settings}'.format(settings=os.environ['DJANGO_SETTINGS_MODULE']))",
"if connection.vendor == 'sqlite':\n cursor = connection.cursor()\n cursor.execu... | <|body_start_0|>
connection_created.connect(self.activate_pragmas_per_connection)
self.activate_pragmas_on_start()
logger.info('Running Kolibri with the following settings: {settings}'.format(settings=os.environ['DJANGO_SETTINGS_MODULE']))
<|end_body_0|>
<|body_start_1|>
if connection.v... | KolibriCoreConfig | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KolibriCoreConfig:
def ready(self):
"""Sets up PRAGMAs."""
<|body_0|>
def activate_pragmas_per_connection(sender, connection, **kwargs):
"""Activate SQLite3 PRAGMAs that apply on a per-connection basis. A no-op right now, but kept around as infrastructure if we ever ... | stack_v2_sparse_classes_36k_train_005035 | 2,504 | permissive | [
{
"docstring": "Sets up PRAGMAs.",
"name": "ready",
"signature": "def ready(self)"
},
{
"docstring": "Activate SQLite3 PRAGMAs that apply on a per-connection basis. A no-op right now, but kept around as infrastructure if we ever want to add PRAGMAs in the future.",
"name": "activate_pragmas_... | 3 | stack_v2_sparse_classes_30k_train_019307 | Implement the Python class `KolibriCoreConfig` described below.
Class description:
Implement the KolibriCoreConfig class.
Method signatures and docstrings:
- def ready(self): Sets up PRAGMAs.
- def activate_pragmas_per_connection(sender, connection, **kwargs): Activate SQLite3 PRAGMAs that apply on a per-connection b... | Implement the Python class `KolibriCoreConfig` described below.
Class description:
Implement the KolibriCoreConfig class.
Method signatures and docstrings:
- def ready(self): Sets up PRAGMAs.
- def activate_pragmas_per_connection(sender, connection, **kwargs): Activate SQLite3 PRAGMAs that apply on a per-connection b... | 11e0d01e2bc43850a6dfd4238e6408004449c3dc | <|skeleton|>
class KolibriCoreConfig:
def ready(self):
"""Sets up PRAGMAs."""
<|body_0|>
def activate_pragmas_per_connection(sender, connection, **kwargs):
"""Activate SQLite3 PRAGMAs that apply on a per-connection basis. A no-op right now, but kept around as infrastructure if we ever ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KolibriCoreConfig:
def ready(self):
"""Sets up PRAGMAs."""
connection_created.connect(self.activate_pragmas_per_connection)
self.activate_pragmas_on_start()
logger.info('Running Kolibri with the following settings: {settings}'.format(settings=os.environ['DJANGO_SETTINGS_MODULE'... | the_stack_v2_python_sparse | kolibri/core/apps.py | lyw07/kolibri | train | 1 | |
ac6f6e4562fd9031640c99cb8776d4d031262040 | [
"super().__init__('data_generation_params')\nself.description = description\nself.init_values = {'threshold_empty_data': 0.0, 'data_name': os.path.join('data', str('tmp_data')), 'save_data': False, 'visualize': False, 'width': 16, 'height': 16, 'create_n_files': 1, 'data_set': 'train', 'time_steps': 150, 'dt': 0.1,... | <|body_start_0|>
super().__init__('data_generation_params')
self.description = description
self.init_values = {'threshold_empty_data': 0.0, 'data_name': os.path.join('data', str('tmp_data')), 'save_data': False, 'visualize': False, 'width': 16, 'height': 16, 'create_n_files': 1, 'data_set': 'tra... | Specifying the parameters and command line arguments for the use case of the data generation. The superclass Params is doing the management of the parameters. | DataGenerationParams | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataGenerationParams:
"""Specifying the parameters and command line arguments for the use case of the data generation. The superclass Params is doing the management of the parameters."""
def __init__(self, description: str):
"""Initialisation of DataGenerationParams. :param descripti... | stack_v2_sparse_classes_36k_train_005036 | 6,028 | no_license | [
{
"docstring": "Initialisation of DataGenerationParams. :param description: descripton of use case.",
"name": "__init__",
"signature": "def __init__(self, description: str)"
},
{
"docstring": "Parsing Options from the command line :return: parameters as dictionary",
"name": "parse_params",
... | 2 | null | Implement the Python class `DataGenerationParams` described below.
Class description:
Specifying the parameters and command line arguments for the use case of the data generation. The superclass Params is doing the management of the parameters.
Method signatures and docstrings:
- def __init__(self, description: str):... | Implement the Python class `DataGenerationParams` described below.
Class description:
Specifying the parameters and command line arguments for the use case of the data generation. The superclass Params is doing the management of the parameters.
Method signatures and docstrings:
- def __init__(self, description: str):... | dbe41a4b6d2cd4eeff86eebae27ad7fd2a348bd3 | <|skeleton|>
class DataGenerationParams:
"""Specifying the parameters and command line arguments for the use case of the data generation. The superclass Params is doing the management of the parameters."""
def __init__(self, description: str):
"""Initialisation of DataGenerationParams. :param descripti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataGenerationParams:
"""Specifying the parameters and command line arguments for the use case of the data generation. The superclass Params is doing the management of the parameters."""
def __init__(self, description: str):
"""Initialisation of DataGenerationParams. :param description: descripto... | the_stack_v2_python_sparse | code/config/data_generation_params.py | larsgehrke/mt | train | 0 |
f3ea8c986fcefa31ee3e684132083cf896b1aea6 | [
"self.storage = storage\nself.email_sender = email_sender\nself.ses_client = ses_client",
"msg = MIMEMultipart('mixed')\nmsg['Subject'] = 'Work items'\nmsg['From'] = self.email_sender\nmsg['To'] = recipient\nmsg_body = MIMEMultipart('alternative')\ntextpart = MIMEText(text.encode(charset), 'plain', charset)\nhtml... | <|body_start_0|>
self.storage = storage
self.email_sender = email_sender
self.ses_client = ses_client
<|end_body_0|>
<|body_start_1|>
msg = MIMEMultipart('mixed')
msg['Subject'] = 'Work items'
msg['From'] = self.email_sender
msg['To'] = recipient
msg_body... | Encapsulates a report resource that gets work items from an Amazon Aurora Serverless database and uses Amazon SES to send emails about them. | Report | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Report:
"""Encapsulates a report resource that gets work items from an Amazon Aurora Serverless database and uses Amazon SES to send emails about them."""
def __init__(self, storage, email_sender, ses_client):
""":param storage: An object that manages moving data in and out of the un... | stack_v2_sparse_classes_36k_train_005037 | 5,653 | permissive | [
{
"docstring": ":param storage: An object that manages moving data in and out of the underlying database. :param email_sender: The email address from which the email report is sent. :param ses_client: A Boto3 Amazon SES client.",
"name": "__init__",
"signature": "def __init__(self, storage, email_sender... | 4 | stack_v2_sparse_classes_30k_train_010956 | Implement the Python class `Report` described below.
Class description:
Encapsulates a report resource that gets work items from an Amazon Aurora Serverless database and uses Amazon SES to send emails about them.
Method signatures and docstrings:
- def __init__(self, storage, email_sender, ses_client): :param storage... | Implement the Python class `Report` described below.
Class description:
Encapsulates a report resource that gets work items from an Amazon Aurora Serverless database and uses Amazon SES to send emails about them.
Method signatures and docstrings:
- def __init__(self, storage, email_sender, ses_client): :param storage... | dec41fb589043ac9d8667aac36fb88a53c3abe50 | <|skeleton|>
class Report:
"""Encapsulates a report resource that gets work items from an Amazon Aurora Serverless database and uses Amazon SES to send emails about them."""
def __init__(self, storage, email_sender, ses_client):
""":param storage: An object that manages moving data in and out of the un... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Report:
"""Encapsulates a report resource that gets work items from an Amazon Aurora Serverless database and uses Amazon SES to send emails about them."""
def __init__(self, storage, email_sender, ses_client):
""":param storage: An object that manages moving data in and out of the underlying data... | the_stack_v2_python_sparse | python/cross_service/aurora_item_tracker/report.py | awsdocs/aws-doc-sdk-examples | train | 8,240 |
c3f852b35705f28fba94e3603d320e96e4341a99 | [
"self.screen = screen\nself.image_3_lives = pygame.image.load('images/player_life_3.png')\nself.image_2_lives = pygame.image.load('images/player_life_2.png')\nself.image_1_lives = pygame.image.load('images/player_life_1.png')\nself.rect_3 = self.image_3_lives.get_rect()\nself.rect_2 = self.image_2_lives.get_rect()\... | <|body_start_0|>
self.screen = screen
self.image_3_lives = pygame.image.load('images/player_life_3.png')
self.image_2_lives = pygame.image.load('images/player_life_2.png')
self.image_1_lives = pygame.image.load('images/player_life_1.png')
self.rect_3 = self.image_3_lives.get_rect... | A class for drawing thumbnails of player lives. | PlayerLives | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlayerLives:
"""A class for drawing thumbnails of player lives."""
def __init__(self, screen):
"""Initializes with 3 thumbnails."""
<|body_0|>
def blitme(self, stats):
"""Draws the current number of lives."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_005038 | 9,447 | no_license | [
{
"docstring": "Initializes with 3 thumbnails.",
"name": "__init__",
"signature": "def __init__(self, screen)"
},
{
"docstring": "Draws the current number of lives.",
"name": "blitme",
"signature": "def blitme(self, stats)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016534 | Implement the Python class `PlayerLives` described below.
Class description:
A class for drawing thumbnails of player lives.
Method signatures and docstrings:
- def __init__(self, screen): Initializes with 3 thumbnails.
- def blitme(self, stats): Draws the current number of lives. | Implement the Python class `PlayerLives` described below.
Class description:
A class for drawing thumbnails of player lives.
Method signatures and docstrings:
- def __init__(self, screen): Initializes with 3 thumbnails.
- def blitme(self, stats): Draws the current number of lives.
<|skeleton|>
class PlayerLives:
... | 98b36e145b96bd25c8efaba93b0f85835ee1ea6b | <|skeleton|>
class PlayerLives:
"""A class for drawing thumbnails of player lives."""
def __init__(self, screen):
"""Initializes with 3 thumbnails."""
<|body_0|>
def blitme(self, stats):
"""Draws the current number of lives."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PlayerLives:
"""A class for drawing thumbnails of player lives."""
def __init__(self, screen):
"""Initializes with 3 thumbnails."""
self.screen = screen
self.image_3_lives = pygame.image.load('images/player_life_3.png')
self.image_2_lives = pygame.image.load('images/player... | the_stack_v2_python_sparse | player.py | ddrifter/drifting1 | train | 2 |
79f37031990247e176d226b25d3b88cbfc1d69b9 | [
"self.vec2d = vec2d\nself.i = 0\nself.j = 0",
"ret = None\nif self.hasNext():\n ret = self.vec2d[self.i][self.j]\n self.j += 1\nreturn ret",
"while self.i < len(self.vec2d) and self.j >= len(self.vec2d[self.i]):\n self.i += 1\n self.j = 0\nreturn self.i < len(self.vec2d) and self.j < len(self.vec2d[... | <|body_start_0|>
self.vec2d = vec2d
self.i = 0
self.j = 0
<|end_body_0|>
<|body_start_1|>
ret = None
if self.hasNext():
ret = self.vec2d[self.i][self.j]
self.j += 1
return ret
<|end_body_1|>
<|body_start_2|>
while self.i < len(self.vec2d)... | Vector2D | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vector2D:
def __init__(self, vec2d):
""":type vec2d: list[list[int]] :type: None"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
"""This function structures the two pointers. :rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_36k_train_005039 | 784 | permissive | [
{
"docstring": ":type vec2d: list[list[int]] :type: None",
"name": "__init__",
"signature": "def __init__(self, vec2d)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": "This function structures the two pointers. :rtype: bool",
... | 3 | null | Implement the Python class `Vector2D` described below.
Class description:
Implement the Vector2D class.
Method signatures and docstrings:
- def __init__(self, vec2d): :type vec2d: list[list[int]] :type: None
- def next(self): :rtype: int
- def hasNext(self): This function structures the two pointers. :rtype: bool | Implement the Python class `Vector2D` described below.
Class description:
Implement the Vector2D class.
Method signatures and docstrings:
- def __init__(self, vec2d): :type vec2d: list[list[int]] :type: None
- def next(self): :rtype: int
- def hasNext(self): This function structures the two pointers. :rtype: bool
<|... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class Vector2D:
def __init__(self, vec2d):
""":type vec2d: list[list[int]] :type: None"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
"""This function structures the two pointers. :rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vector2D:
def __init__(self, vec2d):
""":type vec2d: list[list[int]] :type: None"""
self.vec2d = vec2d
self.i = 0
self.j = 0
def next(self):
""":rtype: int"""
ret = None
if self.hasNext():
ret = self.vec2d[self.i][self.j]
sel... | the_stack_v2_python_sparse | 251 Flatten 2D Vector.py | Aminaba123/LeetCode | train | 1 | |
cec87d6f2772a3d185926f847cd20a8e0664ed83 | [
"filepath = os.path.join(downdir, filename)\nlogger.debug(filepath)\nif os.path.exists(filepath):\n result = financial.FinancialReader().to_data(filepath)\n return result\nlogger.error('文件不存在:{}'.format(filename))\nreturn None",
"history = financial.FinancialList()\nresults = history.fetch_and_parse()\nretu... | <|body_start_0|>
filepath = os.path.join(downdir, filename)
logger.debug(filepath)
if os.path.exists(filepath):
result = financial.FinancialReader().to_data(filepath)
return result
logger.error('文件不存在:{}'.format(filename))
return None
<|end_body_0|>
<|bod... | Affair | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Affair:
def parse(downdir='.', filename=None, *args, **kwargs):
"""按目录解析文件 :param downdir: :param filename: :param kwargs: :return:"""
<|body_0|>
def files():
"""财务文件列表 :return:"""
<|body_1|>
def fetch(downdir='.', filename=None, *args, **kwargs):
... | stack_v2_sparse_classes_36k_train_005040 | 2,643 | permissive | [
{
"docstring": "按目录解析文件 :param downdir: :param filename: :param kwargs: :return:",
"name": "parse",
"signature": "def parse(downdir='.', filename=None, *args, **kwargs)"
},
{
"docstring": "财务文件列表 :return:",
"name": "files",
"signature": "def files()"
},
{
"docstring": "财务数据下载 :pa... | 3 | stack_v2_sparse_classes_30k_train_014580 | Implement the Python class `Affair` described below.
Class description:
Implement the Affair class.
Method signatures and docstrings:
- def parse(downdir='.', filename=None, *args, **kwargs): 按目录解析文件 :param downdir: :param filename: :param kwargs: :return:
- def files(): 财务文件列表 :return:
- def fetch(downdir='.', filen... | Implement the Python class `Affair` described below.
Class description:
Implement the Affair class.
Method signatures and docstrings:
- def parse(downdir='.', filename=None, *args, **kwargs): 按目录解析文件 :param downdir: :param filename: :param kwargs: :return:
- def files(): 财务文件列表 :return:
- def fetch(downdir='.', filen... | dd3065f3189eacc0ba6efbd17f60e9848bbffcd4 | <|skeleton|>
class Affair:
def parse(downdir='.', filename=None, *args, **kwargs):
"""按目录解析文件 :param downdir: :param filename: :param kwargs: :return:"""
<|body_0|>
def files():
"""财务文件列表 :return:"""
<|body_1|>
def fetch(downdir='.', filename=None, *args, **kwargs):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Affair:
def parse(downdir='.', filename=None, *args, **kwargs):
"""按目录解析文件 :param downdir: :param filename: :param kwargs: :return:"""
filepath = os.path.join(downdir, filename)
logger.debug(filepath)
if os.path.exists(filepath):
result = financial.FinancialReader()... | the_stack_v2_python_sparse | mootdx/affair.py | sxlxnyw/mootdx | train | 2 | |
fce0ccee5412745a1d1f4e238e8c8be58210a851 | [
"super(focal_loss, self).__init__()\nself.size_average = size_average\nif isinstance(alpha, list):\n assert len(alpha) == num_classes\n print(' --- Focal_loss alpha = {}, 将对每一类权重进行精细化赋值 --- '.format(alpha))\n self.alpha = torch.Tensor(alpha)\nelse:\n assert alpha < 1\n print(' --- Focal_loss alpha = ... | <|body_start_0|>
super(focal_loss, self).__init__()
self.size_average = size_average
if isinstance(alpha, list):
assert len(alpha) == num_classes
print(' --- Focal_loss alpha = {}, 将对每一类权重进行精细化赋值 --- '.format(alpha))
self.alpha = torch.Tensor(alpha)
el... | focal_loss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class focal_loss:
def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True):
"""focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样... | stack_v2_sparse_classes_36k_train_005041 | 7,025 | no_license | [
{
"docstring": "focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本调节参数. retainnet中设置为2 :param num_classes: 类别数量 :param size_average: 损失计算方式,默认取均值",
"name": "__... | 2 | stack_v2_sparse_classes_30k_train_006200 | Implement the Python class `focal_loss` described below.
Class description:
Implement the focal_loss class.
Method signatures and docstrings:
- def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True): focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表... | Implement the Python class `focal_loss` described below.
Class description:
Implement the focal_loss class.
Method signatures and docstrings:
- def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True): focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表... | aeeb537faa10dd32b28c9fce14b074540e5b93e3 | <|skeleton|>
class focal_loss:
def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True):
"""focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class focal_loss:
def __init__(self, alpha=0.25, gamma=2, num_classes=3, size_average=True):
"""focal_loss损失函数, -α(1-yi)**γ *ce_loss(xi,yi) 步骤详细的实现了 focal_loss损失函数. :param alpha: 阿尔法α,类别权重. 当α是列表时,为各类别权重,当α为常数时,类别权重为[α, 1-α, 1-α, ....],常用于 目标检测算法中抑制背景类 , retainnet中设置为0.25 :param gamma: 伽马γ,难易样本调节参数. retainn... | the_stack_v2_python_sparse | LSTM/model.py | suoyuxi/DIDI-Prediction | train | 0 | |
cd16117b7faee71f063c9cbe25eb48eaec6c1a2d | [
"username = self.get_cookie('username')\npage = int(self.get_argument('page', 1))\nsearchKey = self.get_argument('searchKey', None)\npagesize = int(self.get_argument('pagesize', self._PageSize))\ntotalquery = self.db.query(ReadyReleaseServer.Id)\nNgReleaseObj = self.db.query(ReadyReleaseServer)\nif searchKey:\n ... | <|body_start_0|>
username = self.get_cookie('username')
page = int(self.get_argument('page', 1))
searchKey = self.get_argument('searchKey', None)
pagesize = int(self.get_argument('pagesize', self._PageSize))
totalquery = self.db.query(ReadyReleaseServer.Id)
NgReleaseObj =... | ReadyHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReadyHandler:
def get(self, ident):
"""获取预生产发布信息"""
<|body_0|>
def post(self, ident=0):
"""预生产创建nginx及consul"""
<|body_1|>
def delete(self, ident):
"""预生产删除nginx及consul"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
username = ... | stack_v2_sparse_classes_36k_train_005042 | 2,915 | no_license | [
{
"docstring": "获取预生产发布信息",
"name": "get",
"signature": "def get(self, ident)"
},
{
"docstring": "预生产创建nginx及consul",
"name": "post",
"signature": "def post(self, ident=0)"
},
{
"docstring": "预生产删除nginx及consul",
"name": "delete",
"signature": "def delete(self, ident)"
}... | 3 | stack_v2_sparse_classes_30k_train_007398 | Implement the Python class `ReadyHandler` described below.
Class description:
Implement the ReadyHandler class.
Method signatures and docstrings:
- def get(self, ident): 获取预生产发布信息
- def post(self, ident=0): 预生产创建nginx及consul
- def delete(self, ident): 预生产删除nginx及consul | Implement the Python class `ReadyHandler` described below.
Class description:
Implement the ReadyHandler class.
Method signatures and docstrings:
- def get(self, ident): 获取预生产发布信息
- def post(self, ident=0): 预生产创建nginx及consul
- def delete(self, ident): 预生产删除nginx及consul
<|skeleton|>
class ReadyHandler:
def get(s... | 827a2539f26048ee885882425a2e52a086e4caa4 | <|skeleton|>
class ReadyHandler:
def get(self, ident):
"""获取预生产发布信息"""
<|body_0|>
def post(self, ident=0):
"""预生产创建nginx及consul"""
<|body_1|>
def delete(self, ident):
"""预生产删除nginx及consul"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReadyHandler:
def get(self, ident):
"""获取预生产发布信息"""
username = self.get_cookie('username')
page = int(self.get_argument('page', 1))
searchKey = self.get_argument('searchKey', None)
pagesize = int(self.get_argument('pagesize', self._PageSize))
totalquery = self.d... | the_stack_v2_python_sparse | Api/Release/Handler/ReadyReleaseHandler.py | liuwei881/OpenPlatform | train | 1 | |
205cc4c2ace0f961ed950863bb236ffe9cfe5070 | [
"polling_interval = kwargs.pop('_polling_interval', 5)\nsas_parameter = self._models.SASTokenParameter(storage_resource_uri=blob_storage_url, token=sas_token)\ncontinuation_token = kwargs.pop('continuation_token', None)\nstatus_response = None\nif continuation_token:\n status_url = base64.b64decode(continuation_... | <|body_start_0|>
polling_interval = kwargs.pop('_polling_interval', 5)
sas_parameter = self._models.SASTokenParameter(storage_resource_uri=blob_storage_url, token=sas_token)
continuation_token = kwargs.pop('continuation_token', None)
status_response = None
if continuation_token:
... | Performs Key Vault backup and restore operations. :param str vault_url: URL of the vault on which the client will operate. This is also called the vault's "DNS Name". You should validate that this URL references a valid Key Vault or Managed HSM resource. See https://aka.ms/azsdk/blog/vault-uri for details. :param crede... | KeyVaultBackupClient | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LGPL-2.1-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeyVaultBackupClient:
"""Performs Key Vault backup and restore operations. :param str vault_url: URL of the vault on which the client will operate. This is also called the vault's "DNS Name". You should validate that this URL references a valid Key Vault or Managed HSM resource. See https://aka.m... | stack_v2_sparse_classes_36k_train_005043 | 8,780 | permissive | [
{
"docstring": "Begin a full backup of the Key Vault. :param str blob_storage_url: URL of the blob storage container in which the backup will be stored, for example https://<account>.blob.core.windows.net/backup :param str sas_token: a Shared Access Signature (SAS) token authorizing access to the blob storage r... | 2 | stack_v2_sparse_classes_30k_train_005090 | Implement the Python class `KeyVaultBackupClient` described below.
Class description:
Performs Key Vault backup and restore operations. :param str vault_url: URL of the vault on which the client will operate. This is also called the vault's "DNS Name". You should validate that this URL references a valid Key Vault or ... | Implement the Python class `KeyVaultBackupClient` described below.
Class description:
Performs Key Vault backup and restore operations. :param str vault_url: URL of the vault on which the client will operate. This is also called the vault's "DNS Name". You should validate that this URL references a valid Key Vault or ... | c2ca191e736bb06bfbbbc9493e8325763ba990bb | <|skeleton|>
class KeyVaultBackupClient:
"""Performs Key Vault backup and restore operations. :param str vault_url: URL of the vault on which the client will operate. This is also called the vault's "DNS Name". You should validate that this URL references a valid Key Vault or Managed HSM resource. See https://aka.m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KeyVaultBackupClient:
"""Performs Key Vault backup and restore operations. :param str vault_url: URL of the vault on which the client will operate. This is also called the vault's "DNS Name". You should validate that this URL references a valid Key Vault or Managed HSM resource. See https://aka.ms/azsdk/blog/... | the_stack_v2_python_sparse | sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_backup_client.py | Azure/azure-sdk-for-python | train | 4,046 |
33ac73bcb1e933d88a3d0a9674638f16231a8914 | [
"parser.add_argument('-f', '--force', action='store_true', help='Retry edX enrollment even if the target users enrollments indicate edx_enrolled=True')\nparser.add_argument('--run', type=str, help=\"The 'courseware_id' value for a target CourseRun\")\nparser.add_argument('uservalues', nargs='*', type=str, help='The... | <|body_start_0|>
parser.add_argument('-f', '--force', action='store_true', help='Retry edX enrollment even if the target users enrollments indicate edx_enrolled=True')
parser.add_argument('--run', type=str, help="The 'courseware_id' value for a target CourseRun")
parser.add_argument('uservalues'... | Management command to retry edX enrollment for a user's course run enrollments | Command | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""Management command to retry edX enrollment for a user's course run enrollments"""
def add_arguments(self, parser):
"""Definition of arguments this command accepts"""
<|body_0|>
def handle(self, *args, **options):
"""Run the command"""
<|body_1... | stack_v2_sparse_classes_36k_train_005044 | 2,956 | permissive | [
{
"docstring": "Definition of arguments this command accepts",
"name": "add_arguments",
"signature": "def add_arguments(self, parser)"
},
{
"docstring": "Run the command",
"name": "handle",
"signature": "def handle(self, *args, **options)"
}
] | 2 | null | Implement the Python class `Command` described below.
Class description:
Management command to retry edX enrollment for a user's course run enrollments
Method signatures and docstrings:
- def add_arguments(self, parser): Definition of arguments this command accepts
- def handle(self, *args, **options): Run the comman... | Implement the Python class `Command` described below.
Class description:
Management command to retry edX enrollment for a user's course run enrollments
Method signatures and docstrings:
- def add_arguments(self, parser): Definition of arguments this command accepts
- def handle(self, *args, **options): Run the comman... | c5d9cda4e1ed87463da74d7956f1e1f9258f365c | <|skeleton|>
class Command:
"""Management command to retry edX enrollment for a user's course run enrollments"""
def add_arguments(self, parser):
"""Definition of arguments this command accepts"""
<|body_0|>
def handle(self, *args, **options):
"""Run the command"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Command:
"""Management command to retry edX enrollment for a user's course run enrollments"""
def add_arguments(self, parser):
"""Definition of arguments this command accepts"""
parser.add_argument('-f', '--force', action='store_true', help='Retry edX enrollment even if the target users e... | the_stack_v2_python_sparse | courseware/management/commands/retry_edx_enrollment.py | mitodl/mitxpro | train | 12 |
e9433dda7638aade544bd5e12915d806c35cff27 | [
"if not pubkey or not privkey:\n warnings.warn('You must specify reCAPTCHA public and private keys either in settings file or at RECAPTCHAField initialization')\nself.pubkey = pubkey\nself.privkey = privkey\nself.api_server = api_server\nself.verify_server = verify_server\nkwargs.setdefault('widget', RECAPTCHAWi... | <|body_start_0|>
if not pubkey or not privkey:
warnings.warn('You must specify reCAPTCHA public and private keys either in settings file or at RECAPTCHAField initialization')
self.pubkey = pubkey
self.privkey = privkey
self.api_server = api_server
self.verify_server =... | reCATCHA form field class | RECAPTCHAField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RECAPTCHAField:
"""reCATCHA form field class"""
def __init__(self, pubkey=settings.RECAPTCHA_PUB_KEY, privkey=settings.RECAPTCHA_PRIV_KEY, api_server='https://www.google.com/recaptcha/api', verify_server='https://www.google.com/recaptcha/api/verify', *args, **kwargs):
"""Class initia... | stack_v2_sparse_classes_36k_train_005045 | 6,288 | permissive | [
{
"docstring": "Class initialization",
"name": "__init__",
"signature": "def __init__(self, pubkey=settings.RECAPTCHA_PUB_KEY, privkey=settings.RECAPTCHA_PRIV_KEY, api_server='https://www.google.com/recaptcha/api', verify_server='https://www.google.com/recaptcha/api/verify', *args, **kwargs)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_012767 | Implement the Python class `RECAPTCHAField` described below.
Class description:
reCATCHA form field class
Method signatures and docstrings:
- def __init__(self, pubkey=settings.RECAPTCHA_PUB_KEY, privkey=settings.RECAPTCHA_PRIV_KEY, api_server='https://www.google.com/recaptcha/api', verify_server='https://www.google.... | Implement the Python class `RECAPTCHAField` described below.
Class description:
reCATCHA form field class
Method signatures and docstrings:
- def __init__(self, pubkey=settings.RECAPTCHA_PUB_KEY, privkey=settings.RECAPTCHA_PRIV_KEY, api_server='https://www.google.com/recaptcha/api', verify_server='https://www.google.... | be9d747b8ca4c5d18f9725b2dad08dba6119d810 | <|skeleton|>
class RECAPTCHAField:
"""reCATCHA form field class"""
def __init__(self, pubkey=settings.RECAPTCHA_PUB_KEY, privkey=settings.RECAPTCHA_PRIV_KEY, api_server='https://www.google.com/recaptcha/api', verify_server='https://www.google.com/recaptcha/api/verify', *args, **kwargs):
"""Class initia... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RECAPTCHAField:
"""reCATCHA form field class"""
def __init__(self, pubkey=settings.RECAPTCHA_PUB_KEY, privkey=settings.RECAPTCHA_PRIV_KEY, api_server='https://www.google.com/recaptcha/api', verify_server='https://www.google.com/recaptcha/api/verify', *args, **kwargs):
"""Class initialization"""
... | the_stack_v2_python_sparse | sitetools/forms/fields.py | olivergs/django-sitetools | train | 0 |
056696a3f2d9aae05df62e41f6eab3d23d04a89b | [
"mesh_info = meshpy.tet.MeshInfo()\nopt = meshpy.tet.Options(switches='pqnn', facesout=True, edgesout=True)\nmesh_info.set_points(tri_mesh.vertices)\nfaces = [list(map(lambda x: int(x), i)) for i in tri_mesh.faces]\nmesh_info.set_facets(faces)\nmesh_info = meshpy.tet.build(mesh_info, opt, max_volume=max_vol)\nself.... | <|body_start_0|>
mesh_info = meshpy.tet.MeshInfo()
opt = meshpy.tet.Options(switches='pqnn', facesout=True, edgesout=True)
mesh_info.set_points(tri_mesh.vertices)
faces = [list(map(lambda x: int(x), i)) for i in tri_mesh.faces]
mesh_info.set_facets(faces)
mesh_info = mesh... | HexMachina | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HexMachina:
def __init__(self, tri_mesh, max_vol):
"""Generate tetrahedral mesh and extract surface boundary."""
<|body_0|>
def compute_dual(self):
"""Compute dual graph topology information."""
<|body_1|>
def init_framefield(self):
"""Initialize... | stack_v2_sparse_classes_36k_train_005046 | 7,592 | permissive | [
{
"docstring": "Generate tetrahedral mesh and extract surface boundary.",
"name": "__init__",
"signature": "def __init__(self, tri_mesh, max_vol)"
},
{
"docstring": "Compute dual graph topology information.",
"name": "compute_dual",
"signature": "def compute_dual(self)"
},
{
"doc... | 4 | stack_v2_sparse_classes_30k_train_003176 | Implement the Python class `HexMachina` described below.
Class description:
Implement the HexMachina class.
Method signatures and docstrings:
- def __init__(self, tri_mesh, max_vol): Generate tetrahedral mesh and extract surface boundary.
- def compute_dual(self): Compute dual graph topology information.
- def init_f... | Implement the Python class `HexMachina` described below.
Class description:
Implement the HexMachina class.
Method signatures and docstrings:
- def __init__(self, tri_mesh, max_vol): Generate tetrahedral mesh and extract surface boundary.
- def compute_dual(self): Compute dual graph topology information.
- def init_f... | 4f1ec7407fb903efe2c1d3d38874eb114611d072 | <|skeleton|>
class HexMachina:
def __init__(self, tri_mesh, max_vol):
"""Generate tetrahedral mesh and extract surface boundary."""
<|body_0|>
def compute_dual(self):
"""Compute dual graph topology information."""
<|body_1|>
def init_framefield(self):
"""Initialize... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HexMachina:
def __init__(self, tri_mesh, max_vol):
"""Generate tetrahedral mesh and extract surface boundary."""
mesh_info = meshpy.tet.MeshInfo()
opt = meshpy.tet.Options(switches='pqnn', facesout=True, edgesout=True)
mesh_info.set_points(tri_mesh.vertices)
faces = [li... | the_stack_v2_python_sparse | hexmachina/machina.py | meiliniumowang/hexmachina | train | 0 | |
df328a078f81c39ea77630553ea31e64133a8103 | [
"assert len(layer_size) + 1 == num_layers\nsuper(Autoencoder, self).__init__()\ninput_size = np.prod(size)\nlayer_size = [input_size] + layer_size\nself.num_layers = num_layers\nself.layer_size = layer_size\nself.norm = norm\nlayers = []\nfor i in range(num_layers - 1):\n layers.append(nn.Linear(layer_size[i], l... | <|body_start_0|>
assert len(layer_size) + 1 == num_layers
super(Autoencoder, self).__init__()
input_size = np.prod(size)
layer_size = [input_size] + layer_size
self.num_layers = num_layers
self.layer_size = layer_size
self.norm = norm
layers = []
f... | Simple fully connected autoencoder for image denoising Args: ----- bottleneck_dim: integer dimensionality of the latent space representation num_layers: integer number of layers in encoder and decoder layer_size: list of integers list with the dimensionality of each of the layers norm: boolean If True, latent space rep... | Autoencoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Autoencoder:
"""Simple fully connected autoencoder for image denoising Args: ----- bottleneck_dim: integer dimensionality of the latent space representation num_layers: integer number of layers in encoder and decoder layer_size: list of integers list with the dimensionality of each of the layers ... | stack_v2_sparse_classes_36k_train_005047 | 4,853 | permissive | [
{
"docstring": "Initialization of the model",
"name": "__init__",
"signature": "def __init__(self, bottleneck_dim=32, num_layers=3, layer_size=[256, 128], norm=False, size=(32, 32))"
},
{
"docstring": "Forward pass through the autoencoder model",
"name": "forward",
"signature": "def forw... | 2 | stack_v2_sparse_classes_30k_train_012868 | Implement the Python class `Autoencoder` described below.
Class description:
Simple fully connected autoencoder for image denoising Args: ----- bottleneck_dim: integer dimensionality of the latent space representation num_layers: integer number of layers in encoder and decoder layer_size: list of integers list with th... | Implement the Python class `Autoencoder` described below.
Class description:
Simple fully connected autoencoder for image denoising Args: ----- bottleneck_dim: integer dimensionality of the latent space representation num_layers: integer number of layers in encoder and decoder layer_size: list of integers list with th... | 979966036775b96c7ee7855a2968937403731763 | <|skeleton|>
class Autoencoder:
"""Simple fully connected autoencoder for image denoising Args: ----- bottleneck_dim: integer dimensionality of the latent space representation num_layers: integer number of layers in encoder and decoder layer_size: list of integers list with the dimensionality of each of the layers ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Autoencoder:
"""Simple fully connected autoencoder for image denoising Args: ----- bottleneck_dim: integer dimensionality of the latent space representation num_layers: integer number of layers in encoder and decoder layer_size: list of integers list with the dimensionality of each of the layers norm: boolean... | the_stack_v2_python_sparse | src/models/denoising_autoencoder.py | angelvillar96/super-resolution-noisy-images | train | 7 |
5b0dcb0ec0beaf31c59e3c432492484d6a76671f | [
"KerasClassifier.__init__(self, messageHandler, **kwargs)\nself.printTag = 'KerasLSTMClassifier'\nself.allowedLayers = self.basicLayers + self.kerasROMDict['kerasRcurrentLayersList']",
"for index, layerName in enumerate(self.layerLayout[:-1]):\n layerType = self.initOptionDict[layerName].get('type').lower()\n ... | <|body_start_0|>
KerasClassifier.__init__(self, messageHandler, **kwargs)
self.printTag = 'KerasLSTMClassifier'
self.allowedLayers = self.basicLayers + self.kerasROMDict['kerasRcurrentLayersList']
<|end_body_0|>
<|body_start_1|>
for index, layerName in enumerate(self.layerLayout[:-1]):
... | recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow | KerasLSTMClassifier | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KerasLSTMClassifier:
"""recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow"""
def __init__(self, messageHandler, **kwargs):
"""A constructor that will appropriately intialize a supervised learning object @ In, messageHa... | stack_v2_sparse_classes_36k_train_005048 | 3,214 | permissive | [
{
"docstring": "A constructor that will appropriately intialize a supervised learning object @ In, messageHandler, MessageHandler, a MessageHandler object in charge of raising errors, and printing messages @ In, kwargs, dict, an arbitrary dictionary of keywords and values @ Out, None",
"name": "__init__",
... | 3 | stack_v2_sparse_classes_30k_train_002198 | Implement the Python class `KerasLSTMClassifier` described below.
Class description:
recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow
Method signatures and docstrings:
- def __init__(self, messageHandler, **kwargs): A constructor that will appropriate... | Implement the Python class `KerasLSTMClassifier` described below.
Class description:
recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow
Method signatures and docstrings:
- def __init__(self, messageHandler, **kwargs): A constructor that will appropriate... | bf49370966bdade783f8bca13d17748eabf54505 | <|skeleton|>
class KerasLSTMClassifier:
"""recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow"""
def __init__(self, messageHandler, **kwargs):
"""A constructor that will appropriately intialize a supervised learning object @ In, messageHa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KerasLSTMClassifier:
"""recurrent neural network using short-term model network (LSTM) classifier constructed using Keras API in TensorFlow"""
def __init__(self, messageHandler, **kwargs):
"""A constructor that will appropriately intialize a supervised learning object @ In, messageHandler, Messag... | the_stack_v2_python_sparse | framework/SupervisedLearning/KerasLSTMClassifier.py | amoyyy/raven | train | 0 |
2a1ed59759475048d6ebc5a084f95ee574414f71 | [
"super().__init__(master=root, borderwidth=3, relief=SUNKEN)\nroot.title('Enamer v{major}.{minor}')\nroot.title('Hello, world!')\nself.grid(row=0, column=0)\nself.rowconfigure(0, weight=1)\nself.columnconfigure(0, weight=1)\nself._create_widgets()",
"input_group = ttk.LabelFrame(self, text='Input filename:')\ninp... | <|body_start_0|>
super().__init__(master=root, borderwidth=3, relief=SUNKEN)
root.title('Enamer v{major}.{minor}')
root.title('Hello, world!')
self.grid(row=0, column=0)
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self._create_widgets()
<|end_... | This is the program's main window. | EnameMainWindow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EnameMainWindow:
"""This is the program's main window."""
def __init__(self, root=None):
"""Initializes given frame instance."""
<|body_0|>
def _create_widgets(self):
"""Blah, blah, blah, ..."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super... | stack_v2_sparse_classes_36k_train_005049 | 2,243 | no_license | [
{
"docstring": "Initializes given frame instance.",
"name": "__init__",
"signature": "def __init__(self, root=None)"
},
{
"docstring": "Blah, blah, blah, ...",
"name": "_create_widgets",
"signature": "def _create_widgets(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020738 | Implement the Python class `EnameMainWindow` described below.
Class description:
This is the program's main window.
Method signatures and docstrings:
- def __init__(self, root=None): Initializes given frame instance.
- def _create_widgets(self): Blah, blah, blah, ... | Implement the Python class `EnameMainWindow` described below.
Class description:
This is the program's main window.
Method signatures and docstrings:
- def __init__(self, root=None): Initializes given frame instance.
- def _create_widgets(self): Blah, blah, blah, ...
<|skeleton|>
class EnameMainWindow:
"""This i... | 79ac4d935fba252ff18274fc1085a585f530e641 | <|skeleton|>
class EnameMainWindow:
"""This is the program's main window."""
def __init__(self, root=None):
"""Initializes given frame instance."""
<|body_0|>
def _create_widgets(self):
"""Blah, blah, blah, ..."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EnameMainWindow:
"""This is the program's main window."""
def __init__(self, root=None):
"""Initializes given frame instance."""
super().__init__(master=root, borderwidth=3, relief=SUNKEN)
root.title('Enamer v{major}.{minor}')
root.title('Hello, world!')
self.grid(... | the_stack_v2_python_sparse | Python/Utils/Ename/ename.py | tnotstar/tnotbox | train | 0 |
e42207d540903f7be369b693eb8097e0c5784d85 | [
"liquid = OreList.convert(liquid)\nif 'deposit_name' not in kwargs:\n kwargs['deposit_name'] = f'{liquid.short_name}-{vein.name}-LAKE'\nsuper().__init__(vein, **kwargs)\nself.diameter = diameter\nself.liquid = liquid",
"result = super().as_json()\nresult['generator'].update({'block': self.liquid.as_json(), 'cl... | <|body_start_0|>
liquid = OreList.convert(liquid)
if 'deposit_name' not in kwargs:
kwargs['deposit_name'] = f'{liquid.short_name}-{vein.name}-LAKE'
super().__init__(vein, **kwargs)
self.diameter = diameter
self.liquid = liquid
<|end_body_0|>
<|body_start_1|>
... | LakeDeposit creates a deposit as a shell around a small pond of some fluid. | LakeDeposit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LakeDeposit:
"""LakeDeposit creates a deposit as a shell around a small pond of some fluid."""
def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs):
"""Create a new lake deposit."""
<|body_0|>
def as_json(self):
"""Create a dict represen... | stack_v2_sparse_classes_36k_train_005050 | 1,193 | no_license | [
{
"docstring": "Create a new lake deposit.",
"name": "__init__",
"signature": "def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs)"
},
{
"docstring": "Create a dict representation of this deposit suitable for being converted to JSON.",
"name": "as_json",
"signa... | 2 | stack_v2_sparse_classes_30k_train_016001 | Implement the Python class `LakeDeposit` described below.
Class description:
LakeDeposit creates a deposit as a shell around a small pond of some fluid.
Method signatures and docstrings:
- def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs): Create a new lake deposit.
- def as_json(self): C... | Implement the Python class `LakeDeposit` described below.
Class description:
LakeDeposit creates a deposit as a shell around a small pond of some fluid.
Method signatures and docstrings:
- def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs): Create a new lake deposit.
- def as_json(self): C... | 9bd6e74cb3817eec76119978ea31cf5b04e0ed51 | <|skeleton|>
class LakeDeposit:
"""LakeDeposit creates a deposit as a shell around a small pond of some fluid."""
def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs):
"""Create a new lake deposit."""
<|body_0|>
def as_json(self):
"""Create a dict represen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LakeDeposit:
"""LakeDeposit creates a deposit as a shell around a small pond of some fluid."""
def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs):
"""Create a new lake deposit."""
liquid = OreList.convert(liquid)
if 'deposit_name' not in kwargs:
... | the_stack_v2_python_sparse | src/packconfig/oregen/deposits/lake_deposit.py | tungstonminer/packconfig | train | 0 |
74d015ecfd65afb661073ac57a3988e960559e37 | [
"self.player: Player = player_sprite\nself.enemy_list: SpriteList = enemy_list\nself.ground_level: int = ground_level\nself.gravity_constant: float = gravity_constant\nself.initial_jump_velocity = initial_jump_velocity\nself.key_handler: KeyHandler = key_handler",
"if self.player.running and self.key_handler.is_p... | <|body_start_0|>
self.player: Player = player_sprite
self.enemy_list: SpriteList = enemy_list
self.ground_level: int = ground_level
self.gravity_constant: float = gravity_constant
self.initial_jump_velocity = initial_jump_velocity
self.key_handler: KeyHandler = key_handle... | A physics implementation for runner games with jump canceling. Jump cancelling refers to stopping jumping after the jump button is pressed. Super Mario Bros is a good example of this style of jump. | RunnerPhysicsEngine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunnerPhysicsEngine:
"""A physics implementation for runner games with jump canceling. Jump cancelling refers to stopping jumping after the jump button is pressed. Super Mario Bros is a good example of this style of jump."""
def __init__(self, player_sprite: Player, key_handler: KeyHandler, ... | stack_v2_sparse_classes_36k_train_005051 | 3,109 | no_license | [
{
"docstring": "Set initial parameters for physics. Units for math and arguments are in unscaled pixels. :param player_sprite: the player sprite that will be managed :param key_handler: key handler that proxies keys to actions :param ground_level: how many pixels up from 0 the ground is :param gravity_constant:... | 2 | stack_v2_sparse_classes_30k_train_011465 | Implement the Python class `RunnerPhysicsEngine` described below.
Class description:
A physics implementation for runner games with jump canceling. Jump cancelling refers to stopping jumping after the jump button is pressed. Super Mario Bros is a good example of this style of jump.
Method signatures and docstrings:
-... | Implement the Python class `RunnerPhysicsEngine` described below.
Class description:
A physics implementation for runner games with jump canceling. Jump cancelling refers to stopping jumping after the jump button is pressed. Super Mario Bros is a good example of this style of jump.
Method signatures and docstrings:
-... | 6c952cc4ceba4cce552f5a26151f31eb07baa72a | <|skeleton|>
class RunnerPhysicsEngine:
"""A physics implementation for runner games with jump canceling. Jump cancelling refers to stopping jumping after the jump button is pressed. Super Mario Bros is a good example of this style of jump."""
def __init__(self, player_sprite: Player, key_handler: KeyHandler, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RunnerPhysicsEngine:
"""A physics implementation for runner games with jump canceling. Jump cancelling refers to stopping jumping after the jump button is pressed. Super Mario Bros is a good example of this style of jump."""
def __init__(self, player_sprite: Player, key_handler: KeyHandler, enemy_list: S... | the_stack_v2_python_sparse | CatBurglar/entity/physics.py | Deli-Slicer/CatBurglar | train | 0 |
ff24bbfbb7575d1124b87f8c015697f566bd3abd | [
"self.chassis_serial_to_rack_id_map = chassis_serial_to_rack_id_map\nself.node_configs = node_configs\nself.vips = vips",
"if dictionary is None:\n return None\nchassis_serial_to_rack_id_map = dictionary.get('chassisSerialToRackIdMap')\nnode_configs = None\nif dictionary.get('nodeConfigs') != None:\n node_c... | <|body_start_0|>
self.chassis_serial_to_rack_id_map = chassis_serial_to_rack_id_map
self.node_configs = node_configs
self.vips = vips
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
chassis_serial_to_rack_id_map = dictionary.get('chassisSerialToRac... | Implementation of the 'ExpandPhysicalClusterParameters' model. Specifies the parameters needed to expand a Cohesity Physical Edition Cluster. Attributes: chassis_serial_to_rack_id_map (object): ChassisSerialToRackId map. node_configs (list of PhysicalNodeConfiguration, required): Specifies the configuration details of ... | ExpandPhysicalClusterParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExpandPhysicalClusterParameters:
"""Implementation of the 'ExpandPhysicalClusterParameters' model. Specifies the parameters needed to expand a Cohesity Physical Edition Cluster. Attributes: chassis_serial_to_rack_id_map (object): ChassisSerialToRackId map. node_configs (list of PhysicalNodeConfig... | stack_v2_sparse_classes_36k_train_005052 | 2,462 | permissive | [
{
"docstring": "Constructor for the ExpandPhysicalClusterParameters class",
"name": "__init__",
"signature": "def __init__(self, chassis_serial_to_rack_id_map=None, node_configs=None, vips=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)... | 2 | stack_v2_sparse_classes_30k_train_000401 | Implement the Python class `ExpandPhysicalClusterParameters` described below.
Class description:
Implementation of the 'ExpandPhysicalClusterParameters' model. Specifies the parameters needed to expand a Cohesity Physical Edition Cluster. Attributes: chassis_serial_to_rack_id_map (object): ChassisSerialToRackId map. n... | Implement the Python class `ExpandPhysicalClusterParameters` described below.
Class description:
Implementation of the 'ExpandPhysicalClusterParameters' model. Specifies the parameters needed to expand a Cohesity Physical Edition Cluster. Attributes: chassis_serial_to_rack_id_map (object): ChassisSerialToRackId map. n... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ExpandPhysicalClusterParameters:
"""Implementation of the 'ExpandPhysicalClusterParameters' model. Specifies the parameters needed to expand a Cohesity Physical Edition Cluster. Attributes: chassis_serial_to_rack_id_map (object): ChassisSerialToRackId map. node_configs (list of PhysicalNodeConfig... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExpandPhysicalClusterParameters:
"""Implementation of the 'ExpandPhysicalClusterParameters' model. Specifies the parameters needed to expand a Cohesity Physical Edition Cluster. Attributes: chassis_serial_to_rack_id_map (object): ChassisSerialToRackId map. node_configs (list of PhysicalNodeConfiguration, requ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/expand_physical_cluster_parameters.py | cohesity/management-sdk-python | train | 24 |
64b7c7f0da2ad9311d1e4b7d4250557d71de380b | [
"if not can_edit_player(player_id):\n abort(httplib.METHOD_NOT_ALLOWED, message='That is not your player!')\nticket = get_ticket(player_id, ticket_id)\nif not ticket:\n abort(404, message='Ticket was not found')\nreturn add_ticket_links(ticket)",
"args = request.json\njournal_id = args.get('journal_id')\nif... | <|body_start_0|>
if not can_edit_player(player_id):
abort(httplib.METHOD_NOT_ALLOWED, message='That is not your player!')
ticket = get_ticket(player_id, ticket_id)
if not ticket:
abort(404, message='Ticket was not found')
return add_ticket_links(ticket)
<|end_body... | TicketEndpoint | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TicketEndpoint:
def get(self, player_id, ticket_id):
"""Get information about any past or ongoing battle initiated by the current player against the other player"""
<|body_0|>
def patch(self, player_id, ticket_id):
"""Claim a ticket"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k_train_005053 | 4,333 | permissive | [
{
"docstring": "Get information about any past or ongoing battle initiated by the current player against the other player",
"name": "get",
"signature": "def get(self, player_id, ticket_id)"
},
{
"docstring": "Claim a ticket",
"name": "patch",
"signature": "def patch(self, player_id, tick... | 2 | stack_v2_sparse_classes_30k_test_000504 | Implement the Python class `TicketEndpoint` described below.
Class description:
Implement the TicketEndpoint class.
Method signatures and docstrings:
- def get(self, player_id, ticket_id): Get information about any past or ongoing battle initiated by the current player against the other player
- def patch(self, playe... | Implement the Python class `TicketEndpoint` described below.
Class description:
Implement the TicketEndpoint class.
Method signatures and docstrings:
- def get(self, player_id, ticket_id): Get information about any past or ongoing battle initiated by the current player against the other player
- def patch(self, playe... | 58439d9398006616bbf438da6c5dbe7c32e7a379 | <|skeleton|>
class TicketEndpoint:
def get(self, player_id, ticket_id):
"""Get information about any past or ongoing battle initiated by the current player against the other player"""
<|body_0|>
def patch(self, player_id, ticket_id):
"""Claim a ticket"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TicketEndpoint:
def get(self, player_id, ticket_id):
"""Get information about any past or ongoing battle initiated by the current player against the other player"""
if not can_edit_player(player_id):
abort(httplib.METHOD_NOT_ALLOWED, message='That is not your player!')
tick... | the_stack_v2_python_sparse | driftbase/players/tickets/endpoints.py | 1939Games/drift-base | train | 0 | |
5448a886e6bf0fca3c9243e3da9623ad1cb60ad5 | [
"cur = head\nlength = 0\nwhile cur:\n length += 1\n cur = cur.next\nreturn length",
"A_length = self.length(headA)\nB_length = self.length(headB)\ndisdance = abs(A_length - B_length)\ncur_a = headA\ncur_b = headB\nif A_length > B_length:\n for i in range(disdance):\n cur_a = cur_a.next\nelif A_len... | <|body_start_0|>
cur = head
length = 0
while cur:
length += 1
cur = cur.next
return length
<|end_body_0|>
<|body_start_1|>
A_length = self.length(headA)
B_length = self.length(headB)
disdance = abs(A_length - B_length)
cur_a = head... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def length(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode(self, headA, headB):
""":type headA, headB: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cur = head
... | stack_v2_sparse_classes_36k_train_005054 | 1,120 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "length",
"signature": "def length(self, head)"
},
{
"docstring": ":type headA, headB: ListNode :rtype: ListNode",
"name": "getIntersectionNode",
"signature": "def getIntersectionNode(self, headA, headB)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019122 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def length(self, head): :type head: ListNode :rtype: ListNode
- def getIntersectionNode(self, headA, headB): :type headA, headB: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def length(self, head): :type head: ListNode :rtype: ListNode
- def getIntersectionNode(self, headA, headB): :type headA, headB: ListNode :rtype: ListNode
<|skeleton|>
class Sol... | 9bd2d706f014ce84356ba38fc7801da0285a91d3 | <|skeleton|>
class Solution:
def length(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode(self, headA, headB):
""":type headA, headB: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def length(self, head):
""":type head: ListNode :rtype: ListNode"""
cur = head
length = 0
while cur:
length += 1
cur = cur.next
return length
def getIntersectionNode(self, headA, headB):
""":type headA, headB: ListNode :rty... | the_stack_v2_python_sparse | leetcode/getIntersectionNode-160.py | pittcat/Algorithm_Practice | train | 0 | |
ade7c87c07768f210e6f4bf88228575ee5dcf652 | [
"self.__model_path = model_path\nself.__labels_path = labels_path\nself.__image_path = image_path\nself.__sign = sign\nself.__sorted_data_path = sorted_data_path\nself.__model = None\nself.__lb = None",
"self.__load_Model()\nimage_arr = self.__load_Image()\nself.__predict_Image(image_arr)",
"prints_types.printP... | <|body_start_0|>
self.__model_path = model_path
self.__labels_path = labels_path
self.__image_path = image_path
self.__sign = sign
self.__sorted_data_path = sorted_data_path
self.__model = None
self.__lb = None
<|end_body_0|>
<|body_start_1|>
self.__load_... | ImagePredictor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImagePredictor:
def __init__(self, model_path, labels_path, image_path, sign, sorted_data_path):
"""Create the ImagePredictor class object. :param model_path: string :param labels_path: string :param image_path: string :param sign: boolian :param sorted_data_path: string :return: None"""... | stack_v2_sparse_classes_36k_train_005055 | 6,465 | no_license | [
{
"docstring": "Create the ImagePredictor class object. :param model_path: string :param labels_path: string :param image_path: string :param sign: boolian :param sorted_data_path: string :return: None",
"name": "__init__",
"signature": "def __init__(self, model_path, labels_path, image_path, sign, sort... | 5 | stack_v2_sparse_classes_30k_train_001133 | Implement the Python class `ImagePredictor` described below.
Class description:
Implement the ImagePredictor class.
Method signatures and docstrings:
- def __init__(self, model_path, labels_path, image_path, sign, sorted_data_path): Create the ImagePredictor class object. :param model_path: string :param labels_path:... | Implement the Python class `ImagePredictor` described below.
Class description:
Implement the ImagePredictor class.
Method signatures and docstrings:
- def __init__(self, model_path, labels_path, image_path, sign, sorted_data_path): Create the ImagePredictor class object. :param model_path: string :param labels_path:... | 9b7f035dca04e9ac4d20d4d9fa9e687ce583603b | <|skeleton|>
class ImagePredictor:
def __init__(self, model_path, labels_path, image_path, sign, sorted_data_path):
"""Create the ImagePredictor class object. :param model_path: string :param labels_path: string :param image_path: string :param sign: boolian :param sorted_data_path: string :return: None"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImagePredictor:
def __init__(self, model_path, labels_path, image_path, sign, sorted_data_path):
"""Create the ImagePredictor class object. :param model_path: string :param labels_path: string :param image_path: string :param sign: boolian :param sorted_data_path: string :return: None"""
self.... | the_stack_v2_python_sparse | python files/classify.py | maayan121/project_python_letters-DL | train | 0 | |
d008eee21e0cc46ad0e7ec9952e97c19b9736712 | [
"ndim = None\nfor node in nodes:\n try:\n node = self._ensure_moments(node, GaussianMoments, ndim=None)\n except ValueError:\n pass\n else:\n ndim = node._moments.ndim\n break\nnodes = [self._ensure_moments(node, GaussianMoments, ndim=ndim) for node in nodes]\nN = len(nodes)\nif... | <|body_start_0|>
ndim = None
for node in nodes:
try:
node = self._ensure_moments(node, GaussianMoments, ndim=None)
except ValueError:
pass
else:
ndim = node._moments.ndim
break
nodes = [self._ensu... | Node for computing sums of Gaussian nodes: :math:`X+Y+Z`. Examples -------- >>> import numpy as np >>> from bayespy import nodes >>> X = nodes.Gaussian(np.zeros(2), np.identity(2), plates=(3,)) >>> Y = nodes.Gaussian(np.ones(2), np.identity(2)) >>> Z = nodes.Add(X, Y) >>> print("Mean:\\n", Z.get_moments()[0]) Mean: [[1... | Add | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"AFL-3.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Add:
"""Node for computing sums of Gaussian nodes: :math:`X+Y+Z`. Examples -------- >>> import numpy as np >>> from bayespy import nodes >>> X = nodes.Gaussian(np.zeros(2), np.identity(2), plates=(3,)) >>> Y = nodes.Gaussian(np.ones(2), np.identity(2)) >>> Z = nodes.Add(X, Y) >>> print("Mean:\\n"... | stack_v2_sparse_classes_36k_train_005056 | 4,331 | permissive | [
{
"docstring": "Add(X1, X2, ...)",
"name": "__init__",
"signature": "def __init__(self, *nodes, **kwargs)"
},
{
"docstring": "Compute the moments of the sum",
"name": "_compute_moments",
"signature": "def _compute_moments(self, *u_parents)"
},
{
"docstring": "Compute the message ... | 3 | stack_v2_sparse_classes_30k_train_010328 | Implement the Python class `Add` described below.
Class description:
Node for computing sums of Gaussian nodes: :math:`X+Y+Z`. Examples -------- >>> import numpy as np >>> from bayespy import nodes >>> X = nodes.Gaussian(np.zeros(2), np.identity(2), plates=(3,)) >>> Y = nodes.Gaussian(np.ones(2), np.identity(2)) >>> Z... | Implement the Python class `Add` described below.
Class description:
Node for computing sums of Gaussian nodes: :math:`X+Y+Z`. Examples -------- >>> import numpy as np >>> from bayespy import nodes >>> X = nodes.Gaussian(np.zeros(2), np.identity(2), plates=(3,)) >>> Y = nodes.Gaussian(np.ones(2), np.identity(2)) >>> Z... | 5fe58f7160ebc3a9df7f9e96e50d2bd47837794a | <|skeleton|>
class Add:
"""Node for computing sums of Gaussian nodes: :math:`X+Y+Z`. Examples -------- >>> import numpy as np >>> from bayespy import nodes >>> X = nodes.Gaussian(np.zeros(2), np.identity(2), plates=(3,)) >>> Y = nodes.Gaussian(np.ones(2), np.identity(2)) >>> Z = nodes.Add(X, Y) >>> print("Mean:\\n"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Add:
"""Node for computing sums of Gaussian nodes: :math:`X+Y+Z`. Examples -------- >>> import numpy as np >>> from bayespy import nodes >>> X = nodes.Gaussian(np.zeros(2), np.identity(2), plates=(3,)) >>> Y = nodes.Gaussian(np.ones(2), np.identity(2)) >>> Z = nodes.Add(X, Y) >>> print("Mean:\\n", Z.get_momen... | the_stack_v2_python_sparse | bayespy/inference/vmp/nodes/add.py | bayespy/bayespy | train | 655 |
6d7a2eb11cf2f14d3092f0d9a0d0d4afd66740c3 | [
"super().__init__()\nself.pool = nn.ModuleList()\nfor i in range(0, samplingTimes):\n self.pool.append(nn.AvgPool2d(3, stride=2, padding=1))",
"for pool in self.pool:\n input = pool(input)\nreturn input"
] | <|body_start_0|>
super().__init__()
self.pool = nn.ModuleList()
for i in range(0, samplingTimes):
self.pool.append(nn.AvgPool2d(3, stride=2, padding=1))
<|end_body_0|>
<|body_start_1|>
for pool in self.pool:
input = pool(input)
return input
<|end_body_1|>... | This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3, for input reinforcement, which establishes a direct link between the input ima... | InputProjectionA | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InputProjectionA:
"""This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3, for input reinforcement, which est... | stack_v2_sparse_classes_36k_train_005057 | 15,567 | permissive | [
{
"docstring": ":param samplingTimes: The rate at which you want to down-sample the image",
"name": "__init__",
"signature": "def __init__(self, samplingTimes)"
},
{
"docstring": ":param input: Input RGB Image :return: down-sampled image (pyramid-based approach)",
"name": "forward",
"sig... | 2 | null | Implement the Python class `InputProjectionA` described below.
Class description:
This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x5... | Implement the Python class `InputProjectionA` described below.
Class description:
This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x5... | f2993d3ce73a2f7ddba05da3891defb08547d504 | <|skeleton|>
class InputProjectionA:
"""This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3, for input reinforcement, which est... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InputProjectionA:
"""This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56x56xF, then this class will generate an output of 56x56x3, for input reinforcement, which establishes a di... | the_stack_v2_python_sparse | pytorch/pytorchcv/models/others/oth_espnet.py | osmr/imgclsmob | train | 3,017 |
de66eaf46a6325a476b5383eb4b6ed45fc8f6c90 | [
"domainMin, domainMax = self.fixDomainValues(domainMin, domainMax, xUnit)\nif isinstance(supportMin, PQU):\n xMin = float(supportMin.inUnitsOf(xUnit).value)\nif isinstance(supportMax, PQU):\n xMax = float(supportMax.inUnitsOf(xUnit).value)\nif domainMax < supportMax:\n raise ValueError('domainMax=%g < supp... | <|body_start_0|>
domainMin, domainMax = self.fixDomainValues(domainMin, domainMax, xUnit)
if isinstance(supportMin, PQU):
xMin = float(supportMin.inUnitsOf(xUnit).value)
if isinstance(supportMax, PQU):
xMax = float(supportMax.inUnitsOf(xUnit).value)
if domainMax <... | UniformDistribution | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UniformDistribution:
def __init__(self, xUnit='', supportMin=0.0, supportMax=1.0, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'):
"""Simple implementation of a uniform pdf (http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)) Outside of the interval (d... | stack_v2_sparse_classes_36k_train_005058 | 43,025 | permissive | [
{
"docstring": "Simple implementation of a uniform pdf (http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)) Outside of the interval (domainMin,domainMax), getValue() evaluates to None since this pdf is undefined here :param supportMin: (float or PQU) pdf is constant on interval (supportMin, supportM... | 3 | stack_v2_sparse_classes_30k_train_010243 | Implement the Python class `UniformDistribution` described below.
Class description:
Implement the UniformDistribution class.
Method signatures and docstrings:
- def __init__(self, xUnit='', supportMin=0.0, supportMax=1.0, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'): Simple implementation ... | Implement the Python class `UniformDistribution` described below.
Class description:
Implement the UniformDistribution class.
Method signatures and docstrings:
- def __init__(self, xUnit='', supportMin=0.0, supportMax=1.0, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'): Simple implementation ... | 9566131c37b45fc37f5f8ad07903264864575b6e | <|skeleton|>
class UniformDistribution:
def __init__(self, xUnit='', supportMin=0.0, supportMax=1.0, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'):
"""Simple implementation of a uniform pdf (http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)) Outside of the interval (d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UniformDistribution:
def __init__(self, xUnit='', supportMin=0.0, supportMax=1.0, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'):
"""Simple implementation of a uniform pdf (http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)) Outside of the interval (domainMin,domai... | the_stack_v2_python_sparse | fudge/core/math/pdf.py | alhajri/FUDGE | train | 0 | |
871b5b2bffed62833fad996690a901b3b05fd133 | [
"objc = ctypes.cdll.LoadLibrary(find_library('objc'))\nobjc.objc_getClass.restype = ctypes.c_void_p\nobjc.sel_registerName.restype = ctypes.c_void_p\nobjc.objc_msgSend.restype = ctypes.c_void_p\nobjc.objc_msgSend.argtypes = [ctypes.c_void_p, ctypes.c_void_p]\nreturn objc",
"objc = self.objc\nENBridge = objc.objc_... | <|body_start_0|>
objc = ctypes.cdll.LoadLibrary(find_library('objc'))
objc.objc_getClass.restype = ctypes.c_void_p
objc.sel_registerName.restype = ctypes.c_void_p
objc.objc_msgSend.restype = ctypes.c_void_p
objc.objc_msgSend.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
r... | Access ENBridge.m using ctypes. Based on: https://stackoverflow.com/questions/1490039/ calling-objective-c-functions-from-python#1490644 | ENBridge | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ENBridge:
"""Access ENBridge.m using ctypes. Based on: https://stackoverflow.com/questions/1490039/ calling-objective-c-functions-from-python#1490644"""
def _default_objc(self):
"""Load the objc library using ctypes."""
<|body_0|>
def _default_bridge(self):
"""Ge... | stack_v2_sparse_classes_36k_train_005059 | 6,257 | permissive | [
{
"docstring": "Load the objc library using ctypes.",
"name": "_default_objc",
"signature": "def _default_objc(self)"
},
{
"docstring": "Get an instance of the ENBridge object using ctypes.",
"name": "_default_bridge",
"signature": "def _default_bridge(self)"
},
{
"docstring": "S... | 3 | stack_v2_sparse_classes_30k_train_008831 | Implement the Python class `ENBridge` described below.
Class description:
Access ENBridge.m using ctypes. Based on: https://stackoverflow.com/questions/1490039/ calling-objective-c-functions-from-python#1490644
Method signatures and docstrings:
- def _default_objc(self): Load the objc library using ctypes.
- def _def... | Implement the Python class `ENBridge` described below.
Class description:
Access ENBridge.m using ctypes. Based on: https://stackoverflow.com/questions/1490039/ calling-objective-c-functions-from-python#1490644
Method signatures and docstrings:
- def _default_objc(self): Load the objc library using ctypes.
- def _def... | 04c3a015bcd649f374c5ecd98fcddba5e4fbdbdc | <|skeleton|>
class ENBridge:
"""Access ENBridge.m using ctypes. Based on: https://stackoverflow.com/questions/1490039/ calling-objective-c-functions-from-python#1490644"""
def _default_objc(self):
"""Load the objc library using ctypes."""
<|body_0|>
def _default_bridge(self):
"""Ge... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ENBridge:
"""Access ENBridge.m using ctypes. Based on: https://stackoverflow.com/questions/1490039/ calling-objective-c-functions-from-python#1490644"""
def _default_objc(self):
"""Load the objc library using ctypes."""
objc = ctypes.cdll.LoadLibrary(find_library('objc'))
objc.obj... | the_stack_v2_python_sparse | src/enamlnative/ios/app.py | mfkiwl/enaml-native | train | 0 |
2aee99df7590ac9a3497af616c93d882ecadc554 | [
"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... | service | ImageServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageServiceServicer:
"""service"""
def GetImageStream(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetShm(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|... | stack_v2_sparse_classes_36k_train_005060 | 10,385 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetImageStream",
"signature": "def GetImageStream(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetShm",
"signature": "def GetShm(self, re... | 2 | stack_v2_sparse_classes_30k_train_015923 | Implement the Python class `ImageServiceServicer` described below.
Class description:
service
Method signatures and docstrings:
- def GetImageStream(self, request, context): Missing associated documentation comment in .proto file.
- def GetShm(self, request, context): Missing associated documentation comment in .prot... | Implement the Python class `ImageServiceServicer` described below.
Class description:
service
Method signatures and docstrings:
- def GetImageStream(self, request, context): Missing associated documentation comment in .proto file.
- def GetShm(self, request, context): Missing associated documentation comment in .prot... | a83a60c40eda7051a73363f67cb806ad73637e7a | <|skeleton|>
class ImageServiceServicer:
"""service"""
def GetImageStream(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetShm(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageServiceServicer:
"""service"""
def GetImageStream(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method n... | the_stack_v2_python_sparse | sap-toolkit/sap_toolkit/generated/eval_server_pb2_grpc.py | jelasus/sap-starterkit | train | 0 |
90a2220a238e02e2a24c12070f0d7eb2bb4f2e54 | [
"self.task_name = task_name\nself.col_checker = checker\nself.args = args\nself.fields = fields",
"names = self.fields.get_process_name()\nnames.append(['col_checker', self.col_checker, self.args])\nreturn names",
"try:\n table_checker = process_manager.locate('col_checker', self.col_checker)\nexcept Process... | <|body_start_0|>
self.task_name = task_name
self.col_checker = checker
self.args = args
self.fields = fields
<|end_body_0|>
<|body_start_1|>
names = self.fields.get_process_name()
names.append(['col_checker', self.col_checker, self.args])
return names
<|end_body_... | sub task for the total task | TableCheckerSubTask | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableCheckerSubTask:
"""sub task for the total task"""
def __init__(self, task_name, checker, args, fields):
"""init sub task Args: task_name: str, task name checker: str, checker name args: list, arguments for checker fields: fieldList"""
<|body_0|>
def get_process_name... | stack_v2_sparse_classes_36k_train_005061 | 6,710 | no_license | [
{
"docstring": "init sub task Args: task_name: str, task name checker: str, checker name args: list, arguments for checker fields: fieldList",
"name": "__init__",
"signature": "def __init__(self, task_name, checker, args, fields)"
},
{
"docstring": "Get process name",
"name": "get_process_na... | 3 | stack_v2_sparse_classes_30k_train_016782 | Implement the Python class `TableCheckerSubTask` described below.
Class description:
sub task for the total task
Method signatures and docstrings:
- def __init__(self, task_name, checker, args, fields): init sub task Args: task_name: str, task name checker: str, checker name args: list, arguments for checker fields: ... | Implement the Python class `TableCheckerSubTask` described below.
Class description:
sub task for the total task
Method signatures and docstrings:
- def __init__(self, task_name, checker, args, fields): init sub task Args: task_name: str, task name checker: str, checker name args: list, arguments for checker fields: ... | 913fb4af29f4395f4a300d35c00236065075960e | <|skeleton|>
class TableCheckerSubTask:
"""sub task for the total task"""
def __init__(self, task_name, checker, args, fields):
"""init sub task Args: task_name: str, task name checker: str, checker name args: list, arguments for checker fields: fieldList"""
<|body_0|>
def get_process_name... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TableCheckerSubTask:
"""sub task for the total task"""
def __init__(self, task_name, checker, args, fields):
"""init sub task Args: task_name: str, task name checker: str, checker name args: list, arguments for checker fields: fieldList"""
self.task_name = task_name
self.col_check... | the_stack_v2_python_sparse | script/table_checker_task.py | jhuangpku/data_checker | train | 0 |
db15a6e0532db708e61dfa66753e37bb65385d80 | [
"num = int(input('请输入金额:'))\naccount = self.balance()\naccount['amount'] += num\nself.update_account(account)\nreturn (True, '存款成功')",
"import os\naccount = input('请输入账户名:')\npasswd = input('请输入密码:')\npasswd_02 = input('请再次输入密码:')\naccount_names = set(os.listdir('info'))\nif account in account_names:\n return ... | <|body_start_0|>
num = int(input('请输入金额:'))
account = self.balance()
account['amount'] += num
self.update_account(account)
return (True, '存款成功')
<|end_body_0|>
<|body_start_1|>
import os
account = input('请输入账户名:')
passwd = input('请输入密码:')
passwd_0... | AtmMutil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AtmMutil:
def save_money(self):
"""存钱 :return:"""
<|body_0|>
def make_account(self):
"""创建一个账户 :return:"""
<|body_1|>
def main(self):
"""主函数 :return:"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
num = int(input('请输入金额:'))
... | stack_v2_sparse_classes_36k_train_005062 | 5,505 | no_license | [
{
"docstring": "存钱 :return:",
"name": "save_money",
"signature": "def save_money(self)"
},
{
"docstring": "创建一个账户 :return:",
"name": "make_account",
"signature": "def make_account(self)"
},
{
"docstring": "主函数 :return:",
"name": "main",
"signature": "def main(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_017566 | Implement the Python class `AtmMutil` described below.
Class description:
Implement the AtmMutil class.
Method signatures and docstrings:
- def save_money(self): 存钱 :return:
- def make_account(self): 创建一个账户 :return:
- def main(self): 主函数 :return: | Implement the Python class `AtmMutil` described below.
Class description:
Implement the AtmMutil class.
Method signatures and docstrings:
- def save_money(self): 存钱 :return:
- def make_account(self): 创建一个账户 :return:
- def main(self): 主函数 :return:
<|skeleton|>
class AtmMutil:
def save_money(self):
"""存钱 ... | 167c86be6241c6c148eb586b5dd19275246372a7 | <|skeleton|>
class AtmMutil:
def save_money(self):
"""存钱 :return:"""
<|body_0|>
def make_account(self):
"""创建一个账户 :return:"""
<|body_1|>
def main(self):
"""主函数 :return:"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AtmMutil:
def save_money(self):
"""存钱 :return:"""
num = int(input('请输入金额:'))
account = self.balance()
account['amount'] += num
self.update_account(account)
return (True, '存款成功')
def make_account(self):
"""创建一个账户 :return:"""
import os
... | the_stack_v2_python_sparse | py3-study/面向对象课上代码/1902/11-26/ATM_mutil.py | liuluyang/mk | train | 0 | |
5548bd278c2892e7e07e9ca044aa124ae25ad776 | [
"if not nums:\n return 0\ndp = [0] * len(nums)\nfor i in range(len(nums)):\n dp[i] = 1\n for j in range(i):\n if nums[j] < nums[i]:\n dp[i] = max(dp[j] + 1, dp[i])\nreturn max(dp)",
"dp = []\nfor num in nums:\n index = bisect.bisect_left(dp, num)\n if index == len(dp):\n dp... | <|body_start_0|>
if not nums:
return 0
dp = [0] * len(nums)
for i in range(len(nums)):
dp[i] = 1
for j in range(i):
if nums[j] < nums[i]:
dp[i] = max(dp[j] + 1, dp[i])
return max(dp)
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS_MK1(self, nums: List[int]) -> int:
"""Dynamic Programming Time Complexity: O(n^2) Space complexity: O(n)"""
<|body_0|>
def lengthOfLIS_MK2(self, nums: List[int]) -> int:
"""Dynamic Programming with Binary Search Time Complexity: O(nlgn) Spac... | stack_v2_sparse_classes_36k_train_005063 | 914 | no_license | [
{
"docstring": "Dynamic Programming Time Complexity: O(n^2) Space complexity: O(n)",
"name": "lengthOfLIS_MK1",
"signature": "def lengthOfLIS_MK1(self, nums: List[int]) -> int"
},
{
"docstring": "Dynamic Programming with Binary Search Time Complexity: O(nlgn) Space Complexity: O(n)",
"name":... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS_MK1(self, nums: List[int]) -> int: Dynamic Programming Time Complexity: O(n^2) Space complexity: O(n)
- def lengthOfLIS_MK2(self, nums: List[int]) -> int: Dynamic... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS_MK1(self, nums: List[int]) -> int: Dynamic Programming Time Complexity: O(n^2) Space complexity: O(n)
- def lengthOfLIS_MK2(self, nums: List[int]) -> int: Dynamic... | d7ba416d22becfa8f2a2ae4eee04c86617cd9332 | <|skeleton|>
class Solution:
def lengthOfLIS_MK1(self, nums: List[int]) -> int:
"""Dynamic Programming Time Complexity: O(n^2) Space complexity: O(n)"""
<|body_0|>
def lengthOfLIS_MK2(self, nums: List[int]) -> int:
"""Dynamic Programming with Binary Search Time Complexity: O(nlgn) Spac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS_MK1(self, nums: List[int]) -> int:
"""Dynamic Programming Time Complexity: O(n^2) Space complexity: O(n)"""
if not nums:
return 0
dp = [0] * len(nums)
for i in range(len(nums)):
dp[i] = 1
for j in range(i):
... | the_stack_v2_python_sparse | 0300. Longest Increasing Subsequence/longest_increasing_subsequence.py | faterazer/LeetCode | train | 4 | |
f996b1c7703552286327672104b94585a51097d8 | [
"self.es = {}\nself.vs = {}\nself.max_eid = 1\nself.max_vid = 1",
"if v.vid in self.vs and self.vs[v.vid] is not v:\n raise 'Adding vertex with duplicate vid'\nif v.graph is not None and v.graph is not self:\n raise 'Adding vertex from another graph'\nif v.graph is None:\n v.graph = self\nself.vs[v.vid] ... | <|body_start_0|>
self.es = {}
self.vs = {}
self.max_eid = 1
self.max_vid = 1
<|end_body_0|>
<|body_start_1|>
if v.vid in self.vs and self.vs[v.vid] is not v:
raise 'Adding vertex with duplicate vid'
if v.graph is not None and v.graph is not self:
... | Class describing a graph. Attributes: vs: Dictionary from vid/key to vertex es: Dictionary from eid/key to edge max_vid: (internal) max_vid, used to assign vid for new vertex. Suggested to use function next_vid. max_eid: (internal) max_eid, used to assign eid for new edge. Suggested to use function next_eid. | abstract_graph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class abstract_graph:
"""Class describing a graph. Attributes: vs: Dictionary from vid/key to vertex es: Dictionary from eid/key to edge max_vid: (internal) max_vid, used to assign vid for new vertex. Suggested to use function next_vid. max_eid: (internal) max_eid, used to assign eid for new edge. Sugg... | stack_v2_sparse_classes_36k_train_005064 | 6,981 | permissive | [
{
"docstring": "Initiate empty graph",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Include orphan abstract_vertex in graph and update vertex.graph to point to self",
"name": "include_vertex",
"signature": "def include_vertex(self, v)"
},
{
"docstring"... | 5 | stack_v2_sparse_classes_30k_train_003334 | Implement the Python class `abstract_graph` described below.
Class description:
Class describing a graph. Attributes: vs: Dictionary from vid/key to vertex es: Dictionary from eid/key to edge max_vid: (internal) max_vid, used to assign vid for new vertex. Suggested to use function next_vid. max_eid: (internal) max_eid... | Implement the Python class `abstract_graph` described below.
Class description:
Class describing a graph. Attributes: vs: Dictionary from vid/key to vertex es: Dictionary from eid/key to edge max_vid: (internal) max_vid, used to assign vid for new vertex. Suggested to use function next_vid. max_eid: (internal) max_eid... | 09a5015cf8d10b6f0fd6e96a3039f60e4a8b1670 | <|skeleton|>
class abstract_graph:
"""Class describing a graph. Attributes: vs: Dictionary from vid/key to vertex es: Dictionary from eid/key to edge max_vid: (internal) max_vid, used to assign vid for new vertex. Suggested to use function next_vid. max_eid: (internal) max_eid, used to assign eid for new edge. Sugg... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class abstract_graph:
"""Class describing a graph. Attributes: vs: Dictionary from vid/key to vertex es: Dictionary from eid/key to edge max_vid: (internal) max_vid, used to assign vid for new vertex. Suggested to use function next_vid. max_eid: (internal) max_eid, used to assign eid for new edge. Suggested to use ... | the_stack_v2_python_sparse | bin/abstract_graph.py | nf-core/circdna | train | 16 |
d2c34219beeb58060dc3961a07b9d0a371bdb6e6 | [
"self.__s = s.MyStat(self.SELFNODE, arg_verbose)\nrospy.init_node(self.SELFNODE)\nself.service_ct = rospy.Service(self.SELFTOPIC + '_ct', s_ct_srv, self.handle_ct)\nself.service_st = rospy.Service(self.SELFTOPIC + '_st', s_sigtower_srv, self.handle_st)\nself.service_ws = rospy.Service(self.SELFTOPIC + '_ws', s_work... | <|body_start_0|>
self.__s = s.MyStat(self.SELFNODE, arg_verbose)
rospy.init_node(self.SELFNODE)
self.service_ct = rospy.Service(self.SELFTOPIC + '_ct', s_ct_srv, self.handle_ct)
self.service_st = rospy.Service(self.SELFTOPIC + '_st', s_sigtower_srv, self.handle_st)
self.service_w... | ストレージへの書き込み | Storage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Storage:
"""ストレージへの書き込み"""
def __init__(self, arg_verbose=False):
"""コンストラクタ Parameters ---------- arg_verbose:bool メッセージの強制表示"""
<|body_0|>
def handle_st(self, request):
"""問い合わせを受けてシグナルタワーステータスを書き込み Parameters ---------- request : s_sigtower_srv メッセージ"""
... | stack_v2_sparse_classes_36k_train_005065 | 9,146 | permissive | [
{
"docstring": "コンストラクタ Parameters ---------- arg_verbose:bool メッセージの強制表示",
"name": "__init__",
"signature": "def __init__(self, arg_verbose=False)"
},
{
"docstring": "問い合わせを受けてシグナルタワーステータスを書き込み Parameters ---------- request : s_sigtower_srv メッセージ",
"name": "handle_st",
"signature": "def... | 6 | stack_v2_sparse_classes_30k_train_010031 | Implement the Python class `Storage` described below.
Class description:
ストレージへの書き込み
Method signatures and docstrings:
- def __init__(self, arg_verbose=False): コンストラクタ Parameters ---------- arg_verbose:bool メッセージの強制表示
- def handle_st(self, request): 問い合わせを受けてシグナルタワーステータスを書き込み Parameters ---------- request : s_sigtowe... | Implement the Python class `Storage` described below.
Class description:
ストレージへの書き込み
Method signatures and docstrings:
- def __init__(self, arg_verbose=False): コンストラクタ Parameters ---------- arg_verbose:bool メッセージの強制表示
- def handle_st(self, request): 問い合わせを受けてシグナルタワーステータスを書き込み Parameters ---------- request : s_sigtowe... | 55df934c25c4eff4b6675698903c65aa74e5e675 | <|skeleton|>
class Storage:
"""ストレージへの書き込み"""
def __init__(self, arg_verbose=False):
"""コンストラクタ Parameters ---------- arg_verbose:bool メッセージの強制表示"""
<|body_0|>
def handle_st(self, request):
"""問い合わせを受けてシグナルタワーステータスを書き込み Parameters ---------- request : s_sigtower_srv メッセージ"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Storage:
"""ストレージへの書き込み"""
def __init__(self, arg_verbose=False):
"""コンストラクタ Parameters ---------- arg_verbose:bool メッセージの強制表示"""
self.__s = s.MyStat(self.SELFNODE, arg_verbose)
rospy.init_node(self.SELFNODE)
self.service_ct = rospy.Service(self.SELFTOPIC + '_ct', s_ct_srv... | the_stack_v2_python_sparse | node/Storage.py | trihome/ROS_pyControl | train | 1 |
e12d0004a4cf7594a85270664806a04a3ad9d3ae | [
"self.path = os.path.abspath(path)\nself.target_size = target_size\nself.class_mode = class_mode\nself.batch_size = batch_size\nself.augment = augment",
"if self.augment:\n generator = ImageDataGenerator(rotation_range=40, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.2, zoom_range=0.2, fill_mod... | <|body_start_0|>
self.path = os.path.abspath(path)
self.target_size = target_size
self.class_mode = class_mode
self.batch_size = batch_size
self.augment = augment
<|end_body_0|>
<|body_start_1|>
if self.augment:
generator = ImageDataGenerator(rotation_range=4... | Set up an image data pipeline based on disk files. | ImageDataFromDisk | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageDataFromDisk:
"""Set up an image data pipeline based on disk files."""
def __init__(self, path, target_size, class_mode, batch_size, augment):
"""Args: path: top level location of images on disk (proper directory structure must be present) target_size: final image resolution (he... | stack_v2_sparse_classes_36k_train_005066 | 1,624 | permissive | [
{
"docstring": "Args: path: top level location of images on disk (proper directory structure must be present) target_size: final image resolution (height, width) batch_size: how many images will be process per batch class_mode: one of ImageDataGenerator class modes augment: true to augment data, false otherwise... | 2 | stack_v2_sparse_classes_30k_train_008421 | Implement the Python class `ImageDataFromDisk` described below.
Class description:
Set up an image data pipeline based on disk files.
Method signatures and docstrings:
- def __init__(self, path, target_size, class_mode, batch_size, augment): Args: path: top level location of images on disk (proper directory structure... | Implement the Python class `ImageDataFromDisk` described below.
Class description:
Set up an image data pipeline based on disk files.
Method signatures and docstrings:
- def __init__(self, path, target_size, class_mode, batch_size, augment): Args: path: top level location of images on disk (proper directory structure... | c4edcc7dffdf261728f7a2450ab19b85409cf827 | <|skeleton|>
class ImageDataFromDisk:
"""Set up an image data pipeline based on disk files."""
def __init__(self, path, target_size, class_mode, batch_size, augment):
"""Args: path: top level location of images on disk (proper directory structure must be present) target_size: final image resolution (he... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageDataFromDisk:
"""Set up an image data pipeline based on disk files."""
def __init__(self, path, target_size, class_mode, batch_size, augment):
"""Args: path: top level location of images on disk (proper directory structure must be present) target_size: final image resolution (height, width) ... | the_stack_v2_python_sparse | image_classification/common/image_generators.py | cdragoiu/machine_learning | train | 0 |
856e8bbad431c81045a84fd91c33c105405fff45 | [
"if num1 == num2:\n return\nif len(str(num2)) > len(str(num1)):\n return\nnum1_str = str(num1)\nnum1_dict = defaultdict(int)\nnum1_max_digit = float('-inf')\nnum1_min_digit = float('inf')\ni = 0\nwhile i < len(num1_str):\n n1 = int(num1_str[i])\n num1_dict[n1] += 1\n if n1 > num1_max_digit:\n ... | <|body_start_0|>
if num1 == num2:
return
if len(str(num2)) > len(str(num1)):
return
num1_str = str(num1)
num1_dict = defaultdict(int)
num1_max_digit = float('-inf')
num1_min_digit = float('inf')
i = 0
while i < len(num1_str):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def biggerNum(self, num1, num2):
"""input num1: num input num2: num return: num num1 = 23888 numDict = { 8: 3, 3: 1, 2: 1 } sortedKeys = [8, 3, 2] 88832"""
<|body_0|>
def newNum(self, num1_dict, num1_max_digit, num1_min_digit):
"""input num1_dict: {int: int... | stack_v2_sparse_classes_36k_train_005067 | 4,728 | no_license | [
{
"docstring": "input num1: num input num2: num return: num num1 = 23888 numDict = { 8: 3, 3: 1, 2: 1 } sortedKeys = [8, 3, 2] 88832",
"name": "biggerNum",
"signature": "def biggerNum(self, num1, num2)"
},
{
"docstring": "input num1_dict: {int: int} input num1_max_digit: int input num1_min_digit... | 2 | stack_v2_sparse_classes_30k_train_012973 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def biggerNum(self, num1, num2): input num1: num input num2: num return: num num1 = 23888 numDict = { 8: 3, 3: 1, 2: 1 } sortedKeys = [8, 3, 2] 88832
- def newNum(self, num1_dict... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def biggerNum(self, num1, num2): input num1: num input num2: num return: num num1 = 23888 numDict = { 8: 3, 3: 1, 2: 1 } sortedKeys = [8, 3, 2] 88832
- def newNum(self, num1_dict... | bf98c8fa31043a45b3d21cfe78d4e08f9cac9de6 | <|skeleton|>
class Solution:
def biggerNum(self, num1, num2):
"""input num1: num input num2: num return: num num1 = 23888 numDict = { 8: 3, 3: 1, 2: 1 } sortedKeys = [8, 3, 2] 88832"""
<|body_0|>
def newNum(self, num1_dict, num1_max_digit, num1_min_digit):
"""input num1_dict: {int: int... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def biggerNum(self, num1, num2):
"""input num1: num input num2: num return: num num1 = 23888 numDict = { 8: 3, 3: 1, 2: 1 } sortedKeys = [8, 3, 2] 88832"""
if num1 == num2:
return
if len(str(num2)) > len(str(num1)):
return
num1_str = str(num1)
... | the_stack_v2_python_sparse | string/create_a_bigger_num.py | mistrydarshan99/Leetcode-3 | train | 0 | |
7e98a1f7014d23634fa7967fa88a9ffeff019a2b | [
"tl = self._grid.GetSelectionBlockTopLeft()\nbr = self._grid.GetSelectionBlockBottomRight()\nif tl == [(0, 0)] and br == [(self._grid.GetNumberRows() - 1, self._grid.GetNumberCols() - 1)]:\n self._grid.ClearSelection()\nfor (tlrow, tlcolumn), (brrow, brcolumn) in zip(tl, br):\n for row in range(tlrow, brrow +... | <|body_start_0|>
tl = self._grid.GetSelectionBlockTopLeft()
br = self._grid.GetSelectionBlockBottomRight()
if tl == [(0, 0)] and br == [(self._grid.GetNumberRows() - 1, self._grid.GetNumberCols() - 1)]:
self._grid.ClearSelection()
for (tlrow, tlcolumn), (brrow, brcolumn) in z... | s3dcGridMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class s3dcGridMixin:
def _handlerGridRangeSelect(self, event):
"""This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to ... | stack_v2_sparse_classes_36k_train_005068 | 3,119 | no_license | [
{
"docstring": "This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to be selected, but GetSelectedRows() doesn't think so. This event hand... | 2 | stack_v2_sparse_classes_30k_train_003647 | Implement the Python class `s3dcGridMixin` described below.
Class description:
Implement the s3dcGridMixin class.
Method signatures and docstrings:
- def _handlerGridRangeSelect(self, event): This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activa... | Implement the Python class `s3dcGridMixin` described below.
Class description:
Implement the s3dcGridMixin class.
Method signatures and docstrings:
- def _handlerGridRangeSelect(self, event): This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activa... | 586225d68b079e2a96007bd33784113b3a19a538 | <|skeleton|>
class s3dcGridMixin:
def _handlerGridRangeSelect(self, event):
"""This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class s3dcGridMixin:
def _handlerGridRangeSelect(self, event):
"""This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to be selected, b... | the_stack_v2_python_sparse | modules/viewers/slice3dVWRmodules/shared.py | JoonVan/devide | train | 0 | |
10d6df36c62622a245b5fde67223d1ef42400290 | [
"lowest = float('inf')\nhighest = float('-inf')\nprofit = 0\nfor p in reversed(prices):\n if p > highest:\n highest = p\n lowest = float('inf')\n elif p <= highest:\n if p < lowest:\n lowest = p\n if highest - lowest > profit:\n profit = highest - lowe... | <|body_start_0|>
lowest = float('inf')
highest = float('-inf')
profit = 0
for p in reversed(prices):
if p > highest:
highest = p
lowest = float('inf')
elif p <= highest:
if p < lowest:
lowest = p
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""Purpose: Returns the highest profit you can make by buying and selling stock, at most once. Note: Scans graph from left to right, updating global max and min."""
<|body_0|>
def maxProfit(self, prices: List[int]) -> ... | stack_v2_sparse_classes_36k_train_005069 | 1,571 | no_license | [
{
"docstring": "Purpose: Returns the highest profit you can make by buying and selling stock, at most once. Note: Scans graph from left to right, updating global max and min.",
"name": "maxProfit",
"signature": "def maxProfit(self, prices: List[int]) -> int"
},
{
"docstring": "Updated solver.",
... | 3 | stack_v2_sparse_classes_30k_train_008400 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: Purpose: Returns the highest profit you can make by buying and selling stock, at most once. Note: Scans graph from left to right, u... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: Purpose: Returns the highest profit you can make by buying and selling stock, at most once. Note: Scans graph from left to right, u... | 95a86cbbca28d0c0f6d72d28a2f1cb5a86327934 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""Purpose: Returns the highest profit you can make by buying and selling stock, at most once. Note: Scans graph from left to right, updating global max and min."""
<|body_0|>
def maxProfit(self, prices: List[int]) -> ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""Purpose: Returns the highest profit you can make by buying and selling stock, at most once. Note: Scans graph from left to right, updating global max and min."""
lowest = float('inf')
highest = float('-inf')
profit = 0... | the_stack_v2_python_sparse | best_profit.py | tashakim/puzzles_python | train | 8 | |
7050232e10778ce64fa8e2d01ca53b627caf067b | [
"if len(height) == 2:\n return min(height[1], height[0])\nmax_area = 0\nfor i in range(len(height)):\n for j in range(1, len(height)):\n max_area = max(max_area, min(height[i], height[j]) * abs(j - i))\nreturn max_area",
"if len(height) == 2:\n return min(height[1], height[0])\nleft = 0\nright = l... | <|body_start_0|>
if len(height) == 2:
return min(height[1], height[0])
max_area = 0
for i in range(len(height)):
for j in range(1, len(height)):
max_area = max(max_area, min(height[i], height[j]) * abs(j - i))
return max_area
<|end_body_0|>
<|body... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea_TLE(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(height) == 2:
return m... | stack_v2_sparse_classes_36k_train_005070 | 1,903 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea_TLE",
"signature": "def maxArea_TLE(self, height)"
},
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea",
"signature": "def maxArea(self, height)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016636 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea_TLE(self, height): :type height: List[int] :rtype: int
- def maxArea(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_TLE(self, height): :type height: List[int] :rtype: int
- def maxArea(self, height): :type height: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxArea... | 2d5fa4cd696d5035ea8859befeadc5cc436959c9 | <|skeleton|>
class Solution:
def maxArea_TLE(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea(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_TLE(self, height):
""":type height: List[int] :rtype: int"""
if len(height) == 2:
return min(height[1], height[0])
max_area = 0
for i in range(len(height)):
for j in range(1, len(height)):
max_area = max(max_area, mi... | the_stack_v2_python_sparse | SourceCode/Python/Problem/00011.Container With Most Water.py | roger6blog/LeetCode | train | 0 | |
6ff0920af5e23e593568f640693e6fff89f864b8 | [
"self.dict = {}\nfor i in range(len(words)):\n w = words[i]\n if w in self.dict:\n self.dict[w].append(i)\n else:\n self.dict[w] = [i]",
"ix1 = self.dict[word1]\nix2 = self.dict[word2]\ni1, i2 = (0, 0)\nret = float('inf')\nwhile i1 < len(ix1) and i2 < len(ix2):\n ret = min(ret, abs(ix2[i... | <|body_start_0|>
self.dict = {}
for i in range(len(words)):
w = words[i]
if w in self.dict:
self.dict[w].append(i)
else:
self.dict[w] = [i]
<|end_body_0|>
<|body_start_1|>
ix1 = self.dict[word1]
ix2 = self.dict[word2]
... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.dict = {}
for i in range... | stack_v2_sparse_classes_36k_train_005071 | 950 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021439 | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance:
... | f7cb7cfa6e1f04efd741c2456ad930db48101573 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
self.dict = {}
for i in range(len(words)):
w = words[i]
if w in self.dict:
self.dict[w].append(i)
else:
self.dict[w] = [i]
def shortest(self, w... | the_stack_v2_python_sparse | 244.shortestWordDist2.py | umnstao/leetcodeOJ | train | 0 | |
11bc4a9a07feb860f7344d807e54add28090193a | [
"json_str = session_details.to_json()\nwith open(session_details_file_path, 'w') as outfile:\n json.dump(json_str, outfile, sort_keys=False, indent=4, separators=(',', ': '), ensure_ascii=False)",
"try:\n with open(session_file_path) as data_file:\n data_loaded = json.load(data_file)\n session... | <|body_start_0|>
json_str = session_details.to_json()
with open(session_details_file_path, 'w') as outfile:
json.dump(json_str, outfile, sort_keys=False, indent=4, separators=(',', ': '), ensure_ascii=False)
<|end_body_0|>
<|body_start_1|>
try:
with open(session_file_pat... | - Reads and writes the file that contains the session details. | SessionRW | [
"CC-BY-3.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionRW:
"""- Reads and writes the file that contains the session details."""
def write_session_details_file(session_details_file_path: str, session_details: SessionDetails):
"""- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails in... | stack_v2_sparse_classes_36k_train_005072 | 1,810 | permissive | [
{
"docstring": "- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails instance. :param session_details: SessionDetails instance.",
"name": "write_session_details_file",
"signature": "def write_session_details_file(session_details_file_path: str, session_de... | 2 | null | Implement the Python class `SessionRW` described below.
Class description:
- Reads and writes the file that contains the session details.
Method signatures and docstrings:
- def write_session_details_file(session_details_file_path: str, session_details: SessionDetails): - Writes the file that contains the session det... | Implement the Python class `SessionRW` described below.
Class description:
- Reads and writes the file that contains the session details.
Method signatures and docstrings:
- def write_session_details_file(session_details_file_path: str, session_details: SessionDetails): - Writes the file that contains the session det... | 138c7fa83e084ccb8f5c2ad8827f1fbb2527c00c | <|skeleton|>
class SessionRW:
"""- Reads and writes the file that contains the session details."""
def write_session_details_file(session_details_file_path: str, session_details: SessionDetails):
"""- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SessionRW:
"""- Reads and writes the file that contains the session details."""
def write_session_details_file(session_details_file_path: str, session_details: SessionDetails):
"""- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails instance. :para... | the_stack_v2_python_sparse | file_experts/session_rw.py | iliesidaniel/image-classification | train | 0 |
e7411ff933694afbcaf5d9dc6a2d04a3b9958d83 | [
"cr, uid, context = self.env.args\nemp_id = self.employee_id.id\nif emp_id:\n bed_id = self.env['beds.beds'].search([('employee_id', '=', self.employee_id.id), ('room_id.accommodation_id', '=', context.get('accommodation_id'))])\n if not bed_id:\n emp_name = self.employee_id.name\n raise Validat... | <|body_start_0|>
cr, uid, context = self.env.args
emp_id = self.employee_id.id
if emp_id:
bed_id = self.env['beds.beds'].search([('employee_id', '=', self.employee_id.id), ('room_id.accommodation_id', '=', context.get('accommodation_id'))])
if not bed_id:
... | wiz_vacant_bed | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class wiz_vacant_bed:
def onchange_employee(self):
"""This method is used to identify the bed and room based on the employee selected. ------------------------------------------------------------------ @param self : object pointer @param return : True"""
<|body_0|>
def vacant_bed(... | stack_v2_sparse_classes_36k_train_005073 | 3,454 | no_license | [
{
"docstring": "This method is used to identify the bed and room based on the employee selected. ------------------------------------------------------------------ @param self : object pointer @param return : True",
"name": "onchange_employee",
"signature": "def onchange_employee(self)"
},
{
"do... | 2 | stack_v2_sparse_classes_30k_train_009370 | Implement the Python class `wiz_vacant_bed` described below.
Class description:
Implement the wiz_vacant_bed class.
Method signatures and docstrings:
- def onchange_employee(self): This method is used to identify the bed and room based on the employee selected. --------------------------------------------------------... | Implement the Python class `wiz_vacant_bed` described below.
Class description:
Implement the wiz_vacant_bed class.
Method signatures and docstrings:
- def onchange_employee(self): This method is used to identify the bed and room based on the employee selected. --------------------------------------------------------... | 46e15330b5d642053da61754247f3fbf9d02717e | <|skeleton|>
class wiz_vacant_bed:
def onchange_employee(self):
"""This method is used to identify the bed and room based on the employee selected. ------------------------------------------------------------------ @param self : object pointer @param return : True"""
<|body_0|>
def vacant_bed(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class wiz_vacant_bed:
def onchange_employee(self):
"""This method is used to identify the bed and room based on the employee selected. ------------------------------------------------------------------ @param self : object pointer @param return : True"""
cr, uid, context = self.env.args
emp_... | the_stack_v2_python_sparse | core/sg_accommodation/wizard/wiz_vacant_bed.py | Muhammad-SF/Test | train | 0 | |
c2c5e005b3c3de4be0b46cac6045f476cfe468f5 | [
"passwd = data['password']\npasswd_conf = data['password_confirmation']\nif passwd != passwd_conf:\n raise serializers.ValidationError(\"Passwords don't match.\")\npassword_validation.validate_password(passwd)\ngeocode = geocoder.google(data['address'], key=settings.GOOGLE_API_KEY)\nif geocode:\n data['lat'],... | <|body_start_0|>
passwd = data['password']
passwd_conf = data['password_confirmation']
if passwd != passwd_conf:
raise serializers.ValidationError("Passwords don't match.")
password_validation.validate_password(passwd)
geocode = geocoder.google(data['address'], key=se... | User signup Serializer. Handle sign up data validation and user/type user creation. | UserSignupSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserSignupSerializer:
"""User signup Serializer. Handle sign up data validation and user/type user creation."""
def validate(self, data):
"""Verify passwords match."""
<|body_0|>
def validate_availability(self, value):
"""Check if in the request only has only a u... | stack_v2_sparse_classes_36k_train_005074 | 7,359 | permissive | [
{
"docstring": "Verify passwords match.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Check if in the request only has only a unique combination between shift and day.",
"name": "validate_availability",
"signature": "def validate_availability(self, valu... | 3 | stack_v2_sparse_classes_30k_train_002209 | Implement the Python class `UserSignupSerializer` described below.
Class description:
User signup Serializer. Handle sign up data validation and user/type user creation.
Method signatures and docstrings:
- def validate(self, data): Verify passwords match.
- def validate_availability(self, value): Check if in the requ... | Implement the Python class `UserSignupSerializer` described below.
Class description:
User signup Serializer. Handle sign up data validation and user/type user creation.
Method signatures and docstrings:
- def validate(self, data): Verify passwords match.
- def validate_availability(self, value): Check if in the requ... | 5c37c6876ca13b5794ac44e0342b810426acbc76 | <|skeleton|>
class UserSignupSerializer:
"""User signup Serializer. Handle sign up data validation and user/type user creation."""
def validate(self, data):
"""Verify passwords match."""
<|body_0|>
def validate_availability(self, value):
"""Check if in the request only has only a u... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserSignupSerializer:
"""User signup Serializer. Handle sign up data validation and user/type user creation."""
def validate(self, data):
"""Verify passwords match."""
passwd = data['password']
passwd_conf = data['password_confirmation']
if passwd != passwd_conf:
... | the_stack_v2_python_sparse | hisitter/users/serializers/users.py | babysitter-finder/backend | train | 1 |
479beb085d70affdb9feda9faa6d7207bd085107 | [
"super().__init__(light_profile=None, grid=grid, mat_plot_1d=mat_plot_1d, visuals_1d=visuals_1d, include_1d=include_1d, mat_plot_2d=mat_plot_2d, visuals_2d=visuals_2d, include_2d=include_2d)\nself.light_profile_pdf_list = light_profile_pdf_list\nself.sigma = sigma\nself.low_limit = (1 - math.erf(sigma / math.sqrt(2... | <|body_start_0|>
super().__init__(light_profile=None, grid=grid, mat_plot_1d=mat_plot_1d, visuals_1d=visuals_1d, include_1d=include_1d, mat_plot_2d=mat_plot_2d, visuals_2d=visuals_2d, include_2d=include_2d)
self.light_profile_pdf_list = light_profile_pdf_list
self.sigma = sigma
self.low_... | LightProfilePDFPlotter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LightProfilePDFPlotter:
def __init__(self, light_profile_pdf_list: List[LightProfile], grid: aa.type.Grid2DLike, mat_plot_1d: MatPlot1D=MatPlot1D(), visuals_1d: Visuals1D=Visuals1D(), include_1d: Include1D=Include1D(), mat_plot_2d: MatPlot2D=MatPlot2D(), visuals_2d: Visuals2D=Visuals2D(), includ... | stack_v2_sparse_classes_36k_train_005075 | 12,969 | permissive | [
{
"docstring": "Plots the attributes of a list of `LightProfile` objects using the matplotlib methods `plot()` and `imshow()` and many other matplotlib functions which customize the plot's appearance. Figures plotted by this object average over a list light profiles to computed the average value of each attribu... | 2 | null | Implement the Python class `LightProfilePDFPlotter` described below.
Class description:
Implement the LightProfilePDFPlotter class.
Method signatures and docstrings:
- def __init__(self, light_profile_pdf_list: List[LightProfile], grid: aa.type.Grid2DLike, mat_plot_1d: MatPlot1D=MatPlot1D(), visuals_1d: Visuals1D=Vis... | Implement the Python class `LightProfilePDFPlotter` described below.
Class description:
Implement the LightProfilePDFPlotter class.
Method signatures and docstrings:
- def __init__(self, light_profile_pdf_list: List[LightProfile], grid: aa.type.Grid2DLike, mat_plot_1d: MatPlot1D=MatPlot1D(), visuals_1d: Visuals1D=Vis... | d1a2e400b7ac984a21d972f54e419d8783342454 | <|skeleton|>
class LightProfilePDFPlotter:
def __init__(self, light_profile_pdf_list: List[LightProfile], grid: aa.type.Grid2DLike, mat_plot_1d: MatPlot1D=MatPlot1D(), visuals_1d: Visuals1D=Visuals1D(), include_1d: Include1D=Include1D(), mat_plot_2d: MatPlot2D=MatPlot2D(), visuals_2d: Visuals2D=Visuals2D(), includ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LightProfilePDFPlotter:
def __init__(self, light_profile_pdf_list: List[LightProfile], grid: aa.type.Grid2DLike, mat_plot_1d: MatPlot1D=MatPlot1D(), visuals_1d: Visuals1D=Visuals1D(), include_1d: Include1D=Include1D(), mat_plot_2d: MatPlot2D=MatPlot2D(), visuals_2d: Visuals2D=Visuals2D(), include_2d: Include2... | the_stack_v2_python_sparse | autogalaxy/profiles/plot/light_profile_plotters.py | Jammy2211/PyAutoGalaxy | train | 27 | |
a59a492015185b6e1a9af5b1fdf98acebc0c109e | [
"sc.logger.info('小影圈关注页面初始状态检查开始')\nfun_name = 'test_planet_page'\nsc.logger.info('点击小影圈主按钮')\np_btn = 'com.quvideo.xiaoying:id/img_find'\nWebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(p_btn)).click()\ntime.sleep(1)\nsc.logger.info('开始查找小影圈关注tab')\nel_tab_list = sc.driver.find_elements_by_i... | <|body_start_0|>
sc.logger.info('小影圈关注页面初始状态检查开始')
fun_name = 'test_planet_page'
sc.logger.info('点击小影圈主按钮')
p_btn = 'com.quvideo.xiaoying:id/img_find'
WebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(p_btn)).click()
time.sleep(1)
sc.logger.in... | 小影圈关注页UI的测试类,分步截图. | TestPlanetExploreUI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPlanetExploreUI:
"""小影圈关注页UI的测试类,分步截图."""
def test_planet_page(self):
"""小影圈关注页面初始状态测试."""
<|body_0|>
def test_refresh(self):
"""测试下拉刷新."""
<|body_1|>
def test_swipe_vertical(self):
"""测试上下方向的滑动."""
<|body_2|>
def test_origin... | stack_v2_sparse_classes_36k_train_005076 | 3,656 | no_license | [
{
"docstring": "小影圈关注页面初始状态测试.",
"name": "test_planet_page",
"signature": "def test_planet_page(self)"
},
{
"docstring": "测试下拉刷新.",
"name": "test_refresh",
"signature": "def test_refresh(self)"
},
{
"docstring": "测试上下方向的滑动.",
"name": "test_swipe_vertical",
"signature": "d... | 4 | stack_v2_sparse_classes_30k_train_012401 | Implement the Python class `TestPlanetExploreUI` described below.
Class description:
小影圈关注页UI的测试类,分步截图.
Method signatures and docstrings:
- def test_planet_page(self): 小影圈关注页面初始状态测试.
- def test_refresh(self): 测试下拉刷新.
- def test_swipe_vertical(self): 测试上下方向的滑动.
- def test_origin_home(self): 关注页tab的功能. | Implement the Python class `TestPlanetExploreUI` described below.
Class description:
小影圈关注页UI的测试类,分步截图.
Method signatures and docstrings:
- def test_planet_page(self): 小影圈关注页面初始状态测试.
- def test_refresh(self): 测试下拉刷新.
- def test_swipe_vertical(self): 测试上下方向的滑动.
- def test_origin_home(self): 关注页tab的功能.
<|skeleton|>
cl... | 0003b68fc8e26a96ee1661c1eb1f26f96810e909 | <|skeleton|>
class TestPlanetExploreUI:
"""小影圈关注页UI的测试类,分步截图."""
def test_planet_page(self):
"""小影圈关注页面初始状态测试."""
<|body_0|>
def test_refresh(self):
"""测试下拉刷新."""
<|body_1|>
def test_swipe_vertical(self):
"""测试上下方向的滑动."""
<|body_2|>
def test_origin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestPlanetExploreUI:
"""小影圈关注页UI的测试类,分步截图."""
def test_planet_page(self):
"""小影圈关注页面初始状态测试."""
sc.logger.info('小影圈关注页面初始状态检查开始')
fun_name = 'test_planet_page'
sc.logger.info('点击小影圈主按钮')
p_btn = 'com.quvideo.xiaoying:id/img_find'
WebDriverWait(sc.driver, 10,... | the_stack_v2_python_sparse | iOS/VivaVideo/test_community/test_personal/test_follow.py | Lemonzhulixin/UItest | train | 5 |
ee96e5ab8eaed6292809fd67b2d52a40e5b4ba90 | [
"if request.method == 'GET':\n serializer = self.get_serializer(self.request.user)\nelif request.method == 'POST':\n serializer = self.get_serializer(instance=self.request.user, data=request.data, partial=True)\n serializer.is_valid(raise_exception=True)\n serializer.save()\nelse:\n raise MethodNotAl... | <|body_start_0|>
if request.method == 'GET':
serializer = self.get_serializer(self.request.user)
elif request.method == 'POST':
serializer = self.get_serializer(instance=self.request.user, data=request.data, partial=True)
serializer.is_valid(raise_exception=True)
... | UserViewSet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserViewSet:
def info(self, request, *args, **kwargs):
"""获取或修改用户信息"""
<|body_0|>
def reset_password(self, request, *args, **kwargs):
"""管理员密码重置"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if request.method == 'GET':
serializer = sel... | stack_v2_sparse_classes_36k_train_005077 | 3,087 | permissive | [
{
"docstring": "获取或修改用户信息",
"name": "info",
"signature": "def info(self, request, *args, **kwargs)"
},
{
"docstring": "管理员密码重置",
"name": "reset_password",
"signature": "def reset_password(self, request, *args, **kwargs)"
}
] | 2 | null | Implement the Python class `UserViewSet` described below.
Class description:
Implement the UserViewSet class.
Method signatures and docstrings:
- def info(self, request, *args, **kwargs): 获取或修改用户信息
- def reset_password(self, request, *args, **kwargs): 管理员密码重置 | Implement the Python class `UserViewSet` described below.
Class description:
Implement the UserViewSet class.
Method signatures and docstrings:
- def info(self, request, *args, **kwargs): 获取或修改用户信息
- def reset_password(self, request, *args, **kwargs): 管理员密码重置
<|skeleton|>
class UserViewSet:
def info(self, reque... | b8021250bf3d8cf7adc566deebdba55225148316 | <|skeleton|>
class UserViewSet:
def info(self, request, *args, **kwargs):
"""获取或修改用户信息"""
<|body_0|>
def reset_password(self, request, *args, **kwargs):
"""管理员密码重置"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserViewSet:
def info(self, request, *args, **kwargs):
"""获取或修改用户信息"""
if request.method == 'GET':
serializer = self.get_serializer(self.request.user)
elif request.method == 'POST':
serializer = self.get_serializer(instance=self.request.user, data=request.data, ... | the_stack_v2_python_sparse | apps/user/views.py | lianxiaopang/camel-store-api | train | 0 | |
60ec0c5870def3695556dcc29fd5d3026eacb8a5 | [
"if nums == []:\n return []\nquadruplets = list()\nnums = sorted(nums)\nfor i in range(len(nums) - 3):\n if i > 0 and nums[i] == nums[i - 1]:\n continue\n for j in range(i + 1, len(nums) - 2):\n hash_ = []\n for k in range(j + 1, len(nums)):\n complement = target - (nums[i] ... | <|body_start_0|>
if nums == []:
return []
quadruplets = list()
nums = sorted(nums)
for i in range(len(nums) - 3):
if i > 0 and nums[i] == nums[i - 1]:
continue
for j in range(i + 1, len(nums) - 2):
hash_ = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
""":param nums: A list of integers :param target: The target to sum up to"""
<|body_0|>
def test_fourSum(self):
"""Method to test the code with a few sample cases"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_005078 | 1,858 | no_license | [
{
"docstring": ":param nums: A list of integers :param target: The target to sum up to",
"name": "fourSum",
"signature": "def fourSum(self, nums: List[int], target: int) -> List[List[int]]"
},
{
"docstring": "Method to test the code with a few sample cases",
"name": "test_fourSum",
"sign... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fourSum(self, nums: List[int], target: int) -> List[List[int]]: :param nums: A list of integers :param target: The target to sum up to
- def test_fourSum(self): Method to tes... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fourSum(self, nums: List[int], target: int) -> List[List[int]]: :param nums: A list of integers :param target: The target to sum up to
- def test_fourSum(self): Method to tes... | 575fa25c4586fa41b3d45d95dca6eff9584c3a4a | <|skeleton|>
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
""":param nums: A list of integers :param target: The target to sum up to"""
<|body_0|>
def test_fourSum(self):
"""Method to test the code with a few sample cases"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
""":param nums: A list of integers :param target: The target to sum up to"""
if nums == []:
return []
quadruplets = list()
nums = sorted(nums)
for i in range(len(nums) - 3):
... | the_stack_v2_python_sparse | leetcode/4sum.py | aaakashkumar/competitive_programming | train | 0 | |
b81619824a78e1a3710418ee60a90ba99e1f97ce | [
"if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host",
"headers = {'org': org, 'user': user}\nroute_name = ''\nserv... | <|body_start_0|>
if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):
raise Exception('server_ip和server_port必须同时指定')
self._server_ip = server_ip
self._server_port = server_port
self._service_name = service_name
self._host = host
<|end_bod... | FormSchemaClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormSchemaClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和se... | stack_v2_sparse_classes_36k_train_005079 | 6,297 | permissive | [
{
"docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com",
"name": "__ini... | 4 | stack_v2_sparse_classes_30k_train_007683 | Implement the Python class `FormSchemaClient` described below.
Class description:
Implement the FormSchemaClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的se... | Implement the Python class `FormSchemaClient` described below.
Class description:
Implement the FormSchemaClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的se... | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | <|skeleton|>
class FormSchemaClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FormSchemaClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置... | the_stack_v2_python_sparse | flowable_service_sdk/api/form_schema/form_schema_client.py | easyopsapis/easyops-api-python | train | 5 | |
687ba5868b68413c24d3837714840ea14a2e3395 | [
"pivot_redshift = float(pivot_redshift)\nif pivot_redshift < 0:\n raise ValueError('pivot redshift must be positive.')\nself.pivot_redshift = pivot_redshift",
"survival_prob = np.clip(self.pivot_redshift / data['redshift'], 0, 1)\nrng = np.random.default_rng(seed)\nidx = np.where(rng.random(size=data.shape[0])... | <|body_start_0|>
pivot_redshift = float(pivot_redshift)
if pivot_redshift < 0:
raise ValueError('pivot redshift must be positive.')
self.pivot_redshift = pivot_redshift
<|end_body_0|>
<|body_start_1|>
survival_prob = np.clip(self.pivot_redshift / data['redshift'], 0, 1)
... | Degrader that simulates incompleteness with a selection function inversely proportional to redshift. The survival probability of this selection function is p(z) = min(1, z_p/z), where z_p is the pivot redshift. | InvRedshiftIncompleteness | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvRedshiftIncompleteness:
"""Degrader that simulates incompleteness with a selection function inversely proportional to redshift. The survival probability of this selection function is p(z) = min(1, z_p/z), where z_p is the pivot redshift."""
def __init__(self, pivot_redshift):
"""P... | stack_v2_sparse_classes_36k_train_005080 | 4,671 | permissive | [
{
"docstring": "Parameters ---------- pivot_redshift : positive float The redshift at which the incompleteness begins.",
"name": "__init__",
"signature": "def __init__(self, pivot_redshift)"
},
{
"docstring": "Parameters ---------- data : pd.DataFrame DataFrame of galaxy data to be degraded. see... | 2 | stack_v2_sparse_classes_30k_train_001990 | Implement the Python class `InvRedshiftIncompleteness` described below.
Class description:
Degrader that simulates incompleteness with a selection function inversely proportional to redshift. The survival probability of this selection function is p(z) = min(1, z_p/z), where z_p is the pivot redshift.
Method signature... | Implement the Python class `InvRedshiftIncompleteness` described below.
Class description:
Degrader that simulates incompleteness with a selection function inversely proportional to redshift. The survival probability of this selection function is p(z) = min(1, z_p/z), where z_p is the pivot redshift.
Method signature... | 3224cd3caef645e10a3dfd346dbee85240979888 | <|skeleton|>
class InvRedshiftIncompleteness:
"""Degrader that simulates incompleteness with a selection function inversely proportional to redshift. The survival probability of this selection function is p(z) = min(1, z_p/z), where z_p is the pivot redshift."""
def __init__(self, pivot_redshift):
"""P... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InvRedshiftIncompleteness:
"""Degrader that simulates incompleteness with a selection function inversely proportional to redshift. The survival probability of this selection function is p(z) = min(1, z_p/z), where z_p is the pivot redshift."""
def __init__(self, pivot_redshift):
"""Parameters ---... | the_stack_v2_python_sparse | rail/creation/degradation/spectroscopic_degraders.py | MarkusMichaelRau/RAIL | train | 0 |
df8f379bf0e31b4cba6ce5920b0c9e13a9e6c8c0 | [
"if not root:\n return True\nreturn self.is_mirror(root.left, root.right)",
"if not left and (not right):\n return True\nelif not left or not right:\n return False\nelif left.val == right.val:\n in_pair = self.is_mirror(left.right, right.left)\n out_pair = self.is_mirror(left.left, right.right)\n ... | <|body_start_0|>
if not root:
return True
return self.is_mirror(root.left, root.right)
<|end_body_0|>
<|body_start_1|>
if not left and (not right):
return True
elif not left or not right:
return False
elif left.val == right.val:
in... | A solution class | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""A solution class"""
def isSymmetric(self, root):
"""Checks if the tree is symmetric or not Args: root: root node to start with Returns: bool: indicating if the tree is a symmetric or not"""
<|body_0|>
def is_mirror(self, left, right):
"""Helper funct... | stack_v2_sparse_classes_36k_train_005081 | 1,754 | no_license | [
{
"docstring": "Checks if the tree is symmetric or not Args: root: root node to start with Returns: bool: indicating if the tree is a symmetric or not",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
},
{
"docstring": "Helper function to call recursively Args: left: left node ... | 2 | stack_v2_sparse_classes_30k_train_007037 | Implement the Python class `Solution` described below.
Class description:
A solution class
Method signatures and docstrings:
- def isSymmetric(self, root): Checks if the tree is symmetric or not Args: root: root node to start with Returns: bool: indicating if the tree is a symmetric or not
- def is_mirror(self, left,... | Implement the Python class `Solution` described below.
Class description:
A solution class
Method signatures and docstrings:
- def isSymmetric(self, root): Checks if the tree is symmetric or not Args: root: root node to start with Returns: bool: indicating if the tree is a symmetric or not
- def is_mirror(self, left,... | 01fe893ba2e37c9bda79e3081c556698f0b6d2f0 | <|skeleton|>
class Solution:
"""A solution class"""
def isSymmetric(self, root):
"""Checks if the tree is symmetric or not Args: root: root node to start with Returns: bool: indicating if the tree is a symmetric or not"""
<|body_0|>
def is_mirror(self, left, right):
"""Helper funct... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""A solution class"""
def isSymmetric(self, root):
"""Checks if the tree is symmetric or not Args: root: root node to start with Returns: bool: indicating if the tree is a symmetric or not"""
if not root:
return True
return self.is_mirror(root.left, root.rig... | the_stack_v2_python_sparse | LeetCode/101_symmetric_tree.py | KKosukeee/CodingQuestions | train | 1 |
ee554dc4293d42926a2c638b9567e5448090ac38 | [
"QtGui.QSlider.__init__(self, QtCore.Qt.Horizontal, parent)\nself.setRange(100, 300)\nself.setValue(100)\nself.setTracking(True)\nself.setStatusTip('Zoom in the image')\nself.connect(self, QtCore.SIGNAL('valueChanged(int)'), self.updateZoom)\nself.connect(self, QtCore.SIGNAL('needUpdateStatus'), self.updateStatus)\... | <|body_start_0|>
QtGui.QSlider.__init__(self, QtCore.Qt.Horizontal, parent)
self.setRange(100, 300)
self.setValue(100)
self.setTracking(True)
self.setStatusTip('Zoom in the image')
self.connect(self, QtCore.SIGNAL('valueChanged(int)'), self.updateZoom)
self.connec... | ImageViewerZoomSlider is a slider that allows user to zoom in and out by dragging it | ImageViewerZoomSlider | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageViewerZoomSlider:
"""ImageViewerZoomSlider is a slider that allows user to zoom in and out by dragging it"""
def __init__(self, parent=None):
"""ImageViewerZoomSlider(parent: QWidget) -> ImageViewerZoomSlider Setup the ranges, status tip, etc. of the slider"""
<|body_0|>... | stack_v2_sparse_classes_36k_train_005082 | 14,880 | permissive | [
{
"docstring": "ImageViewerZoomSlider(parent: QWidget) -> ImageViewerZoomSlider Setup the ranges, status tip, etc. of the slider",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "updateZoom(value: int) -> None Update the image when the slider value changed",... | 3 | null | Implement the Python class `ImageViewerZoomSlider` described below.
Class description:
ImageViewerZoomSlider is a slider that allows user to zoom in and out by dragging it
Method signatures and docstrings:
- def __init__(self, parent=None): ImageViewerZoomSlider(parent: QWidget) -> ImageViewerZoomSlider Setup the ran... | Implement the Python class `ImageViewerZoomSlider` described below.
Class description:
ImageViewerZoomSlider is a slider that allows user to zoom in and out by dragging it
Method signatures and docstrings:
- def __init__(self, parent=None): ImageViewerZoomSlider(parent: QWidget) -> ImageViewerZoomSlider Setup the ran... | 23ef56ec24b85c82416e1437a08381635328abe5 | <|skeleton|>
class ImageViewerZoomSlider:
"""ImageViewerZoomSlider is a slider that allows user to zoom in and out by dragging it"""
def __init__(self, parent=None):
"""ImageViewerZoomSlider(parent: QWidget) -> ImageViewerZoomSlider Setup the ranges, status tip, etc. of the slider"""
<|body_0|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageViewerZoomSlider:
"""ImageViewerZoomSlider is a slider that allows user to zoom in and out by dragging it"""
def __init__(self, parent=None):
"""ImageViewerZoomSlider(parent: QWidget) -> ImageViewerZoomSlider Setup the ranges, status tip, etc. of the slider"""
QtGui.QSlider.__init__(... | the_stack_v2_python_sparse | vistrails_current/vistrails/packages/spreadsheet/widgets/imageviewer/imageviewer.py | lumig242/VisTrailsRecommendation | train | 3 |
0059f309df5e7972400a727975f38a0a0c151989 | [
"self.create_pst = create_pst\nself.pst_password = pst_password\nself.pst_size_threshold = pst_size_threshold",
"if dictionary is None:\n return None\ncreate_pst = dictionary.get('createPst')\npst_password = dictionary.get('pstPassword')\npst_size_threshold = dictionary.get('pstSizeThreshold')\nreturn cls(crea... | <|body_start_0|>
self.create_pst = create_pst
self.pst_password = pst_password
self.pst_size_threshold = pst_size_threshold
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
create_pst = dictionary.get('createPst')
pst_password = dictionary.g... | Implementation of the 'PstParameters' model. Specifies PST conversion details. Attributes: create_pst (bool): Specifies if create a PST or MSG for input items. For 6.6 we always set this to true. pst_password (string): Specifies Password to be set for generated PSTs. pst_size_threshold (long|int): Specifies PST size th... | PstParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PstParameters:
"""Implementation of the 'PstParameters' model. Specifies PST conversion details. Attributes: create_pst (bool): Specifies if create a PST or MSG for input items. For 6.6 we always set this to true. pst_password (string): Specifies Password to be set for generated PSTs. pst_size_th... | stack_v2_sparse_classes_36k_train_005083 | 1,970 | permissive | [
{
"docstring": "Constructor for the PstParameters class",
"name": "__init__",
"signature": "def __init__(self, create_pst=None, pst_password=None, pst_size_threshold=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represen... | 2 | stack_v2_sparse_classes_30k_train_016248 | Implement the Python class `PstParameters` described below.
Class description:
Implementation of the 'PstParameters' model. Specifies PST conversion details. Attributes: create_pst (bool): Specifies if create a PST or MSG for input items. For 6.6 we always set this to true. pst_password (string): Specifies Password to... | Implement the Python class `PstParameters` described below.
Class description:
Implementation of the 'PstParameters' model. Specifies PST conversion details. Attributes: create_pst (bool): Specifies if create a PST or MSG for input items. For 6.6 we always set this to true. pst_password (string): Specifies Password to... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PstParameters:
"""Implementation of the 'PstParameters' model. Specifies PST conversion details. Attributes: create_pst (bool): Specifies if create a PST or MSG for input items. For 6.6 we always set this to true. pst_password (string): Specifies Password to be set for generated PSTs. pst_size_th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PstParameters:
"""Implementation of the 'PstParameters' model. Specifies PST conversion details. Attributes: create_pst (bool): Specifies if create a PST or MSG for input items. For 6.6 we always set this to true. pst_password (string): Specifies Password to be set for generated PSTs. pst_size_threshold (long... | the_stack_v2_python_sparse | cohesity_management_sdk/models/pst_parameters.py | cohesity/management-sdk-python | train | 24 |
4921da7ce88afd440d097cc404d7f4dd8e132cd1 | [
"for case in self.__class__.SCALES:\n with self.subTest(case=case):\n self.assertEqual(colors.merge_colors(case[0][0], case[0][1]), case[1])",
"for case in self.__class__.TEXTS:\n with self.subTest(case=case):\n self.assertEqual(colors.color_str_to_trio(case[0]), case[1])",
"for case in self... | <|body_start_0|>
for case in self.__class__.SCALES:
with self.subTest(case=case):
self.assertEqual(colors.merge_colors(case[0][0], case[0][1]), case[1])
<|end_body_0|>
<|body_start_1|>
for case in self.__class__.TEXTS:
with self.subTest(case=case):
... | Tests for color-related helper functions. | TestColors | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestColors:
"""Tests for color-related helper functions."""
def test_merge_colors(self):
"""Test blending colors together."""
<|body_0|>
def test_color_str_to_trio(self):
"""Test converting color text codes to integer trios."""
<|body_1|>
def test_co... | stack_v2_sparse_classes_36k_train_005084 | 1,921 | no_license | [
{
"docstring": "Test blending colors together.",
"name": "test_merge_colors",
"signature": "def test_merge_colors(self)"
},
{
"docstring": "Test converting color text codes to integer trios.",
"name": "test_color_str_to_trio",
"signature": "def test_color_str_to_trio(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_val_000964 | Implement the Python class `TestColors` described below.
Class description:
Tests for color-related helper functions.
Method signatures and docstrings:
- def test_merge_colors(self): Test blending colors together.
- def test_color_str_to_trio(self): Test converting color text codes to integer trios.
- def test_color_... | Implement the Python class `TestColors` described below.
Class description:
Tests for color-related helper functions.
Method signatures and docstrings:
- def test_merge_colors(self): Test blending colors together.
- def test_color_str_to_trio(self): Test converting color text codes to integer trios.
- def test_color_... | 539868dab2041b7694c0d53e8e74cf1b5b033653 | <|skeleton|>
class TestColors:
"""Tests for color-related helper functions."""
def test_merge_colors(self):
"""Test blending colors together."""
<|body_0|>
def test_color_str_to_trio(self):
"""Test converting color text codes to integer trios."""
<|body_1|>
def test_co... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestColors:
"""Tests for color-related helper functions."""
def test_merge_colors(self):
"""Test blending colors together."""
for case in self.__class__.SCALES:
with self.subTest(case=case):
self.assertEqual(colors.merge_colors(case[0][0], case[0][1]), case[1])... | the_stack_v2_python_sparse | test_igseq/test_colors.py | ShawHahnLab/igseq | train | 1 |
3ae99b698b17e25fe5fc4832727a51c6df6142f7 | [
"super(Model, self).__init__()\nself.model1 = MlpNet(layer_sizes1, input_size1).double()\nself.model2 = MlpNet(layer_sizes2, input_size2).double()\nself.loss = cca_loss(outdim_size, use_all_singular_values, device).loss",
"output1 = self.model1(x1)\noutput2 = self.model2(x2)\nreturn (output1, output2)"
] | <|body_start_0|>
super(Model, self).__init__()
self.model1 = MlpNet(layer_sizes1, input_size1).double()
self.model2 = MlpNet(layer_sizes2, input_size2).double()
self.loss = cca_loss(outdim_size, use_all_singular_values, device).loss
<|end_body_0|>
<|body_start_1|>
output1 = self... | Model | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
def __init__(self, layer_sizes1: list, layer_sizes2: list, input_size1: int, input_size2: int, outdim_size: int, use_all_singular_values: bool=False, device=torch.device('cpu')):
"""model initialization Parameters ---------- layer_sizes1 (list): list of layer shape of view 1 layer... | stack_v2_sparse_classes_36k_train_005085 | 2,797 | permissive | [
{
"docstring": "model initialization Parameters ---------- layer_sizes1 (list): list of layer shape of view 1 layer_sizes2 (list): list of layer shape of view 1 input_size1 (int): input dimension of view 1 input_size2 (int): input dimension of view 2 outdim_size (int): output dimension of data use_all_singular_... | 2 | stack_v2_sparse_classes_30k_test_000899 | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def __init__(self, layer_sizes1: list, layer_sizes2: list, input_size1: int, input_size2: int, outdim_size: int, use_all_singular_values: bool=False, device=torch.device('cpu')): model... | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def __init__(self, layer_sizes1: list, layer_sizes2: list, input_size1: int, input_size2: int, outdim_size: int, use_all_singular_values: bool=False, device=torch.device('cpu')): model... | 89ba01c18d3ed36942ffdf3e1f3c68fd08b05324 | <|skeleton|>
class Model:
def __init__(self, layer_sizes1: list, layer_sizes2: list, input_size1: int, input_size2: int, outdim_size: int, use_all_singular_values: bool=False, device=torch.device('cpu')):
"""model initialization Parameters ---------- layer_sizes1 (list): list of layer shape of view 1 layer... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Model:
def __init__(self, layer_sizes1: list, layer_sizes2: list, input_size1: int, input_size2: int, outdim_size: int, use_all_singular_values: bool=False, device=torch.device('cpu')):
"""model initialization Parameters ---------- layer_sizes1 (list): list of layer shape of view 1 layer_sizes2 (list)... | the_stack_v2_python_sparse | Groups/Group_ID_7/DeepCCA/DeepCCAModels.py | aryapushpa/DataScience | train | 0 | |
7074e89a009a2b0bd1af0555ad00e3554719816d | [
"res = ''\nfactorial = [1]\nsu = 1\nfor i in range(1, n):\n su = su * i\n factorial.append(su)\nnumbers = []\nfor i in range(1, n + 1):\n numbers.append(i)\nt = n - 1\nk -= 1\nfor _ in range(n):\n index = k // factorial[t]\n res += str(numbers[index])\n numbers.remove(numbers[index])\n k -= ind... | <|body_start_0|>
res = ''
factorial = [1]
su = 1
for i in range(1, n):
su = su * i
factorial.append(su)
numbers = []
for i in range(1, n + 1):
numbers.append(i)
t = n - 1
k -= 1
for _ in range(n):
ind... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation0(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = ''
factorial = [... | stack_v2_sparse_classes_36k_train_005086 | 1,163 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation",
"signature": "def getPermutation(self, n, k)"
},
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation0",
"signature": "def getPermutation0(self, n, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014368 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation0(self, n, k): :type n: int :type k: int :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation0(self, n, k): :type n: int :type k: int :rtype: str
<|skeleton|>
class Solution:
... | 9e49b2c6003b957276737005d4aaac276b44d251 | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation0(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
res = ''
factorial = [1]
su = 1
for i in range(1, n):
su = su * i
factorial.append(su)
numbers = []
for i in range(1, n + 1):
number... | the_stack_v2_python_sparse | PythonCode/src/0060_Permutation_Sequence.py | oneyuan/CodeforFun | train | 0 | |
dea8d6f747138b93eb4c7f9a135e45c5146a4551 | [
"if self._return_code != 0:\n return None\ninfo = self._body.get(IPROTO_SQL_INFO)\nif info is None:\n return None\nautoincrement_ids = info.get(IPROTO_SQL_INFO_AUTOINCREMENT_IDS)\nreturn autoincrement_ids",
"if self._return_code != 0:\n return None\ninfo = self._body.get(IPROTO_SQL_INFO)\nif info is None... | <|body_start_0|>
if self._return_code != 0:
return None
info = self._body.get(IPROTO_SQL_INFO)
if info is None:
return None
autoincrement_ids = info.get(IPROTO_SQL_INFO_AUTOINCREMENT_IDS)
return autoincrement_ids
<|end_body_0|>
<|body_start_1|>
if... | Represents an SQL EXECUTE request response. | ResponseExecute | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResponseExecute:
"""Represents an SQL EXECUTE request response."""
def autoincrement_ids(self):
"""A list with the new primary-key value (or values) for an INSERT in a table defined with PRIMARY KEY AUTOINCREMENT (NOT result set size). :rtype: :obj:`list` or :obj:`None`"""
<|... | stack_v2_sparse_classes_36k_train_005087 | 10,967 | permissive | [
{
"docstring": "A list with the new primary-key value (or values) for an INSERT in a table defined with PRIMARY KEY AUTOINCREMENT (NOT result set size). :rtype: :obj:`list` or :obj:`None`",
"name": "autoincrement_ids",
"signature": "def autoincrement_ids(self)"
},
{
"docstring": "The number of c... | 2 | stack_v2_sparse_classes_30k_train_004339 | Implement the Python class `ResponseExecute` described below.
Class description:
Represents an SQL EXECUTE request response.
Method signatures and docstrings:
- def autoincrement_ids(self): A list with the new primary-key value (or values) for an INSERT in a table defined with PRIMARY KEY AUTOINCREMENT (NOT result se... | Implement the Python class `ResponseExecute` described below.
Class description:
Represents an SQL EXECUTE request response.
Method signatures and docstrings:
- def autoincrement_ids(self): A list with the new primary-key value (or values) for an INSERT in a table defined with PRIMARY KEY AUTOINCREMENT (NOT result se... | 66e53bca472fec0efacd690ebe6c54c33a7df3f9 | <|skeleton|>
class ResponseExecute:
"""Represents an SQL EXECUTE request response."""
def autoincrement_ids(self):
"""A list with the new primary-key value (or values) for an INSERT in a table defined with PRIMARY KEY AUTOINCREMENT (NOT result set size). :rtype: :obj:`list` or :obj:`None`"""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResponseExecute:
"""Represents an SQL EXECUTE request response."""
def autoincrement_ids(self):
"""A list with the new primary-key value (or values) for an INSERT in a table defined with PRIMARY KEY AUTOINCREMENT (NOT result set size). :rtype: :obj:`list` or :obj:`None`"""
if self._return... | the_stack_v2_python_sparse | tarantool/response.py | tarantool/tarantool-python | train | 80 |
e39bfbcf338391d9bfdc489a0db6ac063155827d | [
"super(ActionTypeHead, self).__init__()\nself.cfg = cfg\nself.act = build_activation(cfg.activation)\nself.project = fc_block(cfg.input_dim, cfg.res_dim)\nblocks = [ResFCBlock(cfg.res_dim, self.act, cfg.norm_type) for _ in range(cfg.res_num)]\nself.res = nn.Sequential(*blocks)\nself.weight_norm = cfg.get('weight_no... | <|body_start_0|>
super(ActionTypeHead, self).__init__()
self.cfg = cfg
self.act = build_activation(cfg.activation)
self.project = fc_block(cfg.input_dim, cfg.res_dim)
blocks = [ResFCBlock(cfg.res_dim, self.act, cfg.norm_type) for _ in range(cfg.res_num)]
self.res = nn.Seq... | Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward | ActionTypeHead | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionTypeHead:
"""Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward"""
def __init__(self, cfg):
"""Overview: initialize architect. Arguments: - cfg (:obj:`dict`): h... | stack_v2_sparse_classes_36k_train_005088 | 5,506 | permissive | [
{
"docstring": "Overview: initialize architect. Arguments: - cfg (:obj:`dict`): head architecture definition",
"name": "__init__",
"signature": "def __init__(self, cfg)"
},
{
"docstring": "Overview: This head embeds lstm_output into a 1D tensor of size 256, passes it through 16 ResBlocks with la... | 2 | stack_v2_sparse_classes_30k_train_014931 | Implement the Python class `ActionTypeHead` described below.
Class description:
Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward
Method signatures and docstrings:
- def __init__(self, cfg): Overview... | Implement the Python class `ActionTypeHead` described below.
Class description:
Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward
Method signatures and docstrings:
- def __init__(self, cfg): Overview... | 09d507c412235a2f0cf9c0b3485ec9ed15fb6421 | <|skeleton|>
class ActionTypeHead:
"""Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward"""
def __init__(self, cfg):
"""Overview: initialize architect. Arguments: - cfg (:obj:`dict`): h... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActionTypeHead:
"""Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward"""
def __init__(self, cfg):
"""Overview: initialize architect. Arguments: - cfg (:obj:`dict`): head architect... | the_stack_v2_python_sparse | distar/model/alphastar/head/action_type_head.py | LFhase/DI-star | train | 1 |
26676263d1d19864965dc6baff05ea892c764f62 | [
"self.logger = logging.getLogger(__name__)\nself.hdr_path = header_path\nif path is not None:\n self.path = path\nelse:\n self.path = os.path.splitext(header_path)[0]\nself.unpack_fmt = unpack_fmt\nself.hdr = self.process_hdr()\nif 'pixperline' not in self.hdr:\n self.calc_from_xy()",
"try:\n num_byte... | <|body_start_0|>
self.logger = logging.getLogger(__name__)
self.hdr_path = header_path
if path is not None:
self.path = path
else:
self.path = os.path.splitext(header_path)[0]
self.unpack_fmt = unpack_fmt
self.hdr = self.process_hdr()
if 'p... | Superclass for BilFile and BsqFile. Contains generic read() method that subclasses use to unpack binary data in the correct order. | EnviFile | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EnviFile:
"""Superclass for BilFile and BsqFile. Contains generic read() method that subclasses use to unpack binary data in the correct order."""
def __init__(self, header_path, path=None, unpack_fmt='<d'):
""":param str header_path: Path to header file. :param str path: Path to fil... | stack_v2_sparse_classes_36k_train_005089 | 7,393 | permissive | [
{
"docstring": ":param str header_path: Path to header file. :param str path: Path to file. Guessed from header if not provided. :param str unpack_fmt: Format string describing structure of data. Default: \"<d\" - little-endian, double precision",
"name": "__init__",
"signature": "def __init__(self, hea... | 6 | stack_v2_sparse_classes_30k_train_020299 | Implement the Python class `EnviFile` described below.
Class description:
Superclass for BilFile and BsqFile. Contains generic read() method that subclasses use to unpack binary data in the correct order.
Method signatures and docstrings:
- def __init__(self, header_path, path=None, unpack_fmt='<d'): :param str heade... | Implement the Python class `EnviFile` described below.
Class description:
Superclass for BilFile and BsqFile. Contains generic read() method that subclasses use to unpack binary data in the correct order.
Method signatures and docstrings:
- def __init__(self, header_path, path=None, unpack_fmt='<d'): :param str heade... | 5d7e21f28ead02d226c19f2831bc261897300b0f | <|skeleton|>
class EnviFile:
"""Superclass for BilFile and BsqFile. Contains generic read() method that subclasses use to unpack binary data in the correct order."""
def __init__(self, header_path, path=None, unpack_fmt='<d'):
""":param str header_path: Path to header file. :param str path: Path to fil... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EnviFile:
"""Superclass for BilFile and BsqFile. Contains generic read() method that subclasses use to unpack binary data in the correct order."""
def __init__(self, header_path, path=None, unpack_fmt='<d'):
""":param str header_path: Path to header file. :param str path: Path to file. Guessed fr... | the_stack_v2_python_sparse | python/src/ceda_di/filetypes/file_io/envi_io.py | cedadev/ceda-di | train | 5 |
de5a9d122fd7a93a6cd0939dee40845214f849db | [
"super(CsvFile, self).__init__()\nself.test_case_name = test_case_name\nself.database_name = database_name\nself.delimiter = delimiter\nself.test_id = test_id\nif self.test_id is None:\n raise UnableToGenerateVisualizations()\nself.list_of_samples = self.select_all_sample_ids(database_name=self.database_name, te... | <|body_start_0|>
super(CsvFile, self).__init__()
self.test_case_name = test_case_name
self.database_name = database_name
self.delimiter = delimiter
self.test_id = test_id
if self.test_id is None:
raise UnableToGenerateVisualizations()
self.list_of_samp... | CsvFile | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CsvFile:
def __init__(self, test_case_name=default_test_case_name, database_name=default_database_name, test_id=None, delimiter=','):
"""Will build up the object, when no test id is given and when test case name is default. It will take the last known test id. :param test_case_name: The ... | stack_v2_sparse_classes_36k_train_005090 | 17,005 | permissive | [
{
"docstring": "Will build up the object, when no test id is given and when test case name is default. It will take the last known test id. :param test_case_name: The name of the test case :param delimiter: The delimiter of the csv file :param database_name: :param test_id: The test id within the test case",
... | 2 | stack_v2_sparse_classes_30k_train_012157 | Implement the Python class `CsvFile` described below.
Class description:
Implement the CsvFile class.
Method signatures and docstrings:
- def __init__(self, test_case_name=default_test_case_name, database_name=default_database_name, test_id=None, delimiter=','): Will build up the object, when no test id is given and ... | Implement the Python class `CsvFile` described below.
Class description:
Implement the CsvFile class.
Method signatures and docstrings:
- def __init__(self, test_case_name=default_test_case_name, database_name=default_database_name, test_id=None, delimiter=','): Will build up the object, when no test id is given and ... | 5e33e64d77997b00a43f5573353138436b1f1a34 | <|skeleton|>
class CsvFile:
def __init__(self, test_case_name=default_test_case_name, database_name=default_database_name, test_id=None, delimiter=','):
"""Will build up the object, when no test id is given and when test case name is default. It will take the last known test id. :param test_case_name: The ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CsvFile:
def __init__(self, test_case_name=default_test_case_name, database_name=default_database_name, test_id=None, delimiter=','):
"""Will build up the object, when no test id is given and when test case name is default. It will take the last known test id. :param test_case_name: The name of the te... | the_stack_v2_python_sparse | QuickPotato/statistical/visualizations.py | simrit1/QuickPotato | train | 0 | |
7199bee165bcb0a6ae55af40f28adaf8bc0bd30b | [
"current_app.logger.info('<Transaction.get for invoice : %s, payment : %s, transaction %s', invoice_id, payment_id, transaction_id)\ntry:\n response, status = (TransactionService.find_by_id(transaction_id).asdict(), HTTPStatus.OK)\nexcept BusinessException as exception:\n return exception.response()\ncurrent_... | <|body_start_0|>
current_app.logger.info('<Transaction.get for invoice : %s, payment : %s, transaction %s', invoice_id, payment_id, transaction_id)
try:
response, status = (TransactionService.find_by_id(transaction_id).asdict(), HTTPStatus.OK)
except BusinessException as exception:
... | Endpoint resource to get transaction. | Transactions | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transactions:
"""Endpoint resource to get transaction."""
def get(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Get the Transaction record."""
<|body_0|>
def patch(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Update ... | stack_v2_sparse_classes_36k_train_005091 | 4,955 | permissive | [
{
"docstring": "Get the Transaction record.",
"name": "get",
"signature": "def get(invoice_id: int=None, payment_id: int=None, transaction_id=None)"
},
{
"docstring": "Update the transaction record by querying payment system.",
"name": "patch",
"signature": "def patch(invoice_id: int=Non... | 2 | null | Implement the Python class `Transactions` described below.
Class description:
Endpoint resource to get transaction.
Method signatures and docstrings:
- def get(invoice_id: int=None, payment_id: int=None, transaction_id=None): Get the Transaction record.
- def patch(invoice_id: int=None, payment_id: int=None, transact... | Implement the Python class `Transactions` described below.
Class description:
Endpoint resource to get transaction.
Method signatures and docstrings:
- def get(invoice_id: int=None, payment_id: int=None, transaction_id=None): Get the Transaction record.
- def patch(invoice_id: int=None, payment_id: int=None, transact... | 0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1 | <|skeleton|>
class Transactions:
"""Endpoint resource to get transaction."""
def get(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Get the Transaction record."""
<|body_0|>
def patch(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Update ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Transactions:
"""Endpoint resource to get transaction."""
def get(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Get the Transaction record."""
current_app.logger.info('<Transaction.get for invoice : %s, payment : %s, transaction %s', invoice_id, payment_id, transact... | the_stack_v2_python_sparse | pay-api/src/pay_api/resources/transaction.py | bcgov/sbc-pay | train | 6 |
d170410e94687b010d3129a177988fdfa525f021 | [
"if self.shape == shapes.POLYGON:\n return geometry.point_inside_polygon([lat, lng], self.verts)\nelif self.shape == shapes.CIRCLE or (self.shape == shapes.POINT and self.radius > 0):\n coords = geometry.lat_lng_to_meters(lat, lng)\n center_coords = geometry.lat_lng_to_meters(self.center[0], self.center[1]... | <|body_start_0|>
if self.shape == shapes.POLYGON:
return geometry.point_inside_polygon([lat, lng], self.verts)
elif self.shape == shapes.CIRCLE or (self.shape == shapes.POINT and self.radius > 0):
coords = geometry.lat_lng_to_meters(lat, lng)
center_coords = geometry.... | A mixin class providing geometry related methods to Region 'like' classes. It is expected classes mixing in this class will provide the following properties at least: 'shape', 'verts', 'center' and 'radius' | RegionGeography | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegionGeography:
"""A mixin class providing geometry related methods to Region 'like' classes. It is expected classes mixing in this class will provide the following properties at least: 'shape', 'verts', 'center' and 'radius'"""
def point_inside(self, lat, lng):
"""Return True if th... | stack_v2_sparse_classes_36k_train_005092 | 6,981 | permissive | [
{
"docstring": "Return True if the lat/lng point is inside this region, False otherwise. :param lat, lng: The latitude and longitude of the point.",
"name": "point_inside",
"signature": "def point_inside(self, lat, lng)"
},
{
"docstring": "Return True if the line segment connecting the [lat, lng... | 2 | null | Implement the Python class `RegionGeography` described below.
Class description:
A mixin class providing geometry related methods to Region 'like' classes. It is expected classes mixing in this class will provide the following properties at least: 'shape', 'verts', 'center' and 'radius'
Method signatures and docstrin... | Implement the Python class `RegionGeography` described below.
Class description:
A mixin class providing geometry related methods to Region 'like' classes. It is expected classes mixing in this class will provide the following properties at least: 'shape', 'verts', 'center' and 'radius'
Method signatures and docstrin... | 1aad5971556d498e3617afe75f27e2f4132d4668 | <|skeleton|>
class RegionGeography:
"""A mixin class providing geometry related methods to Region 'like' classes. It is expected classes mixing in this class will provide the following properties at least: 'shape', 'verts', 'center' and 'radius'"""
def point_inside(self, lat, lng):
"""Return True if th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegionGeography:
"""A mixin class providing geometry related methods to Region 'like' classes. It is expected classes mixing in this class will provide the following properties at least: 'shape', 'verts', 'center' and 'radius'"""
def point_inside(self, lat, lng):
"""Return True if the lat/lng poi... | the_stack_v2_python_sparse | models/region.py | plastr/extrasolar-game | train | 0 |
06b9e3ef29bb3882f34db0c707a165bd9307ce45 | [
"self._request_args = request_args\nself._baseoid = baseoid\nself._accept_errors = accept_errors\nself._default_value = default_value\nself.value = None",
"get_result = await getCmd(*self._request_args, ObjectType(ObjectIdentity(self._baseoid)))\nerrindication, errstatus, errindex, restable = get_result\nif errin... | <|body_start_0|>
self._request_args = request_args
self._baseoid = baseoid
self._accept_errors = accept_errors
self._default_value = default_value
self.value = None
<|end_body_0|>
<|body_start_1|>
get_result = await getCmd(*self._request_args, ObjectType(ObjectIdentity(s... | Get the latest data and update the states. | SnmpData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnmpData:
"""Get the latest data and update the states."""
def __init__(self, request_args, baseoid, accept_errors, default_value) -> None:
"""Initialize the data object."""
<|body_0|>
async def async_update(self):
"""Get the latest data from the remote SNMP capa... | stack_v2_sparse_classes_36k_train_005093 | 7,962 | permissive | [
{
"docstring": "Initialize the data object.",
"name": "__init__",
"signature": "def __init__(self, request_args, baseoid, accept_errors, default_value) -> None"
},
{
"docstring": "Get the latest data from the remote SNMP capable host.",
"name": "async_update",
"signature": "async def asy... | 2 | stack_v2_sparse_classes_30k_train_010667 | Implement the Python class `SnmpData` described below.
Class description:
Get the latest data and update the states.
Method signatures and docstrings:
- def __init__(self, request_args, baseoid, accept_errors, default_value) -> None: Initialize the data object.
- async def async_update(self): Get the latest data from... | Implement the Python class `SnmpData` described below.
Class description:
Get the latest data and update the states.
Method signatures and docstrings:
- def __init__(self, request_args, baseoid, accept_errors, default_value) -> None: Initialize the data object.
- async def async_update(self): Get the latest data from... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class SnmpData:
"""Get the latest data and update the states."""
def __init__(self, request_args, baseoid, accept_errors, default_value) -> None:
"""Initialize the data object."""
<|body_0|>
async def async_update(self):
"""Get the latest data from the remote SNMP capa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SnmpData:
"""Get the latest data and update the states."""
def __init__(self, request_args, baseoid, accept_errors, default_value) -> None:
"""Initialize the data object."""
self._request_args = request_args
self._baseoid = baseoid
self._accept_errors = accept_errors
... | the_stack_v2_python_sparse | homeassistant/components/snmp/sensor.py | home-assistant/core | train | 35,501 |
454ebd2873a32f9884ad44db5f2932cc849af4d9 | [
"\"\"\"\n _ h o r s e\n _ 0 1 2 3 4 5\n o 1 1 1 2 3 4\n r 2 2 2 1 2 3\n s 3 3 2 2 1 2\n\n \"\"\"\nif not word1 or not word2:\n return max(len(word1), len(word2))\nmemo = [j + 1 for j in range(len(word2))]\nfor i in range(len(word1)):\n new_memo = []\n for j in ra... | <|body_start_0|>
"""
_ h o r s e
_ 0 1 2 3 4 5
o 1 1 1 2 3 4
r 2 2 2 1 2 3
s 3 3 2 2 1 2
"""
if not word1 or not word2:
return max(len(word1), len(word2))
memo = [j + 1 for j in range(l... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDistance(self, word1, word2):
"""Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int"""
<|body_0|>
def minDistance(self, word1: str, word2: str) -> int:
"""Apr 02, 2023 14:14"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_005094 | 2,724 | no_license | [
{
"docstring": "Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int",
"name": "minDistance",
"signature": "def minDistance(self, word1, word2)"
},
{
"docstring": "Apr 02, 2023 14:14",
"name": "minDistance",
"signature": "def minDistance(self, word1: str, word2: str) -> int"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDistance(self, word1, word2): Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int
- def minDistance(self, word1: str, word2: str) -> int: Apr 02, 2023 14:14 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDistance(self, word1, word2): Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int
- def minDistance(self, word1: str, word2: str) -> int: Apr 02, 2023 14:14
... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def minDistance(self, word1, word2):
"""Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int"""
<|body_0|>
def minDistance(self, word1: str, word2: str) -> int:
"""Apr 02, 2023 14:14"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minDistance(self, word1, word2):
"""Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int"""
"""
_ h o r s e
_ 0 1 2 3 4 5
o 1 1 1 2 3 4
r 2 2 2 1 2 3
s 3 3 2 2 1 2
"""
... | the_stack_v2_python_sparse | leetcode/solved/72_Edit_Distance/solution.py | sungminoh/algorithms | train | 0 | |
c677d8b648d7f484443f88201ec209b98ab827d6 | [
"super(encoder, self).__init__()\nself.session = tf.Session()\nself.model = model\nself.trainable = trainable\nself.num_labels = num_labels",
"ELMO = 'https://tfhub.dev/google/elmo/2'\nNNLM = 'https://tfhub.dev/google/nnlm-en-dim128/1'\nUSE = 'https://tfhub.dev/google/universal-sentence-encoder-large/2'\nmodel_na... | <|body_start_0|>
super(encoder, self).__init__()
self.session = tf.Session()
self.model = model
self.trainable = trainable
self.num_labels = num_labels
<|end_body_0|>
<|body_start_1|>
ELMO = 'https://tfhub.dev/google/elmo/2'
NNLM = 'https://tfhub.dev/google/nnlm-... | encoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class encoder:
def __init__(self, model='elmo', trainable=False, num_labels=2):
"""Defines an encoder using a pre-trained TensorflowHub module. Can be used for featurization or fine-tuned for classification. Parameters ---------- model : str, optional Trained model from tfhub to use (the defau... | stack_v2_sparse_classes_36k_train_005095 | 7,979 | permissive | [
{
"docstring": "Defines an encoder using a pre-trained TensorflowHub module. Can be used for featurization or fine-tuned for classification. Parameters ---------- model : str, optional Trained model from tfhub to use (the default is \"elmo\") trainable : bool, optional Whether to fix weights or make them traina... | 4 | null | Implement the Python class `encoder` described below.
Class description:
Implement the encoder class.
Method signatures and docstrings:
- def __init__(self, model='elmo', trainable=False, num_labels=2): Defines an encoder using a pre-trained TensorflowHub module. Can be used for featurization or fine-tuned for classi... | Implement the Python class `encoder` described below.
Class description:
Implement the encoder class.
Method signatures and docstrings:
- def __init__(self, model='elmo', trainable=False, num_labels=2): Defines an encoder using a pre-trained TensorflowHub module. Can be used for featurization or fine-tuned for classi... | 42e8858c2ebc6a061012bcadb167d29cebb85c5e | <|skeleton|>
class encoder:
def __init__(self, model='elmo', trainable=False, num_labels=2):
"""Defines an encoder using a pre-trained TensorflowHub module. Can be used for featurization or fine-tuned for classification. Parameters ---------- model : str, optional Trained model from tfhub to use (the defau... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class encoder:
def __init__(self, model='elmo', trainable=False, num_labels=2):
"""Defines an encoder using a pre-trained TensorflowHub module. Can be used for featurization or fine-tuned for classification. Parameters ---------- model : str, optional Trained model from tfhub to use (the default is "elmo") ... | the_stack_v2_python_sparse | text_featurization/lm_finetune/encoder.py | BarracudaPff/code-golf-data-python | train | 0 | |
d4f0ee5960692cb0917d1d61d565384c0e106720 | [
"log('set-time-zone-called').debug4('ClockUtils.s_setTimezone() called: timezone=%s', timeZone)\noriginalFileName = configFileName\nrc, originalFile = cls._s_openFile(log, originalFileName, 'r')\nif rc == ReturnCodes.kOk:\n newFileName = originalFileName + '.tmp.qb'\n rc, newFile = cls._s_openFile(log, newFil... | <|body_start_0|>
log('set-time-zone-called').debug4('ClockUtils.s_setTimezone() called: timezone=%s', timeZone)
originalFileName = configFileName
rc, originalFile = cls._s_openFile(log, originalFileName, 'r')
if rc == ReturnCodes.kOk:
newFileName = originalFileName + '.tmp.qb... | ClockUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClockUtils:
def s_setTimezone(cls, log, timeZone, configFileName=kConfigFilePath, configUtility=kConfigUtility):
"""Sets the new time-zone configuration. Changes the time-zone name in the configuration file and runs the config utility. Args: timeZone: new time-zone to be configured Retur... | stack_v2_sparse_classes_36k_train_005096 | 6,041 | no_license | [
{
"docstring": "Sets the new time-zone configuration. Changes the time-zone name in the configuration file and runs the config utility. Args: timeZone: new time-zone to be configured Returns: ReturnCodes.kOk on success, ReturnCodes.kGeneralError otherwise",
"name": "s_setTimezone",
"signature": "def s_s... | 4 | null | Implement the Python class `ClockUtils` described below.
Class description:
Implement the ClockUtils class.
Method signatures and docstrings:
- def s_setTimezone(cls, log, timeZone, configFileName=kConfigFilePath, configUtility=kConfigUtility): Sets the new time-zone configuration. Changes the time-zone name in the c... | Implement the Python class `ClockUtils` described below.
Class description:
Implement the ClockUtils class.
Method signatures and docstrings:
- def s_setTimezone(cls, log, timeZone, configFileName=kConfigFilePath, configUtility=kConfigUtility): Sets the new time-zone configuration. Changes the time-zone name in the c... | 81bcc74fe7c0ca036ec483f634d7be0bab19a6d0 | <|skeleton|>
class ClockUtils:
def s_setTimezone(cls, log, timeZone, configFileName=kConfigFilePath, configUtility=kConfigUtility):
"""Sets the new time-zone configuration. Changes the time-zone name in the configuration file and runs the config utility. Args: timeZone: new time-zone to be configured Retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClockUtils:
def s_setTimezone(cls, log, timeZone, configFileName=kConfigFilePath, configUtility=kConfigUtility):
"""Sets the new time-zone configuration. Changes the time-zone name in the configuration file and runs the config utility. Args: timeZone: new time-zone to be configured Returns: ReturnCode... | the_stack_v2_python_sparse | oscar/a/sys/clock/utils/clock_utils.py | afeset/miner2-tools | train | 0 | |
26557a246d84b45fb44a3be61f39983d01e3d19a | [
"if not len(strs):\n return None\nreturn chr(257).join(strs)",
"if s is None:\n return []\nif s == '':\n return ['']\nreturn s.split(chr(257))"
] | <|body_start_0|>
if not len(strs):
return None
return chr(257).join(strs)
<|end_body_0|>
<|body_start_1|>
if s is None:
return []
if s == '':
return ['']
return s.split(chr(257))
<|end_body_1|>
| Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs: [str]) -> str:
"""Encodes a list of strings to a single string."""
<|body_0|>
def decode(self, s: str) -> [str]:
"""Decodes a single string to a list of strings."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not le... | stack_v2_sparse_classes_36k_train_005097 | 554 | no_license | [
{
"docstring": "Encodes a list of strings to a single string.",
"name": "encode",
"signature": "def encode(self, strs: [str]) -> str"
},
{
"docstring": "Decodes a single string to a list of strings.",
"name": "decode",
"signature": "def decode(self, s: str) -> [str]"
}
] | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string.
- def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string.
- def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
<|skeleton|>
cla... | f7b9a86797d52ab1057f0300352c0c5670a59bd5 | <|skeleton|>
class Codec:
def encode(self, strs: [str]) -> str:
"""Encodes a list of strings to a single string."""
<|body_0|>
def decode(self, s: str) -> [str]:
"""Decodes a single string to a list of strings."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, strs: [str]) -> str:
"""Encodes a list of strings to a single string."""
if not len(strs):
return None
return chr(257).join(strs)
def decode(self, s: str) -> [str]:
"""Decodes a single string to a list of strings."""
if s is None... | the_stack_v2_python_sparse | Daily-Grind/136.py | DarshanGowda0/LC-Grind | train | 0 | |
2f4e5ada66925ba38993aed030409f22b9939894 | [
"BaseController.__init__(self, veh_id, car_following_params, delay=1.0, fail_safe='safe_velocity')\nself.v_des = v_des\nself.max_accel = car_following_params.controller_params['accel']\nself.dx_1_0 = 4.5\nself.dx_2_0 = 5.25\nself.dx_3_0 = 6.0\nself.d_1 = 1.5\nself.d_2 = 1.0\nself.d_3 = 0.5\nself.danger_edges = dang... | <|body_start_0|>
BaseController.__init__(self, veh_id, car_following_params, delay=1.0, fail_safe='safe_velocity')
self.v_des = v_des
self.max_accel = car_following_params.controller_params['accel']
self.dx_1_0 = 4.5
self.dx_2_0 = 5.25
self.dx_3_0 = 6.0
self.d_1 =... | Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional desired speed of the vehicles (m/s) | FollowerStopper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FollowerStopper:
"""Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional ... | stack_v2_sparse_classes_36k_train_005098 | 3,488 | no_license | [
{
"docstring": "Instantiate FollowerStopper.",
"name": "__init__",
"signature": "def __init__(self, veh_id, car_following_params, v_des=4.15, danger_edges=None)"
},
{
"docstring": "Find distance to intersection. Parameters ---------- env : flow.envs.Env see flow/envs/base.py Returns ------- floa... | 3 | stack_v2_sparse_classes_30k_train_020708 | Implement the Python class `FollowerStopper` described below.
Class description:
Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehi... | Implement the Python class `FollowerStopper` described below.
Class description:
Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehi... | a5a580a3b8ff6d458a55e4d4e5dff2f94d23d7ad | <|skeleton|>
class FollowerStopper:
"""Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FollowerStopper:
"""Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional desired speed... | the_stack_v2_python_sparse | gym-lor/gym_lor/envs/FS.py | YichenZhou113/Deep-RL-for-Autonomy-Traffic | train | 0 |
a9786a71d5c138759e753c4fd57dde43f0217751 | [
"if len(nums) <= 1:\n return 0\ncurr_reach = next_reach = cnt = i = 0\nwhile True:\n while i <= curr_reach:\n next_reach = max(i + nums[i], next_reach)\n if next_reach >= len(nums) - 1:\n return cnt + 1\n i += 1\n curr_reach = next_reach\n cnt += 1",
"L = len(nums)\nif ... | <|body_start_0|>
if len(nums) <= 1:
return 0
curr_reach = next_reach = cnt = i = 0
while True:
while i <= curr_reach:
next_reach = max(i + nums[i], next_reach)
if next_reach >= len(nums) - 1:
return cnt + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def jump(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def toTarget(self, nums):
"""DP-like solution"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(nums) <= 1:
return 0
curr_reach = next_reach ... | stack_v2_sparse_classes_36k_train_005099 | 1,190 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "jump",
"signature": "def jump(self, nums)"
},
{
"docstring": "DP-like solution",
"name": "toTarget",
"signature": "def toTarget(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003798 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump(self, nums): :type nums: List[int] :rtype: int
- def toTarget(self, nums): DP-like solution | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump(self, nums): :type nums: List[int] :rtype: int
- def toTarget(self, nums): DP-like solution
<|skeleton|>
class Solution:
def jump(self, nums):
""":type num... | 2b4be9d2ad2476f285dfbc7f702571015fce4d2e | <|skeleton|>
class Solution:
def jump(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def toTarget(self, nums):
"""DP-like solution"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def jump(self, nums):
""":type nums: List[int] :rtype: int"""
if len(nums) <= 1:
return 0
curr_reach = next_reach = cnt = i = 0
while True:
while i <= curr_reach:
next_reach = max(i + nums[i], next_reach)
if next... | the_stack_v2_python_sparse | DifficultyHard/sol045JumpGame.py | jerry3links/leetcode | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.