blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18320e36a221f653d52092fe585cdb1ca6cb8eee | [
"try:\n from mosestokenizer import MosesPunctuationNormalizer, MosesTokenizer\nexcept ImportError:\n raise ImportError('Please install sacremoses')\nself.lang = lang\nself.punct_normalizer = MosesPunctuationNormalizer(lang=lang)\nself.tokenizer = MosesTokenizer(lang=lang)\nif self.lang == 'zh':\n import op... | <|body_start_0|>
try:
from mosestokenizer import MosesPunctuationNormalizer, MosesTokenizer
except ImportError:
raise ImportError('Please install sacremoses')
self.lang = lang
self.punct_normalizer = MosesPunctuationNormalizer(lang=lang)
self.tokenizer = M... | Tokenizer | [
"MIT",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tokenizer:
def __init__(self, lang: str='en'):
"""Create a tokenizer instance for a specific language. Take note that a caveat is that this tokenizer is not picklable. Does the following in sequence 1. Punct normalize 2. Lang specific moses tokenize 3. Lang specific addtional segmentatio... | stack_v2_sparse_classes_75kplus_train_068900 | 9,564 | permissive | [
{
"docstring": "Create a tokenizer instance for a specific language. Take note that a caveat is that this tokenizer is not picklable. Does the following in sequence 1. Punct normalize 2. Lang specific moses tokenize 3. Lang specific addtional segmentation Keyword Arguments: lang {str} -- Language identifier (de... | 2 | stack_v2_sparse_classes_30k_train_002438 | Implement the Python class `Tokenizer` described below.
Class description:
Implement the Tokenizer class.
Method signatures and docstrings:
- def __init__(self, lang: str='en'): Create a tokenizer instance for a specific language. Take note that a caveat is that this tokenizer is not picklable. Does the following in ... | Implement the Python class `Tokenizer` described below.
Class description:
Implement the Tokenizer class.
Method signatures and docstrings:
- def __init__(self, lang: str='en'): Create a tokenizer instance for a specific language. Take note that a caveat is that this tokenizer is not picklable. Does the following in ... | 9f06ec825d7a8aadf46f1f1c96dae2537b101b17 | <|skeleton|>
class Tokenizer:
def __init__(self, lang: str='en'):
"""Create a tokenizer instance for a specific language. Take note that a caveat is that this tokenizer is not picklable. Does the following in sequence 1. Punct normalize 2. Lang specific moses tokenize 3. Lang specific addtional segmentatio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Tokenizer:
def __init__(self, lang: str='en'):
"""Create a tokenizer instance for a specific language. Take note that a caveat is that this tokenizer is not picklable. Does the following in sequence 1. Punct normalize 2. Lang specific moses tokenize 3. Lang specific addtional segmentation Keyword Argu... | the_stack_v2_python_sparse | laser/data.py | mingruimingrui/laser-keep-alive | train | 2 | |
8ead72658ec23293beb2c94acd99b008544ee40d | [
"def next(tx, ty):\n return (n - 1 - ty, tx)\nn = len(matrix)\ncnt = 0\nfor x in range(n):\n for y in range(x + 1, n - x):\n nx, ny = next(x, y)\n cnt += 1\n while not (nx == x and ny == y) and cnt < n * n:\n tv = matrix[ny][nx]\n matrix[ny][nx] = matrix[y][x]\n ... | <|body_start_0|>
def next(tx, ty):
return (n - 1 - ty, tx)
n = len(matrix)
cnt = 0
for x in range(n):
for y in range(x + 1, n - x):
nx, ny = next(x, y)
cnt += 1
while not (nx == x and ny == y) and cnt < n * n:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotate_other(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix... | stack_v2_sparse_classes_75kplus_train_068901 | 2,297 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
"name": "rotate",
"signature": "def rotate(self, matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
... | 2 | stack_v2_sparse_classes_30k_train_023671 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotate_other(self, matrix): :type matrix: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotate_other(self, matrix): :type matrix: List[... | 387074588c50973b6fb8645f859ae9ca29b4df4c | <|skeleton|>
class Solution:
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotate_other(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rotate(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
def next(tx, ty):
return (n - 1 - ty, tx)
n = len(matrix)
cnt = 0
for x in range(n):
for y in range(x + 1... | the_stack_v2_python_sparse | Coding/Algorithm/Code/LeetCodeCn/Primary/011.py | bovenson/notes | train | 8 | |
f20ebb6b95ee7a894e1dcd349f3b2689c6117864 | [
"super().__init__(name=__name__, class_name=self.__class__.__name__)\nif columns is None:\n columns = [0, 1, 2]\nself._sigma = sigma\nself._threshold = threshold\nself._columns = columns",
"if graph.edge_index is not None:\n self.info('WARNING: GraphBuilder received graph with pre-existing structure. Will o... | <|body_start_0|>
super().__init__(name=__name__, class_name=self.__class__.__name__)
if columns is None:
columns = [0, 1, 2]
self._sigma = sigma
self._threshold = threshold
self._columns = columns
<|end_body_0|>
<|body_start_1|>
if graph.edge_index is not Non... | Builds edges according to Euclidean distance between nodes. See https://arxiv.org/pdf/1809.06166.pdf. | EuclideanEdges | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EuclideanEdges:
"""Builds edges according to Euclidean distance between nodes. See https://arxiv.org/pdf/1809.06166.pdf."""
def __init__(self, sigma: float, threshold: float=0.0, columns: List[int]=None):
"""Construct `EuclideanEdges`."""
<|body_0|>
def _construct_edges(... | stack_v2_sparse_classes_75kplus_train_068902 | 5,691 | permissive | [
{
"docstring": "Construct `EuclideanEdges`.",
"name": "__init__",
"signature": "def __init__(self, sigma: float, threshold: float=0.0, columns: List[int]=None)"
},
{
"docstring": "Forward pass.",
"name": "_construct_edges",
"signature": "def _construct_edges(self, graph: Data) -> Data"
... | 2 | stack_v2_sparse_classes_30k_test_001599 | Implement the Python class `EuclideanEdges` described below.
Class description:
Builds edges according to Euclidean distance between nodes. See https://arxiv.org/pdf/1809.06166.pdf.
Method signatures and docstrings:
- def __init__(self, sigma: float, threshold: float=0.0, columns: List[int]=None): Construct `Euclidea... | Implement the Python class `EuclideanEdges` described below.
Class description:
Builds edges according to Euclidean distance between nodes. See https://arxiv.org/pdf/1809.06166.pdf.
Method signatures and docstrings:
- def __init__(self, sigma: float, threshold: float=0.0, columns: List[int]=None): Construct `Euclidea... | f6e03282dd665c81d06eaa1ab55a07d138064e9a | <|skeleton|>
class EuclideanEdges:
"""Builds edges according to Euclidean distance between nodes. See https://arxiv.org/pdf/1809.06166.pdf."""
def __init__(self, sigma: float, threshold: float=0.0, columns: List[int]=None):
"""Construct `EuclideanEdges`."""
<|body_0|>
def _construct_edges(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EuclideanEdges:
"""Builds edges according to Euclidean distance between nodes. See https://arxiv.org/pdf/1809.06166.pdf."""
def __init__(self, sigma: float, threshold: float=0.0, columns: List[int]=None):
"""Construct `EuclideanEdges`."""
super().__init__(name=__name__, class_name=self.__... | the_stack_v2_python_sparse | src/graphnet/models/graphs/edges/edges.py | graphnet-team/graphnet | train | 55 |
4cb09ae69ed29732a52b1767e24ce0f01e19caed | [
"rank_factory = JRankerFactory()\nif not os.path.exists(model_file_name):\n raise Exception(f'Missing model file: {model_file_name}')\nself.model = rank_factory.loadRankerFromFile(model_file_name)\nself.feat_extr = JCompositeFeatureExtractor(resource_manager, feat_extr_file_name)\nself.dp_wrapper = JDataPointWra... | <|body_start_0|>
rank_factory = JRankerFactory()
if not os.path.exists(model_file_name):
raise Exception(f'Missing model file: {model_file_name}')
self.model = rank_factory.loadRankerFromFile(model_file_name)
self.feat_extr = JCompositeFeatureExtractor(resource_manager, feat_... | QueryRanker | [
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueryRanker:
def __init__(self, resource_manager, feat_extr_file_name, model_file_name):
"""Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_name: feature extractor JSON configuration file. :param model_file_name: a (previously trained/creaed... | stack_v2_sparse_classes_75kplus_train_068903 | 2,805 | permissive | [
{
"docstring": "Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_name: feature extractor JSON configuration file. :param model_file_name: a (previously trained/creaed) model file name",
"name": "__init__",
"signature": "def __init__(self, resource_manager, f... | 2 | null | Implement the Python class `QueryRanker` described below.
Class description:
Implement the QueryRanker class.
Method signatures and docstrings:
- def __init__(self, resource_manager, feat_extr_file_name, model_file_name): Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_n... | Implement the Python class `QueryRanker` described below.
Class description:
Implement the QueryRanker class.
Method signatures and docstrings:
- def __init__(self, resource_manager, feat_extr_file_name, model_file_name): Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_n... | 741734527e6e3add6ed1de893c49517999a36688 | <|skeleton|>
class QueryRanker:
def __init__(self, resource_manager, feat_extr_file_name, model_file_name):
"""Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_name: feature extractor JSON configuration file. :param model_file_name: a (previously trained/creaed... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QueryRanker:
def __init__(self, resource_manager, feat_extr_file_name, model_file_name):
"""Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_name: feature extractor JSON configuration file. :param model_file_name: a (previously trained/creaed) model file n... | the_stack_v2_python_sparse | scripts/py_flexneuart/ranker.py | dzynin/FlexNeuART | train | 0 | |
3dca33f31fe44617cf4869b0ed613b9f078a42f2 | [
"EasyFrame.__init__(self, title='Guessing Game')\nself.myNumber = random.randint(1, 100)\nself.count = 0\ngreeting = 'Guess a number between 1 and 100.'\nself.hintLabel = self.addLabel(text=greeting, row=0, column=0, sticky='NSEW', columnspan=2)\nself.addLabel(text='Your guess', row=1, column=0)\nself.guessField = ... | <|body_start_0|>
EasyFrame.__init__(self, title='Guessing Game')
self.myNumber = random.randint(1, 100)
self.count = 0
greeting = 'Guess a number between 1 and 100.'
self.hintLabel = self.addLabel(text=greeting, row=0, column=0, sticky='NSEW', columnspan=2)
self.addLabel(... | Plays a guessing game with the user. | GuessingGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GuessingGame:
"""Plays a guessing game with the user."""
def __init__(self):
"""Sets up the window,widgets, and data."""
<|body_0|>
def nextGuess(self):
"""Processes the user's next guess."""
<|body_1|>
def newGame(self):
"""Resets the GUI to... | stack_v2_sparse_classes_75kplus_train_068904 | 2,264 | no_license | [
{
"docstring": "Sets up the window,widgets, and data.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Processes the user's next guess.",
"name": "nextGuess",
"signature": "def nextGuess(self)"
},
{
"docstring": "Resets the GUI to its original state.",
... | 3 | stack_v2_sparse_classes_30k_train_032933 | Implement the Python class `GuessingGame` described below.
Class description:
Plays a guessing game with the user.
Method signatures and docstrings:
- def __init__(self): Sets up the window,widgets, and data.
- def nextGuess(self): Processes the user's next guess.
- def newGame(self): Resets the GUI to its original s... | Implement the Python class `GuessingGame` described below.
Class description:
Plays a guessing game with the user.
Method signatures and docstrings:
- def __init__(self): Sets up the window,widgets, and data.
- def nextGuess(self): Processes the user's next guess.
- def newGame(self): Resets the GUI to its original s... | 30375264cf0103e3455fdf92c35a2c5c15b5d7ef | <|skeleton|>
class GuessingGame:
"""Plays a guessing game with the user."""
def __init__(self):
"""Sets up the window,widgets, and data."""
<|body_0|>
def nextGuess(self):
"""Processes the user's next guess."""
<|body_1|>
def newGame(self):
"""Resets the GUI to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GuessingGame:
"""Plays a guessing game with the user."""
def __init__(self):
"""Sets up the window,widgets, and data."""
EasyFrame.__init__(self, title='Guessing Game')
self.myNumber = random.randint(1, 100)
self.count = 0
greeting = 'Guess a number between 1 and 1... | the_stack_v2_python_sparse | Student_Files/ch_08_Student_Files/guessversion2.py | davelpat/Fundamentals_of_Python | train | 1 |
e065a55bed130229f0fa1da93016e9e42e6bc8d3 | [
"self.host = host\nself.port = port\nself.secret = secret",
"if dictionary is None:\n return None\nhost = dictionary.get('host')\nsecret = dictionary.get('secret')\nport = dictionary.get('port')\nreturn cls(host, secret, port)"
] | <|body_start_0|>
self.host = host
self.port = port
self.secret = secret
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
host = dictionary.get('host')
secret = dictionary.get('secret')
port = dictionary.get('port')
return cls... | Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secret (string): Shared key used to authenticate messages b... | RadiusAccountingServerModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RadiusAccountingServerModel:
"""Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secr... | stack_v2_sparse_classes_75kplus_train_068905 | 1,986 | permissive | [
{
"docstring": "Constructor for the RadiusAccountingServerModel class",
"name": "__init__",
"signature": "def __init__(self, host=None, secret=None, port=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of th... | 2 | stack_v2_sparse_classes_30k_train_052730 | Implement the Python class `RadiusAccountingServerModel` described below.
Class description:
Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is... | Implement the Python class `RadiusAccountingServerModel` described below.
Class description:
Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class RadiusAccountingServerModel:
"""Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RadiusAccountingServerModel:
"""Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secret (string): ... | the_stack_v2_python_sparse | meraki_sdk/models/radius_accounting_server_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
5819fc5031474b321b0c610d1e562b85a6ced586 | [
"if not root:\n return 0\n\ndef visit(prefixes, node: TreeNode) -> int:\n new_prefixes = {key + node.val: count for key, count in prefixes.items()}\n new_prefixes[node.val] = new_prefixes.get(node.val, 0) + 1\n count = new_prefixes.get(target, 0)\n if node.left:\n count += visit(new_prefixes, ... | <|body_start_0|>
if not root:
return 0
def visit(prefixes, node: TreeNode) -> int:
new_prefixes = {key + node.val: count for key, count in prefixes.items()}
new_prefixes[node.val] = new_prefixes.get(node.val, 0) + 1
count = new_prefixes.get(target, 0)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum(self, root: TreeNode, target: int) -> int:
"""Traverse the tree downward, and try each path. Keep during the descent the possible starting sums (in a dictionary for multiplicities). On the way up, sum the number of paths."""
<|body_0|>
def pathSum(self,... | stack_v2_sparse_classes_75kplus_train_068906 | 2,344 | no_license | [
{
"docstring": "Traverse the tree downward, and try each path. Keep during the descent the possible starting sums (in a dictionary for multiplicities). On the way up, sum the number of paths.",
"name": "pathSum",
"signature": "def pathSum(self, root: TreeNode, target: int) -> int"
},
{
"docstrin... | 2 | stack_v2_sparse_classes_30k_train_054304 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root: TreeNode, target: int) -> int: Traverse the tree downward, and try each path. Keep during the descent the possible starting sums (in a dictionary for mult... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root: TreeNode, target: int) -> int: Traverse the tree downward, and try each path. Keep during the descent the possible starting sums (in a dictionary for mult... | 3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8 | <|skeleton|>
class Solution:
def pathSum(self, root: TreeNode, target: int) -> int:
"""Traverse the tree downward, and try each path. Keep during the descent the possible starting sums (in a dictionary for multiplicities). On the way up, sum the number of paths."""
<|body_0|>
def pathSum(self,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def pathSum(self, root: TreeNode, target: int) -> int:
"""Traverse the tree downward, and try each path. Keep during the descent the possible starting sums (in a dictionary for multiplicities). On the way up, sum the number of paths."""
if not root:
return 0
def ... | the_stack_v2_python_sparse | binary_tree/PathSum3.py | QuentinDuval/PythonExperiments | train | 3 | |
a89021bfbc7ba91d665dc548b8bd850efbf2393d | [
"self.num_classes = num_classes\nself.num_models = num_models\nif class_names is None:\n class_names = map(str, range(num_classes))\nassert len(class_names) == num_classes, 'ERROR! No. of classes in class_names \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tshould be equal to num_classes.'\nif isinstance(class_names, np.nd... | <|body_start_0|>
self.num_classes = num_classes
self.num_models = num_models
if class_names is None:
class_names = map(str, range(num_classes))
assert len(class_names) == num_classes, 'ERROR! No. of classes in class_names \t\t\t\t\t\t\t\t\t\t\t\tshould be equal to num_classes... | the class of Dempster-Shafer Theory (DST) and Dempster's Rule of Combination (DRC) | DST | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DST:
"""the class of Dempster-Shafer Theory (DST) and Dempster's Rule of Combination (DRC)"""
def __init__(self, num_models, num_classes, class_names=None):
"""Description: * class names are present in class_names Input arguments: * num_models: no. of models * num_classes: no. of cla... | stack_v2_sparse_classes_75kplus_train_068907 | 6,507 | no_license | [
{
"docstring": "Description: * class names are present in class_names Input arguments: * num_models: no. of models * num_classes: no. of classes * class_names: actual class names Return: * self",
"name": "__init__",
"signature": "def __init__(self, num_models, num_classes, class_names=None)"
},
{
... | 6 | stack_v2_sparse_classes_30k_train_026224 | Implement the Python class `DST` described below.
Class description:
the class of Dempster-Shafer Theory (DST) and Dempster's Rule of Combination (DRC)
Method signatures and docstrings:
- def __init__(self, num_models, num_classes, class_names=None): Description: * class names are present in class_names Input argumen... | Implement the Python class `DST` described below.
Class description:
the class of Dempster-Shafer Theory (DST) and Dempster's Rule of Combination (DRC)
Method signatures and docstrings:
- def __init__(self, num_models, num_classes, class_names=None): Description: * class names are present in class_names Input argumen... | 80a89e8ab8a457433b5bde4a7d254bc66e663df0 | <|skeleton|>
class DST:
"""the class of Dempster-Shafer Theory (DST) and Dempster's Rule of Combination (DRC)"""
def __init__(self, num_models, num_classes, class_names=None):
"""Description: * class names are present in class_names Input arguments: * num_models: no. of models * num_classes: no. of cla... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DST:
"""the class of Dempster-Shafer Theory (DST) and Dempster's Rule of Combination (DRC)"""
def __init__(self, num_models, num_classes, class_names=None):
"""Description: * class names are present in class_names Input arguments: * num_models: no. of models * num_classes: no. of classes * class_... | the_stack_v2_python_sparse | Naveen/Backup/DST.py | nmadapan/AHRQ_Gesture_Recognition | train | 2 |
d9ca77b4d06049b9b849c2ce64ebf41a808d6e8a | [
"if email:\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user\nraise ValueError(_('Email must entered to create a user'))",
"extra_fields.setdefault('is_active', True)\nextra_fields.setdefault('is_staff', True)\nextra_fields.setdefa... | <|body_start_0|>
if email:
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
raise ValueError(_('Email must entered to create a user'))
<|end_body_0|>
<|body_start_1|>
extra_fields.set... | CustomUser manager for CustomUser for authentication using email and password | CustomUserManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomUserManager:
"""CustomUser manager for CustomUser for authentication using email and password"""
def create_user(self, email, password, **extra_fields):
"""Create a user with given email and password"""
<|body_0|>
def create_superuser(self, email, password, **extra... | stack_v2_sparse_classes_75kplus_train_068908 | 3,098 | permissive | [
{
"docstring": "Create a user with given email and password",
"name": "create_user",
"signature": "def create_user(self, email, password, **extra_fields)"
},
{
"docstring": "Create a superuser with given email, password and other credentials",
"name": "create_superuser",
"signature": "de... | 2 | null | Implement the Python class `CustomUserManager` described below.
Class description:
CustomUser manager for CustomUser for authentication using email and password
Method signatures and docstrings:
- def create_user(self, email, password, **extra_fields): Create a user with given email and password
- def create_superuse... | Implement the Python class `CustomUserManager` described below.
Class description:
CustomUser manager for CustomUser for authentication using email and password
Method signatures and docstrings:
- def create_user(self, email, password, **extra_fields): Create a user with given email and password
- def create_superuse... | 264b98a325ccfa683737e03623acc99fe3053a99 | <|skeleton|>
class CustomUserManager:
"""CustomUser manager for CustomUser for authentication using email and password"""
def create_user(self, email, password, **extra_fields):
"""Create a user with given email and password"""
<|body_0|>
def create_superuser(self, email, password, **extra... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomUserManager:
"""CustomUser manager for CustomUser for authentication using email and password"""
def create_user(self, email, password, **extra_fields):
"""Create a user with given email and password"""
if email:
user = self.model(email=email, **extra_fields)
... | the_stack_v2_python_sparse | app/users/models.py | S3Infosoft/s3-loyalty-webapp | train | 0 |
644ff74c06dfb30cbfbcd742c8606494c98aa0a6 | [
"i18ns._SIGNAL_HANDLERS_DB['tmp_sig'] = None\ni18ns.register()\nself.assertNotIn(id(i18ns.save_generator), i18ns.signals.generator_init.receivers)",
"i18ns.register()\nfor sig_name, handler in i18ns._SIGNAL_HANDLERS_DB.items():\n sig = getattr(i18ns.signals, sig_name)\n self.assertIn(id(handler), sig.receiv... | <|body_start_0|>
i18ns._SIGNAL_HANDLERS_DB['tmp_sig'] = None
i18ns.register()
self.assertNotIn(id(i18ns.save_generator), i18ns.signals.generator_init.receivers)
<|end_body_0|>
<|body_start_1|>
i18ns.register()
for sig_name, handler in i18ns._SIGNAL_HANDLERS_DB.items():
... | Test plugin registration | TestRegistration | [
"AGPL-3.0-only",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestRegistration:
"""Test plugin registration"""
def test_return_on_missing_signal(self):
"""Test return on missing required signal"""
<|body_0|>
def test_registration(self):
"""Test registration of all signal handlers"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_75kplus_train_068909 | 5,166 | permissive | [
{
"docstring": "Test return on missing required signal",
"name": "test_return_on_missing_signal",
"signature": "def test_return_on_missing_signal(self)"
},
{
"docstring": "Test registration of all signal handlers",
"name": "test_registration",
"signature": "def test_registration(self)"
... | 2 | stack_v2_sparse_classes_30k_val_001978 | Implement the Python class `TestRegistration` described below.
Class description:
Test plugin registration
Method signatures and docstrings:
- def test_return_on_missing_signal(self): Test return on missing required signal
- def test_registration(self): Test registration of all signal handlers | Implement the Python class `TestRegistration` described below.
Class description:
Test plugin registration
Method signatures and docstrings:
- def test_return_on_missing_signal(self): Test return on missing required signal
- def test_registration(self): Test registration of all signal handlers
<|skeleton|>
class Tes... | b5d68070b6f15677a183424c84e30440e128e1ea | <|skeleton|>
class TestRegistration:
"""Test plugin registration"""
def test_return_on_missing_signal(self):
"""Test return on missing required signal"""
<|body_0|>
def test_registration(self):
"""Test registration of all signal handlers"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestRegistration:
"""Test plugin registration"""
def test_return_on_missing_signal(self):
"""Test return on missing required signal"""
i18ns._SIGNAL_HANDLERS_DB['tmp_sig'] = None
i18ns.register()
self.assertNotIn(id(i18ns.save_generator), i18ns.signals.generator_init.recei... | the_stack_v2_python_sparse | plugins/i18n_subsites/test_i18n_subsites.py | JackMcKew/jackmckew.dev | train | 15 |
796cfb8e71990ec8a252dc775aaff0e21be06e15 | [
"self.vocab = vocab\nself.unk_token = unk_token\nself.normalize_text = normalize_text",
"if self.normalize_text:\n text = unicodedata.normalize('NFKC', text)\noutput_tokens = []\nfor char in text:\n if char not in self.vocab:\n output_tokens.append(self.unk_token)\n continue\n output_tokens... | <|body_start_0|>
self.vocab = vocab
self.unk_token = unk_token
self.normalize_text = normalize_text
<|end_body_0|>
<|body_start_1|>
if self.normalize_text:
text = unicodedata.normalize('NFKC', text)
output_tokens = []
for char in text:
if char not... | Runs Character tokenization. | CharacterTokenizer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharacterTokenizer:
"""Runs Character tokenization."""
def __init__(self, vocab, unk_token, normalize_text=True):
"""Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) ... | stack_v2_sparse_classes_75kplus_train_068910 | 40,187 | permissive | [
{
"docstring": "Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) boolean (default True) Whether to apply unicode normalization to text before tokenization.",
"name": "__init__",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_039309 | Implement the Python class `CharacterTokenizer` described below.
Class description:
Runs Character tokenization.
Method signatures and docstrings:
- def __init__(self, vocab, unk_token, normalize_text=True): Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for o... | Implement the Python class `CharacterTokenizer` described below.
Class description:
Runs Character tokenization.
Method signatures and docstrings:
- def __init__(self, vocab, unk_token, normalize_text=True): Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for o... | 4fa0aff21ee083d0197a898cdf17ff476fae2ac3 | <|skeleton|>
class CharacterTokenizer:
"""Runs Character tokenization."""
def __init__(self, vocab, unk_token, normalize_text=True):
"""Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CharacterTokenizer:
"""Runs Character tokenization."""
def __init__(self, vocab, unk_token, normalize_text=True):
"""Constructs a CharacterTokenizer. Args: **vocab**: Vocabulary object. **unk_token**: str A special symbol for out-of-vocabulary token. **normalize_text**: (`optional`) boolean (defa... | the_stack_v2_python_sparse | src/transformers/models/bert_japanese/tokenization_bert_japanese.py | huggingface/transformers | train | 102,193 |
1ee58502cf7c2c1ddf4821e1fca22e850b19e283 | [
"selectors = response.xpath('//*[@id=\"news_list\"]/ol/li')\nfor selector in selectors:\n yield self.parse_item(selector, response)",
"l_item = ItemLoader(item=DongqiudiItem(), selector=selector)\nl_item.add_xpath('title', './h2/a/text()', MapCompose(str.strip))\nl_item.add_xpath('description', './p/text()')\n... | <|body_start_0|>
selectors = response.xpath('//*[@id="news_list"]/ol/li')
for selector in selectors:
yield self.parse_item(selector, response)
<|end_body_0|>
<|body_start_1|>
l_item = ItemLoader(item=DongqiudiItem(), selector=selector)
l_item.add_xpath('title', './h2/a/text(... | FastSpider | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FastSpider:
def parse(self, response):
"""This function parses a news page. :param response: :return: @url http://www.dongqiudi.com/ @returns items 1 @scrapes title url @scrapes page_url project spider server date"""
<|body_0|>
def parse_item(self, selector, response):
... | stack_v2_sparse_classes_75kplus_train_068911 | 1,833 | permissive | [
{
"docstring": "This function parses a news page. :param response: :return: @url http://www.dongqiudi.com/ @returns items 1 @scrapes title url @scrapes page_url project spider server date",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "This function parses a page t... | 2 | null | Implement the Python class `FastSpider` described below.
Class description:
Implement the FastSpider class.
Method signatures and docstrings:
- def parse(self, response): This function parses a news page. :param response: :return: @url http://www.dongqiudi.com/ @returns items 1 @scrapes title url @scrapes page_url pr... | Implement the Python class `FastSpider` described below.
Class description:
Implement the FastSpider class.
Method signatures and docstrings:
- def parse(self, response): This function parses a news page. :param response: :return: @url http://www.dongqiudi.com/ @returns items 1 @scrapes title url @scrapes page_url pr... | 66934852c508bff5540596aa71d5ce40c828b37d | <|skeleton|>
class FastSpider:
def parse(self, response):
"""This function parses a news page. :param response: :return: @url http://www.dongqiudi.com/ @returns items 1 @scrapes title url @scrapes page_url project spider server date"""
<|body_0|>
def parse_item(self, selector, response):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FastSpider:
def parse(self, response):
"""This function parses a news page. :param response: :return: @url http://www.dongqiudi.com/ @returns items 1 @scrapes title url @scrapes page_url project spider server date"""
selectors = response.xpath('//*[@id="news_list"]/ol/li')
for selector... | the_stack_v2_python_sparse | work4/scrapy2/dongqiudi/dongqiudi/spiders/fast.py | arfu2016/DuReader | train | 0 | |
476c4a05d058d2ddfc09191a84b1be7667cb29bd | [
"rol = get_rol_id(id_rol)\nif not rol:\n api.abort(404)\nelse:\n return rol",
"data = request.json\nrol = update_rol(id_rol, data)\nif not rol:\n api.abort(404)\nelse:\n return rol",
"rol = delete_rol(id_rol)\nif not rol:\n api.abort(404)\nelse:\n return rol"
] | <|body_start_0|>
rol = get_rol_id(id_rol)
if not rol:
api.abort(404)
else:
return rol
<|end_body_0|>
<|body_start_1|>
data = request.json
rol = update_rol(id_rol, data)
if not rol:
api.abort(404)
else:
return rol
<|... | Rol | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rol:
def get(self, id_rol):
"""get a rol given its identifier"""
<|body_0|>
def put(self, id_rol):
"""update a rol given its identifier"""
<|body_1|>
def delete(self, id_rol):
"""delete a rol given its identifier"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_75kplus_train_068912 | 1,549 | no_license | [
{
"docstring": "get a rol given its identifier",
"name": "get",
"signature": "def get(self, id_rol)"
},
{
"docstring": "update a rol given its identifier",
"name": "put",
"signature": "def put(self, id_rol)"
},
{
"docstring": "delete a rol given its identifier",
"name": "dele... | 3 | stack_v2_sparse_classes_30k_train_039563 | Implement the Python class `Rol` described below.
Class description:
Implement the Rol class.
Method signatures and docstrings:
- def get(self, id_rol): get a rol given its identifier
- def put(self, id_rol): update a rol given its identifier
- def delete(self, id_rol): delete a rol given its identifier | Implement the Python class `Rol` described below.
Class description:
Implement the Rol class.
Method signatures and docstrings:
- def get(self, id_rol): get a rol given its identifier
- def put(self, id_rol): update a rol given its identifier
- def delete(self, id_rol): delete a rol given its identifier
<|skeleton|>... | e3e6d716102280e73932e5eba65b2ff27eec45e0 | <|skeleton|>
class Rol:
def get(self, id_rol):
"""get a rol given its identifier"""
<|body_0|>
def put(self, id_rol):
"""update a rol given its identifier"""
<|body_1|>
def delete(self, id_rol):
"""delete a rol given its identifier"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rol:
def get(self, id_rol):
"""get a rol given its identifier"""
rol = get_rol_id(id_rol)
if not rol:
api.abort(404)
else:
return rol
def put(self, id_rol):
"""update a rol given its identifier"""
data = request.json
rol = up... | the_stack_v2_python_sparse | app/main/controller/rol_controller.py | Team-3-TCS/api-my-store | train | 1 | |
7d2b8d639e6d7fbf51942b1287bed7e1f83d59c9 | [
"data = {'text': 'test profession'}\nresponse = self.client.post(self.url, data, headers={'Content-Type': 'application/json'})\nself.assertEqual(200, response.status_code)",
"self.profession = Profession.objects.create(text='Test')\nresponse = self.client.get(self.url)\nself.assertEqual(len(response.data['results... | <|body_start_0|>
data = {'text': 'test profession'}
response = self.client.post(self.url, data, headers={'Content-Type': 'application/json'})
self.assertEqual(200, response.status_code)
<|end_body_0|>
<|body_start_1|>
self.profession = Profession.objects.create(text='Test')
resp... | Test cases for profession list call | ProfessionListTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfessionListTestCase:
"""Test cases for profession list call"""
def test_add_profession(self):
"""Test to add a Profession"""
<|body_0|>
def test_profession(self):
"""Test to verify user created profession"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_068913 | 21,995 | no_license | [
{
"docstring": "Test to add a Profession",
"name": "test_add_profession",
"signature": "def test_add_profession(self)"
},
{
"docstring": "Test to verify user created profession",
"name": "test_profession",
"signature": "def test_profession(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010048 | Implement the Python class `ProfessionListTestCase` described below.
Class description:
Test cases for profession list call
Method signatures and docstrings:
- def test_add_profession(self): Test to add a Profession
- def test_profession(self): Test to verify user created profession | Implement the Python class `ProfessionListTestCase` described below.
Class description:
Test cases for profession list call
Method signatures and docstrings:
- def test_add_profession(self): Test to add a Profession
- def test_profession(self): Test to verify user created profession
<|skeleton|>
class ProfessionList... | f38ea1ff9283416f4b4b1a9eb134344a566856a4 | <|skeleton|>
class ProfessionListTestCase:
"""Test cases for profession list call"""
def test_add_profession(self):
"""Test to add a Profession"""
<|body_0|>
def test_profession(self):
"""Test to verify user created profession"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProfessionListTestCase:
"""Test cases for profession list call"""
def test_add_profession(self):
"""Test to add a Profession"""
data = {'text': 'test profession'}
response = self.client.post(self.url, data, headers={'Content-Type': 'application/json'})
self.assertEqual(200... | the_stack_v2_python_sparse | userprofile/tests.py | meanwise-eng/meanwise-server | train | 0 |
7122863ca78fe93e471e7e9fdc68d0cef9fdb953 | [
"dp = [float('inf')] * (amount + 1)\ndp[0] = 0\nfor coin in coins:\n for x in range(coin, amount + 1):\n dp[x] = min(dp[x], dp[x - coin] + 1)\nreturn dp[amount] if dp[amount] != float('inf') else -1",
"def coinChanging(coins, amount, c_index, count, ans):\n if amount == 0:\n return min(ans, co... | <|body_start_0|>
dp = [float('inf')] * (amount + 1)
dp[0] = 0
for coin in coins:
for x in range(coin, amount + 1):
dp[x] = min(dp[x], dp[x - coin] + 1)
return dp[amount] if dp[amount] != float('inf') else -1
<|end_body_0|>
<|body_start_1|>
def coinCha... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def coinChange_1(self, coins, amount):
"""动态规划:自下而上 - 抄作业 执行用时 :840 ms, 在所有 Python 提交中击败了84.86%的用户 内存消耗 :12.2 MB, 在所有 Python 提交中击败了22.61%的用户 :type coins: List[int] :type amount: int :rtype: int"""
<|body_0|>
def coinChange_2(self, coins, amount):
"""贪心 + df... | stack_v2_sparse_classes_75kplus_train_068914 | 2,082 | no_license | [
{
"docstring": "动态规划:自下而上 - 抄作业 执行用时 :840 ms, 在所有 Python 提交中击败了84.86%的用户 内存消耗 :12.2 MB, 在所有 Python 提交中击败了22.61%的用户 :type coins: List[int] :type amount: int :rtype: int",
"name": "coinChange_1",
"signature": "def coinChange_1(self, coins, amount)"
},
{
"docstring": "贪心 + dfs 执行用时 :104 ms, 在所有 Pyt... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange_1(self, coins, amount): 动态规划:自下而上 - 抄作业 执行用时 :840 ms, 在所有 Python 提交中击败了84.86%的用户 内存消耗 :12.2 MB, 在所有 Python 提交中击败了22.61%的用户 :type coins: List[int] :type amount: int... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange_1(self, coins, amount): 动态规划:自下而上 - 抄作业 执行用时 :840 ms, 在所有 Python 提交中击败了84.86%的用户 内存消耗 :12.2 MB, 在所有 Python 提交中击败了22.61%的用户 :type coins: List[int] :type amount: int... | ce644a08dc7fd5efe8cc876dbbfe9be4e1371a15 | <|skeleton|>
class Solution:
def coinChange_1(self, coins, amount):
"""动态规划:自下而上 - 抄作业 执行用时 :840 ms, 在所有 Python 提交中击败了84.86%的用户 内存消耗 :12.2 MB, 在所有 Python 提交中击败了22.61%的用户 :type coins: List[int] :type amount: int :rtype: int"""
<|body_0|>
def coinChange_2(self, coins, amount):
"""贪心 + df... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def coinChange_1(self, coins, amount):
"""动态规划:自下而上 - 抄作业 执行用时 :840 ms, 在所有 Python 提交中击败了84.86%的用户 内存消耗 :12.2 MB, 在所有 Python 提交中击败了22.61%的用户 :type coins: List[int] :type amount: int :rtype: int"""
dp = [float('inf')] * (amount + 1)
dp[0] = 0
for coin in coins:
... | the_stack_v2_python_sparse | leetcode - 副本/S0035_322_coinChange.py | shcqupc/hankPylib | train | 0 | |
a1536957cbf57af9f9ffc12f1fbdfb42c4bc4414 | [
"self.session = session\nself.starting_op_names = starting_op_names\nself.layer_output = LayerOutput(session=session, starting_op_names=starting_op_names, output_op_names=output_op_names, dir_path=dir_path)\naxis_layout = 'NHWC' if tf.keras.backend.image_data_format() == 'channels_last' else 'NCHW'\nself.save_input... | <|body_start_0|>
self.session = session
self.starting_op_names = starting_op_names
self.layer_output = LayerOutput(session=session, starting_op_names=starting_op_names, output_op_names=output_op_names, dir_path=dir_path)
axis_layout = 'NHWC' if tf.keras.backend.image_data_format() == 'ch... | Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim) | LayerOutputUtil | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LayerOutputUtil:
"""Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)"""
def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str):
"""Constructor for LayerOutputUtil. :param s... | stack_v2_sparse_classes_75kplus_train_068915 | 8,075 | permissive | [
{
"docstring": "Constructor for LayerOutputUtil. :param session: Session containing the model whose layer-outputs are needed. :param starting_op_names: List of starting op names of the model. :param output_op_names: List of output op names of the model. :param dir_path: Directory wherein layer-outputs will be s... | 2 | stack_v2_sparse_classes_30k_train_027490 | Implement the Python class `LayerOutputUtil` described below.
Class description:
Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)
Method signatures and docstrings:
- def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], ... | Implement the Python class `LayerOutputUtil` described below.
Class description:
Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)
Method signatures and docstrings:
- def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], ... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class LayerOutputUtil:
"""Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)"""
def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str):
"""Constructor for LayerOutputUtil. :param s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LayerOutputUtil:
"""Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)"""
def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str):
"""Constructor for LayerOutputUtil. :param session: Sessi... | the_stack_v2_python_sparse | TrainingExtensions/tensorflow/src/python/aimet_tensorflow/layer_output_utils.py | quic/aimet | train | 1,676 |
30888ce6691053cf4bca606de63403c2ffbb24e0 | [
"driver = browser\ndriver.get(base_url)\ndriver.find_element_by_xpath(\"//span[text()='账号登录']\").click()\ndriver.get_screenshot_as_file(images_path + 'test_login_case-验证截图-' + str(time.time()) + '.png')\ndriver.find_element_by_id('username_no').send_keys(self.user)\ndriver.find_element_by_id('password').send_keys(s... | <|body_start_0|>
driver = browser
driver.get(base_url)
driver.find_element_by_xpath("//span[text()='账号登录']").click()
driver.get_screenshot_as_file(images_path + 'test_login_case-验证截图-' + str(time.time()) + '.png')
driver.find_element_by_id('username_no').send_keys(self.user)
... | 测试登录 | Testsign | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Testsign:
"""测试登录"""
def test_login_case(self, browser, base_url, images_path):
"""测试登录"""
<|body_0|>
def test_create(self, browser, images_path):
"""新建文件夹"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
driver = browser
driver.get(base_... | stack_v2_sparse_classes_75kplus_train_068916 | 2,702 | no_license | [
{
"docstring": "测试登录",
"name": "test_login_case",
"signature": "def test_login_case(self, browser, base_url, images_path)"
},
{
"docstring": "新建文件夹",
"name": "test_create",
"signature": "def test_create(self, browser, images_path)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001217 | Implement the Python class `Testsign` described below.
Class description:
测试登录
Method signatures and docstrings:
- def test_login_case(self, browser, base_url, images_path): 测试登录
- def test_create(self, browser, images_path): 新建文件夹 | Implement the Python class `Testsign` described below.
Class description:
测试登录
Method signatures and docstrings:
- def test_login_case(self, browser, base_url, images_path): 测试登录
- def test_create(self, browser, images_path): 新建文件夹
<|skeleton|>
class Testsign:
"""测试登录"""
def test_login_case(self, browser, b... | baa61dafeeebb39390bcfa1f85237ebd44021918 | <|skeleton|>
class Testsign:
"""测试登录"""
def test_login_case(self, browser, base_url, images_path):
"""测试登录"""
<|body_0|>
def test_create(self, browser, images_path):
"""新建文件夹"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Testsign:
"""测试登录"""
def test_login_case(self, browser, base_url, images_path):
"""测试登录"""
driver = browser
driver.get(base_url)
driver.find_element_by_xpath("//span[text()='账号登录']").click()
driver.get_screenshot_as_file(images_path + 'test_login_case-验证截图-' + str(... | the_stack_v2_python_sparse | test_dir/1test_Alogin.py | qinchuan-he/ui-test | train | 1 |
2d9ad66f7bf8b42fd4894af2c0df32978ba90634 | [
"self.sz = sz\nself.nthreads = nthreads\nx = ((np.arange(sz) + sz / 2) % sz - sz / 2) / m_per_pix / sz\nxy = np.meshgrid(x, x)\nuu = np.sqrt(xy[0] ** 2 + xy[1] ** 2)\nself.h_ft = np.exp(1j * np.pi * uu ** 2 * wave * d)",
"if wf.shape[0] != self.sz | wf.shape[1] != self.sz:\n print('ERROR: Input wavefront must ... | <|body_start_0|>
self.sz = sz
self.nthreads = nthreads
x = ((np.arange(sz) + sz / 2) % sz - sz / 2) / m_per_pix / sz
xy = np.meshgrid(x, x)
uu = np.sqrt(xy[0] ** 2 + xy[1] ** 2)
self.h_ft = np.exp(1j * np.pi * uu ** 2 * wave * d)
<|end_body_0|>
<|body_start_1|>
i... | Propagate a wave by Fresnel diffraction | FresnelPropagator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FresnelPropagator:
"""Propagate a wave by Fresnel diffraction"""
def __init__(self, sz, m_per_pix, d, wave, nthreads=nthreads):
"""Initiate this fresnel_propagator for a particular wavelength, distance etc. Parameters ---------- wf: float array m_per_pix: float Scale of the pixels in... | stack_v2_sparse_classes_75kplus_train_068917 | 46,053 | permissive | [
{
"docstring": "Initiate this fresnel_propagator for a particular wavelength, distance etc. Parameters ---------- wf: float array m_per_pix: float Scale of the pixels in the input wavefront in metres. d: float Distance to propagate the wavefront. wave: float Wavelength in metres. nthreads: int Number of threads... | 2 | null | Implement the Python class `FresnelPropagator` described below.
Class description:
Propagate a wave by Fresnel diffraction
Method signatures and docstrings:
- def __init__(self, sz, m_per_pix, d, wave, nthreads=nthreads): Initiate this fresnel_propagator for a particular wavelength, distance etc. Parameters ---------... | Implement the Python class `FresnelPropagator` described below.
Class description:
Propagate a wave by Fresnel diffraction
Method signatures and docstrings:
- def __init__(self, sz, m_per_pix, d, wave, nthreads=nthreads): Initiate this fresnel_propagator for a particular wavelength, distance etc. Parameters ---------... | df127262d58f5d03ca210b2cac7c5d09419f11be | <|skeleton|>
class FresnelPropagator:
"""Propagate a wave by Fresnel diffraction"""
def __init__(self, sz, m_per_pix, d, wave, nthreads=nthreads):
"""Initiate this fresnel_propagator for a particular wavelength, distance etc. Parameters ---------- wf: float array m_per_pix: float Scale of the pixels in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FresnelPropagator:
"""Propagate a wave by Fresnel diffraction"""
def __init__(self, sz, m_per_pix, d, wave, nthreads=nthreads):
"""Initiate this fresnel_propagator for a particular wavelength, distance etc. Parameters ---------- wf: float array m_per_pix: float Scale of the pixels in the input wa... | the_stack_v2_python_sparse | opticstools/opticstools.py | mikeireland/opticstools | train | 0 |
e974712da7d8f2688ca9b10fc25758deadc6a0dd | [
"self.domain_controller = domain_controller\nself.domain_name = domain_name\nself.name = name\nself.owner_id = owner_id\nself.mtype = mtype\nself.uuid = uuid",
"if dictionary is None:\n return None\ndomain_controller = cohesity_management_sdk.models.ad_domain_controller.AdDomainController.from_dictionary(dicti... | <|body_start_0|>
self.domain_controller = domain_controller
self.domain_name = domain_name
self.name = name
self.owner_id = owner_id
self.mtype = mtype
self.uuid = uuid
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
domain_... | Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name corresponding to the domain controller. name (string): S... | AdProtectionSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdProtectionSource:
"""Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name correspond... | stack_v2_sparse_classes_75kplus_train_068918 | 3,093 | permissive | [
{
"docstring": "Constructor for the AdProtectionSource class",
"name": "__init__",
"signature": "def __init__(self, domain_controller=None, domain_name=None, name=None, owner_id=None, mtype=None, uuid=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary ... | 2 | stack_v2_sparse_classes_30k_train_008817 | Implement the Python class `AdProtectionSource` described below.
Class description:
Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string... | Implement the Python class `AdProtectionSource` described below.
Class description:
Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class AdProtectionSource:
"""Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name correspond... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdProtectionSource:
"""Implementation of the 'AdProtectionSource' model. Specifies an object representing an AD entity. Attributes: domain_controller (AdDomainController): Specifies the domain controller residing in this physical machine. domain_name (string): Specifies the domain name corresponding to the do... | the_stack_v2_python_sparse | cohesity_management_sdk/models/ad_protection_source.py | cohesity/management-sdk-python | train | 24 |
ce6cb605239ff0916f89997d17095504028617f5 | [
"self.A = A\nself.index = 0\nself.used = 0",
"count = 0\ntarget = self.used + n\nwhile self.index < len(self.A) and count + self.A[self.index] < target:\n count += self.A[self.index]\n self.index += 2\nif self.index >= len(self.A):\n return -1\nelse:\n self.used = target - count\n return self.A[sel... | <|body_start_0|>
self.A = A
self.index = 0
self.used = 0
<|end_body_0|>
<|body_start_1|>
count = 0
target = self.used + n
while self.index < len(self.A) and count + self.A[self.index] < target:
count += self.A[self.index]
self.index += 2
i... | RLEIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.A = A
self.index = 0
self.used = 0
<|end_body_0|>
<|body_sta... | stack_v2_sparse_classes_75kplus_train_068919 | 3,282 | no_license | [
{
"docstring": ":type A: List[int]",
"name": "__init__",
"signature": "def __init__(self, A)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "next",
"signature": "def next(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_035830 | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int
<|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: Lis... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
self.A = A
self.index = 0
self.used = 0
def next(self, n):
""":type n: int :rtype: int"""
count = 0
target = self.used + n
while self.index < len(self.A) and count + self.A[self.in... | the_stack_v2_python_sparse | code900RLEIterator.py | cybelewang/leetcode-python | train | 0 | |
969ba5f67f272118480f3b605466b5c231e24391 | [
"resultDict = {}\nfor pileupType in stepHelper.data.pileup.listSections_():\n datasets = getattr(getattr(stepHelper.data.pileup, pileupType), 'dataset')\n blockDict = {}\n for dataset in datasets:\n blockNames = dbsReader.listFileBlocks(dataset)\n for dbsBlockName in blockNames:\n ... | <|body_start_0|>
resultDict = {}
for pileupType in stepHelper.data.pileup.listSections_():
datasets = getattr(getattr(stepHelper.data.pileup, pileupType), 'dataset')
blockDict = {}
for dataset in datasets:
blockNames = dbsReader.listFileBlocks(dataset)... | Pull dataset block/SE : LFN list from DBS for the pileup datasets required by the steps in the job. Save these maps as files in the sandbox | PileupFetcher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PileupFetcher:
"""Pull dataset block/SE : LFN list from DBS for the pileup datasets required by the steps in the job. Save these maps as files in the sandbox"""
def _queryDbsAndGetPileupConfig(self, stepHelper, dbsReader):
"""Method iterates over components of the pileup configuratio... | stack_v2_sparse_classes_75kplus_train_068920 | 4,412 | no_license | [
{
"docstring": "Method iterates over components of the pileup configuration input and queries DBS. Then iterates over results from DBS. There needs to be a list of files and their locations for each dataset name. Use dbsReader the result data structure is a Python dict following dictionary: FileList is a list o... | 3 | stack_v2_sparse_classes_30k_train_044150 | Implement the Python class `PileupFetcher` described below.
Class description:
Pull dataset block/SE : LFN list from DBS for the pileup datasets required by the steps in the job. Save these maps as files in the sandbox
Method signatures and docstrings:
- def _queryDbsAndGetPileupConfig(self, stepHelper, dbsReader): M... | Implement the Python class `PileupFetcher` described below.
Class description:
Pull dataset block/SE : LFN list from DBS for the pileup datasets required by the steps in the job. Save these maps as files in the sandbox
Method signatures and docstrings:
- def _queryDbsAndGetPileupConfig(self, stepHelper, dbsReader): M... | 122f9332f2e944154dd0df68b6b3f2875427b032 | <|skeleton|>
class PileupFetcher:
"""Pull dataset block/SE : LFN list from DBS for the pileup datasets required by the steps in the job. Save these maps as files in the sandbox"""
def _queryDbsAndGetPileupConfig(self, stepHelper, dbsReader):
"""Method iterates over components of the pileup configuratio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PileupFetcher:
"""Pull dataset block/SE : LFN list from DBS for the pileup datasets required by the steps in the job. Save these maps as files in the sandbox"""
def _queryDbsAndGetPileupConfig(self, stepHelper, dbsReader):
"""Method iterates over components of the pileup configuration input and q... | the_stack_v2_python_sparse | src/python/WMCore/WMSpec/Steps/Fetchers/PileupFetcher.py | cinquo/WMCore | train | 1 |
536782a9d91e5d12f808fc1fb62460c5955356de | [
"self.capacity = capacity\nself.table = dict()\nself.head = Node(None, None)\nself.tail = Node(None, None)\nself.head.next = self.tail\nself.tail.prev = self.head",
"if key in self.table:\n node = self.table[key]\n node.prev.next = node.next\n node.next.prev = node.prev\n tmp = self.head.next\n sel... | <|body_start_0|>
self.capacity = capacity
self.table = dict()
self.head = Node(None, None)
self.tail = Node(None, None)
self.head.next = self.tail
self.tail.prev = self.head
<|end_body_0|>
<|body_start_1|>
if key in self.table:
node = self.table[key]
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_068921 | 2,934 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_012416 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | c80f374d0fc1d4e369351c30b09022a9fa2f294e | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.table = dict()
self.head = Node(None, None)
self.tail = Node(None, None)
self.head.next = self.tail
self.tail.prev = self.head
def get(self, key):
... | the_stack_v2_python_sparse | 146-LRU-cache.py | Jyun-Neng/LeetCode_Python | train | 0 | |
361814879fbd1019509550d74cd6f07ac4827d05 | [
"citations.sort()\nN = len(citations)\nlow, high = (0, N - 1)\nwhile low <= high:\n mid = (low + high) // 2\n if N - mid > citations[mid]:\n low = mid + 1\n else:\n high = mid - 1\nreturn N - low",
"citations.sort()\nprint(citations)\nn = len(citations)\nfor i in range(n):\n length = n -... | <|body_start_0|>
citations.sort()
N = len(citations)
low, high = (0, N - 1)
while low <= high:
mid = (low + high) // 2
if N - mid > citations[mid]:
low = mid + 1
else:
high = mid - 1
return N - low
<|end_body_0|>... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hIndex(self, citations):
"""二分查找 :type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex2(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
citations.sort()
N = ... | stack_v2_sparse_classes_75kplus_train_068922 | 1,636 | no_license | [
{
"docstring": "二分查找 :type citations: List[int] :rtype: int",
"name": "hIndex",
"signature": "def hIndex(self, citations)"
},
{
"docstring": ":type citations: List[int] :rtype: int",
"name": "hIndex2",
"signature": "def hIndex2(self, citations)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012053 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex(self, citations): 二分查找 :type citations: List[int] :rtype: int
- def hIndex2(self, citations): :type citations: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex(self, citations): 二分查找 :type citations: List[int] :rtype: int
- def hIndex2(self, citations): :type citations: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def hIndex(self, citations):
"""二分查找 :type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex2(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hIndex(self, citations):
"""二分查找 :type citations: List[int] :rtype: int"""
citations.sort()
N = len(citations)
low, high = (0, N - 1)
while low <= high:
mid = (low + high) // 2
if N - mid > citations[mid]:
low = mid ... | the_stack_v2_python_sparse | 274_H指数.py | lovehhf/LeetCode | train | 0 | |
a33c01d8957c0c2f5e235d091dafa00654b00c94 | [
"if save_value:\n save_value_list = save_value.split(';')\n if '=' in save_value:\n for i, value in enumerate(save_value_list):\n value_list = value.split('=')\n save_value_list[i] = value_list\n return save_value_list\nelse:\n print('没有需要存储的变量')\n return None",
"save_v... | <|body_start_0|>
if save_value:
save_value_list = save_value.split(';')
if '=' in save_value:
for i, value in enumerate(save_value_list):
value_list = value.split('=')
save_value_list[i] = value_list
return save_value_li... | HandleSaveValue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HandleSaveValue:
def get_save_field(self, save_value):
"""获取要存储的字段,如果有多个字段用;分隔 :return:"""
<|body_0|>
def save_response_data(self, response_data, save_value):
"""取出需要存储的多个字段 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if save_value:
... | stack_v2_sparse_classes_75kplus_train_068923 | 1,927 | no_license | [
{
"docstring": "获取要存储的字段,如果有多个字段用;分隔 :return:",
"name": "get_save_field",
"signature": "def get_save_field(self, save_value)"
},
{
"docstring": "取出需要存储的多个字段 :return:",
"name": "save_response_data",
"signature": "def save_response_data(self, response_data, save_value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_029607 | Implement the Python class `HandleSaveValue` described below.
Class description:
Implement the HandleSaveValue class.
Method signatures and docstrings:
- def get_save_field(self, save_value): 获取要存储的字段,如果有多个字段用;分隔 :return:
- def save_response_data(self, response_data, save_value): 取出需要存储的多个字段 :return: | Implement the Python class `HandleSaveValue` described below.
Class description:
Implement the HandleSaveValue class.
Method signatures and docstrings:
- def get_save_field(self, save_value): 获取要存储的字段,如果有多个字段用;分隔 :return:
- def save_response_data(self, response_data, save_value): 取出需要存储的多个字段 :return:
<|skeleton|>
cl... | 4c2f12db11a7f74bb6482fb086badf4f9fb3eca3 | <|skeleton|>
class HandleSaveValue:
def get_save_field(self, save_value):
"""获取要存储的字段,如果有多个字段用;分隔 :return:"""
<|body_0|>
def save_response_data(self, response_data, save_value):
"""取出需要存储的多个字段 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HandleSaveValue:
def get_save_field(self, save_value):
"""获取要存储的字段,如果有多个字段用;分隔 :return:"""
if save_value:
save_value_list = save_value.split(';')
if '=' in save_value:
for i, value in enumerate(save_value_list):
value_list = value.spl... | the_stack_v2_python_sparse | venv/base/handle_save_value.py | jiangll888/interface_full | train | 0 | |
404f4d1e97d3bc795a1689e144a6cc74ca493a91 | [
"self.fields['name'] = forms.CharField(label='Product Name', max_length=100)\nself.fields['category'] = forms.ModelChoiceField(label='Category', queryset=cmod.Category.objects.order_by('name').all())\nself.fields['price'] = forms.DecimalField(label='Price')\nself.fields['graphic'] = forms.CharField(label='Graphic')... | <|body_start_0|>
self.fields['name'] = forms.CharField(label='Product Name', max_length=100)
self.fields['category'] = forms.ModelChoiceField(label='Category', queryset=cmod.Category.objects.order_by('name').all())
self.fields['price'] = forms.DecimalField(label='Price')
self.fields['gra... | ProductEditForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductEditForm:
def init(self, product):
"""Initialize the form (called at end of __init__)"""
<|body_0|>
def commit(self, product):
"""Process the form action"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.fields['name'] = forms.CharField(la... | stack_v2_sparse_classes_75kplus_train_068924 | 5,132 | no_license | [
{
"docstring": "Initialize the form (called at end of __init__)",
"name": "init",
"signature": "def init(self, product)"
},
{
"docstring": "Process the form action",
"name": "commit",
"signature": "def commit(self, product)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052694 | Implement the Python class `ProductEditForm` described below.
Class description:
Implement the ProductEditForm class.
Method signatures and docstrings:
- def init(self, product): Initialize the form (called at end of __init__)
- def commit(self, product): Process the form action | Implement the Python class `ProductEditForm` described below.
Class description:
Implement the ProductEditForm class.
Method signatures and docstrings:
- def init(self, product): Initialize the form (called at end of __init__)
- def commit(self, product): Process the form action
<|skeleton|>
class ProductEditForm:
... | 07381405afc430eafd70111b0d26fdbbe85c544c | <|skeleton|>
class ProductEditForm:
def init(self, product):
"""Initialize the form (called at end of __init__)"""
<|body_0|>
def commit(self, product):
"""Process the form action"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProductEditForm:
def init(self, product):
"""Initialize the form (called at end of __init__)"""
self.fields['name'] = forms.CharField(label='Product Name', max_length=100)
self.fields['category'] = forms.ModelChoiceField(label='Category', queryset=cmod.Category.objects.order_by('name')... | the_stack_v2_python_sparse | fomo/manager/views/product.py | jfed8/MusicStore | train | 1 | |
0d1d7add4a4e06e32ad2ec405576351dcffa62d5 | [
"delegate = PokemonBattleDelegate()\ndelegate.parent = parent\ndelegate.currHP = delegate.stats['HP']\ndelegate.attacks = []\ndelegate.status = Status()\nreturn delegate",
"delegate = PokemonBattleDelegate()\ndelegate.parent = parent\ndelegate.parent.stats.currentHP = int(tree.find(Tags.currHPTag).text)\ndelegate... | <|body_start_0|>
delegate = PokemonBattleDelegate()
delegate.parent = parent
delegate.currHP = delegate.stats['HP']
delegate.attacks = []
delegate.status = Status()
return delegate
<|end_body_0|>
<|body_start_1|>
delegate = PokemonBattleDelegate()
delegat... | Factory to build Pokemon | PokemonBattleDelegateFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PokemonBattleDelegateFactory:
"""Factory to build Pokemon"""
def buildStarter(parent):
"""Builds a BattleDelegate for a Starter Pokemon"""
<|body_0|>
def loadFromXML(parent, tree):
"""Build a Pokemon's Battle Information"""
<|body_1|>
def copy(parent... | stack_v2_sparse_classes_75kplus_train_068925 | 2,219 | no_license | [
{
"docstring": "Builds a BattleDelegate for a Starter Pokemon",
"name": "buildStarter",
"signature": "def buildStarter(parent)"
},
{
"docstring": "Build a Pokemon's Battle Information",
"name": "loadFromXML",
"signature": "def loadFromXML(parent, tree)"
},
{
"docstring": "Creates... | 3 | stack_v2_sparse_classes_30k_train_038970 | Implement the Python class `PokemonBattleDelegateFactory` described below.
Class description:
Factory to build Pokemon
Method signatures and docstrings:
- def buildStarter(parent): Builds a BattleDelegate for a Starter Pokemon
- def loadFromXML(parent, tree): Build a Pokemon's Battle Information
- def copy(parent, to... | Implement the Python class `PokemonBattleDelegateFactory` described below.
Class description:
Factory to build Pokemon
Method signatures and docstrings:
- def buildStarter(parent): Builds a BattleDelegate for a Starter Pokemon
- def loadFromXML(parent, tree): Build a Pokemon's Battle Information
- def copy(parent, to... | 3931eee5fd04e18bb1738a0b27a4c6979dc4db01 | <|skeleton|>
class PokemonBattleDelegateFactory:
"""Factory to build Pokemon"""
def buildStarter(parent):
"""Builds a BattleDelegate for a Starter Pokemon"""
<|body_0|>
def loadFromXML(parent, tree):
"""Build a Pokemon's Battle Information"""
<|body_1|>
def copy(parent... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PokemonBattleDelegateFactory:
"""Factory to build Pokemon"""
def buildStarter(parent):
"""Builds a BattleDelegate for a Starter Pokemon"""
delegate = PokemonBattleDelegate()
delegate.parent = parent
delegate.currHP = delegate.stats['HP']
delegate.attacks = []
... | the_stack_v2_python_sparse | src/Pokemon/pokemon_battle_delegate_factory.py | sgtnourry/Pokemon-Project | train | 0 |
9947882ffaf7e3326fcf4ac594c54183b42b1dc3 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsInformationProtectionDesktopApp()",
"from .windows_information_protection_app import WindowsInformationProtectionApp\nfrom .windows_information_protection_app import WindowsInformationProtectionApp\nfields: Dict[str, Callable[[A... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WindowsInformationProtectionDesktopApp()
<|end_body_0|>
<|body_start_1|>
from .windows_information_protection_app import WindowsInformationProtectionApp
from .windows_information_protect... | Desktop App for Windows information protection | WindowsInformationProtectionDesktopApp | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsInformationProtectionDesktopApp:
"""Desktop App for Windows information protection"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsInformationProtectionDesktopApp:
"""Creates a new instance of the appropriate class based on discriminator ... | stack_v2_sparse_classes_75kplus_train_068926 | 2,912 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: WindowsInformationProtectionDesktopApp",
"name": "create_from_discriminator_value",
"signature": "def create... | 3 | stack_v2_sparse_classes_30k_train_006230 | Implement the Python class `WindowsInformationProtectionDesktopApp` described below.
Class description:
Desktop App for Windows information protection
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsInformationProtectionDesktopApp: Creates a new ... | Implement the Python class `WindowsInformationProtectionDesktopApp` described below.
Class description:
Desktop App for Windows information protection
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsInformationProtectionDesktopApp: Creates a new ... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WindowsInformationProtectionDesktopApp:
"""Desktop App for Windows information protection"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsInformationProtectionDesktopApp:
"""Creates a new instance of the appropriate class based on discriminator ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WindowsInformationProtectionDesktopApp:
"""Desktop App for Windows information protection"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsInformationProtectionDesktopApp:
"""Creates a new instance of the appropriate class based on discriminator value Args: p... | the_stack_v2_python_sparse | msgraph/generated/models/windows_information_protection_desktop_app.py | microsoftgraph/msgraph-sdk-python | train | 135 |
13a255bc4b33d9542506d49d00c577abeb81950c | [
"self.wan_enabled = wan_enabled\nself.using_static_ip = using_static_ip\nself.static_ip = static_ip\nself.static_gateway_ip = static_gateway_ip\nself.static_subnet_mask = static_subnet_mask\nself.static_dns = static_dns\nself.vlan = vlan",
"if dictionary is None:\n return None\nwan_enabled = dictionary.get('wa... | <|body_start_0|>
self.wan_enabled = wan_enabled
self.using_static_ip = using_static_ip
self.static_ip = static_ip
self.static_gateway_ip = static_gateway_ip
self.static_subnet_mask = static_subnet_mask
self.static_dns = static_dns
self.vlan = vlan
<|end_body_0|>
... | Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to have static IP settings or use DHCP. s... | Wan2Model | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Wan2Model:
"""Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to h... | stack_v2_sparse_classes_75kplus_train_068927 | 3,300 | permissive | [
{
"docstring": "Constructor for the Wan2Model class",
"name": "__init__",
"signature": "def __init__(self, wan_enabled=None, using_static_ip=None, static_ip=None, static_gateway_ip=None, static_subnet_mask=None, static_dns=None, vlan=None)"
},
{
"docstring": "Creates an instance of this model fr... | 2 | stack_v2_sparse_classes_30k_train_034754 | Implement the Python class `Wan2Model` described below.
Class description:
Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static... | Implement the Python class `Wan2Model` described below.
Class description:
Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class Wan2Model:
"""Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to h... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Wan2Model:
"""Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to have static IP... | the_stack_v2_python_sparse | meraki_sdk/models/wan_2_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
f5aa867391c66b9237c4972a6eaea6b4f9bf7696 | [
"endpoint = LookupEndpoint.CUSTOMER_ID.value.format(customerId=customer_id)\nquery_parameters = self._copy_query_parameters()\nquery_parameters['fixture'] = fixture\nreturn self._get(url=self._build_url(endpoint), query_parameters=query_parameters)",
"endpoint = LookupEndpoint.SEARCH.value\nquery_parameters = sel... | <|body_start_0|>
endpoint = LookupEndpoint.CUSTOMER_ID.value.format(customerId=customer_id)
query_parameters = self._copy_query_parameters()
query_parameters['fixture'] = fixture
return self._get(url=self._build_url(endpoint), query_parameters=query_parameters)
<|end_body_0|>
<|body_sta... | LookupClient | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LookupClient:
def get_customer(self, customer_id, fixture=None):
"""GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: reque... | stack_v2_sparse_classes_75kplus_train_068928 | 3,190 | permissive | [
{
"docstring": "GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: requests.Response",
"name": "get_customer",
"signature": "def get_custome... | 5 | stack_v2_sparse_classes_30k_train_037664 | Implement the Python class `LookupClient` described below.
Class description:
Implement the LookupClient class.
Method signatures and docstrings:
- def get_customer(self, customer_id, fixture=None): GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query par... | Implement the Python class `LookupClient` described below.
Class description:
Implement the LookupClient class.
Method signatures and docstrings:
- def get_customer(self, customer_id, fixture=None): GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query par... | 4431af164eb4baf52e26e8842e017cad1609a279 | <|skeleton|>
class LookupClient:
def get_customer(self, customer_id, fixture=None):
"""GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: reque... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LookupClient:
def get_customer(self, customer_id, fixture=None):
"""GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: requests.Response""... | the_stack_v2_python_sparse | q2_api_client/clients/central/lookup_client.py | jcook00/q2-api-client | train | 0 | |
2389facaa4178096d6f98d80815317be2d66febc | [
"self.count = 0\nself.size = size\nself.array = []",
"if self.count == self.size:\n return False\nself.array.append(value)\nself.count += 1\nreturn True",
"if self.count == 0:\n return False\ndata = self.array[self.count - 1]\nself.count -= 1\nreturn data"
] | <|body_start_0|>
self.count = 0
self.size = size
self.array = []
<|end_body_0|>
<|body_start_1|>
if self.count == self.size:
return False
self.array.append(value)
self.count += 1
return True
<|end_body_1|>
<|body_start_2|>
if self.count == 0:... | stack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stack:
def __init__(self, size):
"""栈结构 :param size: 栈大小"""
<|body_0|>
def push(self, value):
"""入栈 入栈判满 :param value:"""
<|body_1|>
def pop(self):
"""出栈 出栈判空 :return:"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.count =... | stack_v2_sparse_classes_75kplus_train_068929 | 856 | no_license | [
{
"docstring": "栈结构 :param size: 栈大小",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": "入栈 入栈判满 :param value:",
"name": "push",
"signature": "def push(self, value)"
},
{
"docstring": "出栈 出栈判空 :return:",
"name": "pop",
"signature": "def pop(se... | 3 | stack_v2_sparse_classes_30k_train_028059 | Implement the Python class `stack` described below.
Class description:
Implement the stack class.
Method signatures and docstrings:
- def __init__(self, size): 栈结构 :param size: 栈大小
- def push(self, value): 入栈 入栈判满 :param value:
- def pop(self): 出栈 出栈判空 :return: | Implement the Python class `stack` described below.
Class description:
Implement the stack class.
Method signatures and docstrings:
- def __init__(self, size): 栈结构 :param size: 栈大小
- def push(self, value): 入栈 入栈判满 :param value:
- def pop(self): 出栈 出栈判空 :return:
<|skeleton|>
class stack:
def __init__(self, size)... | 7543af3cf09cc225626af78a44b185ecad52ac24 | <|skeleton|>
class stack:
def __init__(self, size):
"""栈结构 :param size: 栈大小"""
<|body_0|>
def push(self, value):
"""入栈 入栈判满 :param value:"""
<|body_1|>
def pop(self):
"""出栈 出栈判空 :return:"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class stack:
def __init__(self, size):
"""栈结构 :param size: 栈大小"""
self.count = 0
self.size = size
self.array = []
def push(self, value):
"""入栈 入栈判满 :param value:"""
if self.count == self.size:
return False
self.array.append(value)
self... | the_stack_v2_python_sparse | stack/array_stack.py | cpeixin/leetcode-bbbbrent | train | 0 | |
953ecfda3700e263db7848b60f962c0369921a2c | [
"if type(N) is not int:\n raise TypeError('N must be int representing number of blocks in the encoder')\nif type(dm) is not int:\n raise TypeError('dm must be int representing dimensionality of model')\nif type(h) is not int:\n raise TypeError('h must be int representing number of heads')\nif type(hidden) ... | <|body_start_0|>
if type(N) is not int:
raise TypeError('N must be int representing number of blocks in the encoder')
if type(dm) is not int:
raise TypeError('dm must be int representing dimensionality of model')
if type(h) is not int:
raise TypeError('h must ... | Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the inputs positional_encoding [numpy.nd... | Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the i... | stack_v2_sparse_classes_75kplus_train_068930 | 4,656 | no_license | [
{
"docstring": "Class constructor parameters: N [int]: represents the number of blocks in the encoder dm [int]: represents the dimensionality of the model h [int]: represents the number of heads hidden [int]: represents the number of hidden units in fully connected layer input_vocab [int]: represents the size o... | 2 | stack_v2_sparse_classes_30k_train_009872 | Implement the Python class `Encoder` described below.
Class description:
Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model e... | Implement the Python class `Encoder` described below.
Class description:
Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model e... | 8834b201ca84937365e4dcc0fac978656cdf5293 | <|skeleton|>
class Encoder:
"""Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Encoder:
"""Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the inputs positio... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/9-transformer_encoder.py | ejonakodra/holbertonschool-machine_learning-1 | train | 0 |
1f771d0c58af06d929e418b79eca67e93018e3f6 | [
"base = self.config['locations']['quality_reports']\next = '.xml'\nif compressed:\n ext += '.gz'\nreturn os.path.join(base, pdb + ext)",
"pdbs = []\ndirname = self.config['locations']['quality_reports']\nfor basename in os.listdir(dirname):\n filename = os.path.join(dirname, basename)\n if has_data is no... | <|body_start_0|>
base = self.config['locations']['quality_reports']
ext = '.xml'
if compressed:
ext += '.gz'
return os.path.join(base, pdb + ext)
<|end_body_0|>
<|body_start_1|>
pdbs = []
dirname = self.config['locations']['quality_reports']
for basen... | A set of a utilities for dealing with quality data. | Utils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Utils:
"""A set of a utilities for dealing with quality data."""
def filename(self, pdb, compressed=True):
"""Compute the filename for the given PDB id. Parameters ---------- pdb : str The PDB id to use. compressed : bool, True Flag if we should create a filename for the compressed r... | stack_v2_sparse_classes_75kplus_train_068931 | 12,119 | no_license | [
{
"docstring": "Compute the filename for the given PDB id. Parameters ---------- pdb : str The PDB id to use. compressed : bool, True Flag if we should create a filename for the compressed report. Returns ------- filename : str Filename for the given PDB.",
"name": "filename",
"signature": "def filename... | 4 | null | Implement the Python class `Utils` described below.
Class description:
A set of a utilities for dealing with quality data.
Method signatures and docstrings:
- def filename(self, pdb, compressed=True): Compute the filename for the given PDB id. Parameters ---------- pdb : str The PDB id to use. compressed : bool, True... | Implement the Python class `Utils` described below.
Class description:
A set of a utilities for dealing with quality data.
Method signatures and docstrings:
- def filename(self, pdb, compressed=True): Compute the filename for the given PDB id. Parameters ---------- pdb : str The PDB id to use. compressed : bool, True... | 1982e10a56885e56d79aac69365b9ff78c0e3d92 | <|skeleton|>
class Utils:
"""A set of a utilities for dealing with quality data."""
def filename(self, pdb, compressed=True):
"""Compute the filename for the given PDB id. Parameters ---------- pdb : str The PDB id to use. compressed : bool, True Flag if we should create a filename for the compressed r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Utils:
"""A set of a utilities for dealing with quality data."""
def filename(self, pdb, compressed=True):
"""Compute the filename for the given PDB id. Parameters ---------- pdb : str The PDB id to use. compressed : bool, True Flag if we should create a filename for the compressed report. Return... | the_stack_v2_python_sparse | pymotifs/quality/utils.py | BGSU-RNA/RNA-3D-Hub-core | train | 3 |
ef28919b307a07c67ba8883d48d71f3e544df4aa | [
"self.access_token = access_token\nself.credentials = credentials\nself.client_params = client_params\nself._card_verifiers = card_verifiers\nself._crypto = crypto\nself._key_storage = key_storage\nself._client = None",
"if not self._crypto:\n self._crypto = VirgilCrypto()\nreturn self._crypto",
"if not self... | <|body_start_0|>
self.access_token = access_token
self.credentials = credentials
self.client_params = client_params
self._card_verifiers = card_verifiers
self._crypto = crypto
self._key_storage = key_storage
self._client = None
<|end_body_0|>
<|body_start_1|>
... | The class manages the Virgil api dependencies during run time. It also contains a list of properties that uses to configurate the high-level components. | VirgilContext | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VirgilContext:
"""The class manages the Virgil api dependencies during run time. It also contains a list of properties that uses to configurate the high-level components."""
def __init__(self, access_token=None, credentials=None, card_verifiers=None, crypto=None, key_storage=None, client_par... | stack_v2_sparse_classes_75kplus_train_068932 | 3,933 | permissive | [
{
"docstring": "Initializes a new instance of the VirgilContext class.",
"name": "__init__",
"signature": "def __init__(self, access_token=None, credentials=None, card_verifiers=None, crypto=None, key_storage=None, client_params=None)"
},
{
"docstring": "Gets a cryptographic keys storage.",
... | 4 | stack_v2_sparse_classes_30k_train_026444 | Implement the Python class `VirgilContext` described below.
Class description:
The class manages the Virgil api dependencies during run time. It also contains a list of properties that uses to configurate the high-level components.
Method signatures and docstrings:
- def __init__(self, access_token=None, credentials=... | Implement the Python class `VirgilContext` described below.
Class description:
The class manages the Virgil api dependencies during run time. It also contains a list of properties that uses to configurate the high-level components.
Method signatures and docstrings:
- def __init__(self, access_token=None, credentials=... | 141a62102f520e0081b6a28022e33e26255c5e6f | <|skeleton|>
class VirgilContext:
"""The class manages the Virgil api dependencies during run time. It also contains a list of properties that uses to configurate the high-level components."""
def __init__(self, access_token=None, credentials=None, card_verifiers=None, crypto=None, key_storage=None, client_par... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VirgilContext:
"""The class manages the Virgil api dependencies during run time. It also contains a list of properties that uses to configurate the high-level components."""
def __init__(self, access_token=None, credentials=None, card_verifiers=None, crypto=None, key_storage=None, client_params=None):
... | the_stack_v2_python_sparse | virgil_sdk/api/virgil_context.py | akasranjan005/virgil-sdk-python | train | 0 |
d725f0385d6a0812c5b42836f08d8f7541e42143 | [
"super(SubscriberMessage, self).__init__(*args, **kwargs)\nself.message_id = None\nself.publish_time = None\nself.ack_id = None\nself.set_subscribe_message(received_message)",
"if received_message:\n pubsub_message = received_message.get('message')\n if pubsub_message:\n message = dict()\n mes... | <|body_start_0|>
super(SubscriberMessage, self).__init__(*args, **kwargs)
self.message_id = None
self.publish_time = None
self.ack_id = None
self.set_subscribe_message(received_message)
<|end_body_0|>
<|body_start_1|>
if received_message:
pubsub_message = rec... | Pubsub publish message object | SubscriberMessage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubscriberMessage:
"""Pubsub publish message object"""
def __init__(self, received_message, *args, **kwargs):
"""data is a dictionary attributes is a dictionary"""
<|body_0|>
def create_message_dict(received_message):
"""creates a received message dictionary with... | stack_v2_sparse_classes_75kplus_train_068933 | 3,266 | permissive | [
{
"docstring": "data is a dictionary attributes is a dictionary",
"name": "__init__",
"signature": "def __init__(self, received_message, *args, **kwargs)"
},
{
"docstring": "creates a received message dictionary with set fields or None if message is empty",
"name": "create_message_dict",
... | 3 | stack_v2_sparse_classes_30k_val_002382 | Implement the Python class `SubscriberMessage` described below.
Class description:
Pubsub publish message object
Method signatures and docstrings:
- def __init__(self, received_message, *args, **kwargs): data is a dictionary attributes is a dictionary
- def create_message_dict(received_message): creates a received me... | Implement the Python class `SubscriberMessage` described below.
Class description:
Pubsub publish message object
Method signatures and docstrings:
- def __init__(self, received_message, *args, **kwargs): data is a dictionary attributes is a dictionary
- def create_message_dict(received_message): creates a received me... | d2deb42c25cf83816993015532194a5fc0c4146a | <|skeleton|>
class SubscriberMessage:
"""Pubsub publish message object"""
def __init__(self, received_message, *args, **kwargs):
"""data is a dictionary attributes is a dictionary"""
<|body_0|>
def create_message_dict(received_message):
"""creates a received message dictionary with... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubscriberMessage:
"""Pubsub publish message object"""
def __init__(self, received_message, *args, **kwargs):
"""data is a dictionary attributes is a dictionary"""
super(SubscriberMessage, self).__init__(*args, **kwargs)
self.message_id = None
self.publish_time = None
... | the_stack_v2_python_sparse | gcloud/datastores/utils/pubsub_messages.py | pantheon-systems/etl-framework | train | 2 |
9f3ab67191f4b4a30dcec34f27ce502fd003a144 | [
"if not isinstance(total_passes, int):\n m = f'Expected int for total_passes, got {type(total_passes)}'\n raise TypeError(m)\nif total_passes < 1:\n raise ValueError('Total passes must be a positive integer.')\nself.total_passes = total_passes\nsuper().__init__(gate_count_weight, decay_delta, decay_reset_i... | <|body_start_0|>
if not isinstance(total_passes, int):
m = f'Expected int for total_passes, got {type(total_passes)}'
raise TypeError(m)
if total_passes < 1:
raise ValueError('Total passes must be a positive integer.')
self.total_passes = total_passes
... | Layout algorithm using permutation-aware mapping. | PAMLayoutPass | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PAMLayoutPass:
"""Layout algorithm using permutation-aware mapping."""
def __init__(self, total_passes: int=1, gate_count_weight: float=0.3, decay_delta: float=0.001, decay_reset_interval: int=5, decay_reset_on_gate: bool=True, extended_set_size: int=20, extended_set_weight: float=0.5) -> No... | stack_v2_sparse_classes_75kplus_train_068934 | 3,241 | permissive | [
{
"docstring": "Construct a PAMLayoutPass. Args: total_passes (int): The amount of forward and backward passes to apply before finalizing the layout. gate_count_weight (float): See :class:`PermutationAwareMappingAlgorithm` for info. (Default: 0.3) decay_delta (float): See :class:`GeneralizedSabreAlgorithm` for ... | 2 | stack_v2_sparse_classes_30k_train_047622 | Implement the Python class `PAMLayoutPass` described below.
Class description:
Layout algorithm using permutation-aware mapping.
Method signatures and docstrings:
- def __init__(self, total_passes: int=1, gate_count_weight: float=0.3, decay_delta: float=0.001, decay_reset_interval: int=5, decay_reset_on_gate: bool=Tr... | Implement the Python class `PAMLayoutPass` described below.
Class description:
Layout algorithm using permutation-aware mapping.
Method signatures and docstrings:
- def __init__(self, total_passes: int=1, gate_count_weight: float=0.3, decay_delta: float=0.001, decay_reset_interval: int=5, decay_reset_on_gate: bool=Tr... | c89112d15072e8ffffb68cf1757b184e2aeb3dc8 | <|skeleton|>
class PAMLayoutPass:
"""Layout algorithm using permutation-aware mapping."""
def __init__(self, total_passes: int=1, gate_count_weight: float=0.3, decay_delta: float=0.001, decay_reset_interval: int=5, decay_reset_on_gate: bool=True, extended_set_size: int=20, extended_set_weight: float=0.5) -> No... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PAMLayoutPass:
"""Layout algorithm using permutation-aware mapping."""
def __init__(self, total_passes: int=1, gate_count_weight: float=0.3, decay_delta: float=0.001, decay_reset_interval: int=5, decay_reset_on_gate: bool=True, extended_set_size: int=20, extended_set_weight: float=0.5) -> None:
"... | the_stack_v2_python_sparse | bqskit/passes/mapping/layout/pam.py | BQSKit/bqskit | train | 54 |
c6f6718f430458dd4ecec5b1535bcb1415365ce8 | [
"if self.github_slug:\n return f'https://github.com/{self.github_slug}'\nelse:\n return None",
"if os.getenv('GITHUB_ACTIONS'):\n return cls.for_github_actions()\nelif os.getenv('TRAVIS') == 'true':\n return cls.for_travis()\nelse:\n return cls()",
"github_ref = os.getenv('GITHUB_REF')\nrun_id = ... | <|body_start_0|>
if self.github_slug:
return f'https://github.com/{self.github_slug}'
else:
return None
<|end_body_0|>
<|body_start_1|>
if os.getenv('GITHUB_ACTIONS'):
return cls.for_github_actions()
elif os.getenv('TRAVIS') == 'true':
ret... | Metadata gathered from CI platform environment variables. | CiMetadata | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CiMetadata:
"""Metadata gathered from CI platform environment variables."""
def github_repository(self) -> Optional[str]:
"""URL of the GitHub repository homepage."""
<|body_0|>
def create(cls) -> CiMetadata:
"""Gather CI metadata, automatically inferring the CI ... | stack_v2_sparse_classes_75kplus_train_068935 | 4,366 | permissive | [
{
"docstring": "URL of the GitHub repository homepage.",
"name": "github_repository",
"signature": "def github_repository(self) -> Optional[str]"
},
{
"docstring": "Gather CI metadata, automatically inferring the CI platform.",
"name": "create",
"signature": "def create(cls) -> CiMetadat... | 4 | stack_v2_sparse_classes_30k_train_039258 | Implement the Python class `CiMetadata` described below.
Class description:
Metadata gathered from CI platform environment variables.
Method signatures and docstrings:
- def github_repository(self) -> Optional[str]: URL of the GitHub repository homepage.
- def create(cls) -> CiMetadata: Gather CI metadata, automatica... | Implement the Python class `CiMetadata` described below.
Class description:
Metadata gathered from CI platform environment variables.
Method signatures and docstrings:
- def github_repository(self) -> Optional[str]: URL of the GitHub repository homepage.
- def create(cls) -> CiMetadata: Gather CI metadata, automatica... | cb92f71b49c3f33d85154dee1acdb56c6e5eb2b6 | <|skeleton|>
class CiMetadata:
"""Metadata gathered from CI platform environment variables."""
def github_repository(self) -> Optional[str]:
"""URL of the GitHub repository homepage."""
<|body_0|>
def create(cls) -> CiMetadata:
"""Gather CI metadata, automatically inferring the CI ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CiMetadata:
"""Metadata gathered from CI platform environment variables."""
def github_repository(self) -> Optional[str]:
"""URL of the GitHub repository homepage."""
if self.github_slug:
return f'https://github.com/{self.github_slug}'
else:
return None
... | the_stack_v2_python_sparse | src/lander/ext/parser/_cidata.py | lsst-sqre/lander | train | 3 |
4ad134a49e8320f0a39a1e1bd75cb203fa2dc7f3 | [
"self.num_levels = num_levels\ndq = 1.0 / num_levels\nself.percentiles = np.zeros([num_levels - 1], dtype='int')\nself.percentile_vals = np.zeros([num_levels - 1])\nfor k in range(num_levels - 1):\n self.percentiles[k] = int((k + 1) * dq * 100)\n self.percentile_vals[k] = np.percentile(xvals, self.percentiles... | <|body_start_0|>
self.num_levels = num_levels
dq = 1.0 / num_levels
self.percentiles = np.zeros([num_levels - 1], dtype='int')
self.percentile_vals = np.zeros([num_levels - 1])
for k in range(num_levels - 1):
self.percentiles[k] = int((k + 1) * dq * 100)
s... | This class discretizes a scalar variable. | Discretizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Discretizer:
"""This class discretizes a scalar variable."""
def __init__(self, xvals, num_levels=3):
"""Initialize the class. :param xvals: An np.array of observations of the scalar variable."""
<|body_0|>
def discretize(self, xval):
"""Turn the scalar variable ... | stack_v2_sparse_classes_75kplus_train_068936 | 2,229 | permissive | [
{
"docstring": "Initialize the class. :param xvals: An np.array of observations of the scalar variable.",
"name": "__init__",
"signature": "def __init__(self, xvals, num_levels=3)"
},
{
"docstring": "Turn the scalar variable xval into the discrete category to which it belongs. :param xval: :retu... | 2 | stack_v2_sparse_classes_30k_train_021840 | Implement the Python class `Discretizer` described below.
Class description:
This class discretizes a scalar variable.
Method signatures and docstrings:
- def __init__(self, xvals, num_levels=3): Initialize the class. :param xvals: An np.array of observations of the scalar variable.
- def discretize(self, xval): Turn... | Implement the Python class `Discretizer` described below.
Class description:
This class discretizes a scalar variable.
Method signatures and docstrings:
- def __init__(self, xvals, num_levels=3): Initialize the class. :param xvals: An np.array of observations of the scalar variable.
- def discretize(self, xval): Turn... | e5b1fcb9b45b99ebf2d7c8bfafb3bc8defef4da2 | <|skeleton|>
class Discretizer:
"""This class discretizes a scalar variable."""
def __init__(self, xvals, num_levels=3):
"""Initialize the class. :param xvals: An np.array of observations of the scalar variable."""
<|body_0|>
def discretize(self, xval):
"""Turn the scalar variable ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Discretizer:
"""This class discretizes a scalar variable."""
def __init__(self, xvals, num_levels=3):
"""Initialize the class. :param xvals: An np.array of observations of the scalar variable."""
self.num_levels = num_levels
dq = 1.0 / num_levels
self.percentiles = np.zero... | the_stack_v2_python_sparse | soundsig/discrete_process.py | theunissenlab/soundsig | train | 27 |
10f4e30ee07d0a9a9a3741e18f3ea963d89d1122 | [
"wall_placed_locs = []\nif right:\n locations = [[starting_location[0] + i, starting_location[1]] for i in range(length)]\n for loc in locations:\n if game_state.can_spawn(unit_enum_map['WALL'], loc):\n succ = game_state.attempt_spawn(unit_enum_map['WALL'], loc)\n if succ == 1:\n ... | <|body_start_0|>
wall_placed_locs = []
if right:
locations = [[starting_location[0] + i, starting_location[1]] for i in range(length)]
for loc in locations:
if game_state.can_spawn(unit_enum_map['WALL'], loc):
succ = game_state.attempt_spawn(un... | Contains builder/simulator for a line of horizontal walls | DefensiveWallStrat | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefensiveWallStrat:
"""Contains builder/simulator for a line of horizontal walls"""
def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=True) -> [[int]]:
"""Used for placing a horizontal line of wa... | stack_v2_sparse_classes_75kplus_train_068937 | 6,790 | no_license | [
{
"docstring": "Used for placing a horizontal line of walls @param game_state: GameState object containing current gamestate info unit_enum_map (dict): Maps NAME to unit enum @param starting_location: (x, y) or [[x, y]] @param length: duh @param right: whether the wall goes right or left of the starting locatio... | 2 | stack_v2_sparse_classes_30k_train_044504 | Implement the Python class `DefensiveWallStrat` described below.
Class description:
Contains builder/simulator for a line of horizontal walls
Method signatures and docstrings:
- def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=T... | Implement the Python class `DefensiveWallStrat` described below.
Class description:
Contains builder/simulator for a line of horizontal walls
Method signatures and docstrings:
- def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=T... | e9439191d44f644c55752abadda6882eeb75671f | <|skeleton|>
class DefensiveWallStrat:
"""Contains builder/simulator for a line of horizontal walls"""
def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=True) -> [[int]]:
"""Used for placing a horizontal line of wa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DefensiveWallStrat:
"""Contains builder/simulator for a line of horizontal walls"""
def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=True) -> [[int]]:
"""Used for placing a horizontal line of walls @param ga... | the_stack_v2_python_sparse | algos/bruh_moment/defensive_building_functions.py | echudov/terminal | train | 0 |
142a0e8c008427ed5c8361126de01cf023bb23f9 | [
"if itype == 0:\n self.coef_ = np.zeros(self.n_sfv_ * self.n_features_, dtype=np.float)\nelif itype == 1:\n self.coef_ = np.random.randn(self.n_sfv_ * self.n_features_)\nelif itype == 2:\n self.coef_ = np.empty(self.n_sfv_ * self.n_features_, dtype=np.float)\n coef = self.coef_.reshape(self.n_sfv_, self... | <|body_start_0|>
if itype == 0:
self.coef_ = np.zeros(self.n_sfv_ * self.n_features_, dtype=np.float)
elif itype == 1:
self.coef_ = np.random.randn(self.n_sfv_ * self.n_features_)
elif itype == 2:
self.coef_ = np.empty(self.n_sfv_ * self.n_features_, dtype=np.... | Fitting Method Mixin | LRwPRFittingType1Mixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRwPRFittingType1Mixin:
"""Fitting Method Mixin"""
def init_coef(self, itype, X, y, s):
"""set initial weight initialization methods are specified by `itype` * 0: cleared by 0 * 1: follows standard normal distribution * 2: learned by standard logistic regression * 3: learned by stand... | stack_v2_sparse_classes_75kplus_train_068938 | 15,703 | permissive | [
{
"docstring": "set initial weight initialization methods are specified by `itype` * 0: cleared by 0 * 1: follows standard normal distribution * 2: learned by standard logistic regression * 3: learned by standard logistic regression separately according to the value of sensitve feature Parameters ---------- ity... | 2 | null | Implement the Python class `LRwPRFittingType1Mixin` described below.
Class description:
Fitting Method Mixin
Method signatures and docstrings:
- def init_coef(self, itype, X, y, s): set initial weight initialization methods are specified by `itype` * 0: cleared by 0 * 1: follows standard normal distribution * 2: lear... | Implement the Python class `LRwPRFittingType1Mixin` described below.
Class description:
Fitting Method Mixin
Method signatures and docstrings:
- def init_coef(self, itype, X, y, s): set initial weight initialization methods are specified by `itype` * 0: cleared by 0 * 1: follows standard normal distribution * 2: lear... | 6f9972e4a7dbca2402f29b86ea67889143dbeb3e | <|skeleton|>
class LRwPRFittingType1Mixin:
"""Fitting Method Mixin"""
def init_coef(self, itype, X, y, s):
"""set initial weight initialization methods are specified by `itype` * 0: cleared by 0 * 1: follows standard normal distribution * 2: learned by standard logistic regression * 3: learned by stand... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LRwPRFittingType1Mixin:
"""Fitting Method Mixin"""
def init_coef(self, itype, X, y, s):
"""set initial weight initialization methods are specified by `itype` * 0: cleared by 0 * 1: follows standard normal distribution * 2: learned by standard logistic regression * 3: learned by standard logistic ... | the_stack_v2_python_sparse | aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py | Trusted-AI/AIF360 | train | 1,157 |
78f1a740cd3e126539a7b05d866bc213d29fe061 | [
"create_data()\nuid = len(User.objects.all().values()) + 1\nsid = len(Salon.objects.all().values())\nsids = [len(Service.objects.all().values()) - 1, len(Service.objects.all().values())]\ndict = {'user_id': uid, 'salon_id': sid, 'services': sids, 'day': '2020-07-03', 'time': '16:20:00'}\nreq = HttpRequest()\nreq.PO... | <|body_start_0|>
create_data()
uid = len(User.objects.all().values()) + 1
sid = len(Salon.objects.all().values())
sids = [len(Service.objects.all().values()) - 1, len(Service.objects.all().values())]
dict = {'user_id': uid, 'salon_id': sid, 'services': sids, 'day': '2020-07-03', ... | AppointmentsModelTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppointmentsModelTests:
def test_add_appointment_user_not_existing(self):
"""Checks what happens when the appointment's client is not in database"""
<|body_0|>
def test_add_appointment_salon_not_existing(self):
"""Checks what happens when the appointment's salon is n... | stack_v2_sparse_classes_75kplus_train_068939 | 32,208 | no_license | [
{
"docstring": "Checks what happens when the appointment's client is not in database",
"name": "test_add_appointment_user_not_existing",
"signature": "def test_add_appointment_user_not_existing(self)"
},
{
"docstring": "Checks what happens when the appointment's salon is not in database",
"n... | 5 | null | Implement the Python class `AppointmentsModelTests` described below.
Class description:
Implement the AppointmentsModelTests class.
Method signatures and docstrings:
- def test_add_appointment_user_not_existing(self): Checks what happens when the appointment's client is not in database
- def test_add_appointment_salo... | Implement the Python class `AppointmentsModelTests` described below.
Class description:
Implement the AppointmentsModelTests class.
Method signatures and docstrings:
- def test_add_appointment_user_not_existing(self): Checks what happens when the appointment's client is not in database
- def test_add_appointment_salo... | 0cbcf0be1b9c2dc3a342a4ae84c2cd913b2cfe79 | <|skeleton|>
class AppointmentsModelTests:
def test_add_appointment_user_not_existing(self):
"""Checks what happens when the appointment's client is not in database"""
<|body_0|>
def test_add_appointment_salon_not_existing(self):
"""Checks what happens when the appointment's salon is n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AppointmentsModelTests:
def test_add_appointment_user_not_existing(self):
"""Checks what happens when the appointment's client is not in database"""
create_data()
uid = len(User.objects.all().values()) + 1
sid = len(Salon.objects.all().values())
sids = [len(Service.obje... | the_stack_v2_python_sparse | backend/beautinator/tests.py | Oepeling/Penguin-Beautinator-1 | train | 0 | |
53d6b2bc50929a36fde7bc7a14384dd58228c018 | [
"super(Sqlite3DatabaseFile, self).__init__()\nself._connection = None\nself._cursor = None\nself.filename = None\nself.read_only = None",
"if not self._connection:\n raise RuntimeError('Cannot close database not opened.')\nself._connection.commit()\nself._connection.close()\nself._connection = None\nself._curs... | <|body_start_0|>
super(Sqlite3DatabaseFile, self).__init__()
self._connection = None
self._cursor = None
self.filename = None
self.read_only = None
<|end_body_0|>
<|body_start_1|>
if not self._connection:
raise RuntimeError('Cannot close database not opened.'... | Class that defines a sqlite3 database file. | Sqlite3DatabaseFile | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sqlite3DatabaseFile:
"""Class that defines a sqlite3 database file."""
def __init__(self):
"""Initializes the database file object."""
<|body_0|>
def Close(self):
"""Closes the database file. Raises: RuntimeError: if the database is not opened."""
<|body_... | stack_v2_sparse_classes_75kplus_train_068940 | 11,064 | permissive | [
{
"docstring": "Initializes the database file object.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Closes the database file. Raises: RuntimeError: if the database is not opened.",
"name": "Close",
"signature": "def Close(self)"
},
{
"docstring": "Det... | 5 | stack_v2_sparse_classes_30k_train_044035 | Implement the Python class `Sqlite3DatabaseFile` described below.
Class description:
Class that defines a sqlite3 database file.
Method signatures and docstrings:
- def __init__(self): Initializes the database file object.
- def Close(self): Closes the database file. Raises: RuntimeError: if the database is not opene... | Implement the Python class `Sqlite3DatabaseFile` described below.
Class description:
Class that defines a sqlite3 database file.
Method signatures and docstrings:
- def __init__(self): Initializes the database file object.
- def Close(self): Closes the database file. Raises: RuntimeError: if the database is not opene... | c69b2952b608cfce47ff8fd0d1409d856be35cb1 | <|skeleton|>
class Sqlite3DatabaseFile:
"""Class that defines a sqlite3 database file."""
def __init__(self):
"""Initializes the database file object."""
<|body_0|>
def Close(self):
"""Closes the database file. Raises: RuntimeError: if the database is not opened."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Sqlite3DatabaseFile:
"""Class that defines a sqlite3 database file."""
def __init__(self):
"""Initializes the database file object."""
super(Sqlite3DatabaseFile, self).__init__()
self._connection = None
self._cursor = None
self.filename = None
self.read_onl... | the_stack_v2_python_sparse | plaso/formatters/winevt_rc.py | cyb3rfox/plaso | train | 3 |
5eac60d1778a1ba3d44002a22faa6abf6b8b6e55 | [
"if classes:\n css_class_map = {'collapse': ('-can-collapse', '-is-collapsed'), 'wide': ('-is-wide',)}\n classes = tuple(itertools.chain.from_iterable((css_class_map.get(css_class, (css_class,)) for css_class in classes)))\nself.collapsed = '-is-collapsed' in classes\nsuper(ChangeFormFieldset, self).__init__(... | <|body_start_0|>
if classes:
css_class_map = {'collapse': ('-can-collapse', '-is-collapsed'), 'wide': ('-is-wide',)}
classes = tuple(itertools.chain.from_iterable((css_class_map.get(css_class, (css_class,)) for css_class in classes)))
self.collapsed = '-is-collapsed' in classes
... | A fieldset in an administration change form. This takes care of providing state to the change form to represent a fieldset and each row in that fieldset. The fieldset makes use of the ``.rb-c-form-fieldset`` CSS component. | ChangeFormFieldset | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChangeFormFieldset:
"""A fieldset in an administration change form. This takes care of providing state to the change form to represent a fieldset and each row in that fieldset. The fieldset makes use of the ``.rb-c-form-fieldset`` CSS component."""
def __init__(self, form, classes=(), **kwar... | stack_v2_sparse_classes_75kplus_train_068941 | 9,818 | permissive | [
{
"docstring": "Initialize the fieldset. Args: form (django.contrib.admin.helpers.AdminForm): The administration form owning the fieldset. classes (tuple, optional): Additional CSS classes to add to the ``<fieldset>`` element. **kwargs (dict): Keyword arguments to pass to the parent class.",
"name": "__init... | 3 | stack_v2_sparse_classes_30k_train_026988 | Implement the Python class `ChangeFormFieldset` described below.
Class description:
A fieldset in an administration change form. This takes care of providing state to the change form to represent a fieldset and each row in that fieldset. The fieldset makes use of the ``.rb-c-form-fieldset`` CSS component.
Method sign... | Implement the Python class `ChangeFormFieldset` described below.
Class description:
A fieldset in an administration change form. This takes care of providing state to the change form to represent a fieldset and each row in that fieldset. The fieldset makes use of the ``.rb-c-form-fieldset`` CSS component.
Method sign... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class ChangeFormFieldset:
"""A fieldset in an administration change form. This takes care of providing state to the change form to represent a fieldset and each row in that fieldset. The fieldset makes use of the ``.rb-c-form-fieldset`` CSS component."""
def __init__(self, form, classes=(), **kwar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChangeFormFieldset:
"""A fieldset in an administration change form. This takes care of providing state to the change form to represent a fieldset and each row in that fieldset. The fieldset makes use of the ``.rb-c-form-fieldset`` CSS component."""
def __init__(self, form, classes=(), **kwargs):
... | the_stack_v2_python_sparse | reviewboard/admin/forms/change_form.py | reviewboard/reviewboard | train | 1,141 |
3a31009a3d6a71eeda31ed4d942766d16d687c47 | [
"from app.services.users.groups import GroupFactory\ngroup_factory = GroupFactory(model)\nif group_factory.check_soft_delete():\n return\nif is_created is True:\n group_factory.add_group()\nelse:\n group_factory.modify_group()\nsuper().on_model_change(form, model, is_created)",
"from app.services.users.g... | <|body_start_0|>
from app.services.users.groups import GroupFactory
group_factory = GroupFactory(model)
if group_factory.check_soft_delete():
return
if is_created is True:
group_factory.add_group()
else:
group_factory.modify_group()
sup... | 用户组管理 | GroupModelView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupModelView:
"""用户组管理"""
def on_model_change(self, form, model, is_created):
"""创建修改组时"""
<|body_0|>
def delete_model(self, model):
"""删除组时"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from app.services.users.groups import GroupFactory
... | stack_v2_sparse_classes_75kplus_train_068942 | 5,835 | permissive | [
{
"docstring": "创建修改组时",
"name": "on_model_change",
"signature": "def on_model_change(self, form, model, is_created)"
},
{
"docstring": "删除组时",
"name": "delete_model",
"signature": "def delete_model(self, model)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013114 | Implement the Python class `GroupModelView` described below.
Class description:
用户组管理
Method signatures and docstrings:
- def on_model_change(self, form, model, is_created): 创建修改组时
- def delete_model(self, model): 删除组时 | Implement the Python class `GroupModelView` described below.
Class description:
用户组管理
Method signatures and docstrings:
- def on_model_change(self, form, model, is_created): 创建修改组时
- def delete_model(self, model): 删除组时
<|skeleton|>
class GroupModelView:
"""用户组管理"""
def on_model_change(self, form, model, is_... | 4f866b2264e224389c99bbbdb4521f4b0799b2a3 | <|skeleton|>
class GroupModelView:
"""用户组管理"""
def on_model_change(self, form, model, is_created):
"""创建修改组时"""
<|body_0|>
def delete_model(self, model):
"""删除组时"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupModelView:
"""用户组管理"""
def on_model_change(self, form, model, is_created):
"""创建修改组时"""
from app.services.users.groups import GroupFactory
group_factory = GroupFactory(model)
if group_factory.check_soft_delete():
return
if is_created is True:
... | the_stack_v2_python_sparse | admin/views/users.py | ssfdust/full-stack-flask-smorest | train | 39 |
d0670142c0f02318172820d8e7a6eb0481d14ad8 | [
"self.tty = tty\nself.socket = socket\nself.p_callback = tornado.ioloop.PeriodicCallback(self.consume_lines, callback_time=10)\nself.p_callback.start()",
"try:\n timeout = 0\n if WINDOWS:\n if self.tty.isalive():\n _in = self.tty.read(1000)\n self.socket.notify(_in)\n els... | <|body_start_0|>
self.tty = tty
self.socket = socket
self.p_callback = tornado.ioloop.PeriodicCallback(self.consume_lines, callback_time=10)
self.p_callback.start()
<|end_body_0|>
<|body_start_1|>
try:
timeout = 0
if WINDOWS:
if self.tty.i... | This class allows to read continously from a terminal stream. | TermReader | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TermReader:
"""This class allows to read continously from a terminal stream."""
def __init__(self, tty, socket):
"""Terminal reader constructor."""
<|body_0|>
def consume_lines(self):
"""Consume lines from stream each 100ms."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus_train_068943 | 3,097 | permissive | [
{
"docstring": "Terminal reader constructor.",
"name": "__init__",
"signature": "def __init__(self, tty, socket)"
},
{
"docstring": "Consume lines from stream each 100ms.",
"name": "consume_lines",
"signature": "def consume_lines(self)"
}
] | 2 | null | Implement the Python class `TermReader` described below.
Class description:
This class allows to read continously from a terminal stream.
Method signatures and docstrings:
- def __init__(self, tty, socket): Terminal reader constructor.
- def consume_lines(self): Consume lines from stream each 100ms. | Implement the Python class `TermReader` described below.
Class description:
This class allows to read continously from a terminal stream.
Method signatures and docstrings:
- def __init__(self, tty, socket): Terminal reader constructor.
- def consume_lines(self): Consume lines from stream each 100ms.
<|skeleton|>
cla... | 9e5d377d0242ac5eb1e82a357e6701095a8ca1ff | <|skeleton|>
class TermReader:
"""This class allows to read continously from a terminal stream."""
def __init__(self, tty, socket):
"""Terminal reader constructor."""
<|body_0|>
def consume_lines(self):
"""Consume lines from stream each 100ms."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TermReader:
"""This class allows to read continously from a terminal stream."""
def __init__(self, tty, socket):
"""Terminal reader constructor."""
self.tty = tty
self.socket = socket
self.p_callback = tornado.ioloop.PeriodicCallback(self.consume_lines, callback_time=10)
... | the_stack_v2_python_sparse | home--tommy--mypy/mypy/lib/python2.7/site-packages/spyder_terminal/server/logic/term_manager.py | tommybutler/mlearnpy2 | train | 0 |
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a | [
"super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.weight, whisper_layer.self_attn.k_proj.weight, whisper_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.bias, torch.zeros_like(whisper_layer.self_attn.q... | <|body_start_0|>
super().__init__(config)
self.in_proj_weight = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.weight, whisper_layer.self_attn.k_proj.weight, whisper_layer.self_attn.v_proj.weight]))
self.in_proj_bias = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.bias, torch.ze... | WhisperEncoderLayerBetterTransformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WhisperEncoderLayerBetterTransformer:
def __init__(self, whisper_layer, config):
"""A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieve... | stack_v2_sparse_classes_75kplus_train_068944 | 43,670 | no_license | [
{
"docstring": "A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieved.",
"name": "__init__",
"signature": "def __init__(self, whisper_layer, config)"
... | 2 | stack_v2_sparse_classes_30k_train_012809 | Implement the Python class `WhisperEncoderLayerBetterTransformer` described below.
Class description:
Implement the WhisperEncoderLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, whisper_layer, config): A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` imple... | Implement the Python class `WhisperEncoderLayerBetterTransformer` described below.
Class description:
Implement the WhisperEncoderLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, whisper_layer, config): A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` imple... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class WhisperEncoderLayerBetterTransformer:
def __init__(self, whisper_layer, config):
"""A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieve... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WhisperEncoderLayerBetterTransformer:
def __init__(self, whisper_layer, config):
"""A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieved."""
... | the_stack_v2_python_sparse | generated/test_huggingface_optimum.py | jansel/pytorch-jit-paritybench | train | 35 | |
db7b07be21d0ad1b19a0a9acc7e5c95e4cd821cf | [
"tree = etree.parse(file)\nroot = tree.getroot()\nif not etree.iselement(root):\n sys.exit(\"Error while parsing '\" + file + \"' file.\\n\")\nfor node in root.findall('node'):\n self.parse_node(node)\nfor way in root.findall('way'):\n self.parse_way(way)\nfor relation in root.findall('relation'):\n sel... | <|body_start_0|>
tree = etree.parse(file)
root = tree.getroot()
if not etree.iselement(root):
sys.exit("Error while parsing '" + file + "' file.\n")
for node in root.findall('node'):
self.parse_node(node)
for way in root.findall('way'):
self.pa... | Parser of the OSM file. | Parser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parser:
"""Parser of the OSM file."""
def parse_file(self, file, disableMultipolygonBuildings=False):
"""Parse the OSM file."""
<|body_0|>
def get_tags(self, element):
"""Return a dictionnary of tags belonging to this element."""
<|body_1|>
def parse... | stack_v2_sparse_classes_75kplus_train_068945 | 6,805 | permissive | [
{
"docstring": "Parse the OSM file.",
"name": "parse_file",
"signature": "def parse_file(self, file, disableMultipolygonBuildings=False)"
},
{
"docstring": "Return a dictionnary of tags belonging to this element.",
"name": "get_tags",
"signature": "def get_tags(self, element)"
},
{
... | 6 | stack_v2_sparse_classes_30k_train_042260 | Implement the Python class `Parser` described below.
Class description:
Parser of the OSM file.
Method signatures and docstrings:
- def parse_file(self, file, disableMultipolygonBuildings=False): Parse the OSM file.
- def get_tags(self, element): Return a dictionnary of tags belonging to this element.
- def parse_nod... | Implement the Python class `Parser` described below.
Class description:
Parser of the OSM file.
Method signatures and docstrings:
- def parse_file(self, file, disableMultipolygonBuildings=False): Parse the OSM file.
- def get_tags(self, element): Return a dictionnary of tags belonging to this element.
- def parse_nod... | 8aba6eaae76989facf3442305c8089d3cc366bcf | <|skeleton|>
class Parser:
"""Parser of the OSM file."""
def parse_file(self, file, disableMultipolygonBuildings=False):
"""Parse the OSM file."""
<|body_0|>
def get_tags(self, element):
"""Return a dictionnary of tags belonging to this element."""
<|body_1|>
def parse... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Parser:
"""Parser of the OSM file."""
def parse_file(self, file, disableMultipolygonBuildings=False):
"""Parse the OSM file."""
tree = etree.parse(file)
root = tree.getroot()
if not etree.iselement(root):
sys.exit("Error while parsing '" + file + "' file.\n")
... | the_stack_v2_python_sparse | resources/osm_importer/parser_objects.py | cyberbotics/webots | train | 2,495 |
eefbc01f811186f60e68f1e5353594542ce281ab | [
"try:\n response = requests.get(url='http://tunnel-api.apeyun.com/q', params=ApeProxyManager.params, headers={'Content-Type': 'text/plain; charset=utf-8'})\n if response.status_code == 200:\n res = json.loads(response.text)\n if res['code'] == 200:\n data = res['data']\n cl... | <|body_start_0|>
try:
response = requests.get(url='http://tunnel-api.apeyun.com/q', params=ApeProxyManager.params, headers={'Content-Type': 'text/plain; charset=utf-8'})
if response.status_code == 200:
res = json.loads(response.text)
if res['code'] == 200:... | ApeProxyManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApeProxyManager:
def getProxiesDicts(cls):
"""一次性获取多个代理 :return:"""
<|body_0|>
def getProxy(cls):
"""获取一个代理 :return:"""
<|body_1|>
def proxyDict2String(cls, proxy):
"""将字典形式的代理转化为http://ip:port形式 :param proxy: :return:"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus_train_068946 | 5,542 | no_license | [
{
"docstring": "一次性获取多个代理 :return:",
"name": "getProxiesDicts",
"signature": "def getProxiesDicts(cls)"
},
{
"docstring": "获取一个代理 :return:",
"name": "getProxy",
"signature": "def getProxy(cls)"
},
{
"docstring": "将字典形式的代理转化为http://ip:port形式 :param proxy: :return:",
"name": "p... | 4 | stack_v2_sparse_classes_30k_train_051157 | Implement the Python class `ApeProxyManager` described below.
Class description:
Implement the ApeProxyManager class.
Method signatures and docstrings:
- def getProxiesDicts(cls): 一次性获取多个代理 :return:
- def getProxy(cls): 获取一个代理 :return:
- def proxyDict2String(cls, proxy): 将字典形式的代理转化为http://ip:port形式 :param proxy: :ret... | Implement the Python class `ApeProxyManager` described below.
Class description:
Implement the ApeProxyManager class.
Method signatures and docstrings:
- def getProxiesDicts(cls): 一次性获取多个代理 :return:
- def getProxy(cls): 获取一个代理 :return:
- def proxyDict2String(cls, proxy): 将字典形式的代理转化为http://ip:port形式 :param proxy: :ret... | 3898125fa65ca045e7c203a18e7a1129b9ce5988 | <|skeleton|>
class ApeProxyManager:
def getProxiesDicts(cls):
"""一次性获取多个代理 :return:"""
<|body_0|>
def getProxy(cls):
"""获取一个代理 :return:"""
<|body_1|>
def proxyDict2String(cls, proxy):
"""将字典形式的代理转化为http://ip:port形式 :param proxy: :return:"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApeProxyManager:
def getProxiesDicts(cls):
"""一次性获取多个代理 :return:"""
try:
response = requests.get(url='http://tunnel-api.apeyun.com/q', params=ApeProxyManager.params, headers={'Content-Type': 'text/plain; charset=utf-8'})
if response.status_code == 200:
r... | the_stack_v2_python_sparse | CnkiSpider/proxy.py | konwa/CnkiSpider | train | 0 | |
03d48c204d6def34cea0a69957d003011bbfcc57 | [
"super().__init__(game, '')\nself.mode_selector = self.ui[mode_selector]\nself.mission_selector = self.ui[mission_selector]\nself.mission_selector_label = self.ui[mission_selector_label]\nself.stage_selector = self.ui[stage_selector]\nself.mode_name = stage_name if stage_name else self.stage_selector.text",
"if s... | <|body_start_0|>
super().__init__(game, '')
self.mode_selector = self.ui[mode_selector]
self.mission_selector = self.ui[mission_selector]
self.mission_selector_label = self.ui[mission_selector_label]
self.stage_selector = self.ui[stage_selector]
self.mode_name = stage_nam... | Class for working with Epic Quests with 10 stages (usual missions without difficulty). | TenStageEpicQuest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TenStageEpicQuest:
"""Class for working with Epic Quests with 10 stages (usual missions without difficulty)."""
def __init__(self, game, mode_selector, mission_selector, mission_selector_label, stage_selector, stage_name=None):
"""Class initialization. :param game.Game game: instance... | stack_v2_sparse_classes_75kplus_train_068947 | 25,988 | permissive | [
{
"docstring": "Class initialization. :param game.Game game: instance of the game. :param mode_selector: UI element name of Epic Quest selector. :param mission_selector: UI element name of Epic Quest's mission selector. :param mission_selector_label: UI element name of Epic Quest's mission label. :param stage_s... | 6 | stack_v2_sparse_classes_30k_train_049510 | Implement the Python class `TenStageEpicQuest` described below.
Class description:
Class for working with Epic Quests with 10 stages (usual missions without difficulty).
Method signatures and docstrings:
- def __init__(self, game, mode_selector, mission_selector, mission_selector_label, stage_selector, stage_name=Non... | Implement the Python class `TenStageEpicQuest` described below.
Class description:
Class for working with Epic Quests with 10 stages (usual missions without difficulty).
Method signatures and docstrings:
- def __init__(self, game, mode_selector, mission_selector, mission_selector_label, stage_selector, stage_name=Non... | fbcfd128de26c9dd8716e0af26f0f5db916714ce | <|skeleton|>
class TenStageEpicQuest:
"""Class for working with Epic Quests with 10 stages (usual missions without difficulty)."""
def __init__(self, game, mode_selector, mission_selector, mission_selector_label, stage_selector, stage_name=None):
"""Class initialization. :param game.Game game: instance... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TenStageEpicQuest:
"""Class for working with Epic Quests with 10 stages (usual missions without difficulty)."""
def __init__(self, game, mode_selector, mission_selector, mission_selector_label, stage_selector, stage_name=None):
"""Class initialization. :param game.Game game: instance of the game.... | the_stack_v2_python_sparse | lib/game/missions/epic_quest.py | huynkprovn/mff_auto | train | 0 |
bbf032e330320c3d50361d3a65b1d832a13eb3ee | [
"if id_tarea < 0:\n raise Exception('Parametros incorrectos')\nif len(username) > 16 or len(username) < 2 or re_tuser.match(username) == None:\n raise Exception('Parametros incorrectos')\nif lang != 'es' and lang != 'ar' and (lang != 'en') and (lang != 'fr'):\n raise Exception('Parametros incorrectos')\nif... | <|body_start_0|>
if id_tarea < 0:
raise Exception('Parametros incorrectos')
if len(username) > 16 or len(username) < 2 or re_tuser.match(username) == None:
raise Exception('Parametros incorrectos')
if lang != 'es' and lang != 'ar' and (lang != 'en') and (lang != 'fr'):
... | docstring for APITextos | APITiempo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APITiempo:
"""docstring for APITextos"""
def getUsersSimilar_user_all(username, lang, numberOfSim, id_tarea):
"""Retorna una lista de usuarios similares a un usuario dado se buscan todos los usuarios conocidos en la base de datos. se busca por mismos temas de conversacion. Parameters... | stack_v2_sparse_classes_75kplus_train_068948 | 3,372 | permissive | [
{
"docstring": "Retorna una lista de usuarios similares a un usuario dado se buscan todos los usuarios conocidos en la base de datos. se busca por mismos temas de conversacion. Parameters ---------- username : usuario de la red social con @ o sin @ lang : lenguaje de los usuarios numberOfSim : es el numero de u... | 2 | stack_v2_sparse_classes_30k_train_041486 | Implement the Python class `APITiempo` described below.
Class description:
docstring for APITextos
Method signatures and docstrings:
- def getUsersSimilar_user_all(username, lang, numberOfSim, id_tarea): Retorna una lista de usuarios similares a un usuario dado se buscan todos los usuarios conocidos en la base de dat... | Implement the Python class `APITiempo` described below.
Class description:
docstring for APITextos
Method signatures and docstrings:
- def getUsersSimilar_user_all(username, lang, numberOfSim, id_tarea): Retorna una lista de usuarios similares a un usuario dado se buscan todos los usuarios conocidos en la base de dat... | f123595afc697ddfa862114a228d7351e2f8fd73 | <|skeleton|>
class APITiempo:
"""docstring for APITextos"""
def getUsersSimilar_user_all(username, lang, numberOfSim, id_tarea):
"""Retorna una lista de usuarios similares a un usuario dado se buscan todos los usuarios conocidos en la base de datos. se busca por mismos temas de conversacion. Parameters... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class APITiempo:
"""docstring for APITextos"""
def getUsersSimilar_user_all(username, lang, numberOfSim, id_tarea):
"""Retorna una lista de usuarios similares a un usuario dado se buscan todos los usuarios conocidos en la base de datos. se busca por mismos temas de conversacion. Parameters ---------- u... | the_stack_v2_python_sparse | API/APITiempo.py | garnachod/ConcursoPolicia | train | 0 |
e7dbab7330e823a635f7d49d0565782b92884f1f | [
"def gen_next(x, y):\n yield (y, n - 1 - x)\n yield (n - 1 - x, n - 1 - y)\n yield (n - 1 - y, x)\nn = len(matrix)\nif n <= 1:\n return\nfor d in range(0, n // 2):\n for i in range(d, n - d - 1):\n tmp = matrix[d][i]\n for a, b in gen_next(d, i):\n matrix[a][b], tmp = (tmp, m... | <|body_start_0|>
def gen_next(x, y):
yield (y, n - 1 - x)
yield (n - 1 - x, n - 1 - y)
yield (n - 1 - y, x)
n = len(matrix)
if n <= 1:
return
for d in range(0, n // 2):
for i in range(d, n - d - 1):
tmp = matrix[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace"""
<|body_0|>
def rotate(self, matrix: List[List[int]]) -> None:
"""Do not return anything, ... | stack_v2_sparse_classes_75kplus_train_068949 | 2,631 | no_license | [
{
"docstring": "Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace",
"name": "rotate",
"signature": "def rotate(self, matrix: List[List[int]]) -> None"
},
{
"docstring": "Do not return anything, modify matrix in-place instead.",
"na... | 2 | stack_v2_sparse_classes_30k_train_002914 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace
- def rotate(sel... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace
- def rotate(sel... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace"""
<|body_0|>
def rotate(self, matrix: List[List[int]]) -> None:
"""Do not return anything, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace"""
def gen_next(x, y):
yield (y, n - 1 - x)
yield (n - 1 - x, n - 1 - y)
yield (n -... | the_stack_v2_python_sparse | leetcode/solved/48_Rotate_Image/solution.py | sungminoh/algorithms | train | 0 | |
9c4d3eec7300cfc902a33b58a47683ec1f9386e4 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DelegatedAdminRelationship()",
"from .delegated_admin_access_assignment import DelegatedAdminAccessAssignment\nfrom .delegated_admin_access_details import DelegatedAdminAccessDetails\nfrom .delegated_admin_relationship_customer_partici... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return DelegatedAdminRelationship()
<|end_body_0|>
<|body_start_1|>
from .delegated_admin_access_assignment import DelegatedAdminAccessAssignment
from .delegated_admin_access_details import Del... | DelegatedAdminRelationship | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DelegatedAdminRelationship:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationship:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and... | stack_v2_sparse_classes_75kplus_train_068950 | 8,252 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: DelegatedAdminRelationship",
"name": "create_from_discriminator_value",
"signature": "def create_from_discri... | 3 | null | Implement the Python class `DelegatedAdminRelationship` described below.
Class description:
Implement the DelegatedAdminRelationship class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationship: Creates a new instance of the appropr... | Implement the Python class `DelegatedAdminRelationship` described below.
Class description:
Implement the DelegatedAdminRelationship class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationship: Creates a new instance of the appropr... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class DelegatedAdminRelationship:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationship:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DelegatedAdminRelationship:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DelegatedAdminRelationship:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob... | the_stack_v2_python_sparse | msgraph/generated/models/delegated_admin_relationship.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
86c558efec965e9f915fb0c48bbc0512cfeccbd3 | [
"file = open(raw_book_path, 'r', encoding='UTF-8')\nraw_content = file.read()\nfile.close()\ni = raw_content.index('***')\nprocessed_content = raw_content[i + 30:]\ni = processed_content.index('END OF THIS PROJECT GUTENBERG EBOOK')\nprocessed_content = processed_content[:i]\nspecial_characters = ['*', '-', '_']\nfo... | <|body_start_0|>
file = open(raw_book_path, 'r', encoding='UTF-8')
raw_content = file.read()
file.close()
i = raw_content.index('***')
processed_content = raw_content[i + 30:]
i = processed_content.index('END OF THIS PROJECT GUTENBERG EBOOK')
processed_content = p... | Class to preprocess books from project gutenberg | Preprocess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Preprocess:
"""Class to preprocess books from project gutenberg"""
def clean_book(raw_book_path):
"""Function to clean character *, - and _ as well as removing header and footer."""
<|body_0|>
def generate_clean_book(processed_book_path, raw_book_path):
"""Functi... | stack_v2_sparse_classes_75kplus_train_068951 | 1,266 | no_license | [
{
"docstring": "Function to clean character *, - and _ as well as removing header and footer.",
"name": "clean_book",
"signature": "def clean_book(raw_book_path)"
},
{
"docstring": "Function to generate a clean book",
"name": "generate_clean_book",
"signature": "def generate_clean_book(p... | 2 | stack_v2_sparse_classes_30k_train_002674 | Implement the Python class `Preprocess` described below.
Class description:
Class to preprocess books from project gutenberg
Method signatures and docstrings:
- def clean_book(raw_book_path): Function to clean character *, - and _ as well as removing header and footer.
- def generate_clean_book(processed_book_path, r... | Implement the Python class `Preprocess` described below.
Class description:
Class to preprocess books from project gutenberg
Method signatures and docstrings:
- def clean_book(raw_book_path): Function to clean character *, - and _ as well as removing header and footer.
- def generate_clean_book(processed_book_path, r... | 73579e8a2786a5430ff31638ff2d84ec27d2eb5f | <|skeleton|>
class Preprocess:
"""Class to preprocess books from project gutenberg"""
def clean_book(raw_book_path):
"""Function to clean character *, - and _ as well as removing header and footer."""
<|body_0|>
def generate_clean_book(processed_book_path, raw_book_path):
"""Functi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Preprocess:
"""Class to preprocess books from project gutenberg"""
def clean_book(raw_book_path):
"""Function to clean character *, - and _ as well as removing header and footer."""
file = open(raw_book_path, 'r', encoding='UTF-8')
raw_content = file.read()
file.close()
... | the_stack_v2_python_sparse | data_import_pkg/e_book_preprocess/preprocess.py | FilipePintoReis/PLEI_FEUP | train | 0 |
2515e9e4f36307deda82c25d52503ba5c418ac4b | [
"res, stack = ([], deque([root]))\nwhile stack:\n node = stack.popleft()\n if node:\n res.append(node.val)\n stack.append(node.left)\n stack.append(node.right)\n else:\n res.append(None)\nwhile res and res[-1] is None:\n res.pop()\nreturn str(res)",
"data = eval(data)\nif n... | <|body_start_0|>
res, stack = ([], deque([root]))
while stack:
node = stack.popleft()
if node:
res.append(node.val)
stack.append(node.left)
stack.append(node.right)
else:
res.append(None)
while re... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_068952 | 3,876 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_034946 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | bc895124817aa1341d15ac85e1c6d670a9420dec | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
res, stack = ([], deque([root]))
while stack:
node = stack.popleft()
if node:
res.append(node.val)
stack.append(node.left)... | the_stack_v2_python_sparse | leetcode/297SerializeAndDeserializeBinaryTree.py | qilaidi/leetcode_problems | train | 0 | |
259814434573ce1e15470e55c1a5095876714357 | [
"self.cred = cred['firewall']\nself.debug = cred['debug']\nself.logger = logger.IemlAVLogger(__name__, debug=self.debug)",
"if check_root():\n engineObj = FirewallEngine(cred=self.cred, debug=self.debug)\n engineObj.startEngine()\n self.logger.log('Firewall started', logtype='info')\nelse:\n self.logg... | <|body_start_0|>
self.cred = cred['firewall']
self.debug = cred['debug']
self.logger = logger.IemlAVLogger(__name__, debug=self.debug)
<|end_body_0|>
<|body_start_1|>
if check_root():
engineObj = FirewallEngine(cred=self.cred, debug=self.debug)
engineObj.startEng... | IemlAVFirewall Class. | IemlAVFirewall | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IemlAVFirewall:
"""IemlAVFirewall Class."""
def __init__(self, cred=None, debug=None):
"""Initialize IemlAVFirewall."""
<|body_0|>
def start_firewall(self):
"""Start firewall engine."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.cred = cr... | stack_v2_sparse_classes_75kplus_train_068953 | 1,020 | permissive | [
{
"docstring": "Initialize IemlAVFirewall.",
"name": "__init__",
"signature": "def __init__(self, cred=None, debug=None)"
},
{
"docstring": "Start firewall engine.",
"name": "start_firewall",
"signature": "def start_firewall(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000439 | Implement the Python class `IemlAVFirewall` described below.
Class description:
IemlAVFirewall Class.
Method signatures and docstrings:
- def __init__(self, cred=None, debug=None): Initialize IemlAVFirewall.
- def start_firewall(self): Start firewall engine. | Implement the Python class `IemlAVFirewall` described below.
Class description:
IemlAVFirewall Class.
Method signatures and docstrings:
- def __init__(self, cred=None, debug=None): Initialize IemlAVFirewall.
- def start_firewall(self): Start firewall engine.
<|skeleton|>
class IemlAVFirewall:
"""IemlAVFirewall C... | 8d397a3d59e067176269c5e84d73bf53951b7b3f | <|skeleton|>
class IemlAVFirewall:
"""IemlAVFirewall Class."""
def __init__(self, cred=None, debug=None):
"""Initialize IemlAVFirewall."""
<|body_0|>
def start_firewall(self):
"""Start firewall engine."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IemlAVFirewall:
"""IemlAVFirewall Class."""
def __init__(self, cred=None, debug=None):
"""Initialize IemlAVFirewall."""
self.cred = cred['firewall']
self.debug = cred['debug']
self.logger = logger.IemlAVLogger(__name__, debug=self.debug)
def start_firewall(self):
... | the_stack_v2_python_sparse | iemlav/lib/firewall/iemlAVFirewall.py | GouravRDutta/IemLabsAV | train | 0 |
aa6bde2997861c8e5f0d155ce3e3dde67b223bdc | [
"ret = await self.db.config.find_one({'dataset_id': dataset_id}, projection={'_id': False, 'dataset_id': False})\nif not ret:\n self.send_error(404, reason='Config not found')\nelse:\n self.write(ret)",
"data = json.loads(self.request.body)\nif 'dataset_id' not in data:\n data['dataset_id'] = dataset_id\... | <|body_start_0|>
ret = await self.db.config.find_one({'dataset_id': dataset_id}, projection={'_id': False, 'dataset_id': False})
if not ret:
self.send_error(404, reason='Config not found')
else:
self.write(ret)
<|end_body_0|>
<|body_start_1|>
data = json.loads(se... | Handle config requests. | ConfigHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigHandler:
"""Handle config requests."""
async def get(self, dataset_id):
"""Get a config. Args: dataset_id (str): the dataset id of the config Returns: dict: config"""
<|body_0|>
async def put(self, dataset_id):
"""Set a config. Body should contain the confi... | stack_v2_sparse_classes_75kplus_train_068954 | 2,022 | permissive | [
{
"docstring": "Get a config. Args: dataset_id (str): the dataset id of the config Returns: dict: config",
"name": "get",
"signature": "async def get(self, dataset_id)"
},
{
"docstring": "Set a config. Body should contain the config. Args: dataset_id (str): the dataset id of the config Returns: ... | 2 | null | Implement the Python class `ConfigHandler` described below.
Class description:
Handle config requests.
Method signatures and docstrings:
- async def get(self, dataset_id): Get a config. Args: dataset_id (str): the dataset id of the config Returns: dict: config
- async def put(self, dataset_id): Set a config. Body sho... | Implement the Python class `ConfigHandler` described below.
Class description:
Handle config requests.
Method signatures and docstrings:
- async def get(self, dataset_id): Get a config. Args: dataset_id (str): the dataset id of the config Returns: dict: config
- async def put(self, dataset_id): Set a config. Body sho... | b66c35bb1072f835bc84ea01fce169989323c4b9 | <|skeleton|>
class ConfigHandler:
"""Handle config requests."""
async def get(self, dataset_id):
"""Get a config. Args: dataset_id (str): the dataset id of the config Returns: dict: config"""
<|body_0|>
async def put(self, dataset_id):
"""Set a config. Body should contain the confi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfigHandler:
"""Handle config requests."""
async def get(self, dataset_id):
"""Get a config. Args: dataset_id (str): the dataset id of the config Returns: dict: config"""
ret = await self.db.config.find_one({'dataset_id': dataset_id}, projection={'_id': False, 'dataset_id': False})
... | the_stack_v2_python_sparse | iceprod/rest/handlers/config.py | WIPACrepo/iceprod | train | 5 |
215b74cafe6e62706a6365c119a6769207ae42ce | [
"super(JointHead, self).__init__(name=name)\nassert all([vid_to_aud_txt_kwargs['d_model'] == aud_to_vid_txt_kwargs['d_model'], vid_to_aud_txt_kwargs['d_model'] == txt_to_vid_aud_kwargs['d_model']]), 'The joint space projection should be the same for all projections'\nd_joint = vid_to_aud_txt_kwargs['d_model']\nself... | <|body_start_0|>
super(JointHead, self).__init__(name=name)
assert all([vid_to_aud_txt_kwargs['d_model'] == aud_to_vid_txt_kwargs['d_model'], vid_to_aud_txt_kwargs['d_model'] == txt_to_vid_aud_kwargs['d_model']]), 'The joint space projection should be the same for all projections'
d_joint = vid_... | MLP-based Head to bridge audio, text and video with a Joint style. | JointHead | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JointHead:
"""MLP-based Head to bridge audio, text and video with a Joint style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: b... | stack_v2_sparse_classes_75kplus_train_068955 | 6,829 | permissive | [
{
"docstring": "Initialize the Fine-to-Coarse head class. Args: bn_config: batchnorm configuration args use_xreplica_bn: whether to use cross-replica bn stats or not vid_to_aud_txt_kwargs: vid2rest MLP args aud_to_vid_txt_kwargs: aud2rest MLP args txt_to_vid_aud_kwargs: txt2rest MLP args name: graph name. **kwa... | 2 | stack_v2_sparse_classes_30k_val_000610 | Implement the Python class `JointHead` described below.
Class description:
MLP-based Head to bridge audio, text and video with a Joint style.
Method signatures and docstrings:
- def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **k... | Implement the Python class `JointHead` described below.
Class description:
MLP-based Head to bridge audio, text and video with a Joint style.
Method signatures and docstrings:
- def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **k... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class JointHead:
"""MLP-based Head to bridge audio, text and video with a Joint style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JointHead:
"""MLP-based Head to bridge audio, text and video with a Joint style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: bn_config: bat... | the_stack_v2_python_sparse | vatt/modeling/heads/bridge.py | Jimmy-INL/google-research | train | 1 |
f2bea8af40db8f098d2b53cdcf76fd00ce4388a1 | [
"super(BidirectionalLanguageModel, self).__init__()\nself.lstms = nn.ModuleList([nn.LSTM(emb_dim, hid_dim, bidirectional=True, dropout=dropout, batch_first=True), nn.LSTM(prj_emb, hid_dim, bidirectional=True, dropout=dropout, batch_first=True)])\nself.projection_layer = nn.Linear(2 * hid_dim, prj_emb)",
"first_ou... | <|body_start_0|>
super(BidirectionalLanguageModel, self).__init__()
self.lstms = nn.ModuleList([nn.LSTM(emb_dim, hid_dim, bidirectional=True, dropout=dropout, batch_first=True), nn.LSTM(prj_emb, hid_dim, bidirectional=True, dropout=dropout, batch_first=True)])
self.projection_layer = nn.Linear(2... | BidirectionalLanguageModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BidirectionalLanguageModel:
def __init__(self, emb_dim: int, hid_dim: int, prj_emb: int, dropout: float=0.0) -> None:
"""> We use dropout before and after evert LSTM layer"""
<|body_0|>
def forward(self, x: torch.Tensor, hidden: Tuple[torch.Tensor]=None):
"""Paramete... | stack_v2_sparse_classes_75kplus_train_068956 | 4,549 | no_license | [
{
"docstring": "> We use dropout before and after evert LSTM layer",
"name": "__init__",
"signature": "def __init__(self, emb_dim: int, hid_dim: int, prj_emb: int, dropout: float=0.0) -> None"
},
{
"docstring": "Parameters: x: A sentence tensor that embeded hidden: tuple of hidden and cell. The ... | 2 | stack_v2_sparse_classes_30k_test_002606 | Implement the Python class `BidirectionalLanguageModel` described below.
Class description:
Implement the BidirectionalLanguageModel class.
Method signatures and docstrings:
- def __init__(self, emb_dim: int, hid_dim: int, prj_emb: int, dropout: float=0.0) -> None: > We use dropout before and after evert LSTM layer
-... | Implement the Python class `BidirectionalLanguageModel` described below.
Class description:
Implement the BidirectionalLanguageModel class.
Method signatures and docstrings:
- def __init__(self, emb_dim: int, hid_dim: int, prj_emb: int, dropout: float=0.0) -> None: > We use dropout before and after evert LSTM layer
-... | ca033284850147b334d3771df8235a1135eba76c | <|skeleton|>
class BidirectionalLanguageModel:
def __init__(self, emb_dim: int, hid_dim: int, prj_emb: int, dropout: float=0.0) -> None:
"""> We use dropout before and after evert LSTM layer"""
<|body_0|>
def forward(self, x: torch.Tensor, hidden: Tuple[torch.Tensor]=None):
"""Paramete... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BidirectionalLanguageModel:
def __init__(self, emb_dim: int, hid_dim: int, prj_emb: int, dropout: float=0.0) -> None:
"""> We use dropout before and after evert LSTM layer"""
super(BidirectionalLanguageModel, self).__init__()
self.lstms = nn.ModuleList([nn.LSTM(emb_dim, hid_dim, bidire... | the_stack_v2_python_sparse | papers/4.ELMo/elmo.py | euhkim/NLP | train | 0 | |
ef90a6b86a97fcf3d2106853b7dfff87a90f12ff | [
"self.salt = salt\nself.stretched = stretched\nself.hashes = []\nself.hash_index = 0\nself.search_index = -1",
"tohash = self.salt + str(self.hash_index)\nif self.stretched:\n hash = tohash\n for i in range(2017):\n hash = hashlib.md5(hash.encode('ascii')).hexdigest().lower()\nelse:\n hash = hashl... | <|body_start_0|>
self.salt = salt
self.stretched = stretched
self.hashes = []
self.hash_index = 0
self.search_index = -1
<|end_body_0|>
<|body_start_1|>
tohash = self.salt + str(self.hash_index)
if self.stretched:
hash = tohash
for i in ra... | Day14KeyGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Day14KeyGenerator:
def __init__(self, salt, stretched=False):
"""Generate keys for communicating with santa. :param salt: salt for this instance :param stretched: if True, uses the 'stretched' hashing form"""
<|body_0|>
def generate_next_hash(self):
"""Make the next ... | stack_v2_sparse_classes_75kplus_train_068957 | 3,367 | no_license | [
{
"docstring": "Generate keys for communicating with santa. :param salt: salt for this instance :param stretched: if True, uses the 'stretched' hashing form",
"name": "__init__",
"signature": "def __init__(self, salt, stretched=False)"
},
{
"docstring": "Make the next hash and append it to the e... | 5 | stack_v2_sparse_classes_30k_train_004899 | Implement the Python class `Day14KeyGenerator` described below.
Class description:
Implement the Day14KeyGenerator class.
Method signatures and docstrings:
- def __init__(self, salt, stretched=False): Generate keys for communicating with santa. :param salt: salt for this instance :param stretched: if True, uses the '... | Implement the Python class `Day14KeyGenerator` described below.
Class description:
Implement the Day14KeyGenerator class.
Method signatures and docstrings:
- def __init__(self, salt, stretched=False): Generate keys for communicating with santa. :param salt: salt for this instance :param stretched: if True, uses the '... | 76e8b7100e6b98b9d2b094da04f6fdaecc8e6a5a | <|skeleton|>
class Day14KeyGenerator:
def __init__(self, salt, stretched=False):
"""Generate keys for communicating with santa. :param salt: salt for this instance :param stretched: if True, uses the 'stretched' hashing form"""
<|body_0|>
def generate_next_hash(self):
"""Make the next ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Day14KeyGenerator:
def __init__(self, salt, stretched=False):
"""Generate keys for communicating with santa. :param salt: salt for this instance :param stretched: if True, uses the 'stretched' hashing form"""
self.salt = salt
self.stretched = stretched
self.hashes = []
... | the_stack_v2_python_sparse | Day14/day14.py | wuggy-ianw/AdventOfCode2016-py | train | 0 | |
bcc358094a016a98f25bf144ecaf755352a67e8d | [
"results = {}\nfor uuid, channel in self.items():\n if not channel.exists():\n continue\n results.update({uuid: channel})\nreturn results",
"results = {}\nfor uuid, channel in self.items():\n if channel.exists():\n continue\n results.update({uuid: channel})\nreturn results"
] | <|body_start_0|>
results = {}
for uuid, channel in self.items():
if not channel.exists():
continue
results.update({uuid: channel})
return results
<|end_body_0|>
<|body_start_1|>
results = {}
for uuid, channel in self.items():
i... | Channels | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Channels:
def active(self):
"""Returns a new dictionary populated only with channels that DO currently exist in FreeSWITCH."""
<|body_0|>
def inactive(self):
"""Returns a new dictionary populated only with channels that DO NOT currently exist in FreeSWITCH. (These ch... | stack_v2_sparse_classes_75kplus_train_068958 | 1,438 | no_license | [
{
"docstring": "Returns a new dictionary populated only with channels that DO currently exist in FreeSWITCH.",
"name": "active",
"signature": "def active(self)"
},
{
"docstring": "Returns a new dictionary populated only with channels that DO NOT currently exist in FreeSWITCH. (These channels exi... | 2 | stack_v2_sparse_classes_30k_train_042744 | Implement the Python class `Channels` described below.
Class description:
Implement the Channels class.
Method signatures and docstrings:
- def active(self): Returns a new dictionary populated only with channels that DO currently exist in FreeSWITCH.
- def inactive(self): Returns a new dictionary populated only with ... | Implement the Python class `Channels` described below.
Class description:
Implement the Channels class.
Method signatures and docstrings:
- def active(self): Returns a new dictionary populated only with channels that DO currently exist in FreeSWITCH.
- def inactive(self): Returns a new dictionary populated only with ... | c40e76c6aee2d93f7e9af07fe8daca91a4d317b8 | <|skeleton|>
class Channels:
def active(self):
"""Returns a new dictionary populated only with channels that DO currently exist in FreeSWITCH."""
<|body_0|>
def inactive(self):
"""Returns a new dictionary populated only with channels that DO NOT currently exist in FreeSWITCH. (These ch... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Channels:
def active(self):
"""Returns a new dictionary populated only with channels that DO currently exist in FreeSWITCH."""
results = {}
for uuid, channel in self.items():
if not channel.exists():
continue
results.update({uuid: channel})
... | the_stack_v2_python_sparse | parseltone/api/base.py | Izeni/ParselTONE | train | 1 | |
ec62f4f11a44ef8f8b4e6e1ba29d659eda30f52d | [
"future_question = create_question(question_text='Future Question', days=5)\nurl = reverse('polls:detail', args=(future_question.id,))\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 404)",
"past_question = create_question(question_text='Past Question.', days=-12)\nurl = reverse('polls:de... | <|body_start_0|>
future_question = create_question(question_text='Future Question', days=5)
url = reverse('polls:detail', args=(future_question.id,))
response = self.client.get(url)
self.assertEqual(response.status_code, 404)
<|end_body_0|>
<|body_start_1|>
past_question = creat... | QuestionDetailViewTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionDetailViewTests:
def test_future_question(self):
"""Questions in the future are not accessible by know urls"""
<|body_0|>
def test_past_question(self):
"""Questions in the past are shown correctly"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_068959 | 5,301 | no_license | [
{
"docstring": "Questions in the future are not accessible by know urls",
"name": "test_future_question",
"signature": "def test_future_question(self)"
},
{
"docstring": "Questions in the past are shown correctly",
"name": "test_past_question",
"signature": "def test_past_question(self)"... | 2 | stack_v2_sparse_classes_30k_train_002583 | Implement the Python class `QuestionDetailViewTests` described below.
Class description:
Implement the QuestionDetailViewTests class.
Method signatures and docstrings:
- def test_future_question(self): Questions in the future are not accessible by know urls
- def test_past_question(self): Questions in the past are sh... | Implement the Python class `QuestionDetailViewTests` described below.
Class description:
Implement the QuestionDetailViewTests class.
Method signatures and docstrings:
- def test_future_question(self): Questions in the future are not accessible by know urls
- def test_past_question(self): Questions in the past are sh... | b23491ae91be4fdd86d667c8d5b59020777181a5 | <|skeleton|>
class QuestionDetailViewTests:
def test_future_question(self):
"""Questions in the future are not accessible by know urls"""
<|body_0|>
def test_past_question(self):
"""Questions in the past are shown correctly"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuestionDetailViewTests:
def test_future_question(self):
"""Questions in the future are not accessible by know urls"""
future_question = create_question(question_text='Future Question', days=5)
url = reverse('polls:detail', args=(future_question.id,))
response = self.client.get... | the_stack_v2_python_sparse | python/Django/mysite/polls/tests.py | tkhunlertkit/Sketches | train | 0 | |
577d1948a9c3c7af5b3eb94ae9e7118cf9f120c9 | [
"created = None\npatient_ids = []\nupdated = datetime.now()\nif 'mme_submission' in case_obj and case_obj['mme_submission']:\n created = case_obj['mme_submission']['created_at']\nelse:\n created = updated\npatients = [resp['patient'] for resp in mme_subm_obj.get('server_responses')]\nsubm_obj = {'created_at':... | <|body_start_0|>
created = None
patient_ids = []
updated = datetime.now()
if 'mme_submission' in case_obj and case_obj['mme_submission']:
created = case_obj['mme_submission']['created_at']
else:
created = updated
patients = [resp['patient'] for res... | Class to handle case submissions to MatchMaker Exchange | MMEHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MMEHandler:
"""Class to handle case submissions to MatchMaker Exchange"""
def case_mme_update(self, case_obj, user_obj, mme_subm_obj):
"""Updates a case after a submission to MatchMaker Exchange Args: case_obj(dict): a scout case object user_obj(dict): a scout user object mme_subm_ob... | stack_v2_sparse_classes_75kplus_train_068960 | 3,076 | permissive | [
{
"docstring": "Updates a case after a submission to MatchMaker Exchange Args: case_obj(dict): a scout case object user_obj(dict): a scout user object mme_subm_obj(dict): contains MME submission params and server response Returns: updated_case(dict): the updated scout case",
"name": "case_mme_update",
"... | 2 | stack_v2_sparse_classes_30k_train_022253 | Implement the Python class `MMEHandler` described below.
Class description:
Class to handle case submissions to MatchMaker Exchange
Method signatures and docstrings:
- def case_mme_update(self, case_obj, user_obj, mme_subm_obj): Updates a case after a submission to MatchMaker Exchange Args: case_obj(dict): a scout ca... | Implement the Python class `MMEHandler` described below.
Class description:
Class to handle case submissions to MatchMaker Exchange
Method signatures and docstrings:
- def case_mme_update(self, case_obj, user_obj, mme_subm_obj): Updates a case after a submission to MatchMaker Exchange Args: case_obj(dict): a scout ca... | c9b3ec14f5105abe6066337110145a263320b4c5 | <|skeleton|>
class MMEHandler:
"""Class to handle case submissions to MatchMaker Exchange"""
def case_mme_update(self, case_obj, user_obj, mme_subm_obj):
"""Updates a case after a submission to MatchMaker Exchange Args: case_obj(dict): a scout case object user_obj(dict): a scout user object mme_subm_ob... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MMEHandler:
"""Class to handle case submissions to MatchMaker Exchange"""
def case_mme_update(self, case_obj, user_obj, mme_subm_obj):
"""Updates a case after a submission to MatchMaker Exchange Args: case_obj(dict): a scout case object user_obj(dict): a scout user object mme_subm_obj(dict): cont... | the_stack_v2_python_sparse | scout/adapter/mongo/matchmaker.py | tapaswenipathak/scout | train | 1 |
48dc73a1646dd8958b523ee088855d8c80f4c7d4 | [
"if index is None:\n index = 0\nif default is None:\n default = self._get_paths(include_application=True, include_pyrin=True)\nsuper().__init__('input_paths', index, default=default, **options)",
"include_application = options.get('include_app', False)\ninclude_pyrin = options.get('include_pyrin', False)\np... | <|body_start_0|>
if index is None:
index = 0
if default is None:
default = self._get_paths(include_application=True, include_pyrin=True)
super().__init__('input_paths', index, default=default, **options)
<|end_body_0|>
<|body_start_1|>
include_application = optio... | input paths param class. | InputPathsParam | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InputPathsParam:
"""input paths param class."""
def __init__(self, index=None, default=None, **options):
"""initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: defaul... | stack_v2_sparse_classes_75kplus_train_068961 | 27,683 | permissive | [
{
"docstring": "initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: default value to be emitted to cli if this param is not available. if set to None, this param will not be emitted at all. defa... | 3 | stack_v2_sparse_classes_30k_train_044249 | Implement the Python class `InputPathsParam` described below.
Class description:
input paths param class.
Method signatures and docstrings:
- def __init__(self, index=None, default=None, **options): initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. def... | Implement the Python class `InputPathsParam` described below.
Class description:
input paths param class.
Method signatures and docstrings:
- def __init__(self, index=None, default=None, **options): initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. def... | 9d4776498225de4f3d16a4600b5b19212abe8562 | <|skeleton|>
class InputPathsParam:
"""input paths param class."""
def __init__(self, index=None, default=None, **options):
"""initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: defaul... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InputPathsParam:
"""input paths param class."""
def __init__(self, index=None, default=None, **options):
"""initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: default value to be... | the_stack_v2_python_sparse | src/pyrin/globalization/locale/babel/handlers/params.py | mononobi/pyrin | train | 20 |
1dbef5af8997da20911f8714ccf6e6613fe0db66 | [
"_url_path = '/ComboData/OtherInsuranceTypes'\n_query_builder = Configuration.get_base_uri()\n_query_builder += _url_path\n_query_parameters = {'subDomain': sub_domain}\n_query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_parameters, Configuration.array_serialization)\n_query_url = AP... | <|body_start_0|>
_url_path = '/ComboData/OtherInsuranceTypes'
_query_builder = Configuration.get_base_uri()
_query_builder += _url_path
_query_parameters = {'subDomain': sub_domain}
_query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_parameters, Con... | A Controller to access Endpoints in the easybimehlanding API. | OtherInsuranceTypesController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OtherInsuranceTypesController:
"""A Controller to access Endpoints in the easybimehlanding API."""
def get_other_insurance_types(self, sub_domain, x_api_key):
"""Does a GET request to /ComboData/OtherInsuranceTypes. دریافت لیست سایر بیمه نامه ها Args: sub_domain (string): دامنه یا زی... | stack_v2_sparse_classes_75kplus_train_068962 | 7,140 | permissive | [
{
"docstring": "Does a GET request to /ComboData/OtherInsuranceTypes. دریافت لیست سایر بیمه نامه ها Args: sub_domain (string): دامنه یا زیر دامنه ی مرکز بیمه x_api_key (string): کلید اختصاصی ارتباط با سرور Returns: OtherInsuranceTypes: Response from the API. Raises: APIException: When an error occurs while fetc... | 3 | stack_v2_sparse_classes_30k_train_015003 | Implement the Python class `OtherInsuranceTypesController` described below.
Class description:
A Controller to access Endpoints in the easybimehlanding API.
Method signatures and docstrings:
- def get_other_insurance_types(self, sub_domain, x_api_key): Does a GET request to /ComboData/OtherInsuranceTypes. دریافت لیست... | Implement the Python class `OtherInsuranceTypesController` described below.
Class description:
A Controller to access Endpoints in the easybimehlanding API.
Method signatures and docstrings:
- def get_other_insurance_types(self, sub_domain, x_api_key): Does a GET request to /ComboData/OtherInsuranceTypes. دریافت لیست... | b574a76a8805b306a423229b572c36dae0159def | <|skeleton|>
class OtherInsuranceTypesController:
"""A Controller to access Endpoints in the easybimehlanding API."""
def get_other_insurance_types(self, sub_domain, x_api_key):
"""Does a GET request to /ComboData/OtherInsuranceTypes. دریافت لیست سایر بیمه نامه ها Args: sub_domain (string): دامنه یا زی... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OtherInsuranceTypesController:
"""A Controller to access Endpoints in the easybimehlanding API."""
def get_other_insurance_types(self, sub_domain, x_api_key):
"""Does a GET request to /ComboData/OtherInsuranceTypes. دریافت لیست سایر بیمه نامه ها Args: sub_domain (string): دامنه یا زیر دامنه ی مرک... | the_stack_v2_python_sparse | easybimehlanding/controllers/other_insurance_types_controller.py | kmelodi/EasyBimehLanding_Python | train | 0 |
a5299c3869ba6d74acbb624bd34efe3c6dae0847 | [
"super().__init__(remote, name, signature, labels, beam, lengths_key, inputs, version, return_labels)\nurl = urlparse(self.remote)\nif len(url.netloc.split(':')) != 2:\n raise ValueError('remote has to have the form <host_name>:<port>')\nself.hostname, self.port = url.netloc.split(':')\nv_str = '/versions/{}'.fo... | <|body_start_0|>
super().__init__(remote, name, signature, labels, beam, lengths_key, inputs, version, return_labels)
url = urlparse(self.remote)
if len(url.netloc.split(':')) != 2:
raise ValueError('remote has to have the form <host_name>:<port>')
self.hostname, self.port = ... | RemoteModelREST | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteModelREST:
def __init__(self, remote, name, signature, labels=None, beam=None, lengths_key=None, inputs=None, version=None, return_labels=None):
"""A remote model with REST transport :param remote: The remote endpoint :param name: The name of the model :param signature: The model s... | stack_v2_sparse_classes_75kplus_train_068963 | 16,269 | permissive | [
{
"docstring": "A remote model with REST transport :param remote: The remote endpoint :param name: The name of the model :param signature: The model signature :param labels: The labels (defaults to None) :param beam: The beam width (defaults to None) :param lengths_key: Which key is used for the length of the i... | 2 | stack_v2_sparse_classes_30k_train_039965 | Implement the Python class `RemoteModelREST` described below.
Class description:
Implement the RemoteModelREST class.
Method signatures and docstrings:
- def __init__(self, remote, name, signature, labels=None, beam=None, lengths_key=None, inputs=None, version=None, return_labels=None): A remote model with REST trans... | Implement the Python class `RemoteModelREST` described below.
Class description:
Implement the RemoteModelREST class.
Method signatures and docstrings:
- def __init__(self, remote, name, signature, labels=None, beam=None, lengths_key=None, inputs=None, version=None, return_labels=None): A remote model with REST trans... | 4ad4147d4a88a42b309c6784a95b0b9f1faa2c60 | <|skeleton|>
class RemoteModelREST:
def __init__(self, remote, name, signature, labels=None, beam=None, lengths_key=None, inputs=None, version=None, return_labels=None):
"""A remote model with REST transport :param remote: The remote endpoint :param name: The name of the model :param signature: The model s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RemoteModelREST:
def __init__(self, remote, name, signature, labels=None, beam=None, lengths_key=None, inputs=None, version=None, return_labels=None):
"""A remote model with REST transport :param remote: The remote endpoint :param name: The name of the model :param signature: The model signature :para... | the_stack_v2_python_sparse | baseline/remote.py | blester125/baseline | train | 1 | |
0a48e14b6b283b777b9041049549529b10dbbe1d | [
"credentials = api_helpers.get_delegated_credential(global_configs.get('domain_super_admin_email'), REQUIRED_SCOPES)\nmax_calls, quota_period = api_helpers.get_ratelimiter_config(global_configs, API_NAME)\nself.repository = AdminDirectoryRepositoryClient(credentials=credentials, quota_max_calls=max_calls, quota_per... | <|body_start_0|>
credentials = api_helpers.get_delegated_credential(global_configs.get('domain_super_admin_email'), REQUIRED_SCOPES)
max_calls, quota_period = api_helpers.get_ratelimiter_config(global_configs, API_NAME)
self.repository = AdminDirectoryRepositoryClient(credentials=credentials, qu... | GSuite Admin Directory API Client. | AdminDirectoryClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdminDirectoryClient:
"""GSuite Admin Directory API Client."""
def __init__(self, global_configs, **kwargs):
"""Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs."""
<|body_0|>
def get_group_members(self, group_key):
"""G... | stack_v2_sparse_classes_75kplus_train_068964 | 9,750 | permissive | [
{
"docstring": "Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs.",
"name": "__init__",
"signature": "def __init__(self, global_configs, **kwargs)"
},
{
"docstring": "Get all the members for specified groups. Args: group_key (str): The group's unique id... | 4 | stack_v2_sparse_classes_30k_train_008585 | Implement the Python class `AdminDirectoryClient` described below.
Class description:
GSuite Admin Directory API Client.
Method signatures and docstrings:
- def __init__(self, global_configs, **kwargs): Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs.
- def get_group_member... | Implement the Python class `AdminDirectoryClient` described below.
Class description:
GSuite Admin Directory API Client.
Method signatures and docstrings:
- def __init__(self, global_configs, **kwargs): Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs.
- def get_group_member... | d4421afa50a17ed47cbebe942044ebab3720e0f5 | <|skeleton|>
class AdminDirectoryClient:
"""GSuite Admin Directory API Client."""
def __init__(self, global_configs, **kwargs):
"""Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs."""
<|body_0|>
def get_group_members(self, group_key):
"""G... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdminDirectoryClient:
"""GSuite Admin Directory API Client."""
def __init__(self, global_configs, **kwargs):
"""Initialize. Args: global_configs (dict): Global configurations. **kwargs (dict): The kwargs."""
credentials = api_helpers.get_delegated_credential(global_configs.get('domain_sup... | the_stack_v2_python_sparse | google/cloud/forseti/common/gcp_api/admin_directory.py | kevensen/forseti-security | train | 1 |
65de3a1e42d81b895f4b65d6dbb22d0b1213d6fa | [
"COND_AND_PRACT_TYPE = ((CP_PracticeType.check_incorrect_problems, custom_practice.data.PRACT_TYPES[0]), (CP_PracticeType.check_high_error_tables, custom_practice.data.PRACT_TYPES[1]), (CP_PracticeType.check_high_err_z_score, custom_practice.data.PRACT_TYPES[2]))\nfor i in range(len(COND_AND_PRACT_TYPE)):\n if i... | <|body_start_0|>
COND_AND_PRACT_TYPE = ((CP_PracticeType.check_incorrect_problems, custom_practice.data.PRACT_TYPES[0]), (CP_PracticeType.check_high_error_tables, custom_practice.data.PRACT_TYPES[1]), (CP_PracticeType.check_high_err_z_score, custom_practice.data.PRACT_TYPES[2]))
for i in range(len(COND_... | CP_PracticeType | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CP_PracticeType:
def get_practice_type(handler_input, allow_incorrect_problems: bool=False) -> str:
"""Returns string representing the type of practice for user. Loops through conditions and return practice type if true. Optional allow_incorrect_problems: bool parameter. This is used to ... | stack_v2_sparse_classes_75kplus_train_068965 | 4,490 | permissive | [
{
"docstring": "Returns string representing the type of practice for user. Loops through conditions and return practice type if true. Optional allow_incorrect_problems: bool parameter. This is used to skip check_incorrect_problems practice type.",
"name": "get_practice_type",
"signature": "def get_pract... | 5 | stack_v2_sparse_classes_30k_train_011133 | Implement the Python class `CP_PracticeType` described below.
Class description:
Implement the CP_PracticeType class.
Method signatures and docstrings:
- def get_practice_type(handler_input, allow_incorrect_problems: bool=False) -> str: Returns string representing the type of practice for user. Loops through conditio... | Implement the Python class `CP_PracticeType` described below.
Class description:
Implement the CP_PracticeType class.
Method signatures and docstrings:
- def get_practice_type(handler_input, allow_incorrect_problems: bool=False) -> str: Returns string representing the type of practice for user. Loops through conditio... | 1072dea1a5be0b339211ff39db6a89a90aca64c1 | <|skeleton|>
class CP_PracticeType:
def get_practice_type(handler_input, allow_incorrect_problems: bool=False) -> str:
"""Returns string representing the type of practice for user. Loops through conditions and return practice type if true. Optional allow_incorrect_problems: bool parameter. This is used to ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CP_PracticeType:
def get_practice_type(handler_input, allow_incorrect_problems: bool=False) -> str:
"""Returns string representing the type of practice for user. Loops through conditions and return practice type if true. Optional allow_incorrect_problems: bool parameter. This is used to skip check_inc... | the_stack_v2_python_sparse | 1_code/custom_practice/practice_type.py | jaimiles23/Multiplication-Medley | train | 0 | |
68b7e1d666c8e12f2128e3e382243f1bafa60ee0 | [
"super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length)\nself.velocities = dat.getVelocities(frame, *self.particles)\nself.vmin, self.vmax = amplogwidth(self.velocities)\ntry:\n self.vmin = np.log10(kwargs['vmin'])\nexcept (... | <|body_start_0|>
super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length)
self.velocities = dat.getVelocities(frame, *self.particles)
self.vmin, self.vmax = amplogwidth(self.velocities)
try:
... | Plotting class specific to 'velocity' mode. | Velocity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Velocity:
"""Plotting class specific to 'velocity' mode."""
def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs):
"""Initialises and plots f... | stack_v2_sparse_classes_75kplus_train_068966 | 24,676 | permissive | [
{
"docstring": "Initialises and plots figure. Parameters ---------- dat : active_work.read.Dat Data object. frame : int Frame to render. box_size : float Length of the square box to render. centre : 2-uple like Centre of the box to render. arrow_width : float Width of the arrows. arrow_head_width : float Width ... | 2 | stack_v2_sparse_classes_30k_train_040907 | Implement the Python class `Velocity` described below.
Class description:
Plotting class specific to 'velocity' mode.
Method signatures and docstrings:
- def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_l... | Implement the Python class `Velocity` described below.
Class description:
Plotting class specific to 'velocity' mode.
Method signatures and docstrings:
- def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_l... | 99107a0d4935296b673f67469c1e2bd258954b9b | <|skeleton|>
class Velocity:
"""Plotting class specific to 'velocity' mode."""
def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs):
"""Initialises and plots f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Velocity:
"""Plotting class specific to 'velocity' mode."""
def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs):
"""Initialises and plots figure. Parame... | the_stack_v2_python_sparse | frame.py | yketa/active_work | train | 1 |
f7a2847971c095843414657c8af2624005f0eaa4 | [
"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... | Missing associated documentation comment in .proto file. | IdentityServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentityServicer:
"""Missing associated documentation comment in .proto file."""
def ValidateToken(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def ValidateFileDownload(self, request, context):
"""Missing asso... | stack_v2_sparse_classes_75kplus_train_068967 | 7,201 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "ValidateToken",
"signature": "def ValidateToken(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "ValidateFileDownload",
"signature": "def Val... | 4 | stack_v2_sparse_classes_30k_train_030752 | Implement the Python class `IdentityServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def ValidateToken(self, request, context): Missing associated documentation comment in .proto file.
- def ValidateFileDownload(self, request, c... | Implement the Python class `IdentityServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def ValidateToken(self, request, context): Missing associated documentation comment in .proto file.
- def ValidateFileDownload(self, request, c... | 48546bfda83062a3fcb015d352fecb46346e8c92 | <|skeleton|>
class IdentityServicer:
"""Missing associated documentation comment in .proto file."""
def ValidateToken(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def ValidateFileDownload(self, request, context):
"""Missing asso... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IdentityServicer:
"""Missing associated documentation comment in .proto file."""
def ValidateToken(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')... | the_stack_v2_python_sparse | grpc-middleware/bidi-streaming/service/identity_pb2_grpc.py | amitsaha/python-grpc-demo | train | 145 |
88a6f458942c011f7ffdf69932ccff4bf75a8021 | [
"ans_dict = dict()\nfor num in nums:\n ans_dict[num] = ans_dict.get(num, 0) + 1\nreturn max(zip(ans_dict.values(), ans_dict.keys()))[1]",
"candidates = 0\ncount = 0\nfor num in nums:\n if count == 0:\n candidates = num\n count += 1 if candidates == num else -1\nreturn candidates"
] | <|body_start_0|>
ans_dict = dict()
for num in nums:
ans_dict[num] = ans_dict.get(num, 0) + 1
return max(zip(ans_dict.values(), ans_dict.keys()))[1]
<|end_body_0|>
<|body_start_1|>
candidates = 0
count = 0
for num in nums:
if count == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def majorityElement(self, nums: List[int]) -> int:
"""计数法,空间复杂度o(n)"""
<|body_0|>
def majorityElement1(self, nums: List[int]) -> int:
"""投票方式 :param nums: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans_dict = dict()
f... | stack_v2_sparse_classes_75kplus_train_068968 | 921 | no_license | [
{
"docstring": "计数法,空间复杂度o(n)",
"name": "majorityElement",
"signature": "def majorityElement(self, nums: List[int]) -> int"
},
{
"docstring": "投票方式 :param nums: :return:",
"name": "majorityElement1",
"signature": "def majorityElement1(self, nums: List[int]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_032455 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums: List[int]) -> int: 计数法,空间复杂度o(n)
- def majorityElement1(self, nums: List[int]) -> int: 投票方式 :param nums: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums: List[int]) -> int: 计数法,空间复杂度o(n)
- def majorityElement1(self, nums: List[int]) -> int: 投票方式 :param nums: :return:
<|skeleton|>
class Solution:
... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def majorityElement(self, nums: List[int]) -> int:
"""计数法,空间复杂度o(n)"""
<|body_0|>
def majorityElement1(self, nums: List[int]) -> int:
"""投票方式 :param nums: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def majorityElement(self, nums: List[int]) -> int:
"""计数法,空间复杂度o(n)"""
ans_dict = dict()
for num in nums:
ans_dict[num] = ans_dict.get(num, 0) + 1
return max(zip(ans_dict.values(), ans_dict.keys()))[1]
def majorityElement1(self, nums: List[int]) -> in... | the_stack_v2_python_sparse | Interview_preparation/tencent/MajorityElement.py | yinhuax/leet_code | train | 0 | |
b3da686604b9a13ab480f251b59cbcc2b1bea1d3 | [
"try:\n float(s)\nexcept ValueError:\n return False\nelse:\n return True",
"state = [{}, {'blank': 1, 'sign': 2, 'digit': 3, '.': 4}, {'digit': 3, '.': 4}, {'digit': 3, '.': 5, 'e': 6, 'blank': 9}, {'digit': 5}, {'digit': 5, 'e': 6, 'blank': 9}, {'sign': 7, 'digit': 8}, {'digit': 8}, {'digit': 8, 'blank'... | <|body_start_0|>
try:
float(s)
except ValueError:
return False
else:
return True
<|end_body_0|>
<|body_start_1|>
state = [{}, {'blank': 1, 'sign': 2, 'digit': 3, '.': 4}, {'digit': 3, '.': 4}, {'digit': 3, '.': 5, 'e': 6, 'blank': 9}, {'digit': 5}, {'... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isNumber(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isNumber2(self, s):
"""https://discuss.leetcode.com/topic/30058/a-simple-solution-in-python-based-on-dfa :param s: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_068969 | 1,800 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isNumber",
"signature": "def isNumber(self, s)"
},
{
"docstring": "https://discuss.leetcode.com/topic/30058/a-simple-solution-in-python-based-on-dfa :param s: :return:",
"name": "isNumber2",
"signature": "def isNumber2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_032011 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isNumber(self, s): :type s: str :rtype: bool
- def isNumber2(self, s): https://discuss.leetcode.com/topic/30058/a-simple-solution-in-python-based-on-dfa :param s: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isNumber(self, s): :type s: str :rtype: bool
- def isNumber2(self, s): https://discuss.leetcode.com/topic/30058/a-simple-solution-in-python-based-on-dfa :param s: :return:
<... | 2526f8c0dec7101123123740e146ee4081e979ee | <|skeleton|>
class Solution:
def isNumber(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isNumber2(self, s):
"""https://discuss.leetcode.com/topic/30058/a-simple-solution-in-python-based-on-dfa :param s: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isNumber(self, s):
""":type s: str :rtype: bool"""
try:
float(s)
except ValueError:
return False
else:
return True
def isNumber2(self, s):
"""https://discuss.leetcode.com/topic/30058/a-simple-solution-in-python-base... | the_stack_v2_python_sparse | 065. Valid Number.py | zhangpengGenedock/leetcode_python | train | 1 | |
5481fd6ba53d34fef5d5e2a53bec1b59c2ef8a32 | [
"if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = self.__nb_objects",
"if list_dictionaries is None:\n return '[]'\nelse:\n return json.dumps(list_dictionaries)",
"my_list = []\nif list_objs is not None:\n for objs in list_objs:\n my_list.append(objs.to_dict... | <|body_start_0|>
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
self.id = self.__nb_objects
<|end_body_0|>
<|body_start_1|>
if list_dictionaries is None:
return '[]'
else:
return json.dumps(list_dictionaries)
<|en... | Creating a base class. Note: This will manage the id attribute in all other classes and avoid duplicating the same code. Attributes: __nb_objects: private class attribute | Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base:
"""Creating a base class. Note: This will manage the id attribute in all other classes and avoid duplicating the same code. Attributes: __nb_objects: private class attribute"""
def __init__(self, id=None):
"""Using __init__ method. Note: If id is not None, assign id. If id is N... | stack_v2_sparse_classes_75kplus_train_068970 | 3,738 | no_license | [
{
"docstring": "Using __init__ method. Note: If id is not None, assign id. If id is None, increment __nb_objects and assign new value to id. Args: id: public instance attribute",
"name": "__init__",
"signature": "def __init__(self, id=None)"
},
{
"docstring": "Creating JSON string representation... | 6 | null | Implement the Python class `Base` described below.
Class description:
Creating a base class. Note: This will manage the id attribute in all other classes and avoid duplicating the same code. Attributes: __nb_objects: private class attribute
Method signatures and docstrings:
- def __init__(self, id=None): Using __init... | Implement the Python class `Base` described below.
Class description:
Creating a base class. Note: This will manage the id attribute in all other classes and avoid duplicating the same code. Attributes: __nb_objects: private class attribute
Method signatures and docstrings:
- def __init__(self, id=None): Using __init... | e0bbd66a1ccde948fe102cbbaa790f0a61319ab2 | <|skeleton|>
class Base:
"""Creating a base class. Note: This will manage the id attribute in all other classes and avoid duplicating the same code. Attributes: __nb_objects: private class attribute"""
def __init__(self, id=None):
"""Using __init__ method. Note: If id is not None, assign id. If id is N... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Base:
"""Creating a base class. Note: This will manage the id attribute in all other classes and avoid duplicating the same code. Attributes: __nb_objects: private class attribute"""
def __init__(self, id=None):
"""Using __init__ method. Note: If id is not None, assign id. If id is None, incremen... | the_stack_v2_python_sparse | 0x0C-python-almost_a_circle/models/base.py | jenntang1/holbertonschool-higher_level_programming | train | 0 |
fbf7c2ec8207f0f4f3e1a4fbde785d9f16fd6251 | [
"from .models import Filing\ncmte = self.get_committee(obj_or_id)\nfiling_list = Filing.real.by_committee(cmte)\nqs = self.get_queryset().filter(committee=cmte, filing__in=filing_list)\nreturn qs",
"from .models import Filing\ncmte = self.get_committee(obj_or_id)\nfiling_list = Filing.real.by_committee(cmte)\nqs ... | <|body_start_0|>
from .models import Filing
cmte = self.get_committee(obj_or_id)
filing_list = Filing.real.by_committee(cmte)
qs = self.get_queryset().filter(committee=cmte, filing__in=filing_list)
return qs
<|end_body_0|>
<|body_start_1|>
from .models import Filing
... | Only returns records that are not duplicates. | RealContributionManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RealContributionManager:
"""Only returns records that are not duplicates."""
def by_committee_to(self, obj_or_id):
"""Returns the "real" or valid contributions received by a particular committee."""
<|body_0|>
def by_committee_from(self, obj_or_id):
"""Returns th... | stack_v2_sparse_classes_75kplus_train_068971 | 4,937 | permissive | [
{
"docstring": "Returns the \"real\" or valid contributions received by a particular committee.",
"name": "by_committee_to",
"signature": "def by_committee_to(self, obj_or_id)"
},
{
"docstring": "Returns the \"real\" or valid contributions made by a particular committee.",
"name": "by_commit... | 2 | stack_v2_sparse_classes_30k_train_046041 | Implement the Python class `RealContributionManager` described below.
Class description:
Only returns records that are not duplicates.
Method signatures and docstrings:
- def by_committee_to(self, obj_or_id): Returns the "real" or valid contributions received by a particular committee.
- def by_committee_from(self, o... | Implement the Python class `RealContributionManager` described below.
Class description:
Only returns records that are not duplicates.
Method signatures and docstrings:
- def by_committee_to(self, obj_or_id): Returns the "real" or valid contributions received by a particular committee.
- def by_committee_from(self, o... | 69f7d6f1c64e45c85656af3003b1beed2fb55362 | <|skeleton|>
class RealContributionManager:
"""Only returns records that are not duplicates."""
def by_committee_to(self, obj_or_id):
"""Returns the "real" or valid contributions received by a particular committee."""
<|body_0|>
def by_committee_from(self, obj_or_id):
"""Returns th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RealContributionManager:
"""Only returns records that are not duplicates."""
def by_committee_to(self, obj_or_id):
"""Returns the "real" or valid contributions received by a particular committee."""
from .models import Filing
cmte = self.get_committee(obj_or_id)
filing_lis... | the_stack_v2_python_sparse | calaccess_campaign_browser/managers.py | livlab/django-calaccess-campaign-browser | train | 1 |
0cf1cb9a338cd5383b6517e138ec2ae033a02419 | [
"cubelist, self.cycletime = set_up_masked_cubes()\nmerger = MergeCubesForWeightedBlending('model_id', weighting_coord='forecast_period', model_id_attr='mosg__model_configuration')\nself.cube = merger.process(cubelist)\nself.plugin = WeightAndBlend('model_id', 'dict', weighting_coord='forecast_period', wts_dict=MODE... | <|body_start_0|>
cubelist, self.cycletime = set_up_masked_cubes()
merger = MergeCubesForWeightedBlending('model_id', weighting_coord='forecast_period', model_id_attr='mosg__model_configuration')
self.cube = merger.process(cubelist)
self.plugin = WeightAndBlend('model_id', 'dict', weighti... | Test the _update_spatial_weights method | Test__update_spatial_weights | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test__update_spatial_weights:
"""Test the _update_spatial_weights method"""
def setUp(self):
"""Set up cube and plugin"""
<|body_0|>
def test_basic(self):
"""Test function returns a cube of the expected shape"""
<|body_1|>
def test_values(self):
... | stack_v2_sparse_classes_75kplus_train_068972 | 30,096 | permissive | [
{
"docstring": "Set up cube and plugin",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test function returns a cube of the expected shape",
"name": "test_basic",
"signature": "def test_basic(self)"
},
{
"docstring": "Test weights are fuzzified as expected",
... | 3 | stack_v2_sparse_classes_30k_train_053992 | Implement the Python class `Test__update_spatial_weights` described below.
Class description:
Test the _update_spatial_weights method
Method signatures and docstrings:
- def setUp(self): Set up cube and plugin
- def test_basic(self): Test function returns a cube of the expected shape
- def test_values(self): Test wei... | Implement the Python class `Test__update_spatial_weights` described below.
Class description:
Test the _update_spatial_weights method
Method signatures and docstrings:
- def setUp(self): Set up cube and plugin
- def test_basic(self): Test function returns a cube of the expected shape
- def test_values(self): Test wei... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test__update_spatial_weights:
"""Test the _update_spatial_weights method"""
def setUp(self):
"""Set up cube and plugin"""
<|body_0|>
def test_basic(self):
"""Test function returns a cube of the expected shape"""
<|body_1|>
def test_values(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test__update_spatial_weights:
"""Test the _update_spatial_weights method"""
def setUp(self):
"""Set up cube and plugin"""
cubelist, self.cycletime = set_up_masked_cubes()
merger = MergeCubesForWeightedBlending('model_id', weighting_coord='forecast_period', model_id_attr='mosg__mod... | the_stack_v2_python_sparse | improver_tests/blending/calculate_weights_and_blend/test_WeightAndBlend.py | metoppv/improver | train | 101 |
9b6669348c7f9843d70cc19274bda6349adfcbdc | [
"if isinstance(key, int):\n return UpdateNotificationReason(key)\nif key not in UpdateNotificationReason._member_map_:\n return extend_enum(UpdateNotificationReason, key, default)\nreturn UpdateNotificationReason[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not... | <|body_start_0|>
if isinstance(key, int):
return UpdateNotificationReason(key)
if key not in UpdateNotificationReason._member_map_:
return extend_enum(UpdateNotificationReason, key, default)
return UpdateNotificationReason[key]
<|end_body_0|>
<|body_start_1|>
if ... | [UpdateNotificationReason] Update Notification Reasons Registry | UpdateNotificationReason | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateNotificationReason:
"""[UpdateNotificationReason] Update Notification Reasons Registry"""
def get(key: 'int | str', default: 'int'=-1) -> 'UpdateNotificationReason':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :m... | stack_v2_sparse_classes_75kplus_train_068973 | 2,499 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'UpdateNotificationReason'"
},
{
"docstring": "Lookup function used when value ... | 2 | stack_v2_sparse_classes_30k_train_046840 | Implement the Python class `UpdateNotificationReason` described below.
Class description:
[UpdateNotificationReason] Update Notification Reasons Registry
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'UpdateNotificationReason': Backport support for original codes. Args: key: Key ... | Implement the Python class `UpdateNotificationReason` described below.
Class description:
[UpdateNotificationReason] Update Notification Reasons Registry
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'UpdateNotificationReason': Backport support for original codes. Args: key: Key ... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class UpdateNotificationReason:
"""[UpdateNotificationReason] Update Notification Reasons Registry"""
def get(key: 'int | str', default: 'int'=-1) -> 'UpdateNotificationReason':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UpdateNotificationReason:
"""[UpdateNotificationReason] Update Notification Reasons Registry"""
def get(key: 'int | str', default: 'int'=-1) -> 'UpdateNotificationReason':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"... | the_stack_v2_python_sparse | pcapkit/const/mh/upn_reason.py | JarryShaw/PyPCAPKit | train | 204 |
87062b76c0b4f577b34a7bee36f33208215bf1e7 | [
"self.all_under_hierarchy = all_under_hierarchy\nself.bcc_recipient_addresses = bcc_recipient_addresses\nself.cc_recipient_addresses = cc_recipient_addresses\nself.directory_path = directory_path\nself.domain_ids = domain_ids\nself.email_subject = email_subject\nself.folder_key = folder_key\nself.folder_name = fold... | <|body_start_0|>
self.all_under_hierarchy = all_under_hierarchy
self.bcc_recipient_addresses = bcc_recipient_addresses
self.cc_recipient_addresses = cc_recipient_addresses
self.directory_path = directory_path
self.domain_ids = domain_ids
self.email_subject = email_subject... | Implementation of the 'EmailMetaData' model. Specifies details about the emails and the folder containing emails. Attributes: all_under_hierarchy (bool): AllUnderHierarchy specifies if logs of all the tenants under the hierarchy of tenant with id TenantId should be returned. bcc_recipient_addresses (list of string): Sp... | EmailMetaData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailMetaData:
"""Implementation of the 'EmailMetaData' model. Specifies details about the emails and the folder containing emails. Attributes: all_under_hierarchy (bool): AllUnderHierarchy specifies if logs of all the tenants under the hierarchy of tenant with id TenantId should be returned. bcc... | stack_v2_sparse_classes_75kplus_train_068974 | 7,774 | permissive | [
{
"docstring": "Constructor for the EmailMetaData class",
"name": "__init__",
"signature": "def __init__(self, all_under_hierarchy=None, bcc_recipient_addresses=None, cc_recipient_addresses=None, directory_path=None, domain_ids=None, email_subject=None, folder_key=None, folder_name=None, has_attachments... | 2 | stack_v2_sparse_classes_30k_train_045238 | Implement the Python class `EmailMetaData` described below.
Class description:
Implementation of the 'EmailMetaData' model. Specifies details about the emails and the folder containing emails. Attributes: all_under_hierarchy (bool): AllUnderHierarchy specifies if logs of all the tenants under the hierarchy of tenant w... | Implement the Python class `EmailMetaData` described below.
Class description:
Implementation of the 'EmailMetaData' model. Specifies details about the emails and the folder containing emails. Attributes: all_under_hierarchy (bool): AllUnderHierarchy specifies if logs of all the tenants under the hierarchy of tenant w... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class EmailMetaData:
"""Implementation of the 'EmailMetaData' model. Specifies details about the emails and the folder containing emails. Attributes: all_under_hierarchy (bool): AllUnderHierarchy specifies if logs of all the tenants under the hierarchy of tenant with id TenantId should be returned. bcc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmailMetaData:
"""Implementation of the 'EmailMetaData' model. Specifies details about the emails and the folder containing emails. Attributes: all_under_hierarchy (bool): AllUnderHierarchy specifies if logs of all the tenants under the hierarchy of tenant with id TenantId should be returned. bcc_recipient_ad... | the_stack_v2_python_sparse | cohesity_management_sdk/models/email_meta_data.py | cohesity/management-sdk-python | train | 24 |
e9058520b951c5bb41a7fe729112c84195916f8a | [
"user = request.user\nif is_superuser_or_manager(user):\n return super(ClientAdminConfig, self).get_queryset(request)\nreturn Client.objects.filter(Q(main_sales_contact=user) | Q(contracts__sales_contact=user) | Q(contracts__event__support_contact=user)).distinct()",
"if is_seller(request.user):\n return Tr... | <|body_start_0|>
user = request.user
if is_superuser_or_manager(user):
return super(ClientAdminConfig, self).get_queryset(request)
return Client.objects.filter(Q(main_sales_contact=user) | Q(contracts__sales_contact=user) | Q(contracts__event__support_contact=user)).distinct()
<|end_... | Set view and CRUD permissions over the Client module for an authenticated user in the admin page. A superuser or a manager has all permissions. Any seller can create (add) a client but only the main sales contact (main seller of this client) can update and delete this client. | ClientAdminConfig | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientAdminConfig:
"""Set view and CRUD permissions over the Client module for an authenticated user in the admin page. A superuser or a manager has all permissions. Any seller can create (add) a client but only the main sales contact (main seller of this client) can update and delete this client... | stack_v2_sparse_classes_75kplus_train_068975 | 2,874 | no_license | [
{
"docstring": "Sellers, supporters can see theirs own clients.",
"name": "get_queryset",
"signature": "def get_queryset(self, request)"
},
{
"docstring": "Superuser, member of Managers group or Sellers group can add a client.",
"name": "has_add_permission",
"signature": "def has_add_per... | 6 | stack_v2_sparse_classes_30k_val_001354 | Implement the Python class `ClientAdminConfig` described below.
Class description:
Set view and CRUD permissions over the Client module for an authenticated user in the admin page. A superuser or a manager has all permissions. Any seller can create (add) a client but only the main sales contact (main seller of this cl... | Implement the Python class `ClientAdminConfig` described below.
Class description:
Set view and CRUD permissions over the Client module for an authenticated user in the admin page. A superuser or a manager has all permissions. Any seller can create (add) a client but only the main sales contact (main seller of this cl... | 50c9de9cbc5f11409b6eac211503491f72e21348 | <|skeleton|>
class ClientAdminConfig:
"""Set view and CRUD permissions over the Client module for an authenticated user in the admin page. A superuser or a manager has all permissions. Any seller can create (add) a client but only the main sales contact (main seller of this client) can update and delete this client... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClientAdminConfig:
"""Set view and CRUD permissions over the Client module for an authenticated user in the admin page. A superuser or a manager has all permissions. Any seller can create (add) a client but only the main sales contact (main seller of this client) can update and delete this client."""
def... | the_stack_v2_python_sparse | epicevents_project/events/admin_config/client_admin_config.py | ThiHieuLUU/OCProject12_Event_Management_with_DjangoREST | train | 0 |
707b3658ef827c8ed12566494a32c0fa8c7e7dc5 | [
"for factory in self.pyre_factories():\n factory.pyre_make(**kwds)\nreturn",
"outputs = {product for factory in self.pyre_factories() for product, _ in factory.pyre_outputs() if product is not None}\nfor factory in self.pyre_factories():\n for product, meta in factory.pyre_inputs():\n if product in o... | <|body_start_0|>
for factory in self.pyre_factories():
factory.pyre_make(**kwds)
return
<|end_body_0|>
<|body_start_1|>
outputs = {product for factory in self.pyre_factories() for product, _ in factory.pyre_outputs() if product is not None}
for factory in self.pyre_factories... | A container of flow products and factories | Workflow | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Workflow:
"""A container of flow products and factories"""
def pyre_make(self, **kwds):
"""Invoke this workflow"""
<|body_0|>
def pyre_inputs(self):
"""Generate the sequence of my input products"""
<|body_1|>
def pyre_outputs(self):
"""Genera... | stack_v2_sparse_classes_75kplus_train_068976 | 2,952 | permissive | [
{
"docstring": "Invoke this workflow",
"name": "pyre_make",
"signature": "def pyre_make(self, **kwds)"
},
{
"docstring": "Generate the sequence of my input products",
"name": "pyre_inputs",
"signature": "def pyre_inputs(self)"
},
{
"docstring": "Generate the sequence of my output... | 4 | stack_v2_sparse_classes_30k_train_012759 | Implement the Python class `Workflow` described below.
Class description:
A container of flow products and factories
Method signatures and docstrings:
- def pyre_make(self, **kwds): Invoke this workflow
- def pyre_inputs(self): Generate the sequence of my input products
- def pyre_outputs(self): Generate the sequence... | Implement the Python class `Workflow` described below.
Class description:
A container of flow products and factories
Method signatures and docstrings:
- def pyre_make(self, **kwds): Invoke this workflow
- def pyre_inputs(self): Generate the sequence of my input products
- def pyre_outputs(self): Generate the sequence... | d741c44ffb3e9e1f726bf492202ac8738bb4aa1c | <|skeleton|>
class Workflow:
"""A container of flow products and factories"""
def pyre_make(self, **kwds):
"""Invoke this workflow"""
<|body_0|>
def pyre_inputs(self):
"""Generate the sequence of my input products"""
<|body_1|>
def pyre_outputs(self):
"""Genera... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Workflow:
"""A container of flow products and factories"""
def pyre_make(self, **kwds):
"""Invoke this workflow"""
for factory in self.pyre_factories():
factory.pyre_make(**kwds)
return
def pyre_inputs(self):
"""Generate the sequence of my input products""... | the_stack_v2_python_sparse | packages/pyre/flow/Workflow.py | pyre/pyre | train | 27 |
819816c45841713c2c480874b96abf0cfe25ff3b | [
"self.optimizers = []\nself.sample_x = []\nself.sample_y = []\nself.best_y = []\nself.pending_x = []\nself.next_optim = 0\nself.num_optim = len(optim_list)\nself.path = save_path\nself.save_each_iter = save_each_iter\nself.__create_optimizers(optim_list, acq_func_list, h_space, num_init_rand)",
"for algo_name in ... | <|body_start_0|>
self.optimizers = []
self.sample_x = []
self.sample_y = []
self.best_y = []
self.pending_x = []
self.next_optim = 0
self.num_optim = len(optim_list)
self.path = save_path
self.save_each_iter = save_each_iter
self.__create_o... | Manager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Manager:
def __init__(self, optim_list, acq_func_list, h_space, num_init_rand, save_path='', save_each_iter=False):
"""The Manager constructor :param optim_list: A list of optimizer algorithm to instantiate :param acq_func_list: A list of acquisition function that will be used the optimi... | stack_v2_sparse_classes_75kplus_train_068977 | 5,707 | no_license | [
{
"docstring": "The Manager constructor :param optim_list: A list of optimizer algorithm to instantiate :param acq_func_list: A list of acquisition function that will be used the optimizer of type gaussian process :param h_space: The hyperparameters space that will be used by each optimizer to construct the sur... | 5 | stack_v2_sparse_classes_30k_train_049882 | Implement the Python class `Manager` described below.
Class description:
Implement the Manager class.
Method signatures and docstrings:
- def __init__(self, optim_list, acq_func_list, h_space, num_init_rand, save_path='', save_each_iter=False): The Manager constructor :param optim_list: A list of optimizer algorithm ... | Implement the Python class `Manager` described below.
Class description:
Implement the Manager class.
Method signatures and docstrings:
- def __init__(self, optim_list, acq_func_list, h_space, num_init_rand, save_path='', save_each_iter=False): The Manager constructor :param optim_list: A list of optimizer algorithm ... | 45057f45b1397db429a0ed7f7ee5b3edbf1c1728 | <|skeleton|>
class Manager:
def __init__(self, optim_list, acq_func_list, h_space, num_init_rand, save_path='', save_each_iter=False):
"""The Manager constructor :param optim_list: A list of optimizer algorithm to instantiate :param acq_func_list: A list of acquisition function that will be used the optimi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Manager:
def __init__(self, optim_list, acq_func_list, h_space, num_init_rand, save_path='', save_each_iter=False):
"""The Manager constructor :param optim_list: A list of optimizer algorithm to instantiate :param acq_func_list: A list of acquisition function that will be used the optimizer of type ga... | the_stack_v2_python_sparse | Scheduler/Manager.py | AleAyotte/HyperPara | train | 6 | |
14f1305595bee52bc2180eae2d90ee884eb1d177 | [
"self.loadbalancer = health_monitor.pool.loadbalancer\nself.api_dict = health_monitor.to_dict(pool=False)\nself._call_rpc(context, health_monitor, 'create_health_monitor')",
"driver = self.driver\nself.loadbalancer = health_monitor.pool.loadbalancer\ntry:\n agent_host, service = self._setup_crud(context, healt... | <|body_start_0|>
self.loadbalancer = health_monitor.pool.loadbalancer
self.api_dict = health_monitor.to_dict(pool=False)
self._call_rpc(context, health_monitor, 'create_health_monitor')
<|end_body_0|>
<|body_start_1|>
driver = self.driver
self.loadbalancer = health_monitor.pool.... | HealthMonitorManager class handles Neutron LBaaS monitor CRUD. | HealthMonitorManager | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HealthMonitorManager:
"""HealthMonitorManager class handles Neutron LBaaS monitor CRUD."""
def create(self, context, health_monitor):
"""Create a health monitor."""
<|body_0|>
def update(self, context, old_health_monitor, health_monitor):
"""Update a health monit... | stack_v2_sparse_classes_75kplus_train_068978 | 19,579 | permissive | [
{
"docstring": "Create a health monitor.",
"name": "create",
"signature": "def create(self, context, health_monitor)"
},
{
"docstring": "Update a health monitor.",
"name": "update",
"signature": "def update(self, context, old_health_monitor, health_monitor)"
},
{
"docstring": "De... | 3 | stack_v2_sparse_classes_30k_train_044729 | Implement the Python class `HealthMonitorManager` described below.
Class description:
HealthMonitorManager class handles Neutron LBaaS monitor CRUD.
Method signatures and docstrings:
- def create(self, context, health_monitor): Create a health monitor.
- def update(self, context, old_health_monitor, health_monitor): ... | Implement the Python class `HealthMonitorManager` described below.
Class description:
HealthMonitorManager class handles Neutron LBaaS monitor CRUD.
Method signatures and docstrings:
- def create(self, context, health_monitor): Create a health monitor.
- def update(self, context, old_health_monitor, health_monitor): ... | 923f085dc71540a1399d439098081fe6cf2c82df | <|skeleton|>
class HealthMonitorManager:
"""HealthMonitorManager class handles Neutron LBaaS monitor CRUD."""
def create(self, context, health_monitor):
"""Create a health monitor."""
<|body_0|>
def update(self, context, old_health_monitor, health_monitor):
"""Update a health monit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HealthMonitorManager:
"""HealthMonitorManager class handles Neutron LBaaS monitor CRUD."""
def create(self, context, health_monitor):
"""Create a health monitor."""
self.loadbalancer = health_monitor.pool.loadbalancer
self.api_dict = health_monitor.to_dict(pool=False)
self... | the_stack_v2_python_sparse | f5lbaasdriver/v2/bigip/driver_v2.py | sapcc/f5-openstack-lbaasv2-driver | train | 1 |
601ba2bdebd6037995f3fc07a4ced019fba902ec | [
"if filename == cls._configs[0]:\n return cls.generateBirdConf(node, services)\nelse:\n raise ValueError",
"for ifc in node.netifs():\n if hasattr(ifc, 'control') and ifc.control == True:\n continue\n for a in ifc.addrlist:\n if a.find('.') >= 0:\n return a.split('/')[0]\nretu... | <|body_start_0|>
if filename == cls._configs[0]:
return cls.generateBirdConf(node, services)
else:
raise ValueError
<|end_body_0|>
<|body_start_1|>
for ifc in node.netifs():
if hasattr(ifc, 'control') and ifc.control == True:
continue
... | Bird router support | Bird | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bird:
"""Bird router support"""
def generateconfig(cls, node, filename, services):
"""Return the bird.conf file contents."""
<|body_0|>
def routerid(node):
"""Helper to return the first IPv4 address of a node as its router ID."""
<|body_1|>
def gener... | stack_v2_sparse_classes_75kplus_train_068979 | 7,179 | permissive | [
{
"docstring": "Return the bird.conf file contents.",
"name": "generateconfig",
"signature": "def generateconfig(cls, node, filename, services)"
},
{
"docstring": "Helper to return the first IPv4 address of a node as its router ID.",
"name": "routerid",
"signature": "def routerid(node)"
... | 3 | stack_v2_sparse_classes_30k_train_003525 | Implement the Python class `Bird` described below.
Class description:
Bird router support
Method signatures and docstrings:
- def generateconfig(cls, node, filename, services): Return the bird.conf file contents.
- def routerid(node): Helper to return the first IPv4 address of a node as its router ID.
- def generateB... | Implement the Python class `Bird` described below.
Class description:
Bird router support
Method signatures and docstrings:
- def generateconfig(cls, node, filename, services): Return the bird.conf file contents.
- def routerid(node): Helper to return the first IPv4 address of a node as its router ID.
- def generateB... | 9c246b0ae0e9182dcf61acc4faee41841d5cbd51 | <|skeleton|>
class Bird:
"""Bird router support"""
def generateconfig(cls, node, filename, services):
"""Return the bird.conf file contents."""
<|body_0|>
def routerid(node):
"""Helper to return the first IPv4 address of a node as its router ID."""
<|body_1|>
def gener... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Bird:
"""Bird router support"""
def generateconfig(cls, node, filename, services):
"""Return the bird.conf file contents."""
if filename == cls._configs[0]:
return cls.generateBirdConf(node, services)
else:
raise ValueError
def routerid(node):
... | the_stack_v2_python_sparse | coreemu-read-only/daemon/core/services/bird.py | ermin-sakic/common-open-research-emulator-CORE | train | 3 |
19f1fd2f3ffb66de5e6afa4b04cfb09280008422 | [
"ngram2count = dict()\ntokens = re.split('\\\\s', text)\nfor order in range(startOrder, maxOrder + 1):\n for token in tokens:\n token = '_' + token + '_'\n for i in range(len(token) - order + 1):\n ngram = token[i:i + order]\n if not cls.NGRAM_PATTERN.match(ngram):\n ... | <|body_start_0|>
ngram2count = dict()
tokens = re.split('\\s', text)
for order in range(startOrder, maxOrder + 1):
for token in tokens:
token = '_' + token + '_'
for i in range(len(token) - order + 1):
ngram = token[i:i + order]
... | Some convenient string utilities. | SimilarityUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimilarityUtils:
"""Some convenient string utilities."""
def computeNGrams(cls, startOrder, maxOrder, text):
"""Compute N Grams. @param startOrder @param maxOrder @param text @return a n gram to frequency map."""
<|body_0|>
def computeWord2count(text):
"""Calcula... | stack_v2_sparse_classes_75kplus_train_068980 | 4,522 | no_license | [
{
"docstring": "Compute N Grams. @param startOrder @param maxOrder @param text @return a n gram to frequency map.",
"name": "computeNGrams",
"signature": "def computeNGrams(cls, startOrder, maxOrder, text)"
},
{
"docstring": "Calculate word frequency. @param text a text to process @return a map ... | 6 | stack_v2_sparse_classes_30k_train_045727 | Implement the Python class `SimilarityUtils` described below.
Class description:
Some convenient string utilities.
Method signatures and docstrings:
- def computeNGrams(cls, startOrder, maxOrder, text): Compute N Grams. @param startOrder @param maxOrder @param text @return a n gram to frequency map.
- def computeWord... | Implement the Python class `SimilarityUtils` described below.
Class description:
Some convenient string utilities.
Method signatures and docstrings:
- def computeNGrams(cls, startOrder, maxOrder, text): Compute N Grams. @param startOrder @param maxOrder @param text @return a n gram to frequency map.
- def computeWord... | 58e12957dee8b4b18127df9daeb8825d8ada7923 | <|skeleton|>
class SimilarityUtils:
"""Some convenient string utilities."""
def computeNGrams(cls, startOrder, maxOrder, text):
"""Compute N Grams. @param startOrder @param maxOrder @param text @return a n gram to frequency map."""
<|body_0|>
def computeWord2count(text):
"""Calcula... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SimilarityUtils:
"""Some convenient string utilities."""
def computeNGrams(cls, startOrder, maxOrder, text):
"""Compute N Grams. @param startOrder @param maxOrder @param text @return a n gram to frequency map."""
ngram2count = dict()
tokens = re.split('\\s', text)
for orde... | the_stack_v2_python_sparse | parser/util/SimilarityUtils.py | oldeucryptoboi/wiktionary-parser | train | 0 |
5fe1ed08855733aa84e407953dcdc07d234c51e6 | [
"super(RNNModule, self).__init__()\nself.pack = pack\nself.last = last\nself.lockdrop = LockedDropout()\nassert rnn_type in ['LSTM', 'GRU'], 'RNN type is not supported'\nif not isinstance(nhidden, list):\n nhidden = [nhidden]\nself.rnn_type = rnn_type\nself.ninp = ninput\nself.nhid = nhidden\nself.nlayers = nlay... | <|body_start_0|>
super(RNNModule, self).__init__()
self.pack = pack
self.last = last
self.lockdrop = LockedDropout()
assert rnn_type in ['LSTM', 'GRU'], 'RNN type is not supported'
if not isinstance(nhidden, list):
nhidden = [nhidden]
self.rnn_type = r... | RNNModule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNModule:
def __init__(self, ninput, nhidden, rnn_type='LSTM', nlayers=1, bidirectional=False, dropouti=0.0, dropoutw=0.0, dropouto=0.0, dropout=0.0, pack=True, last=False):
"""A simple RNN Encoder, which produces a fixed vector representation for a variable length sequence of feature v... | stack_v2_sparse_classes_75kplus_train_068981 | 8,959 | no_license | [
{
"docstring": "A simple RNN Encoder, which produces a fixed vector representation for a variable length sequence of feature vectors, using the output at the last timestep of the RNN. We use batch_first=True for our implementation. Tensors are are shape (batch_size, sequence_length, feature_size). Args: input_s... | 4 | stack_v2_sparse_classes_30k_train_048026 | Implement the Python class `RNNModule` described below.
Class description:
Implement the RNNModule class.
Method signatures and docstrings:
- def __init__(self, ninput, nhidden, rnn_type='LSTM', nlayers=1, bidirectional=False, dropouti=0.0, dropoutw=0.0, dropouto=0.0, dropout=0.0, pack=True, last=False): A simple RNN... | Implement the Python class `RNNModule` described below.
Class description:
Implement the RNNModule class.
Method signatures and docstrings:
- def __init__(self, ninput, nhidden, rnn_type='LSTM', nlayers=1, bidirectional=False, dropouti=0.0, dropoutw=0.0, dropouto=0.0, dropout=0.0, pack=True, last=False): A simple RNN... | f64dcd793184be64682b55bdaee7392fd97a0916 | <|skeleton|>
class RNNModule:
def __init__(self, ninput, nhidden, rnn_type='LSTM', nlayers=1, bidirectional=False, dropouti=0.0, dropoutw=0.0, dropouto=0.0, dropout=0.0, pack=True, last=False):
"""A simple RNN Encoder, which produces a fixed vector representation for a variable length sequence of feature v... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RNNModule:
def __init__(self, ninput, nhidden, rnn_type='LSTM', nlayers=1, bidirectional=False, dropouti=0.0, dropoutw=0.0, dropouto=0.0, dropout=0.0, pack=True, last=False):
"""A simple RNN Encoder, which produces a fixed vector representation for a variable length sequence of feature vectors, using ... | the_stack_v2_python_sparse | python/ext_examples/pytorch_example/variational_lstm/variational_lstm/rnn_module.py | HiroIshida/snippets | train | 7 | |
14bbe6e1e994fa003fdd2a567b9856bc011180a2 | [
"requester = self.filter_queryset(self.get_queryset())\nrequester_user = requester.select_related('user').get(user__username=self.request.user.username)\nreturn requester_user",
"if request.user.username != string:\n return Response({'message': \"You don't have permission to edit this profile\"}, status=status... | <|body_start_0|>
requester = self.filter_queryset(self.get_queryset())
requester_user = requester.select_related('user').get(user__username=self.request.user.username)
return requester_user
<|end_body_0|>
<|body_start_1|>
if request.user.username != string:
return Response({... | Gets information of a single user | UpdateUserAPIView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateUserAPIView:
"""Gets information of a single user"""
def get_object(self):
"""Confirm if the one making the query is the owner of the account"""
<|body_0|>
def patch(self, request, string):
"""This method enables the user to edit specific details from their... | stack_v2_sparse_classes_75kplus_train_068982 | 3,684 | permissive | [
{
"docstring": "Confirm if the one making the query is the owner of the account",
"name": "get_object",
"signature": "def get_object(self)"
},
{
"docstring": "This method enables the user to edit specific details from their profile",
"name": "patch",
"signature": "def patch(self, request... | 2 | stack_v2_sparse_classes_30k_train_016803 | Implement the Python class `UpdateUserAPIView` described below.
Class description:
Gets information of a single user
Method signatures and docstrings:
- def get_object(self): Confirm if the one making the query is the owner of the account
- def patch(self, request, string): This method enables the user to edit specif... | Implement the Python class `UpdateUserAPIView` described below.
Class description:
Gets information of a single user
Method signatures and docstrings:
- def get_object(self): Confirm if the one making the query is the owner of the account
- def patch(self, request, string): This method enables the user to edit specif... | b80ad485339dbb02b74d9b2093543bf8173d51de | <|skeleton|>
class UpdateUserAPIView:
"""Gets information of a single user"""
def get_object(self):
"""Confirm if the one making the query is the owner of the account"""
<|body_0|>
def patch(self, request, string):
"""This method enables the user to edit specific details from their... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UpdateUserAPIView:
"""Gets information of a single user"""
def get_object(self):
"""Confirm if the one making the query is the owner of the account"""
requester = self.filter_queryset(self.get_queryset())
requester_user = requester.select_related('user').get(user__username=self.re... | the_stack_v2_python_sparse | authors/apps/profiles/views.py | deferral/ah-django | train | 1 |
a7cf54c599fbd40891752889487664bc3c85c998 | [
"self.dp = [0 for i in range(len(nums) + 1)]\nfor i in range(1, len(nums) + 1):\n self.dp[i] = self.dp[i - 1] + nums[i - 1]\nprint(self.dp)",
"if i > j:\n return 0\nelse:\n return self.dp[j + 1] - self.dp[i]"
] | <|body_start_0|>
self.dp = [0 for i in range(len(nums) + 1)]
for i in range(1, len(nums) + 1):
self.dp[i] = self.dp[i - 1] + nums[i - 1]
print(self.dp)
<|end_body_0|>
<|body_start_1|>
if i > j:
return 0
else:
return self.dp[j + 1] - self.dp[i]... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.dp = [0 for i in range(len(nums) + 1)]
for i i... | stack_v2_sparse_classes_75kplus_train_068983 | 847 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, i, j)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005913 | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int
<|skeleton|>
class NumArray:
def __init__(self, nums):
... | a330e92191642e2965939a06b050ca84d4ed11a6 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
self.dp = [0 for i in range(len(nums) + 1)]
for i in range(1, len(nums) + 1):
self.dp[i] = self.dp[i - 1] + nums[i - 1]
print(self.dp)
def sumRange(self, i, j):
""":type i: int :type j: int... | the_stack_v2_python_sparse | src/dps/range-sum-query-immutable-303.py | monpro/algorithm | train | 102 | |
ed74a996403e2a6a226e3213476e354864dcfb4b | [
"xdata = np.array(x_vect)\nxdata = xdata - x_vect[0]\nydata = np.array(y_vect)\npopt, pcov = curve_fit(sigmoidscaled, xdata, ydata)\nx = np.linspace(-0.5, len(xdata), CURVE_STEP)\ny = sigmoidscaled(x, *popt)\nfit_y = sigmoidscaled(xdata, *popt)\nreturn (popt, pcov, x + x_vect[0], y, fit_y)",
"xdata = np.array(x_v... | <|body_start_0|>
xdata = np.array(x_vect)
xdata = xdata - x_vect[0]
ydata = np.array(y_vect)
popt, pcov = curve_fit(sigmoidscaled, xdata, ydata)
x = np.linspace(-0.5, len(xdata), CURVE_STEP)
y = sigmoidscaled(x, *popt)
fit_y = sigmoidscaled(xdata, *popt)
r... | CurveFit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CurveFit:
def sigm_fit(x_vect, y_vect):
"""Function: sigmond fit @arguments: (in) [x_vect, y_vect]: data for curve_fit (out) popt: Optimal values for the parameters so that the sum of the squared error of f(xdata, *popt) pcov: The estimated covariance of popt. perr = np.sqrt(np.diag(pcov... | stack_v2_sparse_classes_75kplus_train_068984 | 3,323 | no_license | [
{
"docstring": "Function: sigmond fit @arguments: (in) [x_vect, y_vect]: data for curve_fit (out) popt: Optimal values for the parameters so that the sum of the squared error of f(xdata, *popt) pcov: The estimated covariance of popt. perr = np.sqrt(np.diag(pcov)). [x, y, fit_y]: x, y used for plot curve, and fi... | 3 | stack_v2_sparse_classes_30k_train_003689 | Implement the Python class `CurveFit` described below.
Class description:
Implement the CurveFit class.
Method signatures and docstrings:
- def sigm_fit(x_vect, y_vect): Function: sigmond fit @arguments: (in) [x_vect, y_vect]: data for curve_fit (out) popt: Optimal values for the parameters so that the sum of the squ... | Implement the Python class `CurveFit` described below.
Class description:
Implement the CurveFit class.
Method signatures and docstrings:
- def sigm_fit(x_vect, y_vect): Function: sigmond fit @arguments: (in) [x_vect, y_vect]: data for curve_fit (out) popt: Optimal values for the parameters so that the sum of the squ... | 03ff57e6fe0114ffd2dd953e79a73a893a6bc0ad | <|skeleton|>
class CurveFit:
def sigm_fit(x_vect, y_vect):
"""Function: sigmond fit @arguments: (in) [x_vect, y_vect]: data for curve_fit (out) popt: Optimal values for the parameters so that the sum of the squared error of f(xdata, *popt) pcov: The estimated covariance of popt. perr = np.sqrt(np.diag(pcov... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CurveFit:
def sigm_fit(x_vect, y_vect):
"""Function: sigmond fit @arguments: (in) [x_vect, y_vect]: data for curve_fit (out) popt: Optimal values for the parameters so that the sum of the squared error of f(xdata, *popt) pcov: The estimated covariance of popt. perr = np.sqrt(np.diag(pcov)). [x, y, fit... | the_stack_v2_python_sparse | GIS_DataAnalysis/proj_py/src/curve_fit.py | samuelxu999/Research | train | 1 | |
8e520ace6c52ada0ce1dc5ecd0e5c78bb4da4893 | [
"if self.action in ['retrieve', 'list']:\n permission_classes = [AllowAny]\nelse:\n permission_classes = [IsAdminUser]\nreturn [permission() for permission in permission_classes]",
"queryset = super().get_queryset()\nselected_recipe_queryset = SelectedRecipe.objects.select_related('recipe').prefetch_related... | <|body_start_0|>
if self.action in ['retrieve', 'list']:
permission_classes = [AllowAny]
else:
permission_classes = [IsAdminUser]
return [permission() for permission in permission_classes]
<|end_body_0|>
<|body_start_1|>
queryset = super().get_queryset()
... | Provide all methods for manage RecipeSelection. | RecipeSelectionViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecipeSelectionViewSet:
"""Provide all methods for manage RecipeSelection."""
def get_permissions(self):
"""Instantiates and returns the list of permissions that this view requires."""
<|body_0|>
def get_queryset(self):
"""Customize the queryset according to the ... | stack_v2_sparse_classes_75kplus_train_068985 | 5,606 | no_license | [
{
"docstring": "Instantiates and returns the list of permissions that this view requires.",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Customize the queryset according to the current user.",
"name": "get_queryset",
"signature": "def get_queryse... | 3 | null | Implement the Python class `RecipeSelectionViewSet` described below.
Class description:
Provide all methods for manage RecipeSelection.
Method signatures and docstrings:
- def get_permissions(self): Instantiates and returns the list of permissions that this view requires.
- def get_queryset(self): Customize the query... | Implement the Python class `RecipeSelectionViewSet` described below.
Class description:
Provide all methods for manage RecipeSelection.
Method signatures and docstrings:
- def get_permissions(self): Instantiates and returns the list of permissions that this view requires.
- def get_queryset(self): Customize the query... | 617f6c990845d233efa64c9f0b309f5afef17590 | <|skeleton|>
class RecipeSelectionViewSet:
"""Provide all methods for manage RecipeSelection."""
def get_permissions(self):
"""Instantiates and returns the list of permissions that this view requires."""
<|body_0|>
def get_queryset(self):
"""Customize the queryset according to the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RecipeSelectionViewSet:
"""Provide all methods for manage RecipeSelection."""
def get_permissions(self):
"""Instantiates and returns the list of permissions that this view requires."""
if self.action in ['retrieve', 'list']:
permission_classes = [AllowAny]
else:
... | the_stack_v2_python_sparse | apps/recipe/views.py | patate-et-cornichon/patateetcornichon-api | train | 3 |
fe699ee0cbe2831fdfd71707a98ae51fba00b641 | [
"logging.info('## SETUP METHOD ##')\nlogging.info('# Initializing the webdriver.')\nself.chprofile = self.create_chprofile()\nself.driver = webdriver.Chrome(self.chprofile)\nself.driver.maximize_window()\nself.driver.implicitly_wait(5)\nself.driver.get('http://the-internet.herokuapp.com/')",
"logging.info('## TEA... | <|body_start_0|>
logging.info('## SETUP METHOD ##')
logging.info('# Initializing the webdriver.')
self.chprofile = self.create_chprofile()
self.driver = webdriver.Chrome(self.chprofile)
self.driver.maximize_window()
self.driver.implicitly_wait(5)
self.driver.get('... | This class is for instantiating web driver instances. | DriverManagerChrome | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DriverManagerChrome:
"""This class is for instantiating web driver instances."""
def setUp(self):
"""This method is to instantiate the web driver instance."""
<|body_0|>
def tearDown(self):
"""This is teardown method. It is to capture the screenshots for failed t... | stack_v2_sparse_classes_75kplus_train_068986 | 3,946 | permissive | [
{
"docstring": "This method is to instantiate the web driver instance.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "This is teardown method. It is to capture the screenshots for failed test cases, & to remove web driver object.",
"name": "tearDown",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_042006 | Implement the Python class `DriverManagerChrome` described below.
Class description:
This class is for instantiating web driver instances.
Method signatures and docstrings:
- def setUp(self): This method is to instantiate the web driver instance.
- def tearDown(self): This is teardown method. It is to capture the scr... | Implement the Python class `DriverManagerChrome` described below.
Class description:
This class is for instantiating web driver instances.
Method signatures and docstrings:
- def setUp(self): This method is to instantiate the web driver instance.
- def tearDown(self): This is teardown method. It is to capture the scr... | 65513cb85eccb1ae3fae4ac3625d0e6878720ec8 | <|skeleton|>
class DriverManagerChrome:
"""This class is for instantiating web driver instances."""
def setUp(self):
"""This method is to instantiate the web driver instance."""
<|body_0|>
def tearDown(self):
"""This is teardown method. It is to capture the screenshots for failed t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DriverManagerChrome:
"""This class is for instantiating web driver instances."""
def setUp(self):
"""This method is to instantiate the web driver instance."""
logging.info('## SETUP METHOD ##')
logging.info('# Initializing the webdriver.')
self.chprofile = self.create_chpr... | the_stack_v2_python_sparse | attic/2019/contributions-2019/open/mudaliar-yptu/PWAF/utility/drivermanager.py | Agriad/devops-course | train | 0 |
7dae28a51ac9c9132fe1b2456da15f6722aa5d16 | [
"zero_rows = [False] * len(matrix)\nzero_columns = [False] * len(matrix[0])\nfor i in range(0, len(matrix)):\n for j in range(0, len(matrix[i])):\n if matrix[i][j] == 0:\n zero_rows[i] = True\n zero_columns[j] = True\nfor i in range(0, len(matrix)):\n for j in range(0, len(matrix[... | <|body_start_0|>
zero_rows = [False] * len(matrix)
zero_columns = [False] * len(matrix[0])
for i in range(0, len(matrix)):
for j in range(0, len(matrix[i])):
if matrix[i][j] == 0:
zero_rows[i] = True
zero_columns[j] = True
... | MatrixZeros | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MatrixZeros:
def set_zeroes(matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def set_zeroes_efficient(matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify mat... | stack_v2_sparse_classes_75kplus_train_068987 | 1,689 | permissive | [
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
"name": "set_zeroes",
"signature": "def set_zeroes(matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",... | 2 | stack_v2_sparse_classes_30k_train_037281 | Implement the Python class `MatrixZeros` described below.
Class description:
Implement the MatrixZeros class.
Method signatures and docstrings:
- def set_zeroes(matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def set_zeroes_efficient(matrix): :type matrix:... | Implement the Python class `MatrixZeros` described below.
Class description:
Implement the MatrixZeros class.
Method signatures and docstrings:
- def set_zeroes(matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def set_zeroes_efficient(matrix): :type matrix:... | 77838c37e3fdae0f2ec628aa7ddc59f4a5949bbe | <|skeleton|>
class MatrixZeros:
def set_zeroes(matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def set_zeroes_efficient(matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify mat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MatrixZeros:
def set_zeroes(matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
zero_rows = [False] * len(matrix)
zero_columns = [False] * len(matrix[0])
for i in range(0, len(matrix)):
for j in range(0, ... | the_stack_v2_python_sparse | Python/dev/arrays/matrix_zeroes.py | faisaldialpad/hellouniverse | train | 0 | |
674d3be53736a6719b810a95fb5e10b64cedab73 | [
"super().__init__()\nself.args = args\nself.predictor, self.config, self.input_tensor, self.output_tensor = self.load_predictor(os.path.join(args.model_dir, 'inference.pdmodel'), os.path.join(args.model_dir, 'inference.pdiparams'))\nself.transforms = Compose([ResizeImage(args.resize_size), CenterCropImage(args.crop... | <|body_start_0|>
super().__init__()
self.args = args
self.predictor, self.config, self.input_tensor, self.output_tensor = self.load_predictor(os.path.join(args.model_dir, 'inference.pdmodel'), os.path.join(args.model_dir, 'inference.pdiparams'))
self.transforms = Compose([ResizeImage(arg... | InferenceEngine Inference engina class which contains preprocess, run, postprocess | InferenceEngine | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InferenceEngine:
"""InferenceEngine Inference engina class which contains preprocess, run, postprocess"""
def __init__(self, args):
"""Args: args: Parameters generated using argparser. Returns: None"""
<|body_0|>
def load_predictor(self, model_file_path, params_file_path... | stack_v2_sparse_classes_75kplus_train_068988 | 7,015 | permissive | [
{
"docstring": "Args: args: Parameters generated using argparser. Returns: None",
"name": "__init__",
"signature": "def __init__(self, args)"
},
{
"docstring": "load_predictor initialize the inference engine Args: model_file_path: inference model path (*.pdmodel) model_file_path: inference parma... | 5 | stack_v2_sparse_classes_30k_train_046237 | Implement the Python class `InferenceEngine` described below.
Class description:
InferenceEngine Inference engina class which contains preprocess, run, postprocess
Method signatures and docstrings:
- def __init__(self, args): Args: args: Parameters generated using argparser. Returns: None
- def load_predictor(self, m... | Implement the Python class `InferenceEngine` described below.
Class description:
InferenceEngine Inference engina class which contains preprocess, run, postprocess
Method signatures and docstrings:
- def __init__(self, args): Args: args: Parameters generated using argparser. Returns: None
- def load_predictor(self, m... | 8042c21b690ffc0162095e749a41b94dd38732da | <|skeleton|>
class InferenceEngine:
"""InferenceEngine Inference engina class which contains preprocess, run, postprocess"""
def __init__(self, args):
"""Args: args: Parameters generated using argparser. Returns: None"""
<|body_0|>
def load_predictor(self, model_file_path, params_file_path... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InferenceEngine:
"""InferenceEngine Inference engina class which contains preprocess, run, postprocess"""
def __init__(self, args):
"""Args: args: Parameters generated using argparser. Returns: None"""
super().__init__()
self.args = args
self.predictor, self.config, self.i... | the_stack_v2_python_sparse | tutorials/mobilenetv3_prod/Step6/deploy/inference_python/infer.py | PaddlePaddle/models | train | 7,633 |
2957591f1b886ac686376a6b0ff85ae024001961 | [
"r1 = text_equals('Rule 1')('f1')\nl1 = LeafNode('f1', 'Text').with_extra_rules(r1)\nself.assertIn(r1, frozenset(optimize_rule_distribution(l1).all_rules()))\nr2 = text_equals('Rule 2')('f2')\nl2 = LeafNode('f2', 'Text').with_extra_rules(r2)\nm = combine(l1, l2)\no = optimize_rule_distribution(m)\nself.assertNotIn(... | <|body_start_0|>
r1 = text_equals('Rule 1')('f1')
l1 = LeafNode('f1', 'Text').with_extra_rules(r1)
self.assertIn(r1, frozenset(optimize_rule_distribution(l1).all_rules()))
r2 = text_equals('Rule 2')('f2')
l2 = LeafNode('f2', 'Text').with_extra_rules(r2)
m = combine(l1, l2... | TestOptimizeRuleDistribution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestOptimizeRuleDistribution:
def test_leaf_rules(self) -> None:
"""Leaf rules stay at leaves."""
<|body_0|>
def test_combine(self) -> None:
"""Degree-1 rules migrate to leaves."""
<|body_1|>
def test_pick_best(self) -> None:
"""Degree-1 rules mi... | stack_v2_sparse_classes_75kplus_train_068989 | 2,149 | permissive | [
{
"docstring": "Leaf rules stay at leaves.",
"name": "test_leaf_rules",
"signature": "def test_leaf_rules(self) -> None"
},
{
"docstring": "Degree-1 rules migrate to leaves.",
"name": "test_combine",
"signature": "def test_combine(self) -> None"
},
{
"docstring": "Degree-1 rules ... | 3 | stack_v2_sparse_classes_30k_train_049518 | Implement the Python class `TestOptimizeRuleDistribution` described below.
Class description:
Implement the TestOptimizeRuleDistribution class.
Method signatures and docstrings:
- def test_leaf_rules(self) -> None: Leaf rules stay at leaves.
- def test_combine(self) -> None: Degree-1 rules migrate to leaves.
- def te... | Implement the Python class `TestOptimizeRuleDistribution` described below.
Class description:
Implement the TestOptimizeRuleDistribution class.
Method signatures and docstrings:
- def test_leaf_rules(self) -> None: Leaf rules stay at leaves.
- def test_combine(self) -> None: Degree-1 rules migrate to leaves.
- def te... | 20ddf771d6097f0021739cc07f534f29b94ccf6e | <|skeleton|>
class TestOptimizeRuleDistribution:
def test_leaf_rules(self) -> None:
"""Leaf rules stay at leaves."""
<|body_0|>
def test_combine(self) -> None:
"""Degree-1 rules migrate to leaves."""
<|body_1|>
def test_pick_best(self) -> None:
"""Degree-1 rules mi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestOptimizeRuleDistribution:
def test_leaf_rules(self) -> None:
"""Leaf rules stay at leaves."""
r1 = text_equals('Rule 1')('f1')
l1 = LeafNode('f1', 'Text').with_extra_rules(r1)
self.assertIn(r1, frozenset(optimize_rule_distribution(l1).all_rules()))
r2 = text_equals(... | the_stack_v2_python_sparse | blueprint/unit_tests/test_tree.py | ddanco/blueprint-oss | train | 0 | |
0b5c1a6cc30f5aae49288bab48a3f6202b42f207 | [
"super().__init__()\nself.input_dim = input_dim\nself.output_dim = output_dim\nself.kernel_size = kernel_size\nself.device = device\nself.conv = nn.Conv1d(input_dim, output_dim, kernel_size, padding=(kernel_size - 1) // 2)",
"x = x.view(x.shape[0], -1, self.input_dim).permute(0, 2, 1).to(self.device)\ny = self.co... | <|body_start_0|>
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.kernel_size = kernel_size
self.device = device
self.conv = nn.Conv1d(input_dim, output_dim, kernel_size, padding=(kernel_size - 1) // 2)
<|end_body_0|>
<|body_start_1|>
... | CNNEncoderBase | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CNNEncoderBase:
def __init__(self, input_dim, output_dim, kernel_size, device):
"""Build a basic CNN encoder Parameters ---------- input_dim : int The input dimension output_dim : int The output dimension kernel_size : int The size of convolutional kernels"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_068990 | 16,228 | permissive | [
{
"docstring": "Build a basic CNN encoder Parameters ---------- input_dim : int The input dimension output_dim : int The output dimension kernel_size : int The size of convolutional kernels",
"name": "__init__",
"signature": "def __init__(self, input_dim, output_dim, kernel_size, device)"
},
{
"... | 2 | null | Implement the Python class `CNNEncoderBase` described below.
Class description:
Implement the CNNEncoderBase class.
Method signatures and docstrings:
- def __init__(self, input_dim, output_dim, kernel_size, device): Build a basic CNN encoder Parameters ---------- input_dim : int The input dimension output_dim : int T... | Implement the Python class `CNNEncoderBase` described below.
Class description:
Implement the CNNEncoderBase class.
Method signatures and docstrings:
- def __init__(self, input_dim, output_dim, kernel_size, device): Build a basic CNN encoder Parameters ---------- input_dim : int The input dimension output_dim : int T... | 4c30e5827b74bcc45f14cf3ae0c1715459ed09ae | <|skeleton|>
class CNNEncoderBase:
def __init__(self, input_dim, output_dim, kernel_size, device):
"""Build a basic CNN encoder Parameters ---------- input_dim : int The input dimension output_dim : int The output dimension kernel_size : int The size of convolutional kernels"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CNNEncoderBase:
def __init__(self, input_dim, output_dim, kernel_size, device):
"""Build a basic CNN encoder Parameters ---------- input_dim : int The input dimension output_dim : int The output dimension kernel_size : int The size of convolutional kernels"""
super().__init__()
self.in... | the_stack_v2_python_sparse | qlib/contrib/model/pytorch_krnn.py | microsoft/qlib | train | 12,822 | |
9febc46f4b4ab3f915967603d711be0058d89658 | [
"self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]",
"while len(self.x_values) < self.num_points:\n x_direction = choice([1, -1])\n x_distance = choice([0, 1, 2, 3, 4])\n x_step = x_direction * x_distance\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n ... | <|body_start_0|>
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
<|end_body_0|>
<|body_start_1|>
while len(self.x_values) < self.num_points:
x_direction = choice([1, -1])
x_distance = choice([0, 1, 2, 3, 4])
x_step = x_direction *... | a class to generate random walks this class needs 3 attributes 1 for store the numbers in the walk other 2 are for making list to store the x and y coordinate | randomwalk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class randomwalk:
"""a class to generate random walks this class needs 3 attributes 1 for store the numbers in the walk other 2 are for making list to store the x and y coordinate"""
def __init__(self, num_points=5000):
"""initialize attribute to the class"""
<|body_0|>
def fi... | stack_v2_sparse_classes_75kplus_train_068991 | 1,709 | no_license | [
{
"docstring": "initialize attribute to the class",
"name": "__init__",
"signature": "def __init__(self, num_points=5000)"
},
{
"docstring": "calculate all the points in the walk",
"name": "fill_walk",
"signature": "def fill_walk(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_034523 | Implement the Python class `randomwalk` described below.
Class description:
a class to generate random walks this class needs 3 attributes 1 for store the numbers in the walk other 2 are for making list to store the x and y coordinate
Method signatures and docstrings:
- def __init__(self, num_points=5000): initialize... | Implement the Python class `randomwalk` described below.
Class description:
a class to generate random walks this class needs 3 attributes 1 for store the numbers in the walk other 2 are for making list to store the x and y coordinate
Method signatures and docstrings:
- def __init__(self, num_points=5000): initialize... | 4754662b8286ede44cef597d0ead3595faf8f556 | <|skeleton|>
class randomwalk:
"""a class to generate random walks this class needs 3 attributes 1 for store the numbers in the walk other 2 are for making list to store the x and y coordinate"""
def __init__(self, num_points=5000):
"""initialize attribute to the class"""
<|body_0|>
def fi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class randomwalk:
"""a class to generate random walks this class needs 3 attributes 1 for store the numbers in the walk other 2 are for making list to store the x and y coordinate"""
def __init__(self, num_points=5000):
"""initialize attribute to the class"""
self.num_points = num_points
... | the_stack_v2_python_sparse | scatter_squares.py | SANYAM1996/VSCODE | train | 0 |
316b38d68c75ded560cd263860b445d2afea53c7 | [
"res = self.session.query(FubInfo).filter(FubInfo.code == code)\nres = res.all()\nif len(res) > 0:\n return res[0]\nelse:\n return None",
"temp = FubInfo(name=fubinfo.name, code=fubinfo.no, remark='', lat=fubinfo.lat, lon=fubinfo.lon, area='n', isShow=True)\nself.session.add(temp)\nself.session.flush()\nsel... | <|body_start_0|>
res = self.session.query(FubInfo).filter(FubInfo.code == code)
res = res.all()
if len(res) > 0:
return res[0]
else:
return None
<|end_body_0|>
<|body_start_1|>
temp = FubInfo(name=fubinfo.name, code=fubinfo.no, remark='', lat=fubinfo.lat,... | BuoInfoBLL | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BuoInfoBLL:
def isExist(self, code):
"""判断指定code是否已经 存在数据库中,不存在则创建 :param code: :return:"""
<|body_0|>
def create(self, fubinfo):
"""写入 :param fubinfo: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = self.session.query(FubInfo).filter... | stack_v2_sparse_classes_75kplus_train_068992 | 2,413 | no_license | [
{
"docstring": "判断指定code是否已经 存在数据库中,不存在则创建 :param code: :return:",
"name": "isExist",
"signature": "def isExist(self, code)"
},
{
"docstring": "写入 :param fubinfo: :return:",
"name": "create",
"signature": "def create(self, fubinfo)"
}
] | 2 | stack_v2_sparse_classes_30k_train_051299 | Implement the Python class `BuoInfoBLL` described below.
Class description:
Implement the BuoInfoBLL class.
Method signatures and docstrings:
- def isExist(self, code): 判断指定code是否已经 存在数据库中,不存在则创建 :param code: :return:
- def create(self, fubinfo): 写入 :param fubinfo: :return: | Implement the Python class `BuoInfoBLL` described below.
Class description:
Implement the BuoInfoBLL class.
Method signatures and docstrings:
- def isExist(self, code): 判断指定code是否已经 存在数据库中,不存在则创建 :param code: :return:
- def create(self, fubinfo): 写入 :param fubinfo: :return:
<|skeleton|>
class BuoInfoBLL:
def is... | c84e26a8f280a7931b6198afaf1641a1bd0d7402 | <|skeleton|>
class BuoInfoBLL:
def isExist(self, code):
"""判断指定code是否已经 存在数据库中,不存在则创建 :param code: :return:"""
<|body_0|>
def create(self, fubinfo):
"""写入 :param fubinfo: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BuoInfoBLL:
def isExist(self, code):
"""判断指定code是否已经 存在数据库中,不存在则创建 :param code: :return:"""
res = self.session.query(FubInfo).filter(FubInfo.code == code)
res = res.all()
if len(res) > 0:
return res[0]
else:
return None
def create(self, fubi... | the_stack_v2_python_sparse | byRabbitMQ/core/bll.py | evaseemefly/GridForecastSys | train | 1 | |
fcac07ada124c02fb79847f7a90729204ec17315 | [
"if not root:\n return []\nself.max_count = 0\n\ndef visit(root, count):\n self.max_count = max(self.max_count, count)\n if root.left:\n visit(root.left, count + 1)\n if root.right:\n visit(root.right, count + 1)\nvisit(root, 1)\nprint(self.max_count)\nself.print_t = [[''] * (2 ** self.max... | <|body_start_0|>
if not root:
return []
self.max_count = 0
def visit(root, count):
self.max_count = max(self.max_count, count)
if root.left:
visit(root.left, count + 1)
if root.right:
visit(root.right, count + 1)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def printTree(self, root):
""":type root: TreeNode :rtype 42ms"""
<|body_0|>
def printTree_1(self, root):
"""42ms :param root: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return []
self.max_cou... | stack_v2_sparse_classes_75kplus_train_068993 | 4,098 | no_license | [
{
"docstring": ":type root: TreeNode :rtype 42ms",
"name": "printTree",
"signature": "def printTree(self, root)"
},
{
"docstring": "42ms :param root: :return:",
"name": "printTree_1",
"signature": "def printTree_1(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007305 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def printTree(self, root): :type root: TreeNode :rtype 42ms
- def printTree_1(self, root): 42ms :param root: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def printTree(self, root): :type root: TreeNode :rtype 42ms
- def printTree_1(self, root): 42ms :param root: :return:
<|skeleton|>
class Solution:
def printTree(self, root)... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def printTree(self, root):
""":type root: TreeNode :rtype 42ms"""
<|body_0|>
def printTree_1(self, root):
"""42ms :param root: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def printTree(self, root):
""":type root: TreeNode :rtype 42ms"""
if not root:
return []
self.max_count = 0
def visit(root, count):
self.max_count = max(self.max_count, count)
if root.left:
visit(root.left, count + ... | the_stack_v2_python_sparse | PrintBinaryTree_MID_655.py | 953250587/leetcode-python | train | 2 | |
e7e6192df0cf6ba78ba14953cf93c395af688813 | [
"self.given_minutes = 0\nself.closest_time = 0\nself.departing_minutes = self.format_text(file)",
"departing_minutes = []\nwith open(file) as text:\n for line in text:\n split_data = line.split()\n for minute in split_data[1:]:\n departing_minutes.append(int(split_data[0]) * 60 + int(m... | <|body_start_0|>
self.given_minutes = 0
self.closest_time = 0
self.departing_minutes = self.format_text(file)
<|end_body_0|>
<|body_start_1|>
departing_minutes = []
with open(file) as text:
for line in text:
split_data = line.split()
f... | Main class. | Main | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Main:
"""Main class."""
def __init__(self, file: str):
"""initi."""
<|body_0|>
def format_text(self, file: str):
"""Format text."""
<|body_1|>
def get_closest_time(self):
"""Get closest time."""
<|body_2|>
def get_departure_time(... | stack_v2_sparse_classes_75kplus_train_068994 | 2,249 | no_license | [
{
"docstring": "initi.",
"name": "__init__",
"signature": "def __init__(self, file: str)"
},
{
"docstring": "Format text.",
"name": "format_text",
"signature": "def format_text(self, file: str)"
},
{
"docstring": "Get closest time.",
"name": "get_closest_time",
"signature... | 5 | null | Implement the Python class `Main` described below.
Class description:
Main class.
Method signatures and docstrings:
- def __init__(self, file: str): initi.
- def format_text(self, file: str): Format text.
- def get_closest_time(self): Get closest time.
- def get_departure_time(self): Get depature time.
- def ask_user... | Implement the Python class `Main` described below.
Class description:
Main class.
Method signatures and docstrings:
- def __init__(self, file: str): initi.
- def format_text(self, file: str): Format text.
- def get_closest_time(self): Get closest time.
- def get_departure_time(self): Get depature time.
- def ask_user... | b9a4a162bdfd96d481b034e2adf41125daede0ec | <|skeleton|>
class Main:
"""Main class."""
def __init__(self, file: str):
"""initi."""
<|body_0|>
def format_text(self, file: str):
"""Format text."""
<|body_1|>
def get_closest_time(self):
"""Get closest time."""
<|body_2|>
def get_departure_time(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Main:
"""Main class."""
def __init__(self, file: str):
"""initi."""
self.given_minutes = 0
self.closest_time = 0
self.departing_minutes = self.format_text(file)
def format_text(self, file: str):
"""Format text."""
departing_minutes = []
with op... | the_stack_v2_python_sparse | EX15A/bus.py | Mavuks/Iti0102 | train | 0 |
0999d53004b338a7f628448d206e02e93949c757 | [
"if name.startswith('_') and hasattr(self, name[1:]):\n name = name[1:]\nreturn name",
"if attr in self.__class__.__dict__:\n return isinstance(self.__class__.__dict__[attr], _SkipEncodingDecoding)\nreturn False",
"request_data = {}\nfor attr, value in self.__dict__.items():\n if value is not None:\n ... | <|body_start_0|>
if name.startswith('_') and hasattr(self, name[1:]):
name = name[1:]
return name
<|end_body_0|>
<|body_start_1|>
if attr in self.__class__.__dict__:
return isinstance(self.__class__.__dict__[attr], _SkipEncodingDecoding)
return False
<|end_body_1... | Provide a default behavior for to_request_dict method. | _DefaultToRequestDict | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _DefaultToRequestDict:
"""Provide a default behavior for to_request_dict method."""
def _clean_descriptor_name(self, name: str):
"""Update the attribute name to be the same as schema. Args: name (str): attribute name."""
<|body_0|>
def _skip_encoding(self, attr: str):
... | stack_v2_sparse_classes_75kplus_train_068995 | 16,025 | permissive | [
{
"docstring": "Update the attribute name to be the same as schema. Args: name (str): attribute name.",
"name": "_clean_descriptor_name",
"signature": "def _clean_descriptor_name(self, name: str)"
},
{
"docstring": "Skip encoding if the attribute is an instance of _SkipEncodingDecoding descripto... | 3 | stack_v2_sparse_classes_30k_train_020487 | Implement the Python class `_DefaultToRequestDict` described below.
Class description:
Provide a default behavior for to_request_dict method.
Method signatures and docstrings:
- def _clean_descriptor_name(self, name: str): Update the attribute name to be the same as schema. Args: name (str): attribute name.
- def _sk... | Implement the Python class `_DefaultToRequestDict` described below.
Class description:
Provide a default behavior for to_request_dict method.
Method signatures and docstrings:
- def _clean_descriptor_name(self, name: str): Update the attribute name to be the same as schema. Args: name (str): attribute name.
- def _sk... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class _DefaultToRequestDict:
"""Provide a default behavior for to_request_dict method."""
def _clean_descriptor_name(self, name: str):
"""Update the attribute name to be the same as schema. Args: name (str): attribute name."""
<|body_0|>
def _skip_encoding(self, attr: str):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _DefaultToRequestDict:
"""Provide a default behavior for to_request_dict method."""
def _clean_descriptor_name(self, name: str):
"""Update the attribute name to be the same as schema. Args: name (str): attribute name."""
if name.startswith('_') and hasattr(self, name[1:]):
nam... | the_stack_v2_python_sparse | src/sagemaker/model_card/helpers.py | aws/sagemaker-python-sdk | train | 2,050 |
e4e069e158d4a524e1dcc6a29be444f0b2671db9 | [
"dfjson = pd.read_json(f'{cf.conf_dir}/stack/crawlers/langcrs/all_{lang}.json')\ndel dfjson['audio']\nfor name, group in dfjson.groupby('chapter'):\n print(f'`{name}`')\n del group['chapter']\n print(group)",
"dfjson = pd.read_json(f'{cf.conf_dir}/stack/crawlers/langcrs/all_{lang}.json')\nnames = [name f... | <|body_start_0|>
dfjson = pd.read_json(f'{cf.conf_dir}/stack/crawlers/langcrs/all_{lang}.json')
del dfjson['audio']
for name, group in dfjson.groupby('chapter'):
print(f'`{name}`')
del group['chapter']
print(group)
<|end_body_0|>
<|body_start_1|>
dfjs... | AugmentorCli | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AugmentorCli:
def chapters(self, lang='zh'):
"""$ python -m augmentor.cli chapters :param lang: :return:"""
<|body_0|>
def chapter_titles(self, lang='zh'):
"""$ python -m augmentor.cli chapter_titles :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_068996 | 885 | permissive | [
{
"docstring": "$ python -m augmentor.cli chapters :param lang: :return:",
"name": "chapters",
"signature": "def chapters(self, lang='zh')"
},
{
"docstring": "$ python -m augmentor.cli chapter_titles :return:",
"name": "chapter_titles",
"signature": "def chapter_titles(self, lang='zh')"
... | 2 | null | Implement the Python class `AugmentorCli` described below.
Class description:
Implement the AugmentorCli class.
Method signatures and docstrings:
- def chapters(self, lang='zh'): $ python -m augmentor.cli chapters :param lang: :return:
- def chapter_titles(self, lang='zh'): $ python -m augmentor.cli chapter_titles :r... | Implement the Python class `AugmentorCli` described below.
Class description:
Implement the AugmentorCli class.
Method signatures and docstrings:
- def chapters(self, lang='zh'): $ python -m augmentor.cli chapters :param lang: :return:
- def chapter_titles(self, lang='zh'): $ python -m augmentor.cli chapter_titles :r... | 9958d18ee5e75cf9794f546c904097dc1ff4f3a0 | <|skeleton|>
class AugmentorCli:
def chapters(self, lang='zh'):
"""$ python -m augmentor.cli chapters :param lang: :return:"""
<|body_0|>
def chapter_titles(self, lang='zh'):
"""$ python -m augmentor.cli chapter_titles :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AugmentorCli:
def chapters(self, lang='zh'):
"""$ python -m augmentor.cli chapters :param lang: :return:"""
dfjson = pd.read_json(f'{cf.conf_dir}/stack/crawlers/langcrs/all_{lang}.json')
del dfjson['audio']
for name, group in dfjson.groupby('chapter'):
print(f'`{nam... | the_stack_v2_python_sparse | augmentor/cli.py | samlet/stack | train | 3 | |
74e8cc1dfd8db15ae7cfb9c312c856f45bf99e3b | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MacOSLobApp()",
"from .mac_o_s_lob_child_app import MacOSLobChildApp\nfrom .mac_o_s_minimum_operating_system import MacOSMinimumOperatingSystem\nfrom .mobile_lob_app import MobileLobApp\nfrom .mac_o_s_lob_child_app import MacOSLobChild... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return MacOSLobApp()
<|end_body_0|>
<|body_start_1|>
from .mac_o_s_lob_child_app import MacOSLobChildApp
from .mac_o_s_minimum_operating_system import MacOSMinimumOperatingSystem
from .... | Contains properties and inherited properties for the macOS LOB App. | MacOSLobApp | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MacOSLobApp:
"""Contains properties and inherited properties for the macOS LOB App."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSLobApp:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse... | stack_v2_sparse_classes_75kplus_train_068997 | 5,813 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: MacOSLobApp",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(p... | 3 | null | Implement the Python class `MacOSLobApp` described below.
Class description:
Contains properties and inherited properties for the macOS LOB App.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSLobApp: Creates a new instance of the appropriate class... | Implement the Python class `MacOSLobApp` described below.
Class description:
Contains properties and inherited properties for the macOS LOB App.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSLobApp: Creates a new instance of the appropriate class... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class MacOSLobApp:
"""Contains properties and inherited properties for the macOS LOB App."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSLobApp:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MacOSLobApp:
"""Contains properties and inherited properties for the macOS LOB App."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSLobApp:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use ... | the_stack_v2_python_sparse | msgraph/generated/models/mac_o_s_lob_app.py | microsoftgraph/msgraph-sdk-python | train | 135 |
2ef1c23813865678c63e0d13affd5f436a209637 | [
"with ClusterRpcProxy(CONFIG_RPC) as rpc:\n response_data = rpc.query_products.list(num_page, limit)\n return Response(response=response_data, status=200, mimetype='application/json')",
"data = request.json\nwith ClusterRpcProxy(CONFIG_RPC) as rpc:\n response_data = rpc.command_products.add_product(data)... | <|body_start_0|>
with ClusterRpcProxy(CONFIG_RPC) as rpc:
response_data = rpc.query_products.list(num_page, limit)
return Response(response=response_data, status=200, mimetype='application/json')
<|end_body_0|>
<|body_start_1|>
data = request.json
with ClusterRpcProxy(CO... | ProductsCollection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductsCollection:
def get(self, num_page=5, limit=5):
"""returns a list of products"""
<|body_0|>
def post(self):
"""creates a new brand"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
with ClusterRpcProxy(CONFIG_RPC) as rpc:
response_... | stack_v2_sparse_classes_75kplus_train_068998 | 3,911 | no_license | [
{
"docstring": "returns a list of products",
"name": "get",
"signature": "def get(self, num_page=5, limit=5)"
},
{
"docstring": "creates a new brand",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `ProductsCollection` described below.
Class description:
Implement the ProductsCollection class.
Method signatures and docstrings:
- def get(self, num_page=5, limit=5): returns a list of products
- def post(self): creates a new brand | Implement the Python class `ProductsCollection` described below.
Class description:
Implement the ProductsCollection class.
Method signatures and docstrings:
- def get(self, num_page=5, limit=5): returns a list of products
- def post(self): creates a new brand
<|skeleton|>
class ProductsCollection:
def get(self... | 3f4c93c631e5d5b52acd2ce11e220ff3fbec07b6 | <|skeleton|>
class ProductsCollection:
def get(self, num_page=5, limit=5):
"""returns a list of products"""
<|body_0|>
def post(self):
"""creates a new brand"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProductsCollection:
def get(self, num_page=5, limit=5):
"""returns a list of products"""
with ClusterRpcProxy(CONFIG_RPC) as rpc:
response_data = rpc.query_products.list(num_page, limit)
return Response(response=response_data, status=200, mimetype='application/json')
... | the_stack_v2_python_sparse | orchestrator/apis/products_ns.py | bsmi021/eahub_shopco | train | 0 | |
a55dc6594227a004dd2dff0d2226e071150cc0fe | [
"print('Loading model')\npath = Models.modelPath('stackexchange')\ndbfile = os.path.join(path, 'questions.db')\ndb = sqlite3.connect(dbfile)\nembeddings = Embeddings()\nembeddings.load(path)\nreturn (db, embeddings)",
"db, embeddings = StackExchange.load()\ncur = db.cursor()\nmrr = []\nwith open(Models.testPath('... | <|body_start_0|>
print('Loading model')
path = Models.modelPath('stackexchange')
dbfile = os.path.join(path, 'questions.db')
db = sqlite3.connect(dbfile)
embeddings = Embeddings()
embeddings.load(path)
return (db, embeddings)
<|end_body_0|>
<|body_start_1|>
... | StackExchange query-answer dataset. | StackExchange | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StackExchange:
"""StackExchange query-answer dataset."""
def load():
"""Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)"""
<|body_0|>
def run(args):
"""Evaluates a pre-trained model against the StackExchange query-answer data... | stack_v2_sparse_classes_75kplus_train_068999 | 6,859 | permissive | [
{
"docstring": "Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)",
"name": "load",
"signature": "def load()"
},
{
"docstring": "Evaluates a pre-trained model against the StackExchange query-answer dataset. Args: args: command line arguments",
"name": "run... | 2 | stack_v2_sparse_classes_30k_train_014336 | Implement the Python class `StackExchange` described below.
Class description:
StackExchange query-answer dataset.
Method signatures and docstrings:
- def load(): Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)
- def run(args): Evaluates a pre-trained model against the StackExcha... | Implement the Python class `StackExchange` described below.
Class description:
StackExchange query-answer dataset.
Method signatures and docstrings:
- def load(): Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)
- def run(args): Evaluates a pre-trained model against the StackExcha... | c1fde2fcb3cf830247131385ec5340e6a148e70a | <|skeleton|>
class StackExchange:
"""StackExchange query-answer dataset."""
def load():
"""Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)"""
<|body_0|>
def run(args):
"""Evaluates a pre-trained model against the StackExchange query-answer data... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StackExchange:
"""StackExchange query-answer dataset."""
def load():
"""Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)"""
print('Loading model')
path = Models.modelPath('stackexchange')
dbfile = os.path.join(path, 'questions.db')
... | the_stack_v2_python_sparse | src/python/codequestion/evaluate.py | spreck/codequestion | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.