blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
0914beece2c2431f064261b90e0eab0ae9dc573a
[ "interactions = interaction_registry.Registry.get_all_interactions()\nobject_default_vals = object_registry.get_default_object_values()\nfor interaction in interactions:\n for rule_name in interaction.rules_dict:\n param_list = interaction.get_rule_param_list(rule_name)\n for _, param_obj_type in p...
<|body_start_0|> interactions = interaction_registry.Registry.get_all_interactions() object_default_vals = object_registry.get_default_object_values() for interaction in interactions: for rule_name in interaction.rules_dict: param_list = interaction.get_rule_param_lis...
Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules.
ObjectDefaultValuesUnitTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectDefaultValuesUnitTests: """Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules.""" def test_all_rule_input_fields_have_default_values(self) -> None: ...
stack_v2_sparse_classes_36k_train_006400
3,831
permissive
[ { "docstring": "Checks that all rule input fields have a default value, and this is provided in get_default_values().", "name": "test_all_rule_input_fields_have_default_values", "signature": "def test_all_rule_input_fields_have_default_values(self) -> None" }, { "docstring": "Checks that the def...
2
null
Implement the Python class `ObjectDefaultValuesUnitTests` described below. Class description: Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules. Method signatures and docstrings: - de...
Implement the Python class `ObjectDefaultValuesUnitTests` described below. Class description: Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules. Method signatures and docstrings: - de...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class ObjectDefaultValuesUnitTests: """Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules.""" def test_all_rule_input_fields_have_default_values(self) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObjectDefaultValuesUnitTests: """Test that the default value of objects recorded in extensions/objects/object_defaults.json correspond to the defined default values in objects.py for all objects that are used in rules.""" def test_all_rule_input_fields_have_default_values(self) -> None: """Checks...
the_stack_v2_python_sparse
core/domain/object_registry_test.py
oppia/oppia
train
6,172
4cfe4bad63704830383142db801fb210d0391b68
[ "if not root:\n return None\nif root.left and root.right:\n left = self.invertTree(root.left)\n right = self.invertTree(root.right)\n root.left = right\n root.right = left\n return root\nif root.left and root.right == None:\n left = self.invertTree(root.left)\n root.left = None\n root.rig...
<|body_start_0|> if not root: return None if root.left and root.right: left = self.invertTree(root.left) right = self.invertTree(root.right) root.left = right root.right = left return root if root.left and root.right == None...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def invertTree2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> def invertTree3(self, root): """:type root: TreeNode :rtype: TreeNode...
stack_v2_sparse_classes_36k_train_006401
2,594
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree", "signature": "def invertTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree2", "signature": "def invertTree2(self, root)" }, { "docstring": ":type root: Tree...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree2(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree3(self, root): :type root: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree2(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree3(self, root): :type root: ...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def invertTree2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> def invertTree3(self, root): """:type root: TreeNode :rtype: TreeNode...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" if not root: return None if root.left and root.right: left = self.invertTree(root.left) right = self.invertTree(root.right) root.left = right ro...
the_stack_v2_python_sparse
226. Invert Binary Tree/invert.py
Macielyoung/LeetCode
train
1
29b65a1f0bee220dada6a4a0c65e8e565ae998a6
[ "assert len(self.rotated_data) == len(other.rotated_data)\ndata = [self_row + other_row for self_row, other_row in zip(self.rotated_data, other.rotated_data)]\nreturn AssembledImage(data)", "assert len(self.rotated_data[0]) == len(other.rotated_data[0])\ndata = self.rotated_data + other.rotated_data\nreturn Assem...
<|body_start_0|> assert len(self.rotated_data) == len(other.rotated_data) data = [self_row + other_row for self_row, other_row in zip(self.rotated_data, other.rotated_data)] return AssembledImage(data) <|end_body_0|> <|body_start_1|> assert len(self.rotated_data[0]) == len(other.rotated...
The assembled image Public Class Methods: from_image_piece: Create instance from an image piece
AssembledImage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssembledImage: """The assembled image Public Class Methods: from_image_piece: Create instance from an image piece""" def __add__(self, other: AssembledImage) -> AssembledImage: """Horizontal concatenation""" <|body_0|> def __mul__(self, other: AssembledImage) -> Assembl...
stack_v2_sparse_classes_36k_train_006402
6,417
no_license
[ { "docstring": "Horizontal concatenation", "name": "__add__", "signature": "def __add__(self, other: AssembledImage) -> AssembledImage" }, { "docstring": "Vertical concatenation", "name": "__mul__", "signature": "def __mul__(self, other: AssembledImage) -> AssembledImage" }, { "d...
3
stack_v2_sparse_classes_30k_train_012114
Implement the Python class `AssembledImage` described below. Class description: The assembled image Public Class Methods: from_image_piece: Create instance from an image piece Method signatures and docstrings: - def __add__(self, other: AssembledImage) -> AssembledImage: Horizontal concatenation - def __mul__(self, o...
Implement the Python class `AssembledImage` described below. Class description: The assembled image Public Class Methods: from_image_piece: Create instance from an image piece Method signatures and docstrings: - def __add__(self, other: AssembledImage) -> AssembledImage: Horizontal concatenation - def __mul__(self, o...
bcca26134e0764f965a8486e67f61894dde3ba35
<|skeleton|> class AssembledImage: """The assembled image Public Class Methods: from_image_piece: Create instance from an image piece""" def __add__(self, other: AssembledImage) -> AssembledImage: """Horizontal concatenation""" <|body_0|> def __mul__(self, other: AssembledImage) -> Assembl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssembledImage: """The assembled image Public Class Methods: from_image_piece: Create instance from an image piece""" def __add__(self, other: AssembledImage) -> AssembledImage: """Horizontal concatenation""" assert len(self.rotated_data) == len(other.rotated_data) data = [self_ro...
the_stack_v2_python_sparse
Day_20/utils/image.py
Mushinako/Advent-of-Code-2020
train
0
c5e0498f20e7218292b5325e00c741931e2a2b78
[ "self.windowSize = size\nself.queue = collections.deque()\nself.sum = 0.0", "if len(self.queue) == self.windowSize:\n self.sum -= self.queue.popleft()\nself.queue.append(val)\nself.sum += val\nreturn self.sum / len(self.queue)" ]
<|body_start_0|> self.windowSize = size self.queue = collections.deque() self.sum = 0.0 <|end_body_0|> <|body_start_1|> if len(self.queue) == self.windowSize: self.sum -= self.queue.popleft() self.queue.append(val) self.sum += val return self.sum / le...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.windowSize = size self.q...
stack_v2_sparse_classes_36k_train_006403
831
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_006050
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
7134780687acfc2934562d8c7582fd33dfbefdf1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.windowSize = size self.queue = collections.deque() self.sum = 0.0 def next(self, val): """:type val: int :rtype: float""" if len(self.queue) == self.win...
the_stack_v2_python_sparse
LeetCode/movingAverageFromDataStream.py
dixitomkar1809/Coding-Python
train
0
7f837fd05ab9f4d25e0a40af9b3f269b8dd807c2
[ "table = {}\nfor index in range(len(nums)):\n if table.keys().__contains__(nums[index]):\n old_places = table[nums[index]]\n if index - old_places <= k:\n return True\n table[nums[index]] = index\n else:\n table[nums[index]] = index\nprint(table)\nreturn False", "s = s...
<|body_start_0|> table = {} for index in range(len(nums)): if table.keys().__contains__(nums[index]): old_places = table[nums[index]] if index - old_places <= k: return True table[nums[index]] = index else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyDuplicate1(self, nums, k): """超时 :type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_006404
1,174
no_license
[ { "docstring": "超时 :type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate1", "signature": "def containsNearbyDuplicate1(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate", "signature": "def co...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate1(self, nums, k): 超时 :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate1(self, nums, k): 超时 :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def containsNearbyDuplicate1(self, nums, k): """超时 :type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyDuplicate1(self, nums, k): """超时 :type nums: List[int] :type k: int :rtype: bool""" table = {} for index in range(len(nums)): if table.keys().__contains__(nums[index]): old_places = table[nums[index]] if index - ol...
the_stack_v2_python_sparse
python/leetcode/219_Contains_Duplicate_II.py
bobcaoge/my-code
train
0
e25fab7c14a8ec487c117e48e4a7c55e5b285c36
[ "inSpec = super(FastFourierTransform, cls).getInputSpecification()\ninSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True))\nreturn inSpec", "super().__init__()\nself.dynamic = True\nself.targets = None\nself.indices = None", "super()._handleInput(paramIn...
<|body_start_0|> inSpec = super(FastFourierTransform, cls).getInputSpecification() inSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True)) return inSpec <|end_body_0|> <|body_start_1|> super().__init__() self.dynamic = Tru...
Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target
FastFourierTransform
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastFourierTransform: """Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the ...
stack_v2_sparse_classes_36k_train_006405
6,142
permissive
[ { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls.", "name": "getInputSpecification", "signatur...
6
stack_v2_sparse_classes_30k_train_013115
Implement the Python class `FastFourierTransform` described below. Class description: Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class tha...
Implement the Python class `FastFourierTransform` described below. Class description: Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class tha...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class FastFourierTransform: """Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastFourierTransform: """Constructs fast-fourier transform data for a history Outputs are "frequency" for each index and "amplitude" for each target""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for whi...
the_stack_v2_python_sparse
ravenframework/Models/PostProcessors/FastFourierTransform.py
idaholab/raven
train
201
815599e0ab255ea1e72d08e65ee5eb5a5d4d9ed3
[ "super(WordTokenizer, self).__init__()\nself.msg_printer = Printer()\nself.tokenizer = tokenizer\nself.allowed_tokenizers = ['spacy', 'nltk', 'vanilla', 'spacy-whitespace']\nassert self.tokenizer in self.allowed_tokenizers, AssertionError(f'The word tokenizer can be {self.allowed_tokenizers}')\nif self.tokenizer ==...
<|body_start_0|> super(WordTokenizer, self).__init__() self.msg_printer = Printer() self.tokenizer = tokenizer self.allowed_tokenizers = ['spacy', 'nltk', 'vanilla', 'spacy-whitespace'] assert self.tokenizer in self.allowed_tokenizers, AssertionError(f'The word tokenizer can be {...
WordTokenizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordTokenizer: def __init__(self, tokenizer: str='spacy'): """WordTokenizers split the text into tokens Parameters ---------- tokenizer : str The type of tokenizer. spacy Tokenizer from spact nltk NLTK based tokenizer vanilla Tokenize words according to space spacy-whtiespace Same as van...
stack_v2_sparse_classes_36k_train_006406
2,563
permissive
[ { "docstring": "WordTokenizers split the text into tokens Parameters ---------- tokenizer : str The type of tokenizer. spacy Tokenizer from spact nltk NLTK based tokenizer vanilla Tokenize words according to space spacy-whtiespace Same as vanilla but implemented using custom white space tokenizer from spacy", ...
3
null
Implement the Python class `WordTokenizer` described below. Class description: Implement the WordTokenizer class. Method signatures and docstrings: - def __init__(self, tokenizer: str='spacy'): WordTokenizers split the text into tokens Parameters ---------- tokenizer : str The type of tokenizer. spacy Tokenizer from ...
Implement the Python class `WordTokenizer` described below. Class description: Implement the WordTokenizer class. Method signatures and docstrings: - def __init__(self, tokenizer: str='spacy'): WordTokenizers split the text into tokens Parameters ---------- tokenizer : str The type of tokenizer. spacy Tokenizer from ...
1c061b99a35a9d8b565d9762aaaf5db979b50112
<|skeleton|> class WordTokenizer: def __init__(self, tokenizer: str='spacy'): """WordTokenizers split the text into tokens Parameters ---------- tokenizer : str The type of tokenizer. spacy Tokenizer from spact nltk NLTK based tokenizer vanilla Tokenize words according to space spacy-whtiespace Same as van...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordTokenizer: def __init__(self, tokenizer: str='spacy'): """WordTokenizers split the text into tokens Parameters ---------- tokenizer : str The type of tokenizer. spacy Tokenizer from spact nltk NLTK based tokenizer vanilla Tokenize words according to space spacy-whtiespace Same as vanilla but imple...
the_stack_v2_python_sparse
sciwing/tokenizers/word_tokenizer.py
abhinavkashyap/sciwing
train
58
04e10d8620976a6a415dda66ef606185f2343e9d
[ "self.ids = ids\nself.ida = ida\nself.gr = int(gr)", "\"\"\"\n if self.ida=='0':\n return 'The Student: '+str(self.ids)+'\nAssignment '+'\nStatus: Not Given'\n elif self.gr==0:\n return 'The Student: '+str(self.ids)+'\nAssignment: '+str(self.ida)+'\nStatus: Given \nGrade: Ungra...
<|body_start_0|> self.ids = ids self.ida = ida self.gr = int(gr) <|end_body_0|> <|body_start_1|> """ if self.ida=='0': return 'The Student: '+str(self.ids)+' Assignment '+' Status: Not Given' elif self.gr==0: ...
This class will define a grade.
grade
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class grade: """This class will define a grade.""" def __init__(self, ids, ida, gr): """Constructor""" <|body_0|> def __str__(self): """The grade wil be returned as for exemple : The Student: 1 Assignment: 2 Grade: Ungraded Grade is "Ungraded" if self.gr=0 and it means...
stack_v2_sparse_classes_36k_train_006407
1,331
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, ids, ida, gr)" }, { "docstring": "The grade wil be returned as for exemple : The Student: 1 Assignment: 2 Grade: Ungraded Grade is \"Ungraded\" if self.gr=0 and it means that assignment is not finished yet. The St...
2
stack_v2_sparse_classes_30k_train_007751
Implement the Python class `grade` described below. Class description: This class will define a grade. Method signatures and docstrings: - def __init__(self, ids, ida, gr): Constructor - def __str__(self): The grade wil be returned as for exemple : The Student: 1 Assignment: 2 Grade: Ungraded Grade is "Ungraded" if s...
Implement the Python class `grade` described below. Class description: This class will define a grade. Method signatures and docstrings: - def __init__(self, ids, ida, gr): Constructor - def __str__(self): The grade wil be returned as for exemple : The Student: 1 Assignment: 2 Grade: Ungraded Grade is "Ungraded" if s...
e956d7399f0b2b47f6ce539ac1672492250ee013
<|skeleton|> class grade: """This class will define a grade.""" def __init__(self, ids, ida, gr): """Constructor""" <|body_0|> def __str__(self): """The grade wil be returned as for exemple : The Student: 1 Assignment: 2 Grade: Ungraded Grade is "Ungraded" if self.gr=0 and it means...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class grade: """This class will define a grade.""" def __init__(self, ids, ida, gr): """Constructor""" self.ids = ids self.ida = ida self.gr = int(gr) def __str__(self): """The grade wil be returned as for exemple : The Student: 1 Assignment: 2 Grade: Ungraded Grade...
the_stack_v2_python_sparse
StudentsCatalog/Student Lab Assignments/Assignment 5-7/domain_grade.py
FarcasiuRazvan/Python-Projects
train
0
f87344acd34b93217062e4a82faa0fb70a5b66ef
[ "lgas = set()\ncounts = Counter()\nfor row in Clinic.objects.values('lga', 'type').annotate(facilities=Count('id')):\n lgas.add(row['lga'])\n counts[row['type']] += row['facilities']\ncounts['lga'] = len(lgas)\nreturn counts", "staff = Visit.objects.values('sender').distinct()\nsent = Visit.objects.values('...
<|body_start_0|> lgas = set() counts = Counter() for row in Clinic.objects.values('lga', 'type').annotate(facilities=Count('id')): lgas.add(row['lga']) counts[row['type']] += row['facilities'] counts['lga'] = len(lgas) return counts <|end_body_0|> <|body_...
Home
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Home: def get_facility_counts(self): """Returns the total count of facilities, grouped by type, and the count of LGAs.""" <|body_0|> def get_progress_to_date(self): """Returns a dictionary used to populate the "Progress to Date" view on the home page.""" <|bo...
stack_v2_sparse_classes_36k_train_006408
1,696
permissive
[ { "docstring": "Returns the total count of facilities, grouped by type, and the count of LGAs.", "name": "get_facility_counts", "signature": "def get_facility_counts(self)" }, { "docstring": "Returns a dictionary used to populate the \"Progress to Date\" view on the home page.", "name": "get...
2
stack_v2_sparse_classes_30k_val_000912
Implement the Python class `Home` described below. Class description: Implement the Home class. Method signatures and docstrings: - def get_facility_counts(self): Returns the total count of facilities, grouped by type, and the count of LGAs. - def get_progress_to_date(self): Returns a dictionary used to populate the ...
Implement the Python class `Home` described below. Class description: Implement the Home class. Method signatures and docstrings: - def get_facility_counts(self): Returns the total count of facilities, grouped by type, and the count of LGAs. - def get_progress_to_date(self): Returns a dictionary used to populate the ...
d8e7a36041429641ef956687c99cf3a1757b22b8
<|skeleton|> class Home: def get_facility_counts(self): """Returns the total count of facilities, grouped by type, and the count of LGAs.""" <|body_0|> def get_progress_to_date(self): """Returns a dictionary used to populate the "Progress to Date" view on the home page.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Home: def get_facility_counts(self): """Returns the total count of facilities, grouped by type, and the count of LGAs.""" lgas = set() counts = Counter() for row in Clinic.objects.values('lga', 'type').annotate(facilities=Count('id')): lgas.add(row['lga']) ...
the_stack_v2_python_sparse
myvoice/core/views.py
myvoice-nigeria/myvoice
train
1
ea35731087791823e2425ed5f017911b372feed0
[ "res = [0] * (len(nums) + 1)\nfor each in nums:\n res[each] = each\nif 0 in res[1:]:\n return res.index(0, 1)\nelse:\n return 0", "length = len(nums)\nexpected_sum = length * (length + 1) // 2\nactual_sum = sum(nums)\nreturn expected_sum - actual_sum", "nums.sort()\nif nums[-1] != len(nums):\n retur...
<|body_start_0|> res = [0] * (len(nums) + 1) for each in nums: res[each] = each if 0 in res[1:]: return res.index(0, 1) else: return 0 <|end_body_0|> <|body_start_1|> length = len(nums) expected_sum = length * (length + 1) // 2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumber_gauss(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> def missingNumber_sorting(self, nums): """tim...
stack_v2_sparse_classes_36k_train_006409
1,981
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "missingNumber", "signature": "def missingNumber(self, nums)" }, { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: int", "name": "missingNumber_gauss", "signature": "def missingNumber_gauss(self, nums)" }, {...
5
null
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 missingNumber_gauss(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int - def missingNumber...
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 missingNumber_gauss(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int - def missingNumber...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumber_gauss(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> def missingNumber_sorting(self, nums): """tim...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" res = [0] * (len(nums) + 1) for each in nums: res[each] = each if 0 in res[1:]: return res.index(0, 1) else: return 0 def missingNumber_gauss(self, ...
the_stack_v2_python_sparse
LeetCode/Array/268_missing_number.py
XyK0907/for_work
train
0
dc7fd4bfaf71b59844f909bef7fcb9b6527c3299
[ "if not len(args) == 2:\n raise exceptions.FunctionArgumentException(\"'%s': expected exactly two arguments (string separator andlist of strings), got: '%s'.\" % (self.name, args))\nif not isinstance(args[0], str):\n raise exceptions.FunctionArgumentException(\"First argument of joining function '%s' must be...
<|body_start_0|> if not len(args) == 2: raise exceptions.FunctionArgumentException("'%s': expected exactly two arguments (string separator andlist of strings), got: '%s'." % (self.name, args)) if not isinstance(args[0], str): raise exceptions.FunctionArgumentException("First argu...
JoinFunction is the base class for all function which join their provided arguments. It takes the form: " 'JoinFunction': [ "delimiter", ['elem1', 'elem2', ...] ] " It simply joins all of the elements it is provided with the given delimiter.
JoinFunction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinFunction: """JoinFunction is the base class for all function which join their provided arguments. It takes the form: " 'JoinFunction': [ "delimiter", ['elem1', 'elem2', ...] ] " It simply joins all of the elements it is provided with the given delimiter.""" def _check_args(self, args): ...
stack_v2_sparse_classes_36k_train_006410
2,400
permissive
[ { "docstring": "_check_args validates the provided set of arguments.", "name": "_check_args", "signature": "def _check_args(self, args)" }, { "docstring": "apply applies the function to the given set of arguments and returns the result.", "name": "apply", "signature": "def apply(self, ar...
2
null
Implement the Python class `JoinFunction` described below. Class description: JoinFunction is the base class for all function which join their provided arguments. It takes the form: " 'JoinFunction': [ "delimiter", ['elem1', 'elem2', ...] ] " It simply joins all of the elements it is provided with the given delimiter....
Implement the Python class `JoinFunction` described below. Class description: JoinFunction is the base class for all function which join their provided arguments. It takes the form: " 'JoinFunction': [ "delimiter", ['elem1', 'elem2', ...] ] " It simply joins all of the elements it is provided with the given delimiter....
83472c7a4af3496e28c1b7b4021e31c373f37784
<|skeleton|> class JoinFunction: """JoinFunction is the base class for all function which join their provided arguments. It takes the form: " 'JoinFunction': [ "delimiter", ['elem1', 'elem2', ...] ] " It simply joins all of the elements it is provided with the given delimiter.""" def _check_args(self, args): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JoinFunction: """JoinFunction is the base class for all function which join their provided arguments. It takes the form: " 'JoinFunction': [ "delimiter", ['elem1', 'elem2', ...] ] " It simply joins all of the elements it is provided with the given delimiter.""" def _check_args(self, args): """_ch...
the_stack_v2_python_sparse
heat2arm/parser/common/functions/join_function.py
travlaw/heat2arm
train
0
1dc9ede2c51686593a2e93c3715934571636e051
[ "super(MLP, self).__init__()\nassert type(input_dim) == int\nassert type(output_dim) == int\nassert type(hidden_layer_sizes) == list\nassert all((type(n) is int for n in hidden_layer_sizes))\nself._mlp = nn.Sequential()\nself._mlp.add_module('fc0', nn.Linear(input_dim, hidden_layer_sizes[0]))\nself._mlp.add_module(...
<|body_start_0|> super(MLP, self).__init__() assert type(input_dim) == int assert type(output_dim) == int assert type(hidden_layer_sizes) == list assert all((type(n) is int for n in hidden_layer_sizes)) self._mlp = nn.Sequential() self._mlp.add_module('fc0', nn.Li...
A Multi-layer Perceptron.
MLP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """A Multi-layer Perceptron.""" def __init__(self, input_dim: int, output_dim: int, hidden_layer_sizes: List[int], nonlinearity: nn.Module, dropout: Optional[float]=None, batchnorm: Optional[bool]=False) -> None: """Initialize the MLP. Activations are softpluses. Parameters ----...
stack_v2_sparse_classes_36k_train_006411
13,993
permissive
[ { "docstring": "Initialize the MLP. Activations are softpluses. Parameters ---------- input_dim : int Dimension of the input. output_dim : int Dimension of the output variable. hidden_layer_sizes : List[int] List of sizes of all hidden layers. nonlinearity : torch.nn.Module A the nonlinearity to use (must be a ...
2
stack_v2_sparse_classes_30k_train_012334
Implement the Python class `MLP` described below. Class description: A Multi-layer Perceptron. Method signatures and docstrings: - def __init__(self, input_dim: int, output_dim: int, hidden_layer_sizes: List[int], nonlinearity: nn.Module, dropout: Optional[float]=None, batchnorm: Optional[bool]=False) -> None: Initia...
Implement the Python class `MLP` described below. Class description: A Multi-layer Perceptron. Method signatures and docstrings: - def __init__(self, input_dim: int, output_dim: int, hidden_layer_sizes: List[int], nonlinearity: nn.Module, dropout: Optional[float]=None, batchnorm: Optional[bool]=False) -> None: Initia...
184b1537c22ebc2f614677be8fe171de785bda42
<|skeleton|> class MLP: """A Multi-layer Perceptron.""" def __init__(self, input_dim: int, output_dim: int, hidden_layer_sizes: List[int], nonlinearity: nn.Module, dropout: Optional[float]=None, batchnorm: Optional[bool]=False) -> None: """Initialize the MLP. Activations are softpluses. Parameters ----...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLP: """A Multi-layer Perceptron.""" def __init__(self, input_dim: int, output_dim: int, hidden_layer_sizes: List[int], nonlinearity: nn.Module, dropout: Optional[float]=None, batchnorm: Optional[bool]=False) -> None: """Initialize the MLP. Activations are softpluses. Parameters ---------- input_...
the_stack_v2_python_sparse
dynamics_learning/networks/models.py
cristovaoiglesias/replay-overshooting
train
0
e52e73b953676e81bc858081f21ad203aa833f10
[ "super(YOLOHead, self).__init__()\nac_type = cfg.HEAD.ACTIVATION_FN\nout_channel = (cfg.DATASET.NUM_CLASSES + 5) * 3\nself.conv1_1 = ConvBnActivation(128, 256, 3, 1, 1, ac_type)\nself.conv1_2 = nn.Conv2d(256, out_channel, 1, 1, 0)\nself.conv2_1 = ConvBnActivation(256, 512, 3, 1, 1, ac_type)\nself.conv2_2 = nn.Conv2...
<|body_start_0|> super(YOLOHead, self).__init__() ac_type = cfg.HEAD.ACTIVATION_FN out_channel = (cfg.DATASET.NUM_CLASSES + 5) * 3 self.conv1_1 = ConvBnActivation(128, 256, 3, 1, 1, ac_type) self.conv1_2 = nn.Conv2d(256, out_channel, 1, 1, 0) self.conv2_1 = ConvBnActivati...
YOLOHead
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YOLOHead: def __init__(self, cfg): """Args: cfg: 配置文件""" <|body_0|> def forward(self, x1, x2, x3): """Args: x1, x2, x3: neck的输出""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(YOLOHead, self).__init__() ac_type = cfg.HEAD.ACTIVATION_FN...
stack_v2_sparse_classes_36k_train_006412
1,347
no_license
[ { "docstring": "Args: cfg: 配置文件", "name": "__init__", "signature": "def __init__(self, cfg)" }, { "docstring": "Args: x1, x2, x3: neck的输出", "name": "forward", "signature": "def forward(self, x1, x2, x3)" } ]
2
stack_v2_sparse_classes_30k_train_003307
Implement the Python class `YOLOHead` described below. Class description: Implement the YOLOHead class. Method signatures and docstrings: - def __init__(self, cfg): Args: cfg: 配置文件 - def forward(self, x1, x2, x3): Args: x1, x2, x3: neck的输出
Implement the Python class `YOLOHead` described below. Class description: Implement the YOLOHead class. Method signatures and docstrings: - def __init__(self, cfg): Args: cfg: 配置文件 - def forward(self, x1, x2, x3): Args: x1, x2, x3: neck的输出 <|skeleton|> class YOLOHead: def __init__(self, cfg): """Args: c...
b28636c6b13466049d1b21234e21781129c5f7a2
<|skeleton|> class YOLOHead: def __init__(self, cfg): """Args: cfg: 配置文件""" <|body_0|> def forward(self, x1, x2, x3): """Args: x1, x2, x3: neck的输出""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class YOLOHead: def __init__(self, cfg): """Args: cfg: 配置文件""" super(YOLOHead, self).__init__() ac_type = cfg.HEAD.ACTIVATION_FN out_channel = (cfg.DATASET.NUM_CLASSES + 5) * 3 self.conv1_1 = ConvBnActivation(128, 256, 3, 1, 1, ac_type) self.conv1_2 = nn.Conv2d(256, o...
the_stack_v2_python_sparse
yolo/head/head.py
YohannXu/pytorch_yolov4
train
1
ddd106a90cbba4a360f3564696d069d85cfb4ff5
[ "self.db = db\nself.config = config\nself.slides = self.db[self.config['db_collection']]", "image = self.slides.find_one({'_id': ObjectId(id)})\npath = image['path']\nosr = OpenSlide(path)\ndim = (int(self.config['macro_width']), int(self.config['macro_height']))\nif 'label' in osr.associated_images.keys():\n ...
<|body_start_0|> self.db = db self.config = config self.slides = self.db[self.config['db_collection']] <|end_body_0|> <|body_start_1|> image = self.slides.find_one({'_id': ObjectId(id)}) path = image['path'] osr = OpenSlide(path) dim = (int(self.config['macro_wid...
LabelImage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelImage: def __init__(self, db, config): """initialize Thumbnail resource Args: db: mongo db connection config: application configurations opt: deep zoom configurations Returns: None""" <|body_0|> def get(self, id): """Get slide label image --- tags: - Label Image...
stack_v2_sparse_classes_36k_train_006413
1,922
permissive
[ { "docstring": "initialize Thumbnail resource Args: db: mongo db connection config: application configurations opt: deep zoom configurations Returns: None", "name": "__init__", "signature": "def __init__(self, db, config)" }, { "docstring": "Get slide label image --- tags: - Label Image paramete...
2
stack_v2_sparse_classes_30k_train_017949
Implement the Python class `LabelImage` described below. Class description: Implement the LabelImage class. Method signatures and docstrings: - def __init__(self, db, config): initialize Thumbnail resource Args: db: mongo db connection config: application configurations opt: deep zoom configurations Returns: None - d...
Implement the Python class `LabelImage` described below. Class description: Implement the LabelImage class. Method signatures and docstrings: - def __init__(self, db, config): initialize Thumbnail resource Args: db: mongo db connection config: application configurations opt: deep zoom configurations Returns: None - d...
86f89f08dcfdab00ca295a6009820c02d84f7074
<|skeleton|> class LabelImage: def __init__(self, db, config): """initialize Thumbnail resource Args: db: mongo db connection config: application configurations opt: deep zoom configurations Returns: None""" <|body_0|> def get(self, id): """Get slide label image --- tags: - Label Image...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabelImage: def __init__(self, db, config): """initialize Thumbnail resource Args: db: mongo db connection config: application configurations opt: deep zoom configurations Returns: None""" self.db = db self.config = config self.slides = self.db[self.config['db_collection']] ...
the_stack_v2_python_sparse
api/routes/v1/LabelImage.py
dgutman/ADRCPathViewer
train
1
ff6d3c8c63d7c0e939c988edca6e41b59e06ec8a
[ "address = quote_plus(address, safe=',')\nmaps_address = 'http://maps.apple.com/?address=' + address\nwebbrowser.open(maps_address)", "name = kwargs.get('name', 'Selected Location')\nmaps_address = 'http://maps.apple.com/?ll={},{}&q={}'.format(latitude, longitude, name)\nwebbrowser.open(maps_address)", "latitud...
<|body_start_0|> address = quote_plus(address, safe=',') maps_address = 'http://maps.apple.com/?address=' + address webbrowser.open(maps_address) <|end_body_0|> <|body_start_1|> name = kwargs.get('name', 'Selected Location') maps_address = 'http://maps.apple.com/?ll={},{}&q={}'....
Implementation of iOS Maps API.
iOSMaps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iOSMaps: """Implementation of iOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" <|body_0|> def _open_by_lat_long(self, latitude, longitude, **kwargs): """Open a coordinate span...
stack_v2_sparse_classes_36k_train_006414
2,264
permissive
[ { "docstring": ":param address: An address string that geolocation can understand.", "name": "_open_by_address", "signature": "def _open_by_address(self, address, **kwargs)" }, { "docstring": "Open a coordinate span denoting a latitudinal delta and a longitudinal delta (similar to MKCoordinateSp...
4
null
Implement the Python class `iOSMaps` described below. Class description: Implementation of iOS Maps API. Method signatures and docstrings: - def _open_by_address(self, address, **kwargs): :param address: An address string that geolocation can understand. - def _open_by_lat_long(self, latitude, longitude, **kwargs): O...
Implement the Python class `iOSMaps` described below. Class description: Implementation of iOS Maps API. Method signatures and docstrings: - def _open_by_address(self, address, **kwargs): :param address: An address string that geolocation can understand. - def _open_by_lat_long(self, latitude, longitude, **kwargs): O...
d8a2b3d16b12fc54667744a092a453ad007c9448
<|skeleton|> class iOSMaps: """Implementation of iOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" <|body_0|> def _open_by_lat_long(self, latitude, longitude, **kwargs): """Open a coordinate span...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iOSMaps: """Implementation of iOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" address = quote_plus(address, safe=',') maps_address = 'http://maps.apple.com/?address=' + address webbrow...
the_stack_v2_python_sparse
plyer/platforms/ios/maps.py
kivy/plyer
train
1,516
b956596338ec082f9ab18daa3abece65b6978826
[ "employees = []\ntry:\n with transaction.atomic():\n for employee in data['employees']:\n user = self.find_or_create_user(employee['email'])\n token, _ = Token.objects.get_or_create(user=user)\n company = Company.objects.get(id=data['company_id'])\n self.__creat...
<|body_start_0|> employees = [] try: with transaction.atomic(): for employee in data['employees']: user = self.find_or_create_user(employee['email']) token, _ = Token.objects.get_or_create(user=user) company = Compan...
Employees serializer list.
EmployeesSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmployeesSerializer: """Employees serializer list.""" def create(self, data): """Create employees.""" <|body_0|> def to_representation(self, instance): """Represent serializer data.""" <|body_1|> def find_or_create_user(self, email): """Find ...
stack_v2_sparse_classes_36k_train_006415
3,659
no_license
[ { "docstring": "Create employees.", "name": "create", "signature": "def create(self, data)" }, { "docstring": "Represent serializer data.", "name": "to_representation", "signature": "def to_representation(self, instance)" }, { "docstring": "Find or create user by email.", "na...
5
null
Implement the Python class `EmployeesSerializer` described below. Class description: Employees serializer list. Method signatures and docstrings: - def create(self, data): Create employees. - def to_representation(self, instance): Represent serializer data. - def find_or_create_user(self, email): Find or create user ...
Implement the Python class `EmployeesSerializer` described below. Class description: Employees serializer list. Method signatures and docstrings: - def create(self, data): Create employees. - def to_representation(self, instance): Represent serializer data. - def find_or_create_user(self, email): Find or create user ...
252b0ebd77eefbcc945a0efc3068cc3421f46d5f
<|skeleton|> class EmployeesSerializer: """Employees serializer list.""" def create(self, data): """Create employees.""" <|body_0|> def to_representation(self, instance): """Represent serializer data.""" <|body_1|> def find_or_create_user(self, email): """Find ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmployeesSerializer: """Employees serializer list.""" def create(self, data): """Create employees.""" employees = [] try: with transaction.atomic(): for employee in data['employees']: user = self.find_or_create_user(employee['email']...
the_stack_v2_python_sparse
app/companies/serializers/employees_serializer.py
vsokoltsov/Interview360Server
train
2
7ae19a18b4c5fb7d095a1bca020a7ca7d3230f86
[ "precheck_mock = self.StartPatcher(ChromiumOSPreCheckMock())\nwith remote_access.ChromiumOSDeviceHandler('1.1.1.1') as device:\n CrOS_AU = auto_updater.ChromiumOSFlashUpdater(device, self.payload_dir)\n CrOS_AU.RunUpdate()\n self.assertTrue(precheck_mock.patched['CheckRestoreStateful'].called)", "with re...
<|body_start_0|> precheck_mock = self.StartPatcher(ChromiumOSPreCheckMock()) with remote_access.ChromiumOSDeviceHandler('1.1.1.1') as device: CrOS_AU = auto_updater.ChromiumOSFlashUpdater(device, self.payload_dir) CrOS_AU.RunUpdate() self.assertTrue(precheck_mock.patc...
Test precheck function.
ChromiumOSUpdatePreCheckTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromiumOSUpdatePreCheckTest: """Test precheck function.""" def testCheckRestoreStateful(self): """Test whether CheckRestoreStateful is called in update process.""" <|body_0|> def testCheckRestoreStatefulError(self): """Test CheckRestoreStateful fails with raisin...
stack_v2_sparse_classes_36k_train_006416
20,190
permissive
[ { "docstring": "Test whether CheckRestoreStateful is called in update process.", "name": "testCheckRestoreStateful", "signature": "def testCheckRestoreStateful(self)" }, { "docstring": "Test CheckRestoreStateful fails with raising ChromiumOSUpdateError.", "name": "testCheckRestoreStatefulErr...
3
null
Implement the Python class `ChromiumOSUpdatePreCheckTest` described below. Class description: Test precheck function. Method signatures and docstrings: - def testCheckRestoreStateful(self): Test whether CheckRestoreStateful is called in update process. - def testCheckRestoreStatefulError(self): Test CheckRestoreState...
Implement the Python class `ChromiumOSUpdatePreCheckTest` described below. Class description: Test precheck function. Method signatures and docstrings: - def testCheckRestoreStateful(self): Test whether CheckRestoreStateful is called in update process. - def testCheckRestoreStatefulError(self): Test CheckRestoreState...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ChromiumOSUpdatePreCheckTest: """Test precheck function.""" def testCheckRestoreStateful(self): """Test whether CheckRestoreStateful is called in update process.""" <|body_0|> def testCheckRestoreStatefulError(self): """Test CheckRestoreStateful fails with raisin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChromiumOSUpdatePreCheckTest: """Test precheck function.""" def testCheckRestoreStateful(self): """Test whether CheckRestoreStateful is called in update process.""" precheck_mock = self.StartPatcher(ChromiumOSPreCheckMock()) with remote_access.ChromiumOSDeviceHandler('1.1.1.1') as...
the_stack_v2_python_sparse
third_party/chromite/lib/auto_updater_unittest.py
metux/chromium-suckless
train
5
133a0951072c3169b75f56e52111ce1e80507009
[ "if len(powers) != len(periods):\n raise ValueError('Power levels and periods must be equal in length')\nreturn Workout(intervals=[*zip(powers, periods)], **kwargs)", "if start > stop:\n raise ValueError('Start power must be less than stop power')\nif stop < start:\n raise ValueError('Stop power must be ...
<|body_start_0|> if len(powers) != len(periods): raise ValueError('Power levels and periods must be equal in length') return Workout(intervals=[*zip(powers, periods)], **kwargs) <|end_body_0|> <|body_start_1|> if start > stop: raise ValueError('Start power must be less t...
Workout to use with FE device
Workout
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Workout: """Workout to use with FE device""" def from_arrays(powers: List[int], periods: List[float], **kwargs): """Create workout from arrays of powers and periods :param powers List[int]: power setpoints :param periods List[float]: period to hold each power (s) :raises ValueError: ...
stack_v2_sparse_classes_36k_train_006417
13,647
permissive
[ { "docstring": "Create workout from arrays of powers and periods :param powers List[int]: power setpoints :param periods List[float]: period to hold each power (s) :raises ValueError: powers and periods not equal length >>> Workout.from_arrays([100, 200, 300, 400], [5, 5.5, 10.2, 11.1]) Workout(intervals=[(100,...
2
stack_v2_sparse_classes_30k_train_014434
Implement the Python class `Workout` described below. Class description: Workout to use with FE device Method signatures and docstrings: - def from_arrays(powers: List[int], periods: List[float], **kwargs): Create workout from arrays of powers and periods :param powers List[int]: power setpoints :param periods List[f...
Implement the Python class `Workout` described below. Class description: Workout to use with FE device Method signatures and docstrings: - def from_arrays(powers: List[int], periods: List[float], **kwargs): Create workout from arrays of powers and periods :param powers List[int]: power setpoints :param periods List[f...
afe3a1236a48476b092fb68f477c3a8118c1d5e0
<|skeleton|> class Workout: """Workout to use with FE device""" def from_arrays(powers: List[int], periods: List[float], **kwargs): """Create workout from arrays of powers and periods :param powers List[int]: power setpoints :param periods List[float]: period to hold each power (s) :raises ValueError: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Workout: """Workout to use with FE device""" def from_arrays(powers: List[int], periods: List[float], **kwargs): """Create workout from arrays of powers and periods :param powers List[int]: power setpoints :param periods List[float]: period to hold each power (s) :raises ValueError: powers and pe...
the_stack_v2_python_sparse
openant/devices/fitness_equipment.py
Tigge/openant
train
150
888fe82b483a24c97ff26a521d7bd8dca6e887ab
[ "width = car.w\nratio = Classyfication.get_ratio()\nreturn width * ratio", "height = car.h\nratio = Classyfication.get_ratio()\nreturn height * ratio", "contours = ContourDetector.find(mask)\ncnt = SizeMeasurment.__find_biggest_contour(contours)\narea = ContourDetector.area(cnt)\nratio = Classyfication.get_rati...
<|body_start_0|> width = car.w ratio = Classyfication.get_ratio() return width * ratio <|end_body_0|> <|body_start_1|> height = car.h ratio = Classyfication.get_ratio() return height * ratio <|end_body_1|> <|body_start_2|> contours = ContourDetector.find(mask) ...
SizeMeasurment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SizeMeasurment: def calculate_width(car: Vehicle): """Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float""" <|body_0|> def calculate_height(car: Vehicle): """Wylicza...
stack_v2_sparse_classes_36k_train_006418
14,920
no_license
[ { "docstring": "Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float", "name": "calculate_width", "signature": "def calculate_width(car: Vehicle)" }, { "docstring": "Wylicza wysokośc samochodu w m...
6
stack_v2_sparse_classes_30k_train_006069
Implement the Python class `SizeMeasurment` described below. Class description: Implement the SizeMeasurment class. Method signatures and docstrings: - def calculate_width(car: Vehicle): Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w m...
Implement the Python class `SizeMeasurment` described below. Class description: Implement the SizeMeasurment class. Method signatures and docstrings: - def calculate_width(car: Vehicle): Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w m...
c8d6be403f12e01d3a2c0ea671363f20eeb08ce4
<|skeleton|> class SizeMeasurment: def calculate_width(car: Vehicle): """Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float""" <|body_0|> def calculate_height(car: Vehicle): """Wylicza...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SizeMeasurment: def calculate_width(car: Vehicle): """Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float""" width = car.w ratio = Classyfication.get_ratio() return width * rati...
the_stack_v2_python_sparse
src/classify.py
djgrasss/videodetection
train
0
3b2bc19f855c2e67c0a136371cd606ff4db49ba1
[ "ret = []\nlp = len(pattern)\nfor word in words:\n if len(word) != lp:\n continue\n if self.findPattern(word, pattern):\n ret.append(word)\nprint(ret)\nreturn ret", "d = {}\nfor i in range(0, len(pattern)):\n k = pattern[i]\n if k not in d.keys():\n d[k] = word[i]\n if word...
<|body_start_0|> ret = [] lp = len(pattern) for word in words: if len(word) != lp: continue if self.findPattern(word, pattern): ret.append(word) print(ret) return ret <|end_body_0|> <|body_start_1|> d = {} f...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: """if word is one to one map return the word""" <|body_0|> def findPattern(self, word: str, pattern: str) -> bool: """judge if word is one to one map""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_006419
974
no_license
[ { "docstring": "if word is one to one map return the word", "name": "findAndReplacePattern", "signature": "def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]" }, { "docstring": "judge if word is one to one map", "name": "findPattern", "signature": "def findPatte...
2
stack_v2_sparse_classes_30k_train_012663
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: if word is one to one map return the word - def findPattern(self, word: str, pattern: str) -> bool: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: if word is one to one map return the word - def findPattern(self, word: str, pattern: str) -> bool: ...
48384483a55e120caf5d8d353e9aa287fce3cf4a
<|skeleton|> class Solution: def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: """if word is one to one map return the word""" <|body_0|> def findPattern(self, word: str, pattern: str) -> bool: """judge if word is one to one map""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: """if word is one to one map return the word""" ret = [] lp = len(pattern) for word in words: if len(word) != lp: continue if self.findPattern(word, p...
the_stack_v2_python_sparse
problems/0890_Find_And_Replace_Pattern/16_klgentle.py
yychuyu/LeetCode
train
134
94bf4620aabaaa87e2b5c36d0f113099f86a9ff1
[ "if not citations:\n return 0\nn = len(citations)\nd = [0 for i in xrange(n + 1)]\nfor i, ai in enumerate(citations):\n if ai >= n:\n d[n] += 1\n else:\n d[ai] += 1\ns = 0\nfor i in reversed(xrange(n + 1)):\n s += d[i]\n if s >= i:\n return i\nreturn 0", "if not citations:\n ...
<|body_start_0|> if not citations: return 0 n = len(citations) d = [0 for i in xrange(n + 1)] for i, ai in enumerate(citations): if ai >= n: d[n] += 1 else: d[ai] += 1 s = 0 for i in reversed(xrange(n + 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hIndex(self, citations): """:type citations: List[int] :rtype: int""" <|body_0|> def hIndex_binary_search(self, citations): """:type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not citations: ...
stack_v2_sparse_classes_36k_train_006420
1,980
no_license
[ { "docstring": ":type citations: List[int] :rtype: int", "name": "hIndex", "signature": "def hIndex(self, citations)" }, { "docstring": ":type citations: List[int] :rtype: int", "name": "hIndex_binary_search", "signature": "def hIndex_binary_search(self, citations)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex(self, citations): :type citations: List[int] :rtype: int - def hIndex_binary_search(self, citations): :type citations: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex(self, citations): :type citations: List[int] :rtype: int - def hIndex_binary_search(self, citations): :type citations: List[int] :rtype: int <|skeleton|> class Soluti...
0a7aa09a2b95e4caca5b5123fb735ceb5c01e992
<|skeleton|> class Solution: def hIndex(self, citations): """:type citations: List[int] :rtype: int""" <|body_0|> def hIndex_binary_search(self, citations): """:type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hIndex(self, citations): """:type citations: List[int] :rtype: int""" if not citations: return 0 n = len(citations) d = [0 for i in xrange(n + 1)] for i, ai in enumerate(citations): if ai >= n: d[n] += 1 ...
the_stack_v2_python_sparse
h-index.py
onestarshang/leetcode
train
0
fddbc04b84992f8d35d7b4b27ecd64e7a3243f4b
[ "super(AutoregressionLoss, self).__init__()\nself.cpd_channels = cpd_channels\nself.eps = np.finfo(float).eps", "z_d = z.detach()\nz_dist = F.softmax(z_dist, dim=1)\nz_d = z_d.view(len(z_d), -1).contiguous()\nz_dist = z_dist.view(len(z_d), self.cpd_channels, -1).contiguous()\nz_dist = torch.clamp(z_dist, self.eps...
<|body_start_0|> super(AutoregressionLoss, self).__init__() self.cpd_channels = cpd_channels self.eps = np.finfo(float).eps <|end_body_0|> <|body_start_1|> z_d = z.detach() z_dist = F.softmax(z_dist, dim=1) z_d = z_d.view(len(z_d), -1).contiguous() z_dist = z_dis...
Implements the autoregression loss. Given a representation and the estimated cpds, provides the log-likelihood of the representation under the estimated prior.
AutoregressionLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoregressionLoss: """Implements the autoregression loss. Given a representation and the estimated cpds, provides the log-likelihood of the representation under the estimated prior.""" def __init__(self, cpd_channels): """Class constructor. :param cpd_channels: number of bins in whi...
stack_v2_sparse_classes_36k_train_006421
2,703
permissive
[ { "docstring": "Class constructor. :param cpd_channels: number of bins in which the multinomial works.", "name": "__init__", "signature": "def __init__(self, cpd_channels)" }, { "docstring": "Forward propagation. :param z: the batch of latent representations. :param z_dist: the batch of estimate...
2
stack_v2_sparse_classes_30k_train_019354
Implement the Python class `AutoregressionLoss` described below. Class description: Implements the autoregression loss. Given a representation and the estimated cpds, provides the log-likelihood of the representation under the estimated prior. Method signatures and docstrings: - def __init__(self, cpd_channels): Clas...
Implement the Python class `AutoregressionLoss` described below. Class description: Implements the autoregression loss. Given a representation and the estimated cpds, provides the log-likelihood of the representation under the estimated prior. Method signatures and docstrings: - def __init__(self, cpd_channels): Clas...
99384094b5b7213e7669ad492f1b56216045b190
<|skeleton|> class AutoregressionLoss: """Implements the autoregression loss. Given a representation and the estimated cpds, provides the log-likelihood of the representation under the estimated prior.""" def __init__(self, cpd_channels): """Class constructor. :param cpd_channels: number of bins in whi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoregressionLoss: """Implements the autoregression loss. Given a representation and the estimated cpds, provides the log-likelihood of the representation under the estimated prior.""" def __init__(self, cpd_channels): """Class constructor. :param cpd_channels: number of bins in which the multin...
the_stack_v2_python_sparse
models/loss_functions/autoregression_loss.py
ppalaupuigdevall/moments-vae
train
1
cb5f3e7c8f7cad3572650e3dfdf9e712e6a240a6
[ "account = self.request.user\nif account.is_authenticated:\n return rol_mag_wisselen(self.request)", "context = super().get_context_data(**kwargs)\ncontext['url_handleiding_leden'] = settings.URL_PDF_HANDLEIDING_LEDEN\ncontext['url_handleiding_beheerders'] = settings.URL_PDF_HANDLEIDING_BEHEERDERS\ncontext['ur...
<|body_start_0|> account = self.request.user if account.is_authenticated: return rol_mag_wisselen(self.request) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) context['url_handleiding_leden'] = settings.URL_PDF_HANDLEIDING_LEDEN context[...
Django class-based view voor toegang tot de Handleidingen
HandleidingenView
[ "BSD-3-Clause-Clear" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandleidingenView: """Django class-based view voor toegang tot de Handleidingen""" def test_func(self): """called by the UserPassesTestMixin to verify the user has permissions to use this view""" <|body_0|> def get_context_data(self, **kwargs): """called by the t...
stack_v2_sparse_classes_36k_train_006422
8,698
permissive
[ { "docstring": "called by the UserPassesTestMixin to verify the user has permissions to use this view", "name": "test_func", "signature": "def test_func(self)" }, { "docstring": "called by the template system to get the context data for the template", "name": "get_context_data", "signatu...
2
null
Implement the Python class `HandleidingenView` described below. Class description: Django class-based view voor toegang tot de Handleidingen Method signatures and docstrings: - def test_func(self): called by the UserPassesTestMixin to verify the user has permissions to use this view - def get_context_data(self, **kwa...
Implement the Python class `HandleidingenView` described below. Class description: Django class-based view voor toegang tot de Handleidingen Method signatures and docstrings: - def test_func(self): called by the UserPassesTestMixin to verify the user has permissions to use this view - def get_context_data(self, **kwa...
5ed38165a231f0caa56f67e8faf2dd074916e500
<|skeleton|> class HandleidingenView: """Django class-based view voor toegang tot de Handleidingen""" def test_func(self): """called by the UserPassesTestMixin to verify the user has permissions to use this view""" <|body_0|> def get_context_data(self, **kwargs): """called by the t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HandleidingenView: """Django class-based view voor toegang tot de Handleidingen""" def test_func(self): """called by the UserPassesTestMixin to verify the user has permissions to use this view""" account = self.request.user if account.is_authenticated: return rol_mag_w...
the_stack_v2_python_sparse
Plein/views.py
RamonvdW/nhb-apps
train
2
300807ca340381ed02b2f1ca77674a4080ebac22
[ "if not head or not head.next:\n return head\nfast, slow = (head.next, head)\nwhile fast and fast.next:\n fast = fast.next.next\n slow = slow.next\nsecond = slow.next\nslow.next = None\nl = self.sortList(head)\nr = self.sortList(second)\nreturn self.merge(l, r)", "if not l or not r:\n return l or r\ni...
<|body_start_0|> if not head or not head.next: return head fast, slow = (head.next, head) while fast and fast.next: fast = fast.next.next slow = slow.next second = slow.next slow.next = None l = self.sortList(head) r = self.sort...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def merge(self, l, r): """:type l: ListNode :type r: ListNode :rtype: ListNode""" <|body_1|> def sortList_1(self, head): """:type head: ListNode :rtype: Li...
stack_v2_sparse_classes_36k_train_006423
4,222
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "sortList", "signature": "def sortList(self, head)" }, { "docstring": ":type l: ListNode :type r: ListNode :rtype: ListNode", "name": "merge", "signature": "def merge(self, l, r)" }, { "docstring": ":type head: ListN...
5
stack_v2_sparse_classes_30k_train_009466
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList(self, head): :type head: ListNode :rtype: ListNode - def merge(self, l, r): :type l: ListNode :type r: ListNode :rtype: ListNode - def sortList_1(self, head): :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList(self, head): :type head: ListNode :rtype: ListNode - def merge(self, l, r): :type l: ListNode :type r: ListNode :rtype: ListNode - def sortList_1(self, head): :type ...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def merge(self, l, r): """:type l: ListNode :type r: ListNode :rtype: ListNode""" <|body_1|> def sortList_1(self, head): """:type head: ListNode :rtype: Li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" if not head or not head.next: return head fast, slow = (head.next, head) while fast and fast.next: fast = fast.next.next slow = slow.next second = slow.ne...
the_stack_v2_python_sparse
Solutions/0148_sortList.py
YoupengLi/leetcode-sorting
train
3
62faaccf74199d4800fa9dd50b65ab42be2e855f
[ "self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32)\nself.coord_feed = coord_feed\nself.dim_feed = self.coord_feed.feed.map(self.correct_dims, num_parallel_calls=self.num_parallel_calls)\nself.feed = self.dim_feed", "N = tf.shape(X)[0]\nN_slice = tf.reduce_prod(self.coord_feed.dims[1:])\...
<|body_start_0|> self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32) self.coord_feed = coord_feed self.dim_feed = self.coord_feed.feed.map(self.correct_dims, num_parallel_calls=self.num_parallel_calls) self.feed = self.dim_feed <|end_body_0|> <|body_start_1|> ...
CoordinateDimFeed
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoordinateDimFeed: def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10): """Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int""" <|body_0|> def correct_dims(self, ...
stack_v2_sparse_classes_36k_train_006424
18,860
permissive
[ { "docstring": "Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int", "name": "__init__", "signature": "def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10)" }, { "docstring": "Correct f...
2
stack_v2_sparse_classes_30k_train_018464
Implement the Python class `CoordinateDimFeed` described below. Class description: Implement the CoordinateDimFeed class. Method signatures and docstrings: - def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10): Create a coordinate dimension feed that correctly incorperates partial batches. :param co...
Implement the Python class `CoordinateDimFeed` described below. Class description: Implement the CoordinateDimFeed class. Method signatures and docstrings: - def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10): Create a coordinate dimension feed that correctly incorperates partial batches. :param co...
2997d60d8cf07f875e42c0b5f07944e9ab7e9d33
<|skeleton|> class CoordinateDimFeed: def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10): """Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int""" <|body_0|> def correct_dims(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoordinateDimFeed: def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10): """Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int""" self.num_parallel_calls = tf.convert_to_tensor(num_pa...
the_stack_v2_python_sparse
bayes_filter/feeds.py
Joshuaalbert/bayes_filter
train
0
5d6142f85da94de9f03aa096e3e2037932f1f3ea
[ "timestamp = plist_key.get(plist_value_name, None)\nif timestamp is None:\n return None\nreturn dfdatetime_cocoa_time.CocoaTime(timestamp=timestamp)", "for _, process_name, process_values in self._RecurseKey(top_level, depth=1):\n if process_name == 'CacheVersion':\n continue\n for apple_identifie...
<|body_start_0|> timestamp = plist_key.get(plist_value_name, None) if timestamp is None: return None return dfdatetime_cocoa_time.CocoaTime(timestamp=timestamp) <|end_body_0|> <|body_start_1|> for _, process_name, process_values in self._RecurseKey(top_level, depth=1): ...
Plist parser plugin for identity services status cache files. Identity services status cache plist files are typically named: com.apple.identityservices.idstatuscache.plist
IOSIdstatusachePlistPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IOSIdstatusachePlistPlugin: """Plist parser plugin for identity services status cache files. Identity services status cache plist files are typically named: com.apple.identityservices.idstatuscache.plist""" def _GetDateTimeValueFromPlistKey(self, plist_key, plist_value_name): """Retr...
stack_v2_sparse_classes_36k_train_006425
2,979
permissive
[ { "docstring": "Retrieves a date and time value from a specific value in a plist key. Args: plist_key (object): plist key. plist_value_name (str): name of the value in the plist key. Returns: dfdatetime.TimeElementsInMicroseconds: date and time or None if not available.", "name": "_GetDateTimeValueFromPlist...
2
stack_v2_sparse_classes_30k_train_011403
Implement the Python class `IOSIdstatusachePlistPlugin` described below. Class description: Plist parser plugin for identity services status cache files. Identity services status cache plist files are typically named: com.apple.identityservices.idstatuscache.plist Method signatures and docstrings: - def _GetDateTimeV...
Implement the Python class `IOSIdstatusachePlistPlugin` described below. Class description: Plist parser plugin for identity services status cache files. Identity services status cache plist files are typically named: com.apple.identityservices.idstatuscache.plist Method signatures and docstrings: - def _GetDateTimeV...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class IOSIdstatusachePlistPlugin: """Plist parser plugin for identity services status cache files. Identity services status cache plist files are typically named: com.apple.identityservices.idstatuscache.plist""" def _GetDateTimeValueFromPlistKey(self, plist_key, plist_value_name): """Retr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IOSIdstatusachePlistPlugin: """Plist parser plugin for identity services status cache files. Identity services status cache plist files are typically named: com.apple.identityservices.idstatuscache.plist""" def _GetDateTimeValueFromPlistKey(self, plist_key, plist_value_name): """Retrieves a date ...
the_stack_v2_python_sparse
plaso/parsers/plist_plugins/ios_identityservices.py
log2timeline/plaso
train
1,506
6f394b769cc36094c919f015912e5169d87266b1
[ "if not intervals:\n return intervals\nresults = []\nintervals = sorted(intervals, cmp=self.interval_comp)\nresults.append(intervals[0])\nfor i in xrange(1, len(intervals)):\n if results[-1].end >= intervals[i].start:\n results[-1].end = max(results[-1].end, intervals[i].end)\n else:\n result...
<|body_start_0|> if not intervals: return intervals results = [] intervals = sorted(intervals, cmp=self.interval_comp) results.append(intervals[0]) for i in xrange(1, len(intervals)): if results[-1].end >= intervals[i].start: results[-1].en...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval] Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].""" <|body_0|> def interval_comp(self,...
stack_v2_sparse_classes_36k_train_006426
1,147
no_license
[ { "docstring": ":type intervals: List[Interval] :rtype: List[Interval] Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].", "name": "merge", "signature": "def merge(self, intervals)" }, { "docstring": "对节点...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6...
350f28cad5ec384df476f6403cb7a7db419de329
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval] Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].""" <|body_0|> def interval_comp(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval] Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].""" if not intervals: return intervals ...
the_stack_v2_python_sparse
leetcode/mergeintervals.py
wanglinjie/coding
train
0
0e126b37e59623155c6c2fb8d4bbf9035a7d4d9e
[ "max_index = 0\nfor idx, n in enumerate(nums):\n if idx > max_index:\n return False\n max_index = max(max_index, idx + nums[idx])\nreturn True", "start, destination = (0, len(nums) - 1)\nfrontier_backtrack_index = destination\nfor idx in range(len(nums) - 2, -1, -1):\n if idx + nums[idx] >= fronti...
<|body_start_0|> max_index = 0 for idx, n in enumerate(nums): if idx > max_index: return False max_index = max(max_index, idx + nums[idx]) return True <|end_body_0|> <|body_start_1|> start, destination = (0, len(nums) - 1) frontier_backtra...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums: list[int]) -> bool: """Greedy :param nums: :return:""" <|body_0|> def canJump(self, nums: list[int]) -> bool: """Back tracking :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_index = 0 ...
stack_v2_sparse_classes_36k_train_006427
894
no_license
[ { "docstring": "Greedy :param nums: :return:", "name": "canJump", "signature": "def canJump(self, nums: list[int]) -> bool" }, { "docstring": "Back tracking :param nums: :return:", "name": "canJump", "signature": "def canJump(self, nums: list[int]) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_007392
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: list[int]) -> bool: Greedy :param nums: :return: - def canJump(self, nums: list[int]) -> bool: Back tracking :param nums: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: list[int]) -> bool: Greedy :param nums: :return: - def canJump(self, nums: list[int]) -> bool: Back tracking :param nums: :return: <|skeleton|> class Sol...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def canJump(self, nums: list[int]) -> bool: """Greedy :param nums: :return:""" <|body_0|> def canJump(self, nums: list[int]) -> bool: """Back tracking :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canJump(self, nums: list[int]) -> bool: """Greedy :param nums: :return:""" max_index = 0 for idx, n in enumerate(nums): if idx > max_index: return False max_index = max(max_index, idx + nums[idx]) return True def canJum...
the_stack_v2_python_sparse
Leetcode/55. Jump Game.py
brlala/Educative-Grokking-Coding-Exercise
train
3
18ba4a81a55611cce2ccac6aa0aaa6174a1e4ac5
[ "self.log_dir = log_dir\nself.arrow_writers = {}\nself.columnLength = columnLength\nself.chunkRows = 96\nself.step = 0\nself.dfs = {}", "logger.info('Writing to arrow file')\nfor obj_type in powerflow_output:\n df = pd.DataFrame(data=powerflow_output[obj_type], index=[0])\n df['TimeStep'] = float(currenttim...
<|body_start_0|> self.log_dir = log_dir self.arrow_writers = {} self.columnLength = columnLength self.chunkRows = 96 self.step = 0 self.dfs = {} <|end_body_0|> <|body_start_1|> logger.info('Writing to arrow file') for obj_type in powerflow_output: ...
Class that handles writing simulation results to arrow files.
ArrowWriter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArrowWriter: """Class that handles writing simulation results to arrow files.""" def __init__(self, log_dir, columnLength=10): """Constructor""" <|body_0|> def write(self, fed_name, currenttime, powerflow_output, index): """Writes the status of BES assets at a pa...
stack_v2_sparse_classes_36k_train_006428
2,616
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, log_dir, columnLength=10)" }, { "docstring": "Writes the status of BES assets at a particular timestep to an arrow file. :param fed_name: name of BES federate :param log_fields: list of objects to log :param curre...
2
null
Implement the Python class `ArrowWriter` described below. Class description: Class that handles writing simulation results to arrow files. Method signatures and docstrings: - def __init__(self, log_dir, columnLength=10): Constructor - def write(self, fed_name, currenttime, powerflow_output, index): Writes the status ...
Implement the Python class `ArrowWriter` described below. Class description: Class that handles writing simulation results to arrow files. Method signatures and docstrings: - def __init__(self, log_dir, columnLength=10): Constructor - def write(self, fed_name, currenttime, powerflow_output, index): Writes the status ...
def06b01195a152292a7182b9002d3a950f1fa40
<|skeleton|> class ArrowWriter: """Class that handles writing simulation results to arrow files.""" def __init__(self, log_dir, columnLength=10): """Constructor""" <|body_0|> def write(self, fed_name, currenttime, powerflow_output, index): """Writes the status of BES assets at a pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArrowWriter: """Class that handles writing simulation results to arrow files.""" def __init__(self, log_dir, columnLength=10): """Constructor""" self.log_dir = log_dir self.arrow_writers = {} self.columnLength = columnLength self.chunkRows = 96 self.step = ...
the_stack_v2_python_sparse
PyDSS/api/src/app/arrow_writer.py
TimberJ99/PyDSS
train
0
40b37e7e96924811468d9e0e368beb798c02949a
[ "self.parser = argparse.ArgumentParser(prog='switchmap-ng-cli', description=additional_help, formatter_class=argparse.RawTextHelpFormatter)\nsubparsers = self.parser.add_subparsers(dest='action')\n_Show(subparsers)\n_Start(subparsers)\n_Stop(subparsers)\n_Restart(subparsers)\n_Test(subparsers)\nself.args = self.par...
<|body_start_0|> self.parser = argparse.ArgumentParser(prog='switchmap-ng-cli', description=additional_help, formatter_class=argparse.RawTextHelpFormatter) subparsers = self.parser.add_subparsers(dest='action') _Show(subparsers) _Start(subparsers) _Stop(subparsers) _Resta...
Class that manages the CLI.
CLI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CLI: """Class that manages the CLI.""" def __init__(self, additional_help=''): """Method initializing the class. Args: additional_help: String for additional help information Returns: None""" <|body_0|> def process(self): """Act on CLI arguments. Args: None Retur...
stack_v2_sparse_classes_36k_train_006429
14,010
permissive
[ { "docstring": "Method initializing the class. Args: additional_help: String for additional help information Returns: None", "name": "__init__", "signature": "def __init__(self, additional_help='')" }, { "docstring": "Act on CLI arguments. Args: None Returns: None", "name": "process", "s...
2
null
Implement the Python class `CLI` described below. Class description: Class that manages the CLI. Method signatures and docstrings: - def __init__(self, additional_help=''): Method initializing the class. Args: additional_help: String for additional help information Returns: None - def process(self): Act on CLI argume...
Implement the Python class `CLI` described below. Class description: Class that manages the CLI. Method signatures and docstrings: - def __init__(self, additional_help=''): Method initializing the class. Args: additional_help: String for additional help information Returns: None - def process(self): Act on CLI argume...
ae82589fbbab77fef6d6be09c1fcca5846f595a8
<|skeleton|> class CLI: """Class that manages the CLI.""" def __init__(self, additional_help=''): """Method initializing the class. Args: additional_help: String for additional help information Returns: None""" <|body_0|> def process(self): """Act on CLI arguments. Args: None Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CLI: """Class that manages the CLI.""" def __init__(self, additional_help=''): """Method initializing the class. Args: additional_help: String for additional help information Returns: None""" self.parser = argparse.ArgumentParser(prog='switchmap-ng-cli', description=additional_help, forma...
the_stack_v2_python_sparse
switchmap/cli/cli.py
PalisadoesFoundation/switchmap-ng
train
8
2c534120308e0ac4045dcb707dbdf02a11a399f1
[ "self.getFollow = dict()\nself.Tweets = []\nself.tweetNums = 0", "self.Tweets.append((userId, tweetId))\nself.tweetNums += 1\nif userId not in self.getFollow:\n self.getFollow[userId] = []", "if userId not in self.getFollow.keys():\n return\nret = []\nnums = 0\nfor i in range(self.tweetNums - 1, -1, -1):\...
<|body_start_0|> self.getFollow = dict() self.Tweets = [] self.tweetNums = 0 <|end_body_0|> <|body_start_1|> self.Tweets.append((userId, tweetId)) self.tweetNums += 1 if userId not in self.getFollow: self.getFollow[userId] = [] <|end_body_1|> <|body_start_2|...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int): """Retrieve the 10 most recent tw...
stack_v2_sparse_classes_36k_train_006430
3,220
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet.", "name": "postTweet", "signature": "def postTweet(self, userId: int, tweetId: int) -> None" }, { "docstring": "Retrieve the 10 mos...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int): Retrie...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int): Retrie...
0cc970aaa03aa9300319a1e39e052e4beeec6698
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int): """Retrieve the 10 most recent tw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.getFollow = dict() self.Tweets = [] self.tweetNums = 0 def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" self.Tweets.append((userId, tweetId)) ...
the_stack_v2_python_sparse
leetcode.355. 设计推特.py
NonCover/-
train
2
c20a67d98c0905f5a4fe73147e23be123f30b367
[ "if audit_info:\n audit = Audit()\n audit.audit_type = audit_info['audit_type']\n audit.audit_type_id = audit_info.get('audit_type_id')\n audit.sub_type = audit_info.get('sub_type')\n audit.sub_type_id = audit_info.get('sub_type_id')\n audit.field = audit_info['field']\n audit.old_value = audit...
<|body_start_0|> if audit_info: audit = Audit() audit.audit_type = audit_info['audit_type'] audit.audit_type_id = audit_info.get('audit_type_id') audit.sub_type = audit_info.get('sub_type') audit.sub_type_id = audit_info.get('sub_type_id') ...
This class manages audit.
Audit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Audit: """This class manages audit.""" def create_from_dict(cls, audit_info: dict): """Create audit from the dict.""" <|body_0|> def create_from_list(cls, audit_list: list): """Create audit from the list.""" <|body_1|> def find_project_status(cls, pr...
stack_v2_sparse_classes_36k_train_006431
3,503
permissive
[ { "docstring": "Create audit from the dict.", "name": "create_from_dict", "signature": "def create_from_dict(cls, audit_info: dict)" }, { "docstring": "Create audit from the list.", "name": "create_from_list", "signature": "def create_from_list(cls, audit_list: list)" }, { "docst...
3
null
Implement the Python class `Audit` described below. Class description: This class manages audit. Method signatures and docstrings: - def create_from_dict(cls, audit_info: dict): Create audit from the dict. - def create_from_list(cls, audit_list: list): Create audit from the list. - def find_project_status(cls, projec...
Implement the Python class `Audit` described below. Class description: This class manages audit. Method signatures and docstrings: - def create_from_dict(cls, audit_info: dict): Create audit from the dict. - def create_from_list(cls, audit_list: list): Create audit from the list. - def find_project_status(cls, projec...
3bfe09c100a0f5b98d61228324336d5f45ad93ad
<|skeleton|> class Audit: """This class manages audit.""" def create_from_dict(cls, audit_info: dict): """Create audit from the dict.""" <|body_0|> def create_from_list(cls, audit_list: list): """Create audit from the list.""" <|body_1|> def find_project_status(cls, pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Audit: """This class manages audit.""" def create_from_dict(cls, audit_info: dict): """Create audit from the dict.""" if audit_info: audit = Audit() audit.audit_type = audit_info['audit_type'] audit.audit_type_id = audit_info.get('audit_type_id') ...
the_stack_v2_python_sparse
selfservice-api/src/selfservice_api/models/audit.py
bcgov/BCSC-SS
train
2
a93a704b800997be083f1830aa44fbcf179a9322
[ "self.mutually_exclusive = set(kwargs.pop('mutually_exclusive', []))\nhelp_ = kwargs.get('help', '')\nif self.mutually_exclusive:\n ex_str = ', '.join(self.mutually_exclusive)\n kwargs['help'] = help_ + (' NOTE: This argument is mutually exclusive with arguments: [' + ex_str + '].')\nsuper().__init__(*args, ...
<|body_start_0|> self.mutually_exclusive = set(kwargs.pop('mutually_exclusive', [])) help_ = kwargs.get('help', '') if self.mutually_exclusive: ex_str = ', '.join(self.mutually_exclusive) kwargs['help'] = help_ + (' NOTE: This argument is mutually exclusive with argument...
Represent a mutually exclusive option.
MutuallyExclusiveOption
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MutuallyExclusiveOption: """Represent a mutually exclusive option.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Initialize the option.""" <|body_0|> def handle_parse_result(self, ctx: Context, opts: Mapping[str, Any], args: List[Any]) -> Tuple[Any, List[s...
stack_v2_sparse_classes_36k_train_006432
8,209
permissive
[ { "docstring": "Initialize the option.", "name": "__init__", "signature": "def __init__(self, *args: Any, **kwargs: Any) -> None" }, { "docstring": "Handle parse result. :param ctx: the click context. :param opts: the options. :param args: the list of arguments (to be forwarded to the parent cla...
2
null
Implement the Python class `MutuallyExclusiveOption` described below. Class description: Represent a mutually exclusive option. Method signatures and docstrings: - def __init__(self, *args: Any, **kwargs: Any) -> None: Initialize the option. - def handle_parse_result(self, ctx: Context, opts: Mapping[str, Any], args:...
Implement the Python class `MutuallyExclusiveOption` described below. Class description: Represent a mutually exclusive option. Method signatures and docstrings: - def __init__(self, *args: Any, **kwargs: Any) -> None: Initialize the option. - def handle_parse_result(self, ctx: Context, opts: Mapping[str, Any], args:...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class MutuallyExclusiveOption: """Represent a mutually exclusive option.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Initialize the option.""" <|body_0|> def handle_parse_result(self, ctx: Context, opts: Mapping[str, Any], args: List[Any]) -> Tuple[Any, List[s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MutuallyExclusiveOption: """Represent a mutually exclusive option.""" def __init__(self, *args: Any, **kwargs: Any) -> None: """Initialize the option.""" self.mutually_exclusive = set(kwargs.pop('mutually_exclusive', [])) help_ = kwargs.get('help', '') if self.mutually_exc...
the_stack_v2_python_sparse
aea/cli/utils/click_utils.py
fetchai/agents-aea
train
192
a26e541444bf78217fdf77a2ae20bf3ec645591d
[ "self.environment = mls.rl.common.Environment()\nself.environment.game = mls.rl.common.Game(max_step=max_step)\nself.environment.current_state = self.environment.game.init_state(self.environment)", "observation = self.environment.get_observation_for_agent()\nfor ag in self.environment.agents:\n ag.observation ...
<|body_start_0|> self.environment = mls.rl.common.Environment() self.environment.game = mls.rl.common.Game(max_step=max_step) self.environment.current_state = self.environment.game.init_state(self.environment) <|end_body_0|> <|body_start_1|> observation = self.environment.get_observatio...
Engine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Engine: def __init__(self, max_step=-1): """initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game""" <|body_0|> def execute(self): """Main loop of the application.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_006433
1,269
permissive
[ { "docstring": "initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game", "name": "__init__", "signature": "def __init__(self, max_step=-1)" }, { "docstring": "Main loop of the application.", "name": "execute", "signature":...
2
stack_v2_sparse_classes_30k_test_000760
Implement the Python class `Engine` described below. Class description: Implement the Engine class. Method signatures and docstrings: - def __init__(self, max_step=-1): initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game - def execute(self): Main lo...
Implement the Python class `Engine` described below. Class description: Implement the Engine class. Method signatures and docstrings: - def __init__(self, max_step=-1): initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game - def execute(self): Main lo...
373598d067c7f0930ba13fe8da9756ce26eecbaf
<|skeleton|> class Engine: def __init__(self, max_step=-1): """initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game""" <|body_0|> def execute(self): """Main loop of the application.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Engine: def __init__(self, max_step=-1): """initialization of the engine :param max_step maximum step of the environment. temporary. will be change when adding Game""" self.environment = mls.rl.common.Environment() self.environment.game = mls.rl.common.Game(max_step=max_step) s...
the_stack_v2_python_sparse
mlsurvey/rl/engine/engine.py
jlaumonier/mlsurvey
train
0
8c92b85d7fd65836ccfebdc63523d73953e6148f
[ "if not root:\n return []\nres = []\n\ndef digui(root):\n if root:\n for i in root.children:\n digui(i)\n res.append(root.val)\ndigui(root)\nreturn res", "if not root:\n return []\nres = []\nstack = [root]\nwhile stack:\n node = stack.pop()\n for i in node.children:\n ...
<|body_start_0|> if not root: return [] res = [] def digui(root): if root: for i in root.children: digui(i) res.append(root.val) digui(root) return res <|end_body_0|> <|body_start_1|> if not roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def postorder(self, root: 'Node') -> List[int]: """递归""" <|body_0|> def postorder1(self, root: 'Node') -> List[int]: """迭代""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return [] res = [] def dig...
stack_v2_sparse_classes_36k_train_006434
1,058
no_license
[ { "docstring": "递归", "name": "postorder", "signature": "def postorder(self, root: 'Node') -> List[int]" }, { "docstring": "迭代", "name": "postorder1", "signature": "def postorder1(self, root: 'Node') -> List[int]" } ]
2
stack_v2_sparse_classes_30k_train_001599
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorder(self, root: 'Node') -> List[int]: 递归 - def postorder1(self, root: 'Node') -> List[int]: 迭代
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorder(self, root: 'Node') -> List[int]: 递归 - def postorder1(self, root: 'Node') -> List[int]: 迭代 <|skeleton|> class Solution: def postorder(self, root: 'Node') -> L...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def postorder(self, root: 'Node') -> List[int]: """递归""" <|body_0|> def postorder1(self, root: 'Node') -> List[int]: """迭代""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def postorder(self, root: 'Node') -> List[int]: """递归""" if not root: return [] res = [] def digui(root): if root: for i in root.children: digui(i) res.append(root.val) digui(root) ...
the_stack_v2_python_sparse
算法/Week_02/590. N叉树的后序遍历.py
RichieSong/algorithm
train
0
099331659c5d011698fa1b456115bf323e2e4885
[ "book = self.open_excel_book()\nids = self.create_checks(self.sheet_to_array(book.sheet_by_index(0)), book.datemode)\nreturn {'name': 'Cheques importados', 'res_model': 'account.third.check', 'type': 'ir.actions.act_window', 'domain': [('id', 'in', ids)], 'views': [[False, 'tree'], [False, 'form']]}", "import xlr...
<|body_start_0|> book = self.open_excel_book() ids = self.create_checks(self.sheet_to_array(book.sheet_by_index(0)), book.datemode) return {'name': 'Cheques importados', 'res_model': 'account.third.check', 'type': 'ir.actions.act_window', 'domain': [('id', 'in', ids)], 'views': [[False, 'tree'],...
ThirdCheckImportWizard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThirdCheckImportWizard: def import_file(self): """Importo el archivo cargado en el formulario (uso api.multi para devolver una vista despues) :return: una tree (con form) que muestra los cheques creados""" <|body_0|> def create_checks(self, array, datemode): """Crea ...
stack_v2_sparse_classes_36k_train_006435
6,176
no_license
[ { "docstring": "Importo el archivo cargado en el formulario (uso api.multi para devolver una vista despues) :return: una tree (con form) que muestra los cheques creados", "name": "import_file", "signature": "def import_file(self)" }, { "docstring": "Crea cheques a partir de un array con datos :p...
4
null
Implement the Python class `ThirdCheckImportWizard` described below. Class description: Implement the ThirdCheckImportWizard class. Method signatures and docstrings: - def import_file(self): Importo el archivo cargado en el formulario (uso api.multi para devolver una vista despues) :return: una tree (con form) que mu...
Implement the Python class `ThirdCheckImportWizard` described below. Class description: Implement the ThirdCheckImportWizard class. Method signatures and docstrings: - def import_file(self): Importo el archivo cargado en el formulario (uso api.multi para devolver una vista despues) :return: una tree (con form) que mu...
77921b4d965f2e4c081d523b373eb306a450a873
<|skeleton|> class ThirdCheckImportWizard: def import_file(self): """Importo el archivo cargado en el formulario (uso api.multi para devolver una vista despues) :return: una tree (con form) que muestra los cheques creados""" <|body_0|> def create_checks(self, array, datemode): """Crea ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThirdCheckImportWizard: def import_file(self): """Importo el archivo cargado en el formulario (uso api.multi para devolver una vista despues) :return: una tree (con form) que muestra los cheques creados""" book = self.open_excel_book() ids = self.create_checks(self.sheet_to_array(book....
the_stack_v2_python_sparse
odoo_addons_others/opyme_third_check_import/wizard/models/third_check_import_wizard.py
test-odoorosario/opt
train
0
db2f26f22b9fe06fd311fec406ab416a4453f74a
[ "Inventory.__init__(self, product_code, description, market_price, rental_price)\nself.brand = brand\nself.voltage = voltage", "output_dict = Inventory.return_as_dictionary(self)\noutput_dict['brand'] = self.brand\noutput_dict['voltage'] = self.voltage\nreturn output_dict" ]
<|body_start_0|> Inventory.__init__(self, product_code, description, market_price, rental_price) self.brand = brand self.voltage = voltage <|end_body_0|> <|body_start_1|> output_dict = Inventory.return_as_dictionary(self) output_dict['brand'] = self.brand output_dict['vo...
Class for electric appliances
ElectricAppliances
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElectricAppliances: """Class for electric appliances""" def __init__(self, product_code, description, market_price, rental_price, brand, voltage): """Initializes electric appliances class""" <|body_0|> def return_as_dictionary(self): """Returns a dictionary with ...
stack_v2_sparse_classes_36k_train_006436
922
no_license
[ { "docstring": "Initializes electric appliances class", "name": "__init__", "signature": "def __init__(self, product_code, description, market_price, rental_price, brand, voltage)" }, { "docstring": "Returns a dictionary with attributes", "name": "return_as_dictionary", "signature": "def...
2
null
Implement the Python class `ElectricAppliances` described below. Class description: Class for electric appliances Method signatures and docstrings: - def __init__(self, product_code, description, market_price, rental_price, brand, voltage): Initializes electric appliances class - def return_as_dictionary(self): Retur...
Implement the Python class `ElectricAppliances` described below. Class description: Class for electric appliances Method signatures and docstrings: - def __init__(self, product_code, description, market_price, rental_price, brand, voltage): Initializes electric appliances class - def return_as_dictionary(self): Retur...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class ElectricAppliances: """Class for electric appliances""" def __init__(self, product_code, description, market_price, rental_price, brand, voltage): """Initializes electric appliances class""" <|body_0|> def return_as_dictionary(self): """Returns a dictionary with ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElectricAppliances: """Class for electric appliances""" def __init__(self, product_code, description, market_price, rental_price, brand, voltage): """Initializes electric appliances class""" Inventory.__init__(self, product_code, description, market_price, rental_price) self.brand...
the_stack_v2_python_sparse
students/ramkumar_rajanbabu/lesson_01/assignment/inventory_management/electric_appliances_class.py
JavaRod/SP_Python220B_2019
train
1
30e806612b3a115e336479378bf6298293080c11
[ "Document = current_app_ils.document_record_cls\ntry:\n Document.get_record_by_pid(document_pid)\nexcept PIDDoesNotExistError:\n raise DocumentNotFoundError(document_pid)", "super().validate(record, **kwargs)\ndocument_pid = record['document_pid']\nself.ensure_document_exists(document_pid)" ]
<|body_start_0|> Document = current_app_ils.document_record_cls try: Document.get_record_by_pid(document_pid) except PIDDoesNotExistError: raise DocumentNotFoundError(document_pid) <|end_body_0|> <|body_start_1|> super().validate(record, **kwargs) documen...
EItem record validator.
EItemValidator
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EItemValidator: """EItem record validator.""" def ensure_document_exists(self, document_pid): """Ensure document exists or raise.""" <|body_0|> def validate(self, record, **kwargs): """Validate record before create and commit.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_006437
3,816
permissive
[ { "docstring": "Ensure document exists or raise.", "name": "ensure_document_exists", "signature": "def ensure_document_exists(self, document_pid)" }, { "docstring": "Validate record before create and commit.", "name": "validate", "signature": "def validate(self, record, **kwargs)" } ]
2
null
Implement the Python class `EItemValidator` described below. Class description: EItem record validator. Method signatures and docstrings: - def ensure_document_exists(self, document_pid): Ensure document exists or raise. - def validate(self, record, **kwargs): Validate record before create and commit.
Implement the Python class `EItemValidator` described below. Class description: EItem record validator. Method signatures and docstrings: - def ensure_document_exists(self, document_pid): Ensure document exists or raise. - def validate(self, record, **kwargs): Validate record before create and commit. <|skeleton|> c...
1c36526e85510100c5f64059518d1b716d87ac10
<|skeleton|> class EItemValidator: """EItem record validator.""" def ensure_document_exists(self, document_pid): """Ensure document exists or raise.""" <|body_0|> def validate(self, record, **kwargs): """Validate record before create and commit.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EItemValidator: """EItem record validator.""" def ensure_document_exists(self, document_pid): """Ensure document exists or raise.""" Document = current_app_ils.document_record_cls try: Document.get_record_by_pid(document_pid) except PIDDoesNotExistError: ...
the_stack_v2_python_sparse
invenio_app_ils/eitems/api.py
inveniosoftware/invenio-app-ils
train
64
f41d9aa5ce5dcd04cc01b1109a73dcee668ac3df
[ "super(BahandauAttention, self).__init__()\nself.W1 = tf.keras.layers.Dense(units=units)\nself.W2 = tf.keras.layers.Dense(units=units)\nself.V = tf.keras.layers.Dense(units=1)", "hidden_state_with_time_axis = tf.expand_dims(hidden_state, 1)\nscore = self.V(tf.nn.tanh(self.W1(hidden_state_with_time_axis) + self.W2...
<|body_start_0|> super(BahandauAttention, self).__init__() self.W1 = tf.keras.layers.Dense(units=units) self.W2 = tf.keras.layers.Dense(units=units) self.V = tf.keras.layers.Dense(units=1) <|end_body_0|> <|body_start_1|> hidden_state_with_time_axis = tf.expand_dims(hidden_state,...
The attention layer with bahandau score.
BahandauAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BahandauAttention: """The attention layer with bahandau score.""" def __init__(self, units): """The structure function. Args: units: The units number of attention hidden layer.""" <|body_0|> def call(self, inputs, hidden_state): """The Args: inputs: The inputs. h...
stack_v2_sparse_classes_36k_train_006438
20,417
no_license
[ { "docstring": "The structure function. Args: units: The units number of attention hidden layer.", "name": "__init__", "signature": "def __init__(self, units)" }, { "docstring": "The Args: inputs: The inputs. hidden_state: The rnn hidden layer state. Returns: The context vectors and attention we...
2
stack_v2_sparse_classes_30k_train_003311
Implement the Python class `BahandauAttention` described below. Class description: The attention layer with bahandau score. Method signatures and docstrings: - def __init__(self, units): The structure function. Args: units: The units number of attention hidden layer. - def call(self, inputs, hidden_state): The Args: ...
Implement the Python class `BahandauAttention` described below. Class description: The attention layer with bahandau score. Method signatures and docstrings: - def __init__(self, units): The structure function. Args: units: The units number of attention hidden layer. - def call(self, inputs, hidden_state): The Args: ...
d1b70b2a954f4665b628ba252b03c1a74b95559f
<|skeleton|> class BahandauAttention: """The attention layer with bahandau score.""" def __init__(self, units): """The structure function. Args: units: The units number of attention hidden layer.""" <|body_0|> def call(self, inputs, hidden_state): """The Args: inputs: The inputs. h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BahandauAttention: """The attention layer with bahandau score.""" def __init__(self, units): """The structure function. Args: units: The units number of attention hidden layer.""" super(BahandauAttention, self).__init__() self.W1 = tf.keras.layers.Dense(units=units) self.W...
the_stack_v2_python_sparse
NeuralNetworks-tensorflow/RNN/nmt_with_attention/nmt.py
zhaocc1106/machine_learn
train
15
a3b480e5dba83500dcbbef20424d7f2e21969f94
[ "ret_str = str(self.id)\nif self.title:\n ret_str += f' ({self.title})'\nreturn ret_str", "super().clean()\nif self.image and self.youtube_id:\n raise ValidationError(ugettext('A media resource may not contain both an image and a YouTube video.'))\nif not self.image and (not self.youtube_id):\n raise Val...
<|body_start_0|> ret_str = str(self.id) if self.title: ret_str += f' ({self.title})' return ret_str <|end_body_0|> <|body_start_1|> super().clean() if self.image and self.youtube_id: raise ValidationError(ugettext('A media resource may not contain both an...
A container for a single media object such as an image or video.
MediaResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MediaResource: """A container for a single media object such as an image or video.""" def __str__(self): """Returns: A user readable string describing the instance.""" <|body_0|> def clean(self): """Ensure that the resource contains exactly one type of media.""" ...
stack_v2_sparse_classes_36k_train_006439
6,917
permissive
[ { "docstring": "Returns: A user readable string describing the instance.", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Ensure that the resource contains exactly one type of media.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Retu...
3
stack_v2_sparse_classes_30k_val_000407
Implement the Python class `MediaResource` described below. Class description: A container for a single media object such as an image or video. Method signatures and docstrings: - def __str__(self): Returns: A user readable string describing the instance. - def clean(self): Ensure that the resource contains exactly o...
Implement the Python class `MediaResource` described below. Class description: A container for a single media object such as an image or video. Method signatures and docstrings: - def __str__(self): Returns: A user readable string describing the instance. - def clean(self): Ensure that the resource contains exactly o...
a4bc1f4adee7ecfba840ad45da22513f88acbbd0
<|skeleton|> class MediaResource: """A container for a single media object such as an image or video.""" def __str__(self): """Returns: A user readable string describing the instance.""" <|body_0|> def clean(self): """Ensure that the resource contains exactly one type of media.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MediaResource: """A container for a single media object such as an image or video.""" def __str__(self): """Returns: A user readable string describing the instance.""" ret_str = str(self.id) if self.title: ret_str += f' ({self.title})' return ret_str def c...
the_stack_v2_python_sparse
darksite/cms/models.py
UNCDarkside/DarksiteAPI
train
0
6bed9e02e9f1444770bb7b56efb38e34543fd3a7
[ "self.year = year\nself.month = month\nself.course_id = course_id\nself.user_type = user_type\nsuper(Calendar, self).__init__()", "events_per_day = events.filter(eventDate__day=day)\nd = ''\nfor event in events_per_day:\n d += f'<li> {event.get_html_url} </li>'\nif day != 0:\n return f\"<td><span class='dat...
<|body_start_0|> self.year = year self.month = month self.course_id = course_id self.user_type = user_type super(Calendar, self).__init__() <|end_body_0|> <|body_start_1|> events_per_day = events.filter(eventDate__day=day) d = '' for event in events_per_d...
Calendar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Calendar: def __init__(self, year=None, month=None, course_id=None, user_type=None): """calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html". Some part of the code is change in order to be able t...
stack_v2_sparse_classes_36k_train_006440
3,320
no_license
[ { "docstring": "calendar initialisation .. note::This code was made by following this tutorial \"https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html\". Some part of the code is change in order to be able to be integrated to the webapp :param self: object that contains metadata about the request. :p...
4
stack_v2_sparse_classes_30k_test_000326
Implement the Python class `Calendar` described below. Class description: Implement the Calendar class. Method signatures and docstrings: - def __init__(self, year=None, month=None, course_id=None, user_type=None): calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.c...
Implement the Python class `Calendar` described below. Class description: Implement the Calendar class. Method signatures and docstrings: - def __init__(self, year=None, month=None, course_id=None, user_type=None): calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.c...
f003cc8721d78abe9eb6279818ecef287689bb72
<|skeleton|> class Calendar: def __init__(self, year=None, month=None, course_id=None, user_type=None): """calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html". Some part of the code is change in order to be able t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Calendar: def __init__(self, year=None, month=None, course_id=None, user_type=None): """calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html". Some part of the code is change in order to be able to be integrate...
the_stack_v2_python_sparse
IPC/utils.py
erikmudkip/finalProject
train
0
7a02d49108d79b2075ab25f1edbb3626dee48182
[ "super().__init__(parent)\nself.items = items\nself.initUi()", "width = 150\nheight = 70\nroundness = 20\ncolor = qRgb(154, 179, 174)\nstyle = '\\n QLabel {\\n color: black;\\n font-weight: bold;\\n font-size: 30pt;\\n font-family: Asap;\\n ...
<|body_start_0|> super().__init__(parent) self.items = items self.initUi() <|end_body_0|> <|body_start_1|> width = 150 height = 70 roundness = 20 color = qRgb(154, 179, 174) style = '\n QLabel {\n color: black;\n f...
Food Menu widget.
Tabs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tabs: """Food Menu widget.""" def __init__(self, items, parent=None): """Init.""" <|body_0|> def initUi(self): """Ui Setup.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(parent) self.items = items self.initUi()...
stack_v2_sparse_classes_36k_train_006441
2,585
no_license
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, items, parent=None)" }, { "docstring": "Ui Setup.", "name": "initUi", "signature": "def initUi(self)" } ]
2
stack_v2_sparse_classes_30k_train_006087
Implement the Python class `Tabs` described below. Class description: Food Menu widget. Method signatures and docstrings: - def __init__(self, items, parent=None): Init. - def initUi(self): Ui Setup.
Implement the Python class `Tabs` described below. Class description: Food Menu widget. Method signatures and docstrings: - def __init__(self, items, parent=None): Init. - def initUi(self): Ui Setup. <|skeleton|> class Tabs: """Food Menu widget.""" def __init__(self, items, parent=None): """Init."""...
a5d18593e689123cac34af552628ed2818ca5d59
<|skeleton|> class Tabs: """Food Menu widget.""" def __init__(self, items, parent=None): """Init.""" <|body_0|> def initUi(self): """Ui Setup.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tabs: """Food Menu widget.""" def __init__(self, items, parent=None): """Init.""" super().__init__(parent) self.items = items self.initUi() def initUi(self): """Ui Setup.""" width = 150 height = 70 roundness = 20 color = qRgb(15...
the_stack_v2_python_sparse
Menu.py
edgary777/lonchepos
train
0
dc32d9e620f1bec5cb404a7ce702f4b26d02de5e
[ "self.job_id = job_id\nself.cloud_target_type = cloud_target_type\nself.expiry_time_usecs = expiry_time_usecs\nself.target_id = target_id\nself.target_name = target_name\nself.total_snapshots = total_snapshots\nself.mtype = mtype", "if dictionary is None:\n return None\njob_id = dictionary.get('JobId')\ncloud_...
<|body_start_0|> self.job_id = job_id self.cloud_target_type = cloud_target_type self.expiry_time_usecs = expiry_time_usecs self.target_id = target_id self.target_name = target_name self.total_snapshots = total_snapshots self.mtype = mtype <|end_body_0|> <|body_s...
Implementation of the 'GdprCopyTask' model. CopyTask defines the copy tasks of a job. Attributes: job_id (long|int): Specifies the job with which this copy task is tied to. Note: this is only used for internal aggregation. cloud_target_type (string): Specifies the cloud deploy target type. For example 'kAzure','kAWS', ...
GdprCopyTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GdprCopyTask: """Implementation of the 'GdprCopyTask' model. CopyTask defines the copy tasks of a job. Attributes: job_id (long|int): Specifies the job with which this copy task is tied to. Note: this is only used for internal aggregation. cloud_target_type (string): Specifies the cloud deploy ta...
stack_v2_sparse_classes_36k_train_006442
3,218
permissive
[ { "docstring": "Constructor for the GdprCopyTask class", "name": "__init__", "signature": "def __init__(self, job_id=None, cloud_target_type=None, expiry_time_usecs=None, target_id=None, target_name=None, total_snapshots=None, mtype=None)" }, { "docstring": "Creates an instance of this model fro...
2
stack_v2_sparse_classes_30k_train_005789
Implement the Python class `GdprCopyTask` described below. Class description: Implementation of the 'GdprCopyTask' model. CopyTask defines the copy tasks of a job. Attributes: job_id (long|int): Specifies the job with which this copy task is tied to. Note: this is only used for internal aggregation. cloud_target_type ...
Implement the Python class `GdprCopyTask` described below. Class description: Implementation of the 'GdprCopyTask' model. CopyTask defines the copy tasks of a job. Attributes: job_id (long|int): Specifies the job with which this copy task is tied to. Note: this is only used for internal aggregation. cloud_target_type ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class GdprCopyTask: """Implementation of the 'GdprCopyTask' model. CopyTask defines the copy tasks of a job. Attributes: job_id (long|int): Specifies the job with which this copy task is tied to. Note: this is only used for internal aggregation. cloud_target_type (string): Specifies the cloud deploy ta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GdprCopyTask: """Implementation of the 'GdprCopyTask' model. CopyTask defines the copy tasks of a job. Attributes: job_id (long|int): Specifies the job with which this copy task is tied to. Note: this is only used for internal aggregation. cloud_target_type (string): Specifies the cloud deploy target type. Fo...
the_stack_v2_python_sparse
cohesity_management_sdk/models/gdpr_copy_task.py
cohesity/management-sdk-python
train
24
325c32215a9def40e1776540593a190e8eb8ae57
[ "color = self.color\nif color is not None:\n glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE)\n glEnable(GL_COLOR_MATERIAL)\n glEnableClientState(GL_COLOR_ARRAY)\n color.bind()\n try:\n glColorPointer(3, GL_FLOAT, 0, color)\n finally:\n color.unbind()\n return 1\nelse:\n return 0...
<|body_start_0|> color = self.color if color is not None: glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE) glEnable(GL_COLOR_MATERIAL) glEnableClientState(GL_COLOR_ARRAY) color.bind() try: glColorPointer(3, GL_FLOAT, 0, color) ...
VBO-based holder
VBOHolder
[ "GPL-1.0-or-later", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VBOHolder: """VBO-based holder""" def _enableColors(self, node): """Enable the colour array if possible""" <|body_0|> def _enableNormals(self, node): """Enable the normal array if possible""" <|body_1|> def _enableTextures(self, node): """Ena...
stack_v2_sparse_classes_36k_train_006443
12,165
permissive
[ { "docstring": "Enable the colour array if possible", "name": "_enableColors", "signature": "def _enableColors(self, node)" }, { "docstring": "Enable the normal array if possible", "name": "_enableNormals", "signature": "def _enableNormals(self, node)" }, { "docstring": "Enable t...
4
null
Implement the Python class `VBOHolder` described below. Class description: VBO-based holder Method signatures and docstrings: - def _enableColors(self, node): Enable the colour array if possible - def _enableNormals(self, node): Enable the normal array if possible - def _enableTextures(self, node): Enable the normal ...
Implement the Python class `VBOHolder` described below. Class description: VBO-based holder Method signatures and docstrings: - def _enableColors(self, node): Enable the colour array if possible - def _enableNormals(self, node): Enable the normal array if possible - def _enableTextures(self, node): Enable the normal ...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class VBOHolder: """VBO-based holder""" def _enableColors(self, node): """Enable the colour array if possible""" <|body_0|> def _enableNormals(self, node): """Enable the normal array if possible""" <|body_1|> def _enableTextures(self, node): """Ena...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VBOHolder: """VBO-based holder""" def _enableColors(self, node): """Enable the colour array if possible""" color = self.color if color is not None: glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE) glEnable(GL_COLOR_MATERIAL) glEnableClientState(GL...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/scenegraph/indexedpolygons.py
alexus37/AugmentedRealityChess
train
1
edf923aa25dbe41f4ecf41a0c5ccb434f74230aa
[ "matches = []\nif isinstance(obj, dict):\n if len(obj) == 1:\n for key_name, _ in obj.items():\n if key_name not in self.supported_functions:\n message = 'FindInMap only supports [{0}] functions at {1}'\n matches.append(RuleMatch(tree[:] + [key_name], message.forma...
<|body_start_0|> matches = [] if isinstance(obj, dict): if len(obj) == 1: for key_name, _ in obj.items(): if key_name not in self.supported_functions: message = 'FindInMap only supports [{0}] functions at {1}' ...
Check if FindInMap values are correct
FindInMap
[ "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindInMap: """Check if FindInMap values are correct""" def check_dict(self, obj, tree): """Check that obj is a dict with Ref as the only key Mappings only support Ref inside them""" <|body_0|> def map_name(self, map_name, mappings, tree): """Check the map name"""...
stack_v2_sparse_classes_36k_train_006444
5,093
permissive
[ { "docstring": "Check that obj is a dict with Ref as the only key Mappings only support Ref inside them", "name": "check_dict", "signature": "def check_dict(self, obj, tree)" }, { "docstring": "Check the map name", "name": "map_name", "signature": "def map_name(self, map_name, mappings, ...
5
null
Implement the Python class `FindInMap` described below. Class description: Check if FindInMap values are correct Method signatures and docstrings: - def check_dict(self, obj, tree): Check that obj is a dict with Ref as the only key Mappings only support Ref inside them - def map_name(self, map_name, mappings, tree): ...
Implement the Python class `FindInMap` described below. Class description: Check if FindInMap values are correct Method signatures and docstrings: - def check_dict(self, obj, tree): Check that obj is a dict with Ref as the only key Mappings only support Ref inside them - def map_name(self, map_name, mappings, tree): ...
5176573c2f4cb7313998b4bc0bcb0716b58ea380
<|skeleton|> class FindInMap: """Check if FindInMap values are correct""" def check_dict(self, obj, tree): """Check that obj is a dict with Ref as the only key Mappings only support Ref inside them""" <|body_0|> def map_name(self, map_name, mappings, tree): """Check the map name"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindInMap: """Check if FindInMap values are correct""" def check_dict(self, obj, tree): """Check that obj is a dict with Ref as the only key Mappings only support Ref inside them""" matches = [] if isinstance(obj, dict): if len(obj) == 1: for key_name, ...
the_stack_v2_python_sparse
src/cfnlint/rules/functions/FindInMap.py
rene84/cfn-python-lint
train
1
4ffe360107579f25d35c3e89c5b11bfa5f08e841
[ "self.root = None\nself.region = region.copy()\nxmin2k = smaller2k(self.region.x_min)\nymin2k = smaller2k(self.region.y_min)\nxmax2k = larger2k(self.region.x_max)\nymax2k = larger2k(self.region.y_max)\nself.region.x_min = self.region.y_min = min(xmin2k, ymin2k)\nself.region.x_max = self.region.y_max = max(xmax2k, y...
<|body_start_0|> self.root = None self.region = region.copy() xmin2k = smaller2k(self.region.x_min) ymin2k = smaller2k(self.region.y_min) xmax2k = larger2k(self.region.x_max) ymax2k = larger2k(self.region.y_max) self.region.x_min = self.region.y_min = min(xmin2k, ...
QuadTree
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuadTree: def __init__(self, region): """Create QuadTree defined over existing rectangular region. Assume that (0,0) is the lower left coordinate and the half-length side of any square in quadtree is power of 2. If incoming region is too small, this expands accordingly.""" <|body...
stack_v2_sparse_classes_36k_train_006445
7,418
permissive
[ { "docstring": "Create QuadTree defined over existing rectangular region. Assume that (0,0) is the lower left coordinate and the half-length side of any square in quadtree is power of 2. If incoming region is too small, this expands accordingly.", "name": "__init__", "signature": "def __init__(self, reg...
5
stack_v2_sparse_classes_30k_train_017890
Implement the Python class `QuadTree` described below. Class description: Implement the QuadTree class. Method signatures and docstrings: - def __init__(self, region): Create QuadTree defined over existing rectangular region. Assume that (0,0) is the lower left coordinate and the half-length side of any square in qua...
Implement the Python class `QuadTree` described below. Class description: Implement the QuadTree class. Method signatures and docstrings: - def __init__(self, region): Create QuadTree defined over existing rectangular region. Assume that (0,0) is the lower left coordinate and the half-length side of any square in qua...
f0dd93a4099f363580fe1b36216f808be31a0f17
<|skeleton|> class QuadTree: def __init__(self, region): """Create QuadTree defined over existing rectangular region. Assume that (0,0) is the lower left coordinate and the half-length side of any square in quadtree is power of 2. If incoming region is too small, this expands accordingly.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuadTree: def __init__(self, region): """Create QuadTree defined over existing rectangular region. Assume that (0,0) is the lower left coordinate and the half-length side of any square in quadtree is power of 2. If incoming region is too small, this expands accordingly.""" self.root = None ...
the_stack_v2_python_sparse
Quadtree/quadtree/quad_point.py
kmsnyder/python-quadtree-webinar
train
0
03e55c6015649e55a16894753259fd73bc1df896
[ "if filter_id is not None:\n f = Filter.get_if_accessible_by(filter_id, self.current_user, raise_if_none=True, options=[joinedload(Filter.stream)])\n self.verify_and_commit()\n return self.success(data=f)\nfilters = Filter.get_records_accessible_by(self.current_user)\nself.verify_and_commit()\nreturn self....
<|body_start_0|> if filter_id is not None: f = Filter.get_if_accessible_by(filter_id, self.current_user, raise_if_none=True, options=[joinedload(Filter.stream)]) self.verify_and_commit() return self.success(data=f) filters = Filter.get_records_accessible_by(self.curre...
FilterHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterHandler: def get(self, filter_id=None): """--- single: description: Retrieve a filter tags: - filters parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleFilter 400: content: application/json: schema: ...
stack_v2_sparse_classes_36k_train_006446
4,760
permissive
[ { "docstring": "--- single: description: Retrieve a filter tags: - filters parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleFilter 400: content: application/json: schema: Error multiple: description: Retrieve all filters tags: -...
4
stack_v2_sparse_classes_30k_train_012171
Implement the Python class `FilterHandler` described below. Class description: Implement the FilterHandler class. Method signatures and docstrings: - def get(self, filter_id=None): --- single: description: Retrieve a filter tags: - filters parameters: - in: path name: filter_id required: true schema: type: integer re...
Implement the Python class `FilterHandler` described below. Class description: Implement the FilterHandler class. Method signatures and docstrings: - def get(self, filter_id=None): --- single: description: Retrieve a filter tags: - filters parameters: - in: path name: filter_id required: true schema: type: integer re...
2433d5ae0b2f41faac3c76ed4ae8d9a4da5522fb
<|skeleton|> class FilterHandler: def get(self, filter_id=None): """--- single: description: Retrieve a filter tags: - filters parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleFilter 400: content: application/json: schema: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterHandler: def get(self, filter_id=None): """--- single: description: Retrieve a filter tags: - filters parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleFilter 400: content: application/json: schema: Error multiple...
the_stack_v2_python_sparse
skyportal/handlers/api/filter.py
dmitryduev/skyportal
train
1
631de2942d6f0b78ea75799a7cdf87ae27958f39
[ "super().__init__()\nif not callable(raysampler):\n raise ValueError('\"raysampler\" has to be a \"Callable\" object.')\nif not callable(raymarcher):\n raise ValueError('\"raymarcher\" has to be a \"Callable\" object.')\nself.raysampler = raysampler\nself.raymarcher = raymarcher", "if not callable(volumetri...
<|body_start_0|> super().__init__() if not callable(raysampler): raise ValueError('"raysampler" has to be a "Callable" object.') if not callable(raymarcher): raise ValueError('"raymarcher" has to be a "Callable" object.') self.raysampler = raysampler self....
A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `volumetric_function` `Callable`, which defines ...
ImplicitRenderer
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImplicitRenderer: """A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `vol...
stack_v2_sparse_classes_36k_train_006447
17,111
permissive
[ { "docstring": "Args: raysampler: A `Callable` that takes as input scene cameras (an instance of `CamerasBase`) and returns a RayBundle or HeterogeneousRayBundle, that describes the rays emitted from the cameras. raymarcher: A `Callable` that receives the response of the `volumetric_function` (an input to `self...
2
stack_v2_sparse_classes_30k_test_000407
Implement the Python class `ImplicitRenderer` described below. Class description: A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input th...
Implement the Python class `ImplicitRenderer` described below. Class description: A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input th...
a3d99cab6bf5eb69be8d5eb48895da6edd859565
<|skeleton|> class ImplicitRenderer: """A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `vol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImplicitRenderer: """A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `volumetric_funct...
the_stack_v2_python_sparse
pytorch3d/renderer/implicit/renderer.py
facebookresearch/pytorch3d
train
7,964
7e09de1c5dc520c79c269c897db4b3fe602bd1f3
[ "assert isinstance(response, scrapy.http.response.html.HtmlResponse)\nurls = [response.url]\nposts_per_page = 50\nlast_page = response.selector.xpath('//a[contains(@title, \"Click to jump to page\")]/strong[2]/text()').extract_first()\nif last_page:\n last_page = read_number(last_page)\nelse:\n last_page = 0\...
<|body_start_0|> assert isinstance(response, scrapy.http.response.html.HtmlResponse) urls = [response.url] posts_per_page = 50 last_page = response.selector.xpath('//a[contains(@title, "Click to jump to page")]/strong[2]/text()').extract_first() if last_page: last_pag...
scrape images from angling addicts forum
SeaAnglingIrelandArchives
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeaAnglingIrelandArchives: """scrape images from angling addicts forum""" def parse(self, response): """get links to report boards yields: http://www.sea-angling-ireland.org/forum/viewforum.php?f=62 http://www.sea-angling-ireland.org/forum/viewforum.php?f=62&start=50""" <|bod...
stack_v2_sparse_classes_36k_train_006448
5,577
no_license
[ { "docstring": "get links to report boards yields: http://www.sea-angling-ireland.org/forum/viewforum.php?f=62 http://www.sea-angling-ireland.org/forum/viewforum.php?f=62&start=50", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "get links to all reports from boards ...
3
null
Implement the Python class `SeaAnglingIrelandArchives` described below. Class description: scrape images from angling addicts forum Method signatures and docstrings: - def parse(self, response): get links to report boards yields: http://www.sea-angling-ireland.org/forum/viewforum.php?f=62 http://www.sea-angling-irela...
Implement the Python class `SeaAnglingIrelandArchives` described below. Class description: scrape images from angling addicts forum Method signatures and docstrings: - def parse(self, response): get links to report boards yields: http://www.sea-angling-ireland.org/forum/viewforum.php?f=62 http://www.sea-angling-irela...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class SeaAnglingIrelandArchives: """scrape images from angling addicts forum""" def parse(self, response): """get links to report boards yields: http://www.sea-angling-ireland.org/forum/viewforum.php?f=62 http://www.sea-angling-ireland.org/forum/viewforum.php?f=62&start=50""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeaAnglingIrelandArchives: """scrape images from angling addicts forum""" def parse(self, response): """get links to report boards yields: http://www.sea-angling-ireland.org/forum/viewforum.php?f=62 http://www.sea-angling-ireland.org/forum/viewforum.php?f=62&start=50""" assert isinstance(...
the_stack_v2_python_sparse
imgscrape/spiders/seaanglingireland.py
gmonkman/python
train
0
6738ec6de0db9d7f9d515f9ee57d99976b112383
[ "self.version = ''\nself.datafile = ''\nself.command = ''\nself.alphabet = ''\nself.sequences = []", "if isinstance(key, str):\n for motif in self:\n if motif.name == key:\n return motif\nelse:\n return list.__getitem__(self, key)" ]
<|body_start_0|> self.version = '' self.datafile = '' self.command = '' self.alphabet = '' self.sequences = [] <|end_body_0|> <|body_start_1|> if isinstance(key, str): for motif in self: if motif.name == key: return motif ...
A class for holding the results of a MEME run. A meme.Record is an object that holds the results from running MEME. It implements no methods of its own. The meme.Record class inherits from list, so you can access individual motifs in the record by their index. Alternatively, you can find a motif by its name: >>> from B...
Record
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Record: """A class for holding the results of a MEME run. A meme.Record is an object that holds the results from running MEME. It implements no methods of its own. The meme.Record class inherits from list, so you can access individual motifs in the record by their index. Alternatively, you can fi...
stack_v2_sparse_classes_36k_train_006449
6,706
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return the motif of index key.", "name": "__getitem__", "signature": "def __getitem__(self, key)" } ]
2
null
Implement the Python class `Record` described below. Class description: A class for holding the results of a MEME run. A meme.Record is an object that holds the results from running MEME. It implements no methods of its own. The meme.Record class inherits from list, so you can access individual motifs in the record by...
Implement the Python class `Record` described below. Class description: A class for holding the results of a MEME run. A meme.Record is an object that holds the results from running MEME. It implements no methods of its own. The meme.Record class inherits from list, so you can access individual motifs in the record by...
595c5c46794ae08a1f19716636eac7430cededa1
<|skeleton|> class Record: """A class for holding the results of a MEME run. A meme.Record is an object that holds the results from running MEME. It implements no methods of its own. The meme.Record class inherits from list, so you can access individual motifs in the record by their index. Alternatively, you can fi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Record: """A class for holding the results of a MEME run. A meme.Record is an object that holds the results from running MEME. It implements no methods of its own. The meme.Record class inherits from list, so you can access individual motifs in the record by their index. Alternatively, you can find a motif by...
the_stack_v2_python_sparse
.venv/Lib/site-packages/Bio/motifs/meme.py
abner-lucas/tp-cruzi-db
train
2
a3196eba68381137ee1cb0edc35f2a3abcafe563
[ "a, b, c = sorted(amount)\nif c >= a + b:\n return c\nreturn ceil((a + b + c) / 2)", "pq = []\nfor num in amount:\n if num > 0:\n heappush(pq, -num)\nres = 0\nwhile len(pq) >= 2:\n a, b = (-heappop(pq), -heappop(pq))\n a, b = (a - 1, b - 1)\n if a > 0:\n heappush(pq, -a)\n if b > 0...
<|body_start_0|> a, b, c = sorted(amount) if c >= a + b: return c return ceil((a + b + c) / 2) <|end_body_0|> <|body_start_1|> pq = [] for num in amount: if num > 0: heappush(pq, -num) res = 0 while len(pq) >= 2: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fillCups(self, amount: List[int]) -> int: """贪心 一种是有一种水特别多,那么答案就是这种水的数量。 否则,一定可以匹配到只剩一杯,或匹配完。""" <|body_0|> def fillCups2(self, amount: List[int]) -> int: """优先队列模拟 每次取两个最大的消去""" <|body_1|> <|end_skeleton|> <|body_start_0|> a, b, c = s...
stack_v2_sparse_classes_36k_train_006450
1,425
no_license
[ { "docstring": "贪心 一种是有一种水特别多,那么答案就是这种水的数量。 否则,一定可以匹配到只剩一杯,或匹配完。", "name": "fillCups", "signature": "def fillCups(self, amount: List[int]) -> int" }, { "docstring": "优先队列模拟 每次取两个最大的消去", "name": "fillCups2", "signature": "def fillCups2(self, amount: List[int]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fillCups(self, amount: List[int]) -> int: 贪心 一种是有一种水特别多,那么答案就是这种水的数量。 否则,一定可以匹配到只剩一杯,或匹配完。 - def fillCups2(self, amount: List[int]) -> int: 优先队列模拟 每次取两个最大的消去
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fillCups(self, amount: List[int]) -> int: 贪心 一种是有一种水特别多,那么答案就是这种水的数量。 否则,一定可以匹配到只剩一杯,或匹配完。 - def fillCups2(self, amount: List[int]) -> int: 优先队列模拟 每次取两个最大的消去 <|skeleton|> cl...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def fillCups(self, amount: List[int]) -> int: """贪心 一种是有一种水特别多,那么答案就是这种水的数量。 否则,一定可以匹配到只剩一杯,或匹配完。""" <|body_0|> def fillCups2(self, amount: List[int]) -> int: """优先队列模拟 每次取两个最大的消去""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fillCups(self, amount: List[int]) -> int: """贪心 一种是有一种水特别多,那么答案就是这种水的数量。 否则,一定可以匹配到只剩一杯,或匹配完。""" a, b, c = sorted(amount) if c >= a + b: return c return ceil((a + b + c) / 2) def fillCups2(self, amount: List[int]) -> int: """优先队列模拟 每次取两个最大...
the_stack_v2_python_sparse
12_贪心算法/经典题/倒水问题/6112. 装满杯子需要的最短总时长.py
981377660LMT/algorithm-study
train
225
f28fe9e01812afc15a1270ad7c3b3a355fbf5e1f
[ "dic, q = (['0', '1', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'], [])\nif len(digits) == 0 or not digits:\n return q\nq.append('')\nfor i in range(len(digits)):\n dic_index = int(digits[i])\n while len(q[0]) == i:\n temp = q.pop(0)\n for c in dic[dic_index]:\n q.appe...
<|body_start_0|> dic, q = (['0', '1', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'], []) if len(digits) == 0 or not digits: return q q.append('') for i in range(len(digits)): dic_index = int(digits[i]) while len(q[0]) == i: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def letterCombinations_1(self, digits): """:type digits: str :rtype: List[str]""" <|body_1|> def letterCombinations_2(self, digits): """:type dig...
stack_v2_sparse_classes_36k_train_006451
2,318
no_license
[ { "docstring": ":type digits: str :rtype: List[str]", "name": "letterCombinations", "signature": "def letterCombinations(self, digits)" }, { "docstring": ":type digits: str :rtype: List[str]", "name": "letterCombinations_1", "signature": "def letterCombinations_1(self, digits)" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def letterCombinations_1(self, digits): :type digits: str :rtype: List[str] - def letterCombinations_2...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def letterCombinations_1(self, digits): :type digits: str :rtype: List[str] - def letterCombinations_2...
9d9e0c08992ef7dbd9ac517821faa9de17f49b0e
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def letterCombinations_1(self, digits): """:type digits: str :rtype: List[str]""" <|body_1|> def letterCombinations_2(self, digits): """:type dig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" dic, q = (['0', '1', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'], []) if len(digits) == 0 or not digits: return q q.append('') for i in range(len(digits))...
the_stack_v2_python_sparse
017-letter-combinations-of-a-phone-number.py
floydchenchen/leetcode
train
0
8cb5ee0e7fa87bca8beeb005f6cc9b75065fc694
[ "mile_rule = self.env.ref('metro_park_base_data_10.repair_rule_l')\nfor record in self:\n if record.rule and record.rule.id == mile_rule.id:\n record.is_mile = True", "if len(self) == 0:\n return\nfor record in self:\n if not record.plan_id or not record.dev:\n continue\n pre_date_train_...
<|body_start_0|> mile_rule = self.env.ref('metro_park_base_data_10.repair_rule_l') for record in self: if record.rule and record.rule.id == mile_rule.id: record.is_mile = True <|end_body_0|> <|body_start_1|> if len(self) == 0: return for record in...
日计划设备检修信息,包含计划内容和日常维护及运行内容
RuleInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _compute_is_mile(self): """计算是否为公里数 :return:""" <|body_0|> def _compute_last_repair_info(self): """计算上次里程修信息 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> mile_rule = self.env.ref('metro_...
stack_v2_sparse_classes_36k_train_006452
1,559
no_license
[ { "docstring": "计算是否为公里数 :return:", "name": "_compute_is_mile", "signature": "def _compute_is_mile(self)" }, { "docstring": "计算上次里程修信息 :return:", "name": "_compute_last_repair_info", "signature": "def _compute_last_repair_info(self)" } ]
2
stack_v2_sparse_classes_30k_train_019932
Implement the Python class `RuleInfo` described below. Class description: 日计划设备检修信息,包含计划内容和日常维护及运行内容 Method signatures and docstrings: - def _compute_is_mile(self): 计算是否为公里数 :return: - def _compute_last_repair_info(self): 计算上次里程修信息 :return:
Implement the Python class `RuleInfo` described below. Class description: 日计划设备检修信息,包含计划内容和日常维护及运行内容 Method signatures and docstrings: - def _compute_is_mile(self): 计算是否为公里数 :return: - def _compute_last_repair_info(self): 计算上次里程修信息 :return: <|skeleton|> class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _...
13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9
<|skeleton|> class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _compute_is_mile(self): """计算是否为公里数 :return:""" <|body_0|> def _compute_last_repair_info(self): """计算上次里程修信息 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _compute_is_mile(self): """计算是否为公里数 :return:""" mile_rule = self.env.ref('metro_park_base_data_10.repair_rule_l') for record in self: if record.rule and record.rule.id == mile_rule.id: record.is_mile = True...
the_stack_v2_python_sparse
mdias_addons/metro_park_base_data_10/models/plan_date_rule_info.py
rezaghanimi/main_mdias
train
0
b94ee346b3b81a27026c223ab788ae242b99f3fd
[ "parser.add_argument('BOMName', type=str, help='Provide a BillOfMaterial Name which was used for Asset')\nparser.add_argument('Quantity', type=int, help='Number of Asset to be created')\nparser.add_argument('ProductName', type=str, help='Provide a Product Name')\nparser.add_argument('WarehouseName', type=str, help=...
<|body_start_0|> parser.add_argument('BOMName', type=str, help='Provide a BillOfMaterial Name which was used for Asset') parser.add_argument('Quantity', type=int, help='Number of Asset to be created') parser.add_argument('ProductName', type=str, help='Provide a Product Name') parser.add_...
.
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """.""" def add_arguments(self, parser): """Mandatory Arguments.""" <|body_0|> def handle(self, *args, **options): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> parser.add_argument('BOMName', type=str, help='Provide a BillOfMater...
stack_v2_sparse_classes_36k_train_006453
3,898
no_license
[ { "docstring": "Mandatory Arguments.", "name": "add_arguments", "signature": "def add_arguments(self, parser)" }, { "docstring": ".", "name": "handle", "signature": "def handle(self, *args, **options)" } ]
2
stack_v2_sparse_classes_30k_train_018505
Implement the Python class `Command` described below. Class description: . Method signatures and docstrings: - def add_arguments(self, parser): Mandatory Arguments. - def handle(self, *args, **options): .
Implement the Python class `Command` described below. Class description: . Method signatures and docstrings: - def add_arguments(self, parser): Mandatory Arguments. - def handle(self, *args, **options): . <|skeleton|> class Command: """.""" def add_arguments(self, parser): """Mandatory Arguments."""...
0c9c041624b1133d04c0389a9270140b68c10b21
<|skeleton|> class Command: """.""" def add_arguments(self, parser): """Mandatory Arguments.""" <|body_0|> def handle(self, *args, **options): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: """.""" def add_arguments(self, parser): """Mandatory Arguments.""" parser.add_argument('BOMName', type=str, help='Provide a BillOfMaterial Name which was used for Asset') parser.add_argument('Quantity', type=int, help='Number of Asset to be created') parser.add_a...
the_stack_v2_python_sparse
aims/inventory/management/commands/create_assets.py
anmolsrivastava18/ERP_Repository
train
0
bc4609361c3cf4afec0a8f65fa06c956c45e5ba2
[ "self.x = array_check(x)\nself.y = array_check(y)\nself._coef = None\nself._intercept = None\nself._pvalues = None\nself._f_statistics = None\nself._r_squared = None\nself.__m = OLS(self.y, sm.add_constant(self.x))", "result = self.__m.fit()\nself._intercept, *self._coef = result.params\nself._pvalues = result.f_...
<|body_start_0|> self.x = array_check(x) self.y = array_check(y) self._coef = None self._intercept = None self._pvalues = None self._f_statistics = None self._r_squared = None self.__m = OLS(self.y, sm.add_constant(self.x)) <|end_body_0|> <|body_start_1|>...
Linear regression for single variable or multi-variable.
LinearRegression
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearRegression: """Linear regression for single variable or multi-variable.""" def __init__(self, x: array_like, y: array_like) -> None: """:param x: array_like N-D array with (n-sample, n-feature) :param y: array_like""" <|body_0|> def fit(self) -> LinearRegressionPar...
stack_v2_sparse_classes_36k_train_006454
4,947
no_license
[ { "docstring": ":param x: array_like N-D array with (n-sample, n-feature) :param y: array_like", "name": "__init__", "signature": "def __init__(self, x: array_like, y: array_like) -> None" }, { "docstring": "Fit the self.x and self.y, then get fitting params. :return: class LinearRegressionParam...
4
stack_v2_sparse_classes_30k_test_000734
Implement the Python class `LinearRegression` described below. Class description: Linear regression for single variable or multi-variable. Method signatures and docstrings: - def __init__(self, x: array_like, y: array_like) -> None: :param x: array_like N-D array with (n-sample, n-feature) :param y: array_like - def ...
Implement the Python class `LinearRegression` described below. Class description: Linear regression for single variable or multi-variable. Method signatures and docstrings: - def __init__(self, x: array_like, y: array_like) -> None: :param x: array_like N-D array with (n-sample, n-feature) :param y: array_like - def ...
1c8d5fbf3676dc81e9f143e93ee2564359519b11
<|skeleton|> class LinearRegression: """Linear regression for single variable or multi-variable.""" def __init__(self, x: array_like, y: array_like) -> None: """:param x: array_like N-D array with (n-sample, n-feature) :param y: array_like""" <|body_0|> def fit(self) -> LinearRegressionPar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearRegression: """Linear regression for single variable or multi-variable.""" def __init__(self, x: array_like, y: array_like) -> None: """:param x: array_like N-D array with (n-sample, n-feature) :param y: array_like""" self.x = array_check(x) self.y = array_check(y) s...
the_stack_v2_python_sparse
statistics/regression.py
qliu0/PythonInAirSeaScience
train
0
c3ae9ba7ad2c5c3460f2bb4e281835bf267f2ef8
[ "np.random.seed(6589)\nn = 100\ndtypes = [np.float32, np.float64]\nfor dtype in dtypes:\n volatilities = np.exp(np.random.randn(n) / 2)\n forwards = np.exp(np.random.randn(n))\n strikes = forwards * (1 + (np.random.rand(n) - 0.5) * 0.2)\n expiries = np.exp(np.random.randn(n))\n prices = self.evaluate...
<|body_start_0|> np.random.seed(6589) n = 100 dtypes = [np.float32, np.float64] for dtype in dtypes: volatilities = np.exp(np.random.randn(n) / 2) forwards = np.exp(np.random.randn(n)) strikes = forwards * (1 + (np.random.rand(n) - 0.5) * 0.2) ...
Tests for methods in implied_vol module.
ImpliedVolTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImpliedVolTest: """Tests for methods in implied_vol module.""" def test_implied_vol(self): """Basic test of the implied vol calculation.""" <|body_0|> def test_validate(self): """Test the algorithm doesn't raise where it shouldn't.""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_006455
4,993
permissive
[ { "docstring": "Basic test of the implied vol calculation.", "name": "test_implied_vol", "signature": "def test_implied_vol(self)" }, { "docstring": "Test the algorithm doesn't raise where it shouldn't.", "name": "test_validate", "signature": "def test_validate(self)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_007992
Implement the Python class `ImpliedVolTest` described below. Class description: Tests for methods in implied_vol module. Method signatures and docstrings: - def test_implied_vol(self): Basic test of the implied vol calculation. - def test_validate(self): Test the algorithm doesn't raise where it shouldn't. - def test...
Implement the Python class `ImpliedVolTest` described below. Class description: Tests for methods in implied_vol module. Method signatures and docstrings: - def test_implied_vol(self): Basic test of the implied vol calculation. - def test_validate(self): Test the algorithm doesn't raise where it shouldn't. - def test...
0d3a2193c0f2d320b65e602cf01d7a617da484df
<|skeleton|> class ImpliedVolTest: """Tests for methods in implied_vol module.""" def test_implied_vol(self): """Basic test of the implied vol calculation.""" <|body_0|> def test_validate(self): """Test the algorithm doesn't raise where it shouldn't.""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImpliedVolTest: """Tests for methods in implied_vol module.""" def test_implied_vol(self): """Basic test of the implied vol calculation.""" np.random.seed(6589) n = 100 dtypes = [np.float32, np.float64] for dtype in dtypes: volatilities = np.exp(np.rand...
the_stack_v2_python_sparse
tf_quant_finance/black_scholes/implied_vol_lib_test.py
google/tf-quant-finance
train
4,165
b91ee64dc7ee589c7c29bce5a64d50805a82521a
[ "if 'SF' in user_id:\n res = assoc_db.read_one_associate_by_query({'salesforce_id': user_id})\nelse:\n res = assoc_db.read_one_associate_by_query({'email': user_id})\nif res['swot']:\n for swot in res['swot']:\n swot['date_created'] = converter(swot['date_created'])\nelse:\n res['swot'] = [{'auth...
<|body_start_0|> if 'SF' in user_id: res = assoc_db.read_one_associate_by_query({'salesforce_id': user_id}) else: res = assoc_db.read_one_associate_by_query({'email': user_id}) if res['swot']: for swot in res['swot']: swot['date_created'] = con...
Class for routing employee/user_id requests
EmployeeIdRoute
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmployeeIdRoute: """Class for routing employee/user_id requests""" def get(self, user_id): """Retrieves associate information for a designated associate vai salesforce id or email""" <|body_0|> def post(self, user_id): """Adds a SWOT to a designated associate via...
stack_v2_sparse_classes_36k_train_006456
4,872
no_license
[ { "docstring": "Retrieves associate information for a designated associate vai salesforce id or email", "name": "get", "signature": "def get(self, user_id)" }, { "docstring": "Adds a SWOT to a designated associate via their salesforce id or email", "name": "post", "signature": "def post(...
2
stack_v2_sparse_classes_30k_val_000211
Implement the Python class `EmployeeIdRoute` described below. Class description: Class for routing employee/user_id requests Method signatures and docstrings: - def get(self, user_id): Retrieves associate information for a designated associate vai salesforce id or email - def post(self, user_id): Adds a SWOT to a des...
Implement the Python class `EmployeeIdRoute` described below. Class description: Class for routing employee/user_id requests Method signatures and docstrings: - def get(self, user_id): Retrieves associate information for a designated associate vai salesforce id or email - def post(self, user_id): Adds a SWOT to a des...
d376039c1d08f573fde536978ffce0e44a05922c
<|skeleton|> class EmployeeIdRoute: """Class for routing employee/user_id requests""" def get(self, user_id): """Retrieves associate information for a designated associate vai salesforce id or email""" <|body_0|> def post(self, user_id): """Adds a SWOT to a designated associate via...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmployeeIdRoute: """Class for routing employee/user_id requests""" def get(self, user_id): """Retrieves associate information for a designated associate vai salesforce id or email""" if 'SF' in user_id: res = assoc_db.read_one_associate_by_query({'salesforce_id': user_id}) ...
the_stack_v2_python_sparse
src/router/employees.py
revaturelabs/csm-backend
train
2
03edae5b99f73df1fc223201f5dc6c2e4b64d227
[ "file_id = self.get_argument('file_id', default=None)\nchunk = self.get_argument('chunk', default=None)\nverify = self.get_argument('verify', default='').lower() == 'true'\nif file_id is None:\n raise ValueError('Cannot fetch a file or chunk without a file ID.')\nresponse = await self.client(Operation(operation_...
<|body_start_0|> file_id = self.get_argument('file_id', default=None) chunk = self.get_argument('chunk', default=None) verify = self.get_argument('verify', default='').lower() == 'true' if file_id is None: raise ValueError('Cannot fetch a file or chunk without a file ID.') ...
FileChunkAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileChunkAPI: async def get(self): """--- summary: Retrieve a File or FileChunk parameters: - name: file_id in: query required: true description: The ID of the file type: string - name: chunk in: query required: false description: The chunk number requested type: integer - name: verify i...
stack_v2_sparse_classes_36k_train_006457
8,203
permissive
[ { "docstring": "--- summary: Retrieve a File or FileChunk parameters: - name: file_id in: query required: true description: The ID of the file type: string - name: chunk in: query required: false description: The chunk number requested type: integer - name: verify in: query required: false description: Flag tha...
3
null
Implement the Python class `FileChunkAPI` described below. Class description: Implement the FileChunkAPI class. Method signatures and docstrings: - async def get(self): --- summary: Retrieve a File or FileChunk parameters: - name: file_id in: query required: true description: The ID of the file type: string - name: c...
Implement the Python class `FileChunkAPI` described below. Class description: Implement the FileChunkAPI class. Method signatures and docstrings: - async def get(self): --- summary: Retrieve a File or FileChunk parameters: - name: file_id in: query required: true description: The ID of the file type: string - name: c...
a5fd2dcc2444409e243d3fdaa43d86695e5cb142
<|skeleton|> class FileChunkAPI: async def get(self): """--- summary: Retrieve a File or FileChunk parameters: - name: file_id in: query required: true description: The ID of the file type: string - name: chunk in: query required: false description: The chunk number requested type: integer - name: verify i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileChunkAPI: async def get(self): """--- summary: Retrieve a File or FileChunk parameters: - name: file_id in: query required: true description: The ID of the file type: string - name: chunk in: query required: false description: The chunk number requested type: integer - name: verify in: query requi...
the_stack_v2_python_sparse
src/app/beer_garden/api/http/handlers/vbeta/chunk.py
beer-garden/beer-garden
train
254
4211e47e5d84f2f86018686a325dc62e4fb52e08
[ "global DCHECKER\nself.groups = 0\nself.dictgroups = []\ncheckdict = CHECK_DICT_OBRACKET.search(istring)\nif checkdict:\n if not DCHECKER:\n import alt_hunspell\n DCHECKER = alt_hunspell.Hunspell()\n brcheck = OPEN_BRACKET.search(istring, 0)\n i = 0\n while brcheck:\n start = brchec...
<|body_start_0|> global DCHECKER self.groups = 0 self.dictgroups = [] checkdict = CHECK_DICT_OBRACKET.search(istring) if checkdict: if not DCHECKER: import alt_hunspell DCHECKER = alt_hunspell.Hunspell() brcheck = OPEN_BRACK...
Matching part of P2P rule.
Condition
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Condition: """Matching part of P2P rule.""" def __init__(self, istring, flags): """Create an instance of P2P condition.""" <|body_0|> def finditer(self, iline): """Return all possible matches of condition of given rule.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_006458
17,033
permissive
[ { "docstring": "Create an instance of P2P condition.", "name": "__init__", "signature": "def __init__(self, istring, flags)" }, { "docstring": "Return all possible matches of condition of given rule.", "name": "finditer", "signature": "def finditer(self, iline)" } ]
2
stack_v2_sparse_classes_30k_train_007491
Implement the Python class `Condition` described below. Class description: Matching part of P2P rule. Method signatures and docstrings: - def __init__(self, istring, flags): Create an instance of P2P condition. - def finditer(self, iline): Return all possible matches of condition of given rule.
Implement the Python class `Condition` described below. Class description: Matching part of P2P rule. Method signatures and docstrings: - def __init__(self, istring, flags): Create an instance of P2P condition. - def finditer(self, iline): Return all possible matches of condition of given rule. <|skeleton|> class Co...
ac645fb41260b86491b17fbc50e5ea3300dc28b7
<|skeleton|> class Condition: """Matching part of P2P rule.""" def __init__(self, istring, flags): """Create an instance of P2P condition.""" <|body_0|> def finditer(self, iline): """Return all possible matches of condition of given rule.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Condition: """Matching part of P2P rule.""" def __init__(self, istring, flags): """Create an instance of P2P condition.""" global DCHECKER self.groups = 0 self.dictgroups = [] checkdict = CHECK_DICT_OBRACKET.search(istring) if checkdict: if not ...
the_stack_v2_python_sparse
scripts/lib/python/ld/p2p.py
WladimirSidorenko/TextNormalization
train
1
1c4e2fd34033973c51d13e82d5ea3f5609ce3716
[ "try:\n return EnvironmentInstanceProduct.objects.get(pk=pk)\nexcept EnvironmentInstanceProduct.DoesNotExist:\n raise Http404", "env_product = self.get_object(pk)\nserializer = EnvironmentInstanceProductSerializer(env_product)\nreturn Response(serializer.data)", "env_product = self.get_object(pk)\nseriali...
<|body_start_0|> try: return EnvironmentInstanceProduct.objects.get(pk=pk) except EnvironmentInstanceProduct.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> env_product = self.get_object(pk) serializer = EnvironmentInstanceProductSerializer(env_produc...
Retrieve, update or delete a EnvironmentInstanceProduct instance.
EnvironmentInstanceProductDetails
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentInstanceProductDetails: """Retrieve, update or delete a EnvironmentInstanceProduct instance.""" def get_object(self, pk): """Get the particular row from the table.""" <|body_0|> def get(self, request, pk, format=None): """We are going to add the contac...
stack_v2_sparse_classes_36k_train_006459
15,222
permissive
[ { "docstring": "Get the particular row from the table.", "name": "get_object", "signature": "def get_object(self, pk)" }, { "docstring": "We are going to add the contact info content along with this pull request", "name": "get", "signature": "def get(self, request, pk, format=None)" },...
4
stack_v2_sparse_classes_30k_train_009373
Implement the Python class `EnvironmentInstanceProductDetails` described below. Class description: Retrieve, update or delete a EnvironmentInstanceProduct instance. Method signatures and docstrings: - def get_object(self, pk): Get the particular row from the table. - def get(self, request, pk, format=None): We are go...
Implement the Python class `EnvironmentInstanceProductDetails` described below. Class description: Retrieve, update or delete a EnvironmentInstanceProduct instance. Method signatures and docstrings: - def get_object(self, pk): Get the particular row from the table. - def get(self, request, pk, format=None): We are go...
b0635e72338e14dad24f1ee0329212cd60a3e83a
<|skeleton|> class EnvironmentInstanceProductDetails: """Retrieve, update or delete a EnvironmentInstanceProduct instance.""" def get_object(self, pk): """Get the particular row from the table.""" <|body_0|> def get(self, request, pk, format=None): """We are going to add the contac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvironmentInstanceProductDetails: """Retrieve, update or delete a EnvironmentInstanceProduct instance.""" def get_object(self, pk): """Get the particular row from the table.""" try: return EnvironmentInstanceProduct.objects.get(pk=pk) except EnvironmentInstanceProduct...
the_stack_v2_python_sparse
environment/views.py
faisaltheparttimecoder/carelogBackend
train
1
abf103845299e7eb8edd6df81b7b2244f466e5d9
[ "tf.reset_default_graph()\noptim = tf.train.GradientDescentOptimizer(0.001)\nglobal_step = tf.train.get_or_create_global_step()\nsparse_optim = sparse_optimizers.SparseRigLOptimizer(optim, start_iter, end_iter, freq_iter, drop_fraction=drop_frac)\nx = tf.ones((1, n_inp))\ny = layers.masked_fully_connected(x, n_out,...
<|body_start_0|> tf.reset_default_graph() optim = tf.train.GradientDescentOptimizer(0.001) global_step = tf.train.get_or_create_global_step() sparse_optim = sparse_optimizers.SparseRigLOptimizer(optim, start_iter, end_iter, freq_iter, drop_fraction=drop_frac) x = tf.ones((1, n_in...
SparseRigLOptimizerTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseRigLOptimizerTest: def _setup_graph(self, n_inp, n_out, drop_frac, start_iter=1, end_iter=4, freq_iter=2): """Setups a trivial training procedure for sparse training.""" <|body_0|> def testMaskedGradientCalculation(self, n_inp, n_out): """Checking whether maske...
stack_v2_sparse_classes_36k_train_006460
25,606
permissive
[ { "docstring": "Setups a trivial training procedure for sparse training.", "name": "_setup_graph", "signature": "def _setup_graph(self, n_inp, n_out, drop_frac, start_iter=1, end_iter=4, freq_iter=2)" }, { "docstring": "Checking whether masked_grad is calculated after apply_gradients.", "nam...
3
null
Implement the Python class `SparseRigLOptimizerTest` described below. Class description: Implement the SparseRigLOptimizerTest class. Method signatures and docstrings: - def _setup_graph(self, n_inp, n_out, drop_frac, start_iter=1, end_iter=4, freq_iter=2): Setups a trivial training procedure for sparse training. - d...
Implement the Python class `SparseRigLOptimizerTest` described below. Class description: Implement the SparseRigLOptimizerTest class. Method signatures and docstrings: - def _setup_graph(self, n_inp, n_out, drop_frac, start_iter=1, end_iter=4, freq_iter=2): Setups a trivial training procedure for sparse training. - d...
d39fc7d46505cb3196cb1edeb32ed0b6dd44c0f9
<|skeleton|> class SparseRigLOptimizerTest: def _setup_graph(self, n_inp, n_out, drop_frac, start_iter=1, end_iter=4, freq_iter=2): """Setups a trivial training procedure for sparse training.""" <|body_0|> def testMaskedGradientCalculation(self, n_inp, n_out): """Checking whether maske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseRigLOptimizerTest: def _setup_graph(self, n_inp, n_out, drop_frac, start_iter=1, end_iter=4, freq_iter=2): """Setups a trivial training procedure for sparse training.""" tf.reset_default_graph() optim = tf.train.GradientDescentOptimizer(0.001) global_step = tf.train.get_o...
the_stack_v2_python_sparse
rigl/sparse_optimizers_test.py
google-research/rigl
train
324
df878db7dd510848d81e27e3642e20ab691b3cc3
[ "self.config = {}\nself.config['db'] = {}\nself.config['db']['host'] = 'web40'\nself.config['db']['port'] = 27017\nself.config['db']['db'] = 'd4dchallenge'\nself.config['db']['collection'] = 'traces'\nself.traces = self.__get_collection(self.config)", "connection = Connection(config['db']['host'], config['db']['p...
<|body_start_0|> self.config = {} self.config['db'] = {} self.config['db']['host'] = 'web40' self.config['db']['port'] = 27017 self.config['db']['db'] = 'd4dchallenge' self.config['db']['collection'] = 'traces' self.traces = self.__get_collection(self.config) <|en...
SpaceTemporalModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpaceTemporalModel: def __init__(self): """Load and retieve collection pointer from MongoDB""" <|body_0|> def __get_collection(self, config): """Return collection from MongoDB with a specific configuration""" <|body_1|> def retieve_data_and_create_model(...
stack_v2_sparse_classes_36k_train_006461
5,480
no_license
[ { "docstring": "Load and retieve collection pointer from MongoDB", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return collection from MongoDB with a specific configuration", "name": "__get_collection", "signature": "def __get_collection(self, config)" }, ...
5
stack_v2_sparse_classes_30k_train_006233
Implement the Python class `SpaceTemporalModel` described below. Class description: Implement the SpaceTemporalModel class. Method signatures and docstrings: - def __init__(self): Load and retieve collection pointer from MongoDB - def __get_collection(self, config): Return collection from MongoDB with a specific conf...
Implement the Python class `SpaceTemporalModel` described below. Class description: Implement the SpaceTemporalModel class. Method signatures and docstrings: - def __init__(self): Load and retieve collection pointer from MongoDB - def __get_collection(self, config): Return collection from MongoDB with a specific conf...
86ebaf8382327d4e982916fc3bf83b189ecdb138
<|skeleton|> class SpaceTemporalModel: def __init__(self): """Load and retieve collection pointer from MongoDB""" <|body_0|> def __get_collection(self, config): """Return collection from MongoDB with a specific configuration""" <|body_1|> def retieve_data_and_create_model(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpaceTemporalModel: def __init__(self): """Load and retieve collection pointer from MongoDB""" self.config = {} self.config['db'] = {} self.config['db']['host'] = 'web40' self.config['db']['port'] = 27017 self.config['db']['db'] = 'd4dchallenge' self.con...
the_stack_v2_python_sparse
service/space_temporal.py
sjsnjnu/d4d-challenge
train
0
a60a9d1d7b4bed0bfd34ee413200b467037d3910
[ "self.backoff = backoff\nself.random_jitter_range = random_jitter_range\nsuper(LinearRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs)", "random_generator = random.Random()\nrandom_range_start = self.backoff - self.random_jitter_range if self.backoff > self.random_jit...
<|body_start_0|> self.backoff = backoff self.random_jitter_range = random_jitter_range super(LinearRetry, self).__init__(retry_total=retry_total, retry_to_secondary=retry_to_secondary, **kwargs) <|end_body_0|> <|body_start_1|> random_generator = random.Random() random_range_star...
Linear retry.
LinearRetry
[ "MIT", "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearRetry: """Linear retry.""" def __init__(self, backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): """Constructs a Linear retry object. :param int backoff: The backoff interval, in seconds, between retries. :param int max_attempts: The maximum ...
stack_v2_sparse_classes_36k_train_006462
26,717
permissive
[ { "docstring": "Constructs a Linear retry object. :param int backoff: The backoff interval, in seconds, between retries. :param int max_attempts: The maximum number of retry attempts. :param bool retry_to_secondary: Whether the request should be retried to secondary, if able. This should only be enabled of RA-G...
2
stack_v2_sparse_classes_30k_train_002708
Implement the Python class `LinearRetry` described below. Class description: Linear retry. Method signatures and docstrings: - def __init__(self, backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): Constructs a Linear retry object. :param int backoff: The backoff interval, in second...
Implement the Python class `LinearRetry` described below. Class description: Linear retry. Method signatures and docstrings: - def __init__(self, backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): Constructs a Linear retry object. :param int backoff: The backoff interval, in second...
c2ca191e736bb06bfbbbc9493e8325763ba990bb
<|skeleton|> class LinearRetry: """Linear retry.""" def __init__(self, backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): """Constructs a Linear retry object. :param int backoff: The backoff interval, in seconds, between retries. :param int max_attempts: The maximum ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearRetry: """Linear retry.""" def __init__(self, backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs): """Constructs a Linear retry object. :param int backoff: The backoff interval, in seconds, between retries. :param int max_attempts: The maximum number of ret...
the_stack_v2_python_sparse
sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/storage/blob/_shared/policies.py
Azure/azure-sdk-for-python
train
4,046
ceb8d0980c5ba00bd956b4737d89408705ef3e63
[ "assert Q.shape == (4,), Q\nw, x, y, z = Q\nxx = x * x\nxy = x * y\nyy = y * y\nxz = x * z\nyz = y * z\nzz = z * z\nxw = x * w\nyw = y * w\nzw = z * w\nreturn np.array([[1 - 2 * (yy + zz), 2 * (xy + zw), 2 * (xz - yw)], [2 * (xy - zw), 1 - 2 * (xx + zz), 2 * (yz + xw)], [2 * (xz + yw), 2 * (yz - xw), 1 - 2 * (xx + ...
<|body_start_0|> assert Q.shape == (4,), Q w, x, y, z = Q xx = x * x xy = x * y yy = y * y xz = x * z yz = y * z zz = z * z xw = x * w yw = y * w zw = z * w return np.array([[1 - 2 * (yy + zz), 2 * (xy + zw), 2 * (xz - yw)],...
WXYZ
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WXYZ: def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.""" <|body_0|> def from_rotation_matrix(R: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/m...
stack_v2_sparse_classes_36k_train_006463
10,562
no_license
[ { "docstring": "See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.", "name": "to_rotation_matrix", "signature": "def to_rotation_matrix(Q: np.ndarray) -> np.ndarray" }, { "docstring": "See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q55 Note: ...
2
stack_v2_sparse_classes_30k_train_015316
Implement the Python class `WXYZ` described below. Class description: Implement the WXYZ class. Method signatures and docstrings: - def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major. - def from_rotation_matrix(R: np.nd...
Implement the Python class `WXYZ` described below. Class description: Implement the WXYZ class. Method signatures and docstrings: - def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major. - def from_rotation_matrix(R: np.nd...
bac774e1f7b3131f559ee3ff1662836c424ebaa5
<|skeleton|> class WXYZ: def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.""" <|body_0|> def from_rotation_matrix(R: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WXYZ: def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.""" assert Q.shape == (4,), Q w, x, y, z = Q xx = x * x xy = x * y yy = y * y xz = x * z ...
the_stack_v2_python_sparse
src/ie/meshroomy.py
laurelkeys/ff
train
1
58483fd26ded2eef48506baf01f41c8d30f8086e
[ "super().__init__(env_spec)\nself.state_des = state_des\nself.limit_rad = 0.5236\nself.kp_servo = 14.0\nself.Kp, self.Kd = (None, None)\nself.init_param(kp, kd)", "th_x, th_y, x, y, _, _, x_dot, y_dot = obs\nerr = to.tensor([self.state_des[0] - x, self.state_des[1] - y])\nerr_dot = to.tensor([0.0 - x_dot, 0.0 - y...
<|body_start_0|> super().__init__(env_spec) self.state_des = state_des self.limit_rad = 0.5236 self.kp_servo = 14.0 self.Kp, self.Kd = (None, None) self.init_param(kp, kd) <|end_body_0|> <|body_start_1|> th_x, th_y, x, y, _, _, x_dot, y_dot = obs err = to...
PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`.
QBallBalancerPDCtrl
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QBallBalancerPDCtrl: """PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`....
stack_v2_sparse_classes_36k_train_006464
25,612
permissive
[ { "docstring": "Constructor :param env_spec: environment specification :param state_des: tensor of desired x and y ball position [m] :param kp: 2x2 tensor of constant controller feedback coefficients for error [V/m] :param kd: 2x2 tensor of constant controller feedback coefficients for error time derivative [Vs...
4
stack_v2_sparse_classes_30k_train_002467
Implement the Python class `QBallBalancerPDCtrl` described below. Class description: PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado...
Implement the Python class `QBallBalancerPDCtrl` described below. Class description: PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado...
a6c982862e2ab39a9f65d1c09aa59d9a8b7ac6c5
<|skeleton|> class QBallBalancerPDCtrl: """PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QBallBalancerPDCtrl: """PD-controller for the Quanser Ball Balancer. The only but significant difference of this controller to the other PD controller is the clipping of the actions. .. note:: This class's desired state specification deviates from the Pyrado policies which interact with a `Task`.""" def ...
the_stack_v2_python_sparse
Pyrado/pyrado/policies/environment_specific.py
jacarvalho/SimuRLacra
train
0
da693becd45b726478b01c075df233acff71672f
[ "self.current_dir = os.getcwd()\nnow = datetime.now().strftime('%I%p_%m_%d_%Y')\ntest_name = self.__class__.__name__\nself.tempdir = '{}_{}'.format(test_name, now)\nif not os.path.isdir(self.tempdir):\n os.mkdir(self.tempdir)\nos.chdir(self.tempdir)\nopen('test.pdb', 'w').write(test_pdb_str)", "params_phil = i...
<|body_start_0|> self.current_dir = os.getcwd() now = datetime.now().strftime('%I%p_%m_%d_%Y') test_name = self.__class__.__name__ self.tempdir = '{}_{}'.format(test_name, now) if not os.path.isdir(self.tempdir): os.mkdir(self.tempdir) os.chdir(self.tempdir) ...
TestPDBinterpretationNCSSearch
[ "BSD-3-Clause-LBNL", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPDBinterpretationNCSSearch: def setUp(self): """Create temporary folder for temp files produced during test""" <|body_0|> def test_calling_pdb_interpretation(self): """Make sure can create NCS object and change search parameters""" <|body_1|> def tea...
stack_v2_sparse_classes_36k_train_006465
6,330
permissive
[ { "docstring": "Create temporary folder for temp files produced during test", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Make sure can create NCS object and change search parameters", "name": "test_calling_pdb_interpretation", "signature": "def test_calling_pdb_in...
3
stack_v2_sparse_classes_30k_train_018492
Implement the Python class `TestPDBinterpretationNCSSearch` described below. Class description: Implement the TestPDBinterpretationNCSSearch class. Method signatures and docstrings: - def setUp(self): Create temporary folder for temp files produced during test - def test_calling_pdb_interpretation(self): Make sure ca...
Implement the Python class `TestPDBinterpretationNCSSearch` described below. Class description: Implement the TestPDBinterpretationNCSSearch class. Method signatures and docstrings: - def setUp(self): Create temporary folder for temp files produced during test - def test_calling_pdb_interpretation(self): Make sure ca...
77d66c719b5746f37af51ad593e2941ed6fbba17
<|skeleton|> class TestPDBinterpretationNCSSearch: def setUp(self): """Create temporary folder for temp files produced during test""" <|body_0|> def test_calling_pdb_interpretation(self): """Make sure can create NCS object and change search parameters""" <|body_1|> def tea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPDBinterpretationNCSSearch: def setUp(self): """Create temporary folder for temp files produced during test""" self.current_dir = os.getcwd() now = datetime.now().strftime('%I%p_%m_%d_%Y') test_name = self.__class__.__name__ self.tempdir = '{}_{}'.format(test_name, ...
the_stack_v2_python_sparse
modules/cctbx_project/mmtbx/monomer_library/tst_pdb_interpretation_ncs_processing.py
jorgediazjr/dials-dev20191018
train
0
aa876ff752c87ba050211cd7def0415b28d91afb
[ "super(MulticastRange, self).__init__()\nself.schema_class = 'vsm_multicast_range_schema.MulticastRangeSchema'\nself.set_connection(vsm.get_connection())\nif scope is None or scope is '':\n self.set_create_endpoint('/vdn/config/multicasts')\nelse:\n self.set_create_endpoint('/vdn/config/multicasts?isUniversal...
<|body_start_0|> super(MulticastRange, self).__init__() self.schema_class = 'vsm_multicast_range_schema.MulticastRangeSchema' self.set_connection(vsm.get_connection()) if scope is None or scope is '': self.set_create_endpoint('/vdn/config/multicasts') else: ...
MulticastRange
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MulticastRange: def __init__(self, vsm=None, scope=None): """Constructor to create MulticastRange managed object @param vsm : vsm object on which this managed object needs to be configured""" <|body_0|> def create(self, schema_object): """Creates multicast range with...
stack_v2_sparse_classes_36k_train_006466
1,989
no_license
[ { "docstring": "Constructor to create MulticastRange managed object @param vsm : vsm object on which this managed object needs to be configured", "name": "__init__", "signature": "def __init__(self, vsm=None, scope=None)" }, { "docstring": "Creates multicast range with specified parameters @para...
2
stack_v2_sparse_classes_30k_val_000803
Implement the Python class `MulticastRange` described below. Class description: Implement the MulticastRange class. Method signatures and docstrings: - def __init__(self, vsm=None, scope=None): Constructor to create MulticastRange managed object @param vsm : vsm object on which this managed object needs to be configu...
Implement the Python class `MulticastRange` described below. Class description: Implement the MulticastRange class. Method signatures and docstrings: - def __init__(self, vsm=None, scope=None): Constructor to create MulticastRange managed object @param vsm : vsm object on which this managed object needs to be configu...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class MulticastRange: def __init__(self, vsm=None, scope=None): """Constructor to create MulticastRange managed object @param vsm : vsm object on which this managed object needs to be configured""" <|body_0|> def create(self, schema_object): """Creates multicast range with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MulticastRange: def __init__(self, vsm=None, scope=None): """Constructor to create MulticastRange managed object @param vsm : vsm object on which this managed object needs to be configured""" super(MulticastRange, self).__init__() self.schema_class = 'vsm_multicast_range_schema.Multica...
the_stack_v2_python_sparse
SystemTesting/pylib/nsx/vsm/multicast_range/vsm_multicast_range.py
Cloudxtreme/MyProject
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_36k_train_006467
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_016555
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_36k
data/stack_v2_sparse_classes_30k
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
b9888866f41fdf12510ca8e7a4c80074023b3009
[ "super().__init__(model_type, task, **kwargs)\nself.nb_classes = None\nself.set_task(task)", "if type(task) != thelper.tasks.Classification:\n raise AssertionError(\"task passed to ExternalClassifModule should be 'thelper.tasks.Classification'\")\nself.nb_classes = len(self.task.class_names)\nimport torchvisio...
<|body_start_0|> super().__init__(model_type, task, **kwargs) self.nb_classes = None self.set_task(task) <|end_body_0|> <|body_start_1|> if type(task) != thelper.tasks.Classification: raise AssertionError("task passed to ExternalClassifModule should be 'thelper.tasks.Classif...
External model interface specialization for classification tasks. This interface will try to 'rewire' the last fully connected layer of the models it instantiates to match the number of classes to predict defined in the task object. .. seealso:: | :class:`thelper.nn.utils.Module` | :class:`thelper.nn.utils.ExternalModu...
ExternalClassifModule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalClassifModule: """External model interface specialization for classification tasks. This interface will try to 'rewire' the last fully connected layer of the models it instantiates to match the number of classes to predict defined in the task object. .. seealso:: | :class:`thelper.nn.util...
stack_v2_sparse_classes_36k_train_006468
22,198
permissive
[ { "docstring": "Receives a task object to hold internally for model specialization, and tries to rewire the last 'fc' layer.", "name": "__init__", "signature": "def __init__(self, model_type, task, **kwargs)" }, { "docstring": "Rewires the last fully connected layer of the wrapped network to fit...
2
null
Implement the Python class `ExternalClassifModule` described below. Class description: External model interface specialization for classification tasks. This interface will try to 'rewire' the last fully connected layer of the models it instantiates to match the number of classes to predict defined in the task object....
Implement the Python class `ExternalClassifModule` described below. Class description: External model interface specialization for classification tasks. This interface will try to 'rewire' the last fully connected layer of the models it instantiates to match the number of classes to predict defined in the task object....
d91c50d4e3755c4779ef882967519aaa9d863ff4
<|skeleton|> class ExternalClassifModule: """External model interface specialization for classification tasks. This interface will try to 'rewire' the last fully connected layer of the models it instantiates to match the number of classes to predict defined in the task object. .. seealso:: | :class:`thelper.nn.util...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExternalClassifModule: """External model interface specialization for classification tasks. This interface will try to 'rewire' the last fully connected layer of the models it instantiates to match the number of classes to predict defined in the task object. .. seealso:: | :class:`thelper.nn.utils.Module` | :...
the_stack_v2_python_sparse
thelper/nn/utils.py
plstcharles/thelper
train
19
4b8ddb08bbed17e2a90d22dd97820c76448f25ca
[ "if n == 0 or n == 1:\n return n\nsum = 0\nfor i in range(1, n + 1):\n sum += self.numTrees(i - 1) + self.numTrees(n - i)\nreturn sum", "if n == 0 or n == 1:\n return 1\nsum = 0\nfor i in range(1, n + 1):\n sum += self.numTrees(i - 1) * self.numTrees(n - i)\nreturn sum", "if n in self.result:\n r...
<|body_start_0|> if n == 0 or n == 1: return n sum = 0 for i in range(1, n + 1): sum += self.numTrees(i - 1) + self.numTrees(n - i) return sum <|end_body_0|> <|body_start_1|> if n == 0 or n == 1: return 1 sum = 0 for i in range...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees(self, n): """:type n: int :rtype: int""" <|body_1|> def numTrees(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_006469
909
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numTrees", "signature": "def numTrees(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numTrees", "signature": "def numTrees(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numTrees", "si...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees(self, n): :type n: int :rtype: int - def numTrees(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees(self, n): :type n: int :rtype: int - def numTrees(self, n): :type n: int :rtype: int <|skeleton|> class Solution: ...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees(self, n): """:type n: int :rtype: int""" <|body_1|> def numTrees(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numTrees(self, n): """:type n: int :rtype: int""" if n == 0 or n == 1: return n sum = 0 for i in range(1, n + 1): sum += self.numTrees(i - 1) + self.numTrees(n - i) return sum def numTrees(self, n): """:type n: int :rty...
the_stack_v2_python_sparse
Python_leetcode/96_unique_binary_search_tress.py
xiangcao/Leetcode
train
0
10516341a745c5ee11067a8e5b94ac40e3571304
[ "self.logger = AntiVirusLogger(__name__, debug=debug)\nif config_path is not None:\n self._CONFIG_PATH = config_path\nelse:\n self.logger.log('Configuration file path not found.', logtype='error')\n sys.exit(0)\nif file_list:\n self.file_list = file_list\nelse:\n self.file_list = []\nself.hash_scanne...
<|body_start_0|> self.logger = AntiVirusLogger(__name__, debug=debug) if config_path is not None: self._CONFIG_PATH = config_path else: self.logger.log('Configuration file path not found.', logtype='error') sys.exit(0) if file_list: self.fi...
ScannerEngine class.
ScannerEngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScannerEngine: """ScannerEngine class.""" def __init__(self, debug=False, config_path=None, vt_api_key=None, file_list=None): """Initialize ScannerEngine. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): VirusTotal API Key f...
stack_v2_sparse_classes_36k_train_006470
4,932
permissive
[ { "docstring": "Initialize ScannerEngine. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): VirusTotal API Key file_list (list): List of files to scan Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=False,...
2
stack_v2_sparse_classes_30k_train_005500
Implement the Python class `ScannerEngine` described below. Class description: ScannerEngine class. Method signatures and docstrings: - def __init__(self, debug=False, config_path=None, vt_api_key=None, file_list=None): Initialize ScannerEngine. Args: debug (bool): Log on terminal or not config_path (str): Configurat...
Implement the Python class `ScannerEngine` described below. Class description: ScannerEngine class. Method signatures and docstrings: - def __init__(self, debug=False, config_path=None, vt_api_key=None, file_list=None): Initialize ScannerEngine. Args: debug (bool): Log on terminal or not config_path (str): Configurat...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class ScannerEngine: """ScannerEngine class.""" def __init__(self, debug=False, config_path=None, vt_api_key=None, file_list=None): """Initialize ScannerEngine. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): VirusTotal API Key f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScannerEngine: """ScannerEngine class.""" def __init__(self, debug=False, config_path=None, vt_api_key=None, file_list=None): """Initialize ScannerEngine. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): VirusTotal API Key file_list (lis...
the_stack_v2_python_sparse
securetea/lib/antivirus/scanner/scanner_engine.py
rejahrehim/SecureTea-Project
train
1
09664f8a4cce173651142202ebfab6d36a157a55
[ "encrypted_data = [ord(i) for i in data]\nencrypted_data = [str(i) + ' ' for i in encrypted_data]\nencrypted_data = ''.join(encrypted_data)\nprint(f'Writing encrypted {data} as {encrypted_data}')\nsuper().write(encrypted_data)\nprint(f'Finished writing encrypted data {encrypted_data}')", "print('reading encrypte...
<|body_start_0|> encrypted_data = [ord(i) for i in data] encrypted_data = [str(i) + ' ' for i in encrypted_data] encrypted_data = ''.join(encrypted_data) print(f'Writing encrypted {data} as {encrypted_data}') super().write(encrypted_data) print(f'Finished writing encrypt...
This is a decorator (read: wrapper) that adds an encryption/decryption behaviour to a datasource. This decorator can wrap around a concrete DataSource (like FileDataSource) or it can also wrap around another Decorator. The encryption converts each letter to its ASCII code, while the decryption algorithm does the same.
EncryptedDataSourceDecorator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncryptedDataSourceDecorator: """This is a decorator (read: wrapper) that adds an encryption/decryption behaviour to a datasource. This decorator can wrap around a concrete DataSource (like FileDataSource) or it can also wrap around another Decorator. The encryption converts each letter to its AS...
stack_v2_sparse_classes_36k_train_006471
6,195
no_license
[ { "docstring": "Encrypts the given data and calls the write function of the DataSource that is being wrapped around. :param data: a string :return: None", "name": "write", "signature": "def write(self, data)" }, { "docstring": "Reads data from a data source and decrypts it to a string value. :pr...
2
stack_v2_sparse_classes_30k_train_010158
Implement the Python class `EncryptedDataSourceDecorator` described below. Class description: This is a decorator (read: wrapper) that adds an encryption/decryption behaviour to a datasource. This decorator can wrap around a concrete DataSource (like FileDataSource) or it can also wrap around another Decorator. The en...
Implement the Python class `EncryptedDataSourceDecorator` described below. Class description: This is a decorator (read: wrapper) that adds an encryption/decryption behaviour to a datasource. This decorator can wrap around a concrete DataSource (like FileDataSource) or it can also wrap around another Decorator. The en...
68ad3a22646c5433e395fbee2c1fbb972b805c09
<|skeleton|> class EncryptedDataSourceDecorator: """This is a decorator (read: wrapper) that adds an encryption/decryption behaviour to a datasource. This decorator can wrap around a concrete DataSource (like FileDataSource) or it can also wrap around another Decorator. The encryption converts each letter to its AS...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncryptedDataSourceDecorator: """This is a decorator (read: wrapper) that adds an encryption/decryption behaviour to a datasource. This decorator can wrap around a concrete DataSource (like FileDataSource) or it can also wrap around another Decorator. The encryption converts each letter to its ASCII code, whi...
the_stack_v2_python_sparse
Lectures/1028/decorator_example.py
usop7/Python_OOP_Projects
train
0
0f94febad3196146faaf287bf8870b439dd4f3b5
[ "print('In bl | User | create User method')\ntry:\n is_user_exists = FacadeAdmin.is_exist_by_login(entity['login'])\nexcept Exception as e:\n raise ServiceException('ADMIN_USER_DATABASE_QUERY_FAIL', 'Fail to verify if the user already exist.', str(e))\nif is_user_exists:\n raise ServiceException('ADMIN_USE...
<|body_start_0|> print('In bl | User | create User method') try: is_user_exists = FacadeAdmin.is_exist_by_login(entity['login']) except Exception as e: raise ServiceException('ADMIN_USER_DATABASE_QUERY_FAIL', 'Fail to verify if the user already exist.', str(e)) if...
Allow user management systems
Admin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Admin: """Allow user management systems""" def create_user(entity): """Create a new admin user :param entity: A Entity object with required values email: The email associated to this user [String, Required] password: The password associated to this user [String, Required] email: The ...
stack_v2_sparse_classes_36k_train_006472
5,356
no_license
[ { "docstring": "Create a new admin user :param entity: A Entity object with required values email: The email associated to this user [String, Required] password: The password associated to this user [String, Required] email: The email associated to this user [String, Required] firstname: The first name of the u...
3
stack_v2_sparse_classes_30k_train_016842
Implement the Python class `Admin` described below. Class description: Allow user management systems Method signatures and docstrings: - def create_user(entity): Create a new admin user :param entity: A Entity object with required values email: The email associated to this user [String, Required] password: The passwo...
Implement the Python class `Admin` described below. Class description: Allow user management systems Method signatures and docstrings: - def create_user(entity): Create a new admin user :param entity: A Entity object with required values email: The email associated to this user [String, Required] password: The passwo...
8dd3118eab24ee3992bc345573f4bb427930b30c
<|skeleton|> class Admin: """Allow user management systems""" def create_user(entity): """Create a new admin user :param entity: A Entity object with required values email: The email associated to this user [String, Required] password: The password associated to this user [String, Required] email: The ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Admin: """Allow user management systems""" def create_user(entity): """Create a new admin user :param entity: A Entity object with required values email: The email associated to this user [String, Required] password: The password associated to this user [String, Required] email: The email associa...
the_stack_v2_python_sparse
admin/bl/admin_user.py
amityadav17/catalog
train
0
e3716ba33ee1433ca3e9da1c588c71cc54fba45c
[ "serializer = self.login_serializer_class(data=request.data)\nif serializer.is_valid():\n return self.__login_user(serializer.data)\nelse:\n return self.json_failed_response(errors=serializer.errors)", "try:\n user = authenticate(username=data[EMAIL], password=data[PASSWORD])\n return self.json_succes...
<|body_start_0|> serializer = self.login_serializer_class(data=request.data) if serializer.is_valid(): return self.__login_user(serializer.data) else: return self.json_failed_response(errors=serializer.errors) <|end_body_0|> <|body_start_1|> try: user...
View for login_service user
LoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginView: """View for login_service user""" def post(self, request: Request, *args, **kwargs) -> Response: """request params: - email - password :return json response http response codes: 200 - ok, login_service success 400 - login_service failed - view errors in errors key keys: su...
stack_v2_sparse_classes_36k_train_006473
1,914
no_license
[ { "docstring": "request params: - email - password :return json response http response codes: 200 - ok, login_service success 400 - login_service failed - view errors in errors key keys: success - true if login_service was success and false otherwise errors - json of login_service errors if success if false tok...
2
stack_v2_sparse_classes_30k_train_000797
Implement the Python class `LoginView` described below. Class description: View for login_service user Method signatures and docstrings: - def post(self, request: Request, *args, **kwargs) -> Response: request params: - email - password :return json response http response codes: 200 - ok, login_service success 400 - ...
Implement the Python class `LoginView` described below. Class description: View for login_service user Method signatures and docstrings: - def post(self, request: Request, *args, **kwargs) -> Response: request params: - email - password :return json response http response codes: 200 - ok, login_service success 400 - ...
bab909324aa2e4c1c8fff72093d3fcf44aaf4963
<|skeleton|> class LoginView: """View for login_service user""" def post(self, request: Request, *args, **kwargs) -> Response: """request params: - email - password :return json response http response codes: 200 - ok, login_service success 400 - login_service failed - view errors in errors key keys: su...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginView: """View for login_service user""" def post(self, request: Request, *args, **kwargs) -> Response: """request params: - email - password :return json response http response codes: 200 - ok, login_service success 400 - login_service failed - view errors in errors key keys: success - true ...
the_stack_v2_python_sparse
crm/views/login/login_view.py
vovapasko/crm
train
0
67b8c381ab3e85c8c39229f626375b11d4acdfe2
[ "super(MultiboxLoss, self).__init__()\nself.iou_threshold = iou_threshold\nself.neg_pos_ratio = neg_pos_ratio\nself.center_variance = center_variance\nself.size_variance = size_variance\nself.priors = priors\nself.priors", "num_classes = confidence.size(2)\nwith torch.no_grad():\n loss = -F.log_softmax(confide...
<|body_start_0|> super(MultiboxLoss, self).__init__() self.iou_threshold = iou_threshold self.neg_pos_ratio = neg_pos_ratio self.center_variance = center_variance self.size_variance = size_variance self.priors = priors self.priors <|end_body_0|> <|body_start_1|> ...
MultiboxLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiboxLoss: def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): """Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" <|body_0|> def forward(self, confidence, pr...
stack_v2_sparse_classes_36k_train_006474
33,668
no_license
[ { "docstring": "Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.", "name": "__init__", "signature": "def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device)" }, { "docstring": "Compute class...
2
stack_v2_sparse_classes_30k_train_003736
Implement the Python class `MultiboxLoss` described below. Class description: Implement the MultiboxLoss class. Method signatures and docstrings: - def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): Implement SSD Multibox Loss. Basically, Multibox loss combines classific...
Implement the Python class `MultiboxLoss` described below. Class description: Implement the MultiboxLoss class. Method signatures and docstrings: - def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): Implement SSD Multibox Loss. Basically, Multibox loss combines classific...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MultiboxLoss: def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): """Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" <|body_0|> def forward(self, confidence, pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiboxLoss: def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): """Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" super(MultiboxLoss, self).__init__() self.iou_threshol...
the_stack_v2_python_sparse
generated/test_qfgaohao_pytorch_ssd.py
jansel/pytorch-jit-paritybench
train
35
1b47dde160bbb90b746c4f017de069f0a0251a0b
[ "len1, len2 = (len(nums1), len(nums2))\nnums3 = []\ni, j, k = (0, 0, 0)\nwhile i < len1 and j < len2:\n if nums1[i] <= nums2[j]:\n nums3.append(nums1[i])\n i += 1\n else:\n nums3.append(nums2[j])\n j += 1\nif i < len1:\n nums3.extend(nums1[i:])\nif j < len2:\n nums3.extend(nu...
<|body_start_0|> len1, len2 = (len(nums1), len(nums2)) nums3 = [] i, j, k = (0, 0, 0) while i < len1 and j < len2: if nums1[i] <= nums2[j]: nums3.append(nums1[i]) i += 1 else: nums3.append(nums2[j]) j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def find_median_sorted_arrays(self, nums1, nums2): """bin-search :type nums1: List[int] :type nums2: List[int] :rtype: float""" ...
stack_v2_sparse_classes_36k_train_006475
3,158
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": "bin-search :type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "find_median_sorte...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def find_median_sorted_arrays(self, nums1, nums2): bin-search :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def find_median_sorted_arrays(self, nums1, nums2): bin-search :type ...
215d513b3564a7a76db3d2b29e4acc341a68e8ee
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def find_median_sorted_arrays(self, nums1, nums2): """bin-search :type nums1: List[int] :type nums2: List[int] :rtype: float""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" len1, len2 = (len(nums1), len(nums2)) nums3 = [] i, j, k = (0, 0, 0) while i < len1 and j < len2: if nums1[i] <= nums2[j]: ...
the_stack_v2_python_sparse
python/bin-search/median-of-two-sorted.py
euxuoh/leetcode
train
0
41cf2a8a364fe9efc69f720ea53eee1bcea41def
[ "entries = self.model_cls.published.none()\nif self.request.GET:\n self.pattern = self.request.GET.get('q', '')\n if len(self.pattern) < 3:\n self.error = _('The pattern is too short')\n else:\n query_parsed = QUERY.parseString(self.pattern)\n entries = self.model_cls.published.filter(...
<|body_start_0|> entries = self.model_cls.published.none() if self.request.GET: self.pattern = self.request.GET.get('q', '') if len(self.pattern) < 3: self.error = _('The pattern is too short') else: query_parsed = QUERY.parseString(sel...
Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.
EntrySearchMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntrySearchMixin: """Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.""" def get_queryset(self): """Overridde the ...
stack_v2_sparse_classes_36k_train_006476
3,025
no_license
[ { "docstring": "Overridde the get_queryset method to do some validations and build the search queryset.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Add error and pattern in context.", "name": "get_context_data", "signature": "def get_context_data(se...
2
stack_v2_sparse_classes_30k_train_019447
Implement the Python class `EntrySearchMixin` described below. Class description: Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern. Method signatures...
Implement the Python class `EntrySearchMixin` described below. Class description: Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern. Method signatures...
80e5a36154d1e2ffdc08c7f0563e8e887efb017d
<|skeleton|> class EntrySearchMixin: """Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.""" def get_queryset(self): """Overridde the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntrySearchMixin: """Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.""" def get_queryset(self): """Overridde the get_queryset ...
the_stack_v2_python_sparse
apps/mp_blog/views/mixins.py
ivansons/mp_cms
train
0
74bce0dbec2c1a92c40a962f3a099097be735c96
[ "super().__init__()\nself.input_size = input_size\nself.d_model = d_model\nif input_size != d_model:\n self.proj = nn.Linear(input_size, d_model)\nlayer = TransformerEncoderLayer(d_model, nhead, dim_feedforward, dropout)\nself.layers = nn.ModuleList([copy.deepcopy(layer) for _ in range(num_layers)])\nself.num_la...
<|body_start_0|> super().__init__() self.input_size = input_size self.d_model = d_model if input_size != d_model: self.proj = nn.Linear(input_size, d_model) layer = TransformerEncoderLayer(d_model, nhead, dim_feedforward, dropout) self.layers = nn.ModuleList([...
TransformerEncoder is a stack of N encoder layers.
TransformerEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoder: """TransformerEncoder is a stack of N encoder layers.""" def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1) -> None: """Initialize the TransformerEncoder. Parameters --------- i...
stack_v2_sparse_classes_36k_train_006477
20,460
permissive
[ { "docstring": "Initialize the TransformerEncoder. Parameters --------- input_size : int The embedding dimension of the model. If different from d_model, a linear projection layer is added. d_model : int the number of expected features in encoder/decoder inputs. Default ``512``. nhead : int, optional the number...
3
stack_v2_sparse_classes_30k_train_007371
Implement the Python class `TransformerEncoder` described below. Class description: TransformerEncoder is a stack of N encoder layers. Method signatures and docstrings: - def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1) -> None: ...
Implement the Python class `TransformerEncoder` described below. Class description: TransformerEncoder is a stack of N encoder layers. Method signatures and docstrings: - def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1) -> None: ...
0dc2f5b2b286694defe8abf450fe5be9ae12c097
<|skeleton|> class TransformerEncoder: """TransformerEncoder is a stack of N encoder layers.""" def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1) -> None: """Initialize the TransformerEncoder. Parameters --------- i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerEncoder: """TransformerEncoder is a stack of N encoder layers.""" def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1) -> None: """Initialize the TransformerEncoder. Parameters --------- input_size : i...
the_stack_v2_python_sparse
flambe/nn/transformer.py
cle-ros/flambe
train
1
e068b101bd9b0e305d987c95d480733fa1c628f3
[ "url = 'https://raw.githubusercontent.com/elhenrico/covid19-Brazil-timeseries/master/confirmed-cases.csv'\nlogger.debug('Fetching Brazil province-level confirmed cases from BRA_MSHM')\nreturn pd.read_csv(url)", "url = 'https://raw.githubusercontent.com/elhenrico/covid19-Brazil-timeseries/master/deaths.csv'\nlogge...
<|body_start_0|> url = 'https://raw.githubusercontent.com/elhenrico/covid19-Brazil-timeseries/master/confirmed-cases.csv' logger.debug('Fetching Brazil province-level confirmed cases from BRA_MSHM') return pd.read_csv(url) <|end_body_0|> <|body_start_1|> url = 'https://raw.githubusercon...
BRA_MSHMFetcher
[ "Apache-2.0", "CC-BY-NC-ND-4.0", "CC-BY-NC-4.0", "CC0-1.0", "CC-BY-SA-3.0", "LicenseRef-scancode-unknown-license-reference", "Unlicense", "GPL-3.0-only", "LicenseRef-scancode-proprietary-license", "CC-BY-4.0", "CC-BY-NC-SA-4.0", "LicenseRef-scancode-public-domain", "OGL-UK-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BRA_MSHMFetcher: def province_confirmed_fetch(self): """This url mainly provide cumulative data of confirmed cases on the province-level.""" <|body_0|> def province_dead_fetch(self): """This url mainly provide cumulative data of death data on the province-level.""" ...
stack_v2_sparse_classes_36k_train_006478
5,057
permissive
[ { "docstring": "This url mainly provide cumulative data of confirmed cases on the province-level.", "name": "province_confirmed_fetch", "signature": "def province_confirmed_fetch(self)" }, { "docstring": "This url mainly provide cumulative data of death data on the province-level.", "name": ...
3
stack_v2_sparse_classes_30k_train_013790
Implement the Python class `BRA_MSHMFetcher` described below. Class description: Implement the BRA_MSHMFetcher class. Method signatures and docstrings: - def province_confirmed_fetch(self): This url mainly provide cumulative data of confirmed cases on the province-level. - def province_dead_fetch(self): This url main...
Implement the Python class `BRA_MSHMFetcher` described below. Class description: Implement the BRA_MSHMFetcher class. Method signatures and docstrings: - def province_confirmed_fetch(self): This url mainly provide cumulative data of confirmed cases on the province-level. - def province_dead_fetch(self): This url main...
aecbea09d684201f122fba931f764e8b88a82fe7
<|skeleton|> class BRA_MSHMFetcher: def province_confirmed_fetch(self): """This url mainly provide cumulative data of confirmed cases on the province-level.""" <|body_0|> def province_dead_fetch(self): """This url mainly provide cumulative data of death data on the province-level.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BRA_MSHMFetcher: def province_confirmed_fetch(self): """This url mainly provide cumulative data of confirmed cases on the province-level.""" url = 'https://raw.githubusercontent.com/elhenrico/covid19-Brazil-timeseries/master/confirmed-cases.csv' logger.debug('Fetching Brazil province-l...
the_stack_v2_python_sparse
src/plugins/BRA_MSHM/fetcher.py
covid19db/fetchers-python
train
4
f0f3bdc3d9e98670d652e37d67ec6a640cdde081
[ "correlationIterable = self._mergeCorrelationIterable(correlationIterable)\nif self._maximumValueCountThreshold is not None:\n correlationIterable = self._removeNodesWithTooManyValues(correlationIterable, self._maximumValueCountThreshold)\nreturn correlationIterable", "lastCorrelation = None\nfor correlation i...
<|body_start_0|> correlationIterable = self._mergeCorrelationIterable(correlationIterable) if self._maximumValueCountThreshold is not None: correlationIterable = self._removeNodesWithTooManyValues(correlationIterable, self._maximumValueCountThreshold) return correlationIterable <|end...
Takes care of merging correlations
CorrelationMergeDelegate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorrelationMergeDelegate: """Takes care of merging correlations""" def mergeCorrelationIterable(self, correlationIterable): """:type correlationIterable: Iterable""" <|body_0|> def _mergeCorrelationIterable(self, correlationIterable): """:type correlationIterable...
stack_v2_sparse_classes_36k_train_006479
7,995
no_license
[ { "docstring": ":type correlationIterable: Iterable", "name": "mergeCorrelationIterable", "signature": "def mergeCorrelationIterable(self, correlationIterable)" }, { "docstring": ":type correlationIterable: Iterable", "name": "_mergeCorrelationIterable", "signature": "def _mergeCorrelati...
5
stack_v2_sparse_classes_30k_train_012393
Implement the Python class `CorrelationMergeDelegate` described below. Class description: Takes care of merging correlations Method signatures and docstrings: - def mergeCorrelationIterable(self, correlationIterable): :type correlationIterable: Iterable - def _mergeCorrelationIterable(self, correlationIterable): :typ...
Implement the Python class `CorrelationMergeDelegate` described below. Class description: Takes care of merging correlations Method signatures and docstrings: - def mergeCorrelationIterable(self, correlationIterable): :type correlationIterable: Iterable - def _mergeCorrelationIterable(self, correlationIterable): :typ...
7915b67d07288145a2fa46a7fce3e47edad4e6c7
<|skeleton|> class CorrelationMergeDelegate: """Takes care of merging correlations""" def mergeCorrelationIterable(self, correlationIterable): """:type correlationIterable: Iterable""" <|body_0|> def _mergeCorrelationIterable(self, correlationIterable): """:type correlationIterable...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CorrelationMergeDelegate: """Takes care of merging correlations""" def mergeCorrelationIterable(self, correlationIterable): """:type correlationIterable: Iterable""" correlationIterable = self._mergeCorrelationIterable(correlationIterable) if self._maximumValueCountThreshold is no...
the_stack_v2_python_sparse
modsecurity_exception_factory/correlation/correlation_merge_delegate.py
akadata/modsecurity-exception-factory
train
0
ad20d6063cd8bb82fcff88a30eec3ab76fe3ce07
[ "print('Inside __init__()')\nself.arg1 = arg1\nself.arg2 = arg2\nself.arg3 = arg3", "print('Inside __call__()')\n\ndef wrapped_f(*args):\n print('Inside wrapped_f()')\n print('Decorator arguments:', self.arg1, self.arg2, self.arg3)\n f(*args)\n print('After f(*args)')\nreturn wrapped_f" ]
<|body_start_0|> print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 <|end_body_0|> <|body_start_1|> print('Inside __call__()') def wrapped_f(*args): print('Inside wrapped_f()') print('Decorator arguments:', self.arg1, s...
decoratorWithArguments
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class decoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_36k_train_006480
2,403
no_license
[ { "docstring": "If there are decorator arguments, the function to be decorated is not passed to the constructor!", "name": "__init__", "signature": "def __init__(self, arg1, arg2, arg3)" }, { "docstring": "If there are decorator arguments, __call__() is only called once, as part of the decoratio...
2
null
Implement the Python class `decoratorWithArguments` described below. Class description: Implement the decoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
Implement the Python class `decoratorWithArguments` described below. Class description: Implement the decoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
836fcdd3f5c1b150122302685104fe51b5ebe1a3
<|skeleton|> class decoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class decoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 def __call__(self, f):...
the_stack_v2_python_sparse
05PythonCookbook/ch9Metaprogramming/i94parameter_arugment.py
greatabel/PythonRepository
train
33
dfeb17bc31c7e83c8708f6d68f2ff97b0a635c2d
[ "super(HybridRecommender, self).__init__()\nif not all((x.shape == Similarities_list[0].shape for x in Similarities_list)):\n raise ValueError('ItemKNNSimilarityHybridRecommender: similarities have different size')\nself.Similarities_list = []\nfor matrix in Similarities_list:\n self.Similarities_list.append(...
<|body_start_0|> super(HybridRecommender, self).__init__() if not all((x.shape == Similarities_list[0].shape for x in Similarities_list)): raise ValueError('ItemKNNSimilarityHybridRecommender: similarities have different size') self.Similarities_list = [] for matrix in Simila...
Hybrid recommender weights : list topK : number number of member : The number of recommenders involved in this one.
HybridRecommender
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HybridRecommender: """Hybrid recommender weights : list topK : number number of member : The number of recommenders involved in this one.""" def __init__(self, URM_train, Similarities_list, sparse_weights=True): """:param URM_train: :param Similarities_list: The list of Similarities ...
stack_v2_sparse_classes_36k_train_006481
2,133
no_license
[ { "docstring": ":param URM_train: :param Similarities_list: The list of Similarities Matrices originating from their recommender :param weights_list: The list of weights we assign to each recommender :param sparse_weights:", "name": "__init__", "signature": "def __init__(self, URM_train, Similarities_li...
2
stack_v2_sparse_classes_30k_train_011079
Implement the Python class `HybridRecommender` described below. Class description: Hybrid recommender weights : list topK : number number of member : The number of recommenders involved in this one. Method signatures and docstrings: - def __init__(self, URM_train, Similarities_list, sparse_weights=True): :param URM_t...
Implement the Python class `HybridRecommender` described below. Class description: Hybrid recommender weights : list topK : number number of member : The number of recommenders involved in this one. Method signatures and docstrings: - def __init__(self, URM_train, Similarities_list, sparse_weights=True): :param URM_t...
a543f2ec5e26273d44f8222c92aac16254d10a13
<|skeleton|> class HybridRecommender: """Hybrid recommender weights : list topK : number number of member : The number of recommenders involved in this one.""" def __init__(self, URM_train, Similarities_list, sparse_weights=True): """:param URM_train: :param Similarities_list: The list of Similarities ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HybridRecommender: """Hybrid recommender weights : list topK : number number of member : The number of recommenders involved in this one.""" def __init__(self, URM_train, Similarities_list, sparse_weights=True): """:param URM_train: :param Similarities_list: The list of Similarities Matrices orig...
the_stack_v2_python_sparse
Hybrid/HybridRecommender.py
BlancNicolas/RecSys_challenge
train
0
50f58fc7a3ec71ecec2a24106ddcbd21efe73f9f
[ "Point.__init__(self, decisions, problem)\nself.rank = 0\nself.dominated = []\nself.dominating = 0\nself.norm_objectives = None\nself.perpendicular = None\nself.reference_id = None", "new = NSGAPoint(self.decisions)\nnew.objectives = self.objectives[:]\nif self.norm_objectives:\n new.norm_objectives = self.nor...
<|body_start_0|> Point.__init__(self, decisions, problem) self.rank = 0 self.dominated = [] self.dominating = 0 self.norm_objectives = None self.perpendicular = None self.reference_id = None <|end_body_0|> <|body_start_1|> new = NSGAPoint(self.decisions) ...
NSGAPoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NSGAPoint: def __init__(self, decisions, problem=None): """Represents a point in the frontier for NSGA :param decisions: Set of decisions :param problem: Instance of the problem""" <|body_0|> def clone(self): """Method to clone a point :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_006482
11,661
permissive
[ { "docstring": "Represents a point in the frontier for NSGA :param decisions: Set of decisions :param problem: Instance of the problem", "name": "__init__", "signature": "def __init__(self, decisions, problem=None)" }, { "docstring": "Method to clone a point :return:", "name": "clone", "...
2
stack_v2_sparse_classes_30k_train_018625
Implement the Python class `NSGAPoint` described below. Class description: Implement the NSGAPoint class. Method signatures and docstrings: - def __init__(self, decisions, problem=None): Represents a point in the frontier for NSGA :param decisions: Set of decisions :param problem: Instance of the problem - def clone(...
Implement the Python class `NSGAPoint` described below. Class description: Implement the NSGAPoint class. Method signatures and docstrings: - def __init__(self, decisions, problem=None): Represents a point in the frontier for NSGA :param decisions: Set of decisions :param problem: Instance of the problem - def clone(...
dcd4a13f08f8c1bd68740e81f472ff6ac76addca
<|skeleton|> class NSGAPoint: def __init__(self, decisions, problem=None): """Represents a point in the frontier for NSGA :param decisions: Set of decisions :param problem: Instance of the problem""" <|body_0|> def clone(self): """Method to clone a point :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NSGAPoint: def __init__(self, decisions, problem=None): """Represents a point in the frontier for NSGA :param decisions: Set of decisions :param problem: Instance of the problem""" Point.__init__(self, decisions, problem) self.rank = 0 self.dominated = [] self.dominatin...
the_stack_v2_python_sparse
algorithms/nsga3/nsga3.py
bigfatnoob/optima
train
7
1f34d74651fa36c9b718f2711405b84507e08a6b
[ "if not root:\n return 0\nreturn self.counter(root, sum) + self.pathSum(root.left, sum) + self.pathSum(root.right, sum)", "res = 0\nif not root:\n return res\nif root.val == sum:\n res += 1\nres += self.counter(root.left, sum - root.val)\nres += self.counter(root.right, sum - root.val)\nreturn res" ]
<|body_start_0|> if not root: return 0 return self.counter(root, sum) + self.pathSum(root.left, sum) + self.pathSum(root.right, sum) <|end_body_0|> <|body_start_1|> res = 0 if not root: return res if root.val == sum: res += 1 res += se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_0|> def counter(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_006483
1,266
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: int", "name": "pathSum", "signature": "def pathSum(self, root, sum)" }, { "docstring": ":type root: TreeNode :type sum: int :rtype: int", "name": "counter", "signature": "def counter(self, root, sum)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: int - def counter(self, root, sum): :type root: TreeNode :type sum: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: int - def counter(self, root, sum): :type root: TreeNode :type sum: int :rtype: int <|skeleton|> class ...
af28e4070e3cab859bfcdc45aca3f31c1e3325fe
<|skeleton|> class Solution: def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_0|> def counter(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" if not root: return 0 return self.counter(root, sum) + self.pathSum(root.left, sum) + self.pathSum(root.right, sum) def counter(self, root, sum): """:type root: TreeNo...
the_stack_v2_python_sparse
pathSumIII.py
Jill1627/lc-notes
train
0
371f3e653f814971e608598bae17264de5b2add1
[ "for res in self:\n if res.assessment_type in ['quarter', 'semiannual', 'probation']:\n raise UserError('当前版本仅支持类型为月度或年度,如需其他类型请购买完整版!')\n if res.assessment_type:\n res.evaluation_ids = [(2, 0, res.evaluation_ids.ids)]\n return {'domain': {'evaluation_ids': [('cycle_type', '=', self.asses...
<|body_start_0|> for res in self: if res.assessment_type in ['quarter', 'semiannual', 'probation']: raise UserError('当前版本仅支持类型为月度或年度,如需其他类型请购买完整版!') if res.assessment_type: res.evaluation_ids = [(2, 0, res.evaluation_ids.ids)] return {'doma...
InitiatePerformanceAssessment
[ "Apache-2.0", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InitiatePerformanceAssessment: def _onchange_assessment_type(self): """:return:""" <|body_0|> def initiate_performance(self): """发起考核 :return:""" <|body_1|> def send_email_now(self, performance_object): """发送员工通知邮件,通过邮件:EMail队列管理器进行发送 :return:"""...
stack_v2_sparse_classes_36k_train_006484
6,241
permissive
[ { "docstring": ":return:", "name": "_onchange_assessment_type", "signature": "def _onchange_assessment_type(self)" }, { "docstring": "发起考核 :return:", "name": "initiate_performance", "signature": "def initiate_performance(self)" }, { "docstring": "发送员工通知邮件,通过邮件:EMail队列管理器进行发送 :ret...
4
null
Implement the Python class `InitiatePerformanceAssessment` described below. Class description: Implement the InitiatePerformanceAssessment class. Method signatures and docstrings: - def _onchange_assessment_type(self): :return: - def initiate_performance(self): 发起考核 :return: - def send_email_now(self, performance_obj...
Implement the Python class `InitiatePerformanceAssessment` described below. Class description: Implement the InitiatePerformanceAssessment class. Method signatures and docstrings: - def _onchange_assessment_type(self): :return: - def initiate_performance(self): 发起考核 :return: - def send_email_now(self, performance_obj...
8608aaeae7a8c86d53b68ce26b7b308f779c3dd8
<|skeleton|> class InitiatePerformanceAssessment: def _onchange_assessment_type(self): """:return:""" <|body_0|> def initiate_performance(self): """发起考核 :return:""" <|body_1|> def send_email_now(self, performance_object): """发送员工通知邮件,通过邮件:EMail队列管理器进行发送 :return:"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InitiatePerformanceAssessment: def _onchange_assessment_type(self): """:return:""" for res in self: if res.assessment_type in ['quarter', 'semiannual', 'probation']: raise UserError('当前版本仅支持类型为月度或年度,如需其他类型请购买完整版!') if res.assessment_type: ...
the_stack_v2_python_sparse
odoo_performance_manage/wizard/initiate_performance.py
niulinlnc/odooExtModel
train
4
40156aeda5db65df5bac7d87240906e4c30c5f1b
[ "super().__init__(num_heads, block, different_layout_per_head)\nself.num_random_blocks = num_random_blocks\nself.num_sliding_window_blocks = num_sliding_window_blocks\nself.num_global_blocks = num_global_blocks\nif attention != 'unidirectional' and attention != 'bidirectional':\n raise NotImplementedError('only ...
<|body_start_0|> super().__init__(num_heads, block, different_layout_per_head) self.num_random_blocks = num_random_blocks self.num_sliding_window_blocks = num_sliding_window_blocks self.num_global_blocks = num_global_blocks if attention != 'unidirectional' and attention != 'bidir...
Configuration class to store `BigBird` sparsity configuration. For more details about this sparsity config, please see `Big Bird: Transformers for Longer Sequences`: https://arxiv.org/pdf/2007.14062.pdf This class extends parent class of `SparsityConfig` and customizes it for `BigBird` sparsity.
BigBirdSparsityConfig
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BigBirdSparsityConfig: """Configuration class to store `BigBird` sparsity configuration. For more details about this sparsity config, please see `Big Bird: Transformers for Longer Sequences`: https://arxiv.org/pdf/2007.14062.pdf This class extends parent class of `SparsityConfig` and customizes i...
stack_v2_sparse_classes_36k_train_006485
42,463
permissive
[ { "docstring": "Initialize the BigBird Sparsity Pattern Config. For usage example please see, TODO DeepSpeed Sparse Transformer Tutorial Arguments: num_heads: required: an integer determining number of attention heads of the layer. block: optional: an integer determining the block size. Current implementation o...
5
null
Implement the Python class `BigBirdSparsityConfig` described below. Class description: Configuration class to store `BigBird` sparsity configuration. For more details about this sparsity config, please see `Big Bird: Transformers for Longer Sequences`: https://arxiv.org/pdf/2007.14062.pdf This class extends parent cla...
Implement the Python class `BigBirdSparsityConfig` described below. Class description: Configuration class to store `BigBird` sparsity configuration. For more details about this sparsity config, please see `Big Bird: Transformers for Longer Sequences`: https://arxiv.org/pdf/2007.14062.pdf This class extends parent cla...
55d9964c59c0c6e23158b5789a5c36c28939a7b0
<|skeleton|> class BigBirdSparsityConfig: """Configuration class to store `BigBird` sparsity configuration. For more details about this sparsity config, please see `Big Bird: Transformers for Longer Sequences`: https://arxiv.org/pdf/2007.14062.pdf This class extends parent class of `SparsityConfig` and customizes i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BigBirdSparsityConfig: """Configuration class to store `BigBird` sparsity configuration. For more details about this sparsity config, please see `Big Bird: Transformers for Longer Sequences`: https://arxiv.org/pdf/2007.14062.pdf This class extends parent class of `SparsityConfig` and customizes it for `BigBir...
the_stack_v2_python_sparse
deepspeed/ops/sparse_attention/sparsity_config.py
microsoft/DeepSpeed
train
27,557
c7dd6d09117cc8686eddbd1a7ea10d88a5909a25
[ "transactions = get_transactions_by_gifts(None)\nresult = TransactionSchema(many=True).dump(transactions).data\nreturn (result, 200)", "transactions = get_transactions_by_gifts(request.json['searchable_ids'])\nresult = TransactionSchema(many=True).dump(transactions).data\nreturn (result, 200)" ]
<|body_start_0|> transactions = get_transactions_by_gifts(None) result = TransactionSchema(many=True).dump(transactions).data return (result, 200) <|end_body_0|> <|body_start_1|> transactions = get_transactions_by_gifts(request.json['searchable_ids']) result = TransactionSchema(...
Flask-RESTful resource endpoints for TransactionModel by gift searchable ID's.
TransactionsByGifts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransactionsByGifts: """Flask-RESTful resource endpoints for TransactionModel by gift searchable ID's.""" def get(self): """Simple endpoint to retrieve all rows from table.""" <|body_0|> def post(self): """Simple endpoint to return several rows from table given a...
stack_v2_sparse_classes_36k_train_006486
4,727
no_license
[ { "docstring": "Simple endpoint to retrieve all rows from table.", "name": "get", "signature": "def get(self)" }, { "docstring": "Simple endpoint to return several rows from table given a list of gift searchable ID's.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `TransactionsByGifts` described below. Class description: Flask-RESTful resource endpoints for TransactionModel by gift searchable ID's. Method signatures and docstrings: - def get(self): Simple endpoint to retrieve all rows from table. - def post(self): Simple endpoint to return several ro...
Implement the Python class `TransactionsByGifts` described below. Class description: Flask-RESTful resource endpoints for TransactionModel by gift searchable ID's. Method signatures and docstrings: - def get(self): Simple endpoint to retrieve all rows from table. - def post(self): Simple endpoint to return several ro...
d5ffcc5d276692d1578cea704125b1b3952beb1c
<|skeleton|> class TransactionsByGifts: """Flask-RESTful resource endpoints for TransactionModel by gift searchable ID's.""" def get(self): """Simple endpoint to retrieve all rows from table.""" <|body_0|> def post(self): """Simple endpoint to return several rows from table given a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransactionsByGifts: """Flask-RESTful resource endpoints for TransactionModel by gift searchable ID's.""" def get(self): """Simple endpoint to retrieve all rows from table.""" transactions = get_transactions_by_gifts(None) result = TransactionSchema(many=True).dump(transactions).d...
the_stack_v2_python_sparse
application/resources/transaction.py
transreductionist/API-Project-1
train
0
5b2c9a88ce2ab06dda2f3824d6c5b7a0591a25c0
[ "self.adafruit_sht = adafruit_sht\nself.temperature: float | None = None\nself.humidity: float | None = None", "temperature, humidity = self.adafruit_sht.read_temperature_humidity()\nif math.isnan(temperature) or math.isnan(humidity):\n _LOGGER.warning('Bad sample from sensor SHT31')\n return\nself.temperat...
<|body_start_0|> self.adafruit_sht = adafruit_sht self.temperature: float | None = None self.humidity: float | None = None <|end_body_0|> <|body_start_1|> temperature, humidity = self.adafruit_sht.read_temperature_humidity() if math.isnan(temperature) or math.isnan(humidity): ...
Get the latest data from the SHT sensor.
SHTClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SHTClient: """Get the latest data from the SHT sensor.""" def __init__(self, adafruit_sht): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from the SHT sensor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> sel...
stack_v2_sparse_classes_36k_train_006487
4,258
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, adafruit_sht)" }, { "docstring": "Get the latest data from the SHT sensor.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `SHTClient` described below. Class description: Get the latest data from the SHT sensor. Method signatures and docstrings: - def __init__(self, adafruit_sht): Initialize the sensor. - def update(self): Get the latest data from the SHT sensor.
Implement the Python class `SHTClient` described below. Class description: Get the latest data from the SHT sensor. Method signatures and docstrings: - def __init__(self, adafruit_sht): Initialize the sensor. - def update(self): Get the latest data from the SHT sensor. <|skeleton|> class SHTClient: """Get the la...
8de7966104911bca6f855a1755a6d71a07afb9de
<|skeleton|> class SHTClient: """Get the latest data from the SHT sensor.""" def __init__(self, adafruit_sht): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from the SHT sensor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SHTClient: """Get the latest data from the SHT sensor.""" def __init__(self, adafruit_sht): """Initialize the sensor.""" self.adafruit_sht = adafruit_sht self.temperature: float | None = None self.humidity: float | None = None def update(self): """Get the late...
the_stack_v2_python_sparse
homeassistant/components/sht31/sensor.py
AlexxIT/home-assistant
train
9
5e2f2255de96dec5a0bff573f08f65b13a47bd0d
[ "self.cap = 10007\nself.size = 0\nself.d = [LinkedListNode(0) for _ in xrange(self.cap)]", "prev = dummy = self.d[key % self.cap]\ncurr = dummy.next\nwhile curr:\n if curr.val[0] == key:\n break\n prev = curr\n curr = curr.next\nif not curr:\n curr = LinkedListNode((key, value))\n curr.prev,...
<|body_start_0|> self.cap = 10007 self.size = 0 self.d = [LinkedListNode(0) for _ in xrange(self.cap)] <|end_body_0|> <|body_start_1|> prev = dummy = self.d[key % self.cap] curr = dummy.next while curr: if curr.val[0] == key: break ...
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_36k_train_006488
2,146
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_008567
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(...
6fec95b9b4d735727160905e754a698513bfb7d8
<|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_36k
data/stack_v2_sparse_classes_30k
class MyHashMap: def __init__(self): """Initialize your data structure here.""" self.cap = 10007 self.size = 0 self.d = [LinkedListNode(0) for _ in xrange(self.cap)] def put(self, key, value): """value will always be non-negative. :type key: int :type value: int :rtype: ...
the_stack_v2_python_sparse
leetcode/design/design-hashmap.py
jwyx3/practices
train
2
67fde1c2bb2e041b9a0d5ba2b2bb9aab02982488
[ "updated_grid = [[self.update_cell(row, col) for col in range(self.get_grid_width())] for row in range(self.get_grid_height())]\nfor col in range(self.get_grid_width()):\n for row in range(self.get_grid_height()):\n if updated_grid[row][col] == EMPTY:\n self.set_empty(row, col)\n else:\n...
<|body_start_0|> updated_grid = [[self.update_cell(row, col) for col in range(self.get_grid_width())] for row in range(self.get_grid_height())] for col in range(self.get_grid_width()): for row in range(self.get_grid_height()): if updated_grid[row][col] == EMPTY: ...
Extend Grid class to support Game of Life
GameOfLife
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameOfLife: """Extend Grid class to support Game of Life""" def update_gol(self): """Function that performs one step of the Game of Life""" <|body_0|> def update_cell(self, row, col): """Function that computes the update for one cell in the Game of Life""" ...
stack_v2_sparse_classes_36k_train_006489
1,456
no_license
[ { "docstring": "Function that performs one step of the Game of Life", "name": "update_gol", "signature": "def update_gol(self)" }, { "docstring": "Function that computes the update for one cell in the Game of Life", "name": "update_cell", "signature": "def update_cell(self, row, col)" ...
2
null
Implement the Python class `GameOfLife` described below. Class description: Extend Grid class to support Game of Life Method signatures and docstrings: - def update_gol(self): Function that performs one step of the Game of Life - def update_cell(self, row, col): Function that computes the update for one cell in the G...
Implement the Python class `GameOfLife` described below. Class description: Extend Grid class to support Game of Life Method signatures and docstrings: - def update_gol(self): Function that performs one step of the Game of Life - def update_cell(self, row, col): Function that computes the update for one cell in the G...
8d3000467be6ccef812dec0d9e95e108551f8b3b
<|skeleton|> class GameOfLife: """Extend Grid class to support Game of Life""" def update_gol(self): """Function that performs one step of the Game of Life""" <|body_0|> def update_cell(self, row, col): """Function that computes the update for one cell in the Game of Life""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameOfLife: """Extend Grid class to support Game of Life""" def update_gol(self): """Function that performs one step of the Game of Life""" updated_grid = [[self.update_cell(row, col) for col in range(self.get_grid_width())] for row in range(self.get_grid_height())] for col in ran...
the_stack_v2_python_sparse
principles_of_computing/pj5/gameoflife.py
creasyw/Courses
train
2
dfda78681fe7f41c8f6aecdce8fffbffdbf9448f
[ "self.explanation_type = explanation_type\nself._internal_obj = internal_obj\nself.feature_names = feature_names\nself.feature_types = feature_types\nself.name = name\nself.selector = selector", "if key is None:\n return self._internal_obj['overall']\nreturn None", "from ..visual.plot import plot_density\nda...
<|body_start_0|> self.explanation_type = explanation_type self._internal_obj = internal_obj self.feature_names = feature_names self.feature_types = feature_types self.name = name self.selector = selector <|end_body_0|> <|body_start_1|> if key is None: ...
Produces explanation specific to regression metrics.
RegressionExplanation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegressionExplanation: """Produces explanation specific to regression metrics.""" def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None): """Initializes class. Args: explanation_type: Type of explanation. internal_obj: A j...
stack_v2_sparse_classes_36k_train_006490
5,223
permissive
[ { "docstring": "Initializes class. Args: explanation_type: Type of explanation. internal_obj: A jsonable object that backs the explanation. feature_names: List of feature names. feature_types: List of feature types. name: User-defined name of explanation. selector: A dataframe whose indices correspond to explan...
3
stack_v2_sparse_classes_30k_test_000486
Implement the Python class `RegressionExplanation` described below. Class description: Produces explanation specific to regression metrics. Method signatures and docstrings: - def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None): Initializes class. Args:...
Implement the Python class `RegressionExplanation` described below. Class description: Produces explanation specific to regression metrics. Method signatures and docstrings: - def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None): Initializes class. Args:...
e6f38ea195aecbbd9d28c7183a83c65ada16e1ae
<|skeleton|> class RegressionExplanation: """Produces explanation specific to regression metrics.""" def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None): """Initializes class. Args: explanation_type: Type of explanation. internal_obj: A j...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegressionExplanation: """Produces explanation specific to regression metrics.""" def __init__(self, explanation_type, internal_obj, feature_names=None, feature_types=None, name=None, selector=None): """Initializes class. Args: explanation_type: Type of explanation. internal_obj: A jsonable objec...
the_stack_v2_python_sparse
python/interpret-core/interpret/perf/_regression.py
interpretml/interpret
train
3,731
83a8f33f1e130c8e392c79c943b2cc4f12ff4d28
[ "if not prices or len(prices) < 1:\n return 0\nn = len(prices)\nbuy = [0] * (n + 1)\nsell = [0] * (n + 1)\nbuy[1] = -prices[0]\nfor i in range(2, n + 1):\n price = prices[i - 1]\n buy[i] = max(sell[i - 2] - price, buy[i - 1])\n sell[i] = max(buy[i - 1] + price, sell[i - 1])\nreturn sell[n]", "n = len(...
<|body_start_0|> if not prices or len(prices) < 1: return 0 n = len(prices) buy = [0] * (n + 1) sell = [0] * (n + 1) buy[1] = -prices[0] for i in range(2, n + 1): price = prices[i - 1] buy[i] = max(sell[i - 2] - price, buy[i - 1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g "buy, sell, buy" or "buy, cooldown, cooldown" sell[i]: The maximum profit can b...
stack_v2_sparse_classes_36k_train_006491
3,095
no_license
[ { "docstring": ":type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g \"buy, sell, buy\" or \"buy, cooldown, cooldown\" sell[i]: The maximum profit can be made if the first i days end with sell or wa...
2
stack_v2_sparse_classes_30k_train_018869
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g "buy, sell, buy" or "buy, cooldown, cooldown" sell[i]: The maximum profit can b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int On any i-th day, we can buy, sell or cooldown buy[i]: The maximum profit can be made if the first i days end with buy or wait. E.g "buy, sell, buy" or "buy, cooldown, cooldown" sell[i]: The maximum profit can be made if the ...
the_stack_v2_python_sparse
B/BestTimetoBuyandSellStockWithCooldown.py
bssrdf/pyleet
train
2
bbbae4d58c8d219796a3b57516c379f085cc076b
[ "super(VisualShape, self).__init__()\nself.filename = filename\nself.scale = scale", "visual_id = p.createVisualShape(p.GEOM_MESH, fileName=self.filename, meshScale=[self.scale] * 3)\nbody_id = p.createMultiBody(baseCollisionShapeIndex=-1, baseVisualShapeIndex=visual_id)\nreturn body_id" ]
<|body_start_0|> super(VisualShape, self).__init__() self.filename = filename self.scale = scale <|end_body_0|> <|body_start_1|> visual_id = p.createVisualShape(p.GEOM_MESH, fileName=self.filename, meshScale=[self.scale] * 3) body_id = p.createMultiBody(baseCollisionShapeIndex=-...
Visual shape created with mesh file
VisualShape
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisualShape: """Visual shape created with mesh file""" def __init__(self, filename, scale=1.0): """Create a visual shape to show in pybullet and MeshRenderer :param filename: obj filename""" <|body_0|> def _load(self): """Load the object into pybullet""" ...
stack_v2_sparse_classes_36k_train_006492
891
permissive
[ { "docstring": "Create a visual shape to show in pybullet and MeshRenderer :param filename: obj filename", "name": "__init__", "signature": "def __init__(self, filename, scale=1.0)" }, { "docstring": "Load the object into pybullet", "name": "_load", "signature": "def _load(self)" } ]
2
null
Implement the Python class `VisualShape` described below. Class description: Visual shape created with mesh file Method signatures and docstrings: - def __init__(self, filename, scale=1.0): Create a visual shape to show in pybullet and MeshRenderer :param filename: obj filename - def _load(self): Load the object into...
Implement the Python class `VisualShape` described below. Class description: Visual shape created with mesh file Method signatures and docstrings: - def __init__(self, filename, scale=1.0): Create a visual shape to show in pybullet and MeshRenderer :param filename: obj filename - def _load(self): Load the object into...
db08f35fd645cae52d44b9696aedc905067bde13
<|skeleton|> class VisualShape: """Visual shape created with mesh file""" def __init__(self, filename, scale=1.0): """Create a visual shape to show in pybullet and MeshRenderer :param filename: obj filename""" <|body_0|> def _load(self): """Load the object into pybullet""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VisualShape: """Visual shape created with mesh file""" def __init__(self, filename, scale=1.0): """Create a visual shape to show in pybullet and MeshRenderer :param filename: obj filename""" super(VisualShape, self).__init__() self.filename = filename self.scale = scale ...
the_stack_v2_python_sparse
igibson/objects/visual_shape.py
junyaoshi/iGibson
train
1
79d8d649ec9ce5c99a240baa4178591ef8e8dbef
[ "CtrlDev.__init__(self, parent)\nself._diag = DiagWebcam(self)\nself._compat = CompatWebcam(self)\nself._guiClass = GUIWebcam", "try:\n self._callInfo()\n self._callCompat()\n runDiag = False\n for i in self._compatRes:\n runDiag = runDiag | (not i[0])\n if runDiag:\n self._callDiag()...
<|body_start_0|> CtrlDev.__init__(self, parent) self._diag = DiagWebcam(self) self._compat = CompatWebcam(self) self._guiClass = GUIWebcam <|end_body_0|> <|body_start_1|> try: self._callInfo() self._callCompat() runDiag = False for...
Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade e cria a tela de exibição.
CtrlWebcam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtrlWebcam: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'....
stack_v2_sparse_classes_36k_train_006493
1,399
no_license
[ { "docstring": "Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Executa o info, compat e diag (dependendo do resultado do compatibilidade) e cria as tela...
2
null
Implement the Python class `CtrlWebcam` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade e cria a tela de exibição. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributos '_diag', '_...
Implement the Python class `CtrlWebcam` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade e cria a tela de exibição. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributos '_diag', '_...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class CtrlWebcam: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CtrlWebcam: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'.""" C...
the_stack_v2_python_sparse
src/libs/webcam/ctrl_webcam.py
adrianomelo/ldc-desktop
train
1
f5fe0f7fea601c7891aed905f664d022b8727b6c
[ "if not root:\n return []\nret = []\nstack = []\ncur = root\nwhile cur:\n ret.append(cur.val)\n stack.append(cur)\n cur = cur.left\n while not cur and stack:\n cur = stack.pop().right\nreturn ret", "def traverse(n):\n if not n:\n return\n yield n.val\n yield from traverse(n.l...
<|body_start_0|> if not root: return [] ret = [] stack = [] cur = root while cur: ret.append(cur.val) stack.append(cur) cur = cur.left while not cur and stack: cur = stack.pop().right return ret <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """Jul 26, 2018 06:43""" <|body_0|> def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]: """Mar 05, 2023 14:14""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: retur...
stack_v2_sparse_classes_36k_train_006494
1,892
no_license
[ { "docstring": "Jul 26, 2018 06:43", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": "Mar 05, 2023 14:14", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): Jul 26, 2018 06:43 - def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]: Mar 05, 2023 14:14
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): Jul 26, 2018 06:43 - def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]: Mar 05, 2023 14:14 <|skeleton|> class Solution: ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def preorderTraversal(self, root): """Jul 26, 2018 06:43""" <|body_0|> def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]: """Mar 05, 2023 14:14""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """Jul 26, 2018 06:43""" if not root: return [] ret = [] stack = [] cur = root while cur: ret.append(cur.val) stack.append(cur) cur = cur.left while not cur ...
the_stack_v2_python_sparse
leetcode/solved/144_Binary_Tree_Preorder_Traversal/solution.py
sungminoh/algorithms
train
0
b8f78be36e80b18f38ff260de07d9748cec55b2b
[ "super().__init__()\nself.mode = mode\nself.qubit_names = qubit_names", "if self.mode == FilterMode.INCLUDE:\n return not all([qb_name in self.qubit_names for qb_name in qubit_names])\nelif self.mode == FilterMode.EXCLUDE:\n return not any([qb_name in self.qubit_names for qb_name in qubit_names])", "if no...
<|body_start_0|> super().__init__() self.mode = mode self.qubit_names = qubit_names <|end_body_0|> <|body_start_1|> if self.mode == FilterMode.INCLUDE: return not all([qb_name in self.qubit_names for qb_name in qubit_names]) elif self.mode == FilterMode.EXCLUDE: ...
A filter class to filter based on value nodes' `qubit` field
QubitFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QubitFilter: """A filter class to filter based on value nodes' `qubit` field""" def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, qubit_names=[]): """Creates a QubitFilter instance All qubit names in a node's `qubits` field must be in/or not in `self.qubit_names`; based on `mod...
stack_v2_sparse_classes_36k_train_006495
7,968
permissive
[ { "docstring": "Creates a QubitFilter instance All qubit names in a node's `qubits` field must be in/or not in `self.qubit_names`; based on `mode`. For example, if `mode=FilterMode.INCLUDE`, a value node will be filtered if any qubit name in `node['qubits']` is not in `qubit_names`. Args: mode (Filtermode, opti...
3
null
Implement the Python class `QubitFilter` described below. Class description: A filter class to filter based on value nodes' `qubit` field Method signatures and docstrings: - def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, qubit_names=[]): Creates a QubitFilter instance All qubit names in a node's `qubits` fie...
Implement the Python class `QubitFilter` described below. Class description: A filter class to filter based on value nodes' `qubit` field Method signatures and docstrings: - def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, qubit_names=[]): Creates a QubitFilter instance All qubit names in a node's `qubits` fie...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class QubitFilter: """A filter class to filter based on value nodes' `qubit` field""" def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, qubit_names=[]): """Creates a QubitFilter instance All qubit names in a node's `qubits` field must be in/or not in `self.qubit_names`; based on `mod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QubitFilter: """A filter class to filter based on value nodes' `qubit` field""" def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, qubit_names=[]): """Creates a QubitFilter instance All qubit names in a node's `qubits` field must be in/or not in `self.qubit_names`; based on `mode`. For examp...
the_stack_v2_python_sparse
pycqed/utilities/devicedb/filters.py
QudevETH/PycQED_py3
train
8
8d083100fee44589cc3da7b1acee55d86f120838
[ "res = nums.copy()\nlength = len(nums)\nfor i in range(2, k + 1):\n for j in range(length - i + 1):\n res[j] = max(res[j], nums[j + i - 1])\nreturn res[:length - k + 1]", "res = []\nmaxVal, maxPos = (float('-inf'), None)\nfor i, num in enumerate(nums[:k]):\n if num >= maxVal:\n maxVal, maxPos ...
<|body_start_0|> res = nums.copy() length = len(nums) for i in range(2, k + 1): for j in range(length - i + 1): res[j] = max(res[j], nums[j + i - 1]) return res[:length - k + 1] <|end_body_0|> <|body_start_1|> res = [] maxVal, maxPos = (float(...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """借鉴 shell sort ,从winsize=1 逐步扩张到 winsize=k ,每次只需要比较 新入windows的num 和原winsize_max 之间的大小即可 O(kn) But LTE""" <|body_0|> def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """滑动窗口...
stack_v2_sparse_classes_36k_train_006496
7,153
permissive
[ { "docstring": "借鉴 shell sort ,从winsize=1 逐步扩张到 winsize=k ,每次只需要比较 新入windows的num 和原winsize_max 之间的大小即可 O(kn) But LTE", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]" }, { "docstring": "滑动窗口法, 每次滑动 - first + last ,然后判断 max(windows) O(nk...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 借鉴 shell sort ,从winsize=1 逐步扩张到 winsize=k ,每次只需要比较 新入windows的num 和原winsize_max 之间的大小即可 O(kn) But LTE - def maxSl...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 借鉴 shell sort ,从winsize=1 逐步扩张到 winsize=k ,每次只需要比较 新入windows的num 和原winsize_max 之间的大小即可 O(kn) But LTE - def maxSl...
65549f72c565d9f11641c86d6cef9c7988805817
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """借鉴 shell sort ,从winsize=1 逐步扩张到 winsize=k ,每次只需要比较 新入windows的num 和原winsize_max 之间的大小即可 O(kn) But LTE""" <|body_0|> def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """滑动窗口...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """借鉴 shell sort ,从winsize=1 逐步扩张到 winsize=k ,每次只需要比较 新入windows的num 和原winsize_max 之间的大小即可 O(kn) But LTE""" res = nums.copy() length = len(nums) for i in range(2, k + 1): for j in range(lengt...
the_stack_v2_python_sparse
src/239.sliding-window-maximum.py
wisesky/LeetCode-Practice
train
0
61fb61379af3f23f6e053eaf8d7c1e5904a72afa
[ "if qca_passwd is None:\n qca_passwd = os.environ.get('QCAUSR', None)\nself.qc_spec = qc_spec\nself.client = FractalClient(address, username='user', password=qca_passwd, verify=False)\ntry:\n self.coll = base_class.from_server(name=coll_name, client=self.client)\nexcept KeyError as ex:\n if create:\n ...
<|body_start_0|> if qca_passwd is None: qca_passwd = os.environ.get('QCAUSR', None) self.qc_spec = qc_spec self.client = FractalClient(address, username='user', password=qca_passwd, verify=False) try: self.coll = base_class.from_server(name=coll_name, client=self....
Wrapper over a QFractal Dataset class Handles creating and authenticating with the underlying class method. It is a base class for building superclasses that create utility operations for adding molecules to the database (e.g., generate XYZ coordinates to allow for a 'just add this SMILES'), using a consistent identifi...
QCFractalWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QCFractalWrapper: """Wrapper over a QFractal Dataset class Handles creating and authenticating with the underlying class method. It is a base class for building superclasses that create utility operations for adding molecules to the database (e.g., generate XYZ coordinates to allow for a 'just ad...
stack_v2_sparse_classes_36k_train_006497
29,582
no_license
[ { "docstring": "Open the geometry computation dataset Args: address: Address for the QCFractal server base_class: Type of the collection qc_spec: Name of the QC specification coll_name: Name of the collection holding the data qca_passwd: Password for the QCFractal server create: Whether creating a new collectio...
2
stack_v2_sparse_classes_30k_train_021253
Implement the Python class `QCFractalWrapper` described below. Class description: Wrapper over a QFractal Dataset class Handles creating and authenticating with the underlying class method. It is a base class for building superclasses that create utility operations for adding molecules to the database (e.g., generate ...
Implement the Python class `QCFractalWrapper` described below. Class description: Wrapper over a QFractal Dataset class Handles creating and authenticating with the underlying class method. It is a base class for building superclasses that create utility operations for adding molecules to the database (e.g., generate ...
ef9e586e89053d1f6bea541717db8be43dbce0a4
<|skeleton|> class QCFractalWrapper: """Wrapper over a QFractal Dataset class Handles creating and authenticating with the underlying class method. It is a base class for building superclasses that create utility operations for adding molecules to the database (e.g., generate XYZ coordinates to allow for a 'just ad...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QCFractalWrapper: """Wrapper over a QFractal Dataset class Handles creating and authenticating with the underlying class method. It is a base class for building superclasses that create utility operations for adding molecules to the database (e.g., generate XYZ coordinates to allow for a 'just add this SMILES...
the_stack_v2_python_sparse
moldesign/simulate/qcfractal.py
exalearn/electrolyte-design
train
4
34553c79d3ced37c5e55a96fe3eccb5b18c29ec5
[ "self.Kd = Kd\nself.Kp = Kp\nself.Ki = Ki\nself.setpoint = setpoint\nself.output_limits = output_limits\nself.integral = 0\nself.last_error = 0\nself.last_value = 0\npass", "self.integral = 0\nself.last_error = 0\nself.last_value = 0", "error = self.setpoint - measurement\nderivative = error - self.last_error\n...
<|body_start_0|> self.Kd = Kd self.Kp = Kp self.Ki = Ki self.setpoint = setpoint self.output_limits = output_limits self.integral = 0 self.last_error = 0 self.last_value = 0 pass <|end_body_0|> <|body_start_1|> self.integral = 0 se...
Useful reusable PID class
PID
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PID: """Useful reusable PID class""" def __init__(self, Kd: float, Kp: float, Ki: float, setpoint=0.0, output_limits=None): """Initializes the PID controller :param Kd: The derivative portion of the PID controller :param Kp: The proportial portion of the PID controller :param Ki: The...
stack_v2_sparse_classes_36k_train_006498
1,854
permissive
[ { "docstring": "Initializes the PID controller :param Kd: The derivative portion of the PID controller :param Kp: The proportial portion of the PID controller :param Ki: The integral portion of the PID controller :param setpoint: The point that the PID is set to :param output_limits: Max and minimum setting for...
3
null
Implement the Python class `PID` described below. Class description: Useful reusable PID class Method signatures and docstrings: - def __init__(self, Kd: float, Kp: float, Ki: float, setpoint=0.0, output_limits=None): Initializes the PID controller :param Kd: The derivative portion of the PID controller :param Kp: Th...
Implement the Python class `PID` described below. Class description: Useful reusable PID class Method signatures and docstrings: - def __init__(self, Kd: float, Kp: float, Ki: float, setpoint=0.0, output_limits=None): Initializes the PID controller :param Kd: The derivative portion of the PID controller :param Kp: Th...
5509c07931d85583b0d99606f66817afb6fbcbe1
<|skeleton|> class PID: """Useful reusable PID class""" def __init__(self, Kd: float, Kp: float, Ki: float, setpoint=0.0, output_limits=None): """Initializes the PID controller :param Kd: The derivative portion of the PID controller :param Kp: The proportial portion of the PID controller :param Ki: The...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PID: """Useful reusable PID class""" def __init__(self, Kd: float, Kp: float, Ki: float, setpoint=0.0, output_limits=None): """Initializes the PID controller :param Kd: The derivative portion of the PID controller :param Kp: The proportial portion of the PID controller :param Ki: The integral por...
the_stack_v2_python_sparse
soccer_common/src/soccer_common/pid.py
utra-robosoccer/soccerbot
train
118
c3641d4e7463259190934193429f3317fc44c06d
[ "size = len(matrix)\nfor i in range(size):\n self.rotate_row(matrix, i)\nreturn", "size = len(matrix)\nfor j, v in enumerate(matrix[n][n:size - n - 1]):\n temp, i, j = self.exchange(matrix, size, n, j + n, matrix[n][j + n])\n temp, i, j = self.exchange(matrix, size, i, j, temp)\n temp, i, j = self.exc...
<|body_start_0|> size = len(matrix) for i in range(size): self.rotate_row(matrix, i) return <|end_body_0|> <|body_start_1|> size = len(matrix) for j, v in enumerate(matrix[n][n:size - n - 1]): temp, i, j = self.exchange(matrix, size, n, j + n, matrix[n][j...
Solution
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate_row(self, matrix, n): """n is the row index""" <|body_1|> def exchange(self, matrix, size, ...
stack_v2_sparse_classes_36k_train_006499
1,081
permissive
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "def rotate(self, matrix)" }, { "docstring": "n is the row index", "name": "rotate_row", "signature": "def rotate_row(self, matrix, n)" },...
3
stack_v2_sparse_classes_30k_train_008017
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate_row(self, matrix, n): n is the row index...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate_row(self, matrix, n): n is the row index...
2677b6d26bedb9bc6c6137a2392d0afaceb91ec2
<|skeleton|> class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate_row(self, matrix, n): """n is the row index""" <|body_1|> def exchange(self, matrix, size, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" size = len(matrix) for i in range(size): self.rotate_row(matrix, i) return def rotate_row(self, matrix, n): """n...
the_stack_v2_python_sparse
rotate_image/solution.py
haotianzhu/Questions_Solutions
train
0