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
b2c8849b114ffbfe4722b43a1884203fb935c767
[ "self._num_classes = num_classes\nself._level = level\nself._num_convs = num_convs\nself._upsample_factor = upsample_factor\nself._upsample_num_filters = upsample_num_filters\nif activation == 'relu':\n self._activation = tf.nn.relu\nelif activation == 'swish':\n self._activation = tf.nn.swish\nelse:\n rai...
<|body_start_0|> self._num_classes = num_classes self._level = level self._num_convs = num_convs self._upsample_factor = upsample_factor self._upsample_num_filters = upsample_num_filters if activation == 'relu': self._activation = tf.nn.relu elif activ...
Semantic segmentation head.
SegmentationHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegmentationHead: """Semantic segmentation head.""" def __init__(self, num_classes, level, num_convs=2, upsample_factor=1, upsample_num_filters=256, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchNormActivation(activation='relu')): """Initialize params to b...
stack_v2_sparse_classes_75kplus_train_074500
46,218
permissive
[ { "docstring": "Initialize params to build segmentation head. Args: num_classes: `int` number of mask classification categories. The number of classes does not include background class. level: `int` feature level used for prediction. num_convs: `int` number of stacked convolution before the last prediction laye...
2
stack_v2_sparse_classes_30k_train_027686
Implement the Python class `SegmentationHead` described below. Class description: Semantic segmentation head. Method signatures and docstrings: - def __init__(self, num_classes, level, num_convs=2, upsample_factor=1, upsample_num_filters=256, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchN...
Implement the Python class `SegmentationHead` described below. Class description: Semantic segmentation head. Method signatures and docstrings: - def __init__(self, num_classes, level, num_convs=2, upsample_factor=1, upsample_num_filters=256, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchN...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class SegmentationHead: """Semantic segmentation head.""" def __init__(self, num_classes, level, num_convs=2, upsample_factor=1, upsample_num_filters=256, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchNormActivation(activation='relu')): """Initialize params to b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SegmentationHead: """Semantic segmentation head.""" def __init__(self, num_classes, level, num_convs=2, upsample_factor=1, upsample_num_filters=256, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchNormActivation(activation='relu')): """Initialize params to build segmenta...
the_stack_v2_python_sparse
models/official/detection/modeling/architecture/heads.py
tensorflow/tpu
train
5,627
a3a4973963ad168ba9c58b92201168986e1506f2
[ "self.species = species\nself.danger_level = danger_level\nself.emoji = emoji", "if self.danger_level == opponent.danger_level:\n return opponent\nelif self.danger_level < opponent.danger_level:\n return opponent\nelse:\n return self" ]
<|body_start_0|> self.species = species self.danger_level = danger_level self.emoji = emoji <|end_body_0|> <|body_start_1|> if self.danger_level == opponent.danger_level: return opponent elif self.danger_level < opponent.danger_level: return opponent ...
Defined Animal class.
Animal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Animal: """Defined Animal class.""" def __init__(self, species: str, danger_level: int, emoji: str): """Constructor for the Animal class.""" <|body_0|> def fight(self, opponent: Animal) -> Animal: """Simulates a fight between two animals and returns the one with ...
stack_v2_sparse_classes_75kplus_train_074501
3,208
no_license
[ { "docstring": "Constructor for the Animal class.", "name": "__init__", "signature": "def __init__(self, species: str, danger_level: int, emoji: str)" }, { "docstring": "Simulates a fight between two animals and returns the one with the higher danger_level.", "name": "fight", "signature"...
2
stack_v2_sparse_classes_30k_train_039507
Implement the Python class `Animal` described below. Class description: Defined Animal class. Method signatures and docstrings: - def __init__(self, species: str, danger_level: int, emoji: str): Constructor for the Animal class. - def fight(self, opponent: Animal) -> Animal: Simulates a fight between two animals and ...
Implement the Python class `Animal` described below. Class description: Defined Animal class. Method signatures and docstrings: - def __init__(self, species: str, danger_level: int, emoji: str): Constructor for the Animal class. - def fight(self, opponent: Animal) -> Animal: Simulates a fight between two animals and ...
cdc288669d5df9db4f6fe61dd5a9a6bfeb663ae3
<|skeleton|> class Animal: """Defined Animal class.""" def __init__(self, species: str, danger_level: int, emoji: str): """Constructor for the Animal class.""" <|body_0|> def fight(self, opponent: Animal) -> Animal: """Simulates a fight between two animals and returns the one with ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Animal: """Defined Animal class.""" def __init__(self, species: str, danger_level: int, emoji: str): """Constructor for the Animal class.""" self.species = species self.danger_level = danger_level self.emoji = emoji def fight(self, opponent: Animal) -> Animal: ...
the_stack_v2_python_sparse
exercises/ex11/animal_kingdom.py
kimcha-0/comp110-21ss1-workspace
train
0
bf9588ee2a4af4d9357a51e13ab14a30f1f6561b
[ "self.res = []\nself.dfs(root, [], target)\nreturn self.res", "if not root:\n return\npath.append(root.val)\ntarget -= root.val\nif target == 0 and (not root.left) and (not root.right):\n self.res.append(path[:])\nself.dfs(root.left, path, target)\nself.dfs(root.right, path, target)\npath.pop()" ]
<|body_start_0|> self.res = [] self.dfs(root, [], target) return self.res <|end_body_0|> <|body_start_1|> if not root: return path.append(root.val) target -= root.val if target == 0 and (not root.left) and (not root.right): self.res.append...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root, target): """Args: root: TreeNode target: int Return: list[list[int]]""" <|body_0|> def dfs(self, root, path, target): """Args: root: TreeNode path: list[int] target: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_074502
902
no_license
[ { "docstring": "Args: root: TreeNode target: int Return: list[list[int]]", "name": "pathSum", "signature": "def pathSum(self, root, target)" }, { "docstring": "Args: root: TreeNode path: list[int] target: int", "name": "dfs", "signature": "def dfs(self, root, path, target)" } ]
2
stack_v2_sparse_classes_30k_train_026794
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, target): Args: root: TreeNode target: int Return: list[list[int]] - def dfs(self, root, path, target): Args: root: TreeNode path: list[int] target: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, target): Args: root: TreeNode target: int Return: list[list[int]] - def dfs(self, root, path, target): Args: root: TreeNode path: list[int] target: int <...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def pathSum(self, root, target): """Args: root: TreeNode target: int Return: list[list[int]]""" <|body_0|> def dfs(self, root, path, target): """Args: root: TreeNode path: list[int] target: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def pathSum(self, root, target): """Args: root: TreeNode target: int Return: list[list[int]]""" self.res = [] self.dfs(root, [], target) return self.res def dfs(self, root, path, target): """Args: root: TreeNode path: list[int] target: int""" if n...
the_stack_v2_python_sparse
剑指offer/剑指 Offer 34. 二叉树中和为某一值的路径.py
AiZhanghan/Leetcode
train
0
39b2110306ffbf176b3fc00fee4e37696b58f44c
[ "firsts, others = data\nstat = self.ChiSquared(firsts) + self.ChiSquared(others)\nreturn stat", "hist = thinkstats2.Hist(lengths)\nobserved = np.array(hist.Freqs(self.values))\nexpected = self.expected_probs * len(lengths)\nstat = sum((observed - expected) ** 2 / expected)\nreturn stat", "firsts, others = self....
<|body_start_0|> firsts, others = data stat = self.ChiSquared(firsts) + self.ChiSquared(others) return stat <|end_body_0|> <|body_start_1|> hist = thinkstats2.Hist(lengths) observed = np.array(hist.Freqs(self.values)) expected = self.expected_probs * len(lengths) ...
Tests difference in pregnancy length using a chi-squared statistic.
PregLengthTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PregLengthTest: """Tests difference in pregnancy length using a chi-squared statistic.""" def TestStatistic(self, data): """Computes the test statistic. data: pair of lists of pregnancy lengths""" <|body_0|> def ChiSquared(self, lengths): """Computes the chi-squa...
stack_v2_sparse_classes_75kplus_train_074503
10,162
permissive
[ { "docstring": "Computes the test statistic. data: pair of lists of pregnancy lengths", "name": "TestStatistic", "signature": "def TestStatistic(self, data)" }, { "docstring": "Computes the chi-squared statistic. lengths: sequence of lengths returns: float", "name": "ChiSquared", "signat...
4
stack_v2_sparse_classes_30k_train_001007
Implement the Python class `PregLengthTest` described below. Class description: Tests difference in pregnancy length using a chi-squared statistic. Method signatures and docstrings: - def TestStatistic(self, data): Computes the test statistic. data: pair of lists of pregnancy lengths - def ChiSquared(self, lengths): ...
Implement the Python class `PregLengthTest` described below. Class description: Tests difference in pregnancy length using a chi-squared statistic. Method signatures and docstrings: - def TestStatistic(self, data): Computes the test statistic. data: pair of lists of pregnancy lengths - def ChiSquared(self, lengths): ...
30a85d5137db95e01461ad21519bc1bdf294044b
<|skeleton|> class PregLengthTest: """Tests difference in pregnancy length using a chi-squared statistic.""" def TestStatistic(self, data): """Computes the test statistic. data: pair of lists of pregnancy lengths""" <|body_0|> def ChiSquared(self, lengths): """Computes the chi-squa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PregLengthTest: """Tests difference in pregnancy length using a chi-squared statistic.""" def TestStatistic(self, data): """Computes the test statistic. data: pair of lists of pregnancy lengths""" firsts, others = data stat = self.ChiSquared(firsts) + self.ChiSquared(others) ...
the_stack_v2_python_sparse
CompStats/hypothesis.py
sunny2309/scipy_conf_notebooks
train
2
51cf65e373f49fdf7b37f5209164cc2983595586
[ "if type(other) == Conv2DNode:\n if other.C_IN < 16:\n return False\n macnode = SearchNodeByType.get_next(other, MACNode, ['content', 'next'])\nelif type(other) == MACNode:\n unrolled_op: UnrolledOperation = other.get_node('!content').get_node('!content')\n if unrolled_op.times != 16:\n re...
<|body_start_0|> if type(other) == Conv2DNode: if other.C_IN < 16: return False macnode = SearchNodeByType.get_next(other, MACNode, ['content', 'next']) elif type(other) == MACNode: unrolled_op: UnrolledOperation = other.get_node('!content').get_node('...
Node for a quad multiply and accumulate for SSE3 CPUs.
MACNodeInt8SSE3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MACNodeInt8SSE3: """Node for a quad multiply and accumulate for SSE3 CPUs.""" def applicable(cls, other): """Determine if this SSE3 with quantization implementation is applicable as replacement for a simple MACNode. The MACNode must be within an UnrolledOperation. The operands res_va...
stack_v2_sparse_classes_75kplus_train_074504
7,547
permissive
[ { "docstring": "Determine if this SSE3 with quantization implementation is applicable as replacement for a simple MACNode. The MACNode must be within an UnrolledOperation. The operands res_var and var1 must be accessed in a specific way to be replaceable by this implementation. Also datatype must be Int8. You c...
2
stack_v2_sparse_classes_30k_train_007180
Implement the Python class `MACNodeInt8SSE3` described below. Class description: Node for a quad multiply and accumulate for SSE3 CPUs. Method signatures and docstrings: - def applicable(cls, other): Determine if this SSE3 with quantization implementation is applicable as replacement for a simple MACNode. The MACNode...
Implement the Python class `MACNodeInt8SSE3` described below. Class description: Node for a quad multiply and accumulate for SSE3 CPUs. Method signatures and docstrings: - def applicable(cls, other): Determine if this SSE3 with quantization implementation is applicable as replacement for a simple MACNode. The MACNode...
987b0efeb56cd150b3a34b672fd5eba05e6d491f
<|skeleton|> class MACNodeInt8SSE3: """Node for a quad multiply and accumulate for SSE3 CPUs.""" def applicable(cls, other): """Determine if this SSE3 with quantization implementation is applicable as replacement for a simple MACNode. The MACNode must be within an UnrolledOperation. The operands res_va...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MACNodeInt8SSE3: """Node for a quad multiply and accumulate for SSE3 CPUs.""" def applicable(cls, other): """Determine if this SSE3 with quantization implementation is applicable as replacement for a simple MACNode. The MACNode must be within an UnrolledOperation. The operands res_var and var1 mu...
the_stack_v2_python_sparse
nncg/nodes/macnodeint8sse3.py
iml130/nncg
train
34
7975b3573651fb25a80d784b8ab4bfb806b6f4d9
[ "self.dataset = dataset\nself.model = model\nself.loss_func = loss_func\nself.optimizer = optimizer", "report = self._initialize_report()\nfor epoch_index in range(num_epochs):\n report['epoch_index'] = epoch_index\n running_loss, running_accuracy = self._train_epoch(batch_size, device)\n report['train_l...
<|body_start_0|> self.dataset = dataset self.model = model self.loss_func = loss_func self.optimizer = optimizer <|end_body_0|> <|body_start_1|> report = self._initialize_report() for epoch_index in range(num_epochs): report['epoch_index'] = epoch_index ...
Trainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trainer: def __init__(self, dataset, model, loss_func, optimizer): """Args: dataset (TwitterDataset): the dataset used for training and evaluation model (SentimentClassifierPerception): the model loss_func (torch.nn.CrossEntropyLoss): the loss function that should be used optimizer (torc...
stack_v2_sparse_classes_75kplus_train_074505
7,619
no_license
[ { "docstring": "Args: dataset (TwitterDataset): the dataset used for training and evaluation model (SentimentClassifierPerception): the model loss_func (torch.nn.CrossEntropyLoss): the loss function that should be used optimizer (torch.optim.Optimizer): the optimizer that should be used to update model weights"...
6
stack_v2_sparse_classes_30k_train_051807
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def __init__(self, dataset, model, loss_func, optimizer): Args: dataset (TwitterDataset): the dataset used for training and evaluation model (SentimentClassifierPerception): the mo...
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def __init__(self, dataset, model, loss_func, optimizer): Args: dataset (TwitterDataset): the dataset used for training and evaluation model (SentimentClassifierPerception): the mo...
43a453a03060c2adf6bf16302d5138cfa77a30d1
<|skeleton|> class Trainer: def __init__(self, dataset, model, loss_func, optimizer): """Args: dataset (TwitterDataset): the dataset used for training and evaluation model (SentimentClassifierPerception): the model loss_func (torch.nn.CrossEntropyLoss): the loss function that should be used optimizer (torc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Trainer: def __init__(self, dataset, model, loss_func, optimizer): """Args: dataset (TwitterDataset): the dataset used for training and evaluation model (SentimentClassifierPerception): the model loss_func (torch.nn.CrossEntropyLoss): the loss function that should be used optimizer (torch.optim.Optimi...
the_stack_v2_python_sparse
workshops/sentiment2020/Solution/Trainer.py
Petlja/PSIML
train
17
9dd4762b3b666d2af38d23b7d6e638dc4cff3af4
[ "branch_type = self.data.get('type', '').lower()\nif branch_type not in BRANCH_TYPES:\n self.error('invalid_branch_type')\nreturn branch_type", "children = self.data.get('children')\ncleaned_children = []\nif children:\n for child in children:\n parser = get_parser(child)\n if not parser:\n ...
<|body_start_0|> branch_type = self.data.get('type', '').lower() if branch_type not in BRANCH_TYPES: self.error('invalid_branch_type') return branch_type <|end_body_0|> <|body_start_1|> children = self.data.get('children') cleaned_children = [] if children: ...
Parser and validator for context branch nodes.
BranchParser
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BranchParser: """Parser and validator for context branch nodes.""" def validate_type(self): """Validates the branch type.""" <|body_0|> def validate_children(self): """Recurses validation to children in branch. Note this occurs regardless if this node is disabled...
stack_v2_sparse_classes_75kplus_train_074506
5,573
permissive
[ { "docstring": "Validates the branch type.", "name": "validate_type", "signature": "def validate_type(self)" }, { "docstring": "Recurses validation to children in branch. Note this occurs regardless if this node is disabled (or if there are warnings), to enable downstream handling.", "name":...
2
stack_v2_sparse_classes_30k_train_028903
Implement the Python class `BranchParser` described below. Class description: Parser and validator for context branch nodes. Method signatures and docstrings: - def validate_type(self): Validates the branch type. - def validate_children(self): Recurses validation to children in branch. Note this occurs regardless if ...
Implement the Python class `BranchParser` described below. Class description: Parser and validator for context branch nodes. Method signatures and docstrings: - def validate_type(self): Validates the branch type. - def validate_children(self): Recurses validation to children in branch. Note this occurs regardless if ...
655c1a766be616cb1357ddff8bc345ab61ae9e8a
<|skeleton|> class BranchParser: """Parser and validator for context branch nodes.""" def validate_type(self): """Validates the branch type.""" <|body_0|> def validate_children(self): """Recurses validation to children in branch. Note this occurs regardless if this node is disabled...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BranchParser: """Parser and validator for context branch nodes.""" def validate_type(self): """Validates the branch type.""" branch_type = self.data.get('type', '').lower() if branch_type not in BRANCH_TYPES: self.error('invalid_branch_type') return branch_type...
the_stack_v2_python_sparse
avocado/query/parsers/context.py
rysdyk/avocado
train
0
5199aa44888f5d65d8a268514879cdf0b8bc756b
[ "prompts = []\nfor ancestry in Ancestry.objects.all():\n prompts.append((ancestry.id, _(ancestry.name)))\nreturn prompts", "if self.value():\n documents = []\n for document in Document.objects.all():\n should_add = False\n for ancestry in document.ancestries():\n if str(ancestry....
<|body_start_0|> prompts = [] for ancestry in Ancestry.objects.all(): prompts.append((ancestry.id, _(ancestry.name))) return prompts <|end_body_0|> <|body_start_1|> if self.value(): documents = [] for document in Document.objects.all(): ...
DocumentAncestryFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentAncestryFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right si...
stack_v2_sparse_classes_75kplus_train_074507
18,088
no_license
[ { "docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.", "name": "lookups", "signature": "def lookups(self, request,...
2
stack_v2_sparse_classes_30k_train_005952
Implement the Python class `DocumentAncestryFilter` described below. Class description: Implement the DocumentAncestryFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear ...
Implement the Python class `DocumentAncestryFilter` described below. Class description: Implement the DocumentAncestryFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear ...
91a2d43edfad0e675bd1000f16424e434b7de2bf
<|skeleton|> class DocumentAncestryFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right si...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DocumentAncestryFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.""" ...
the_stack_v2_python_sparse
smartancestry/data/forms.py
mrommel/SmartAncestry
train
2
a9539eb0cb975083f52680d21e5875e3d3c28129
[ "request_command = self.parser_invoker.remote_start_bolus_command_bytes(self.sequence_id, self.product_id, 1)\nresponse_command_content = self.connectObj.send_receive_command(request_command)\nreturn response_command_content", "request_command = self.parser_invoker.remote_start_bolus_command_bytes(self.sequence_i...
<|body_start_0|> request_command = self.parser_invoker.remote_start_bolus_command_bytes(self.sequence_id, self.product_id, 1) response_command_content = self.connectObj.send_receive_command(request_command) return response_command_content <|end_body_0|> <|body_start_1|> request_command ...
This class is used to define all related methods with bolus.
Bolus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bolus: """This class is used to define all related methods with bolus.""" def start_bolus(self): """This method is used to start bolus. :return: None""" <|body_0|> def stop_bolus(self): """This method is used to stop bolus. :return: None""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_074508
1,581
permissive
[ { "docstring": "This method is used to start bolus. :return: None", "name": "start_bolus", "signature": "def start_bolus(self)" }, { "docstring": "This method is used to stop bolus. :return: None", "name": "stop_bolus", "signature": "def stop_bolus(self)" }, { "docstring": "This ...
3
stack_v2_sparse_classes_30k_train_040425
Implement the Python class `Bolus` described below. Class description: This class is used to define all related methods with bolus. Method signatures and docstrings: - def start_bolus(self): This method is used to start bolus. :return: None - def stop_bolus(self): This method is used to stop bolus. :return: None - de...
Implement the Python class `Bolus` described below. Class description: This class is used to define all related methods with bolus. Method signatures and docstrings: - def start_bolus(self): This method is used to start bolus. :return: None - def stop_bolus(self): This method is used to stop bolus. :return: None - de...
c2a4884a36f4c6c6552fa942143ae5d21c120b41
<|skeleton|> class Bolus: """This class is used to define all related methods with bolus.""" def start_bolus(self): """This method is used to start bolus. :return: None""" <|body_0|> def stop_bolus(self): """This method is used to stop bolus. :return: None""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bolus: """This class is used to define all related methods with bolus.""" def start_bolus(self): """This method is used to start bolus. :return: None""" request_command = self.parser_invoker.remote_start_bolus_command_bytes(self.sequence_id, self.product_id, 1) response_command_co...
the_stack_v2_python_sparse
Keywords/DeliveryView/bolus.py
cassie01/PumpLibrary
train
0
3dbb8bb4ac8d15146bc7c9f998cf82134bf26ac7
[ "if keyword == 'employee':\n cr_emp = EmployeeLL()\n cr_emp.create_employee(user_input)\nelif keyword == 'airplane':\n cr_air = AirplanesLL()\n cr_air.create_airplane(user_input)\nelif keyword == 'destination':\n cr_dest = Des1tinationLL()\n cr_dest.create_destination(user_input)\nelif keyword == ...
<|body_start_0|> if keyword == 'employee': cr_emp = EmployeeLL() cr_emp.create_employee(user_input) elif keyword == 'airplane': cr_air = AirplanesLL() cr_air.create_airplane(user_input) elif keyword == 'destination': cr_dest = Des1tinat...
LL_API_offii
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LL_API_offii: def create(self, keyword, user_input): """Creates new object and saves to Database. keyword: employee,airplane,destination or worktrip user_input: user input for corresponding item""" <|body_0|> def get_list(self, keyword): """Gets updated list from dat...
stack_v2_sparse_classes_75kplus_train_074509
1,367
no_license
[ { "docstring": "Creates new object and saves to Database. keyword: employee,airplane,destination or worktrip user_input: user input for corresponding item", "name": "create", "signature": "def create(self, keyword, user_input)" }, { "docstring": "Gets updated list from database. keyword: employe...
2
null
Implement the Python class `LL_API_offii` described below. Class description: Implement the LL_API_offii class. Method signatures and docstrings: - def create(self, keyword, user_input): Creates new object and saves to Database. keyword: employee,airplane,destination or worktrip user_input: user input for correspondi...
Implement the Python class `LL_API_offii` described below. Class description: Implement the LL_API_offii class. Method signatures and docstrings: - def create(self, keyword, user_input): Creates new object and saves to Database. keyword: employee,airplane,destination or worktrip user_input: user input for correspondi...
ee2b2e6c1422ebab40e36ed3ed23f6f70ee7adb2
<|skeleton|> class LL_API_offii: def create(self, keyword, user_input): """Creates new object and saves to Database. keyword: employee,airplane,destination or worktrip user_input: user input for corresponding item""" <|body_0|> def get_list(self, keyword): """Gets updated list from dat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LL_API_offii: def create(self, keyword, user_input): """Creates new object and saves to Database. keyword: employee,airplane,destination or worktrip user_input: user input for corresponding item""" if keyword == 'employee': cr_emp = EmployeeLL() cr_emp.create_employee(u...
the_stack_v2_python_sparse
random code snippets/LL_API_offi.py
heidars19/3ja-vikna-verkefni
train
3
0839426f506813a7fdc630978a8e3e687e4a7d08
[ "if not root:\n return []\nright = self.rightSideView(root.right)\nleft = self.rightSideView(root.left)\nreturn [root.val] + right + left[len(right):]", "def collect(node, depth):\n if node:\n if depth == len(view):\n view.append(node.val)\n collect(node.right, depth + 1)\n c...
<|body_start_0|> if not root: return [] right = self.rightSideView(root.right) left = self.rightSideView(root.left) return [root.val] + right + left[len(right):] <|end_body_0|> <|body_start_1|> def collect(node, depth): if node: if depth =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rightSideView(self, root): """:type root: TreeNode :rtype: List[int] Recursive, combine right and left Compute the right view of both right and left left subtree, then combine them. For very unbalanced trees, this can be O(n^2), though. beats 79.79%""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_074510
1,757
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int] Recursive, combine right and left Compute the right view of both right and left left subtree, then combine them. For very unbalanced trees, this can be O(n^2), though. beats 79.79%", "name": "rightSideView", "signature": "def rightSideView(self, roo...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rightSideView(self, root): :type root: TreeNode :rtype: List[int] Recursive, combine right and left Compute the right view of both right and left left subtree, then combine t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rightSideView(self, root): :type root: TreeNode :rtype: List[int] Recursive, combine right and left Compute the right view of both right and left left subtree, then combine t...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def rightSideView(self, root): """:type root: TreeNode :rtype: List[int] Recursive, combine right and left Compute the right view of both right and left left subtree, then combine them. For very unbalanced trees, this can be O(n^2), though. beats 79.79%""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rightSideView(self, root): """:type root: TreeNode :rtype: List[int] Recursive, combine right and left Compute the right view of both right and left left subtree, then combine them. For very unbalanced trees, this can be O(n^2), though. beats 79.79%""" if not root: re...
the_stack_v2_python_sparse
LeetCode/199_binary_tree_right_side_view.py
yao23/Machine_Learning_Playground
train
12
5e3061bed3e73b6a588d1770c23e6cea1441ca5a
[ "self.bed_line = {}\nself.strand = {}\nself.score = {}\nself.chr_start_end = {}\n'Read filebed into a bed dict'\nwith open(filebed) as fh:\n for line in fh:\n mylist = line.rstrip('\\n').split('\\t')\n self.chr, self.start, self.end, self.gene, self.this_score, self.this_strand = mylist[0:6]\n ...
<|body_start_0|> self.bed_line = {} self.strand = {} self.score = {} self.chr_start_end = {} 'Read filebed into a bed dict' with open(filebed) as fh: for line in fh: mylist = line.rstrip('\n').split('\t') self.chr, self.start, s...
format the following line into bed information of two sides
BedIO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BedIO: """format the following line into bed information of two sides""" def __init__(self, filebed): """Initialize the values""" <|body_0|> def rename(self, re_tobesub, re_subto): """Change the keys with re.sub(re_tobesub, re_subto)""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_074511
3,622
no_license
[ { "docstring": "Initialize the values", "name": "__init__", "signature": "def __init__(self, filebed)" }, { "docstring": "Change the keys with re.sub(re_tobesub, re_subto)", "name": "rename", "signature": "def rename(self, re_tobesub, re_subto)" } ]
2
stack_v2_sparse_classes_30k_train_037125
Implement the Python class `BedIO` described below. Class description: format the following line into bed information of two sides Method signatures and docstrings: - def __init__(self, filebed): Initialize the values - def rename(self, re_tobesub, re_subto): Change the keys with re.sub(re_tobesub, re_subto)
Implement the Python class `BedIO` described below. Class description: format the following line into bed information of two sides Method signatures and docstrings: - def __init__(self, filebed): Initialize the values - def rename(self, re_tobesub, re_subto): Change the keys with re.sub(re_tobesub, re_subto) <|skele...
e31c8f2f65260ceff110d07b530b67e465e41800
<|skeleton|> class BedIO: """format the following line into bed information of two sides""" def __init__(self, filebed): """Initialize the values""" <|body_0|> def rename(self, re_tobesub, re_subto): """Change the keys with re.sub(re_tobesub, re_subto)""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BedIO: """format the following line into bed information of two sides""" def __init__(self, filebed): """Initialize the values""" self.bed_line = {} self.strand = {} self.score = {} self.chr_start_end = {} 'Read filebed into a bed dict' with open(fi...
the_stack_v2_python_sparse
lh_bin/merge_bed_to_bedpe.py
lhui2010/bundle
train
6
17f63617387c3b441ab93f51252e403d3f32a010
[ "tk.Frame.__init__(self, parent, relief=const.DAO_FRAME_RELIEF, padx=const.DAO_FRAME_PADX, pady=const.DAO_FRAME_PADY, bd=const.DAO_FRAME_BD)\nself._cio_output = []\nself._lbl_title = tk.Label(self, font=const.DAO_TITLE_FONT, text=const.DAO_TITLE_TEXT, padx=const.DAO_TITLE_PADX, pady=const.DAO_TITLE_PADY)\nself._f_o...
<|body_start_0|> tk.Frame.__init__(self, parent, relief=const.DAO_FRAME_RELIEF, padx=const.DAO_FRAME_PADX, pady=const.DAO_FRAME_PADY, bd=const.DAO_FRAME_BD) self._cio_output = [] self._lbl_title = tk.Label(self, font=const.DAO_TITLE_FONT, text=const.DAO_TITLE_TEXT, padx=const.DAO_TITLE_PADX, pad...
DataAugmentationOutputF
[ "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataAugmentationOutputF: def __init__(self, parent, disabled=False): """:param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled.""" <|body_0|> def update_status(self, data_augmentation_options: DataAugmentation): """- Upda...
stack_v2_sparse_classes_75kplus_train_074512
3,130
permissive
[ { "docstring": ":param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled.", "name": "__init__", "signature": "def __init__(self, parent, disabled=False)" }, { "docstring": "- Updates the option's state. :param data_augmentation_options: DataAugmentatio...
4
stack_v2_sparse_classes_30k_train_014534
Implement the Python class `DataAugmentationOutputF` described below. Class description: Implement the DataAugmentationOutputF class. Method signatures and docstrings: - def __init__(self, parent, disabled=False): :param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled. - ...
Implement the Python class `DataAugmentationOutputF` described below. Class description: Implement the DataAugmentationOutputF class. Method signatures and docstrings: - def __init__(self, parent, disabled=False): :param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled. - ...
138c7fa83e084ccb8f5c2ad8827f1fbb2527c00c
<|skeleton|> class DataAugmentationOutputF: def __init__(self, parent, disabled=False): """:param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled.""" <|body_0|> def update_status(self, data_augmentation_options: DataAugmentation): """- Upda...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataAugmentationOutputF: def __init__(self, parent, disabled=False): """:param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled.""" tk.Frame.__init__(self, parent, relief=const.DAO_FRAME_RELIEF, padx=const.DAO_FRAME_PADX, pady=const.DAO_FRAME_PADY, ...
the_stack_v2_python_sparse
graphics/output/data_augmentation_output_f.py
iliesidaniel/image-classification
train
0
5d6a72eab05b847c842b48fc198b0ee85e3fac72
[ "local_domains = load_data('cloud')['domains']\nremote_domains = self.do.get_domains()\nremote_domain_names = [d.name for d in remote_domains]\nmissing_domains = [d for d in local_domains if d['fqdn'] not in remote_domain_names]\nfor domain in missing_domains:\n ui = self.ui.group(domain['fqdn'])\n droplet = ...
<|body_start_0|> local_domains = load_data('cloud')['domains'] remote_domains = self.do.get_domains() remote_domain_names = [d.name for d in remote_domains] missing_domains = [d for d in local_domains if d['fqdn'] not in remote_domain_names] for domain in missing_domains: ...
A collection of actions for network domains.
Domains
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Domains: """A collection of actions for network domains.""" def create(self): """Create domains on Digital Ocean from the manifest.""" <|body_0|> def sync(self): """Ensure that the Digital Ocean domains match the manifest.""" <|body_1|> def prune(sel...
stack_v2_sparse_classes_75kplus_train_074513
3,691
no_license
[ { "docstring": "Create domains on Digital Ocean from the manifest.", "name": "create", "signature": "def create(self)" }, { "docstring": "Ensure that the Digital Ocean domains match the manifest.", "name": "sync", "signature": "def sync(self)" }, { "docstring": "Remove unused rem...
3
stack_v2_sparse_classes_30k_val_001585
Implement the Python class `Domains` described below. Class description: A collection of actions for network domains. Method signatures and docstrings: - def create(self): Create domains on Digital Ocean from the manifest. - def sync(self): Ensure that the Digital Ocean domains match the manifest. - def prune(self): ...
Implement the Python class `Domains` described below. Class description: A collection of actions for network domains. Method signatures and docstrings: - def create(self): Create domains on Digital Ocean from the manifest. - def sync(self): Ensure that the Digital Ocean domains match the manifest. - def prune(self): ...
ca6c408cbc552b21ee0761eb6f34b7e8c2656153
<|skeleton|> class Domains: """A collection of actions for network domains.""" def create(self): """Create domains on Digital Ocean from the manifest.""" <|body_0|> def sync(self): """Ensure that the Digital Ocean domains match the manifest.""" <|body_1|> def prune(sel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Domains: """A collection of actions for network domains.""" def create(self): """Create domains on Digital Ocean from the manifest.""" local_domains = load_data('cloud')['domains'] remote_domains = self.do.get_domains() remote_domain_names = [d.name for d in remote_domains...
the_stack_v2_python_sparse
infrastructure/fibula/actions/domains.py
justinlocsei/fibula
train
0
13d294af1f0a0e6e4e844d42da07707dd37904d2
[ "self.big_list = list()\nfor pos in range(PRIME):\n self.big_list.append(list())", "pos = key % PRIME\nfound = False\nfor pair in self.big_list[pos]:\n if pair[0] == key:\n found = True\n pair[1] = value\nif not found:\n self.big_list[pos].append([key, value])", "pos = key % PRIME\nfor pa...
<|body_start_0|> self.big_list = list() for pos in range(PRIME): self.big_list.append(list()) <|end_body_0|> <|body_start_1|> pos = key % PRIME found = False for pair in self.big_list[pos]: if pair[0] == key: found = True p...
MyHashMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key, value): """value will always be non-negative. :type key: int :type value: int :rtype: void""" <|body_1|> def get(self, key): """Returns the va...
stack_v2_sparse_classes_75kplus_train_074514
1,553
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "value will always be non-negative. :type key: int :type value: int :rtype: void", "name": "put", "signature": "def put(self, key, value)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_045242
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: void - def get(...
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: void - def get(...
8f88cae7cc982ab8495e185914b1baeceb294060
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key, value): """value will always be non-negative. :type key: int :type value: int :rtype: void""" <|body_1|> def get(self, key): """Returns the va...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyHashMap: def __init__(self): """Initialize your data structure here.""" self.big_list = list() for pos in range(PRIME): self.big_list.append(list()) def put(self, key, value): """value will always be non-negative. :type key: int :type value: int :rtype: void"...
the_stack_v2_python_sparse
706. Design HashMap/solution.py
huangruihaocst/leetcode-python
train
0
71a6f0f730df2831c9dcda704e5ec44c73fd59f1
[ "super(ResConfigSettings, self).set_values()\nself.env['ir.config_parameter'].sudo().set_param('recruitment.li_username', self.li_username)\nself.env['ir.config_parameter'].sudo().set_param('recruitment.li_password', self.li_password)", "res = super(ResConfigSettings, self).get_values()\nres.update(li_username=se...
<|body_start_0|> super(ResConfigSettings, self).set_values() self.env['ir.config_parameter'].sudo().set_param('recruitment.li_username', self.li_username) self.env['ir.config_parameter'].sudo().set_param('recruitment.li_password', self.li_password) <|end_body_0|> <|body_start_1|> res = ...
config settings
ResConfigSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResConfigSettings: """config settings""" def set_values(self): """super the config to set the value""" <|body_0|> def get_values(self): """super the config to get the value""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(ResConfigSettings,...
stack_v2_sparse_classes_75kplus_train_074515
1,944
no_license
[ { "docstring": "super the config to set the value", "name": "set_values", "signature": "def set_values(self)" }, { "docstring": "super the config to get the value", "name": "get_values", "signature": "def get_values(self)" } ]
2
stack_v2_sparse_classes_30k_train_014918
Implement the Python class `ResConfigSettings` described below. Class description: config settings Method signatures and docstrings: - def set_values(self): super the config to set the value - def get_values(self): super the config to get the value
Implement the Python class `ResConfigSettings` described below. Class description: config settings Method signatures and docstrings: - def set_values(self): super the config to set the value - def get_values(self): super the config to get the value <|skeleton|> class ResConfigSettings: """config settings""" ...
4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14
<|skeleton|> class ResConfigSettings: """config settings""" def set_values(self): """super the config to set the value""" <|body_0|> def get_values(self): """super the config to get the value""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResConfigSettings: """config settings""" def set_values(self): """super the config to set the value""" super(ResConfigSettings, self).set_values() self.env['ir.config_parameter'].sudo().set_param('recruitment.li_username', self.li_username) self.env['ir.config_parameter']....
the_stack_v2_python_sparse
hr_linkedin_recruitment/models/recruitment_config.py
CybroOdoo/CybroAddons
train
209
af9a0485da0352e489101eb0b9a9487f30618c6d
[ "self.kMeans = KMeans(n_clusters=k, init='k-means++').fit(self.affinity)\nself.nClusters = k\nself.clusterLabels = self.kMeans.labels_\nself.confusionMatrix = confusion_matrix(self.trueLabels, self.clusterLabels)\nreturn self.kMeans", "try:\n trueLabels, clusterLabels = (self.trueLabels, self.clusterLabels)\ne...
<|body_start_0|> self.kMeans = KMeans(n_clusters=k, init='k-means++').fit(self.affinity) self.nClusters = k self.clusterLabels = self.kMeans.labels_ self.confusionMatrix = confusion_matrix(self.trueLabels, self.clusterLabels) return self.kMeans <|end_body_0|> <|body_start_1|> ...
Interface to k-means clustering.
KMeansAnalysis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KMeansAnalysis: """Interface to k-means clustering.""" def cluster(self, k): """Cluster the data using the k-means method. @return: An C{sklearn.cluster.KMeans} instance.""" <|body_0|> def print_(self, margin='', result=None): """Print details of the clustering. ...
stack_v2_sparse_classes_75kplus_train_074516
9,448
no_license
[ { "docstring": "Cluster the data using the k-means method. @return: An C{sklearn.cluster.KMeans} instance.", "name": "cluster", "signature": "def cluster(self, k)" }, { "docstring": "Print details of the clustering. @param margin: A C{str} that should be inserted at the start of each line of out...
2
null
Implement the Python class `KMeansAnalysis` described below. Class description: Interface to k-means clustering. Method signatures and docstrings: - def cluster(self, k): Cluster the data using the k-means method. @return: An C{sklearn.cluster.KMeans} instance. - def print_(self, margin='', result=None): Print detail...
Implement the Python class `KMeansAnalysis` described below. Class description: Interface to k-means clustering. Method signatures and docstrings: - def cluster(self, k): Cluster the data using the k-means method. @return: An C{sklearn.cluster.KMeans} instance. - def print_(self, margin='', result=None): Print detail...
3e848dfa66f5fd07f1fb709abc935baff9f43d87
<|skeleton|> class KMeansAnalysis: """Interface to k-means clustering.""" def cluster(self, k): """Cluster the data using the k-means method. @return: An C{sklearn.cluster.KMeans} instance.""" <|body_0|> def print_(self, margin='', result=None): """Print details of the clustering. ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KMeansAnalysis: """Interface to k-means clustering.""" def cluster(self, k): """Cluster the data using the k-means method. @return: An C{sklearn.cluster.KMeans} instance.""" self.kMeans = KMeans(n_clusters=k, init='k-means++').fit(self.affinity) self.nClusters = k self.clu...
the_stack_v2_python_sparse
light/performance/cluster.py
acorg/light-matter
train
0
7fa56bbc0d870d32bf47bd7f6c884a9273d26b8a
[ "super(LimitConsumer, self).__init__(columns=columns, consumer=consumer)\nself.limit = limit\nself.count = 0", "if self.count < self.limit:\n self.count += 1\n return row\nelse:\n raise StopIteration()" ]
<|body_start_0|> super(LimitConsumer, self).__init__(columns=columns, consumer=consumer) self.limit = limit self.count = 0 <|end_body_0|> <|body_start_1|> if self.count < self.limit: self.count += 1 return row else: raise StopIteration() <|end...
Consumer that limits the number of rows that are passed on to a downstream consumer. Raises a StopIteration error when the maximum number of rows is reached.
LimitConsumer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LimitConsumer: """Consumer that limits the number of rows that are passed on to a downstream consumer. Raises a StopIteration error when the maximum number of rows is reached.""" def __init__(self, columns: DatasetSchema, limit: int, consumer: Optional[StreamConsumer]=None): """Initi...
stack_v2_sparse_classes_75kplus_train_074517
4,564
permissive
[ { "docstring": "Initialize the row limit and the downstream consumer. Parameters ---------- columns: list of string Names of columns for the rows that the consumer will receive. limit: int Maximum number of rows that are passed on to the downstream consumer. consumer: openclean.data.stream.base.StreamConsumer, ...
2
stack_v2_sparse_classes_30k_train_028255
Implement the Python class `LimitConsumer` described below. Class description: Consumer that limits the number of rows that are passed on to a downstream consumer. Raises a StopIteration error when the maximum number of rows is reached. Method signatures and docstrings: - def __init__(self, columns: DatasetSchema, li...
Implement the Python class `LimitConsumer` described below. Class description: Consumer that limits the number of rows that are passed on to a downstream consumer. Raises a StopIteration error when the maximum number of rows is reached. Method signatures and docstrings: - def __init__(self, columns: DatasetSchema, li...
e3d0e04f90468c49f29ca53edc2feb12465c24d5
<|skeleton|> class LimitConsumer: """Consumer that limits the number of rows that are passed on to a downstream consumer. Raises a StopIteration error when the maximum number of rows is reached.""" def __init__(self, columns: DatasetSchema, limit: int, consumer: Optional[StreamConsumer]=None): """Initi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LimitConsumer: """Consumer that limits the number of rows that are passed on to a downstream consumer. Raises a StopIteration error when the maximum number of rows is reached.""" def __init__(self, columns: DatasetSchema, limit: int, consumer: Optional[StreamConsumer]=None): """Initialize the row...
the_stack_v2_python_sparse
openclean/operator/transform/limit.py
Denisfench/openclean-core
train
0
cd6a17c59a192b74c35039e7d709358552edee49
[ "num_schools_elementary_laval_xpath = '//*[@id=\"MainContent\"]/div[1]/p[2]/a/@href'\nnum_schools_secondary_laval_xpath = '//*[@id=\"MainContent\"]/div[1]/p[4]/a/@href'\nnum_schools_elementary_lanaudiere1_xpath = '//*[@id=\"MainContent\"]/div[1]/p[8]/a/@href'\nnum_schools_secondary_lanaudiere1_xpath = '//*[@id=\"Ma...
<|body_start_0|> num_schools_elementary_laval_xpath = '//*[@id="MainContent"]/div[1]/p[2]/a/@href' num_schools_secondary_laval_xpath = '//*[@id="MainContent"]/div[1]/p[4]/a/@href' num_schools_elementary_lanaudiere1_xpath = '//*[@id="MainContent"]/div[1]/p[8]/a/@href' num_schools_secondar...
a scrapy spider to crawl swlauriersb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found
MontrealSwlauriersbSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MontrealSwlauriersbSpider: """a scrapy spider to crawl swlauriersb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): ...
stack_v2_sparse_classes_75kplus_train_074518
6,134
no_license
[ { "docstring": "parse the start urls to get a list of schools urls for all schools types and cities", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "get required information for each school this method is called once for each school page", "name": "parse_school_...
3
stack_v2_sparse_classes_30k_train_035804
Implement the Python class `MontrealSwlauriersbSpider` described below. Class description: a scrapy spider to crawl swlauriersb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Met...
Implement the Python class `MontrealSwlauriersbSpider` described below. Class description: a scrapy spider to crawl swlauriersb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Met...
350264cf6da323692c2838d8cb235ef61085851b
<|skeleton|> class MontrealSwlauriersbSpider: """a scrapy spider to crawl swlauriersb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MontrealSwlauriersbSpider: """a scrapy spider to crawl swlauriersb.qc.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): """parse the ...
the_stack_v2_python_sparse
school_scraping/spiders/montreal_swlauriersb.py
ramadanmostafa/canada_school_scraping
train
0
eba94bc2d5c5c8474948afec4ef725809f540735
[ "self.row = 0\nself.col = -1\nself.matrix = vec2d", "if self.hasNext():\n self.col += 1\n return self.matrix[self.row][self.col]\nelse:\n return None", "if self.row >= len(self.matrix):\n return False\nif self.col >= len(self.matrix[self.row]) - 1:\n self.row += 1\n while self.row < len(self.m...
<|body_start_0|> self.row = 0 self.col = -1 self.matrix = vec2d <|end_body_0|> <|body_start_1|> if self.hasNext(): self.col += 1 return self.matrix[self.row][self.col] else: return None <|end_body_1|> <|body_start_2|> if self.row >= l...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_75kplus_train_074519
795
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
stack_v2_sparse_classes_30k_train_054287
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
15f012927dc34b5d751af6633caa5e8882d26ff7
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.row = 0 self.col = -1 self.matrix = vec2d def next(self): """:rtype: int""" if self.hasNext(): self.col += 1 return sel...
the_stack_v2_python_sparse
python/251.Flatten2DVector.py
MaxPoon/Leetcode
train
15
f40c0828f572115de0f53f279116da123beae028
[ "content = response.xpath(\"//div[@class='dw_table']//div[@class='el']\")\nfor con in content:\n item = {}\n item['work_name'] = con.xpath('./p/span/a/@title').extract_first()\n href = con.xpath('./p/span/a/@href').extract_first()\n item['company_name'] = con.xpath('./span[@class=\"t2\"]/a/@title').extr...
<|body_start_0|> content = response.xpath("//div[@class='dw_table']//div[@class='el']") for con in content: item = {} item['work_name'] = con.xpath('./p/span/a/@title').extract_first() href = con.xpath('./p/span/a/@href').extract_first() item['company_name...
MySpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySpider: def parse(self, response): """获取一级页面数据""" <|body_0|> def parse_work_info(self, response): """获取二级页面数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> content = response.xpath("//div[@class='dw_table']//div[@class='el']") for con in...
stack_v2_sparse_classes_75kplus_train_074520
2,992
no_license
[ { "docstring": "获取一级页面数据", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "获取二级页面数据", "name": "parse_work_info", "signature": "def parse_work_info(self, response)" } ]
2
null
Implement the Python class `MySpider` described below. Class description: Implement the MySpider class. Method signatures and docstrings: - def parse(self, response): 获取一级页面数据 - def parse_work_info(self, response): 获取二级页面数据
Implement the Python class `MySpider` described below. Class description: Implement the MySpider class. Method signatures and docstrings: - def parse(self, response): 获取一级页面数据 - def parse_work_info(self, response): 获取二级页面数据 <|skeleton|> class MySpider: def parse(self, response): """获取一级页面数据""" <...
2dd9e53dd53c6a53ef1eeab08593524b4119b25e
<|skeleton|> class MySpider: def parse(self, response): """获取一级页面数据""" <|body_0|> def parse_work_info(self, response): """获取二级页面数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MySpider: def parse(self, response): """获取一级页面数据""" content = response.xpath("//div[@class='dw_table']//div[@class='el']") for con in content: item = {} item['work_name'] = con.xpath('./p/span/a/@title').extract_first() href = con.xpath('./p/span/a/@...
the_stack_v2_python_sparse
curriculum_design_qianchengwuyou/wuyouSpider/wuyouSpider/spiders/mySpider.py
Tiancaichao/MyCrawlerProjects
train
0
a21c4f14ab80b4b232dec752560d1bcbb74f2f55
[ "if end_word not in word_list:\n return 0\nlength = len(begin_word)\nall_combo_dict = defaultdict(list)\nfor word in word_list:\n \"\\n 对每个单词,以通配符对应该单词的方式记录下来,比如hot单词,\\n 记录方式为{'*ot':['hot'], 'h*t':['hot'], 'ho*':['hot']}\\n 把所有的单词分别都统计出来\\n \"\n for ...
<|body_start_0|> if end_word not in word_list: return 0 length = len(begin_word) all_combo_dict = defaultdict(list) for word in word_list: "\n 对每个单词,以通配符对应该单词的方式记录下来,比如hot单词,\n 记录方式为{'*ot':['hot'], 'h*t':['hot'], 'ho*':['hot']}\n ...
给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。 转换需遵循如下规则: 每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明: 如果不存在这样的转换序列,返回 0。 所有单词具有相同的长度。 所有单词只由小写字母组成。 字典中不存在重复的单词。 你可以假设 beginWord 和 endWord 是非空的,且二者不相同。 示例 1: 输入: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"] 输出: 5 解释...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。 转换需遵循如下规则: 每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明: 如果不存在这样的转换序列,返回 0。 所有单词具有相同的长度。 所有单词只由小写字母组成。 字典中不存在重复的单词。 你可以假设 beginWord 和 endWord 是非空的,且二者不相同。 示例 1: 输入: beginWord = "hit", endWord = "cog", wordList = ["hot","do...
stack_v2_sparse_classes_75kplus_train_074521
4,754
no_license
[ { "docstring": ":type begin_word: str :type end_word: str :type word_list: List[str] :rtype: int 从beginword开始,寻找wordlist中与beginword单词相差一个字母的单词,获取到这些单词,然后再往下分别 寻找与之相差一个字母的单词,直到首先找到endword。", "name": "ladder_length", "signature": "def ladder_length(self, begin_word, end_word, word_list)" }, { "doc...
2
null
Implement the Python class `Solution` described below. Class description: 给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。 转换需遵循如下规则: 每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明: 如果不存在这样的转换序列,返回 0。 所有单词具有相同的长度。 所有单词只由小写字母组成。 字典中不存在重复的单词。 你可以假设 beginWord 和 endWord 是非空的,且二者不相同。 示例 1: 输入: beginWord = "hit",...
Implement the Python class `Solution` described below. Class description: 给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。 转换需遵循如下规则: 每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明: 如果不存在这样的转换序列,返回 0。 所有单词具有相同的长度。 所有单词只由小写字母组成。 字典中不存在重复的单词。 你可以假设 beginWord 和 endWord 是非空的,且二者不相同。 示例 1: 输入: beginWord = "hit",...
2c534185854c1a6f5ffdb2698f9db9989f30a25b
<|skeleton|> class Solution: """给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。 转换需遵循如下规则: 每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明: 如果不存在这样的转换序列,返回 0。 所有单词具有相同的长度。 所有单词只由小写字母组成。 字典中不存在重复的单词。 你可以假设 beginWord 和 endWord 是非空的,且二者不相同。 示例 1: 输入: beginWord = "hit", endWord = "cog", wordList = ["hot","do...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。 转换需遵循如下规则: 每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明: 如果不存在这样的转换序列,返回 0。 所有单词具有相同的长度。 所有单词只由小写字母组成。 字典中不存在重复的单词。 你可以假设 beginWord 和 endWord 是非空的,且二者不相同。 示例 1: 输入: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot...
the_stack_v2_python_sparse
Week 06/id_668/leetcode_127_668.py
Carryours/algorithm004-03
train
2
324fda191b914005214da2150294efd4984e6b74
[ "self._window = window\nself.name = name\nself.view = view", "try:\n meth = getattr(self._window.scene, self.view)\n meth()\nexcept AttributeError:\n pass" ]
<|body_start_0|> self._window = window self.name = name self.view = view <|end_body_0|> <|body_start_1|> try: meth = getattr(self._window.scene, self.view) meth() except AttributeError: pass <|end_body_1|>
Sets the scene to a particular view.
SpecialViewAction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecialViewAction: """Sets the scene to a particular view.""" def __init__(self, window, name, view): """Creates a new action.""" <|body_0|> def perform(self): """Performs the action.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._window ...
stack_v2_sparse_classes_75kplus_train_074522
17,920
no_license
[ { "docstring": "Creates a new action.", "name": "__init__", "signature": "def __init__(self, window, name, view)" }, { "docstring": "Performs the action.", "name": "perform", "signature": "def perform(self)" } ]
2
stack_v2_sparse_classes_30k_val_000812
Implement the Python class `SpecialViewAction` described below. Class description: Sets the scene to a particular view. Method signatures and docstrings: - def __init__(self, window, name, view): Creates a new action. - def perform(self): Performs the action.
Implement the Python class `SpecialViewAction` described below. Class description: Sets the scene to a particular view. Method signatures and docstrings: - def __init__(self, window, name, view): Creates a new action. - def perform(self): Performs the action. <|skeleton|> class SpecialViewAction: """Sets the sce...
5466f5858dbd2f1f082fa0d7417b57c8fb068fad
<|skeleton|> class SpecialViewAction: """Sets the scene to a particular view.""" def __init__(self, window, name, view): """Creates a new action.""" <|body_0|> def perform(self): """Performs the action.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpecialViewAction: """Sets the scene to a particular view.""" def __init__(self, window, name, view): """Creates a new action.""" self._window = window self.name = name self.view = view def perform(self): """Performs the action.""" try: met...
the_stack_v2_python_sparse
maps/build/mayavi/enthought/tvtk/tools/ivtk.py
m-elhussieny/code
train
0
a1a9ba52b07d22412429f349408fae2f564274e2
[ "if not filename:\n raise ValueError(f'{filename} is not a valid file')\nwith open(filename, encoding='utf8') as fname:\n try:\n self.profile = yaml.safe_load(fname)\n except yaml.YAMLError as ex:\n raise ValueError('f{filename} is not a valid YAML file: {ex}') from ex\n if self.profile is...
<|body_start_0|> if not filename: raise ValueError(f'{filename} is not a valid file') with open(filename, encoding='utf8') as fname: try: self.profile = yaml.safe_load(fname) except yaml.YAMLError as ex: raise ValueError('f{filename} is...
Manages which scan levels are run for packages.
Profile
[ "CC0-1.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Profile: """Manages which scan levels are run for packages.""" def __init__(self, filename: str) -> None: """Initialize profile.""" <|body_0|> def get_package_level(self, package: Package) -> Union[str, Any]: """Get which scan level to use for a given package."""...
stack_v2_sparse_classes_75kplus_train_074523
1,305
permissive
[ { "docstring": "Initialize profile.", "name": "__init__", "signature": "def __init__(self, filename: str) -> None" }, { "docstring": "Get which scan level to use for a given package.", "name": "get_package_level", "signature": "def get_package_level(self, package: Package) -> Union[str, ...
2
stack_v2_sparse_classes_30k_test_000273
Implement the Python class `Profile` described below. Class description: Manages which scan levels are run for packages. Method signatures and docstrings: - def __init__(self, filename: str) -> None: Initialize profile. - def get_package_level(self, package: Package) -> Union[str, Any]: Get which scan level to use fo...
Implement the Python class `Profile` described below. Class description: Manages which scan levels are run for packages. Method signatures and docstrings: - def __init__(self, filename: str) -> None: Initialize profile. - def get_package_level(self, package: Package) -> Union[str, Any]: Get which scan level to use fo...
25225188b04dbdebb04674d0b3c8af886ccf87c3
<|skeleton|> class Profile: """Manages which scan levels are run for packages.""" def __init__(self, filename: str) -> None: """Initialize profile.""" <|body_0|> def get_package_level(self, package: Package) -> Union[str, Any]: """Get which scan level to use for a given package."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Profile: """Manages which scan levels are run for packages.""" def __init__(self, filename: str) -> None: """Initialize profile.""" if not filename: raise ValueError(f'{filename} is not a valid file') with open(filename, encoding='utf8') as fname: try: ...
the_stack_v2_python_sparse
statick_tool/profile.py
sscpac/statick
train
73
dc31babbf9be1b75cc8b3de77a77242c0080223d
[ "self.keys = keys or []\nself.obj = copy.copy(obj)\nself.hook = can(hook)\nfor key in keys:\n setattr(self.obj, key, can(getattr(obj, key)))\nself.buffers = []", "if g is None:\n g = {}\nobj = self.obj\nfor key in self.keys:\n setattr(obj, key, uncan(getattr(obj, key), g))\nif self.hook:\n self.hook =...
<|body_start_0|> self.keys = keys or [] self.obj = copy.copy(obj) self.hook = can(hook) for key in keys: setattr(self.obj, key, can(getattr(obj, key))) self.buffers = [] <|end_body_0|> <|body_start_1|> if g is None: g = {} obj = self.obj ...
A canned object.
CannedObject
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CannedObject: """A canned object.""" def __init__(self, obj, keys=None, hook=None): """can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional)...
stack_v2_sparse_classes_75kplus_train_074524
13,378
permissive
[ { "docstring": "can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional) An optional extra callable, which can do additional processing of the uncanned object. Notes -----...
2
stack_v2_sparse_classes_30k_train_035665
Implement the Python class `CannedObject` described below. Class description: A canned object. Method signatures and docstrings: - def __init__(self, obj, keys=None, hook=None): can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will b...
Implement the Python class `CannedObject` described below. Class description: A canned object. Method signatures and docstrings: - def __init__(self, obj, keys=None, hook=None): can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will b...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class CannedObject: """A canned object.""" def __init__(self, obj, keys=None, hook=None): """can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CannedObject: """A canned object.""" def __init__(self, obj, keys=None, hook=None): """can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional) An optional ...
the_stack_v2_python_sparse
contrib/python/ipykernel/py3/ipykernel/pickleutil.py
catboost/catboost
train
8,012
c6b0e1e1489fd9a86b00426967ba18a37300a96b
[ "tweet = line.split(',')[1].lower()\ntweet = re.sub('[^a-z 0-9]', '', tweet)\nwords = tweet.split()\nfor word in words:\n yield (word, 1)", "total = sum(values)\nif total > 10000:\n yield (key, total)" ]
<|body_start_0|> tweet = line.split(',')[1].lower() tweet = re.sub('[^a-z 0-9]', '', tweet) words = tweet.split() for word in words: yield (word, 1) <|end_body_0|> <|body_start_1|> total = sum(values) if total > 10000: yield (key, total) <|end_bod...
MRWordFrequencyCount
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MRWordFrequencyCount: def mapper(self, _, line): """Parse tweets from input, remove non-alphanumeric characters and return key,value pair for each word""" <|body_0|> def reducer(self, key, values): """Aggregate total instances of words, and only return those that app...
stack_v2_sparse_classes_75kplus_train_074525
1,406
no_license
[ { "docstring": "Parse tweets from input, remove non-alphanumeric characters and return key,value pair for each word", "name": "mapper", "signature": "def mapper(self, _, line)" }, { "docstring": "Aggregate total instances of words, and only return those that appear more than 10,000 times", "...
2
stack_v2_sparse_classes_30k_train_010693
Implement the Python class `MRWordFrequencyCount` described below. Class description: Implement the MRWordFrequencyCount class. Method signatures and docstrings: - def mapper(self, _, line): Parse tweets from input, remove non-alphanumeric characters and return key,value pair for each word - def reducer(self, key, va...
Implement the Python class `MRWordFrequencyCount` described below. Class description: Implement the MRWordFrequencyCount class. Method signatures and docstrings: - def mapper(self, _, line): Parse tweets from input, remove non-alphanumeric characters and return key,value pair for each word - def reducer(self, key, va...
a0706171ec7d502eb85397862b1daf9912ac15a5
<|skeleton|> class MRWordFrequencyCount: def mapper(self, _, line): """Parse tweets from input, remove non-alphanumeric characters and return key,value pair for each word""" <|body_0|> def reducer(self, key, values): """Aggregate total instances of words, and only return those that app...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MRWordFrequencyCount: def mapper(self, _, line): """Parse tweets from input, remove non-alphanumeric characters and return key,value pair for each word""" tweet = line.split(',')[1].lower() tweet = re.sub('[^a-z 0-9]', '', tweet) words = tweet.split() for word in words:...
the_stack_v2_python_sparse
word_count.py
nickhamlin/MIDS-W205_A4
train
0
7fd83ee6c3e489d73a224e09e00cd92c0be79640
[ "article = get_object_or_404(Articles, slug=article_slug)\ncomments = get_object_or_404(Comments, id=id, article=article)\ncomment = Comments.objects.get(id=id)\nif comment.user != request.user:\n data = {'error': 'You are not allowed to edit this comment'}\n return Response(data, status=status.HTTP_403_FORB...
<|body_start_0|> article = get_object_or_404(Articles, slug=article_slug) comments = get_object_or_404(Comments, id=id, article=article) comment = Comments.objects.get(id=id) if comment.user != request.user: data = {'error': 'You are not allowed to edit this comment'} ...
Handles all requests for updating and deleting requests
UpdateDeleteCommentView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDeleteCommentView: """Handles all requests for updating and deleting requests""" def put(self, request, article_slug, id): """Handles all requests by user to update their comments""" <|body_0|> def delete(self, request, article_slug, id): """handles all req...
stack_v2_sparse_classes_75kplus_train_074526
8,741
permissive
[ { "docstring": "Handles all requests by user to update their comments", "name": "put", "signature": "def put(self, request, article_slug, id)" }, { "docstring": "handles all requests for uses to delete their comments", "name": "delete", "signature": "def delete(self, request, article_slu...
2
stack_v2_sparse_classes_30k_train_006522
Implement the Python class `UpdateDeleteCommentView` described below. Class description: Handles all requests for updating and deleting requests Method signatures and docstrings: - def put(self, request, article_slug, id): Handles all requests by user to update their comments - def delete(self, request, article_slug,...
Implement the Python class `UpdateDeleteCommentView` described below. Class description: Handles all requests for updating and deleting requests Method signatures and docstrings: - def put(self, request, article_slug, id): Handles all requests by user to update their comments - def delete(self, request, article_slug,...
ff4f1ba34d074e68e49f7896848f81b729542e1f
<|skeleton|> class UpdateDeleteCommentView: """Handles all requests for updating and deleting requests""" def put(self, request, article_slug, id): """Handles all requests by user to update their comments""" <|body_0|> def delete(self, request, article_slug, id): """handles all req...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateDeleteCommentView: """Handles all requests for updating and deleting requests""" def put(self, request, article_slug, id): """Handles all requests by user to update their comments""" article = get_object_or_404(Articles, slug=article_slug) comments = get_object_or_404(Commen...
the_stack_v2_python_sparse
authors/apps/comments/views.py
rfpremier/ah-django
train
0
2abaee166f1a4df5b395d72c015ba69770a13432
[ "self.flow_hash = flow_hash\nself.classified = 0\nself.classification_tag = ''\nself.classification_time = 0\nself.actions = {}\nself.clsfn = clsfn\nself.time_limit = time_limit\nself.logger = logger\ndb_data = {'flow_hash': self.flow_hash}\ndb_data['classification_time'] = {'$gte': datetime.datetime.now() - self.t...
<|body_start_0|> self.flow_hash = flow_hash self.classified = 0 self.classification_tag = '' self.classification_time = 0 self.actions = {} self.clsfn = clsfn self.time_limit = time_limit self.logger = logger db_data = {'flow_hash': self.flow_hash}...
An object that represents an individual traffic classification
Classification
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Classification: """An object that represents an individual traffic classification""" def __init__(self, flow_hash, clsfn, time_limit, logger): """Retrieve classification data from MongoDB collection for a particular flow hash within a time range. time range is from current time backw...
stack_v2_sparse_classes_75kplus_train_074527
44,404
permissive
[ { "docstring": "Retrieve classification data from MongoDB collection for a particular flow hash within a time range. time range is from current time backwards by number of seconds defined in config for classification_time_limit Setting test returns database query execution statistics", "name": "__init__", ...
4
stack_v2_sparse_classes_30k_train_020632
Implement the Python class `Classification` described below. Class description: An object that represents an individual traffic classification Method signatures and docstrings: - def __init__(self, flow_hash, clsfn, time_limit, logger): Retrieve classification data from MongoDB collection for a particular flow hash w...
Implement the Python class `Classification` described below. Class description: An object that represents an individual traffic classification Method signatures and docstrings: - def __init__(self, flow_hash, clsfn, time_limit, logger): Retrieve classification data from MongoDB collection for a particular flow hash w...
55cc27e81defc42775ff563bfbef31800e089b14
<|skeleton|> class Classification: """An object that represents an individual traffic classification""" def __init__(self, flow_hash, clsfn, time_limit, logger): """Retrieve classification data from MongoDB collection for a particular flow hash within a time range. time range is from current time backw...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Classification: """An object that represents an individual traffic classification""" def __init__(self, flow_hash, clsfn, time_limit, logger): """Retrieve classification data from MongoDB collection for a particular flow hash within a time range. time range is from current time backwards by numbe...
the_stack_v2_python_sparse
nmeta/flows.py
awesome-nfv/nmeta
train
0
f3647ae0647d46e102b017bec622a593a5338613
[ "request = self.get_serializer_context()['request']\nif request.query_params.get('brief', False):\n return serializers.NestedDeviceSerializer\nelif 'config_context' in request.query_params.get('exclude', []):\n return serializers.DeviceSerializer\nreturn serializers.DeviceWithConfigContextSerializer", "devi...
<|body_start_0|> request = self.get_serializer_context()['request'] if request.query_params.get('brief', False): return serializers.NestedDeviceSerializer elif 'config_context' in request.query_params.get('exclude', []): return serializers.DeviceSerializer return ...
DeviceViewSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceViewSet: def get_serializer_class(self): """Select the specific serializer based on the request context. If the `brief` query param equates to True, return the NestedDeviceSerializer If the `exclude` query param includes `config_context` as a value, return the DeviceSerializer Else...
stack_v2_sparse_classes_75kplus_train_074528
24,145
permissive
[ { "docstring": "Select the specific serializer based on the request context. If the `brief` query param equates to True, return the NestedDeviceSerializer If the `exclude` query param includes `config_context` as a value, return the DeviceSerializer Else, return the DeviceWithConfigContextSerializer", "name...
2
stack_v2_sparse_classes_30k_train_020392
Implement the Python class `DeviceViewSet` described below. Class description: Implement the DeviceViewSet class. Method signatures and docstrings: - def get_serializer_class(self): Select the specific serializer based on the request context. If the `brief` query param equates to True, return the NestedDeviceSerializ...
Implement the Python class `DeviceViewSet` described below. Class description: Implement the DeviceViewSet class. Method signatures and docstrings: - def get_serializer_class(self): Select the specific serializer based on the request context. If the `brief` query param equates to True, return the NestedDeviceSerializ...
506884bc4dc70299db3e2a7ad577dd7fd808065e
<|skeleton|> class DeviceViewSet: def get_serializer_class(self): """Select the specific serializer based on the request context. If the `brief` query param equates to True, return the NestedDeviceSerializer If the `exclude` query param includes `config_context` as a value, return the DeviceSerializer Else...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeviceViewSet: def get_serializer_class(self): """Select the specific serializer based on the request context. If the `brief` query param equates to True, return the NestedDeviceSerializer If the `exclude` query param includes `config_context` as a value, return the DeviceSerializer Else, return the D...
the_stack_v2_python_sparse
netbox/dcim/api/views.py
netbox-community/netbox
train
8,122
49b2d4c8b5ae6b6bf4f59b9012f93e34bb741b88
[ "super(QNetwork, self).__init__()\nself.seed = torch.manual_seed(seed)\nfc2_size = 10 * state_size\nfc3_size = 6 * state_size\nself.fc1 = nn.Linear(state_size, fc2_size)\nself.fc2 = nn.Linear(fc2_size, fc3_size)\nself.fc3 = nn.Linear(fc3_size, action_size)\nself.dropout = nn.Dropout(0.1)", "x = state\nx = F.leaky...
<|body_start_0|> super(QNetwork, self).__init__() self.seed = torch.manual_seed(seed) fc2_size = 10 * state_size fc3_size = 6 * state_size self.fc1 = nn.Linear(state_size, fc2_size) self.fc2 = nn.Linear(fc2_size, fc3_size) self.fc3 = nn.Linear(fc3_size, action_siz...
Actor (Policy) Model.
QNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QNetwork: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_074529
1,262
permissive
[ { "docstring": "Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed", "name": "__init__", "signature": "def __init__(self, state_size, action_size, seed)" }, { "docstring": "Build a net...
2
stack_v2_sparse_classes_30k_train_006895
Implement the Python class `QNetwork` described below. Class description: Actor (Policy) Model. Method signatures and docstrings: - def __init__(self, state_size, action_size, seed): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each act...
Implement the Python class `QNetwork` described below. Class description: Actor (Policy) Model. Method signatures and docstrings: - def __init__(self, state_size, action_size, seed): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each act...
6406714d2ec35746ff8126e7f0773a722c3a6631
<|skeleton|> class QNetwork: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QNetwork: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" super(QNetwork, self).__init__(...
the_stack_v2_python_sparse
dqn/lunar_lander/model.py
TonysCousin/udacity-reinforcement-learning
train
0
3fbecc85055c7686cc1c130e31580696b39a86dd
[ "email = self.request.get('email')\ndate = self.request.get('date')\nself.hello_request(api_url='timeline/admin/{}/{}'.format(email, date), type='GET', api_info=self.suripu_app)", "email = self.request.get('email')\ndate = self.request.get('date')\nself.hello_request(api_url='timeline/admin/invalidate/{}/{}'.form...
<|body_start_0|> email = self.request.get('email') date = self.request.get('date') self.hello_request(api_url='timeline/admin/{}/{}'.format(email, date), type='GET', api_info=self.suripu_app) <|end_body_0|> <|body_start_1|> email = self.request.get('email') date = self.request.g...
TimelineAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimelineAPI: def get(self): """Retrieve user timeline""" <|body_0|> def post(self): """Invalidate cache for user timeline""" <|body_1|> <|end_skeleton|> <|body_start_0|> email = self.request.get('email') date = self.request.get('date') ...
stack_v2_sparse_classes_75kplus_train_074530
2,336
no_license
[ { "docstring": "Retrieve user timeline", "name": "get", "signature": "def get(self)" }, { "docstring": "Invalidate cache for user timeline", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_011135
Implement the Python class `TimelineAPI` described below. Class description: Implement the TimelineAPI class. Method signatures and docstrings: - def get(self): Retrieve user timeline - def post(self): Invalidate cache for user timeline
Implement the Python class `TimelineAPI` described below. Class description: Implement the TimelineAPI class. Method signatures and docstrings: - def get(self): Retrieve user timeline - def post(self): Invalidate cache for user timeline <|skeleton|> class TimelineAPI: def get(self): """Retrieve user tim...
44a274372d72416d7f7f95d76b6882ca3b4baff7
<|skeleton|> class TimelineAPI: def get(self): """Retrieve user timeline""" <|body_0|> def post(self): """Invalidate cache for user timeline""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimelineAPI: def get(self): """Retrieve user timeline""" email = self.request.get('email') date = self.request.get('date') self.hello_request(api_url='timeline/admin/{}/{}'.format(email, date), type='GET', api_info=self.suripu_app) def post(self): """Invalidate cac...
the_stack_v2_python_sparse
api/timeline.py
hello/hello-admin
train
2
55e893dddf6a74c87159007e5157e01239c720da
[ "nn.Module.__init__(self)\nself.res = res\nself.dropout_p = dropout_p\nself.conv_bias = conv_bias\nself.leakiness = leakiness\nself.inst_norm_affine = inst_norm_affine\nself.lrelu_inplace = lrelu_inplace\nself.dropout = nn.Dropout3d(dropout_p)\nself.in_0 = nn.InstanceNorm3d(output_channels, affine=self.inst_norm_af...
<|body_start_0|> nn.Module.__init__(self) self.res = res self.dropout_p = dropout_p self.conv_bias = conv_bias self.leakiness = leakiness self.inst_norm_affine = inst_norm_affine self.lrelu_inplace = lrelu_inplace self.dropout = nn.Dropout3d(dropout_p) ...
EncodingModule
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncodingModule: def __init__(self, input_channels, output_channels, kernel_size=3, dropout_p=0.3, leakiness=0.01, conv_bias=True, inst_norm_affine=True, res=False, lrelu_inplace=True): """[The Encoding convolution module to learn the information and use] [This function will create the Le...
stack_v2_sparse_classes_75kplus_train_074531
20,028
permissive
[ { "docstring": "[The Encoding convolution module to learn the information and use] [This function will create the Learning convolutions] Arguments: input_channels {[int]} -- [the input number of channels, in our case the number of channels from downsample] output_channels {[int]} -- [the output number of channe...
2
null
Implement the Python class `EncodingModule` described below. Class description: Implement the EncodingModule class. Method signatures and docstrings: - def __init__(self, input_channels, output_channels, kernel_size=3, dropout_p=0.3, leakiness=0.01, conv_bias=True, inst_norm_affine=True, res=False, lrelu_inplace=True...
Implement the Python class `EncodingModule` described below. Class description: Implement the EncodingModule class. Method signatures and docstrings: - def __init__(self, input_channels, output_channels, kernel_size=3, dropout_p=0.3, leakiness=0.01, conv_bias=True, inst_norm_affine=True, res=False, lrelu_inplace=True...
9acfe15cce2297ea706f6fb0406796c0e9305ccb
<|skeleton|> class EncodingModule: def __init__(self, input_channels, output_channels, kernel_size=3, dropout_p=0.3, leakiness=0.01, conv_bias=True, inst_norm_affine=True, res=False, lrelu_inplace=True): """[The Encoding convolution module to learn the information and use] [This function will create the Le...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncodingModule: def __init__(self, input_channels, output_channels, kernel_size=3, dropout_p=0.3, leakiness=0.01, conv_bias=True, inst_norm_affine=True, res=False, lrelu_inplace=True): """[The Encoding convolution module to learn the information and use] [This function will create the Learning convolu...
the_stack_v2_python_sparse
BrainMaGe/models/seg_modules.py
AugustKRZhu/BrainMaGe
train
0
c1714e7ef3d00d6afe4027a59556d247d1d94da8
[ "if N == 0:\n return 1\nelif N < 0:\n return 0\nelse:\n return self.recursive(N - 1) + self.recursive(N - 2) + self.recursive(N - 3)", "cache = {0: 1}\n\ndef recurse(N):\n if N < 0:\n return 0\n elif N not in cache:\n cache[N] = recurse(N - 1) + recurse(N - 2) + recurse(N - 3)\n re...
<|body_start_0|> if N == 0: return 1 elif N < 0: return 0 else: return self.recursive(N - 1) + self.recursive(N - 2) + self.recursive(N - 3) <|end_body_0|> <|body_start_1|> cache = {0: 1} def recurse(N): if N < 0: ...
ThreeStepSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreeStepSolution: def recursive(self, N): """We solve this problem using recursion.""" <|body_0|> def top_down(self, N): """Top down approach using memoization""" <|body_1|> <|end_skeleton|> <|body_start_0|> if N == 0: return 1 ...
stack_v2_sparse_classes_75kplus_train_074532
1,199
no_license
[ { "docstring": "We solve this problem using recursion.", "name": "recursive", "signature": "def recursive(self, N)" }, { "docstring": "Top down approach using memoization", "name": "top_down", "signature": "def top_down(self, N)" } ]
2
stack_v2_sparse_classes_30k_train_042517
Implement the Python class `ThreeStepSolution` described below. Class description: Implement the ThreeStepSolution class. Method signatures and docstrings: - def recursive(self, N): We solve this problem using recursion. - def top_down(self, N): Top down approach using memoization
Implement the Python class `ThreeStepSolution` described below. Class description: Implement the ThreeStepSolution class. Method signatures and docstrings: - def recursive(self, N): We solve this problem using recursion. - def top_down(self, N): Top down approach using memoization <|skeleton|> class ThreeStepSolutio...
5347a98a61efbfef75e3e27ac564c423c4ec25bb
<|skeleton|> class ThreeStepSolution: def recursive(self, N): """We solve this problem using recursion.""" <|body_0|> def top_down(self, N): """Top down approach using memoization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreeStepSolution: def recursive(self, N): """We solve this problem using recursion.""" if N == 0: return 1 elif N < 0: return 0 else: return self.recursive(N - 1) + self.recursive(N - 2) + self.recursive(N - 3) def top_down(self, N): ...
the_stack_v2_python_sparse
dynamic_programming/triple_steps.py
gtang31/algorithms
train
0
431057602fcb04d8a436df006e349a1e94991180
[ "super(GANLoss, self).__init__()\nself.register_buffer('real_label', torch.tensor(target_real_label))\nself.register_buffer('fake_label', torch.tensor(target_fake_label))\nself.gan_mode = gan_mode\nif gan_mode == 'lsgan':\n self.loss = nn.MSELoss()\nelif gan_mode == 'vanilla':\n self.loss = nn.BCEWithLogitsLo...
<|body_start_0|> super(GANLoss, self).__init__() self.register_buffer('real_label', torch.tensor(target_real_label)) self.register_buffer('fake_label', torch.tensor(target_fake_label)) self.gan_mode = gan_mode if gan_mode == 'lsgan': self.loss = nn.MSELoss() e...
Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.
GANLoss
[ "CC0-1.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_75kplus_train_074533
20,630
permissive
[ { "docstring": "Initialize the GANLoss class. Parameters: gan_mode (str) - - the type of GAN objective. It currently supports vanilla, lsgan, and wgangp. target_real_label (bool) - - label for a real image target_fake_label (bool) - - label of a fake image Note: Do not use sigmoid as the last layer of Discrimin...
3
stack_v2_sparse_classes_30k_train_040846
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
c4a63f89e758eb404688098938d23507733d4514
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: gan_mode (str) ...
the_stack_v2_python_sparse
derender/GAN.py
tonyman1008/sorderender
train
0
e7489c44e03af5e6654bd85d1647009e2303461e
[ "self.Ch2P2_19a = 10\nself.Ch2P2_19b = 17\nself.Ch2P2_19c = 6\nself.Ch2P2_19d = 8\nself.Ch2P2_20a = 14\nself.Ch2P2_20b = 8\nself.Ch2P2_20c = 13\nself.Ch2P2_20d = 6\nself.Ch2P2_22a = '00010001 11101010 00100010 00001110'\nself.Ch2P2_22b = '00001110 00111000 11101010 00111000'\nself.Ch2P2_22c = '01101110 00001110 001...
<|body_start_0|> self.Ch2P2_19a = 10 self.Ch2P2_19b = 17 self.Ch2P2_19c = 6 self.Ch2P2_19d = 8 self.Ch2P2_20a = 14 self.Ch2P2_20b = 8 self.Ch2P2_20c = 13 self.Ch2P2_20d = 6 self.Ch2P2_22a = '00010001 11101010 00100010 00001110' self.Ch2P2_2...
HW02
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。""" <|body_0|> def ch3(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = "xxx" 意思是 Ch3 : 第三章 P3_28a: 第三章...
stack_v2_sparse_classes_75kplus_train_074534
2,811
no_license
[ { "docstring": "請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = \"xxx\" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 \"xxx\" : 你要填入你的答地方。", "name": "ch2", "signature": "def ch2(self)" }, { "docstring": "請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = \"xxx\" 意思是 Ch3 : 第三章 P3_28a: 第...
2
stack_v2_sparse_classes_30k_train_048503
Implement the Python class `HW02` described below. Class description: Implement the HW02 class. Method signatures and docstrings: - def ch2(self): 請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 - def ch3(self): 請將你計算出來的答案填入以下變...
Implement the Python class `HW02` described below. Class description: Implement the HW02 class. Method signatures and docstrings: - def ch2(self): 請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 - def ch3(self): 請將你計算出來的答案填入以下變...
008575d161d48672f906bdaec130f0c5060cd36d
<|skeleton|> class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。""" <|body_0|> def ch3(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = "xxx" 意思是 Ch3 : 第三章 P3_28a: 第三章...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。""" self.Ch2P2_19a = 10 self.Ch2P2_19b = 17 self.Ch2P2_19c = 6 self.Ch2P2_19d = 8 self.Ch2P2_20a = 1...
the_stack_v2_python_sparse
homework02_b05505009.py
PeterWolf-tw/ESOE-CS101-2016
train
21
b7a68df8d5b8c4388036c919d8e044b840e66e87
[ "UserModel = get_user_model()\nemail = self.cleaned_data['email']\nself.users_cache = UserModel._default_manager.filter(email__iexact=email)\nif not len(self.users_cache):\n raise forms.ValidationError(self.error_messages['unknown'])\nif not any((user.is_active for user in self.users_cache)):\n raise forms.Va...
<|body_start_0|> UserModel = get_user_model() email = self.cleaned_data['email'] self.users_cache = UserModel._default_manager.filter(email__iexact=email) if not len(self.users_cache): raise forms.ValidationError(self.error_messages['unknown']) if not any((user.is_act...
PasswordResetForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordResetForm: def clean_email(self): """Validates that an active user exists with the given email address.""" <|body_0|> def save(self, domain_override=None, subject_template_name='registration/password_reset_subject.txt', email_template_name='registration/password_rese...
stack_v2_sparse_classes_75kplus_train_074535
3,164
permissive
[ { "docstring": "Validates that an active user exists with the given email address.", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "Generates a one-use only link for resetting password and sends to the user.", "name": "save", "signature": "def save(self, d...
2
stack_v2_sparse_classes_30k_train_020631
Implement the Python class `PasswordResetForm` described below. Class description: Implement the PasswordResetForm class. Method signatures and docstrings: - def clean_email(self): Validates that an active user exists with the given email address. - def save(self, domain_override=None, subject_template_name='registra...
Implement the Python class `PasswordResetForm` described below. Class description: Implement the PasswordResetForm class. Method signatures and docstrings: - def clean_email(self): Validates that an active user exists with the given email address. - def save(self, domain_override=None, subject_template_name='registra...
8d8f9149b6efeb65202809a5f8916386f58a1b3b
<|skeleton|> class PasswordResetForm: def clean_email(self): """Validates that an active user exists with the given email address.""" <|body_0|> def save(self, domain_override=None, subject_template_name='registration/password_reset_subject.txt', email_template_name='registration/password_rese...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PasswordResetForm: def clean_email(self): """Validates that an active user exists with the given email address.""" UserModel = get_user_model() email = self.cleaned_data['email'] self.users_cache = UserModel._default_manager.filter(email__iexact=email) if not len(self.u...
the_stack_v2_python_sparse
website/drawquest/apps/drawquest_auth/forms.py
MichaelBechHansen/drawquest-web
train
0
f626518698d28db912ab31462e56eb87fe8c1caa
[ "super(Policy, self).__init__()\nself.action_bound = action_bound\nself.detector = detector\nself.lut_thetas = lut_info['thetas']\nself.lut_phis = lut_info['phis']\nself.lut_mask = lut_info['mask']\nself.p = local_p\nself.thresh = thresh\nself.name = 'down + proportional + in-bounds'\nself.im_ctr = (agent_cfg.obs_s...
<|body_start_0|> super(Policy, self).__init__() self.action_bound = action_bound self.detector = detector self.lut_thetas = lut_info['thetas'] self.lut_phis = lut_info['phis'] self.lut_mask = lut_info['mask'] self.p = local_p self.thresh = thresh s...
This custom policy combines 'downward' heuristic with information from strawberry detector.
CustomPolicy1
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomPolicy1: """This custom policy combines 'downward' heuristic with information from strawberry detector.""" def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5): """Initialize custom policy.""" <|body_0|> def best_bb(self, bbs): """R...
stack_v2_sparse_classes_75kplus_train_074536
45,503
permissive
[ { "docstring": "Initialize custom policy.", "name": "__init__", "signature": "def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5)" }, { "docstring": "Returns predicted bounding box for ripe strawberry with highest confidence value.", "name": "best_bb", "signatur...
4
stack_v2_sparse_classes_30k_train_044681
Implement the Python class `CustomPolicy1` described below. Class description: This custom policy combines 'downward' heuristic with information from strawberry detector. Method signatures and docstrings: - def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5): Initialize custom policy. - def ...
Implement the Python class `CustomPolicy1` described below. Class description: This custom policy combines 'downward' heuristic with information from strawberry detector. Method signatures and docstrings: - def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5): Initialize custom policy. - def ...
c28840e254cdd2a4f3d16fffa6391748f94b7d8c
<|skeleton|> class CustomPolicy1: """This custom policy combines 'downward' heuristic with information from strawberry detector.""" def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5): """Initialize custom policy.""" <|body_0|> def best_bb(self, bbs): """R...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomPolicy1: """This custom policy combines 'downward' heuristic with information from strawberry detector.""" def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5): """Initialize custom policy.""" super(Policy, self).__init__() self.action_bound = action...
the_stack_v2_python_sparse
ddpg/policy.py
jsather/harvester-python
train
3
163ea2f4e262456a0b1d8f46d0b90ffbfee360c1
[ "if JWTWrapper.__instance is None:\n JWTWrapper()\nreturn JWTWrapper.__instance", "if JWTWrapper.__instance is not None:\n raise AuthenticationError('Attempt made to create multiple JWTWrappers')\nJWTWrapper.__instance = JWTAuthenticationBackend()" ]
<|body_start_0|> if JWTWrapper.__instance is None: JWTWrapper() return JWTWrapper.__instance <|end_body_0|> <|body_start_1|> if JWTWrapper.__instance is not None: raise AuthenticationError('Attempt made to create multiple JWTWrappers') JWTWrapper.__instance = JWT...
Singleton wrapper for Flask JWTAuthenticationBackend.
JWTWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JWTWrapper: """Singleton wrapper for Flask JWTAuthenticationBackend.""" def get_instance(): """Retrieve singleton JWTAuthenticationBackend.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_074537
7,750
permissive
[ { "docstring": "Retrieve singleton JWTAuthenticationBackend.", "name": "get_instance", "signature": "def get_instance()" }, { "docstring": "Virtually private constructor.", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_test_001654
Implement the Python class `JWTWrapper` described below. Class description: Singleton wrapper for Flask JWTAuthenticationBackend. Method signatures and docstrings: - def get_instance(): Retrieve singleton JWTAuthenticationBackend. - def __init__(self): Virtually private constructor.
Implement the Python class `JWTWrapper` described below. Class description: Singleton wrapper for Flask JWTAuthenticationBackend. Method signatures and docstrings: - def get_instance(): Retrieve singleton JWTAuthenticationBackend. - def __init__(self): Virtually private constructor. <|skeleton|> class JWTWrapper: ...
ddff47af77a3596c37b712113d25f39282493a76
<|skeleton|> class JWTWrapper: """Singleton wrapper for Flask JWTAuthenticationBackend.""" def get_instance(): """Retrieve singleton JWTAuthenticationBackend.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JWTWrapper: """Singleton wrapper for Flask JWTAuthenticationBackend.""" def get_instance(): """Retrieve singleton JWTAuthenticationBackend.""" if JWTWrapper.__instance is None: JWTWrapper() return JWTWrapper.__instance def __init__(self): """Virtually priv...
the_stack_v2_python_sparse
notify-api/src/notify_api/core/jwt.py
pwei1018/sbc-auth
train
3
8e254edc3fe9fe441d9316ae640f7cdc342ba064
[ "if isinstance(tags, str):\n return tags.split(',')\nreturn list(tags)", "obj = super().dict(**kwargs)\nif 'tags' in obj:\n obj['tags'] = ','.join(obj['tags'])\nreturn obj" ]
<|body_start_0|> if isinstance(tags, str): return tags.split(',') return list(tags) <|end_body_0|> <|body_start_1|> obj = super().dict(**kwargs) if 'tags' in obj: obj['tags'] = ','.join(obj['tags']) return obj <|end_body_1|>
Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):
ModelItemIO
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelItemIO: """Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):""" def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]: """Convert comma-separated tag list into list if ne...
stack_v2_sparse_classes_75kplus_train_074538
3,127
permissive
[ { "docstring": "Convert comma-separated tag list into list if needed.", "name": "split_tags", "signature": "def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]" }, { "docstring": "Map this IO into a dictionary suitable for serialisation.", "name": "dict", "signature": "def ...
2
stack_v2_sparse_classes_30k_val_000264
Implement the Python class `ModelItemIO` described below. Class description: Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective): Method signatures and docstrings: - def split_tags(cls, tags: Union[str, Iterable[str]]) -> Li...
Implement the Python class `ModelItemIO` described below. Class description: Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective): Method signatures and docstrings: - def split_tags(cls, tags: Union[str, Iterable[str]]) -> Li...
31f1dcadb3ff113d8a77ce132657237ea01c307b
<|skeleton|> class ModelItemIO: """Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):""" def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]: """Convert comma-separated tag list into list if ne...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelItemIO: """Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):""" def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]: """Convert comma-separated tag list into list if needed.""" ...
the_stack_v2_python_sparse
src/structurizr/model/model_item.py
Midnighter/structurizr-python
train
61
f72c1f467f8ef6a333d83d7e6c8faabf4b458d37
[ "cell = reference_element.UFCInterval()\npolynomial_space = polynomial_set.ONPolynomialSet(cell, degree)\ndual = TimeElementDualSet(family, degree)\nfinite_element.FiniteElement.__init__(self, polynomial_space, dual, degree)", "n = len(self.dual.coords)\nif n == 0:\n weights[0] = 2.0\n return weights\nA = e...
<|body_start_0|> cell = reference_element.UFCInterval() polynomial_space = polynomial_set.ONPolynomialSet(cell, degree) dual = TimeElementDualSet(family, degree) finite_element.FiniteElement.__init__(self, polynomial_space, dual, degree) <|end_body_0|> <|body_start_1|> n = len(s...
.
TimeElement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeElement: """.""" def __init__(self, family, degree): """Create time element with given (polynomial degree).""" <|body_0|> def compute_quadrature_weights(self): """Compute the quadrature weights by solving a linear system of equations for exact integration of ...
stack_v2_sparse_classes_75kplus_train_074539
4,109
no_license
[ { "docstring": "Create time element with given (polynomial degree).", "name": "__init__", "signature": "def __init__(self, family, degree)" }, { "docstring": "Compute the quadrature weights by solving a linear system of equations for exact integration of polynomials. We compute the integrals ove...
2
stack_v2_sparse_classes_30k_train_049308
Implement the Python class `TimeElement` described below. Class description: . Method signatures and docstrings: - def __init__(self, family, degree): Create time element with given (polynomial degree). - def compute_quadrature_weights(self): Compute the quadrature weights by solving a linear system of equations for ...
Implement the Python class `TimeElement` described below. Class description: . Method signatures and docstrings: - def __init__(self, family, degree): Create time element with given (polynomial degree). - def compute_quadrature_weights(self): Compute the quadrature weights by solving a linear system of equations for ...
7af15cd0ab522436ca285f8422faa42675345f55
<|skeleton|> class TimeElement: """.""" def __init__(self, family, degree): """Create time element with given (polynomial degree).""" <|body_0|> def compute_quadrature_weights(self): """Compute the quadrature weights by solving a linear system of equations for exact integration of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeElement: """.""" def __init__(self, family, degree): """Create time element with given (polynomial degree).""" cell = reference_element.UFCInterval() polynomial_space = polynomial_set.ONPolynomialSet(cell, degree) dual = TimeElementDualSet(family, degree) finit...
the_stack_v2_python_sparse
Lib/site-packages/ffc/timeelements.py
maciekswat/dolfin_python_deps
train
0
03f64f92c1acb719fccc439fdc4dd9e85cc91cb2
[ "n = len(nums)\ntotal = n * (n + 1) // 2\nfor i in range(0, n):\n total -= nums[i]\nreturn total", "n = len(nums)\nx1 = nums[0]\nx2 = 1\nfor i in range(n):\n x1 ^= nums[i]\nfor i in range(n + 2):\n x2 ^= i\n return x1 ^ x2" ]
<|body_start_0|> n = len(nums) total = n * (n + 1) // 2 for i in range(0, n): total -= nums[i] return total <|end_body_0|> <|body_start_1|> n = len(nums) x1 = nums[0] x2 = 1 for i in range(n): x1 ^= nums[i] for i in range(n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) total = n * (n + 1...
stack_v2_sparse_classes_75kplus_train_074540
756
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "missingNumber", "signature": "def missingNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "missingNumber2", "signature": "def missingNumber2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_028197
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber(self, nums): :type nums: List[int] :rtype: int - def missingNumber2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber(self, nums): :type nums: List[int] :rtype: int - def missingNumber2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def missin...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) total = n * (n + 1) // 2 for i in range(0, n): total -= nums[i] return total def missingNumber2(self, nums): """:type nums: List[int] :rtype: int""" ...
the_stack_v2_python_sparse
old/Session002/Arrays/MissingNumber.py
MaxIakovliev/algorithms
train
0
aec14cbe98e38e118cb5089b82f9947b6b527f9b
[ "self.input_image = input_image\nself.params = params\nself.edge_image = None", "canny = cv2.Canny(image=self.input_image, threshold1=self.params.hysteresis_min_thresh, threshold2=self.params.hysteresis_max_thresh, apertureSize=3)\nLogger.debug('Canny edges computed')\ndilated = cv2.dilate(canny, self.params.kern...
<|body_start_0|> self.input_image = input_image self.params = params self.edge_image = None <|end_body_0|> <|body_start_1|> canny = cv2.Canny(image=self.input_image, threshold1=self.params.hysteresis_min_thresh, threshold2=self.params.hysteresis_max_thresh, apertureSize=3) Logge...
Class responsible for detecting edges in greyscale images. The approach taken to detect edges in the input greyscale image is the following: 1. Perform a canny edge detection on the input image. 2. Dilate the resulting binary image for a parametrized number of steps in order to connect short edges and smooth out the ed...
EdgeDetector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdgeDetector: """Class responsible for detecting edges in greyscale images. The approach taken to detect edges in the input greyscale image is the following: 1. Perform a canny edge detection on the input image. 2. Dilate the resulting binary image for a parametrized number of steps in order to c...
stack_v2_sparse_classes_75kplus_train_074541
3,074
no_license
[ { "docstring": ":param input_image: Input greyscale image where edges must be detected. :param params: Parameters used for edge detection.", "name": "__init__", "signature": "def __init__(self, input_image: np.ndarray, params: EdgeDetectorParams=EdgeDetectorParams())" }, { "docstring": "Detects ...
2
null
Implement the Python class `EdgeDetector` described below. Class description: Class responsible for detecting edges in greyscale images. The approach taken to detect edges in the input greyscale image is the following: 1. Perform a canny edge detection on the input image. 2. Dilate the resulting binary image for a par...
Implement the Python class `EdgeDetector` described below. Class description: Class responsible for detecting edges in greyscale images. The approach taken to detect edges in the input greyscale image is the following: 1. Perform a canny edge detection on the input image. 2. Dilate the resulting binary image for a par...
25bc6f52a89b73e6a38488171c106f947f4e70ef
<|skeleton|> class EdgeDetector: """Class responsible for detecting edges in greyscale images. The approach taken to detect edges in the input greyscale image is the following: 1. Perform a canny edge detection on the input image. 2. Dilate the resulting binary image for a parametrized number of steps in order to c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EdgeDetector: """Class responsible for detecting edges in greyscale images. The approach taken to detect edges in the input greyscale image is the following: 1. Perform a canny edge detection on the input image. 2. Dilate the resulting binary image for a parametrized number of steps in order to connect short ...
the_stack_v2_python_sparse
thermography/detection/edge_detection.py
PaoloC68/thermography
train
1
0d410143fff9028a90a7737d843cd9f2d9cf5625
[ "super(SimpleScheduler, self).__init__(trainer)\nself._iter = 0\nself._patience = patience", "self._iter += 1\nlogging.info('{} epochs left to run'.format(self._patience - self._iter))\nif self._iter >= self._patience:\n return True\nelse:\n return False" ]
<|body_start_0|> super(SimpleScheduler, self).__init__(trainer) self._iter = 0 self._patience = patience <|end_body_0|> <|body_start_1|> self._iter += 1 logging.info('{} epochs left to run'.format(self._patience - self._iter)) if self._iter >= self._patience: ...
Simple scheduler with maximum patience.
SimpleScheduler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleScheduler: """Simple scheduler with maximum patience.""" def __init__(self, trainer, patience=10): """:type trainer: deepy.trainers.base.NeuralTrainer""" <|body_0|> def invoke(self): """Run it, return whether to end training.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_074542
4,722
permissive
[ { "docstring": ":type trainer: deepy.trainers.base.NeuralTrainer", "name": "__init__", "signature": "def __init__(self, trainer, patience=10)" }, { "docstring": "Run it, return whether to end training.", "name": "invoke", "signature": "def invoke(self)" } ]
2
stack_v2_sparse_classes_30k_train_012026
Implement the Python class `SimpleScheduler` described below. Class description: Simple scheduler with maximum patience. Method signatures and docstrings: - def __init__(self, trainer, patience=10): :type trainer: deepy.trainers.base.NeuralTrainer - def invoke(self): Run it, return whether to end training.
Implement the Python class `SimpleScheduler` described below. Class description: Simple scheduler with maximum patience. Method signatures and docstrings: - def __init__(self, trainer, patience=10): :type trainer: deepy.trainers.base.NeuralTrainer - def invoke(self): Run it, return whether to end training. <|skeleto...
9b4f9ebda7f6f1e03dad7ef7374e36c3d0cd754a
<|skeleton|> class SimpleScheduler: """Simple scheduler with maximum patience.""" def __init__(self, trainer, patience=10): """:type trainer: deepy.trainers.base.NeuralTrainer""" <|body_0|> def invoke(self): """Run it, return whether to end training.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleScheduler: """Simple scheduler with maximum patience.""" def __init__(self, trainer, patience=10): """:type trainer: deepy.trainers.base.NeuralTrainer""" super(SimpleScheduler, self).__init__(trainer) self._iter = 0 self._patience = patience def invoke(self): ...
the_stack_v2_python_sparse
deepy/trainers/annealers.py
fahad92virgo/deepy
train
1
65d32b24360987dc07225a4d1a2c127bb8ab0486
[ "self.config = config\nself.cookie = cookie\nself.quotas = quotas", "if dictionary is None:\n return None\nconfig = cohesity_management_sdk.models.dir_quota_config.DirQuotaConfig.from_dictionary(dictionary.get('config')) if dictionary.get('config') else None\ncookie = dictionary.get('cookie')\nquotas = None\ni...
<|body_start_0|> self.config = config self.cookie = cookie self.quotas = quotas <|end_body_0|> <|body_start_1|> if dictionary is None: return None config = cohesity_management_sdk.models.dir_quota_config.DirQuotaConfig.from_dictionary(dictionary.get('config')) if dic...
Implementation of the 'DirQuotaInfo' model. Specifies the configuration and policy details for directory quota in a view. Attributes: config (DirQuotaConfig): Specifies the directory quota configuration. cookie (long|int): This cookie can be used in the succeeding call to list user quotas and usages to get the next set...
DirQuotaInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirQuotaInfo: """Implementation of the 'DirQuotaInfo' model. Specifies the configuration and policy details for directory quota in a view. Attributes: config (DirQuotaConfig): Specifies the directory quota configuration. cookie (long|int): This cookie can be used in the succeeding call to list us...
stack_v2_sparse_classes_75kplus_train_074543
2,492
permissive
[ { "docstring": "Constructor for the DirQuotaInfo class", "name": "__init__", "signature": "def __init__(self, config=None, cookie=None, quotas=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as...
2
stack_v2_sparse_classes_30k_train_004018
Implement the Python class `DirQuotaInfo` described below. Class description: Implementation of the 'DirQuotaInfo' model. Specifies the configuration and policy details for directory quota in a view. Attributes: config (DirQuotaConfig): Specifies the directory quota configuration. cookie (long|int): This cookie can be...
Implement the Python class `DirQuotaInfo` described below. Class description: Implementation of the 'DirQuotaInfo' model. Specifies the configuration and policy details for directory quota in a view. Attributes: config (DirQuotaConfig): Specifies the directory quota configuration. cookie (long|int): This cookie can be...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DirQuotaInfo: """Implementation of the 'DirQuotaInfo' model. Specifies the configuration and policy details for directory quota in a view. Attributes: config (DirQuotaConfig): Specifies the directory quota configuration. cookie (long|int): This cookie can be used in the succeeding call to list us...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DirQuotaInfo: """Implementation of the 'DirQuotaInfo' model. Specifies the configuration and policy details for directory quota in a view. Attributes: config (DirQuotaConfig): Specifies the directory quota configuration. cookie (long|int): This cookie can be used in the succeeding call to list user quotas and...
the_stack_v2_python_sparse
cohesity_management_sdk/models/dir_quota_info.py
cohesity/management-sdk-python
train
24
294168f6d843a00ff2f3e6b6bb67a4d11cea1ad3
[ "choices = QuestionChoice.objects.filter(question_id=pk)\nserializer = QuestionChoiceSerializer(choices, many=True)\nreturn Response(serializer.data)", "serializer = QuestionSerializer(data=request.data, many=True)\nif serializer.is_valid(raise_exception=True):\n serializer.save()\n return Response(serializ...
<|body_start_0|> choices = QuestionChoice.objects.filter(question_id=pk) serializer = QuestionChoiceSerializer(choices, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> serializer = QuestionSerializer(data=request.data, many=True) if serializer.is_vali...
QuestionViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionViewSet: def choices(self, _, pk=None): """Returns All the choices available for a question""" <|body_0|> def bulk_create(self, request): """This Endpoint is Used to Create Questions in bulk.""" <|body_1|> <|end_skeleton|> <|body_start_0|> c...
stack_v2_sparse_classes_75kplus_train_074544
6,078
no_license
[ { "docstring": "Returns All the choices available for a question", "name": "choices", "signature": "def choices(self, _, pk=None)" }, { "docstring": "This Endpoint is Used to Create Questions in bulk.", "name": "bulk_create", "signature": "def bulk_create(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_018595
Implement the Python class `QuestionViewSet` described below. Class description: Implement the QuestionViewSet class. Method signatures and docstrings: - def choices(self, _, pk=None): Returns All the choices available for a question - def bulk_create(self, request): This Endpoint is Used to Create Questions in bulk.
Implement the Python class `QuestionViewSet` described below. Class description: Implement the QuestionViewSet class. Method signatures and docstrings: - def choices(self, _, pk=None): Returns All the choices available for a question - def bulk_create(self, request): This Endpoint is Used to Create Questions in bulk....
71f80648a765cd9a943ba49dd64da7a0c525e0b6
<|skeleton|> class QuestionViewSet: def choices(self, _, pk=None): """Returns All the choices available for a question""" <|body_0|> def bulk_create(self, request): """This Endpoint is Used to Create Questions in bulk.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuestionViewSet: def choices(self, _, pk=None): """Returns All the choices available for a question""" choices = QuestionChoice.objects.filter(question_id=pk) serializer = QuestionChoiceSerializer(choices, many=True) return Response(serializer.data) def bulk_create(self, r...
the_stack_v2_python_sparse
api/views.py
nikmalviya/HRSurveyRESTAPI
train
0
be7342d4d522fe53a2f90341b2dbc94c9739f4c6
[ "current_directory = os.path.dirname(os.path.abspath(__file__))\ntest_access_file = os.path.join(current_directory, 'TestData.json')\nwith open(test_access_file, 'r') as f:\n cls._data = json.load(f)\ncls._hostname = cls._data['organizations']['name']", "user_rest_v1_failure = self._data['systemusers']['user_r...
<|body_start_0|> current_directory = os.path.dirname(os.path.abspath(__file__)) test_access_file = os.path.join(current_directory, 'TestData.json') with open(test_access_file, 'r') as f: cls._data = json.load(f) cls._hostname = cls._data['organizations']['name'] <|end_body_0|...
Test the Access module.
TestAccess
[ "GPL-3.0-only", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAccess: """Test the Access module.""" def setUpClass(cls): """Prepare test class. Get the Test Data from JSON (JavaScript Object Notation) file.""" <|body_0|> def test_login_rest_v1_failure(self): """Test a failure of REST (REpresentational State Transfer) lo...
stack_v2_sparse_classes_75kplus_train_074545
2,569
permissive
[ { "docstring": "Prepare test class. Get the Test Data from JSON (JavaScript Object Notation) file.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Test a failure of REST (REpresentational State Transfer) login method. Get the failure username and password (user_rest...
3
stack_v2_sparse_classes_30k_train_009120
Implement the Python class `TestAccess` described below. Class description: Test the Access module. Method signatures and docstrings: - def setUpClass(cls): Prepare test class. Get the Test Data from JSON (JavaScript Object Notation) file. - def test_login_rest_v1_failure(self): Test a failure of REST (REpresentation...
Implement the Python class `TestAccess` described below. Class description: Test the Access module. Method signatures and docstrings: - def setUpClass(cls): Prepare test class. Get the Test Data from JSON (JavaScript Object Notation) file. - def test_login_rest_v1_failure(self): Test a failure of REST (REpresentation...
15d00019d496a2a401961e66e3fbb3876a9c6c9d
<|skeleton|> class TestAccess: """Test the Access module.""" def setUpClass(cls): """Prepare test class. Get the Test Data from JSON (JavaScript Object Notation) file.""" <|body_0|> def test_login_rest_v1_failure(self): """Test a failure of REST (REpresentational State Transfer) lo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAccess: """Test the Access module.""" def setUpClass(cls): """Prepare test class. Get the Test Data from JSON (JavaScript Object Notation) file.""" current_directory = os.path.dirname(os.path.abspath(__file__)) test_access_file = os.path.join(current_directory, 'TestData.json'...
the_stack_v2_python_sparse
projects/Python-D365API/D365API/TestAccess.py
rakasiwisurya/CodeWithFriends-Spring2020
train
1
eff8fe34670ee19cc6c3c3d3003fed17729860bd
[ "print('Constructing trajectory network for time: {}'.format(stream.time), end='\\r')\nG = Graph()\nparticles = list(stream)\nif save_position:\n G.add_nodes_from(((p.id, {'pos': p.position}) for p in particles))\nelse:\n G.add_nodes_from((p.id for p in particles))\npos = np.array([p.position for p in particl...
<|body_start_0|> print('Constructing trajectory network for time: {}'.format(stream.time), end='\r') G = Graph() particles = list(stream) if save_position: G.add_nodes_from(((p.id, {'pos': p.position}) for p in particles)) else: G.add_nodes_from((p.id for ...
Trajectory network constructor singleton class.
TrajectoryNetConstructor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrajectoryNetConstructor: """Trajectory network constructor singleton class.""" def get_proximitynet(self, stream, distance, save_position=False): """Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep d...
stack_v2_sparse_classes_75kplus_train_074546
2,890
no_license
[ { "docstring": "Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep distance : int or float The distance threshold within which objects are considered connected. save_position : boolean (optional, default: False) Whether to save pa...
2
stack_v2_sparse_classes_30k_train_052531
Implement the Python class `TrajectoryNetConstructor` described below. Class description: Trajectory network constructor singleton class. Method signatures and docstrings: - def get_proximitynet(self, stream, distance, save_position=False): Get the proximity network for a single timestamp. Params ------ stream : Part...
Implement the Python class `TrajectoryNetConstructor` described below. Class description: Trajectory network constructor singleton class. Method signatures and docstrings: - def get_proximitynet(self, stream, distance, save_position=False): Get the proximity network for a single timestamp. Params ------ stream : Part...
0394980efc628bfedd4fd504079a534418cbb89a
<|skeleton|> class TrajectoryNetConstructor: """Trajectory network constructor singleton class.""" def get_proximitynet(self, stream, distance, save_position=False): """Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TrajectoryNetConstructor: """Trajectory network constructor singleton class.""" def get_proximitynet(self, stream, distance, save_position=False): """Get the proximity network for a single timestamp. Params ------ stream : ParticleStream The iterator over Particles in that timestep distance : int...
the_stack_v2_python_sparse
generators/trajectories/trajectory_net_constructor.py
tipech/spatialnet
train
1
0a72abdba9127984b8f02202b6930c340c901c4d
[ "pattern = '[%d/%b/%Y:%H:%M:%S'\ntime_struct = time.strptime(timestamp, pattern)\nformatted = time.strftime('%Y/%m/%d %H:%M:%S', time_struct)\nreturn formatted", "document = {'source': info['name'], 'timestamp': None, 'user': None, 'client_ip': None, 'method': None, 'url': None, 'status_code': None, 'user_agent':...
<|body_start_0|> pattern = '[%d/%b/%Y:%H:%M:%S' time_struct = time.strptime(timestamp, pattern) formatted = time.strftime('%Y/%m/%d %H:%M:%S', time_struct) return formatted <|end_body_0|> <|body_start_1|> document = {'source': info['name'], 'timestamp': None, 'user': None, 'clie...
Handles processing the web logs and then uploading data to ElasticSearch
WebLogWorker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebLogWorker: """Handles processing the web logs and then uploading data to ElasticSearch""" def format_timestamp(timestamp): """Covernt an Apache-style timestamp to one ElasticSearch likes""" <|body_0|> def format_info(self, info): """Extract the handy bits of d...
stack_v2_sparse_classes_75kplus_train_074547
2,838
no_license
[ { "docstring": "Covernt an Apache-style timestamp to one ElasticSearch likes", "name": "format_timestamp", "signature": "def format_timestamp(timestamp)" }, { "docstring": "Extract the handy bits of data into a JSON document", "name": "format_info", "signature": "def format_info(self, in...
2
null
Implement the Python class `WebLogWorker` described below. Class description: Handles processing the web logs and then uploading data to ElasticSearch Method signatures and docstrings: - def format_timestamp(timestamp): Covernt an Apache-style timestamp to one ElasticSearch likes - def format_info(self, info): Extrac...
Implement the Python class `WebLogWorker` described below. Class description: Handles processing the web logs and then uploading data to ElasticSearch Method signatures and docstrings: - def format_timestamp(timestamp): Covernt an Apache-style timestamp to one ElasticSearch likes - def format_info(self, info): Extrac...
576bdb1983eb950e507ba5719eae4c75c6a59bc7
<|skeleton|> class WebLogWorker: """Handles processing the web logs and then uploading data to ElasticSearch""" def format_timestamp(timestamp): """Covernt an Apache-style timestamp to one ElasticSearch likes""" <|body_0|> def format_info(self, info): """Extract the handy bits of d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WebLogWorker: """Handles processing the web logs and then uploading data to ElasticSearch""" def format_timestamp(timestamp): """Covernt an Apache-style timestamp to one ElasticSearch likes""" pattern = '[%d/%b/%Y:%H:%M:%S' time_struct = time.strptime(timestamp, pattern) f...
the_stack_v2_python_sparse
kafka/log_processor/processors/weblog.py
willnx/autobox
train
1
71db5cbd70964ce4d7cedfda878d3e4ca3ba9c12
[ "data_format = {'nickName': fields.String, 'national_id': fields.String, 'mobile': fields.String, 'sex': fields.Integer, 'language': fields.String, 'birthday': fields.String, 'status': fields.Integer}\nargs = uid_token_parser.parse_args()\ntry:\n member = check_token(uid=args['uid'], token=args['token'], fake=Fa...
<|body_start_0|> data_format = {'nickName': fields.String, 'national_id': fields.String, 'mobile': fields.String, 'sex': fields.Integer, 'language': fields.String, 'birthday': fields.String, 'status': fields.Integer} args = uid_token_parser.parse_args() try: member = check_token(uid=...
MemberInfoApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemberInfoApi: def get(self): """获取会员信息 获取昵称、头像、性别、状态、数等个人信息 --- tags: - 会员接口 parameters: - name: uid in: query required: true description: 用户id schema: type: string - name: token in: query required: true description: AccessToken schema: type: string responses: 200: description: code=0为正...
stack_v2_sparse_classes_75kplus_train_074548
26,273
no_license
[ { "docstring": "获取会员信息 获取昵称、头像、性别、状态、数等个人信息 --- tags: - 会员接口 parameters: - name: uid in: query required: true description: 用户id schema: type: string - name: token in: query required: true description: AccessToken schema: type: string responses: 200: description: code=0为正常,返回用户信息;code不等于0请查看message中的错误信息; nickna...
2
stack_v2_sparse_classes_30k_train_018776
Implement the Python class `MemberInfoApi` described below. Class description: Implement the MemberInfoApi class. Method signatures and docstrings: - def get(self): 获取会员信息 获取昵称、头像、性别、状态、数等个人信息 --- tags: - 会员接口 parameters: - name: uid in: query required: true description: 用户id schema: type: string - name: token in: qu...
Implement the Python class `MemberInfoApi` described below. Class description: Implement the MemberInfoApi class. Method signatures and docstrings: - def get(self): 获取会员信息 获取昵称、头像、性别、状态、数等个人信息 --- tags: - 会员接口 parameters: - name: uid in: query required: true description: 用户id schema: type: string - name: token in: qu...
91a23ac732b85b62072720deca9f3796d0af4a2d
<|skeleton|> class MemberInfoApi: def get(self): """获取会员信息 获取昵称、头像、性别、状态、数等个人信息 --- tags: - 会员接口 parameters: - name: uid in: query required: true description: 用户id schema: type: string - name: token in: query required: true description: AccessToken schema: type: string responses: 200: description: code=0为正...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MemberInfoApi: def get(self): """获取会员信息 获取昵称、头像、性别、状态、数等个人信息 --- tags: - 会员接口 parameters: - name: uid in: query required: true description: 用户id schema: type: string - name: token in: query required: true description: AccessToken schema: type: string responses: 200: description: code=0为正常,返回用户信息;code不...
the_stack_v2_python_sparse
main/controllers/api/member.py
maxcl730/my-scaffold
train
0
135bcce517075c3ac2229ca1cca207b404282879
[ "if len(prices) < 2:\n return 0\ndp = [[0 for _ in range(2)] for _ in range(len(prices))]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\nfor i in range(1, len(prices)):\n dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i])\n dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - prices[i])\nreturn dp[-1][0]", "if len(pri...
<|body_start_0|> if len(prices) < 2: return 0 dp = [[0 for _ in range(2)] for _ in range(len(prices))] dp[0][0] = 0 dp[0][1] = -prices[0] for i in range(1, len(prices)): dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] = max(dp[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情...
stack_v2_sparse_classes_75kplus_train_074549
2,732
no_license
[ { "docstring": "动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情况 1. 昨天未持股,今天买入 2. 昨天持股,今天不动 因为可以多次买卖,使用前面的利润减去今天买入的价格,为当前持有现金 方程表示为...
2
stack_v2_sparse_classes_30k_train_023777
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情况 1. 昨天未持股,今天买...
the_stack_v2_python_sparse
datastructure/dp_exercise/MaxProfit2.py
yinhuax/leet_code
train
0
2a4d6f68db9b63d5d26253d58fb1b43cdb25206e
[ "last_comment_by = self.data.get('last_comment_by', None)\nif last_comment_by is None:\n last_comment_by = self.BASE_LAST_COMMENT_BY.copy()\nnow = datetime.datetime.utcnow().isoformat()\nif is_public is True:\n last_comment_by['public']['name'] = user.get_initials()\n last_comment_by['public']['date_of'] =...
<|body_start_0|> last_comment_by = self.data.get('last_comment_by', None) if last_comment_by is None: last_comment_by = self.BASE_LAST_COMMENT_BY.copy() now = datetime.datetime.utcnow().isoformat() if is_public is True: last_comment_by['public']['name'] = user.get...
Save the last comment (public|privileged) in the data field
ItemLastCommentByMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemLastCommentByMixin: """Save the last comment (public|privileged) in the data field""" def set_last_comment_by(self, is_public, user): """Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users...
stack_v2_sparse_classes_75kplus_train_074550
17,116
no_license
[ { "docstring": "Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users", "name": "set_last_comment_by", "signature": "def set_last_comment_by(self, is_public, user)" }, { "docstring": "So get the last commen...
2
stack_v2_sparse_classes_30k_train_000800
Implement the Python class `ItemLastCommentByMixin` described below. Class description: Save the last comment (public|privileged) in the data field Method signatures and docstrings: - def set_last_comment_by(self, is_public, user): Save in our data field the appropriate last user info for whoever commented take note ...
Implement the Python class `ItemLastCommentByMixin` described below. Class description: Save the last comment (public|privileged) in the data field Method signatures and docstrings: - def set_last_comment_by(self, is_public, user): Save in our data field the appropriate last user info for whoever commented take note ...
cdda3dd17a776bf2a07fe093304160bf3c43199b
<|skeleton|> class ItemLastCommentByMixin: """Save the last comment (public|privileged) in the data field""" def set_last_comment_by(self, is_public, user): """Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ItemLastCommentByMixin: """Save the last comment (public|privileged) in the data field""" def set_last_comment_by(self, is_public, user): """Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users""" l...
the_stack_v2_python_sparse
toolkit/core/item/mixins.py
rosscdh/toolkit
train
1
43a27f38ee70629ed5aa7de8bcacfda8c8146891
[ "self.public_key_hash = public_key_hash\nself.ephemeral_public_key = ephemeral_public_key\nself.transaction_id = transaction_id", "if dictionary is None:\n return None\nephemeral_public_key = dictionary.get('ephemeral_public_key')\npublic_key_hash = dictionary.get('public_key_hash')\ntransaction_id = dictionar...
<|body_start_0|> self.public_key_hash = public_key_hash self.ephemeral_public_key = ephemeral_public_key self.transaction_id = transaction_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None ephemeral_public_key = dictionary.get('ephemeral_public_ke...
Implementation of the 'CreateApplePayHeaderRequest' model. The ApplePay header request Attributes: public_key_hash (string): SHA–256 hash, Base64 string codified ephemeral_public_key (string): X.509 encoded key bytes, Base64 encoded as a string transaction_id (string): Transaction identifier, generated on Device
CreateApplePayHeaderRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateApplePayHeaderRequest: """Implementation of the 'CreateApplePayHeaderRequest' model. The ApplePay header request Attributes: public_key_hash (string): SHA–256 hash, Base64 string codified ephemeral_public_key (string): X.509 encoded key bytes, Base64 encoded as a string transaction_id (stri...
stack_v2_sparse_classes_75kplus_train_074551
2,190
permissive
[ { "docstring": "Constructor for the CreateApplePayHeaderRequest class", "name": "__init__", "signature": "def __init__(self, ephemeral_public_key=None, public_key_hash=None, transaction_id=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)...
2
stack_v2_sparse_classes_30k_train_046009
Implement the Python class `CreateApplePayHeaderRequest` described below. Class description: Implementation of the 'CreateApplePayHeaderRequest' model. The ApplePay header request Attributes: public_key_hash (string): SHA–256 hash, Base64 string codified ephemeral_public_key (string): X.509 encoded key bytes, Base64 e...
Implement the Python class `CreateApplePayHeaderRequest` described below. Class description: Implementation of the 'CreateApplePayHeaderRequest' model. The ApplePay header request Attributes: public_key_hash (string): SHA–256 hash, Base64 string codified ephemeral_public_key (string): X.509 encoded key bytes, Base64 e...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class CreateApplePayHeaderRequest: """Implementation of the 'CreateApplePayHeaderRequest' model. The ApplePay header request Attributes: public_key_hash (string): SHA–256 hash, Base64 string codified ephemeral_public_key (string): X.509 encoded key bytes, Base64 encoded as a string transaction_id (stri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateApplePayHeaderRequest: """Implementation of the 'CreateApplePayHeaderRequest' model. The ApplePay header request Attributes: public_key_hash (string): SHA–256 hash, Base64 string codified ephemeral_public_key (string): X.509 encoded key bytes, Base64 encoded as a string transaction_id (string): Transact...
the_stack_v2_python_sparse
mundiapi/models/create_apple_pay_header_request.py
mundipagg/MundiAPI-PYTHON
train
10
4dac33b2d008d235362c4a7055977c2ecf27fc2f
[ "study_id = root._get_study_id(info)\ninvited_by = Membership.objects.get(collaborator=root.node.id, study=study_id).invited_by\nreturn invited_by", "study_id = root._get_study_id(info)\njoined_on = Membership.objects.get(collaborator=root.node.id, study=study_id).joined_on\nreturn joined_on", "study_id = root....
<|body_start_0|> study_id = root._get_study_id(info) invited_by = Membership.objects.get(collaborator=root.node.id, study=study_id).invited_by return invited_by <|end_body_0|> <|body_start_1|> study_id = root._get_study_id(info) joined_on = Membership.objects.get(collaborator=ro...
Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.
Edge
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Edge: """Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.""" def resolve_invited_by(root, info, **kwargs): """Returns the user that invited this collaborator to the study.""" <|body_0|> def resolve_joined...
stack_v2_sparse_classes_75kplus_train_074552
5,435
permissive
[ { "docstring": "Returns the user that invited this collaborator to the study.", "name": "resolve_invited_by", "signature": "def resolve_invited_by(root, info, **kwargs)" }, { "docstring": "Returns the date the collaborator joined the study.", "name": "resolve_joined_on", "signature": "de...
4
stack_v2_sparse_classes_30k_train_044541
Implement the Python class `Edge` described below. Class description: Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table. Method signatures and docstrings: - def resolve_invited_by(root, info, **kwargs): Returns the user that invited this collaborator to...
Implement the Python class `Edge` described below. Class description: Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table. Method signatures and docstrings: - def resolve_invited_by(root, info, **kwargs): Returns the user that invited this collaborator to...
ba62b369e6464259ea92dbb9ba49876513f37fba
<|skeleton|> class Edge: """Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.""" def resolve_invited_by(root, info, **kwargs): """Returns the user that invited this collaborator to the study.""" <|body_0|> def resolve_joined...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Edge: """Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.""" def resolve_invited_by(root, info, **kwargs): """Returns the user that invited this collaborator to the study.""" study_id = root._get_study_id(info) inv...
the_stack_v2_python_sparse
creator/users/schema.py
kids-first/kf-api-study-creator
train
3
b193964771e915d36308ed16fb9105f49ee8ca8b
[ "Parametre.__init__(self, 'descendre', 'lower')\nself.schema = '<texte_libre>'\nself.aide_courte = 'descend un canot'\nself.aide_longue = \"Cette commande permet de descendre un canot qui se trouve sur le pont du navire où vous vous trouvez. Vous devez vous tenir près d'un bossoir, permettant de faire descendre le ...
<|body_start_0|> Parametre.__init__(self, 'descendre', 'lower') self.schema = '<texte_libre>' self.aide_courte = 'descend un canot' self.aide_longue = "Cette commande permet de descendre un canot qui se trouve sur le pont du navire où vous vous trouvez. Vous devez vous tenir près d'un bo...
Commande 'canot descendre'.
PrmDescendre
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmDescendre: """Commande 'canot descendre'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parame...
stack_v2_sparse_classes_75kplus_train_074553
3,513
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre.", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_040499
Implement the Python class `PrmDescendre` described below. Class description: Commande 'canot descendre'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre.
Implement the Python class `PrmDescendre` described below. Class description: Commande 'canot descendre'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre. <|skeleton|> class PrmDescendre: """Commande '...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmDescendre: """Commande 'canot descendre'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrmDescendre: """Commande 'canot descendre'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'descendre', 'lower') self.schema = '<texte_libre>' self.aide_courte = 'descend un canot' self.aide_longue = "Cette commande permet de desce...
the_stack_v2_python_sparse
src/secondaires/navigation/commandes/canot/descendre.py
vincent-lg/tsunami
train
5
9ed1c21bf475e216d2be29f34e067f263c906c73
[ "self.file_path = file_path\nif not os.path.isfile(self.file_path):\n raise ValueError('File path %s is not a valid file' % self.file_path)\ntry:\n import extract_msg\nexcept ImportError:\n raise ImportError('extract_msg is not installed. Please install it with `pip install extract_msg`')", "import extra...
<|body_start_0|> self.file_path = file_path if not os.path.isfile(self.file_path): raise ValueError('File path %s is not a valid file' % self.file_path) try: import extract_msg except ImportError: raise ImportError('extract_msg is not installed. Please...
Loader that loads Outlook Message files using extract_msg. https://github.com/TeamMsgExtractor/msg-extractor
OutlookMessageLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutlookMessageLoader: """Loader that loads Outlook Message files using extract_msg. https://github.com/TeamMsgExtractor/msg-extractor""" def __init__(self, file_path: str): """Initialize with file path.""" <|body_0|> def load(self) -> List[Document]: """Load data...
stack_v2_sparse_classes_75kplus_train_074554
2,270
no_license
[ { "docstring": "Initialize with file path.", "name": "__init__", "signature": "def __init__(self, file_path: str)" }, { "docstring": "Load data into document objects.", "name": "load", "signature": "def load(self) -> List[Document]" } ]
2
stack_v2_sparse_classes_30k_train_035818
Implement the Python class `OutlookMessageLoader` described below. Class description: Loader that loads Outlook Message files using extract_msg. https://github.com/TeamMsgExtractor/msg-extractor Method signatures and docstrings: - def __init__(self, file_path: str): Initialize with file path. - def load(self) -> List...
Implement the Python class `OutlookMessageLoader` described below. Class description: Loader that loads Outlook Message files using extract_msg. https://github.com/TeamMsgExtractor/msg-extractor Method signatures and docstrings: - def __init__(self, file_path: str): Initialize with file path. - def load(self) -> List...
b7aaa920a52613e3f1f04fa5cd7568ad37302d11
<|skeleton|> class OutlookMessageLoader: """Loader that loads Outlook Message files using extract_msg. https://github.com/TeamMsgExtractor/msg-extractor""" def __init__(self, file_path: str): """Initialize with file path.""" <|body_0|> def load(self) -> List[Document]: """Load data...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OutlookMessageLoader: """Loader that loads Outlook Message files using extract_msg. https://github.com/TeamMsgExtractor/msg-extractor""" def __init__(self, file_path: str): """Initialize with file path.""" self.file_path = file_path if not os.path.isfile(self.file_path): ...
the_stack_v2_python_sparse
openai/venv/lib64/python3.10/site-packages/langchain/document_loaders/email.py
henrymendez/garage
train
0
c83223d4b0ecbaa9b38d97d701a5af57169bb9b8
[ "self.features = []\nself.feature_vectors = []\nself.__select_features(weights)\nfor feature_set in self.features:\n self.__generate_dataset(weights, documents, feature_set)", "features = set()\nscores = dict([])\nfor doc, doc_dict in weights.iteritems():\n top = dict(sorted(doc_dict.iteritems(), key=operat...
<|body_start_0|> self.features = [] self.feature_vectors = [] self.__select_features(weights) for feature_set in self.features: self.__generate_dataset(weights, documents, feature_set) <|end_body_0|> <|body_start_1|> features = set() scores = dict([]) ...
FeatureSelector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureSelector: def __init__(self, weights, documents): """function: constructor --------------------- select features and generate feature vector sets from @documents :param weights: table of (document,word) tf-idf scores :param documents: list of document objects""" <|body_0|>...
stack_v2_sparse_classes_75kplus_train_074555
4,307
no_license
[ { "docstring": "function: constructor --------------------- select features and generate feature vector sets from @documents :param weights: table of (document,word) tf-idf scores :param documents: list of document objects", "name": "__init__", "signature": "def __init__(self, weights, documents)" }, ...
3
stack_v2_sparse_classes_30k_train_023647
Implement the Python class `FeatureSelector` described below. Class description: Implement the FeatureSelector class. Method signatures and docstrings: - def __init__(self, weights, documents): function: constructor --------------------- select features and generate feature vector sets from @documents :param weights:...
Implement the Python class `FeatureSelector` described below. Class description: Implement the FeatureSelector class. Method signatures and docstrings: - def __init__(self, weights, documents): function: constructor --------------------- select features and generate feature vector sets from @documents :param weights:...
068662ed9399b136b3098c7706ee89717eef0bf5
<|skeleton|> class FeatureSelector: def __init__(self, weights, documents): """function: constructor --------------------- select features and generate feature vector sets from @documents :param weights: table of (document,word) tf-idf scores :param documents: list of document objects""" <|body_0|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeatureSelector: def __init__(self, weights, documents): """function: constructor --------------------- select features and generate feature vector sets from @documents :param weights: table of (document,word) tf-idf scores :param documents: list of document objects""" self.features = [] ...
the_stack_v2_python_sparse
preprocessing/feature/featureselect.py
ankailou/reuters-minwisehash
train
0
a3c6ecf3305b909da69994f315b291aa05268f44
[ "self._block_args = block_args\nself._batch_norm_momentum = global_params.batch_norm_momentum\nself._batch_norm_epsilon = global_params.batch_norm_epsilon\nif global_params.data_format == 'channels_first':\n self._channel_axis = 1\n self._spatial_dims = [2, 3]\nelse:\n self._channel_axis = -1\n self._sp...
<|body_start_0|> self._block_args = block_args self._batch_norm_momentum = global_params.batch_norm_momentum self._batch_norm_epsilon = global_params.batch_norm_epsilon if global_params.data_format == 'channels_first': self._channel_axis = 1 self._spatial_dims = [...
A class of MnasNet/MobileNetV2 Inveretd Residual Bottleneck. Attributes: has_se: boolean. Whether the block contains a Squeeze and Excitation layer inside. endpoints: dict. A list of internal tensors.
MBConvBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MBConvBlock: """A class of MnasNet/MobileNetV2 Inveretd Residual Bottleneck. Attributes: has_se: boolean. Whether the block contains a Squeeze and Excitation layer inside. endpoints: dict. A list of internal tensors.""" def __init__(self, block_args, global_params, layer_runtimes, dropout_ra...
stack_v2_sparse_classes_75kplus_train_074556
18,413
permissive
[ { "docstring": "Initializes a MBConv block. Args: block_args: BlockArgs, arguments to create a MnasBlock. global_params: GlobalParams, a set of global parameters.", "name": "__init__", "signature": "def __init__(self, block_args, global_params, layer_runtimes, dropout_rate)" }, { "docstring": "B...
4
null
Implement the Python class `MBConvBlock` described below. Class description: A class of MnasNet/MobileNetV2 Inveretd Residual Bottleneck. Attributes: has_se: boolean. Whether the block contains a Squeeze and Excitation layer inside. endpoints: dict. A list of internal tensors. Method signatures and docstrings: - def ...
Implement the Python class `MBConvBlock` described below. Class description: A class of MnasNet/MobileNetV2 Inveretd Residual Bottleneck. Attributes: has_se: boolean. Whether the block contains a Squeeze and Excitation layer inside. endpoints: dict. A list of internal tensors. Method signatures and docstrings: - def ...
5c3090487c7222e20f62df02aac910482b15877c
<|skeleton|> class MBConvBlock: """A class of MnasNet/MobileNetV2 Inveretd Residual Bottleneck. Attributes: has_se: boolean. Whether the block contains a Squeeze and Excitation layer inside. endpoints: dict. A list of internal tensors.""" def __init__(self, block_args, global_params, layer_runtimes, dropout_ra...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MBConvBlock: """A class of MnasNet/MobileNetV2 Inveretd Residual Bottleneck. Attributes: has_se: boolean. Whether the block contains a Squeeze and Excitation layer inside. endpoints: dict. A list of internal tensors.""" def __init__(self, block_args, global_params, layer_runtimes, dropout_rate): ...
the_stack_v2_python_sparse
nas-search/singlepath_supernet.py
RoxaneFis/single-path-nas
train
1
1718fd0de16a4973603bc47f724bde41fbcbc2fe
[ "p = prehead = ListNode()\ncarry = 0\nwhile l1 or l2:\n s = carry\n if l1:\n s += l1.val\n l1 = l1.next\n if l2:\n s += l2.val\n l2 = l2.next\n carry = s // 10\n p.next = ListNode(s % 10)\n p = p.next\nif carry:\n p.next = ListNode(carry)\nreturn prehead.next", "de...
<|body_start_0|> p = prehead = ListNode() carry = 0 while l1 or l2: s = carry if l1: s += l1.val l1 = l1.next if l2: s += l2.val l2 = l2.next carry = s // 10 p.next = ListN...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers_v1(self, l1: ListNode, l2: ListNode) -> ListNode: """Use a "prehead" to simplify the logic. LeatCode: 64 ms, 14 MB; beats 94.54%""" <|body_0|> def addTwoNumbers_v2(self, l1: ListNode, l2: ListNode) -> ListNode: """Convert lists to integers...
stack_v2_sparse_classes_75kplus_train_074557
3,213
no_license
[ { "docstring": "Use a \"prehead\" to simplify the logic. LeatCode: 64 ms, 14 MB; beats 94.54%", "name": "addTwoNumbers_v1", "signature": "def addTwoNumbers_v1(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "Convert lists to integers and then conver the sume of integers back to ...
2
stack_v2_sparse_classes_30k_train_035054
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers_v1(self, l1: ListNode, l2: ListNode) -> ListNode: Use a "prehead" to simplify the logic. LeatCode: 64 ms, 14 MB; beats 94.54% - def addTwoNumbers_v2(self, l1: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers_v1(self, l1: ListNode, l2: ListNode) -> ListNode: Use a "prehead" to simplify the logic. LeatCode: 64 ms, 14 MB; beats 94.54% - def addTwoNumbers_v2(self, l1: L...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def addTwoNumbers_v1(self, l1: ListNode, l2: ListNode) -> ListNode: """Use a "prehead" to simplify the logic. LeatCode: 64 ms, 14 MB; beats 94.54%""" <|body_0|> def addTwoNumbers_v2(self, l1: ListNode, l2: ListNode) -> ListNode: """Convert lists to integers...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def addTwoNumbers_v1(self, l1: ListNode, l2: ListNode) -> ListNode: """Use a "prehead" to simplify the logic. LeatCode: 64 ms, 14 MB; beats 94.54%""" p = prehead = ListNode() carry = 0 while l1 or l2: s = carry if l1: s += l1.va...
the_stack_v2_python_sparse
python3/linked_list/add_two_numbers.py
victorchu/algorithms
train
0
ef1008c216a3347395c0a47a991cb0e09208f576
[ "super(BaseModule, self).__init__()\nself.cfg = cfg\nself.id = 0\nif self.cfg.VISUALIZATION.ENABLE and self.cfg.VISUALIZATION.FEATURE_MAPS.ENABLE:\n self.base_output_dir = self.cfg.VISUALIZATION.FEATURE_MAPS.BASE_OUTPUT_DIR\n self.register_forward_hook(self.visualize_features)", "b, c, t, h, w = output_x.sh...
<|body_start_0|> super(BaseModule, self).__init__() self.cfg = cfg self.id = 0 if self.cfg.VISUALIZATION.ENABLE and self.cfg.VISUALIZATION.FEATURE_MAPS.ENABLE: self.base_output_dir = self.cfg.VISUALIZATION.FEATURE_MAPS.BASE_OUTPUT_DIR self.register_forward_hook(se...
Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled.
BaseModule
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseModule: """Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled.""" def __init__(self, cfg): """Args: cfg (Config): global ...
stack_v2_sparse_classes_75kplus_train_074558
17,711
permissive
[ { "docstring": "Args: cfg (Config): global config object.", "name": "__init__", "signature": "def __init__(self, cfg)" }, { "docstring": "Visualizes and saves the normalized output features for the module.", "name": "visualize_features", "signature": "def visualize_features(self, module,...
2
stack_v2_sparse_classes_30k_train_003441
Implement the Python class `BaseModule` described below. Class description: Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled. Method signatures and docstring...
Implement the Python class `BaseModule` described below. Class description: Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled. Method signatures and docstring...
cfb49fa51a13373e4afc74f8800ec8284c41b8d2
<|skeleton|> class BaseModule: """Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled.""" def __init__(self, cfg): """Args: cfg (Config): global ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseModule: """Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled.""" def __init__(self, cfg): """Args: cfg (Config): global config object...
the_stack_v2_python_sparse
papers/pytorch-video-understanding/models/base/base_blocks.py
hrb518/EssentialMC2
train
1
0be23cd4be2fc403cd795bb78123df42e96342de
[ "if user_id is None:\n return None\nsession_id = super().create_session(user_id)\nif session_id is None:\n return None\nuser_session = UserSession(**{'user_id': user_id, 'session_id': session_id})\nuser_session.save()\nreturn session_id", "if session_id is None:\n return None\nUserSession.load_from_file(...
<|body_start_0|> if user_id is None: return None session_id = super().create_session(user_id) if session_id is None: return None user_session = UserSession(**{'user_id': user_id, 'session_id': session_id}) user_session.save() return session_id <|en...
Session to use a DB
SessionDBAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionDBAuth: """Session to use a DB""" def create_session(self, user_id=None): """Create Session""" <|body_0|> def user_id_for_session_id(self, session_id=None): """Get the user id for session""" <|body_1|> def destroy_session(self, request=None): ...
stack_v2_sparse_classes_75kplus_train_074559
1,931
no_license
[ { "docstring": "Create Session", "name": "create_session", "signature": "def create_session(self, user_id=None)" }, { "docstring": "Get the user id for session", "name": "user_id_for_session_id", "signature": "def user_id_for_session_id(self, session_id=None)" }, { "docstring": "...
3
null
Implement the Python class `SessionDBAuth` described below. Class description: Session to use a DB Method signatures and docstrings: - def create_session(self, user_id=None): Create Session - def user_id_for_session_id(self, session_id=None): Get the user id for session - def destroy_session(self, request=None): Dest...
Implement the Python class `SessionDBAuth` described below. Class description: Session to use a DB Method signatures and docstrings: - def create_session(self, user_id=None): Create Session - def user_id_for_session_id(self, session_id=None): Get the user id for session - def destroy_session(self, request=None): Dest...
c37b81be36c1094de838b6ed1e954c635785fabc
<|skeleton|> class SessionDBAuth: """Session to use a DB""" def create_session(self, user_id=None): """Create Session""" <|body_0|> def user_id_for_session_id(self, session_id=None): """Get the user id for session""" <|body_1|> def destroy_session(self, request=None): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SessionDBAuth: """Session to use a DB""" def create_session(self, user_id=None): """Create Session""" if user_id is None: return None session_id = super().create_session(user_id) if session_id is None: return None user_session = UserSession(...
the_stack_v2_python_sparse
0x07-Session_authentication/api/v1/auth/session_db_auth.py
TzStrikerYT/holbertonschool-web_back_end
train
2
b0a38bf5898cc135cadfdfe9ce0dd37de6983675
[ "super().__init__()\nself.traverse_edges = ['next']\nself.imdb = imdb\nself.max_error = 0\nself.dtype_required = dtype_required", "t = edge.get_target()\nif type(t) is KerasLayerNode and callable(t.func):\n l = t.func([np.array(self.imdb)])\n t.out_max = np.max(l)\n t.out_min = np.min(l)\nreturn True", ...
<|body_start_0|> super().__init__() self.traverse_edges = ['next'] self.imdb = imdb self.max_error = 0 self.dtype_required = dtype_required <|end_body_0|> <|body_start_1|> t = edge.get_target() if type(t) is KerasLayerNode and callable(t.func): l = t....
Action to apply quantization where possible
QuantizeAction
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantizeAction: """Action to apply quantization where possible""" def __init__(self, imdb, dtype_required): """Init this class.""" <|body_0|> def _pre_action(self, edge) -> bool: """Called on every visited edge. Used to determine what values actual appear. Max an...
stack_v2_sparse_classes_75kplus_train_074560
2,075
permissive
[ { "docstring": "Init this class.", "name": "__init__", "signature": "def __init__(self, imdb, dtype_required)" }, { "docstring": "Called on every visited edge. Used to determine what values actual appear. Max and min of these values are used later to determine the scaling factor. :param edge: Th...
3
null
Implement the Python class `QuantizeAction` described below. Class description: Action to apply quantization where possible Method signatures and docstrings: - def __init__(self, imdb, dtype_required): Init this class. - def _pre_action(self, edge) -> bool: Called on every visited edge. Used to determine what values ...
Implement the Python class `QuantizeAction` described below. Class description: Action to apply quantization where possible Method signatures and docstrings: - def __init__(self, imdb, dtype_required): Init this class. - def _pre_action(self, edge) -> bool: Called on every visited edge. Used to determine what values ...
987b0efeb56cd150b3a34b672fd5eba05e6d491f
<|skeleton|> class QuantizeAction: """Action to apply quantization where possible""" def __init__(self, imdb, dtype_required): """Init this class.""" <|body_0|> def _pre_action(self, edge) -> bool: """Called on every visited edge. Used to determine what values actual appear. Max an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuantizeAction: """Action to apply quantization where possible""" def __init__(self, imdb, dtype_required): """Init this class.""" super().__init__() self.traverse_edges = ['next'] self.imdb = imdb self.max_error = 0 self.dtype_required = dtype_required ...
the_stack_v2_python_sparse
nncg/traverse/actions/quantizeaction.py
iml130/nncg
train
34
454ebd2873a32f9884ad44db5f2932cc849af4d9
[ "\"\"\"\n _ h o r s e\n _ 0 1 2 3 4 5\n o 1 1 1 2 3 4\n r 2 2 2 1 2 3\n s 3 3 2 2 1 2\n\n \"\"\"\nif not word1 or not word2:\n return max(len(word1), len(word2))\nmemo = [j + 1 for j in range(len(word2))]\nfor i in range(len(word1)):\n new_memo = []\n for j in ra...
<|body_start_0|> """ _ h o r s e _ 0 1 2 3 4 5 o 1 1 1 2 3 4 r 2 2 2 1 2 3 s 3 3 2 2 1 2 """ if not word1 or not word2: return max(len(word1), len(word2)) memo = [j + 1 for j in range(l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance(self, word1, word2): """Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance(self, word1: str, word2: str) -> int: """Apr 02, 2023 14:14""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_074561
2,724
no_license
[ { "docstring": "Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int", "name": "minDistance", "signature": "def minDistance(self, word1, word2)" }, { "docstring": "Apr 02, 2023 14:14", "name": "minDistance", "signature": "def minDistance(self, word1: str, word2: str) -> int" ...
2
stack_v2_sparse_classes_30k_val_001480
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1, word2): Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int - def minDistance(self, word1: str, word2: str) -> int: Apr 02, 2023 14:14
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1, word2): Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int - def minDistance(self, word1: str, word2: str) -> int: Apr 02, 2023 14:14 ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def minDistance(self, word1, word2): """Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance(self, word1: str, word2: str) -> int: """Apr 02, 2023 14:14""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minDistance(self, word1, word2): """Aug 11, 2018 05:20 :type word1: str :type word2: str :rtype: int""" """ _ h o r s e _ 0 1 2 3 4 5 o 1 1 1 2 3 4 r 2 2 2 1 2 3 s 3 3 2 2 1 2 """ ...
the_stack_v2_python_sparse
leetcode/solved/72_Edit_Distance/solution.py
sungminoh/algorithms
train
0
854d7a1d91d77c75110ba04b006e9c230305f6b1
[ "receiver = cls()\nactivity = receiver.__app__.widget\nreceiver.setReceiver(receiver.getId())\n\ndef on_receive(ctx, intent):\n callback(intent)\nreceiver.onReceive.connect(on_receive)\nactivity.registerReceiver(receiver, IntentFilter(action))\nreturn receiver", "activity = self.__app__.widget\nactivity.unregi...
<|body_start_0|> receiver = cls() activity = receiver.__app__.widget receiver.setReceiver(receiver.getId()) def on_receive(ctx, intent): callback(intent) receiver.onReceive.connect(on_receive) activity.registerReceiver(receiver, IntentFilter(action)) ...
A BroadcastReceiver that delegates to a listener
BroadcastReceiver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BroadcastReceiver: """A BroadcastReceiver that delegates to a listener""" def for_action(cls, action, callback, single_shot=True): """Create a BroadcastReceiver that is invoked when the given action is received. Parameters ---------- action: String Action to receive callback: Callabl...
stack_v2_sparse_classes_75kplus_train_074562
10,095
permissive
[ { "docstring": "Create a BroadcastReceiver that is invoked when the given action is received. Parameters ---------- action: String Action to receive callback: Callable Callback to invoke when the action is received single_shot: Bool Cleanup after one callback Returns ------- receiver: BroadcastReceiver The rece...
2
stack_v2_sparse_classes_30k_train_029643
Implement the Python class `BroadcastReceiver` described below. Class description: A BroadcastReceiver that delegates to a listener Method signatures and docstrings: - def for_action(cls, action, callback, single_shot=True): Create a BroadcastReceiver that is invoked when the given action is received. Parameters ----...
Implement the Python class `BroadcastReceiver` described below. Class description: A BroadcastReceiver that delegates to a listener Method signatures and docstrings: - def for_action(cls, action, callback, single_shot=True): Create a BroadcastReceiver that is invoked when the given action is received. Parameters ----...
04c3a015bcd649f374c5ecd98fcddba5e4fbdbdc
<|skeleton|> class BroadcastReceiver: """A BroadcastReceiver that delegates to a listener""" def for_action(cls, action, callback, single_shot=True): """Create a BroadcastReceiver that is invoked when the given action is received. Parameters ---------- action: String Action to receive callback: Callabl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BroadcastReceiver: """A BroadcastReceiver that delegates to a listener""" def for_action(cls, action, callback, single_shot=True): """Create a BroadcastReceiver that is invoked when the given action is received. Parameters ---------- action: String Action to receive callback: Callable Callback to...
the_stack_v2_python_sparse
src/enamlnative/android/android_content.py
mfkiwl/enaml-native
train
0
c64bf9ad1b0ed6a9c98fce6714301bc0819ad185
[ "def memoize(N: int) -> int:\n if N <= 1:\n return N\n if N in self.cache.keys():\n return self.cache[N]\n self.cache[N] = memoize(N - 1) + memoize(N - 2)\n return memoize(N)\nself.cache = {0: 0, 1: 1}\nreturn memoize(N)", "if N < 2:\n return N\ndp = [0] * (N + 1)\ndp[0], dp[1] = (0, ...
<|body_start_0|> def memoize(N: int) -> int: if N <= 1: return N if N in self.cache.keys(): return self.cache[N] self.cache[N] = memoize(N - 1) + memoize(N - 2) return memoize(N) self.cache = {0: 0, 1: 1} return memo...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fib(self, N: int) -> int: """递归超时,记忆化递归实现(数组/哈希表)""" <|body_0|> def fib1(self, N: int) -> int: """递归(自上而下)超时,循环实现(自下而上)""" <|body_1|> def fib2(self, N: int) -> int: """空间复杂度:O(1)""" <|body_2|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_75kplus_train_074563
1,986
permissive
[ { "docstring": "递归超时,记忆化递归实现(数组/哈希表)", "name": "fib", "signature": "def fib(self, N: int) -> int" }, { "docstring": "递归(自上而下)超时,循环实现(自下而上)", "name": "fib1", "signature": "def fib1(self, N: int) -> int" }, { "docstring": "空间复杂度:O(1)", "name": "fib2", "signature": "def fib2...
3
stack_v2_sparse_classes_30k_train_036512
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, N: int) -> int: 递归超时,记忆化递归实现(数组/哈希表) - def fib1(self, N: int) -> int: 递归(自上而下)超时,循环实现(自下而上) - def fib2(self, N: int) -> int: 空间复杂度:O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, N: int) -> int: 递归超时,记忆化递归实现(数组/哈希表) - def fib1(self, N: int) -> int: 递归(自上而下)超时,循环实现(自下而上) - def fib2(self, N: int) -> int: 空间复杂度:O(1) <|skeleton|> class Solution...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def fib(self, N: int) -> int: """递归超时,记忆化递归实现(数组/哈希表)""" <|body_0|> def fib1(self, N: int) -> int: """递归(自上而下)超时,循环实现(自下而上)""" <|body_1|> def fib2(self, N: int) -> int: """空间复杂度:O(1)""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def fib(self, N: int) -> int: """递归超时,记忆化递归实现(数组/哈希表)""" def memoize(N: int) -> int: if N <= 1: return N if N in self.cache.keys(): return self.cache[N] self.cache[N] = memoize(N - 1) + memoize(N - 2) ret...
the_stack_v2_python_sparse
509-fibonacci-number.py
yuenliou/leetcode
train
0
4c3ff1408f9a92cb5cfab61546b39836426ebd02
[ "super(AnalysisStorage, self).__init__(filename=filename, mode='r')\nself.set_caching_mode(caching_mode)\nAnalysisStorage.cache_for_analysis(self)", "with AnalysisStorage.CacheTimer('Cached all CVs'):\n for cv, cv_store in storage.snapshots.attribute_list.items():\n if cv_store:\n cv_store.ca...
<|body_start_0|> super(AnalysisStorage, self).__init__(filename=filename, mode='r') self.set_caching_mode(caching_mode) AnalysisStorage.cache_for_analysis(self) <|end_body_0|> <|body_start_1|> with AnalysisStorage.CacheTimer('Cached all CVs'): for cv, cv_store in storage.sna...
Open a storage in read-only and do caching useful for analysis.
AnalysisStorage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalysisStorage: """Open a storage in read-only and do caching useful for analysis.""" def __init__(self, filename, caching_mode='analysis'): """Open a storage in read-only and do caching useful for analysis. Parameters ---------- filename : str The filename of the storage to be open...
stack_v2_sparse_classes_75kplus_train_074564
17,720
permissive
[ { "docstring": "Open a storage in read-only and do caching useful for analysis. Parameters ---------- filename : str The filename of the storage to be opened caching_mode : str The caching mode to be used. Default is `analysis` which will cache lots of usually relevant object. If you have a decent size system a...
2
stack_v2_sparse_classes_30k_train_015058
Implement the Python class `AnalysisStorage` described below. Class description: Open a storage in read-only and do caching useful for analysis. Method signatures and docstrings: - def __init__(self, filename, caching_mode='analysis'): Open a storage in read-only and do caching useful for analysis. Parameters -------...
Implement the Python class `AnalysisStorage` described below. Class description: Open a storage in read-only and do caching useful for analysis. Method signatures and docstrings: - def __init__(self, filename, caching_mode='analysis'): Open a storage in read-only and do caching useful for analysis. Parameters -------...
3d02df4ccdeb6d62030a28e371a6b4ea9aaee5fe
<|skeleton|> class AnalysisStorage: """Open a storage in read-only and do caching useful for analysis.""" def __init__(self, filename, caching_mode='analysis'): """Open a storage in read-only and do caching useful for analysis. Parameters ---------- filename : str The filename of the storage to be open...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnalysisStorage: """Open a storage in read-only and do caching useful for analysis.""" def __init__(self, filename, caching_mode='analysis'): """Open a storage in read-only and do caching useful for analysis. Parameters ---------- filename : str The filename of the storage to be opened caching_mo...
the_stack_v2_python_sparse
openpathsampling/storage/storage.py
dwhswenson/openpathsampling
train
3
e0e78dbfe4fd009bfd60945323fdb6255f4c53fb
[ "self._header_state = {}\nheader_key_list = DEFAULT_HEADER_KEY_LIST\nfor header_key in header_key_list:\n self._header_state[header_key] = None\nself._metadata_extracted = False\nif DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT in config:\n particle_classes_dict = config.get(DataSetDriverConfigKeys.PARTICLE_C...
<|body_start_0|> self._header_state = {} header_key_list = DEFAULT_HEADER_KEY_LIST for header_key in header_key_list: self._header_state[header_key] = None self._metadata_extracted = False if DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT in config: particl...
NutnrJCsppParser
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NutnrJCsppParser: def __init__(self, config, stream_handle, exception_callback): """This the constructor which instantiates the NutnrJCsppParser""" <|body_0|> def _process_data_match(self, data_match): """This method processes a data match. It will extract a metadata...
stack_v2_sparse_classes_75kplus_train_074565
17,304
permissive
[ { "docstring": "This the constructor which instantiates the NutnrJCsppParser", "name": "__init__", "signature": "def __init__(self, config, stream_handle, exception_callback)" }, { "docstring": "This method processes a data match. It will extract a metadata particle and insert it into the record...
3
stack_v2_sparse_classes_30k_train_048176
Implement the Python class `NutnrJCsppParser` described below. Class description: Implement the NutnrJCsppParser class. Method signatures and docstrings: - def __init__(self, config, stream_handle, exception_callback): This the constructor which instantiates the NutnrJCsppParser - def _process_data_match(self, data_m...
Implement the Python class `NutnrJCsppParser` described below. Class description: Implement the NutnrJCsppParser class. Method signatures and docstrings: - def __init__(self, config, stream_handle, exception_callback): This the constructor which instantiates the NutnrJCsppParser - def _process_data_match(self, data_m...
bdbf01f5614e7188ce19596704794466e5683b30
<|skeleton|> class NutnrJCsppParser: def __init__(self, config, stream_handle, exception_callback): """This the constructor which instantiates the NutnrJCsppParser""" <|body_0|> def _process_data_match(self, data_match): """This method processes a data match. It will extract a metadata...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NutnrJCsppParser: def __init__(self, config, stream_handle, exception_callback): """This the constructor which instantiates the NutnrJCsppParser""" self._header_state = {} header_key_list = DEFAULT_HEADER_KEY_LIST for header_key in header_key_list: self._header_stat...
the_stack_v2_python_sparse
mi/dataset/parser/nutnr_j_cspp.py
oceanobservatories/mi-instrument
train
1
ca3c97b1a69cc1d58d0352eb7863ea5b0761474f
[ "super(AdamWeightDecayOptimizer, self).__init__(False, name)\nself.learning_rate = tf.identity(learning_rate, 'learning_rate')\nself.weight_decay_rate = weight_decay_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.exclude_from_weight_decay = exclude_from_weight_decay", "assignments ...
<|body_start_0|> super(AdamWeightDecayOptimizer, self).__init__(False, name) self.learning_rate = tf.identity(learning_rate, 'learning_rate') self.weight_decay_rate = weight_decay_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon self.exclude_f...
A basic Adam optimizer that includes "correct" L2 weight decay.
AdamWeightDecayOptimizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWeig...
stack_v2_sparse_classes_75kplus_train_074566
27,721
permissive
[ { "docstring": "Constructs a AdamWeightDecayOptimizer.", "name": "__init__", "signature": "def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer')" }, { "docstring": "See base class.", ...
4
null
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
4bd9f94d0f34d2a2846c5d892ca16121b18b6e10
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWeig...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWeightDecayOptimi...
the_stack_v2_python_sparse
LatticeBERT/optimization.py
RunxinXu/AliceMind
train
0
8b09716a2aa886b93b7002878d1d8558d790cf45
[ "self.id_nodo = id_nodo\nself.padre = padre\nself.valor = valor\nself.hijos = {}", "if self.id_nodo == id_nodo:\n return self\nfor hijo in self.hijos.values():\n nodo = hijo.obtener_nodo(id_nodo)\n if nodo is not None:\n return nodo\nreturn None", "padre = self.obtener_nodo(id_padre)\nif padre i...
<|body_start_0|> self.id_nodo = id_nodo self.padre = padre self.valor = valor self.hijos = {} <|end_body_0|> <|body_start_1|> if self.id_nodo == id_nodo: return self for hijo in self.hijos.values(): nodo = hijo.obtener_nodo(id_nodo) if...
Esta clase representa un árbol La estructura es recursiva, de manera que cada nodo es la raíz de un sub-árbol. Los nodos hijos pueden ser guardados en una estructura, como lista o diccionario. En este ejemplo, los nodos hijos serán guardados en un diccionario.
Arbol
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Arbol: """Esta clase representa un árbol La estructura es recursiva, de manera que cada nodo es la raíz de un sub-árbol. Los nodos hijos pueden ser guardados en una estructura, como lista o diccionario. En este ejemplo, los nodos hijos serán guardados en un diccionario.""" def __init__(self,...
stack_v2_sparse_classes_75kplus_train_074567
5,113
no_license
[ { "docstring": "Inicializa la estructura básica del árbol. Tiene un identificador propio, la referencia a su padre, el valor almacenado y una estructura con sus hijos.", "name": "__init__", "signature": "def __init__(self, id_nodo, valor=None, padre=None)" }, { "docstring": "Obtiene el nodo con ...
4
stack_v2_sparse_classes_30k_train_045890
Implement the Python class `Arbol` described below. Class description: Esta clase representa un árbol La estructura es recursiva, de manera que cada nodo es la raíz de un sub-árbol. Los nodos hijos pueden ser guardados en una estructura, como lista o diccionario. En este ejemplo, los nodos hijos serán guardados en un ...
Implement the Python class `Arbol` described below. Class description: Esta clase representa un árbol La estructura es recursiva, de manera que cada nodo es la raíz de un sub-árbol. Los nodos hijos pueden ser guardados en una estructura, como lista o diccionario. En este ejemplo, los nodos hijos serán guardados en un ...
54f55b9da9d0fa3f976466b3bef19e488c45bef8
<|skeleton|> class Arbol: """Esta clase representa un árbol La estructura es recursiva, de manera que cada nodo es la raíz de un sub-árbol. Los nodos hijos pueden ser guardados en una estructura, como lista o diccionario. En este ejemplo, los nodos hijos serán guardados en un diccionario.""" def __init__(self,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Arbol: """Esta clase representa un árbol La estructura es recursiva, de manera que cada nodo es la raíz de un sub-árbol. Los nodos hijos pueden ser guardados en una estructura, como lista o diccionario. En este ejemplo, los nodos hijos serán guardados en un diccionario.""" def __init__(self, id_nodo, val...
the_stack_v2_python_sparse
Semana 11/arboles.py
TMagini/Apuntes-Progra-Avanzada
train
0
ed009c01180f071657fb1680dff2aaf765af10d5
[ "super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)", "d_k = query.size(-1)\nscores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)\n...
<|body_start_0|> super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_model), 4) self.attn = None self.dropout = nn.Dropout(p=dropout) <|end_body_0|> <|body_start_1|> ...
MultiHeadedAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def attention(self, query, key, value, mask=None, dropout=None): """Compute 'Scaled Dot Product Attention'""" <|body_1|> def forwa...
stack_v2_sparse_classes_75kplus_train_074568
14,213
no_license
[ { "docstring": "Take in model size and number of heads.", "name": "__init__", "signature": "def __init__(self, h, d_model, dropout=0.1)" }, { "docstring": "Compute 'Scaled Dot Product Attention'", "name": "attention", "signature": "def attention(self, query, key, value, mask=None, dropou...
3
stack_v2_sparse_classes_30k_train_014184
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def attention(self, query, key, value, mask=None, dropout=None): Co...
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def attention(self, query, key, value, mask=None, dropout=None): Co...
7c389dd416c67f382c9a5d3e1661a5bd89aecc47
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def attention(self, query, key, value, mask=None, dropout=None): """Compute 'Scaled Dot Product Attention'""" <|body_1|> def forwa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_mo...
the_stack_v2_python_sparse
models/AttModel.py
Shiyang-Yan/ParaCNN
train
2
a48fc3b122b969497f56d7536a169137a0ccb30d
[ "self._discovery_info: BluetoothServiceInfoBleak | None = None\nself._discovered_device: DeviceData | None = None\nself._discovered_devices: dict[str, str] = {}", "await self.async_set_unique_id(discovery_info.address)\nself._abort_if_unique_id_configured()\ndevice = DeviceData()\nif not device.supported(discover...
<|body_start_0|> self._discovery_info: BluetoothServiceInfoBleak | None = None self._discovered_device: DeviceData | None = None self._discovered_devices: dict[str, str] = {} <|end_body_0|> <|body_start_1|> await self.async_set_unique_id(discovery_info.address) self._abort_if_un...
Handle a config flow for sensorpro.
SensorProConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorProConfigFlow: """Handle a config flow for sensorpro.""" def __init__(self) -> None: """Initialize the config flow.""" <|body_0|> async def async_step_bluetooth(self, discovery_info: BluetoothServiceInfoBleak) -> FlowResult: """Handle the bluetooth discover...
stack_v2_sparse_classes_75kplus_train_074569
3,548
permissive
[ { "docstring": "Initialize the config flow.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Handle the bluetooth discovery step.", "name": "async_step_bluetooth", "signature": "async def async_step_bluetooth(self, discovery_info: BluetoothServiceInfoBle...
4
stack_v2_sparse_classes_30k_train_029392
Implement the Python class `SensorProConfigFlow` described below. Class description: Handle a config flow for sensorpro. Method signatures and docstrings: - def __init__(self) -> None: Initialize the config flow. - async def async_step_bluetooth(self, discovery_info: BluetoothServiceInfoBleak) -> FlowResult: Handle t...
Implement the Python class `SensorProConfigFlow` described below. Class description: Handle a config flow for sensorpro. Method signatures and docstrings: - def __init__(self) -> None: Initialize the config flow. - async def async_step_bluetooth(self, discovery_info: BluetoothServiceInfoBleak) -> FlowResult: Handle t...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SensorProConfigFlow: """Handle a config flow for sensorpro.""" def __init__(self) -> None: """Initialize the config flow.""" <|body_0|> async def async_step_bluetooth(self, discovery_info: BluetoothServiceInfoBleak) -> FlowResult: """Handle the bluetooth discover...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SensorProConfigFlow: """Handle a config flow for sensorpro.""" def __init__(self) -> None: """Initialize the config flow.""" self._discovery_info: BluetoothServiceInfoBleak | None = None self._discovered_device: DeviceData | None = None self._discovered_devices: dict[str, ...
the_stack_v2_python_sparse
homeassistant/components/sensorpro/config_flow.py
home-assistant/core
train
35,501
2ec684892d645d3aca020594e5a47c91fb68adbe
[ "a = 10.0\nf = self.dtype_f(self.init)\nf[:] = (-du[0] + (a - 1 / (2 - t)) * u[0] + (2 - t) * a * u[2] + np.exp(t) * (3 - t) / (2 - t), -du[1] + (1 - a) / (t - 2) * u[0] - u[1] + (a - 1) * u[2] + 2 * np.exp(t), (t + 2) * u[0] + (t ** 2 - 4) * u[1] - (t ** 2 + t - 2) * np.exp(t))\nreturn f", "me = self.dtype_u(sel...
<|body_start_0|> a = 10.0 f = self.dtype_f(self.init) f[:] = (-du[0] + (a - 1 / (2 - t)) * u[0] + (2 - t) * a * u[2] + np.exp(t) * (3 - t) / (2 - t), -du[1] + (1 - a) / (t - 2) * u[0] - u[1] + (a - 1) * u[2] + 2 * np.exp(t), (t + 2) * u[0] + (t ** 2 - 4) * u[1] - (t ** 2 + t - 2) * np.exp(t)) ...
Example implementing a smooth linear index-2 differential-algebraic equation (DAE) with known analytical solution. The DAE system is given by .. math:: \\frac{d u_1 (t)}{dt} = (\\alpha - \\frac{1}{2 - t}) u_1 (t) + (2-t) \\alpha z (t) + \\frac{3 - t}{2 - t}, .. math:: \\frac{d u_2 (t)}{dt} = \\frac{1 - \\alpha}{t - 2} ...
simple_dae_1
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class simple_dae_1: """Example implementing a smooth linear index-2 differential-algebraic equation (DAE) with known analytical solution. The DAE system is given by .. math:: \\frac{d u_1 (t)}{dt} = (\\alpha - \\frac{1}{2 - t}) u_1 (t) + (2-t) \\alpha z (t) + \\frac{3 - t}{2 - t}, .. math:: \\frac{d u_...
stack_v2_sparse_classes_75kplus_train_074570
8,326
permissive
[ { "docstring": "Routine to evaluate the implicit representation of the problem, i.e., :math:`F(u, u', t)`. Parameters ---------- u : dtype_u Current values of the numerical solution at time t. du : dtype_u Current values of the derivative of the numerical solution at time t. t : float Current time of the numeri...
2
null
Implement the Python class `simple_dae_1` described below. Class description: Example implementing a smooth linear index-2 differential-algebraic equation (DAE) with known analytical solution. The DAE system is given by .. math:: \\frac{d u_1 (t)}{dt} = (\\alpha - \\frac{1}{2 - t}) u_1 (t) + (2-t) \\alpha z (t) + \\fr...
Implement the Python class `simple_dae_1` described below. Class description: Example implementing a smooth linear index-2 differential-algebraic equation (DAE) with known analytical solution. The DAE system is given by .. math:: \\frac{d u_1 (t)}{dt} = (\\alpha - \\frac{1}{2 - t}) u_1 (t) + (2-t) \\alpha z (t) + \\fr...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class simple_dae_1: """Example implementing a smooth linear index-2 differential-algebraic equation (DAE) with known analytical solution. The DAE system is given by .. math:: \\frac{d u_1 (t)}{dt} = (\\alpha - \\frac{1}{2 - t}) u_1 (t) + (2-t) \\alpha z (t) + \\frac{3 - t}{2 - t}, .. math:: \\frac{d u_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class simple_dae_1: """Example implementing a smooth linear index-2 differential-algebraic equation (DAE) with known analytical solution. The DAE system is given by .. math:: \\frac{d u_1 (t)}{dt} = (\\alpha - \\frac{1}{2 - t}) u_1 (t) + (2-t) \\alpha z (t) + \\frac{3 - t}{2 - t}, .. math:: \\frac{d u_2 (t)}{dt} = ...
the_stack_v2_python_sparse
pySDC/projects/DAE/problems/simple_DAE.py
Parallel-in-Time/pySDC
train
30
d3bea7e63cc6cb5ab792c258b8c1ca7382e47c76
[ "if not isinstance(uid, str) or not bool(uid.strip()):\n message: str = 'uid cannot be Null'\n raise InputError(status=error_codes.input_error_code, description=message)\nif not isinstance(organization_id, str) or not bool(organization_id.strip()):\n message: str = 'organization_id cannot be Null'\n rai...
<|body_start_0|> if not isinstance(uid, str) or not bool(uid.strip()): message: str = 'uid cannot be Null' raise InputError(status=error_codes.input_error_code, description=message) if not isinstance(organization_id, str) or not bool(organization_id.strip()): message:...
UserValidators
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserValidators: def is_user_valid(organization_id: str, uid: str) -> Optional[bool]: """**is_user_valid** returns true if user_instance is found and user_instance.is_active :param organization_id: :param uid: :return:""" <|body_0|> async def is_user_valid_async(organization_...
stack_v2_sparse_classes_75kplus_train_074571
14,108
permissive
[ { "docstring": "**is_user_valid** returns true if user_instance is found and user_instance.is_active :param organization_id: :param uid: :return:", "name": "is_user_valid", "signature": "def is_user_valid(organization_id: str, uid: str) -> Optional[bool]" }, { "docstring": "**is_user_valid_async...
4
stack_v2_sparse_classes_30k_train_020280
Implement the Python class `UserValidators` described below. Class description: Implement the UserValidators class. Method signatures and docstrings: - def is_user_valid(organization_id: str, uid: str) -> Optional[bool]: **is_user_valid** returns true if user_instance is found and user_instance.is_active :param organ...
Implement the Python class `UserValidators` described below. Class description: Implement the UserValidators class. Method signatures and docstrings: - def is_user_valid(organization_id: str, uid: str) -> Optional[bool]: **is_user_valid** returns true if user_instance is found and user_instance.is_active :param organ...
e8cf1df3f061c9745977e207568ffed2abdc70fc
<|skeleton|> class UserValidators: def is_user_valid(organization_id: str, uid: str) -> Optional[bool]: """**is_user_valid** returns true if user_instance is found and user_instance.is_active :param organization_id: :param uid: :return:""" <|body_0|> async def is_user_valid_async(organization_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserValidators: def is_user_valid(organization_id: str, uid: str) -> Optional[bool]: """**is_user_valid** returns true if user_instance is found and user_instance.is_active :param organization_id: :param uid: :return:""" if not isinstance(uid, str) or not bool(uid.strip()): message...
the_stack_v2_python_sparse
database/users.py
saaiiravi/membership_and_affiliate_api
train
0
e9c8e1e7bac6a3cfbda4361740dd0679f25e23ca
[ "if isinstance(obj.data, pint.Quantity):\n if obj.shape == (1,):\n return {'units': obj.units, 'value': obj.data.magnitude[0]}\n return {'time': obj.time, 'units': obj.units, 'shape': obj.shape, 'interpolation': obj.interpolation, 'values': obj.data.magnitude}\nreturn {'expression': obj.data, 'units': ...
<|body_start_0|> if isinstance(obj.data, pint.Quantity): if obj.shape == (1,): return {'units': obj.units, 'value': obj.data.magnitude[0]} return {'time': obj.time, 'units': obj.units, 'shape': obj.shape, 'interpolation': obj.interpolation, 'values': obj.data.magnitude} ...
Serialization class for weldx.core.TimeSeries
TimeSeriesConverter
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeSeriesConverter: """Serialization class for weldx.core.TimeSeries""" def to_yaml_tree(self, obj: TimeSeries, tag: str, ctx) -> dict: """Convert to python dict.""" <|body_0|> def from_yaml_tree(self, node: dict, tag: str, ctx): """Construct from tree.""" ...
stack_v2_sparse_classes_75kplus_train_074572
1,913
permissive
[ { "docstring": "Convert to python dict.", "name": "to_yaml_tree", "signature": "def to_yaml_tree(self, obj: TimeSeries, tag: str, ctx) -> dict" }, { "docstring": "Construct from tree.", "name": "from_yaml_tree", "signature": "def from_yaml_tree(self, node: dict, tag: str, ctx)" }, { ...
3
stack_v2_sparse_classes_30k_train_027884
Implement the Python class `TimeSeriesConverter` described below. Class description: Serialization class for weldx.core.TimeSeries Method signatures and docstrings: - def to_yaml_tree(self, obj: TimeSeries, tag: str, ctx) -> dict: Convert to python dict. - def from_yaml_tree(self, node: dict, tag: str, ctx): Construc...
Implement the Python class `TimeSeriesConverter` described below. Class description: Serialization class for weldx.core.TimeSeries Method signatures and docstrings: - def to_yaml_tree(self, obj: TimeSeries, tag: str, ctx) -> dict: Convert to python dict. - def from_yaml_tree(self, node: dict, tag: str, ctx): Construc...
7bc16a196ee669822f3663f3c7a08f6bbd0c76d5
<|skeleton|> class TimeSeriesConverter: """Serialization class for weldx.core.TimeSeries""" def to_yaml_tree(self, obj: TimeSeries, tag: str, ctx) -> dict: """Convert to python dict.""" <|body_0|> def from_yaml_tree(self, node: dict, tag: str, ctx): """Construct from tree.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeSeriesConverter: """Serialization class for weldx.core.TimeSeries""" def to_yaml_tree(self, obj: TimeSeries, tag: str, ctx) -> dict: """Convert to python dict.""" if isinstance(obj.data, pint.Quantity): if obj.shape == (1,): return {'units': obj.units, 'val...
the_stack_v2_python_sparse
weldx/tags/core/time_series.py
BAMWelDX/weldx
train
20
4eaea7c902d88f512c2271637650d6b419295afe
[ "sql = super(MySQLQueryGrammar, self).compile_select(query)\nif query.unions:\n sql = '(%s) %s' % (sql, self._compile_unions(query))\nreturn sql", "if union['all']:\n joiner = ' UNION ALL '\nelse:\n joiner = ' UNION '\nreturn '%s(%s)' % (joiner, union['query'].to_sql())", "if isinstance(value, basestri...
<|body_start_0|> sql = super(MySQLQueryGrammar, self).compile_select(query) if query.unions: sql = '(%s) %s' % (sql, self._compile_unions(query)) return sql <|end_body_0|> <|body_start_1|> if union['all']: joiner = ' UNION ALL ' else: joiner =...
MySQLQueryGrammar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLQueryGrammar: def compile_select(self, query): """Compile a select query into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :return: The compiled sql :rtype: str""" <|body_0|> def _compile_union(self, union): """Compile a single union state...
stack_v2_sparse_classes_75kplus_train_074573
3,559
permissive
[ { "docstring": "Compile a select query into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :return: The compiled sql :rtype: str", "name": "compile_select", "signature": "def compile_select(self, query)" }, { "docstring": "Compile a single union statement :param union: The u...
6
null
Implement the Python class `MySQLQueryGrammar` described below. Class description: Implement the MySQLQueryGrammar class. Method signatures and docstrings: - def compile_select(self, query): Compile a select query into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :return: The compiled sql :rtyp...
Implement the Python class `MySQLQueryGrammar` described below. Class description: Implement the MySQLQueryGrammar class. Method signatures and docstrings: - def compile_select(self, query): Compile a select query into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :return: The compiled sql :rtyp...
375ffeb9b519ca1ac4cc5be4b61e87c0a82d1be4
<|skeleton|> class MySQLQueryGrammar: def compile_select(self, query): """Compile a select query into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :return: The compiled sql :rtype: str""" <|body_0|> def _compile_union(self, union): """Compile a single union state...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MySQLQueryGrammar: def compile_select(self, query): """Compile a select query into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :return: The compiled sql :rtype: str""" sql = super(MySQLQueryGrammar, self).compile_select(query) if query.unions: sql = ...
the_stack_v2_python_sparse
orator/query/grammars/mysql_grammar.py
MasoniteFramework/orator
train
1
f167bc0b98d2f132359136156770754348c98299
[ "validate = Validate()\nname = self.cleaned_data['name']\nif not validate.check_name(name):\n raise ValidationError(u\"Некоректно введено ім'я.\")\nreturn name", "validate = Validate()\nlogin = self.cleaned_data['login']\nif not validate.check_login(login):\n raise ValidationError(u'Некоректно введно логін....
<|body_start_0|> validate = Validate() name = self.cleaned_data['name'] if not validate.check_name(name): raise ValidationError(u"Некоректно введено ім'я.") return name <|end_body_0|> <|body_start_1|> validate = Validate() login = self.cleaned_data['login'] ...
This class is the form class for teachers.
TeacherForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeacherForm: """This class is the form class for teachers.""" def clean_name(self): """Validate name field.""" <|body_0|> def clean_login(self): """Validate login field.""" <|body_1|> def clean_email(self): """Validate email field.""" ...
stack_v2_sparse_classes_75kplus_train_074574
1,418
permissive
[ { "docstring": "Validate name field.", "name": "clean_name", "signature": "def clean_name(self)" }, { "docstring": "Validate login field.", "name": "clean_login", "signature": "def clean_login(self)" }, { "docstring": "Validate email field.", "name": "clean_email", "signa...
3
stack_v2_sparse_classes_30k_train_013579
Implement the Python class `TeacherForm` described below. Class description: This class is the form class for teachers. Method signatures and docstrings: - def clean_name(self): Validate name field. - def clean_login(self): Validate login field. - def clean_email(self): Validate email field.
Implement the Python class `TeacherForm` described below. Class description: This class is the form class for teachers. Method signatures and docstrings: - def clean_name(self): Validate name field. - def clean_login(self): Validate login field. - def clean_email(self): Validate email field. <|skeleton|> class Teach...
3bdfa3dac95590036be8f33f8cd1f8831e872ef0
<|skeleton|> class TeacherForm: """This class is the form class for teachers.""" def clean_name(self): """Validate name field.""" <|body_0|> def clean_login(self): """Validate login field.""" <|body_1|> def clean_email(self): """Validate email field.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TeacherForm: """This class is the form class for teachers.""" def clean_name(self): """Validate name field.""" validate = Validate() name = self.cleaned_data['name'] if not validate.check_name(name): raise ValidationError(u"Некоректно введено ім'я.") re...
the_stack_v2_python_sparse
SMS/apps/mainteacher/forms.py
Social-projects-Rivne/SMS_autotesting
train
0
63674f287632baa99b4736c3f1e17aaff0840a6a
[ "seller = Shop_Seller(id=shopId).get()\nif seller:\n itemList = Shop_Seller(id=shopId).get().itemList\n itemList = [marshal(item, output_shopItem) for item in itemList]\n return Response(data=itemList)\nelse:\n return Response(code=HttpStatus.HTTP_404_NOT_FOUND, message='无符合条件的商家')", "if not current_u...
<|body_start_0|> seller = Shop_Seller(id=shopId).get() if seller: itemList = Shop_Seller(id=shopId).get().itemList itemList = [marshal(item, output_shopItem) for item in itemList] return Response(data=itemList) else: return Response(code=HttpStatus...
Menu
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Menu: def get(self, shopId): """获取商家商品列表 :return:""" <|body_0|> def post(self, shopId): """添加商品 :param shopId: :return:""" <|body_1|> def put(self, shopId): """修改商品信息,可进行部分字段更新 :param shopId: :return:""" <|body_2|> def delete(self, s...
stack_v2_sparse_classes_75kplus_train_074575
14,722
no_license
[ { "docstring": "获取商家商品列表 :return:", "name": "get", "signature": "def get(self, shopId)" }, { "docstring": "添加商品 :param shopId: :return:", "name": "post", "signature": "def post(self, shopId)" }, { "docstring": "修改商品信息,可进行部分字段更新 :param shopId: :return:", "name": "put", "si...
4
stack_v2_sparse_classes_30k_train_046090
Implement the Python class `Menu` described below. Class description: Implement the Menu class. Method signatures and docstrings: - def get(self, shopId): 获取商家商品列表 :return: - def post(self, shopId): 添加商品 :param shopId: :return: - def put(self, shopId): 修改商品信息,可进行部分字段更新 :param shopId: :return: - def delete(self, shopI...
Implement the Python class `Menu` described below. Class description: Implement the Menu class. Method signatures and docstrings: - def get(self, shopId): 获取商家商品列表 :return: - def post(self, shopId): 添加商品 :param shopId: :return: - def put(self, shopId): 修改商品信息,可进行部分字段更新 :param shopId: :return: - def delete(self, shopI...
34a2bf4a51cc40a22dd43cb5eb88af7c2f2c5120
<|skeleton|> class Menu: def get(self, shopId): """获取商家商品列表 :return:""" <|body_0|> def post(self, shopId): """添加商品 :param shopId: :return:""" <|body_1|> def put(self, shopId): """修改商品信息,可进行部分字段更新 :param shopId: :return:""" <|body_2|> def delete(self, s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Menu: def get(self, shopId): """获取商家商品列表 :return:""" seller = Shop_Seller(id=shopId).get() if seller: itemList = Shop_Seller(id=shopId).get().itemList itemList = [marshal(item, output_shopItem) for item in itemList] return Response(data=itemList) ...
the_stack_v2_python_sparse
App/Shop/Controller/ShopResource.py
Vulcanhy/api.grooo-master
train
0
f25c4ca8f74cd3079a0809aba38c573067e943f0
[ "t_min, t_max, t_increment = (200.15, 220.15, 10.0)\nresult = SaturatedVapourPressureTable(t_min=t_min, t_max=t_max, t_increment=t_increment).process()\nself.assertEqual(result.attributes['minimum_temperature'], t_min)\nself.assertEqual(result.attributes['maximum_temperature'], t_max)\nself.assertEqual(result.attri...
<|body_start_0|> t_min, t_max, t_increment = (200.15, 220.15, 10.0) result = SaturatedVapourPressureTable(t_min=t_min, t_max=t_max, t_increment=t_increment).process() self.assertEqual(result.attributes['minimum_temperature'], t_min) self.assertEqual(result.attributes['maximum_temperature...
Test that the plugin functions as expected.
Test_process
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_process: """Test that the plugin functions as expected.""" def test_cube_attributes(self): """Test that returned cube has appropriate attributes.""" <|body_0|> def test_cube_values(self): """Test that returned cube has expected values.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_074576
4,810
permissive
[ { "docstring": "Test that returned cube has appropriate attributes.", "name": "test_cube_attributes", "signature": "def test_cube_attributes(self)" }, { "docstring": "Test that returned cube has expected values.", "name": "test_cube_values", "signature": "def test_cube_values(self)" },...
3
stack_v2_sparse_classes_30k_train_040953
Implement the Python class `Test_process` described below. Class description: Test that the plugin functions as expected. Method signatures and docstrings: - def test_cube_attributes(self): Test that returned cube has appropriate attributes. - def test_cube_values(self): Test that returned cube has expected values. -...
Implement the Python class `Test_process` described below. Class description: Test that the plugin functions as expected. Method signatures and docstrings: - def test_cube_attributes(self): Test that returned cube has appropriate attributes. - def test_cube_values(self): Test that returned cube has expected values. -...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_process: """Test that the plugin functions as expected.""" def test_cube_attributes(self): """Test that returned cube has appropriate attributes.""" <|body_0|> def test_cube_values(self): """Test that returned cube has expected values.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_process: """Test that the plugin functions as expected.""" def test_cube_attributes(self): """Test that returned cube has appropriate attributes.""" t_min, t_max, t_increment = (200.15, 220.15, 10.0) result = SaturatedVapourPressureTable(t_min=t_min, t_max=t_max, t_increment=...
the_stack_v2_python_sparse
improver_tests/generate_ancillaries/test_SaturatedVapourPressureTable.py
metoppv/improver
train
101
7e48fa0a2351d2e7756ea00f4a61380b1d10f6a0
[ "if n_sigma_z and z_cuts:\n raise ValueError('Both arguments n_sigma_z and z_cuts are' + ' given while only one is accepted!')\nmode = 'uniform_charge'\nself.config = (mode, n_slices, n_sigma_z, z_cuts)", "z_cut_tail, z_cut_head = self.get_long_cuts(beam)\nn_part = len(beam.z)\nid_new = np.argsort(beam.z)\nid_...
<|body_start_0|> if n_sigma_z and z_cuts: raise ValueError('Both arguments n_sigma_z and z_cuts are' + ' given while only one is accepted!') mode = 'uniform_charge' self.config = (mode, n_slices, n_sigma_z, z_cuts) <|end_body_0|> <|body_start_1|> z_cut_tail, z_cut_head = sel...
Slices with respect to uniform charge for each bin along the slicing region.
UniformChargeSlicer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UniformChargeSlicer: """Slices with respect to uniform charge for each bin along the slicing region.""" def __init__(self, n_slices, n_sigma_z=None, z_cuts=None, *args, **kwargs): """Return a UniformChargeSlicer object. Set and store the corresponding slicing configuration in self.co...
stack_v2_sparse_classes_75kplus_train_074577
27,870
permissive
[ { "docstring": "Return a UniformChargeSlicer object. Set and store the corresponding slicing configuration in self.config . Note that either n_sigma_z or z_cuts can be set. If both are given, a ValueError will be raised.", "name": "__init__", "signature": "def __init__(self, n_slices, n_sigma_z=None, z_...
2
null
Implement the Python class `UniformChargeSlicer` described below. Class description: Slices with respect to uniform charge for each bin along the slicing region. Method signatures and docstrings: - def __init__(self, n_slices, n_sigma_z=None, z_cuts=None, *args, **kwargs): Return a UniformChargeSlicer object. Set and...
Implement the Python class `UniformChargeSlicer` described below. Class description: Slices with respect to uniform charge for each bin along the slicing region. Method signatures and docstrings: - def __init__(self, n_slices, n_sigma_z=None, z_cuts=None, *args, **kwargs): Return a UniformChargeSlicer object. Set and...
b238bf3fbea02fcfaf8795ee54cc0e3134de477a
<|skeleton|> class UniformChargeSlicer: """Slices with respect to uniform charge for each bin along the slicing region.""" def __init__(self, n_slices, n_sigma_z=None, z_cuts=None, *args, **kwargs): """Return a UniformChargeSlicer object. Set and store the corresponding slicing configuration in self.co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UniformChargeSlicer: """Slices with respect to uniform charge for each bin along the slicing region.""" def __init__(self, n_slices, n_sigma_z=None, z_cuts=None, *args, **kwargs): """Return a UniformChargeSlicer object. Set and store the corresponding slicing configuration in self.config . Note t...
the_stack_v2_python_sparse
PyHEADTAIL/particles/slicing.py
PyCOMPLETE/PyHEADTAIL
train
39
1e023cefc27669de2717b7a35d426c2ec757767d
[ "if matrix == [[]] or matrix == []:\n return False\nrow_index = self.bin_search_row(0, len(matrix) - 1, matrix, target)\nif row_index == -1:\n return False\nreturn self.bin_search_column(0, len(matrix[row_index]) - 1, matrix[row_index], target)", "if start > end:\n return -1\nmid = (start + end) // 2\nif...
<|body_start_0|> if matrix == [[]] or matrix == []: return False row_index = self.bin_search_row(0, len(matrix) - 1, matrix, target) if row_index == -1: return False return self.bin_search_column(0, len(matrix[row_index]) - 1, matrix[row_index], target) <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def bin_search_row(self, start, end, matrix, target) -> int: """:type start: int :type end: int :type matrix: List[List[int]] :type target:...
stack_v2_sparse_classes_75kplus_train_074578
2,192
no_license
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": ":type start: int :type end: int :type matrix: List[List[int]] :type target: int :rtype: int", "name": "bin_search_ro...
3
stack_v2_sparse_classes_30k_train_006743
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def bin_search_row(self, start, end, matrix, target) -> int: :type start: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def bin_search_row(self, start, end, matrix, target) -> int: :type start: i...
f832227c4d0e0b1c0cc326561187004ef24e2a68
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def bin_search_row(self, start, end, matrix, target) -> int: """:type start: int :type end: int :type matrix: List[List[int]] :type target:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" if matrix == [[]] or matrix == []: return False row_index = self.bin_search_row(0, len(matrix) - 1, matrix, target) if row_index == -1: r...
the_stack_v2_python_sparse
74.py
Gackle/leetcode_practice
train
0
4cd5a2a5c2a2f607697be5c27adebf8fea3cade6
[ "self.data_train = PrepareData().create_training_and_test_data_sets()[0]\nself.data_test = PrepareData().create_training_and_test_data_sets()[1]\nself.label_train = PrepareData().create_training_and_test_data_sets()[2]\nself.label_test = PrepareData().create_training_and_test_data_sets()[3]", "logistic_regresion_...
<|body_start_0|> self.data_train = PrepareData().create_training_and_test_data_sets()[0] self.data_test = PrepareData().create_training_and_test_data_sets()[1] self.label_train = PrepareData().create_training_and_test_data_sets()[2] self.label_test = PrepareData().create_training_and_tes...
LogisticRegresionAlgorithm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogisticRegresionAlgorithm: def __init__(self): """Constructor method that keeps the data and labels in two sets for training and testing.""" <|body_0|> def make_predictions(self, label_train): """Make predictions of one of the labels using the Logistic Regression cl...
stack_v2_sparse_classes_75kplus_train_074579
1,538
permissive
[ { "docstring": "Constructor method that keeps the data and labels in two sets for training and testing.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Make predictions of one of the labels using the Logistic Regression classifier algorithm. Returns: label_prediction (...
3
stack_v2_sparse_classes_30k_val_000671
Implement the Python class `LogisticRegresionAlgorithm` described below. Class description: Implement the LogisticRegresionAlgorithm class. Method signatures and docstrings: - def __init__(self): Constructor method that keeps the data and labels in two sets for training and testing. - def make_predictions(self, label...
Implement the Python class `LogisticRegresionAlgorithm` described below. Class description: Implement the LogisticRegresionAlgorithm class. Method signatures and docstrings: - def __init__(self): Constructor method that keeps the data and labels in two sets for training and testing. - def make_predictions(self, label...
2d941a92280422b5c2054259780e015b938dca29
<|skeleton|> class LogisticRegresionAlgorithm: def __init__(self): """Constructor method that keeps the data and labels in two sets for training and testing.""" <|body_0|> def make_predictions(self, label_train): """Make predictions of one of the labels using the Logistic Regression cl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogisticRegresionAlgorithm: def __init__(self): """Constructor method that keeps the data and labels in two sets for training and testing.""" self.data_train = PrepareData().create_training_and_test_data_sets()[0] self.data_test = PrepareData().create_training_and_test_data_sets()[1] ...
the_stack_v2_python_sparse
ML/logistic_regresion_algorithm.py
khatabi-abderrahim/breast_cancer_detection
train
1
3d371f2dfa59640fb9cfe26fe51cfd6e77559d72
[ "self.mean = mean\nself.scale = scale\nself.upper = upper\nself.lower = lower\nstats.rv_continuous.__init__(self, momtype=0, a=self.lower, b=self.upper, name='mydist')", "sample = self.rvs(size=n)\nsample = [s + self.mean for s in sample]\nsample = [s * self.scale for s in sample]\nreturn sample" ]
<|body_start_0|> self.mean = mean self.scale = scale self.upper = upper self.lower = lower stats.rv_continuous.__init__(self, momtype=0, a=self.lower, b=self.upper, name='mydist') <|end_body_0|> <|body_start_1|> sample = self.rvs(size=n) sample = [s + self.mean f...
A generic class to provide common features to my distributions.
MyDist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyDist: """A generic class to provide common features to my distributions.""" def __init__(self, mean=0, scale=1, upper=None, lower=None): """Wraps the important parameters we want to vary to the initialization function.""" <|body_0|> def getSample(self, n): """G...
stack_v2_sparse_classes_75kplus_train_074580
6,517
no_license
[ { "docstring": "Wraps the important parameters we want to vary to the initialization function.", "name": "__init__", "signature": "def __init__(self, mean=0, scale=1, upper=None, lower=None)" }, { "docstring": "Get a sample of n values returned as a list.", "name": "getSample", "signatur...
2
stack_v2_sparse_classes_30k_train_046346
Implement the Python class `MyDist` described below. Class description: A generic class to provide common features to my distributions. Method signatures and docstrings: - def __init__(self, mean=0, scale=1, upper=None, lower=None): Wraps the important parameters we want to vary to the initialization function. - def ...
Implement the Python class `MyDist` described below. Class description: A generic class to provide common features to my distributions. Method signatures and docstrings: - def __init__(self, mean=0, scale=1, upper=None, lower=None): Wraps the important parameters we want to vary to the initialization function. - def ...
ba1786f427e93025acdad6111732e52243ac54f1
<|skeleton|> class MyDist: """A generic class to provide common features to my distributions.""" def __init__(self, mean=0, scale=1, upper=None, lower=None): """Wraps the important parameters we want to vary to the initialization function.""" <|body_0|> def getSample(self, n): """G...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyDist: """A generic class to provide common features to my distributions.""" def __init__(self, mean=0, scale=1, upper=None, lower=None): """Wraps the important parameters we want to vary to the initialization function.""" self.mean = mean self.scale = scale self.upper = ...
the_stack_v2_python_sparse
generate_electrons/distributions.py
billyziege/tem_scripts
train
0
8353ae1289096f301e0dd287b965a69eff127320
[ "auctioneer = Auctioneer()\n[auctioneer.register_bidder(x) for x in bidders]\nself._auctioneer = auctioneer", "print('Auctioning ' + item + ' starting at ' + str(start_price))\nself._auctioneer.accept_bid(start_price, None)\nwinner = self._auctioneer.get_highest_bidder()\nfinal_price = self._auctioneer.get_highes...
<|body_start_0|> auctioneer = Auctioneer() [auctioneer.register_bidder(x) for x in bidders] self._auctioneer = auctioneer <|end_body_0|> <|body_start_1|> print('Auctioning ' + item + ' starting at ' + str(start_price)) self._auctioneer.accept_bid(start_price, None) winne...
Simulates an auction. Is responsible for driving the auctioneer and the bidders.
Auction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder""" ...
stack_v2_sparse_classes_75kplus_train_074581
5,374
no_license
[ { "docstring": "Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder", "name": "__init__", "signature": "def __init__(self, bidders)" }, { "docstring": "Starts the auction for the given item at the g...
2
stack_v2_sparse_classes_30k_train_053845
Implement the Python class `Auction` described below. Class description: Simulates an auction. Is responsible for driving the auctioneer and the bidders. Method signatures and docstrings: - def __init__(self, bidders): Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :para...
Implement the Python class `Auction` described below. Class description: Simulates an auction. Is responsible for driving the auctioneer and the bidders. Method signatures and docstrings: - def __init__(self, bidders): Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :para...
46441744be7773075f5f91c09c1032e9fc0a54e8
<|skeleton|> class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder""" auctione...
the_stack_v2_python_sparse
Labs/Lab6/auction_simulator.py
Xaitin/3522_A01053901
train
0
86a9a44e6fd9bce0bef0e38d3ac3871984b89cdb
[ "tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')\nif tokens[3] in ['point', 'dmap', 'dradial']:\n return True\nreturn tokens[2] in ['point', 'dmap', 'dradial']", "tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')\nif tokens[3] in ['point', 'map', 'radial']:\n return T...
<|body_start_0|> tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_') if tokens[3] in ['point', 'dmap', 'dradial']: return True return tokens[2] in ['point', 'dmap', 'dradial'] <|end_body_0|> <|body_start_1|> tokens = os.path.splitext(os.path.basename(limitfi...
Small class to collect limit results from a series of simulations.
CollectLimits
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectLimits: """Small class to collect limit results from a series of simulations.""" def is_decay_limits(limitfile): """Return true if a file has limits for decay""" <|body_0|> def is_ann_limits(limitfile): """Return true if a file has limits for annhilation""...
stack_v2_sparse_classes_75kplus_train_074582
11,467
permissive
[ { "docstring": "Return true if a file has limits for decay", "name": "is_decay_limits", "signature": "def is_decay_limits(limitfile)" }, { "docstring": "Return true if a file has limits for annhilation", "name": "is_ann_limits", "signature": "def is_ann_limits(limitfile)" }, { "d...
4
stack_v2_sparse_classes_30k_train_016021
Implement the Python class `CollectLimits` described below. Class description: Small class to collect limit results from a series of simulations. Method signatures and docstrings: - def is_decay_limits(limitfile): Return true if a file has limits for decay - def is_ann_limits(limitfile): Return true if a file has lim...
Implement the Python class `CollectLimits` described below. Class description: Small class to collect limit results from a series of simulations. Method signatures and docstrings: - def is_decay_limits(limitfile): Return true if a file has limits for decay - def is_ann_limits(limitfile): Return true if a file has lim...
e5b3f950d18d5077f7abf46f53fcf59e97bb3301
<|skeleton|> class CollectLimits: """Small class to collect limit results from a series of simulations.""" def is_decay_limits(limitfile): """Return true if a file has limits for decay""" <|body_0|> def is_ann_limits(limitfile): """Return true if a file has limits for annhilation""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CollectLimits: """Small class to collect limit results from a series of simulations.""" def is_decay_limits(limitfile): """Return true if a file has limits for decay""" tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_') if tokens[3] in ['point', 'dmap', 'dradial'...
the_stack_v2_python_sparse
dmpipe/dm_collect.py
fermiPy/dmpipe
train
1
240dfe17f8091c20f806de1d17dcb81569eaaff6
[ "self.probability = p\nself.min_factor = min_factor\nself.max_factor = max_factor", "if np.random.random() < self.probability:\n factor = np.random.uniform(self.min_factor, self.max_factor)\n image_enhancer_contrast = ImageEnhance.Contrast(image)\n image = image_enhancer_contrast.enhance(factor)\nreturn ...
<|body_start_0|> self.probability = p self.min_factor = min_factor self.max_factor = max_factor <|end_body_0|> <|body_start_1|> if np.random.random() < self.probability: factor = np.random.uniform(self.min_factor, self.max_factor) image_enhancer_contrast = ImageE...
This class is used to random change contrast of an image.
RandomContrast
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomContrast: """This class is used to random change contrast of an image.""" def __init__(self, p=0.9, min_factor=0.4, max_factor=1.8): """required :attr:`probability` parameter :func:`~Augmentor.Pipeline.Pipeline.random_contrast` function. :param probability: Controls the probabi...
stack_v2_sparse_classes_75kplus_train_074583
40,740
no_license
[ { "docstring": "required :attr:`probability` parameter :func:`~Augmentor.Pipeline.Pipeline.random_contrast` function. :param probability: Controls the probability that the operation is performed when it is invoked in the pipeline. :param min_factor: The value between 0.0 and max_factor that define the minimum a...
2
stack_v2_sparse_classes_30k_train_043207
Implement the Python class `RandomContrast` described below. Class description: This class is used to random change contrast of an image. Method signatures and docstrings: - def __init__(self, p=0.9, min_factor=0.4, max_factor=1.8): required :attr:`probability` parameter :func:`~Augmentor.Pipeline.Pipeline.random_con...
Implement the Python class `RandomContrast` described below. Class description: This class is used to random change contrast of an image. Method signatures and docstrings: - def __init__(self, p=0.9, min_factor=0.4, max_factor=1.8): required :attr:`probability` parameter :func:`~Augmentor.Pipeline.Pipeline.random_con...
a9c19225733b1a61eb0b006e6afc1bd2826bba2b
<|skeleton|> class RandomContrast: """This class is used to random change contrast of an image.""" def __init__(self, p=0.9, min_factor=0.4, max_factor=1.8): """required :attr:`probability` parameter :func:`~Augmentor.Pipeline.Pipeline.random_contrast` function. :param probability: Controls the probabi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomContrast: """This class is used to random change contrast of an image.""" def __init__(self, p=0.9, min_factor=0.4, max_factor=1.8): """required :attr:`probability` parameter :func:`~Augmentor.Pipeline.Pipeline.random_contrast` function. :param probability: Controls the probability that the...
the_stack_v2_python_sparse
imcls/data/transforms/operations.py
iYuqinL/imcls
train
0
3c5f1b946f42a8c8ff4c62996aa14672581ebb78
[ "ip = UserLogic.visitor_ip_address(request)\ndata = request.data\npassword = data.pop('password', None)\nif not password:\n return ParseError(ErrorMsg.UserPassword.value)\nlogging.warning(LoggingMsg.LoggingMsg_user_1.value.format(ip, data))\nuser_data = self.get_serializer(data=data)\nuser_data.is_valid(raise_ex...
<|body_start_0|> ip = UserLogic.visitor_ip_address(request) data = request.data password = data.pop('password', None) if not password: return ParseError(ErrorMsg.UserPassword.value) logging.warning(LoggingMsg.LoggingMsg_user_1.value.format(ip, data)) user_data...
To registration user and activate account
UsersViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersViewSet: """To registration user and activate account""" def create(self, request, *args, **kwargs): """{"username":"name", "password":"password", "email":"test@e.e"}""" <|body_0|> def activate(self, request, **kwargs): """Example: after registration you get...
stack_v2_sparse_classes_75kplus_train_074584
3,844
no_license
[ { "docstring": "{\"username\":\"name\", \"password\":\"password\", \"email\":\"test@e.e\"}", "name": "create", "signature": "def create(self, request, *args, **kwargs)" }, { "docstring": "Example: after registration you get email with link to activate account link : http://localhost:8000/api/v1/...
2
null
Implement the Python class `UsersViewSet` described below. Class description: To registration user and activate account Method signatures and docstrings: - def create(self, request, *args, **kwargs): {"username":"name", "password":"password", "email":"test@e.e"} - def activate(self, request, **kwargs): Example: after...
Implement the Python class `UsersViewSet` described below. Class description: To registration user and activate account Method signatures and docstrings: - def create(self, request, *args, **kwargs): {"username":"name", "password":"password", "email":"test@e.e"} - def activate(self, request, **kwargs): Example: after...
59cea18c9f5d6ad899ba25c272793aeae8eaf4a9
<|skeleton|> class UsersViewSet: """To registration user and activate account""" def create(self, request, *args, **kwargs): """{"username":"name", "password":"password", "email":"test@e.e"}""" <|body_0|> def activate(self, request, **kwargs): """Example: after registration you get...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UsersViewSet: """To registration user and activate account""" def create(self, request, *args, **kwargs): """{"username":"name", "password":"password", "email":"test@e.e"}""" ip = UserLogic.visitor_ip_address(request) data = request.data password = data.pop('password', Non...
the_stack_v2_python_sparse
apps/users/views.py
kaday506s/TestPlaneks
train
0
899c6af62cb0ab3a8e8c3cb4a4def6f3b5149334
[ "self.filename = logname\nlogging.getLogger().setLevel(logging.DEBUG)\nlogfile = logging.handlers.RotatingFileHandler(self.filename, maxBytes=10 * 1024 * 1024, backupCount=30)\nlogfile.setLevel(logging.DEBUG)\nformatter = logging.Formatter('[%(asctime)s] [%(levelname)-5s] [%(process)d] %(message)s', '%Y-%m-%d %H:%M...
<|body_start_0|> self.filename = logname logging.getLogger().setLevel(logging.DEBUG) logfile = logging.handlers.RotatingFileHandler(self.filename, maxBytes=10 * 1024 * 1024, backupCount=30) logfile.setLevel(logging.DEBUG) formatter = logging.Formatter('[%(asctime)s] [%(levelname)...
mini logging's class
mini_logging
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mini_logging: """mini logging's class""" def __init__(self, logname): """logging""" <|body_0|> def GenLog(self, logType, logContent): """set the basiconfig for the log. It's a file log.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.filena...
stack_v2_sparse_classes_75kplus_train_074585
3,429
no_license
[ { "docstring": "logging", "name": "__init__", "signature": "def __init__(self, logname)" }, { "docstring": "set the basiconfig for the log. It's a file log.", "name": "GenLog", "signature": "def GenLog(self, logType, logContent)" } ]
2
null
Implement the Python class `mini_logging` described below. Class description: mini logging's class Method signatures and docstrings: - def __init__(self, logname): logging - def GenLog(self, logType, logContent): set the basiconfig for the log. It's a file log.
Implement the Python class `mini_logging` described below. Class description: mini logging's class Method signatures and docstrings: - def __init__(self, logname): logging - def GenLog(self, logType, logContent): set the basiconfig for the log. It's a file log. <|skeleton|> class mini_logging: """mini logging's ...
6505830e909e98464e7fb13f50c712a414b1f508
<|skeleton|> class mini_logging: """mini logging's class""" def __init__(self, logname): """logging""" <|body_0|> def GenLog(self, logType, logContent): """set the basiconfig for the log. It's a file log.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class mini_logging: """mini logging's class""" def __init__(self, logname): """logging""" self.filename = logname logging.getLogger().setLevel(logging.DEBUG) logfile = logging.handlers.RotatingFileHandler(self.filename, maxBytes=10 * 1024 * 1024, backupCount=30) logfile....
the_stack_v2_python_sparse
agent/libs/td_logging.py
jsonkey/neo
train
1
b60711affb032386a1ed5342de0057d817705862
[ "pygame.sprite.Sprite.__init__(self)\nself.image = pygame.Surface([70, 50])\nself.image.fill((255, 255, 255))\nself.rect = self.image.get_rect()\nself.rect.y = 40\nself.set_pos(pos)", "if pos == 0:\n self.rect.x = -15\nelif pos == 1:\n self.rect.x = 148\nelif pos == 2:\n self.rect.x = 310\nelif pos == 3:...
<|body_start_0|> pygame.sprite.Sprite.__init__(self) self.image = pygame.Surface([70, 50]) self.image.fill((255, 255, 255)) self.rect = self.image.get_rect() self.rect.y = 40 self.set_pos(pos) <|end_body_0|> <|body_start_1|> if pos == 0: self.rect.x =...
Pygame sprite class for riverbank sprites used for killing the player
Riverbank
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Riverbank: """Pygame sprite class for riverbank sprites used for killing the player""" def __init__(self, pos): """- :param pos: An int representing the "index" of the riverbank. Should be 0-5, with 0 representing the left-most riverbank and 5 representing the right-most bank.""" ...
stack_v2_sparse_classes_75kplus_train_074586
1,472
permissive
[ { "docstring": "- :param pos: An int representing the \"index\" of the riverbank. Should be 0-5, with 0 representing the left-most riverbank and 5 representing the right-most bank.", "name": "__init__", "signature": "def __init__(self, pos)" }, { "docstring": "Helper function called by construct...
2
stack_v2_sparse_classes_30k_train_007861
Implement the Python class `Riverbank` described below. Class description: Pygame sprite class for riverbank sprites used for killing the player Method signatures and docstrings: - def __init__(self, pos): - :param pos: An int representing the "index" of the riverbank. Should be 0-5, with 0 representing the left-most...
Implement the Python class `Riverbank` described below. Class description: Pygame sprite class for riverbank sprites used for killing the player Method signatures and docstrings: - def __init__(self, pos): - :param pos: An int representing the "index" of the riverbank. Should be 0-5, with 0 representing the left-most...
d8c6bad99ccaf10d3cca05b6fc44799e2f46ad2a
<|skeleton|> class Riverbank: """Pygame sprite class for riverbank sprites used for killing the player""" def __init__(self, pos): """- :param pos: An int representing the "index" of the riverbank. Should be 0-5, with 0 representing the left-most riverbank and 5 representing the right-most bank.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Riverbank: """Pygame sprite class for riverbank sprites used for killing the player""" def __init__(self, pos): """- :param pos: An int representing the "index" of the riverbank. Should be 0-5, with 0 representing the left-most riverbank and 5 representing the right-most bank.""" pygame.s...
the_stack_v2_python_sparse
src/Sprites/riverbank.py
johnpcooke94/project-scrumger-games
train
0
d7dc2de967278bd3f5f0b3f17414d0ba3f4e1454
[ "try:\n proband_id, relation_to_proband = self.original.split(self.delim)\n self.proband_id = proband_id\n self.relation_to_proband = [relation_to_proband]\nexcept ValueError as exc:\n if 'not enough values to unpack' in exc.args[0]:\n self.proband_id = self.original\n self.relation_to_pro...
<|body_start_0|> try: proband_id, relation_to_proband = self.original.split(self.delim) self.proband_id = proband_id self.relation_to_proband = [relation_to_proband] except ValueError as exc: if 'not enough values to unpack' in exc.args[0]: ...
Represent the original and digested information encoded in a biorepidnumber.
BiorepIDNumber
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiorepIDNumber: """Represent the original and digested information encoded in a biorepidnumber.""" def __attrs_post_init__(self): """Perform custom __init__ actions after the attrs init func.""" <|body_0|> def __relations_not_in(self, attribute, value): """Valida...
stack_v2_sparse_classes_75kplus_train_074587
2,212
permissive
[ { "docstring": "Perform custom __init__ actions after the attrs init func.", "name": "__attrs_post_init__", "signature": "def __attrs_post_init__(self)" }, { "docstring": "Validate that ``relation_to_proband`` is not in ``value``.", "name": "__relations_not_in", "signature": "def __relat...
2
null
Implement the Python class `BiorepIDNumber` described below. Class description: Represent the original and digested information encoded in a biorepidnumber. Method signatures and docstrings: - def __attrs_post_init__(self): Perform custom __init__ actions after the attrs init func. - def __relations_not_in(self, attr...
Implement the Python class `BiorepIDNumber` described below. Class description: Represent the original and digested information encoded in a biorepidnumber. Method signatures and docstrings: - def __attrs_post_init__(self): Perform custom __init__ actions after the attrs init func. - def __relations_not_in(self, attr...
50396e5ffdff5473098556d18635daecb47b60d9
<|skeleton|> class BiorepIDNumber: """Represent the original and digested information encoded in a biorepidnumber.""" def __attrs_post_init__(self): """Perform custom __init__ actions after the attrs init func.""" <|body_0|> def __relations_not_in(self, attribute, value): """Valida...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BiorepIDNumber: """Represent the original and digested information encoded in a biorepidnumber.""" def __attrs_post_init__(self): """Perform custom __init__ actions after the attrs init func.""" try: proband_id, relation_to_proband = self.original.split(self.delim) ...
the_stack_v2_python_sparse
src/biorep_etl/data/parsers/bch/biorepository.py
ScottSnapperLab/biorep-etl
train
0
406e66a7dbdee8a5ac1b6aafa6a3a0fcc4ad9750
[ "feature_id = kwargs['feature_id']\ngate_id = kwargs.get('gate_id', None)\nvotes = Vote.get_votes(feature_id=feature_id, gate_id=gate_id)\ndicts = [converters.vote_value_to_json_dict(v) for v in votes]\nreturn {'votes': dicts}", "feature_id = kwargs['feature_id']\ngate_id = kwargs['gate_id']\nfeature = self.get_s...
<|body_start_0|> feature_id = kwargs['feature_id'] gate_id = kwargs.get('gate_id', None) votes = Vote.get_votes(feature_id=feature_id, gate_id=gate_id) dicts = [converters.vote_value_to_json_dict(v) for v in votes] return {'votes': dicts} <|end_body_0|> <|body_start_1|> ...
Users may see the set of votes on a feature, and add their own, if allowed.
VotesAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VotesAPI: """Users may see the set of votes on a feature, and add their own, if allowed.""" def do_get(self, **kwargs) -> dict[str, list[dict[str, Any]]]: """Return a list of all vote values for a given feature.""" <|body_0|> def do_post(self, **kwargs) -> dict[str, str]...
stack_v2_sparse_classes_75kplus_train_074588
4,047
permissive
[ { "docstring": "Return a list of all vote values for a given feature.", "name": "do_get", "signature": "def do_get(self, **kwargs) -> dict[str, list[dict[str, Any]]]" }, { "docstring": "Set a user's vote value for the specified feature and gate.", "name": "do_post", "signature": "def do_...
3
stack_v2_sparse_classes_30k_train_017054
Implement the Python class `VotesAPI` described below. Class description: Users may see the set of votes on a feature, and add their own, if allowed. Method signatures and docstrings: - def do_get(self, **kwargs) -> dict[str, list[dict[str, Any]]]: Return a list of all vote values for a given feature. - def do_post(s...
Implement the Python class `VotesAPI` described below. Class description: Users may see the set of votes on a feature, and add their own, if allowed. Method signatures and docstrings: - def do_get(self, **kwargs) -> dict[str, list[dict[str, Any]]]: Return a list of all vote values for a given feature. - def do_post(s...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class VotesAPI: """Users may see the set of votes on a feature, and add their own, if allowed.""" def do_get(self, **kwargs) -> dict[str, list[dict[str, Any]]]: """Return a list of all vote values for a given feature.""" <|body_0|> def do_post(self, **kwargs) -> dict[str, str]...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VotesAPI: """Users may see the set of votes on a feature, and add their own, if allowed.""" def do_get(self, **kwargs) -> dict[str, list[dict[str, Any]]]: """Return a list of all vote values for a given feature.""" feature_id = kwargs['feature_id'] gate_id = kwargs.get('gate_id', ...
the_stack_v2_python_sparse
api/reviews_api.py
GoogleChrome/chromium-dashboard
train
574
8fec4c9193b5ae8636ce2e79b962fb6be2cf4ca5
[ "self.active = active\nself.order_size_limit = int(order_size_limit)\nself.order_price_upper_limit = float(order_price_upper_limit)\nself.balance_use_limit = float(balance_use_limit)\nself.trade_count = trade_count\nself.trade_limit = int(trade_limit)", "msg = ''\nif not self.active:\n msg = u'风控: 风控引擎未开启'\n ...
<|body_start_0|> self.active = active self.order_size_limit = int(order_size_limit) self.order_price_upper_limit = float(order_price_upper_limit) self.balance_use_limit = float(balance_use_limit) self.trade_count = trade_count self.trade_limit = int(trade_limit) <|end_bod...
风控引擎
RiskManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RiskManager: """风控引擎""" def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count): """Constructor""" <|body_0|> def checkRisk(self, orderReq, tick, account): """检查风险""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_074589
3,904
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count)" }, { "docstring": "检查风险", "name": "checkRisk", "signature": "def checkRisk(self, orderReq, tick, account)" ...
2
stack_v2_sparse_classes_30k_train_048843
Implement the Python class `RiskManager` described below. Class description: 风控引擎 Method signatures and docstrings: - def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count): Constructor - def checkRisk(self, orderReq, tick, account): 检查风险
Implement the Python class `RiskManager` described below. Class description: 风控引擎 Method signatures and docstrings: - def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count): Constructor - def checkRisk(self, orderReq, tick, account): 检查风险 <|skeleton|> class...
1390db7bba9c2a3408b09a863b03f7802cbe2fff
<|skeleton|> class RiskManager: """风控引擎""" def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count): """Constructor""" <|body_0|> def checkRisk(self, orderReq, tick, account): """检查风险""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RiskManager: """风控引擎""" def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count): """Constructor""" self.active = active self.order_size_limit = int(order_size_limit) self.order_price_upper_limit = float(order_price...
the_stack_v2_python_sparse
基线库/源码/SQuant/trader/trade/riskManager.py
SQuantTeam/SQuant
train
4
81b36b15f0205e2e8ed31653241e68ec27f153e1
[ "activity = self.object\nid_list_schema = IdListSchema()\ntag_id_list = id_list_schema.deserialize(self.request_data)\nsession = activity.current_session\nquery = Tag.query(session=session)\nquery = query.filter(Tag.id.in_(tag_id_list))\ntag_list = query.all()\nfor tag in tag_list:\n activity.tags.append(tag)\nr...
<|body_start_0|> activity = self.object id_list_schema = IdListSchema() tag_id_list = id_list_schema.deserialize(self.request_data) session = activity.current_session query = Tag.query(session=session) query = query.filter(Tag.id.in_(tag_id_list)) tag_list = query...
REST API resource for Activity model.
ActivityResource
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityResource: """REST API resource for Activity model.""" def add_tags(self): """Add tags to current activity. Return a List of Tags that were added.""" <|body_0|> def remove_tags(self): """Remove tags from current activity. JSON request body is a list of int...
stack_v2_sparse_classes_75kplus_train_074590
2,050
permissive
[ { "docstring": "Add tags to current activity. Return a List of Tags that were added.", "name": "add_tags", "signature": "def add_tags(self)" }, { "docstring": "Remove tags from current activity. JSON request body is a list of integer values with Tag IDs to remove. Returns a list with the Tags th...
2
stack_v2_sparse_classes_30k_train_012656
Implement the Python class `ActivityResource` described below. Class description: REST API resource for Activity model. Method signatures and docstrings: - def add_tags(self): Add tags to current activity. Return a List of Tags that were added. - def remove_tags(self): Remove tags from current activity. JSON request ...
Implement the Python class `ActivityResource` described below. Class description: REST API resource for Activity model. Method signatures and docstrings: - def add_tags(self): Add tags to current activity. Return a List of Tags that were added. - def remove_tags(self): Remove tags from current activity. JSON request ...
2cbd9c0cc8f265eb1ddcb23c29c23e18e25bd421
<|skeleton|> class ActivityResource: """REST API resource for Activity model.""" def add_tags(self): """Add tags to current activity. Return a List of Tags that were added.""" <|body_0|> def remove_tags(self): """Remove tags from current activity. JSON request body is a list of int...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActivityResource: """REST API resource for Activity model.""" def add_tags(self): """Add tags to current activity. Return a List of Tags that were added.""" activity = self.object id_list_schema = IdListSchema() tag_id_list = id_list_schema.deserialize(self.request_data) ...
the_stack_v2_python_sparse
sandglass/time/api/v1/activity.py
jeronimoalbi/sandglass.time
train
0
0afd4d6d8b8c52b30b8fe331a2ff48e628a88e87
[ "bsscs = BSSCS_CLASSIFIER(l2_reg=tf.contrib.layers.l2_regularizer(scale=0.001), learning_rate=0.001, steps=250, batch=250)\nself.assertTrue(bsscs != None)\nsingle_layer = bsscs.create_layer(512, activation=tf.nn.relu)\nself.assertTrue(single_layer != None)", "bsscs = BSSCS_CLASSIFIER(l2_reg=tf.contrib.layers.l2_r...
<|body_start_0|> bsscs = BSSCS_CLASSIFIER(l2_reg=tf.contrib.layers.l2_regularizer(scale=0.001), learning_rate=0.001, steps=250, batch=250) self.assertTrue(bsscs != None) single_layer = bsscs.create_layer(512, activation=tf.nn.relu) self.assertTrue(single_layer != None) <|end_body_0|> <|...
ClassifierNetworkTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassifierNetworkTests: def test_layer_creation(self): """Tests the creation of a default layer preconditions: No layer has been created postconditions: layer with default placeholder has been created""" <|body_0|> def test_loss_creation(self): """Tests the creation ...
stack_v2_sparse_classes_75kplus_train_074591
3,035
no_license
[ { "docstring": "Tests the creation of a default layer preconditions: No layer has been created postconditions: layer with default placeholder has been created", "name": "test_layer_creation", "signature": "def test_layer_creation(self)" }, { "docstring": "Tests the creation of a loss function pr...
4
stack_v2_sparse_classes_30k_val_001842
Implement the Python class `ClassifierNetworkTests` described below. Class description: Implement the ClassifierNetworkTests class. Method signatures and docstrings: - def test_layer_creation(self): Tests the creation of a default layer preconditions: No layer has been created postconditions: layer with default place...
Implement the Python class `ClassifierNetworkTests` described below. Class description: Implement the ClassifierNetworkTests class. Method signatures and docstrings: - def test_layer_creation(self): Tests the creation of a default layer preconditions: No layer has been created postconditions: layer with default place...
d665ca405bdf35fdb57f8149a10b90be82d8de22
<|skeleton|> class ClassifierNetworkTests: def test_layer_creation(self): """Tests the creation of a default layer preconditions: No layer has been created postconditions: layer with default placeholder has been created""" <|body_0|> def test_loss_creation(self): """Tests the creation ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassifierNetworkTests: def test_layer_creation(self): """Tests the creation of a default layer preconditions: No layer has been created postconditions: layer with default placeholder has been created""" bsscs = BSSCS_CLASSIFIER(l2_reg=tf.contrib.layers.l2_regularizer(scale=0.001), learning_ra...
the_stack_v2_python_sparse
BSSCSFramework/classifier_tests.py
wezleysherman/TBI-NN-421
train
3
eb83f960720951e9eea5a9c8b3c5fe1b9d71275d
[ "t1 = BinaryTree(3, BinaryTree(5, right=BinaryTree(2)))\nt2 = BinaryTree(4, BinaryTree(6), BinaryTree(7))\nt = BinaryTree(1, t1, t2)\nself.assertEqual(get_largest_height_difference(None), 0)\nself.assertEqual(get_largest_height_difference(t1), 2)\nself.assertEqual(get_largest_height_difference(t2), 0)\nself.assertE...
<|body_start_0|> t1 = BinaryTree(3, BinaryTree(5, right=BinaryTree(2))) t2 = BinaryTree(4, BinaryTree(6), BinaryTree(7)) t = BinaryTree(1, t1, t2) self.assertEqual(get_largest_height_difference(None), 0) self.assertEqual(get_largest_height_difference(t1), 2) self.assertEq...
ExerciseTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExerciseTests: def test_client_code(self): """Tests the client code to make sure the exercise passes it.""" <|body_0|> def test_hidden(self): """The hidden test for students.""" <|body_1|> <|end_skeleton|> <|body_start_0|> t1 = BinaryTree(3, BinaryT...
stack_v2_sparse_classes_75kplus_train_074592
2,301
no_license
[ { "docstring": "Tests the client code to make sure the exercise passes it.", "name": "test_client_code", "signature": "def test_client_code(self)" }, { "docstring": "The hidden test for students.", "name": "test_hidden", "signature": "def test_hidden(self)" } ]
2
stack_v2_sparse_classes_30k_train_012219
Implement the Python class `ExerciseTests` described below. Class description: Implement the ExerciseTests class. Method signatures and docstrings: - def test_client_code(self): Tests the client code to make sure the exercise passes it. - def test_hidden(self): The hidden test for students.
Implement the Python class `ExerciseTests` described below. Class description: Implement the ExerciseTests class. Method signatures and docstrings: - def test_client_code(self): Tests the client code to make sure the exercise passes it. - def test_hidden(self): The hidden test for students. <|skeleton|> class Exerci...
556c5485e38ad81dae7bb14e312f2b081100245d
<|skeleton|> class ExerciseTests: def test_client_code(self): """Tests the client code to make sure the exercise passes it.""" <|body_0|> def test_hidden(self): """The hidden test for students.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExerciseTests: def test_client_code(self): """Tests the client code to make sure the exercise passes it.""" t1 = BinaryTree(3, BinaryTree(5, right=BinaryTree(2))) t2 = BinaryTree(4, BinaryTree(6), BinaryTree(7)) t = BinaryTree(1, t1, t2) self.assertEqual(get_largest_hei...
the_stack_v2_python_sparse
pyta/Week10_summer/test_ex7.py
Kevintjy/Python-Beginner
train
1
4d5e8f7bce16534835cb54723402c0442eb632d7
[ "self.mean = float(mean)\nself.stddev = float(stddev)\nif stddev < 1:\n raise ValueError('stddev must be a positive value')\nif data is not None and (not isinstance(data, list)):\n raise TypeError('data must be a list')\nif isinstance(data, list) and len(data) < 2:\n raise ValueError('data must contain mul...
<|body_start_0|> self.mean = float(mean) self.stddev = float(stddev) if stddev < 1: raise ValueError('stddev must be a positive value') if data is not None and (not isinstance(data, list)): raise TypeError('data must be a list') if isinstance(data, list) a...
class Normal
Normal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Normal: """class Normal""" def __init__(self, data=None, mean=0.0, stddev=1.0): """data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev...
stack_v2_sparse_classes_75kplus_train_074593
2,397
no_license
[ { "docstring": "data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev", "name": "__init__", "signature": "def __init__(self, data=None, mean=0.0, stddev=1.0...
5
stack_v2_sparse_classes_30k_train_011188
Implement the Python class `Normal` described below. Class description: class Normal Method signatures and docstrings: - def __init__(self, data=None, mean=0.0, stddev=1.0): data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the ...
Implement the Python class `Normal` described below. Class description: class Normal Method signatures and docstrings: - def __init__(self, data=None, mean=0.0, stddev=1.0): data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the ...
4a7a8ff0c4f785656a395d0abf4f182ce1fef5bc
<|skeleton|> class Normal: """class Normal""" def __init__(self, data=None, mean=0.0, stddev=1.0): """data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Normal: """class Normal""" def __init__(self, data=None, mean=0.0, stddev=1.0): """data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev""" s...
the_stack_v2_python_sparse
math/0x03-probability/normal.py
xica369/holbertonschool-machine_learning
train
0
3b1eb63c7c5b22c4c784c696ff03a3b0f8430efc
[ "number = ''.join((c for c in number if c.isnumeric()))\nif len(number) == number_length:\n return number\nreturn None", "number = number.replace(' ', '')\nresult = re.match('^[0-9]+$', number)\nif not result:\n return True\nreturn False", "ni_nuber = re.match('^\\\\s*[a-zA-Z]{2}(?:\\\\s*\\\\d\\\\s*){6}[a...
<|body_start_0|> number = ''.join((c for c in number if c.isnumeric())) if len(number) == number_length: return number return None <|end_body_0|> <|body_start_1|> number = number.replace(' ', '') result = re.match('^[0-9]+$', number) if not result: ...
NumberLengthValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumberLengthValidator: def normalise_number(number, number_length): """Return a normalised NHS number if valid, or None if not,""" <|body_0|> def number_only(number): """Return a normalised NHS number if valid, or None if not,""" <|body_1|> def ni_number...
stack_v2_sparse_classes_75kplus_train_074594
1,349
permissive
[ { "docstring": "Return a normalised NHS number if valid, or None if not,", "name": "normalise_number", "signature": "def normalise_number(number, number_length)" }, { "docstring": "Return a normalised NHS number if valid, or None if not,", "name": "number_only", "signature": "def number_...
3
stack_v2_sparse_classes_30k_train_011957
Implement the Python class `NumberLengthValidator` described below. Class description: Implement the NumberLengthValidator class. Method signatures and docstrings: - def normalise_number(number, number_length): Return a normalised NHS number if valid, or None if not, - def number_only(number): Return a normalised NHS...
Implement the Python class `NumberLengthValidator` described below. Class description: Implement the NumberLengthValidator class. Method signatures and docstrings: - def normalise_number(number, number_length): Return a normalised NHS number if valid, or None if not, - def number_only(number): Return a normalised NHS...
ad049db27650e850742a3bd466f96d36a3420589
<|skeleton|> class NumberLengthValidator: def normalise_number(number, number_length): """Return a normalised NHS number if valid, or None if not,""" <|body_0|> def number_only(number): """Return a normalised NHS number if valid, or None if not,""" <|body_1|> def ni_number...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumberLengthValidator: def normalise_number(number, number_length): """Return a normalised NHS number if valid, or None if not,""" number = ''.join((c for c in number if c.isnumeric())) if len(number) == number_length: return number return None def number_only(...
the_stack_v2_python_sparse
ndopapp/main/ndop_validator.py
uk-gov-mirror/nhsconnect.ndop-nojs
train
0
4b025007c7c14e0c5a64a7cfb01d3ba79d1b27ab
[ "self.mirror = mirror\nself.codename = codename\nself.architecture = architecture\nself.repositories = repositories\nself.updates = updates", "mirror_url = self.mirror.url()\nurls = []\nfor repository in self.repositories:\n urls.append(f'{mirror_url}dists/{self.codename}/{repository}/binary-{self.architecture...
<|body_start_0|> self.mirror = mirror self.codename = codename self.architecture = architecture self.repositories = repositories self.updates = updates <|end_body_0|> <|body_start_1|> mirror_url = self.mirror.url() urls = [] for repository in self.reposit...
DebianBasedSource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DebianBasedSource: def __init__(self, mirror, codename, architecture, repositories, updates): """A Debian Based Source object that can be used to navigate debian based package archives. Parameters ---------- mirror : the mirror to use to download the source packages codename : the codena...
stack_v2_sparse_classes_75kplus_train_074595
4,691
permissive
[ { "docstring": "A Debian Based Source object that can be used to navigate debian based package archives. Parameters ---------- mirror : the mirror to use to download the source packages codename : the codename of the version of the distribution to use architecture : the target architecture of the packages repos...
2
stack_v2_sparse_classes_30k_train_008799
Implement the Python class `DebianBasedSource` described below. Class description: Implement the DebianBasedSource class. Method signatures and docstrings: - def __init__(self, mirror, codename, architecture, repositories, updates): A Debian Based Source object that can be used to navigate debian based package archiv...
Implement the Python class `DebianBasedSource` described below. Class description: Implement the DebianBasedSource class. Method signatures and docstrings: - def __init__(self, mirror, codename, architecture, repositories, updates): A Debian Based Source object that can be used to navigate debian based package archiv...
dfe1a73aa72cad4338445bec370be064707bff0c
<|skeleton|> class DebianBasedSource: def __init__(self, mirror, codename, architecture, repositories, updates): """A Debian Based Source object that can be used to navigate debian based package archives. Parameters ---------- mirror : the mirror to use to download the source packages codename : the codena...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DebianBasedSource: def __init__(self, mirror, codename, architecture, repositories, updates): """A Debian Based Source object that can be used to navigate debian based package archives. Parameters ---------- mirror : the mirror to use to download the source packages codename : the codename of the vers...
the_stack_v2_python_sparse
fetchy/plugins/packages/source.py
gridl/fetchy
train
0
1546e03a56a9d1d59ea5bdd4bb59dd13c408bab8
[ "cache.clear()\npart = Part.objects.create(name='Test Part', description='I am but a humble test part', IPN='IPN-123')\nreturn part", "cache.clear()\nself.assertTrue(part.settings.part_component_default())\nself.assertTrue(part.settings.part_purchaseable_default())\nself.assertFalse(part.settings.part_salable_def...
<|body_start_0|> cache.clear() part = Part.objects.create(name='Test Part', description='I am but a humble test part', IPN='IPN-123') return part <|end_body_0|> <|body_start_1|> cache.clear() self.assertTrue(part.settings.part_component_default()) self.assertTrue(part.se...
Tests to ensure that the user-configurable default values work as expected. Some fields for the Part model can have default values specified by the user.
PartSettingsTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartSettingsTest: """Tests to ensure that the user-configurable default values work as expected. Some fields for the Part model can have default values specified by the user.""" def make_part(self): """Helper function to create a simple part.""" <|body_0|> def test_defau...
stack_v2_sparse_classes_75kplus_train_074596
24,967
permissive
[ { "docstring": "Helper function to create a simple part.", "name": "make_part", "signature": "def make_part(self)" }, { "docstring": "Test that the default values for the part settings are correct.", "name": "test_defaults", "signature": "def test_defaults(self)" }, { "docstring"...
5
null
Implement the Python class `PartSettingsTest` described below. Class description: Tests to ensure that the user-configurable default values work as expected. Some fields for the Part model can have default values specified by the user. Method signatures and docstrings: - def make_part(self): Helper function to create...
Implement the Python class `PartSettingsTest` described below. Class description: Tests to ensure that the user-configurable default values work as expected. Some fields for the Part model can have default values specified by the user. Method signatures and docstrings: - def make_part(self): Helper function to create...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class PartSettingsTest: """Tests to ensure that the user-configurable default values work as expected. Some fields for the Part model can have default values specified by the user.""" def make_part(self): """Helper function to create a simple part.""" <|body_0|> def test_defau...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PartSettingsTest: """Tests to ensure that the user-configurable default values work as expected. Some fields for the Part model can have default values specified by the user.""" def make_part(self): """Helper function to create a simple part.""" cache.clear() part = Part.objects.c...
the_stack_v2_python_sparse
InvenTree/part/test_part.py
inventree/InvenTree
train
3,077
e4cc7f263d1e2a103b065e68de700f19b2e0eb2c
[ "num = sum([n * pow(10, len(num) - i - 1) for i, n in enumerate(num)]) + k\nres = []\nwhile num:\n res = [num % 10] + res\n num = num // 10\nreturn res", "res = []\ni = len(num) - 1\ncarry = 0\nwhile k or i >= 0 or carry:\n n1 = num[i] if i >= 0 else 0\n n2 = k % 10 if k else 0\n n = n1 + n2 + carr...
<|body_start_0|> num = sum([n * pow(10, len(num) - i - 1) for i, n in enumerate(num)]) + k res = [] while num: res = [num % 10] + res num = num // 10 return res <|end_body_0|> <|body_start_1|> res = [] i = len(num) - 1 carry = 0 wh...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addToArrayForm(self, num, k): """:type num: List[int] :type k: int :rtype: List[int]""" <|body_0|> def addToArrayForm(self, num, k): """:type num: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_074597
2,023
no_license
[ { "docstring": ":type num: List[int] :type k: int :rtype: List[int]", "name": "addToArrayForm", "signature": "def addToArrayForm(self, num, k)" }, { "docstring": ":type num: List[int] :type k: int :rtype: List[int]", "name": "addToArrayForm", "signature": "def addToArrayForm(self, num, k...
2
stack_v2_sparse_classes_30k_train_020006
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addToArrayForm(self, num, k): :type num: List[int] :type k: int :rtype: List[int] - def addToArrayForm(self, num, k): :type num: List[int] :type k: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addToArrayForm(self, num, k): :type num: List[int] :type k: int :rtype: List[int] - def addToArrayForm(self, num, k): :type num: List[int] :type k: int :rtype: List[int] <|s...
860590239da0618c52967a55eda8d6bbe00bfa96
<|skeleton|> class Solution: def addToArrayForm(self, num, k): """:type num: List[int] :type k: int :rtype: List[int]""" <|body_0|> def addToArrayForm(self, num, k): """:type num: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def addToArrayForm(self, num, k): """:type num: List[int] :type k: int :rtype: List[int]""" num = sum([n * pow(10, len(num) - i - 1) for i, n in enumerate(num)]) + k res = [] while num: res = [num % 10] + res num = num // 10 return res ...
the_stack_v2_python_sparse
LeetCode/p0989/I/add-to-array-form-of-integer.py
Ynjxsjmh/PracticeMakesPerfect
train
0
3aa2285efd246c67c64029f79686255970282379
[ "if len(num) <= k:\n return '0'\nelif k <= 0:\n return num\ncount = 0\nindex = 0\nnew_num = ''\nwhile index < len(num):\n if index + 1 < len(num) and int(num[index]) > int(num[index + 1]):\n index += 1\n count += 1\n while new_num and count < k and (num[index] == '0'):\n new...
<|body_start_0|> if len(num) <= k: return '0' elif k <= 0: return num count = 0 index = 0 new_num = '' while index < len(num): if index + 1 < len(num) and int(num[index]) > int(num[index + 1]): index += 1 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_0|> def __removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_1|> def removeKdigits(self, num, k): """:type num: str :t...
stack_v2_sparse_classes_75kplus_train_074598
14,768
permissive
[ { "docstring": ":type num: str :type k: int :rtype: str", "name": "_removeKdigits", "signature": "def _removeKdigits(self, num, k)" }, { "docstring": ":type num: str :type k: int :rtype: str", "name": "__removeKdigits", "signature": "def __removeKdigits(self, num, k)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_049060
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def __removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def removeKdigits(self, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def __removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def removeKdigits(self, n...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_0|> def __removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_1|> def removeKdigits(self, num, k): """:type num: str :t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def _removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" if len(num) <= k: return '0' elif k <= 0: return num count = 0 index = 0 new_num = '' while index < len(num): if index + 1 < len...
the_stack_v2_python_sparse
402.remove-k-digits.py
windard/leeeeee
train
0
94d722f388d674c4b4bb8fdf9a1434a2c73d061e
[ "super(AgeFilter, self).__init__(order)\nself.age = age\nself.ageField = ageField\nself.ageTolerance = ageTolerance\nif self.ageTolerance < 0:\n self.ageTolerance = 0\nself.minAgeField = minAgeField\nself.maxAgeField = maxAgeField\nself.rejectUnclassified = rejectUnclassified", "for result in results:\n if ...
<|body_start_0|> super(AgeFilter, self).__init__(order) self.age = age self.ageField = ageField self.ageTolerance = ageTolerance if self.ageTolerance < 0: self.ageTolerance = 0 self.minAgeField = minAgeField self.maxAgeField = maxAgeField self....
Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter precedence * age (integer) : the age of t...
AgeFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AgeFilter: """Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter prec...
stack_v2_sparse_classes_75kplus_train_074599
2,776
permissive
[ { "docstring": "Constructor for AgeFilter", "name": "__init__", "signature": "def __init__(self, age, ageField=None, ageTolerance=3, minAgeField='minAge', maxAgeField='maxAge', order=0, rejectUnclassified=False)" }, { "docstring": "Filters the results according to a given range in which the resu...
2
stack_v2_sparse_classes_30k_train_033408
Implement the Python class `AgeFilter` described below. Class description: Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using ...
Implement the Python class `AgeFilter` described below. Class description: Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using ...
ed72aee466649bd834d5b4459eb6e0173df6e2ec
<|skeleton|> class AgeFilter: """Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter prec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AgeFilter: """Filters search results based on either a specific age or if the age is within an age range defined by the result. Note: there is no default value for 'age' it must be passed to this filter so that it can be customised for the application using it. Options: * order (int): filter precedence * age ...
the_stack_v2_python_sparse
reference-code/puppy/result/filter/ageFilter.py
Granvanoeli/ifind
train
0