blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
e18c788b49dd6a6d784af2a7ddda8e1ae40903f9
[ "super().__init__()\nself.model = model\nself.optimizer = optimizer\nself.loss_module = nn.CrossEntropyLoss()\nself.data_loader = data_loader\nself.data_iter = iter(self.data_loader)", "try:\n batch = next(self.data_iter)\nexcept StopIteration:\n self.data_iter = iter(self.data_loader)\n batch = next(sel...
<|body_start_0|> super().__init__() self.model = model self.optimizer = optimizer self.loss_module = nn.CrossEntropyLoss() self.data_loader = data_loader self.data_iter = iter(self.data_loader) <|end_body_0|> <|body_start_1|> try: batch = next(self.da...
DistributionFitting
[ "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistributionFitting: def __init__(self, model, optimizer, data_loader): """Creates a DistributionFitting object that summarizes all functionalities for performing the distribution fitting stage of ENCO. Parameters ---------- model : MultivarMLP PyTorch module of the neural networks that ...
stack_v2_sparse_classes_75kplus_train_065400
3,579
permissive
[ { "docstring": "Creates a DistributionFitting object that summarizes all functionalities for performing the distribution fitting stage of ENCO. Parameters ---------- model : MultivarMLP PyTorch module of the neural networks that model the conditional distributions. optimizer : torch.optim.Optimizer Standard PyT...
5
stack_v2_sparse_classes_30k_train_053669
Implement the Python class `DistributionFitting` described below. Class description: Implement the DistributionFitting class. Method signatures and docstrings: - def __init__(self, model, optimizer, data_loader): Creates a DistributionFitting object that summarizes all functionalities for performing the distribution ...
Implement the Python class `DistributionFitting` described below. Class description: Implement the DistributionFitting class. Method signatures and docstrings: - def __init__(self, model, optimizer, data_loader): Creates a DistributionFitting object that summarizes all functionalities for performing the distribution ...
cffd2793fddc7df4acb31758d71e19f88986dc14
<|skeleton|> class DistributionFitting: def __init__(self, model, optimizer, data_loader): """Creates a DistributionFitting object that summarizes all functionalities for performing the distribution fitting stage of ENCO. Parameters ---------- model : MultivarMLP PyTorch module of the neural networks that ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DistributionFitting: def __init__(self, model, optimizer, data_loader): """Creates a DistributionFitting object that summarizes all functionalities for performing the distribution fitting stage of ENCO. Parameters ---------- model : MultivarMLP PyTorch module of the neural networks that model the cond...
the_stack_v2_python_sparse
causal_discovery/distribution_fitting.py
codeaudit/ENCO
train
0
059c9a77e1e06e8ef81846f6b85788d26e97e106
[ "\"\"\"\n ### Option 1 : Iteration (faster)\n digits[-1] += 1\n\n i = 0\n for i in range(len(digits)) :\n if digits[-1-i] < 10 :\n break\n elif i+1 < len(digits) :\n digits[-1-i] = 0\n digits[-2-i] += 1\n else ...
<|body_start_0|> """ ### Option 1 : Iteration (faster) digits[-1] += 1 i = 0 for i in range(len(digits)) : if digits[-1-i] < 10 : break elif i+1 < len(digits) : ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int] test cases: [1,2,3] => [1,2,4] [0] => [1] [1,9] => [2,0] [9,9] => [1,0,0] Time Complexity : best O(1) worst O(n) Space Complexity : O(1)""" <|body_0|> def plusOne(self, digits: List[int]) -> Li...
stack_v2_sparse_classes_75kplus_train_065401
2,415
no_license
[ { "docstring": ":type digits: List[int] :rtype: List[int] test cases: [1,2,3] => [1,2,4] [0] => [1] [1,9] => [2,0] [9,9] => [1,0,0] Time Complexity : best O(1) worst O(n) Space Complexity : O(1)", "name": "plusOne", "signature": "def plusOne(self, digits)" }, { "docstring": "[9,9,9] #need an ins...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] test cases: [1,2,3] => [1,2,4] [0] => [1] [1,9] => [2,0] [9,9] => [1,0,0] Time Complexity : best O(1) worst O...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] test cases: [1,2,3] => [1,2,4] [0] => [1] [1,9] => [2,0] [9,9] => [1,0,0] Time Complexity : best O(1) worst O...
eaccc82e3068e92b17d76d42666829ccd28e7661
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int] test cases: [1,2,3] => [1,2,4] [0] => [1] [1,9] => [2,0] [9,9] => [1,0,0] Time Complexity : best O(1) worst O(n) Space Complexity : O(1)""" <|body_0|> def plusOne(self, digits: List[int]) -> Li...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int] test cases: [1,2,3] => [1,2,4] [0] => [1] [1,9] => [2,0] [9,9] => [1,0,0] Time Complexity : best O(1) worst O(n) Space Complexity : O(1)""" """ ### Option 1 : Iteration (faster) di...
the_stack_v2_python_sparse
66_Plus_One.py
becomeuseless/WeUseless
train
1
46bd49f9fba63ef62991e2ff3c465c8048967684
[ "product = product_db.Product.get_by_key_name(product_id)\nif not product:\n self.error(httplib.NOT_FOUND)\n return\nif not client_id:\n clients = client_db.Client.all()\n clients.ancestor(product)\n clients_result = []\n for client in clients:\n clients_result.append({'client_id': client.k...
<|body_start_0|> product = product_db.Product.get_by_key_name(product_id) if not product: self.error(httplib.NOT_FOUND) return if not client_id: clients = client_db.Client.all() clients.ancestor(product) clients_result = [] ...
A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route can be used for the handler.
ClientHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientHandler: """A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route ...
stack_v2_sparse_classes_75kplus_train_065402
5,848
no_license
[ { "docstring": "Responds with information about all clients or a specific client. /clients/<product>/ Responds with a JSON encoded object that contains a list of client IDs for the given product. /clients/<product>/<client> Responds with a JSON encoded object of the product ID, client ID, description and child ...
4
stack_v2_sparse_classes_30k_train_007168
Implement the Python class `ClientHandler` described below. Class description: A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all ...
Implement the Python class `ClientHandler` described below. Class description: A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all ...
4fe608d3225f38e765928c137214428cb60c3cd1
<|skeleton|> class ClientHandler: """A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClientHandler: """A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route can be used f...
the_stack_v2_python_sparse
syzygy/dashboard/handler/client.py
TheRyuu/sawbuck
train
4
1e12709f54a7ef504a524019d0c1f7dd86608e31
[ "if len(nums) == 1:\n return nums[0]\n\ndef my_rob(nums):\n if not nums:\n return 0\n if len(nums) == 1:\n return nums[0]\n memo = [0] * len(nums)\n memo[0] = nums[0]\n memo[1] = max(memo[0], nums[1])\n for i in range(2, len(nums)):\n memo[i] = max(memo[i - 2] + nums[i], me...
<|body_start_0|> if len(nums) == 1: return nums[0] def my_rob(nums): if not nums: return 0 if len(nums) == 1: return nums[0] memo = [0] * len(nums) memo[0] = nums[0] memo[1] = max(memo[0], nums[1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob_2variables(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 1: ...
stack_v2_sparse_classes_75kplus_train_065403
1,316
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: int", "name": "rob_2variables", "signature": "def rob_2variables(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_030970
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob_2variables(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob_2variables(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob_2variables(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 1: return nums[0] def my_rob(nums): if not nums: return 0 if len(nums) == 1: return nums[0] memo = [0] * len(nums) ...
the_stack_v2_python_sparse
LeetCode/DynamicProgramming/213_house_robber_ii.py
XyK0907/for_work
train
0
0fb9d6738e26068cdb2aec8982158f906ea6a443
[ "ride = self.context['ride']\nrating_set = ride.rating.all()\nuser_rating = rating_set.get(user=user)\nrating_query = rating_set.filter(user=user, score__gt=0)\nif user not in ride.passengers.all():\n raise serializers.ValidationError('You are not in the ride.')\nif rating_query.exists():\n raise serializers....
<|body_start_0|> ride = self.context['ride'] rating_set = ride.rating.all() user_rating = rating_set.get(user=user) rating_query = rating_set.filter(user=user, score__gt=0) if user not in ride.passengers.all(): raise serializers.ValidationError('You are not in the rid...
QualifyRideSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QualifyRideSerializer: def validate_user(self, user): """Validate that: The user has not already given a rating The user is part of the ride""" <|body_0|> def validate_qualification(self, qualification): """Validates then qualification is greater then 0""" <|...
stack_v2_sparse_classes_75kplus_train_065404
9,158
permissive
[ { "docstring": "Validate that: The user has not already given a rating The user is part of the ride", "name": "validate_user", "signature": "def validate_user(self, user)" }, { "docstring": "Validates then qualification is greater then 0", "name": "validate_qualification", "signature": "...
4
stack_v2_sparse_classes_30k_train_016220
Implement the Python class `QualifyRideSerializer` described below. Class description: Implement the QualifyRideSerializer class. Method signatures and docstrings: - def validate_user(self, user): Validate that: The user has not already given a rating The user is part of the ride - def validate_qualification(self, qu...
Implement the Python class `QualifyRideSerializer` described below. Class description: Implement the QualifyRideSerializer class. Method signatures and docstrings: - def validate_user(self, user): Validate that: The user has not already given a rating The user is part of the ride - def validate_qualification(self, qu...
cb30f1cb6cdafe81fd61ff7539ecaa39f3751353
<|skeleton|> class QualifyRideSerializer: def validate_user(self, user): """Validate that: The user has not already given a rating The user is part of the ride""" <|body_0|> def validate_qualification(self, qualification): """Validates then qualification is greater then 0""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QualifyRideSerializer: def validate_user(self, user): """Validate that: The user has not already given a rating The user is part of the ride""" ride = self.context['ride'] rating_set = ride.rating.all() user_rating = rating_set.get(user=user) rating_query = rating_set.f...
the_stack_v2_python_sparse
cride/rides/serializers/rides.py
ChekeGT/Comparte-Ride
train
1
bb2dcd274f9d6bf1dadffaab697538dccd0def86
[ "self.coverage = coverage\nself.ignore_errors = ignore_errors\nself.code_units = []\nself.directory = None", "morfs = morfs or self.coverage.data.measured_files()\nfile_locator = self.coverage.file_locator\nself.code_units = code_unit_factory(morfs, file_locator)\nif config.include:\n patterns = [file_locator....
<|body_start_0|> self.coverage = coverage self.ignore_errors = ignore_errors self.code_units = [] self.directory = None <|end_body_0|> <|body_start_1|> morfs = morfs or self.coverage.data.measured_files() file_locator = self.coverage.file_locator self.code_units ...
A base class for all reporters.
Reporter
[ "W3C", "LGPL-2.0-only", "BSD-3-Clause", "MIT", "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reporter: """A base class for all reporters.""" def __init__(self, coverage, ignore_errors=False): """Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing.""" <|body_0|> def find_code_un...
stack_v2_sparse_classes_75kplus_train_065405
2,906
permissive
[ { "docstring": "Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing.", "name": "__init__", "signature": "def __init__(self, coverage, ignore_errors=False)" }, { "docstring": "Find the code units we'll report on...
3
stack_v2_sparse_classes_30k_val_002463
Implement the Python class `Reporter` described below. Class description: A base class for all reporters. Method signatures and docstrings: - def __init__(self, coverage, ignore_errors=False): Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during fil...
Implement the Python class `Reporter` described below. Class description: A base class for all reporters. Method signatures and docstrings: - def __init__(self, coverage, ignore_errors=False): Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during fil...
acefdaaadd3ef46f10f63d1acae2259e4024d383
<|skeleton|> class Reporter: """A base class for all reporters.""" def __init__(self, coverage, ignore_errors=False): """Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing.""" <|body_0|> def find_code_un...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Reporter: """A base class for all reporters.""" def __init__(self, coverage, ignore_errors=False): """Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing.""" self.coverage = coverage self.ignore_...
the_stack_v2_python_sparse
third_party/blink/Tools/Scripts/webkitpy/thirdparty/coverage/report.py
youtube/cobalt
train
169
10be8be9aa9584969a9e4ae55e924e0d0cdd8c9a
[ "junk_Decor.print_sep()\nt_items = cur.execute(' SELECT * FROM details WHERE %s = ?' % data, (value,))\nlist_db = []\nfor item in t_items:\n list_db.append(item)\njunk_Decor.print_sep()\nreturn list_db", "junk_Decor.print_sep()\nt_items = cur.execute(' SELECT * FROM details WHERE %s > ?' % data, (value,))\nlis...
<|body_start_0|> junk_Decor.print_sep() t_items = cur.execute(' SELECT * FROM details WHERE %s = ?' % data, (value,)) list_db = [] for item in t_items: list_db.append(item) junk_Decor.print_sep() return list_db <|end_body_0|> <|body_start_1|> junk_Dec...
MIS_calculations
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MIS_calculations: def separate_data_equal(data, value): """data will contain the data part ex "sl_no" or "name" or "e_mail etc." value will conatin the value of the data to be separated or sorted out from based on equality!""" <|body_0|> def separate_data_greater(data, value...
stack_v2_sparse_classes_75kplus_train_065406
10,620
permissive
[ { "docstring": "data will contain the data part ex \"sl_no\" or \"name\" or \"e_mail etc.\" value will conatin the value of the data to be separated or sorted out from based on equality!", "name": "separate_data_equal", "signature": "def separate_data_equal(data, value)" }, { "docstring": "data ...
4
stack_v2_sparse_classes_30k_train_032001
Implement the Python class `MIS_calculations` described below. Class description: Implement the MIS_calculations class. Method signatures and docstrings: - def separate_data_equal(data, value): data will contain the data part ex "sl_no" or "name" or "e_mail etc." value will conatin the value of the data to be separat...
Implement the Python class `MIS_calculations` described below. Class description: Implement the MIS_calculations class. Method signatures and docstrings: - def separate_data_equal(data, value): data will contain the data part ex "sl_no" or "name" or "e_mail etc." value will conatin the value of the data to be separat...
8d4c16b9e960d352a7775786ea60290b29b30143
<|skeleton|> class MIS_calculations: def separate_data_equal(data, value): """data will contain the data part ex "sl_no" or "name" or "e_mail etc." value will conatin the value of the data to be separated or sorted out from based on equality!""" <|body_0|> def separate_data_greater(data, value...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MIS_calculations: def separate_data_equal(data, value): """data will contain the data part ex "sl_no" or "name" or "e_mail etc." value will conatin the value of the data to be separated or sorted out from based on equality!""" junk_Decor.print_sep() t_items = cur.execute(' SELECT * FRO...
the_stack_v2_python_sparse
python_gui_tkinter/KALU/Version 0.1/MISman.py
Jimut123/code-backup
train
9
57de9a46dfbf33b117c2dfbb534a5020e019d520
[ "ret = [0]\nfor i in range(1, len(pattern)):\n j = ret[i - 1]\n while j > 0 and pattern[j] != pattern[i]:\n j = ret[j - 1]\n ret.append(j + 1 if pattern[j] == pattern[i] else j)\nreturn ret", "partial, j = (self.partial(P), 0)\nfor i in range(len(T)):\n while j > 0 and T[i] != P[j]:\n j ...
<|body_start_0|> ret = [0] for i in range(1, len(pattern)): j = ret[i - 1] while j > 0 and pattern[j] != pattern[i]: j = ret[j - 1] ret.append(j + 1 if pattern[j] == pattern[i] else j) return ret <|end_body_0|> <|body_start_1|> partial...
KMP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KMP: def partial(self, pattern): """Calculate partial match table: String -> [Int]""" <|body_0|> def search(self, T, P): """KMP search main algorithm: String -> String -> [Int] Return all the matching position of pattern string P in T""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_75kplus_train_065407
45,905
no_license
[ { "docstring": "Calculate partial match table: String -> [Int]", "name": "partial", "signature": "def partial(self, pattern)" }, { "docstring": "KMP search main algorithm: String -> String -> [Int] Return all the matching position of pattern string P in T", "name": "search", "signature":...
2
stack_v2_sparse_classes_30k_train_000065
Implement the Python class `KMP` described below. Class description: Implement the KMP class. Method signatures and docstrings: - def partial(self, pattern): Calculate partial match table: String -> [Int] - def search(self, T, P): KMP search main algorithm: String -> String -> [Int] Return all the matching position o...
Implement the Python class `KMP` described below. Class description: Implement the KMP class. Method signatures and docstrings: - def partial(self, pattern): Calculate partial match table: String -> [Int] - def search(self, T, P): KMP search main algorithm: String -> String -> [Int] Return all the matching position o...
7e9f47e1dc7c79802ad7ff692514f1314815515a
<|skeleton|> class KMP: def partial(self, pattern): """Calculate partial match table: String -> [Int]""" <|body_0|> def search(self, T, P): """KMP search main algorithm: String -> String -> [Int] Return all the matching position of pattern string P in T""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KMP: def partial(self, pattern): """Calculate partial match table: String -> [Int]""" ret = [0] for i in range(1, len(pattern)): j = ret[i - 1] while j > 0 and pattern[j] != pattern[i]: j = ret[j - 1] ret.append(j + 1 if pattern[j] ==...
the_stack_v2_python_sparse
python/820. Short Encoding of Words.py
forrest0402/leetcode
train
0
cf223f2937e86fe317e5b3706026fddc724017fd
[ "logging.Handler.__init__(self)\nif not isinstance(database, LogMaster) and (not isinstance(database, LogReadWrite)):\n raise TypeError('A LogMaster or LogReadWrite object must be specified. A {:} was specified instead'.format(type(database)))\nself.database_name = database.database_name\nself.write_log = databa...
<|body_start_0|> logging.Handler.__init__(self) if not isinstance(database, LogMaster) and (not isinstance(database, LogReadWrite)): raise TypeError('A LogMaster or LogReadWrite object must be specified. A {:} was specified instead'.format(type(database))) self.database_name = databa...
A handler class which writes logging records, appropriately formatted, to the a specified database's permanent log. This is used to simplify the log generation process with the use of the python "logging" package.
MongoLogHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MongoLogHandler: """A handler class which writes logging records, appropriately formatted, to the a specified database's permanent log. This is used to simplify the log generation process with the use of the python "logging" package.""" def __init__(self, database): """A LogMaster or...
stack_v2_sparse_classes_75kplus_train_065408
47,472
no_license
[ { "docstring": "A LogMaster or LogReadWrite object must be specified. The resulting handler object will have a 'database_name' attribute that can be used to identify the handler's destination.", "name": "__init__", "signature": "def __init__(self, database)" }, { "docstring": "If a formatter is ...
2
stack_v2_sparse_classes_30k_train_038217
Implement the Python class `MongoLogHandler` described below. Class description: A handler class which writes logging records, appropriately formatted, to the a specified database's permanent log. This is used to simplify the log generation process with the use of the python "logging" package. Method signatures and d...
Implement the Python class `MongoLogHandler` described below. Class description: A handler class which writes logging records, appropriately formatted, to the a specified database's permanent log. This is used to simplify the log generation process with the use of the python "logging" package. Method signatures and d...
aab8f9789cb6d9b824836ffa4613b4b17d7d4df6
<|skeleton|> class MongoLogHandler: """A handler class which writes logging records, appropriately formatted, to the a specified database's permanent log. This is used to simplify the log generation process with the use of the python "logging" package.""" def __init__(self, database): """A LogMaster or...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MongoLogHandler: """A handler class which writes logging records, appropriately formatted, to the a specified database's permanent log. This is used to simplify the log generation process with the use of the python "logging" package.""" def __init__(self, database): """A LogMaster or LogReadWrite...
the_stack_v2_python_sparse
Drivers/Database/MongoDB.py
cdfredrick/AstroComb_HPF
train
1
058dc0ccbd8acae862f2d48e8f1c1a7282c5692c
[ "if six.PY2:\n class_name = b'{0:s}Comment'.format(self.__name__)\nelse:\n class_name = '{0:s}Comment'.format(self.__name__)\nself.Comment = type(class_name, (Comment, BaseModel), dict(__tablename__='{0:s}_comment'.format(self.__tablename__), parent_id=Column(Integer, ForeignKey('{0:s}.id'.format(self.__table...
<|body_start_0|> if six.PY2: class_name = b'{0:s}Comment'.format(self.__name__) else: class_name = '{0:s}Comment'.format(self.__name__) self.Comment = type(class_name, (Comment, BaseModel), dict(__tablename__='{0:s}_comment'.format(self.__tablename__), parent_id=Column(In...
A MixIn for generating the necessary tables in the database and to make it accessible from the parent model object (the model object that uses this MixIn, i.e. the object that the comment is added to).
CommentMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentMixin: """A MixIn for generating the necessary tables in the database and to make it accessible from the parent model object (the model object that uses this MixIn, i.e. the object that the comment is added to).""" def comments(self): """Generates the comment tables and adds t...
stack_v2_sparse_classes_75kplus_train_065409
12,641
permissive
[ { "docstring": "Generates the comment tables and adds the attribute to the parent model object. Returns: A relationship to a comment (timesketch.models.annotation.Comment)", "name": "comments", "signature": "def comments(self)" }, { "docstring": "Remove a comment from an event. Args: comment_id:...
4
stack_v2_sparse_classes_30k_train_031052
Implement the Python class `CommentMixin` described below. Class description: A MixIn for generating the necessary tables in the database and to make it accessible from the parent model object (the model object that uses this MixIn, i.e. the object that the comment is added to). Method signatures and docstrings: - de...
Implement the Python class `CommentMixin` described below. Class description: A MixIn for generating the necessary tables in the database and to make it accessible from the parent model object (the model object that uses this MixIn, i.e. the object that the comment is added to). Method signatures and docstrings: - de...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class CommentMixin: """A MixIn for generating the necessary tables in the database and to make it accessible from the parent model object (the model object that uses this MixIn, i.e. the object that the comment is added to).""" def comments(self): """Generates the comment tables and adds t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommentMixin: """A MixIn for generating the necessary tables in the database and to make it accessible from the parent model object (the model object that uses this MixIn, i.e. the object that the comment is added to).""" def comments(self): """Generates the comment tables and adds the attribute ...
the_stack_v2_python_sparse
timesketch/models/annotations.py
google/timesketch
train
2,263
5bfa83f914b425806bb716ba32083ed7543a8150
[ "if self.transactions:\n return self.transactions[0].date_in_utc\nreturn None", "if self.transactions:\n return self.transactions[0].status\nreturn None", "if self.transactions:\n return self.transactions[0].gross_gift_amount\nreturn None" ]
<|body_start_0|> if self.transactions: return self.transactions[0].date_in_utc return None <|end_body_0|> <|body_start_1|> if self.transactions: return self.transactions[0].status return None <|end_body_1|> <|body_start_2|> if self.transactions: ...
Head, or master table, for donations.
GiftModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GiftModel: """Head, or master table, for donations.""" def date_in_utc(self): """Place latest transaction date_in_utc on the Gift.""" <|body_0|> def status(self): """Place latest transaction status on the Gift.""" <|body_1|> def gross_gift_amount(sel...
stack_v2_sparse_classes_75kplus_train_065410
2,591
no_license
[ { "docstring": "Place latest transaction date_in_utc on the Gift.", "name": "date_in_utc", "signature": "def date_in_utc(self)" }, { "docstring": "Place latest transaction status on the Gift.", "name": "status", "signature": "def status(self)" }, { "docstring": "Place latest tran...
3
null
Implement the Python class `GiftModel` described below. Class description: Head, or master table, for donations. Method signatures and docstrings: - def date_in_utc(self): Place latest transaction date_in_utc on the Gift. - def status(self): Place latest transaction status on the Gift. - def gross_gift_amount(self): ...
Implement the Python class `GiftModel` described below. Class description: Head, or master table, for donations. Method signatures and docstrings: - def date_in_utc(self): Place latest transaction date_in_utc on the Gift. - def status(self): Place latest transaction status on the Gift. - def gross_gift_amount(self): ...
d5ffcc5d276692d1578cea704125b1b3952beb1c
<|skeleton|> class GiftModel: """Head, or master table, for donations.""" def date_in_utc(self): """Place latest transaction date_in_utc on the Gift.""" <|body_0|> def status(self): """Place latest transaction status on the Gift.""" <|body_1|> def gross_gift_amount(sel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GiftModel: """Head, or master table, for donations.""" def date_in_utc(self): """Place latest transaction date_in_utc on the Gift.""" if self.transactions: return self.transactions[0].date_in_utc return None def status(self): """Place latest transaction st...
the_stack_v2_python_sparse
application/models/gift.py
transreductionist/API-Project-1
train
0
e12fad3f557ff3e11124c7f0244960a51f7f4628
[ "self.histogram_backprojection = HistogramBackprojection(filepath)\nself.service = rospy.Service('perform_detection', ImageProcessing, self.annotateImage)\nself.bridge = CvBridge()\nrospy.logdebug('Histrogram Backprojection service is available')", "cv_image = self.bridge.imgmsg_to_cv2(req.input_image, '8UC3')\nr...
<|body_start_0|> self.histogram_backprojection = HistogramBackprojection(filepath) self.service = rospy.Service('perform_detection', ImageProcessing, self.annotateImage) self.bridge = CvBridge() rospy.logdebug('Histrogram Backprojection service is available') <|end_body_0|> <|body_start...
Creates a ROS service that takes a sensor_msgs/Image and returns a sensor_msgs/Image resulting from using histogram backprojection detection.
HistogramBackprojectionServer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistogramBackprojectionServer: """Creates a ROS service that takes a sensor_msgs/Image and returns a sensor_msgs/Image resulting from using histogram backprojection detection.""" def __init__(self, filepath): """Constructor takes an input filepath to the .npy file containing the hist...
stack_v2_sparse_classes_75kplus_train_065411
1,701
permissive
[ { "docstring": "Constructor takes an input filepath to the .npy file containing the histogram", "name": "__init__", "signature": "def __init__(self, filepath)" }, { "docstring": "Callback function for ImageProcessing Service. Return image is the same size as the input image", "name": "annota...
2
null
Implement the Python class `HistogramBackprojectionServer` described below. Class description: Creates a ROS service that takes a sensor_msgs/Image and returns a sensor_msgs/Image resulting from using histogram backprojection detection. Method signatures and docstrings: - def __init__(self, filepath): Constructor tak...
Implement the Python class `HistogramBackprojectionServer` described below. Class description: Creates a ROS service that takes a sensor_msgs/Image and returns a sensor_msgs/Image resulting from using histogram backprojection detection. Method signatures and docstrings: - def __init__(self, filepath): Constructor tak...
56cdb6a05ee47827b4cb9428c4357ea30981176e
<|skeleton|> class HistogramBackprojectionServer: """Creates a ROS service that takes a sensor_msgs/Image and returns a sensor_msgs/Image resulting from using histogram backprojection detection.""" def __init__(self, filepath): """Constructor takes an input filepath to the .npy file containing the hist...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HistogramBackprojectionServer: """Creates a ROS service that takes a sensor_msgs/Image and returns a sensor_msgs/Image resulting from using histogram backprojection detection.""" def __init__(self, filepath): """Constructor takes an input filepath to the .npy file containing the histogram""" ...
the_stack_v2_python_sparse
pcs_ros/src/histogram_backprojection_node
arkinrc/point_cloud_segmentation
train
0
9fec0e39bfb50cf0f9fb31074baa90632d9712c1
[ "pl = PageLogin(self.driver)\npl.quick_login()\nree = ReceiveEmail(self.driver)\nmail_num1 = ree.sent_mail_statistics()\nree.goto_inbox()\nself.driver.switch_to.frame('mainFrame')\nree.single_check(0)\nree.move_to_sent()\nsleep(1)\nself.driver.switch_to.default_content()\nassert ree.get_message_box() == '已将邮件成功移动 [...
<|body_start_0|> pl = PageLogin(self.driver) pl.quick_login() ree = ReceiveEmail(self.driver) mail_num1 = ree.sent_mail_statistics() ree.goto_inbox() self.driver.switch_to.frame('mainFrame') ree.single_check(0) ree.move_to_sent() sleep(1) s...
测试信件移动功能(移动到已发送)
TestMoveToSent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMoveToSent: """测试信件移动功能(移动到已发送)""" def test1_move_to_sent(self): """测试随机勾选单个邮件移动到已发送""" <|body_0|> def test2_move_to_sent(self): """测试随机批量勾选邮件标移动到已发送""" <|body_1|> def test3_move_to_sent(self): """测试按发件人姓名勾选邮件移动到已发送""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_065412
5,009
no_license
[ { "docstring": "测试随机勾选单个邮件移动到已发送", "name": "test1_move_to_sent", "signature": "def test1_move_to_sent(self)" }, { "docstring": "测试随机批量勾选邮件标移动到已发送", "name": "test2_move_to_sent", "signature": "def test2_move_to_sent(self)" }, { "docstring": "测试按发件人姓名勾选邮件移动到已发送", "name": "test3...
4
stack_v2_sparse_classes_30k_train_038928
Implement the Python class `TestMoveToSent` described below. Class description: 测试信件移动功能(移动到已发送) Method signatures and docstrings: - def test1_move_to_sent(self): 测试随机勾选单个邮件移动到已发送 - def test2_move_to_sent(self): 测试随机批量勾选邮件标移动到已发送 - def test3_move_to_sent(self): 测试按发件人姓名勾选邮件移动到已发送 - def test4_move_to_sent(self): 测试勾选当...
Implement the Python class `TestMoveToSent` described below. Class description: 测试信件移动功能(移动到已发送) Method signatures and docstrings: - def test1_move_to_sent(self): 测试随机勾选单个邮件移动到已发送 - def test2_move_to_sent(self): 测试随机批量勾选邮件标移动到已发送 - def test3_move_to_sent(self): 测试按发件人姓名勾选邮件移动到已发送 - def test4_move_to_sent(self): 测试勾选当...
d6fb7c64903dfbf89f9b10f4bc3beb72e7c251f5
<|skeleton|> class TestMoveToSent: """测试信件移动功能(移动到已发送)""" def test1_move_to_sent(self): """测试随机勾选单个邮件移动到已发送""" <|body_0|> def test2_move_to_sent(self): """测试随机批量勾选邮件标移动到已发送""" <|body_1|> def test3_move_to_sent(self): """测试按发件人姓名勾选邮件移动到已发送""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestMoveToSent: """测试信件移动功能(移动到已发送)""" def test1_move_to_sent(self): """测试随机勾选单个邮件移动到已发送""" pl = PageLogin(self.driver) pl.quick_login() ree = ReceiveEmail(self.driver) mail_num1 = ree.sent_mail_statistics() ree.goto_inbox() self.driver.switch_to.fr...
the_stack_v2_python_sparse
QQ_mail_auto_test/mail_auto_test/test_case/testL_move_to_sent.py
jianghualuo/python_selenium
train
0
fbd56d646930a400bad223587d419ae56059ad6a
[ "if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nfor edge in self.graph.iteredges():\n if edge.source == edge.target:\n raise ValueError('a loop detected')\nself.independent_set = None\nself.cardinality = 0\nself.source = None", "if source is not None:\n se...
<|body_start_0|> if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): if edge.source == edge.target: raise ValueError('a loop detected') self.independent_set = None self.ca...
Find a maximal independent set.
LargestLastIndependentSet6
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LargestLastIndependentSet6: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if ...
stack_v2_sparse_classes_75kplus_train_065413
12,259
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None)" } ]
2
stack_v2_sparse_classes_30k_train_000637
Implement the Python class `LargestLastIndependentSet6` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode.
Implement the Python class `LargestLastIndependentSet6` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode. <|skeleton|> class LargestLastIndependentSet6: ...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class LargestLastIndependentSet6: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LargestLastIndependentSet6: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): ...
the_stack_v2_python_sparse
graphtheory/independentsets/isetll.py
kgashok/graphs-dict
train
0
79205759e44904843ef5999daeaeaf4fb8e02563
[ "s = sum(nums)\nif s % k != 0:\n return False\ntarget = s // k\nvisited = [False for _ in nums]\nreturn self.dfs(nums, None, target, visited, k)", "if k == 0:\n return True\nif cur_sum and cur_sum == target_sum:\n return self.dfs(nums, None, target_sum, visited, k - 1)\nfor i in range(len(nums)):\n if...
<|body_start_0|> s = sum(nums) if s % k != 0: return False target = s // k visited = [False for _ in nums] return self.dfs(nums, None, target, visited, k) <|end_body_0|> <|body_start_1|> if k == 0: return True if cur_sum and cur_sum == tar...
Solution_TLE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_TLE: def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: """resurive search""" <|body_0|> def dfs(self, nums, cur_sum, target_sum, visited, k): """some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0...
stack_v2_sparse_classes_75kplus_train_065414
3,307
no_license
[ { "docstring": "resurive search", "name": "canPartitionKSubsets", "signature": "def canPartitionKSubsets(self, nums: List[int], k: int) -> bool" }, { "docstring": "some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0) + nums[i] rather than cur_sum or...
2
stack_v2_sparse_classes_30k_val_001144
Implement the Python class `Solution_TLE` described below. Class description: Implement the Solution_TLE class. Method signatures and docstrings: - def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: resurive search - def dfs(self, nums, cur_sum, target_sum, visited, k): some corner cases: 1. target_sum ...
Implement the Python class `Solution_TLE` described below. Class description: Implement the Solution_TLE class. Method signatures and docstrings: - def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: resurive search - def dfs(self, nums, cur_sum, target_sum, visited, k): some corner cases: 1. target_sum ...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution_TLE: def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: """resurive search""" <|body_0|> def dfs(self, nums, cur_sum, target_sum, visited, k): """some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution_TLE: def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: """resurive search""" s = sum(nums) if s % k != 0: return False target = s // k visited = [False for _ in nums] return self.dfs(nums, None, target, visited, k) def df...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/698 Partition to K Equal Sum Subsets.py
syurskyi/Algorithms_and_Data_Structure
train
4
bb0d81c23dbcd095db4bf9248a4e84686580b611
[ "cache_key = (calendar_year, str(price_types), fuel_id)\nif cache_key not in FuelPrice._data:\n if omega_globals.options.flat_context:\n calendar_year = omega_globals.options.flat_context_year\n else:\n calendar_year = max(FuelPrice._data['min_calendar_year'], min(calendar_year, FuelPrice._data[...
<|body_start_0|> cache_key = (calendar_year, str(price_types), fuel_id) if cache_key not in FuelPrice._data: if omega_globals.options.flat_context: calendar_year = omega_globals.options.flat_context_year else: calendar_year = max(FuelPrice._data['m...
**Loads and provides access to fuel prices from the analysis context**
FuelPrice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuelPrice: """**Loads and provides access to fuel prices from the analysis context**""" def get_fuel_prices(calendar_year, price_types, fuel_id): """Get fuel price data for fuel_id in calendar_year Args: calendar_year (numeric): calendar year to get price in price_types (str, [str1, ...
stack_v2_sparse_classes_75kplus_train_065415
8,523
no_license
[ { "docstring": "Get fuel price data for fuel_id in calendar_year Args: calendar_year (numeric): calendar year to get price in price_types (str, [str1, str2...]): ContextFuelPrices attributes to get fuel_id (str): fuel ID Returns: Fuel price or tuple of fuel prices if multiple attributes were requested Example: ...
2
stack_v2_sparse_classes_30k_train_049824
Implement the Python class `FuelPrice` described below. Class description: **Loads and provides access to fuel prices from the analysis context** Method signatures and docstrings: - def get_fuel_prices(calendar_year, price_types, fuel_id): Get fuel price data for fuel_id in calendar_year Args: calendar_year (numeric)...
Implement the Python class `FuelPrice` described below. Class description: **Loads and provides access to fuel prices from the analysis context** Method signatures and docstrings: - def get_fuel_prices(calendar_year, price_types, fuel_id): Get fuel price data for fuel_id in calendar_year Args: calendar_year (numeric)...
afe912c57383b9de90ef30820f7977c3367a30c4
<|skeleton|> class FuelPrice: """**Loads and provides access to fuel prices from the analysis context**""" def get_fuel_prices(calendar_year, price_types, fuel_id): """Get fuel price data for fuel_id in calendar_year Args: calendar_year (numeric): calendar year to get price in price_types (str, [str1, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FuelPrice: """**Loads and provides access to fuel prices from the analysis context**""" def get_fuel_prices(calendar_year, price_types, fuel_id): """Get fuel price data for fuel_id in calendar_year Args: calendar_year (numeric): calendar year to get price in price_types (str, [str1, str2...]): Co...
the_stack_v2_python_sparse
omega_model/context/fuel_prices.py
USEPA/EPA_OMEGA_Model
train
17
52423f17a949fbf9a52fdcb67f04797d91a61c32
[ "super().__init__()\nself.mode = 'wl' if start < 1 else 'freq'\nif self.mode == 'wl':\n temp_start = start\n start = wl2freq(stop)\n stop = wl2freq(temp_start)\nif start > stop:\n raise ValueError('Starting frequency cannot be greater than stopping frequency.')\nself.freqs = np.linspace(start, stop, num...
<|body_start_0|> super().__init__() self.mode = 'wl' if start < 1 else 'freq' if self.mode == 'wl': temp_start = start start = wl2freq(stop) stop = wl2freq(temp_start) if start > stop: raise ValueError('Starting frequency cannot be greater ...
Wrapper simulator to make it easier to simulate over a range of frequencies.
SweepSimulator
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SweepSimulator: """Wrapper simulator to make it easier to simulate over a range of frequencies.""" def __init__(self, start: float=1.5e-06, stop: float=1.6e-06, num: int=2000) -> None: """Initializes the SweepSimulator instance. The start and stop values can be given in either wavele...
stack_v2_sparse_classes_75kplus_train_065416
6,765
permissive
[ { "docstring": "Initializes the SweepSimulator instance. The start and stop values can be given in either wavelength or frequency. The simulation will output results in the same mode. Parameters ---------- start : The starting frequency/wavelength. stop : The stopping frequency/wavelength. num : The number of p...
2
stack_v2_sparse_classes_30k_train_044512
Implement the Python class `SweepSimulator` described below. Class description: Wrapper simulator to make it easier to simulate over a range of frequencies. Method signatures and docstrings: - def __init__(self, start: float=1.5e-06, stop: float=1.6e-06, num: int=2000) -> None: Initializes the SweepSimulator instance...
Implement the Python class `SweepSimulator` described below. Class description: Wrapper simulator to make it easier to simulate over a range of frequencies. Method signatures and docstrings: - def __init__(self, start: float=1.5e-06, stop: float=1.6e-06, num: int=2000) -> None: Initializes the SweepSimulator instance...
b120a3592cca49bc8e797e331ad6efe6fd6de714
<|skeleton|> class SweepSimulator: """Wrapper simulator to make it easier to simulate over a range of frequencies.""" def __init__(self, start: float=1.5e-06, stop: float=1.6e-06, num: int=2000) -> None: """Initializes the SweepSimulator instance. The start and stop values can be given in either wavele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SweepSimulator: """Wrapper simulator to make it easier to simulate over a range of frequencies.""" def __init__(self, start: float=1.5e-06, stop: float=1.6e-06, num: int=2000) -> None: """Initializes the SweepSimulator instance. The start and stop values can be given in either wavelength or frequ...
the_stack_v2_python_sparse
simphony/simulators.py
BYUCamachoLab/simphony
train
84
5aa7573507a14d0f1004ef26b58280b304c9fcdb
[ "self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\nself.sock.bind((host, port))", "self.sock.listen(3)\nwhile True:\n client, address = self.sock.accept()\n threading.Thread(target=self.listen_client, args=(client,)).start()\n ...
<|body_start_0|> self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.sock.bind((host, port)) <|end_body_0|> <|body_start_1|> self.sock.listen(3) while True: client, address = self.sock.acc...
This class represents the server of the Vocal application. ... Attributes ---------- sock : socket instance of the Python socket module Methods ------- listen() Listen for clients requests and creates threads to handle their requests. send_status() Sends to the client every 1 minute the status of the house. listen_clie...
VocalServer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VocalServer: """This class represents the server of the Vocal application. ... Attributes ---------- sock : socket instance of the Python socket module Methods ------- listen() Listen for clients requests and creates threads to handle their requests. send_status() Sends to the client every 1 minu...
stack_v2_sparse_classes_75kplus_train_065417
3,094
permissive
[ { "docstring": "Parameters ---------- host : str IP address to connect (e.g. \"192.168.0.24\") port : int Number of the port to establish connection (e.g. 6000)", "name": "__init__", "signature": "def __init__(self, host, port)" }, { "docstring": "Listen to the maximum of 3 clients and creates t...
4
null
Implement the Python class `VocalServer` described below. Class description: This class represents the server of the Vocal application. ... Attributes ---------- sock : socket instance of the Python socket module Methods ------- listen() Listen for clients requests and creates threads to handle their requests. send_st...
Implement the Python class `VocalServer` described below. Class description: This class represents the server of the Vocal application. ... Attributes ---------- sock : socket instance of the Python socket module Methods ------- listen() Listen for clients requests and creates threads to handle their requests. send_st...
4370618fc3397e72700e2ef89cbbd59ef4e79685
<|skeleton|> class VocalServer: """This class represents the server of the Vocal application. ... Attributes ---------- sock : socket instance of the Python socket module Methods ------- listen() Listen for clients requests and creates threads to handle their requests. send_status() Sends to the client every 1 minu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VocalServer: """This class represents the server of the Vocal application. ... Attributes ---------- sock : socket instance of the Python socket module Methods ------- listen() Listen for clients requests and creates threads to handle their requests. send_status() Sends to the client every 1 minute the status...
the_stack_v2_python_sparse
vocal/src/server/vocal_server.py
dantasl/Operational-Systems-Project
train
0
0881febba83d43b1ac80706a55cebc543180fdd9
[ "self.c = c\nself.link_limit = None\nself.unknown_path_names: list[str] = []", "c = self.c\nif not mypy:\n print('install mypy with `pip install mypy`')\n return\nself.unknown_path_names = []\nfor root in roots:\n fn = os.path.normpath(c.fullPath(root))\n self.check_file(fn, root)", "c = self.c\nif ...
<|body_start_0|> self.c = c self.link_limit = None self.unknown_path_names: list[str] = [] <|end_body_0|> <|body_start_1|> c = self.c if not mypy: print('install mypy with `pip install mypy`') return self.unknown_path_names = [] for root i...
A class to run mypy on all Python @<file> nodes in c.p's tree.
MypyCommand
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MypyCommand: """A class to run mypy on all Python @<file> nodes in c.p's tree.""" def __init__(self, c: Cmdr) -> None: """ctor for MypyCommand class.""" <|body_0|> def check_all(self, roots: Any) -> None: """Run mypy on all files in paths.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_065418
26,058
permissive
[ { "docstring": "ctor for MypyCommand class.", "name": "__init__", "signature": "def __init__(self, c: Cmdr) -> None" }, { "docstring": "Run mypy on all files in paths.", "name": "check_all", "signature": "def check_all(self, roots: Any) -> None" }, { "docstring": "Run mypy on one...
4
stack_v2_sparse_classes_30k_train_005044
Implement the Python class `MypyCommand` described below. Class description: A class to run mypy on all Python @<file> nodes in c.p's tree. Method signatures and docstrings: - def __init__(self, c: Cmdr) -> None: ctor for MypyCommand class. - def check_all(self, roots: Any) -> None: Run mypy on all files in paths. - ...
Implement the Python class `MypyCommand` described below. Class description: A class to run mypy on all Python @<file> nodes in c.p's tree. Method signatures and docstrings: - def __init__(self, c: Cmdr) -> None: ctor for MypyCommand class. - def check_all(self, roots: Any) -> None: Run mypy on all files in paths. - ...
a3f6c3ebda805dc40cd93123948f153a26eccee5
<|skeleton|> class MypyCommand: """A class to run mypy on all Python @<file> nodes in c.p's tree.""" def __init__(self, c: Cmdr) -> None: """ctor for MypyCommand class.""" <|body_0|> def check_all(self, roots: Any) -> None: """Run mypy on all files in paths.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MypyCommand: """A class to run mypy on all Python @<file> nodes in c.p's tree.""" def __init__(self, c: Cmdr) -> None: """ctor for MypyCommand class.""" self.c = c self.link_limit = None self.unknown_path_names: list[str] = [] def check_all(self, roots: Any) -> None: ...
the_stack_v2_python_sparse
leo/commands/checkerCommands.py
leo-editor/leo-editor
train
1,671
79f1f9403e408b557a41330ebb7d2d08d8b3f800
[ "try:\n self.assertEqual(add(17, 23), 40)\nexcept Exception as error:\n print(error)", "try:\n self.assertEqual(add(-7, -11), -18)\nexcept Exception as error:\n print(error)", "try:\n self.assertEqual(add(0, 15), 15)\nexcept Exception as error:\n print(error)" ]
<|body_start_0|> try: self.assertEqual(add(17, 23), 40) except Exception as error: print(error) <|end_body_0|> <|body_start_1|> try: self.assertEqual(add(-7, -11), -18) except Exception as error: print(error) <|end_body_1|> <|body_start_2...
Test add function from calculation.py module.
TestAddFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAddFunction: """Test add function from calculation.py module.""" def test_add_all_args_greater_zero(self): """Test add function if all arguments are greater than zero.""" <|body_0|> def test_add_all_args_less_zero(self): """Test add function if all arguments ...
stack_v2_sparse_classes_75kplus_train_065419
1,838
no_license
[ { "docstring": "Test add function if all arguments are greater than zero.", "name": "test_add_all_args_greater_zero", "signature": "def test_add_all_args_greater_zero(self)" }, { "docstring": "Test add function if all arguments are less than zero.", "name": "test_add_all_args_less_zero", ...
3
stack_v2_sparse_classes_30k_val_002990
Implement the Python class `TestAddFunction` described below. Class description: Test add function from calculation.py module. Method signatures and docstrings: - def test_add_all_args_greater_zero(self): Test add function if all arguments are greater than zero. - def test_add_all_args_less_zero(self): Test add funct...
Implement the Python class `TestAddFunction` described below. Class description: Test add function from calculation.py module. Method signatures and docstrings: - def test_add_all_args_greater_zero(self): Test add function if all arguments are greater than zero. - def test_add_all_args_less_zero(self): Test add funct...
3a500c9d55fecf4032b5faf59a1cbecf64592e9a
<|skeleton|> class TestAddFunction: """Test add function from calculation.py module.""" def test_add_all_args_greater_zero(self): """Test add function if all arguments are greater than zero.""" <|body_0|> def test_add_all_args_less_zero(self): """Test add function if all arguments ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAddFunction: """Test add function from calculation.py module.""" def test_add_all_args_greater_zero(self): """Test add function if all arguments are greater than zero.""" try: self.assertEqual(add(17, 23), 40) except Exception as error: print(error) ...
the_stack_v2_python_sparse
python10/test_calculation.py
maksimok93/Dp-189
train
0
02546685dd64aafde41c541479f85d9143626449
[ "super().__init__()\nself.image_module = globals()[image_module_class](**image_module_params)\nin_features = self.image_module.out_features\nself.aggregation_module = globals()[aggregation_module_class](in_features=self.image_module.out_features, **aggregation_module_params)\nif image_module_devices is not None:\n ...
<|body_start_0|> super().__init__() self.image_module = globals()[image_module_class](**image_module_params) in_features = self.image_module.out_features self.aggregation_module = globals()[aggregation_module_class](in_features=self.image_module.out_features, **aggregation_module_params)...
Makes a prediction on an exam using 2D cnns and an aggregation function. An exam is an aggregation of images.
ExamModule2D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExamModule2D: """Makes a prediction on an exam using 2D cnns and an aggregation function. An exam is an aggregation of images.""" def __init__(self, image_module_class='ClippedResNet', image_module_params={}, aggregation_module_class='AvgMerge', aggregation_module_params={}, image_module_dev...
stack_v2_sparse_classes_75kplus_train_065420
6,198
permissive
[ { "docstring": "Each image is fed through the same image_module then the outputs of the image module are aggregated together into one prediction using the aggregation module. The output of the image_module should match the input of the aggregation_module. Args: image_modules_class (string) name of image_module ...
2
null
Implement the Python class `ExamModule2D` described below. Class description: Makes a prediction on an exam using 2D cnns and an aggregation function. An exam is an aggregation of images. Method signatures and docstrings: - def __init__(self, image_module_class='ClippedResNet', image_module_params={}, aggregation_mod...
Implement the Python class `ExamModule2D` described below. Class description: Makes a prediction on an exam using 2D cnns and an aggregation function. An exam is an aggregation of images. Method signatures and docstrings: - def __init__(self, image_module_class='ClippedResNet', image_module_params={}, aggregation_mod...
182821ae6b6abe1bc3623692aeba85da8083b27b
<|skeleton|> class ExamModule2D: """Makes a prediction on an exam using 2D cnns and an aggregation function. An exam is an aggregation of images.""" def __init__(self, image_module_class='ClippedResNet', image_module_params={}, aggregation_module_class='AvgMerge', aggregation_module_params={}, image_module_dev...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExamModule2D: """Makes a prediction on an exam using 2D cnns and an aggregation function. An exam is an aggregation of images.""" def __init__(self, image_module_class='ClippedResNet', image_module_params={}, aggregation_module_class='AvgMerge', aggregation_module_params={}, image_module_devices=None): ...
the_stack_v2_python_sparse
pet_ct/model/image.py
seyuboglu/weakly-supervised-petct
train
16
35a9bb2a798f9dea7d022723e8e8edf9144051a6
[ "data = {'jsonrpc': '2.0', 'method': 'user.login', 'params': {'user': ZABBIX_USER, 'password': ZABBIX_PASSWORD}, 'id': 0}\nres = requests.post(url=ZABBIX_URL, json=data)\nresult = res.json()\nkey = result.get('result')\nreturn key", "major_name = []\nmajor_groupid = []\ndata = {'jsonrpc': '2.0', 'method': 'hostgr...
<|body_start_0|> data = {'jsonrpc': '2.0', 'method': 'user.login', 'params': {'user': ZABBIX_USER, 'password': ZABBIX_PASSWORD}, 'id': 0} res = requests.post(url=ZABBIX_URL, json=data) result = res.json() key = result.get('result') return key <|end_body_0|> <|body_start_1|> ...
ZabbixApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZabbixApi: def get_key(self): """获取密钥 :return:""" <|body_0|> def get_major_unit(self, auth): """获取zabbix所有的主机组 :param auth: :return:[{"groupid": "72","name": "bj-ali-ck1000"},{"groupid": "99","name": "bj-ali-jh1000"}]""" <|body_1|> def get_mainframe(self...
stack_v2_sparse_classes_75kplus_train_065421
17,555
no_license
[ { "docstring": "获取密钥 :return:", "name": "get_key", "signature": "def get_key(self)" }, { "docstring": "获取zabbix所有的主机组 :param auth: :return:[{\"groupid\": \"72\",\"name\": \"bj-ali-ck1000\"},{\"groupid\": \"99\",\"name\": \"bj-ali-jh1000\"}]", "name": "get_major_unit", "signature": "def g...
4
null
Implement the Python class `ZabbixApi` described below. Class description: Implement the ZabbixApi class. Method signatures and docstrings: - def get_key(self): 获取密钥 :return: - def get_major_unit(self, auth): 获取zabbix所有的主机组 :param auth: :return:[{"groupid": "72","name": "bj-ali-ck1000"},{"groupid": "99","name": "bj-a...
Implement the Python class `ZabbixApi` described below. Class description: Implement the ZabbixApi class. Method signatures and docstrings: - def get_key(self): 获取密钥 :return: - def get_major_unit(self, auth): 获取zabbix所有的主机组 :param auth: :return:[{"groupid": "72","name": "bj-ali-ck1000"},{"groupid": "99","name": "bj-a...
ff4f09a00a0efb4571fa90c6b32f8b55ce2aa6c4
<|skeleton|> class ZabbixApi: def get_key(self): """获取密钥 :return:""" <|body_0|> def get_major_unit(self, auth): """获取zabbix所有的主机组 :param auth: :return:[{"groupid": "72","name": "bj-ali-ck1000"},{"groupid": "99","name": "bj-ali-jh1000"}]""" <|body_1|> def get_mainframe(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZabbixApi: def get_key(self): """获取密钥 :return:""" data = {'jsonrpc': '2.0', 'method': 'user.login', 'params': {'user': ZABBIX_USER, 'password': ZABBIX_PASSWORD}, 'id': 0} res = requests.post(url=ZABBIX_URL, json=data) result = res.json() key = result.get('result') ...
the_stack_v2_python_sparse
libs/celery_task/zabbix.py
z991/neng_backend
train
1
2f8b017ef07ea356df463501615c938469e1869b
[ "padding = (1, 1)\nsuper(ConvEncoder, self).__init__()\nself._block_1 = torch.nn.Sequential(torch.nn.Conv2d(in_channels, 64, kernel_size=(3, 3), stride=(2, 2), padding_mode='zeros', padding=padding), torch.nn.BatchNorm2d(64) if not use_group_norm else torch.nn.GroupNorm(group_norm_groups, 64), torch.nn.ReLU(), torc...
<|body_start_0|> padding = (1, 1) super(ConvEncoder, self).__init__() self._block_1 = torch.nn.Sequential(torch.nn.Conv2d(in_channels, 64, kernel_size=(3, 3), stride=(2, 2), padding_mode='zeros', padding=padding), torch.nn.BatchNorm2d(64) if not use_group_norm else torch.nn.GroupNorm(group_norm_...
Transforms a 2D pillar embedding into a 3D flow vector
ConvEncoder
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvEncoder: """Transforms a 2D pillar embedding into a 3D flow vector""" def __init__(self, in_channels=64, out_channels=256, use_group_norm=False, group_norm_groups=4): """This class can either use batch norm or group norm. GroupNorm has LayerNorm and InstanceNorm as special cases....
stack_v2_sparse_classes_75kplus_train_065422
6,470
permissive
[ { "docstring": "This class can either use batch norm or group norm. GroupNorm has LayerNorm and InstanceNorm as special cases. It allows to work with much smaller batch sizes. :param in_channels: :param out_channels: :param use_group_norm:", "name": "__init__", "signature": "def __init__(self, in_channe...
2
stack_v2_sparse_classes_30k_train_011633
Implement the Python class `ConvEncoder` described below. Class description: Transforms a 2D pillar embedding into a 3D flow vector Method signatures and docstrings: - def __init__(self, in_channels=64, out_channels=256, use_group_norm=False, group_norm_groups=4): This class can either use batch norm or group norm. G...
Implement the Python class `ConvEncoder` described below. Class description: Transforms a 2D pillar embedding into a 3D flow vector Method signatures and docstrings: - def __init__(self, in_channels=64, out_channels=256, use_group_norm=False, group_norm_groups=4): This class can either use batch norm or group norm. G...
8fb42ae338082a2d92853e109f043040558c50c9
<|skeleton|> class ConvEncoder: """Transforms a 2D pillar embedding into a 3D flow vector""" def __init__(self, in_channels=64, out_channels=256, use_group_norm=False, group_norm_groups=4): """This class can either use batch norm or group norm. GroupNorm has LayerNorm and InstanceNorm as special cases....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConvEncoder: """Transforms a 2D pillar embedding into a 3D flow vector""" def __init__(self, in_channels=64, out_channels=256, use_group_norm=False, group_norm_groups=4): """This class can either use batch norm or group norm. GroupNorm has LayerNorm and InstanceNorm as special cases. It allows to...
the_stack_v2_python_sparse
networks/convEncoder.py
zivzone/FastFlow3D
train
0
f35312ec0b42841dbbefa13a39eb429bcb6ef2ff
[ "self.acquisition = acquisition\nself.acquisition_optimizer = acquisition_optimizer\nself.batch_size = batch_size\nself.model = model\nself.parameter_space = parameter_space", "self.acquisition.update_parameters()\nx1, _ = self.acquisition_optimizer.optimize(self.acquisition)\nx_batch = [x1]\nfor i in range(1, se...
<|body_start_0|> self.acquisition = acquisition self.acquisition_optimizer = acquisition_optimizer self.batch_size = batch_size self.model = model self.parameter_space = parameter_space <|end_body_0|> <|body_start_1|> self.acquisition.update_parameters() x1, _ = ...
Probability of Improvement insipred global penalization point calculator
CorrelationPenalizationPointCalculator
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorrelationPenalizationPointCalculator: """Probability of Improvement insipred global penalization point calculator""" def __init__(self, acquisition: Acquisition, acquisition_optimizer, model, parameter_space: ParameterSpace, batch_size: int): """:param acquisition: Base acquisition...
stack_v2_sparse_classes_75kplus_train_065423
4,270
permissive
[ { "docstring": ":param acquisition: Base acquisition function to use without any penalization applied, this acquisition should output positive values only. :param acquisition_optimizer: AcquisitionOptimizer object to optimize the penalized acquisition :param model: Model object, used to compute the parameters o...
2
null
Implement the Python class `CorrelationPenalizationPointCalculator` described below. Class description: Probability of Improvement insipred global penalization point calculator Method signatures and docstrings: - def __init__(self, acquisition: Acquisition, acquisition_optimizer, model, parameter_space: ParameterSpac...
Implement the Python class `CorrelationPenalizationPointCalculator` described below. Class description: Probability of Improvement insipred global penalization point calculator Method signatures and docstrings: - def __init__(self, acquisition: Acquisition, acquisition_optimizer, model, parameter_space: ParameterSpac...
40bab526af6562653c42dbb32b174524c44ce2ba
<|skeleton|> class CorrelationPenalizationPointCalculator: """Probability of Improvement insipred global penalization point calculator""" def __init__(self, acquisition: Acquisition, acquisition_optimizer, model, parameter_space: ParameterSpace, batch_size: int): """:param acquisition: Base acquisition...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CorrelationPenalizationPointCalculator: """Probability of Improvement insipred global penalization point calculator""" def __init__(self, acquisition: Acquisition, acquisition_optimizer, model, parameter_space: ParameterSpace, batch_size: int): """:param acquisition: Base acquisition function to ...
the_stack_v2_python_sparse
PyStationB/libraries/GlobalPenalisation/gp/moment_matching/numpy/correlation_penalisation.py
mebristo/station-b-libraries
train
0
0dc8b7d1e2b810fa5d336f0cff56eee99e7b7cfe
[ "self.model = PointNetSegmentation(ShapeNetParts.num_classes)\nself.model.load_state_dict(torch.load(ckpt, map_location='cpu'))\nself.model.eval()", "input_tensor = torch.from_numpy(points).float().unsqueeze(0)\nprediction = torch.argmax(self.model(input_tensor)[0], dim=1)\nreturn prediction" ]
<|body_start_0|> self.model = PointNetSegmentation(ShapeNetParts.num_classes) self.model.load_state_dict(torch.load(ckpt, map_location='cpu')) self.model.eval() <|end_body_0|> <|body_start_1|> input_tensor = torch.from_numpy(points).float().unsqueeze(0) prediction = torch.argmax...
Utility for segmentation inference using trained PointNet network
InferenceHandlerPointNetSegmentation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InferenceHandlerPointNetSegmentation: """Utility for segmentation inference using trained PointNet network""" def __init__(self, ckpt): """:param ckpt: checkpoint path to weights of the trained network""" <|body_0|> def infer_single(self, points): """Infer class ...
stack_v2_sparse_classes_75kplus_train_065424
979
no_license
[ { "docstring": ":param ckpt: checkpoint path to weights of the trained network", "name": "__init__", "signature": "def __init__(self, ckpt)" }, { "docstring": "Infer class of the shape given its point cloud representation :param points: points of shape 3 x 1024 :return: part segmentation labels ...
2
stack_v2_sparse_classes_30k_train_021892
Implement the Python class `InferenceHandlerPointNetSegmentation` described below. Class description: Utility for segmentation inference using trained PointNet network Method signatures and docstrings: - def __init__(self, ckpt): :param ckpt: checkpoint path to weights of the trained network - def infer_single(self, ...
Implement the Python class `InferenceHandlerPointNetSegmentation` described below. Class description: Utility for segmentation inference using trained PointNet network Method signatures and docstrings: - def __init__(self, ckpt): :param ckpt: checkpoint path to weights of the trained network - def infer_single(self, ...
a98d61403017317eb2b5da9760f78a19c76622e4
<|skeleton|> class InferenceHandlerPointNetSegmentation: """Utility for segmentation inference using trained PointNet network""" def __init__(self, ckpt): """:param ckpt: checkpoint path to weights of the trained network""" <|body_0|> def infer_single(self, points): """Infer class ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InferenceHandlerPointNetSegmentation: """Utility for segmentation inference using trained PointNet network""" def __init__(self, ckpt): """:param ckpt: checkpoint path to weights of the trained network""" self.model = PointNetSegmentation(ShapeNetParts.num_classes) self.model.load...
the_stack_v2_python_sparse
E2/exercise_2/inference/infer_pointnet_segmentation.py
nazmicancalik/ml3d
train
7
3c6c7228a2b40b35be6604a70ac71748457e0b0f
[ "if isinstance(filter_names[0], str):\n flist = phot.load_filters(filter_names, interp=True, lamb=self.lamb, filterLib=filterLib)\n _fnames = filter_names\nelse:\n flist = phot.load_Integrationfilters(filter_names, interp=True, lamb=self.lamb)\n _fnames = [fk.name for fk in filter_names]\nif extLaw is n...
<|body_start_0|> if isinstance(filter_names[0], str): flist = phot.load_filters(filter_names, interp=True, lamb=self.lamb, filterLib=filterLib) _fnames = filter_names else: flist = phot.load_Integrationfilters(filter_names, interp=True, lamb=self.lamb) _fn...
Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs
SpectralGrid
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ----...
stack_v2_sparse_classes_75kplus_train_065425
11,734
permissive
[ { "docstring": "Extract integrated fluxes through filters Parameters ---------- filter_names: list list of filter names according to the filter lib or filter instances (no mixing between name and instances) absFlux:bool returns absolute fluxes if set extLaw: extinction.ExtinctionLaw apply extinction law if prov...
2
stack_v2_sparse_classes_30k_train_028044
Implement the Python class `SpectralGrid` described below. Class description: Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs Method signatures and docstrings: - def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): ...
Implement the Python class `SpectralGrid` described below. Class description: Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs Method signatures and docstrings: - def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): ...
892940813f4b22d545b501cc596c72967d9a45bc
<|skeleton|> class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ----...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ---------- filter...
the_stack_v2_python_sparse
beast/physicsmodel/grid.py
dthilker/beast
train
0
1415b50a597925d7f0c4db41dcf642d935aa187f
[ "cur1 = l1\ncur2 = l2\nresult = []\nhead = ListNode('head')\ncur = head\nwhile cur1 != None or cur2 != None:\n if cur1 != None and cur2 == None:\n rv = cur1.val\n cur1 = cur1.next\n if cur1 == None and cur2 != None:\n rv = cur2.val\n cur2 = cur2.next\n if cur1 != None and cur2 !...
<|body_start_0|> cur1 = l1 cur2 = l2 result = [] head = ListNode('head') cur = head while cur1 != None or cur2 != None: if cur1 != None and cur2 == None: rv = cur1.val cur1 = cur1.next if cur1 == None and cur2 != Non...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> cur1 = l...
stack_v2_sparse_classes_75kplus_train_065426
1,657
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" } ]
2
stack_v2_sparse_classes_30k_train_031103
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode <|skeleton|>...
6401928a042f98dbbe513ec5cd673fa029cc4bce
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" cur1 = l1 cur2 = l2 result = [] head = ListNode('head') cur = head while cur1 != None or cur2 != None: if cur1 != None and cur2 == None: ...
the_stack_v2_python_sparse
python/023-merge-k-sorted-lists.py
xupingmao/leetcode
train
1
052a09159bd663e80b96e8d6a2d98efed53b1ae7
[ "lowest = float('inf')\nmaxc = 0\nfor i in xrange(1, len(prices)):\n lowest = min(lowest, prices[i - 1])\n maxc = max(maxc, prices[i] - lowest)\nreturn maxc", "local_max = 0\nmmax = 0\nfor i in xrange(1, len(prices)):\n local_max += prices[i] - prices[i - 1]\n local_max = max(0, local_max)\n mmax =...
<|body_start_0|> lowest = float('inf') maxc = 0 for i in xrange(1, len(prices)): lowest = min(lowest, prices[i - 1]) maxc = max(maxc, prices[i] - lowest) return maxc <|end_body_0|> <|body_start_1|> local_max = 0 mmax = 0 for i in xrange(1,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_2(self, prices): """:type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性.""" <|body_1|> def rewrite(self, prices): """:type pric...
stack_v2_sparse_classes_75kplus_train_065427
2,506
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性.", "name": "maxProfit_2", "signature": "def maxProfit_2(self, prices)" }, { "d...
3
stack_v2_sparse_classes_30k_train_043649
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 - def maxProfit_2(self, prices): :type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性. - def rewrite(...
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 - def maxProfit_2(self, prices): :type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性. - def rewrite(...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_2(self, prices): """:type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性.""" <|body_1|> def rewrite(self, prices): """:type pric...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" lowest = float('inf') maxc = 0 for i in xrange(1, len(prices)): lowest = min(lowest, prices[i - 1]) maxc = max(maxc, prices[i] - lowest) return maxc def maxProf...
the_stack_v2_python_sparse
co_fb/121_Best_Time_to_Buy_and_Sell_Stock.py
vsdrun/lc_public
train
6
2125b2483ac6a846fa5c12e4ed03d12e74be0b07
[ "r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y)\nf_ = r * a_m / (1 - m ** 2) * np.cos(m * (phi - phi_m))\nreturn f_", "r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y)\nf_x = np.cos(phi) * a_m / (1 - m ** 2) * np.cos(m * (phi - phi_m)) + np.sin(phi) * m * a_m ...
<|body_start_0|> r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y) f_ = r * a_m / (1 - m ** 2) * np.cos(m * (phi - phi_m)) return f_ <|end_body_0|> <|body_start_1|> r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y) f_x = np.cos(p...
This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientation in radian
Multipole
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Multipole: """This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientat...
stack_v2_sparse_classes_75kplus_train_065428
3,657
permissive
[ { "docstring": "Lensing potential of multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf :param x: x-coordinate to evaluate function :param y: y-coordinate to evaluate function :param m: int, multipole order, m>=...
3
stack_v2_sparse_classes_30k_train_000834
Implement the Python class `Multipole` described below. Class description: This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole str...
Implement the Python class `Multipole` described below. Class description: This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole str...
902a0f318da46bd444d408853f40f744603e2f35
<|skeleton|> class Multipole: """This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Multipole: """This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientation in radian...
the_stack_v2_python_sparse
lenstronomy/LensModel/Profiles/multipole.py
sibirrer/lenstronomy
train
115
dfd1f9dac6e543ba286ddbe2a998f7f4d1d22054
[ "super(Encoder, self).__init__()\nself.n_src_vocab = n_src_vocab\nself.n_layers = n_layers\nself.n_head = n_head\nself.d_k = d_k\nself.d_v = d_v\nself.d_model = d_model\nself.d_inner = d_inner\nself.dropout_rate = dropout\nself.pe_maxlen = pe_maxlen\nself.src_emb = nn.Embedding(n_src_vocab, d_model, padding_idx=Con...
<|body_start_0|> super(Encoder, self).__init__() self.n_src_vocab = n_src_vocab self.n_layers = n_layers self.n_head = n_head self.d_k = d_k self.d_v = d_v self.d_model = d_model self.d_inner = d_inner self.dropout_rate = dropout self.pe_ma...
Encoder of Transformer including self-attention and feed forward.
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder of Transformer including self-attention and feed forward.""" def __init__(self, n_src_vocab=Config.n_src_vocab, n_layers=6, n_head=8, d_k=64, d_v=64, d_model=512, d_inner=2048, dropout=0.1, pe_maxlen=5000): """:param n_src_vocab: 编码器输入的词表大小 :param n_layers: 需要几层tr...
stack_v2_sparse_classes_75kplus_train_065429
4,276
no_license
[ { "docstring": ":param n_src_vocab: 编码器输入的词表大小 :param n_layers: 需要几层transformer的编码块 :param n_head: self-attention的头 :param d_k: key的维度 :param d_v: value的维度 :param d_model: 词嵌入的维度 :param d_inner: :param dropout: :param pe_maxlen: 对于编码器,一般都认为等于maxlen. 解码器可以体现出其作用", "name": "__init__", "signature": "def __...
2
null
Implement the Python class `Encoder` described below. Class description: Encoder of Transformer including self-attention and feed forward. Method signatures and docstrings: - def __init__(self, n_src_vocab=Config.n_src_vocab, n_layers=6, n_head=8, d_k=64, d_v=64, d_model=512, d_inner=2048, dropout=0.1, pe_maxlen=5000...
Implement the Python class `Encoder` described below. Class description: Encoder of Transformer including self-attention and feed forward. Method signatures and docstrings: - def __init__(self, n_src_vocab=Config.n_src_vocab, n_layers=6, n_head=8, d_k=64, d_v=64, d_model=512, d_inner=2048, dropout=0.1, pe_maxlen=5000...
1272fed2dc8fef78a9ded0f1ae1644d613a3b57b
<|skeleton|> class Encoder: """Encoder of Transformer including self-attention and feed forward.""" def __init__(self, n_src_vocab=Config.n_src_vocab, n_layers=6, n_head=8, d_k=64, d_v=64, d_model=512, d_inner=2048, dropout=0.1, pe_maxlen=5000): """:param n_src_vocab: 编码器输入的词表大小 :param n_layers: 需要几层tr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: """Encoder of Transformer including self-attention and feed forward.""" def __init__(self, n_src_vocab=Config.n_src_vocab, n_layers=6, n_head=8, d_k=64, d_v=64, d_model=512, d_inner=2048, dropout=0.1, pe_maxlen=5000): """:param n_src_vocab: 编码器输入的词表大小 :param n_layers: 需要几层transformer的编码块...
the_stack_v2_python_sparse
NMT/Transformers_NMT/transformer/encoder.py
shawroad/NLP_pytorch_project
train
530
3d715a9906517175e9b55ec47ae2e3efe802548b
[ "if rowIndex <= 0:\n return []\ncur_row = []\nfor n in range(rowIndex + 1):\n new_row = [None for _ in range(n + 1)]\n new_row[0], new_row[-1] = (1, 1)\n for j in range(1, n):\n new_row[j] = cur_row[j - 1] + cur_row[j]\n cur_row = new_row\nreturn cur_row", "res = [1]\nfor i in range(1, row_n...
<|body_start_0|> if rowIndex <= 0: return [] cur_row = [] for n in range(rowIndex + 1): new_row = [None for _ in range(n + 1)] new_row[0], new_row[-1] = (1, 1) for j in range(1, n): new_row[j] = cur_row[j - 1] + cur_row[j] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getRow(self, rowIndex: int): """根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:""" <|body_0|> def getRow_2(self, row_nums): """根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nums: 给定行数 :return: res:list 该行元素""" <|body_1|> de...
stack_v2_sparse_classes_75kplus_train_065430
2,416
no_license
[ { "docstring": "根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:", "name": "getRow", "signature": "def getRow(self, rowIndex: int)" }, { "docstring": "根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nums: 给定行数 :return: res:list 该行元素", "name": "getRow_2", "signature": "def g...
3
stack_v2_sparse_classes_30k_train_009295
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex: int): 根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return: - def getRow_2(self, row_nums): 根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex: int): 根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return: - def getRow_2(self, row_nums): 根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nu...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def getRow(self, rowIndex: int): """根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:""" <|body_0|> def getRow_2(self, row_nums): """根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nums: 给定行数 :return: res:list 该行元素""" <|body_1|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getRow(self, rowIndex: int): """根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:""" if rowIndex <= 0: return [] cur_row = [] for n in range(rowIndex + 1): new_row = [None for _ in range(n + 1)] new_row[0], new_row[-1] = (1,...
the_stack_v2_python_sparse
leetcode/solved/119_.py
usnnu/python_foundation
train
0
54b64b8d644f496f7399d07a752379e19c2d1b28
[ "self.s3_conn = s3_conn\nself.cache_dir = cache_dir\nself.s3_path = s3_path\nself.bucket_name, self.prefix = split_s3_path(self.s3_path)", "full_path = os.path.join(self.cache_dir, filename)\nif os.path.isfile(full_path):\n yield full_path\nelse:\n if not os.path.isdir(self.cache_dir):\n os.mkdir(sel...
<|body_start_0|> self.s3_conn = s3_conn self.cache_dir = cache_dir self.s3_path = s3_path self.bucket_name, self.prefix = split_s3_path(self.s3_path) <|end_body_0|> <|body_start_1|> full_path = os.path.join(self.cache_dir, filename) if os.path.isfile(full_path): ...
An object that downloads and caches ONET files from S3
OnetCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OnetCache: """An object that downloads and caches ONET files from S3""" def __init__(self, s3_conn, s3_path, cache_dir): """Args: s3_conn: a boto s3 connection s3_path: path to the onet directory cache_dir: directory to cache files""" <|body_0|> def ensure_file(self, fil...
stack_v2_sparse_classes_75kplus_train_065431
2,489
permissive
[ { "docstring": "Args: s3_conn: a boto s3 connection s3_path: path to the onet directory cache_dir: directory to cache files", "name": "__init__", "signature": "def __init__(self, s3_conn, s3_path, cache_dir)" }, { "docstring": "Ensures that the given ONET data file is present, either by using a ...
2
stack_v2_sparse_classes_30k_train_029833
Implement the Python class `OnetCache` described below. Class description: An object that downloads and caches ONET files from S3 Method signatures and docstrings: - def __init__(self, s3_conn, s3_path, cache_dir): Args: s3_conn: a boto s3 connection s3_path: path to the onet directory cache_dir: directory to cache f...
Implement the Python class `OnetCache` described below. Class description: An object that downloads and caches ONET files from S3 Method signatures and docstrings: - def __init__(self, s3_conn, s3_path, cache_dir): Args: s3_conn: a boto s3 connection s3_path: path to the onet directory cache_dir: directory to cache f...
feffead90815ccdecf24bf1a995f79683442b046
<|skeleton|> class OnetCache: """An object that downloads and caches ONET files from S3""" def __init__(self, s3_conn, s3_path, cache_dir): """Args: s3_conn: a boto s3 connection s3_path: path to the onet directory cache_dir: directory to cache files""" <|body_0|> def ensure_file(self, fil...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OnetCache: """An object that downloads and caches ONET files from S3""" def __init__(self, s3_conn, s3_path, cache_dir): """Args: s3_conn: a boto s3 connection s3_path: path to the onet directory cache_dir: directory to cache files""" self.s3_conn = s3_conn self.cache_dir = cache_...
the_stack_v2_python_sparse
skills_ml/datasets/onet_cache.py
workforce-data-initiative/skills-ml
train
164
764b3f2f44fd7a0182673df496a7576142cbb4dd
[ "def merge(l1, l2):\n dummy = ListNode(0)\n tmp = dummy\n while l1 and l2:\n if l1.val < l2.val:\n tmp.next = ListNode(l1.val)\n l1 = l1.next\n else:\n tmp.next = ListNode(l2.val)\n l2 = l2.next\n tmp = tmp.next\n if l1:\n tmp.next ...
<|body_start_0|> def merge(l1, l2): dummy = ListNode(0) tmp = dummy while l1 and l2: if l1.val < l2.val: tmp.next = ListNode(l1.val) l1 = l1.next else: tmp.next = ListNode(l2.val) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def sortList0(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> def merge(l1, l2): dummy = Lis...
stack_v2_sparse_classes_75kplus_train_065432
1,510
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "sortList", "signature": "def sortList(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "sortList0", "signature": "def sortList0(self, head)" } ]
2
null
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 sortList0(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList(self, head): :type head: ListNode :rtype: ListNode - def sortList0(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def sortList...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def sortList0(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" def merge(l1, l2): dummy = ListNode(0) tmp = dummy while l1 and l2: if l1.val < l2.val: tmp.next = ListNode(l1.val) l1 = l...
the_stack_v2_python_sparse
PythonCode/src/0148_Sort_List.py
oneyuan/CodeforFun
train
0
b118f558b174ec499dc5d820ac8aaffe6520cc55
[ "self.exploration_vs_exploitation = exploration_vs_exploitation\nself.decomposition_funcs = decomposition_funcs\nself.preprocessors = preprocessors\nself.nbits = nbits\nself.seed = seed\nself.estimators = [SGDRegressor(penalty='elasticnet') for _ in range(n_estimators)]", "coefs = [est.coef_ for est in self.estim...
<|body_start_0|> self.exploration_vs_exploitation = exploration_vs_exploitation self.decomposition_funcs = decomposition_funcs self.preprocessors = preprocessors self.nbits = nbits self.seed = seed self.estimators = [SGDRegressor(penalty='elasticnet') for _ in range(n_est...
ScoreEstimator.
GraphLinearScoreEstimator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphLinearScoreEstimator: """ScoreEstimator.""" def __init__(self, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1): """init.""" <|body_0|> def predict_gradient(self, graphs): """predict_gradient.""...
stack_v2_sparse_classes_75kplus_train_065433
21,013
permissive
[ { "docstring": "init.", "name": "__init__", "signature": "def __init__(self, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1)" }, { "docstring": "predict_gradient.", "name": "predict_gradient", "signature": "def predict_grad...
2
stack_v2_sparse_classes_30k_train_021768
Implement the Python class `GraphLinearScoreEstimator` described below. Class description: ScoreEstimator. Method signatures and docstrings: - def __init__(self, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1): init. - def predict_gradient(self, graphs)...
Implement the Python class `GraphLinearScoreEstimator` described below. Class description: ScoreEstimator. Method signatures and docstrings: - def __init__(self, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1): init. - def predict_gradient(self, graphs)...
d89e88183cce1ff24dca9333c09fa11597a45c7a
<|skeleton|> class GraphLinearScoreEstimator: """ScoreEstimator.""" def __init__(self, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1): """init.""" <|body_0|> def predict_gradient(self, graphs): """predict_gradient.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraphLinearScoreEstimator: """ScoreEstimator.""" def __init__(self, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1): """init.""" self.exploration_vs_exploitation = exploration_vs_exploitation self.decomposition_funcs...
the_stack_v2_python_sparse
ego/optimization/score_estimator.py
smautner/EGO
train
0
f78d8982ee492f1e64891fd8e42d13b115f3d3d5
[ "registrations = registrations.sorted('id')\nexisting_leads = self.env['crm.lead'].search([('registration_ids', 'in', registrations.ids), ('event_lead_rule_id', 'in', self.ids)])\nrule_to_existing_regs = defaultdict(lambda: self.env['event.registration'])\nfor lead in existing_leads:\n rule_to_existing_regs[lead...
<|body_start_0|> registrations = registrations.sorted('id') existing_leads = self.env['crm.lead'].search([('registration_ids', 'in', registrations.ids), ('event_lead_rule_id', 'in', self.ids)]) rule_to_existing_regs = defaultdict(lambda: self.env['event.registration']) for lead in existi...
Rule model for creating / updating leads from event registrations. SPECIFICATIONS: CREATION TYPE There are two types of lead creation: * per attendee: create a lead for each registration; * per order: create a lead for a group of registrations; The last one is only available through interface if it is possible to regis...
EventLeadRule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventLeadRule: """Rule model for creating / updating leads from event registrations. SPECIFICATIONS: CREATION TYPE There are two types of lead creation: * per attendee: create a lead for each registration; * per order: create a lead for a group of registrations; The last one is only available thr...
stack_v2_sparse_classes_75kplus_train_065434
11,131
permissive
[ { "docstring": "Create or update leads based on rule configuration. Two main lead management type exists * per attendee: each registration creates a lead; * per order: registrations are grouped per group and one lead is created or updated with the batch (used mainly with sale order configuration in event_sale);...
2
stack_v2_sparse_classes_30k_train_012277
Implement the Python class `EventLeadRule` described below. Class description: Rule model for creating / updating leads from event registrations. SPECIFICATIONS: CREATION TYPE There are two types of lead creation: * per attendee: create a lead for each registration; * per order: create a lead for a group of registrati...
Implement the Python class `EventLeadRule` described below. Class description: Rule model for creating / updating leads from event registrations. SPECIFICATIONS: CREATION TYPE There are two types of lead creation: * per attendee: create a lead for each registration; * per order: create a lead for a group of registrati...
310497a9872db7844b521e6dab5f7a9f61d365a4
<|skeleton|> class EventLeadRule: """Rule model for creating / updating leads from event registrations. SPECIFICATIONS: CREATION TYPE There are two types of lead creation: * per attendee: create a lead for each registration; * per order: create a lead for a group of registrations; The last one is only available thr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EventLeadRule: """Rule model for creating / updating leads from event registrations. SPECIFICATIONS: CREATION TYPE There are two types of lead creation: * per attendee: create a lead for each registration; * per order: create a lead for a group of registrations; The last one is only available through interfac...
the_stack_v2_python_sparse
addons/event_crm/models/event_lead_rule.py
SHIVJITH/Odoo_Machine_Test
train
0
96c6d65456e6e6582b089fc60ec44910b3712e66
[ "self.rpcprocessor = rpcprocessor\nself.host = host\nself.port = port", "self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\ntry:\n self.socket.bind((self.host, self.port))\nexcept OSError as e:\n print('ERROR: ' + e.strerror, f...
<|body_start_0|> self.rpcprocessor = rpcprocessor self.host = host self.port = port <|end_body_0|> <|body_start_1|> self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) try: self.soc...
Simple JSON-RPC server for line-terminated messages Not a production quality server, handles only one connection at a time.
SimpleJsonRpcServer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleJsonRpcServer: """Simple JSON-RPC server for line-terminated messages Not a production quality server, handles only one connection at a time.""" def __init__(self, rpcprocessor, host, port): """Constructor Args: rpcprocessor (RpcProcessor): RPC implementation host (str): Hostna...
stack_v2_sparse_classes_75kplus_train_065435
2,145
permissive
[ { "docstring": "Constructor Args: rpcprocessor (RpcProcessor): RPC implementation host (str): Hostname or IP to listen on port (int): TCP port to listen on", "name": "__init__", "signature": "def __init__(self, rpcprocessor, host, port)" }, { "docstring": "Start the server and listen on host:por...
3
stack_v2_sparse_classes_30k_train_010921
Implement the Python class `SimpleJsonRpcServer` described below. Class description: Simple JSON-RPC server for line-terminated messages Not a production quality server, handles only one connection at a time. Method signatures and docstrings: - def __init__(self, rpcprocessor, host, port): Constructor Args: rpcproces...
Implement the Python class `SimpleJsonRpcServer` described below. Class description: Simple JSON-RPC server for line-terminated messages Not a production quality server, handles only one connection at a time. Method signatures and docstrings: - def __init__(self, rpcprocessor, host, port): Constructor Args: rpcproces...
9602d3b3f06d3d8ee8549788301e43b172a597f6
<|skeleton|> class SimpleJsonRpcServer: """Simple JSON-RPC server for line-terminated messages Not a production quality server, handles only one connection at a time.""" def __init__(self, rpcprocessor, host, port): """Constructor Args: rpcprocessor (RpcProcessor): RPC implementation host (str): Hostna...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleJsonRpcServer: """Simple JSON-RPC server for line-terminated messages Not a production quality server, handles only one connection at a time.""" def __init__(self, rpcprocessor, host, port): """Constructor Args: rpcprocessor (RpcProcessor): RPC implementation host (str): Hostname or IP to l...
the_stack_v2_python_sparse
reflectrpc/simpleserver.py
ARteapartedelarte/reflectrpc
train
0
7c1f97de1665037ed6bd0ddf1128f42c58ff551a
[ "self._url = f'amqp://{host}:{port}'\nself._debug = debug\nself._conn = kombu.Connection(hostname=host, port=port, userid='guest', password='guest', virtual_host='/')", "self._conn.connect()\nproducer = kombu.Producer(self._conn.channel())\nproducer.publish(message, headers=headers or {}, exchange=kombu.Exchange(...
<|body_start_0|> self._url = f'amqp://{host}:{port}' self._debug = debug self._conn = kombu.Connection(hostname=host, port=port, userid='guest', password='guest', virtual_host='/') <|end_body_0|> <|body_start_1|> self._conn.connect() producer = kombu.Producer(self._conn.channel(...
The Producer class writes messages to the message queue to be consumed.
Producer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Producer: """The Producer class writes messages to the message queue to be consumed.""" def __init__(self, host=AMQP_HOST, port=AMQP_PORT, debug=False): """Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :par...
stack_v2_sparse_classes_75kplus_train_065436
8,728
permissive
[ { "docstring": "Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :param debug: print debugging messages", "name": "__init__", "signature": "def __init__(self, host=AMQP_HOST, port=AMQP_PORT, debug=False)" }, { "docstring"...
2
null
Implement the Python class `Producer` described below. Class description: The Producer class writes messages to the message queue to be consumed. Method signatures and docstrings: - def __init__(self, host=AMQP_HOST, port=AMQP_PORT, debug=False): Sets up connection to broker to write to. :param host: hostname for the...
Implement the Python class `Producer` described below. Class description: The Producer class writes messages to the message queue to be consumed. Method signatures and docstrings: - def __init__(self, host=AMQP_HOST, port=AMQP_PORT, debug=False): Sets up connection to broker to write to. :param host: hostname for the...
9227d38cb53204b45641ac55aefd6a13d2aad563
<|skeleton|> class Producer: """The Producer class writes messages to the message queue to be consumed.""" def __init__(self, host=AMQP_HOST, port=AMQP_PORT, debug=False): """Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Producer: """The Producer class writes messages to the message queue to be consumed.""" def __init__(self, host=AMQP_HOST, port=AMQP_PORT, debug=False): """Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :param debug: pri...
the_stack_v2_python_sparse
base/modules/tmp/sb_utils/root/sb_utils/amqp_tools.py
sumodgeorge/openc2-oif-orchestrator
train
0
57febc7b7d328744369c68beae40c2f58295da73
[ "if cosmo is not None:\n self.cosmo = cosmo\nelse:\n self.cosmo = conversions.Cosmo_Conversions()", "pspec_freqs = np.linspace(lower_freq, upper_freq, num_freqs, endpoint=False)\nomega_ratio = self.power_beam_sq_int(pol) / self.power_beam_int(pol) ** 2\nscalar = _compute_pspec_scalar(self.cosmo, self.beam_f...
<|body_start_0|> if cosmo is not None: self.cosmo = cosmo else: self.cosmo = conversions.Cosmo_Conversions() <|end_body_0|> <|body_start_1|> pspec_freqs = np.linspace(lower_freq, upper_freq, num_freqs, endpoint=False) omega_ratio = self.power_beam_sq_int(pol) / s...
PSpecBeamBase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSpecBeamBase: def __init__(self, cosmo=None): """Base class for PSpecBeam objects. Provides compute_pspec_scalar() method to integrate over and interpolate beam solid angles, and Jy_to_mK() method to convert units. Parameters ---------- cosmo : conversions.Cosmo_Conversions object, opti...
stack_v2_sparse_classes_75kplus_train_065437
29,545
permissive
[ { "docstring": "Base class for PSpecBeam objects. Provides compute_pspec_scalar() method to integrate over and interpolate beam solid angles, and Jy_to_mK() method to convert units. Parameters ---------- cosmo : conversions.Cosmo_Conversions object, optional Cosmology object. Uses the default cosmology object i...
4
stack_v2_sparse_classes_30k_train_044659
Implement the Python class `PSpecBeamBase` described below. Class description: Implement the PSpecBeamBase class. Method signatures and docstrings: - def __init__(self, cosmo=None): Base class for PSpecBeam objects. Provides compute_pspec_scalar() method to integrate over and interpolate beam solid angles, and Jy_to_...
Implement the Python class `PSpecBeamBase` described below. Class description: Implement the PSpecBeamBase class. Method signatures and docstrings: - def __init__(self, cosmo=None): Base class for PSpecBeam objects. Provides compute_pspec_scalar() method to integrate over and interpolate beam solid angles, and Jy_to_...
482c31c5b1ead911d521f514b6e6a700b9fab17e
<|skeleton|> class PSpecBeamBase: def __init__(self, cosmo=None): """Base class for PSpecBeam objects. Provides compute_pspec_scalar() method to integrate over and interpolate beam solid angles, and Jy_to_mK() method to convert units. Parameters ---------- cosmo : conversions.Cosmo_Conversions object, opti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PSpecBeamBase: def __init__(self, cosmo=None): """Base class for PSpecBeam objects. Provides compute_pspec_scalar() method to integrate over and interpolate beam solid angles, and Jy_to_mK() method to convert units. Parameters ---------- cosmo : conversions.Cosmo_Conversions object, optional Cosmology...
the_stack_v2_python_sparse
hera_pspec/pspecbeam.py
HERA-Team/hera_pspec
train
11
8c8b62d0b482efe039d52744a0a3ada53669821e
[ "from .services import get_mentee_tasks_dict\nuser_id = current_user.get_id()\ntry:\n tasks = get_mentee_tasks_dict(user_id)\n return ({'tasks': tasks, 'success': True}, 200)\nexcept SQLAlchemyError:\n return {'success': False}", "from .services import add_task\nparser = reqparse.RequestParser()\nparser....
<|body_start_0|> from .services import get_mentee_tasks_dict user_id = current_user.get_id() try: tasks = get_mentee_tasks_dict(user_id) return ({'tasks': tasks, 'success': True}, 200) except SQLAlchemyError: return {'success': False} <|end_body_0|> <...
MporterAPITask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MporterAPITask: def get(self): """get user tasks jwt authorization header required :return: {tasks: [list of tasks]}""" <|body_0|> def post(self): """create new task under the authorized user :return: {message: 'success' or 'failed'}""" <|body_1|> def de...
stack_v2_sparse_classes_75kplus_train_065438
4,700
permissive
[ { "docstring": "get user tasks jwt authorization header required :return: {tasks: [list of tasks]}", "name": "get", "signature": "def get(self)" }, { "docstring": "create new task under the authorized user :return: {message: 'success' or 'failed'}", "name": "post", "signature": "def post...
3
stack_v2_sparse_classes_30k_train_020651
Implement the Python class `MporterAPITask` described below. Class description: Implement the MporterAPITask class. Method signatures and docstrings: - def get(self): get user tasks jwt authorization header required :return: {tasks: [list of tasks]} - def post(self): create new task under the authorized user :return:...
Implement the Python class `MporterAPITask` described below. Class description: Implement the MporterAPITask class. Method signatures and docstrings: - def get(self): get user tasks jwt authorization header required :return: {tasks: [list of tasks]} - def post(self): create new task under the authorized user :return:...
3014131fe480604319555319662e5c20d2abb125
<|skeleton|> class MporterAPITask: def get(self): """get user tasks jwt authorization header required :return: {tasks: [list of tasks]}""" <|body_0|> def post(self): """create new task under the authorized user :return: {message: 'success' or 'failed'}""" <|body_1|> def de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MporterAPITask: def get(self): """get user tasks jwt authorization header required :return: {tasks: [list of tasks]}""" from .services import get_mentee_tasks_dict user_id = current_user.get_id() try: tasks = get_mentee_tasks_dict(user_id) return ({'task...
the_stack_v2_python_sparse
app/api.py
abhn/Mporter
train
3
a832f33ee1fb45c8a3611846d4e60b8415854120
[ "if not s:\n return\nc = s.pop()\nself.reverseStringList(s)\ns.insert(0, c)", "l = 0\nr = len(s) - 1\nss = list(s)\nwhile l <= r:\n if s[l] in string.ascii_letters and s[r] in string.ascii_letters:\n t = ss[l]\n ss[l] = ss[r]\n ss[r] = t\n l += 1\n r -= 1\n elif s[l] in...
<|body_start_0|> if not s: return c = s.pop() self.reverseStringList(s) s.insert(0, c) <|end_body_0|> <|body_start_1|> l = 0 r = len(s) - 1 ss = list(s) while l <= r: if s[l] in string.ascii_letters and s[r] in string.ascii_letters...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseStringList(self, s): """:type s: List[str] :rtype: None Do not return anything, modify s in-place instead.""" <|body_0|> def reverseString(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if ...
stack_v2_sparse_classes_75kplus_train_065439
1,189
no_license
[ { "docstring": ":type s: List[str] :rtype: None Do not return anything, modify s in-place instead.", "name": "reverseStringList", "signature": "def reverseStringList(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "reverseString", "signature": "def reverseString(self, s)"...
2
stack_v2_sparse_classes_30k_train_011156
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseStringList(self, s): :type s: List[str] :rtype: None Do not return anything, modify s in-place instead. - def reverseString(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseStringList(self, s): :type s: List[str] :rtype: None Do not return anything, modify s in-place instead. - def reverseString(self, s): :type s: str :rtype: str <|skele...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def reverseStringList(self, s): """:type s: List[str] :rtype: None Do not return anything, modify s in-place instead.""" <|body_0|> def reverseString(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverseStringList(self, s): """:type s: List[str] :rtype: None Do not return anything, modify s in-place instead.""" if not s: return c = s.pop() self.reverseStringList(s) s.insert(0, c) def reverseString(self, s): """:type s: str ...
the_stack_v2_python_sparse
R/ReverseString.py
bssrdf/pyleet
train
2
1fb4ffbde107dd83679257d63da8d01fb75b3a20
[ "email = request.GET.get('email', '')\ndata = {}\nif Business.objects.filter(bemail=email):\n data['email'] = '该邮箱已经注册过'\n return HttpResponse(json.dumps(data), content_type='application/json')\nsend_register(email, 'update_email')\ndata['status'] = 'success'\nreturn HttpResponse(json.dumps(data), content_typ...
<|body_start_0|> email = request.GET.get('email', '') data = {} if Business.objects.filter(bemail=email): data['email'] = '该邮箱已经注册过' return HttpResponse(json.dumps(data), content_type='application/json') send_register(email, 'update_email') data['status'] ...
UpdateBusEmailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateBusEmailView: def get(self, request): """获取邮箱验证码""" <|body_0|> def post(self, request): """修改邮箱 :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> email = request.GET.get('email', '') data = {} if Business...
stack_v2_sparse_classes_75kplus_train_065440
17,883
no_license
[ { "docstring": "获取邮箱验证码", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改邮箱 :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_015638
Implement the Python class `UpdateBusEmailView` described below. Class description: Implement the UpdateBusEmailView class. Method signatures and docstrings: - def get(self, request): 获取邮箱验证码 - def post(self, request): 修改邮箱 :param request: :return:
Implement the Python class `UpdateBusEmailView` described below. Class description: Implement the UpdateBusEmailView class. Method signatures and docstrings: - def get(self, request): 获取邮箱验证码 - def post(self, request): 修改邮箱 :param request: :return: <|skeleton|> class UpdateBusEmailView: def get(self, request): ...
cf2fe51fe908fc67dc3ccdd8baeb099c8fc32f21
<|skeleton|> class UpdateBusEmailView: def get(self, request): """获取邮箱验证码""" <|body_0|> def post(self, request): """修改邮箱 :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateBusEmailView: def get(self, request): """获取邮箱验证码""" email = request.GET.get('email', '') data = {} if Business.objects.filter(bemail=email): data['email'] = '该邮箱已经注册过' return HttpResponse(json.dumps(data), content_type='application/json') s...
the_stack_v2_python_sparse
business/views.py
DWEI001/MealOrderingOnline
train
0
181bfff0c98b85adb69d1e0eeba9265824077208
[ "if self._async_current_entries(True):\n return self.async_abort(reason='single_instance_allowed')\nreturn self.async_create_entry(title='Switcher', data={})", "if self._async_current_entries(True):\n return self.async_abort(reason='single_instance_allowed')\nself.hass.data.setdefault(DOMAIN, {})\nif DATA_D...
<|body_start_0|> if self._async_current_entries(True): return self.async_abort(reason='single_instance_allowed') return self.async_create_entry(title='Switcher', data={}) <|end_body_0|> <|body_start_1|> if self._async_current_entries(True): return self.async_abort(reason...
Handle Switcher config flow.
SwitcherFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwitcherFlowHandler: """Handle Switcher config flow.""" async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: """Handle a flow initiated by import.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResu...
stack_v2_sparse_classes_75kplus_train_065441
1,753
permissive
[ { "docstring": "Handle a flow initiated by import.", "name": "async_step_import", "signature": "async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult" }, { "docstring": "Handle the start of the config flow.", "name": "async_step_user", "signature": "async def asy...
3
stack_v2_sparse_classes_30k_train_045084
Implement the Python class `SwitcherFlowHandler` described below. Class description: Handle Switcher config flow. Method signatures and docstrings: - async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: Handle a flow initiated by import. - async def async_step_user(self, user_input: dict[st...
Implement the Python class `SwitcherFlowHandler` described below. Class description: Handle Switcher config flow. Method signatures and docstrings: - async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: Handle a flow initiated by import. - async def async_step_user(self, user_input: dict[st...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SwitcherFlowHandler: """Handle Switcher config flow.""" async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: """Handle a flow initiated by import.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SwitcherFlowHandler: """Handle Switcher config flow.""" async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: """Handle a flow initiated by import.""" if self._async_current_entries(True): return self.async_abort(reason='single_instance_allowed') ...
the_stack_v2_python_sparse
homeassistant/components/switcher_kis/config_flow.py
home-assistant/core
train
35,501
23d435541fb77ed43359088c0d5584de902f30bb
[ "super(FeatureExtractor, self).__init__()\nif feat_type == 'spectrogram':\n self.feat = partial(librosa_stft, n_fft=opts['n_fft'], hop_length=opts['hop_length'], win_length=opts['win_length'])\nelif feat_type == 'fbank':\n self.feat = partial(python_speech_features_fbank, samplerate=rate, n_fft=opts['n_fft'],...
<|body_start_0|> super(FeatureExtractor, self).__init__() if feat_type == 'spectrogram': self.feat = partial(librosa_stft, n_fft=opts['n_fft'], hop_length=opts['hop_length'], win_length=opts['win_length']) elif feat_type == 'fbank': self.feat = partial(python_speech_featu...
FeatureExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureExtractor: def __init__(self, rate, feat_type, opts): """params: rate: sample rate of speech feat_type: feature type, spectrogram, fbank, mfcc opts: detail configuration for feature extraction""" <|body_0|> def forward(self, wave): """Params: wave: wave data, ...
stack_v2_sparse_classes_75kplus_train_065442
8,519
no_license
[ { "docstring": "params: rate: sample rate of speech feat_type: feature type, spectrogram, fbank, mfcc opts: detail configuration for feature extraction", "name": "__init__", "signature": "def __init__(self, rate, feat_type, opts)" }, { "docstring": "Params: wave: wave data, shape is (B, T) Retur...
2
stack_v2_sparse_classes_30k_test_001613
Implement the Python class `FeatureExtractor` described below. Class description: Implement the FeatureExtractor class. Method signatures and docstrings: - def __init__(self, rate, feat_type, opts): params: rate: sample rate of speech feat_type: feature type, spectrogram, fbank, mfcc opts: detail configuration for fe...
Implement the Python class `FeatureExtractor` described below. Class description: Implement the FeatureExtractor class. Method signatures and docstrings: - def __init__(self, rate, feat_type, opts): params: rate: sample rate of speech feat_type: feature type, spectrogram, fbank, mfcc opts: detail configuration for fe...
eb52842755312a751fd40fce648ca92c3e737720
<|skeleton|> class FeatureExtractor: def __init__(self, rate, feat_type, opts): """params: rate: sample rate of speech feat_type: feature type, spectrogram, fbank, mfcc opts: detail configuration for feature extraction""" <|body_0|> def forward(self, wave): """Params: wave: wave data, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeatureExtractor: def __init__(self, rate, feat_type, opts): """params: rate: sample rate of speech feat_type: feature type, spectrogram, fbank, mfcc opts: detail configuration for feature extraction""" super(FeatureExtractor, self).__init__() if feat_type == 'spectrogram': ...
the_stack_v2_python_sparse
libs/dataio/feature.py
zengchang233/asv_beginner
train
2
c7f2275a1e3d02db3ee212a088ab600fbbf708ef
[ "if t < 0 or k < 0:\n return False\nall_buckets = {}\nbucket_size = t + 1\nfor i in range(len(nums)):\n bucket_num = nums[i] // bucket_size\n if bucket_num in all_buckets:\n return True\n all_buckets[bucket_num] = nums[i]\n if bucket_num - 1 in all_buckets and abs(all_buckets[bucket_num - 1] -...
<|body_start_0|> if t < 0 or k < 0: return False all_buckets = {} bucket_size = t + 1 for i in range(len(nums)): bucket_num = nums[i] // bucket_size if bucket_num in all_buckets: return True all_buckets[bucket_num] = nums[i]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate2(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_75kplus_train_065443
2,872
no_license
[ { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearbyAlmostDuplicate", "signature": "def containsNearbyAlmostDuplicate(self, nums, k, t)" }, { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearby...
2
stack_v2_sparse_classes_30k_val_001109
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate2(self, nums, k, t): :type nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate2(self, nums, k, t): :type nu...
b0f498ebe84e46b7e17e94759dd462891dcc8f85
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate2(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" if t < 0 or k < 0: return False all_buckets = {} bucket_size = t + 1 for i in range(len(nums)): bucket_num = nums[i]...
the_stack_v2_python_sparse
查找表类算法/table_5_2.py
wulinlw/leetcode_cn
train
0
8e04cf88acf7539052b388de625850b741f52b4d
[ "subm = Submission.objects.get_or_404(id=id)\nif isinstance(g.user, Student):\n if g.user == subm.submitter:\n return subm.to_dict()\n else:\n abort(403)\nelse:\n proj = Project.objects.get_or_404(submissions=subm)\n course = proj.course\n if g.user in course.teachers:\n return s...
<|body_start_0|> subm = Submission.objects.get_or_404(id=id) if isinstance(g.user, Student): if g.user == subm.submitter: return subm.to_dict() else: abort(403) else: proj = Project.objects.get_or_404(submissions=subm) ...
SingleSubmission
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleSubmission: def get(self, id): """Returns a single submission by id. Logged in user must be submitter or a teacher.""" <|body_0|> def delete(self, id): """Deletes a submission, only it's submitter can delete it.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_065444
2,883
permissive
[ { "docstring": "Returns a single submission by id. Logged in user must be submitter or a teacher.", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Deletes a submission, only it's submitter can delete it.", "name": "delete", "signature": "def delete(self, id)" } ]
2
stack_v2_sparse_classes_30k_train_020009
Implement the Python class `SingleSubmission` described below. Class description: Implement the SingleSubmission class. Method signatures and docstrings: - def get(self, id): Returns a single submission by id. Logged in user must be submitter or a teacher. - def delete(self, id): Deletes a submission, only it's submi...
Implement the Python class `SingleSubmission` described below. Class description: Implement the SingleSubmission class. Method signatures and docstrings: - def get(self, id): Returns a single submission by id. Logged in user must be submitter or a teacher. - def delete(self, id): Deletes a submission, only it's submi...
844f15803537116a19d1a556378e15fccb85d1c8
<|skeleton|> class SingleSubmission: def get(self, id): """Returns a single submission by id. Logged in user must be submitter or a teacher.""" <|body_0|> def delete(self, id): """Deletes a submission, only it's submitter can delete it.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SingleSubmission: def get(self, id): """Returns a single submission by id. Logged in user must be submitter or a teacher.""" subm = Submission.objects.get_or_404(id=id) if isinstance(g.user, Student): if g.user == subm.submitter: return subm.to_dict() ...
the_stack_v2_python_sparse
application/resources/submission.py
seifhatem/java-project-runner
train
0
357b4b7e64ee4a0b6d7cca0424e6584bbede3373
[ "entry1 = stats_values.StatsStoreEntry(process_id='test_process', metric_name='test_metric', metric_value=stats_values.StatsStoreValue(value_type=rdf_stats.MetricMetadata.ValueType.INT, fields_values=[stats_values.StatsStoreFieldValue(field_type=rdf_stats.MetricFieldDefinition.FieldType.STR, str_value='dim1'), stat...
<|body_start_0|> entry1 = stats_values.StatsStoreEntry(process_id='test_process', metric_name='test_metric', metric_value=stats_values.StatsStoreValue(value_type=rdf_stats.MetricMetadata.ValueType.INT, fields_values=[stats_values.StatsStoreFieldValue(field_type=rdf_stats.MetricFieldDefinition.FieldType.STR, str...
StatsDBUtilsTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatsDBUtilsTest: def testStatsEntryId_VaryStringDimensions(self): """Ensures StatsEntries with different str dimensions get different ids.""" <|body_0|> def testStatsEntryId_VaryIntDimensions(self): """Ensures StatsEntries with different int dimensions get different...
stack_v2_sparse_classes_75kplus_train_065445
7,868
permissive
[ { "docstring": "Ensures StatsEntries with different str dimensions get different ids.", "name": "testStatsEntryId_VaryStringDimensions", "signature": "def testStatsEntryId_VaryStringDimensions(self)" }, { "docstring": "Ensures StatsEntries with different int dimensions get different ids.", "...
3
stack_v2_sparse_classes_30k_train_048437
Implement the Python class `StatsDBUtilsTest` described below. Class description: Implement the StatsDBUtilsTest class. Method signatures and docstrings: - def testStatsEntryId_VaryStringDimensions(self): Ensures StatsEntries with different str dimensions get different ids. - def testStatsEntryId_VaryIntDimensions(se...
Implement the Python class `StatsDBUtilsTest` described below. Class description: Implement the StatsDBUtilsTest class. Method signatures and docstrings: - def testStatsEntryId_VaryStringDimensions(self): Ensures StatsEntries with different str dimensions get different ids. - def testStatsEntryId_VaryIntDimensions(se...
cfc725b5ee3a2626ac4cdae7fb14471612da4522
<|skeleton|> class StatsDBUtilsTest: def testStatsEntryId_VaryStringDimensions(self): """Ensures StatsEntries with different str dimensions get different ids.""" <|body_0|> def testStatsEntryId_VaryIntDimensions(self): """Ensures StatsEntries with different int dimensions get different...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StatsDBUtilsTest: def testStatsEntryId_VaryStringDimensions(self): """Ensures StatsEntries with different str dimensions get different ids.""" entry1 = stats_values.StatsStoreEntry(process_id='test_process', metric_name='test_metric', metric_value=stats_values.StatsStoreValue(value_type=rdf_st...
the_stack_v2_python_sparse
grr/server/grr_response_server/db_utils_test.py
4ndygu/grr
train
0
378e2c89055ff4e33113733255bffc4a0cb8456e
[ "self.enabled = enabled\nself.apigateway = config.get('apigateway') if config else None\nself.job = 'lithops'\nself.instance = os.environ['__LITHOPS_SESSION_ID'].split('-')[0]", "if self.enabled and self.apigateway:\n dim = 'job/{}/instance/{}'.format(self.job, self.instance)\n for key, val in labels:\n ...
<|body_start_0|> self.enabled = enabled self.apigateway = config.get('apigateway') if config else None self.job = 'lithops' self.instance = os.environ['__LITHOPS_SESSION_ID'].split('-')[0] <|end_body_0|> <|body_start_1|> if self.enabled and self.apigateway: dim = 'jo...
PrometheusExporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrometheusExporter: def __init__(self, enabled, config): """Prometheus exporter for sending metrics to an API Gateway""" <|body_0|> def send_metric(self, name, value, type, labels): """Send a metric to prometheus""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_065446
1,057
permissive
[ { "docstring": "Prometheus exporter for sending metrics to an API Gateway", "name": "__init__", "signature": "def __init__(self, enabled, config)" }, { "docstring": "Send a metric to prometheus", "name": "send_metric", "signature": "def send_metric(self, name, value, type, labels)" } ]
2
stack_v2_sparse_classes_30k_train_031244
Implement the Python class `PrometheusExporter` described below. Class description: Implement the PrometheusExporter class. Method signatures and docstrings: - def __init__(self, enabled, config): Prometheus exporter for sending metrics to an API Gateway - def send_metric(self, name, value, type, labels): Send a metr...
Implement the Python class `PrometheusExporter` described below. Class description: Implement the PrometheusExporter class. Method signatures and docstrings: - def __init__(self, enabled, config): Prometheus exporter for sending metrics to an API Gateway - def send_metric(self, name, value, type, labels): Send a metr...
12bf3babbce6e9eb70a5e16cdd40093552a2ecfc
<|skeleton|> class PrometheusExporter: def __init__(self, enabled, config): """Prometheus exporter for sending metrics to an API Gateway""" <|body_0|> def send_metric(self, name, value, type, labels): """Send a metric to prometheus""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrometheusExporter: def __init__(self, enabled, config): """Prometheus exporter for sending metrics to an API Gateway""" self.enabled = enabled self.apigateway = config.get('apigateway') if config else None self.job = 'lithops' self.instance = os.environ['__LITHOPS_SESS...
the_stack_v2_python_sparse
lithops/util/metrics.py
Cohen-J-Omer/lithops
train
0
80d6d9400eff3c921349903f42ac0a5f5bd70e2f
[ "if self.jaro_winkler_distance > other.jaro_winkler_distance:\n return True\nreturn self.damerau_levenshtein_distance < other.damerau_levenshtein_distance", "if not isinstance(other, MatchingStats):\n return False\nreturn self.exact_match == other.exact_match or self.match_rating_approach_comparison == othe...
<|body_start_0|> if self.jaro_winkler_distance > other.jaro_winkler_distance: return True return self.damerau_levenshtein_distance < other.damerau_levenshtein_distance <|end_body_0|> <|body_start_1|> if not isinstance(other, MatchingStats): return False return se...
Definition of matching statistics for two strings. . Attributes: string1: a string string2: another string damerau_levenshtein_distance: the Damerau Levenshtein distance between the two strings. jaro_winkler_distance: the Jaro Winkler distance between the two strings. match_rating_approach_comparison: the match rating ...
MatchingStats
[ "Apache-2.0", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchingStats: """Definition of matching statistics for two strings. . Attributes: string1: a string string2: another string damerau_levenshtein_distance: the Damerau Levenshtein distance between the two strings. jaro_winkler_distance: the Jaro Winkler distance between the two strings. match_rati...
stack_v2_sparse_classes_75kplus_train_065447
2,752
permissive
[ { "docstring": "Redefines Less than. The stats are \"smaller\" if the distance between the two strings is smaller. In other words, the stats are smaller if the strings are more likely to match.", "name": "__lt__", "signature": "def __lt__(self, other: 'MatchingStats') -> bool" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_040771
Implement the Python class `MatchingStats` described below. Class description: Definition of matching statistics for two strings. . Attributes: string1: a string string2: another string damerau_levenshtein_distance: the Damerau Levenshtein distance between the two strings. jaro_winkler_distance: the Jaro Winkler dista...
Implement the Python class `MatchingStats` described below. Class description: Definition of matching statistics for two strings. . Attributes: string1: a string string2: another string damerau_levenshtein_distance: the Damerau Levenshtein distance between the two strings. jaro_winkler_distance: the Jaro Winkler dista...
3df724ae5705c675261349ecd3ac38b0781c1d65
<|skeleton|> class MatchingStats: """Definition of matching statistics for two strings. . Attributes: string1: a string string2: another string damerau_levenshtein_distance: the Damerau Levenshtein distance between the two strings. jaro_winkler_distance: the Jaro Winkler distance between the two strings. match_rati...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MatchingStats: """Definition of matching statistics for two strings. . Attributes: string1: a string string2: another string damerau_levenshtein_distance: the Damerau Levenshtein distance between the two strings. jaro_winkler_distance: the Jaro Winkler distance between the two strings. match_rating_approach_c...
the_stack_v2_python_sparse
continuous_delivery_scripts/utils/string_helpers.py
acabarbaye/continuous-delivery-scripts-1
train
1
942e20fa65f0a304ef68a184de15e6472a24b5c6
[ "super().__init__(*args, **kwargs)\nself.mode = None\nself.axis = None", "if isinstance(self.args, dict):\n self.mode = engine.evaluate(self.args.get('mode'), recursive=True)\n self.axis = engine.evaluate(self.args.get('axis'), recursive=True)\nelse:\n self.mode = self.args\n self.axis = Merge.DEFAULT...
<|body_start_0|> super().__init__(*args, **kwargs) self.mode = None self.axis = None <|end_body_0|> <|body_start_1|> if isinstance(self.args, dict): self.mode = engine.evaluate(self.args.get('mode'), recursive=True) self.axis = engine.evaluate(self.args.get('axis...
A container for merging inputs from multiple input layers.
Merge
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Merge: """A container for merging inputs from multiple input layers.""" def __init__(self, *args, **kwargs): """Create a new merge container.""" <|body_0|> def _parse(self, engine): """Parse the child containers""" <|body_1|> def _build(self, model):...
stack_v2_sparse_classes_75kplus_train_065448
4,408
permissive
[ { "docstring": "Create a new merge container.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Parse the child containers", "name": "_parse", "signature": "def _parse(self, engine)" }, { "docstring": "Instantiate the container.", "na...
4
stack_v2_sparse_classes_30k_train_045906
Implement the Python class `Merge` described below. Class description: A container for merging inputs from multiple input layers. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a new merge container. - def _parse(self, engine): Parse the child containers - def _build(self, model): Ins...
Implement the Python class `Merge` described below. Class description: A container for merging inputs from multiple input layers. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a new merge container. - def _parse(self, engine): Parse the child containers - def _build(self, model): Ins...
fd0c120e50815c1e5be64e5dde964dcd47234556
<|skeleton|> class Merge: """A container for merging inputs from multiple input layers.""" def __init__(self, *args, **kwargs): """Create a new merge container.""" <|body_0|> def _parse(self, engine): """Parse the child containers""" <|body_1|> def _build(self, model):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Merge: """A container for merging inputs from multiple input layers.""" def __init__(self, *args, **kwargs): """Create a new merge container.""" super().__init__(*args, **kwargs) self.mode = None self.axis = None def _parse(self, engine): """Parse the child co...
the_stack_v2_python_sparse
kur/containers/layers/merge.py
deepgram/kur
train
873
1c15971ec2be21599e09a4e8ec9a32cb288b8efd
[ "super(BayesianLSTMCell, self).__init__(num_units, **kwargs)\nself.w = None\nself.b = None\nself.prior = prior\nself.n = name\nself.is_training = is_training\nself.num_units = num_units\nself.X_dim = X_dim", "with tf.variable_scope('BayesLSTMCell'):\n if self.w is None:\n print(['------- Size input LSTM...
<|body_start_0|> super(BayesianLSTMCell, self).__init__(num_units, **kwargs) self.w = None self.b = None self.prior = prior self.n = name self.is_training = is_training self.num_units = num_units self.X_dim = X_dim <|end_body_0|> <|body_start_1|> ...
BayesianLSTMCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BayesianLSTMCell: def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): """In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weigh...
stack_v2_sparse_classes_75kplus_train_065449
4,584
no_license
[ { "docstring": "In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weights: Needed to compute the first set of weights before seeing any data As wwll as the number of units in each...
2
stack_v2_sparse_classes_30k_test_001686
Implement the Python class `BayesianLSTMCell` described below. Class description: Implement the BayesianLSTMCell class. Method signatures and docstrings: - def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): In the initialization of the Cell, we will set: - The internal weights structures w...
Implement the Python class `BayesianLSTMCell` described below. Class description: Implement the BayesianLSTMCell class. Method signatures and docstrings: - def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): In the initialization of the Cell, we will set: - The internal weights structures w...
f1248011010e95906e291316aec1679c23a834e3
<|skeleton|> class BayesianLSTMCell: def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): """In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weigh...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BayesianLSTMCell: def __init__(self, X_dim, num_units, prior, is_training, name=None, **kwargs): """In the initialization of the Cell, we will set: - The internal weights structures w and b. Which will hold the weights and biases for the 4 gates of the LSTM cell. - The Prior of the weights: Needed to ...
the_stack_v2_python_sparse
libs/BBBLSTM/BayesianLSTMCell.py
Sdoof/Trapyng
train
0
0f5aaa0b7447cea549be7b20c3a8b28143e61c28
[ "self.encoding = A\nself.length = len(A)\nself.i = 0", "while self.i < self.length and self.encoding[self.i] < n:\n n -= self.encoding[self.i]\n self.i += 2\nif self.i >= self.length:\n return -1\nself.encoding[self.i] -= n\nreturn self.encoding[self.i + 1]" ]
<|body_start_0|> self.encoding = A self.length = len(A) self.i = 0 <|end_body_0|> <|body_start_1|> while self.i < self.length and self.encoding[self.i] < n: n -= self.encoding[self.i] self.i += 2 if self.i >= self.length: return -1 sel...
RLEIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.encoding = A self.length = len(A) self.i = 0 <|end_body_0|> ...
stack_v2_sparse_classes_75kplus_train_065450
1,849
no_license
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_032980
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RLEIterator: def __init__(self, A): """:type A: List[int]""" self.encoding = A self.length = len(A) self.i = 0 def next(self, n): """:type n: int :rtype: int""" while self.i < self.length and self.encoding[self.i] < n: n -= self.encoding[self.i]...
the_stack_v2_python_sparse
python_1_to_1000/900_RLE_Iterator.py
jakehoare/leetcode
train
58
9f1f227e9b2eea62631303fe0e98a5cef80344fb
[ "self.URL = locDict['URL']\nself.LocationName = locDict['Location']\nself.Keys = [locDict['Key']]\nself.locDict = locDict\nreturn", "case = Status.POSSIBLE\nr = requests.get(self.URL)\ntry:\n if self.locDict['available']:\n case = Status.YES\n else:\n case = Status.NO\nexcept KeyError:\n lo...
<|body_start_0|> self.URL = locDict['URL'] self.LocationName = locDict['Location'] self.Keys = [locDict['Key']] self.locDict = locDict return <|end_body_0|> <|body_start_1|> case = Status.POSSIBLE r = requests.get(self.URL) try: if self.locDic...
class for a scraper that reports status for a single Pharmaca location
Pharmaca
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pharmaca: """class for a scraper that reports status for a single Pharmaca location""" def __init__(self, locDict): """initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute...
stack_v2_sparse_classes_75kplus_train_065451
1,417
permissive
[ { "docstring": "initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute of the PharmacaWrapper class", "name": "__init__", "signature": "def __init__(self, locDict)" }, { "docstring": "l...
2
stack_v2_sparse_classes_30k_train_012129
Implement the Python class `Pharmaca` described below. Class description: class for a scraper that reports status for a single Pharmaca location Method signatures and docstrings: - def __init__(self, locDict): initialization method. Takes a locDict dictionary with information about a single location. The keys of the ...
Implement the Python class `Pharmaca` described below. Class description: class for a scraper that reports status for a single Pharmaca location Method signatures and docstrings: - def __init__(self, locDict): initialization method. Takes a locDict dictionary with information about a single location. The keys of the ...
28248155c136f9b267f0ada7749d30848de0981f
<|skeleton|> class Pharmaca: """class for a scraper that reports status for a single Pharmaca location""" def __init__(self, locDict): """initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pharmaca: """class for a scraper that reports status for a single Pharmaca location""" def __init__(self, locDict): """initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute of the Pharm...
the_stack_v2_python_sparse
python/Pharmaca.py
CovidWA/scrapers-oss
train
0
6640f260e798560bc00fd29d4fe7c8c85ec54676
[ "if data is None:\n if lambtha <= 0:\n raise ValueError('lambtha must be a positive value')\n else:\n self.lambtha = float(lambtha)\nelse:\n if type(data) is not list:\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple ...
<|body_start_0|> if data is None: if lambtha <= 0: raise ValueError('lambtha must be a positive value') else: self.lambtha = float(lambtha) else: if type(data) is not list: raise TypeError('data must be a list') ...
Represents an exponential distribution
Exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exponential: """Represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Class constructor - data is a list of the data to be used to estimate the distribution - lambtha is the expected number of occurences in a given time frame""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_065452
1,434
no_license
[ { "docstring": "Class constructor - data is a list of the data to be used to estimate the distribution - lambtha is the expected number of occurences in a given time frame", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" }, { "docstring": "Calculates the value of t...
3
stack_v2_sparse_classes_30k_train_006176
Implement the Python class `Exponential` described below. Class description: Represents an exponential distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Class constructor - data is a list of the data to be used to estimate the distribution - lambtha is the expected number of...
Implement the Python class `Exponential` described below. Class description: Represents an exponential distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Class constructor - data is a list of the data to be used to estimate the distribution - lambtha is the expected number of...
161e33b23d398d7d01ad0d7740b78dda3f27e787
<|skeleton|> class Exponential: """Represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Class constructor - data is a list of the data to be used to estimate the distribution - lambtha is the expected number of occurences in a given time frame""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Exponential: """Represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Class constructor - data is a list of the data to be used to estimate the distribution - lambtha is the expected number of occurences in a given time frame""" if data is None: ...
the_stack_v2_python_sparse
math/0x03-probability/exponential.py
felipeserna/holbertonschool-machine_learning
train
0
bee6a1428ab90c3f7553bc54320a8b5b702361d6
[ "single_scalers = []\nidx_to_remove = []\nfor i, (expt, refl) in enumerate(zip(experiments, reflections)):\n try:\n scaler = SingleScalerFactory.create(params, expt, refl, for_multi=True)\n except BadDatasetForScalingException as e:\n logger.info(e)\n idx_to_remove.append(i)\n else:\n ...
<|body_start_0|> single_scalers = [] idx_to_remove = [] for i, (expt, refl) in enumerate(zip(experiments, reflections)): try: scaler = SingleScalerFactory.create(params, expt, refl, for_multi=True) except BadDatasetForScalingException as e: ...
Factory for creating a scaler for multiple datasets
MultiScalerFactory
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiScalerFactory: """Factory for creating a scaler for multiple datasets""" def create(params, experiments, reflections): """create a list of single scalers to pass to a MultiScaler.""" <|body_0|> def create_from_targetscaler(targetscaler): """method to pass sc...
stack_v2_sparse_classes_75kplus_train_065453
13,194
permissive
[ { "docstring": "create a list of single scalers to pass to a MultiScaler.", "name": "create", "signature": "def create(params, experiments, reflections)" }, { "docstring": "method to pass scalers from TargetScaler to a MultiScaler", "name": "create_from_targetscaler", "signature": "def c...
2
stack_v2_sparse_classes_30k_train_000203
Implement the Python class `MultiScalerFactory` described below. Class description: Factory for creating a scaler for multiple datasets Method signatures and docstrings: - def create(params, experiments, reflections): create a list of single scalers to pass to a MultiScaler. - def create_from_targetscaler(targetscale...
Implement the Python class `MultiScalerFactory` described below. Class description: Factory for creating a scaler for multiple datasets Method signatures and docstrings: - def create(params, experiments, reflections): create a list of single scalers to pass to a MultiScaler. - def create_from_targetscaler(targetscale...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class MultiScalerFactory: """Factory for creating a scaler for multiple datasets""" def create(params, experiments, reflections): """create a list of single scalers to pass to a MultiScaler.""" <|body_0|> def create_from_targetscaler(targetscaler): """method to pass sc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiScalerFactory: """Factory for creating a scaler for multiple datasets""" def create(params, experiments, reflections): """create a list of single scalers to pass to a MultiScaler.""" single_scalers = [] idx_to_remove = [] for i, (expt, refl) in enumerate(zip(experimen...
the_stack_v2_python_sparse
src/dials/algorithms/scaling/scaler_factory.py
dials/dials
train
71
29ee016a4f20be96d35e962054f723be2bffada2
[ "self.internreferanse_field = internreferanse_field\nself.fodt_dato_field = APIHelper.RFC3339DateTime(fodt_dato_field) if fodt_dato_field else None\nself.fodt_dato_field_specified = fodt_dato_field_specified\nself.navn_field = navn_field\nself.adresse_field = adresse_field\nself.postnr_field = postnr_field\nself.po...
<|body_start_0|> self.internreferanse_field = internreferanse_field self.fodt_dato_field = APIHelper.RFC3339DateTime(fodt_dato_field) if fodt_dato_field else None self.fodt_dato_field_specified = fodt_dato_field_specified self.navn_field = navn_field self.adresse_field = adresse_...
Implementation of the 'Rettighetshavere' model. TODO: type model description here. Attributes: internreferanse_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. fodt_dato_field_specified (bool): TODO: type description here. navn_field (string): TODO: type descriptio...
Rettighetshavere
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rettighetshavere: """Implementation of the 'Rettighetshavere' model. TODO: type model description here. Attributes: internreferanse_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. fodt_dato_field_specified (bool): TODO: type description here...
stack_v2_sparse_classes_75kplus_train_065454
4,475
permissive
[ { "docstring": "Constructor for the Rettighetshavere class", "name": "__init__", "signature": "def __init__(self, internreferanse_field=None, fodt_dato_field=None, fodt_dato_field_specified=None, navn_field=None, adresse_field=None, postnr_field=None, poststed_field=None, andel_field=None, indirekte_eie...
2
stack_v2_sparse_classes_30k_train_048095
Implement the Python class `Rettighetshavere` described below. Class description: Implementation of the 'Rettighetshavere' model. TODO: type model description here. Attributes: internreferanse_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. fodt_dato_field_specif...
Implement the Python class `Rettighetshavere` described below. Class description: Implementation of the 'Rettighetshavere' model. TODO: type model description here. Attributes: internreferanse_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. fodt_dato_field_specif...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Rettighetshavere: """Implementation of the 'Rettighetshavere' model. TODO: type model description here. Attributes: internreferanse_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. fodt_dato_field_specified (bool): TODO: type description here...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Rettighetshavere: """Implementation of the 'Rettighetshavere' model. TODO: type model description here. Attributes: internreferanse_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. fodt_dato_field_specified (bool): TODO: type description here. navn_field ...
the_stack_v2_python_sparse
idfy_rest_client/models/rettighetshavere.py
dealflowteam/Idfy
train
0
b1e140e1248c2b62d64c0f98f592327413306b5c
[ "text_length = len(text)\namount_to_pad = self.block_size - text_length % self.block_size\nif amount_to_pad == 0:\n amount_to_pad = self.block_size\npad = chr(amount_to_pad)\nreturn text + pad * amount_to_pad", "pad = ord(decrypted[-1])\nif pad < 1 or pad > 32:\n pad = 0\nreturn decrypted[:-pad]" ]
<|body_start_0|> text_length = len(text) amount_to_pad = self.block_size - text_length % self.block_size if amount_to_pad == 0: amount_to_pad = self.block_size pad = chr(amount_to_pad) return text + pad * amount_to_pad <|end_body_0|> <|body_start_1|> pad = or...
提供基于PKCS7算法的加解密接口
PKCS7Encoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PKCS7Encoder: """提供基于PKCS7算法的加解密接口""" def encode(self, text): """对需要加密的明文进行填充补位 @:param text: 需要进行填充补位操作的明文 @:return: 补齐明文字符串""" <|body_0|> def decode(decrypted): """删除解密后明文的补位字符 @param decrypted: 解密后的明文 @return: 删除补位字符后的明文""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_065455
12,124
permissive
[ { "docstring": "对需要加密的明文进行填充补位 @:param text: 需要进行填充补位操作的明文 @:return: 补齐明文字符串", "name": "encode", "signature": "def encode(self, text)" }, { "docstring": "删除解密后明文的补位字符 @param decrypted: 解密后的明文 @return: 删除补位字符后的明文", "name": "decode", "signature": "def decode(decrypted)" } ]
2
stack_v2_sparse_classes_30k_train_018872
Implement the Python class `PKCS7Encoder` described below. Class description: 提供基于PKCS7算法的加解密接口 Method signatures and docstrings: - def encode(self, text): 对需要加密的明文进行填充补位 @:param text: 需要进行填充补位操作的明文 @:return: 补齐明文字符串 - def decode(decrypted): 删除解密后明文的补位字符 @param decrypted: 解密后的明文 @return: 删除补位字符后的明文
Implement the Python class `PKCS7Encoder` described below. Class description: 提供基于PKCS7算法的加解密接口 Method signatures and docstrings: - def encode(self, text): 对需要加密的明文进行填充补位 @:param text: 需要进行填充补位操作的明文 @:return: 补齐明文字符串 - def decode(decrypted): 删除解密后明文的补位字符 @param decrypted: 解密后的明文 @return: 删除补位字符后的明文 <|skeleton|> clas...
70effec8283eb9f3f6807ee743956211e5512206
<|skeleton|> class PKCS7Encoder: """提供基于PKCS7算法的加解密接口""" def encode(self, text): """对需要加密的明文进行填充补位 @:param text: 需要进行填充补位操作的明文 @:return: 补齐明文字符串""" <|body_0|> def decode(decrypted): """删除解密后明文的补位字符 @param decrypted: 解密后的明文 @return: 删除补位字符后的明文""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PKCS7Encoder: """提供基于PKCS7算法的加解密接口""" def encode(self, text): """对需要加密的明文进行填充补位 @:param text: 需要进行填充补位操作的明文 @:return: 补齐明文字符串""" text_length = len(text) amount_to_pad = self.block_size - text_length % self.block_size if amount_to_pad == 0: amount_to_pad = self....
the_stack_v2_python_sparse
backend/app/common/wechat.py
AronYang/flask-base-admin
train
9
210d2fc43ce94f4bb0b5aaff5cc63636e05993d0
[ "formatted_city = city_format('Buenos Aires', 'Argentina')\nself.assertEqual(formatted_city, 'Buenos Aires, Argentina')\npass", "formatted_city = city_format('Buenos Aires', 'Argentina', '2300000')\nself.assertEqual(formatted_city, 'Buenos Aires, Argentina - population : 2300000')\npass" ]
<|body_start_0|> formatted_city = city_format('Buenos Aires', 'Argentina') self.assertEqual(formatted_city, 'Buenos Aires, Argentina') pass <|end_body_0|> <|body_start_1|> formatted_city = city_format('Buenos Aires', 'Argentina', '2300000') self.assertEqual(formatted_city, 'Buen...
Test cities.py
CityTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CityTestCase: """Test cities.py""" def test_city_country(self): """Se verifica formateo de ciudad , pais""" <|body_0|> def test_population(self): """se verifica si acepta el campo poblacion""" <|body_1|> <|end_skeleton|> <|body_start_0|> formatt...
stack_v2_sparse_classes_75kplus_train_065456
673
no_license
[ { "docstring": "Se verifica formateo de ciudad , pais", "name": "test_city_country", "signature": "def test_city_country(self)" }, { "docstring": "se verifica si acepta el campo poblacion", "name": "test_population", "signature": "def test_population(self)" } ]
2
stack_v2_sparse_classes_30k_train_039079
Implement the Python class `CityTestCase` described below. Class description: Test cities.py Method signatures and docstrings: - def test_city_country(self): Se verifica formateo de ciudad , pais - def test_population(self): se verifica si acepta el campo poblacion
Implement the Python class `CityTestCase` described below. Class description: Test cities.py Method signatures and docstrings: - def test_city_country(self): Se verifica formateo de ciudad , pais - def test_population(self): se verifica si acepta el campo poblacion <|skeleton|> class CityTestCase: """Test cities...
0678e8d884e0641d592a3a457db11cc2085c8b27
<|skeleton|> class CityTestCase: """Test cities.py""" def test_city_country(self): """Se verifica formateo de ciudad , pais""" <|body_0|> def test_population(self): """se verifica si acepta el campo poblacion""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CityTestCase: """Test cities.py""" def test_city_country(self): """Se verifica formateo de ciudad , pais""" formatted_city = city_format('Buenos Aires', 'Argentina') self.assertEqual(formatted_city, 'Buenos Aires, Argentina') pass def test_population(self): ""...
the_stack_v2_python_sparse
src/test_cities.py
lucasguerra91/some-python
train
0
3e2daa4c183aa4180ed4627896369b9ac0cca60b
[ "if root is None:\n return 0\nreturn max(self._maxPathSum(root))", "if root is None:\n return (0, float('-INF'))\nlcan, lcannot = self._maxPathSum(root.left)\nrcan, rcannot = self._maxPathSum(root.right)\ncanConcat = root.val + max(lcan, rcan, 0)\ncannotConcat = max(lcannot, rcannot, root.val + lcan + rcan,...
<|body_start_0|> if root is None: return 0 return max(self._maxPathSum(root)) <|end_body_0|> <|body_start_1|> if root is None: return (0, float('-INF')) lcan, lcannot = self._maxPathSum(root.left) rcan, rcannot = self._maxPathSum(root.right) canCo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def _maxPathSum(self, root): """:rtype: (int, int) <= (canConcat, cannotConcat)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: retu...
stack_v2_sparse_classes_75kplus_train_065457
921
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxPathSum", "signature": "def maxPathSum(self, root)" }, { "docstring": ":rtype: (int, int) <= (canConcat, cannotConcat)", "name": "_maxPathSum", "signature": "def _maxPathSum(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_046258
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def _maxPathSum(self, root): :rtype: (int, int) <= (canConcat, cannotConcat)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def _maxPathSum(self, root): :rtype: (int, int) <= (canConcat, cannotConcat) <|skeleton|> class Solution: def...
821bd3792d98b05320e472ca49c0eec9f3366a95
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def _maxPathSum(self, root): """:rtype: (int, int) <= (canConcat, cannotConcat)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" if root is None: return 0 return max(self._maxPathSum(root)) def _maxPathSum(self, root): """:rtype: (int, int) <= (canConcat, cannotConcat)""" if root is None: ret...
the_stack_v2_python_sparse
124.py
sycLin/LeetCode-Solutions
train
0
5c7a01c5c8fa2ec65564adfacaa66d129cf2eaa6
[ "self.logger = logging.getLogger('simple')\nself.cfg = cfg\nself.executor = executor\nself.preprocess_list = []\nfor key, pre_params in cfg['preprocess'].items():\n try:\n pre_task = get_preprocess_routine(key, pre_params)\n self.preprocess_list.append(pre_task)\n except NameError as e:\n ...
<|body_start_0|> self.logger = logging.getLogger('simple') self.cfg = cfg self.executor = executor self.preprocess_list = [] for key, pre_params in cfg['preprocess'].items(): try: pre_task = get_preprocess_routine(key, pre_params) self....
Defines a pre-processing pipeline. This class defines a pre-processing pipeline that is serially executed on an executor.
preprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class preprocessor: """Defines a pre-processing pipeline. This class defines a pre-processing pipeline that is serially executed on an executor.""" def __init__(self, executor, cfg): """Configures the pre-processing pipeline from a dictionary. For each key-value pairs in `cfg['preprocess']...
stack_v2_sparse_classes_75kplus_train_065458
3,618
no_license
[ { "docstring": "Configures the pre-processing pipeline from a dictionary. For each key-value pairs in `cfg['preprocess']`, a pre-processing callable will be configured and appended list of callables. Args: executor (PEP-3148-style executor): Executor on which all pre-processing will be performed cfg: (dict) Del...
3
null
Implement the Python class `preprocessor` described below. Class description: Defines a pre-processing pipeline. This class defines a pre-processing pipeline that is serially executed on an executor. Method signatures and docstrings: - def __init__(self, executor, cfg): Configures the pre-processing pipeline from a d...
Implement the Python class `preprocessor` described below. Class description: Defines a pre-processing pipeline. This class defines a pre-processing pipeline that is serially executed on an executor. Method signatures and docstrings: - def __init__(self, executor, cfg): Configures the pre-processing pipeline from a d...
7ce63705e18c427f448c8d720c950a54add07966
<|skeleton|> class preprocessor: """Defines a pre-processing pipeline. This class defines a pre-processing pipeline that is serially executed on an executor.""" def __init__(self, executor, cfg): """Configures the pre-processing pipeline from a dictionary. For each key-value pairs in `cfg['preprocess']...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class preprocessor: """Defines a pre-processing pipeline. This class defines a pre-processing pipeline that is serially executed on an executor.""" def __init__(self, executor, cfg): """Configures the pre-processing pipeline from a dictionary. For each key-value pairs in `cfg['preprocess']`, a pre-proc...
the_stack_v2_python_sparse
delta/preprocess/preprocess.py
rkube/delta
train
7
9bb788f191a8239148dbf2a399310f037143a94e
[ "assert cycle_period_sec > 0\nassert min_value <= max_value\nself._manager = manager\nself._channels = list(channels)\nself._refresh = resolution_ms\nself._cycle_period = cycle_period_sec * 1000.0 / 2\nself._cycle_start = time.time() * 1000\nself._dwell = dwell\nself._reverse_cycle = False\nself._max = max_value\ns...
<|body_start_0|> assert cycle_period_sec > 0 assert min_value <= max_value self._manager = manager self._channels = list(channels) self._refresh = resolution_ms self._cycle_period = cycle_period_sec * 1000.0 / 2 self._cycle_start = time.time() * 1000 self....
Effect which implements a looping in and out fade with ordered channels, where 'lower' channels fade in later and fade out sooner.
BreathFader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BreathFader: """Effect which implements a looping in and out fade with ordered channels, where 'lower' channels fade in later and fade out sooner.""" def __init__(self, manager, channels, cycle_period_sec=10, dwell=0.2, resolution_ms=10, min_value=DMX_MIN_SLOT_VALUE, max_value=DMX_MAX_SLOT_V...
stack_v2_sparse_classes_75kplus_train_065459
2,901
no_license
[ { "docstring": "Args: manager - Manager or Adapter object to drive. channels - Ordered list of channels to drive. cycle_period_sec - Period in seconds at which the animation should repeat. dwell - resolution_ms - Time width of each animation frame. min_value - Minimum value to fade to. max_value - Maximum value...
3
stack_v2_sparse_classes_30k_train_041739
Implement the Python class `BreathFader` described below. Class description: Effect which implements a looping in and out fade with ordered channels, where 'lower' channels fade in later and fade out sooner. Method signatures and docstrings: - def __init__(self, manager, channels, cycle_period_sec=10, dwell=0.2, reso...
Implement the Python class `BreathFader` described below. Class description: Effect which implements a looping in and out fade with ordered channels, where 'lower' channels fade in later and fade out sooner. Method signatures and docstrings: - def __init__(self, manager, channels, cycle_period_sec=10, dwell=0.2, reso...
cfbd2c9fa1f725469bd05407ad2952e6cdeca0c5
<|skeleton|> class BreathFader: """Effect which implements a looping in and out fade with ordered channels, where 'lower' channels fade in later and fade out sooner.""" def __init__(self, manager, channels, cycle_period_sec=10, dwell=0.2, resolution_ms=10, min_value=DMX_MIN_SLOT_VALUE, max_value=DMX_MAX_SLOT_V...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BreathFader: """Effect which implements a looping in and out fade with ordered channels, where 'lower' channels fade in later and fade out sooner.""" def __init__(self, manager, channels, cycle_period_sec=10, dwell=0.2, resolution_ms=10, min_value=DMX_MIN_SLOT_VALUE, max_value=DMX_MAX_SLOT_VALUE): ...
the_stack_v2_python_sparse
py/tellasign/effects/breath_fade.py
kevinballard/tellasign
train
0
7a1644512bf8300be84fbfc998e7463abe8c9c44
[ "f_id = request.GET.get('id') if request.GET.get('id') else False\nf_name = '{}_id'.format(request.GET.get('type')) if request.GET.get('type') else False\nfilter_dict = self._filter(request.GET.get('filter'))\nfilter_data = {'name': f_name, 'id': f_id, 'data': queryset.filter(**filter_dict)}\nreturn filter_data", ...
<|body_start_0|> f_id = request.GET.get('id') if request.GET.get('id') else False f_name = '{}_id'.format(request.GET.get('type')) if request.GET.get('type') else False filter_dict = self._filter(request.GET.get('filter')) filter_data = {'name': f_name, 'id': f_id, 'data': queryset.filte...
自定义filter方法, 根据传入的值,返回filter后的queryset
MSKFilterBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MSKFilterBackend: """自定义filter方法, 根据传入的值,返回filter后的queryset""" def filter_queryset(self, request, queryset, view): """根据传值,返回相应的queryset :param request: :param queryset: :return:""" <|body_0|> def _filter(f_params: json, f_type: str=None, f_id: str=None): """:par...
stack_v2_sparse_classes_75kplus_train_065460
9,001
no_license
[ { "docstring": "根据传值,返回相应的queryset :param request: :param queryset: :return:", "name": "filter_queryset", "signature": "def filter_queryset(self, request, queryset, view)" }, { "docstring": ":param f_params: :param f_type: :param f_id: :return:", "name": "_filter", "signature": "def _fil...
2
null
Implement the Python class `MSKFilterBackend` described below. Class description: 自定义filter方法, 根据传入的值,返回filter后的queryset Method signatures and docstrings: - def filter_queryset(self, request, queryset, view): 根据传值,返回相应的queryset :param request: :param queryset: :return: - def _filter(f_params: json, f_type: str=None, ...
Implement the Python class `MSKFilterBackend` described below. Class description: 自定义filter方法, 根据传入的值,返回filter后的queryset Method signatures and docstrings: - def filter_queryset(self, request, queryset, view): 根据传值,返回相应的queryset :param request: :param queryset: :return: - def _filter(f_params: json, f_type: str=None, ...
05cf8ed62ecc06f30d2182e5d668bb05580f54ea
<|skeleton|> class MSKFilterBackend: """自定义filter方法, 根据传入的值,返回filter后的queryset""" def filter_queryset(self, request, queryset, view): """根据传值,返回相应的queryset :param request: :param queryset: :return:""" <|body_0|> def _filter(f_params: json, f_type: str=None, f_id: str=None): """:par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MSKFilterBackend: """自定义filter方法, 根据传入的值,返回filter后的queryset""" def filter_queryset(self, request, queryset, view): """根据传值,返回相应的queryset :param request: :param queryset: :return:""" f_id = request.GET.get('id') if request.GET.get('id') else False f_name = '{}_id'.format(request.GE...
the_stack_v2_python_sparse
api/views/_common.py
abel67/MaskSuperCat
train
0
b556daaa9806409b7f5fdf06b67a6aaa51fc9782
[ "\"\"\"\n 1. consider using reduce, really necessary?\n 2. since it's prefix, that is to say, every char must exist in strings\n \"\"\"\nif not strs:\n return ''\nmax_index = 0\nfor i, clist in enumerate(zip(*strs)):\n result = set(clist)\n if len(result) > 1:\n return strs[0][:...
<|body_start_0|> """ 1. consider using reduce, really necessary? 2. since it's prefix, that is to say, every char must exist in strings """ if not strs: return '' max_index = 0 for i, clist in enumerate(zip(*strs)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def rewrite(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ 1. consider using red...
stack_v2_sparse_classes_75kplus_train_065461
2,085
no_license
[ { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix", "signature": "def longestCommonPrefix(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: str", "name": "rewrite", "signature": "def rewrite(self, strs)" } ]
2
stack_v2_sparse_classes_30k_train_013341
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def rewrite(self, strs): :type strs: List[str] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def rewrite(self, strs): :type strs: List[str] :rtype: str <|skeleton|> class Solution: def longest...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def rewrite(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" """ 1. consider using reduce, really necessary? 2. since it's prefix, that is to say, every char must exist in strings """ if not strs: ret...
the_stack_v2_python_sparse
co_ms/14_Longest_Common_Prefix.py
vsdrun/lc_public
train
6
a94e8b7f4c07c30ba01e3ef34e2f4bf88aab3d37
[ "self.configControl = ConfigControlServiceClient()\nself.commonInter = GlobalFunction.CommonInter()\nlog.info('Init Config Control Server...')", "log.info('Set Storage Size 0M...')\nresult = self.configControl.judgeSetLimitZero()\nassert result\nlog.info('Clear Recording Data...')\nself.commonInter.clearStorageDa...
<|body_start_0|> self.configControl = ConfigControlServiceClient() self.commonInter = GlobalFunction.CommonInter() log.info('Init Config Control Server...') <|end_body_0|> <|body_start_1|> log.info('Set Storage Size 0M...') result = self.configControl.judgeSetLimitZero() ...
Test ConfigControlServer Function
TestConfigControl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConfigControl: """Test ConfigControlServer Function""" def __init__(self): """Constructor""" <|body_0|> def test1_setStreamStorageLimitZero(self): """Set device storage limit zero""" <|body_1|> def test2_setStorageLimitOtherSize(self): ""...
stack_v2_sparse_classes_75kplus_train_065462
1,323
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Set device storage limit zero", "name": "test1_setStreamStorageLimitZero", "signature": "def test1_setStreamStorageLimitZero(self)" }, { "docstring": "Set device storage limit 3...
3
stack_v2_sparse_classes_30k_train_051493
Implement the Python class `TestConfigControl` described below. Class description: Test ConfigControlServer Function Method signatures and docstrings: - def __init__(self): Constructor - def test1_setStreamStorageLimitZero(self): Set device storage limit zero - def test2_setStorageLimitOtherSize(self): Set device sto...
Implement the Python class `TestConfigControl` described below. Class description: Test ConfigControlServer Function Method signatures and docstrings: - def __init__(self): Constructor - def test1_setStreamStorageLimitZero(self): Set device storage limit zero - def test2_setStorageLimitOtherSize(self): Set device sto...
cf33bc397501301e8ca06d25b1be5733f0c52e6d
<|skeleton|> class TestConfigControl: """Test ConfigControlServer Function""" def __init__(self): """Constructor""" <|body_0|> def test1_setStreamStorageLimitZero(self): """Set device storage limit zero""" <|body_1|> def test2_setStorageLimitOtherSize(self): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestConfigControl: """Test ConfigControlServer Function""" def __init__(self): """Constructor""" self.configControl = ConfigControlServiceClient() self.commonInter = GlobalFunction.CommonInter() log.info('Init Config Control Server...') def test1_setStreamStorageLimit...
the_stack_v2_python_sparse
CoreEngine5.0/src/unitcase/test_client/Test4_Config.py
guanxingquan/core-engine-five-unit-test
train
0
e7335538c7050766f201666f2ed2f511f48731c8
[ "tag = self.get_object()\nexporter = exports.ReferenceFlatComplete(queryset=models.Reference.objects.filter(tags=tag).order_by('id'), filename=f'{self.assessment}-{tag.slug}', assessment=self.assessment, tags=self.model.get_all_tags(self.assessment.id, json_encode=False), include_parent_tag=False)\nreturn Response(...
<|body_start_0|> tag = self.get_object() exporter = exports.ReferenceFlatComplete(queryset=models.Reference.objects.filter(tags=tag).order_by('id'), filename=f'{self.assessment}-{tag.slug}', assessment=self.assessment, tags=self.model.get_all_tags(self.assessment.id, json_encode=False), include_parent_t...
ReferenceFilterTagViewset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReferenceFilterTagViewset: def references(self, request, pk): """Return all references for a selected tag; does not include tag-descendants.""" <|body_0|> def references_table_builder(self, request, pk): """Return all references for a selected tag in table-builder im...
stack_v2_sparse_classes_75kplus_train_065463
11,341
permissive
[ { "docstring": "Return all references for a selected tag; does not include tag-descendants.", "name": "references", "signature": "def references(self, request, pk)" }, { "docstring": "Return all references for a selected tag in table-builder import format; does not include tag-descendants.", ...
2
stack_v2_sparse_classes_30k_train_011208
Implement the Python class `ReferenceFilterTagViewset` described below. Class description: Implement the ReferenceFilterTagViewset class. Method signatures and docstrings: - def references(self, request, pk): Return all references for a selected tag; does not include tag-descendants. - def references_table_builder(se...
Implement the Python class `ReferenceFilterTagViewset` described below. Class description: Implement the ReferenceFilterTagViewset class. Method signatures and docstrings: - def references(self, request, pk): Return all references for a selected tag; does not include tag-descendants. - def references_table_builder(se...
9f053e26efb40f146281944a04d6f2c6bb015253
<|skeleton|> class ReferenceFilterTagViewset: def references(self, request, pk): """Return all references for a selected tag; does not include tag-descendants.""" <|body_0|> def references_table_builder(self, request, pk): """Return all references for a selected tag in table-builder im...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReferenceFilterTagViewset: def references(self, request, pk): """Return all references for a selected tag; does not include tag-descendants.""" tag = self.get_object() exporter = exports.ReferenceFlatComplete(queryset=models.Reference.objects.filter(tags=tag).order_by('id'), filename=f...
the_stack_v2_python_sparse
hawc/apps/lit/api.py
TahiriNadia/hawc
train
0
4465bedab331f4fc1378cddb2d4933ed199d76f4
[ "super(Generator, self).__init__()\nself.stage = stage\nself.gf_dim = ngf\nself.ef_dim = nef\nself.nz = nz\nself.text_dim = text_dim\nself.define_module()", "self.ca_net = CA_NET(self.text_dim, self.ef_dim)\nself.baw_net = BAW(self.gf_dim * 32, self.ef_dim, self.nz)\nif self.stage > 1:\n for p in self.baw_net....
<|body_start_0|> super(Generator, self).__init__() self.stage = stage self.gf_dim = ngf self.ef_dim = nef self.nz = nz self.text_dim = text_dim self.define_module() <|end_body_0|> <|body_start_1|> self.ca_net = CA_NET(self.text_dim, self.ef_dim) s...
Network Generator class. Args: - stage (int): generator's stage (1,2 or 3) - ngf (int): dimension of the generators filters - nef (int): condition dimension - nz (int): noise dimension - text_dim (int): original embedding dimension
Generator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """Network Generator class. Args: - stage (int): generator's stage (1,2 or 3) - ngf (int): dimension of the generators filters - nef (int): condition dimension - nz (int): noise dimension - text_dim (int): original embedding dimension""" def __init__(self, stage, ngf, nef, nz, tex...
stack_v2_sparse_classes_75kplus_train_065464
22,492
no_license
[ { "docstring": "Initialize the Generator's init stage.", "name": "__init__", "signature": "def __init__(self, stage, ngf, nef, nz, text_dim)" }, { "docstring": "Define the generator module.", "name": "define_module", "signature": "def define_module(self)" }, { "docstring": "Forwa...
3
stack_v2_sparse_classes_30k_train_013481
Implement the Python class `Generator` described below. Class description: Network Generator class. Args: - stage (int): generator's stage (1,2 or 3) - ngf (int): dimension of the generators filters - nef (int): condition dimension - nz (int): noise dimension - text_dim (int): original embedding dimension Method sign...
Implement the Python class `Generator` described below. Class description: Network Generator class. Args: - stage (int): generator's stage (1,2 or 3) - ngf (int): dimension of the generators filters - nef (int): condition dimension - nz (int): noise dimension - text_dim (int): original embedding dimension Method sign...
70d344d80425e7bbcc7984737dbe50a6638293c9
<|skeleton|> class Generator: """Network Generator class. Args: - stage (int): generator's stage (1,2 or 3) - ngf (int): dimension of the generators filters - nef (int): condition dimension - nz (int): noise dimension - text_dim (int): original embedding dimension""" def __init__(self, stage, ngf, nef, nz, tex...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Generator: """Network Generator class. Args: - stage (int): generator's stage (1,2 or 3) - ngf (int): dimension of the generators filters - nef (int): condition dimension - nz (int): noise dimension - text_dim (int): original embedding dimension""" def __init__(self, stage, ngf, nef, nz, text_dim): ...
the_stack_v2_python_sparse
TeleGAN/model.py
ails-lab/teleGAN
train
1
7464d22d0850f01ea00add69e963e90db3c09e18
[ "value = self.request.form.get('days_in_past', '1')\ndays_in_past = 1\nif value == 'all':\n days_in_past = None\nelse:\n try:\n days_in_past = float(value)\n except:\n pass\nreturn self.getRecentDatasetRecords(days_in_past)", "catalog = getToolByName(self.context, 'portal_catalog')\nquery =...
<|body_start_0|> value = self.request.form.get('days_in_past', '1') days_in_past = 1 if value == 'all': days_in_past = None else: try: days_in_past = float(value) except: pass return self.getRecentDatasetRecords(...
DataRecordRepositoryRifcsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataRecordRepositoryRifcsView: def getRenderables(self): """Overriden from RifcsView.""" <|body_0|> def getRecentDatasetRecords(self, days_in_past=None): """Return a list of DatasetRecord objects that were recently modified. By default, we operate on how frequently t...
stack_v2_sparse_classes_75kplus_train_065465
6,064
no_license
[ { "docstring": "Overriden from RifcsView.", "name": "getRenderables", "signature": "def getRenderables(self)" }, { "docstring": "Return a list of DatasetRecord objects that were recently modified. By default, we operate on how frequently the ANDS harvester will come along, which is every day, wi...
2
stack_v2_sparse_classes_30k_train_032451
Implement the Python class `DataRecordRepositoryRifcsView` described below. Class description: Implement the DataRecordRepositoryRifcsView class. Method signatures and docstrings: - def getRenderables(self): Overriden from RifcsView. - def getRecentDatasetRecords(self, days_in_past=None): Return a list of DatasetReco...
Implement the Python class `DataRecordRepositoryRifcsView` described below. Class description: Implement the DataRecordRepositoryRifcsView class. Method signatures and docstrings: - def getRenderables(self): Overriden from RifcsView. - def getRecentDatasetRecords(self, days_in_past=None): Return a list of DatasetReco...
bdbaf4d8ecfb83af7398ad274068db1638e74bf5
<|skeleton|> class DataRecordRepositoryRifcsView: def getRenderables(self): """Overriden from RifcsView.""" <|body_0|> def getRecentDatasetRecords(self, days_in_past=None): """Return a list of DatasetRecord objects that were recently modified. By default, we operate on how frequently t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataRecordRepositoryRifcsView: def getRenderables(self): """Overriden from RifcsView.""" value = self.request.form.get('days_in_past', '1') days_in_past = 1 if value == 'all': days_in_past = None else: try: days_in_past = float(va...
the_stack_v2_python_sparse
tdh/metadata/data_record_repository.py
jcu-eresearch/tdh.metadata
train
0
29a99e89f46b3107c77d6c87ba335e147339d2af
[ "n, end, start, step = (len(nums), 0, 0, 0)\nwhile end < n - 1:\n step += 1\n maxend = end + 1\n for i in range(start, end + 1):\n if i + nums[i] >= n - 1:\n return step\n maxend = max(maxend, i + nums[i])\n start, end = (end + 1, maxend)\nreturn step", "dp = [i for i in range...
<|body_start_0|> n, end, start, step = (len(nums), 0, 0, 0) while end < n - 1: step += 1 maxend = end + 1 for i in range(start, end + 1): if i + nums[i] >= n - 1: return step maxend = max(maxend, i + nums[i]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def dp_jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n, end, start, step = (len(nums), 0, 0, 0) while...
stack_v2_sparse_classes_75kplus_train_065466
964
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "jump", "signature": "def jump(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "dp_jump", "signature": "def dp_jump(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_017581
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jump(self, nums): :type nums: List[int] :rtype: int - def dp_jump(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jump(self, nums): :type nums: List[int] :rtype: int - def dp_jump(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def jump(self, nums): ...
30bfafb6a7727c9305b22933b63d9d645182c633
<|skeleton|> class Solution: def jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def dp_jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def jump(self, nums): """:type nums: List[int] :rtype: int""" n, end, start, step = (len(nums), 0, 0, 0) while end < n - 1: step += 1 maxend = end + 1 for i in range(start, end + 1): if i + nums[i] >= n - 1: ...
the_stack_v2_python_sparse
leetcode/Array/jump-game-ii.py
iCodeIN/competitive-programming-5
train
0
ca3cf6a429f153b11d70c5962487ea774c7b4ec4
[ "def normal_normal_model():\n loc = ed.norm.rvs(loc=0.0, scale=1.0, name='loc')\n x = ed.norm.rvs(loc=loc, scale=0.5, size=5, name='x')\n return x\nlog_joint = ed.make_log_joint_fn(normal_normal_model)\nx = np.random.normal(size=5)\nloc = 0.3\nvalue = log_joint(loc=loc, x=x)\ntrue_value = np.sum(ed.norm.lo...
<|body_start_0|> def normal_normal_model(): loc = ed.norm.rvs(loc=0.0, scale=1.0, name='loc') x = ed.norm.rvs(loc=loc, scale=0.5, size=5, name='x') return x log_joint = ed.make_log_joint_fn(normal_normal_model) x = np.random.normal(size=5) loc = 0.3 ...
ProgramTransformationsTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgramTransformationsTest: def testMakeLogJointUnconditional(self): """Test `make_log_joint` works on unconditional model.""" <|body_0|> def testMakeLogJointConditional(self): """Test `make_log_joint` works on conditional model.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus_train_065467
2,566
permissive
[ { "docstring": "Test `make_log_joint` works on unconditional model.", "name": "testMakeLogJointUnconditional", "signature": "def testMakeLogJointUnconditional(self)" }, { "docstring": "Test `make_log_joint` works on conditional model.", "name": "testMakeLogJointConditional", "signature":...
2
stack_v2_sparse_classes_30k_train_045330
Implement the Python class `ProgramTransformationsTest` described below. Class description: Implement the ProgramTransformationsTest class. Method signatures and docstrings: - def testMakeLogJointUnconditional(self): Test `make_log_joint` works on unconditional model. - def testMakeLogJointConditional(self): Test `ma...
Implement the Python class `ProgramTransformationsTest` described below. Class description: Implement the ProgramTransformationsTest class. Method signatures and docstrings: - def testMakeLogJointUnconditional(self): Test `make_log_joint` works on unconditional model. - def testMakeLogJointConditional(self): Test `ma...
ccdb9bfb11fe713bc449f0e884b405f619f58059
<|skeleton|> class ProgramTransformationsTest: def testMakeLogJointUnconditional(self): """Test `make_log_joint` works on unconditional model.""" <|body_0|> def testMakeLogJointConditional(self): """Test `make_log_joint` works on conditional model.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProgramTransformationsTest: def testMakeLogJointUnconditional(self): """Test `make_log_joint` works on unconditional model.""" def normal_normal_model(): loc = ed.norm.rvs(loc=0.0, scale=1.0, name='loc') x = ed.norm.rvs(loc=loc, scale=0.5, size=5, name='x') ...
the_stack_v2_python_sparse
edward2/numpy/program_transformations_test.py
google/edward2
train
710
910e793183fcfbe8bf459a1073a601ad8b200a09
[ "msg_data = {}\nmsg_data['test_module'] = data['module']\nmsg_data['test_number'] = data['number']\nmsg_data['test_title'] = data['title']\nmsg_data['test_expected_result'] = data['expected_result']\nmsg_data['test_actual_result'] = data['actual_result']\nmsg_data['test_result'] = data['test_result']\nreturn msg_da...
<|body_start_0|> msg_data = {} msg_data['test_module'] = data['module'] msg_data['test_number'] = data['number'] msg_data['test_title'] = data['title'] msg_data['test_expected_result'] = data['expected_result'] msg_data['test_actual_result'] = data['actual_result'] ...
SendRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SendRequest: def get_test_msg(self, data): """获取测试用例相关信息""" <|body_0|> def get_request(self, data): """进行接口请求""" <|body_1|> <|end_skeleton|> <|body_start_0|> msg_data = {} msg_data['test_module'] = data['module'] msg_data['test_numbe...
stack_v2_sparse_classes_75kplus_train_065468
1,834
no_license
[ { "docstring": "获取测试用例相关信息", "name": "get_test_msg", "signature": "def get_test_msg(self, data)" }, { "docstring": "进行接口请求", "name": "get_request", "signature": "def get_request(self, data)" } ]
2
null
Implement the Python class `SendRequest` described below. Class description: Implement the SendRequest class. Method signatures and docstrings: - def get_test_msg(self, data): 获取测试用例相关信息 - def get_request(self, data): 进行接口请求
Implement the Python class `SendRequest` described below. Class description: Implement the SendRequest class. Method signatures and docstrings: - def get_test_msg(self, data): 获取测试用例相关信息 - def get_request(self, data): 进行接口请求 <|skeleton|> class SendRequest: def get_test_msg(self, data): """获取测试用例相关信息""" ...
bdd6490a79cf107c950a64ecf96c29ad1a5e175c
<|skeleton|> class SendRequest: def get_test_msg(self, data): """获取测试用例相关信息""" <|body_0|> def get_request(self, data): """进行接口请求""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SendRequest: def get_test_msg(self, data): """获取测试用例相关信息""" msg_data = {} msg_data['test_module'] = data['module'] msg_data['test_number'] = data['number'] msg_data['test_title'] = data['title'] msg_data['test_expected_result'] = data['expected_result'] ...
the_stack_v2_python_sparse
testting/lib/sendRequest.py
BrightS-Li/code-meself
train
0
86875eb5f72e417143936b7296af84e6906402d6
[ "if num > 0 and num < 10:\n if num < 4:\n return num * symbol1\n elif num == 4:\n return symbol1 + symbol2\n elif num == 5:\n return symbol2\n elif num < 9:\n return symbol2 + (num - 5) * symbol1\n elif num == 9:\n return symbol1 + symbol3\nelse:\n return ''", ...
<|body_start_0|> if num > 0 and num < 10: if num < 4: return num * symbol1 elif num == 4: return symbol1 + symbol2 elif num == 5: return symbol2 elif num < 9: return symbol2 + (num - 5) * symbol1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def romanRule(self, num, symbol1, symbol2, symbol3): """:type num:int,symbol1:str,symbol2:str,symbol3:str rtype:str""" <|body_0|> def intToRoman(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n...
stack_v2_sparse_classes_75kplus_train_065469
999
no_license
[ { "docstring": ":type num:int,symbol1:str,symbol2:str,symbol3:str rtype:str", "name": "romanRule", "signature": "def romanRule(self, num, symbol1, symbol2, symbol3)" }, { "docstring": ":type num: int :rtype: str", "name": "intToRoman", "signature": "def intToRoman(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_054006
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def romanRule(self, num, symbol1, symbol2, symbol3): :type num:int,symbol1:str,symbol2:str,symbol3:str rtype:str - def intToRoman(self, num): :type num: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def romanRule(self, num, symbol1, symbol2, symbol3): :type num:int,symbol1:str,symbol2:str,symbol3:str rtype:str - def intToRoman(self, num): :type num: int :rtype: str <|skelet...
1ba8a525435deb7f23d74b52cd3b1f4ab1fa571e
<|skeleton|> class Solution: def romanRule(self, num, symbol1, symbol2, symbol3): """:type num:int,symbol1:str,symbol2:str,symbol3:str rtype:str""" <|body_0|> def intToRoman(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def romanRule(self, num, symbol1, symbol2, symbol3): """:type num:int,symbol1:str,symbol2:str,symbol3:str rtype:str""" if num > 0 and num < 10: if num < 4: return num * symbol1 elif num == 4: return symbol1 + symbol2 ...
the_stack_v2_python_sparse
012.Integer to Roman/Integer to Roman.py
jiangzuochen/leetcode
train
1
3ac28933a25890697c8d82a3083e285620e3a959
[ "from collections import deque\nif not root:\n return True\nlevel = [root.left, root.right]\nwhile any(level):\n next_level = deque()\n i, j = (0, len(level) - 1)\n while i < j:\n if level[i] and level[j]:\n if level[i].val != level[j].val:\n return False\n el...
<|body_start_0|> from collections import deque if not root: return True level = [root.left, root.right] while any(level): next_level = deque() i, j = (0, len(level) - 1) while i < j: if level[i] and level[j]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric_1(self, root: TreeNode) -> bool: """层序遍历,每层的值列表应该对称""" <|body_0|> def isSymmetric(self, root: TreeNode) -> bool: """问题转换成两棵树是否为镜像""" <|body_1|> <|end_skeleton|> <|body_start_0|> from collections import deque if not ...
stack_v2_sparse_classes_75kplus_train_065470
2,863
no_license
[ { "docstring": "层序遍历,每层的值列表应该对称", "name": "isSymmetric_1", "signature": "def isSymmetric_1(self, root: TreeNode) -> bool" }, { "docstring": "问题转换成两棵树是否为镜像", "name": "isSymmetric", "signature": "def isSymmetric(self, root: TreeNode) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_048098
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric_1(self, root: TreeNode) -> bool: 层序遍历,每层的值列表应该对称 - def isSymmetric(self, root: TreeNode) -> bool: 问题转换成两棵树是否为镜像
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric_1(self, root: TreeNode) -> bool: 层序遍历,每层的值列表应该对称 - def isSymmetric(self, root: TreeNode) -> bool: 问题转换成两棵树是否为镜像 <|skeleton|> class Solution: def isSymmetric...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def isSymmetric_1(self, root: TreeNode) -> bool: """层序遍历,每层的值列表应该对称""" <|body_0|> def isSymmetric(self, root: TreeNode) -> bool: """问题转换成两棵树是否为镜像""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isSymmetric_1(self, root: TreeNode) -> bool: """层序遍历,每层的值列表应该对称""" from collections import deque if not root: return True level = [root.left, root.right] while any(level): next_level = deque() i, j = (0, len(level) - 1) ...
the_stack_v2_python_sparse
.leetcode/101.对称二叉树.py
xiaoruijiang/algorithm
train
0
8750b938ee19e72f39e3aa5a10c474abd3ac1f82
[ "super(generic_build, self).__init__(**kwargs)\nself.__annotations = kwargs.get('annotations', {})\nself.__build = kwargs.get('build', [])\nself.__comment = kwargs.get('comment', True)\nself.__directory = kwargs.get('directory', None)\nself.environment_variables = kwargs.get('devel_environment', {})\nself.__install...
<|body_start_0|> super(generic_build, self).__init__(**kwargs) self.__annotations = kwargs.get('annotations', {}) self.__build = kwargs.get('build', []) self.__comment = kwargs.get('comment', True) self.__directory = kwargs.get('directory', None) self.environment_variable...
The `generic_build` building block downloads and builds a specified package. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. annotations: Dictionary of additional annotations to include. The default is an empty dictionary. build: List of shell commands to ru...
generic_build
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class generic_build: """The `generic_build` building block downloads and builds a specified package. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. annotations: Dictionary of additional annotations to include. The default is an empty dictio...
stack_v2_sparse_classes_75kplus_train_065471
10,687
permissive
[ { "docstring": "Initialize building block", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Fill in container instructions", "name": "__instructions", "signature": "def __instructions(self)" }, { "docstring": "Construct the series of shell comma...
4
stack_v2_sparse_classes_30k_train_014410
Implement the Python class `generic_build` described below. Class description: The `generic_build` building block downloads and builds a specified package. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. annotations: Dictionary of additional annotations to ...
Implement the Python class `generic_build` described below. Class description: The `generic_build` building block downloads and builds a specified package. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. annotations: Dictionary of additional annotations to ...
60fd2a51c171258a6b3f93c2523101cb7018ba1b
<|skeleton|> class generic_build: """The `generic_build` building block downloads and builds a specified package. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. annotations: Dictionary of additional annotations to include. The default is an empty dictio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class generic_build: """The `generic_build` building block downloads and builds a specified package. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is False. annotations: Dictionary of additional annotations to include. The default is an empty dictionary. build: ...
the_stack_v2_python_sparse
hpccm/building_blocks/generic_build.py
NVIDIA/hpc-container-maker
train
419
00aebdf3dfd86c7ea7580ca6118a1db55fb135ab
[ "if not 0 < train_prop <= 1:\n raise ValueError(\"'train_prop' must be in (0, 1] (got {}).\".format(train_prop))\nself.train_prop = train_prop\nself._stat_func = stat_func\nself.loc_mean_fit = -1.0\nself.last_timestamp = -1\nself._fitted = False", "self.last_timestamp = X[-1]\nlast_ind = int(np.ceil(y.size * s...
<|body_start_0|> if not 0 < train_prop <= 1: raise ValueError("'train_prop' must be in (0, 1] (got {}).".format(train_prop)) self.train_prop = train_prop self._stat_func = stat_func self.loc_mean_fit = -1.0 self.last_timestamp = -1 self._fitted = False <|end_b...
Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps.
_TSLocalStat
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _TSLocalStat: """Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps.""" def __init__(self, stat_func: t.Ca...
stack_v2_sparse_classes_75kplus_train_065472
12,299
permissive
[ { "docstring": "Init a Local statistical forecasting model.", "name": "__init__", "signature": "def __init__(self, stat_func: t.Callable[[np.ndarray], float], train_prop: float)" }, { "docstring": "Fit a local statistical forecasting model.", "name": "fit", "signature": "def fit(self, X:...
3
stack_v2_sparse_classes_30k_train_006639
Implement the Python class `_TSLocalStat` described below. Class description: Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps. Me...
Implement the Python class `_TSLocalStat` described below. Class description: Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps. Me...
61cc1f63fa055c7466151cfefa7baff8df1702b7
<|skeleton|> class _TSLocalStat: """Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps.""" def __init__(self, stat_func: t.Ca...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _TSLocalStat: """Local statistical forecasting model for time-series. This model calculates a statistic from the most recent time-series observations, tipically the mean or median, and use the obtained value as the forecasted value for future timestamps.""" def __init__(self, stat_func: t.Callable[[np.nd...
the_stack_v2_python_sparse
tspymfe/_models.py
FelSiq/ts-pymfe
train
9
69df4ca7139266a0bb9614f2a86c08b6eb25227c
[ "self.url = url\nself.port = port\nself.client = pymongo.MongoClient(self.url, self.port)\nself.db = self.client[database]", "if self.db[table_name].insert_one(info):\n print('存入数据库成功')\nelse:\n print('存入数据库失败', info)" ]
<|body_start_0|> self.url = url self.port = port self.client = pymongo.MongoClient(self.url, self.port) self.db = self.client[database] <|end_body_0|> <|body_start_1|> if self.db[table_name].insert_one(info): print('存入数据库成功') else: print('存入数据库失败'...
定义MongoDB操作类
MongoDBHandle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MongoDBHandle: """定义MongoDB操作类""" def __init__(self, url, port, database): """初始化数据库信息并创建数据库操作对象""" <|body_0|> def insert(self, info, table_name): """将数据插入数据库""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.url = url self.port = por...
stack_v2_sparse_classes_75kplus_train_065473
579
no_license
[ { "docstring": "初始化数据库信息并创建数据库操作对象", "name": "__init__", "signature": "def __init__(self, url, port, database)" }, { "docstring": "将数据插入数据库", "name": "insert", "signature": "def insert(self, info, table_name)" } ]
2
stack_v2_sparse_classes_30k_train_025748
Implement the Python class `MongoDBHandle` described below. Class description: 定义MongoDB操作类 Method signatures and docstrings: - def __init__(self, url, port, database): 初始化数据库信息并创建数据库操作对象 - def insert(self, info, table_name): 将数据插入数据库
Implement the Python class `MongoDBHandle` described below. Class description: 定义MongoDB操作类 Method signatures and docstrings: - def __init__(self, url, port, database): 初始化数据库信息并创建数据库操作对象 - def insert(self, info, table_name): 将数据插入数据库 <|skeleton|> class MongoDBHandle: """定义MongoDB操作类""" def __init__(self, u...
6f138a7a4eaaa0892986be07232d68defeafaeb6
<|skeleton|> class MongoDBHandle: """定义MongoDB操作类""" def __init__(self, url, port, database): """初始化数据库信息并创建数据库操作对象""" <|body_0|> def insert(self, info, table_name): """将数据插入数据库""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MongoDBHandle: """定义MongoDB操作类""" def __init__(self, url, port, database): """初始化数据库信息并创建数据库操作对象""" self.url = url self.port = port self.client = pymongo.MongoClient(self.url, self.port) self.db = self.client[database] def insert(self, info, table_name): ...
the_stack_v2_python_sparse
DataBaseHandler/mongodb_handle.py
zeze-ya/12306Train_Info_Spider
train
1
4bd2466bd0b7dd2a9cda0f53e216372bf9503a0a
[ "user_id = token_auth.current_user()\nsearch_dto = TeamSearchDTO()\nsearch_dto.team_name = request.args.get('team_name', None)\nsearch_dto.member = request.args.get('member', None)\nsearch_dto.manager = request.args.get('manager', None)\nsearch_dto.member_request = request.args.get('member_request', None)\nsearch_d...
<|body_start_0|> user_id = token_auth.current_user() search_dto = TeamSearchDTO() search_dto.team_name = request.args.get('team_name', None) search_dto.member = request.args.get('member', None) search_dto.manager = request.args.get('manager', None) search_dto.member_reque...
TeamsAllAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamsAllAPI: def get(self): """Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name ...
stack_v2_sparse_classes_75kplus_train_065474
12,780
permissive
[ { "docstring": "Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name of the team to filter by type: str defa...
2
stack_v2_sparse_classes_30k_train_025684
Implement the Python class `TeamsAllAPI` described below. Class description: Implement the TeamsAllAPI class. Method signatures and docstrings: - def get(self): Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required...
Implement the Python class `TeamsAllAPI` described below. Class description: Implement the TeamsAllAPI class. Method signatures and docstrings: - def get(self): Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required...
45bf3937c74902226096aee5b49e7abea62df524
<|skeleton|> class TeamsAllAPI: def get(self): """Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TeamsAllAPI: def get(self): """Gets all teams --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: query name: team_name description: name of the team to...
the_stack_v2_python_sparse
backend/api/teams/resources.py
hotosm/tasking-manager
train
526
2b728386d1be6060d1b46f7eefe06074276cb5bd
[ "self.context = zmq.Context()\nself.socket = self.context.socket(zmq.REP)\nself.socket.setsockopt(zmq.LINGER, 0)\nself.socket.setsockopt(zmq.SNDTIMEO, timeoutms)\nself.socket.setsockopt(zmq.RCVTIMEO, timeoutms)\nself.socket.bind(address)\nself.real_time = real_time\nself.state = RemoteControlledAgent.STATE_REQ", ...
<|body_start_0|> self.context = zmq.Context() self.socket = self.context.socket(zmq.REP) self.socket.setsockopt(zmq.LINGER, 0) self.socket.setsockopt(zmq.SNDTIMEO, timeoutms) self.socket.setsockopt(zmq.RCVTIMEO, timeoutms) self.socket.bind(address) self.real_time ...
Agent implementation that receives commands from a remote peer. Uses a request(remote-agent)/reply(self) pattern to model a [blocking] service call. The agent is expected to initiate a request using a dictionary: - `cmd` field set either to `'reset'` or `'step'`. - `action` field set when `cmd=='step'`. The remote agen...
RemoteControlledAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteControlledAgent: """Agent implementation that receives commands from a remote peer. Uses a request(remote-agent)/reply(self) pattern to model a [blocking] service call. The agent is expected to initiate a request using a dictionary: - `cmd` field set either to `'reset'` or `'step'`. - `acti...
stack_v2_sparse_classes_75kplus_train_065475
10,273
permissive
[ { "docstring": "Initialize the remote controlled agent.", "name": "__init__", "signature": "def __init__(self, address, real_time=False, timeoutms=DEFAULT_TIMEOUTMS)" }, { "docstring": "Process agent environment callback.", "name": "__call__", "signature": "def __call__(self, env, **ctx)...
2
stack_v2_sparse_classes_30k_train_026513
Implement the Python class `RemoteControlledAgent` described below. Class description: Agent implementation that receives commands from a remote peer. Uses a request(remote-agent)/reply(self) pattern to model a [blocking] service call. The agent is expected to initiate a request using a dictionary: - `cmd` field set e...
Implement the Python class `RemoteControlledAgent` described below. Class description: Agent implementation that receives commands from a remote peer. Uses a request(remote-agent)/reply(self) pattern to model a [blocking] service call. The agent is expected to initiate a request using a dictionary: - `cmd` field set e...
d2386df70e14c190669509e28009f46aed561c88
<|skeleton|> class RemoteControlledAgent: """Agent implementation that receives commands from a remote peer. Uses a request(remote-agent)/reply(self) pattern to model a [blocking] service call. The agent is expected to initiate a request using a dictionary: - `cmd` field set either to `'reset'` or `'step'`. - `acti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RemoteControlledAgent: """Agent implementation that receives commands from a remote peer. Uses a request(remote-agent)/reply(self) pattern to model a [blocking] service call. The agent is expected to initiate a request using a dictionary: - `cmd` field set either to `'reset'` or `'step'`. - `action` field set...
the_stack_v2_python_sparse
pkg_blender/blendtorch/btb/env.py
cheind/pytorch-blender
train
509
286640778a47f329cf2a90e902bc60ace1807822
[ "super(ComponentDirHelper, self).__init__(logging.getLogger(self.logger_name()))\nself._logger.debug('pkg: {}, main_program: {}'.format(pkg, main_program))\nself._pkg = pkg\nself._main_program = main_program", "ll = pkg_resources.resource_listdir(self._pkg, '')\nfor file_name in ll:\n real_file_name = pkg_reso...
<|body_start_0|> super(ComponentDirHelper, self).__init__(logging.getLogger(self.logger_name())) self._logger.debug('pkg: {}, main_program: {}'.format(pkg, main_program)) self._pkg = pkg self._main_program = main_program <|end_body_0|> <|body_start_1|> ll = pkg_resources.resourc...
ComponentDirHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentDirHelper: def __init__(self, pkg, main_program): """Extract component directory outside of egg, so an external command can run :param main_program: The main program to run. E.g. main.py :param pkg: The package the main_program is in, this is required in order to extract the fil...
stack_v2_sparse_classes_75kplus_train_065476
1,916
permissive
[ { "docstring": "Extract component directory outside of egg, so an external command can run :param main_program: The main program to run. E.g. main.py :param pkg: The package the main_program is in, this is required in order to extract the files of the componenbt outisde the egg", "name": "__init__", "si...
2
stack_v2_sparse_classes_30k_train_046912
Implement the Python class `ComponentDirHelper` described below. Class description: Implement the ComponentDirHelper class. Method signatures and docstrings: - def __init__(self, pkg, main_program): Extract component directory outside of egg, so an external command can run :param main_program: The main program to run...
Implement the Python class `ComponentDirHelper` described below. Class description: Implement the ComponentDirHelper class. Method signatures and docstrings: - def __init__(self, pkg, main_program): Extract component directory outside of egg, so an external command can run :param main_program: The main program to run...
738356ce6d5e691a5d813acafa3f0ff730e76136
<|skeleton|> class ComponentDirHelper: def __init__(self, pkg, main_program): """Extract component directory outside of egg, so an external command can run :param main_program: The main program to run. E.g. main.py :param pkg: The package the main_program is in, this is required in order to extract the fil...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ComponentDirHelper: def __init__(self, pkg, main_program): """Extract component directory outside of egg, so an external command can run :param main_program: The main program to run. E.g. main.py :param pkg: The package the main_program is in, this is required in order to extract the files of the comp...
the_stack_v2_python_sparse
mlcomp/parallelm/pipeline/component_dir_helper.py
theromis/mlpiper
train
0
70530cf310013e84c73ae4289ee558616299a51a
[ "self.lookup_field = 'url_path'\nself.lookup_url_kwarg = 'path'\nself.kwargs[self.lookup_url_kwarg] = '/{}/{}'.format(HomePage.default_slug, path)\ninstance = self.get_object()\nserializer = self.get_serializer(instance)\nreturn Response(serializer.data)", "url_patterns = list(super().get_urlpatterns())\nurl_patt...
<|body_start_0|> self.lookup_field = 'url_path' self.lookup_url_kwarg = 'path' self.kwargs[self.lookup_url_kwarg] = '/{}/{}'.format(HomePage.default_slug, path) instance = self.get_object() serializer = self.get_serializer(instance) return Response(serializer.data) <|end_...
Gets live content.
PagesAPIEndpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PagesAPIEndpoint: """Gets live content.""" def detail_view_by_path(self, request, path): """Same as the default view but getting the page by its path""" <|body_0|> def get_urlpatterns(cls): """Extends the default Wagtail list of endpoints.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_065477
3,334
permissive
[ { "docstring": "Same as the default view but getting the page by its path", "name": "detail_view_by_path", "signature": "def detail_view_by_path(self, request, path)" }, { "docstring": "Extends the default Wagtail list of endpoints.", "name": "get_urlpatterns", "signature": "def get_urlp...
2
null
Implement the Python class `PagesAPIEndpoint` described below. Class description: Gets live content. Method signatures and docstrings: - def detail_view_by_path(self, request, path): Same as the default view but getting the page by its path - def get_urlpatterns(cls): Extends the default Wagtail list of endpoints.
Implement the Python class `PagesAPIEndpoint` described below. Class description: Gets live content. Method signatures and docstrings: - def detail_view_by_path(self, request, path): Same as the default view but getting the page by its path - def get_urlpatterns(cls): Extends the default Wagtail list of endpoints. <...
7bd6a386e3583779ddba2347a4b3a80fdf75b368
<|skeleton|> class PagesAPIEndpoint: """Gets live content.""" def detail_view_by_path(self, request, path): """Same as the default view but getting the page by its path""" <|body_0|> def get_urlpatterns(cls): """Extends the default Wagtail list of endpoints.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PagesAPIEndpoint: """Gets live content.""" def detail_view_by_path(self, request, path): """Same as the default view but getting the page by its path""" self.lookup_field = 'url_path' self.lookup_url_kwarg = 'path' self.kwargs[self.lookup_url_kwarg] = '/{}/{}'.format(HomeP...
the_stack_v2_python_sparse
api/router.py
rds0751/nhsuk-content-store
train
0
ae85a0038e9bc4120cbd847f29a14d052de53fbc
[ "super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)", "if mask is not None:\n mask = mask.unsqueeze(1)\nnbatches = query.size(0)\nif layer_past ...
<|body_start_0|> super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_model), 4) self.attn = None self.dropout = nn.Dropout(p=dropout) <|end_body_0|> <|body_start_1|> ...
MultiHeadedAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None, layer_past=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_065478
16,634
permissive
[ { "docstring": "Take in model size and number of heads.", "name": "__init__", "signature": "def __init__(self, h, d_model, dropout=0.1)" }, { "docstring": "Implements Figure 2", "name": "forward", "signature": "def forward(self, query, key, value, mask=None, layer_past=None)" } ]
2
stack_v2_sparse_classes_30k_train_040646
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None, layer_past=None): I...
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def forward(self, query, key, value, mask=None, layer_past=None): I...
6a774be5c27b1a5eecf4bcfff55249acf6c2fd5f
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def forward(self, query, key, value, mask=None, layer_past=None): """Implements Figure 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_mo...
the_stack_v2_python_sparse
captioning/models/cachedTransformer.py
ruotianluo/ImageCaptioning.pytorch
train
1,247
5b37a4471322a633d7ad60d4606ad9a5f6aaca7a
[ "self.maze = maze\nself.rat_1 = rat_1\nself.rat_2 = rat_2\nself.num_sprouts_left = 0\nfor i in range(len(self.maze)):\n row = self.maze[i]\n self.num_sprouts_left += row.count('@')", "if self.maze[row][col] == '#':\n return True\nelse:\n return False", "if row == self.rat_1.row and col == self.rat_1...
<|body_start_0|> self.maze = maze self.rat_1 = rat_1 self.rat_2 = rat_2 self.num_sprouts_left = 0 for i in range(len(self.maze)): row = self.maze[i] self.num_sprouts_left += row.count('@') <|end_body_0|> <|body_start_1|> if self.maze[row][col] == ...
A 2D maze.
Maze
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in th...
stack_v2_sparse_classes_75kplus_train_065479
6,001
permissive
[ { "docstring": "(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in the maze. Example call: Maze([['#', '#', '#', '#', '#', '#', '#'], ['#', '.', '....
5
stack_v2_sparse_classes_30k_test_000036
Implement the Python class `Maze` described below. Class description: A 2D maze. Method signatures and docstrings: - def __init__(self, maze, rat_1, rat_2): (Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the fi...
Implement the Python class `Maze` described below. Class description: A 2D maze. Method signatures and docstrings: - def __init__(self, maze, rat_1, rat_2): (Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the fi...
ff265343635a0109b6deab31f2a112d304d020cb
<|skeleton|> class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Maze: """A 2D maze.""" def __init__(self, maze, rat_1, rat_2): """(Maze, list of list of str, Rat, Rat) -> NoneType Initialize a maze with two rats. Args: maze (list of list of str): a maze with contents. rat_1 (object): the first rat in the maze. rat_2 (object): the second rat in the maze. Examp...
the_stack_v2_python_sparse
Crafting_Quality_Code_UniToronto/week5_functions/assignment/a2.py
bounty030/Coursera
train
1
29a17d6f09ae41a3fd5af4b3fe864f89a7d7e2e1
[ "rows, cols = (len(rooms), len(rooms[0]))\ndirection = [[0, 1], [1, 0], [-1, 0], [0, -1]]\nq = deque()\nfor i in range(rows):\n for j in range(cols):\n if not rooms[i][j]:\n q.append([i, j])\n\ndef isValid(i, j):\n return 0 <= i < rows and 0 <= j < cols\n\ndef bfs(q, depth=0):\n while q:\...
<|body_start_0|> rows, cols = (len(rooms), len(rooms[0])) direction = [[0, 1], [1, 0], [-1, 0], [0, -1]] q = deque() for i in range(rows): for j in range(cols): if not rooms[i][j]: q.append([i, j]) def isValid(i, j): re...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wallsAndGates(self, rooms: List[List[int]]) -> None: """Do not return anything, modify rooms in-place instead.""" <|body_0|> def wallsAndGates(self, rooms: List[List[int]]) -> None: """Do not return anything, modify rooms in-place instead.""" <|...
stack_v2_sparse_classes_75kplus_train_065480
2,339
permissive
[ { "docstring": "Do not return anything, modify rooms in-place instead.", "name": "wallsAndGates", "signature": "def wallsAndGates(self, rooms: List[List[int]]) -> None" }, { "docstring": "Do not return anything, modify rooms in-place instead.", "name": "wallsAndGates", "signature": "def ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wallsAndGates(self, rooms: List[List[int]]) -> None: Do not return anything, modify rooms in-place instead. - def wallsAndGates(self, rooms: List[List[int]]) -> None: Do not ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wallsAndGates(self, rooms: List[List[int]]) -> None: Do not return anything, modify rooms in-place instead. - def wallsAndGates(self, rooms: List[List[int]]) -> None: Do not ...
6be68c19bcaab4e64a8f646cc64f651bade8ba86
<|skeleton|> class Solution: def wallsAndGates(self, rooms: List[List[int]]) -> None: """Do not return anything, modify rooms in-place instead.""" <|body_0|> def wallsAndGates(self, rooms: List[List[int]]) -> None: """Do not return anything, modify rooms in-place instead.""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def wallsAndGates(self, rooms: List[List[int]]) -> None: """Do not return anything, modify rooms in-place instead.""" rows, cols = (len(rooms), len(rooms[0])) direction = [[0, 1], [1, 0], [-1, 0], [0, -1]] q = deque() for i in range(rows): for j in...
the_stack_v2_python_sparse
com/Leetcode/286.WallsandGates.py
samkitsheth95/InterviewPrep
train
0
4f46799b8fd352920257c71a7cb54d2e801ed2d0
[ "a_dir = f'{self.cur_dir}/testcases/seg/gt'\nb_dir = f'{self.cur_dir}/testcases/seg/pred'\nresult = evaluate_segmentation(list_files(a_dir, '.png', with_prefix=True), list_files(b_dir, '.png', with_prefix=True), nproc=1)\nsummary = result.summary()\ngt_summary = {'mAcc': 81.27147766323024, 'mIoU': 61.73469387755102...
<|body_start_0|> a_dir = f'{self.cur_dir}/testcases/seg/gt' b_dir = f'{self.cur_dir}/testcases/seg/pred' result = evaluate_segmentation(list_files(a_dir, '.png', with_prefix=True), list_files(b_dir, '.png', with_prefix=True), nproc=1) summary = result.summary() gt_summary = {'mAc...
Test cases for the evaluate_segmentation function.
TestEvaluateSegmentation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEvaluateSegmentation: """Test cases for the evaluate_segmentation function.""" def test_ious_miou(self) -> None: """Test the general case.""" <|body_0|> def test_blank_dir(self) -> None: """Test the missing prediction scenario.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_065481
3,852
permissive
[ { "docstring": "Test the general case.", "name": "test_ious_miou", "signature": "def test_ious_miou(self) -> None" }, { "docstring": "Test the missing prediction scenario.", "name": "test_blank_dir", "signature": "def test_blank_dir(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_018052
Implement the Python class `TestEvaluateSegmentation` described below. Class description: Test cases for the evaluate_segmentation function. Method signatures and docstrings: - def test_ious_miou(self) -> None: Test the general case. - def test_blank_dir(self) -> None: Test the missing prediction scenario.
Implement the Python class `TestEvaluateSegmentation` described below. Class description: Test cases for the evaluate_segmentation function. Method signatures and docstrings: - def test_ious_miou(self) -> None: Test the general case. - def test_blank_dir(self) -> None: Test the missing prediction scenario. <|skeleto...
a4bfa9dc0c79abe90b2c06d20e84b79fbd9f2e38
<|skeleton|> class TestEvaluateSegmentation: """Test cases for the evaluate_segmentation function.""" def test_ious_miou(self) -> None: """Test the general case.""" <|body_0|> def test_blank_dir(self) -> None: """Test the missing prediction scenario.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestEvaluateSegmentation: """Test cases for the evaluate_segmentation function.""" def test_ious_miou(self) -> None: """Test the general case.""" a_dir = f'{self.cur_dir}/testcases/seg/gt' b_dir = f'{self.cur_dir}/testcases/seg/pred' result = evaluate_segmentation(list_fil...
the_stack_v2_python_sparse
bdd100k/eval/seg_test.py
navcul3108/bdd100k
train
0
2032a5a1e0458fb79f88c360e8ec82d266f94c5d
[ "if trans is not None:\n x = trans.transform(x)\nlimits = cls.train(x)\nreturn cls.map(x, palette, limits, na_value)", "if old is None:\n old = (-np.inf, np.inf)\nif not len(new_data):\n return old\nnew_data = np.asarray(new_data)\nif new_data.dtype.kind not in CONTINUOUS_KINDS:\n raise TypeError('Dis...
<|body_start_0|> if trans is not None: x = trans.transform(x) limits = cls.train(x) return cls.map(x, palette, limits, na_value) <|end_body_0|> <|body_start_1|> if old is None: old = (-np.inf, np.inf) if not len(new_data): return old n...
Continuous scale
scale_continuous
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class scale_continuous: """Continuous scale""" def apply(cls, x: FloatArrayLike, palette: ContinuousPalette, na_value: Any=None, trans: Optional[Trans]=None) -> NDArrayFloat: """Scale data continuously Parameters ---------- x : array_like Continuous values to scale palette : callable ``f(x...
stack_v2_sparse_classes_75kplus_train_065482
8,329
permissive
[ { "docstring": "Scale data continuously Parameters ---------- x : array_like Continuous values to scale palette : callable ``f(x)`` Palette to use na_value : object Value to use for missing values. trans : trans How to transform the data before scaling. If ``None``, no transformation is done. Returns ------- ou...
3
null
Implement the Python class `scale_continuous` described below. Class description: Continuous scale Method signatures and docstrings: - def apply(cls, x: FloatArrayLike, palette: ContinuousPalette, na_value: Any=None, trans: Optional[Trans]=None) -> NDArrayFloat: Scale data continuously Parameters ---------- x : array...
Implement the Python class `scale_continuous` described below. Class description: Continuous scale Method signatures and docstrings: - def apply(cls, x: FloatArrayLike, palette: ContinuousPalette, na_value: Any=None, trans: Optional[Trans]=None) -> NDArrayFloat: Scale data continuously Parameters ---------- x : array...
90b0a54dd3a76528fae7997083d2ab8d31f82a58
<|skeleton|> class scale_continuous: """Continuous scale""" def apply(cls, x: FloatArrayLike, palette: ContinuousPalette, na_value: Any=None, trans: Optional[Trans]=None) -> NDArrayFloat: """Scale data continuously Parameters ---------- x : array_like Continuous values to scale palette : callable ``f(x...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class scale_continuous: """Continuous scale""" def apply(cls, x: FloatArrayLike, palette: ContinuousPalette, na_value: Any=None, trans: Optional[Trans]=None) -> NDArrayFloat: """Scale data continuously Parameters ---------- x : array_like Continuous values to scale palette : callable ``f(x)`` Palette t...
the_stack_v2_python_sparse
mizani/scale.py
has2k1/mizani
train
41
7652bc8c9b4d40ab67a82c9f5a74fb24a749d89e
[ "temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'})\nstatues = temple.zhifu_statues()\nprint(statues)\nself.assertEqual(statues, '支付成功')", "temple.zhifu = mock.Mock(return_value={'result': 'fail', 'reason': '余额不足'})\nstatues = temple.zhifu_statues()\nself.assertEqual(statues, '支付失败')" ...
<|body_start_0|> temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'}) statues = temple.zhifu_statues() print(statues) self.assertEqual(statues, '支付成功') <|end_body_0|> <|body_start_1|> temple.zhifu = mock.Mock(return_value={'result': 'fail', 'reason': '余...
单元测试用例
Test_zhifu_statues
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" <|body_0|> def test_02(self): """测试支付失败场景""" <|body_1|> <|end_skeleton|> <|body_start_0|> temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'}) s...
stack_v2_sparse_classes_75kplus_train_065483
4,862
no_license
[ { "docstring": "测试支付成功场景", "name": "test_01", "signature": "def test_01(self)" }, { "docstring": "测试支付失败场景", "name": "test_02", "signature": "def test_02(self)" } ]
2
stack_v2_sparse_classes_30k_train_034873
Implement the Python class `Test_zhifu_statues` described below. Class description: 单元测试用例 Method signatures and docstrings: - def test_01(self): 测试支付成功场景 - def test_02(self): 测试支付失败场景
Implement the Python class `Test_zhifu_statues` described below. Class description: 单元测试用例 Method signatures and docstrings: - def test_01(self): 测试支付成功场景 - def test_02(self): 测试支付失败场景 <|skeleton|> class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" <|body_0|> def t...
a58fdcc3eb0b52c94e50a110b4f1a053c6fa0ab2
<|skeleton|> class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" <|body_0|> def test_02(self): """测试支付失败场景""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'}) statues = temple.zhifu_statues() print(statues) self.assertEqual(statues, '支付成功') def test_02(self): """测试...
the_stack_v2_python_sparse
testcase/test_temple.py
yangyilin182/IotInterFace
train
0
4bb5d0302c5a3977946273389a5c0c6c749ebb3f
[ "super().__init__()\nself._mappers = mappers\nself._consumer = consumer", "for mapper in self._mappers:\n LOG.debug('Calling mapper (%s) for event (%s)', mapper, event)\n event = mapper.map(event)\nLOG.debug('Calling consumer (%s) for event (%s)', self._consumer, event)\nself._consumer.consume(event)" ]
<|body_start_0|> super().__init__() self._mappers = mappers self._consumer = consumer <|end_body_0|> <|body_start_1|> for mapper in self._mappers: LOG.debug('Calling mapper (%s) for event (%s)', mapper, event) event = mapper.map(event) LOG.debug('Calling ...
A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer
ObservabilityEventConsumerDecorator
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservabilityEventConsumerDecorator: """A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer""" def __in...
stack_v2_sparse_classes_75kplus_train_065484
8,249
permissive
[ { "docstring": "Parameters ---------- mappers : List[ObservabilityEventMapper] List of event mappers which will be used to process events before passing to consumer consumer : ObservabilityEventConsumer Actual consumer which will handle the events after they are processed by mappers", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_004315
Implement the Python class `ObservabilityEventConsumerDecorator` described below. Class description: A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass t...
Implement the Python class `ObservabilityEventConsumerDecorator` described below. Class description: A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass t...
b297ff015f2b69d7c74059c2d42ece1c29ea73ee
<|skeleton|> class ObservabilityEventConsumerDecorator: """A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer""" def __in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObservabilityEventConsumerDecorator: """A decorator implementation for consumer, which can have mappers and decorated consumer within. Rather than the normal implementation, this will process the events through mappers which is been provided, and then pass them to actual consumer""" def __init__(self, ma...
the_stack_v2_python_sparse
samcli/lib/observability/observability_info_puller.py
aws/aws-sam-cli
train
1,402
3b4598f100b891b1cdd0ff22c17814aa7c35246d
[ "nn.Module.__init__(self)\nself.input_dim = pinput['dim']\nself.output_dim = poutput['dim']\nself.modules_list = nn.ModuleList()\nself.nn_lin = poutput.get('nn_lin')\nif issubclass(type(self.input_dim), list):\n input_dim_mean = self.input_dim[0]\n input_dim_var = self.input_dim[1]\nelse:\n input_dim_mean ...
<|body_start_0|> nn.Module.__init__(self) self.input_dim = pinput['dim'] self.output_dim = poutput['dim'] self.modules_list = nn.ModuleList() self.nn_lin = poutput.get('nn_lin') if issubclass(type(self.input_dim), list): input_dim_mean = self.input_dim[0] ...
GaussianLayer1D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianLayer1D: def __init__(self, pinput, poutput, **kwargs): """Args pinput (dict): dimension of input poutput (dict): dimension of output""" <|body_0|> def forward(self, ins, *args, **kwargs): """Outputs parameters of a diagonal Gaussian distribution. :param ins ...
stack_v2_sparse_classes_75kplus_train_065485
6,457
no_license
[ { "docstring": "Args pinput (dict): dimension of input poutput (dict): dimension of output", "name": "__init__", "signature": "def __init__(self, pinput, poutput, **kwargs)" }, { "docstring": "Outputs parameters of a diagonal Gaussian distribution. :param ins : input vector. :returns: (torch.Ten...
2
stack_v2_sparse_classes_30k_train_015647
Implement the Python class `GaussianLayer1D` described below. Class description: Implement the GaussianLayer1D class. Method signatures and docstrings: - def __init__(self, pinput, poutput, **kwargs): Args pinput (dict): dimension of input poutput (dict): dimension of output - def forward(self, ins, *args, **kwargs):...
Implement the Python class `GaussianLayer1D` described below. Class description: Implement the GaussianLayer1D class. Method signatures and docstrings: - def __init__(self, pinput, poutput, **kwargs): Args pinput (dict): dimension of input poutput (dict): dimension of output - def forward(self, ins, *args, **kwargs):...
703c435dbfb612f61908822d789f1a4034ac48b0
<|skeleton|> class GaussianLayer1D: def __init__(self, pinput, poutput, **kwargs): """Args pinput (dict): dimension of input poutput (dict): dimension of output""" <|body_0|> def forward(self, ins, *args, **kwargs): """Outputs parameters of a diagonal Gaussian distribution. :param ins ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GaussianLayer1D: def __init__(self, pinput, poutput, **kwargs): """Args pinput (dict): dimension of input poutput (dict): dimension of output""" nn.Module.__init__(self) self.input_dim = pinput['dim'] self.output_dim = poutput['dim'] self.modules_list = nn.ModuleList() ...
the_stack_v2_python_sparse
lt/modules/modules_distribution.py
domkirke/latent-transcription
train
2
c55c8ef9e3e854e30cc580c3cf9d6fe91ae863d8
[ "self.graph = graph\nself.cv = cv\nself.s = graph[0][0][0]\nself.vp = [None] * len(graph)\nself.sd = [None] * len(graph)\nself.vp[0] = self.s\nself.sd[0] = 0", "for row in range(len(self.graph)):\n v = self.graph[row][0][0]\n for ele in range(1, len(self.graph[row])):\n if len(self.graph[row][ele]) =...
<|body_start_0|> self.graph = graph self.cv = cv self.s = graph[0][0][0] self.vp = [None] * len(graph) self.sd = [None] * len(graph) self.vp[0] = self.s self.sd[0] = 0 <|end_body_0|> <|body_start_1|> for row in range(len(self.graph)): v = self...
Computes Dijkstra's shortest path, using heap
dijkstra
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dijkstra: """Computes Dijkstra's shortest path, using heap""" def __init__(self, graph, cv): """input graph which rows represent vertex first column represents destination vertex second column represents distance/weight outputs shortest path from vertex 1 from first row""" <|...
stack_v2_sparse_classes_75kplus_train_065486
3,455
no_license
[ { "docstring": "input graph which rows represent vertex first column represents destination vertex second column represents distance/weight outputs shortest path from vertex 1 from first row", "name": "__init__", "signature": "def __init__(self, graph, cv)" }, { "docstring": "input graph which r...
3
stack_v2_sparse_classes_30k_train_017444
Implement the Python class `dijkstra` described below. Class description: Computes Dijkstra's shortest path, using heap Method signatures and docstrings: - def __init__(self, graph, cv): input graph which rows represent vertex first column represents destination vertex second column represents distance/weight outputs...
Implement the Python class `dijkstra` described below. Class description: Computes Dijkstra's shortest path, using heap Method signatures and docstrings: - def __init__(self, graph, cv): input graph which rows represent vertex first column represents destination vertex second column represents distance/weight outputs...
fe9797e9b4677507379c26ef01f2f873873f2381
<|skeleton|> class dijkstra: """Computes Dijkstra's shortest path, using heap""" def __init__(self, graph, cv): """input graph which rows represent vertex first column represents destination vertex second column represents distance/weight outputs shortest path from vertex 1 from first row""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class dijkstra: """Computes Dijkstra's shortest path, using heap""" def __init__(self, graph, cv): """input graph which rows represent vertex first column represents destination vertex second column represents distance/weight outputs shortest path from vertex 1 from first row""" self.graph = gr...
the_stack_v2_python_sparse
graph/week2/dijkstra.py
davehuh/algorithms
train
0
d6fa244248a93c8492999f611a5b7acd6cbf3588
[ "self.cancelEmoji = cancelEmoji\noptions[cancelEmoji] = NonSaveableReactionMenuOption('cancel', cancelEmoji, self.delete, None)\nsuper(CancellableReactionMenu, self).__init__(msg, options=options, titleTxt=titleTxt, desc=desc, col=col, footerTxt=footerTxt, img=img, thumb=thumb, icon=icon, authorName=authorName, tim...
<|body_start_0|> self.cancelEmoji = cancelEmoji options[cancelEmoji] = NonSaveableReactionMenuOption('cancel', cancelEmoji, self.delete, None) super(CancellableReactionMenu, self).__init__(msg, options=options, titleTxt=titleTxt, desc=desc, col=col, footerTxt=footerTxt, img=img, thumb=thumb, ico...
A simple ReactionMenu extension that adds an extra 'cancel' option to your given options dictionary. The 'cancel' option will call the menu's delete method. No extra restrictions beyond targetMember/targetRole are placed on members who may cancel the menu. If CancellableReactionMenu is extended into a saveable menu cla...
CancellableReactionMenu
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CancellableReactionMenu: """A simple ReactionMenu extension that adds an extra 'cancel' option to your given options dictionary. The 'cancel' option will call the menu's delete method. No extra restrictions beyond targetMember/targetRole are placed on members who may cancel the menu. If Cancellab...
stack_v2_sparse_classes_75kplus_train_065487
34,501
permissive
[ { "docstring": ":param discord.Message msg: the message where this menu is embedded :param options: A dictionary storing all of the menu's options and their behaviour (Default {}) :type options: dict[lib.emojis.dumbEmoji, ReactionMenuOption] :param lib.emojis.dumbEmoji emoji: The emoji members should react with...
2
stack_v2_sparse_classes_30k_train_037698
Implement the Python class `CancellableReactionMenu` described below. Class description: A simple ReactionMenu extension that adds an extra 'cancel' option to your given options dictionary. The 'cancel' option will call the menu's delete method. No extra restrictions beyond targetMember/targetRole are placed on member...
Implement the Python class `CancellableReactionMenu` described below. Class description: A simple ReactionMenu extension that adds an extra 'cancel' option to your given options dictionary. The 'cancel' option will call the menu's delete method. No extra restrictions beyond targetMember/targetRole are placed on member...
b4fe3d765b764ab169284ce0869a810825013389
<|skeleton|> class CancellableReactionMenu: """A simple ReactionMenu extension that adds an extra 'cancel' option to your given options dictionary. The 'cancel' option will call the menu's delete method. No extra restrictions beyond targetMember/targetRole are placed on members who may cancel the menu. If Cancellab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CancellableReactionMenu: """A simple ReactionMenu extension that adds an extra 'cancel' option to your given options dictionary. The 'cancel' option will call the menu's delete method. No extra restrictions beyond targetMember/targetRole are placed on members who may cancel the menu. If CancellableReactionMen...
the_stack_v2_python_sparse
BB/reactionMenus/ReactionMenu.py
Trimatix/GOF2BountyBot
train
7
5f0755fe5f8d8978a3d3bbc3bf0016478074b8ae
[ "self.base_ope_estimator = SwitchDoublyRobust\nsuper()._check_lambdas()\nsuper()._check_init_inputs()", "check_array(array=estimated_rewards_by_reg_model, name='estimated_rewards_by_reg_model', expected_dim=3)\ncheck_array(array=reward, name='reward', expected_dim=1)\ncheck_array(array=action, name='action', expe...
<|body_start_0|> self.base_ope_estimator = SwitchDoublyRobust super()._check_lambdas() super()._check_init_inputs() <|end_body_0|> <|body_start_1|> check_array(array=estimated_rewards_by_reg_model, name='estimated_rewards_by_reg_model', expected_dim=3) check_array(array=reward, ...
Switch Doubly Robust (Switch-DR) with build-in hyperparameter tuning. Parameters ---------- lambdas: List[float] A list of candidate switching hyperparameters. The automatic hyperparameter tuning proposed by Su et al.(2020) will choose the best hyperparameter value from the data. estimator_name: str, default='switch-dr...
SwitchDoublyRobustTuning
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwitchDoublyRobustTuning: """Switch Doubly Robust (Switch-DR) with build-in hyperparameter tuning. Parameters ---------- lambdas: List[float] A list of candidate switching hyperparameters. The automatic hyperparameter tuning proposed by Su et al.(2020) will choose the best hyperparameter value fr...
stack_v2_sparse_classes_75kplus_train_065488
35,774
permissive
[ { "docstring": "Initialize Class.", "name": "__post_init__", "signature": "def __post_init__(self) -> None" }, { "docstring": "Estimate the policy value of evaluation policy with a tuned hyperparameter. Parameters ---------- reward: array-like, shape (n_rounds,) Reward observed in each round of ...
3
stack_v2_sparse_classes_30k_train_002338
Implement the Python class `SwitchDoublyRobustTuning` described below. Class description: Switch Doubly Robust (Switch-DR) with build-in hyperparameter tuning. Parameters ---------- lambdas: List[float] A list of candidate switching hyperparameters. The automatic hyperparameter tuning proposed by Su et al.(2020) will ...
Implement the Python class `SwitchDoublyRobustTuning` described below. Class description: Switch Doubly Robust (Switch-DR) with build-in hyperparameter tuning. Parameters ---------- lambdas: List[float] A list of candidate switching hyperparameters. The automatic hyperparameter tuning proposed by Su et al.(2020) will ...
53598edab284b4364d127ec5662137de3f9c1206
<|skeleton|> class SwitchDoublyRobustTuning: """Switch Doubly Robust (Switch-DR) with build-in hyperparameter tuning. Parameters ---------- lambdas: List[float] A list of candidate switching hyperparameters. The automatic hyperparameter tuning proposed by Su et al.(2020) will choose the best hyperparameter value fr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SwitchDoublyRobustTuning: """Switch Doubly Robust (Switch-DR) with build-in hyperparameter tuning. Parameters ---------- lambdas: List[float] A list of candidate switching hyperparameters. The automatic hyperparameter tuning proposed by Su et al.(2020) will choose the best hyperparameter value from the data. ...
the_stack_v2_python_sparse
obp/ope/estimators_tuning.py
han20192019/newRL
train
0
b5e7cdc5752a78168aa4cc3cad4b9861cd7ce4e5
[ "self.__case_folder = CaseFolder()\nself.__tokenizer = Tokenizer()\nstopword_remover_factory = StopwordRemoverFactory()\nself.__stopword_remover = stopword_remover_factory.create()\nstemmer_factory = StemmerFactory()\nself.__stemmer = stemmer_factory.create()\nself.__tf_unigram = TfUnigram()\nself.__tf_bigram = TfB...
<|body_start_0|> self.__case_folder = CaseFolder() self.__tokenizer = Tokenizer() stopword_remover_factory = StopwordRemoverFactory() self.__stopword_remover = stopword_remover_factory.create() stemmer_factory = StemmerFactory() self.__stemmer = stemmer_factory.create() ...
Bertugas Melakukan Pemrosesan Teks (Text Proeprocessing)
Preprocesser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preprocesser: """Bertugas Melakukan Pemrosesan Teks (Text Proeprocessing)""" def __init__(self): """Konstruktor""" <|body_0|> def __del__(self): """Destructor""" <|body_1|> def __get_features(self, tokens: list): """Mendapatkan Fitur Ruang-Ve...
stack_v2_sparse_classes_75kplus_train_065489
2,073
no_license
[ { "docstring": "Konstruktor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Destructor", "name": "__del__", "signature": "def __del__(self)" }, { "docstring": "Mendapatkan Fitur Ruang-Vektor Kombinasi Unigram dan Bigram", "name": "__get_features", ...
5
stack_v2_sparse_classes_30k_test_000852
Implement the Python class `Preprocesser` described below. Class description: Bertugas Melakukan Pemrosesan Teks (Text Proeprocessing) Method signatures and docstrings: - def __init__(self): Konstruktor - def __del__(self): Destructor - def __get_features(self, tokens: list): Mendapatkan Fitur Ruang-Vektor Kombinasi ...
Implement the Python class `Preprocesser` described below. Class description: Bertugas Melakukan Pemrosesan Teks (Text Proeprocessing) Method signatures and docstrings: - def __init__(self): Konstruktor - def __del__(self): Destructor - def __get_features(self, tokens: list): Mendapatkan Fitur Ruang-Vektor Kombinasi ...
9742c193251303334ef805c8c94eb075afad777f
<|skeleton|> class Preprocesser: """Bertugas Melakukan Pemrosesan Teks (Text Proeprocessing)""" def __init__(self): """Konstruktor""" <|body_0|> def __del__(self): """Destructor""" <|body_1|> def __get_features(self, tokens: list): """Mendapatkan Fitur Ruang-Ve...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Preprocesser: """Bertugas Melakukan Pemrosesan Teks (Text Proeprocessing)""" def __init__(self): """Konstruktor""" self.__case_folder = CaseFolder() self.__tokenizer = Tokenizer() stopword_remover_factory = StopwordRemoverFactory() self.__stopword_remover = stopwor...
the_stack_v2_python_sparse
ujian_app/penilaian/pemrosesan_teks/preprocesser.py
anh4rs/Aplikasi-Penilaian-Otomatis-Esai-BI
train
0
43c1b4e9c3f83d58e96eedd2d36c93a4cafeaeb1
[ "if not params:\n params = []\nif not lib_paths:\n lib_paths = []\nif not os.path.exists(jar_path):\n logger.error('Jar file ' + jar_path + ' does not exist')\n raise HadoopJobException('Jar file ' + jar_path + ' does not exist')\nfor lp in lib_paths:\n if not os.path.exists(lp):\n logger.warn...
<|body_start_0|> if not params: params = [] if not lib_paths: lib_paths = [] if not os.path.exists(jar_path): logger.error('Jar file ' + jar_path + ' does not exist') raise HadoopJobException('Jar file ' + jar_path + ' does not exist') for ...
This class represents a Hadoop MapReduce job to be executed from a jar file. Attributes: jar_path (str): The local path of the jar containing the job. params (list of str): The list of parameters of the job. lib_paths (list of str): The list of local paths to the libraries used by the job. state (int): State of the job...
HadoopJarJob
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HadoopJarJob: """This class represents a Hadoop MapReduce job to be executed from a jar file. Attributes: jar_path (str): The local path of the jar containing the job. params (list of str): The list of parameters of the job. lib_paths (list of str): The list of local paths to the libraries used b...
stack_v2_sparse_classes_75kplus_train_065490
6,117
no_license
[ { "docstring": "Creates a new Hadoop MapReduce jar job with the given parameters. Args: jar_path (str): The local path of the jar containing the job. params (list of str, optional): The list of parameters of the job. lib_paths (list of str, optional): The list of local paths to the libraries used by the job.", ...
3
stack_v2_sparse_classes_30k_train_003482
Implement the Python class `HadoopJarJob` described below. Class description: This class represents a Hadoop MapReduce job to be executed from a jar file. Attributes: jar_path (str): The local path of the jar containing the job. params (list of str): The list of parameters of the job. lib_paths (list of str): The list...
Implement the Python class `HadoopJarJob` described below. Class description: This class represents a Hadoop MapReduce job to be executed from a jar file. Attributes: jar_path (str): The local path of the jar containing the job. params (list of str): The list of parameters of the job. lib_paths (list of str): The list...
dedaee18783f065c66b2ace172f0ab0e16d0fa8e
<|skeleton|> class HadoopJarJob: """This class represents a Hadoop MapReduce job to be executed from a jar file. Attributes: jar_path (str): The local path of the jar containing the job. params (list of str): The list of parameters of the job. lib_paths (list of str): The list of local paths to the libraries used b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HadoopJarJob: """This class represents a Hadoop MapReduce job to be executed from a jar file. Attributes: jar_path (str): The local path of the jar containing the job. params (list of str): The list of parameters of the job. lib_paths (list of str): The list of local paths to the libraries used by the job. st...
the_stack_v2_python_sparse
hadoop_g5k/objects.py
mliroz/hadoop_g5k
train
7
c0b13d01d91b1603bdcebfa23a5f89524fff2300
[ "if game_object is None:\n return False\nlive_drag_component: LiveDragComponent = CommonComponentUtils.get_component(game_object, CommonComponentType.LIVE_DRAG)\nif live_drag_component is None:\n return False\nlive_drag_component._set_can_live_drag(True)\nreturn True", "if game_object is None:\n return F...
<|body_start_0|> if game_object is None: return False live_drag_component: LiveDragComponent = CommonComponentUtils.get_component(game_object, CommonComponentType.LIVE_DRAG) if live_drag_component is None: return False live_drag_component._set_can_live_drag(True) ...
Utilities for manipulating the location and draggability of Objects.
CommonObjectLocationUtils
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonObjectLocationUtils: """Utilities for manipulating the location and draggability of Objects.""" def enable_object_drag_in_live_mode(game_object: GameObject) -> bool: """enable_object_drag_in_live_mode(game_object) Enable the draggability of an Object in Live Mode. :param game_o...
stack_v2_sparse_classes_75kplus_train_065491
4,455
permissive
[ { "docstring": "enable_object_drag_in_live_mode(game_object) Enable the draggability of an Object in Live Mode. :param game_object: An instance of an Object. :type game_object: GameObject :return: True, if successful. False, if not. :rtype: bool", "name": "enable_object_drag_in_live_mode", "signature": ...
6
stack_v2_sparse_classes_30k_train_007548
Implement the Python class `CommonObjectLocationUtils` described below. Class description: Utilities for manipulating the location and draggability of Objects. Method signatures and docstrings: - def enable_object_drag_in_live_mode(game_object: GameObject) -> bool: enable_object_drag_in_live_mode(game_object) Enable ...
Implement the Python class `CommonObjectLocationUtils` described below. Class description: Utilities for manipulating the location and draggability of Objects. Method signatures and docstrings: - def enable_object_drag_in_live_mode(game_object: GameObject) -> bool: enable_object_drag_in_live_mode(game_object) Enable ...
fc4d10f95b844249bf7254e9e0948921753b076d
<|skeleton|> class CommonObjectLocationUtils: """Utilities for manipulating the location and draggability of Objects.""" def enable_object_drag_in_live_mode(game_object: GameObject) -> bool: """enable_object_drag_in_live_mode(game_object) Enable the draggability of an Object in Live Mode. :param game_o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommonObjectLocationUtils: """Utilities for manipulating the location and draggability of Objects.""" def enable_object_drag_in_live_mode(game_object: GameObject) -> bool: """enable_object_drag_in_live_mode(game_object) Enable the draggability of an Object in Live Mode. :param game_object: An ins...
the_stack_v2_python_sparse
Scripts/sims4communitylib/utils/objects/common_object_location_utils.py
xoxonaad/Sims4CommunityLibrary
train
0
b81cd6b9f4dfa3b5af7737b07efbe773c1741608
[ "super(TRUNET_OutputLayer, self).__init__()\nself.trainable = t_params['trainable']\nself.dc = model_type_settings['discrete_continuous']\nself.do0 = tf.keras.layers.TimeDistributed(tf.keras.layers.SpatialDropout2D(rate=dropout_rate, data_format='channels_last'))\nself.do1 = tf.keras.layers.TimeDistributed(tf.keras...
<|body_start_0|> super(TRUNET_OutputLayer, self).__init__() self.trainable = t_params['trainable'] self.dc = model_type_settings['discrete_continuous'] self.do0 = tf.keras.layers.TimeDistributed(tf.keras.layers.SpatialDropout2D(rate=dropout_rate, data_format='channels_last')) sel...
TRUNET_OutputLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TRUNET_OutputLayer: def __init__(self, t_params, layer_params, model_type_settings, dropout_rate): """:param list layer_params: a list of dicts of params for the layers""" <|body_0|> def call(self, _inputs, training=True): """:param tnsr inputs: (bs, seq_len, h,w,c)"...
stack_v2_sparse_classes_75kplus_train_065492
17,462
permissive
[ { "docstring": ":param list layer_params: a list of dicts of params for the layers", "name": "__init__", "signature": "def __init__(self, t_params, layer_params, model_type_settings, dropout_rate)" }, { "docstring": ":param tnsr inputs: (bs, seq_len, h,w,c)", "name": "call", "signature":...
2
stack_v2_sparse_classes_30k_train_014390
Implement the Python class `TRUNET_OutputLayer` described below. Class description: Implement the TRUNET_OutputLayer class. Method signatures and docstrings: - def __init__(self, t_params, layer_params, model_type_settings, dropout_rate): :param list layer_params: a list of dicts of params for the layers - def call(s...
Implement the Python class `TRUNET_OutputLayer` described below. Class description: Implement the TRUNET_OutputLayer class. Method signatures and docstrings: - def __init__(self, t_params, layer_params, model_type_settings, dropout_rate): :param list layer_params: a list of dicts of params for the layers - def call(s...
12dff08f2361848e13b0952540e2198db386eab8
<|skeleton|> class TRUNET_OutputLayer: def __init__(self, t_params, layer_params, model_type_settings, dropout_rate): """:param list layer_params: a list of dicts of params for the layers""" <|body_0|> def call(self, _inputs, training=True): """:param tnsr inputs: (bs, seq_len, h,w,c)"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TRUNET_OutputLayer: def __init__(self, t_params, layer_params, model_type_settings, dropout_rate): """:param list layer_params: a list of dicts of params for the layers""" super(TRUNET_OutputLayer, self).__init__() self.trainable = t_params['trainable'] self.dc = model_type_set...
the_stack_v2_python_sparse
layers.py
siyuan-qx/TRUNET
train
0
e68f8db6d3bce057c6b4d5cced0578aac6573358
[ "if isinstance(location_constraint, dict) and isinstance(client_info, dict):\n LocationClientApi._logger.debug('register location tracking: pi=%s client_info=%s location_constraint=%s', pi_uuid, client_info, location_constraint)\n json_body = dict(pi_uuid=pi_uuid, client_info=client_info, location_constraint=...
<|body_start_0|> if isinstance(location_constraint, dict) and isinstance(client_info, dict): LocationClientApi._logger.debug('register location tracking: pi=%s client_info=%s location_constraint=%s', pi_uuid, client_info, location_constraint) json_body = dict(pi_uuid=pi_uuid, client_info...
Library exported by Magen location service, wrapping client side calls to rest APIs exported by Magen location service. - Magen policy service is an example users of this module. - Note that Magen location service itself is an adaptation service that communicates with external location service(s) that are (or at least ...
LocationClientApi
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationClientApi: """Library exported by Magen location service, wrapping client side calls to rest APIs exported by Magen location service. - Magen policy service is an example users of this module. - Note that Magen location service itself is an adaptation service that communicates with extern...
stack_v2_sparse_classes_75kplus_train_065493
8,635
permissive
[ { "docstring": "Register supplied device with Magen location service, to have its location tracked, as per class documentation. :param pi_uuid: :param client_info: additional device information for location service to identify device to external location service :param location_constraint: higher-level represen...
6
null
Implement the Python class `LocationClientApi` described below. Class description: Library exported by Magen location service, wrapping client side calls to rest APIs exported by Magen location service. - Magen policy service is an example users of this module. - Note that Magen location service itself is an adaptatio...
Implement the Python class `LocationClientApi` described below. Class description: Library exported by Magen location service, wrapping client side calls to rest APIs exported by Magen location service. - Magen policy service is an example users of this module. - Note that Magen location service itself is an adaptatio...
a82342d88e9868c59c19796cbf8fc8a68413be27
<|skeleton|> class LocationClientApi: """Library exported by Magen location service, wrapping client side calls to rest APIs exported by Magen location service. - Magen policy service is an example users of this module. - Note that Magen location service itself is an adaptation service that communicates with extern...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocationClientApi: """Library exported by Magen location service, wrapping client side calls to rest APIs exported by Magen location service. - Magen policy service is an example users of this module. - Note that Magen location service itself is an adaptation service that communicates with external location s...
the_stack_v2_python_sparse
magen_location/location_client/location_client.py
magengit/magen-ps
train
0
e680d348148e20a194fb1341a3fbe56e1134f62d
[ "target = self.db.target_table\npred_name = pred_name if pred_name else target\nexamples = self.db.rows(target, [self.db.target_att, self.db.pkeys[target]])\nreturn '\\n'.join(['%s(%s, %s).' % (pred_name, ILPConverter.fmt_col(cls), pk) for cls, pk in examples])", "modeslist, getters = ([self.mode(self.db.target_t...
<|body_start_0|> target = self.db.target_table pred_name = pred_name if pred_name else target examples = self.db.rows(target, [self.db.target_att, self.db.pkeys[target]]) return '\n'.join(['%s(%s, %s).' % (pred_name, ILPConverter.fmt_col(cls), pk) for cls, pk in examples]) <|end_body_0|>...
Converts the database context to RSD inputs. Inherits from ILPConverter.
RSDConverter
[ "GPL-1.0-or-later", "LicenseRef-scancode-proprietary-license", "GPL-2.0-only", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RSDConverter: """Converts the database context to RSD inputs. Inherits from ILPConverter.""" def all_examples(self, pred_name=None): """Emits all examples in prolog form for RSD. :param pred_name: override for the emitted predicate name""" <|body_0|> def background_knowl...
stack_v2_sparse_classes_75kplus_train_065494
28,150
permissive
[ { "docstring": "Emits all examples in prolog form for RSD. :param pred_name: override for the emitted predicate name", "name": "all_examples", "signature": "def all_examples(self, pred_name=None)" }, { "docstring": "Emits the background knowledge in prolog form for RSD.", "name": "background...
2
null
Implement the Python class `RSDConverter` described below. Class description: Converts the database context to RSD inputs. Inherits from ILPConverter. Method signatures and docstrings: - def all_examples(self, pred_name=None): Emits all examples in prolog form for RSD. :param pred_name: override for the emitted predi...
Implement the Python class `RSDConverter` described below. Class description: Converts the database context to RSD inputs. Inherits from ILPConverter. Method signatures and docstrings: - def all_examples(self, pred_name=None): Emits all examples in prolog form for RSD. :param pred_name: override for the emitted predi...
807fb177328b23db28c0940b2e5222306c9c08a2
<|skeleton|> class RSDConverter: """Converts the database context to RSD inputs. Inherits from ILPConverter.""" def all_examples(self, pred_name=None): """Emits all examples in prolog form for RSD. :param pred_name: override for the emitted predicate name""" <|body_0|> def background_knowl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RSDConverter: """Converts the database context to RSD inputs. Inherits from ILPConverter.""" def all_examples(self, pred_name=None): """Emits all examples in prolog form for RSD. :param pred_name: override for the emitted predicate name""" target = self.db.target_table pred_name =...
the_stack_v2_python_sparse
rdm/db/converters.py
xflows/rdm
train
30
034088f0a40e5e7e5935e8f15455d447155dba8c
[ "with open(self.inputFileName) as txt:\n for line in txt:\n result = re.match('[A-Z].*', line)\n if result:\n print(result.group())", "with open(self.inputFileName) as txt:\n for line in txt:\n result = re.match('[A-Z][^ ]*', line)\n if result:\n print(resul...
<|body_start_0|> with open(self.inputFileName) as txt: for line in txt: result = re.match('[A-Z].*', line) if result: print(result.group()) <|end_body_0|> <|body_start_1|> with open(self.inputFileName) as txt: for line in txt: ...
正規表現の解答
Answer_5_3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Answer_5_3: """正規表現の解答""" def Step1(self): """先頭が多文字で始まる行を表示する。""" <|body_0|> def Step2(self): """先頭が大文字で始まる行の最初の単語を表示する。""" <|body_1|> def Step3(self): """各行の4つ目の単語を表示する。""" <|body_2|> def Step4(self): """cで始まる単語を表示する。""...
stack_v2_sparse_classes_75kplus_train_065495
1,838
no_license
[ { "docstring": "先頭が多文字で始まる行を表示する。", "name": "Step1", "signature": "def Step1(self)" }, { "docstring": "先頭が大文字で始まる行の最初の単語を表示する。", "name": "Step2", "signature": "def Step2(self)" }, { "docstring": "各行の4つ目の単語を表示する。", "name": "Step3", "signature": "def Step3(self)" }, { ...
5
stack_v2_sparse_classes_30k_train_016314
Implement the Python class `Answer_5_3` described below. Class description: 正規表現の解答 Method signatures and docstrings: - def Step1(self): 先頭が多文字で始まる行を表示する。 - def Step2(self): 先頭が大文字で始まる行の最初の単語を表示する。 - def Step3(self): 各行の4つ目の単語を表示する。 - def Step4(self): cで始まる単語を表示する。 - def Step5(self): peachをappleに変換する。
Implement the Python class `Answer_5_3` described below. Class description: 正規表現の解答 Method signatures and docstrings: - def Step1(self): 先頭が多文字で始まる行を表示する。 - def Step2(self): 先頭が大文字で始まる行の最初の単語を表示する。 - def Step3(self): 各行の4つ目の単語を表示する。 - def Step4(self): cで始まる単語を表示する。 - def Step5(self): peachをappleに変換する。 <|skeleton|> c...
6028f92290de60eb2552825d850758099162397f
<|skeleton|> class Answer_5_3: """正規表現の解答""" def Step1(self): """先頭が多文字で始まる行を表示する。""" <|body_0|> def Step2(self): """先頭が大文字で始まる行の最初の単語を表示する。""" <|body_1|> def Step3(self): """各行の4つ目の単語を表示する。""" <|body_2|> def Step4(self): """cで始まる単語を表示する。""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Answer_5_3: """正規表現の解答""" def Step1(self): """先頭が多文字で始まる行を表示する。""" with open(self.inputFileName) as txt: for line in txt: result = re.match('[A-Z].*', line) if result: print(result.group()) def Step2(self): """先頭...
the_stack_v2_python_sparse
セクション5/Algorithm_5_3.py
inoue0508/psample
train
0
7a29e75a4e22f863b0bcd83ebed1dae9acd5a671
[ "log.debug('Converting to block data: {0!r}'.format(data))\nlength = len(data)\nlength_length = len(str(length))\nreturn '#{0}{1}{2}'.format(length_length, length, data)", "log.debug('Converting from block data: {0!r}'.format(block_data))\nif len(block_data) < 3:\n raise BlockDataError('Not enough data.')\nif ...
<|body_start_0|> log.debug('Converting to block data: {0!r}'.format(data)) length = len(data) length_length = len(str(length)) return '#{0}{1}{2}'.format(length_length, length, data) <|end_body_0|> <|body_start_1|> log.debug('Converting from block data: {0!r}'.format(block_data)...
Utility methods for conversion between binary and 488.2 block data.
BlockData
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockData: """Utility methods for conversion between binary and 488.2 block data.""" def to_block_data(data): """Packs binary data into 488.2 block data. As per section 7.7.6 of IEEE Std 488.2-1992. Note: Does not produce indefinitely-formatted block data.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_065496
6,331
permissive
[ { "docstring": "Packs binary data into 488.2 block data. As per section 7.7.6 of IEEE Std 488.2-1992. Note: Does not produce indefinitely-formatted block data.", "name": "to_block_data", "signature": "def to_block_data(data)" }, { "docstring": "Extracts binary data from 488.2 block data. As per ...
2
null
Implement the Python class `BlockData` described below. Class description: Utility methods for conversion between binary and 488.2 block data. Method signatures and docstrings: - def to_block_data(data): Packs binary data into 488.2 block data. As per section 7.7.6 of IEEE Std 488.2-1992. Note: Does not produce indef...
Implement the Python class `BlockData` described below. Class description: Utility methods for conversion between binary and 488.2 block data. Method signatures and docstrings: - def to_block_data(data): Packs binary data into 488.2 block data. As per section 7.7.6 of IEEE Std 488.2-1992. Note: Does not produce indef...
f319a117fef7189d6dcc91124bd28ab3601e325e
<|skeleton|> class BlockData: """Utility methods for conversion between binary and 488.2 block data.""" def to_block_data(data): """Packs binary data into 488.2 block data. As per section 7.7.6 of IEEE Std 488.2-1992. Note: Does not produce indefinitely-formatted block data.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BlockData: """Utility methods for conversion between binary and 488.2 block data.""" def to_block_data(data): """Packs binary data into 488.2 block data. As per section 7.7.6 of IEEE Std 488.2-1992. Note: Does not produce indefinitely-formatted block data.""" log.debug('Converting to bloc...
the_stack_v2_python_sparse
spacq/devices/tools.py
mainCSG/SpanishAcquisitionIQC
train
1
73522b664f3f91597bf35fbf04dceef6470970a6
[ "user_id = kwargs.get('user_id')\nif user_id:\n notifications = NotificationModel.get(user_id)\n response = Notifications().dump(dict(notifications=notifications)).data\n return Response(json.dumps(response), status=200, mimetype='application/json')\nelse:\n err = {'error': ['user_id cannot be empty']}\...
<|body_start_0|> user_id = kwargs.get('user_id') if user_id: notifications = NotificationModel.get(user_id) response = Notifications().dump(dict(notifications=notifications)).data return Response(json.dumps(response), status=200, mimetype='application/json') e...
Class for managing notification routes handler.
Notification
[ "BSD-3-Clause-Clear" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Notification: """Class for managing notification routes handler.""" def get(self, **kwargs): """Get method handler for notification route.""" <|body_0|> def put(self, **kwargs): """Put method handler for notification route.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_065497
4,868
permissive
[ { "docstring": "Get method handler for notification route.", "name": "get", "signature": "def get(self, **kwargs)" }, { "docstring": "Put method handler for notification route.", "name": "put", "signature": "def put(self, **kwargs)" } ]
2
null
Implement the Python class `Notification` described below. Class description: Class for managing notification routes handler. Method signatures and docstrings: - def get(self, **kwargs): Get method handler for notification route. - def put(self, **kwargs): Put method handler for notification route.
Implement the Python class `Notification` described below. Class description: Class for managing notification routes handler. Method signatures and docstrings: - def get(self, **kwargs): Get method handler for notification route. - def put(self, **kwargs): Put method handler for notification route. <|skeleton|> clas...
7854dd314c2f5cb09d722d16ca0114c4cd9907b6
<|skeleton|> class Notification: """Class for managing notification routes handler.""" def get(self, **kwargs): """Get method handler for notification route.""" <|body_0|> def put(self, **kwargs): """Put method handler for notification route.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Notification: """Class for managing notification routes handler.""" def get(self, **kwargs): """Get method handler for notification route.""" user_id = kwargs.get('user_id') if user_id: notifications = NotificationModel.get(user_id) response = Notifications...
the_stack_v2_python_sparse
app/api/v1/resources/notification.py
Fozia-Zafar/Device-Registration-Subsystem
train
0
124c6612bf3fa823f865ffcee035f72521988bfe
[ "super(BiRNN, self).__init__(**kwargs)\nself.embedding = nn.Embedding(len(vocab), embed_size)\nself.encoder = rnn.LSTM(num_hiddens, num_layers=num_layers, bidirectional=True, input_size=embed_size)\nself.decoder = nn.Dense(2)", "embeddings = self.embedding(inputs.T)\nstates = self.encoder(embeddings)\nencoding = ...
<|body_start_0|> super(BiRNN, self).__init__(**kwargs) self.embedding = nn.Embedding(len(vocab), embed_size) self.encoder = rnn.LSTM(num_hiddens, num_layers=num_layers, bidirectional=True, input_size=embed_size) self.decoder = nn.Dense(2) <|end_body_0|> <|body_start_1|> embeddin...
BiRNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiRNN: def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs): """1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :p...
stack_v2_sparse_classes_75kplus_train_065498
6,973
no_license
[ { "docstring": "1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :param kwargs:", "name": "__init__", "signature": "def __init__(self, vocab, embed_siz...
2
stack_v2_sparse_classes_30k_train_044640
Implement the Python class `BiRNN` described below. Class description: Implement the BiRNN class. Method signatures and docstrings: - def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs): 1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作...
Implement the Python class `BiRNN` described below. Class description: Implement the BiRNN class. Method signatures and docstrings: - def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs): 1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作...
cfca78f2d351caa58092ce5e6b955347aba6637e
<|skeleton|> class BiRNN: def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs): """1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BiRNN: def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs): """1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :param kwargs:""...
the_stack_v2_python_sparse
NLP_exercise/NLP_exercise/text_emotion_classification.py
Jeff654/my_machine_learning
train
1
309484e02826b23cacb08b5c3980cb537a43ec0d
[ "self.provider_id = provider_id\nself.driver_id = driver_id\nself.comment = comment\nself.date_time = date_time", "if dictionary is None:\n return None\nprovider_id = dictionary.get('providerId')\ndriver_id = dictionary.get('driverId')\ncomment = dictionary.get('comment')\ndate_time = dictionary.get('dateTime'...
<|body_start_0|> self.provider_id = provider_id self.driver_id = driver_id self.comment = comment self.date_time = date_time <|end_body_0|> <|body_start_1|> if dictionary is None: return None provider_id = dictionary.get('providerId') driver_id = dict...
Implementation of the 'Annotation Log' model. TODO: type model description here. Attributes: provider_id (string): The unique 'Provider ID' of the TSP. driver_id (string): The id of the driver who created this log. comment (string): The annotation text associated with the log. date_time (string): Date and time for this...
AnnotationLog
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnnotationLog: """Implementation of the 'Annotation Log' model. TODO: type model description here. Attributes: provider_id (string): The unique 'Provider ID' of the TSP. driver_id (string): The id of the driver who created this log. comment (string): The annotation text associated with the log. d...
stack_v2_sparse_classes_75kplus_train_065499
2,114
permissive
[ { "docstring": "Constructor for the AnnotationLog class", "name": "__init__", "signature": "def __init__(self, provider_id=None, driver_id=None, comment=None, date_time=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repre...
2
stack_v2_sparse_classes_30k_train_007155
Implement the Python class `AnnotationLog` described below. Class description: Implementation of the 'Annotation Log' model. TODO: type model description here. Attributes: provider_id (string): The unique 'Provider ID' of the TSP. driver_id (string): The id of the driver who created this log. comment (string): The ann...
Implement the Python class `AnnotationLog` described below. Class description: Implementation of the 'Annotation Log' model. TODO: type model description here. Attributes: provider_id (string): The unique 'Provider ID' of the TSP. driver_id (string): The id of the driver who created this log. comment (string): The ann...
729e9391879e273545a4818558677b2e47261f08
<|skeleton|> class AnnotationLog: """Implementation of the 'Annotation Log' model. TODO: type model description here. Attributes: provider_id (string): The unique 'Provider ID' of the TSP. driver_id (string): The id of the driver who created this log. comment (string): The annotation text associated with the log. d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnnotationLog: """Implementation of the 'Annotation Log' model. TODO: type model description here. Attributes: provider_id (string): The unique 'Provider ID' of the TSP. driver_id (string): The id of the driver who created this log. comment (string): The annotation text associated with the log. date_time (str...
the_stack_v2_python_sparse
sdk/python/v0.1-rc.4/opentelematicsapi/models/annotation_log.py
nmfta-repo/nmfta-opentelematics-prototype
train
2