blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
a29f60f11feb6e3839f6dcac5fbb40661c3f798a
[ "if not root:\n return\na, b = ([], [])\na.append(root)\nwhile a:\n index = a.pop(0)\n if index:\n b.append(str(index.val))\n a.append(index.left)\n a.append(index.right)\n else:\n b.append('null')\nwhile b[-1] == 'null':\n b.pop()\nreturn b", "if not data:\n return\n...
<|body_start_0|> if not root: return a, b = ([], []) a.append(root) while a: index = a.pop(0) if index: b.append(str(index.val)) a.append(index.left) a.append(index.right) else: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_021600
1,664
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
10693cb991bdadd8b476a5edc6888e4c4de9a17a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return a, b = ([], []) a.append(root) while a: index = a.pop(0) if index: b.append(str(index.val)...
the_stack_v2_python_sparse
offer_37.py
ZhangNing777/LeetCode_Python
train
0
9b29e66450a133fbd70359a7f31a3f22282494c8
[ "version1 = version1.split('.')\nversion2 = version2.split('.')\nn1 = len(version1)\nn2 = len(version2)\ni, j = (0, 0)\nwhile i < n1 or j < n2:\n value1 = int(version1[i]) if i < n1 else 0\n value2 = int(version2[j]) if j < n2 else 0\n if value1 > value2:\n return 1\n elif value1 < value2:\n ...
<|body_start_0|> version1 = version1.split('.') version2 = version2.split('.') n1 = len(version1) n2 = len(version2) i, j = (0, 0) while i < n1 or j < n2: value1 = int(version1[i]) if i < n1 else 0 value2 = int(version2[j]) if j < n2 else 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compareVersion(self, version1: str, version2: str) -> int: """split 后双指针,空间复杂度(m + n),时间复杂度O(max(n, m)) :param version1: :param version2: :return:""" <|body_0|> def compareVersion1(self, version1: str, version2: str) -> int: """不使用split, 额外空间O(1) :param...
stack_v2_sparse_classes_36k_train_021601
2,911
no_license
[ { "docstring": "split 后双指针,空间复杂度(m + n),时间复杂度O(max(n, m)) :param version1: :param version2: :return:", "name": "compareVersion", "signature": "def compareVersion(self, version1: str, version2: str) -> int" }, { "docstring": "不使用split, 额外空间O(1) :param version1: :param version2: :return:", "na...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compareVersion(self, version1: str, version2: str) -> int: split 后双指针,空间复杂度(m + n),时间复杂度O(max(n, m)) :param version1: :param version2: :return: - def compareVersion1(self, ve...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compareVersion(self, version1: str, version2: str) -> int: split 后双指针,空间复杂度(m + n),时间复杂度O(max(n, m)) :param version1: :param version2: :return: - def compareVersion1(self, ve...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def compareVersion(self, version1: str, version2: str) -> int: """split 后双指针,空间复杂度(m + n),时间复杂度O(max(n, m)) :param version1: :param version2: :return:""" <|body_0|> def compareVersion1(self, version1: str, version2: str) -> int: """不使用split, 额外空间O(1) :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def compareVersion(self, version1: str, version2: str) -> int: """split 后双指针,空间复杂度(m + n),时间复杂度O(max(n, m)) :param version1: :param version2: :return:""" version1 = version1.split('.') version2 = version2.split('.') n1 = len(version1) n2 = len(version2) ...
the_stack_v2_python_sparse
datastructure/daily_topic/CompareVersion.py
yinhuax/leet_code
train
0
00e570daa2871e33d109ab100a525d46b6bf369c
[ "processed_dict = {}\nfor key, value in request.GET.items():\n processed_dict[key] = value\nsign = processed_dict.pop('sign', None)\nalipay = AliPay(appid='2016091400509243', app_notify_url='http://www.zhutaosong.top:8000/alipay/return/', app_private_key_path=private_key_path, alipay_public_key_path=ali_pub_key_...
<|body_start_0|> processed_dict = {} for key, value in request.GET.items(): processed_dict[key] = value sign = processed_dict.pop('sign', None) alipay = AliPay(appid='2016091400509243', app_notify_url='http://www.zhutaosong.top:8000/alipay/return/', app_private_key_path=priva...
AlipayView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlipayView: def get(self, request): """支付宝返回的return_url :param request: :return:""" <|body_0|> def post(self, request): """支付宝返回的notify_url :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> processed_dict = {} for key,...
stack_v2_sparse_classes_36k_train_021602
6,235
no_license
[ { "docstring": "支付宝返回的return_url :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "支付宝返回的notify_url :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_009935
Implement the Python class `AlipayView` described below. Class description: Implement the AlipayView class. Method signatures and docstrings: - def get(self, request): 支付宝返回的return_url :param request: :return: - def post(self, request): 支付宝返回的notify_url :param request: :return:
Implement the Python class `AlipayView` described below. Class description: Implement the AlipayView class. Method signatures and docstrings: - def get(self, request): 支付宝返回的return_url :param request: :return: - def post(self, request): 支付宝返回的notify_url :param request: :return: <|skeleton|> class AlipayView: de...
6e43bb7d814920222f3310bd6fd9f04cb3d5bbf1
<|skeleton|> class AlipayView: def get(self, request): """支付宝返回的return_url :param request: :return:""" <|body_0|> def post(self, request): """支付宝返回的notify_url :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlipayView: def get(self, request): """支付宝返回的return_url :param request: :return:""" processed_dict = {} for key, value in request.GET.items(): processed_dict[key] = value sign = processed_dict.pop('sign', None) alipay = AliPay(appid='2016091400509243', app_n...
the_stack_v2_python_sparse
apps/integral/views.py
bbright3493/python_real_war
train
0
d1ed222a4932c33c1ef08508161298387b99d203
[ "self.inventory_1 = Inventory('1234', 'lamp', '45', '10')\nself.inventory_1_dic = self.inventory_1.return_as_dictionary()\nself.electric_appliances_1 = ElectricAppliances('4455', 'TV', '2200', '140', 'Samsung', '120')\nself.electric_appliances_1_dic = self.electric_appliances_1.return_as_dictionary()\nself.furnitur...
<|body_start_0|> self.inventory_1 = Inventory('1234', 'lamp', '45', '10') self.inventory_1_dic = self.inventory_1.return_as_dictionary() self.electric_appliances_1 = ElectricAppliances('4455', 'TV', '2200', '140', 'Samsung', '120') self.electric_appliances_1_dic = self.electric_appliance...
CLass to test each individual python file inside inventory_management
InventoryTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryTest: """CLass to test each individual python file inside inventory_management""" def setUp(self): """setUP Method to create instances of each class""" <|body_0|> def test_inventory(self): """Method to test inventory_class""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_021603
7,098
no_license
[ { "docstring": "setUP Method to create instances of each class", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Method to test inventory_class", "name": "test_inventory", "signature": "def test_inventory(self)" }, { "docstring": "Method to test electric_applia...
4
null
Implement the Python class `InventoryTest` described below. Class description: CLass to test each individual python file inside inventory_management Method signatures and docstrings: - def setUp(self): setUP Method to create instances of each class - def test_inventory(self): Method to test inventory_class - def test...
Implement the Python class `InventoryTest` described below. Class description: CLass to test each individual python file inside inventory_management Method signatures and docstrings: - def setUp(self): setUP Method to create instances of each class - def test_inventory(self): Method to test inventory_class - def test...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class InventoryTest: """CLass to test each individual python file inside inventory_management""" def setUp(self): """setUP Method to create instances of each class""" <|body_0|> def test_inventory(self): """Method to test inventory_class""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InventoryTest: """CLass to test each individual python file inside inventory_management""" def setUp(self): """setUP Method to create instances of each class""" self.inventory_1 = Inventory('1234', 'lamp', '45', '10') self.inventory_1_dic = self.inventory_1.return_as_dictionary() ...
the_stack_v2_python_sparse
students/pooria_k/lesson01/test_unit.py
JavaRod/SP_Python220B_2019
train
1
0d1c887a8fd12b8f64849a937e33c746faa9b10a
[ "Fireworks.__init__(self, cv)\nParticle.__init__(self, cv, x, y, vx, vy, 'yellow', timetodie)\nself.pcolor = pcolor\nself.pattern = pattern\nself.particles_amount = particles_amount\nself.exploded = False\nsize = 3\nself.cid = self.cv.create_oval(x - size, y - size, x + size, y + size, fill=self.color)", "if self...
<|body_start_0|> Fireworks.__init__(self, cv) Particle.__init__(self, cv, x, y, vx, vy, 'yellow', timetodie) self.pcolor = pcolor self.pattern = pattern self.particles_amount = particles_amount self.exploded = False size = 3 self.cid = self.cv.create_oval(...
A Rocket is first shooting up in the sky before exploding in a pattern.
Rocket
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rocket: """A Rocket is first shooting up in the sky before exploding in a pattern.""" def __init__(self, cv, x, y, pattern=None, particles_amount=500, vx=0, vy=-120, timetodie=2.0, pcolor='white'): """Initializing the Rocket with a variable pattern. Args: cv (Tk.canvas): the canvas i...
stack_v2_sparse_classes_36k_train_021604
17,823
no_license
[ { "docstring": "Initializing the Rocket with a variable pattern. Args: cv (Tk.canvas): the canvas in which the Rocket is drawn x (float): x-starting point of rocket y (float): y-starting point of rocket pattern (callable): distribution for the particles particles_amount (int): Amount of particles emerging from ...
3
stack_v2_sparse_classes_30k_train_018707
Implement the Python class `Rocket` described below. Class description: A Rocket is first shooting up in the sky before exploding in a pattern. Method signatures and docstrings: - def __init__(self, cv, x, y, pattern=None, particles_amount=500, vx=0, vy=-120, timetodie=2.0, pcolor='white'): Initializing the Rocket wi...
Implement the Python class `Rocket` described below. Class description: A Rocket is first shooting up in the sky before exploding in a pattern. Method signatures and docstrings: - def __init__(self, cv, x, y, pattern=None, particles_amount=500, vx=0, vy=-120, timetodie=2.0, pcolor='white'): Initializing the Rocket wi...
5e51c57c17ee8c233a0fe63f32942e80549040fd
<|skeleton|> class Rocket: """A Rocket is first shooting up in the sky before exploding in a pattern.""" def __init__(self, cv, x, y, pattern=None, particles_amount=500, vx=0, vy=-120, timetodie=2.0, pcolor='white'): """Initializing the Rocket with a variable pattern. Args: cv (Tk.canvas): the canvas i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rocket: """A Rocket is first shooting up in the sky before exploding in a pattern.""" def __init__(self, cv, x, y, pattern=None, particles_amount=500, vx=0, vy=-120, timetodie=2.0, pcolor='white'): """Initializing the Rocket with a variable pattern. Args: cv (Tk.canvas): the canvas in which the R...
the_stack_v2_python_sparse
semester_one/infoI/sheet10/fireworks.py
fkarg/uni-stuff
train
0
b19bb67b87de2b83dfe6e9335cd70e8539429dab
[ "ctx.save_for_backward(input)\nz = torch.rand_like(input, requires_grad=False)\np = (torch.clamp(input, -1, 1) + 1) / 2\nreturn -1.0 + 2.0 * (z < p).float()", "input, = ctx.saved_tensors\ngrad_input = grad_output.clone()\ngrad_input[torch.abs(input) > 1.001] = 0\nreturn grad_input" ]
<|body_start_0|> ctx.save_for_backward(input) z = torch.rand_like(input, requires_grad=False) p = (torch.clamp(input, -1, 1) + 1) / 2 return -1.0 + 2.0 * (z < p).float() <|end_body_0|> <|body_start_1|> input, = ctx.saved_tensors grad_input = grad_output.clone() g...
Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`
BinaryConnectStochastic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryConnectStochastic: """Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`""" def forward(ctx, input): """Apply stochastic binarization on input tensor.""" <|body_0|> def b...
stack_v2_sparse_classes_36k_train_021605
7,014
permissive
[ { "docstring": "Apply stochastic binarization on input tensor.", "name": "forward", "signature": "def forward(ctx, input)" }, { "docstring": "Compute the back propagation of the binarization op.", "name": "backward", "signature": "def backward(ctx, grad_output)" } ]
2
stack_v2_sparse_classes_30k_train_006279
Implement the Python class `BinaryConnectStochastic` described below. Class description: Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}` Method signatures and docstrings: - def forward(ctx, input): Apply stochastic binar...
Implement the Python class `BinaryConnectStochastic` described below. Class description: Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}` Method signatures and docstrings: - def forward(ctx, input): Apply stochastic binar...
990e970b1fbd299ff88200db21a9cc3fe44706d3
<|skeleton|> class BinaryConnectStochastic: """Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`""" def forward(ctx, input): """Apply stochastic binarization on input tensor.""" <|body_0|> def b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryConnectStochastic: """Binarizarion stochastic op with backprob. Forward : :math:`r_b = 1` with prob of :math:`hardsigmoid(r)` Backward : :math:`d r_b/d r = 1_{|r|=<1}`""" def forward(ctx, input): """Apply stochastic binarization on input tensor.""" ctx.save_for_backward(input) ...
the_stack_v2_python_sparse
QuantTorch/functions/binary_connect.py
AamirRaihan/Pytorch_Quantize_impls
train
0
95f8d5cdb04db131eec782075bf3a3abf601f4e7
[ "self.gamma = gamma\nself.eps = eps\ncache = dict()\nfor k, v in model.params.items():\n cache[k] = np.zeros_like(v)\nself.cache = cache", "gamma = self.gamma\neps = self.eps\ncache = self.cache\nparams, grads = (model.params, model.grads)\nfor k in grads:\n cache[k] = gamma * cache[k] + (1 - gamma) * np.po...
<|body_start_0|> self.gamma = gamma self.eps = eps cache = dict() for k, v in model.params.items(): cache[k] = np.zeros_like(v) self.cache = cache <|end_body_0|> <|body_start_1|> gamma = self.gamma eps = self.eps cache = self.cache par...
RMSpropOptim
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RMSpropOptim: def __init__(self, model, gamma=0.9, eps=1e-12): """Inputs: :param model: a neural network class object :param gamma: (float) suggest to be 0.9 :param eps: (float) a small number""" <|body_0|> def step(self, model, learning_rate): """Implement a one-ste...
stack_v2_sparse_classes_36k_train_021606
9,004
no_license
[ { "docstring": "Inputs: :param model: a neural network class object :param gamma: (float) suggest to be 0.9 :param eps: (float) a small number", "name": "__init__", "signature": "def __init__(self, model, gamma=0.9, eps=1e-12)" }, { "docstring": "Implement a one-step RMSprop update on network's ...
2
stack_v2_sparse_classes_30k_train_003815
Implement the Python class `RMSpropOptim` described below. Class description: Implement the RMSpropOptim class. Method signatures and docstrings: - def __init__(self, model, gamma=0.9, eps=1e-12): Inputs: :param model: a neural network class object :param gamma: (float) suggest to be 0.9 :param eps: (float) a small n...
Implement the Python class `RMSpropOptim` described below. Class description: Implement the RMSpropOptim class. Method signatures and docstrings: - def __init__(self, model, gamma=0.9, eps=1e-12): Inputs: :param model: a neural network class object :param gamma: (float) suggest to be 0.9 :param eps: (float) a small n...
a401d09c28432109e9ced10e5011bff97dda05b9
<|skeleton|> class RMSpropOptim: def __init__(self, model, gamma=0.9, eps=1e-12): """Inputs: :param model: a neural network class object :param gamma: (float) suggest to be 0.9 :param eps: (float) a small number""" <|body_0|> def step(self, model, learning_rate): """Implement a one-ste...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RMSpropOptim: def __init__(self, model, gamma=0.9, eps=1e-12): """Inputs: :param model: a neural network class object :param gamma: (float) suggest to be 0.9 :param eps: (float) a small number""" self.gamma = gamma self.eps = eps cache = dict() for k, v in model.params....
the_stack_v2_python_sparse
assignment2/E4040.2017.Assign2.xw2501/E4040.2017.Assign2.xw2501/ecbm4040/optimizers.py
xw2501/Deep_Learning_study
train
7
2e811d347b7e693b10c947c2294cce8a9959a607
[ "v1, v2 = (version1.split('.'), version2.split('.'))\nm, n = (len(v1), len(v2))\nfor idx in range(max(m, n)):\n item1 = int(v1[idx]) if idx < m else 0\n item2 = int(v2[idx]) if idx < n else 0\n if item1 > item2:\n return 1\n elif item1 < item2:\n return -1\nreturn 0", "p1, p2 = (0, 0)\nn...
<|body_start_0|> v1, v2 = (version1.split('.'), version2.split('.')) m, n = (len(v1), len(v2)) for idx in range(max(m, n)): item1 = int(v1[idx]) if idx < m else 0 item2 = int(v2[idx]) if idx < n else 0 if item1 > item2: return 1 eli...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compareVersionSplitString(self, version1: str, version2: str) -> int: """字符串分割,逐个比较""" <|body_0|> def compareVersion(self, version1: str, version2: str) -> int: """双指针""" <|body_1|> def get_next_chunk(self, version: str, n: int, p: int) -> ...
stack_v2_sparse_classes_36k_train_021607
1,644
no_license
[ { "docstring": "字符串分割,逐个比较", "name": "compareVersionSplitString", "signature": "def compareVersionSplitString(self, version1: str, version2: str) -> int" }, { "docstring": "双指针", "name": "compareVersion", "signature": "def compareVersion(self, version1: str, version2: str) -> int" }, ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compareVersionSplitString(self, version1: str, version2: str) -> int: 字符串分割,逐个比较 - def compareVersion(self, version1: str, version2: str) -> int: 双指针 - def get_next_chunk(sel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compareVersionSplitString(self, version1: str, version2: str) -> int: 字符串分割,逐个比较 - def compareVersion(self, version1: str, version2: str) -> int: 双指针 - def get_next_chunk(sel...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def compareVersionSplitString(self, version1: str, version2: str) -> int: """字符串分割,逐个比较""" <|body_0|> def compareVersion(self, version1: str, version2: str) -> int: """双指针""" <|body_1|> def get_next_chunk(self, version: str, n: int, p: int) -> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def compareVersionSplitString(self, version1: str, version2: str) -> int: """字符串分割,逐个比较""" v1, v2 = (version1.split('.'), version2.split('.')) m, n = (len(v1), len(v2)) for idx in range(max(m, n)): item1 = int(v1[idx]) if idx < m else 0 item2 =...
the_stack_v2_python_sparse
165.比较版本号/solution.py
QtTao/daily_leetcode
train
0
ad1eb218fbcc53177f2804fdd0dcd615b10debc5
[ "if 'w' not in self.mode:\n raise IOError('FileStoreImage %s is not in write mode.', self.urn)\npredicate = ('index:target:%s' % target).lower()\ndata_store.DB.MultiSet(self.urn, {predicate: target}, token=self.token, replace=True, sync=False)", "regex = ['index:target:.*%s.*' % target_regex.lower()]\nif isins...
<|body_start_0|> if 'w' not in self.mode: raise IOError('FileStoreImage %s is not in write mode.', self.urn) predicate = ('index:target:%s' % target).lower() data_store.DB.MultiSet(self.urn, {predicate: target}, token=self.token, replace=True, sync=False) <|end_body_0|> <|body_start...
The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 path to the files on these clients. e.g. on...
FileStoreImage
[ "Apache-2.0", "DOC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileStoreImage: """The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 p...
stack_v2_sparse_classes_36k_train_021608
24,878
permissive
[ { "docstring": "Adds an indexed reference to the target URN.", "name": "AddIndex", "signature": "def AddIndex(self, target)" }, { "docstring": "Search the index for matches to the file specified by the regex. Args: target_regex: The regular expression to match against the index. limit: Either a ...
2
stack_v2_sparse_classes_30k_train_002597
Implement the Python class `FileStoreImage` described below. Class description: The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific has...
Implement the Python class `FileStoreImage` described below. Class description: The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific has...
ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e
<|skeleton|> class FileStoreImage: """The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileStoreImage: """The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 path to the fi...
the_stack_v2_python_sparse
lib/aff4_objects/filestore.py
defaultnamehere/grr
train
3
738520414003b38a39ee6f782bec02851a6f7f6d
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "self.bttn1 = Button(self, text='Я ничего не делаю!')\nself.bttn1.grid()\nself.bttn2 = Button(self)\nself.bttn2.grid()\nself.bttn2.configure(text='И я тоже!')\nself.bttn3 = Button(self)\nself.bttn3.grid()\nself.bttn3['text'] = 'И я!'...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> self.bttn1 = Button(self, text='Я ничего не делаю!') self.bttn1.grid() self.bttn2 = Button(self) self.bttn2.grid() self.bttn2.conf...
GUI - приложение с тремя кнопками
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """GUI - приложение с тремя кнопками""" def __init__(self, master): """Инициализирует рамку.""" <|body_0|> def create_widgets(self): """Создает три бесполезные кнопки.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Applicatio...
stack_v2_sparse_classes_36k_train_021609
1,163
no_license
[ { "docstring": "Инициализирует рамку.", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Создает три бесполезные кнопки.", "name": "create_widgets", "signature": "def create_widgets(self)" } ]
2
stack_v2_sparse_classes_30k_train_021394
Implement the Python class `Application` described below. Class description: GUI - приложение с тремя кнопками Method signatures and docstrings: - def __init__(self, master): Инициализирует рамку. - def create_widgets(self): Создает три бесполезные кнопки.
Implement the Python class `Application` described below. Class description: GUI - приложение с тремя кнопками Method signatures and docstrings: - def __init__(self, master): Инициализирует рамку. - def create_widgets(self): Создает три бесполезные кнопки. <|skeleton|> class Application: """GUI - приложение с тр...
0192a5a936aac4ebec18e6f6bb4988e1865942f0
<|skeleton|> class Application: """GUI - приложение с тремя кнопками""" def __init__(self, master): """Инициализирует рамку.""" <|body_0|> def create_widgets(self): """Создает три бесполезные кнопки.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """GUI - приложение с тремя кнопками""" def __init__(self, master): """Инициализирует рамку.""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Создает три бесполезные кнопки.""" sel...
the_stack_v2_python_sparse
lessons/Chapter 10/10_02.py
a-abramow/MDawsonlessons
train
0
80ee4760bf6f18b6e9079870a9f94db99e4d97d5
[ "if root is None:\n return False\nif root.val == 1:\n return True\nreturn self.hasOne(root.left) or self.hasOne(root.right)", "if root is None:\n return root\nif self.hasOne(root.left):\n root.left = self.pruneTree(root.left)\nelse:\n root.left = None\nif self.hasOne(root.right):\n root.right = ...
<|body_start_0|> if root is None: return False if root.val == 1: return True return self.hasOne(root.left) or self.hasOne(root.right) <|end_body_0|> <|body_start_1|> if root is None: return root if self.hasOne(root.left): root.left...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasOne(self, root): """:type root: TreeNode :rtype: Boolean""" <|body_0|> def pruneTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: return False ...
stack_v2_sparse_classes_36k_train_021610
1,090
no_license
[ { "docstring": ":type root: TreeNode :rtype: Boolean", "name": "hasOne", "signature": "def hasOne(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "pruneTree", "signature": "def pruneTree(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_008416
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasOne(self, root): :type root: TreeNode :rtype: Boolean - def pruneTree(self, root): :type root: TreeNode :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasOne(self, root): :type root: TreeNode :rtype: Boolean - def pruneTree(self, root): :type root: TreeNode :rtype: TreeNode <|skeleton|> class Solution: def hasOne(self...
f8b35179b980e55f61bbcd2631fa3a9bf30c40ec
<|skeleton|> class Solution: def hasOne(self, root): """:type root: TreeNode :rtype: Boolean""" <|body_0|> def pruneTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasOne(self, root): """:type root: TreeNode :rtype: Boolean""" if root is None: return False if root.val == 1: return True return self.hasOne(root.left) or self.hasOne(root.right) def pruneTree(self, root): """:type root: TreeN...
the_stack_v2_python_sparse
Python Solutions/814 Binary Tree Pruning.py
Sue9/Leetcode
train
0
e57fe9ffad2652dfbc3b96c69b87b8d5c545a062
[ "attachments = []\nattachment_ids = []\npicking_ids = self.picking_ids.filtered(lambda l: not l.is_printed_in_batch and (not l.is_create_label))\nif not picking_ids:\n raise UserError('No labels to print')\ndelivery_type = False\nfor picking in picking_ids.sorted(key=lambda l: l.product_sku):\n delivery_type ...
<|body_start_0|> attachments = [] attachment_ids = [] picking_ids = self.picking_ids.filtered(lambda l: not l.is_printed_in_batch and (not l.is_create_label)) if not picking_ids: raise UserError('No labels to print') delivery_type = False for picking in pickin...
StockPickingBatch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StockPickingBatch: def generate_shipping_label(self): """Prints the Shipping label-Packing slip report for the batch.""" <|body_0|> def merge_packing_slip(self, attachment_ids): """Merges the Shipping label-Packing slip report of all pickings in the batch. :param att...
stack_v2_sparse_classes_36k_train_021611
20,885
no_license
[ { "docstring": "Prints the Shipping label-Packing slip report for the batch.", "name": "generate_shipping_label", "signature": "def generate_shipping_label(self)" }, { "docstring": "Merges the Shipping label-Packing slip report of all pickings in the batch. :param attachment_ids: list of PDF dat...
3
null
Implement the Python class `StockPickingBatch` described below. Class description: Implement the StockPickingBatch class. Method signatures and docstrings: - def generate_shipping_label(self): Prints the Shipping label-Packing slip report for the batch. - def merge_packing_slip(self, attachment_ids): Merges the Shipp...
Implement the Python class `StockPickingBatch` described below. Class description: Implement the StockPickingBatch class. Method signatures and docstrings: - def generate_shipping_label(self): Prints the Shipping label-Packing slip report for the batch. - def merge_packing_slip(self, attachment_ids): Merges the Shipp...
9b15373125139cab1d26294c218685c5b87b9709
<|skeleton|> class StockPickingBatch: def generate_shipping_label(self): """Prints the Shipping label-Packing slip report for the batch.""" <|body_0|> def merge_packing_slip(self, attachment_ids): """Merges the Shipping label-Packing slip report of all pickings in the batch. :param att...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StockPickingBatch: def generate_shipping_label(self): """Prints the Shipping label-Packing slip report for the batch.""" attachments = [] attachment_ids = [] picking_ids = self.picking_ids.filtered(lambda l: not l.is_printed_in_batch and (not l.is_create_label)) if not ...
the_stack_v2_python_sparse
delivery_shipping_label/models/stock_picking.py
suningwz/ruvati
train
0
bed1618a3a27d5d8b6a690256fb272b02bbd6b83
[ "super(LaneNetBackEnd, self).__init__()\nself._phase = phase\nself._is_training = self._is_net_for_training()", "if isinstance(self._phase, tf.Tensor):\n phase = self._phase\nelse:\n phase = tf.constant(self._phase, dtype=tf.string)\nreturn tf.equal(phase, tf.constant('train', dtype=tf.string))", "loss_we...
<|body_start_0|> super(LaneNetBackEnd, self).__init__() self._phase = phase self._is_training = self._is_net_for_training() <|end_body_0|> <|body_start_1|> if isinstance(self._phase, tf.Tensor): phase = self._phase else: phase = tf.constant(self._phase, d...
LaneNet backend branch which is mainly used for binary and instance segmentation loss calculation
LaneNetBackEnd
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaneNetBackEnd: """LaneNet backend branch which is mainly used for binary and instance segmentation loss calculation""" def __init__(self, phase): """init lanenet backend :param phase: train or test""" <|body_0|> def _is_net_for_training(self): """if the net is u...
stack_v2_sparse_classes_36k_train_021612
8,245
permissive
[ { "docstring": "init lanenet backend :param phase: train or test", "name": "__init__", "signature": "def __init__(self, phase)" }, { "docstring": "if the net is used for training or not :return:", "name": "_is_net_for_training", "signature": "def _is_net_for_training(self)" }, { ...
5
stack_v2_sparse_classes_30k_train_000733
Implement the Python class `LaneNetBackEnd` described below. Class description: LaneNet backend branch which is mainly used for binary and instance segmentation loss calculation Method signatures and docstrings: - def __init__(self, phase): init lanenet backend :param phase: train or test - def _is_net_for_training(s...
Implement the Python class `LaneNetBackEnd` described below. Class description: LaneNet backend branch which is mainly used for binary and instance segmentation loss calculation Method signatures and docstrings: - def __init__(self, phase): init lanenet backend :param phase: train or test - def _is_net_for_training(s...
b4e9eeb3b25597ce7a393771d3f324d64ec1348b
<|skeleton|> class LaneNetBackEnd: """LaneNet backend branch which is mainly used for binary and instance segmentation loss calculation""" def __init__(self, phase): """init lanenet backend :param phase: train or test""" <|body_0|> def _is_net_for_training(self): """if the net is u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LaneNetBackEnd: """LaneNet backend branch which is mainly used for binary and instance segmentation loss calculation""" def __init__(self, phase): """init lanenet backend :param phase: train or test""" super(LaneNetBackEnd, self).__init__() self._phase = phase self._is_tra...
the_stack_v2_python_sparse
lanenet_model/lanenet_back_end.py
xuanyuyt/lanenet-lane-detection
train
8
5cd5760cf8f50b45001cdd03e6bc5dc3b26663e3
[ "super(ThompsonSampling, self).__init__(args, data, initial_queries, classification_model, embedding_model, cache)\ndensity_estimates, _, _ = get_batch_density_estimates(self.args, self.initial_queries, self.de_nn_algo, self.data, self.embedding_model, self.classification_model, cache=self.cache)\ndensity_estimates...
<|body_start_0|> super(ThompsonSampling, self).__init__(args, data, initial_queries, classification_model, embedding_model, cache) density_estimates, _, _ = get_batch_density_estimates(self.args, self.initial_queries, self.de_nn_algo, self.data, self.embedding_model, self.classification_model, cache=sel...
Implements Thompson Sampling with a Beta prior, having means as the density estimates
ThompsonSampling
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThompsonSampling: """Implements Thompson Sampling with a Beta prior, having means as the density estimates""" def __init__(self, args, data, initial_queries, classification_model, embedding_model, cache): """Initialize algorithm and calculate priors based on density estimates""" ...
stack_v2_sparse_classes_36k_train_021613
19,526
no_license
[ { "docstring": "Initialize algorithm and calculate priors based on density estimates", "name": "__init__", "signature": "def __init__(self, args, data, initial_queries, classification_model, embedding_model, cache)" }, { "docstring": "Select query based on the algorithm", "name": "select_que...
2
stack_v2_sparse_classes_30k_val_000153
Implement the Python class `ThompsonSampling` described below. Class description: Implements Thompson Sampling with a Beta prior, having means as the density estimates Method signatures and docstrings: - def __init__(self, args, data, initial_queries, classification_model, embedding_model, cache): Initialize algorith...
Implement the Python class `ThompsonSampling` described below. Class description: Implements Thompson Sampling with a Beta prior, having means as the density estimates Method signatures and docstrings: - def __init__(self, args, data, initial_queries, classification_model, embedding_model, cache): Initialize algorith...
5e3fd843a872dac20dba7632fc0801a2980e9ac6
<|skeleton|> class ThompsonSampling: """Implements Thompson Sampling with a Beta prior, having means as the density estimates""" def __init__(self, args, data, initial_queries, classification_model, embedding_model, cache): """Initialize algorithm and calculate priors based on density estimates""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThompsonSampling: """Implements Thompson Sampling with a Beta prior, having means as the density estimates""" def __init__(self, args, data, initial_queries, classification_model, embedding_model, cache): """Initialize algorithm and calculate priors based on density estimates""" super(Tho...
the_stack_v2_python_sparse
other_experiments/ucb.py
QMrpy/InteractiveErrors
train
0
bebe5e2754eb3c08b50c2f8d580eed14687c725a
[ "TagsLU.CheckPrereq(self)\nfor tag in self.op.tags:\n objects.TaggableObject.ValidateTag(tag)", "try:\n for tag in self.op.tags:\n self.target.AddTag(tag)\nexcept errors.TagError as err:\n raise errors.OpExecError('Error while setting tag: %s' % str(err))\nself.cfg.Update(self.target, feedback_fn)...
<|body_start_0|> TagsLU.CheckPrereq(self) for tag in self.op.tags: objects.TaggableObject.ValidateTag(tag) <|end_body_0|> <|body_start_1|> try: for tag in self.op.tags: self.target.AddTag(tag) except errors.TagError as err: raise error...
Sets a tag on a given object.
LUTagsSet
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LUTagsSet: """Sets a tag on a given object.""" def CheckPrereq(self): """Check prerequisites. This checks the type and length of the tag name and value.""" <|body_0|> def Exec(self, feedback_fn): """Sets the tag.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_021614
7,102
permissive
[ { "docstring": "Check prerequisites. This checks the type and length of the tag name and value.", "name": "CheckPrereq", "signature": "def CheckPrereq(self)" }, { "docstring": "Sets the tag.", "name": "Exec", "signature": "def Exec(self, feedback_fn)" } ]
2
null
Implement the Python class `LUTagsSet` described below. Class description: Sets a tag on a given object. Method signatures and docstrings: - def CheckPrereq(self): Check prerequisites. This checks the type and length of the tag name and value. - def Exec(self, feedback_fn): Sets the tag.
Implement the Python class `LUTagsSet` described below. Class description: Sets a tag on a given object. Method signatures and docstrings: - def CheckPrereq(self): Check prerequisites. This checks the type and length of the tag name and value. - def Exec(self, feedback_fn): Sets the tag. <|skeleton|> class LUTagsSet...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class LUTagsSet: """Sets a tag on a given object.""" def CheckPrereq(self): """Check prerequisites. This checks the type and length of the tag name and value.""" <|body_0|> def Exec(self, feedback_fn): """Sets the tag.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LUTagsSet: """Sets a tag on a given object.""" def CheckPrereq(self): """Check prerequisites. This checks the type and length of the tag name and value.""" TagsLU.CheckPrereq(self) for tag in self.op.tags: objects.TaggableObject.ValidateTag(tag) def Exec(self, fee...
the_stack_v2_python_sparse
lib/cmdlib/tags.py
ganeti/ganeti
train
465
74bc6036a6b7e0ec5031a7d1023a1b570f6948ab
[ "super().__init__()\nself.encoder = ESPNetX4_Encoder(classes, p, q)\nif encoderFile != None:\n self.encoder.load_state_dict(torch.load(encoderFile))\n print('Encoder loaded!')\nself.en_modules = []\nfor i, m in enumerate(self.encoder.children()):\n self.en_modules.append(m)\nself.level3_C = C(128 + 3, clas...
<|body_start_0|> super().__init__() self.encoder = ESPNetX4_Encoder(classes, p, q) if encoderFile != None: self.encoder.load_state_dict(torch.load(encoderFile)) print('Encoder loaded!') self.en_modules = [] for i, m in enumerate(self.encoder.children()): ...
This class defines the ESPNetX4 network
ESPNetX4
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESPNetX4: """This class defines the ESPNetX4 network""" def __init__(self, classes=19, p=2, q=3, encoderFile=None): """:param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier :param encoderFile: pretrain...
stack_v2_sparse_classes_36k_train_021615
44,685
permissive
[ { "docstring": ":param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier :param encoderFile: pretrained encoder weights. Recall that we first trained the ESPNetX4-C and then attached the RUM-based light weight decoder. See paper for...
2
null
Implement the Python class `ESPNetX4` described below. Class description: This class defines the ESPNetX4 network Method signatures and docstrings: - def __init__(self, classes=19, p=2, q=3, encoderFile=None): :param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplie...
Implement the Python class `ESPNetX4` described below. Class description: This class defines the ESPNetX4 network Method signatures and docstrings: - def __init__(self, classes=19, p=2, q=3, encoderFile=None): :param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplie...
27272e43126a507a6d93b21cd2372f5432f61237
<|skeleton|> class ESPNetX4: """This class defines the ESPNetX4 network""" def __init__(self, classes=19, p=2, q=3, encoderFile=None): """:param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier :param encoderFile: pretrain...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ESPNetX4: """This class defines the ESPNetX4 network""" def __init__(self, classes=19, p=2, q=3, encoderFile=None): """:param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier :param encoderFile: pretrained encoder we...
the_stack_v2_python_sparse
model/ESPNetX4.py
Ethan-ye/Efficient-Segmentation-Networks
train
0
acfdcb335c32e36881c60c686687326fa053f4ca
[ "self.model_type = model_type\nself.fire = kwargs.get('fire', 2)\nself.refract = kwargs.get('refract', 4)\nself.t_max = self.fire + self.refract\nself.precision = kwargs.get('precision', 0.97)\nself.activation_time = kwargs.get('activation_time', -1)\nself.potential = kwargs.get('potential', 1)", "self.activation...
<|body_start_0|> self.model_type = model_type self.fire = kwargs.get('fire', 2) self.refract = kwargs.get('refract', 4) self.t_max = self.fire + self.refract self.precision = kwargs.get('precision', 0.97) self.activation_time = kwargs.get('activation_time', -1) se...
The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance fire : float The duration of time it takes for the neuronal current to reach its peak refract : float The duration of time it t...
Firing_Model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Firing_Model: """The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance fire : float The duration of time it takes for the neuronal current to reach its peak r...
stack_v2_sparse_classes_36k_train_021616
13,526
permissive
[ { "docstring": "Parameters ---------- model_type : str Describes the type of firing model for this Firing_Model instance **fire : float Specifies the duration of time it takes for the neuronal current to reach its peak **refract : float Specifies the duration of time it takes after reaching the peak current to ...
2
stack_v2_sparse_classes_30k_train_020864
Implement the Python class `Firing_Model` described below. Class description: The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance fire : float The duration of time it takes for t...
Implement the Python class `Firing_Model` described below. Class description: The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance fire : float The duration of time it takes for t...
93aa6312ab53e6a71f6ef5dd1fc6b2187d852ee1
<|skeleton|> class Firing_Model: """The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance fire : float The duration of time it takes for the neuronal current to reach its peak r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Firing_Model: """The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance fire : float The duration of time it takes for the neuronal current to reach its peak refract : floa...
the_stack_v2_python_sparse
neuralnet/neuron_stable_adjust.py
orrenravid1/AML
train
0
16c8f9ae480c44be6d649888ec793045069ee561
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
CreditCardsServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreditCardsServicer: """Missing associated documentation comment in .proto file.""" def table(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def get_all(self, request, context): """Missing associated documentati...
stack_v2_sparse_classes_36k_train_021617
9,841
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "table", "signature": "def table(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "get_all", "signature": "def get_all(self, request, context)"...
6
stack_v2_sparse_classes_30k_train_011068
Implement the Python class `CreditCardsServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def table(self, request, context): Missing associated documentation comment in .proto file. - def get_all(self, request, context): Missing a...
Implement the Python class `CreditCardsServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def table(self, request, context): Missing associated documentation comment in .proto file. - def get_all(self, request, context): Missing a...
47d57bda959afa0b53d65e996b08e2f3b650c1a8
<|skeleton|> class CreditCardsServicer: """Missing associated documentation comment in .proto file.""" def table(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def get_all(self, request, context): """Missing associated documentati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreditCardsServicer: """Missing associated documentation comment in .proto file.""" def table(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') ...
the_stack_v2_python_sparse
pix/bank_client/protos/credit_cards_pb2_grpc.py
thecodeworkers/testing-clients
train
0
7e5bbc300ae16bf96def637a26487cc9dfdc5493
[ "title = definition['title']\ndescription = definition.get('description')\nanalysis, created = self.get_or_create(title=title, description=description)\nversions = definition.get('versions', [])\nversions_created = AnalysisVersion.objects.from_list(analysis, versions)\nreturn (analysis, created, versions_created)",...
<|body_start_0|> title = definition['title'] description = definition.get('description') analysis, created = self.get_or_create(title=title, description=description) versions = definition.get('versions', []) versions_created = AnalysisVersion.objects.from_list(analysis, versions)...
Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class.
AnalysisManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalysisManager: """Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class.""" def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]: """Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instan...
stack_v2_sparse_classes_36k_train_021618
2,477
permissive
[ { "docstring": "Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instance based on a dictionary definition. Parameters ---------- definition : dict Analysis definition Returns ------- Tuple[models.Model, bool, bool] analysis, created, versions_created See Also -------- * :ref:`user_guide/an...
2
null
Implement the Python class `AnalysisManager` described below. Class description: Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class. Method signatures and docstrings: - def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]: Gets or creates an ...
Implement the Python class `AnalysisManager` described below. Class description: Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class. Method signatures and docstrings: - def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]: Gets or creates an ...
5642579660fd09dde4a23bf02ec98a7ec264bceb
<|skeleton|> class AnalysisManager: """Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class.""" def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]: """Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnalysisManager: """Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class.""" def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]: """Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instance based on a...
the_stack_v2_python_sparse
django_analyses/models/managers/analysis.py
TheLabbingProject/django_analyses
train
1
39b2110306ffbf176b3fc00fee4e37696b58f44c
[ "group1, group2 = data\ntest_stat = abs(group1.mean() - group2.mean())\nreturn test_stat", "group1, group2 = self.data\nself.n, self.m = (len(group1), len(group2))\nself.pool = np.hstack((group1, group2))", "np.random.shuffle(self.pool)\ndata = (self.pool[:self.n], self.pool[self.n:])\nreturn data" ]
<|body_start_0|> group1, group2 = data test_stat = abs(group1.mean() - group2.mean()) return test_stat <|end_body_0|> <|body_start_1|> group1, group2 = self.data self.n, self.m = (len(group1), len(group2)) self.pool = np.hstack((group1, group2)) <|end_body_1|> <|body_st...
Tests a difference in means by permutation.
DiffMeansPermute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiffMeansPermute: """Tests a difference in means by permutation.""" def TestStatistic(self, data): """Computes the test statistic. data: data in whatever form is relevant""" <|body_0|> def MakeModel(self): """Build a model of the null hypothesis.""" <|bod...
stack_v2_sparse_classes_36k_train_021619
10,162
permissive
[ { "docstring": "Computes the test statistic. data: data in whatever form is relevant", "name": "TestStatistic", "signature": "def TestStatistic(self, data)" }, { "docstring": "Build a model of the null hypothesis.", "name": "MakeModel", "signature": "def MakeModel(self)" }, { "do...
3
stack_v2_sparse_classes_30k_train_016797
Implement the Python class `DiffMeansPermute` described below. Class description: Tests a difference in means by permutation. Method signatures and docstrings: - def TestStatistic(self, data): Computes the test statistic. data: data in whatever form is relevant - def MakeModel(self): Build a model of the null hypothe...
Implement the Python class `DiffMeansPermute` described below. Class description: Tests a difference in means by permutation. Method signatures and docstrings: - def TestStatistic(self, data): Computes the test statistic. data: data in whatever form is relevant - def MakeModel(self): Build a model of the null hypothe...
30a85d5137db95e01461ad21519bc1bdf294044b
<|skeleton|> class DiffMeansPermute: """Tests a difference in means by permutation.""" def TestStatistic(self, data): """Computes the test statistic. data: data in whatever form is relevant""" <|body_0|> def MakeModel(self): """Build a model of the null hypothesis.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiffMeansPermute: """Tests a difference in means by permutation.""" def TestStatistic(self, data): """Computes the test statistic. data: data in whatever form is relevant""" group1, group2 = data test_stat = abs(group1.mean() - group2.mean()) return test_stat def Make...
the_stack_v2_python_sparse
CompStats/hypothesis.py
sunny2309/scipy_conf_notebooks
train
2
6b748f62e90fb0d4adcfa1ef134567b23dc609be
[ "input_ts = random_data.create_random_ts(n_ts=5, n_req=3, n_hist=7, max_length=2000, min_length=200)\nwrite_data_to_iot_format.write_ts(input_ts, FILE_NAME)\ndata, metric_ids, host_ids, header_names = get_iot_data.get_data(FILE_NAME, [], True)\nos.remove(FILE_NAME)\nwith self.assertRaises(IndexError) as e:\n ts_...
<|body_start_0|> input_ts = random_data.create_random_ts(n_ts=5, n_req=3, n_hist=7, max_length=2000, min_length=200) write_data_to_iot_format.write_ts(input_ts, FILE_NAME) data, metric_ids, host_ids, header_names = get_iot_data.get_data(FILE_NAME, [], True) os.remove(FILE_NAME) w...
TestIotData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIotData: def test_read_empty_lines(self): """Checks results of reading empty lines""" <|body_0|> def test_read_empty_dataset(self): """Checks results of reading empty dataset""" <|body_1|> <|end_skeleton|> <|body_start_0|> input_ts = random_data...
stack_v2_sparse_classes_36k_train_021620
4,254
no_license
[ { "docstring": "Checks results of reading empty lines", "name": "test_read_empty_lines", "signature": "def test_read_empty_lines(self)" }, { "docstring": "Checks results of reading empty dataset", "name": "test_read_empty_dataset", "signature": "def test_read_empty_dataset(self)" } ]
2
stack_v2_sparse_classes_30k_train_012514
Implement the Python class `TestIotData` described below. Class description: Implement the TestIotData class. Method signatures and docstrings: - def test_read_empty_lines(self): Checks results of reading empty lines - def test_read_empty_dataset(self): Checks results of reading empty dataset
Implement the Python class `TestIotData` described below. Class description: Implement the TestIotData class. Method signatures and docstrings: - def test_read_empty_lines(self): Checks results of reading empty lines - def test_read_empty_dataset(self): Checks results of reading empty dataset <|skeleton|> class Test...
7ed73b0db340b0f54cbc68a6ea02b95df45bc30e
<|skeleton|> class TestIotData: def test_read_empty_lines(self): """Checks results of reading empty lines""" <|body_0|> def test_read_empty_dataset(self): """Checks results of reading empty dataset""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestIotData: def test_read_empty_lines(self): """Checks results of reading empty lines""" input_ts = random_data.create_random_ts(n_ts=5, n_req=3, n_hist=7, max_length=2000, min_length=200) write_data_to_iot_format.write_ts(input_ts, FILE_NAME) data, metric_ids, host_ids, heade...
the_stack_v2_python_sparse
python-code/UnitTests/test_iot_data.py
Strijov/Multiscale
train
3
0974f05aa0d564818f86aedf846ef0ece92ec3f6
[ "import collections\nsequences = collections.defaultdict(int)\nfor i in range(len(s)):\n sequences[s[i:i + 10]] += 1\nreturn [key for key, value in sequences.iteritems() if value > 1]", "if not s:\n return []\nr, p = (set(), set())\nfor i in xrange(len(s) - 9):\n t = s[i:i + 10]\n if t in p:\n ...
<|body_start_0|> import collections sequences = collections.defaultdict(int) for i in range(len(s)): sequences[s[i:i + 10]] += 1 return [key for key, value in sequences.iteritems() if value > 1] <|end_body_0|> <|body_start_1|> if not s: return [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRepeatedDnaSequences(self, s): """https://discuss.leetcode.com/topic/8805/4-lines-python-solution/2 :type s: str :rtype: List[str]""" <|body_0|> def findRepeatedDnaSequences2(self, s): """fastest answer retrieve from leetcode submission :param s: :r...
stack_v2_sparse_classes_36k_train_021621
1,326
no_license
[ { "docstring": "https://discuss.leetcode.com/topic/8805/4-lines-python-solution/2 :type s: str :rtype: List[str]", "name": "findRepeatedDnaSequences", "signature": "def findRepeatedDnaSequences(self, s)" }, { "docstring": "fastest answer retrieve from leetcode submission :param s: :return:", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatedDnaSequences(self, s): https://discuss.leetcode.com/topic/8805/4-lines-python-solution/2 :type s: str :rtype: List[str] - def findRepeatedDnaSequences2(self, s): ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatedDnaSequences(self, s): https://discuss.leetcode.com/topic/8805/4-lines-python-solution/2 :type s: str :rtype: List[str] - def findRepeatedDnaSequences2(self, s): ...
2526f8c0dec7101123123740e146ee4081e979ee
<|skeleton|> class Solution: def findRepeatedDnaSequences(self, s): """https://discuss.leetcode.com/topic/8805/4-lines-python-solution/2 :type s: str :rtype: List[str]""" <|body_0|> def findRepeatedDnaSequences2(self, s): """fastest answer retrieve from leetcode submission :param s: :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findRepeatedDnaSequences(self, s): """https://discuss.leetcode.com/topic/8805/4-lines-python-solution/2 :type s: str :rtype: List[str]""" import collections sequences = collections.defaultdict(int) for i in range(len(s)): sequences[s[i:i + 10]] += 1 ...
the_stack_v2_python_sparse
187. Repeated DNA Sequences.py
zhangpengGenedock/leetcode_python
train
1
84564bc3cc7dbe7da0fa315308088f687545a02d
[ "mgr = PageImportManager()\npid_notice_pairs = [('84714961156', None), ('139288502700', TypeError), ('291107654260858', TypeError), ('9423481220941280', FacebookAPIError), ('53379078585', PageImportReport.ModelInstanceExists)]\nrandom.shuffle(pid_notice_pairs)\noriginal_fb_records = {}\nfor pid, notice in pid_notic...
<|body_start_0|> mgr = PageImportManager() pid_notice_pairs = [('84714961156', None), ('139288502700', TypeError), ('291107654260858', TypeError), ('9423481220941280', FacebookAPIError), ('53379078585', PageImportReport.ModelInstanceExists)] random.shuffle(pid_notice_pairs) original_fb_r...
PlaceImportingTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlaceImportingTest: def test_import(self): """Tests the importing of a batch of FB pages as Places""" <|body_0|> def test_import_no_owner(self): """Tests the importing of a batch of FB pages as Places without owner importing disabled.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_021622
14,911
no_license
[ { "docstring": "Tests the importing of a batch of FB pages as Places", "name": "test_import", "signature": "def test_import(self)" }, { "docstring": "Tests the importing of a batch of FB pages as Places without owner importing disabled.", "name": "test_import_no_owner", "signature": "def...
2
null
Implement the Python class `PlaceImportingTest` described below. Class description: Implement the PlaceImportingTest class. Method signatures and docstrings: - def test_import(self): Tests the importing of a batch of FB pages as Places - def test_import_no_owner(self): Tests the importing of a batch of FB pages as Pl...
Implement the Python class `PlaceImportingTest` described below. Class description: Implement the PlaceImportingTest class. Method signatures and docstrings: - def test_import(self): Tests the importing of a batch of FB pages as Places - def test_import_no_owner(self): Tests the importing of a batch of FB pages as Pl...
3ed85e856a026001a1d91d09d31d944c64704824
<|skeleton|> class PlaceImportingTest: def test_import(self): """Tests the importing of a batch of FB pages as Places""" <|body_0|> def test_import_no_owner(self): """Tests the importing of a batch of FB pages as Places without owner importing disabled.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlaceImportingTest: def test_import(self): """Tests the importing of a batch of FB pages as Places""" mgr = PageImportManager() pid_notice_pairs = [('84714961156', None), ('139288502700', TypeError), ('291107654260858', TypeError), ('9423481220941280', FacebookAPIError), ('53379078585'...
the_stack_v2_python_sparse
scenable/outsourcing/subtests/fbpages.py
gregarious/betasite
train
0
aab53c42c26c9d1287effbd607bd152114a4056c
[ "req_body = cli.make_body(sp=sp, ipPort=ip_port, ipAddress=ip_address, netmask=netmask, v6PrefixLength=v6_prefix_length, gateway=gateway, vlanId=vlan_id)\nresp = cli.post(cls().resource_class, **req_body)\nresp.raise_if_err()\nreturn cls.get(cli, resp.resource_id)", "req_body = self._cli.make_body(sp=sp, ipPort=i...
<|body_start_0|> req_body = cli.make_body(sp=sp, ipPort=ip_port, ipAddress=ip_address, netmask=netmask, v6PrefixLength=v6_prefix_length, gateway=gateway, vlanId=vlan_id) resp = cli.post(cls().resource_class, **req_body) resp.raise_if_err() return cls.get(cli, resp.resource_id) <|end_body...
UnityReplicationInterface
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnityReplicationInterface: def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on...
stack_v2_sparse_classes_36k_train_021623
3,507
permissive
[ { "docstring": "Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on which the replication interface is running. :param ip_port: `UnityIpPort` object. Physical port or link aggregation on the storage processor on which...
2
stack_v2_sparse_classes_30k_train_019967
Implement the Python class `UnityReplicationInterface` described below. Class description: Implement the UnityReplicationInterface class. Method signatures and docstrings: - def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): Creates a replication interface....
Implement the Python class `UnityReplicationInterface` described below. Class description: Implement the UnityReplicationInterface class. Method signatures and docstrings: - def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): Creates a replication interface....
ccfccba0bceda34c0d5dc8105c95731036f4e955
<|skeleton|> class UnityReplicationInterface: def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnityReplicationInterface: def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on which the rep...
the_stack_v2_python_sparse
storops/unity/resource/replication_interface.py
emc-openstack/storops
train
61
6f9a261378620108730601613788d7fa44cd541d
[ "delay_factor = self.select_delay_factor(delay_factor=0)\noutput = ''\ncount = 1\nwhile count <= 30:\n output += self.read_channel()\n if 'any key to continue' in output:\n self.write_channel(self.RETURN)\n break\n else:\n time.sleep(0.33 * delay_factor)\n count += 1\nself.write_cha...
<|body_start_0|> delay_factor = self.select_delay_factor(delay_factor=0) output = '' count = 1 while count <= 30: output += self.read_channel() if 'any key to continue' in output: self.write_channel(self.RETURN) break el...
HPProcurveSSH
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HPProcurveSSH: def session_preparation(self): """Prepare the session after the connection has been established.""" <|body_0|> def _build_ssh_client(self): """Allow passwordless authentication for HP devices being provisioned.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_021624
6,256
permissive
[ { "docstring": "Prepare the session after the connection has been established.", "name": "session_preparation", "signature": "def session_preparation(self)" }, { "docstring": "Allow passwordless authentication for HP devices being provisioned.", "name": "_build_ssh_client", "signature": ...
2
stack_v2_sparse_classes_30k_train_004808
Implement the Python class `HPProcurveSSH` described below. Class description: Implement the HPProcurveSSH class. Method signatures and docstrings: - def session_preparation(self): Prepare the session after the connection has been established. - def _build_ssh_client(self): Allow passwordless authentication for HP de...
Implement the Python class `HPProcurveSSH` described below. Class description: Implement the HPProcurveSSH class. Method signatures and docstrings: - def session_preparation(self): Prepare the session after the connection has been established. - def _build_ssh_client(self): Allow passwordless authentication for HP de...
585c9f0dd4a08608c5019341eb6546f4c8c28138
<|skeleton|> class HPProcurveSSH: def session_preparation(self): """Prepare the session after the connection has been established.""" <|body_0|> def _build_ssh_client(self): """Allow passwordless authentication for HP devices being provisioned.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HPProcurveSSH: def session_preparation(self): """Prepare the session after the connection has been established.""" delay_factor = self.select_delay_factor(delay_factor=0) output = '' count = 1 while count <= 30: output += self.read_channel() if '...
the_stack_v2_python_sparse
netmiko/hp/hp_procurve.py
TanY0Y0/netmiko
train
1
81d4a003e1449ec375f9b83cee18f0151bd1aeb0
[ "self.shared_vars = shared_vars\nself.context = zmq.Context()\nself.impath_receiver = self.context.socket(zmq.REP)\nself.impath_receiver.bind(impath_return_ch)\nif 'ipc:' in impath_return_ch:\n os.chmod(impath_return_ch[6:], 508)\nprint('done initialization')\nsuper(IstImpathReturnThread, self).__init__()", "t...
<|body_start_0|> self.shared_vars = shared_vars self.context = zmq.Context() self.impath_receiver = self.context.socket(zmq.REP) self.impath_receiver.bind(impath_return_ch) if 'ipc:' in impath_return_ch: os.chmod(impath_return_ch[6:], 508) print('done initiali...
Class implementing the thread which download images from the image search provider.
IstImpathReturnThread
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IstImpathReturnThread: """Class implementing the thread which download images from the image search provider.""" def __init__(self, impath_return_ch, shared_vars): """Initializes the class Arguments: impath_return_ch: ZMQ return channel shared_vars: holder of global shared variables"...
stack_v2_sparse_classes_36k_train_021625
11,195
permissive
[ { "docstring": "Initializes the class Arguments: impath_return_ch: ZMQ return channel shared_vars: holder of global shared variables", "name": "__init__", "signature": "def __init__(self, impath_return_ch, shared_vars)" }, { "docstring": "Executes the thread. Stores the paths to the downloaded t...
2
null
Implement the Python class `IstImpathReturnThread` described below. Class description: Class implementing the thread which download images from the image search provider. Method signatures and docstrings: - def __init__(self, impath_return_ch, shared_vars): Initializes the class Arguments: impath_return_ch: ZMQ retur...
Implement the Python class `IstImpathReturnThread` described below. Class description: Class implementing the thread which download images from the image search provider. Method signatures and docstrings: - def __init__(self, impath_return_ch, shared_vars): Initializes the class Arguments: impath_return_ch: ZMQ retur...
f79b1a3661534b78b991810303aa6db4bb24a14f
<|skeleton|> class IstImpathReturnThread: """Class implementing the thread which download images from the image search provider.""" def __init__(self, impath_return_ch, shared_vars): """Initializes the class Arguments: impath_return_ch: ZMQ return channel shared_vars: holder of global shared variables"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IstImpathReturnThread: """Class implementing the thread which download images from the image search provider.""" def __init__(self, impath_return_ch, shared_vars): """Initializes the class Arguments: impath_return_ch: ZMQ return channel shared_vars: holder of global shared variables""" se...
the_stack_v2_python_sparse
siteroot/controllers/retengine/engine/qtypes/engines/text_query.py
danigunawan/vgg_frontend
train
0
cc20c3f604266ee113b8ec29da059175f332656a
[ "with self.session() as session:\n query = session.query(mod.NrClasses.handle).distinct()\n return set((result.handle for result in query))", "def empty():\n return {'members': [], 'representative': None, 'name': {'class_id': None, 'full': None, 'handle': None, 'version': None, 'cutoff': cutoff}, 'releas...
<|body_start_0|> with self.session() as session: query = session.query(mod.NrClasses.handle).distinct() return set((result.handle for result in query)) <|end_body_0|> <|body_start_1|> def empty(): return {'members': [], 'representative': None, 'name': {'class_id': No...
Known
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Known: def handles(self): """Return a set of all known handles for the nr set.""" <|body_0|> def classes(self, release_id, cutoff): """Get all classes with the given resolution cutoff in the given release. If nothing is below the cutoff then an empty dictonary will b...
stack_v2_sparse_classes_36k_train_021626
17,502
no_license
[ { "docstring": "Return a set of all known handles for the nr set.", "name": "handles", "signature": "def handles(self)" }, { "docstring": "Get all classes with the given resolution cutoff in the given release. If nothing is below the cutoff then an empty dictonary will be returned. :release_id: ...
3
null
Implement the Python class `Known` described below. Class description: Implement the Known class. Method signatures and docstrings: - def handles(self): Return a set of all known handles for the nr set. - def classes(self, release_id, cutoff): Get all classes with the given resolution cutoff in the given release. If ...
Implement the Python class `Known` described below. Class description: Implement the Known class. Method signatures and docstrings: - def handles(self): Return a set of all known handles for the nr set. - def classes(self, release_id, cutoff): Get all classes with the given resolution cutoff in the given release. If ...
1982e10a56885e56d79aac69365b9ff78c0e3d92
<|skeleton|> class Known: def handles(self): """Return a set of all known handles for the nr set.""" <|body_0|> def classes(self, release_id, cutoff): """Get all classes with the given resolution cutoff in the given release. If nothing is below the cutoff then an empty dictonary will b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Known: def handles(self): """Return a set of all known handles for the nr set.""" with self.session() as session: query = session.query(mod.NrClasses.handle).distinct() return set((result.handle for result in query)) def classes(self, release_id, cutoff): "...
the_stack_v2_python_sparse
pymotifs/nr/builder.py
BGSU-RNA/RNA-3D-Hub-core
train
3
93fd211999fd389e3097dc54c6ea30cc368477e3
[ "cell = csv_readline(line)\nif cell[0] == 'V':\n yield (cell[4], 1)", "total = 0\ntotal = sum((i for i in visit_counts))\nyield (customer, total)" ]
<|body_start_0|> cell = csv_readline(line) if cell[0] == 'V': yield (cell[4], 1) <|end_body_0|> <|body_start_1|> total = 0 total = sum((i for i in visit_counts)) yield (customer, total) <|end_body_1|>
CustomerVisit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerVisit: def mapper(self, line_no, line): """Extracts the Customer that visit a page""" <|body_0|> def reducer(self, customer, visit_counts): """Sumarizes the visit counts by adding them together.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021627
1,020
no_license
[ { "docstring": "Extracts the Customer that visit a page", "name": "mapper", "signature": "def mapper(self, line_no, line)" }, { "docstring": "Sumarizes the visit counts by adding them together.", "name": "reducer", "signature": "def reducer(self, customer, visit_counts)" } ]
2
stack_v2_sparse_classes_30k_train_010701
Implement the Python class `CustomerVisit` described below. Class description: Implement the CustomerVisit class. Method signatures and docstrings: - def mapper(self, line_no, line): Extracts the Customer that visit a page - def reducer(self, customer, visit_counts): Sumarizes the visit counts by adding them together...
Implement the Python class `CustomerVisit` described below. Class description: Implement the CustomerVisit class. Method signatures and docstrings: - def mapper(self, line_no, line): Extracts the Customer that visit a page - def reducer(self, customer, visit_counts): Sumarizes the visit counts by adding them together...
dc1b55b1ca0b989ff65df04fc96df2afc102ee0d
<|skeleton|> class CustomerVisit: def mapper(self, line_no, line): """Extracts the Customer that visit a page""" <|body_0|> def reducer(self, customer, visit_counts): """Sumarizes the visit counts by adding them together.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomerVisit: def mapper(self, line_no, line): """Extracts the Customer that visit a page""" cell = csv_readline(line) if cell[0] == 'V': yield (cell[4], 1) def reducer(self, customer, visit_counts): """Sumarizes the visit counts by adding them together.""" ...
the_stack_v2_python_sparse
week4/visits_per_customer_solution.py
hchandaria/UCB_MIDS_W261
train
0
a5ba3ba14e744d0c9ca6a5cce20d6a92d49e316c
[ "args = image_download.parse_args()\nas_attachment = args.get('asAttachment')\nthumbnail = args.get('thumbnail')\nimage = current_user.images.filter(id=image_id, deleted=False).first()\nif image is None:\n return ({'success': False}, 400)\nwidth = args.get('width')\nheight = args.get('height')\nif not width:\n ...
<|body_start_0|> args = image_download.parse_args() as_attachment = args.get('asAttachment') thumbnail = args.get('thumbnail') image = current_user.images.filter(id=image_id, deleted=False).first() if image is None: return ({'success': False}, 400) width = arg...
ImageId
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageId: def get(self, image_id): """Returns category by ID""" <|body_0|> def delete(self, image_id): """Deletes an image by ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = image_download.parse_args() as_attachment = args.get('asAt...
stack_v2_sparse_classes_36k_train_021628
6,500
permissive
[ { "docstring": "Returns category by ID", "name": "get", "signature": "def get(self, image_id)" }, { "docstring": "Deletes an image by ID", "name": "delete", "signature": "def delete(self, image_id)" } ]
2
stack_v2_sparse_classes_30k_val_000689
Implement the Python class `ImageId` described below. Class description: Implement the ImageId class. Method signatures and docstrings: - def get(self, image_id): Returns category by ID - def delete(self, image_id): Deletes an image by ID
Implement the Python class `ImageId` described below. Class description: Implement the ImageId class. Method signatures and docstrings: - def get(self, image_id): Returns category by ID - def delete(self, image_id): Deletes an image by ID <|skeleton|> class ImageId: def get(self, image_id): """Returns c...
9cce5d2f64944e2aa7ca829ca4032624e3305138
<|skeleton|> class ImageId: def get(self, image_id): """Returns category by ID""" <|body_0|> def delete(self, image_id): """Deletes an image by ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageId: def get(self, image_id): """Returns category by ID""" args = image_download.parse_args() as_attachment = args.get('asAttachment') thumbnail = args.get('thumbnail') image = current_user.images.filter(id=image_id, deleted=False).first() if image is None: ...
the_stack_v2_python_sparse
backend/webserver/api/images.py
jsbroks/coco-annotator
train
1,987
9a9d3e5f1cb707ccd191b81b14244b49cfa75748
[ "from sims4communitylib.utils.sims.common_occult_utils import CommonOccultUtils\nif CommonOccultUtils.is_alien(sim_info):\n return CommonOccultType.ALIEN\nelif CommonOccultUtils.is_ghost(sim_info):\n return CommonOccultType.GHOST\nelif CommonOccultUtils.is_mermaid(sim_info):\n return CommonOccultType.MERMA...
<|body_start_0|> from sims4communitylib.utils.sims.common_occult_utils import CommonOccultUtils if CommonOccultUtils.is_alien(sim_info): return CommonOccultType.ALIEN elif CommonOccultUtils.is_ghost(sim_info): return CommonOccultType.GHOST elif CommonOccultUtils.i...
Custom Occult Types enum containing all occults. DLC not required.
CommonOccultType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonOccultType: """Custom Occult Types enum containing all occults. DLC not required.""" def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': """determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_in...
stack_v2_sparse_classes_36k_train_021629
3,786
permissive
[ { "docstring": "determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return: The CommonOccultType that represents what a Sim is. :rtype: CommonOccultType", "name": "determine_occult_type", "signature": "def determine_occul...
2
stack_v2_sparse_classes_30k_train_001331
Implement the Python class `CommonOccultType` described below. Class description: Custom Occult Types enum containing all occults. DLC not required. Method signatures and docstrings: - def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': determine_occult_type(sim_info) Determine the type of Occult a Si...
Implement the Python class `CommonOccultType` described below. Class description: Custom Occult Types enum containing all occults. DLC not required. Method signatures and docstrings: - def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': determine_occult_type(sim_info) Determine the type of Occult a Si...
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
<|skeleton|> class CommonOccultType: """Custom Occult Types enum containing all occults. DLC not required.""" def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': """determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonOccultType: """Custom Occult Types enum containing all occults. DLC not required.""" def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': """determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :...
the_stack_v2_python_sparse
src/sims4communitylib/enums/common_occult_type.py
velocist/TS4CheatsInfo
train
1
9b698052a443462bb0fbc6116afe194183a62c52
[ "self.g = g\nself.visited = [False] * self.g.get_size()\nself.vertex_group = [0] * self.g.get_size()", "if self.visited[v]:\n return\nself.visited[v] = True\nself.vertex_group[v] = group\nfor vertex in g.adj(v):\n self.dfs(g, vertex, group, a_stack)\na_stack.push(v)", "a_stack = LinkedListStack()\nrg = se...
<|body_start_0|> self.g = g self.visited = [False] * self.g.get_size() self.vertex_group = [0] * self.g.get_size() <|end_body_0|> <|body_start_1|> if self.visited[v]: return self.visited[v] = True self.vertex_group[v] = group for vertex in g.adj(v): ...
class to compute connected components of given graph
StrongComponents
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StrongComponents: """class to compute connected components of given graph""" def __init__(self, g: Digraph): """init with a graph :param g: Graph""" <|body_0|> def dfs(self, g: Digraph, v: int, group: int, a_stack: Stack): """dfs to mark components from the same ...
stack_v2_sparse_classes_36k_train_021630
1,936
no_license
[ { "docstring": "init with a graph :param g: Graph", "name": "__init__", "signature": "def __init__(self, g: Digraph)" }, { "docstring": "dfs to mark components from the same group Complexity O(E + V) :param g: a graph to process :param v: starting vertex :param group: current group number :param...
4
null
Implement the Python class `StrongComponents` described below. Class description: class to compute connected components of given graph Method signatures and docstrings: - def __init__(self, g: Digraph): init with a graph :param g: Graph - def dfs(self, g: Digraph, v: int, group: int, a_stack: Stack): dfs to mark comp...
Implement the Python class `StrongComponents` described below. Class description: class to compute connected components of given graph Method signatures and docstrings: - def __init__(self, g: Digraph): init with a graph :param g: Graph - def dfs(self, g: Digraph, v: int, group: int, a_stack: Stack): dfs to mark comp...
e24f1a422a998672d1e78ba6bc23dfa5836e3a51
<|skeleton|> class StrongComponents: """class to compute connected components of given graph""" def __init__(self, g: Digraph): """init with a graph :param g: Graph""" <|body_0|> def dfs(self, g: Digraph, v: int, group: int, a_stack: Stack): """dfs to mark components from the same ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StrongComponents: """class to compute connected components of given graph""" def __init__(self, g: Digraph): """init with a graph :param g: Graph""" self.g = g self.visited = [False] * self.g.get_size() self.vertex_group = [0] * self.g.get_size() def dfs(self, g: Digr...
the_stack_v2_python_sparse
graphs/strong_components.py
mkozel92/algos_py
train
1
ab2b4fb3cb2b26299c4ab1187c2d86256866ad9f
[ "if context is None:\n context = {}\nprice_obj = self.pool.get('product.pricelist')\nproduct_obj = self.pool.get('product.product')\nproduct_brw = product and product_obj.browse(cr, uid, product, context=context)\nres = super(SaleOrderLine, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty, uom=u...
<|body_start_0|> if context is None: context = {} price_obj = self.pool.get('product.pricelist') product_obj = self.pool.get('product.product') product_brw = product and product_obj.browse(cr, uid, product, context=context) res = super(SaleOrderLine, self).product_id_...
SaleOrderLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaleOrderLine: def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None): """Overridden the method of pr...
stack_v2_sparse_classes_36k_train_021631
9,928
no_license
[ { "docstring": "Overridden the method of product line sales, to replace the unit price calculation and selection of the cost structure that handles the product, and later to filter the prices for the product selected", "name": "product_id_change", "signature": "def product_id_change(self, cr, uid, ids, ...
2
null
Implement the Python class `SaleOrderLine` described below. Class description: Implement the SaleOrderLine class. Method signatures and docstrings: - def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order...
Implement the Python class `SaleOrderLine` described below. Class description: Implement the SaleOrderLine class. Method signatures and docstrings: - def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order...
9c588e45011a87ec8d9af73535c4c56485be92f7
<|skeleton|> class SaleOrderLine: def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None): """Overridden the method of pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaleOrderLine: def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None): """Overridden the method of product line sal...
the_stack_v2_python_sparse
addons-vauxoo/price_structure/model/sale.py
OpenBusinessSolutions/odoo-fondeur-server
train
1
14032205f890d29dd0bbe830e6ebbfe6192e8be9
[ "super(SelfAttention, self).__init__()\nself.W = tf.keras.layers.Dense(units)\nself.U = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)", "ss_prev = tf.expand_dims(s_prev, axis=1)\nscore_t = self.V(tf.nn.tanh(self.W(ss_prev) + self.U(hidden_states)))\nweights = tf.nn.softmax(score_t, axis=1)\ncont...
<|body_start_0|> super(SelfAttention, self).__init__() self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) <|end_body_0|> <|body_start_1|> ss_prev = tf.expand_dims(s_prev, axis=1) score_t = self.V(tf.nn.tanh(self....
Self attention class
SelfAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: """Self attention class""" def __init__(self, units): """initialization function""" <|body_0|> def call(self, s_prev, hidden_states): """Function that returns context and weights""" <|body_1|> <|end_skeleton|> <|body_start_0|> sup...
stack_v2_sparse_classes_36k_train_021632
781
no_license
[ { "docstring": "initialization function", "name": "__init__", "signature": "def __init__(self, units)" }, { "docstring": "Function that returns context and weights", "name": "call", "signature": "def call(self, s_prev, hidden_states)" } ]
2
null
Implement the Python class `SelfAttention` described below. Class description: Self attention class Method signatures and docstrings: - def __init__(self, units): initialization function - def call(self, s_prev, hidden_states): Function that returns context and weights
Implement the Python class `SelfAttention` described below. Class description: Self attention class Method signatures and docstrings: - def __init__(self, units): initialization function - def call(self, s_prev, hidden_states): Function that returns context and weights <|skeleton|> class SelfAttention: """Self a...
9dbf8221d4eb22dbc2487cb55e84a801a38aa5c8
<|skeleton|> class SelfAttention: """Self attention class""" def __init__(self, units): """initialization function""" <|body_0|> def call(self, s_prev, hidden_states): """Function that returns context and weights""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelfAttention: """Self attention class""" def __init__(self, units): """initialization function""" super(SelfAttention, self).__init__() self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) def call(self...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/1-self_attention.py
yasmineholb/holbertonschool-machine_learning
train
0
3106cb9233ae0604f22467633ca8f556cb0207f5
[ "self._r = r\nself.rotationmap = EulerAnglesMap(eulerangles)\nself.x_rotationmap = EulerAnglesMap(eulerangles=[0, np.pi / 2, 0])", "elev, azim = self.rotationmap.invmap(elev, azim)\nelev, azim = self.x_rotationmap.invmap(elev, azim)\nrxy = self._r * np.sqrt(1 - np.sin(elev))\nx = -rxy * np.cos(azim)\ny = -rxy * n...
<|body_start_0|> self._r = r self.rotationmap = EulerAnglesMap(eulerangles) self.x_rotationmap = EulerAnglesMap(eulerangles=[0, np.pi / 2, 0]) <|end_body_0|> <|body_start_1|> elev, azim = self.rotationmap.invmap(elev, azim) elev, azim = self.x_rotationmap.invmap(elev, azim) ...
https://en.wikipedia.org/wiki/Albers_projection Compared to the entry of 8/21/2015 (numbers were chosen to have simpler formulas) phi1 = 90, phi2 = 0, phi0 = 90, lambda0 = 90 lambda <- 2n (lambda - lambda0) (doubles the area) => n = 0.5 rho0 = 0, C = 1, rho = 2sqrt(1-sin(phi))
AlbersProjectionMap
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlbersProjectionMap: """https://en.wikipedia.org/wiki/Albers_projection Compared to the entry of 8/21/2015 (numbers were chosen to have simpler formulas) phi1 = 90, phi2 = 0, phi0 = 90, lambda0 = 90 lambda <- 2n (lambda - lambda0) (doubles the area) => n = 0.5 rho0 = 0, C = 1, rho = 2sqrt(1-sin(p...
stack_v2_sparse_classes_36k_train_021633
16,243
permissive
[ { "docstring": "r: radious of the sphere from which the projection is made", "name": "__init__", "signature": "def __init__(self, r, eulerangles=None)" }, { "docstring": "Returns (nan, nan) if point cannot be mapped else (x, y) arguments can be numpy arrays or scalars", "name": "map", "s...
3
stack_v2_sparse_classes_30k_train_007998
Implement the Python class `AlbersProjectionMap` described below. Class description: https://en.wikipedia.org/wiki/Albers_projection Compared to the entry of 8/21/2015 (numbers were chosen to have simpler formulas) phi1 = 90, phi2 = 0, phi0 = 90, lambda0 = 90 lambda <- 2n (lambda - lambda0) (doubles the area) => n = 0...
Implement the Python class `AlbersProjectionMap` described below. Class description: https://en.wikipedia.org/wiki/Albers_projection Compared to the entry of 8/21/2015 (numbers were chosen to have simpler formulas) phi1 = 90, phi2 = 0, phi0 = 90, lambda0 = 90 lambda <- 2n (lambda - lambda0) (doubles the area) => n = 0...
fdab351e6c5530c8f051193158856ba6ef11d715
<|skeleton|> class AlbersProjectionMap: """https://en.wikipedia.org/wiki/Albers_projection Compared to the entry of 8/21/2015 (numbers were chosen to have simpler formulas) phi1 = 90, phi2 = 0, phi0 = 90, lambda0 = 90 lambda <- 2n (lambda - lambda0) (doubles the area) => n = 0.5 rho0 = 0, C = 1, rho = 2sqrt(1-sin(p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlbersProjectionMap: """https://en.wikipedia.org/wiki/Albers_projection Compared to the entry of 8/21/2015 (numbers were chosen to have simpler formulas) phi1 = 90, phi2 = 0, phi0 = 90, lambda0 = 90 lambda <- 2n (lambda - lambda0) (doubles the area) => n = 0.5 rho0 = 0, C = 1, rho = 2sqrt(1-sin(phi))""" ...
the_stack_v2_python_sparse
retina/screen/map/mapimpl.py
neurokernel/retina
train
5
4c69e8367160f8f4d615dfb53444a14518d9991f
[ "rng = np.random.default_rng(self.seed)\nself.seeds_ = {'train_test': rng.integers(MAX_RAND_SEED), 'kfold_shuffle': rng.integers(MAX_RAND_SEED), 'tensorflow': rng.integers(MAX_RAND_SEED)}\ntensorflow.random.set_seed(self.seeds_['tensorflow'])\nself.logger.info('Running %s', self)\nstart = time.perf_counter()\nX, y ...
<|body_start_0|> rng = np.random.default_rng(self.seed) self.seeds_ = {'train_test': rng.integers(MAX_RAND_SEED), 'kfold_shuffle': rng.integers(MAX_RAND_SEED), 'tensorflow': rng.integers(MAX_RAND_SEED)} tensorflow.random.set_seed(self.seeds_['tensorflow']) self.logger.info('Running %s', ...
An experiment to evalute hyperparameter tuned DF classifier.
Experiment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Experiment: """An experiment to evalute hyperparameter tuned DF classifier.""" def run(self): """Run hyperparameter tuning for the DeepFingerprinting classifier and return the prediction probabilities for the best chosen classifier.""" <|body_0|> def tune_hyperparameters...
stack_v2_sparse_classes_36k_train_021634
8,806
permissive
[ { "docstring": "Run hyperparameter tuning for the DeepFingerprinting classifier and return the prediction probabilities for the best chosen classifier.", "name": "run", "signature": "def run(self)" }, { "docstring": "Perform hyperparameter tuning on the learning rate.", "name": "tune_hyperpa...
3
stack_v2_sparse_classes_30k_train_020225
Implement the Python class `Experiment` described below. Class description: An experiment to evalute hyperparameter tuned DF classifier. Method signatures and docstrings: - def run(self): Run hyperparameter tuning for the DeepFingerprinting classifier and return the prediction probabilities for the best chosen classi...
Implement the Python class `Experiment` described below. Class description: An experiment to evalute hyperparameter tuned DF classifier. Method signatures and docstrings: - def run(self): Run hyperparameter tuning for the DeepFingerprinting classifier and return the prediction probabilities for the best chosen classi...
61f0ceedad70b2be7609f3a02f1fc4115265d910
<|skeleton|> class Experiment: """An experiment to evalute hyperparameter tuned DF classifier.""" def run(self): """Run hyperparameter tuning for the DeepFingerprinting classifier and return the prediction probabilities for the best chosen classifier.""" <|body_0|> def tune_hyperparameters...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Experiment: """An experiment to evalute hyperparameter tuned DF classifier.""" def run(self): """Run hyperparameter tuning for the DeepFingerprinting classifier and return the prediction probabilities for the best chosen classifier.""" rng = np.random.default_rng(self.seed) self.s...
the_stack_v2_python_sparse
workflow/scripts/evaluate_tuned_df.py
jpcsmith/qcsd-experiments
train
2
a9b6c84a463b105cb5a0e5c3998d90d284e2080b
[ "self.config = config\nself.toutiao_similarity = toutiao_similarity(config)\nself.toutiao_cold_start = toutiao_cold_start(config)\nself.toutiao_hot_article = toutiao_hot_article(config)\nself.user_view_history = user_view_history(config)", "recent_view = self.user_view_history.get_user_view_history(usid, article_...
<|body_start_0|> self.config = config self.toutiao_similarity = toutiao_similarity(config) self.toutiao_cold_start = toutiao_cold_start(config) self.toutiao_hot_article = toutiao_hot_article(config) self.user_view_history = user_view_history(config) <|end_body_0|> <|body_start_1...
default_feed
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class default_feed: def __init__(self, config): """初始化""" <|body_0|> def get_similarity_articles(self, usid, article_no): """获得文章""" <|body_1|> def get_cold_start_articles(self, article_no, column=None, stage=None): """获得文章 column:栏目 stage:对应的阶段""" ...
stack_v2_sparse_classes_36k_train_021635
3,413
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "获得文章", "name": "get_similarity_articles", "signature": "def get_similarity_articles(self, usid, article_no)" }, { "docstring": "获得文章 column:栏目 stage:对应的阶段", "name": "get_col...
5
stack_v2_sparse_classes_30k_train_015008
Implement the Python class `default_feed` described below. Class description: Implement the default_feed class. Method signatures and docstrings: - def __init__(self, config): 初始化 - def get_similarity_articles(self, usid, article_no): 获得文章 - def get_cold_start_articles(self, article_no, column=None, stage=None): 获得文章...
Implement the Python class `default_feed` described below. Class description: Implement the default_feed class. Method signatures and docstrings: - def __init__(self, config): 初始化 - def get_similarity_articles(self, usid, article_no): 获得文章 - def get_cold_start_articles(self, article_no, column=None, stage=None): 获得文章...
c3df9ad7f6e95d076f6fcd437c2391738ae55e47
<|skeleton|> class default_feed: def __init__(self, config): """初始化""" <|body_0|> def get_similarity_articles(self, usid, article_no): """获得文章""" <|body_1|> def get_cold_start_articles(self, article_no, column=None, stage=None): """获得文章 column:栏目 stage:对应的阶段""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class default_feed: def __init__(self, config): """初始化""" self.config = config self.toutiao_similarity = toutiao_similarity(config) self.toutiao_cold_start = toutiao_cold_start(config) self.toutiao_hot_article = toutiao_hot_article(config) self.user_view_history = use...
the_stack_v2_python_sparse
toutiao_processor/processor/default_feed.py
cash2one/toutiao-1
train
0
c3de7388bd76854e8b231a7906d56ce8741421d2
[ "self.sensor = Sensor('127.0.0.1', 1111)\nself.pump = Pump('127.0.0.1', 2222)\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)\nself.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump.PUMP_OUT, 'PUMP_OFF': self.pump.PUMP_OFF}", "height = 50\ncur_ac...
<|body_start_0|> self.sensor = Sensor('127.0.0.1', 1111) self.pump = Pump('127.0.0.1', 2222) self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self.decider) self.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump.PUMP_OUT, 'PUMP_OF...
Unit tests for the Controller class
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Create dummy instance""" <|body_0|> def test_tick(self): """Test behavior of tick method""" <|body_1|> def test_fail(self): """Test for exception in controller.tic...
stack_v2_sparse_classes_36k_train_021636
4,886
no_license
[ { "docstring": "Create dummy instance", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test behavior of tick method", "name": "test_tick", "signature": "def test_tick(self)" }, { "docstring": "Test for exception in controller.tick method", "name": "test_fa...
3
stack_v2_sparse_classes_30k_train_011317
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): Create dummy instance - def test_tick(self): Test behavior of tick method - def test_fail(self): Test for exception in controller.tick method
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): Create dummy instance - def test_tick(self): Test behavior of tick method - def test_fail(self): Test for exception in controller.tick method <|ske...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Create dummy instance""" <|body_0|> def test_tick(self): """Test behavior of tick method""" <|body_1|> def test_fail(self): """Test for exception in controller.tic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """Create dummy instance""" self.sensor = Sensor('127.0.0.1', 1111) self.pump = Pump('127.0.0.1', 2222) self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump...
the_stack_v2_python_sparse
students/tbrackney/Lesson6/water-regulation/waterregulation/test.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
2dbfc183a5864f6724f23a69cc44bc9a53a2156b
[ "pub_rec = super(pub_history, self).create(vals)\nif not pub_rec.accommodation_id.state == 'open' and 'renewed':\n raise ValidationError(_(\"Cannot import pub file in state '%s' for this accommodation\") % pub_rec.accommodation_id.state)\nreturn pub_rec", "emp_list = []\nemp_bed = 0\nfor pub_brw in self:\n ...
<|body_start_0|> pub_rec = super(pub_history, self).create(vals) if not pub_rec.accommodation_id.state == 'open' and 'renewed': raise ValidationError(_("Cannot import pub file in state '%s' for this accommodation") % pub_rec.accommodation_id.state) return pub_rec <|end_body_0|> <|b...
pub_history
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pub_history: def create(self, vals): """The method used to create new record at time check the accommodation state If accommodation state is open or renewed at time Validation error generate. --------------------------------------------------------------------------- @param self: Record ...
stack_v2_sparse_classes_36k_train_021637
24,603
no_license
[ { "docstring": "The method used to create new record at time check the accommodation state If accommodation state is open or renewed at time Validation error generate. --------------------------------------------------------------------------- @param self: Record set @multi : The decorator of multi @return: Tru...
2
stack_v2_sparse_classes_30k_train_009001
Implement the Python class `pub_history` described below. Class description: Implement the pub_history class. Method signatures and docstrings: - def create(self, vals): The method used to create new record at time check the accommodation state If accommodation state is open or renewed at time Validation error genera...
Implement the Python class `pub_history` described below. Class description: Implement the pub_history class. Method signatures and docstrings: - def create(self, vals): The method used to create new record at time check the accommodation state If accommodation state is open or renewed at time Validation error genera...
46e15330b5d642053da61754247f3fbf9d02717e
<|skeleton|> class pub_history: def create(self, vals): """The method used to create new record at time check the accommodation state If accommodation state is open or renewed at time Validation error generate. --------------------------------------------------------------------------- @param self: Record ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class pub_history: def create(self, vals): """The method used to create new record at time check the accommodation state If accommodation state is open or renewed at time Validation error generate. --------------------------------------------------------------------------- @param self: Record set @multi : T...
the_stack_v2_python_sparse
core/sg_accommodation/models/accommodation_agreement.py
Muhammad-SF/Test
train
0
5f11c07573ac6c63f2a45973ca0ad953e6034b37
[ "if self.dbconn.version < 90300:\n return\nsuper(EventTriggerDict, self)._from_catalog()", "for key in intriggers:\n if not key.startswith('event trigger '):\n raise KeyError('Unrecognized object type: %s' % key)\n trg = key[14:]\n inobj = intriggers[key]\n if not inobj:\n raise Value...
<|body_start_0|> if self.dbconn.version < 90300: return super(EventTriggerDict, self)._from_catalog() <|end_body_0|> <|body_start_1|> for key in intriggers: if not key.startswith('event trigger '): raise KeyError('Unrecognized object type: %s' % key) ...
The collection of event triggers in a database
EventTriggerDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventTriggerDict: """The collection of event triggers in a database""" def _from_catalog(self): """Initialize the dictionary of triggers by querying the catalogs""" <|body_0|> def from_map(self, intriggers, newdb): """Initialize the dictionary of triggers by conv...
stack_v2_sparse_classes_36k_train_021638
5,108
permissive
[ { "docstring": "Initialize the dictionary of triggers by querying the catalogs", "name": "_from_catalog", "signature": "def _from_catalog(self)" }, { "docstring": "Initialize the dictionary of triggers by converting the input map :param intriggers: YAML map defining the event triggers :param new...
2
stack_v2_sparse_classes_30k_train_014126
Implement the Python class `EventTriggerDict` described below. Class description: The collection of event triggers in a database Method signatures and docstrings: - def _from_catalog(self): Initialize the dictionary of triggers by querying the catalogs - def from_map(self, intriggers, newdb): Initialize the dictionar...
Implement the Python class `EventTriggerDict` described below. Class description: The collection of event triggers in a database Method signatures and docstrings: - def _from_catalog(self): Initialize the dictionary of triggers by querying the catalogs - def from_map(self, intriggers, newdb): Initialize the dictionar...
ec682513d5256e383647f38f7fba29530cfb9fbe
<|skeleton|> class EventTriggerDict: """The collection of event triggers in a database""" def _from_catalog(self): """Initialize the dictionary of triggers by querying the catalogs""" <|body_0|> def from_map(self, intriggers, newdb): """Initialize the dictionary of triggers by conv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventTriggerDict: """The collection of event triggers in a database""" def _from_catalog(self): """Initialize the dictionary of triggers by querying the catalogs""" if self.dbconn.version < 90300: return super(EventTriggerDict, self)._from_catalog() def from_map(s...
the_stack_v2_python_sparse
pyrseas/dbobject/eventtrig.py
perseas/Pyrseas
train
323
1e471f9f14face543d7994a2f9edbe03938b69f7
[ "if root is None:\n return []\nresult = []\n\ndef dfs(root, total, path):\n if root.left is None and root.right is None and (total == sum):\n result.append(path[:])\n if root.left:\n path.append(root.left.val)\n dfs(root.left, total + root.left.val, path)\n path.pop()\n if ro...
<|body_start_0|> if root is None: return [] result = [] def dfs(root, total, path): if root.left is None and root.right is None and (total == sum): result.append(path[:]) if root.left: path.append(root.left.val) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """DFS, Time: O(n), Space: O(n)""" <|body_0|> def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """BFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_021639
1,566
no_license
[ { "docstring": "DFS, Time: O(n), Space: O(n)", "name": "pathSum", "signature": "def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]" }, { "docstring": "BFS, Time: O(n), Space: O(n)", "name": "pathSum", "signature": "def pathSum(self, root: TreeNode, sum: int) -> List[List[int]...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: DFS, Time: O(n), Space: O(n) - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: BFS, Time: O(n), Sp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: DFS, Time: O(n), Space: O(n) - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: BFS, Time: O(n), Sp...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """DFS, Time: O(n), Space: O(n)""" <|body_0|> def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """BFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """DFS, Time: O(n), Space: O(n)""" if root is None: return [] result = [] def dfs(root, total, path): if root.left is None and root.right is None and (total == sum): ...
the_stack_v2_python_sparse
python/113-Path Sum II.py
cwza/leetcode
train
0
1ab50e97029b5ef114669fcc91fe0c8cef63746f
[ "rev = ''\nn = len(num)\nfor i in range(n - 1, -1, -1):\n if num[i] in '23457':\n return False\n if num[i] in '018':\n rev += num[i]\n if num[i] == '6':\n rev += '9'\n if num[i] == '9':\n rev += '6'\nreturn num == rev", "evenMidCandidate = ['11', '69', '88', '96', '00']\nod...
<|body_start_0|> rev = '' n = len(num) for i in range(n - 1, -1, -1): if num[i] in '23457': return False if num[i] in '018': rev += num[i] if num[i] == '6': rev += '9' if num[i] == '9': ...
https://leetcode.com/problems/strobogrammatic-number-ii/discuss/67275/Python-recursive-solution-need-some-observation-so-far-97
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/strobogrammatic-number-ii/discuss/67275/Python-recursive-solution-need-some-observation-so-far-97""" def isStrobogrammatic(self, num): """:type num: str :rtype: bool""" <|body_0|> def findStrobogrammatic(self, n): """:ty...
stack_v2_sparse_classes_36k_train_021640
1,360
no_license
[ { "docstring": ":type num: str :rtype: bool", "name": "isStrobogrammatic", "signature": "def isStrobogrammatic(self, num)" }, { "docstring": ":type n: int :rtype: List[str]", "name": "findStrobogrammatic", "signature": "def findStrobogrammatic(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/strobogrammatic-number-ii/discuss/67275/Python-recursive-solution-need-some-observation-so-far-97 Method signatures and docstrings: - def isStrobogrammatic(self, num): :type num: str :rtype: bool - def findStrobogr...
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/strobogrammatic-number-ii/discuss/67275/Python-recursive-solution-need-some-observation-so-far-97 Method signatures and docstrings: - def isStrobogrammatic(self, num): :type num: str :rtype: bool - def findStrobogr...
877933424e6d2c590d6ac53db18bee951a3d9de4
<|skeleton|> class Solution: """https://leetcode.com/problems/strobogrammatic-number-ii/discuss/67275/Python-recursive-solution-need-some-observation-so-far-97""" def isStrobogrammatic(self, num): """:type num: str :rtype: bool""" <|body_0|> def findStrobogrammatic(self, n): """:ty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """https://leetcode.com/problems/strobogrammatic-number-ii/discuss/67275/Python-recursive-solution-need-some-observation-so-far-97""" def isStrobogrammatic(self, num): """:type num: str :rtype: bool""" rev = '' n = len(num) for i in range(n - 1, -1, -1): ...
the_stack_v2_python_sparse
leetcode/247.strobogrammatic-number-ii.py
siddhism/leetcode
train
0
b7650fc1ccb111269ec2f0e2869375396cbb3be3
[ "prototypes_, omegas_ = model.get_model_params()\nprototypes_labels_ = model.prototypes_labels_\ndistance_function = 'mahalanobis'\nkwarg_str = 'VI'\nif model.force_all_finite == 'allow-nan':\n distance_function = _nan_mahalanobis\n kwarg_str = 'RM'\ncdists = np.zeros((data.shape[0], model._prototypes_shape[0...
<|body_start_0|> prototypes_, omegas_ = model.get_model_params() prototypes_labels_ = model.prototypes_labels_ distance_function = 'mahalanobis' kwarg_str = 'VI' if model.force_all_finite == 'allow-nan': distance_function = _nan_mahalanobis kwarg_str = 'RM...
Local adaptive squared Euclidean distance Class that holds the localized adaptive squared Euclidean distance function and its gradient as described in `[1]`_ and `[2]`_. Parameters ---------- force_all_finite : {True, False, "allow-nan"} Parameter to indicate that NaNLVQ distance variant should be used. If true no nans...
LocalAdaptiveSquaredEuclidean
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalAdaptiveSquaredEuclidean: """Local adaptive squared Euclidean distance Class that holds the localized adaptive squared Euclidean distance function and its gradient as described in `[1]`_ and `[2]`_. Parameters ---------- force_all_finite : {True, False, "allow-nan"} Parameter to indicate tha...
stack_v2_sparse_classes_36k_train_021641
5,929
permissive
[ { "docstring": "Computes the local variant of the adaptive squared Euclidean distance: .. math:: d^{\\\\Lambda}(\\\\mathbf{w}, \\\\mathbf{x}) = (\\\\mathbf{x} - \\\\mathbf{w})^{\\\\top} \\\\Omega_j^{\\\\top} \\\\Omega_j (\\\\mathbf{x} - \\\\mathbf{w}) with :math:`\\\\Omega_j` depending on the localization setti...
2
stack_v2_sparse_classes_30k_train_004739
Implement the Python class `LocalAdaptiveSquaredEuclidean` described below. Class description: Local adaptive squared Euclidean distance Class that holds the localized adaptive squared Euclidean distance function and its gradient as described in `[1]`_ and `[2]`_. Parameters ---------- force_all_finite : {True, False,...
Implement the Python class `LocalAdaptiveSquaredEuclidean` described below. Class description: Local adaptive squared Euclidean distance Class that holds the localized adaptive squared Euclidean distance function and its gradient as described in `[1]`_ and `[2]`_. Parameters ---------- force_all_finite : {True, False,...
9b64b15e0a7db3de90fd80ccc66ed6cdf2cc5ddb
<|skeleton|> class LocalAdaptiveSquaredEuclidean: """Local adaptive squared Euclidean distance Class that holds the localized adaptive squared Euclidean distance function and its gradient as described in `[1]`_ and `[2]`_. Parameters ---------- force_all_finite : {True, False, "allow-nan"} Parameter to indicate tha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocalAdaptiveSquaredEuclidean: """Local adaptive squared Euclidean distance Class that holds the localized adaptive squared Euclidean distance function and its gradient as described in `[1]`_ and `[2]`_. Parameters ---------- force_all_finite : {True, False, "allow-nan"} Parameter to indicate that NaNLVQ dist...
the_stack_v2_python_sparse
sklvq/distances/_local_adaptive_squared_euclidean.py
SarahFallmann/sklvq
train
0
feeb72ca2828586d3f4c40b744db01ba94a9a3e9
[ "super(Var, self).__init__(trigger, element)\nself._log = logging.getLogger('agentml.parser.tags.var')\nwith open(os.path.join(self.trigger.agentml.script_path, 'schemas', 'tags', 'var.rng')) as file:\n self.schema = schema(file.read())\nself.type = attribute(element, 'type', 'user')", "if len(self._element):\...
<|body_start_0|> super(Var, self).__init__(trigger, element) self._log = logging.getLogger('agentml.parser.tags.var') with open(os.path.join(self.trigger.agentml.script_path, 'schemas', 'tags', 'var.rng')) as file: self.schema = schema(file.read()) self.type = attribute(eleme...
Var
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Var: def __init__(self, trigger, element): """Initialize a new Random Tag instance :param trigger: The executing Trigger instance :type trigger: parser.trigger.Trigger :param element: The XML Element object :type element: etree._Element""" <|body_0|> def value(self): ...
stack_v2_sparse_classes_36k_train_021642
2,089
permissive
[ { "docstring": "Initialize a new Random Tag instance :param trigger: The executing Trigger instance :type trigger: parser.trigger.Trigger :param element: The XML Element object :type element: etree._Element", "name": "__init__", "signature": "def __init__(self, trigger, element)" }, { "docstring...
2
stack_v2_sparse_classes_30k_train_004130
Implement the Python class `Var` described below. Class description: Implement the Var class. Method signatures and docstrings: - def __init__(self, trigger, element): Initialize a new Random Tag instance :param trigger: The executing Trigger instance :type trigger: parser.trigger.Trigger :param element: The XML Elem...
Implement the Python class `Var` described below. Class description: Implement the Var class. Method signatures and docstrings: - def __init__(self, trigger, element): Initialize a new Random Tag instance :param trigger: The executing Trigger instance :type trigger: parser.trigger.Trigger :param element: The XML Elem...
209665f27913232433f9b69bdff282ff5e49b7bb
<|skeleton|> class Var: def __init__(self, trigger, element): """Initialize a new Random Tag instance :param trigger: The executing Trigger instance :type trigger: parser.trigger.Trigger :param element: The XML Element object :type element: etree._Element""" <|body_0|> def value(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Var: def __init__(self, trigger, element): """Initialize a new Random Tag instance :param trigger: The executing Trigger instance :type trigger: parser.trigger.Trigger :param element: The XML Element object :type element: etree._Element""" super(Var, self).__init__(trigger, element) se...
the_stack_v2_python_sparse
agentml/parser/tags/var.py
Python3pkg/AgentML
train
0
18ec761307b47ac4ef9f348a44926e0618eb4238
[ "def next_greater(num):\n s = list(str(num))\n l = len(s)\n for i in range(l - 2, -1, -1):\n for j in range(l - 1, i, -1):\n if int(s[j]) > int(s[i]):\n s[i], s[j] = (s[j], s[i])\n s_2 = sorted(s[i + 1:])\n s = s[0:i + 1] + s_2\n ...
<|body_start_0|> def next_greater(num): s = list(str(num)) l = len(s) for i in range(l - 2, -1, -1): for j in range(l - 1, i, -1): if int(s[j]) > int(s[i]): s[i], s[j] = (s[j], s[i]) s_2 = sor...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreaterElement(self, n): """:type n: int :rtype: int 32ms""" <|body_0|> def nextGreaterElement_1(self, n): """:type n: int :rtype: int 29ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> def next_greater(num): s = list...
stack_v2_sparse_classes_36k_train_021643
2,204
no_license
[ { "docstring": ":type n: int :rtype: int 32ms", "name": "nextGreaterElement", "signature": "def nextGreaterElement(self, n)" }, { "docstring": ":type n: int :rtype: int 29ms", "name": "nextGreaterElement_1", "signature": "def nextGreaterElement_1(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElement(self, n): :type n: int :rtype: int 32ms - def nextGreaterElement_1(self, n): :type n: int :rtype: int 29ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElement(self, n): :type n: int :rtype: int 32ms - def nextGreaterElement_1(self, n): :type n: int :rtype: int 29ms <|skeleton|> class Solution: def nextGreat...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def nextGreaterElement(self, n): """:type n: int :rtype: int 32ms""" <|body_0|> def nextGreaterElement_1(self, n): """:type n: int :rtype: int 29ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextGreaterElement(self, n): """:type n: int :rtype: int 32ms""" def next_greater(num): s = list(str(num)) l = len(s) for i in range(l - 2, -1, -1): for j in range(l - 1, i, -1): if int(s[j]) > int(s[i]): ...
the_stack_v2_python_sparse
NextGreaterElementIII_MID_556.py
953250587/leetcode-python
train
2
9c9858688c11fd8449d1ba76dda49f5e2dd41678
[ "cur_x = 1\nans_list = set()\nwhile cur_x <= bound:\n cur_y = 1\n temp = cur_x + cur_y\n while temp <= bound:\n ans_list.add(temp)\n cur_y *= y\n temp = cur_x + cur_y\n if cur_y == 1:\n break\n cur_x *= x\n if cur_x == 1:\n break\nreturn list(ans_list)", ...
<|body_start_0|> cur_x = 1 ans_list = set() while cur_x <= bound: cur_y = 1 temp = cur_x + cur_y while temp <= bound: ans_list.add(temp) cur_y *= y temp = cur_x + cur_y if cur_y == 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def powerfulIntegers(self, x, y, bound): """:type x: int :type y: int :type bound: int :rtype: List[int] 32 ms 11.7 MB""" <|body_0|> def powerfulIntegers_1(self, x, y, bound): """24 ms 12 MB :param x: :param y: :param bound: :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_021644
2,220
no_license
[ { "docstring": ":type x: int :type y: int :type bound: int :rtype: List[int] 32 ms 11.7 MB", "name": "powerfulIntegers", "signature": "def powerfulIntegers(self, x, y, bound)" }, { "docstring": "24 ms 12 MB :param x: :param y: :param bound: :return:", "name": "powerfulIntegers_1", "signa...
2
stack_v2_sparse_classes_30k_train_017530
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def powerfulIntegers(self, x, y, bound): :type x: int :type y: int :type bound: int :rtype: List[int] 32 ms 11.7 MB - def powerfulIntegers_1(self, x, y, bound): 24 ms 12 MB :para...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def powerfulIntegers(self, x, y, bound): :type x: int :type y: int :type bound: int :rtype: List[int] 32 ms 11.7 MB - def powerfulIntegers_1(self, x, y, bound): 24 ms 12 MB :para...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def powerfulIntegers(self, x, y, bound): """:type x: int :type y: int :type bound: int :rtype: List[int] 32 ms 11.7 MB""" <|body_0|> def powerfulIntegers_1(self, x, y, bound): """24 ms 12 MB :param x: :param y: :param bound: :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def powerfulIntegers(self, x, y, bound): """:type x: int :type y: int :type bound: int :rtype: List[int] 32 ms 11.7 MB""" cur_x = 1 ans_list = set() while cur_x <= bound: cur_y = 1 temp = cur_x + cur_y while temp <= bound: ...
the_stack_v2_python_sparse
PowerfulIntegers_970.py
953250587/leetcode-python
train
2
da707a7b44bfe1e8de80614b5106c3280fd18356
[ "self.plot_length = 100\nself.xdata = deque(maxlen=self.plot_length)\nself.timeCtr = 0\nself.ydata = deque(maxlen=self.plot_length)\nself.plotting = 0\nself.canvas = canvas\nself.sampleRate = sampleRate\nself.bufferSize = max(int(sampleRate) + 1, bufferSize)", "self.readthread = APDIn.ReadAPD('Dev1/ctr0', self.sa...
<|body_start_0|> self.plot_length = 100 self.xdata = deque(maxlen=self.plot_length) self.timeCtr = 0 self.ydata = deque(maxlen=self.plot_length) self.plotting = 0 self.canvas = canvas self.sampleRate = sampleRate self.bufferSize = max(int(sampleRate) + 1, ...
PlotAPD
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotAPD: def __init__(self, canvas=None, sampleRate=1000.0, bufferSize=1): """:param canvas: canvas to plot on. Supply one if calling from GUI, if not a pyplot plot is created :param sampleRate: Samples/sec to read from apd :param timePerPt: time to average over these samples per plotted...
stack_v2_sparse_classes_36k_train_021645
4,897
no_license
[ { "docstring": ":param canvas: canvas to plot on. Supply one if calling from GUI, if not a pyplot plot is created :param sampleRate: Samples/sec to read from apd :param timePerPt: time to average over these samples per plotted pt", "name": "__init__", "signature": "def __init__(self, canvas=None, sample...
5
stack_v2_sparse_classes_30k_test_000893
Implement the Python class `PlotAPD` described below. Class description: Implement the PlotAPD class. Method signatures and docstrings: - def __init__(self, canvas=None, sampleRate=1000.0, bufferSize=1): :param canvas: canvas to plot on. Supply one if calling from GUI, if not a pyplot plot is created :param sampleRat...
Implement the Python class `PlotAPD` described below. Class description: Implement the PlotAPD class. Method signatures and docstrings: - def __init__(self, canvas=None, sampleRate=1000.0, bufferSize=1): :param canvas: canvas to plot on. Supply one if calling from GUI, if not a pyplot plot is created :param sampleRat...
12fc680e453ad13fca152a8b900b377d52efdceb
<|skeleton|> class PlotAPD: def __init__(self, canvas=None, sampleRate=1000.0, bufferSize=1): """:param canvas: canvas to plot on. Supply one if calling from GUI, if not a pyplot plot is created :param sampleRate: Samples/sec to read from apd :param timePerPt: time to average over these samples per plotted...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlotAPD: def __init__(self, canvas=None, sampleRate=1000.0, bufferSize=1): """:param canvas: canvas to plot on. Supply one if calling from GUI, if not a pyplot plot is created :param sampleRate: Samples/sec to read from apd :param timePerPt: time to average over these samples per plotted pt""" ...
the_stack_v2_python_sparse
src/old_gui/PlotAPDCounts3.py
EdwardBetts/PythonLab
train
0
a3de877fec13032852c021fc485642379193978b
[ "self.val = val\nself.left = left\nself.right = right\nself.next = next", "if not root:\n return root\nqueue = [root]\nwhile len(queue) > 0:\n queue_size = len(queue)\n cur = queue.pop(0)\n if cur.left:\n queue.append(cur.left)\n if cur.right:\n queue.append(cur.right)\n if queue_s...
<|body_start_0|> self.val = val self.left = left self.right = right self.next = next <|end_body_0|> <|body_start_1|> if not root: return root queue = [root] while len(queue) > 0: queue_size = len(queue) cur = queue.pop(0) ...
二叉树的节点定义
TreeNode1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeNode1: """二叉树的节点定义""" def __init__(self, val=0, left=None, right=None, next=None): """:param val: :param left: :param right: :param next:""" <|body_0|> def connect(self, root): """:type root: Node :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_021646
1,276
no_license
[ { "docstring": ":param val: :param left: :param right: :param next:", "name": "__init__", "signature": "def __init__(self, val=0, left=None, right=None, next=None)" }, { "docstring": ":type root: Node :rtype: Node", "name": "connect", "signature": "def connect(self, root)" } ]
2
null
Implement the Python class `TreeNode1` described below. Class description: 二叉树的节点定义 Method signatures and docstrings: - def __init__(self, val=0, left=None, right=None, next=None): :param val: :param left: :param right: :param next: - def connect(self, root): :type root: Node :rtype: Node
Implement the Python class `TreeNode1` described below. Class description: 二叉树的节点定义 Method signatures and docstrings: - def __init__(self, val=0, left=None, right=None, next=None): :param val: :param left: :param right: :param next: - def connect(self, root): :type root: Node :rtype: Node <|skeleton|> class TreeNode...
a75310a96d2b165b15d5ee10ec409a17cdc880ba
<|skeleton|> class TreeNode1: """二叉树的节点定义""" def __init__(self, val=0, left=None, right=None, next=None): """:param val: :param left: :param right: :param next:""" <|body_0|> def connect(self, root): """:type root: Node :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeNode1: """二叉树的节点定义""" def __init__(self, val=0, left=None, right=None, next=None): """:param val: :param left: :param right: :param next:""" self.val = val self.left = left self.right = right self.next = next def connect(self, root): """:type root:...
the_stack_v2_python_sparse
leetcode/tree/code/fill_next_one.py
skyxyz-lang/CS_Note
train
0
97fa7925d1cc7cf74a2d0f2e9cba9ca938ccee08
[ "try:\n config_dict = {'server': 'https://cmsweb.cern.ch/', 'database': 'registration', 'cacheduration': 1}\n config_dict.update(cfg_dict)\n self.server = CouchServer(config_dict['server'])\n self.db = self.server.connectDatabase(config_dict['database'])\n if 'location' not in reg_info.keys():\n ...
<|body_start_0|> try: config_dict = {'server': 'https://cmsweb.cern.ch/', 'database': 'registration', 'cacheduration': 1} config_dict.update(cfg_dict) self.server = CouchServer(config_dict['server']) self.db = self.server.connectDatabase(config_dict['database']) ...
Registration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Registration: def __init__(self, cfg_dict={}, reg_info={}): """Initialise the regsvc for this component,""" <|body_0|> def report(self): """'Ping' the RegSvc with a doc containing the service doc's ID and a timestamp, this can be used to provide uptime information.""...
stack_v2_sparse_classes_36k_train_021647
2,691
no_license
[ { "docstring": "Initialise the regsvc for this component,", "name": "__init__", "signature": "def __init__(self, cfg_dict={}, reg_info={})" }, { "docstring": "'Ping' the RegSvc with a doc containing the service doc's ID and a timestamp, this can be used to provide uptime information.", "name...
2
null
Implement the Python class `Registration` described below. Class description: Implement the Registration class. Method signatures and docstrings: - def __init__(self, cfg_dict={}, reg_info={}): Initialise the regsvc for this component, - def report(self): 'Ping' the RegSvc with a doc containing the service doc's ID a...
Implement the Python class `Registration` described below. Class description: Implement the Registration class. Method signatures and docstrings: - def __init__(self, cfg_dict={}, reg_info={}): Initialise the regsvc for this component, - def report(self): 'Ping' the RegSvc with a doc containing the service doc's ID a...
f4cb398de940560e40491ba676b704e1489d4682
<|skeleton|> class Registration: def __init__(self, cfg_dict={}, reg_info={}): """Initialise the regsvc for this component,""" <|body_0|> def report(self): """'Ping' the RegSvc with a doc containing the service doc's ID and a timestamp, this can be used to provide uptime information.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Registration: def __init__(self, cfg_dict={}, reg_info={}): """Initialise the regsvc for this component,""" try: config_dict = {'server': 'https://cmsweb.cern.ch/', 'database': 'registration', 'cacheduration': 1} config_dict.update(cfg_dict) self.server = Co...
the_stack_v2_python_sparse
src/python/WMCore/Services/Registration/Registration.py
PerilousApricot/WMCore
train
1
6f87a54be811efa5ad25d8d8097193fdb82927e0
[ "base.Action.__init__(self, self.__saveOverlay)\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx\nself.__name = '{}_{}'.format(type(self).__name__, id(self))\ndisplayCtx.addListener('selectedOverlay', self.__name, self.__selectedOverlayChanged)\noverlayList.addListener('overlays', self.__name, self...
<|body_start_0|> base.Action.__init__(self, self.__saveOverlay) self.__overlayList = overlayList self.__displayCtx = displayCtx self.__name = '{}_{}'.format(type(self).__name__, id(self)) displayCtx.addListener('selectedOverlay', self.__name, self.__selectedOverlayChanged) ...
The ``SaveOverlayAction`` allows the user to save the currently selected overlay, if it has been edited, or only exists in memory.
SaveOverlayAction
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveOverlayAction: """The ``SaveOverlayAction`` allows the user to save the currently selected overlay, if it has been edited, or only exists in memory.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``SaveOverlayAction``. :arg overlayList: The :class:`.OverlayLis...
stack_v2_sparse_classes_36k_train_021648
9,300
permissive
[ { "docstring": "Create a ``SaveOverlayAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`. :arg frame: The :class:`.FSLeyesFrame`.", "name": "__init__", "signature": "def __init__(self, overlayList, displayCtx, frame)" }, { "docstring": "Removes l...
5
stack_v2_sparse_classes_30k_train_012983
Implement the Python class `SaveOverlayAction` described below. Class description: The ``SaveOverlayAction`` allows the user to save the currently selected overlay, if it has been edited, or only exists in memory. Method signatures and docstrings: - def __init__(self, overlayList, displayCtx, frame): Create a ``SaveO...
Implement the Python class `SaveOverlayAction` described below. Class description: The ``SaveOverlayAction`` allows the user to save the currently selected overlay, if it has been edited, or only exists in memory. Method signatures and docstrings: - def __init__(self, overlayList, displayCtx, frame): Create a ``SaveO...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class SaveOverlayAction: """The ``SaveOverlayAction`` allows the user to save the currently selected overlay, if it has been edited, or only exists in memory.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``SaveOverlayAction``. :arg overlayList: The :class:`.OverlayLis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaveOverlayAction: """The ``SaveOverlayAction`` allows the user to save the currently selected overlay, if it has been edited, or only exists in memory.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``SaveOverlayAction``. :arg overlayList: The :class:`.OverlayList`. :arg disp...
the_stack_v2_python_sparse
fsleyes/actions/saveoverlay.py
sanjayankur31/fsleyes
train
1
135bcce517075c3ac2229ca1cca207b404282879
[ "if len(prices) < 2:\n return 0\ndp = [[0 for _ in range(2)] for _ in range(len(prices))]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\nfor i in range(1, len(prices)):\n dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i])\n dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - prices[i])\nreturn dp[-1][0]", "if len(pri...
<|body_start_0|> if len(prices) < 2: return 0 dp = [[0 for _ in range(2)] for _ in range(len(prices))] dp[0][0] = 0 dp[0][1] = -prices[0] for i in range(1, len(prices)): dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] = max(dp[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情...
stack_v2_sparse_classes_36k_train_021649
2,732
no_license
[ { "docstring": "动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情况 1. 昨天未持股,今天买入 2. 昨天持股,今天不动 因为可以多次买卖,使用前面的利润减去今天买入的价格,为当前持有现金 方程表示为...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划 股票可以多次交易,在再次购买前需要出售掉之前的股票,同一天不能同时卖出买入 以i表示天数,用0、1表示未持股 或者 持股状态,方程表示为dp[i][0]、dp[i][1] dp[i][0] 表示第i天未持股,分为两种情况: 1. 昨天未持股,今天未持股 2. 昨天持股,今天卖出 方程表示为 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 表示第i天持股,分为两种情况 1. 昨天未持股,今天买...
the_stack_v2_python_sparse
datastructure/dp_exercise/MaxProfit2.py
yinhuax/leet_code
train
0
4c09f03b402ebc8e97eaf2d7c88b6cfc206e4be8
[ "res = []\nht = collections.Counter(nums2)\nfor item in nums1:\n if item in ht and ht[item] > 0:\n ht[item] -= 1\n res.append(item)\nreturn res", "nums1.sort()\nnums2.sort()\np1, p2 = (0, 0)\nres = []\nwhile p1 < len(nums1) and p2 < len(nums2):\n if nums1[p1] == nums2[p2]:\n res.append(...
<|body_start_0|> res = [] ht = collections.Counter(nums2) for item in nums1: if item in ht and ht[item] > 0: ht[item] -= 1 res.append(item) return res <|end_body_0|> <|body_start_1|> nums1.sort() nums2.sort() p1, p2 = (...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect0(self, nums1: List[int], nums2: List[int]) -> List[int]: """Time complexity: O(n), where m is the number of elements in nums1. Space complexity: O(m), where n is the number of elements in nums2.""" <|body_0|> def intersect(self, nums1, nums2): ...
stack_v2_sparse_classes_36k_train_021650
2,489
no_license
[ { "docstring": "Time complexity: O(n), where m is the number of elements in nums1. Space complexity: O(m), where n is the number of elements in nums2.", "name": "intersect0", "signature": "def intersect0(self, nums1: List[int], nums2: List[int]) -> List[int]" }, { "docstring": "Assumption: input...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect0(self, nums1: List[int], nums2: List[int]) -> List[int]: Time complexity: O(n), where m is the number of elements in nums1. Space complexity: O(m), where n is the n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect0(self, nums1: List[int], nums2: List[int]) -> List[int]: Time complexity: O(n), where m is the number of elements in nums1. Space complexity: O(m), where n is the n...
95a86cbbca28d0c0f6d72d28a2f1cb5a86327934
<|skeleton|> class Solution: def intersect0(self, nums1: List[int], nums2: List[int]) -> List[int]: """Time complexity: O(n), where m is the number of elements in nums1. Space complexity: O(m), where n is the number of elements in nums2.""" <|body_0|> def intersect(self, nums1, nums2): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect0(self, nums1: List[int], nums2: List[int]) -> List[int]: """Time complexity: O(n), where m is the number of elements in nums1. Space complexity: O(m), where n is the number of elements in nums2.""" res = [] ht = collections.Counter(nums2) for item in num...
the_stack_v2_python_sparse
intersect_arrs.py
tashakim/puzzles_python
train
8
4876c2f8e1e8545bf619b73a06439d40ef21ce1d
[ "self.method = Req.methods[method.lower()]\nself.args = args\nself.sleep = kws.pop('sleep', None)\nself.parser = kws.pop('parser', None)\nself.kws = kws", "try:\n response = self.method(*self.args, **self.kws)\n result = self.parser(context, response, queue)\n if self.sleep:\n gevent.sleep(self.sl...
<|body_start_0|> self.method = Req.methods[method.lower()] self.args = args self.sleep = kws.pop('sleep', None) self.parser = kws.pop('parser', None) self.kws = kws <|end_body_0|> <|body_start_1|> try: response = self.method(*self.args, **self.kws) ...
该对象用于描述HTTP请求
Req
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Req: """该对象用于描述HTTP请求""" def __init__(self, method, *args, **kws): """:param method: HTTP请求方法 :param parser: 响应解析器 :param *args: requests参数 :param **kws: requests参数""" <|body_0|> def __call__(self, context, queue): """:param context: 上下文 :param queue: 抓取队列""" ...
stack_v2_sparse_classes_36k_train_021651
3,713
permissive
[ { "docstring": ":param method: HTTP请求方法 :param parser: 响应解析器 :param *args: requests参数 :param **kws: requests参数", "name": "__init__", "signature": "def __init__(self, method, *args, **kws)" }, { "docstring": ":param context: 上下文 :param queue: 抓取队列", "name": "__call__", "signature": "def _...
2
stack_v2_sparse_classes_30k_train_011706
Implement the Python class `Req` described below. Class description: 该对象用于描述HTTP请求 Method signatures and docstrings: - def __init__(self, method, *args, **kws): :param method: HTTP请求方法 :param parser: 响应解析器 :param *args: requests参数 :param **kws: requests参数 - def __call__(self, context, queue): :param context: 上下文 :par...
Implement the Python class `Req` described below. Class description: 该对象用于描述HTTP请求 Method signatures and docstrings: - def __init__(self, method, *args, **kws): :param method: HTTP请求方法 :param parser: 响应解析器 :param *args: requests参数 :param **kws: requests参数 - def __call__(self, context, queue): :param context: 上下文 :par...
1a894fd1f5f1f3e160d9e388036a8add6d369438
<|skeleton|> class Req: """该对象用于描述HTTP请求""" def __init__(self, method, *args, **kws): """:param method: HTTP请求方法 :param parser: 响应解析器 :param *args: requests参数 :param **kws: requests参数""" <|body_0|> def __call__(self, context, queue): """:param context: 上下文 :param queue: 抓取队列""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Req: """该对象用于描述HTTP请求""" def __init__(self, method, *args, **kws): """:param method: HTTP请求方法 :param parser: 响应解析器 :param *args: requests参数 :param **kws: requests参数""" self.method = Req.methods[method.lower()] self.args = args self.sleep = kws.pop('sleep', None) se...
the_stack_v2_python_sparse
girlfriend/plugin/crawl.py
chihz/girlfriend
train
0
b4f0618400120c1c1b9315fdbb3f683ee10db5f5
[ "def dfs(node, res):\n if node is None:\n return res + 'None,'\n res = res + str(node.val) + ','\n res = dfs(node.left, res)\n res = dfs(node.right, res)\n return res\nreturn dfs(root, '')", "nodes = data.split(',')\nposi = 0\n\ndef dfs():\n nonlocal posi\n if posi == len(nodes):\n ...
<|body_start_0|> def dfs(node, res): if node is None: return res + 'None,' res = res + str(node.val) + ',' res = dfs(node.left, res) res = dfs(node.right, res) return res return dfs(root, '') <|end_body_0|> <|body_start_1|> ...
Codec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_021652
1,641
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_000008
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
6f0e92fd6e225c9db5a038881fc193e4e4231c3e
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def dfs(node, res): if node is None: return res + 'None,' res = res + str(node.val) + ',' res = dfs(node.left, res) res = ...
the_stack_v2_python_sparse
py/297.二叉树的序列化与反序列化.py
guojiangwei/myLeetCode
train
0
81c352f4e90c2fe928e723d2009bdf377955e9d5
[ "self.started = False\nself.elapsed = 0\nself.startTime = 0\nself.numIterations = numIterations\nself.iteration = 0", "if self.started:\n self.iteration = self.iteration + steps\n self.elapsed = time.time() - self.startTime\n timePerRun = self.elapsed / self.iteration\n totalTime = self.numIterations ...
<|body_start_0|> self.started = False self.elapsed = 0 self.startTime = 0 self.numIterations = numIterations self.iteration = 0 <|end_body_0|> <|body_start_1|> if self.started: self.iteration = self.iteration + steps self.elapsed = time.time() - s...
Progress2
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Progress2: def __init__(self, numIterations): """Progress tracker that calculates and prints the time until a process is finished. example usage: import sm import time numIter = 10 progress = sm.Progress2(numIter) for iter in range(0, numIter): progress.sample() time.sleep(1)""" ...
stack_v2_sparse_classes_36k_train_021653
2,882
permissive
[ { "docstring": "Progress tracker that calculates and prints the time until a process is finished. example usage: import sm import time numIter = 10 progress = sm.Progress2(numIter) for iter in range(0, numIter): progress.sample() time.sleep(1)", "name": "__init__", "signature": "def __init__(self, numIt...
3
stack_v2_sparse_classes_30k_train_019522
Implement the Python class `Progress2` described below. Class description: Implement the Progress2 class. Method signatures and docstrings: - def __init__(self, numIterations): Progress tracker that calculates and prints the time until a process is finished. example usage: import sm import time numIter = 10 progress ...
Implement the Python class `Progress2` described below. Class description: Implement the Progress2 class. Method signatures and docstrings: - def __init__(self, numIterations): Progress tracker that calculates and prints the time until a process is finished. example usage: import sm import time numIter = 10 progress ...
94bb8437a72a0d97a491097a7085bf3db4f93bba
<|skeleton|> class Progress2: def __init__(self, numIterations): """Progress tracker that calculates and prints the time until a process is finished. example usage: import sm import time numIter = 10 progress = sm.Progress2(numIter) for iter in range(0, numIter): progress.sample() time.sleep(1)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Progress2: def __init__(self, numIterations): """Progress tracker that calculates and prints the time until a process is finished. example usage: import sm import time numIter = 10 progress = sm.Progress2(numIter) for iter in range(0, numIter): progress.sample() time.sleep(1)""" self.started =...
the_stack_v2_python_sparse
Schweizer-Messer/sm_python/python/sm/Progress.py
ethz-asl/kalibr
train
3,744
b88359f8ac0f95a1532e8df8b34513e14707c042
[ "PinshCmd.PinshCmd.__init__(self, 'multiple')\nself.help_text = ''\nself.choices = choices\nif not choices:\n self.help_text = 'error\\t--This module needs attention--'\n return\nif len(choices) != len(help_text):\n self.help_text = 'error\\t--This module needs attention--'\n return\nfor index in range(...
<|body_start_0|> PinshCmd.PinshCmd.__init__(self, 'multiple') self.help_text = '' self.choices = choices if not choices: self.help_text = 'error\t--This module needs attention--' return if len(choices) != len(help_text): self.help_text = 'error...
A Field which allows the user a simple way of choosing from a group
MultipleChoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultipleChoice: """A Field which allows the user a simple way of choosing from a group""" def __init__(self, choices=None, help_text=None): """choices -- a list of possible choices help_text -- a list of what each choice means""" <|body_0|> def match(self, command_line, ...
stack_v2_sparse_classes_36k_train_021654
3,331
no_license
[ { "docstring": "choices -- a list of possible choices help_text -- a list of what each choice means", "name": "__init__", "signature": "def __init__(self, choices=None, help_text=None)" }, { "docstring": "determines if the user typed in an option that the system recognizes", "name": "match",...
3
stack_v2_sparse_classes_30k_val_000865
Implement the Python class `MultipleChoice` described below. Class description: A Field which allows the user a simple way of choosing from a group Method signatures and docstrings: - def __init__(self, choices=None, help_text=None): choices -- a list of possible choices help_text -- a list of what each choice means ...
Implement the Python class `MultipleChoice` described below. Class description: A Field which allows the user a simple way of choosing from a group Method signatures and docstrings: - def __init__(self, choices=None, help_text=None): choices -- a list of possible choices help_text -- a list of what each choice means ...
bb528eed464a63e0f6772fa27a9d472ef3a407aa
<|skeleton|> class MultipleChoice: """A Field which allows the user a simple way of choosing from a group""" def __init__(self, choices=None, help_text=None): """choices -- a list of possible choices help_text -- a list of what each choice means""" <|body_0|> def match(self, command_line, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultipleChoice: """A Field which allows the user a simple way of choosing from a group""" def __init__(self, choices=None, help_text=None): """choices -- a list of possible choices help_text -- a list of what each choice means""" PinshCmd.PinshCmd.__init__(self, 'multiple') self.h...
the_stack_v2_python_sparse
cli/lib/MultipleChoice.py
psbanka/bombardier
train
0
d15fd28566e82730635943092b5d5c326c910765
[ "assert isinstance(block_string, str)\nops = block_string.split('_')\noptions = {}\nfor op in ops:\n splits = re.split('(\\\\d.*)', op)\n if len(splits) >= 2:\n key, value = splits[:2]\n options[key] = value\nif 's' not in options or len(options['s']) != 2:\n raise ValueError('Strides options...
<|body_start_0|> assert isinstance(block_string, str) ops = block_string.split('_') options = {} for op in ops: splits = re.split('(\\d.*)', op) if len(splits) >= 2: key, value = splits[:2] options[key] = value if 's' not in...
Block Decoder for readability.
BlockDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockDecoder: """Block Decoder for readability.""" def _decode_block_string(self, block_string): """Gets a block through a string notation of arguments.""" <|body_0|> def _encode_block_string(self, block): """Encodes a block to a string.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_021655
10,046
permissive
[ { "docstring": "Gets a block through a string notation of arguments.", "name": "_decode_block_string", "signature": "def _decode_block_string(self, block_string)" }, { "docstring": "Encodes a block to a string.", "name": "_encode_block_string", "signature": "def _encode_block_string(self...
4
stack_v2_sparse_classes_30k_train_020839
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability. Method signatures and docstrings: - def _decode_block_string(self, block_string): Gets a block through a string notation of arguments. - def _encode_block_string(self, block): Encodes a block to a string. - de...
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability. Method signatures and docstrings: - def _decode_block_string(self, block_string): Gets a block through a string notation of arguments. - def _encode_block_string(self, block): Encodes a block to a string. - de...
2aa47722e961745898f70d40145ecd286666f8b7
<|skeleton|> class BlockDecoder: """Block Decoder for readability.""" def _decode_block_string(self, block_string): """Gets a block through a string notation of arguments.""" <|body_0|> def _encode_block_string(self, block): """Encodes a block to a string.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlockDecoder: """Block Decoder for readability.""" def _decode_block_string(self, block_string): """Gets a block through a string notation of arguments.""" assert isinstance(block_string, str) ops = block_string.split('_') options = {} for op in ops: sp...
the_stack_v2_python_sparse
efficientnet_l2softmax/utils.py
knjcode/kaggle-kuzushiji-recognition-2019
train
24
fc6507c3beadb96e406358a7d00a98ea7d3fb3d4
[ "logs.debug('INSTALLERS: Instantiating Endpoint object')\nif os == 'Darwin':\n logs.debug(f'INSTALLERS: Operating system: {os}')\n self._docker_mac(logs=logs)\nelse:\n msg = f'Docker installation is not automated for this operating system: {os}:\\n If docker is already installed on yous system, ...
<|body_start_0|> logs.debug('INSTALLERS: Instantiating Endpoint object') if os == 'Darwin': logs.debug(f'INSTALLERS: Operating system: {os}') self._docker_mac(logs=logs) else: msg = f'Docker installation is not automated for this operating system: {os}:\n ...
Class wrapper for Docker installation procedures
Installers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Installers: """Class wrapper for Docker installation procedures""" def __init__(self, os: str, logs: logging.Logger) -> None: """Instantiation of Installers object. Parameters ---------- logs: logging.Logger object Logger object to manage DHTK logs""" <|body_0|> def _doc...
stack_v2_sparse_classes_36k_train_021656
21,202
no_license
[ { "docstring": "Instantiation of Installers object. Parameters ---------- logs: logging.Logger object Logger object to manage DHTK logs", "name": "__init__", "signature": "def __init__(self, os: str, logs: logging.Logger) -> None" }, { "docstring": "Method to create Docker installation pipeline ...
3
stack_v2_sparse_classes_30k_train_009754
Implement the Python class `Installers` described below. Class description: Class wrapper for Docker installation procedures Method signatures and docstrings: - def __init__(self, os: str, logs: logging.Logger) -> None: Instantiation of Installers object. Parameters ---------- logs: logging.Logger object Logger objec...
Implement the Python class `Installers` described below. Class description: Class wrapper for Docker installation procedures Method signatures and docstrings: - def __init__(self, os: str, logs: logging.Logger) -> None: Instantiation of Installers object. Parameters ---------- logs: logging.Logger object Logger objec...
54d9104c8b04af0fb368a499372d7ea0337be3d2
<|skeleton|> class Installers: """Class wrapper for Docker installation procedures""" def __init__(self, os: str, logs: logging.Logger) -> None: """Instantiation of Installers object. Parameters ---------- logs: logging.Logger object Logger object to manage DHTK logs""" <|body_0|> def _doc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Installers: """Class wrapper for Docker installation procedures""" def __init__(self, os: str, logs: logging.Logger) -> None: """Instantiation of Installers object. Parameters ---------- logs: logging.Logger object Logger object to manage DHTK logs""" logs.debug('INSTALLERS: Instantiating...
the_stack_v2_python_sparse
venv/Lib/site-packages/dhtk/core/client.py
sorchawalsh/semanticweb
train
0
965d67df630e297fe7d97b4b6141a2bf3f72f164
[ "super().__init__()\nself.prenet = torch.nn.Conv1d(attention_dim + 2, attention_dim, 3, padding=1)\nself.decoder = Encoder(idim=-1, input_layer=None, attention_dim=attention_dim, attention_heads=attention_heads, linear_units=linear_units, num_blocks=blocks, dropout_rate=dropout_rate, positional_dropout_rate=positio...
<|body_start_0|> super().__init__() self.prenet = torch.nn.Conv1d(attention_dim + 2, attention_dim, 3, padding=1) self.decoder = Encoder(idim=-1, input_layer=None, attention_dim=attention_dim, attention_heads=attention_heads, linear_units=linear_units, num_blocks=blocks, dropout_rate=dropout_rat...
Pitch or Mel decoder module in VISinger 2.
Decoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Pitch or Mel decoder module in VISinger 2.""" def __init__(self, out_channels: int=192, attention_dim: int=192, attention_heads: int=2, linear_units: int=768, blocks: int=6, pw_layer_type: str='conv1d', pw_conv_kernel_size: int=3, pos_enc_layer_type: str='rel_pos', self_attention...
stack_v2_sparse_classes_36k_train_021657
4,739
permissive
[ { "docstring": "Args: out_channels (int): The output dimension of the module. attention_dim (int): The dimension of the attention mechanism. attention_heads (int): The number of attention heads. linear_units (int): The number of units in the linear layer. blocks (int): The number of encoder blocks. pw_layer_typ...
2
null
Implement the Python class `Decoder` described below. Class description: Pitch or Mel decoder module in VISinger 2. Method signatures and docstrings: - def __init__(self, out_channels: int=192, attention_dim: int=192, attention_heads: int=2, linear_units: int=768, blocks: int=6, pw_layer_type: str='conv1d', pw_conv_k...
Implement the Python class `Decoder` described below. Class description: Pitch or Mel decoder module in VISinger 2. Method signatures and docstrings: - def __init__(self, out_channels: int=192, attention_dim: int=192, attention_heads: int=2, linear_units: int=768, blocks: int=6, pw_layer_type: str='conv1d', pw_conv_k...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class Decoder: """Pitch or Mel decoder module in VISinger 2.""" def __init__(self, out_channels: int=192, attention_dim: int=192, attention_heads: int=2, linear_units: int=768, blocks: int=6, pw_layer_type: str='conv1d', pw_conv_kernel_size: int=3, pos_enc_layer_type: str='rel_pos', self_attention...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """Pitch or Mel decoder module in VISinger 2.""" def __init__(self, out_channels: int=192, attention_dim: int=192, attention_heads: int=2, linear_units: int=768, blocks: int=6, pw_layer_type: str='conv1d', pw_conv_kernel_size: int=3, pos_enc_layer_type: str='rel_pos', self_attention_layer_type: ...
the_stack_v2_python_sparse
espnet2/gan_svs/vits/pitch_predictor.py
espnet/espnet
train
7,242
b09fcc3c150b51078862cf001cd6450cdc41e025
[ "self.degree = degree\nself.crc_length = crc_length\nself.secret_bit = BitArray(bytes=secret_bytes, length=len(secret_bytes) * 8)\nself.gf_exp = gf_exp\nself.checksum_bit = BitArray(uint=binascii.crc32(self.secret_bit.bytes), length=self.crc_length)\nself.total_bit = self.secret_bit.copy()\nself.total_bit.append(se...
<|body_start_0|> self.degree = degree self.crc_length = crc_length self.secret_bit = BitArray(bytes=secret_bytes, length=len(secret_bytes) * 8) self.gf_exp = gf_exp self.checksum_bit = BitArray(uint=binascii.crc32(self.secret_bit.bytes), length=self.crc_length) self.total...
PolynomialGenerator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolynomialGenerator: def __init__(self, secret_bytes, degree, crc_length, gf_exp): """:param secret_bytes: secret in bytes format :param degree: polynomial degree as int :param crc_length: CRC length as int :param gf_exp: exponential in GF(2**gf_exp)""" <|body_0|> def prune_...
stack_v2_sparse_classes_36k_train_021658
3,654
permissive
[ { "docstring": ":param secret_bytes: secret in bytes format :param degree: polynomial degree as int :param crc_length: CRC length as int :param gf_exp: exponential in GF(2**gf_exp)", "name": "__init__", "signature": "def __init__(self, secret_bytes, degree, crc_length, gf_exp)" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_014639
Implement the Python class `PolynomialGenerator` described below. Class description: Implement the PolynomialGenerator class. Method signatures and docstrings: - def __init__(self, secret_bytes, degree, crc_length, gf_exp): :param secret_bytes: secret in bytes format :param degree: polynomial degree as int :param crc...
Implement the Python class `PolynomialGenerator` described below. Class description: Implement the PolynomialGenerator class. Method signatures and docstrings: - def __init__(self, secret_bytes, degree, crc_length, gf_exp): :param secret_bytes: secret in bytes format :param degree: polynomial degree as int :param crc...
ca4e506c0532fc949f9d483780e9ede2c47d125b
<|skeleton|> class PolynomialGenerator: def __init__(self, secret_bytes, degree, crc_length, gf_exp): """:param secret_bytes: secret in bytes format :param degree: polynomial degree as int :param crc_length: CRC length as int :param gf_exp: exponential in GF(2**gf_exp)""" <|body_0|> def prune_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolynomialGenerator: def __init__(self, secret_bytes, degree, crc_length, gf_exp): """:param secret_bytes: secret in bytes format :param degree: polynomial degree as int :param crc_length: CRC length as int :param gf_exp: exponential in GF(2**gf_exp)""" self.degree = degree self.crc_le...
the_stack_v2_python_sparse
Polynomial_Generator.py
abb-iss/distributed-fuzzy-vault
train
11
3c40eff4ab9d650b46d3f23db40a88ee1cfa2567
[ "self.sensor = sensor\nself.pump = pump\nself.decider = decider\nself.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}", "wtr_height = self.sensor.measure()\npump_state = self.pump.get_state()\nnext_state = self.decider.decide(wtr_height, pump_state, self.actions)\nreturn ...
<|body_start_0|> self.sensor = sensor self.pump = pump self.decider = decider self.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF} <|end_body_0|> <|body_start_1|> wtr_height = self.sensor.measure() pump_state = self.pump.get_stat...
Encapsulates command and coordination for the water-regulation module
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_36k_train_021659
1,428
no_license
[ { "docstring": "Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance of decider.Decider", "name": "__init__", "signature": "def __init__(self, sensor, pump, decider)" }, { "docstring": ...
2
null
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance...
the_stack_v2_python_sparse
students/Chris_Kenyon/Lesson_6/water-regulation/waterregulation/controller.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
5460e94ca69e81da3dfbe356fc9545f03baab185
[ "if target not in nums:\n return -1\nreturn nums.index(target)", "left = 0\nright = len(nums) - 1\nif not nums:\n return -1\nwhile left + 1 < right:\n mid = (left + right) // 2\n if nums[mid] >= nums[left]:\n if nums[left] <= target <= nums[mid]:\n right = mid\n else:\n ...
<|body_start_0|> if target not in nums: return -1 return nums.index(target) <|end_body_0|> <|body_start_1|> left = 0 right = len(nums) - 1 if not nums: return -1 while left + 1 < right: mid = (left + right) // 2 if nums[mid...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search_binary(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021660
2,370
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "search", "signature": "def search(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "search_binary", "signature": "def search_binary(self, nums, target)" }...
2
stack_v2_sparse_classes_30k_train_013666
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search_binary(self, nums, target): :type nums: List[int] :type target: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search_binary(self, nums, target): :type nums: List[int] :type target: int :rtype: int ...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search_binary(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" if target not in nums: return -1 return nums.index(target) def search_binary(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" ...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00033.Search in Rotated Sorted Array.py
roger6blog/LeetCode
train
0
5f40abcf24075df92de65ecfda0a9ccd20c87bd4
[ "def inorder(node):\n if node:\n yield from inorder(node.left)\n yield node.val\n yield from inorder(node.right)\nfor i in inorder(root):\n if k > 1:\n k -= 1\n else:\n return i", "cnt = 0\nstack = []\ntmp = root\nwhile tmp is not None or len(stack) > 0:\n if tmp is ...
<|body_start_0|> def inorder(node): if node: yield from inorder(node.left) yield node.val yield from inorder(node.right) for i in inorder(root): if k > 1: k -= 1 else: return i <|end_body_...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: """Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4""" <|body_0|> def kthSmallest(self, root: Op...
stack_v2_sparse_classes_36k_train_021661
2,102
permissive
[ { "docstring": "Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4", "name": "kthSmallest2", "signature": "def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int" }, { "docstring": "93 ...
2
stack_v2_sparse_classes_30k_train_011694
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: """Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4""" <|body_0|> def kthSmallest(self, root: Op...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: """Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4""" def inorder(node): if node: yiel...
the_stack_v2_python_sparse
src/230-KthSmallestElementinaBST.py
Jiezhi/myleetcode
train
1
b7047862229ef0d3f68df0b2bdd85bffa467cd09
[ "self.debug_mode = debug_mode\nself.em = Embedding()\nself.em.load()\nself.preprocessor()", "logger.info('load data')\nself.train = pd.read_csv(config.root_path + '/data/train.csv', sep='\\t').dropna()\nself.dev = pd.read_csv(config.root_path + '/data/dev.csv', sep='\\t').dropna()\nif self.debug_mode:\n self.t...
<|body_start_0|> self.debug_mode = debug_mode self.em = Embedding() self.em.load() self.preprocessor() <|end_body_0|> <|body_start_1|> logger.info('load data') self.train = pd.read_csv(config.root_path + '/data/train.csv', sep='\t').dropna() self.dev = pd.read_cs...
MLData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLData: def __init__(self, debug_mode=False): """@description: initlize ML dataset class @param {type} debug_mode: if debug_Mode the only deal 10000 data em, new embedding class @return:None""" <|body_0|> def preprocessor(self): """@description: Preprocess data, segm...
stack_v2_sparse_classes_36k_train_021662
4,675
no_license
[ { "docstring": "@description: initlize ML dataset class @param {type} debug_mode: if debug_Mode the only deal 10000 data em, new embedding class @return:None", "name": "__init__", "signature": "def __init__(self, debug_mode=False)" }, { "docstring": "@description: Preprocess data, segment, trans...
4
stack_v2_sparse_classes_30k_train_009608
Implement the Python class `MLData` described below. Class description: Implement the MLData class. Method signatures and docstrings: - def __init__(self, debug_mode=False): @description: initlize ML dataset class @param {type} debug_mode: if debug_Mode the only deal 10000 data em, new embedding class @return:None - ...
Implement the Python class `MLData` described below. Class description: Implement the MLData class. Method signatures and docstrings: - def __init__(self, debug_mode=False): @description: initlize ML dataset class @param {type} debug_mode: if debug_Mode the only deal 10000 data em, new embedding class @return:None - ...
9f2abcefef21b7b8c390bec5e9abce9ba7537921
<|skeleton|> class MLData: def __init__(self, debug_mode=False): """@description: initlize ML dataset class @param {type} debug_mode: if debug_Mode the only deal 10000 data em, new embedding class @return:None""" <|body_0|> def preprocessor(self): """@description: Preprocess data, segm...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLData: def __init__(self, debug_mode=False): """@description: initlize ML dataset class @param {type} debug_mode: if debug_Mode the only deal 10000 data em, new embedding class @return:None""" self.debug_mode = debug_mode self.em = Embedding() self.em.load() self.prepr...
the_stack_v2_python_sparse
src/data/mlData.py
mgh5212819/Chinese_Classification
train
9
636b7a105ae1d8d68a66cccf488b3ef6a0377426
[ "default_levels = ('n', 'np1')\nif nlevels is None or nlevels == 1:\n previous_levels = []\nelse:\n previous_levels = ['nm%i' % n for n in range(nlevels - 1, 0, -1)]\nlevels = tuple(previous_levels) + default_levels\nself.levels = levels\nself.add_fields(equation, levels)\nself.previous = [getattr(self, level...
<|body_start_0|> default_levels = ('n', 'np1') if nlevels is None or nlevels == 1: previous_levels = [] else: previous_levels = ['nm%i' % n for n in range(nlevels - 1, 0, -1)] levels = tuple(previous_levels) + default_levels self.levels = levels se...
Creates the fields required in the :class:`Timestepper` object.
TimeLevelFields
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeLevelFields: """Creates the fields required in the :class:`Timestepper` object.""" def __init__(self, equation, nlevels=None): """Args: equation (:class:`PrognosticEquation`): an equation object. nlevels (optional, iterable): an iterable containing the names of the time levels"""...
stack_v2_sparse_classes_36k_train_021663
12,017
permissive
[ { "docstring": "Args: equation (:class:`PrognosticEquation`): an equation object. nlevels (optional, iterable): an iterable containing the names of the time levels", "name": "__init__", "signature": "def __init__(self, equation, nlevels=None)" }, { "docstring": "Args: equation (:class:`Prognosti...
4
stack_v2_sparse_classes_30k_train_005856
Implement the Python class `TimeLevelFields` described below. Class description: Creates the fields required in the :class:`Timestepper` object. Method signatures and docstrings: - def __init__(self, equation, nlevels=None): Args: equation (:class:`PrognosticEquation`): an equation object. nlevels (optional, iterable...
Implement the Python class `TimeLevelFields` described below. Class description: Creates the fields required in the :class:`Timestepper` object. Method signatures and docstrings: - def __init__(self, equation, nlevels=None): Args: equation (:class:`PrognosticEquation`): an equation object. nlevels (optional, iterable...
ab93672a84d4a71019abad4249529403e4b0c8d7
<|skeleton|> class TimeLevelFields: """Creates the fields required in the :class:`Timestepper` object.""" def __init__(self, equation, nlevels=None): """Args: equation (:class:`PrognosticEquation`): an equation object. nlevels (optional, iterable): an iterable containing the names of the time levels"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeLevelFields: """Creates the fields required in the :class:`Timestepper` object.""" def __init__(self, equation, nlevels=None): """Args: equation (:class:`PrognosticEquation`): an equation object. nlevels (optional, iterable): an iterable containing the names of the time levels""" defa...
the_stack_v2_python_sparse
gusto/fields.py
firedrakeproject/gusto
train
10
56c63f6d45c86654e62e879b105769b7b1d71652
[ "user_friends_graph = self.get_user_friends_graph(user, user_friends_getter)\nsocial_graph_setter.store_user_friends_graph(user, user_friends_graph)\nreturn user_friends_graph", "graph = nx.Graph()\nuser_friends_list = user_friends_getter.get_friends_by_name(user)\nlocal = [user] + user_friends_list\nfor agent in...
<|body_start_0|> user_friends_graph = self.get_user_friends_graph(user, user_friends_getter) social_graph_setter.store_user_friends_graph(user, user_friends_graph) return user_friends_graph <|end_body_0|> <|body_start_1|> graph = nx.Graph() user_friends_list = user_friends_gette...
Creates a graph of twitter friends representing a community
SocialGraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_...
stack_v2_sparse_classes_36k_train_021664
2,007
no_license
[ { "docstring": "Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_getter the dao to retrieve the given users friends from @param social_graph_setter the dao to store the computed social graph", "name": "gen_user_friends_graph", "signature"...
2
stack_v2_sparse_classes_30k_train_008756
Implement the Python class `SocialGraph` described below. Class description: Creates a graph of twitter friends representing a community Method signatures and docstrings: - def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): Generates a user friends graph for a given user @param use...
Implement the Python class `SocialGraph` described below. Class description: Creates a graph of twitter friends representing a community Method signatures and docstrings: - def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): Generates a user friends graph for a given user @param use...
33a3fa38ad4dcdd54ff583da15dcd67c99ad9701
<|skeleton|> class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_getter the da...
the_stack_v2_python_sparse
src/process/social_graph/social_graph.py
ReinaKousaka/core
train
0
b5c67bea97a664f8173eb874f6c2cbd977790af5
[ "if not nums:\n return 0\nelif len(nums) == 1:\n return 0\nlength = len(nums)\nfor i in range(length):\n if i == 0 and nums[i] > nums[i + 1]:\n return i\n elif i == length - 1 and nums[i] > nums[i - 1]:\n return i\n elif nums[i] > nums[i - 1] and nums[i] > nums[i + 1]:\n return i...
<|body_start_0|> if not nums: return 0 elif len(nums) == 1: return 0 length = len(nums) for i in range(length): if i == 0 and nums[i] > nums[i + 1]: return i elif i == length - 1 and nums[i] > nums[i - 1]: re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPeakElement(self, nums): """Iteration Time complexity: O(n) :type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement(self, nums): """Binary search: sequence indexes: left, left+1, ..., mid-1, mid, mid+1, ...., right-1, right If mid is tar...
stack_v2_sparse_classes_36k_train_021665
1,560
no_license
[ { "docstring": "Iteration Time complexity: O(n) :type nums: List[int] :rtype: int", "name": "findPeakElement", "signature": "def findPeakElement(self, nums)" }, { "docstring": "Binary search: sequence indexes: left, left+1, ..., mid-1, mid, mid+1, ...., right-1, right If mid is target, then bing...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement(self, nums): Iteration Time complexity: O(n) :type nums: List[int] :rtype: int - def findPeakElement(self, nums): Binary search: sequence indexes: left, left+...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement(self, nums): Iteration Time complexity: O(n) :type nums: List[int] :rtype: int - def findPeakElement(self, nums): Binary search: sequence indexes: left, left+...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Solution: def findPeakElement(self, nums): """Iteration Time complexity: O(n) :type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement(self, nums): """Binary search: sequence indexes: left, left+1, ..., mid-1, mid, mid+1, ...., right-1, right If mid is tar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findPeakElement(self, nums): """Iteration Time complexity: O(n) :type nums: List[int] :rtype: int""" if not nums: return 0 elif len(nums) == 1: return 0 length = len(nums) for i in range(length): if i == 0 and nums[i] > ...
the_stack_v2_python_sparse
python_solution/BinarySearch/162_FindPeakElement.py
Dimen61/leetcode
train
4
7aa4bc5888883f955b0715f889a653640f6569c7
[ "try:\n cls.abrir_conexion()\n sql = 'INSERT into entradasMat (idMaterial, cant, fecha, concepto) values (%s,%s,%s,%s)'\n values = (idMaterial, cant, fecha, concepto)\n cls.cursor.execute(sql, values)\n cls.db.commit()\n return True\nexcept Exception as e:\n raise custom_exceptions.ErrorDeConex...
<|body_start_0|> try: cls.abrir_conexion() sql = 'INSERT into entradasMat (idMaterial, cant, fecha, concepto) values (%s,%s,%s,%s)' values = (idMaterial, cant, fecha, concepto) cls.cursor.execute(sql, values) cls.db.commit() return True ...
DatosEntradaExterna
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatosEntradaExterna: def add_one(cls, idMaterial, cant, concepto, fecha, noClose=False): """Registra una entrada externa de stock en la BD en base a los parámetros recibidos.""" <|body_0|> def get_all(cls, noClose=False): """Obtiene todas las entradas externas de la ...
stack_v2_sparse_classes_36k_train_021666
2,067
no_license
[ { "docstring": "Registra una entrada externa de stock en la BD en base a los parámetros recibidos.", "name": "add_one", "signature": "def add_one(cls, idMaterial, cant, concepto, fecha, noClose=False)" }, { "docstring": "Obtiene todas las entradas externas de la BD.", "name": "get_all", ...
2
stack_v2_sparse_classes_30k_train_000771
Implement the Python class `DatosEntradaExterna` described below. Class description: Implement the DatosEntradaExterna class. Method signatures and docstrings: - def add_one(cls, idMaterial, cant, concepto, fecha, noClose=False): Registra una entrada externa de stock en la BD en base a los parámetros recibidos. - def...
Implement the Python class `DatosEntradaExterna` described below. Class description: Implement the DatosEntradaExterna class. Method signatures and docstrings: - def add_one(cls, idMaterial, cant, concepto, fecha, noClose=False): Registra una entrada externa de stock en la BD en base a los parámetros recibidos. - def...
57ca674dba4dabd2526c450ba7210933240f19c5
<|skeleton|> class DatosEntradaExterna: def add_one(cls, idMaterial, cant, concepto, fecha, noClose=False): """Registra una entrada externa de stock en la BD en base a los parámetros recibidos.""" <|body_0|> def get_all(cls, noClose=False): """Obtiene todas las entradas externas de la ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatosEntradaExterna: def add_one(cls, idMaterial, cant, concepto, fecha, noClose=False): """Registra una entrada externa de stock en la BD en base a los parámetros recibidos.""" try: cls.abrir_conexion() sql = 'INSERT into entradasMat (idMaterial, cant, fecha, concepto)...
the_stack_v2_python_sparse
data/data_entrada_externa.py
JoaquinCardonaRuiz/proyecto-final
train
0
ee70efd608852760f4a82b54956d258fa62a61ad
[ "assert adversary is not None\nif not adversary.is_targeted_attack or adversary.target_label is None:\n target_labels = self._generate_random_target(adversary.original_label)\nelse:\n target_labels = [adversary.target_label]\nfor target in target_labels:\n original_image = adversary.original\n mask = np...
<|body_start_0|> assert adversary is not None if not adversary.is_targeted_attack or adversary.target_label is None: target_labels = self._generate_random_target(adversary.original_label) else: target_labels = [adversary.target_label] for target in target_labels: ...
Implements the Saliency Map Attack. The Jacobian-based Saliency Map Approach (Papernot et al. 2016). Paper link: https://arxiv.org/pdf/1511.07528.pdf
SaliencyMapAttack
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaliencyMapAttack: """Implements the Saliency Map Attack. The Jacobian-based Saliency Map Approach (Papernot et al. 2016). Paper link: https://arxiv.org/pdf/1511.07528.pdf""" def _apply(self, adversary, max_iter=2000, fast=True, theta=0.1, max_perturbations_per_pixel=7): """Apply the...
stack_v2_sparse_classes_36k_train_021667
5,906
permissive
[ { "docstring": "Apply the JSMA attack. Args: adversary(Adversary): The Adversary object. max_iter(int): The max iterations. fast(bool): Whether evaluate the pixel influence on sum of residual classes. theta(float): Perturbation per pixel relative to [min, max] range. max_perturbations_per_pixel(int): The max co...
3
stack_v2_sparse_classes_30k_train_009704
Implement the Python class `SaliencyMapAttack` described below. Class description: Implements the Saliency Map Attack. The Jacobian-based Saliency Map Approach (Papernot et al. 2016). Paper link: https://arxiv.org/pdf/1511.07528.pdf Method signatures and docstrings: - def _apply(self, adversary, max_iter=2000, fast=T...
Implement the Python class `SaliencyMapAttack` described below. Class description: Implements the Saliency Map Attack. The Jacobian-based Saliency Map Approach (Papernot et al. 2016). Paper link: https://arxiv.org/pdf/1511.07528.pdf Method signatures and docstrings: - def _apply(self, adversary, max_iter=2000, fast=T...
a60babdf382aba71fe447b3259441b4bed947414
<|skeleton|> class SaliencyMapAttack: """Implements the Saliency Map Attack. The Jacobian-based Saliency Map Approach (Papernot et al. 2016). Paper link: https://arxiv.org/pdf/1511.07528.pdf""" def _apply(self, adversary, max_iter=2000, fast=True, theta=0.1, max_perturbations_per_pixel=7): """Apply the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaliencyMapAttack: """Implements the Saliency Map Attack. The Jacobian-based Saliency Map Approach (Papernot et al. 2016). Paper link: https://arxiv.org/pdf/1511.07528.pdf""" def _apply(self, adversary, max_iter=2000, fast=True, theta=0.1, max_perturbations_per_pixel=7): """Apply the JSMA attack....
the_stack_v2_python_sparse
PaddleCV/adversarial/advbox/attacks/saliency.py
littletomatodonkey/models
train
5
9786952b6889a2254568a02489762ec36bbde4dc
[ "self.hash_func = hash_func\nif self.hash_func is None:\n self.hash_func = lambda k: int(sha1(k).hexdigest(), 16)", "if key is None:\n raise ValueError('key cannot be `None` when using hashing partitioner')\npartitions = sorted(partitions)\nreturn partitions[abs(self.hash_func(key)) % len(partitions)]" ]
<|body_start_0|> self.hash_func = hash_func if self.hash_func is None: self.hash_func = lambda k: int(sha1(k).hexdigest(), 16) <|end_body_0|> <|body_start_1|> if key is None: raise ValueError('key cannot be `None` when using hashing partitioner') partitions = sor...
Returns a (relatively) consistent partition out of all available partitions based on the key. Messages that are published with the same keys are not guaranteed to end up on the same broker if the number of brokers changes (due to the addition or removal of a broker, planned or unplanned) or if the number of topics per ...
HashingPartitioner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashingPartitioner: """Returns a (relatively) consistent partition out of all available partitions based on the key. Messages that are published with the same keys are not guaranteed to end up on the same broker if the number of brokers changes (due to the addition or removal of a broker, planned...
stack_v2_sparse_classes_36k_train_021668
5,870
permissive
[ { "docstring": ":param hash_func: hash function (defaults to :func:`hash`), should return an `int`. If hash randomization (Python 2.7) is enabled, a custom hashing function should be defined that is consistent between interpreter restarts. :type hash_func: function", "name": "__init__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_011057
Implement the Python class `HashingPartitioner` described below. Class description: Returns a (relatively) consistent partition out of all available partitions based on the key. Messages that are published with the same keys are not guaranteed to end up on the same broker if the number of brokers changes (due to the a...
Implement the Python class `HashingPartitioner` described below. Class description: Returns a (relatively) consistent partition out of all available partitions based on the key. Messages that are published with the same keys are not guaranteed to end up on the same broker if the number of brokers changes (due to the a...
c7054bd05b127385b8c6f56a4e2241d92ff42ab4
<|skeleton|> class HashingPartitioner: """Returns a (relatively) consistent partition out of all available partitions based on the key. Messages that are published with the same keys are not guaranteed to end up on the same broker if the number of brokers changes (due to the addition or removal of a broker, planned...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HashingPartitioner: """Returns a (relatively) consistent partition out of all available partitions based on the key. Messages that are published with the same keys are not guaranteed to end up on the same broker if the number of brokers changes (due to the addition or removal of a broker, planned or unplanned...
the_stack_v2_python_sparse
py_kafk/tar/pykafka-2.8.1-dev.1/pykafka/partitioners.py
liuansen/python-utils-class
train
3
2ed079ce585737cb64624f56788bfd8ae5b34666
[ "d = defaultdict(int)\n\ndef dfs(root, level):\n if not root:\n return\n d[level] += root.val\n dfs(root.left, level + 1)\n dfs(root.right, level + 1)\ndfs(root, 0)\nreturn d[max(d.keys())]", "queue = [root]\nsum_ = 0\nwhile queue:\n count = len(queue)\n sum_ = 0\n while count:\n ...
<|body_start_0|> d = defaultdict(int) def dfs(root, level): if not root: return d[level] += root.val dfs(root.left, level + 1) dfs(root.right, level + 1) dfs(root, 0) return d[max(d.keys())] <|end_body_0|> <|body_start_1|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deepestLeavesSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def deepestLeavesSumIterative(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = defaultdict(int) ...
stack_v2_sparse_classes_36k_train_021669
1,718
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "deepestLeavesSum", "signature": "def deepestLeavesSum(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "deepestLeavesSumIterative", "signature": "def deepestLeavesSumIterative(self, root)" } ]
2
stack_v2_sparse_classes_30k_val_000055
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deepestLeavesSum(self, root): :type root: TreeNode :rtype: int - def deepestLeavesSumIterative(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deepestLeavesSum(self, root): :type root: TreeNode :rtype: int - def deepestLeavesSumIterative(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
546cbce06fcd4bc34e16d42b5d5eb68fb25e16a9
<|skeleton|> class Solution: def deepestLeavesSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def deepestLeavesSumIterative(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deepestLeavesSum(self, root): """:type root: TreeNode :rtype: int""" d = defaultdict(int) def dfs(root, level): if not root: return d[level] += root.val dfs(root.left, level + 1) dfs(root.right, level + 1) ...
the_stack_v2_python_sparse
leetcode/solution_1302.py
eselyavka/python
train
0
ae4b5272470f5cf0f5f669f76622d6c241d3a7c6
[ "super(MaskedMSELoss, self).__init__()\nself.reduction = reduction\nself.criterion = nn.MSELoss(reduction='none')", "loss = self.criterion(input * mask, target * mask)\nif self.reduction == 'mean':\n loss = torch.sum(loss) / torch.sum(mask)\nreturn loss" ]
<|body_start_0|> super(MaskedMSELoss, self).__init__() self.reduction = reduction self.criterion = nn.MSELoss(reduction='none') <|end_body_0|> <|body_start_1|> loss = self.criterion(input * mask, target * mask) if self.reduction == 'mean': loss = torch.sum(loss) / to...
MaskedMSELoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskedMSELoss: def __init__(self, reduction='mean'): """Masked MSE implementation :param reduction: the same, as in nn.MSELoss""" <|body_0|> def forward(self, input, target, mask): """calculates masked loss :param input: input image as array :param target: reconstruc...
stack_v2_sparse_classes_36k_train_021670
20,751
permissive
[ { "docstring": "Masked MSE implementation :param reduction: the same, as in nn.MSELoss", "name": "__init__", "signature": "def __init__(self, reduction='mean')" }, { "docstring": "calculates masked loss :param input: input image as array :param target: reconstructed image as array :param mask: m...
2
stack_v2_sparse_classes_30k_train_008268
Implement the Python class `MaskedMSELoss` described below. Class description: Implement the MaskedMSELoss class. Method signatures and docstrings: - def __init__(self, reduction='mean'): Masked MSE implementation :param reduction: the same, as in nn.MSELoss - def forward(self, input, target, mask): calculates masked...
Implement the Python class `MaskedMSELoss` described below. Class description: Implement the MaskedMSELoss class. Method signatures and docstrings: - def __init__(self, reduction='mean'): Masked MSE implementation :param reduction: the same, as in nn.MSELoss - def forward(self, input, target, mask): calculates masked...
c80145929007876a6c459851bfe6d420195c340d
<|skeleton|> class MaskedMSELoss: def __init__(self, reduction='mean'): """Masked MSE implementation :param reduction: the same, as in nn.MSELoss""" <|body_0|> def forward(self, input, target, mask): """calculates masked loss :param input: input image as array :param target: reconstruc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskedMSELoss: def __init__(self, reduction='mean'): """Masked MSE implementation :param reduction: the same, as in nn.MSELoss""" super(MaskedMSELoss, self).__init__() self.reduction = reduction self.criterion = nn.MSELoss(reduction='none') def forward(self, input, target,...
the_stack_v2_python_sparse
src/models/autoencoders.py
nomiscientist/xray
train
0
1713b17553ac4b268032a3b5cbc313b2384ce980
[ "self.rgb0 = rgb0\nself.rgb1 = rgb1\nif t1 is None:\n t0, t1 = (0, t0)\nself.t0, self.t1 = (t0, t1)\nself.dt = float(t1 - t0)\nself.power = power", "if t <= self.t0:\n return self.rgb0\nif t >= self.t1:\n return self.rgb1\nt = (t - self.t0) / self.dt\nif self.power < 0:\n t = 1.0 - t\nt = math.pow(t, ...
<|body_start_0|> self.rgb0 = rgb0 self.rgb1 = rgb1 if t1 is None: t0, t1 = (0, t0) self.t0, self.t1 = (t0, t1) self.dt = float(t1 - t0) self.power = power <|end_body_0|> <|body_start_1|> if t <= self.t0: return self.rgb0 if t >= se...
Linear interpolation between two sRGB colors.
ColorInterpolator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColorInterpolator: """Linear interpolation between two sRGB colors.""" def __init__(self, rgb0, rgb1, t0=1.0, t1=None, power=1.0): """Initialize the generator. - rgb0: 3-tuple of 8-bit sRGB colors that represent the start time - rgb1: 3-tuple of 8-bit sRGB colors that represent the e...
stack_v2_sparse_classes_36k_train_021671
15,787
no_license
[ { "docstring": "Initialize the generator. - rgb0: 3-tuple of 8-bit sRGB colors that represent the start time - rgb1: 3-tuple of 8-bit sRGB colors that represent the end time - t0: start time (if t1 is omitted, the end time, and start is 0) - t1: end time - power: power to apply to the interpolation coefficient;...
2
null
Implement the Python class `ColorInterpolator` described below. Class description: Linear interpolation between two sRGB colors. Method signatures and docstrings: - def __init__(self, rgb0, rgb1, t0=1.0, t1=None, power=1.0): Initialize the generator. - rgb0: 3-tuple of 8-bit sRGB colors that represent the start time ...
Implement the Python class `ColorInterpolator` described below. Class description: Linear interpolation between two sRGB colors. Method signatures and docstrings: - def __init__(self, rgb0, rgb1, t0=1.0, t1=None, power=1.0): Initialize the generator. - rgb0: 3-tuple of 8-bit sRGB colors that represent the start time ...
60f51bce5de5e94eb3763970f0524d281bc1978b
<|skeleton|> class ColorInterpolator: """Linear interpolation between two sRGB colors.""" def __init__(self, rgb0, rgb1, t0=1.0, t1=None, power=1.0): """Initialize the generator. - rgb0: 3-tuple of 8-bit sRGB colors that represent the start time - rgb1: 3-tuple of 8-bit sRGB colors that represent the e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColorInterpolator: """Linear interpolation between two sRGB colors.""" def __init__(self, rgb0, rgb1, t0=1.0, t1=None, power=1.0): """Initialize the generator. - rgb0: 3-tuple of 8-bit sRGB colors that represent the start time - rgb1: 3-tuple of 8-bit sRGB colors that represent the end time - t0:...
the_stack_v2_python_sparse
lib/visutil.py
kajott/adventofcode
train
3
ed188a9e8361b01eb52b92a2231efde7ff75c523
[ "for i in xrange(len(nums)):\n ran = random.randint(0, len(nums) - 1)\n nums[i], nums[ran] = (nums[ran], nums[i])\nstart, stop = (0, len(nums) - 1)\ntarget, pi = (len(nums) - k, len(nums) - 1)\npi = self.findPivot(start, stop, nums)\nwhile target != pi:\n if pi > target:\n stop = pi - 1\n pi ...
<|body_start_0|> for i in xrange(len(nums)): ran = random.randint(0, len(nums) - 1) nums[i], nums[ran] = (nums[ran], nums[i]) start, stop = (0, len(nums) - 1) target, pi = (len(nums) - k, len(nums) - 1) pi = self.findPivot(start, stop, nums) while target !...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int https://leetcode.com/problems/kth-largest-element-in-an-array/""" <|body_0|> def findPivot(self, start, stop, nums): """find the pivot, #@ return type int""" <|body...
stack_v2_sparse_classes_36k_train_021672
1,735
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int https://leetcode.com/problems/kth-largest-element-in-an-array/", "name": "findKthLargest", "signature": "def findKthLargest(self, nums, k)" }, { "docstring": "find the pivot, #@ return type int", "name": "findPivot", "signatu...
2
stack_v2_sparse_classes_30k_train_019638
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int https://leetcode.com/problems/kth-largest-element-in-an-array/ - def findPivot(self, start, stop...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int https://leetcode.com/problems/kth-largest-element-in-an-array/ - def findPivot(self, start, stop...
3690344a4c0dee945a4a736614089e47f0491d0d
<|skeleton|> class Solution: def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int https://leetcode.com/problems/kth-largest-element-in-an-array/""" <|body_0|> def findPivot(self, start, stop, nums): """find the pivot, #@ return type int""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int https://leetcode.com/problems/kth-largest-element-in-an-array/""" for i in xrange(len(nums)): ran = random.randint(0, len(nums) - 1) nums[i], nums[ran] = (nums[ran], nums[i]) ...
the_stack_v2_python_sparse
Numbers/215-Kth-Largest-Element-in-an-Array.py
eugenejw/leetcode_2016
train
0
b4d5f9d41d2de4f8f37d32a98b1b3037b0efa458
[ "if bits % 8 != 0:\n raise ValueError('not implemented')\nself.a = a\nself.mod = mod\nself.bits = bits", "if seed is None:\n while True:\n seed = int.from_bytes(os.urandom(self.mod.bit_length() // 8 + 8), 'little') % self.mod\n if math.gcd(seed, self.mod) == 1:\n break\nstate = seed...
<|body_start_0|> if bits % 8 != 0: raise ValueError('not implemented') self.a = a self.mod = mod self.bits = bits <|end_body_0|> <|body_start_1|> if seed is None: while True: seed = int.from_bytes(os.urandom(self.mod.bit_length() // 8 + 8)...
Lehmer pseudorandom number generator. https://en.wikipedia.org/wiki/Lehmer_random_number_generator. Default parameters use a 128 bit instance proposed by L'Ecuyer. FindBias can detect this pseudorandom number generator. Detection still works if the output is truncated to 16 bits, but fails when only 8 bits per step are...
Lehmer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lehmer: """Lehmer pseudorandom number generator. https://en.wikipedia.org/wiki/Lehmer_random_number_generator. Default parameters use a 128 bit instance proposed by L'Ecuyer. FindBias can detect this pseudorandom number generator. Detection still works if the output is truncated to 16 bits, but f...
stack_v2_sparse_classes_36k_train_021673
19,579
permissive
[ { "docstring": "Constructs a Lehmer pseudo random number generator. Args: a: the multiplier mod: the modulus bits: the number of bits of output per step. This implementation only supports output sizes that are a multiple of 8.", "name": "__init__", "signature": "def __init__(self, a: int=250962815189121...
2
null
Implement the Python class `Lehmer` described below. Class description: Lehmer pseudorandom number generator. https://en.wikipedia.org/wiki/Lehmer_random_number_generator. Default parameters use a 128 bit instance proposed by L'Ecuyer. FindBias can detect this pseudorandom number generator. Detection still works if th...
Implement the Python class `Lehmer` described below. Class description: Lehmer pseudorandom number generator. https://en.wikipedia.org/wiki/Lehmer_random_number_generator. Default parameters use a 128 bit instance proposed by L'Ecuyer. FindBias can detect this pseudorandom number generator. Detection still works if th...
16e5f47fcc11f51d3fb58b50adddd075f4373bbc
<|skeleton|> class Lehmer: """Lehmer pseudorandom number generator. https://en.wikipedia.org/wiki/Lehmer_random_number_generator. Default parameters use a 128 bit instance proposed by L'Ecuyer. FindBias can detect this pseudorandom number generator. Detection still works if the output is truncated to 16 bits, but f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Lehmer: """Lehmer pseudorandom number generator. https://en.wikipedia.org/wiki/Lehmer_random_number_generator. Default parameters use a 128 bit instance proposed by L'Ecuyer. FindBias can detect this pseudorandom number generator. Detection still works if the output is truncated to 16 bits, but fails when onl...
the_stack_v2_python_sparse
paranoid_crypto/lib/randomness_tests/rng.py
google/paranoid_crypto
train
766
76cf984d735c33c58d0e3fdda9a8b6729299d92c
[ "n = len(str)\ni = 0\nnegative = False\nwhile i < n and str[i] == ' ':\n i += 1\nif i == n:\n return 0\nif i < n and str[i] != '-' and (str[i] != '+') and (not str[i].isdigit()):\n return 0\nif i < n:\n if str[i] == '-':\n negative = True\n i += 1\n elif str[i] == '+':\n i += 1\n...
<|body_start_0|> n = len(str) i = 0 negative = False while i < n and str[i] == ' ': i += 1 if i == n: return 0 if i < n and str[i] != '-' and (str[i] != '+') and (not str[i].isdigit()): return 0 if i < n: if str[i] =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def myAtoi_myself(self, str): """:type str: str :rtype: int""" <|body_0|> def myAtoi(self, str): """:type str: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(str) i = 0 negative = False whil...
stack_v2_sparse_classes_36k_train_021674
3,558
no_license
[ { "docstring": ":type str: str :rtype: int", "name": "myAtoi_myself", "signature": "def myAtoi_myself(self, str)" }, { "docstring": ":type str: str :rtype: int", "name": "myAtoi", "signature": "def myAtoi(self, str)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myAtoi_myself(self, str): :type str: str :rtype: int - def myAtoi(self, str): :type str: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myAtoi_myself(self, str): :type str: str :rtype: int - def myAtoi(self, str): :type str: str :rtype: int <|skeleton|> class Solution: def myAtoi_myself(self, str): ...
93266095329e2e8e949a72371b88b07382a60e0d
<|skeleton|> class Solution: def myAtoi_myself(self, str): """:type str: str :rtype: int""" <|body_0|> def myAtoi(self, str): """:type str: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def myAtoi_myself(self, str): """:type str: str :rtype: int""" n = len(str) i = 0 negative = False while i < n and str[i] == ' ': i += 1 if i == n: return 0 if i < n and str[i] != '-' and (str[i] != '+') and (not str[i]....
the_stack_v2_python_sparse
myAtoi.py
shivangi-prog/leetcode
train
0
de830ce9a4f203668f9872cbf620b9517a8e4413
[ "while pc:\n opcode = self.ctx.getConcreteMemoryAreaValue(pc, 16)\n instruction = Instruction()\n instruction.setOpcode(opcode)\n instruction.setAddress(pc)\n self.assertTrue(self.ctx.processing(instruction) == EXCEPTION.NO_FAULT)\n pc = self.ctx.getConcreteRegisterValue(self.ctx.registers.rip)\nr...
<|body_start_0|> while pc: opcode = self.ctx.getConcreteMemoryAreaValue(pc, 16) instruction = Instruction() instruction.setOpcode(opcode) instruction.setAddress(pc) self.assertTrue(self.ctx.processing(instruction) == EXCEPTION.NO_FAULT) pc ...
Test IR.
TestIR
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIR: """Test IR.""" def emulate(self, pc): """Emulate every opcode from pc. Process instruction until the end""" <|body_0|> def load_binary(self, filename): """Load in memory every opcode from an elf program.""" <|body_1|> def test_ir(self): ...
stack_v2_sparse_classes_36k_train_021675
24,070
permissive
[ { "docstring": "Emulate every opcode from pc. Process instruction until the end", "name": "emulate", "signature": "def emulate(self, pc)" }, { "docstring": "Load in memory every opcode from an elf program.", "name": "load_binary", "signature": "def load_binary(self, filename)" }, { ...
5
null
Implement the Python class `TestIR` described below. Class description: Test IR. Method signatures and docstrings: - def emulate(self, pc): Emulate every opcode from pc. Process instruction until the end - def load_binary(self, filename): Load in memory every opcode from an elf program. - def test_ir(self): Load bina...
Implement the Python class `TestIR` described below. Class description: Test IR. Method signatures and docstrings: - def emulate(self, pc): Emulate every opcode from pc. Process instruction until the end - def load_binary(self, filename): Load in memory every opcode from an elf program. - def test_ir(self): Load bina...
a61651ce331ac53ec09e1d8fef5eab744e98c9de
<|skeleton|> class TestIR: """Test IR.""" def emulate(self, pc): """Emulate every opcode from pc. Process instruction until the end""" <|body_0|> def load_binary(self, filename): """Load in memory every opcode from an elf program.""" <|body_1|> def test_ir(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestIR: """Test IR.""" def emulate(self, pc): """Emulate every opcode from pc. Process instruction until the end""" while pc: opcode = self.ctx.getConcreteMemoryAreaValue(pc, 16) instruction = Instruction() instruction.setOpcode(opcode) inst...
the_stack_v2_python_sparse
src/testers/unittests/test_semantics.py
JonathanSalwan/Triton
train
3,163
b728a9d3acb9eeb16f0f7b70d83dba1e2b8c969b
[ "if not head:\n return pre\nnxt = head.next\nhead.next = pre\nreturn self.reverseList(nxt, head)", "pre = None\ncurr = head\nwhile curr:\n nxt = curr.next\n curr.next = pre\n pre = curr\n curr = nxt\nreturn pre" ]
<|body_start_0|> if not head: return pre nxt = head.next head.next = pre return self.reverseList(nxt, head) <|end_body_0|> <|body_start_1|> pre = None curr = head while curr: nxt = curr.next curr.next = pre pre = cu...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head: ListNode, pre=None) -> ListNode: """Recursive. Running time: O(n) where n is the length of the list.""" <|body_0|> def reverseList_iterative(self, head: ListNode) -> ListNode: """Iterative. Running time: O(n) where n is the lengt...
stack_v2_sparse_classes_36k_train_021676
656
permissive
[ { "docstring": "Recursive. Running time: O(n) where n is the length of the list.", "name": "reverseList", "signature": "def reverseList(self, head: ListNode, pre=None) -> ListNode" }, { "docstring": "Iterative. Running time: O(n) where n is the length of the list.", "name": "reverseList_iter...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode, pre=None) -> ListNode: Recursive. Running time: O(n) where n is the length of the list. - def reverseList_iterative(self, head: ListNode) ->...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode, pre=None) -> ListNode: Recursive. Running time: O(n) where n is the length of the list. - def reverseList_iterative(self, head: ListNode) ->...
4a508a982b125a3a90ea893ae70863df7c99cc70
<|skeleton|> class Solution: def reverseList(self, head: ListNode, pre=None) -> ListNode: """Recursive. Running time: O(n) where n is the length of the list.""" <|body_0|> def reverseList_iterative(self, head: ListNode) -> ListNode: """Iterative. Running time: O(n) where n is the lengt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head: ListNode, pre=None) -> ListNode: """Recursive. Running time: O(n) where n is the length of the list.""" if not head: return pre nxt = head.next head.next = pre return self.reverseList(nxt, head) def reverseList_iter...
the_stack_v2_python_sparse
solutions/206_reverse_linked_list.py
YiqunPeng/leetcode_pro
train
0
8f67d59da3bc32ceb80cb28e394e6aca85cb7f3c
[ "rc, stdout, stderr = IpNeighbour.showNeighboursByDevice(logger, device, version)\nif rc != 0:\n return None\nif logger:\n logger('neigh-table-get').debug2('retrieving device %s neighbor table', device, stdout)\noutput = stdout.splitlines()\nreturn output", "output = NeighbourUtils.getNeighbourTable(logger,...
<|body_start_0|> rc, stdout, stderr = IpNeighbour.showNeighboursByDevice(logger, device, version) if rc != 0: return None if logger: logger('neigh-table-get').debug2('retrieving device %s neighbor table', device, stdout) output = stdout.splitlines() return...
This class holds neighbour utilities
NeighbourUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeighbourUtils: """This class holds neighbour utilities""" def getNeighbourTable(logger, device, version=4): """This function returns the neighbour table""" <|body_0|> def getNeighbourMacAddress(logger, device, dstIp, version=4): """This function returns the neig...
stack_v2_sparse_classes_36k_train_021677
10,343
no_license
[ { "docstring": "This function returns the neighbour table", "name": "getNeighbourTable", "signature": "def getNeighbourTable(logger, device, version=4)" }, { "docstring": "This function returns the neighbour mac address", "name": "getNeighbourMacAddress", "signature": "def getNeighbourMa...
2
stack_v2_sparse_classes_30k_train_003982
Implement the Python class `NeighbourUtils` described below. Class description: This class holds neighbour utilities Method signatures and docstrings: - def getNeighbourTable(logger, device, version=4): This function returns the neighbour table - def getNeighbourMacAddress(logger, device, dstIp, version=4): This func...
Implement the Python class `NeighbourUtils` described below. Class description: This class holds neighbour utilities Method signatures and docstrings: - def getNeighbourTable(logger, device, version=4): This function returns the neighbour table - def getNeighbourMacAddress(logger, device, dstIp, version=4): This func...
81bcc74fe7c0ca036ec483f634d7be0bab19a6d0
<|skeleton|> class NeighbourUtils: """This class holds neighbour utilities""" def getNeighbourTable(logger, device, version=4): """This function returns the neighbour table""" <|body_0|> def getNeighbourMacAddress(logger, device, dstIp, version=4): """This function returns the neig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeighbourUtils: """This class holds neighbour utilities""" def getNeighbourTable(logger, device, version=4): """This function returns the neighbour table""" rc, stdout, stderr = IpNeighbour.showNeighboursByDevice(logger, device, version) if rc != 0: return None ...
the_stack_v2_python_sparse
oscar/a/sys/net/lnx/neighbour.py
afeset/miner2-tools
train
0
481e2ab43ed04bdc09b072fb8ebd6c9925e32787
[ "ret = subprocess.getoutput(['swift auth'])\nret = ret.split('\\n')[0]\nret = ret.split('=')[1]\nreturn ret", "client_url = os.environ.get('SWIFT_X_ACCOUNT_SHARING_URL', None)\nif not client_url:\n logging.log(logging.ERROR, 'Swift X Account sharing API environment variables %s%s', \"haven't been sourced. Plea...
<|body_start_0|> ret = subprocess.getoutput(['swift auth']) ret = ret.split('\n')[0] ret = ret.split('=')[1] return ret <|end_body_0|> <|body_start_1|> client_url = os.environ.get('SWIFT_X_ACCOUNT_SHARING_URL', None) if not client_url: logging.log(logging.ERR...
Share and publish Openstack Swift containers.
Publish
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Publish: """Share and publish Openstack Swift containers.""" def _get_address(): """Discover the address for the object storage.""" <|body_0|> async def _push_share(self, container, recipient, rights): """Wrap the async share_new_access function.""" <|bod...
stack_v2_sparse_classes_36k_train_021678
3,766
permissive
[ { "docstring": "Discover the address for the object storage.", "name": "_get_address", "signature": "def _get_address()" }, { "docstring": "Wrap the async share_new_access function.", "name": "_push_share", "signature": "async def _push_share(self, container, recipient, rights)" }, {...
4
stack_v2_sparse_classes_30k_train_001305
Implement the Python class `Publish` described below. Class description: Share and publish Openstack Swift containers. Method signatures and docstrings: - def _get_address(): Discover the address for the object storage. - async def _push_share(self, container, recipient, rights): Wrap the async share_new_access funct...
Implement the Python class `Publish` described below. Class description: Share and publish Openstack Swift containers. Method signatures and docstrings: - def _get_address(): Discover the address for the object storage. - async def _push_share(self, container, recipient, rights): Wrap the async share_new_access funct...
2d70bf112b9ea5df4622ea23cb70a17125434e83
<|skeleton|> class Publish: """Share and publish Openstack Swift containers.""" def _get_address(): """Discover the address for the object storage.""" <|body_0|> async def _push_share(self, container, recipient, rights): """Wrap the async share_new_access function.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Publish: """Share and publish Openstack Swift containers.""" def _get_address(): """Discover the address for the object storage.""" ret = subprocess.getoutput(['swift auth']) ret = ret.split('\n')[0] ret = ret.split('=')[1] return ret async def _push_share(sel...
the_stack_v2_python_sparse
bindings/python/publish.py
CSCfi/swift-browser-ui
train
12
c262de6739f8099e72cf5d60d44736edfa281bda
[ "result = await iterm2.rpc.async_save_arrangement(connection, name)\nstatus = result.saved_arrangement_response.status\nif status != iterm2.api_pb2.CreateTabResponse.Status.Value('OK'):\n raise SavedArrangementException(iterm2.api_pb2.SavedArrangementResponse.Status.Name(result.saved_arrangement_response.status)...
<|body_start_0|> result = await iterm2.rpc.async_save_arrangement(connection, name) status = result.saved_arrangement_response.status if status != iterm2.api_pb2.CreateTabResponse.Status.Value('OK'): raise SavedArrangementException(iterm2.api_pb2.SavedArrangementResponse.Status.Name(...
Arrangement
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Arrangement: async def async_save(connection: iterm2.connection.Connection, name: str): """Save all windows as a new arrangement. Replaces the arrangement with the given name if it already exists. :param connection: The name of the arrangement. :param name: The name of the arrangement. :...
stack_v2_sparse_classes_36k_train_021679
1,743
permissive
[ { "docstring": "Save all windows as a new arrangement. Replaces the arrangement with the given name if it already exists. :param connection: The name of the arrangement. :param name: The name of the arrangement. :throws: SavedArrangementException", "name": "async_save", "signature": "async def async_sav...
2
stack_v2_sparse_classes_30k_train_009231
Implement the Python class `Arrangement` described below. Class description: Implement the Arrangement class. Method signatures and docstrings: - async def async_save(connection: iterm2.connection.Connection, name: str): Save all windows as a new arrangement. Replaces the arrangement with the given name if it already...
Implement the Python class `Arrangement` described below. Class description: Implement the Arrangement class. Method signatures and docstrings: - async def async_save(connection: iterm2.connection.Connection, name: str): Save all windows as a new arrangement. Replaces the arrangement with the given name if it already...
941607f54b55ded5a6b69dc26ea0a36836b2a2e8
<|skeleton|> class Arrangement: async def async_save(connection: iterm2.connection.Connection, name: str): """Save all windows as a new arrangement. Replaces the arrangement with the given name if it already exists. :param connection: The name of the arrangement. :param name: The name of the arrangement. :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Arrangement: async def async_save(connection: iterm2.connection.Connection, name: str): """Save all windows as a new arrangement. Replaces the arrangement with the given name if it already exists. :param connection: The name of the arrangement. :param name: The name of the arrangement. :throws: SavedA...
the_stack_v2_python_sparse
iterm2env/versions/3.7.2/lib/python3.7/site-packages/iterm2/arrangement.py
n-someya/SushiStatusBar
train
0
65ff10743f2c6736ba88f924d7b270b6b35171cf
[ "dist = {}\nprev = {}\ndist[start] = 0\nprev[start] = 0\nq = []\nheappush(q, (0, start))\nwhile len(q) != 0:\n prov_cost, src = heappop(q)\n if dist[src] < prov_cost:\n continue\n for dest in adj[src].neighbor.keys():\n cost = adj[src].neighbor[dest]\n if dest in dist.keys():\n ...
<|body_start_0|> dist = {} prev = {} dist[start] = 0 prev[start] = 0 q = [] heappush(q, (0, start)) while len(q) != 0: prov_cost, src = heappop(q) if dist[src] < prov_cost: continue for dest in adj[src].neighbor....
Dijkstra
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dijkstra: def dijkstra(self, adj, start, goal=None): """ダイクストラアルゴリズムによる最短経路を求めるメソッド 入力 adj: adj[i][j]の値が頂点iから頂点jまでの距離(頂点iから頂点jに枝がない場合,値はfloat('inf'))となるような2次元リスト(正方行列) start: 始点のID goal: オプション引数.終点のID 出力 goalを引数に持つ場合,startからgoalまでの最短経路を格納したリストを返す 持たない場合は,startから各頂点までの最短距離を格納したリストを返す""" ...
stack_v2_sparse_classes_36k_train_021680
5,880
no_license
[ { "docstring": "ダイクストラアルゴリズムによる最短経路を求めるメソッド 入力 adj: adj[i][j]の値が頂点iから頂点jまでの距離(頂点iから頂点jに枝がない場合,値はfloat('inf'))となるような2次元リスト(正方行列) start: 始点のID goal: オプション引数.終点のID 出力 goalを引数に持つ場合,startからgoalまでの最短経路を格納したリストを返す 持たない場合は,startから各頂点までの最短距離を格納したリストを返す", "name": "dijkstra", "signature": "def dijkstra(self, adj, ...
2
stack_v2_sparse_classes_30k_train_015229
Implement the Python class `Dijkstra` described below. Class description: Implement the Dijkstra class. Method signatures and docstrings: - def dijkstra(self, adj, start, goal=None): ダイクストラアルゴリズムによる最短経路を求めるメソッド 入力 adj: adj[i][j]の値が頂点iから頂点jまでの距離(頂点iから頂点jに枝がない場合,値はfloat('inf'))となるような2次元リスト(正方行列) start: 始点のID goal: オプショ...
Implement the Python class `Dijkstra` described below. Class description: Implement the Dijkstra class. Method signatures and docstrings: - def dijkstra(self, adj, start, goal=None): ダイクストラアルゴリズムによる最短経路を求めるメソッド 入力 adj: adj[i][j]の値が頂点iから頂点jまでの距離(頂点iから頂点jに枝がない場合,値はfloat('inf'))となるような2次元リスト(正方行列) start: 始点のID goal: オプショ...
415e8230c8386163e1abf5eea217a1e5be8a15bc
<|skeleton|> class Dijkstra: def dijkstra(self, adj, start, goal=None): """ダイクストラアルゴリズムによる最短経路を求めるメソッド 入力 adj: adj[i][j]の値が頂点iから頂点jまでの距離(頂点iから頂点jに枝がない場合,値はfloat('inf'))となるような2次元リスト(正方行列) start: 始点のID goal: オプション引数.終点のID 出力 goalを引数に持つ場合,startからgoalまでの最短経路を格納したリストを返す 持たない場合は,startから各頂点までの最短距離を格納したリストを返す""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dijkstra: def dijkstra(self, adj, start, goal=None): """ダイクストラアルゴリズムによる最短経路を求めるメソッド 入力 adj: adj[i][j]の値が頂点iから頂点jまでの距離(頂点iから頂点jに枝がない場合,値はfloat('inf'))となるような2次元リスト(正方行列) start: 始点のID goal: オプション引数.終点のID 出力 goalを引数に持つ場合,startからgoalまでの最短経路を格納したリストを返す 持たない場合は,startから各頂点までの最短距離を格納したリストを返す""" dist = ...
the_stack_v2_python_sparse
ABC/164/e.py
tamanyan/coding-problems
train
0
8177090727343302afe93f36330edf7e29ebb479
[ "courses = []\nuser = self.context['user']\nmodules = user.profile.purchased_modules.all()\nfor module in modules:\n course_id = self.course_in_courses(module.course.mnemo, courses)\n if course_id:\n courses[course_id[0]]['modules'].append({'mnemo': module.mnemo})\n else:\n courses.append({'m...
<|body_start_0|> courses = [] user = self.context['user'] modules = user.profile.purchased_modules.all() for module in modules: course_id = self.course_in_courses(module.course.mnemo, courses) if course_id: courses[course_id[0]]['modules'].append({...
UserInfoSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserInfoSerializer: def get_courses(self, *args): """Return purchased modules embedded in courses""" <|body_0|> def course_in_courses(self, mnemo, courses): """Check whether corresponding to 'mnemo' course is in 'courses'. Return tuple (course_id,) if course mnemo fo...
stack_v2_sparse_classes_36k_train_021681
5,467
permissive
[ { "docstring": "Return purchased modules embedded in courses", "name": "get_courses", "signature": "def get_courses(self, *args)" }, { "docstring": "Check whether corresponding to 'mnemo' course is in 'courses'. Return tuple (course_id,) if course mnemo found in courses, return False otherwise."...
2
stack_v2_sparse_classes_30k_train_001590
Implement the Python class `UserInfoSerializer` described below. Class description: Implement the UserInfoSerializer class. Method signatures and docstrings: - def get_courses(self, *args): Return purchased modules embedded in courses - def course_in_courses(self, mnemo, courses): Check whether corresponding to 'mnem...
Implement the Python class `UserInfoSerializer` described below. Class description: Implement the UserInfoSerializer class. Method signatures and docstrings: - def get_courses(self, *args): Return purchased modules embedded in courses - def course_in_courses(self, mnemo, courses): Check whether corresponding to 'mnem...
860d1c1214de125346c0accc4ec4b8953297231b
<|skeleton|> class UserInfoSerializer: def get_courses(self, *args): """Return purchased modules embedded in courses""" <|body_0|> def course_in_courses(self, mnemo, courses): """Check whether corresponding to 'mnemo' course is in 'courses'. Return tuple (course_id,) if course mnemo fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserInfoSerializer: def get_courses(self, *args): """Return purchased modules embedded in courses""" courses = [] user = self.context['user'] modules = user.profile.purchased_modules.all() for module in modules: course_id = self.course_in_courses(module.cour...
the_stack_v2_python_sparse
src/user/serializers.py
xgerinx/skillsitev2
train
0
d4debfa56e0886cd9149ac9660403776113a9204
[ "try:\n regex = await self.nyuki.storage.regexes.get_one(regex_id)\nexcept AutoReconnect:\n return Response(status=503)\nif not regex:\n return Response(status=404)\nreturn Response(regex)", "try:\n regex = await self.nyuki.storage.regexes.get_one(regex_id)\nexcept AutoReconnect:\n return Response(...
<|body_start_0|> try: regex = await self.nyuki.storage.regexes.get_one(regex_id) except AutoReconnect: return Response(status=503) if not regex: return Response(status=404) return Response(regex) <|end_body_0|> <|body_start_1|> try: ...
ApiFactoryRegex
[ "MIT", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "GPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "GPL-2.0-only", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-generic-exception", "Apache-2.0", "LicenseRef-scancode-warran...
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiFactoryRegex: async def get(self, request, regex_id): """Return the regex for id `regex_id`""" <|body_0|> async def patch(self, request, regex_id): """Modify an existing regex""" <|body_1|> async def delete(self, request, regex_id): """Delete ...
stack_v2_sparse_classes_36k_train_021682
10,772
permissive
[ { "docstring": "Return the regex for id `regex_id`", "name": "get", "signature": "async def get(self, request, regex_id)" }, { "docstring": "Modify an existing regex", "name": "patch", "signature": "async def patch(self, request, regex_id)" }, { "docstring": "Delete the regex wit...
3
null
Implement the Python class `ApiFactoryRegex` described below. Class description: Implement the ApiFactoryRegex class. Method signatures and docstrings: - async def get(self, request, regex_id): Return the regex for id `regex_id` - async def patch(self, request, regex_id): Modify an existing regex - async def delete(s...
Implement the Python class `ApiFactoryRegex` described below. Class description: Implement the ApiFactoryRegex class. Method signatures and docstrings: - async def get(self, request, regex_id): Return the regex for id `regex_id` - async def patch(self, request, regex_id): Modify an existing regex - async def delete(s...
f185fababee380660930243515652093855acfe7
<|skeleton|> class ApiFactoryRegex: async def get(self, request, regex_id): """Return the regex for id `regex_id`""" <|body_0|> async def patch(self, request, regex_id): """Modify an existing regex""" <|body_1|> async def delete(self, request, regex_id): """Delete ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiFactoryRegex: async def get(self, request, regex_id): """Return the regex for id `regex_id`""" try: regex = await self.nyuki.storage.regexes.get_one(regex_id) except AutoReconnect: return Response(status=503) if not regex: return Response(...
the_stack_v2_python_sparse
nyuki/workflow/api/factory.py
d-nery/nyuki
train
0
3266fc0552501a60e1058f58d4aba5599e6d18df
[ "super().__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(units=dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = t...
<|body_start_0|> super().__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(units=dm) self.layernorm1 = tf.keras.layers...
class DecoderBlock
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """class DecoderBlock""" def __init__(self, dm, h, hidden, drop_rate=0.1): """class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """call function""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_021683
1,710
no_license
[ { "docstring": "class constructor", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)" }, { "docstring": "call function", "name": "call", "signature": "def call(self, x, encoder_output, training, look_ahead_mask, padding_mask)" } ]
2
null
Implement the Python class `DecoderBlock` described below. Class description: class DecoderBlock Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): call function
Implement the Python class `DecoderBlock` described below. Class description: class DecoderBlock Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): call function <|skeleton|> class Decod...
a49eb348ff994f35b0efbbd5ac3ac8ae8ccb57d2
<|skeleton|> class DecoderBlock: """class DecoderBlock""" def __init__(self, dm, h, hidden, drop_rate=0.1): """class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """call function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderBlock: """class DecoderBlock""" def __init__(self, dm, h, hidden, drop_rate=0.1): """class constructor""" super().__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(units=hidden, a...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/8-transformer_decoder_block.py
salmenz/holbertonschool-machine_learning
train
4
9178ca12b78e13e0c79c6a5fb6b7d07699b3d982
[ "self.parentDir_path = os.path.dirname(os.path.realpath(__file__))\nself.outputFile_path = os.path.join(self.parentDir_path, self.outputFile_name)\nself.python_path = sys.executable\nself.jobClient_path = os.path.join(self.parentDir_path, 'job_client.py')\nself.jobClient_command = '{0} {1}'.format(self.python_path,...
<|body_start_0|> self.parentDir_path = os.path.dirname(os.path.realpath(__file__)) self.outputFile_path = os.path.join(self.parentDir_path, self.outputFile_name) self.python_path = sys.executable self.jobClient_path = os.path.join(self.parentDir_path, 'job_client.py') self.jobCli...
CronHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CronHandler: def __init__(self): """Set used paths, commands and output file paths.""" <|body_0|> def addCron(self, cron_str, command_str, outputFile_path=None): """Add new crontab to cronList Parameters ---------- cron_str : str time the crontab should be executed (...
stack_v2_sparse_classes_36k_train_021684
6,447
no_license
[ { "docstring": "Set used paths, commands and output file paths.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add new crontab to cronList Parameters ---------- cron_str : str time the crontab should be executed (cron format: *(min) *(h) *(day) *(month) *(day of week)...
4
stack_v2_sparse_classes_30k_train_020136
Implement the Python class `CronHandler` described below. Class description: Implement the CronHandler class. Method signatures and docstrings: - def __init__(self): Set used paths, commands and output file paths. - def addCron(self, cron_str, command_str, outputFile_path=None): Add new crontab to cronList Parameters...
Implement the Python class `CronHandler` described below. Class description: Implement the CronHandler class. Method signatures and docstrings: - def __init__(self): Set used paths, commands and output file paths. - def addCron(self, cron_str, command_str, outputFile_path=None): Add new crontab to cronList Parameters...
ca5fbbbd241c4aeea9ca0053ee21a672ede133d2
<|skeleton|> class CronHandler: def __init__(self): """Set used paths, commands and output file paths.""" <|body_0|> def addCron(self, cron_str, command_str, outputFile_path=None): """Add new crontab to cronList Parameters ---------- cron_str : str time the crontab should be executed (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CronHandler: def __init__(self): """Set used paths, commands and output file paths.""" self.parentDir_path = os.path.dirname(os.path.realpath(__file__)) self.outputFile_path = os.path.join(self.parentDir_path, self.outputFile_name) self.python_path = sys.executable self...
the_stack_v2_python_sparse
v2/cron_handler.py
ArnoSchiller/DIH4CPS-PYTESTS
train
0
fbb5f8d9ad107e9eb0949031e21c44463e580496
[ "with create_session() as session:\n matched_parking_list = session.query(MatchedParkingSpaceList).filter(MatchedParkingSpaceList.plate == plate).one()\n entity = MatchedParkingSpaceMapper.to_entity(record=matched_parking_list)\n raise Return(entity)", "with create_session() as session:\n matched_park...
<|body_start_0|> with create_session() as session: matched_parking_list = session.query(MatchedParkingSpaceList).filter(MatchedParkingSpaceList.plate == plate).one() entity = MatchedParkingSpaceMapper.to_entity(record=matched_parking_list) raise Return(entity) <|end_body_0|> ...
MatchedParkingList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" <|body_0|> def read_many(cls, user_id): """Read many and only return list<MatchedPa...
stack_v2_sparse_classes_36k_train_021685
3,429
no_license
[ { "docstring": "Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user", "name": "read_one", "signature": "def read_one(cls, plate)" }, { "docstring": "Read many and only return list<MatchedParkingSpace> :param str user...
5
stack_v2_sparse_classes_30k_val_001017
Implement the Python class `MatchedParkingList` described below. Class description: Implement the MatchedParkingList class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user ...
Implement the Python class `MatchedParkingList` described below. Class description: Implement the MatchedParkingList class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user ...
fd759c16b9864f6b1b47b1ba3f1af77f8d08af20
<|skeleton|> class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" <|body_0|> def read_many(cls, user_id): """Read many and only return list<MatchedPa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" with create_session() as session: matched_parking_list = session.query(MatchedParkingSpaceList).fi...
the_stack_v2_python_sparse
ParkingFinder/repositories/matched_parking_list.py
Big-Lemon/ParkingFinder
train
2
06cea535324be19810f4eeecc9d3704458e4ebb9
[ "sentences = get_raw_sentences_from_payload(req)\nmethod = req.params.get('method', 'union')\nlimit = int(req.params.get('limit', '10'))\nsentence_encoder = self.sentence_encoder\ncorpus_index = self.corpus_index\ndb_session = self.db_session\ntry:\n resp.status = falcon.HTTP_200\n resp.media = self.similar_k...
<|body_start_0|> sentences = get_raw_sentences_from_payload(req) method = req.params.get('method', 'union') limit = int(req.params.get('limit', '10')) sentence_encoder = self.sentence_encoder corpus_index = self.corpus_index db_session = self.db_session try: ...
Corpus Semantic Search. { 'results': [ { 'dist': 0.7293307781219482, 'id': 2021055, 'label': ['business_commentary_neg'], 'nearest': -388907830, 'text': 'However, if you were to exclude the Hilton ' 'Waikoloa Village resort, which was negatively ' 'impacted by Hurricane Lane and the Klauea ' 'volcano eruption, RevPAR p...
CovidSimilarityResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CovidSimilarityResource: """Corpus Semantic Search. { 'results': [ { 'dist': 0.7293307781219482, 'id': 2021055, 'label': ['business_commentary_neg'], 'nearest': -388907830, 'text': 'However, if you were to exclude the Hilton ' 'Waikoloa Village resort, which was negatively ' 'impacted by Hurrican...
stack_v2_sparse_classes_36k_train_021686
9,348
permissive
[ { "docstring": "Handle POST request.", "name": "on_post", "signature": "def on_post(self, req, resp)" }, { "docstring": "Find similar sentences. Args: input_sentences (str/list[str]): one or more input sentences. sentence_encoder : encoder limit (int): limit result set size to ``limit``. corpus_...
2
stack_v2_sparse_classes_30k_train_006475
Implement the Python class `CovidSimilarityResource` described below. Class description: Corpus Semantic Search. { 'results': [ { 'dist': 0.7293307781219482, 'id': 2021055, 'label': ['business_commentary_neg'], 'nearest': -388907830, 'text': 'However, if you were to exclude the Hilton ' 'Waikoloa Village resort, which...
Implement the Python class `CovidSimilarityResource` described below. Class description: Corpus Semantic Search. { 'results': [ { 'dist': 0.7293307781219482, 'id': 2021055, 'label': ['business_commentary_neg'], 'nearest': -388907830, 'text': 'However, if you were to exclude the Hilton ' 'Waikoloa Village resort, which...
b917bcfebc0f81fd3ba0207b09809ecd07fa9016
<|skeleton|> class CovidSimilarityResource: """Corpus Semantic Search. { 'results': [ { 'dist': 0.7293307781219482, 'id': 2021055, 'label': ['business_commentary_neg'], 'nearest': -388907830, 'text': 'However, if you were to exclude the Hilton ' 'Waikoloa Village resort, which was negatively ' 'impacted by Hurrican...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CovidSimilarityResource: """Corpus Semantic Search. { 'results': [ { 'dist': 0.7293307781219482, 'id': 2021055, 'label': ['business_commentary_neg'], 'nearest': -388907830, 'text': 'However, if you were to exclude the Hilton ' 'Waikoloa Village resort, which was negatively ' 'impacted by Hurricane Lane and th...
the_stack_v2_python_sparse
src/resources/similarity.py
sarahJune1/covid19
train
0
df6aaae80a22ca5cecb45e8c9f45398dd4200a03
[ "if walk._next is None:\n return (walk, walk)\nelse:\n head, tail = self._recursive_reverse(walk._next)\n tail._next = walk\n walk._next = None\n return (head, walk)", "if self.is_empty():\n return\nhead, tail = self._recursive_reverse(self._head)\nself._head = head\nself._tail = tail", "if se...
<|body_start_0|> if walk._next is None: return (walk, walk) else: head, tail = self._recursive_reverse(walk._next) tail._next = walk walk._next = None return (head, walk) <|end_body_0|> <|body_start_1|> if self.is_empty(): ...
SList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SList: def _recursive_reverse(self, walk): """Reverse the singly linked list by recursiving.""" <|body_0|> def recursive_reverse(self): """Reverse the singly linked list by recursiving.""" <|body_1|> def iterate_reverse(self): """Reverse the sing...
stack_v2_sparse_classes_36k_train_021687
1,487
no_license
[ { "docstring": "Reverse the singly linked list by recursiving.", "name": "_recursive_reverse", "signature": "def _recursive_reverse(self, walk)" }, { "docstring": "Reverse the singly linked list by recursiving.", "name": "recursive_reverse", "signature": "def recursive_reverse(self)" }...
3
null
Implement the Python class `SList` described below. Class description: Implement the SList class. Method signatures and docstrings: - def _recursive_reverse(self, walk): Reverse the singly linked list by recursiving. - def recursive_reverse(self): Reverse the singly linked list by recursiving. - def iterate_reverse(s...
Implement the Python class `SList` described below. Class description: Implement the SList class. Method signatures and docstrings: - def _recursive_reverse(self, walk): Reverse the singly linked list by recursiving. - def recursive_reverse(self): Reverse the singly linked list by recursiving. - def iterate_reverse(s...
70b23ead7a89e46a84d9d914e7c8fa678edd1f90
<|skeleton|> class SList: def _recursive_reverse(self, walk): """Reverse the singly linked list by recursiving.""" <|body_0|> def recursive_reverse(self): """Reverse the singly linked list by recursiving.""" <|body_1|> def iterate_reverse(self): """Reverse the sing...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SList: def _recursive_reverse(self, walk): """Reverse the singly linked list by recursiving.""" if walk._next is None: return (walk, walk) else: head, tail = self._recursive_reverse(walk._next) tail._next = walk walk._next = None ...
the_stack_v2_python_sparse
linded_list_ch07/creativity/reverse_singly_list_c7_29.py
wanyikang/dsap
train
1
047f80690a5099e9f1505b2dd7da347d7bd2adc1
[ "lists_ = []\nfor row in matrix:\n lists_ += row\nlists_.sort()\nreturn lists_[k - 1]", "n = len(matrix)\npointers = [0] * n\ncount = 0\nwhile True:\n min_, min_index = (float('inf'), -1)\n for index, point in enumerate(pointers):\n if point < n:\n tmp_min = matrix[index][point]\n ...
<|body_start_0|> lists_ = [] for row in matrix: lists_ += row lists_.sort() return lists_[k - 1] <|end_body_0|> <|body_start_1|> n = len(matrix) pointers = [0] * n count = 0 while True: min_, min_index = (float('inf'), -1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021688
2,165
no_license
[ { "docstring": ":type matrix: List[List[int]] :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSmallest(self, matrix, k)" }, { "docstring": ":type matrix: List[List[int]] :type k: int :rtype: int", "name": "kthSmallest2", "signature": "def kthSmallest2(self, matrix,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: int - def kthSmallest2(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: int - def kthSmallest2(self, matrix, k): :type matrix: List[List[int]] :type k: int :rtype: i...
cefa2f08667de4d2973274de3ff29a31a7d25eda
<|skeleton|> class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" lists_ = [] for row in matrix: lists_ += row lists_.sort() return lists_[k - 1] def kthSmallest2(self, matrix, k): """:type matrix: List[Lis...
the_stack_v2_python_sparse
378/Solution.py
zhangruochi/leetcode
train
14
8ede324f500758c4eb4509a84d8a895aa8b76dde
[ "super(Svm2DSlope1, self).setUp()\nsch2 = [('Class', int), ('Dim_1', float), ('Dim_2', float)]\ntrain_file = self.get_file('SVM-2F-train-50X50_1SlopePlus0.csv')\ntest_file = self.get_file('SVM-2F-test-50X50_1SlopePlus0.csv')\nself.trainer = self.context.frame.import_csv(train_file, schema=sch2)\nself.frame = self.c...
<|body_start_0|> super(Svm2DSlope1, self).setUp() sch2 = [('Class', int), ('Dim_1', float), ('Dim_2', float)] train_file = self.get_file('SVM-2F-train-50X50_1SlopePlus0.csv') test_file = self.get_file('SVM-2F-test-50X50_1SlopePlus0.csv') self.trainer = self.context.frame.import_c...
Svm2DSlope1
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Svm2DSlope1: def setUp(self): """Build the frame needed for these tests""" <|body_0|> def test_svm_model_test(self): """Test with train and test data generated with same hyperplane""" <|body_1|> def test_svm_model_predict(self): """Test the predi...
stack_v2_sparse_classes_36k_train_021689
3,131
permissive
[ { "docstring": "Build the frame needed for these tests", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test with train and test data generated with same hyperplane", "name": "test_svm_model_test", "signature": "def test_svm_model_test(self)" }, { "docstring":...
3
null
Implement the Python class `Svm2DSlope1` described below. Class description: Implement the Svm2DSlope1 class. Method signatures and docstrings: - def setUp(self): Build the frame needed for these tests - def test_svm_model_test(self): Test with train and test data generated with same hyperplane - def test_svm_model_p...
Implement the Python class `Svm2DSlope1` described below. Class description: Implement the Svm2DSlope1 class. Method signatures and docstrings: - def setUp(self): Build the frame needed for these tests - def test_svm_model_test(self): Test with train and test data generated with same hyperplane - def test_svm_model_p...
5548fc925b5c278263cbdebbd9e8c7593320c2f4
<|skeleton|> class Svm2DSlope1: def setUp(self): """Build the frame needed for these tests""" <|body_0|> def test_svm_model_test(self): """Test with train and test data generated with same hyperplane""" <|body_1|> def test_svm_model_predict(self): """Test the predi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Svm2DSlope1: def setUp(self): """Build the frame needed for these tests""" super(Svm2DSlope1, self).setUp() sch2 = [('Class', int), ('Dim_1', float), ('Dim_2', float)] train_file = self.get_file('SVM-2F-train-50X50_1SlopePlus0.csv') test_file = self.get_file('SVM-2F-tes...
the_stack_v2_python_sparse
regression-tests/sparktkregtests/testcases/models/svm_2d_slope1_test.py
trustedanalytics/spark-tk
train
35
d0f9f1019b6036c90a1d10b02252b81ab022a419
[ "dict_details_dic = cache.get('system_dict_details', {}) if getattr(settings, 'REDIS_ENABLE', False) else {}\nif not dict_details_dic:\n queryset = self.filter_queryset(self.get_queryset())\n queryset_dic = queryset.order_by('sort').values('dict_data__dictType', 'dictLabel', 'dictValue', 'is_default')\n fo...
<|body_start_0|> dict_details_dic = cache.get('system_dict_details', {}) if getattr(settings, 'REDIS_ENABLE', False) else {} if not dict_details_dic: queryset = self.filter_queryset(self.get_queryset()) queryset_dic = queryset.order_by('sort').values('dict_data__dictType', 'dictL...
字典详情 模型的CRUD视图
DictDetailsModelViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DictDetailsModelViewSet: """字典详情 模型的CRUD视图""" def dict_details_list(self, request: Request, *args, **kwargs): """根据字典类型查询字典数据信息 :param request: :param args: :param kwargs: :return:""" <|body_0|> def clearCache(self, request: Request, *args, **kwargs): """清理键值缓存 :...
stack_v2_sparse_classes_36k_train_021690
16,018
permissive
[ { "docstring": "根据字典类型查询字典数据信息 :param request: :param args: :param kwargs: :return:", "name": "dict_details_list", "signature": "def dict_details_list(self, request: Request, *args, **kwargs)" }, { "docstring": "清理键值缓存 :param request: :param args: :param kwargs: :return:", "name": "clearCach...
3
null
Implement the Python class `DictDetailsModelViewSet` described below. Class description: 字典详情 模型的CRUD视图 Method signatures and docstrings: - def dict_details_list(self, request: Request, *args, **kwargs): 根据字典类型查询字典数据信息 :param request: :param args: :param kwargs: :return: - def clearCache(self, request: Request, *args...
Implement the Python class `DictDetailsModelViewSet` described below. Class description: 字典详情 模型的CRUD视图 Method signatures and docstrings: - def dict_details_list(self, request: Request, *args, **kwargs): 根据字典类型查询字典数据信息 :param request: :param args: :param kwargs: :return: - def clearCache(self, request: Request, *args...
32b598f304bc41eebd4f8173236038120cdfaf87
<|skeleton|> class DictDetailsModelViewSet: """字典详情 模型的CRUD视图""" def dict_details_list(self, request: Request, *args, **kwargs): """根据字典类型查询字典数据信息 :param request: :param args: :param kwargs: :return:""" <|body_0|> def clearCache(self, request: Request, *args, **kwargs): """清理键值缓存 :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DictDetailsModelViewSet: """字典详情 模型的CRUD视图""" def dict_details_list(self, request: Request, *args, **kwargs): """根据字典类型查询字典数据信息 :param request: :param args: :param kwargs: :return:""" dict_details_dic = cache.get('system_dict_details', {}) if getattr(settings, 'REDIS_ENABLE', False) else ...
the_stack_v2_python_sparse
apps/vadmin/system/views.py
kuangzhanzhizi/ansible-ui-backend
train
0
55b41fbe5fb04e0d8c43383486a09b4258151c1e
[ "subv = SimpleMachineVertex(None, '')\npl = Placement(subv, 0, 0, 1)\nself.assertEqual(pl.x, 0)\nself.assertEqual(pl.y, 0)\nself.assertEqual(pl.p, 1)\nself.assertEqual(subv, pl.vertex)", "subv = SimpleMachineVertex(None, '')\npl = list()\nfor i in range(4):\n pl.append(Placement(subv, 0, 0, i))\nself.assertRai...
<|body_start_0|> subv = SimpleMachineVertex(None, '') pl = Placement(subv, 0, 0, 1) self.assertEqual(pl.x, 0) self.assertEqual(pl.y, 0) self.assertEqual(pl.p, 1) self.assertEqual(subv, pl.vertex) <|end_body_0|> <|body_start_1|> subv = SimpleMachineVertex(None, ''...
tester for placement object in pacman.model.placements.placement
TestPlacement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPlacement: """tester for placement object in pacman.model.placements.placement""" def test_create_new_placement(self): """test that creating a new placement puts stuff in the right place :return:""" <|body_0|> def test_create_new_placements_duplicate_vertex(self): ...
stack_v2_sparse_classes_36k_train_021691
1,279
no_license
[ { "docstring": "test that creating a new placement puts stuff in the right place :return:", "name": "test_create_new_placement", "signature": "def test_create_new_placement(self)" }, { "docstring": "check that you cant put a vertex in multiple placements :return:", "name": "test_create_new_p...
2
stack_v2_sparse_classes_30k_train_004927
Implement the Python class `TestPlacement` described below. Class description: tester for placement object in pacman.model.placements.placement Method signatures and docstrings: - def test_create_new_placement(self): test that creating a new placement puts stuff in the right place :return: - def test_create_new_place...
Implement the Python class `TestPlacement` described below. Class description: tester for placement object in pacman.model.placements.placement Method signatures and docstrings: - def test_create_new_placement(self): test that creating a new placement puts stuff in the right place :return: - def test_create_new_place...
5c2faba4d823e9341e5c18f61ea9bf8c6e15b687
<|skeleton|> class TestPlacement: """tester for placement object in pacman.model.placements.placement""" def test_create_new_placement(self): """test that creating a new placement puts stuff in the right place :return:""" <|body_0|> def test_create_new_placements_duplicate_vertex(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPlacement: """tester for placement object in pacman.model.placements.placement""" def test_create_new_placement(self): """test that creating a new placement puts stuff in the right place :return:""" subv = SimpleMachineVertex(None, '') pl = Placement(subv, 0, 0, 1) sel...
the_stack_v2_python_sparse
unittests/model_tests/placement_tests/test_placement_object.py
kfriesth/PACMAN
train
0
653eb2feb20c0bb6edc44718f2ebc7f54f06bfa2
[ "self.freq = Counter()\nself.group = defaultdict(list)\nself.maxfreq = 0", "self.freq[x] += 1\nself.maxfreq = max(self.maxfreq, self.freq[x])\nself.group[self.freq[x]].append(x)", "x = self.group[self.maxfreq].pop()\nself.freq[x] -= 1\nif not self.group[self.maxfreq]:\n self.maxfreq -= 1\nreturn x" ]
<|body_start_0|> self.freq = Counter() self.group = defaultdict(list) self.maxfreq = 0 <|end_body_0|> <|body_start_1|> self.freq[x] += 1 self.maxfreq = max(self.maxfreq, self.freq[x]) self.group[self.freq[x]].append(x) <|end_body_1|> <|body_start_2|> x = self.gr...
Frequency Stack that is based on two dictionaries: - one keeps frequencies of elements - another keep groups of elements based on frequencies
FreqStack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FreqStack: """Frequency Stack that is based on two dictionaries: - one keeps frequencies of elements - another keep groups of elements based on frequencies""" def __init__(self): """Freq and Group dictionaries Space: O(n) n - number of elements in the stack""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_021692
1,162
no_license
[ { "docstring": "Freq and Group dictionaries Space: O(n) n - number of elements in the stack", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Time: O(1)", "name": "push", "signature": "def push(self, x)" }, { "docstring": "Time: O(1)", "name": "pop", ...
3
null
Implement the Python class `FreqStack` described below. Class description: Frequency Stack that is based on two dictionaries: - one keeps frequencies of elements - another keep groups of elements based on frequencies Method signatures and docstrings: - def __init__(self): Freq and Group dictionaries Space: O(n) n - n...
Implement the Python class `FreqStack` described below. Class description: Frequency Stack that is based on two dictionaries: - one keeps frequencies of elements - another keep groups of elements based on frequencies Method signatures and docstrings: - def __init__(self): Freq and Group dictionaries Space: O(n) n - n...
9a20e1835652f5e6c33ef5c238f622e81f84ca26
<|skeleton|> class FreqStack: """Frequency Stack that is based on two dictionaries: - one keeps frequencies of elements - another keep groups of elements based on frequencies""" def __init__(self): """Freq and Group dictionaries Space: O(n) n - number of elements in the stack""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FreqStack: """Frequency Stack that is based on two dictionaries: - one keeps frequencies of elements - another keep groups of elements based on frequencies""" def __init__(self): """Freq and Group dictionaries Space: O(n) n - number of elements in the stack""" self.freq = Counter() ...
the_stack_v2_python_sparse
leetcode/p0895_maximum_frequency_stack.py
weak-head/leetcode
train
0
a098fdcecb3ae8431a5da8afd64e106b4b3c7846
[ "cur_s = [S]\nfor i in range(len(S)):\n next_s = []\n for s in cur_s:\n if s[i].isdigit():\n next_s.append(s)\n else:\n next_s.append(s[0:i] + s[i].lower() + s[i + 1:])\n next_s.append(s[0:i] + s[i].upper() + s[i + 1:])\n cur_s = next_s\nreturn cur_s", "res ...
<|body_start_0|> cur_s = [S] for i in range(len(S)): next_s = [] for s in cur_s: if s[i].isdigit(): next_s.append(s) else: next_s.append(s[0:i] + s[i].lower() + s[i + 1:]) next_s.append(s[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def letterCasePermutation(self, S): """:type S: str :rtype: List[str] 131ms""" <|body_0|> def letterCasePermutation_1(self, S): """:type S: str :rtype: List[str] 109ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> cur_s = [S] for...
stack_v2_sparse_classes_36k_train_021693
1,741
no_license
[ { "docstring": ":type S: str :rtype: List[str] 131ms", "name": "letterCasePermutation", "signature": "def letterCasePermutation(self, S)" }, { "docstring": ":type S: str :rtype: List[str] 109ms", "name": "letterCasePermutation_1", "signature": "def letterCasePermutation_1(self, S)" } ]
2
stack_v2_sparse_classes_30k_train_012565
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCasePermutation(self, S): :type S: str :rtype: List[str] 131ms - def letterCasePermutation_1(self, S): :type S: str :rtype: List[str] 109ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCasePermutation(self, S): :type S: str :rtype: List[str] 131ms - def letterCasePermutation_1(self, S): :type S: str :rtype: List[str] 109ms <|skeleton|> class Solution...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def letterCasePermutation(self, S): """:type S: str :rtype: List[str] 131ms""" <|body_0|> def letterCasePermutation_1(self, S): """:type S: str :rtype: List[str] 109ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def letterCasePermutation(self, S): """:type S: str :rtype: List[str] 131ms""" cur_s = [S] for i in range(len(S)): next_s = [] for s in cur_s: if s[i].isdigit(): next_s.append(s) else: ...
the_stack_v2_python_sparse
LetterCasePermutation_784.py
953250587/leetcode-python
train
2
de5451ff6a6794c77bc921fd406f6a9d66fdab89
[ "super().__init__(perplexity=perplexity, max_samples=max_samples, shuffle=shuffle, **kwargs)\nself.perplexity = perplexity\nself.max_samples = max_samples\nself.shuffle = shuffle", "if len(features) > self.max_samples:\n if not self.shuffle:\n inds = features.index[:self.max_samples]\n else:\n ...
<|body_start_0|> super().__init__(perplexity=perplexity, max_samples=max_samples, shuffle=shuffle, **kwargs) self.perplexity = perplexity self.max_samples = max_samples self.shuffle = shuffle <|end_body_0|> <|body_start_1|> if len(features) > self.max_samples: if not...
TSNE_Plot
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSNE_Plot: def __init__(self, perplexity=30, max_samples=2000, shuffle=False, **kwargs): """Computes a t-SNE 2d visualisation of the data Parameters ---------- perplexity : float, optional The perplexity is related to the number of nearest neighbors that is used in other manifold learnin...
stack_v2_sparse_classes_36k_train_021694
2,315
permissive
[ { "docstring": "Computes a t-SNE 2d visualisation of the data Parameters ---------- perplexity : float, optional The perplexity is related to the number of nearest neighbors that is used in other manifold learning algorithms (see t-SNE documentation), by default 30 max_samples : int, optional Limits the computa...
2
stack_v2_sparse_classes_30k_train_017423
Implement the Python class `TSNE_Plot` described below. Class description: Implement the TSNE_Plot class. Method signatures and docstrings: - def __init__(self, perplexity=30, max_samples=2000, shuffle=False, **kwargs): Computes a t-SNE 2d visualisation of the data Parameters ---------- perplexity : float, optional T...
Implement the Python class `TSNE_Plot` described below. Class description: Implement the TSNE_Plot class. Method signatures and docstrings: - def __init__(self, perplexity=30, max_samples=2000, shuffle=False, **kwargs): Computes a t-SNE 2d visualisation of the data Parameters ---------- perplexity : float, optional T...
041391f4ef0667e555046fc66f5beb67b4975dda
<|skeleton|> class TSNE_Plot: def __init__(self, perplexity=30, max_samples=2000, shuffle=False, **kwargs): """Computes a t-SNE 2d visualisation of the data Parameters ---------- perplexity : float, optional The perplexity is related to the number of nearest neighbors that is used in other manifold learnin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TSNE_Plot: def __init__(self, perplexity=30, max_samples=2000, shuffle=False, **kwargs): """Computes a t-SNE 2d visualisation of the data Parameters ---------- perplexity : float, optional The perplexity is related to the number of nearest neighbors that is used in other manifold learning algorithms (...
the_stack_v2_python_sparse
astronomaly/visualisation/tsne_plot.py
MichelleLochner/astronomaly
train
69
f1d81d0b6b61f0b5b2b9584be6a857792286e76c
[ "super(PositionalEncoding, self).__init__()\nposition_encoding = np.array([[pos / np.power(10000, 2.0 * (j // 2) / d_model) for j in range(d_model)] for pos in range(max_seq_len)])\nposition_encoding[:, 0::2] = np.sin(position_encoding[:, 0::2])\nposition_encoding[:, 1::2] = np.cos(position_encoding[:, 1::2])\npad_...
<|body_start_0|> super(PositionalEncoding, self).__init__() position_encoding = np.array([[pos / np.power(10000, 2.0 * (j // 2) / d_model) for j in range(d_model)] for pos in range(max_seq_len)]) position_encoding[:, 0::2] = np.sin(position_encoding[:, 0::2]) position_encoding[:, 1::2] =...
PositionalEncoding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionalEncoding: def __init__(self, d_model, max_seq_len): """初始化。 Args: d_model: 一个标量。模型的维度,论文默认是512 max_seq_len: 一个标量。文本序列的最大长度""" <|body_0|> def forward(self, input_len): """神经网络的前向传播。 Args: input_len: 一个张量,形状为[BATCH_SIZE, 1]。每一个张量的值代表这一批文本序列中对应的长度。 Returns: 返回...
stack_v2_sparse_classes_36k_train_021695
15,500
no_license
[ { "docstring": "初始化。 Args: d_model: 一个标量。模型的维度,论文默认是512 max_seq_len: 一个标量。文本序列的最大长度", "name": "__init__", "signature": "def __init__(self, d_model, max_seq_len)" }, { "docstring": "神经网络的前向传播。 Args: input_len: 一个张量,形状为[BATCH_SIZE, 1]。每一个张量的值代表这一批文本序列中对应的长度。 Returns: 返回这一批序列的位置编码,进行了对齐。", "nam...
2
stack_v2_sparse_classes_30k_train_013895
Implement the Python class `PositionalEncoding` described below. Class description: Implement the PositionalEncoding class. Method signatures and docstrings: - def __init__(self, d_model, max_seq_len): 初始化。 Args: d_model: 一个标量。模型的维度,论文默认是512 max_seq_len: 一个标量。文本序列的最大长度 - def forward(self, input_len): 神经网络的前向传播。 Args:...
Implement the Python class `PositionalEncoding` described below. Class description: Implement the PositionalEncoding class. Method signatures and docstrings: - def __init__(self, d_model, max_seq_len): 初始化。 Args: d_model: 一个标量。模型的维度,论文默认是512 max_seq_len: 一个标量。文本序列的最大长度 - def forward(self, input_len): 神经网络的前向传播。 Args:...
6dd9eb4b2c65c346debbaa4cfc6b6a3cbdaf8047
<|skeleton|> class PositionalEncoding: def __init__(self, d_model, max_seq_len): """初始化。 Args: d_model: 一个标量。模型的维度,论文默认是512 max_seq_len: 一个标量。文本序列的最大长度""" <|body_0|> def forward(self, input_len): """神经网络的前向传播。 Args: input_len: 一个张量,形状为[BATCH_SIZE, 1]。每一个张量的值代表这一批文本序列中对应的长度。 Returns: 返回...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionalEncoding: def __init__(self, d_model, max_seq_len): """初始化。 Args: d_model: 一个标量。模型的维度,论文默认是512 max_seq_len: 一个标量。文本序列的最大长度""" super(PositionalEncoding, self).__init__() position_encoding = np.array([[pos / np.power(10000, 2.0 * (j // 2) / d_model) for j in range(d_model)] for...
the_stack_v2_python_sparse
models/transformer.py
wkk-nlp/SGAN
train
0
14129a55aeaa36e67d6107888a1220ca73afc971
[ "if first_stage_features_stride != 16:\n raise ValueError('`first_stage_features_stride` must be 16.')\nsuper(FasterRCNNResnetKerasFeatureExtractor, self).__init__(is_training, first_stage_features_stride, batch_norm_trainable, weight_decay)\nself.classification_backbone = None\nself._variable_dict = {}\nself._r...
<|body_start_0|> if first_stage_features_stride != 16: raise ValueError('`first_stage_features_stride` must be 16.') super(FasterRCNNResnetKerasFeatureExtractor, self).__init__(is_training, first_stage_features_stride, batch_norm_trainable, weight_decay) self.classification_backbone ...
Faster R-CNN with Resnet feature extractor implementation.
FasterRCNNResnetKerasFeatureExtractor
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FasterRCNNResnetKerasFeatureExtractor: """Faster R-CNN with Resnet feature extractor implementation.""" def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_norm_trainable=False, weight_decay=0.0): """Constructor. Args...
stack_v2_sparse_classes_36k_train_021696
9,440
permissive
[ { "docstring": "Constructor. Args: is_training: See base class. resnet_v1_base_model: base resnet v1 network to use. One of the resnet_v1.resnet_v1_{50,101,152} models. resnet_v1_base_model_name: model name under which to construct resnet v1. first_stage_features_stride: See base class. batch_norm_trainable: Se...
4
stack_v2_sparse_classes_30k_train_005860
Implement the Python class `FasterRCNNResnetKerasFeatureExtractor` described below. Class description: Faster R-CNN with Resnet feature extractor implementation. Method signatures and docstrings: - def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_n...
Implement the Python class `FasterRCNNResnetKerasFeatureExtractor` described below. Class description: Faster R-CNN with Resnet feature extractor implementation. Method signatures and docstrings: - def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_n...
6fc53292b1d3ce3c0340ce724c2c11c77e663d27
<|skeleton|> class FasterRCNNResnetKerasFeatureExtractor: """Faster R-CNN with Resnet feature extractor implementation.""" def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_norm_trainable=False, weight_decay=0.0): """Constructor. Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FasterRCNNResnetKerasFeatureExtractor: """Faster R-CNN with Resnet feature extractor implementation.""" def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_norm_trainable=False, weight_decay=0.0): """Constructor. Args: is_training...
the_stack_v2_python_sparse
models/research/object_detection/models/faster_rcnn_resnet_keras_feature_extractor.py
aboerzel/German_License_Plate_Recognition
train
34
25be4c33a6df43f2b7267bca45aec9bd553fa021
[ "insert_op = str(uuid.uuid4())\nto_ins = df.rename(columns={'vintage': 'last_updated'}).assign(insert_op=insert_op, provider=self.provider, state_fips=self.state_fips)\nif 'location_type' not in list(to_ins):\n to_ins['location_type'] = self.location_type\nif 'source_url' not in list(to_ins):\n to_ins['source...
<|body_start_0|> insert_op = str(uuid.uuid4()) to_ins = df.rename(columns={'vintage': 'last_updated'}).assign(insert_op=insert_op, provider=self.provider, state_fips=self.state_fips) if 'location_type' not in list(to_ins): to_ins['location_type'] = self.location_type if 'sour...
Definition of common parameters and values for scraping a State Dashboard Attributes ---------- table: Type[Base] = CovidObservation SQLAlchemy base table to insert into provider = "state" Provider here is state data_type: str = "covid" Data type is set to covid has_location: bool Must be set by subclasses. True if loc...
StateDashboard
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateDashboard: """Definition of common parameters and values for scraping a State Dashboard Attributes ---------- table: Type[Base] = CovidObservation SQLAlchemy base table to insert into provider = "state" Provider here is state data_type: str = "covid" Data type is set to covid has_location: b...
stack_v2_sparse_classes_36k_train_021697
35,919
permissive
[ { "docstring": "prepare dataframe for `put` operation. Returns a modified DataFrame and the insert_op string", "name": "_prep_df", "signature": "def _prep_df(self, df: pd.DataFrame) -> Tuple[pd.DataFrame, str]" }, { "docstring": "Internal _put method for dumping data using TempTable class", ...
4
stack_v2_sparse_classes_30k_train_003659
Implement the Python class `StateDashboard` described below. Class description: Definition of common parameters and values for scraping a State Dashboard Attributes ---------- table: Type[Base] = CovidObservation SQLAlchemy base table to insert into provider = "state" Provider here is state data_type: str = "covid" Da...
Implement the Python class `StateDashboard` described below. Class description: Definition of common parameters and values for scraping a State Dashboard Attributes ---------- table: Type[Base] = CovidObservation SQLAlchemy base table to insert into provider = "state" Provider here is state data_type: str = "covid" Da...
e953871679222791f751b9bc26146ea607ebd937
<|skeleton|> class StateDashboard: """Definition of common parameters and values for scraping a State Dashboard Attributes ---------- table: Type[Base] = CovidObservation SQLAlchemy base table to insert into provider = "state" Provider here is state data_type: str = "covid" Data type is set to covid has_location: b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateDashboard: """Definition of common parameters and values for scraping a State Dashboard Attributes ---------- table: Type[Base] = CovidObservation SQLAlchemy base table to insert into provider = "state" Provider here is state data_type: str = "covid" Data type is set to covid has_location: bool Must be s...
the_stack_v2_python_sparse
can_tools/scrapers/official/base.py
mehanig/can-scrapers
train
1
09b0c926717bd4aaa9dbd3b659ad3621f39c03c2
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "direction = choice([1, -1])\ndistance = choice([0, 1, 2, 3, 4, 5])\nstep = distance * direction\nreturn step", "while len(self.x_values) < self.num_points:\n x_step = self.get_step()\n y_step = self.get_step()\n if x_step == 0 a...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> direction = choice([1, -1]) distance = choice([0, 1, 2, 3, 4, 5]) step = distance * direction return step <|end_body_1|> <|body_start_2|> ...
a class to generate random walks
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """a class to generate random walks""" def __init__(self, num_points=5000): """initialize the attributes of a walk""" <|body_0|> def get_step(self): """determine the direction and distance for a step""" <|body_1|> def fill_walk(self): ...
stack_v2_sparse_classes_36k_train_021698
1,203
no_license
[ { "docstring": "initialize the attributes of a walk", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "determine the direction and distance for a step", "name": "get_step", "signature": "def get_step(self)" }, { "docstring": "calculate all...
3
stack_v2_sparse_classes_30k_train_011955
Implement the Python class `RandomWalk` described below. Class description: a class to generate random walks Method signatures and docstrings: - def __init__(self, num_points=5000): initialize the attributes of a walk - def get_step(self): determine the direction and distance for a step - def fill_walk(self): calcula...
Implement the Python class `RandomWalk` described below. Class description: a class to generate random walks Method signatures and docstrings: - def __init__(self, num_points=5000): initialize the attributes of a walk - def get_step(self): determine the direction and distance for a step - def fill_walk(self): calcula...
18784c7e3abfb74f85f8c96cb0f8e606cab6dccc
<|skeleton|> class RandomWalk: """a class to generate random walks""" def __init__(self, num_points=5000): """initialize the attributes of a walk""" <|body_0|> def get_step(self): """determine the direction and distance for a step""" <|body_1|> def fill_walk(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """a class to generate random walks""" def __init__(self, num_points=5000): """initialize the attributes of a walk""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def get_step(self): """determine the direction and distance f...
the_stack_v2_python_sparse
chapter_15/random_walk.py
mwnickerson/python-crash-course
train
0
d95043f5f3764a56f9fc243ab5e7218b63d6f2a4
[ "if 'comm' not in problem_params:\n problem_params['comm'] = None\nessential_keys = ['nvars', 'nu', 'freq', 'comm']\nfor key in essential_keys:\n if key not in problem_params:\n msg = 'need %s to instantiate problem, only got %s' % (key, str(problem_params.keys()))\n raise ParameterError(msg)\ni...
<|body_start_0|> if 'comm' not in problem_params: problem_params['comm'] = None essential_keys = ['nvars', 'nu', 'freq', 'comm'] for key in essential_keys: if key not in problem_params: msg = 'need %s to instantiate problem, only got %s' % (key, str(proble...
Example implementing the forced 1D heat equation with periodic BC in [0,1], discretized using Dedalus
heat1d_dedalus_forced
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class heat1d_dedalus_forced: """Example implementing the forced 1D heat equation with periodic BC in [0,1], discretized using Dedalus""" def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): """Initialization routine Args: problem_params (dict): custom ...
stack_v2_sparse_classes_36k_train_021699
4,418
permissive
[ { "docstring": "Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed parent class) dtype_f: mesh data type (will be passed parent class)", "name": "__init__", "signature": "def __init__(self, problem_params, dtype_u=dedalus_field, ...
4
null
Implement the Python class `heat1d_dedalus_forced` described below. Class description: Example implementing the forced 1D heat equation with periodic BC in [0,1], discretized using Dedalus Method signatures and docstrings: - def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): In...
Implement the Python class `heat1d_dedalus_forced` described below. Class description: Example implementing the forced 1D heat equation with periodic BC in [0,1], discretized using Dedalus Method signatures and docstrings: - def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): In...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class heat1d_dedalus_forced: """Example implementing the forced 1D heat equation with periodic BC in [0,1], discretized using Dedalus""" def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): """Initialization routine Args: problem_params (dict): custom ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class heat1d_dedalus_forced: """Example implementing the forced 1D heat equation with periodic BC in [0,1], discretized using Dedalus""" def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): """Initialization routine Args: problem_params (dict): custom parameters fo...
the_stack_v2_python_sparse
pySDC/playgrounds/deprecated/Dedalus/HeatEquation_1D_Dedalus_forced.py
Parallel-in-Time/pySDC
train
30