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
46780f22b185fa8b881a63bb12a4c78e9e993e7b
[ "if not t1 and (not t2):\n return True\nif not t1 or not t2:\n return False\nif t1.val != t2.val:\n return False\nreturn self.is_same_tree_(t1.left, t2.left) and self.is_same_tree_(t1.right, t2.right)", "def check(tree_1: 'TreeNode', tree_2: 'TreeNode') -> bool:\n if not tree_1 and (not tree_2):\n ...
<|body_start_0|> if not t1 and (not t2): return True if not t1 or not t2: return False if t1.val != t2.val: return False return self.is_same_tree_(t1.left, t2.left) and self.is_same_tree_(t1.right, t2.right) <|end_body_0|> <|body_start_1|> def...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:""" <|body_0|> def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach:...
stack_v2_sparse_classes_36k_train_021800
1,537
no_license
[ { "docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:", "name": "is_same_tree_", "signature": "def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool" }, { "docstring": "Approach: Iteration Time Complexity: O(N) Space Complexity:...
2
stack_v2_sparse_classes_30k_train_015641
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return: - def is_same...
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return: - def is_same...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class BinaryTree: def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:""" <|body_0|> def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryTree: def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:""" if not t1 and (not t2): return True if not t1 or not t2: return False if t1...
the_stack_v2_python_sparse
revisited/trees/same_tree.py
Shiv2157k/leet_code
train
1
645021bac95726a95e7f8e26f805e3b68af5ede3
[ "self.snn = snn\nself.xtrn = xtrn\nself.ytrn = ytrn", "self.snn.coefs_[0] = weights[:1800].reshape((30, 60))\nself.snn.coefs_[1] = weights[1800:1860].reshape((60, 1))\nself.snn.intercepts_[0] = weights[1860:1920]\nself.snn.intercepts_[1] = weights[1920]\nreturn 1.0 - self.snn.score(self.xtrn, self.ytrn)" ]
<|body_start_0|> self.snn = snn self.xtrn = xtrn self.ytrn = ytrn <|end_body_0|> <|body_start_1|> self.snn.coefs_[0] = weights[:1800].reshape((30, 60)) self.snn.coefs_[1] = weights[1800:1860].reshape((60, 1)) self.snn.intercepts_[0] = weights[1860:1920] self.snn....
SwarmObjective
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwarmObjective: def __init__(self, snn, xtrn, ytrn): """Keep the NN object and test data""" <|body_0|> def Evaluate(self, weights): """Test the NN with the given weights""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.snn = snn self.xtr...
stack_v2_sparse_classes_36k_train_021801
5,989
permissive
[ { "docstring": "Keep the NN object and test data", "name": "__init__", "signature": "def __init__(self, snn, xtrn, ytrn)" }, { "docstring": "Test the NN with the given weights", "name": "Evaluate", "signature": "def Evaluate(self, weights)" } ]
2
null
Implement the Python class `SwarmObjective` described below. Class description: Implement the SwarmObjective class. Method signatures and docstrings: - def __init__(self, snn, xtrn, ytrn): Keep the NN object and test data - def Evaluate(self, weights): Test the NN with the given weights
Implement the Python class `SwarmObjective` described below. Class description: Implement the SwarmObjective class. Method signatures and docstrings: - def __init__(self, snn, xtrn, ytrn): Keep the NN object and test data - def Evaluate(self, weights): Test the NN with the given weights <|skeleton|> class SwarmObjec...
5445b6f90ab49339ca0fdb71e98d44e6827c95a8
<|skeleton|> class SwarmObjective: def __init__(self, snn, xtrn, ytrn): """Keep the NN object and test data""" <|body_0|> def Evaluate(self, weights): """Test the NN with the given weights""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SwarmObjective: def __init__(self, snn, xtrn, ytrn): """Keep the NN object and test data""" self.snn = snn self.xtrn = xtrn self.ytrn = ytrn def Evaluate(self, weights): """Test the NN with the given weights""" self.snn.coefs_[0] = weights[:1800].reshape((3...
the_stack_v2_python_sparse
nn/nn.py
dayoladejo/SwarmOptimization
train
0
1b7575a64366b7da437ac0ffd9fddd6860b639ac
[ "self.cutoff = cutoff\nself.box_width = box_width\nself.voxel_width = voxel_width\nself.reduce_to_contacts = reduce_to_contacts", "if 'complex' in kwargs:\n datapoint = kwargs.get('complex')\n raise DeprecationWarning('Complex is being phased out as a parameter, please pass \"datapoint\" instead.')\ntry:\n ...
<|body_start_0|> self.cutoff = cutoff self.box_width = box_width self.voxel_width = voxel_width self.reduce_to_contacts = reduce_to_contacts <|end_body_0|> <|body_start_1|> if 'complex' in kwargs: datapoint = kwargs.get('complex') raise DeprecationWarning...
Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it originated to create a local salt bridge array. ...
SaltBridgeVoxelizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaltBridgeVoxelizer: """Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it o...
stack_v2_sparse_classes_36k_train_021802
27,676
permissive
[ { "docstring": "Parameters ---------- cutoff: float, optional (default 5.0) The distance in angstroms within which atoms must be to be considered for a salt bridge between them. box_width: float, optional (default 16.0) Size of a box in which voxel features are calculated. Box is centered on a ligand centroid. ...
2
null
Implement the Python class `SaltBridgeVoxelizer` described below. Class description: Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this...
Implement the Python class `SaltBridgeVoxelizer` described below. Class description: Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class SaltBridgeVoxelizer: """Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaltBridgeVoxelizer: """Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it originated to ...
the_stack_v2_python_sparse
deepchem/feat/complex_featurizers/grid_featurizers.py
deepchem/deepchem
train
4,876
d14f8beeb9e8e03cbbb7f62f5d364e9578d23aa4
[ "ReconstFit.__init__(self, fiber_model, vox_data)\nself.life_matrix = life_matrix\nself.vox_coords = vox_coords\nself.fit_data = to_fit\nself.beta = beta\nself.weighted_signal = weighted_signal\nself.b0_signal = b0_signal\nself.relative_signal = relative_signal\nself.mean_signal = mean_sig\nself.streamline = stream...
<|body_start_0|> ReconstFit.__init__(self, fiber_model, vox_data) self.life_matrix = life_matrix self.vox_coords = vox_coords self.fit_data = to_fit self.beta = beta self.weighted_signal = weighted_signal self.b0_signal = b0_signal self.relative_signal = r...
A fit of the LiFE model to diffusion data
FiberFit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FiberFit: """A fit of the LiFE model to diffusion data""" def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): """Parameters ---------- fiber_model : A FiberModel class inst...
stack_v2_sparse_classes_36k_train_021803
20,065
permissive
[ { "docstring": "Parameters ---------- fiber_model : A FiberModel class instance params : the parameters derived from a fit of the model to the data.", "name": "__init__", "signature": "def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mea...
2
stack_v2_sparse_classes_30k_train_018197
Implement the Python class `FiberFit` described below. Class description: A fit of the LiFE model to diffusion data Method signatures and docstrings: - def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): Pa...
Implement the Python class `FiberFit` described below. Class description: A fit of the LiFE model to diffusion data Method signatures and docstrings: - def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): Pa...
3c3acc55de8ba741e673063378e6cbaf10b64c7a
<|skeleton|> class FiberFit: """A fit of the LiFE model to diffusion data""" def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): """Parameters ---------- fiber_model : A FiberModel class inst...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FiberFit: """A fit of the LiFE model to diffusion data""" def __init__(self, fiber_model, life_matrix, vox_coords, to_fit, beta, weighted_signal, b0_signal, relative_signal, mean_sig, vox_data, streamline, affine, evals): """Parameters ---------- fiber_model : A FiberModel class instance params :...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/dipy/tracking/life.py
Raniac/NEURO-LEARN
train
9
3088d426fbd8143cc42f87b0b294569f20b89150
[ "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!')" ]
<|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...
Proto file describing the Ad Group Criterion Label service. Service to manage labels on ad group criteria.
AdGroupCriterionLabelServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdGroupCriterionLabelServiceServicer: """Proto file describing the Ad Group Criterion Label service. Service to manage labels on ad group criteria.""" def GetAdGroupCriterionLabel(self, request, context): """Returns the requested ad group criterion label in full detail.""" <|...
stack_v2_sparse_classes_36k_train_021804
3,841
permissive
[ { "docstring": "Returns the requested ad group criterion label in full detail.", "name": "GetAdGroupCriterionLabel", "signature": "def GetAdGroupCriterionLabel(self, request, context)" }, { "docstring": "Creates and removes ad group criterion labels. Operation statuses are returned.", "name"...
2
null
Implement the Python class `AdGroupCriterionLabelServiceServicer` described below. Class description: Proto file describing the Ad Group Criterion Label service. Service to manage labels on ad group criteria. Method signatures and docstrings: - def GetAdGroupCriterionLabel(self, request, context): Returns the request...
Implement the Python class `AdGroupCriterionLabelServiceServicer` described below. Class description: Proto file describing the Ad Group Criterion Label service. Service to manage labels on ad group criteria. Method signatures and docstrings: - def GetAdGroupCriterionLabel(self, request, context): Returns the request...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class AdGroupCriterionLabelServiceServicer: """Proto file describing the Ad Group Criterion Label service. Service to manage labels on ad group criteria.""" def GetAdGroupCriterionLabel(self, request, context): """Returns the requested ad group criterion label in full detail.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdGroupCriterionLabelServiceServicer: """Proto file describing the Ad Group Criterion Label service. Service to manage labels on ad group criteria.""" def GetAdGroupCriterionLabel(self, request, context): """Returns the requested ad group criterion label in full detail.""" context.set_cod...
the_stack_v2_python_sparse
google/ads/google_ads/v2/proto/services/ad_group_criterion_label_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
44462eb6d42cea46ad622054eac699a07e37c013
[ "from m4.devices.i4d import I4D\nself._i4d = I4D(Interferometer.i4d_IP, Interferometer.i4d_port)\nself._ic = InterferometerConverter()\nself._logger = logging.getLogger('4D')", "if nframes == 1:\n width, height, pixel_size_in_microns, data_array = self._i4d.takeSingleMeasurement()\nelse:\n data_array = np.z...
<|body_start_0|> from m4.devices.i4d import I4D self._i4d = I4D(Interferometer.i4d_IP, Interferometer.i4d_port) self._ic = InterferometerConverter() self._logger = logging.getLogger('4D') <|end_body_0|> <|body_start_1|> if nframes == 1: width, height, pixel_size_in_m...
Class for i4d 6110 interferometer
I4d6110
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class I4d6110: """Class for i4d 6110 interferometer""" def __init__(self): """The constructor""" <|body_0|> def acquire_phasemap(self, nframes=1, show=0): """Parameters ---------- nframes: int number of frames show: int 0 to not show the image Returns ------- masked_im...
stack_v2_sparse_classes_36k_train_021805
4,915
no_license
[ { "docstring": "The constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Parameters ---------- nframes: int number of frames show: int 0 to not show the image Returns ------- masked_ima: numpy masked array interferometer image", "name": "acquire_phasemap", ...
3
null
Implement the Python class `I4d6110` described below. Class description: Class for i4d 6110 interferometer Method signatures and docstrings: - def __init__(self): The constructor - def acquire_phasemap(self, nframes=1, show=0): Parameters ---------- nframes: int number of frames show: int 0 to not show the image Retu...
Implement the Python class `I4d6110` described below. Class description: Class for i4d 6110 interferometer Method signatures and docstrings: - def __init__(self): The constructor - def acquire_phasemap(self, nframes=1, show=0): Parameters ---------- nframes: int number of frames show: int 0 to not show the image Retu...
cfb3757cc491199248dba767ddf47dce9b191261
<|skeleton|> class I4d6110: """Class for i4d 6110 interferometer""" def __init__(self): """The constructor""" <|body_0|> def acquire_phasemap(self, nframes=1, show=0): """Parameters ---------- nframes: int number of frames show: int 0 to not show the image Returns ------- masked_im...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class I4d6110: """Class for i4d 6110 interferometer""" def __init__(self): """The constructor""" from m4.devices.i4d import I4D self._i4d = I4D(Interferometer.i4d_IP, Interferometer.i4d_port) self._ic = InterferometerConverter() self._logger = logging.getLogger('4D') ...
the_stack_v2_python_sparse
m4/devices/interferometer.py
alfiopuglisi/M4
train
0
e8fe9e7e0ad0442326e31da4469c1a303711a6f1
[ "max_sub_sum = max(nums)\nfor i in range(len(nums)):\n tmp = nums[i]\n for j in range(i + 1, len(nums)):\n if tmp + nums[j] > 0:\n tmp += nums[j]\n if max_sub_sum < tmp:\n max_sub_sum = tmp\n else:\n break\nreturn max_sub_sum", "if not nums:\n ...
<|body_start_0|> max_sub_sum = max(nums) for i in range(len(nums)): tmp = nums[i] for j in range(i + 1, len(nums)): if tmp + nums[j] > 0: tmp += nums[j] if max_sub_sum < tmp: max_sub_sum = tmp ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums: list): """时间复杂度为O(n^2) :param nums: :return:""" <|body_0|> def maxSubArray1(self, nums: list): """动态规划,时间复杂度为O(n) :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_sub_sum = max(nums) ...
stack_v2_sparse_classes_36k_train_021806
1,219
no_license
[ { "docstring": "时间复杂度为O(n^2) :param nums: :return:", "name": "maxSubArray", "signature": "def maxSubArray(self, nums: list)" }, { "docstring": "动态规划,时间复杂度为O(n) :param nums: :return:", "name": "maxSubArray1", "signature": "def maxSubArray1(self, nums: list)" } ]
2
stack_v2_sparse_classes_30k_train_002954
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: list): 时间复杂度为O(n^2) :param nums: :return: - def maxSubArray1(self, nums: list): 动态规划,时间复杂度为O(n) :param nums: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: list): 时间复杂度为O(n^2) :param nums: :return: - def maxSubArray1(self, nums: list): 动态规划,时间复杂度为O(n) :param nums: :return: <|skeleton|> class Solution: ...
5f67368e72c376c1299b849e7a92e6d0cbd9ae55
<|skeleton|> class Solution: def maxSubArray(self, nums: list): """时间复杂度为O(n^2) :param nums: :return:""" <|body_0|> def maxSubArray1(self, nums: list): """动态规划,时间复杂度为O(n) :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums: list): """时间复杂度为O(n^2) :param nums: :return:""" max_sub_sum = max(nums) for i in range(len(nums)): tmp = nums[i] for j in range(i + 1, len(nums)): if tmp + nums[j] > 0: tmp += nums[j] ...
the_stack_v2_python_sparse
53-最大子序和/solution.py
BillyChao/leetcode
train
5
fe13420446b89d6d86399e9f1086d0ac6bcfa080
[ "packagestr = request.data\nif packagestr['path'][-1] != '/':\n packagestr['path'] = packagestr['path'] + '/'\npackage_dir = settings.PACKAGE_DIR\nif package_dir[-1] == '/':\n package_dir = package_dir[:-1]\npackagestr['path'] = package_dir + packagestr['path']\ncmd = 'rpm -ivh ' + packagestr['path'] + packag...
<|body_start_0|> packagestr = request.data if packagestr['path'][-1] != '/': packagestr['path'] = packagestr['path'] + '/' package_dir = settings.PACKAGE_DIR if package_dir[-1] == '/': package_dir = package_dir[:-1] packagestr['path'] = package_dir + packa...
install packages,uninstall packages ['post', 'delete']
packages
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class packages: """install packages,uninstall packages ['post', 'delete']""" def post(self, request, format=None): """install packages""" <|body_0|> def delete(self, request, format=None): """uninstall packages""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021807
7,576
no_license
[ { "docstring": "install packages", "name": "post", "signature": "def post(self, request, format=None)" }, { "docstring": "uninstall packages", "name": "delete", "signature": "def delete(self, request, format=None)" } ]
2
null
Implement the Python class `packages` described below. Class description: install packages,uninstall packages ['post', 'delete'] Method signatures and docstrings: - def post(self, request, format=None): install packages - def delete(self, request, format=None): uninstall packages
Implement the Python class `packages` described below. Class description: install packages,uninstall packages ['post', 'delete'] Method signatures and docstrings: - def post(self, request, format=None): install packages - def delete(self, request, format=None): uninstall packages <|skeleton|> class packages: """...
7f801a569a396a27371d0831752595877c224a6b
<|skeleton|> class packages: """install packages,uninstall packages ['post', 'delete']""" def post(self, request, format=None): """install packages""" <|body_0|> def delete(self, request, format=None): """uninstall packages""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class packages: """install packages,uninstall packages ['post', 'delete']""" def post(self, request, format=None): """install packages""" packagestr = request.data if packagestr['path'][-1] != '/': packagestr['path'] = packagestr['path'] + '/' package_dir = settings....
the_stack_v2_python_sparse
Python_projects/flask_projects/unicorn_project/packages/views.py
sdtimothy8/Coding
train
0
bbd805c106c412cf5e124b5ba0b85fa21a782357
[ "pointer_a, pointer_b = (headA, headB)\nwhile pointer_a is not pointer_b:\n pointer_a = headB if pointer_a is None else pointer_a.next\n pointer_b = headA if pointer_b is None else pointer_b.next\nreturn pointer_a", "if headA is None or headB is None:\n return None\na, b = (headA, headB)\ncntA, cntB = (1...
<|body_start_0|> pointer_a, pointer_b = (headA, headB) while pointer_a is not pointer_b: pointer_a = headB if pointer_a is None else pointer_a.next pointer_b = headA if pointer_b is None else pointer_b.next return pointer_a <|end_body_0|> <|body_start_1|> if head...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_021808
2,275
no_license
[ { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNod...
2
stack_v2_sparse_classes_30k_train_006662
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: Lis...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" pointer_a, pointer_b = (headA, headB) while pointer_a is not pointer_b: pointer_a = headB if pointer_a is None else pointer_a.next pointer_b = headA if poi...
the_stack_v2_python_sparse
code160IntersectionOfTwoLinkedLists.py
cybelewang/leetcode-python
train
0
98159f369cfe107735b777c0541331cf421af48a
[ "if len(temp) == k:\n result.append(temp[:])\n return\ni = num\nwhile i <= n:\n temp.append(i)\n self.search_num(n, k, i + 1, result, temp)\n temp.pop()\n i += 1", "result = []\ntemp = []\nself.search_num(n, k, 1, result, temp)\nreturn result", "result = []\ntemp = []\nself.search_helper(n, k,...
<|body_start_0|> if len(temp) == k: result.append(temp[:]) return i = num while i <= n: temp.append(i) self.search_num(n, k, i + 1, result, temp) temp.pop() i += 1 <|end_body_0|> <|body_start_1|> result = [] ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search_num(self, n: int, k: int, num: int, result: List[List[int]], temp: List[int]) -> None: """深度优先遍历 Args: n: 1-n之间的数 k: 选择k个数 num:当前数字 result:结果链表 temp:当前链表 Returns: 结果链表""" <|body_0|> def combine(self, n: int, k: int) -> List[List[int]]: """数组排列组合 ...
stack_v2_sparse_classes_36k_train_021809
3,290
permissive
[ { "docstring": "深度优先遍历 Args: n: 1-n之间的数 k: 选择k个数 num:当前数字 result:结果链表 temp:当前链表 Returns: 结果链表", "name": "search_num", "signature": "def search_num(self, n: int, k: int, num: int, result: List[List[int]], temp: List[int]) -> None" }, { "docstring": "数组排列组合 Args: n: 1-n之间的数 k: 选择k个数 Returns: 排列组合之...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_num(self, n: int, k: int, num: int, result: List[List[int]], temp: List[int]) -> None: 深度优先遍历 Args: n: 1-n之间的数 k: 选择k个数 num:当前数字 result:结果链表 temp:当前链表 Returns: 结果链表 - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_num(self, n: int, k: int, num: int, result: List[List[int]], temp: List[int]) -> None: 深度优先遍历 Args: n: 1-n之间的数 k: 选择k个数 num:当前数字 result:结果链表 temp:当前链表 Returns: 结果链表 - ...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def search_num(self, n: int, k: int, num: int, result: List[List[int]], temp: List[int]) -> None: """深度优先遍历 Args: n: 1-n之间的数 k: 选择k个数 num:当前数字 result:结果链表 temp:当前链表 Returns: 结果链表""" <|body_0|> def combine(self, n: int, k: int) -> List[List[int]]: """数组排列组合 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search_num(self, n: int, k: int, num: int, result: List[List[int]], temp: List[int]) -> None: """深度优先遍历 Args: n: 1-n之间的数 k: 选择k个数 num:当前数字 result:结果链表 temp:当前链表 Returns: 结果链表""" if len(temp) == k: result.append(temp[:]) return i = num while...
the_stack_v2_python_sparse
src/leetcodepython/array/combinations_77.py
zhangyu345293721/leetcode
train
101
e204ca8a0b9f42541fa54ca452229e35b41a5c13
[ "return_url = post.pop('return_url', '')\nif not return_url:\n return_url = '/shop/payment/validate/'\nreturn return_url", "res = False\nreference = post['orderid']\nif reference:\n _logger.info('bambora: validated data')\n res = request.env['payment.transaction'].sudo().form_feedback(post, 'bambora_vkda...
<|body_start_0|> return_url = post.pop('return_url', '') if not return_url: return_url = '/shop/payment/validate/' return return_url <|end_body_0|> <|body_start_1|> res = False reference = post['orderid'] if reference: _logger.info('bambora: valid...
Handles the redirection back from payment gateway to merchant site
BamboraController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BamboraController: """Handles the redirection back from payment gateway to merchant site""" def _get_return_url(self, **post): """Extract the return URL from the data coming from bambora.""" <|body_0|> def bambora_validate_data(self, **post): """Validate the data...
stack_v2_sparse_classes_36k_train_021810
2,006
no_license
[ { "docstring": "Extract the return URL from the data coming from bambora.", "name": "_get_return_url", "signature": "def _get_return_url(self, **post)" }, { "docstring": "Validate the data coming from bambora.", "name": "bambora_validate_data", "signature": "def bambora_validate_data(sel...
4
null
Implement the Python class `BamboraController` described below. Class description: Handles the redirection back from payment gateway to merchant site Method signatures and docstrings: - def _get_return_url(self, **post): Extract the return URL from the data coming from bambora. - def bambora_validate_data(self, **pos...
Implement the Python class `BamboraController` described below. Class description: Handles the redirection back from payment gateway to merchant site Method signatures and docstrings: - def _get_return_url(self, **post): Extract the return URL from the data coming from bambora. - def bambora_validate_data(self, **pos...
0ed19a2d40a5a9de44e3247cca56211c65e6c63a
<|skeleton|> class BamboraController: """Handles the redirection back from payment gateway to merchant site""" def _get_return_url(self, **post): """Extract the return URL from the data coming from bambora.""" <|body_0|> def bambora_validate_data(self, **post): """Validate the data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BamboraController: """Handles the redirection back from payment gateway to merchant site""" def _get_return_url(self, **post): """Extract the return URL from the data coming from bambora.""" return_url = post.pop('return_url', '') if not return_url: return_url = '/shop...
the_stack_v2_python_sparse
payment_bambora_vkdata/controllers/main.py
tate11/vkd-odoo-sh
train
0
337dc67ed4620a488f66b001d77dd9753dde6486
[ "try:\n activity = request.json\n (services.log_service().upsert_activity(activity), 201)\nexcept Exception as e:\n nsp.abort(500, 'An internal error has occurred: {}'.format(e))", "try:\n activity = request.json\n (services.log_service().upsert_activity(activity), 204)\nexcept Exception as e:\n ...
<|body_start_0|> try: activity = request.json (services.log_service().upsert_activity(activity), 201) except Exception as e: nsp.abort(500, 'An internal error has occurred: {}'.format(e)) <|end_body_0|> <|body_start_1|> try: activity = request.jso...
Activity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Activity: def post(self): """Insert a new activity log""" <|body_0|> def put(self): """Update an activity object by it's id.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: activity = request.json (services.log_service()...
stack_v2_sparse_classes_36k_train_021811
4,427
no_license
[ { "docstring": "Insert a new activity log", "name": "post", "signature": "def post(self)" }, { "docstring": "Update an activity object by it's id.", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_002633
Implement the Python class `Activity` described below. Class description: Implement the Activity class. Method signatures and docstrings: - def post(self): Insert a new activity log - def put(self): Update an activity object by it's id.
Implement the Python class `Activity` described below. Class description: Implement the Activity class. Method signatures and docstrings: - def post(self): Insert a new activity log - def put(self): Update an activity object by it's id. <|skeleton|> class Activity: def post(self): """Insert a new activi...
df826cf7098aee59e0a1ced6f465c2e8bb3df9a5
<|skeleton|> class Activity: def post(self): """Insert a new activity log""" <|body_0|> def put(self): """Update an activity object by it's id.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Activity: def post(self): """Insert a new activity log""" try: activity = request.json (services.log_service().upsert_activity(activity), 201) except Exception as e: nsp.abort(500, 'An internal error has occurred: {}'.format(e)) def put(self): ...
the_stack_v2_python_sparse
patient_portal/patient_portal/api/logs.py
bkh148/patient-cloud
train
0
6d7dc80a330fe276c6b2d5583c475d55b72b2bb4
[ "digits = []\ndec = 10\nwhile n > 0:\n d = n % dec\n digits.append(d)\n n = (n - d) // dec\nm = len(digits)\ni = 1\nwhile i < m:\n if digits[i] < digits[i - 1]:\n break\n i += 1\nif i == m:\n return -1\nj = 0\nwhile j <= i:\n if digits[j] > digits[i]:\n break\n j += 1\ndigits[i...
<|body_start_0|> digits = [] dec = 10 while n > 0: d = n % dec digits.append(d) n = (n - d) // dec m = len(digits) i = 1 while i < m: if digits[i] < digits[i - 1]: break i += 1 if i == m: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreaterElement(self, n): """:type n: int :rtype: int""" <|body_0|> def nextGreaterElementStr(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> digits = [] dec = 10 while n > 0: ...
stack_v2_sparse_classes_36k_train_021812
2,345
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "nextGreaterElement", "signature": "def nextGreaterElement(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "nextGreaterElementStr", "signature": "def nextGreaterElementStr(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_010077
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 - def nextGreaterElementStr(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElement(self, n): :type n: int :rtype: int - def nextGreaterElementStr(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def nextGreaterElement...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def nextGreaterElement(self, n): """:type n: int :rtype: int""" <|body_0|> def nextGreaterElementStr(self, n): """:type n: int :rtype: int""" <|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""" digits = [] dec = 10 while n > 0: d = n % dec digits.append(d) n = (n - d) // dec m = len(digits) i = 1 while i < m: if digits[i] < ...
the_stack_v2_python_sparse
N/NextGreaterElementIII.py
bssrdf/pyleet
train
2
61c4a7646c8cc0c477a84dc3446ee4e6df7d488e
[ "try:\n response = super(APIBaseView, self).dispatch_request(request, *args, **kwargs)\n if isawaitable(response):\n response = await response\nexcept Exception as exception:\n response = await self.handle_exception(exception)\nreturn response", "if isinstance(exception, ValidationError):\n res...
<|body_start_0|> try: response = super(APIBaseView, self).dispatch_request(request, *args, **kwargs) if isawaitable(response): response = await response except Exception as exception: response = await self.handle_exception(exception) return res...
扩展 class based view, 增加异常处理
APIBaseView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIBaseView: """扩展 class based view, 增加异常处理""" async def dispatch_request(self, request, *args, **kwargs): """扩展 http 请求的分发, 添加错误处理""" <|body_0|> async def handle_exception(self, exception): """处理异常 ValidationError, APIException: 返回适当的错误信息 else: 重新抛出异常""" ...
stack_v2_sparse_classes_36k_train_021813
3,695
no_license
[ { "docstring": "扩展 http 请求的分发, 添加错误处理", "name": "dispatch_request", "signature": "async def dispatch_request(self, request, *args, **kwargs)" }, { "docstring": "处理异常 ValidationError, APIException: 返回适当的错误信息 else: 重新抛出异常", "name": "handle_exception", "signature": "async def handle_excepti...
2
stack_v2_sparse_classes_30k_train_009872
Implement the Python class `APIBaseView` described below. Class description: 扩展 class based view, 增加异常处理 Method signatures and docstrings: - async def dispatch_request(self, request, *args, **kwargs): 扩展 http 请求的分发, 添加错误处理 - async def handle_exception(self, exception): 处理异常 ValidationError, APIException: 返回适当的错误信息 el...
Implement the Python class `APIBaseView` described below. Class description: 扩展 class based view, 增加异常处理 Method signatures and docstrings: - async def dispatch_request(self, request, *args, **kwargs): 扩展 http 请求的分发, 添加错误处理 - async def handle_exception(self, exception): 处理异常 ValidationError, APIException: 返回适当的错误信息 el...
8b8a0684de8e7fcdf0c229b05816cf7cbd5909f2
<|skeleton|> class APIBaseView: """扩展 class based view, 增加异常处理""" async def dispatch_request(self, request, *args, **kwargs): """扩展 http 请求的分发, 添加错误处理""" <|body_0|> async def handle_exception(self, exception): """处理异常 ValidationError, APIException: 返回适当的错误信息 else: 重新抛出异常""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class APIBaseView: """扩展 class based view, 增加异常处理""" async def dispatch_request(self, request, *args, **kwargs): """扩展 http 请求的分发, 添加错误处理""" try: response = super(APIBaseView, self).dispatch_request(request, *args, **kwargs) if isawaitable(response): resp...
the_stack_v2_python_sparse
src/views/utils.py
Kingvast/qrcode_web
train
1
94738d0dd4bd733307056b3e8f31ca059734579b
[ "nr_rows, _ = data_frame.shape\nif not nr_rows:\n return '*<empty table>*'\nif nr_rows <= self._DATAFRAM_HEADER_ROWS + self._DATAFRAM_TAIL_ROWS:\n return tabulate.tabulate(data_frame, tablefmt='pipe', headers='keys')\nreturn_lines = []\nreturn_lines.append(tabulate.tabulate(data_frame[:self._DATAFRAM_HEADER_R...
<|body_start_0|> nr_rows, _ = data_frame.shape if not nr_rows: return '*<empty table>*' if nr_rows <= self._DATAFRAM_HEADER_ROWS + self._DATAFRAM_TAIL_ROWS: return tabulate.tabulate(data_frame, tablefmt='pipe', headers='keys') return_lines = [] return_line...
Markdown story exporter.
MarkdownStoryExporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarkdownStoryExporter: """Markdown story exporter.""" def _dataframe_to_markdown(self, data_frame): """Returns a markdown formatted string from a pandas DataFrame.""" <|body_0|> def export_story(self): """Export the story as a markdown.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_021814
3,234
permissive
[ { "docstring": "Returns a markdown formatted string from a pandas DataFrame.", "name": "_dataframe_to_markdown", "signature": "def _dataframe_to_markdown(self, data_frame)" }, { "docstring": "Export the story as a markdown.", "name": "export_story", "signature": "def export_story(self)" ...
2
stack_v2_sparse_classes_30k_train_005638
Implement the Python class `MarkdownStoryExporter` described below. Class description: Markdown story exporter. Method signatures and docstrings: - def _dataframe_to_markdown(self, data_frame): Returns a markdown formatted string from a pandas DataFrame. - def export_story(self): Export the story as a markdown.
Implement the Python class `MarkdownStoryExporter` described below. Class description: Markdown story exporter. Method signatures and docstrings: - def _dataframe_to_markdown(self, data_frame): Returns a markdown formatted string from a pandas DataFrame. - def export_story(self): Export the story as a markdown. <|sk...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class MarkdownStoryExporter: """Markdown story exporter.""" def _dataframe_to_markdown(self, data_frame): """Returns a markdown formatted string from a pandas DataFrame.""" <|body_0|> def export_story(self): """Export the story as a markdown.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MarkdownStoryExporter: """Markdown story exporter.""" def _dataframe_to_markdown(self, data_frame): """Returns a markdown formatted string from a pandas DataFrame.""" nr_rows, _ = data_frame.shape if not nr_rows: return '*<empty table>*' if nr_rows <= self._DAT...
the_stack_v2_python_sparse
timesketch/lib/stories/markdown.py
google/timesketch
train
2,263
6d3c7468846a6671d70aaa25304680bec4242f78
[ "super(EncoderBlock, self).__init__()\nself.mha = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNormalization(...
<|body_start_0|> super(EncoderBlock, self).__init__() self.mha = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(dm) self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06) ...
create an encoder block for a transformer
EncoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderBlock: """create an encoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, training, mask=None): """Public instance method""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_021815
1,459
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)" }, { "docstring": "Public instance method", "name": "call", "signature": "def call(self, x, training, mask=None)" } ]
2
null
Implement the Python class `EncoderBlock` described below. Class description: create an encoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor - def call(self, x, training, mask=None): Public instance method
Implement the Python class `EncoderBlock` described below. Class description: create an encoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor - def call(self, x, training, mask=None): Public instance method <|skeleton|> class EncoderBl...
c23deee331a71a089197547fcae4c1eefb8d24ef
<|skeleton|> class EncoderBlock: """create an encoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, training, mask=None): """Public instance method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderBlock: """create an encoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" super(EncoderBlock, self).__init__() self.mha = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(hidden, activation='r...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/7-transformer_encoder_block.py
YosriGFX/holbertonschool-machine_learning
train
0
ebca861fe181c2e8074734923c1a73988444313f
[ "if config is None:\n config = KubernetesDagRunnerConfig()\nsuper().__init__(config)", "if not pipeline.pipeline_info.run_id:\n pipeline.pipeline_info.run_id = datetime.datetime.now().isoformat()\nif not kube_utils.is_inside_cluster():\n kubernetes_remote_runner.run_as_kubernetes_job(pipeline=pipeline, t...
<|body_start_0|> if config is None: config = KubernetesDagRunnerConfig() super().__init__(config) <|end_body_0|> <|body_start_1|> if not pipeline.pipeline_info.run_id: pipeline.pipeline_info.run_id = datetime.datetime.now().isoformat() if not kube_utils.is_inside...
TFX runner on Kubernetes.
KubernetesDagRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KubernetesDagRunner: """TFX runner on Kubernetes.""" def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None): """Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pip...
stack_v2_sparse_classes_36k_train_021816
10,406
permissive
[ { "docstring": "Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config that supports InProcessComponentLauncher and KubernetesComponentLauncher.", "name": "__init__", "signature": "def __i...
3
null
Implement the Python class `KubernetesDagRunner` described below. Class description: TFX runner on Kubernetes. Method signatures and docstrings: - def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None): Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for cus...
Implement the Python class `KubernetesDagRunner` described below. Class description: TFX runner on Kubernetes. Method signatures and docstrings: - def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None): Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for cus...
1b328504fa08a70388691e4072df76f143631325
<|skeleton|> class KubernetesDagRunner: """TFX runner on Kubernetes.""" def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None): """Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pip...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KubernetesDagRunner: """TFX runner on Kubernetes.""" def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None): """Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config ...
the_stack_v2_python_sparse
tfx/orchestration/experimental/kubernetes/kubernetes_dag_runner.py
tensorflow/tfx
train
2,116
571151cd5cd6fd19018954fa1d525e5b8ed3e358
[ "self.data_type = data[:4]\nself.data_type = struct.unpack('<I', str(self.data_type))[0]\nself.unknown = data[4:8]\nself.length = data[8:12]\nself.length = struct.unpack('<I', str(self.length))[0]\nself.length2 = data[12:16]\nself.length2 = struct.unpack('<I', str(self.length2))[0]\nself.segment_length = 16 + self....
<|body_start_0|> self.data_type = data[:4] self.data_type = struct.unpack('<I', str(self.data_type))[0] self.unknown = data[4:8] self.length = data[8:12] self.length = struct.unpack('<I', str(self.length))[0] self.length2 = data[12:16] self.length2 = struct.unpack...
Represents the header and content of a zeus message segment.
ZeusSegment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZeusSegment: """Represents the header and content of a zeus message segment.""" def __init__(self, data): """The initializer. :type data: bytearray :param data:""" <|body_0|> def extract_command(self): """Extracts command data from segment. :raise RuntimeError: i...
stack_v2_sparse_classes_36k_train_021817
30,437
no_license
[ { "docstring": "The initializer. :type data: bytearray :param data:", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Extracts command data from segment. :raise RuntimeError: if segment is not of type 1 (command) :return: string containing the command :rtype: str",...
2
stack_v2_sparse_classes_30k_train_021581
Implement the Python class `ZeusSegment` described below. Class description: Represents the header and content of a zeus message segment. Method signatures and docstrings: - def __init__(self, data): The initializer. :type data: bytearray :param data: - def extract_command(self): Extracts command data from segment. :...
Implement the Python class `ZeusSegment` described below. Class description: Represents the header and content of a zeus message segment. Method signatures and docstrings: - def __init__(self, data): The initializer. :type data: bytearray :param data: - def extract_command(self): Extracts command data from segment. :...
925ff53eb0c7a750ae784e3a2c059ed5e8b140e3
<|skeleton|> class ZeusSegment: """Represents the header and content of a zeus message segment.""" def __init__(self, data): """The initializer. :type data: bytearray :param data:""" <|body_0|> def extract_command(self): """Extracts command data from segment. :raise RuntimeError: i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZeusSegment: """Represents the header and content of a zeus message segment.""" def __init__(self, data): """The initializer. :type data: bytearray :param data:""" self.data_type = data[:4] self.data_type = struct.unpack('<I', str(self.data_type))[0] self.unknown = data[4:...
the_stack_v2_python_sparse
src/hystck/botnet/bots/zeus/zeus_generators.py
dasec/hystck
train
5
82f69f582f649481e31305520662e70d778e4107
[ "if not head:\n return head\ndummyHead = Node(None, None, head, None)\nself.flattenDFS(dummyHead, head)\ndummyHead.next.prev = None\nreturn dummyHead.next", "if not current:\n return previous\ncurrent.prev = previous\nprevious.next = current\ntempNext = current.next\ncurrentTail = self.flattenDFS(current, c...
<|body_start_0|> if not head: return head dummyHead = Node(None, None, head, None) self.flattenDFS(dummyHead, head) dummyHead.next.prev = None return dummyHead.next <|end_body_0|> <|body_start_1|> if not current: return previous current.pr...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, head): """:type head: Node :rtype: Node""" <|body_0|> def flattenDFS(self, previous, current): """:type head: Node :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: return head ...
stack_v2_sparse_classes_36k_train_021818
1,645
permissive
[ { "docstring": ":type head: Node :rtype: Node", "name": "flatten", "signature": "def flatten(self, head)" }, { "docstring": ":type head: Node :rtype: Node", "name": "flattenDFS", "signature": "def flattenDFS(self, previous, current)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, head): :type head: Node :rtype: Node - def flattenDFS(self, previous, current): :type head: Node :rtype: Node
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, head): :type head: Node :rtype: Node - def flattenDFS(self, previous, current): :type head: Node :rtype: Node <|skeleton|> class Solution: def flatten(sel...
20ae1a048eddbc9a32c819cf61258e2b57572f05
<|skeleton|> class Solution: def flatten(self, head): """:type head: Node :rtype: Node""" <|body_0|> def flattenDFS(self, previous, current): """:type head: Node :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten(self, head): """:type head: Node :rtype: Node""" if not head: return head dummyHead = Node(None, None, head, None) self.flattenDFS(dummyHead, head) dummyHead.next.prev = None return dummyHead.next def flattenDFS(self, previ...
the_stack_v2_python_sparse
leetcode.com/python/430_Flatten_a_Multilevel_Doubly_Linked_List.py
partho-maple/coding-interview-gym
train
862
c75186ad1a92476048421c4b15c6f9ad0292734f
[ "if not load_data:\n return\ndata_paths = ['app_data', '..app_data']\nadp = None\nfor data_path in data_paths:\n if os.path.exists(os.path.join(os.curdir, data_path)):\n adp = os.path.join(os.curdir, data_path)\nif not adp:\n _logger.error('app data path not found.')\n return\nfiles = glob(os.pat...
<|body_start_0|> if not load_data: return data_paths = ['app_data', '..app_data'] adp = None for data_path in data_paths: if os.path.exists(os.path.join(os.curdir, data_path)): adp = os.path.join(os.curdir, data_path) if not adp: ...
base data generator object.
BaseGen
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseGen: """base data generator object.""" def __init__(self, load_data=True): """Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory""" <|body_0|> def update(self, resp): """Update t...
stack_v2_sparse_classes_36k_train_021819
2,060
permissive
[ { "docstring": "Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory", "name": "__init__", "signature": "def __init__(self, load_data=True)" }, { "docstring": "Update this object with response data :param resp: reques...
2
stack_v2_sparse_classes_30k_train_015092
Implement the Python class `BaseGen` described below. Class description: base data generator object. Method signatures and docstrings: - def __init__(self, load_data=True): Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory - def update(...
Implement the Python class `BaseGen` described below. Class description: base data generator object. Method signatures and docstrings: - def __init__(self, load_data=True): Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory - def update(...
461ae46aeda21d54de8a91aa5ef677676d5db541
<|skeleton|> class BaseGen: """base data generator object.""" def __init__(self, load_data=True): """Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory""" <|body_0|> def update(self, resp): """Update t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseGen: """base data generator object.""" def __init__(self, load_data=True): """Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory""" if not load_data: return data_paths = ['app_data', '...
the_stack_v2_python_sparse
rdr_service/data_gen/generators/base_gen.py
all-of-us/raw-data-repository
train
46
07d89e0c7e4ecdc6c9b8f613ab3d4abccd19f745
[ "m = self.CMD_RE.match(cmd_key)\nif m:\n return int(m.group(1))\nelse:\n return 0", "self.uninstall(connector_comment)\ndb = registry.get_service(registry.SERVICE_DB_INTERFACE)\nconn = db.get_connection()\ncursor = conn.cursor()\ndb.select(cursor, ['*'], 'monsetting', where=\"$name = 'snmpmon' AND $key LIKE...
<|body_start_0|> m = self.CMD_RE.match(cmd_key) if m: return int(m.group(1)) else: return 0 <|end_body_0|> <|body_start_1|> self.uninstall(connector_comment) db = registry.get_service(registry.SERVICE_DB_INTERFACE) conn = db.get_connection() ...
This class is responsible for installing and uninstalling the TEAL SNMP connector support
SNMPConnectorInstaller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SNMPConnectorInstaller: """This class is responsible for installing and uninstalling the TEAL SNMP connector support""" def _get_cmd_num(self, cmd_key): """Get the command number from the cmds monsetting entry If the cmds field is incorrectly formatted, 0 is returned""" <|bod...
stack_v2_sparse_classes_36k_train_021820
3,969
no_license
[ { "docstring": "Get the command number from the cmds monsetting entry If the cmds field is incorrectly formatted, 0 is returned", "name": "_get_cmd_num", "signature": "def _get_cmd_num(self, cmd_key)" }, { "docstring": "Install the SNMP connectors into the xCAT monsetting table", "name": "in...
4
null
Implement the Python class `SNMPConnectorInstaller` described below. Class description: This class is responsible for installing and uninstalling the TEAL SNMP connector support Method signatures and docstrings: - def _get_cmd_num(self, cmd_key): Get the command number from the cmds monsetting entry If the cmds field...
Implement the Python class `SNMPConnectorInstaller` described below. Class description: This class is responsible for installing and uninstalling the TEAL SNMP connector support Method signatures and docstrings: - def _get_cmd_num(self, cmd_key): Get the command number from the cmds monsetting entry If the cmds field...
eba6c1489b503fdcf040a126942643b355867bcd
<|skeleton|> class SNMPConnectorInstaller: """This class is responsible for installing and uninstalling the TEAL SNMP connector support""" def _get_cmd_num(self, cmd_key): """Get the command number from the cmds monsetting entry If the cmds field is incorrectly formatted, 0 is returned""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SNMPConnectorInstaller: """This class is responsible for installing and uninstalling the TEAL SNMP connector support""" def _get_cmd_num(self, cmd_key): """Get the command number from the cmds monsetting entry If the cmds field is incorrectly formatted, 0 is returned""" m = self.CMD_RE.ma...
the_stack_v2_python_sparse
src/ibm/teal/util/snmp_config.py
ppjsand/pyteal
train
1
f43e37db49d57b403a976c971ee66b25680e557e
[ "try:\n cluster = Cluster([host], port=port)\n self.session = cluster.connect(keyspace)\nexcept Exception as e:\n print('The connection was unsuccessful.\\n' + str(e))", "try:\n df = pd.DataFrame(list(self.session.execute(query)))\n return df\nexcept Exception as e:\n print('An error occurred du...
<|body_start_0|> try: cluster = Cluster([host], port=port) self.session = cluster.connect(keyspace) except Exception as e: print('The connection was unsuccessful.\n' + str(e)) <|end_body_0|> <|body_start_1|> try: df = pd.DataFrame(list(self.sessio...
CassandraHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CassandraHelper: def __init__(self, host, port, keyspace): """creating connection with cassandra :param host: The host name. :param port: The port in use. :param keyspace: The name of the keyspace""" <|body_0|> def execute_query_cassandra(self, query): """For executi...
stack_v2_sparse_classes_36k_train_021821
861
no_license
[ { "docstring": "creating connection with cassandra :param host: The host name. :param port: The port in use. :param keyspace: The name of the keyspace", "name": "__init__", "signature": "def __init__(self, host, port, keyspace)" }, { "docstring": "For executing cassandra query :param query: The ...
2
stack_v2_sparse_classes_30k_train_012975
Implement the Python class `CassandraHelper` described below. Class description: Implement the CassandraHelper class. Method signatures and docstrings: - def __init__(self, host, port, keyspace): creating connection with cassandra :param host: The host name. :param port: The port in use. :param keyspace: The name of ...
Implement the Python class `CassandraHelper` described below. Class description: Implement the CassandraHelper class. Method signatures and docstrings: - def __init__(self, host, port, keyspace): creating connection with cassandra :param host: The host name. :param port: The port in use. :param keyspace: The name of ...
0ee797be88095388c41bc5074df926760a0e3f8f
<|skeleton|> class CassandraHelper: def __init__(self, host, port, keyspace): """creating connection with cassandra :param host: The host name. :param port: The port in use. :param keyspace: The name of the keyspace""" <|body_0|> def execute_query_cassandra(self, query): """For executi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CassandraHelper: def __init__(self, host, port, keyspace): """creating connection with cassandra :param host: The host name. :param port: The port in use. :param keyspace: The name of the keyspace""" try: cluster = Cluster([host], port=port) self.session = cluster.conne...
the_stack_v2_python_sparse
helpers/cassandra_helper.py
taimoorpashanbs17/DataLake_Automation
train
0
5bdbe1be9354c5424de8de13a2317aad2cbc47c8
[ "osm_user_details_url = f\"{current_app.config['OSM_SERVER_URL']}/api/0.6/user/{user_id}.json\"\nresponse = requests.get(osm_user_details_url)\nif response.status_code != 200:\n raise OSMServiceError('Bad response from OSM')\nreturn OSMService._parse_osm_user_details_response(response.json())", "osm_user = osm...
<|body_start_0|> osm_user_details_url = f"{current_app.config['OSM_SERVER_URL']}/api/0.6/user/{user_id}.json" response = requests.get(osm_user_details_url) if response.status_code != 200: raise OSMServiceError('Bad response from OSM') return OSMService._parse_osm_user_details...
OSMService
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSMService: def get_osm_details_for_user(user_id: int) -> UserOSMDTO: """Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError""" <|body_0|> def _parse_osm_user_details_response(osm_response: dict, user_element='user') -> UserOSM...
stack_v2_sparse_classes_36k_train_021822
1,488
permissive
[ { "docstring": "Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError", "name": "get_osm_details_for_user", "signature": "def get_osm_details_for_user(user_id: int) -> UserOSMDTO" }, { "docstring": "Parses the OSM user details response and extracts u...
2
null
Implement the Python class `OSMService` described below. Class description: Implement the OSMService class. Method signatures and docstrings: - def get_osm_details_for_user(user_id: int) -> UserOSMDTO: Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError - def _parse_osm...
Implement the Python class `OSMService` described below. Class description: Implement the OSMService class. Method signatures and docstrings: - def get_osm_details_for_user(user_id: int) -> UserOSMDTO: Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError - def _parse_osm...
45bf3937c74902226096aee5b49e7abea62df524
<|skeleton|> class OSMService: def get_osm_details_for_user(user_id: int) -> UserOSMDTO: """Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError""" <|body_0|> def _parse_osm_user_details_response(osm_response: dict, user_element='user') -> UserOSM...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OSMService: def get_osm_details_for_user(user_id: int) -> UserOSMDTO: """Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError""" osm_user_details_url = f"{current_app.config['OSM_SERVER_URL']}/api/0.6/user/{user_id}.json" response = reques...
the_stack_v2_python_sparse
backend/services/users/osm_service.py
hotosm/tasking-manager
train
526
1448e8715b7f0dd20ceed73ec4e74d2632c57585
[ "self.directory = directory\nself.function_table = {}\nself.status = DataPackStatus.INACTIVE\nself.name = directory.split('/')[-1].split('\\\\')[-1]\nself.access = None\nself.description = ''", "if self.status == DataPackStatus.SYSTEM_ERROR:\n return\ntry:\n if self.status in (DataPackStatus.ACTIVATED, Data...
<|body_start_0|> self.directory = directory self.function_table = {} self.status = DataPackStatus.INACTIVE self.name = directory.split('/')[-1].split('\\')[-1] self.access = None self.description = '' <|end_body_0|> <|body_start_1|> if self.status == DataPackStat...
Class for a single data pack
DataPack
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataPack: """Class for a single data pack""" def __init__(self, directory: str): """Will create a new DataPack-object :param directory: where the datapack is located""" <|body_0|> async def load(self): """Will load the data pack""" <|body_1|> def unl...
stack_v2_sparse_classes_36k_train_021823
10,029
permissive
[ { "docstring": "Will create a new DataPack-object :param directory: where the datapack is located", "name": "__init__", "signature": "def __init__(self, directory: str)" }, { "docstring": "Will load the data pack", "name": "load", "signature": "async def load(self)" }, { "docstri...
4
stack_v2_sparse_classes_30k_train_011341
Implement the Python class `DataPack` described below. Class description: Class for a single data pack Method signatures and docstrings: - def __init__(self, directory: str): Will create a new DataPack-object :param directory: where the datapack is located - async def load(self): Will load the data pack - def unload(...
Implement the Python class `DataPack` described below. Class description: Class for a single data pack Method signatures and docstrings: - def __init__(self, directory: str): Will create a new DataPack-object :param directory: where the datapack is located - async def load(self): Will load the data pack - def unload(...
644ef36a70c45a70820f6f6069b2f36545a187e5
<|skeleton|> class DataPack: """Class for a single data pack""" def __init__(self, directory: str): """Will create a new DataPack-object :param directory: where the datapack is located""" <|body_0|> async def load(self): """Will load the data pack""" <|body_1|> def unl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataPack: """Class for a single data pack""" def __init__(self, directory: str): """Will create a new DataPack-object :param directory: where the datapack is located""" self.directory = directory self.function_table = {} self.status = DataPackStatus.INACTIVE self.n...
the_stack_v2_python_sparse
mcpython/common/data/DataPacks.py
mcpython4-coding/core
train
4
0c7c692536dc5e58d65661314e16b826ad56779f
[ "self.object = self.get_object()\neditor = self.object\ncontractor = self.request.user.contractorprofile\nactive_assignments = editor.assignment_set.all()\nassignments_for_viewer = active_assignments.filter(contractor=contractor)\nreturn active_assignments", "self.object = self.get_object()\neditor = self.object\...
<|body_start_0|> self.object = self.get_object() editor = self.object contractor = self.request.user.contractorprofile active_assignments = editor.assignment_set.all() assignments_for_viewer = active_assignments.filter(contractor=contractor) return active_assignments <|en...
A public profile page for talent editors. Displays details about an editor that works with contractors. Contractors see assignments and calls from this editor and pitches they've submitted.
PublicTalentEditorDetailView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicTalentEditorDetailView: """A public profile page for talent editors. Displays details about an editor that works with contractors. Contractors see assignments and calls from this editor and pitches they've submitted.""" def assignments(self): """Get assignments from this editor...
stack_v2_sparse_classes_36k_train_021824
28,644
permissive
[ { "docstring": "Get assignments from this editor that are relevant to requesting user.", "name": "assignments", "signature": "def assignments(self)" }, { "docstring": "Get pitches to this editor that are relevant to contractor viewing this profile.", "name": "pitches", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_004635
Implement the Python class `PublicTalentEditorDetailView` described below. Class description: A public profile page for talent editors. Displays details about an editor that works with contractors. Contractors see assignments and calls from this editor and pitches they've submitted. Method signatures and docstrings: ...
Implement the Python class `PublicTalentEditorDetailView` described below. Class description: A public profile page for talent editors. Displays details about an editor that works with contractors. Contractors see assignments and calls from this editor and pitches they've submitted. Method signatures and docstrings: ...
dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9
<|skeleton|> class PublicTalentEditorDetailView: """A public profile page for talent editors. Displays details about an editor that works with contractors. Contractors see assignments and calls from this editor and pitches they've submitted.""" def assignments(self): """Get assignments from this editor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PublicTalentEditorDetailView: """A public profile page for talent editors. Displays details about an editor that works with contractors. Contractors see assignments and calls from this editor and pitches they've submitted.""" def assignments(self): """Get assignments from this editor that are rel...
the_stack_v2_python_sparse
project/editorial/views/contractors.py
ProjectFacet/facet
train
25
65300aef5964778af611c2b8c9cd7565489067cb
[ "self.config = {}\nfor key, value in configs:\n self.setConfig(key, value)", "gist_md_pattern = GistPattern(GIST_MD_RE, self.getConfigs())\ngist_md_pattern.md = md\nmd.inlinePatterns.register(gist_md_pattern, 'gist', 175)\ngist_rst_pattern = GistPattern(GIST_RST_RE, self.getConfigs())\ngist_rst_pattern.md = md...
<|body_start_0|> self.config = {} for key, value in configs: self.setConfig(key, value) <|end_body_0|> <|body_start_1|> gist_md_pattern = GistPattern(GIST_MD_RE, self.getConfigs()) gist_md_pattern.md = md md.inlinePatterns.register(gist_md_pattern, 'gist', 175) ...
Gist extension for Markdown.
GistExtension
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GistExtension: """Gist extension for Markdown.""" def __init__(self, configs={}): """Initialize the extension.""" <|body_0|> def extendMarkdown(self, md, md_globals=None): """Extend Markdown.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_36k_train_021825
6,764
permissive
[ { "docstring": "Initialize the extension.", "name": "__init__", "signature": "def __init__(self, configs={})" }, { "docstring": "Extend Markdown.", "name": "extendMarkdown", "signature": "def extendMarkdown(self, md, md_globals=None)" } ]
2
null
Implement the Python class `GistExtension` described below. Class description: Gist extension for Markdown. Method signatures and docstrings: - def __init__(self, configs={}): Initialize the extension. - def extendMarkdown(self, md, md_globals=None): Extend Markdown.
Implement the Python class `GistExtension` described below. Class description: Gist extension for Markdown. Method signatures and docstrings: - def __init__(self, configs={}): Initialize the extension. - def extendMarkdown(self, md, md_globals=None): Extend Markdown. <|skeleton|> class GistExtension: """Gist ext...
2b10e9952bac5a1119e6845c7a2c28273aca9775
<|skeleton|> class GistExtension: """Gist extension for Markdown.""" def __init__(self, configs={}): """Initialize the extension.""" <|body_0|> def extendMarkdown(self, md, md_globals=None): """Extend Markdown.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GistExtension: """Gist extension for Markdown.""" def __init__(self, configs={}): """Initialize the extension.""" self.config = {} for key, value in configs: self.setConfig(key, value) def extendMarkdown(self, md, md_globals=None): """Extend Markdown.""" ...
the_stack_v2_python_sparse
nikola/plugins/compile/markdown/mdx_gist.py
getnikola/nikola
train
2,142
ef272aed6c74791199beb3e61af87d7ff7582757
[ "self.output_attribute = output_attribute\nself.separator = separator\nself.distance = distance", "try:\n for graph in graphs:\n for n, d in graph.nodes_iter(data=True):\n edge_labels = []\n if self.distance == 1:\n edge_labels += [graph.edge[u][v].get('label', '-') ...
<|body_start_0|> self.output_attribute = output_attribute self.separator = separator self.distance = distance <|end_body_0|> <|body_start_1|> try: for graph in graphs: for n, d in graph.nodes_iter(data=True): edge_labels = [] ...
RelabelWithLabelOfIncidentEdges. Delete an edge if its dictionary has a key equal to 'attribute' and the 'condition' is true between 'value' and the value associated to key=attribute.
RelabelWithLabelOfIncidentEdges
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelabelWithLabelOfIncidentEdges: """RelabelWithLabelOfIncidentEdges. Delete an edge if its dictionary has a key equal to 'attribute' and the 'condition' is true between 'value' and the value associated to key=attribute.""" def __init__(self, output_attribute='type', separator='', distance=1)...
stack_v2_sparse_classes_36k_train_021826
23,871
permissive
[ { "docstring": "\"Construct. Parameters ---------- graphs : iterator over path graphs of RNA sequences output_attribute : string The key of the node dictionary where to write the result. separator : string The string used to separate the sorted concatenation of labels. distance : integer (default 1) The neighbo...
2
stack_v2_sparse_classes_30k_train_002962
Implement the Python class `RelabelWithLabelOfIncidentEdges` described below. Class description: RelabelWithLabelOfIncidentEdges. Delete an edge if its dictionary has a key equal to 'attribute' and the 'condition' is true between 'value' and the value associated to key=attribute. Method signatures and docstrings: - d...
Implement the Python class `RelabelWithLabelOfIncidentEdges` described below. Class description: RelabelWithLabelOfIncidentEdges. Delete an edge if its dictionary has a key equal to 'attribute' and the 'condition' is true between 'value' and the value associated to key=attribute. Method signatures and docstrings: - d...
227ad49d0b3d4611866011bd1648cd8946ede05a
<|skeleton|> class RelabelWithLabelOfIncidentEdges: """RelabelWithLabelOfIncidentEdges. Delete an edge if its dictionary has a key equal to 'attribute' and the 'condition' is true between 'value' and the value associated to key=attribute.""" def __init__(self, output_attribute='type', separator='', distance=1)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelabelWithLabelOfIncidentEdges: """RelabelWithLabelOfIncidentEdges. Delete an edge if its dictionary has a key equal to 'attribute' and the 'condition' is true between 'value' and the value associated to key=attribute.""" def __init__(self, output_attribute='type', separator='', distance=1): """...
the_stack_v2_python_sparse
GArDen/transform/node.py
rgerkin/EDeN
train
0
3c168de818983787368e162ef2c1988976f3206b
[ "index = 0\ncount = 0\nlength = len(intervals)\nwhile count < length:\n if intervals[index][1] < newInterval[0]:\n index += 1\n count += 1\n else:\n if newInterval[1] < intervals[index][0]:\n intervals.insert(index, newInterval)\n return intervals\n intervals[...
<|body_start_0|> index = 0 count = 0 length = len(intervals) while count < length: if intervals[index][1] < newInterval[0]: index += 1 count += 1 else: if newInterval[1] < intervals[index][0]: int...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _insert(self, intervals, newInterval): """:type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]""" <|body_0|> def insert(self, intervals, newInterval): """:type intervals: List[List[int]] :type newInterval: List[int] :rty...
stack_v2_sparse_classes_36k_train_021827
3,143
permissive
[ { "docstring": ":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]", "name": "_insert", "signature": "def _insert(self, intervals, newInterval)" }, { "docstring": ":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]", "name...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _insert(self, intervals, newInterval): :type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]] - def insert(self, intervals, newInterval): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _insert(self, intervals, newInterval): :type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]] - def insert(self, intervals, newInterval): :type...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _insert(self, intervals, newInterval): """:type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]""" <|body_0|> def insert(self, intervals, newInterval): """:type intervals: List[List[int]] :type newInterval: List[int] :rty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _insert(self, intervals, newInterval): """:type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]""" index = 0 count = 0 length = len(intervals) while count < length: if intervals[index][1] < newInterval[0]: ...
the_stack_v2_python_sparse
57.insert-interval.py
windard/leeeeee
train
0
413bdd815447f7247ba6487955eaed7192a265c9
[ "super(particles_output, self).__init__()\nfig = plt.figure()\nself.ax = fig.add_subplot(111, projection='3d')\nself.ax.set_xlim3d([-20, 20])\nself.ax.set_ylim3d([-20, 20])\nself.ax.set_zlim3d([-20, 20])\nplt.ion()\nself.sframe = None\nself.bar_run = None", "super(particles_output, self).pre_run(step, level_numbe...
<|body_start_0|> super(particles_output, self).__init__() fig = plt.figure() self.ax = fig.add_subplot(111, projection='3d') self.ax.set_xlim3d([-20, 20]) self.ax.set_ylim3d([-20, 20]) self.ax.set_zlim3d([-20, 20]) plt.ion() self.sframe = None self...
particles_output
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class particles_output: def __init__(self): """Initialization of particles output""" <|body_0|> def pre_run(self, step, level_number): """Overwrite default routine called before time-loop starts Args: step: the current step level_number: the current level number""" ...
stack_v2_sparse_classes_36k_train_021828
4,455
permissive
[ { "docstring": "Initialization of particles output", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Overwrite default routine called before time-loop starts Args: step: the current step level_number: the current level number", "name": "pre_run", "signature": "de...
3
null
Implement the Python class `particles_output` described below. Class description: Implement the particles_output class. Method signatures and docstrings: - def __init__(self): Initialization of particles output - def pre_run(self, step, level_number): Overwrite default routine called before time-loop starts Args: ste...
Implement the Python class `particles_output` described below. Class description: Implement the particles_output class. Method signatures and docstrings: - def __init__(self): Initialization of particles output - def pre_run(self, step, level_number): Overwrite default routine called before time-loop starts Args: ste...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class particles_output: def __init__(self): """Initialization of particles output""" <|body_0|> def pre_run(self, step, level_number): """Overwrite default routine called before time-loop starts Args: step: the current step level_number: the current level number""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class particles_output: def __init__(self): """Initialization of particles output""" super(particles_output, self).__init__() fig = plt.figure() self.ax = fig.add_subplot(111, projection='3d') self.ax.set_xlim3d([-20, 20]) self.ax.set_ylim3d([-20, 20]) self.ax...
the_stack_v2_python_sparse
pySDC/playgrounds/Boris/penningtrap_HookClass.py
Parallel-in-Time/pySDC
train
30
1ea06a26bdb4a8f304a810865fa8605fb9fbd67f
[ "self.radio = RF24(RPI_BPLUS_GPIO_J8_15, RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ)\nself.radio.begin()\nself.radio.setPALevel(RF24_PA_MAX)\nself.radio.enableDynamicPayloads()\nself.radio.setDataRate(RF24_250KBPS)\nself.radio.setRetries(5, options['repetitions'])\nself.radio.openWritingPipe(nrf24l01pConn.PIPES[1...
<|body_start_0|> self.radio = RF24(RPI_BPLUS_GPIO_J8_15, RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ) self.radio.begin() self.radio.setPALevel(RF24_PA_MAX) self.radio.enableDynamicPayloads() self.radio.setDataRate(RF24_250KBPS) self.radio.setRetries(5, options['repetitio...
Class in charge of the reading the data using nrf24l01p receiver. It uses the library https://github.com/TMRh20/RF24 to do the transmission of the data.
nrf24l01pConn
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class nrf24l01pConn: """Class in charge of the reading the data using nrf24l01p receiver. It uses the library https://github.com/TMRh20/RF24 to do the transmission of the data.""" def __init__(self, options): """Initialization of the nrf24l01p connexion. Args: options: Is a dictionary, it ...
stack_v2_sparse_classes_36k_train_021829
1,637
permissive
[ { "docstring": "Initialization of the nrf24l01p connexion. Args: options: Is a dictionary, it must have a 'repetitions' key. It is the maximum number of repetitions to do when you are sending a value and the receiver do not get it, the value must be between [1, 15].", "name": "__init__", "signature": "d...
2
stack_v2_sparse_classes_30k_test_000765
Implement the Python class `nrf24l01pConn` described below. Class description: Class in charge of the reading the data using nrf24l01p receiver. It uses the library https://github.com/TMRh20/RF24 to do the transmission of the data. Method signatures and docstrings: - def __init__(self, options): Initialization of the...
Implement the Python class `nrf24l01pConn` described below. Class description: Class in charge of the reading the data using nrf24l01p receiver. It uses the library https://github.com/TMRh20/RF24 to do the transmission of the data. Method signatures and docstrings: - def __init__(self, options): Initialization of the...
9c8a6bd5708241b30ee8c2b37b0c2d15977e84cd
<|skeleton|> class nrf24l01pConn: """Class in charge of the reading the data using nrf24l01p receiver. It uses the library https://github.com/TMRh20/RF24 to do the transmission of the data.""" def __init__(self, options): """Initialization of the nrf24l01p connexion. Args: options: Is a dictionary, it ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class nrf24l01pConn: """Class in charge of the reading the data using nrf24l01p receiver. It uses the library https://github.com/TMRh20/RF24 to do the transmission of the data.""" def __init__(self, options): """Initialization of the nrf24l01p connexion. Args: options: Is a dictionary, it must have a '...
the_stack_v2_python_sparse
RaspberryPi/ardupi_weather/arduino/nrf24l01pConn.py
jordivilaseca/ardupi-weather
train
2
08cfdcc97016edc56b3a099c5f01cd65edbe7b3d
[ "Part = self.old_state.apps.get_model('part', 'part')\nunits = ['mm', 'INCH', '', '%']\nfor idx, unit in enumerate(units):\n Part.objects.create(name=f'Part {idx + 1}', description=f'My part at index {idx}', units=unit, level=0, lft=0, rght=0, tree_id=0)", "Part = self.new_state.apps.get_model('part', 'part')\...
<|body_start_0|> Part = self.old_state.apps.get_model('part', 'part') units = ['mm', 'INCH', '', '%'] for idx, unit in enumerate(units): Part.objects.create(name=f'Part {idx + 1}', description=f'My part at index {idx}', units=unit, level=0, lft=0, rght=0, tree_id=0) <|end_body_0|> <...
Test for data migration of Part.units field
PartUnitsMigrationTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartUnitsMigrationTest: """Test for data migration of Part.units field""" def prepare(self): """Prepare some parts with units""" <|body_0|> def test_units_migration(self): """Test that the units have migrated OK""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_021830
8,200
permissive
[ { "docstring": "Prepare some parts with units", "name": "prepare", "signature": "def prepare(self)" }, { "docstring": "Test that the units have migrated OK", "name": "test_units_migration", "signature": "def test_units_migration(self)" } ]
2
null
Implement the Python class `PartUnitsMigrationTest` described below. Class description: Test for data migration of Part.units field Method signatures and docstrings: - def prepare(self): Prepare some parts with units - def test_units_migration(self): Test that the units have migrated OK
Implement the Python class `PartUnitsMigrationTest` described below. Class description: Test for data migration of Part.units field Method signatures and docstrings: - def prepare(self): Prepare some parts with units - def test_units_migration(self): Test that the units have migrated OK <|skeleton|> class PartUnitsM...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class PartUnitsMigrationTest: """Test for data migration of Part.units field""" def prepare(self): """Prepare some parts with units""" <|body_0|> def test_units_migration(self): """Test that the units have migrated OK""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PartUnitsMigrationTest: """Test for data migration of Part.units field""" def prepare(self): """Prepare some parts with units""" Part = self.old_state.apps.get_model('part', 'part') units = ['mm', 'INCH', '', '%'] for idx, unit in enumerate(units): Part.objects...
the_stack_v2_python_sparse
InvenTree/part/test_migrations.py
inventree/InvenTree
train
3,077
6100f1a09996674b67a958a7026ada368ae699fb
[ "nn.Module.__init__(self)\nself.tau = tau\nself.y_list = y_list\nself.batch_size = batch_size\nself.device = device", "p = torch.cat((z_i, z_j), dim=0)\nsim = nn.CosineSimilarity(dim=2)(p.unsqueeze(1), p.unsqueeze(0)) / self.tau\ny2 = torch.cat([y, y], dim=0).view(-1, 1)\nif self.y_list == 'all':\n mask = torc...
<|body_start_0|> nn.Module.__init__(self) self.tau = tau self.y_list = y_list self.batch_size = batch_size self.device = device <|end_body_0|> <|body_start_1|> p = torch.cat((z_i, z_j), dim=0) sim = nn.CosineSimilarity(dim=2)(p.unsqueeze(1), p.unsqueeze(0)) / sel...
Define the Supervised Contrastive Loss as a Pytorch Module.
SupervisedContrastiveLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupervisedContrastiveLoss: """Define the Supervised Contrastive Loss as a Pytorch Module.""" def __init__(self, tau, batch_size, y_list='all', device='cuda'): """Initialize a Supervised Contrastive Loss Module. ---------- INPUT |---- tau (float) the temperature hyperparameter. |---- ...
stack_v2_sparse_classes_36k_train_021831
18,386
permissive
[ { "docstring": "Initialize a Supervised Contrastive Loss Module. ---------- INPUT |---- tau (float) the temperature hyperparameter. |---- y_list (list of int) the list of class to conisder for positive. | Default is using all classes. |---- batch_size (int) the batch_size used. |---- device (str) the device to ...
2
stack_v2_sparse_classes_30k_train_004572
Implement the Python class `SupervisedContrastiveLoss` described below. Class description: Define the Supervised Contrastive Loss as a Pytorch Module. Method signatures and docstrings: - def __init__(self, tau, batch_size, y_list='all', device='cuda'): Initialize a Supervised Contrastive Loss Module. ---------- INPUT...
Implement the Python class `SupervisedContrastiveLoss` described below. Class description: Define the Supervised Contrastive Loss as a Pytorch Module. Method signatures and docstrings: - def __init__(self, tau, batch_size, y_list='all', device='cuda'): Initialize a Supervised Contrastive Loss Module. ---------- INPUT...
850b6195d6290a50eee865b4d5a66f5db5260e8f
<|skeleton|> class SupervisedContrastiveLoss: """Define the Supervised Contrastive Loss as a Pytorch Module.""" def __init__(self, tau, batch_size, y_list='all', device='cuda'): """Initialize a Supervised Contrastive Loss Module. ---------- INPUT |---- tau (float) the temperature hyperparameter. |---- ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupervisedContrastiveLoss: """Define the Supervised Contrastive Loss as a Pytorch Module.""" def __init__(self, tau, batch_size, y_list='all', device='cuda'): """Initialize a Supervised Contrastive Loss Module. ---------- INPUT |---- tau (float) the temperature hyperparameter. |---- y_list (list ...
the_stack_v2_python_sparse
Code/src/models/optim/CustomLosses.py
antoine-spahr/X-ray-Anomaly-Detection
train
3
0385c7f0deeb55f6c38847633693a9160f816003
[ "super(RnnEncoder, self).__init__()\ncells = {'GRU': nn.GRU, 'LSTM': nn.LSTM}\nself.rnn = cells[args.cell_type](input_size=args.embedding_dim, hidden_size=args.hidden_dim // 2, num_layers=args.layer_num, bidirectional=True)", "e_T = e.permute(1, 0, 2)\nif m is not None:\n seq_lens = list(map(int, torch.sum(m, ...
<|body_start_0|> super(RnnEncoder, self).__init__() cells = {'GRU': nn.GRU, 'LSTM': nn.LSTM} self.rnn = cells[args.cell_type](input_size=args.embedding_dim, hidden_size=args.hidden_dim // 2, num_layers=args.layer_num, bidirectional=True) <|end_body_0|> <|body_start_1|> e_T = e.permute(1...
Basic RNN encoder module, input embeddings and output hidden states.
RnnEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RnnEncoder: """Basic RNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, "GRU" or "LSTM". args.embedding_dim ...
stack_v2_sparse_classes_36k_train_021832
6,319
no_license
[ { "docstring": "Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, \"GRU\" or \"LSTM\". args.embedding_dim -- dimension of word embeddings.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstri...
2
stack_v2_sparse_classes_30k_train_018611
Implement the Python class `RnnEncoder` described below. Class description: Basic RNN encoder module, input embeddings and output hidden states. Method signatures and docstrings: - def __init__(self, args): Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -...
Implement the Python class `RnnEncoder` described below. Class description: Basic RNN encoder module, input embeddings and output hidden states. Method signatures and docstrings: - def __init__(self, args): Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -...
e79606e24ecc6fd713b481afb527c34eec7d5d66
<|skeleton|> class RnnEncoder: """Basic RNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, "GRU" or "LSTM". args.embedding_dim ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RnnEncoder: """Basic RNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """Inputs: args.hidden_dim -- dimension of hidden states. args.layer_num -- number of RNN layers. args.cell_type -- type of RNN cells, "GRU" or "LSTM". args.embedding_dim -- dimension ...
the_stack_v2_python_sparse
rationalize/models/encoder.py
anshiquanshu66/factcheck-acl2021
train
0
c5624780b5dac24ae3ab0dac321794bfb387a0e5
[ "super().__init__('human_model_generation_service')\nself.bridge = ROS2Bridge()\nself.service_name = service_name\nself.model_generator = PIFuGeneratorLearner(device=device, checkpoint_dir=checkpoint_dir)\nmy_callback_group = MutuallyExclusiveCallbackGroup()\nself.srv = self.create_service(ImgToMesh, 'human_model_g...
<|body_start_0|> super().__init__('human_model_generation_service') self.bridge = ROS2Bridge() self.service_name = service_name self.model_generator = PIFuGeneratorLearner(device=device, checkpoint_dir=checkpoint_dir) my_callback_group = MutuallyExclusiveCallbackGroup() s...
PifuService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PifuService: def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'): """Creates a ROS Service for human model generation :param service_name: The name of the service :type service_name: str :param device: device on which we are running inference ('cp...
stack_v2_sparse_classes_36k_train_021833
4,356
permissive
[ { "docstring": "Creates a ROS Service for human model generation :param service_name: The name of the service :type service_name: str :param device: device on which we are running inference ('cpu' or 'cuda') :type device: str :param checkpoint_dir: the directory where the PIFu weights will be downloaded/loaded ...
2
null
Implement the Python class `PifuService` described below. Class description: Implement the PifuService class. Method signatures and docstrings: - def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'): Creates a ROS Service for human model generation :param service_name: The name...
Implement the Python class `PifuService` described below. Class description: Implement the PifuService class. Method signatures and docstrings: - def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'): Creates a ROS Service for human model generation :param service_name: The name...
b3d6ce670cdf63469fc5766630eb295d67b3d788
<|skeleton|> class PifuService: def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'): """Creates a ROS Service for human model generation :param service_name: The name of the service :type service_name: str :param device: device on which we are running inference ('cp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PifuService: def __init__(self, service_name='human_model_generation', device='cuda', checkpoint_dir='.'): """Creates a ROS Service for human model generation :param service_name: The name of the service :type service_name: str :param device: device on which we are running inference ('cpu' or 'cuda') ...
the_stack_v2_python_sparse
projects/opendr_ws_2/src/opendr_simulation/opendr_simulation/human_model_generation_service.py
opendr-eu/opendr
train
535
4d2cd9a3615bae19cb46a835b6601bfc607f525d
[ "self._query = '{!join}' + query\nself._from = from_field\nself._to = to_field", "params = []\nparams.append(('from', self._from))\nparams.append(('to', self._to))\nreturn params" ]
<|body_start_0|> self._query = '{!join}' + query self._from = from_field self._to = to_field <|end_body_0|> <|body_start_1|> params = [] params.append(('from', self._from)) params.append(('to', self._to)) return params <|end_body_1|>
A base query for all join operations.
JoinBaseQuery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinBaseQuery: """A base query for all join operations.""" def __init__(self, query, from_field, to_field): """Join base query takes care of joining syntax""" <|body_0|> def get_params(self): """Return the list of query params for the `JoinBaseQuery`.""" ...
stack_v2_sparse_classes_36k_train_021834
2,190
permissive
[ { "docstring": "Join base query takes care of joining syntax", "name": "__init__", "signature": "def __init__(self, query, from_field, to_field)" }, { "docstring": "Return the list of query params for the `JoinBaseQuery`.", "name": "get_params", "signature": "def get_params(self)" } ]
2
stack_v2_sparse_classes_30k_train_017173
Implement the Python class `JoinBaseQuery` described below. Class description: A base query for all join operations. Method signatures and docstrings: - def __init__(self, query, from_field, to_field): Join base query takes care of joining syntax - def get_params(self): Return the list of query params for the `JoinBa...
Implement the Python class `JoinBaseQuery` described below. Class description: A base query for all join operations. Method signatures and docstrings: - def __init__(self, query, from_field, to_field): Join base query takes care of joining syntax - def get_params(self): Return the list of query params for the `JoinBa...
2810f3202166b045a7f5f9a21b964c681bfd8136
<|skeleton|> class JoinBaseQuery: """A base query for all join operations.""" def __init__(self, query, from_field, to_field): """Join base query takes care of joining syntax""" <|body_0|> def get_params(self): """Return the list of query params for the `JoinBaseQuery`.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JoinBaseQuery: """A base query for all join operations.""" def __init__(self, query, from_field, to_field): """Join base query takes care of joining syntax""" self._query = '{!join}' + query self._from = from_field self._to = to_field def get_params(self): """...
the_stack_v2_python_sparse
dopplr/solr/query/join.py
renatoaquino/dopplr
train
1
bd39b9c0fc423a30003a5ff0ff5555f01e9e8a6d
[ "self.length = len(nums)\nself.Map = dict()\nfor i in range(self.length):\n if nums[i] != 0:\n self.Map[i] = nums[i]", "res = 0\nfor i in range(self.length):\n if i in self.Map and i in vec.Map:\n res += self.Map[i] * vec.Map[i]\nreturn res" ]
<|body_start_0|> self.length = len(nums) self.Map = dict() for i in range(self.length): if nums[i] != 0: self.Map[i] = nums[i] <|end_body_0|> <|body_start_1|> res = 0 for i in range(self.length): if i in self.Map and i in vec.Map: ...
SparseVector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseVector: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.length = len(nums) self.Map = dict() ...
stack_v2_sparse_classes_36k_train_021835
741
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type vec: 'SparseVector' :rtype: int", "name": "dotProduct", "signature": "def dotProduct(self, vec)" } ]
2
stack_v2_sparse_classes_30k_train_019557
Implement the Python class `SparseVector` described below. Class description: Implement the SparseVector class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int
Implement the Python class `SparseVector` described below. Class description: Implement the SparseVector class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int <|skeleton|> class SparseVector: def __init__(sel...
8a82905d40b882b20a9b6f862942f8f3e4bebcf0
<|skeleton|> class SparseVector: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseVector: def __init__(self, nums): """:type nums: List[int]""" self.length = len(nums) self.Map = dict() for i in range(self.length): if nums[i] != 0: self.Map[i] = nums[i] def dotProduct(self, vec): """:type vec: 'SparseVector' :rt...
the_stack_v2_python_sparse
ByTags/Others/1570. Dot Product of Two Sparse Vectors.py
lynkeib/LeetCode
train
0
33dba0c9cc5193a336cd06e95c3352ab78557a52
[ "for i in range(len(nums)):\n for j in range(i + 1, i + k + 1):\n if j >= len(nums):\n break\n if abs(nums[i] - nums[j]) <= t:\n return True\nreturn False", "if t < 0:\n return False\nbucket = {}\nw = t + 1\nfor i in range(len(nums)):\n m = nums[i] // w\n if m in bu...
<|body_start_0|> for i in range(len(nums)): for j in range(i + 1, i + k + 1): if j >= len(nums): break if abs(nums[i] - nums[j]) <= t: return True return False <|end_body_0|> <|body_start_1|> if t < 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """brute force :type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate2(self, nums, k, t): """bucket :type nums: List[int] :type k: int :type t: int :r...
stack_v2_sparse_classes_36k_train_021836
1,195
no_license
[ { "docstring": "brute force :type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearbyAlmostDuplicate", "signature": "def containsNearbyAlmostDuplicate(self, nums, k, t)" }, { "docstring": "bucket :type nums: List[int] :type k: int :type t: int :rtype: bool", "nam...
2
stack_v2_sparse_classes_30k_train_009849
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): brute force :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate2(self, nums, k, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): brute force :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate2(self, nums, k, ...
e16702d2b3ec4e5054baad56f4320bc3b31676ad
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """brute force :type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate2(self, nums, k, t): """bucket :type nums: List[int] :type k: int :type t: int :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """brute force :type nums: List[int] :type k: int :type t: int :rtype: bool""" for i in range(len(nums)): for j in range(i + 1, i + k + 1): if j >= len(nums): break if...
the_stack_v2_python_sparse
leetcode/hard/contains_duplicate3.py
SuperMartinYang/learning_algorithm
train
0
e62c5178d1022d4b5763661e4cbcd8602f9c716c
[ "super(ROIAlign, self).__init__(**kwargs)\nself.pool_shape = pool_shape\nself.max_pool = tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=2, name='roi_max_pool')", "rois, feature_map_list, img_metas = inputs\nroi_indices = tf.cast(rois[:, 0], tf.int32)\nrois = rois[:, 1:]\nrois = tf.stop_gradient(rois)\npooled...
<|body_start_0|> super(ROIAlign, self).__init__(**kwargs) self.pool_shape = pool_shape self.max_pool = tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=2, name='roi_max_pool') <|end_body_0|> <|body_start_1|> rois, feature_map_list, img_metas = inputs roi_indices = tf.cast(roi...
ROIAlign
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ROIAlign: def __init__(self, pool_shape, **kwargs): """Implements ROI Pooling. Attributes --- pool_shape: (height, width) of the output pooled regions. Example: (14, 14)""" <|body_0|> def __call__(self, inputs): """Args --- rois: [batch_size * num_rois, (batch_ind, y...
stack_v2_sparse_classes_36k_train_021837
2,353
no_license
[ { "docstring": "Implements ROI Pooling. Attributes --- pool_shape: (height, width) of the output pooled regions. Example: (14, 14)", "name": "__init__", "signature": "def __init__(self, pool_shape, **kwargs)" }, { "docstring": "Args --- rois: [batch_size * num_rois, (batch_ind, y1, x1, y2, x2)] ...
2
stack_v2_sparse_classes_30k_train_005452
Implement the Python class `ROIAlign` described below. Class description: Implement the ROIAlign class. Method signatures and docstrings: - def __init__(self, pool_shape, **kwargs): Implements ROI Pooling. Attributes --- pool_shape: (height, width) of the output pooled regions. Example: (14, 14) - def __call__(self, ...
Implement the Python class `ROIAlign` described below. Class description: Implement the ROIAlign class. Method signatures and docstrings: - def __init__(self, pool_shape, **kwargs): Implements ROI Pooling. Attributes --- pool_shape: (height, width) of the output pooled regions. Example: (14, 14) - def __call__(self, ...
ff1ecb407f33697b02f2f2061912841e168fd33f
<|skeleton|> class ROIAlign: def __init__(self, pool_shape, **kwargs): """Implements ROI Pooling. Attributes --- pool_shape: (height, width) of the output pooled regions. Example: (14, 14)""" <|body_0|> def __call__(self, inputs): """Args --- rois: [batch_size * num_rois, (batch_ind, y...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ROIAlign: def __init__(self, pool_shape, **kwargs): """Implements ROI Pooling. Attributes --- pool_shape: (height, width) of the output pooled regions. Example: (14, 14)""" super(ROIAlign, self).__init__(**kwargs) self.pool_shape = pool_shape self.max_pool = tf.keras.layers.Max...
the_stack_v2_python_sparse
venv/Lib/site-packages/detecting/models/roi_extractors/roi_align.py
RavinduAye/pythonProject
train
0
92858f4c6c8b2f078572f95837dccfd0bf4b6cfa
[ "self.component_name = component_name\nself.component_type = component_type\nself.indent = None if ndjson else 4\nself.separators = (',', ':') if ndjson else (', ', ': ')\nsuper(StructuredFormatter, self).__init__()", "data: Dict[str, Union[str, List[str]]] = {'timestamp': datetime.utcnow().isoformat(), 'message'...
<|body_start_0|> self.component_name = component_name self.component_type = component_type self.indent = None if ndjson else 4 self.separators = (',', ':') if ndjson else (', ', ': ') super(StructuredFormatter, self).__init__() <|end_body_0|> <|body_start_1|> data: Dict[...
StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)
StructuredFormatter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StructuredFormatter: """StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)""" def __init__(self, component_name: Optional[str]=None, compon...
stack_v2_sparse_classes_36k_train_021838
3,202
permissive
[ { "docstring": "Create a StructuredFormatter object. component_name: Optional[str] - The name of the software component component_type: Optional[str] - The type of the software component ndjson: bool - Output as NDJSON; defaults to True.", "name": "__init__", "signature": "def __init__(self, component_n...
2
stack_v2_sparse_classes_30k_test_000578
Implement the Python class `StructuredFormatter` described below. Class description: StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/) Method signatures and docstri...
Implement the Python class `StructuredFormatter` described below. Class description: StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/) Method signatures and docstri...
12719efa84be2281debe98a18c69bbe7a6d0f399
<|skeleton|> class StructuredFormatter: """StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)""" def __init__(self, component_name: Optional[str]=None, compon...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StructuredFormatter: """StructuredFormatter is a Formatter for structured logging. LogRecord objects are formatted as JSON. Under the default configuration, a StructuredFormatter will render these as NDJSON (http://ndjson.org/)""" def __init__(self, component_name: Optional[str]=None, component_type: Opt...
the_stack_v2_python_sparse
lta/log_format.py
blinkdog/lta
train
0
7381c5c01276b5e75019fb720543a79ae36f34b7
[ "root = BinaryTree.Node(3)\nroot.left = BinaryTree.Node(1)\nroot.left.right = BinaryTree.Node(2)\ntree = BinaryTree(root)\ntree.double_rotate_left_right(tree.root)\nassert tree.root.key == 2\nassert tree.root.left.key == 1\nassert tree.root.right.key == 3", "root = BinaryTree.Node(1)\nroot.right = BinaryTree.Node...
<|body_start_0|> root = BinaryTree.Node(3) root.left = BinaryTree.Node(1) root.left.right = BinaryTree.Node(2) tree = BinaryTree(root) tree.double_rotate_left_right(tree.root) assert tree.root.key == 2 assert tree.root.left.key == 1 assert tree.root.right....
A double rotation of a BinaryTree is used in the special case where a node has a child to the left which in turn has a child to the right or the inverse case where a node has a child to the right which in turn has a child to the left. The double rotation will balance this structure.
TestBinaryTreeDoubleRotation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBinaryTreeDoubleRotation: """A double rotation of a BinaryTree is used in the special case where a node has a child to the left which in turn has a child to the right or the inverse case where a node has a child to the right which in turn has a child to the left. The double rotation will bala...
stack_v2_sparse_classes_36k_train_021839
4,225
no_license
[ { "docstring": "Test a double rotation with a left-rotate followed by a right-rotate. The starting tree is on the left, the result is on the right: 3 3 2 / / / 1 ===> 2 ===> 1 3 \\\\ / 2 1", "name": "test_double_rotate_left_right", "signature": "def test_double_rotate_left_right(self)" }, { "doc...
2
stack_v2_sparse_classes_30k_train_005374
Implement the Python class `TestBinaryTreeDoubleRotation` described below. Class description: A double rotation of a BinaryTree is used in the special case where a node has a child to the left which in turn has a child to the right or the inverse case where a node has a child to the right which in turn has a child to ...
Implement the Python class `TestBinaryTreeDoubleRotation` described below. Class description: A double rotation of a BinaryTree is used in the special case where a node has a child to the left which in turn has a child to the right or the inverse case where a node has a child to the right which in turn has a child to ...
f086ca1dba5f4ca329b5650b3f7b01dc9f89299d
<|skeleton|> class TestBinaryTreeDoubleRotation: """A double rotation of a BinaryTree is used in the special case where a node has a child to the left which in turn has a child to the right or the inverse case where a node has a child to the right which in turn has a child to the left. The double rotation will bala...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestBinaryTreeDoubleRotation: """A double rotation of a BinaryTree is used in the special case where a node has a child to the left which in turn has a child to the right or the inverse case where a node has a child to the right which in turn has a child to the left. The double rotation will balance this stru...
the_stack_v2_python_sparse
data_structures/binary_tree/test_binary_tree_rotation.py
hans25041/python_practice
train
0
b10502290abd996fcefeaca9860475321a342501
[ "self.id = id\nself.name = name\nself.last_edited = APIHelper.RFC3339DateTime(last_edited) if last_edited else None\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nid = dictionary.get('Id')\nname = dictionary.get('Name')\nlast_edited = APIHelper.RFC3339DateTime.from...
<|body_start_0|> self.id = id self.name = name self.last_edited = APIHelper.RFC3339DateTime(last_edited) if last_edited else None self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None id = dictio...
Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited
PdfTemplateListItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PdfTemplateListItem: """Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited""" def __ini...
stack_v2_sparse_classes_36k_train_021840
2,450
permissive
[ { "docstring": "Constructor for the PdfTemplateListItem class", "name": "__init__", "signature": "def __init__(self, id=None, name=None, last_edited=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary...
2
stack_v2_sparse_classes_30k_train_000935
Implement the Python class `PdfTemplateListItem` described below. Class description: Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the te...
Implement the Python class `PdfTemplateListItem` described below. Class description: Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the te...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class PdfTemplateListItem: """Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited""" def __ini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PdfTemplateListItem: """Implementation of the 'PdfTemplateListItem' model. TODO: type model description here. Attributes: id (uuid|string): TODO: type description here. name (string): The name of the Pdf template last_edited (datetime): Timestamp when the template is last edited""" def __init__(self, id=...
the_stack_v2_python_sparse
idfy_rest_client/models/pdf_template_list_item.py
dealflowteam/Idfy
train
0
3b79f1da407ce35df0781001c524bac20927a1d4
[ "best_side = 'index_left'\nindex_left = 0\nindex_right = len(subHeight) - 1\nfor i in range(1, int(len(subHeight) / 2 - 1)):\n index_left += 1\n index_right -= 1\n if subHeight[index_left] < subHeight[index_right]:\n best_side = 'index_left'\n elif subHeight[index_left] > subHeight[index_right]:\...
<|body_start_0|> best_side = 'index_left' index_left = 0 index_right = len(subHeight) - 1 for i in range(1, int(len(subHeight) / 2 - 1)): index_left += 1 index_right -= 1 if subHeight[index_left] < subHeight[index_right]: best_side = 'i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def best_side(self, subHeight): """两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> best_side = 'index_le...
stack_v2_sparse_classes_36k_train_021841
1,949
no_license
[ { "docstring": "两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:", "name": "best_side", "signature": "def best_side(self, subHeight)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
stack_v2_sparse_classes_30k_val_000982
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def best_side(self, subHeight): 两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return: - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def best_side(self, subHeight): 两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return: - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Soluti...
17b22a7201de65cf9ac8807efee225f475d72ef3
<|skeleton|> class Solution: def best_side(self, subHeight): """两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def best_side(self, subHeight): """两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:""" best_side = 'index_left' index_left = 0 index_right = len(subHeight) - 1 for i in range(1, int(len(subHeight) / 2 - 1)): index_left += 1 index_...
the_stack_v2_python_sparse
day5/code11.py
ohquai/LeetCode
train
0
bfe842722dd7a3de77080ef6d8b16f18ddd28507
[ "new_process_ip = request.remote_addr\nif not request.is_json:\n parser = reqparse.RequestParser()\n parser.add_argument(constants.PID_KEY, type=str, help='Process id of process attempting to join the group')\n data = parser.parse_args()\nelse:\n data = request.json\nresult = client._coordinate_process_...
<|body_start_0|> new_process_ip = request.remote_addr if not request.is_json: parser = reqparse.RequestParser() parser.add_argument(constants.PID_KEY, type=str, help='Process id of process attempting to join the group') data = parser.parse_args() else: ...
Message handler for coordinator operations particular to a specific process and a specific group: join group, and leave group
CoordinatorRes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoordinatorRes: """Message handler for coordinator operations particular to a specific process and a specific group: join group, and leave group""" def post(self, process_id=None, group_id=None): """Handler that listens for join group messages. :param process_id: process id of coordi...
stack_v2_sparse_classes_36k_train_021842
8,983
no_license
[ { "docstring": "Handler that listens for join group messages. :param process_id: process id of coordinator (self in this case) :param group_id: group id of the group the process is trying to join body of request: { contants.PID_KEY: process id of the process making the request to join } :return:", "name": "...
2
stack_v2_sparse_classes_30k_val_000693
Implement the Python class `CoordinatorRes` described below. Class description: Message handler for coordinator operations particular to a specific process and a specific group: join group, and leave group Method signatures and docstrings: - def post(self, process_id=None, group_id=None): Handler that listens for joi...
Implement the Python class `CoordinatorRes` described below. Class description: Message handler for coordinator operations particular to a specific process and a specific group: join group, and leave group Method signatures and docstrings: - def post(self, process_id=None, group_id=None): Handler that listens for joi...
45df130f30bcf106d863efe800ab22a5ef56cbea
<|skeleton|> class CoordinatorRes: """Message handler for coordinator operations particular to a specific process and a specific group: join group, and leave group""" def post(self, process_id=None, group_id=None): """Handler that listens for join group messages. :param process_id: process id of coordi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoordinatorRes: """Message handler for coordinator operations particular to a specific process and a specific group: join group, and leave group""" def post(self, process_id=None, group_id=None): """Handler that listens for join group messages. :param process_id: process id of coordinator (self i...
the_stack_v2_python_sparse
src/client_comms_rx.py
lavelle96/group-management-system
train
0
5a3e77ed905eb5336b7117a3c08e681b279bf8ed
[ "logger.warning(f'\\tWARNING: {self.__class__.__name__} are experimental for quantile regression. They may change or be removed without warning in future releases.')\nif sample_weight is not None:\n logger.warning(f'\\tWARNING: {self.__class__.__name__} ignores sample_weight.')\nX, y = check_X_y(X, y, accept_spa...
<|body_start_0|> logger.warning(f'\tWARNING: {self.__class__.__name__} are experimental for quantile regression. They may change or be removed without warning in future releases.') if sample_weight is not None: logger.warning(f'\tWARNING: {self.__class__.__name__} ignores sample_weight.') ...
BaseForestQuantileRegressor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseForestQuantileRegressor: def fit(self, X, y, sample_weight=None): """Build a forest from the training set (X, y). Parameters ---------- X : array-like or sparse matrix, shape = [n_samples, n_features] The training input samples. Internally, it will be converted to ``dtype=np.float32`...
stack_v2_sparse_classes_36k_train_021843
36,172
permissive
[ { "docstring": "Build a forest from the training set (X, y). Parameters ---------- X : array-like or sparse matrix, shape = [n_samples, n_features] The training input samples. Internally, it will be converted to ``dtype=np.float32`` and if a sparse matrix is provided to a sparse ``csc_matrix``. y : array-like, ...
2
null
Implement the Python class `BaseForestQuantileRegressor` described below. Class description: Implement the BaseForestQuantileRegressor class. Method signatures and docstrings: - def fit(self, X, y, sample_weight=None): Build a forest from the training set (X, y). Parameters ---------- X : array-like or sparse matrix,...
Implement the Python class `BaseForestQuantileRegressor` described below. Class description: Implement the BaseForestQuantileRegressor class. Method signatures and docstrings: - def fit(self, X, y, sample_weight=None): Build a forest from the training set (X, y). Parameters ---------- X : array-like or sparse matrix,...
6af92e149491f6e5062495d87306b3625d12d992
<|skeleton|> class BaseForestQuantileRegressor: def fit(self, X, y, sample_weight=None): """Build a forest from the training set (X, y). Parameters ---------- X : array-like or sparse matrix, shape = [n_samples, n_features] The training input samples. Internally, it will be converted to ``dtype=np.float32`...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseForestQuantileRegressor: def fit(self, X, y, sample_weight=None): """Build a forest from the training set (X, y). Parameters ---------- X : array-like or sparse matrix, shape = [n_samples, n_features] The training input samples. Internally, it will be converted to ``dtype=np.float32`` and if a spa...
the_stack_v2_python_sparse
tabular/src/autogluon/tabular/models/rf/rf_quantile.py
stjordanis/autogluon
train
0
5f668d66c245ee150a4b78534839dc3a55f76cfa
[ "try:\n args = parser.parse_args()\n action = args['action']\n if action == 'rescan':\n DBSubdomainResult.delete_by_tid(tid)\n DBSubdomainTask.update_by_id(tid, {'date': int(time.time()), 'status': 'waiting', 'end_date': 0})\n cid = t_subdomain_task.delay(tid)\n DBSubdomainTask....
<|body_start_0|> try: args = parser.parse_args() action = args['action'] if action == 'rescan': DBSubdomainResult.delete_by_tid(tid) DBSubdomainTask.update_by_id(tid, {'date': int(time.time()), 'status': 'waiting', 'end_date': 0}) ...
SubdomainTaskManageV1
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubdomainTaskManageV1: def put(self, tid): """task rescan""" <|body_0|> def delete(self, tid): """delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_021844
8,221
permissive
[ { "docstring": "task rescan", "name": "put", "signature": "def put(self, tid)" }, { "docstring": "delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:", "name": "delete", "signature": "def delete(self, tid)" } ]
2
stack_v2_sparse_classes_30k_train_008826
Implement the Python class `SubdomainTaskManageV1` described below. Class description: Implement the SubdomainTaskManageV1 class. Method signatures and docstrings: - def put(self, tid): task rescan - def delete(self, tid): delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:
Implement the Python class `SubdomainTaskManageV1` described below. Class description: Implement the SubdomainTaskManageV1 class. Method signatures and docstrings: - def put(self, tid): task rescan - def delete(self, tid): delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return: <|sk...
fadb1136b8896fe2a0f7783627bda867d5e6fd98
<|skeleton|> class SubdomainTaskManageV1: def put(self, tid): """task rescan""" <|body_0|> def delete(self, tid): """delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubdomainTaskManageV1: def put(self, tid): """task rescan""" try: args = parser.parse_args() action = args['action'] if action == 'rescan': DBSubdomainResult.delete_by_tid(tid) DBSubdomainTask.update_by_id(tid, {'date': int(ti...
the_stack_v2_python_sparse
fuxi/web/api/discovery/subdomain_api.py
Solotov/fuxi
train
0
c3297933c2e3c35d59ed609019077c04ec1cd5cf
[ "if n < 1:\n return 0\ncount = 0\nfor i in range(1, n + 1):\n num = i\n while num != 0:\n if num % 10 == 1:\n count += 1\n num /= 10\nreturn count", "if n < 1:\n return 0\ncount = 0\nfactot = 1\nwhile n / factot != 0:\n digit = n / factot % 10\n high = n / (10 * factot)\...
<|body_start_0|> if n < 1: return 0 count = 0 for i in range(1, n + 1): num = i while num != 0: if num % 10 == 1: count += 1 num /= 10 return count <|end_body_0|> <|body_start_1|> if n < 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countDigitOneBruteForce(self, n): """:type n: int :rtype: int""" <|body_0|> def countDigitOneMath(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 1: return 0 count = 0 ...
stack_v2_sparse_classes_36k_train_021845
2,642
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "countDigitOneBruteForce", "signature": "def countDigitOneBruteForce(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "countDigitOneMath", "signature": "def countDigitOneMath(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countDigitOneBruteForce(self, n): :type n: int :rtype: int - def countDigitOneMath(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countDigitOneBruteForce(self, n): :type n: int :rtype: int - def countDigitOneMath(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def countDigitOneBrut...
819fbc523f3b33742333b6b39b72337a24a26f7a
<|skeleton|> class Solution: def countDigitOneBruteForce(self, n): """:type n: int :rtype: int""" <|body_0|> def countDigitOneMath(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countDigitOneBruteForce(self, n): """:type n: int :rtype: int""" if n < 1: return 0 count = 0 for i in range(1, n + 1): num = i while num != 0: if num % 10 == 1: count += 1 num...
the_stack_v2_python_sparse
leetcode/Math/233. Number of Digit One整数中1的个数.py
Andrewlearning/Leetcoding
train
1
99f061aa214cc4993a3a1e02c0805a6f6c3bf848
[ "session = Session()\ntry:\n item = find_it_asset_instance(it_asset_instance_id, organization_code, session)\n if item is None:\n raise falcon.HTTPNotFound()\n resp.media = {'data': custom_asdict(item)}\nfinally:\n session.close()", "session = Session()\ntry:\n it_asset_instance = find_it_as...
<|body_start_0|> session = Session() try: item = find_it_asset_instance(it_asset_instance_id, organization_code, session) if item is None: raise falcon.HTTPNotFound() resp.media = {'data': custom_asdict(item)} finally: session.close...
GET and DELETE an organization's IT asset instance.
Item
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Item: """GET and DELETE an organization's IT asset instance.""" def on_get(self, req, resp, organization_code, it_asset_instance_id): """GETs a single instance of IT asset of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation...
stack_v2_sparse_classes_36k_train_021846
9,295
no_license
[ { "docstring": "GETs a single instance of IT asset of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. :param organization_code: The code of the organization. :param it_asset_instance_id: The id of the IT asset instance to retrieve.", "name": "on...
3
stack_v2_sparse_classes_30k_train_013794
Implement the Python class `Item` described below. Class description: GET and DELETE an organization's IT asset instance. Method signatures and docstrings: - def on_get(self, req, resp, organization_code, it_asset_instance_id): GETs a single instance of IT asset of an organization. :param req: See Falcon Request docu...
Implement the Python class `Item` described below. Class description: GET and DELETE an organization's IT asset instance. Method signatures and docstrings: - def on_get(self, req, resp, organization_code, it_asset_instance_id): GETs a single instance of IT asset of an organization. :param req: See Falcon Request docu...
62723133595829230e5b589431a32cda3b092460
<|skeleton|> class Item: """GET and DELETE an organization's IT asset instance.""" def on_get(self, req, resp, organization_code, it_asset_instance_id): """GETs a single instance of IT asset of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Item: """GET and DELETE an organization's IT asset instance.""" def on_get(self, req, resp, organization_code, it_asset_instance_id): """GETs a single instance of IT asset of an organization. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. :param orga...
the_stack_v2_python_sparse
knoweak/api/resources/organization_it_asset.py
psvaiter/knoweak-api
train
0
2fec99e2909f81b2a0869b9545a453d08954052c
[ "self.edc_id: str = edc_id\nself.location: tuple[float, ...] = location\nself.r_mngr_config: RManagerConfig = RManagerConfig() if r_mngr_config is None else r_mngr_config\nself.pu_configs: dict[str, ProcessingUnitConfig] = dict()\nself.edc_temp: float = edc_temp\nself.cooler_config: CoolerConfig = CoolerConfig('def...
<|body_start_0|> self.edc_id: str = edc_id self.location: tuple[float, ...] = location self.r_mngr_config: RManagerConfig = RManagerConfig() if r_mngr_config is None else r_mngr_config self.pu_configs: dict[str, ProcessingUnitConfig] = dict() self.edc_temp: float = edc_temp ...
EdgeDataCenterConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdgeDataCenterConfig: def __init__(self, edc_id: str, location: tuple[float, ...], r_mngr_config: RManagerConfig=None, cooler_config: CoolerConfig | None=None, edc_temp: float=298, edc_trx: TransceiverConfig=None): """Edge data center configuration. :param edc_id: ID of the Edge Data Cen...
stack_v2_sparse_classes_36k_train_021847
18,403
permissive
[ { "docstring": "Edge data center configuration. :param edc_id: ID of the Edge Data Center. :param location: Location of the EDC (coordinates in meters). :param r_mngr_config: Resource manager configuration. :param cooler_config: configuration of cooling infrastructure of EDC. :param edc_temp: temperature (in Ke...
4
null
Implement the Python class `EdgeDataCenterConfig` described below. Class description: Implement the EdgeDataCenterConfig class. Method signatures and docstrings: - def __init__(self, edc_id: str, location: tuple[float, ...], r_mngr_config: RManagerConfig=None, cooler_config: CoolerConfig | None=None, edc_temp: float=...
Implement the Python class `EdgeDataCenterConfig` described below. Class description: Implement the EdgeDataCenterConfig class. Method signatures and docstrings: - def __init__(self, edc_id: str, location: tuple[float, ...], r_mngr_config: RManagerConfig=None, cooler_config: CoolerConfig | None=None, edc_temp: float=...
cb425605de3341d27ce43fb326b300cb8ac781f6
<|skeleton|> class EdgeDataCenterConfig: def __init__(self, edc_id: str, location: tuple[float, ...], r_mngr_config: RManagerConfig=None, cooler_config: CoolerConfig | None=None, edc_temp: float=298, edc_trx: TransceiverConfig=None): """Edge data center configuration. :param edc_id: ID of the Edge Data Cen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EdgeDataCenterConfig: def __init__(self, edc_id: str, location: tuple[float, ...], r_mngr_config: RManagerConfig=None, cooler_config: CoolerConfig | None=None, edc_temp: float=298, edc_trx: TransceiverConfig=None): """Edge data center configuration. :param edc_id: ID of the Edge Data Center. :param lo...
the_stack_v2_python_sparse
mercury/config/edcs.py
greenlsi/mercury_mso_framework
train
2
9b8f70ecb5efc70b9fbb550bf94a8d9c9ddcdb8b
[ "self.m = m\nself.group = group\nself.fullscreen = fullscreen\nbtn = MapBtn(content=icon_content, v_on='menu.on')\nslot = {'name': 'activator', 'variable': 'menu', 'children': btn}\nchildren = [card_content]\nif isinstance(card_content, sw.Tile):\n card_title = card_content.get_title()\n card_content.nest()\n...
<|body_start_0|> self.m = m self.group = group self.fullscreen = fullscreen btn = MapBtn(content=icon_content, v_on='menu.on') slot = {'name': 'activator', 'variable': 'menu', 'children': btn} children = [card_content] if isinstance(card_content, sw.Tile): ...
MenuControl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MenuControl: def __init__(self, icon_content: str, card_content: Union[v.VuetifyWidget, str], card_title: str='', m: Optional[Map]=None, group: int=0, fullscreen: bool=False, **kwargs) -> None: """Widget control displaying a btn on the map. When clicked the menu expand to show the conten...
stack_v2_sparse_classes_36k_train_021848
6,732
permissive
[ { "docstring": "Widget control displaying a btn on the map. When clicked the menu expand to show the content set by the user and all the others are closed. It's used to display interactive tiles directly in the map. If the card_content is a Tile it will be automatically nested. Args: icon_content: the icon cont...
5
stack_v2_sparse_classes_30k_test_000404
Implement the Python class `MenuControl` described below. Class description: Implement the MenuControl class. Method signatures and docstrings: - def __init__(self, icon_content: str, card_content: Union[v.VuetifyWidget, str], card_title: str='', m: Optional[Map]=None, group: int=0, fullscreen: bool=False, **kwargs) ...
Implement the Python class `MenuControl` described below. Class description: Implement the MenuControl class. Method signatures and docstrings: - def __init__(self, icon_content: str, card_content: Union[v.VuetifyWidget, str], card_title: str='', m: Optional[Map]=None, group: int=0, fullscreen: bool=False, **kwargs) ...
b26c7d698659d5c5a2029d02fc94dcd9daf0df98
<|skeleton|> class MenuControl: def __init__(self, icon_content: str, card_content: Union[v.VuetifyWidget, str], card_title: str='', m: Optional[Map]=None, group: int=0, fullscreen: bool=False, **kwargs) -> None: """Widget control displaying a btn on the map. When clicked the menu expand to show the conten...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MenuControl: def __init__(self, icon_content: str, card_content: Union[v.VuetifyWidget, str], card_title: str='', m: Optional[Map]=None, group: int=0, fullscreen: bool=False, **kwargs) -> None: """Widget control displaying a btn on the map. When clicked the menu expand to show the content set by the u...
the_stack_v2_python_sparse
sepal_ui/mapping/menu_control.py
12rambau/sepal_ui
train
17
13bc22c36cac712e09d5ec992cd3225eb04fd438
[ "super().setUp()\nself.request = self.request_context['request']\nself.request.path = '/api/v1/status/'\nself.request.META['QUERY_STRING'] = ''", "middleware = RequestTimingMiddleware()\nmiddleware.process_request(self.request)\nself.assertTrue(hasattr(self.request, 'start_time'))", "mock_get_tenant.return_valu...
<|body_start_0|> super().setUp() self.request = self.request_context['request'] self.request.path = '/api/v1/status/' self.request.META['QUERY_STRING'] = '' <|end_body_0|> <|body_start_1|> middleware = RequestTimingMiddleware() middleware.process_request(self.request) ...
Tests against the koku tenant middleware.
RequestTimingMiddlewareTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestTimingMiddlewareTest: """Tests against the koku tenant middleware.""" def setUp(self): """Set up middleware tests.""" <|body_0|> def test_process_request(self): """Test that the request gets a user.""" <|body_1|> def test_process_response(self...
stack_v2_sparse_classes_36k_train_021849
27,733
permissive
[ { "docstring": "Set up middleware tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the request gets a user.", "name": "test_process_request", "signature": "def test_process_request(self)" }, { "docstring": "Test that the request gets a user.",...
3
stack_v2_sparse_classes_30k_train_007677
Implement the Python class `RequestTimingMiddlewareTest` described below. Class description: Tests against the koku tenant middleware. Method signatures and docstrings: - def setUp(self): Set up middleware tests. - def test_process_request(self): Test that the request gets a user. - def test_process_response(self, mo...
Implement the Python class `RequestTimingMiddlewareTest` described below. Class description: Tests against the koku tenant middleware. Method signatures and docstrings: - def setUp(self): Set up middleware tests. - def test_process_request(self): Test that the request gets a user. - def test_process_response(self, mo...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class RequestTimingMiddlewareTest: """Tests against the koku tenant middleware.""" def setUp(self): """Set up middleware tests.""" <|body_0|> def test_process_request(self): """Test that the request gets a user.""" <|body_1|> def test_process_response(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestTimingMiddlewareTest: """Tests against the koku tenant middleware.""" def setUp(self): """Set up middleware tests.""" super().setUp() self.request = self.request_context['request'] self.request.path = '/api/v1/status/' self.request.META['QUERY_STRING'] = '' ...
the_stack_v2_python_sparse
koku/koku/test_middleware.py
project-koku/koku
train
225
c694d733d0b5b55de39e8dc3846e8e7dd92b9717
[ "self.logger = logger.SecureTeaLogger(__name__, debug=debug)\nself.system_log_map = {'debian': '/var/log/auth.log'}\nos_name = utils.categorize_os()\nself.log_file = None\nif os_name:\n try:\n self.log_file = self.system_log_map[os_name]\n except KeyError:\n self.logger.log('Could not find path ...
<|body_start_0|> self.logger = logger.SecureTeaLogger(__name__, debug=debug) self.system_log_map = {'debian': '/var/log/auth.log'} os_name = utils.categorize_os() self.log_file = None if os_name: try: self.log_file = self.system_log_map[os_name] ...
PortScan Class.
PortScan
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortScan: """PortScan Class.""" def __init__(self, debug=False): """Initialize PortScan. Args: debug (bool): Log on terminal or not Raises: None Returns: None""" <|body_0|> def parse_log_file(self): """Parse the log file to extract IP address showing quick Reciev...
stack_v2_sparse_classes_36k_train_021850
5,683
permissive
[ { "docstring": "Initialize PortScan. Args: debug (bool): Log on terminal or not Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=False)" }, { "docstring": "Parse the log file to extract IP address showing quick Recieved Disconnect. Args: None Raises: None R...
5
null
Implement the Python class `PortScan` described below. Class description: PortScan Class. Method signatures and docstrings: - def __init__(self, debug=False): Initialize PortScan. Args: debug (bool): Log on terminal or not Raises: None Returns: None - def parse_log_file(self): Parse the log file to extract IP address...
Implement the Python class `PortScan` described below. Class description: PortScan Class. Method signatures and docstrings: - def __init__(self, debug=False): Initialize PortScan. Args: debug (bool): Log on terminal or not Raises: None Returns: None - def parse_log_file(self): Parse the log file to extract IP address...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class PortScan: """PortScan Class.""" def __init__(self, debug=False): """Initialize PortScan. Args: debug (bool): Log on terminal or not Raises: None Returns: None""" <|body_0|> def parse_log_file(self): """Parse the log file to extract IP address showing quick Reciev...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PortScan: """PortScan Class.""" def __init__(self, debug=False): """Initialize PortScan. Args: debug (bool): Log on terminal or not Raises: None Returns: None""" self.logger = logger.SecureTeaLogger(__name__, debug=debug) self.system_log_map = {'debian': '/var/log/auth.log'} ...
the_stack_v2_python_sparse
securetea/lib/log_monitor/system_log/port_scan.py
rejahrehim/SecureTea-Project
train
1
4f1db3fa7960c270ec7f8a2cd615593a9cab1439
[ "edge_strings = []\nfor u in range(0, self.num_nodes):\n for v, cost in self.adjancency_lists[u]:\n edge_strings.append('%d->%d|%d' % (u, v, cost))\nreturn '[' + ', '.join(edge_strings) + ']'", "self.num_nodes = 0\nself.num_edges = 0\nself.adjancency_lists = []", "with open(file_name) as f:\n self....
<|body_start_0|> edge_strings = [] for u in range(0, self.num_nodes): for v, cost in self.adjancency_lists[u]: edge_strings.append('%d->%d|%d' % (u, v, cost)) return '[' + ', '.join(edge_strings) + ']' <|end_body_0|> <|body_start_1|> self.num_nodes = 0 ...
Graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: def __repr__(self): """The graph as human-readable and testable string.""" <|body_0|> def __init__(self): """Create an empty graph.""" <|body_1|> def read(self, file_name): """Read graph from given file. >>> graph = Graph() >>> graph.read(...
stack_v2_sparse_classes_36k_train_021851
1,143
no_license
[ { "docstring": "The graph as human-readable and testable string.", "name": "__repr__", "signature": "def __repr__(self)" }, { "docstring": "Create an empty graph.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Read graph from given file. >>> graph = Gr...
3
stack_v2_sparse_classes_30k_train_009836
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __repr__(self): The graph as human-readable and testable string. - def __init__(self): Create an empty graph. - def read(self, file_name): Read graph from given file. >>> graph = G...
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __repr__(self): The graph as human-readable and testable string. - def __init__(self): Create an empty graph. - def read(self, file_name): Read graph from given file. >>> graph = G...
5e51c57c17ee8c233a0fe63f32942e80549040fd
<|skeleton|> class Graph: def __repr__(self): """The graph as human-readable and testable string.""" <|body_0|> def __init__(self): """Create an empty graph.""" <|body_1|> def read(self, file_name): """Read graph from given file. >>> graph = Graph() >>> graph.read(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Graph: def __repr__(self): """The graph as human-readable and testable string.""" edge_strings = [] for u in range(0, self.num_nodes): for v, cost in self.adjancency_lists[u]: edge_strings.append('%d->%d|%d' % (u, v, cost)) return '[' + ', '.join(edg...
the_stack_v2_python_sparse
semester_two/algoDat/public/code/vorlesung-10/graph.py
fkarg/uni-stuff
train
0
652a1e2e8b6505c8509e78e302d308bdd1f23802
[ "max_texture_size = pyglet.image.get_max_texture_size()\nself.texture_width = min(texture_width, max_texture_size)\nself.texture_height = min(texture_height, max_texture_size)\nself.atlases = []", "for atlas in list(self.atlases):\n try:\n return atlas.add(img, border)\n except AllocatorException:\n ...
<|body_start_0|> max_texture_size = pyglet.image.get_max_texture_size() self.texture_width = min(texture_width, max_texture_size) self.texture_height = min(texture_height, max_texture_size) self.atlases = [] <|end_body_0|> <|body_start_1|> for atlas in list(self.atlases): ...
Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin.
TextureBin
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextureBin: """Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin.""" def __init__(self, texture_width: int=2048, texture_height: int=2048) -> None: ...
stack_v2_sparse_classes_36k_train_021852
10,284
permissive
[ { "docstring": "Create a texture bin for holding atlases of the given size. :Parameters: `texture_width` : int Width of texture atlases to create. `texture_height` : int Height of texture atlases to create. `border` : int Leaves specified pixels of blank space around each image added to the Atlases.", "name...
2
stack_v2_sparse_classes_30k_train_013144
Implement the Python class `TextureBin` described below. Class description: Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin. Method signatures and docstrings: - def __init__(se...
Implement the Python class `TextureBin` described below. Class description: Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin. Method signatures and docstrings: - def __init__(se...
094c638f0529fecab4e74556487b92453a78753c
<|skeleton|> class TextureBin: """Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin.""" def __init__(self, texture_width: int=2048, texture_height: int=2048) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextureBin: """Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin.""" def __init__(self, texture_width: int=2048, texture_height: int=2048) -> None: """Create...
the_stack_v2_python_sparse
pyglet/image/atlas.py
pyglet/pyglet
train
1,687
6374fb173bfd37053c07ba970ea3fe46d5fee626
[ "self.name = name\nself.data_path = paths.dn + '/data/' + name\nself.train_path = self.data_path + '/train'\nself.test_path = self.data_path + '/test'\nself.populate()\nself.cfg_path = paths.dn + '/cfg/' + name + '.cfg'\nself.dat_path = paths.dn + '/cfg/' + name + '.dat'\nself.backup_path = paths.dn + '/backup'\nse...
<|body_start_0|> self.name = name self.data_path = paths.dn + '/data/' + name self.train_path = self.data_path + '/train' self.test_path = self.data_path + '/test' self.populate() self.cfg_path = paths.dn + '/cfg/' + name + '.cfg' self.dat_path = paths.dn + '/cfg/...
Wrapper for an on-disk Darknet network configuration.
Darknetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Darknetwork: """Wrapper for an on-disk Darknet network configuration.""" def __init__(self, name): """Creates a new network and populates it with metadata found on disk if it could be found. Parameters ---------- name : str unique identifying name""" <|body_0|> def make_...
stack_v2_sparse_classes_36k_train_021853
5,215
no_license
[ { "docstring": "Creates a new network and populates it with metadata found on disk if it could be found. Parameters ---------- name : str unique identifying name", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Generates the .dat file used to convey network metada...
6
stack_v2_sparse_classes_30k_train_015812
Implement the Python class `Darknetwork` described below. Class description: Wrapper for an on-disk Darknet network configuration. Method signatures and docstrings: - def __init__(self, name): Creates a new network and populates it with metadata found on disk if it could be found. Parameters ---------- name : str uni...
Implement the Python class `Darknetwork` described below. Class description: Wrapper for an on-disk Darknet network configuration. Method signatures and docstrings: - def __init__(self, name): Creates a new network and populates it with metadata found on disk if it could be found. Parameters ---------- name : str uni...
bebffb2e886ba990f6b5fe6d51aa3ec4571c8d8c
<|skeleton|> class Darknetwork: """Wrapper for an on-disk Darknet network configuration.""" def __init__(self, name): """Creates a new network and populates it with metadata found on disk if it could be found. Parameters ---------- name : str unique identifying name""" <|body_0|> def make_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Darknetwork: """Wrapper for an on-disk Darknet network configuration.""" def __init__(self, name): """Creates a new network and populates it with metadata found on disk if it could be found. Parameters ---------- name : str unique identifying name""" self.name = name self.data_pat...
the_stack_v2_python_sparse
bwi_scavenger/scripts/darknet_structure.py
utexas-bwi/scavenger_hunt
train
2
e1c06e9a51f3f32d182d916d96cd7d5c9328e2bd
[ "if self.events is None:\n self.events = {}\nevents = self.events\nall_events = all_events or ALL_EVENTS\nexclude = set(exclude or ())\nfor name in all_events:\n if name in exclude:\n continue\n if name not in events:\n events[name] = []\n handlers = events[name]\n if hasattr(extension,...
<|body_start_0|> if self.events is None: self.events = {} events = self.events all_events = all_events or ALL_EVENTS exclude = set(exclude or ()) for name in all_events: if name in exclude: continue if name not in events: ...
EventMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventMixin: def bind_events(self, extension, all_events=None, exclude=None): """Bind ``all_events`` to an ``extension``. :param extension: an class:`.Extension` :param all_events: optional list of event names. If not supplied, the default lux events are used. :param exclude: optional lis...
stack_v2_sparse_classes_36k_train_021854
8,545
permissive
[ { "docstring": "Bind ``all_events`` to an ``extension``. :param extension: an class:`.Extension` :param all_events: optional list of event names. If not supplied, the default lux events are used. :param exclude: optional list of event to exclude", "name": "bind_events", "signature": "def bind_events(sel...
2
null
Implement the Python class `EventMixin` described below. Class description: Implement the EventMixin class. Method signatures and docstrings: - def bind_events(self, extension, all_events=None, exclude=None): Bind ``all_events`` to an ``extension``. :param extension: an class:`.Extension` :param all_events: optional ...
Implement the Python class `EventMixin` described below. Class description: Implement the EventMixin class. Method signatures and docstrings: - def bind_events(self, extension, all_events=None, exclude=None): Bind ``all_events`` to an ``extension``. :param extension: an class:`.Extension` :param all_events: optional ...
d647c34d11d1172d40e16b6afaba4ee67950fb5a
<|skeleton|> class EventMixin: def bind_events(self, extension, all_events=None, exclude=None): """Bind ``all_events`` to an ``extension``. :param extension: an class:`.Extension` :param all_events: optional list of event names. If not supplied, the default lux events are used. :param exclude: optional lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventMixin: def bind_events(self, extension, all_events=None, exclude=None): """Bind ``all_events`` to an ``extension``. :param extension: an class:`.Extension` :param all_events: optional list of event names. If not supplied, the default lux events are used. :param exclude: optional list of event to ...
the_stack_v2_python_sparse
lux/core/extension.py
SirZazu/lux
train
0
8f1cb251047bc0f41c858c9af34575fb5203e192
[ "instanceA = Enum()\ninstanceB = Enum()\nself.assertEqual(instanceA, instanceB)", "instance = Enum()\nHORIZONTAL = instance.getNextId('orientation')\nVERTICAL = instance.getNextId('orientation')\nself.assertTrue(HORIZONTAL < VERTICAL)", "class Direction:\n TOP = enum('direction')\n LEFT = enum('direction'...
<|body_start_0|> instanceA = Enum() instanceB = Enum() self.assertEqual(instanceA, instanceB) <|end_body_0|> <|body_start_1|> instance = Enum() HORIZONTAL = instance.getNextId('orientation') VERTICAL = instance.getNextId('orientation') self.assertTrue(HORIZONTAL ...
testing of class Enum
EnumTestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnumTestCase: """testing of class Enum""" def testSingleton(self): """testing the singleton mechanism""" <|body_0|> def testGetNextId(self): """example of creating two constants""" <|body_1|> def testEnumFunctionWithStringContext(self): """ex...
stack_v2_sparse_classes_36k_train_021855
4,176
permissive
[ { "docstring": "testing the singleton mechanism", "name": "testSingleton", "signature": "def testSingleton(self)" }, { "docstring": "example of creating two constants", "name": "testGetNextId", "signature": "def testGetNextId(self)" }, { "docstring": "example of creating four con...
4
null
Implement the Python class `EnumTestCase` described below. Class description: testing of class Enum Method signatures and docstrings: - def testSingleton(self): testing the singleton mechanism - def testGetNextId(self): example of creating two constants - def testEnumFunctionWithStringContext(self): example of creati...
Implement the Python class `EnumTestCase` described below. Class description: testing of class Enum Method signatures and docstrings: - def testSingleton(self): testing the singleton mechanism - def testGetNextId(self): example of creating two constants - def testEnumFunctionWithStringContext(self): example of creati...
d097ca0ad6a6aee2180d32dce6a3322621f655fd
<|skeleton|> class EnumTestCase: """testing of class Enum""" def testSingleton(self): """testing the singleton mechanism""" <|body_0|> def testGetNextId(self): """example of creating two constants""" <|body_1|> def testEnumFunctionWithStringContext(self): """ex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnumTestCase: """testing of class Enum""" def testSingleton(self): """testing the singleton mechanism""" instanceA = Enum() instanceB = Enum() self.assertEqual(instanceA, instanceB) def testGetNextId(self): """example of creating two constants""" insta...
the_stack_v2_python_sparse
recipes/Python/578015_Simple_enum_mechanism/recipe-578015.py
betty29/code-1
train
0
b9c3e8297140917b9ab7f685fa74f38b3fed1ea4
[ "from dials.util.options import ArgumentParser\nimport libtbx.load_env\nusage = 'usage: %s combined.expt combined.refl' % libtbx.env.dispatcher_name\nself.parser = ArgumentParser(usage=usage, sort_options=True, phil=phil_scope, read_experiments=True, read_reflections=True, check_format=False, epilog=help_message)",...
<|body_start_0|> from dials.util.options import ArgumentParser import libtbx.load_env usage = 'usage: %s combined.expt combined.refl' % libtbx.env.dispatcher_name self.parser = ArgumentParser(usage=usage, sort_options=True, phil=phil_scope, read_experiments=True, read_reflections=True, c...
Class to parse the command line options.
Script
[ "BSD-3-Clause-LBNL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Script: """Class to parse the command line options.""" def __init__(self): """Set the expected options.""" <|body_0|> def run(self): """Parse the options.""" <|body_1|> <|end_skeleton|> <|body_start_0|> from dials.util.options import ArgumentPar...
stack_v2_sparse_classes_36k_train_021856
7,820
permissive
[ { "docstring": "Set the expected options.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Parse the options.", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `Script` described below. Class description: Class to parse the command line options. Method signatures and docstrings: - def __init__(self): Set the expected options. - def run(self): Parse the options.
Implement the Python class `Script` described below. Class description: Class to parse the command line options. Method signatures and docstrings: - def __init__(self): Set the expected options. - def run(self): Parse the options. <|skeleton|> class Script: """Class to parse the command line options.""" def...
7f4dfb6c873fd560920f697cbfd8a5ff6eed82fa
<|skeleton|> class Script: """Class to parse the command line options.""" def __init__(self): """Set the expected options.""" <|body_0|> def run(self): """Parse the options.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Script: """Class to parse the command line options.""" def __init__(self): """Set the expected options.""" from dials.util.options import ArgumentParser import libtbx.load_env usage = 'usage: %s combined.expt combined.refl' % libtbx.env.dispatcher_name self.parser ...
the_stack_v2_python_sparse
xfel/command_line/filter_experiments_by_rmsd.py
cctbx/cctbx_project
train
206
aeb8e21c411e031d8cda978ce85e924ca1145d22
[ "super(HypervisorsClient, self).__init__(serialize_format, deserialize_format)\nself.auth_token = auth_token\nself.default_headers['X-Auth-Token'] = auth_token\nct = ''.join(['application/', self.serialize_format])\naccept = ''.join(['application/', self.deserialize_format])\nself.default_headers['Content-Type'] = ...
<|body_start_0|> super(HypervisorsClient, self).__init__(serialize_format, deserialize_format) self.auth_token = auth_token self.default_headers['X-Auth-Token'] = auth_token ct = ''.join(['application/', self.serialize_format]) accept = ''.join(['application/', self.deserialize_f...
HypervisorsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HypervisorsClient: def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): """@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for...
stack_v2_sparse_classes_36k_train_021857
3,393
permissive
[ { "docstring": "@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for serializing requests @type serialize_format: String @param deserialize_format: Format for de-serializing responses...
4
stack_v2_sparse_classes_30k_train_008276
Implement the Python class `HypervisorsClient` described below. Class description: Implement the HypervisorsClient class. Method signatures and docstrings: - def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): @param url: Base URL for the compute service @type url: String @param auth_...
Implement the Python class `HypervisorsClient` described below. Class description: Implement the HypervisorsClient class. Method signatures and docstrings: - def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): @param url: Base URL for the compute service @type url: String @param auth_...
7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924
<|skeleton|> class HypervisorsClient: def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): """@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HypervisorsClient: def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): """@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for serializing r...
the_stack_v2_python_sparse
cloudcafe/compute/hypervisors_api/client.py
kurhula/cloudcafe
train
0
5aac1328faf366fa51f598d9699c2d818bd5471a
[ "self.driver.get('http://www.baidu.com')\nself.driver.find_element_by_id('kw').send_keys('selenium测试')\nelement = self.driver.execute_script(\"return document.getElementById('su')\")\nelement.click()\nself.driver.execute_script('document.documentElement.scrollTop=0')\nsleep(1)\nself.driver.execute_script('document....
<|body_start_0|> self.driver.get('http://www.baidu.com') self.driver.find_element_by_id('kw').send_keys('selenium测试') element = self.driver.execute_script("return document.getElementById('su')") element.click() self.driver.execute_script('document.documentElement.scrollTop=0') ...
jS测试类
TestJs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestJs: """jS测试类""" def test_js_scroll(self): """js滑动处理""" <|body_0|> def test_datetime(self): """更改12306出发日期的时间控件""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.driver.get('http://www.baidu.com') self.driver.find_element_by_id('kw...
stack_v2_sparse_classes_36k_train_021858
1,741
no_license
[ { "docstring": "js滑动处理", "name": "test_js_scroll", "signature": "def test_js_scroll(self)" }, { "docstring": "更改12306出发日期的时间控件", "name": "test_datetime", "signature": "def test_datetime(self)" } ]
2
stack_v2_sparse_classes_30k_train_007981
Implement the Python class `TestJs` described below. Class description: jS测试类 Method signatures and docstrings: - def test_js_scroll(self): js滑动处理 - def test_datetime(self): 更改12306出发日期的时间控件
Implement the Python class `TestJs` described below. Class description: jS测试类 Method signatures and docstrings: - def test_js_scroll(self): js滑动处理 - def test_datetime(self): 更改12306出发日期的时间控件 <|skeleton|> class TestJs: """jS测试类""" def test_js_scroll(self): """js滑动处理""" <|body_0|> def tes...
41651054386069fb3da5ec80d4acd922561f6de5
<|skeleton|> class TestJs: """jS测试类""" def test_js_scroll(self): """js滑动处理""" <|body_0|> def test_datetime(self): """更改12306出发日期的时间控件""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestJs: """jS测试类""" def test_js_scroll(self): """js滑动处理""" self.driver.get('http://www.baidu.com') self.driver.find_element_by_id('kw').send_keys('selenium测试') element = self.driver.execute_script("return document.getElementById('su')") element.click() self...
the_stack_v2_python_sparse
com/python/pytest_test1/selenium_js/test_js.py
fengzige1993/PythonData
train
0
55f6da9f4aa1cf2d35fbfae4560bc4dcd0697d1c
[ "letters = [1] * n\nrunning_total = n\nfor i in range(len(letters) - 1, -1, -1):\n if running_total == k:\n break\n elif running_total + 25 <= k:\n letters[i] += 25\n running_total += 25\n else:\n letters[i] += k - running_total\n running_total += k - running_total\nretur...
<|body_start_0|> letters = [1] * n running_total = n for i in range(len(letters) - 1, -1, -1): if running_total == k: break elif running_total + 25 <= k: letters[i] += 25 running_total += 25 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getSmallestString(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_0|> def getSmallestString(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> letters = [1] * n ...
stack_v2_sparse_classes_36k_train_021859
2,141
no_license
[ { "docstring": ":type n: int :type k: int :rtype: str", "name": "getSmallestString", "signature": "def getSmallestString(self, n, k)" }, { "docstring": ":type n: int :type k: int :rtype: str", "name": "getSmallestString", "signature": "def getSmallestString(self, n, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getSmallestString(self, n, k): :type n: int :type k: int :rtype: str - def getSmallestString(self, n, k): :type n: int :type k: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getSmallestString(self, n, k): :type n: int :type k: int :rtype: str - def getSmallestString(self, n, k): :type n: int :type k: int :rtype: str <|skeleton|> class Solution: ...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: def getSmallestString(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_0|> def getSmallestString(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getSmallestString(self, n, k): """:type n: int :type k: int :rtype: str""" letters = [1] * n running_total = n for i in range(len(letters) - 1, -1, -1): if running_total == k: break elif running_total + 25 <= k: ...
the_stack_v2_python_sparse
1663-smallest_string_with_given_numeric_value.py
stevestar888/leetcode-problems
train
2
c2f2115a4594c0cf5a2c1627d82f006cad890554
[ "assert isinstance(response, scrapy.http.response.html.HtmlResponse)\nurls = [response.url]\nposts_per_page = 25\nlast_page = response.selector.xpath('//a[contains(@title, \"Click to jump to page\")]/strong[2]/text()').extract_first()\nif last_page:\n last_page = read_number(last_page)\nelse:\n last_page = 0\...
<|body_start_0|> assert isinstance(response, scrapy.http.response.html.HtmlResponse) urls = [response.url] posts_per_page = 25 last_page = response.selector.xpath('//a[contains(@title, "Click to jump to page")]/strong[2]/text()').extract_first() if last_page: last_pag...
scrape images from angling addicts forum
AnglingAddictsSpeciesHuntImageSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnglingAddictsSpeciesHuntImageSpider: """scrape images from angling addicts forum""" def parse(self, response): """get links to post pages in board YIELDING...: http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97.html http://www.anglingaddicts.co.uk/forum/saltwater-speci...
stack_v2_sparse_classes_36k_train_021860
4,571
no_license
[ { "docstring": "get links to post pages in board YIELDING...: http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97.html http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97-25.html", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "get all thre...
3
null
Implement the Python class `AnglingAddictsSpeciesHuntImageSpider` described below. Class description: scrape images from angling addicts forum Method signatures and docstrings: - def parse(self, response): get links to post pages in board YIELDING...: http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97.h...
Implement the Python class `AnglingAddictsSpeciesHuntImageSpider` described below. Class description: scrape images from angling addicts forum Method signatures and docstrings: - def parse(self, response): get links to post pages in board YIELDING...: http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97.h...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class AnglingAddictsSpeciesHuntImageSpider: """scrape images from angling addicts forum""" def parse(self, response): """get links to post pages in board YIELDING...: http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97.html http://www.anglingaddicts.co.uk/forum/saltwater-speci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnglingAddictsSpeciesHuntImageSpider: """scrape images from angling addicts forum""" def parse(self, response): """get links to post pages in board YIELDING...: http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97.html http://www.anglingaddicts.co.uk/forum/saltwater-species-hunt-f97-2...
the_stack_v2_python_sparse
imgscrape/spiders/angling_addicts.py
gmonkman/python
train
0
f53bb2124ce5b4d5d7c7dcdd43be118a412e5ba0
[ "for line in matrix:\n if target in line:\n return True\nreturn False", "h = len(matrix)\nif h == 0:\n return False\nw = len(matrix[0])\nif w == 0:\n return False\nleft = 0\nright = h * w - 1\nwhile left <= right:\n mid = (left + right) // 2\n i = mid // w\n j = mid % w\n if matrix[i][...
<|body_start_0|> for line in matrix: if target in line: return True return False <|end_body_0|> <|body_start_1|> h = len(matrix) if h == 0: return False w = len(matrix[0]) if w == 0: return False left = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: """可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool""" <|body_0|> def searchMatrix1(self, matrix: List[List[int]], target: int) -> bool: """利用二分法查...
stack_v2_sparse_classes_36k_train_021861
2,816
no_license
[ { "docstring": "可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix: List[List[int]], target: int) -> bool" }, { "docstring": "利用二分法查找,其时间复杂度为O(mn) 注意: h = len(matrix) if h == 0: return Fa...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: 可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool - def searchMatrix...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: 可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool - def searchMatrix...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: """可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool""" <|body_0|> def searchMatrix1(self, matrix: List[List[int]], target: int) -> bool: """利用二分法查...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: """可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool""" for line in matrix: if target in line: return True return False def searchMat...
the_stack_v2_python_sparse
LeetCode_practice/0074_SearchMatrix.py
LeBron-Jian/BasicAlgorithmPractice
train
13
7356b3fd65d28b754e4a6e1ea3de68f95059bcfe
[ "if not rid:\n return\nlog = t_log_onoffline()\nlog.rid = rid\nlog.sock = sock\nDBEngine.Add(log)", "if not rid:\n return\nlog = t_log_onoffline()\nlog.rid = rid\nlog.opt = 'off'\nlog.sock = sock\nDBEngine.Add(log)" ]
<|body_start_0|> if not rid: return log = t_log_onoffline() log.rid = rid log.sock = sock DBEngine.Add(log) <|end_body_0|> <|body_start_1|> if not rid: return log = t_log_onoffline() log.rid = rid log.opt = 'off' lo...
角色在线|离线日志
t_log_onoffline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class t_log_onoffline: """角色在线|离线日志""" def On(rid, sock): """在线 :param rid: 角色rid :param sock: sockfileno :return:""" <|body_0|> def Off(rid, sock): """离线 :param rid: 角色rid :param sock: sockfileno :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021862
1,373
no_license
[ { "docstring": "在线 :param rid: 角色rid :param sock: sockfileno :return:", "name": "On", "signature": "def On(rid, sock)" }, { "docstring": "离线 :param rid: 角色rid :param sock: sockfileno :return:", "name": "Off", "signature": "def Off(rid, sock)" } ]
2
null
Implement the Python class `t_log_onoffline` described below. Class description: 角色在线|离线日志 Method signatures and docstrings: - def On(rid, sock): 在线 :param rid: 角色rid :param sock: sockfileno :return: - def Off(rid, sock): 离线 :param rid: 角色rid :param sock: sockfileno :return:
Implement the Python class `t_log_onoffline` described below. Class description: 角色在线|离线日志 Method signatures and docstrings: - def On(rid, sock): 在线 :param rid: 角色rid :param sock: sockfileno :return: - def Off(rid, sock): 离线 :param rid: 角色rid :param sock: sockfileno :return: <|skeleton|> class t_log_onoffline: "...
fa1591863985a418fd361eb6dac36d1301bc1231
<|skeleton|> class t_log_onoffline: """角色在线|离线日志""" def On(rid, sock): """在线 :param rid: 角色rid :param sock: sockfileno :return:""" <|body_0|> def Off(rid, sock): """离线 :param rid: 角色rid :param sock: sockfileno :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class t_log_onoffline: """角色在线|离线日志""" def On(rid, sock): """在线 :param rid: 角色rid :param sock: sockfileno :return:""" if not rid: return log = t_log_onoffline() log.rid = rid log.sock = sock DBEngine.Add(log) def Off(rid, sock): """离线 :pa...
the_stack_v2_python_sparse
learn_hb_game/game/source/DataBase/Table/Log/t_log_onoffline.py
isoundy000/learn_python
train
0
9b5d5373e907fc76cabfe781745d27d75de2dec5
[ "self.screen_width = 1200\nself.screen_height = 800\nself.menu_bg_color = (0, 0, 0)\nself.game_bg_color = (0, 0, 255)\nself.font_color = (255, 255, 255)\nself.title_font_size = 100\nself.sub_title_font_size = 80\nself.menu_font_size = 48\nself.show_menu = True\nself.show_high_scores = False\nself.show_game = False\...
<|body_start_0|> self.screen_width = 1200 self.screen_height = 800 self.menu_bg_color = (0, 0, 0) self.game_bg_color = (0, 0, 255) self.font_color = (255, 255, 255) self.title_font_size = 100 self.sub_title_font_size = 80 self.menu_font_size = 48 s...
A class to store all settings for Alien Invasion
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """A class to store all settings for Alien Invasion""" def __init__(self): """Initialize the game's static settings""" <|body_0|> def initialize_dynamic_settings(self): """Init settings that change throughout the game""" <|body_1|> def incr...
stack_v2_sparse_classes_36k_train_021863
2,509
no_license
[ { "docstring": "Initialize the game's static settings", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Init settings that change throughout the game", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_019450
Implement the Python class `Settings` described below. Class description: A class to store all settings for Alien Invasion Method signatures and docstrings: - def __init__(self): Initialize the game's static settings - def initialize_dynamic_settings(self): Init settings that change throughout the game - def increase...
Implement the Python class `Settings` described below. Class description: A class to store all settings for Alien Invasion Method signatures and docstrings: - def __init__(self): Initialize the game's static settings - def initialize_dynamic_settings(self): Init settings that change throughout the game - def increase...
eed86936f440e2881d3671fead051f30bc680e43
<|skeleton|> class Settings: """A class to store all settings for Alien Invasion""" def __init__(self): """Initialize the game's static settings""" <|body_0|> def initialize_dynamic_settings(self): """Init settings that change throughout the game""" <|body_1|> def incr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Settings: """A class to store all settings for Alien Invasion""" def __init__(self): """Initialize the game's static settings""" self.screen_width = 1200 self.screen_height = 800 self.menu_bg_color = (0, 0, 0) self.game_bg_color = (0, 0, 255) self.font_colo...
the_stack_v2_python_sparse
Alien Invasion/settings.py
dpham147/Python
train
0
05113f3c399cfafc2a6bf09083db5747c81a0c2d
[ "self.prefix = args[0]\nself.suffix = args[1]\nself.order = order", "for entry in results:\n entry['link'] = self.prefix + entry['link'] + self.suffix\nreturn results" ]
<|body_start_0|> self.prefix = args[0] self.suffix = args[1] self.order = order <|end_body_0|> <|body_start_1|> for entry in results: entry['link'] = self.prefix + entry['link'] + self.suffix return results <|end_body_1|>
Decorates links to search results with given pre- and suffixes, returning [prefix]+url+[suffix].
URLDecorator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URLDecorator: """Decorates links to search results with given pre- and suffixes, returning [prefix]+url+[suffix].""" def __init__(self, args, order=0): """Constructor for URLDecorator. Parameters: * prefix: String to preceed the original url. * suffix: String to tail the original url...
stack_v2_sparse_classes_36k_train_021864
726
permissive
[ { "docstring": "Constructor for URLDecorator. Parameters: * prefix: String to preceed the original url. * suffix: String to tail the original url.", "name": "__init__", "signature": "def __init__(self, args, order=0)" }, { "docstring": "Returns a result set with modified urls.", "name": "mod...
2
null
Implement the Python class `URLDecorator` described below. Class description: Decorates links to search results with given pre- and suffixes, returning [prefix]+url+[suffix]. Method signatures and docstrings: - def __init__(self, args, order=0): Constructor for URLDecorator. Parameters: * prefix: String to preceed th...
Implement the Python class `URLDecorator` described below. Class description: Decorates links to search results with given pre- and suffixes, returning [prefix]+url+[suffix]. Method signatures and docstrings: - def __init__(self, args, order=0): Constructor for URLDecorator. Parameters: * prefix: String to preceed th...
ed72aee466649bd834d5b4459eb6e0173df6e2ec
<|skeleton|> class URLDecorator: """Decorates links to search results with given pre- and suffixes, returning [prefix]+url+[suffix].""" def __init__(self, args, order=0): """Constructor for URLDecorator. Parameters: * prefix: String to preceed the original url. * suffix: String to tail the original url...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class URLDecorator: """Decorates links to search results with given pre- and suffixes, returning [prefix]+url+[suffix].""" def __init__(self, args, order=0): """Constructor for URLDecorator. Parameters: * prefix: String to preceed the original url. * suffix: String to tail the original url.""" ...
the_stack_v2_python_sparse
reference-code/puppy/result/modifier/urldecorator.py
Granvanoeli/ifind
train
0
dac925a2145fa34e8bd7ef71b271c2d78bc05f2c
[ "samples = len(y_pred)\ny_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07)\nif len(y_true.shape) == 1:\n correct_confidences = y_pred_clipped[range(samples), y_true]\nelif len(y_true.shape) == 2:\n correct_confidences = np.sum(y_pred_clipped * y_true, axis=1)\nnegative_log_likelihoods = -np.log(correct_confid...
<|body_start_0|> samples = len(y_pred) y_pred_clipped = np.clip(y_pred, 1e-07, 1 - 1e-07) if len(y_true.shape) == 1: correct_confidences = y_pred_clipped[range(samples), y_true] elif len(y_true.shape) == 2: correct_confidences = np.sum(y_pred_clipped * y_true, axi...
The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]
CategoricalCrossentropy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward p...
stack_v2_sparse_classes_36k_train_021865
2,192
no_license
[ { "docstring": "Performs the forward pass. Args : y_pred(np.array): Model predictions y_true(np.array): Actual values Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]", "name": "forward", "signature": "def forward(self, y_pred, y_true)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_val_001002
Implement the Python class `CategoricalCrossentropy` described below. Class description: The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116] Method signatures and docstrings: - ...
Implement the Python class `CategoricalCrossentropy` described below. Class description: The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116] Method signatures and docstrings: - ...
8ffd24971d8808e7c9caa722a7ff4df306b75b90
<|skeleton|> class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CategoricalCrossentropy: """The class computes the categorical crossentropy by applying the formula: -sum(y_{i,j}*log(y_hat_{i,j})) Sources: * Neural Networks from Scratch - Harrison Kinsley & Daniel Kukieła [pg.112-116]""" def forward(self, y_pred, y_true): """Performs the forward pass. Args : y...
the_stack_v2_python_sparse
Music Recognizer/Metrics/CategoricalCrossentropy.py
andutzu7/Lucrare-Licenta-MusicRecognizer
train
0
d1f09bf7a77d0bca021cc42435855bd12f5e7557
[ "model_card_dict = self.to_dict()\nmodel_card_dict[json_utils.SCHEMA_VERSION_STRING] = json_utils.get_latest_schema_version()\nreturn json_lib.dumps(model_card_dict, indent=2)", "if isinstance(json, str):\n json = json_lib.loads(json)\njson_utils.validate_json_schema(json)\nself._from_json(json, self)\nreturn ...
<|body_start_0|> model_card_dict = self.to_dict() model_card_dict[json_utils.SCHEMA_VERSION_STRING] = json_utils.get_latest_schema_version() return json_lib.dumps(model_card_dict, indent=2) <|end_body_0|> <|body_start_1|> if isinstance(json, str): json = json_lib.loads(json)...
Fields used to generate the Model Card. Attributes: model_details: Descriptive metadata for the model. model_parameters: Technical metadata for the model. quantitative_analysis: Quantitative analysis of model performance. considerations: Any considerations related to model construction, training, and application.
ModelCard
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelCard: """Fields used to generate the Model Card. Attributes: model_details: Descriptive metadata for the model. model_parameters: Technical metadata for the model. quantitative_analysis: Quantitative analysis of model performance. considerations: Any considerations related to model construct...
stack_v2_sparse_classes_36k_train_021866
22,161
permissive
[ { "docstring": "Write ModelCard to JSON.", "name": "to_json", "signature": "def to_json(self) -> str" }, { "docstring": "Reads ModelCard from JSON. This function will only overwrite ModelCard fields specified in the JSON. Args: json: A JSON object from which to populate fields in the model card....
5
stack_v2_sparse_classes_30k_train_014385
Implement the Python class `ModelCard` described below. Class description: Fields used to generate the Model Card. Attributes: model_details: Descriptive metadata for the model. model_parameters: Technical metadata for the model. quantitative_analysis: Quantitative analysis of model performance. considerations: Any co...
Implement the Python class `ModelCard` described below. Class description: Fields used to generate the Model Card. Attributes: model_details: Descriptive metadata for the model. model_parameters: Technical metadata for the model. quantitative_analysis: Quantitative analysis of model performance. considerations: Any co...
74d7e6d8d3163b830711b226491ccd976a2d7018
<|skeleton|> class ModelCard: """Fields used to generate the Model Card. Attributes: model_details: Descriptive metadata for the model. model_parameters: Technical metadata for the model. quantitative_analysis: Quantitative analysis of model performance. considerations: Any considerations related to model construct...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelCard: """Fields used to generate the Model Card. Attributes: model_details: Descriptive metadata for the model. model_parameters: Technical metadata for the model. quantitative_analysis: Quantitative analysis of model performance. considerations: Any considerations related to model construction, training...
the_stack_v2_python_sparse
model_card_toolkit/model_card.py
tensorflow/model-card-toolkit
train
389
34ce94b4488517cf866c95e2e2b2fd21f00fe6b8
[ "while True:\n result = 0\n while num != 0:\n ind = num % 10\n num = num // 10\n result += ind\n if result < 10:\n break\n else:\n num = result\nreturn result", "while num >= 10:\n num = sum(map(int, str(num)))\nreturn num", "if num == 0:\n return 0\nelse:\n ...
<|body_start_0|> while True: result = 0 while num != 0: ind = num % 10 num = num // 10 result += ind if result < 10: break else: num = result return result <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addDigits(self, num): """:type num: int :rtype: int""" <|body_0|> def addDigits(self, num): """:type num: int :rtype: int""" <|body_1|> def addDigits(self, num): """:type num: int :rtype: int""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_021867
969
no_license
[ { "docstring": ":type num: int :rtype: int", "name": "addDigits", "signature": "def addDigits(self, num)" }, { "docstring": ":type num: int :rtype: int", "name": "addDigits", "signature": "def addDigits(self, num)" }, { "docstring": ":type num: int :rtype: int", "name": "addD...
3
stack_v2_sparse_classes_30k_train_000712
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num): :type num: int :rtype: int - def addDigits(self, num): :type num: int :rtype: int - def addDigits(self, num): :type num: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num): :type num: int :rtype: int - def addDigits(self, num): :type num: int :rtype: int - def addDigits(self, num): :type num: int :rtype: int <|skeleton|> c...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def addDigits(self, num): """:type num: int :rtype: int""" <|body_0|> def addDigits(self, num): """:type num: int :rtype: int""" <|body_1|> def addDigits(self, num): """:type num: int :rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addDigits(self, num): """:type num: int :rtype: int""" while True: result = 0 while num != 0: ind = num % 10 num = num // 10 result += ind if result < 10: break else: ...
the_stack_v2_python_sparse
code/258#Add Digits.py
EachenKuang/LeetCode
train
28
10544f4c60b88773dd53ae4e8f51be8feb718ac5
[ "if not root:\n return ''\nresult = []\nstack = [root]\nwhile stack:\n node = stack.pop()\n result.append(str(node.val))\n if node.right:\n stack.append(node.right)\n if node.left:\n stack.append(node.left)\nreturn '#'.join(result)", "if not data:\n return None\nelements = collecti...
<|body_start_0|> if not root: return '' result = [] stack = [root] while stack: node = stack.pop() result.append(str(node.val)) if node.right: stack.append(node.right) if node.left: stack.append(n...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> def deserialize2(self, data: str) -> TreeNode: ...
stack_v2_sparse_classes_36k_train_021868
2,157
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" }, { "doc...
3
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. - def deserialize2(sel...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. - def deserialize2(sel...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> def deserialize2(self, data: str) -> TreeNode: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return '' result = [] stack = [root] while stack: node = stack.pop() result.append(str(node.val)) if node.right: ...
the_stack_v2_python_sparse
python_leetcode_2020/Python_Leetcode_2020/serialization/449_serialize_and_deserialize_BST.py
xiangcao/Leetcode
train
0
a30319e7f31c3c93f0b092ab286e46ce7e313c66
[ "if not isinstance(a_list, list) or not all((isinstance(sub, list) for sub in a_list)):\n return None\ntry:\n arr = np.array(a_list, dtype=dtype)\n if arr.dtype == object:\n return None\n return arr\nexcept ValueError:\n return None", "if isinstance(a_tuple, tuple):\n try:\n arr = ...
<|body_start_0|> if not isinstance(a_list, list) or not all((isinstance(sub, list) for sub in a_list)): return None try: arr = np.array(a_list, dtype=dtype) if arr.dtype == object: return None return arr except ValueError: ...
NumPyCreator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumPyCreator: def from_list(self, a_list, dtype=None): """Convert a list or nested list into a NumPy array""" <|body_0|> def from_tuple(self, a_tuple, dtype=None): """Convert a tuple or nested tuples into a NumPy array""" <|body_1|> def from_iterable(sel...
stack_v2_sparse_classes_36k_train_021869
2,322
no_license
[ { "docstring": "Convert a list or nested list into a NumPy array", "name": "from_list", "signature": "def from_list(self, a_list, dtype=None)" }, { "docstring": "Convert a tuple or nested tuples into a NumPy array", "name": "from_tuple", "signature": "def from_tuple(self, a_tuple, dtype=...
6
stack_v2_sparse_classes_30k_train_017916
Implement the Python class `NumPyCreator` described below. Class description: Implement the NumPyCreator class. Method signatures and docstrings: - def from_list(self, a_list, dtype=None): Convert a list or nested list into a NumPy array - def from_tuple(self, a_tuple, dtype=None): Convert a tuple or nested tuples in...
Implement the Python class `NumPyCreator` described below. Class description: Implement the NumPyCreator class. Method signatures and docstrings: - def from_list(self, a_list, dtype=None): Convert a list or nested list into a NumPy array - def from_tuple(self, a_tuple, dtype=None): Convert a tuple or nested tuples in...
24358cc6807d86fe5da766bb4505eef29f1e371f
<|skeleton|> class NumPyCreator: def from_list(self, a_list, dtype=None): """Convert a list or nested list into a NumPy array""" <|body_0|> def from_tuple(self, a_tuple, dtype=None): """Convert a tuple or nested tuples into a NumPy array""" <|body_1|> def from_iterable(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumPyCreator: def from_list(self, a_list, dtype=None): """Convert a list or nested list into a NumPy array""" if not isinstance(a_list, list) or not all((isinstance(sub, list) for sub in a_list)): return None try: arr = np.array(a_list, dtype=dtype) ...
the_stack_v2_python_sparse
day03/ex00/NumPyCreator.py
Ghilphar/bootcamp_python
train
0
1a5a58c30c91f56408a12f8d91c918ab697aa1dd
[ "A = Assignment.objects.getAssignmentByCode(request)\nS = Student.objects.getStudentByRegIdOrRollNo(request)\nAR = AssignmentResponse(assignment=A, student=S, responseLink=request['responseLink'], status=1)\nAR.save()\nreturn AR", "A = Assignment.objects.getAssignmentByCode(request)\nS = Student.objects.getStuden...
<|body_start_0|> A = Assignment.objects.getAssignmentByCode(request) S = Student.objects.getStudentByRegIdOrRollNo(request) AR = AssignmentResponse(assignment=A, student=S, responseLink=request['responseLink'], status=1) AR.save() return AR <|end_body_0|> <|body_start_1|> ...
AssignmentResponseManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssignmentResponseManager: def addAssignmentResponse(self, request): """add assignment response""" <|body_0|> def evaluateAssignmentResponse(self, request): """saves evaluation grade of an assignment response""" <|body_1|> def deleteAssignmentResponse(se...
stack_v2_sparse_classes_36k_train_021870
2,948
permissive
[ { "docstring": "add assignment response", "name": "addAssignmentResponse", "signature": "def addAssignmentResponse(self, request)" }, { "docstring": "saves evaluation grade of an assignment response", "name": "evaluateAssignmentResponse", "signature": "def evaluateAssignmentResponse(self...
5
null
Implement the Python class `AssignmentResponseManager` described below. Class description: Implement the AssignmentResponseManager class. Method signatures and docstrings: - def addAssignmentResponse(self, request): add assignment response - def evaluateAssignmentResponse(self, request): saves evaluation grade of an ...
Implement the Python class `AssignmentResponseManager` described below. Class description: Implement the AssignmentResponseManager class. Method signatures and docstrings: - def addAssignmentResponse(self, request): add assignment response - def evaluateAssignmentResponse(self, request): saves evaluation grade of an ...
9673bf8b6094560f0e5cb60efb536139deaa965e
<|skeleton|> class AssignmentResponseManager: def addAssignmentResponse(self, request): """add assignment response""" <|body_0|> def evaluateAssignmentResponse(self, request): """saves evaluation grade of an assignment response""" <|body_1|> def deleteAssignmentResponse(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssignmentResponseManager: def addAssignmentResponse(self, request): """add assignment response""" A = Assignment.objects.getAssignmentByCode(request) S = Student.objects.getStudentByRegIdOrRollNo(request) AR = AssignmentResponse(assignment=A, student=S, responseLink=request['r...
the_stack_v2_python_sparse
Assessment/models/AssignmentResponse.py
IEEEDTU/CMS
train
5
bd714210b95959697327cefd9831661239f78468
[ "self.root = root\nself.dictAdj = dict()\nfor u, v, w in weightedEdges:\n self._addEdgeAndWeight(u, v, w)\n self._addEdgeAndWeight(v, u, w)\nself.heapHandler = DHeapHandler()\nself.heap = self.heapHandler.makeheap([])\nself.dictHeapItems = dict()\nfor x in self.dictAdj.keys():\n if x != self.root:\n ...
<|body_start_0|> self.root = root self.dictAdj = dict() for u, v, w in weightedEdges: self._addEdgeAndWeight(u, v, w) self._addEdgeAndWeight(v, u, w) self.heapHandler = DHeapHandler() self.heap = self.heapHandler.makeheap([]) self.dictHeapItems = d...
Prim algorithm to find the minimum spanning tree
Prim
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Prim: """Prim algorithm to find the minimum spanning tree""" def __init__(self, weightedEdges, root): """set of 3-uples (u,v,weight) and root of the search""" <|body_0|> def _addEdgeAndWeight(self, u, v, w): """add the edge (u,v) with weight w to adjacency list o...
stack_v2_sparse_classes_36k_train_021871
2,779
no_license
[ { "docstring": "set of 3-uples (u,v,weight) and root of the search", "name": "__init__", "signature": "def __init__(self, weightedEdges, root)" }, { "docstring": "add the edge (u,v) with weight w to adjacency list of u + the parent of u", "name": "_addEdgeAndWeight", "signature": "def _a...
3
stack_v2_sparse_classes_30k_train_005332
Implement the Python class `Prim` described below. Class description: Prim algorithm to find the minimum spanning tree Method signatures and docstrings: - def __init__(self, weightedEdges, root): set of 3-uples (u,v,weight) and root of the search - def _addEdgeAndWeight(self, u, v, w): add the edge (u,v) with weight ...
Implement the Python class `Prim` described below. Class description: Prim algorithm to find the minimum spanning tree Method signatures and docstrings: - def __init__(self, weightedEdges, root): set of 3-uples (u,v,weight) and root of the search - def _addEdgeAndWeight(self, u, v, w): add the edge (u,v) with weight ...
775071c849b582ae3fc5ea2fc647a4438e3d1a32
<|skeleton|> class Prim: """Prim algorithm to find the minimum spanning tree""" def __init__(self, weightedEdges, root): """set of 3-uples (u,v,weight) and root of the search""" <|body_0|> def _addEdgeAndWeight(self, u, v, w): """add the edge (u,v) with weight w to adjacency list o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Prim: """Prim algorithm to find the minimum spanning tree""" def __init__(self, weightedEdges, root): """set of 3-uples (u,v,weight) and root of the search""" self.root = root self.dictAdj = dict() for u, v, w in weightedEdges: self._addEdgeAndWeight(u, v, w) ...
the_stack_v2_python_sparse
prim.py
acrodeon/pythonInteractive-algos
train
0
68c72573f9e7af2f6f1e171f8dae01518197289f
[ "self.Scenario = Scenario\nself.Observer = Observer\nself.popSize = self.Scenario.Parameter('PopulationSize')\nself.SimulationEnd = 400 * self.popSize\nself.Pop = []\nfor ID in range(self.popSize):\n Node = Nodes[ID % len(Nodes)]\n self.Pop.append(Ant('A%d' % ID, InitialNode=Node))", "self.Observer.season()...
<|body_start_0|> self.Scenario = Scenario self.Observer = Observer self.popSize = self.Scenario.Parameter('PopulationSize') self.SimulationEnd = 400 * self.popSize self.Pop = [] for ID in range(self.popSize): Node = Nodes[ID % len(Nodes)] self.Pop....
defines the population of agents
AntPopulation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AntPopulation: """defines the population of agents""" def __init__(self, Scenario, Observer, Nodes): """creates a population of ant agents""" <|body_0|> def one_decision(self): """This function is repeatedly called by the simulation thread. One ant is randomly ch...
stack_v2_sparse_classes_36k_train_021872
14,320
no_license
[ { "docstring": "creates a population of ant agents", "name": "__init__", "signature": "def __init__(self, Scenario, Observer, Nodes)" }, { "docstring": "This function is repeatedly called by the simulation thread. One ant is randomly chosen and decides what it does", "name": "one_decision", ...
2
stack_v2_sparse_classes_30k_train_010036
Implement the Python class `AntPopulation` described below. Class description: defines the population of agents Method signatures and docstrings: - def __init__(self, Scenario, Observer, Nodes): creates a population of ant agents - def one_decision(self): This function is repeatedly called by the simulation thread. O...
Implement the Python class `AntPopulation` described below. Class description: defines the population of agents Method signatures and docstrings: - def __init__(self, Scenario, Observer, Nodes): creates a population of ant agents - def one_decision(self): This function is repeatedly called by the simulation thread. O...
58d45d5b7df4379da955dbe58f4445b3bf9c8283
<|skeleton|> class AntPopulation: """defines the population of agents""" def __init__(self, Scenario, Observer, Nodes): """creates a population of ant agents""" <|body_0|> def one_decision(self): """This function is repeatedly called by the simulation thread. One ant is randomly ch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AntPopulation: """defines the population of agents""" def __init__(self, Scenario, Observer, Nodes): """creates a population of ant agents""" self.Scenario = Scenario self.Observer = Observer self.popSize = self.Scenario.Parameter('PopulationSize') self.SimulationE...
the_stack_v2_python_sparse
Evolife/Other/Antnet/Antnet.py
piochelepiotr/jump
train
0
061f2259706d1d83f505c6bf28fa276351e1fc0a
[ "v = APIValidator()\ndraft_id = draft_id or deposition.get_default_draft_id()\nmetadata_schema = deposition.type.api_metadata_schema(draft_id)\nif metadata_schema:\n schema = self.input_schema.copy()\n schema['metadata'] = metadata_schema\nelse:\n schema = self.input_schema\nif not v.validate(request.json,...
<|body_start_0|> v = APIValidator() draft_id = draft_id or deposition.get_default_draft_id() metadata_schema = deposition.type.api_metadata_schema(draft_id) if metadata_schema: schema = self.input_schema.copy() schema['metadata'] = metadata_schema else: ...
Mix-in class for validating and processing deposition input data.
InputProcessorMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputProcessorMixin: """Mix-in class for validating and processing deposition input data.""" def validate_input(self, deposition, draft_id=None): """Validate input data for creating and update a deposition.""" <|body_0|> def process_input(self, deposition, draft_id=None)...
stack_v2_sparse_classes_36k_train_021873
19,789
no_license
[ { "docstring": "Validate input data for creating and update a deposition.", "name": "validate_input", "signature": "def validate_input(self, deposition, draft_id=None)" }, { "docstring": "Process input data.", "name": "process_input", "signature": "def process_input(self, deposition, dra...
2
stack_v2_sparse_classes_30k_train_011731
Implement the Python class `InputProcessorMixin` described below. Class description: Mix-in class for validating and processing deposition input data. Method signatures and docstrings: - def validate_input(self, deposition, draft_id=None): Validate input data for creating and update a deposition. - def process_input(...
Implement the Python class `InputProcessorMixin` described below. Class description: Mix-in class for validating and processing deposition input data. Method signatures and docstrings: - def validate_input(self, deposition, draft_id=None): Validate input data for creating and update a deposition. - def process_input(...
e84cb33310506fcdab1dcdb1e8bd425d44435fbe
<|skeleton|> class InputProcessorMixin: """Mix-in class for validating and processing deposition input data.""" def validate_input(self, deposition, draft_id=None): """Validate input data for creating and update a deposition.""" <|body_0|> def process_input(self, deposition, draft_id=None)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InputProcessorMixin: """Mix-in class for validating and processing deposition input data.""" def validate_input(self, deposition, draft_id=None): """Validate input data for creating and update a deposition.""" v = APIValidator() draft_id = draft_id or deposition.get_default_draft_...
the_stack_v2_python_sparse
lw_daap/modules/invenio_deposit/restful.py
groundnuty/lw-daap
train
0
fa7c14d16e88ca37b378614013319cfe61b5fa58
[ "super(Decoder, self).__init__()\nself.opt = opt\nself.fc1 = nn.Linear(16, 512)\nself.fc2 = nn.Linear(512, 1024)\nself.fc3 = nn.Linear(1024, 784)", "batch_size = target.size(0)\ntarget = target.type(torch.FloatTensor)\nmask = torch.stack([target for i in range(16)], dim=2)\nassert mask.size() == torch.Size([batch...
<|body_start_0|> super(Decoder, self).__init__() self.opt = opt self.fc1 = nn.Linear(16, 512) self.fc2 = nn.Linear(512, 1024) self.fc3 = nn.Linear(1024, 784) <|end_body_0|> <|body_start_1|> batch_size = target.size(0) target = target.type(torch.FloatTensor) ...
The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reconstruct a [784,] size image. Reference: Section 4.1, Fig. 2
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reconstruct a [784,] size image. Reference: Section 4.1, Fig. 2""" def __init__(self, opt): """Th...
stack_v2_sparse_classes_36k_train_021874
14,893
no_license
[ { "docstring": "The decoder network consists of 3 fully connected layers, with 512, 1024, 784 neurons each.", "name": "__init__", "signature": "def __init__(self, opt)" }, { "docstring": "Args: `v`: [batch_size, 10, 16] `target`: [batch_size, 10] Return: `reconstruction`: [batch_size, 784] We se...
2
null
Implement the Python class `Decoder` described below. Class description: The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reconstruct a [784,] size image. Reference: Section 4.1, Fig. 2 Method...
Implement the Python class `Decoder` described below. Class description: The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reconstruct a [784,] size image. Reference: Section 4.1, Fig. 2 Method...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Decoder: """The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reconstruct a [784,] size image. Reference: Section 4.1, Fig. 2""" def __init__(self, opt): """Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """The decoder network consists of 3 fully connected layers. For each [10, 16] output, we mask out the incorrect predictions, and send the [16,] vector to the decoder network to reconstruct a [784,] size image. Reference: Section 4.1, Fig. 2""" def __init__(self, opt): """The decoder net...
the_stack_v2_python_sparse
generated/test_laubonghaudoi_CapsNet_guide_PyTorch.py
jansel/pytorch-jit-paritybench
train
35
437da607e5e27f70750f22b4e1fbb1a8614e60f0
[ "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...
Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.
KnowledgeBasesServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnowledgeBasesServicer: """Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.""" def ListKnowledgeBases(self, request, context): """Returns the list of all knowledge bases of the specified agent.""" <|body_0|> def GetKn...
stack_v2_sparse_classes_36k_train_021875
5,251
permissive
[ { "docstring": "Returns the list of all knowledge bases of the specified agent.", "name": "ListKnowledgeBases", "signature": "def ListKnowledgeBases(self, request, context)" }, { "docstring": "Retrieves the specified knowledge base.", "name": "GetKnowledgeBase", "signature": "def GetKnow...
4
stack_v2_sparse_classes_30k_train_003283
Implement the Python class `KnowledgeBasesServicer` described below. Class description: Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data. Method signatures and docstrings: - def ListKnowledgeBases(self, request, context): Returns the list of all knowledge bases of ...
Implement the Python class `KnowledgeBasesServicer` described below. Class description: Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data. Method signatures and docstrings: - def ListKnowledgeBases(self, request, context): Returns the list of all knowledge bases of ...
c9c830feb6b66c2e362f8fb5d147ef0c4f4a08cf
<|skeleton|> class KnowledgeBasesServicer: """Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.""" def ListKnowledgeBases(self, request, context): """Returns the list of all knowledge bases of the specified agent.""" <|body_0|> def GetKn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KnowledgeBasesServicer: """Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.""" def ListKnowledgeBases(self, request, context): """Returns the list of all knowledge bases of the specified agent.""" context.set_code(grpc.StatusCode.UNIMP...
the_stack_v2_python_sparse
pyenv/lib/python3.6/site-packages/dialogflow_v2beta1/proto/knowledge_base_pb2_grpc.py
ronald-rgr/ai-chatbot-smartguide
train
0
598da755a8e74ac6d70895132c01e6e5d63f02c6
[ "user = self.context.get('user')\npassword = value\nuser_auth = authenticate(username=user.username, password=password)\nif not user_auth:\n raise serializers.ValidationError('Contraseña actual incorrecta.')\nreturn value", "old_passwd = data['password']\npasswd = data['new_password']\npasswd_conf = data['new_...
<|body_start_0|> user = self.context.get('user') password = value user_auth = authenticate(username=user.username, password=password) if not user_auth: raise serializers.ValidationError('Contraseña actual incorrecta.') return value <|end_body_0|> <|body_start_1|> ...
Change password serializer.
PasswordChangeSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordChangeSerializer: """Change password serializer.""" def validate_password(self, value): """Check that the password is valid for current user.""" <|body_0|> def validate(self, data): """Verify passwords match.""" <|body_1|> def create(self, da...
stack_v2_sparse_classes_36k_train_021876
14,720
permissive
[ { "docstring": "Check that the password is valid for current user.", "name": "validate_password", "signature": "def validate_password(self, value)" }, { "docstring": "Verify passwords match.", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Handle u...
3
stack_v2_sparse_classes_30k_train_021229
Implement the Python class `PasswordChangeSerializer` described below. Class description: Change password serializer. Method signatures and docstrings: - def validate_password(self, value): Check that the password is valid for current user. - def validate(self, data): Verify passwords match. - def create(self, data):...
Implement the Python class `PasswordChangeSerializer` described below. Class description: Change password serializer. Method signatures and docstrings: - def validate_password(self, value): Check that the password is valid for current user. - def validate(self, data): Verify passwords match. - def create(self, data):...
ba013f8a06d4b68464a599a1bfaad917e801eeef
<|skeleton|> class PasswordChangeSerializer: """Change password serializer.""" def validate_password(self, value): """Check that the password is valid for current user.""" <|body_0|> def validate(self, data): """Verify passwords match.""" <|body_1|> def create(self, da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordChangeSerializer: """Change password serializer.""" def validate_password(self, value): """Check that the password is valid for current user.""" user = self.context.get('user') password = value user_auth = authenticate(username=user.username, password=password) ...
the_stack_v2_python_sparse
id/modules/api/accounts/serializers.py
argob/id-mi-argentina-distro
train
5
3db12e07ee9a624450497ace9b2da985892b0fe5
[ "self.url = url\nself.cluster = cluster\nself.app_id = app_id\nself.secret = secret if secret is not None else ''\nself.read_apollo = read_apollo\nif read_apollo:\n from apollo.apollo_client import ApolloClient\n self.client = ApolloClient(self.url, self.app_id, cluster=self.cluster, secret=self.secret)\nelse...
<|body_start_0|> self.url = url self.cluster = cluster self.app_id = app_id self.secret = secret if secret is not None else '' self.read_apollo = read_apollo if read_apollo: from apollo.apollo_client import ApolloClient self.client = ApolloClient(s...
python 连接 apollo配置中心工具类
ApolloHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApolloHelper: """python 连接 apollo配置中心工具类""" def __init__(self, app_id, url='http://localhost:8080', secret='', cluster='default', read_apollo=False): """初始化apollo连接, 同时将apollo配置同步到本地, 以防止apollo服务挂了导致整个系统瘫痪 :param app_id: :param secret: :param cluster:""" <|body_0|> def g...
stack_v2_sparse_classes_36k_train_021877
2,702
no_license
[ { "docstring": "初始化apollo连接, 同时将apollo配置同步到本地, 以防止apollo服务挂了导致整个系统瘫痪 :param app_id: :param secret: :param cluster:", "name": "__init__", "signature": "def __init__(self, app_id, url='http://localhost:8080', secret='', cluster='default', read_apollo=False)" }, { "docstring": "通过配置文件实例化apollo连接 :p...
4
stack_v2_sparse_classes_30k_train_011032
Implement the Python class `ApolloHelper` described below. Class description: python 连接 apollo配置中心工具类 Method signatures and docstrings: - def __init__(self, app_id, url='http://localhost:8080', secret='', cluster='default', read_apollo=False): 初始化apollo连接, 同时将apollo配置同步到本地, 以防止apollo服务挂了导致整个系统瘫痪 :param app_id: :param...
Implement the Python class `ApolloHelper` described below. Class description: python 连接 apollo配置中心工具类 Method signatures and docstrings: - def __init__(self, app_id, url='http://localhost:8080', secret='', cluster='default', read_apollo=False): 初始化apollo连接, 同时将apollo配置同步到本地, 以防止apollo服务挂了导致整个系统瘫痪 :param app_id: :param...
f096a7168cb45a7e3e2b677ec650bfd01c7b59cd
<|skeleton|> class ApolloHelper: """python 连接 apollo配置中心工具类""" def __init__(self, app_id, url='http://localhost:8080', secret='', cluster='default', read_apollo=False): """初始化apollo连接, 同时将apollo配置同步到本地, 以防止apollo服务挂了导致整个系统瘫痪 :param app_id: :param secret: :param cluster:""" <|body_0|> def g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApolloHelper: """python 连接 apollo配置中心工具类""" def __init__(self, app_id, url='http://localhost:8080', secret='', cluster='default', read_apollo=False): """初始化apollo连接, 同时将apollo配置同步到本地, 以防止apollo服务挂了导致整个系统瘫痪 :param app_id: :param secret: :param cluster:""" self.url = url self.cluste...
the_stack_v2_python_sparse
helper/apollo_helper.py
weidongcao/huanLing
train
47
3c6fae92e75ffb2027be2c702311f4af52fd363f
[ "AssessmentResults.__init__(self, controller, **kwargs)\nself._lst_labels.append(u'π<sub>A</sub>:')\nself._lst_labels.append(u'π<sub>F</sub>:')\nself._lst_labels.append(u'π<sub>T</sub>:')\nself._lblModel.set_tooltip_markup(_(u'The assessment model used to calculate the meter failure rate.'))\nself.txtPiA = ramstk.R...
<|body_start_0|> AssessmentResults.__init__(self, controller, **kwargs) self._lst_labels.append(u'π<sub>A</sub>:') self._lst_labels.append(u'π<sub>F</sub>:') self._lst_labels.append(u'π<sub>T</sub>:') self._lblModel.set_tooltip_markup(_(u'The assessment model used to calculate th...
Display Meter assessment results attribute data in the RAMSTK Work Book. The Meter assessment result view displays all the assessment results for the selected meter. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. The attributes of a meter assessment result vie...
MeterAssessmentResults
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeterAssessmentResults: """Display Meter assessment results attribute data in the RAMSTK Work Book. The Meter assessment result view displays all the assessment results for the selected meter. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress method...
stack_v2_sparse_classes_36k_train_021878
14,683
permissive
[ { "docstring": "Initialize an instance of the Meter assessment result view. :param controller: the meter data controller instance. :type controller: :class:`ramstk.meter.Controller.MeterBoMDataController`", "name": "__init__", "signature": "def __init__(self, controller, **kwargs)" }, { "docstri...
5
null
Implement the Python class `MeterAssessmentResults` described below. Class description: Display Meter assessment results attribute data in the RAMSTK Work Book. The Meter assessment result view displays all the assessment results for the selected meter. This includes, currently, results for MIL-HDBK-217FN2 parts count...
Implement the Python class `MeterAssessmentResults` described below. Class description: Display Meter assessment results attribute data in the RAMSTK Work Book. The Meter assessment result view displays all the assessment results for the selected meter. This includes, currently, results for MIL-HDBK-217FN2 parts count...
488ffed8b842399ddcae93007de6c6f1dda23d05
<|skeleton|> class MeterAssessmentResults: """Display Meter assessment results attribute data in the RAMSTK Work Book. The Meter assessment result view displays all the assessment results for the selected meter. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress method...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeterAssessmentResults: """Display Meter assessment results attribute data in the RAMSTK Work Book. The Meter assessment result view displays all the assessment results for the selected meter. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. The attrib...
the_stack_v2_python_sparse
src/ramstk/gui/gtk/workviews/components/Meter.py
JmiXIII/ramstk
train
0
df22a1e2abf1dd222d939296e3fc2c6d9b88e1ee
[ "for donor_name in donors:\n newFile = open(donor_name[0] + '.txt', mode='w')\n newFile.write(thankyou_dispacth[int_option](donor_name[0], lifetime_donations(tup_donor_names)))\n newFile.close()\n print(donor_name[0] + 'saved')", "str_salutation = 'Dear {},'.format(donor)\nstr_body = '\\n\\n' + 'Thank...
<|body_start_0|> for donor_name in donors: newFile = open(donor_name[0] + '.txt', mode='w') newFile.write(thankyou_dispacth[int_option](donor_name[0], lifetime_donations(tup_donor_names))) newFile.close() print(donor_name[0] + 'saved') <|end_body_0|> <|body_start...
files
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class files: def write_email(donors): """Writes emails to the donors and saves them to text files. :param donors: Tuple table that stores all the donor's donation information. :return:""" <|body_0|> def donor_email(donor, dictionary): """Formats the email with donor's name...
stack_v2_sparse_classes_36k_train_021879
14,291
no_license
[ { "docstring": "Writes emails to the donors and saves them to text files. :param donors: Tuple table that stores all the donor's donation information. :return:", "name": "write_email", "signature": "def write_email(donors)" }, { "docstring": "Formats the email with donor's name and total lifetim...
2
null
Implement the Python class `files` described below. Class description: Implement the files class. Method signatures and docstrings: - def write_email(donors): Writes emails to the donors and saves them to text files. :param donors: Tuple table that stores all the donor's donation information. :return: - def donor_ema...
Implement the Python class `files` described below. Class description: Implement the files class. Method signatures and docstrings: - def write_email(donors): Writes emails to the donors and saves them to text files. :param donors: Tuple table that stores all the donor's donation information. :return: - def donor_ema...
e298b1151dab639659d8dfa56f47bcb43dd3438f
<|skeleton|> class files: def write_email(donors): """Writes emails to the donors and saves them to text files. :param donors: Tuple table that stores all the donor's donation information. :return:""" <|body_0|> def donor_email(donor, dictionary): """Formats the email with donor's name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class files: def write_email(donors): """Writes emails to the donors and saves them to text files. :param donors: Tuple table that stores all the donor's donation information. :return:""" for donor_name in donors: newFile = open(donor_name[0] + '.txt', mode='w') newFile.write...
the_stack_v2_python_sparse
students/rhamersky/Lesson_5/mailroom_part3.py
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
train
13
1f8ae88e20d73f0dd4235ea4d4931a1a29e11083
[ "LDC_Info.__init__(self)\nself.setTitle(self.name)\nif info_res:\n self.status = compat_res[0]\n self.ui.setupUi(self.frame)\n self.__fill_frame(info_res, compat_res, diag_res)\nelse:\n self.status = False\n self.__labelError(compat_res)", "vendor = self._check_invalid_values(info_res.vendor[1])\nm...
<|body_start_0|> LDC_Info.__init__(self) self.setTitle(self.name) if info_res: self.status = compat_res[0] self.ui.setupUi(self.frame) self.__fill_frame(info_res, compat_res, diag_res) else: self.status = False self.__labelError...
Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados de mouse
GUIMouse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIMouse: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados de mouse""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMouse') compat_res -...
stack_v2_sparse_classes_36k_train_021880
3,283
no_license
[ { "docstring": "Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMouse') compat_res -- Lista com as tuples de resultado de compatibilidade [(True, msg)] diag_res -- Lista com os resultados do diagnóstico (nesse caso não existe teste de diagnóstico, recebe-se uma lista va...
3
null
Implement the Python class `GUIMouse` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados de mouse Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os resul...
Implement the Python class `GUIMouse` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados de mouse Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os resul...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class GUIMouse: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados de mouse""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMouse') compat_res -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GUIMouse: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados de mouse""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMouse') compat_res -- Lista com a...
the_stack_v2_python_sparse
src/libs/mouse/gui_mouse.py
adrianomelo/ldc-desktop
train
1
69a5d7cb9e4791d5730c7dac0b76819ab291faeb
[ "self.root = None\nfor item in container:\n self.insert(item)", "def _str(indent: str, root: _BSTNode) -> str:\n \"\"\"\n Return a 'sideways' representation of the values in the BST rooted\n at root, with right subtree indented above root, and left indented\n below root, eac...
<|body_start_0|> self.root = None for item in container: self.insert(item) <|end_body_0|> <|body_start_1|> def _str(indent: str, root: _BSTNode) -> str: """ Return a 'sideways' representation of the values in the BST rooted at root...
A Binary Search Tree.
BST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BST: """A Binary Search Tree.""" def __init__(self, container=[]): """(BST, list) -> NoneType Initialize this BST by inserting the items from container (default []) one by one, in the order given.""" <|body_0|> def __str__(self): """(BST) -> str Return a "sideway...
stack_v2_sparse_classes_36k_train_021881
3,829
no_license
[ { "docstring": "(BST, list) -> NoneType Initialize this BST by inserting the items from container (default []) one by one, in the order given.", "name": "__init__", "signature": "def __init__(self, container=[])" }, { "docstring": "(BST) -> str Return a \"sideways\" representation of the values ...
5
stack_v2_sparse_classes_30k_train_005201
Implement the Python class `BST` described below. Class description: A Binary Search Tree. Method signatures and docstrings: - def __init__(self, container=[]): (BST, list) -> NoneType Initialize this BST by inserting the items from container (default []) one by one, in the order given. - def __str__(self): (BST) -> ...
Implement the Python class `BST` described below. Class description: A Binary Search Tree. Method signatures and docstrings: - def __init__(self, container=[]): (BST, list) -> NoneType Initialize this BST by inserting the items from container (default []) one by one, in the order given. - def __str__(self): (BST) -> ...
c7437d387dc2b9a8039c60d8786373899c2e28bd
<|skeleton|> class BST: """A Binary Search Tree.""" def __init__(self, container=[]): """(BST, list) -> NoneType Initialize this BST by inserting the items from container (default []) one by one, in the order given.""" <|body_0|> def __str__(self): """(BST) -> str Return a "sideway...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BST: """A Binary Search Tree.""" def __init__(self, container=[]): """(BST, list) -> NoneType Initialize this BST by inserting the items from container (default []) one by one, in the order given.""" self.root = None for item in container: self.insert(item) def __...
the_stack_v2_python_sparse
CSC148/06 Tree(BST)/lab9/BST_rec1.py
xxcocoymlxx/Study-Notes
train
2
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/admin/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/admin/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 200)", "ur...
<|body_start_0|> url = '/admin/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/admin/' self.client.login(username=self.adminUN, password='pass') response = self.client.get(u...
AdminTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminTestCase: def test_not_logged_in(self): """Test that the admin view will redirect to login page whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the admin view will load whilst logged in as admin.""" <|body_1|> def te...
stack_v2_sparse_classes_36k_train_021882
26,818
permissive
[ { "docstring": "Test that the admin view will redirect to login page whilst not logged in.", "name": "test_not_logged_in", "signature": "def test_not_logged_in(self)" }, { "docstring": "Test that the admin view will load whilst logged in as admin.", "name": "test_logged_in_admin", "signa...
3
null
Implement the Python class `AdminTestCase` described below. Class description: Implement the AdminTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the admin view will redirect to login page whilst not logged in. - def test_logged_in_admin(self): Test that the admin view will...
Implement the Python class `AdminTestCase` described below. Class description: Implement the AdminTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the admin view will redirect to login page whilst not logged in. - def test_logged_in_admin(self): Test that the admin view will...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class AdminTestCase: def test_not_logged_in(self): """Test that the admin view will redirect to login page whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the admin view will load whilst logged in as admin.""" <|body_1|> def te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminTestCase: def test_not_logged_in(self): """Test that the admin view will redirect to login page whilst not logged in.""" url = '/admin/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) def test_logged_in_admin(se...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
cadf5e67cec2abcab1fd47d10e613ebd9ac7e09a
[ "self.Whf = np.random.normal(size=(i + h, h))\nself.Whb = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(2 * h, o))\nself.bhf = np.zeros((1, h))\nself.bhb = np.zeros((1, h))\nself.by = np.zeros((1, o))", "x_concat = np.concatenate((h_prev, x_t), axis=1)\nh_next = np.matmul(x_concat, self.Whf)...
<|body_start_0|> self.Whf = np.random.normal(size=(i + h, h)) self.Whb = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(2 * h, o)) self.bhf = np.zeros((1, h)) self.bhb = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> ...
Class that represents a bidirectional cell of an RNN
BidirectionalCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalCell: """Class that represents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs""" <|body_0|> def forward(self, h_prev, x...
stack_v2_sparse_classes_36k_train_021883
2,621
no_license
[ { "docstring": "i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "x_t is a numpy.ndarray of shape (m, i) that contains the data input for the ...
4
null
Implement the Python class `BidirectionalCell` described below. Class description: Class that represents a bidirectional cell of an RNN Method signatures and docstrings: - def __init__(self, i, h, o): i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outpu...
Implement the Python class `BidirectionalCell` described below. Class description: Class that represents a bidirectional cell of an RNN Method signatures and docstrings: - def __init__(self, i, h, o): i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outpu...
d3802fc2e552447cd5b17d1ed593aee46a8ae929
<|skeleton|> class BidirectionalCell: """Class that represents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs""" <|body_0|> def forward(self, h_prev, x...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BidirectionalCell: """Class that represents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """i is the dimensionality of the data h is the dimensionality of the hidden states o is the dimensionality of the outputs""" self.Whf = np.random.normal(size=(i + h, h)) sel...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/7-bi_output.py
RodrigoSierraV/holbertonschool-machine_learning
train
0
dacc7f965586859011a47d372bd4c9410f936e4c
[ "circuit = Circuit(2)\ncircuit.append_gate(HGate(), 1)\ncircuit.append_gate(CZGate(), (0, 1))\ncircuit.append_gate(HGate(), 1)\nself.cg = CircuitGate(circuit)", "cnot_points = []\nfor cycle, op in circuit.operations_with_cycles():\n if isinstance(op.gate, CNOTGate):\n cnot_points.append((cycle, op.locat...
<|body_start_0|> circuit = Circuit(2) circuit.append_gate(HGate(), 1) circuit.append_gate(CZGate(), (0, 1)) circuit.append_gate(HGate(), 1) self.cg = CircuitGate(circuit) <|end_body_0|> <|body_start_1|> cnot_points = [] for cycle, op in circuit.operations_with_cy...
The CNOTToCZPass class. This uses a rule to convert CNOTs to CZs.
CNOTToCZPass
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNOTToCZPass: """The CNOTToCZPass class. This uses a rule to convert CNOTs to CZs.""" def __init__(self) -> None: """Construct a CNOTToCZPass.""" <|body_0|> async def run(self, circuit: Circuit, data: PassData) -> None: """Perform the pass's operation, see :class...
stack_v2_sparse_classes_36k_train_021884
1,580
permissive
[ { "docstring": "Construct a CNOTToCZPass.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Perform the pass's operation, see :class:`BasePass` for more.", "name": "run", "signature": "async def run(self, circuit: Circuit, data: PassData) -> None" } ]
2
null
Implement the Python class `CNOTToCZPass` described below. Class description: The CNOTToCZPass class. This uses a rule to convert CNOTs to CZs. Method signatures and docstrings: - def __init__(self) -> None: Construct a CNOTToCZPass. - async def run(self, circuit: Circuit, data: PassData) -> None: Perform the pass's ...
Implement the Python class `CNOTToCZPass` described below. Class description: The CNOTToCZPass class. This uses a rule to convert CNOTs to CZs. Method signatures and docstrings: - def __init__(self) -> None: Construct a CNOTToCZPass. - async def run(self, circuit: Circuit, data: PassData) -> None: Perform the pass's ...
c89112d15072e8ffffb68cf1757b184e2aeb3dc8
<|skeleton|> class CNOTToCZPass: """The CNOTToCZPass class. This uses a rule to convert CNOTs to CZs.""" def __init__(self) -> None: """Construct a CNOTToCZPass.""" <|body_0|> async def run(self, circuit: Circuit, data: PassData) -> None: """Perform the pass's operation, see :class...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CNOTToCZPass: """The CNOTToCZPass class. This uses a rule to convert CNOTs to CZs.""" def __init__(self) -> None: """Construct a CNOTToCZPass.""" circuit = Circuit(2) circuit.append_gate(HGate(), 1) circuit.append_gate(CZGate(), (0, 1)) circuit.append_gate(HGate(),...
the_stack_v2_python_sparse
bqskit/passes/rules/cnot2cz.py
BQSKit/bqskit
train
54
d813a4f9013c9770cf1b0828877f4ed64c0c29e9
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SimulationAutomationRun()", "from .entity import Entity\nfrom .simulation_automation_run_status import SimulationAutomationRunStatus\nfrom .entity import Entity\nfrom .simulation_automation_run_status import SimulationAutomationRunStat...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SimulationAutomationRun() <|end_body_0|> <|body_start_1|> from .entity import Entity from .simulation_automation_run_status import SimulationAutomationRunStatus from .entity impo...
SimulationAutomationRun
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulationAutomationRun: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationAutomationRun: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and creat...
stack_v2_sparse_classes_36k_train_021885
3,312
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: SimulationAutomationRun", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
stack_v2_sparse_classes_30k_train_003427
Implement the Python class `SimulationAutomationRun` described below. Class description: Implement the SimulationAutomationRun class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationAutomationRun: Creates a new instance of the appropriate clas...
Implement the Python class `SimulationAutomationRun` described below. Class description: Implement the SimulationAutomationRun class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationAutomationRun: Creates a new instance of the appropriate clas...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SimulationAutomationRun: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationAutomationRun: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and creat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulationAutomationRun: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SimulationAutomationRun: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object R...
the_stack_v2_python_sparse
msgraph/generated/models/simulation_automation_run.py
microsoftgraph/msgraph-sdk-python
train
135
a639412340c7c976da22e0ae2f1cb875ddf94df8
[ "r = Round.query.get(round_id)\nif r is not None:\n if r.has_dance(dance_id):\n return r.adjudication_data(dance_id, dancing_round=True)\n abort(404, 'Round does not have dance with given dance_id')\nabort(404, 'Unknown round_id')", "r = Round.query.get(round_id)\nif r is not None:\n if r.has_danc...
<|body_start_0|> r = Round.query.get(round_id) if r is not None: if r.has_dance(dance_id): return r.adjudication_data(dance_id, dancing_round=True) abort(404, 'Round does not have dance with given dance_id') abort(404, 'Unknown round_id') <|end_body_0|> <...
RoundAPIAdjudicationDance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoundAPIAdjudicationDance: def get(self, round_id, dance_id): """Get adjudication data for a specific dance""" <|body_0|> def patch(self, round_id, dance_id): """Gives a mark to a list of couples for a specific dance or placing for couples in the final""" <|b...
stack_v2_sparse_classes_36k_train_021886
25,303
no_license
[ { "docstring": "Get adjudication data for a specific dance", "name": "get", "signature": "def get(self, round_id, dance_id)" }, { "docstring": "Gives a mark to a list of couples for a specific dance or placing for couples in the final", "name": "patch", "signature": "def patch(self, roun...
2
null
Implement the Python class `RoundAPIAdjudicationDance` described below. Class description: Implement the RoundAPIAdjudicationDance class. Method signatures and docstrings: - def get(self, round_id, dance_id): Get adjudication data for a specific dance - def patch(self, round_id, dance_id): Gives a mark to a list of c...
Implement the Python class `RoundAPIAdjudicationDance` described below. Class description: Implement the RoundAPIAdjudicationDance class. Method signatures and docstrings: - def get(self, round_id, dance_id): Get adjudication data for a specific dance - def patch(self, round_id, dance_id): Gives a mark to a list of c...
079b109fd13683a31d1d632faa5ab72cf0e78ddf
<|skeleton|> class RoundAPIAdjudicationDance: def get(self, round_id, dance_id): """Get adjudication data for a specific dance""" <|body_0|> def patch(self, round_id, dance_id): """Gives a mark to a list of couples for a specific dance or placing for couples in the final""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoundAPIAdjudicationDance: def get(self, round_id, dance_id): """Get adjudication data for a specific dance""" r = Round.query.get(round_id) if r is not None: if r.has_dance(dance_id): return r.adjudication_data(dance_id, dancing_round=True) abor...
the_stack_v2_python_sparse
backend/apis/round/apis.py
AlenAlic/DANCE
train
0
5719de02c8b56e9c1a4c5b8efa338146b0461852
[ "super(Downsample, self).__init__()\nself.apply_batchnorm = apply_batchnorm\ninitializer = tf.random_normal_initializer(0, 0.02)\nself.conv1 = tf.keras.layers.Conv2D(filters=filters, kernel_size=(size, size), strides=(2, 2), padding='same', kernel_initializer=initializer, use_bias=False)\nif self.apply_batchnorm:\n...
<|body_start_0|> super(Downsample, self).__init__() self.apply_batchnorm = apply_batchnorm initializer = tf.random_normal_initializer(0, 0.02) self.conv1 = tf.keras.layers.Conv2D(filters=filters, kernel_size=(size, size), strides=(2, 2), padding='same', kernel_initializer=initializer, us...
Use convolution layer to downsample
Downsample
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Downsample: """Use convolution layer to downsample""" def __init__(self, filters, size, apply_batchnorm=True): """The construct function. Args: filters: The convolution filters number. size: The convolution filter size. apply_batchnorm If use batch normalization:""" <|body_0|...
stack_v2_sparse_classes_36k_train_021887
20,044
no_license
[ { "docstring": "The construct function. Args: filters: The convolution filters number. size: The convolution filter size. apply_batchnorm If use batch normalization:", "name": "__init__", "signature": "def __init__(self, filters, size, apply_batchnorm=True)" }, { "docstring": "Calls the model on...
2
stack_v2_sparse_classes_30k_train_001109
Implement the Python class `Downsample` described below. Class description: Use convolution layer to downsample Method signatures and docstrings: - def __init__(self, filters, size, apply_batchnorm=True): The construct function. Args: filters: The convolution filters number. size: The convolution filter size. apply_b...
Implement the Python class `Downsample` described below. Class description: Use convolution layer to downsample Method signatures and docstrings: - def __init__(self, filters, size, apply_batchnorm=True): The construct function. Args: filters: The convolution filters number. size: The convolution filter size. apply_b...
d1b70b2a954f4665b628ba252b03c1a74b95559f
<|skeleton|> class Downsample: """Use convolution layer to downsample""" def __init__(self, filters, size, apply_batchnorm=True): """The construct function. Args: filters: The convolution filters number. size: The convolution filter size. apply_batchnorm If use batch normalization:""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Downsample: """Use convolution layer to downsample""" def __init__(self, filters, size, apply_batchnorm=True): """The construct function. Args: filters: The convolution filters number. size: The convolution filter size. apply_batchnorm If use batch normalization:""" super(Downsample, self...
the_stack_v2_python_sparse
NeuralNetworks-tensorflow/generation_network_model/GAN/pix2pix.py
zhaocc1106/machine_learn
train
15
494497b8d6531af5349291667ca1a80f4f7a1721
[ "self._frame_queue = framequeue\nself._listening_host = '127.0.0.1'\nself._listening_port = int(ait.config.get('dsn.sle.frame_output_port', kwargs.get('frame_output_port', ait.DEFAULT_FRAME_PORT)))\nself._downlink_frame_type = ait.config.get('dsn.sle.downlink_frame_type', kwargs.get('downlink_frame_type', ait.DEFAU...
<|body_start_0|> self._frame_queue = framequeue self._listening_host = '127.0.0.1' self._listening_port = int(ait.config.get('dsn.sle.frame_output_port', kwargs.get('frame_output_port', ait.DEFAULT_FRAME_PORT))) self._downlink_frame_type = ait.config.get('dsn.sle.downlink_frame_type', kw...
UDP Datagram server that handles incoming messages TMFrames/AOSFrames from frame output port of the upstream service (AIT DSN RAF/RCF server?)
Frame_Service
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Frame_Service: """UDP Datagram server that handles incoming messages TMFrames/AOSFrames from frame output port of the upstream service (AIT DSN RAF/RCF server?)""" def __init__(self, framequeue, *args, **kwargs): """Constructor :param framequeue: The frame queue to which frames from ...
stack_v2_sparse_classes_36k_train_021888
43,287
permissive
[ { "docstring": "Constructor :param framequeue: The frame queue to which frames from ports will be added :param args: Arguments :param kwargs: Keyword arguments", "name": "__init__", "signature": "def __init__(self, framequeue, *args, **kwargs)" }, { "docstring": "This handler is called whenever ...
4
stack_v2_sparse_classes_30k_train_019280
Implement the Python class `Frame_Service` described below. Class description: UDP Datagram server that handles incoming messages TMFrames/AOSFrames from frame output port of the upstream service (AIT DSN RAF/RCF server?) Method signatures and docstrings: - def __init__(self, framequeue, *args, **kwargs): Constructor...
Implement the Python class `Frame_Service` described below. Class description: UDP Datagram server that handles incoming messages TMFrames/AOSFrames from frame output port of the upstream service (AIT DSN RAF/RCF server?) Method signatures and docstrings: - def __init__(self, framequeue, *args, **kwargs): Constructor...
654bc5575aa2c9792052a220854bea2d30841f8d
<|skeleton|> class Frame_Service: """UDP Datagram server that handles incoming messages TMFrames/AOSFrames from frame output port of the upstream service (AIT DSN RAF/RCF server?)""" def __init__(self, framequeue, *args, **kwargs): """Constructor :param framequeue: The frame queue to which frames from ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Frame_Service: """UDP Datagram server that handles incoming messages TMFrames/AOSFrames from frame output port of the upstream service (AIT DSN RAF/RCF server?)""" def __init__(self, framequeue, *args, **kwargs): """Constructor :param framequeue: The frame queue to which frames from ports will be...
the_stack_v2_python_sparse
ait/dsn/proc/deframe_packet_processor.py
NASA-AMMOS/AIT-DSN
train
22
9e4eae77ec00fe1fcb0cf779812c6172876b0031
[ "self.script_type = script_type\nself.default_shell = default_shell\nname = '%s-script' % self.script_type\nfacility = logging.handlers.SysLogHandler.LOG_DAEMON\nself.logger = logger.Logger(name=name, debug=debug, facility=facility)\nself.retriever = script_retriever.ScriptRetriever(self.logger, script_type)\nself....
<|body_start_0|> self.script_type = script_type self.default_shell = default_shell name = '%s-script' % self.script_type facility = logging.handlers.SysLogHandler.LOG_DAEMON self.logger = logger.Logger(name=name, debug=debug, facility=facility) self.retriever = script_ret...
A class for retrieving and executing metadata scripts.
ScriptManager
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScriptManager: """A class for retrieving and executing metadata scripts.""" def __init__(self, script_type, default_shell=None, run_dir=None, debug=False): """Constructor. Args: script_type: string, the metadata script type to run. default_shell: string, the default shell to execute ...
stack_v2_sparse_classes_36k_train_021889
4,004
permissive
[ { "docstring": "Constructor. Args: script_type: string, the metadata script type to run. default_shell: string, the default shell to execute the script. run_dir: string, the base directory location of the temporary directory. debug: bool, True if debug output should write to the console.", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_021571
Implement the Python class `ScriptManager` described below. Class description: A class for retrieving and executing metadata scripts. Method signatures and docstrings: - def __init__(self, script_type, default_shell=None, run_dir=None, debug=False): Constructor. Args: script_type: string, the metadata script type to ...
Implement the Python class `ScriptManager` described below. Class description: A class for retrieving and executing metadata scripts. Method signatures and docstrings: - def __init__(self, script_type, default_shell=None, run_dir=None, debug=False): Constructor. Args: script_type: string, the metadata script type to ...
cf4b33214f770da2299923a5fa73d3d95f66ec35
<|skeleton|> class ScriptManager: """A class for retrieving and executing metadata scripts.""" def __init__(self, script_type, default_shell=None, run_dir=None, debug=False): """Constructor. Args: script_type: string, the metadata script type to run. default_shell: string, the default shell to execute ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScriptManager: """A class for retrieving and executing metadata scripts.""" def __init__(self, script_type, default_shell=None, run_dir=None, debug=False): """Constructor. Args: script_type: string, the metadata script type to run. default_shell: string, the default shell to execute the script. r...
the_stack_v2_python_sparse
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_manager.py
GoogleCloudPlatform/compute-image-packages
train
329
a63d3728fdaa2cbdf96e6a4fbb7197237db32968
[ "dataset_type = models.DatasetType.objects.using('agdc').get(id=request.GET.get('dataset_type_ref'))\nmeasurements = dataset_type.definition['measurements']\nfor measurement in measurements:\n measurement['src_varname'] = measurement['name']\n measurement['dtype'] = 'int32' if measurement['dtype'] in ['uint16...
<|body_start_0|> dataset_type = models.DatasetType.objects.using('agdc').get(id=request.GET.get('dataset_type_ref')) measurements = dataset_type.definition['measurements'] for measurement in measurements: measurement['src_varname'] = measurement['name'] measurement['dtype...
Gets a list of existing measurements and validates user added measurements
IngestionMeasurement
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IngestionMeasurement: """Gets a list of existing measurements and validates user added measurements""" def get(self, request): """Get existing measurement forms for a dataset type Args: dataset type id, used to fetch the dataset type and its definition. Returns: Rendered HTML string ...
stack_v2_sparse_classes_36k_train_021890
19,958
permissive
[ { "docstring": "Get existing measurement forms for a dataset type Args: dataset type id, used to fetch the dataset type and its definition. Returns: Rendered HTML string containing a form for each measurement and a panel that enumerates all measurements. Essentially just the right side panel of the ingestion/da...
2
stack_v2_sparse_classes_30k_train_012383
Implement the Python class `IngestionMeasurement` described below. Class description: Gets a list of existing measurements and validates user added measurements Method signatures and docstrings: - def get(self, request): Get existing measurement forms for a dataset type Args: dataset type id, used to fetch the datase...
Implement the Python class `IngestionMeasurement` described below. Class description: Gets a list of existing measurements and validates user added measurements Method signatures and docstrings: - def get(self, request): Get existing measurement forms for a dataset type Args: dataset type id, used to fetch the datase...
ef50e918df89313f130d735e7cb7c0a069da410e
<|skeleton|> class IngestionMeasurement: """Gets a list of existing measurements and validates user added measurements""" def get(self, request): """Get existing measurement forms for a dataset type Args: dataset type id, used to fetch the dataset type and its definition. Returns: Rendered HTML string ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IngestionMeasurement: """Gets a list of existing measurements and validates user added measurements""" def get(self, request): """Get existing measurement forms for a dataset type Args: dataset type id, used to fetch the dataset type and its definition. Returns: Rendered HTML string containing a ...
the_stack_v2_python_sparse
apps/data_cube_manager/views/ingestion.py
ceos-seo/data_cube_ui
train
47
20a35bf2a4f2b34def1ad7af7c3936569f624dbd
[ "self.verbose = verbose\nif slot_nums is None:\n self.slot_nums = set()\nelse:\n self.slot_nums = {int(slot_num) for slot_num in slot_nums}\nself.cfg_dict = {}\nself.S_dict = {}\nself.logs_dict = {}\nfor slot_num in sorted(self.slot_nums):\n self.load_single_slot(slot_num=slot_num)", "slot_num = int(slot...
<|body_start_0|> self.verbose = verbose if slot_nums is None: self.slot_nums = set() else: self.slot_nums = {int(slot_num) for slot_num in slot_nums} self.cfg_dict = {} self.S_dict = {} self.logs_dict = {} for slot_num in sorted(self.slot_n...
For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg = load_s.S_dict[slot_num] S = load...
LoadS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadS: """For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg =...
stack_v2_sparse_classes_36k_train_021891
3,884
no_license
[ { "docstring": "Proved with a slot numbers, an instance of this class will automatically load and configure each SMuRF slot. The smurf slots are accessible through the instance variables self.cfg_dict, self.S_dict, and self.logs_dict. As the names of these variables suggest, each variable is a dictionary with t...
3
stack_v2_sparse_classes_30k_train_018473
Implement the Python class `LoadS` described below. Class description: For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_...
Implement the Python class `LoadS` described below. Class description: For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_...
0b002f1477efb6b5fcaddc4a282c35883165a42a
<|skeleton|> class LoadS: """For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg =...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoadS: """For obtaining and initializing and abstract number of SMuRF controllers (identified by slot number) for testing, commonly this is denoted as python objected denoted as an uppercase 'S'. For a single S, and cfg use: slot_num = 1 load_s = LoadS(slot_nums={slot_num}, verbose=verbose) cfg = load_s.S_dic...
the_stack_v2_python_sparse
chw3k5/ufm_optimize/operators/controler.py
simonsobs/readout-script-dev
train
1
6686b9ffc6573f146a957b5eb063297d49c57622
[ "result = {'result': 'NG'}\ncontent = CtrlDSSection().get_usecase_by_doc_id(doc_id, 'USERCASE')\nif content:\n result = {'result': 'OK', 'content': content}\nreturn result", "result = {'result': 'NG', 'error': ''}\ndata_json = request.get_json()\nsec_obj = CtrlDSSection()\nflag, error = sec_obj.usecase_add(dat...
<|body_start_0|> result = {'result': 'NG'} content = CtrlDSSection().get_usecase_by_doc_id(doc_id, 'USERCASE') if content: result = {'result': 'OK', 'content': content} return result <|end_body_0|> <|body_start_1|> result = {'result': 'NG', 'error': ''} data_...
ApiDSDocUsecase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiDSDocUsecase: def get(self, doc_id): """获取文档下所有usecase的说明 :param doc_id: :return:""" <|body_0|> def post(self): """保存和修改文档下usecase的说明 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG'} content = CtrlDSSecti...
stack_v2_sparse_classes_36k_train_021892
31,026
no_license
[ { "docstring": "获取文档下所有usecase的说明 :param doc_id: :return:", "name": "get", "signature": "def get(self, doc_id)" }, { "docstring": "保存和修改文档下usecase的说明 :return:", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_012198
Implement the Python class `ApiDSDocUsecase` described below. Class description: Implement the ApiDSDocUsecase class. Method signatures and docstrings: - def get(self, doc_id): 获取文档下所有usecase的说明 :param doc_id: :return: - def post(self): 保存和修改文档下usecase的说明 :return:
Implement the Python class `ApiDSDocUsecase` described below. Class description: Implement the ApiDSDocUsecase class. Method signatures and docstrings: - def get(self, doc_id): 获取文档下所有usecase的说明 :param doc_id: :return: - def post(self): 保存和修改文档下usecase的说明 :return: <|skeleton|> class ApiDSDocUsecase: def get(sel...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiDSDocUsecase: def get(self, doc_id): """获取文档下所有usecase的说明 :param doc_id: :return:""" <|body_0|> def post(self): """保存和修改文档下usecase的说明 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiDSDocUsecase: def get(self, doc_id): """获取文档下所有usecase的说明 :param doc_id: :return:""" result = {'result': 'NG'} content = CtrlDSSection().get_usecase_by_doc_id(doc_id, 'USERCASE') if content: result = {'result': 'OK', 'content': content} return result ...
the_stack_v2_python_sparse
Source/collaboration_2/app/api_1_0/api_ds_doc.py
lsn1183/web_project
train
0
213a90e54d97c7db15b4c9972c1dcb083ec0a937
[ "self.data = data\nself.period_begin = period_beg\nself.period_end = period_end\nself.observations = []", "increase = Increase(self.data.copy(deep=True), self.period_begin, self.period_end)\nincrease.analyse()\nself.observations.extend(increase.observations)\ndecrease = Decrease(self.data.copy(deep=True), self.pe...
<|body_start_0|> self.data = data self.period_begin = period_beg self.period_end = period_end self.observations = [] <|end_body_0|> <|body_start_1|> increase = Increase(self.data.copy(deep=True), self.period_begin, self.period_end) increase.analyse() self.observa...
A class for running the analysis over the given data.
Analyse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Analyse: """A class for running the analysis over the given data.""" def __init__(self, data, period_beg, period_end): """The init function. Args: data (pd.dataframe): The dataframe to be used for running the analysis period_beg (datetime.datetime): The datetime of the beginning of t...
stack_v2_sparse_classes_36k_train_021893
2,087
no_license
[ { "docstring": "The init function. Args: data (pd.dataframe): The dataframe to be used for running the analysis period_beg (datetime.datetime): The datetime of the beginning of the period period_end (datetime.datetime): The datetime of the end of the period", "name": "__init__", "signature": "def __init...
4
stack_v2_sparse_classes_30k_train_010583
Implement the Python class `Analyse` described below. Class description: A class for running the analysis over the given data. Method signatures and docstrings: - def __init__(self, data, period_beg, period_end): The init function. Args: data (pd.dataframe): The dataframe to be used for running the analysis period_be...
Implement the Python class `Analyse` described below. Class description: A class for running the analysis over the given data. Method signatures and docstrings: - def __init__(self, data, period_beg, period_end): The init function. Args: data (pd.dataframe): The dataframe to be used for running the analysis period_be...
5e62f96e541118ae924303b730f18d248022cac0
<|skeleton|> class Analyse: """A class for running the analysis over the given data.""" def __init__(self, data, period_beg, period_end): """The init function. Args: data (pd.dataframe): The dataframe to be used for running the analysis period_beg (datetime.datetime): The datetime of the beginning of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Analyse: """A class for running the analysis over the given data.""" def __init__(self, data, period_beg, period_end): """The init function. Args: data (pd.dataframe): The dataframe to be used for running the analysis period_beg (datetime.datetime): The datetime of the beginning of the period per...
the_stack_v2_python_sparse
NLGengine/analyse.py
StanMey/Robotreporter
train
3
aa2c75bb2e83a0bfb4e2e58f3dc2a96af5e910a6
[ "if len(s) <= 1:\n return s\n\ndef isPalindrome(sub):\n if sub == sub[::-1]:\n return True\nfor l in range(len(s), -1, -1):\n for head in range(len(s) - l):\n tail = head + l + 1\n if isPalindrome(s[head:tail]):\n return s[head:tail]", "max_palindrome = ''\nfor i in range(...
<|body_start_0|> if len(s) <= 1: return s def isPalindrome(sub): if sub == sub[::-1]: return True for l in range(len(s), -1, -1): for head in range(len(s) - l): tail = head + l + 1 if isPalindrome(s[head:tail]):...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome(self, s: str) -> str: """This solution is similar to O(n^3) bruteforce, but uses approach that we doesn't need to check substrings shorter than current max_palin...
stack_v2_sparse_classes_36k_train_021894
2,296
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": "This solution is similar to O(n^3) bruteforce, but uses approach that we doesn't need to check substrings shorter than current max_palindrom. On each iteration...
2
stack_v2_sparse_classes_30k_train_019228
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome(self, s: str) -> str: This solution is similar to O(n^3) bruteforce, but uses approach that we do...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome(self, s: str) -> str: This solution is similar to O(n^3) bruteforce, but uses approach that we do...
92b4b7c6b69d39bf79a9e20a9fc947304c2a1de5
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome(self, s: str) -> str: """This solution is similar to O(n^3) bruteforce, but uses approach that we doesn't need to check substrings shorter than current max_palin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if len(s) <= 1: return s def isPalindrome(sub): if sub == sub[::-1]: return True for l in range(len(s), -1, -1): for head in range(len(s) - l): ...
the_stack_v2_python_sparse
leet_0005_longest_palindromic_substring.py
kkaixiao/pythonalgo2
train
2
5516452a231a947d42ced06ffa7d69be4605bd97
[ "if len(nums) == 0:\n return 0\nmax_length = 1\nfor i in range(len(nums)):\n count = 1\n cur = nums[i]\n pre = None\n for j in range(i + 1, len(nums)):\n if cur < nums[j]:\n count += 1\n pre = cur\n cur = nums[j]\n elif cur > nums[j]:\n if pre...
<|body_start_0|> if len(nums) == 0: return 0 max_length = 1 for i in range(len(nums)): count = 1 cur = nums[i] pre = None for j in range(i + 1, len(nums)): if cur < nums[j]: count += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 0: return 0 ...
stack_v2_sparse_classes_36k_train_021895
1,182
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_015310
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def lengthOfLIS...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 0: return 0 max_length = 1 for i in range(len(nums)): count = 1 cur = nums[i] pre = None for j in range(i + 1, len(nums)): ...
the_stack_v2_python_sparse
longest-increasing-subsequence/solution.py
uxlsl/leetcode_practice
train
0
1fc8e5c695007c61734c84b725d8c559e698fee2
[ "super().__init__()\nif path:\n use_pretrained = False\nelse:\n use_pretrained = True\nresnet = models.resnet50(pretrained=use_pretrained)\nself.pretrained = nn.Module()\nself.scratch = nn.Module()\nself.pretrained.layer1 = nn.Sequential(resnet.conv1, resnet.bn1, resnet.relu, resnet.maxpool, resnet.layer1)\ns...
<|body_start_0|> super().__init__() if path: use_pretrained = False else: use_pretrained = True resnet = models.resnet50(pretrained=use_pretrained) self.pretrained = nn.Module() self.scratch = nn.Module() self.pretrained.layer1 = nn.Sequent...
Network for monocular depth estimation.
MidasNetOld
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MidasNetOld: """Network for monocular depth estimation.""" def __init__(self, path=None, features=256): """Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256.""" <|body_0|> def forward(se...
stack_v2_sparse_classes_36k_train_021896
5,777
permissive
[ { "docstring": "Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256.", "name": "__init__", "signature": "def __init__(self, path=None, features=256)" }, { "docstring": "Forward pass. Args: x (tensor): input data (...
3
stack_v2_sparse_classes_30k_train_004581
Implement the Python class `MidasNetOld` described below. Class description: Network for monocular depth estimation. Method signatures and docstrings: - def __init__(self, path=None, features=256): Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. D...
Implement the Python class `MidasNetOld` described below. Class description: Network for monocular depth estimation. Method signatures and docstrings: - def __init__(self, path=None, features=256): Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. D...
a00c3619bf4042e446e1919087f0b09fe9fa3a65
<|skeleton|> class MidasNetOld: """Network for monocular depth estimation.""" def __init__(self, path=None, features=256): """Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256.""" <|body_0|> def forward(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MidasNetOld: """Network for monocular depth estimation.""" def __init__(self, path=None, features=256): """Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256.""" super().__init__() if path: ...
the_stack_v2_python_sparse
nasws/cnn/search_space/monodepth/models/midas_net_old.py
kcyu2014/nas-landmarkreg
train
10
be142f7992b7d27046142538c8f7a70a6e073f6a
[ "if theJSON.has('matchHostPK') or theJSON.has('matchHostSignature'):\n raise RuntimeException('Already signed JSON! Cannot sign again.')\ntheJSON.put('matchHostPK', thePK)\ntheSignature = BaseCryptography.signData(theSK, CanonicalJSON.getCanonicalForm(theJSON, CanonicalizationStrategy.SIMPLE))\ntheJSON.put('matc...
<|body_start_0|> if theJSON.has('matchHostPK') or theJSON.has('matchHostSignature'): raise RuntimeException('Already signed JSON! Cannot sign again.') theJSON.put('matchHostPK', thePK) theSignature = BaseCryptography.signData(theSK, CanonicalJSON.getCanonicalForm(theJSON, Canonicaliz...
generated source for class SignableJSON
SignableJSON
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignableJSON: """generated source for class SignableJSON""" def signJSON(cls, theJSON, thePK, theSK): """generated source for method signJSON""" <|body_0|> def isSignedJSON(cls, theJSON): """generated source for method isSignedJSON""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_021897
2,578
permissive
[ { "docstring": "generated source for method signJSON", "name": "signJSON", "signature": "def signJSON(cls, theJSON, thePK, theSK)" }, { "docstring": "generated source for method isSignedJSON", "name": "isSignedJSON", "signature": "def isSignedJSON(cls, theJSON)" }, { "docstring":...
3
null
Implement the Python class `SignableJSON` described below. Class description: generated source for class SignableJSON Method signatures and docstrings: - def signJSON(cls, theJSON, thePK, theSK): generated source for method signJSON - def isSignedJSON(cls, theJSON): generated source for method isSignedJSON - def veri...
Implement the Python class `SignableJSON` described below. Class description: generated source for class SignableJSON Method signatures and docstrings: - def signJSON(cls, theJSON, thePK, theSK): generated source for method signJSON - def isSignedJSON(cls, theJSON): generated source for method isSignedJSON - def veri...
4e6e6e876c3a4294cd711647051da2d9c1836b60
<|skeleton|> class SignableJSON: """generated source for class SignableJSON""" def signJSON(cls, theJSON, thePK, theSK): """generated source for method signJSON""" <|body_0|> def isSignedJSON(cls, theJSON): """generated source for method isSignedJSON""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignableJSON: """generated source for class SignableJSON""" def signJSON(cls, theJSON, thePK, theSK): """generated source for method signJSON""" if theJSON.has('matchHostPK') or theJSON.has('matchHostSignature'): raise RuntimeException('Already signed JSON! Cannot sign again.'...
the_stack_v2_python_sparse
ggpy/cruft/autocode/SignableJSON.py
hobson/ggpy
train
1
51a7679431c5092f992c7ed3853965bf8dedac72
[ "self.capacity = capacity\nself.dicti = {}\nself.head = Node(0, 0)\nself.tail = Node(0, 0)\nself.head.next = self.tail\nself.tail.prev = self.head", "if key not in self.dicti:\n return -1\nnode = self.dicti[key]\nself.remove(node)\nself.add(node)\nreturn node.val", "if key in self.dicti:\n self.remove(sel...
<|body_start_0|> self.capacity = capacity self.dicti = {} self.head = Node(0, 0) self.tail = Node(0, 0) self.head.next = self.tail self.tail.prev = self.head <|end_body_0|> <|body_start_1|> if key not in self.dicti: return -1 node = self.dicti...
LRUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> def...
stack_v2_sparse_classes_36k_train_021898
1,745
permissive
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
5
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void - def...
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void - def...
147d99e273bc398c107f2aef73aba0d6bb88dea0
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.dicti = {} self.head = Node(0, 0) self.tail = Node(0, 0) self.head.next = self.tail self.tail.prev = self.head def get(self, key): """:type key: ...
the_stack_v2_python_sparse
146_LRU_Cache.py
rpm1995/LeetCode
train
0
33c4866b8c3a17c5b3f0553a1eabbb4f4c6c9f25
[ "print('Inside __init__()')\nself.arg1 = arg1\nself.arg2 = arg2\nself.arg3 = arg3", "print('Inside __call__()')\n\ndef wrapped_f(*args):\n print('Inside wrapped_f()')\n print('Decorator arguments:', self.arg1, self.arg2, self.arg3)\n return f(*args)\nreturn wrapped_f" ]
<|body_start_0|> print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 <|end_body_0|> <|body_start_1|> print('Inside __call__()') def wrapped_f(*args): print('Inside wrapped_f()') print('Decorator arguments:', self.arg1, s...
decoratorWithArguments
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class decoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_36k_train_021899
2,314
no_license
[ { "docstring": "If there are decorator arguments, the function to be decorated is not passed to the constructor!", "name": "__init__", "signature": "def __init__(self, arg1, arg2, arg3)" }, { "docstring": "If there are decorator arguments, __call__() is only called once, as part of the decoratio...
2
stack_v2_sparse_classes_30k_train_020680
Implement the Python class `decoratorWithArguments` described below. Class description: Implement the decoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
Implement the Python class `decoratorWithArguments` described below. Class description: Implement the decoratorWithArguments class. Method signatures and docstrings: - def __init__(self, arg1, arg2, arg3): If there are decorator arguments, the function to be decorated is not passed to the constructor! - def __call__(...
3fdee9a4fc87ce191643f59a3e33d03dac602156
<|skeleton|> class decoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator arguments, __call__() is only called once,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class decoratorWithArguments: def __init__(self, arg1, arg2, arg3): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" print('Inside __init__()') self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 def __call__(self, f):...
the_stack_v2_python_sparse
Code/dec.py
ThomasTwiton/CS330-1
train
0