blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
eadeb1fbd63e59cb74261590abcab27fb903de85
[ "if head == None:\n return (None, 0)\nseq = []\nwhile head != None:\n seq.append(head.val)\n head = head.next\nreturn (create_reversed_linked_list(seq), len(seq))", "reversed_head, length = self.reverseList(head)\nfor i in range(int(length / 2)):\n if head.val != reversed_head.val:\n return Fal...
<|body_start_0|> if head == None: return (None, 0) seq = [] while head != None: seq.append(head.val) head = head.next return (create_reversed_linked_list(seq), len(seq)) <|end_body_0|> <|body_start_1|> reversed_head, length = self.reverseList(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head == None: return (Non...
stack_v2_sparse_classes_75kplus_train_067700
1,223
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, head)" } ]
2
stack_v2_sparse_classes_30k_val_002084
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def isPalindrome(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def isPalindrome(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def revers...
0e95eb7ef8e2c362ef1dab1424bfdffad0daac32
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" if head == None: return (None, 0) seq = [] while head != None: seq.append(head.val) head = head.next return (create_reversed_linked_list(seq), len(seq)...
the_stack_v2_python_sparse
top_interview_questions/easy/linked_list_5_palidrome.py
MartinMa28/LeetCode-Solutions
train
0
c08ee7c9a4a5d43447ec404b66380b97c13783b5
[ "cleaned_data = super(SignUpForm, self).clean()\npassword = cleaned_data.get('password')\npassword_confirmation = cleaned_data.get('password_confirmation')\nif password and password_confirmation:\n if password != password_confirmation:\n self.add_error('password_confirmation', 'Does not match password')\n...
<|body_start_0|> cleaned_data = super(SignUpForm, self).clean() password = cleaned_data.get('password') password_confirmation = cleaned_data.get('password_confirmation') if password and password_confirmation: if password != password_confirmation: self.add_erro...
Create new user.
SignUpForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignUpForm: """Create new user.""" def clean(self): """Clean data and add perform custom validation.""" <|body_0|> def submit(self): """Submit the form. Create new user in case of success validation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_067701
3,261
no_license
[ { "docstring": "Clean data and add perform custom validation.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Submit the form. Create new user in case of success validation.", "name": "submit", "signature": "def submit(self)" } ]
2
stack_v2_sparse_classes_30k_train_022460
Implement the Python class `SignUpForm` described below. Class description: Create new user. Method signatures and docstrings: - def clean(self): Clean data and add perform custom validation. - def submit(self): Submit the form. Create new user in case of success validation.
Implement the Python class `SignUpForm` described below. Class description: Create new user. Method signatures and docstrings: - def clean(self): Clean data and add perform custom validation. - def submit(self): Submit the form. Create new user in case of success validation. <|skeleton|> class SignUpForm: """Cre...
feac92294756385fe5021bfa838d27b9334d6b7b
<|skeleton|> class SignUpForm: """Create new user.""" def clean(self): """Clean data and add perform custom validation.""" <|body_0|> def submit(self): """Submit the form. Create new user in case of success validation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignUpForm: """Create new user.""" def clean(self): """Clean data and add perform custom validation.""" cleaned_data = super(SignUpForm, self).clean() password = cleaned_data.get('password') password_confirmation = cleaned_data.get('password_confirmation') if passw...
the_stack_v2_python_sparse
otus_stackoverflow/user/forms.py
vsokoltsov/OTUS_PYTHON
train
0
da2071dd619a7eb41a093b62b64d613569284d79
[ "self.user = SocialUser.objects.create(firstName='nauman', lastName='sharif', email='testuser@gmail.com', moderation=False, anonymity=False, is_admin=False)\nself.user.set_password('123')\nself.user.save()\nself.resource_type = ResourceType.objects.create(resource_type='funding')\nself.resource = Resource.objects.c...
<|body_start_0|> self.user = SocialUser.objects.create(firstName='nauman', lastName='sharif', email='testuser@gmail.com', moderation=False, anonymity=False, is_admin=False) self.user.set_password('123') self.user.save() self.resource_type = ResourceType.objects.create(resource_type='fund...
This class contains tests for updating a network
TestUpdateNetworkView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUpdateNetworkView: """This class contains tests for updating a network""" def setUp(self): """This sets up request to update network :return:""" <|body_0|> def test_update_network_view(self): """This function makes request to update contact :return:""" ...
stack_v2_sparse_classes_75kplus_train_067702
33,021
no_license
[ { "docstring": "This sets up request to update network :return:", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "This function makes request to update contact :return:", "name": "test_update_network_view", "signature": "def test_update_network_view(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_048804
Implement the Python class `TestUpdateNetworkView` described below. Class description: This class contains tests for updating a network Method signatures and docstrings: - def setUp(self): This sets up request to update network :return: - def test_update_network_view(self): This function makes request to update conta...
Implement the Python class `TestUpdateNetworkView` described below. Class description: This class contains tests for updating a network Method signatures and docstrings: - def setUp(self): This sets up request to update network :return: - def test_update_network_view(self): This function makes request to update conta...
4da7f1d7f02695504887287db28f808c637a2286
<|skeleton|> class TestUpdateNetworkView: """This class contains tests for updating a network""" def setUp(self): """This sets up request to update network :return:""" <|body_0|> def test_update_network_view(self): """This function makes request to update contact :return:""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestUpdateNetworkView: """This class contains tests for updating a network""" def setUp(self): """This sets up request to update network :return:""" self.user = SocialUser.objects.create(firstName='nauman', lastName='sharif', email='testuser@gmail.com', moderation=False, anonymity=False, ...
the_stack_v2_python_sparse
SocialImpactNetwork/tests.py
nauman-pucit/problem_solver
train
0
e369f08c1559b3e2d7b1bfa9ed77c7631de46291
[ "super().__init__(**kwargs)\nnum_trees = params.any_(num_trees, lambda i: params.integer(i, above=0), lambda i: params.integer(i, from_=-1, to=-1))\nuse_jackknife = params.boolean(use_jackknife)\nbias_learner = params.any_(bias_learner, lambda arg: params.instance(arg, BaseLoloLearner), params.none)\nleaf_learner =...
<|body_start_0|> super().__init__(**kwargs) num_trees = params.any_(num_trees, lambda i: params.integer(i, above=0), lambda i: params.integer(i, from_=-1, to=-1)) use_jackknife = params.boolean(use_jackknife) bias_learner = params.any_(bias_learner, lambda arg: params.instance(arg, BaseL...
Random forest regression, lolo implementation. See https://github.com/CitrineInformatics/lolo Supports only numeric (vector) inputs and labels.
RandomForestRegressionLolo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomForestRegressionLolo: """Random forest regression, lolo implementation. See https://github.com/CitrineInformatics/lolo Supports only numeric (vector) inputs and labels.""" def __init__(self, num_trees: int=-1, use_jackknife: bool=True, bias_learner: Optional[BaseLoloLearner]=None, leaf...
stack_v2_sparse_classes_75kplus_train_067703
7,132
permissive
[ { "docstring": "Initialize random forest model. See lolo Scala source code for initialization parameters: https://github.com/CitrineInformatics/lolo/blob/develop/src/main/scala/io/citrine/lolo/learners/RandomForest.scala When using `uncertainty_calibration=False` (the default), the number of trees `num_trees` s...
3
null
Implement the Python class `RandomForestRegressionLolo` described below. Class description: Random forest regression, lolo implementation. See https://github.com/CitrineInformatics/lolo Supports only numeric (vector) inputs and labels. Method signatures and docstrings: - def __init__(self, num_trees: int=-1, use_jack...
Implement the Python class `RandomForestRegressionLolo` described below. Class description: Random forest regression, lolo implementation. See https://github.com/CitrineInformatics/lolo Supports only numeric (vector) inputs and labels. Method signatures and docstrings: - def __init__(self, num_trees: int=-1, use_jack...
e222cf9c126f81edfdb3b2b9a99abac6678129e8
<|skeleton|> class RandomForestRegressionLolo: """Random forest regression, lolo implementation. See https://github.com/CitrineInformatics/lolo Supports only numeric (vector) inputs and labels.""" def __init__(self, num_trees: int=-1, use_jackknife: bool=True, bias_learner: Optional[BaseLoloLearner]=None, leaf...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomForestRegressionLolo: """Random forest regression, lolo implementation. See https://github.com/CitrineInformatics/lolo Supports only numeric (vector) inputs and labels.""" def __init__(self, num_trees: int=-1, use_jackknife: bool=True, bias_learner: Optional[BaseLoloLearner]=None, leaf_learner: Opt...
the_stack_v2_python_sparse
smlb/learners/lolo/random_forest_regression_lolo.py
syam-s/smlb
train
0
a0fa83bbc62260f58d22553a99ae8078a68b5741
[ "self.max_size = max_size\nself.resolution = resolution\nself.density = density\nself.update_freq = update_freq\nself.rng = np.random.RandomState(seed)\nself.regenerate_cache()", "low_size = int(self.resolution * self.max_size)\nlow_pattern = self.rng.uniform(0, 1, size=(low_size, low_size)) * 255\nlow_pattern = ...
<|body_start_0|> self.max_size = max_size self.resolution = resolution self.density = density self.update_freq = update_freq self.rng = np.random.RandomState(seed) self.regenerate_cache() <|end_body_0|> <|body_start_1|> low_size = int(self.resolution * self.max_s...
Reproduces "random pattern mask" for inpainting, which was proposed in Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., & Efros, A. A. Context Encoders: Feature Learning by Inpainting. Conference on Computer Vision and Pattern Recognition, 2016. ArXiv link: https://arxiv.org/abs/1604.07379 This code is based on li...
RandomPattern
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomPattern: """Reproduces "random pattern mask" for inpainting, which was proposed in Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., & Efros, A. A. Context Encoders: Feature Learning by Inpainting. Conference on Computer Vision and Pattern Recognition, 2016. ArXiv link: https://arxiv.or...
stack_v2_sparse_classes_75kplus_train_067704
13,181
permissive
[ { "docstring": "Args: max_size (int): the size of big binary matrix resolution (float): the ratio of the small matrix size to the big one. Authors recommend to use values from 0.01 to 0.1. density (float): the binarization threshold, also equals the average ones ratio in the mask update_freq (float): the freque...
3
stack_v2_sparse_classes_30k_train_031476
Implement the Python class `RandomPattern` described below. Class description: Reproduces "random pattern mask" for inpainting, which was proposed in Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., & Efros, A. A. Context Encoders: Feature Learning by Inpainting. Conference on Computer Vision and Pattern Recognit...
Implement the Python class `RandomPattern` described below. Class description: Reproduces "random pattern mask" for inpainting, which was proposed in Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., & Efros, A. A. Context Encoders: Feature Learning by Inpainting. Conference on Computer Vision and Pattern Recognit...
50d6c804326b02ba4357865f7346383c1f8c52fb
<|skeleton|> class RandomPattern: """Reproduces "random pattern mask" for inpainting, which was proposed in Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., & Efros, A. A. Context Encoders: Feature Learning by Inpainting. Conference on Computer Vision and Pattern Recognition, 2016. ArXiv link: https://arxiv.or...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomPattern: """Reproduces "random pattern mask" for inpainting, which was proposed in Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., & Efros, A. A. Context Encoders: Feature Learning by Inpainting. Conference on Computer Vision and Pattern Recognition, 2016. ArXiv link: https://arxiv.org/abs/1604.07...
the_stack_v2_python_sparse
vaeac/mask_generators.py
seele1917/FaceVideoVAEAC
train
1
9f9f6717a079c2b3628d2793c1b98e0c70d32d24
[ "VoxelTimeSeries.__init__(self, overlay, overlayList, displayCtx, plotPanel)\nself.parentTs = parentTs\nself.contrast = contrast\nself.fitType = fitType\nself.idx = idx", "opts = self.displayCtx.getOpts(self.overlay)\ncoords = opts.getVoxel()\nif coords is None:\n return ([], [])\ndata = self.overlay.partialFi...
<|body_start_0|> VoxelTimeSeries.__init__(self, overlay, overlayList, displayCtx, plotPanel) self.parentTs = parentTs self.contrast = contrast self.fitType = fitType self.idx = idx <|end_body_0|> <|body_start_1|> opts = self.displayCtx.getOpts(self.overlay) coord...
A :class:`VoxelTimeSeries` class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel. Instances of this class are created by the :class:`FEATTimeSeries` class.
FEATPartialFitTimeSeries
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FEATPartialFitTimeSeries: """A :class:`VoxelTimeSeries` class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel. Instances of this class are created by the :class:`FEATTimeSeries` class.""" def __init__(self, overlay, overlayList, displayCtx...
stack_v2_sparse_classes_75kplus_train_067705
28,910
permissive
[ { "docstring": "Create a ``FEATPartialFitTimeSeries``. :arg overlay: The :class:`.FEATImage` instance to extract the data from. :arg overlayList: The :class:`.OverlayList` instance. :arg displayCtx: The :class:`.DisplayContext` instance. :arg plotPanel: The :class:`TimeSeriesPanel` which owns this ``FEATPartial...
2
stack_v2_sparse_classes_30k_test_001989
Implement the Python class `FEATPartialFitTimeSeries` described below. Class description: A :class:`VoxelTimeSeries` class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel. Instances of this class are created by the :class:`FEATTimeSeries` class. Method signatures a...
Implement the Python class `FEATPartialFitTimeSeries` described below. Class description: A :class:`VoxelTimeSeries` class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel. Instances of this class are created by the :class:`FEATTimeSeries` class. Method signatures a...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class FEATPartialFitTimeSeries: """A :class:`VoxelTimeSeries` class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel. Instances of this class are created by the :class:`FEATTimeSeries` class.""" def __init__(self, overlay, overlayList, displayCtx...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FEATPartialFitTimeSeries: """A :class:`VoxelTimeSeries` class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel. Instances of this class are created by the :class:`FEATTimeSeries` class.""" def __init__(self, overlay, overlayList, displayCtx, plotPanel, ...
the_stack_v2_python_sparse
fsleyes/plotting/timeseries.py
sanjayankur31/fsleyes
train
1
1fd6b82c3bd7a971cc0680e2909ccfd8db83e644
[ "self._repositories = []\nself.__kinds = set()\nself._controller = False", "kind = svc_ref.get_property(cohorte.repositories.PROP_FACTORY_MODEL)\nself.__kinds.add(kind)\nself._controller = REQUIRED_REPOSITORIES.issubset(self.__kinds)", "kind = svc_ref.get_property(cohorte.repositories.PROP_FACTORY_MODEL)\ntry:\...
<|body_start_0|> self._repositories = [] self.__kinds = set() self._controller = False <|end_body_0|> <|body_start_1|> kind = svc_ref.get_property(cohorte.repositories.PROP_FACTORY_MODEL) self.__kinds.add(kind) self._controller = REQUIRED_REPOSITORIES.issubset(self.__kin...
Looks for the source bundle of components
ComponentFinder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentFinder: """Looks for the source bundle of components""" def __init__(self): """Sets up members""" <|body_0|> def _bind_repository(self, field, svc, svc_ref): """A repository has been bound. Starts the timer to provide the service when most of repositorie...
stack_v2_sparse_classes_75kplus_train_067706
4,627
permissive
[ { "docstring": "Sets up members", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "A repository has been bound. Starts the timer to provide the service when most of repositories have been bound.", "name": "_bind_repository", "signature": "def _bind_repository(self...
4
stack_v2_sparse_classes_30k_train_039986
Implement the Python class `ComponentFinder` described below. Class description: Looks for the source bundle of components Method signatures and docstrings: - def __init__(self): Sets up members - def _bind_repository(self, field, svc, svc_ref): A repository has been bound. Starts the timer to provide the service whe...
Implement the Python class `ComponentFinder` described below. Class description: Looks for the source bundle of components Method signatures and docstrings: - def __init__(self): Sets up members - def _bind_repository(self, field, svc, svc_ref): A repository has been bound. Starts the timer to provide the service whe...
686556cdde20beba77ae202de9969be46feed5e2
<|skeleton|> class ComponentFinder: """Looks for the source bundle of components""" def __init__(self): """Sets up members""" <|body_0|> def _bind_repository(self, field, svc, svc_ref): """A repository has been bound. Starts the timer to provide the service when most of repositorie...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ComponentFinder: """Looks for the source bundle of components""" def __init__(self): """Sets up members""" self._repositories = [] self.__kinds = set() self._controller = False def _bind_repository(self, field, svc, svc_ref): """A repository has been bound. St...
the_stack_v2_python_sparse
python/cohorte/composer/node/finder.py
cohorte/cohorte-runtime
train
3
26fac3c68d357edadb5ae307b68ba5eafc4a147a
[ "array = tf.convert_to_tensor(array, dtype=tf.float16)\nstandardized_array = load._standardize_data(array, epsilon=0)\nnp.testing.assert_allclose(np.array(standardized_array), np.array([-1.225, 0.0, 1.225]), rtol=0.001, atol=0)", "data = load._preprocess_structured_data(features, label)\nchex.assert_shape(data.x,...
<|body_start_0|> array = tf.convert_to_tensor(array, dtype=tf.float16) standardized_array = load._standardize_data(array, epsilon=0) np.testing.assert_allclose(np.array(standardized_array), np.array([-1.225, 0.0, 1.225]), rtol=0.001, atol=0) <|end_body_0|> <|body_start_1|> data = load._...
LoadTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadTest: def test_standardize_data(self, array: np.ndarray): """Test data standardization method.""" <|body_0|> def test_preprocess_structured_data(self, features: load.Features, label: int): """Test converting structured data into testbed standardized dictionary fo...
stack_v2_sparse_classes_75kplus_train_067707
3,101
permissive
[ { "docstring": "Test data standardization method.", "name": "test_standardize_data", "signature": "def test_standardize_data(self, array: np.ndarray)" }, { "docstring": "Test converting structured data into testbed standardized dictionary format.", "name": "test_preprocess_structured_data", ...
4
stack_v2_sparse_classes_30k_train_027556
Implement the Python class `LoadTest` described below. Class description: Implement the LoadTest class. Method signatures and docstrings: - def test_standardize_data(self, array: np.ndarray): Test data standardization method. - def test_preprocess_structured_data(self, features: load.Features, label: int): Test conve...
Implement the Python class `LoadTest` described below. Class description: Implement the LoadTest class. Method signatures and docstrings: - def test_standardize_data(self, array: np.ndarray): Test data standardization method. - def test_preprocess_structured_data(self, features: load.Features, label: int): Test conve...
cc2e3de49c29f29852c8cd5885ab54fb6e664e2e
<|skeleton|> class LoadTest: def test_standardize_data(self, array: np.ndarray): """Test data standardization method.""" <|body_0|> def test_preprocess_structured_data(self, features: load.Features, label: int): """Test converting structured data into testbed standardized dictionary fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoadTest: def test_standardize_data(self, array: np.ndarray): """Test data standardization method.""" array = tf.convert_to_tensor(array, dtype=tf.float16) standardized_array = load._standardize_data(array, epsilon=0) np.testing.assert_allclose(np.array(standardized_array), np....
the_stack_v2_python_sparse
neural_testbed/real_data/load_classification_test.py
Aakanksha-Rana/neural_testbed
train
0
48322d67d5b079b797aa53406a367c8fa18616d8
[ "adjList = [[] for _ in range(n)]\ndeg = [0] * n\nfor cur, pre in prerequisites:\n adjList[pre].append(cur)\n deg[cur] += 1\nparent = [0] * n\nqueue = deque([i for i in range(n) if deg[i] == 0])\nwhile queue:\n cur = queue.popleft()\n for next in adjList[cur]:\n parent[next] |= parent[cur] | 1 <<...
<|body_start_0|> adjList = [[] for _ in range(n)] deg = [0] * n for cur, pre in prerequisites: adjList[pre].append(cur) deg[cur] += 1 parent = [0] * n queue = deque([i for i in range(n) if deg[i] == 0]) while queue: cur = queue.popleft(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkIfPrerequisite(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]: """回答课程 uj 是否是课程 vj 的先决条件。""" <|body_0|> def checkIfPrerequisite2(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]: ...
stack_v2_sparse_classes_75kplus_train_067708
1,445
no_license
[ { "docstring": "回答课程 uj 是否是课程 vj 的先决条件。", "name": "checkIfPrerequisite", "signature": "def checkIfPrerequisite(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]" }, { "docstring": "回答课程 uj 是否是课程 vj 的先决条件。", "name": "checkIfPrerequisite2", "signature": ...
2
stack_v2_sparse_classes_30k_train_044352
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkIfPrerequisite(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]: 回答课程 uj 是否是课程 vj 的先决条件。 - def checkIfPrerequisite2(self, n: int, pr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkIfPrerequisite(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]: 回答课程 uj 是否是课程 vj 的先决条件。 - def checkIfPrerequisite2(self, n: int, pr...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def checkIfPrerequisite(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]: """回答课程 uj 是否是课程 vj 的先决条件。""" <|body_0|> def checkIfPrerequisite2(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def checkIfPrerequisite(self, n: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]: """回答课程 uj 是否是课程 vj 的先决条件。""" adjList = [[] for _ in range(n)] deg = [0] * n for cur, pre in prerequisites: adjList[pre].append(cur) ...
the_stack_v2_python_sparse
7_graph/带权图最短路和最小生成树/floyd多源/1462. 课程表 IV.py
981377660LMT/algorithm-study
train
225
9d13f71e4e419964ca485a084ccae702002c48e8
[ "self.mModel = model\nself.mModel_2 = model_2\nself.mView = MainWindow(self.mModel, self.mModel_2, self)\nself.mView.show()", "print('Controller, start_inductor_calculation')\ninductor_parameters = self.mView.get_inductor_parameters()\ninductor_parameters['type'] = 'inductor'\ntry:\n self.mModel.set_data_from_...
<|body_start_0|> self.mModel = model self.mModel_2 = model_2 self.mView = MainWindow(self.mModel, self.mModel_2, self) self.mView.show() <|end_body_0|> <|body_start_1|> print('Controller, start_inductor_calculation') inductor_parameters = self.mView.get_inductor_paramete...
MiomContrioller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MiomContrioller: def __init__(self, model, model_2): """Принимает ссылку на модель. Создает и отображает внешний вид (gui) приложения :param model: ссылка на модель""" <|body_0|> def start_inductor_calculation(self): """Расчет индуктора :return:""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_067709
6,829
no_license
[ { "docstring": "Принимает ссылку на модель. Создает и отображает внешний вид (gui) приложения :param model: ссылка на модель", "name": "__init__", "signature": "def __init__(self, model, model_2)" }, { "docstring": "Расчет индуктора :return:", "name": "start_inductor_calculation", "signa...
5
null
Implement the Python class `MiomContrioller` described below. Class description: Implement the MiomContrioller class. Method signatures and docstrings: - def __init__(self, model, model_2): Принимает ссылку на модель. Создает и отображает внешний вид (gui) приложения :param model: ссылка на модель - def start_inducto...
Implement the Python class `MiomContrioller` described below. Class description: Implement the MiomContrioller class. Method signatures and docstrings: - def __init__(self, model, model_2): Принимает ссылку на модель. Создает и отображает внешний вид (gui) приложения :param model: ссылка на модель - def start_inducto...
cea9865ea834da01c9da367d29ea91f24da13380
<|skeleton|> class MiomContrioller: def __init__(self, model, model_2): """Принимает ссылку на модель. Создает и отображает внешний вид (gui) приложения :param model: ссылка на модель""" <|body_0|> def start_inductor_calculation(self): """Расчет индуктора :return:""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MiomContrioller: def __init__(self, model, model_2): """Принимает ссылку на модель. Создает и отображает внешний вид (gui) приложения :param model: ссылка на модель""" self.mModel = model self.mModel_2 = model_2 self.mView = MainWindow(self.mModel, self.mModel_2, self) ...
the_stack_v2_python_sparse
Python/controller/MiomController.py
Kroshy1984/MIOM
train
0
1e860fb837123697ff4af0713ecba6bb8ce4b80f
[ "sn = len(s)\npn = len(p)\ndp = [[False] * (pn + 1) for _ in range(sn + 1)]\ndp[0][0] = True\nfor j in range(1, pn + 1):\n if p[j - 1] == '*':\n dp[0][j] = dp[0][j - 1]\nfor i in range(1, sn + 1):\n for j in range(1, pn + 1):\n if s[i - 1] == p[j - 1] or p[j - 1] == '?':\n dp[i][j] = ...
<|body_start_0|> sn = len(s) pn = len(p) dp = [[False] * (pn + 1) for _ in range(sn + 1)] dp[0][0] = True for j in range(1, pn + 1): if p[j - 1] == '*': dp[0][j] = dp[0][j - 1] for i in range(1, sn + 1): for j in range(1, pn + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMatch(self, s, p): """动态规划""" <|body_0|> def isMatch1(self, s, p): """双指针法""" <|body_1|> <|end_skeleton|> <|body_start_0|> sn = len(s) pn = len(p) dp = [[False] * (pn + 1) for _ in range(sn + 1)] dp[0][0] = Tr...
stack_v2_sparse_classes_75kplus_train_067710
1,627
no_license
[ { "docstring": "动态规划", "name": "isMatch", "signature": "def isMatch(self, s, p)" }, { "docstring": "双指针法", "name": "isMatch1", "signature": "def isMatch1(self, s, p)" } ]
2
stack_v2_sparse_classes_30k_train_049666
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): 动态规划 - def isMatch1(self, s, p): 双指针法
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): 动态规划 - def isMatch1(self, s, p): 双指针法 <|skeleton|> class Solution: def isMatch(self, s, p): """动态规划""" <|body_0|> def isMatch1...
3f4284330f9771037ca59e2e6a94122e51e58540
<|skeleton|> class Solution: def isMatch(self, s, p): """动态规划""" <|body_0|> def isMatch1(self, s, p): """双指针法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isMatch(self, s, p): """动态规划""" sn = len(s) pn = len(p) dp = [[False] * (pn + 1) for _ in range(sn + 1)] dp[0][0] = True for j in range(1, pn + 1): if p[j - 1] == '*': dp[0][j] = dp[0][j - 1] for i in range(1, sn...
the_stack_v2_python_sparse
Leetcode/44.通配符匹配.py
myf-algorithm/Leetcode
train
1
b49f9d70d758291e37b61df276128e943eb5a185
[ "ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance)\nself.component_name = PREPROCESSOR\nself.DIR_PRE = os.path.join(TTK_ROOT, 'components', 'preprocessing')\nself.CREATION_EXTENSION = 'txt'\nself.RETRIEVAL_EXTENSION = 'cnk2'", "self.create_fragments(self.tag, remove_tags=True)\nself.process_fragments(...
<|body_start_0|> ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance) self.component_name = PREPROCESSOR self.DIR_PRE = os.path.join(TTK_ROOT, 'components', 'preprocessing') self.CREATION_EXTENSION = 'txt' self.RETRIEVAL_EXTENSION = 'cnk2' <|end_body_0|> <|body_start_1|...
Wrapper for the preprocessing components. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_PRE - directry where the preprocessor code lives see ComponentWrapper for other variables.
PreprocessorWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreprocessorWrapper: """Wrapper for the preprocessing components. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_PRE - directry where the preprocessor code lives see ComponentWrapper for other variables.""" def __init__(self, tag, xmldoc, tarsqi_...
stack_v2_sparse_classes_75kplus_train_067711
5,172
no_license
[ { "docstring": "Calls __init__ of the base class and sets component_name, DIR_PRE, CREATION_EXTENSION and RETRIEVAL_EXTENSION.", "name": "__init__", "signature": "def __init__(self, tag, xmldoc, tarsqi_instance)" }, { "docstring": "This is one of the few components that overwrites the base class...
6
stack_v2_sparse_classes_30k_train_017988
Implement the Python class `PreprocessorWrapper` described below. Class description: Wrapper for the preprocessing components. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_PRE - directry where the preprocessor code lives see ComponentWrapper for other variables. Method ...
Implement the Python class `PreprocessorWrapper` described below. Class description: Wrapper for the preprocessing components. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_PRE - directry where the preprocessor code lives see ComponentWrapper for other variables. Method ...
efb55fa054e2313fd710939330a4fbda5634cb41
<|skeleton|> class PreprocessorWrapper: """Wrapper for the preprocessing components. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_PRE - directry where the preprocessor code lives see ComponentWrapper for other variables.""" def __init__(self, tag, xmldoc, tarsqi_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PreprocessorWrapper: """Wrapper for the preprocessing components. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_PRE - directry where the preprocessor code lives see ComponentWrapper for other variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): ...
the_stack_v2_python_sparse
code/components/preprocessing/wrapper.py
tankle/TARSQI
train
1
68a6ada51916da01cfa504b14c7168c4209b108a
[ "s = Selector(response)\njobs = s.css(self.job_selector)\nfor job in jobs:\n joblink = job.xpath('h2/a/@href').extract_first()\n if not joblink:\n continue\n item = JobItem()\n item['url'] = urljoin(self.root, joblink)\n item['title'] = job.xpath('h2/a/@title').extract_first()\n item['text'...
<|body_start_0|> s = Selector(response) jobs = s.css(self.job_selector) for job in jobs: joblink = job.xpath('h2/a/@href').extract_first() if not joblink: continue item = JobItem() item['url'] = urljoin(self.root, joblink) ...
Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.
IndeedSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndeedSpider: """Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.""" def parse(self, response): """Get the joblinks and hand them off.""" <|body_0|> def parse_job(self, response): """Parse a joblink into a JobItem."""...
stack_v2_sparse_classes_75kplus_train_067712
1,990
no_license
[ { "docstring": "Get the joblinks and hand them off.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse a joblink into a JobItem.", "name": "parse_job", "signature": "def parse_job(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_002751
Implement the Python class `IndeedSpider` described below. Class description: Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads. Method signatures and docstrings: - def parse(self, response): Get the joblinks and hand them off. - def parse_job(self, response): Parse a jobli...
Implement the Python class `IndeedSpider` described below. Class description: Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads. Method signatures and docstrings: - def parse(self, response): Get the joblinks and hand them off. - def parse_job(self, response): Parse a jobli...
f6a8415d4812d7e52760bff5002b14a748f496ca
<|skeleton|> class IndeedSpider: """Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.""" def parse(self, response): """Get the joblinks and hand them off.""" <|body_0|> def parse_job(self, response): """Parse a joblink into a JobItem."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IndeedSpider: """Spider for indeed.com This is a simple site with a single page of jobs, with links to the ads.""" def parse(self, response): """Get the joblinks and hand them off.""" s = Selector(response) jobs = s.css(self.job_selector) for job in jobs: jobli...
the_stack_v2_python_sparse
remotor/spiders/indeed.py
rongyj/remotor
train
0
be96b9bf484a3a706e5cb39905bd52c347828982
[ "perm = CanEditIfOwner()\nfor method in ('GET', 'HEAD', 'OPTIONS'):\n request = Mock(method=method)\n with mute_signals(post_save):\n profile = ProfileFactory.create()\n assert perm.has_object_permission(request, None, profile)", "perm = CanEditIfOwner()\nfor method in ('POST', 'PATCH', 'PUT'):\n ...
<|body_start_0|> perm = CanEditIfOwner() for method in ('GET', 'HEAD', 'OPTIONS'): request = Mock(method=method) with mute_signals(post_save): profile = ProfileFactory.create() assert perm.has_object_permission(request, None, profile) <|end_body_0|> <...
Tests for CanEditIfOwner permissions
CanEditIfOwnerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CanEditIfOwnerTests: """Tests for CanEditIfOwner permissions""" def test_allow_nonedit(self): """Users are allowed to use safe methods without owning the profile.""" <|body_0|> def test_edit_if_owner(self): """Users are allowed to edit their own profile""" ...
stack_v2_sparse_classes_75kplus_train_067713
7,670
permissive
[ { "docstring": "Users are allowed to use safe methods without owning the profile.", "name": "test_allow_nonedit", "signature": "def test_allow_nonedit(self)" }, { "docstring": "Users are allowed to edit their own profile", "name": "test_edit_if_owner", "signature": "def test_edit_if_owne...
3
stack_v2_sparse_classes_30k_train_013263
Implement the Python class `CanEditIfOwnerTests` described below. Class description: Tests for CanEditIfOwner permissions Method signatures and docstrings: - def test_allow_nonedit(self): Users are allowed to use safe methods without owning the profile. - def test_edit_if_owner(self): Users are allowed to edit their ...
Implement the Python class `CanEditIfOwnerTests` described below. Class description: Tests for CanEditIfOwner permissions Method signatures and docstrings: - def test_allow_nonedit(self): Users are allowed to use safe methods without owning the profile. - def test_edit_if_owner(self): Users are allowed to edit their ...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class CanEditIfOwnerTests: """Tests for CanEditIfOwner permissions""" def test_allow_nonedit(self): """Users are allowed to use safe methods without owning the profile.""" <|body_0|> def test_edit_if_owner(self): """Users are allowed to edit their own profile""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CanEditIfOwnerTests: """Tests for CanEditIfOwner permissions""" def test_allow_nonedit(self): """Users are allowed to use safe methods without owning the profile.""" perm = CanEditIfOwner() for method in ('GET', 'HEAD', 'OPTIONS'): request = Mock(method=method) ...
the_stack_v2_python_sparse
profiles/permissions_test.py
mitodl/micromasters
train
35
001d52c1f8244b72f82d25a0ab536d13f7a82d7b
[ "super().__init__(coordinator)\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, str(coordinator.gios.station_id))}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(station_id=coordinator.gios.station_id))\nself._attr_unique_id = f'{coordinator.gios.st...
<|body_start_0|> super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, str(coordinator.gios.station_id))}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(station_id=coordinator.gios.station_id)) self._attr_...
Define an GIOS sensor.
GiosSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GiosSensor: """Define an GIOS sensor.""" def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: """Initialize.""" <|body_0|> def extra_state_attributes(self) -> dict[str, Any]: """Return the state ...
stack_v2_sparse_classes_75kplus_train_067714
6,871
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None" }, { "docstring": "Return the state attributes.", "name": "extra_state_attributes", "signature": "def e...
3
stack_v2_sparse_classes_30k_train_034313
Implement the Python class `GiosSensor` described below. Class description: Define an GIOS sensor. Method signatures and docstrings: - def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: Initialize. - def extra_state_attributes(self) -> dict[str, An...
Implement the Python class `GiosSensor` described below. Class description: Define an GIOS sensor. Method signatures and docstrings: - def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: Initialize. - def extra_state_attributes(self) -> dict[str, An...
bfa315be51371a1b63e04342a0b275a57ae148bd
<|skeleton|> class GiosSensor: """Define an GIOS sensor.""" def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: """Initialize.""" <|body_0|> def extra_state_attributes(self) -> dict[str, Any]: """Return the state ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GiosSensor: """Define an GIOS sensor.""" def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: """Initialize.""" super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE,...
the_stack_v2_python_sparse
homeassistant/components/gios/sensor.py
bdraco/home-assistant
train
13
05539d9636236140cbb9aa9561f74db57fc9e96b
[ "super(GlobalAndArmCommonTowerNetwork, self).__init__(input_tensor_spec=observation_spec, state_spec=(), name=name)\nself._global_network = global_network\nself._arm_network = arm_network\nself._common_network = common_network", "global_obs = observation[bandit_spec_utils.GLOBAL_FEATURE_KEY]\narm_obs = observatio...
<|body_start_0|> super(GlobalAndArmCommonTowerNetwork, self).__init__(input_tensor_spec=observation_spec, state_spec=(), name=name) self._global_network = global_network self._arm_network = arm_network self._common_network = common_network <|end_body_0|> <|body_start_1|> global_...
A network that takes global and arm observations and outputs rewards. This network takes the output of the global and per-arm networks, and leads them through a common network, that in turn outputs reward estimates.
GlobalAndArmCommonTowerNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalAndArmCommonTowerNetwork: """A network that takes global and arm observations and outputs rewards. This network takes the output of the global and per-arm networks, and leads them through a common network, that in turn outputs reward estimates.""" def __init__(self, observation_spec: t...
stack_v2_sparse_classes_75kplus_train_067715
13,061
permissive
[ { "docstring": "Initializes an instance of `GlobalAndArmCommonTowerNetwork`. The network architecture contains networks for both the global and the arm features. The outputs of these networks are concatenated and led through a third (common) network which in turn outputs reward estimates. Args: observation_spec...
2
stack_v2_sparse_classes_30k_train_023078
Implement the Python class `GlobalAndArmCommonTowerNetwork` described below. Class description: A network that takes global and arm observations and outputs rewards. This network takes the output of the global and per-arm networks, and leads them through a common network, that in turn outputs reward estimates. Method...
Implement the Python class `GlobalAndArmCommonTowerNetwork` described below. Class description: A network that takes global and arm observations and outputs rewards. This network takes the output of the global and per-arm networks, and leads them through a common network, that in turn outputs reward estimates. Method...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class GlobalAndArmCommonTowerNetwork: """A network that takes global and arm observations and outputs rewards. This network takes the output of the global and per-arm networks, and leads them through a common network, that in turn outputs reward estimates.""" def __init__(self, observation_spec: t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GlobalAndArmCommonTowerNetwork: """A network that takes global and arm observations and outputs rewards. This network takes the output of the global and per-arm networks, and leads them through a common network, that in turn outputs reward estimates.""" def __init__(self, observation_spec: types.NestedTe...
the_stack_v2_python_sparse
tf_agents/bandits/networks/global_and_arm_feature_network.py
tensorflow/agents
train
2,755
975c513fb390cf934b4c683289d0a80c97bc8644
[ "context = super(PendingEntryListView, self).get_context_data(**kwargs)\ncontext['num_entries'] = self.get_queryset().count()\ncontext['unapproved'] = True\ncontext['entries'] = Entry.objects.filter(version=self.version)\nreturn context", "if self.queryset is None:\n project_slug = self.kwargs.get('project_slu...
<|body_start_0|> context = super(PendingEntryListView, self).get_context_data(**kwargs) context['num_entries'] = self.get_queryset().count() context['unapproved'] = True context['entries'] = Entry.objects.filter(version=self.version) return context <|end_body_0|> <|body_start_1|...
List view for pending Entry.
PendingEntryListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PendingEntryListView: """List view for pending Entry.""" def get_context_data(self, **kwargs): """Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template...
stack_v2_sparse_classes_75kplus_train_067716
13,902
no_license
[ { "docstring": "Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template. :rtype: dict", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, ...
2
stack_v2_sparse_classes_30k_train_002817
Implement the Python class `PendingEntryListView` described below. Class description: List view for pending Entry. Method signatures and docstrings: - def get_context_data(self, **kwargs): Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :r...
Implement the Python class `PendingEntryListView` described below. Class description: List view for pending Entry. Method signatures and docstrings: - def get_context_data(self, **kwargs): Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :r...
ca489c38fdfde29f75c9c1e7f4b4c55d78d91c79
<|skeleton|> class PendingEntryListView: """List view for pending Entry.""" def get_context_data(self, **kwargs): """Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PendingEntryListView: """List view for pending Entry.""" def get_context_data(self, **kwargs): """Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template. :rtype: dic...
the_stack_v2_python_sparse
django_project/changes/views/entry.py
gitter-badger/projecta
train
0
11bc4a9a07feb860f7344d807e54add28090193a
[ "json_str = session_details.to_json()\nwith open(session_details_file_path, 'w') as outfile:\n json.dump(json_str, outfile, sort_keys=False, indent=4, separators=(',', ': '), ensure_ascii=False)", "try:\n with open(session_file_path) as data_file:\n data_loaded = json.load(data_file)\n session...
<|body_start_0|> json_str = session_details.to_json() with open(session_details_file_path, 'w') as outfile: json.dump(json_str, outfile, sort_keys=False, indent=4, separators=(',', ': '), ensure_ascii=False) <|end_body_0|> <|body_start_1|> try: with open(session_file_pat...
- Reads and writes the file that contains the session details.
SessionRW
[ "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionRW: """- Reads and writes the file that contains the session details.""" def write_session_details_file(session_details_file_path: str, session_details: SessionDetails): """- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails in...
stack_v2_sparse_classes_75kplus_train_067717
1,810
permissive
[ { "docstring": "- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails instance. :param session_details: SessionDetails instance.", "name": "write_session_details_file", "signature": "def write_session_details_file(session_details_file_path: str, session_de...
2
stack_v2_sparse_classes_30k_train_025688
Implement the Python class `SessionRW` described below. Class description: - Reads and writes the file that contains the session details. Method signatures and docstrings: - def write_session_details_file(session_details_file_path: str, session_details: SessionDetails): - Writes the file that contains the session det...
Implement the Python class `SessionRW` described below. Class description: - Reads and writes the file that contains the session details. Method signatures and docstrings: - def write_session_details_file(session_details_file_path: str, session_details: SessionDetails): - Writes the file that contains the session det...
138c7fa83e084ccb8f5c2ad8827f1fbb2527c00c
<|skeleton|> class SessionRW: """- Reads and writes the file that contains the session details.""" def write_session_details_file(session_details_file_path: str, session_details: SessionDetails): """- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SessionRW: """- Reads and writes the file that contains the session details.""" def write_session_details_file(session_details_file_path: str, session_details: SessionDetails): """- Writes the file that contains the session details. :param session_details_file_path: NewFileDetails instance. :para...
the_stack_v2_python_sparse
file_experts/session_rw.py
iliesidaniel/image-classification
train
0
621f6c9e90837346e3f9d30bac102d91a0d37551
[ "self.country = country\nself.url = 'https://m.douban.com/rexxar/api/v2/subject_collection/filter_tv_{}_hot/items?start={}&count=18'\nself.headers = {'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1', 'Referer': 'htt...
<|body_start_0|> self.country = country self.url = 'https://m.douban.com/rexxar/api/v2/subject_collection/filter_tv_{}_hot/items?start={}&count=18' self.headers = {'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B...
豆瓣电视爬虫
TvSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TvSpider: """豆瓣电视爬虫""" def __init__(self, country): """爬虫类的初始化 :param country: 要爬去的国家,命名需与豆瓣的相契合""" <|body_0|> def write_data(self, file_dict, filename): """定义文件写入函数 传入一个字典 和文件名""" <|body_1|> def parse_url(self, url): """请求网址 获取返回的json数据""" ...
stack_v2_sparse_classes_75kplus_train_067718
5,963
no_license
[ { "docstring": "爬虫类的初始化 :param country: 要爬去的国家,命名需与豆瓣的相契合", "name": "__init__", "signature": "def __init__(self, country)" }, { "docstring": "定义文件写入函数 传入一个字典 和文件名", "name": "write_data", "signature": "def write_data(self, file_dict, filename)" }, { "docstring": "请求网址 获取返回的json数据"...
4
stack_v2_sparse_classes_30k_train_023401
Implement the Python class `TvSpider` described below. Class description: 豆瓣电视爬虫 Method signatures and docstrings: - def __init__(self, country): 爬虫类的初始化 :param country: 要爬去的国家,命名需与豆瓣的相契合 - def write_data(self, file_dict, filename): 定义文件写入函数 传入一个字典 和文件名 - def parse_url(self, url): 请求网址 获取返回的json数据 - def run(self): 爬取...
Implement the Python class `TvSpider` described below. Class description: 豆瓣电视爬虫 Method signatures and docstrings: - def __init__(self, country): 爬虫类的初始化 :param country: 要爬去的国家,命名需与豆瓣的相契合 - def write_data(self, file_dict, filename): 定义文件写入函数 传入一个字典 和文件名 - def parse_url(self, url): 请求网址 获取返回的json数据 - def run(self): 爬取...
45fccf8a293a87b079c106274c59f990adef456a
<|skeleton|> class TvSpider: """豆瓣电视爬虫""" def __init__(self, country): """爬虫类的初始化 :param country: 要爬去的国家,命名需与豆瓣的相契合""" <|body_0|> def write_data(self, file_dict, filename): """定义文件写入函数 传入一个字典 和文件名""" <|body_1|> def parse_url(self, url): """请求网址 获取返回的json数据""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TvSpider: """豆瓣电视爬虫""" def __init__(self, country): """爬虫类的初始化 :param country: 要爬去的国家,命名需与豆瓣的相契合""" self.country = country self.url = 'https://m.douban.com/rexxar/api/v2/subject_collection/filter_tv_{}_hot/items?start={}&count=18' self.headers = {'User-Agent': 'Mozilla/5.0...
the_stack_v2_python_sparse
day03/douban.py
heyhpython/spider_project
train
0
98d2286088ace086eb756f23eb263c882928e2f5
[ "if errors is None or len(errors) <= 0:\n errors = (Exception,)\nself._errors = errors\nself._log = options.get('log', True)\nsuper().__init__()", "suppressed = isinstance(exc_value, self._errors)\nif suppressed is True and self._log is True:\n logging_services.exception(str(exc_value))\nreturn suppressed" ...
<|body_start_0|> if errors is None or len(errors) <= 0: errors = (Exception,) self._errors = errors self._log = options.get('log', True) super().__init__() <|end_body_0|> <|body_start_1|> suppressed = isinstance(exc_value, self._errors) if suppressed is True ...
context manager to suppress any exceptions and logs them. for example: def service1(): with suppress(): raise Exception('Error Occurred') def service2(): with suppress(ValueError, TypeError, log=False): raise ValueError('Error Occurred')
suppress
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class suppress: """context manager to suppress any exceptions and logs them. for example: def service1(): with suppress(): raise Exception('Error Occurred') def service2(): with suppress(ValueError, TypeError, log=False): raise ValueError('Error Occurred')""" def __init__(self, *errors, **options)...
stack_v2_sparse_classes_75kplus_train_067719
1,832
permissive
[ { "docstring": "initializes an instance of suppress. :param type[Exception] errors: exception types to be suppressed. if not provided, all exceptions will be suppressed. :keyword bool log: log suppressed exceptions. defaults to True if not provided.", "name": "__init__", "signature": "def __init__(self,...
2
stack_v2_sparse_classes_30k_train_032239
Implement the Python class `suppress` described below. Class description: context manager to suppress any exceptions and logs them. for example: def service1(): with suppress(): raise Exception('Error Occurred') def service2(): with suppress(ValueError, TypeError, log=False): raise ValueError('Error Occurred') Method...
Implement the Python class `suppress` described below. Class description: context manager to suppress any exceptions and logs them. for example: def service1(): with suppress(): raise Exception('Error Occurred') def service2(): with suppress(ValueError, TypeError, log=False): raise ValueError('Error Occurred') Method...
9d4776498225de4f3d16a4600b5b19212abe8562
<|skeleton|> class suppress: """context manager to suppress any exceptions and logs them. for example: def service1(): with suppress(): raise Exception('Error Occurred') def service2(): with suppress(ValueError, TypeError, log=False): raise ValueError('Error Occurred')""" def __init__(self, *errors, **options)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class suppress: """context manager to suppress any exceptions and logs them. for example: def service1(): with suppress(): raise Exception('Error Occurred') def service2(): with suppress(ValueError, TypeError, log=False): raise ValueError('Error Occurred')""" def __init__(self, *errors, **options): """...
the_stack_v2_python_sparse
src/pyrin/logging/contexts.py
mononobi/pyrin
train
20
620d3176dc92fcc9c95323c4a6a2069b136f9749
[ "self.name = name\nself.output_format = output_format\nself.parameters = parameters\nself.subject_line = subject_line\nself.mtype = mtype", "if dictionary is None:\n return None\nname = dictionary.get('name')\noutput_format = dictionary.get('outputFormat')\nparameters = cohesity_management_sdk.models.scheduler...
<|body_start_0|> self.name = name self.output_format = output_format self.parameters = parameters self.subject_line = subject_line self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None name = dictionary.get('name') ...
Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report' model. Specifies the type and parameters of a report. Attributes: name (string): Specifies the report name. output_format (string): Specifies the output format of the report. parameters ( SchedulerProto_SchedulerJob_Sche...
SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report: """Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report' model. Specifies the type and parameters of a report. Attributes: name (string): Specifies the report name. output_fo...
stack_v2_sparse_classes_75kplus_train_067720
2,862
permissive
[ { "docstring": "Constructor for the SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report class", "name": "__init__", "signature": "def __init__(self, name=None, output_format=None, parameters=None, subject_line=None, mtype=None)" }, { "docstring": "Creates an instance of t...
2
stack_v2_sparse_classes_30k_train_044540
Implement the Python class `SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report` described below. Class description: Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report' model. Specifies the type and parameters of a report. Attributes: name (string...
Implement the Python class `SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report` described below. Class description: Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report' model. Specifies the type and parameters of a report. Attributes: name (string...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report: """Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report' model. Specifies the type and parameters of a report. Attributes: name (string): Specifies the report name. output_fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report: """Implementation of the 'SchedulerProto_SchedulerJob_ScheduleJobParameters_ReportJobParameter_Report' model. Specifies the type and parameters of a report. Attributes: name (string): Specifies the report name. output_format (string)...
the_stack_v2_python_sparse
cohesity_management_sdk/models/scheduler_proto_scheduler_job_schedule__report.py
cohesity/management-sdk-python
train
24
0942aa7b669d6c40ac4efc7e054fd9a3e825eedc
[ "super().__init__(*args, **kwargs)\nself.fields['name'].widget.attrs.update({'class': 'w3-input w3-border', 'style': 'width:20em; display:inline-block;'})\nself.fields['description'].widget.attrs.update({'class': 'w3-input w3-border', 'rows': 3})\nself.fields['program_type'].widget.attrs.update({'class': 'w3-select...
<|body_start_0|> super().__init__(*args, **kwargs) self.fields['name'].widget.attrs.update({'class': 'w3-input w3-border', 'style': 'width:20em; display:inline-block;'}) self.fields['description'].widget.attrs.update({'class': 'w3-input w3-border', 'rows': 3}) self.fields['program_type']...
Default Model Form
ProgramModelForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgramModelForm: """Default Model Form""" def __init__(self, *args, **kwargs): """Update field definitions with custom attributes""" <|body_0|> def clean_time_start(self): """Raise error if field is required but empty""" <|body_1|> def clean_duratio...
stack_v2_sparse_classes_75kplus_train_067721
7,909
no_license
[ { "docstring": "Update field definitions with custom attributes", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Raise error if field is required but empty", "name": "clean_time_start", "signature": "def clean_time_start(self)" }, { "doc...
4
stack_v2_sparse_classes_30k_train_022843
Implement the Python class `ProgramModelForm` described below. Class description: Default Model Form Method signatures and docstrings: - def __init__(self, *args, **kwargs): Update field definitions with custom attributes - def clean_time_start(self): Raise error if field is required but empty - def clean_duration(se...
Implement the Python class `ProgramModelForm` described below. Class description: Default Model Form Method signatures and docstrings: - def __init__(self, *args, **kwargs): Update field definitions with custom attributes - def clean_time_start(self): Raise error if field is required but empty - def clean_duration(se...
9efd022b6dda81e4088dd78036d652cd88d8214a
<|skeleton|> class ProgramModelForm: """Default Model Form""" def __init__(self, *args, **kwargs): """Update field definitions with custom attributes""" <|body_0|> def clean_time_start(self): """Raise error if field is required but empty""" <|body_1|> def clean_duratio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProgramModelForm: """Default Model Form""" def __init__(self, *args, **kwargs): """Update field definitions with custom attributes""" super().__init__(*args, **kwargs) self.fields['name'].widget.attrs.update({'class': 'w3-input w3-border', 'style': 'width:20em; display:inline-bloc...
the_stack_v2_python_sparse
programs/forms.py
leventerevesz/irrigation-server
train
0
b0247f27ac68e68b18ccf8ef0e6491f10ca8052a
[ "self.X = X\nself.m = m\nself.samples = samples\nself.num_datapoints = X.shape[0]", "u_samples = []\nfor s in self.samples:\n self.m.set_state(s)\n u_samples.append(self.m.predict_f_samples(self.X, 1))\nu_samples = np.vstack(u_samples)\nu = u_samples[:, :, 0]\nreturn u", "g_samples = []\nfor s in self.sam...
<|body_start_0|> self.X = X self.m = m self.samples = samples self.num_datapoints = X.shape[0] <|end_body_0|> <|body_start_1|> u_samples = [] for s in self.samples: self.m.set_state(s) u_samples.append(self.m.predict_f_samples(self.X, 1)) ...
Predict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predict: def __init__(self, X, m, samples): """Predicting the required posterior utlity function and/or preference probability values. based on trained GPflow model described using: m: Trained gpflow model object (on training set) samples : posterior hyperparameters' values X: normalized...
stack_v2_sparse_classes_75kplus_train_067722
2,678
no_license
[ { "docstring": "Predicting the required posterior utlity function and/or preference probability values. based on trained GPflow model described using: m: Trained gpflow model object (on training set) samples : posterior hyperparameters' values X: normalized input feature values at which we want to make the pred...
5
stack_v2_sparse_classes_30k_train_034340
Implement the Python class `Predict` described below. Class description: Implement the Predict class. Method signatures and docstrings: - def __init__(self, X, m, samples): Predicting the required posterior utlity function and/or preference probability values. based on trained GPflow model described using: m: Trained...
Implement the Python class `Predict` described below. Class description: Implement the Predict class. Method signatures and docstrings: - def __init__(self, X, m, samples): Predicting the required posterior utlity function and/or preference probability values. based on trained GPflow model described using: m: Trained...
4642eab332a86140c95656277d59af0fe09a72fe
<|skeleton|> class Predict: def __init__(self, X, m, samples): """Predicting the required posterior utlity function and/or preference probability values. based on trained GPflow model described using: m: Trained gpflow model object (on training set) samples : posterior hyperparameters' values X: normalized...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Predict: def __init__(self, X, m, samples): """Predicting the required posterior utlity function and/or preference probability values. based on trained GPflow model described using: m: Trained gpflow model object (on training set) samples : posterior hyperparameters' values X: normalized input feature...
the_stack_v2_python_sparse
pref_actions/GPUnimodalPrefAct/predict.py
nawalgao/GPActToPref
train
0
2d86d4782d610f3d325c06000d3846a6b9879646
[ "try:\n try:\n pObject = PTJInfo.objects.get(id=pid)\n except:\n return JsonResponse({'status': False, 'err': '内容不存在'}, status=404)\n ptjResult = model_to_dict(pObject)\n return JsonResponse({'status': True, 'ptj': ptjResult})\nexcept:\n return JsonResponse({'status': False, 'err': '出现未...
<|body_start_0|> try: try: pObject = PTJInfo.objects.get(id=pid) except: return JsonResponse({'status': False, 'err': '内容不存在'}, status=404) ptjResult = model_to_dict(pObject) return JsonResponse({'status': True, 'ptj': ptjResult}) ...
PTJInfoView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PTJInfoView: def get(self, requests, pid): """获得兼职消息详情 :param requests: :param pid: ptj id :return:""" <|body_0|> def delete(self, requests, pid): """删除兼职消息 :param requests: :param pid: :return:""" <|body_1|> def post(self, requests): """新增兼职信息 :...
stack_v2_sparse_classes_75kplus_train_067723
2,987
no_license
[ { "docstring": "获得兼职消息详情 :param requests: :param pid: ptj id :return:", "name": "get", "signature": "def get(self, requests, pid)" }, { "docstring": "删除兼职消息 :param requests: :param pid: :return:", "name": "delete", "signature": "def delete(self, requests, pid)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_028697
Implement the Python class `PTJInfoView` described below. Class description: Implement the PTJInfoView class. Method signatures and docstrings: - def get(self, requests, pid): 获得兼职消息详情 :param requests: :param pid: ptj id :return: - def delete(self, requests, pid): 删除兼职消息 :param requests: :param pid: :return: - def po...
Implement the Python class `PTJInfoView` described below. Class description: Implement the PTJInfoView class. Method signatures and docstrings: - def get(self, requests, pid): 获得兼职消息详情 :param requests: :param pid: ptj id :return: - def delete(self, requests, pid): 删除兼职消息 :param requests: :param pid: :return: - def po...
526dea540048fc92260bce611c520c50af744e0b
<|skeleton|> class PTJInfoView: def get(self, requests, pid): """获得兼职消息详情 :param requests: :param pid: ptj id :return:""" <|body_0|> def delete(self, requests, pid): """删除兼职消息 :param requests: :param pid: :return:""" <|body_1|> def post(self, requests): """新增兼职信息 :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PTJInfoView: def get(self, requests, pid): """获得兼职消息详情 :param requests: :param pid: ptj id :return:""" try: try: pObject = PTJInfo.objects.get(id=pid) except: return JsonResponse({'status': False, 'err': '内容不存在'}, status=404) ...
the_stack_v2_python_sparse
apps/PTJ/views/PTJInfo.py
DICKQI/ALGYunXS
train
0
88f6a00540fdc3710155857954fd928e5e11e26e
[ "first_max = second_max = third_max = -float('inf')\nfor val in nums:\n if val in (first_max, second_max, third_max):\n continue\n elif val > first_max:\n third_max, second_max, first_max = (second_max, first_max, val)\n elif val > second_max:\n third_max, second_max = (second_max, val...
<|body_start_0|> first_max = second_max = third_max = -float('inf') for val in nums: if val in (first_max, second_max, third_max): continue elif val > first_max: third_max, second_max, first_max = (second_max, first_max, val) elif val >...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def thirdMax_first_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def third_max_second_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> first_max = second_...
stack_v2_sparse_classes_75kplus_train_067724
1,342
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "thirdMax_first_solution", "signature": "def thirdMax_first_solution(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "third_max_second_solution", "signature": "def third_max_second_solution(self, nums...
2
stack_v2_sparse_classes_30k_train_022825
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def thirdMax_first_solution(self, nums): :type nums: List[int] :rtype: int - def third_max_second_solution(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 thirdMax_first_solution(self, nums): :type nums: List[int] :rtype: int - def third_max_second_solution(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solu...
1e99e0852b8329bf699eb149e7dfe312f82144bc
<|skeleton|> class Solution: def thirdMax_first_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def third_max_second_solution(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def thirdMax_first_solution(self, nums): """:type nums: List[int] :rtype: int""" first_max = second_max = third_max = -float('inf') for val in nums: if val in (first_max, second_max, third_max): continue elif val > first_max: ...
the_stack_v2_python_sparse
easy/array/third_max/third_max.py
deepshig/leetcode-solutions
train
0
85ad0465045f6ea901e9c578c0571fc07211101f
[ "if question.data == '':\n raise ValidationError('必須です。')\nif len(question.data) > 255:\n raise ValidationError('255文字以内で入力してください。')", "if answer.data == '':\n raise ValidationError('必須です。')\nif len(answer.data) > 1000:\n raise ValidationError('1000文字以内で入力してください。')" ]
<|body_start_0|> if question.data == '': raise ValidationError('必須です。') if len(question.data) > 255: raise ValidationError('255文字以内で入力してください。') <|end_body_0|> <|body_start_1|> if answer.data == '': raise ValidationError('必須です。') if len(answer.data) > ...
FaqForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaqForm: def validate_question(self, question): """バリデーション - 必須 - 文字数の上限は255文字""" <|body_0|> def validate_answer(self, answer): """バリデーション - 必須 - 文字数の上限は1000文字""" <|body_1|> <|end_skeleton|> <|body_start_0|> if question.data == '': raise...
stack_v2_sparse_classes_75kplus_train_067725
965
permissive
[ { "docstring": "バリデーション - 必須 - 文字数の上限は255文字", "name": "validate_question", "signature": "def validate_question(self, question)" }, { "docstring": "バリデーション - 必須 - 文字数の上限は1000文字", "name": "validate_answer", "signature": "def validate_answer(self, answer)" } ]
2
stack_v2_sparse_classes_30k_train_037237
Implement the Python class `FaqForm` described below. Class description: Implement the FaqForm class. Method signatures and docstrings: - def validate_question(self, question): バリデーション - 必須 - 文字数の上限は255文字 - def validate_answer(self, answer): バリデーション - 必須 - 文字数の上限は1000文字
Implement the Python class `FaqForm` described below. Class description: Implement the FaqForm class. Method signatures and docstrings: - def validate_question(self, question): バリデーション - 必須 - 文字数の上限は255文字 - def validate_answer(self, answer): バリデーション - 必須 - 文字数の上限は1000文字 <|skeleton|> class FaqForm: def validate_...
8751fcb7fb9d46b023bd1fe33d734c58332d77e9
<|skeleton|> class FaqForm: def validate_question(self, question): """バリデーション - 必須 - 文字数の上限は255文字""" <|body_0|> def validate_answer(self, answer): """バリデーション - 必須 - 文字数の上限は1000文字""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FaqForm: def validate_question(self, question): """バリデーション - 必須 - 文字数の上限は255文字""" if question.data == '': raise ValidationError('必須です。') if len(question.data) > 255: raise ValidationError('255文字以内で入力してください。') def validate_answer(self, answer): """バリ...
the_stack_v2_python_sparse
chatbot/admin/helpers/forms/FaqForm.py
hysakhr/flask_chatbot
train
3
62da1c75cfc3b08a5c306e4bee070e1e3de30cf2
[ "self.food = deque(food)\nself.width = width\nself.height = height\nself.bodyQueue = deque([(0, 0)])\nself.hashSet = set([(0, 0)])\nself.score = 0\nself.moveOps = {'U': (-1, 0), 'D': (1, 0), 'L': (0, -1), 'R': (0, 1)}", "s = self.hashSet\nq = self.bodyQueue\nops = self.moveOps\nwidth = self.width\nheight = self.h...
<|body_start_0|> self.food = deque(food) self.width = width self.height = height self.bodyQueue = deque([(0, 0)]) self.hashSet = set([(0, 0)]) self.score = 0 self.moveOps = {'U': (-1, 0), 'D': (1, 0), 'L': (0, -1), 'R': (0, 1)} <|end_body_0|> <|body_start_1|> ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_75kplus_train_067726
15,245
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
stack_v2_sparse_classes_30k_train_025929
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
leetcode_python/Design/design-snake-game.py
yennanliu/CS_basics
train
64
3ba5bd285b047b66afcbf116c1e1beb32b00dc53
[ "try:\n return runJasperReportEditor(prj_filename)\nexcept:\n log_func.fatal(u'Error opening JasperReport project file <%s>' % prj_filename)\nreturn False", "try:\n if default_prj_filename is None:\n default_prj_filename = DEFAULT_REPORT_LANDSCAPE_FILENAME\n if new_prj_filename is None:\n ...
<|body_start_0|> try: return runJasperReportEditor(prj_filename) except: log_func.fatal(u'Error opening JasperReport project file <%s>' % prj_filename) return False <|end_body_0|> <|body_start_1|> try: if default_prj_filename is None: ...
JasperReport report generator manager.
iqJasperReportManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqJasperReportManager: """JasperReport report generator manager.""" def openProject(self, prj_filename): """Open project file. :param prj_filename: The full name of the project file. :return: True/False""" <|body_0|> def createProject(self, default_prj_filename=None, new...
stack_v2_sparse_classes_75kplus_train_067727
5,611
no_license
[ { "docstring": "Open project file. :param prj_filename: The full name of the project file. :return: True/False", "name": "openProject", "signature": "def openProject(self, prj_filename)" }, { "docstring": "Create a new project file. :param default_prj_filename: The default project file name. :pa...
3
stack_v2_sparse_classes_30k_train_026099
Implement the Python class `iqJasperReportManager` described below. Class description: JasperReport report generator manager. Method signatures and docstrings: - def openProject(self, prj_filename): Open project file. :param prj_filename: The full name of the project file. :return: True/False - def createProject(self...
Implement the Python class `iqJasperReportManager` described below. Class description: JasperReport report generator manager. Method signatures and docstrings: - def openProject(self, prj_filename): Open project file. :param prj_filename: The full name of the project file. :return: True/False - def createProject(self...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqJasperReportManager: """JasperReport report generator manager.""" def openProject(self, prj_filename): """Open project file. :param prj_filename: The full name of the project file. :return: True/False""" <|body_0|> def createProject(self, default_prj_filename=None, new...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class iqJasperReportManager: """JasperReport report generator manager.""" def openProject(self, prj_filename): """Open project file. :param prj_filename: The full name of the project file. :return: True/False""" try: return runJasperReportEditor(prj_filename) except: ...
the_stack_v2_python_sparse
iq/editor/jasper_report/jasperreport_manager.py
XHermitOne/iq_framework
train
1
1a00e7f6dbc7c39d4e077799185542ebfcfa4dd0
[ "if result_schema is None:\n return {}\nresult = result_schema.get_computed_entity_columns(entity, **options)\nif result is None:\n return {}\noptions.update(result_schema=result_schema)\nresult = serializer_services.serialize(result, **options)\nreturn result", "if result_schema is None:\n return {}\nre...
<|body_start_0|> if result_schema is None: return {} result = result_schema.get_computed_entity_columns(entity, **options) if result is None: return {} options.update(result_schema=result_schema) result = serializer_services.serialize(result, **options) ...
schema manager class.
SchemaManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaManager: """schema manager class.""" def get_computed_entity_columns(self, entity, result_schema=None, **options): """gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict s...
stack_v2_sparse_classes_75kplus_train_067728
2,114
permissive
[ { "docstring": "gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict should not contain any `BaseEntity` or `ROW_RESULT` values, otherwise a max recursion error may occur. :param BaseEntity entity: the actu...
2
stack_v2_sparse_classes_30k_train_003890
Implement the Python class `SchemaManager` described below. Class description: schema manager class. Method signatures and docstrings: - def get_computed_entity_columns(self, entity, result_schema=None, **options): gets a dict containing all computed columns to be added to the result. if `result_schema` is not provid...
Implement the Python class `SchemaManager` described below. Class description: schema manager class. Method signatures and docstrings: - def get_computed_entity_columns(self, entity, result_schema=None, **options): gets a dict containing all computed columns to be added to the result. if `result_schema` is not provid...
9d4776498225de4f3d16a4600b5b19212abe8562
<|skeleton|> class SchemaManager: """schema manager class.""" def get_computed_entity_columns(self, entity, result_schema=None, **options): """gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SchemaManager: """schema manager class.""" def get_computed_entity_columns(self, entity, result_schema=None, **options): """gets a dict containing all computed columns to be added to the result. if `result_schema` is not provided, it returns an empty dict. note that the result dict should not con...
the_stack_v2_python_sparse
src/pyrin/api/schema/manager.py
mononobi/pyrin
train
20
312b14cca3f430c4decd83f74726c343c8cae784
[ "self.channel = channel\nself.dc = rapport\nself.period = 20.0\nfreq = 1000.0 / self.period\nself.pwm = Adafruit_PCA9685.PCA9685()\nself.pwm.set_pwm(channel, 0, rapport * 4096)\nself.pwm.set_pwm_freq(freq)", "if angle <= 180:\n self.dc = (angle / 180 + 1) * 5\n self.pwm.set_pwm(self.channel, 0, self.dc * 40...
<|body_start_0|> self.channel = channel self.dc = rapport self.period = 20.0 freq = 1000.0 / self.period self.pwm = Adafruit_PCA9685.PCA9685() self.pwm.set_pwm(channel, 0, rapport * 4096) self.pwm.set_pwm_freq(freq) <|end_body_0|> <|body_start_1|> if angl...
Servomoteur
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Servomoteur: def __init__(self, channel, rapport): """Créer une instance de Servomoteur On en aura trois dans notre cas""" <|body_0|> def set_servo_pulse(self, angle): """1/Calcul du rapport cyclique correspondant à l'angle de rotation dont on veut que le servo posit...
stack_v2_sparse_classes_75kplus_train_067729
1,600
no_license
[ { "docstring": "Créer une instance de Servomoteur On en aura trois dans notre cas", "name": "__init__", "signature": "def __init__(self, channel, rapport)" }, { "docstring": "1/Calcul du rapport cyclique correspondant à l'angle de rotation dont on veut que le servo positionne le bras 2/Positionn...
2
null
Implement the Python class `Servomoteur` described below. Class description: Implement the Servomoteur class. Method signatures and docstrings: - def __init__(self, channel, rapport): Créer une instance de Servomoteur On en aura trois dans notre cas - def set_servo_pulse(self, angle): 1/Calcul du rapport cyclique cor...
Implement the Python class `Servomoteur` described below. Class description: Implement the Servomoteur class. Method signatures and docstrings: - def __init__(self, channel, rapport): Créer une instance de Servomoteur On en aura trois dans notre cas - def set_servo_pulse(self, angle): 1/Calcul du rapport cyclique cor...
5c91e6a5fb091b4b2df465957b7ce9d281b12abb
<|skeleton|> class Servomoteur: def __init__(self, channel, rapport): """Créer une instance de Servomoteur On en aura trois dans notre cas""" <|body_0|> def set_servo_pulse(self, angle): """1/Calcul du rapport cyclique correspondant à l'angle de rotation dont on veut que le servo posit...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Servomoteur: def __init__(self, channel, rapport): """Créer une instance de Servomoteur On en aura trois dans notre cas""" self.channel = channel self.dc = rapport self.period = 20.0 freq = 1000.0 / self.period self.pwm = Adafruit_PCA9685.PCA9685() self....
the_stack_v2_python_sparse
Fablab/codeSource/src/servo/control_servo.py
Villaquiranm/Fablab
train
1
76d7018000beb1395899c283c9337a14d1a6f293
[ "nums = str(N)\nfor num in nums:\n if num == '0' or N % int(num) != 0:\n return False\nreturn True", "sDN = []\nfor n in range(left, right + 1):\n if self.isselfDividingNumber(n):\n sDN.append(n)\nreturn sDN" ]
<|body_start_0|> nums = str(N) for num in nums: if num == '0' or N % int(num) != 0: return False return True <|end_body_0|> <|body_start_1|> sDN = [] for n in range(left, right + 1): if self.isselfDividingNumber(n): sDN.app...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isselfDividingNumber(self, N): """:type N: int :rtype: Bool""" <|body_0|> def selfDividingNumbers(self, left, right): """:type left: int :type right: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = str(N) ...
stack_v2_sparse_classes_75kplus_train_067730
582
no_license
[ { "docstring": ":type N: int :rtype: Bool", "name": "isselfDividingNumber", "signature": "def isselfDividingNumber(self, N)" }, { "docstring": ":type left: int :type right: int :rtype: List[int]", "name": "selfDividingNumbers", "signature": "def selfDividingNumbers(self, left, right)" ...
2
stack_v2_sparse_classes_30k_train_047174
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isselfDividingNumber(self, N): :type N: int :rtype: Bool - def selfDividingNumbers(self, left, right): :type left: int :type right: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isselfDividingNumber(self, N): :type N: int :rtype: Bool - def selfDividingNumbers(self, left, right): :type left: int :type right: int :rtype: List[int] <|skeleton|> class ...
9752533bc76ce5ecb881f61e33a3bc4b20dcf666
<|skeleton|> class Solution: def isselfDividingNumber(self, N): """:type N: int :rtype: Bool""" <|body_0|> def selfDividingNumbers(self, left, right): """:type left: int :type right: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isselfDividingNumber(self, N): """:type N: int :rtype: Bool""" nums = str(N) for num in nums: if num == '0' or N % int(num) != 0: return False return True def selfDividingNumbers(self, left, right): """:type left: int :type...
the_stack_v2_python_sparse
728. Self Dividing Numbers/728. Self Dividing Numbers.py
603lzy/LeetCode
train
3
37f3e84b4abfa2fb7be18fac9b05db8da0055e60
[ "if support_regional_security_policy or support_net_lb:\n cls.NAME_ARG = flags.PriorityArgument('describe')\n cls.NAME_ARG.AddArgument(parser, operation_type='describe', cust_metavar='PRIORITY')\n flags.AddRegionFlag(parser, 'describe')\n cls.SECURITY_POLICY_ARG = security_policy_flags.SecurityPolicyMul...
<|body_start_0|> if support_regional_security_policy or support_net_lb: cls.NAME_ARG = flags.PriorityArgument('describe') cls.NAME_ARG.AddArgument(parser, operation_type='describe', cust_metavar='PRIORITY') flags.AddRegionFlag(parser, 'describe') cls.SECURITY_POLI...
Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy
DescribeHelper
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DescribeHelper: """Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy""" def Args(cls, parser, support_regional_security_...
stack_v2_sparse_classes_75kplus_train_067731
7,354
permissive
[ { "docstring": "Generates the flagset for a Describe command.", "name": "Args", "signature": "def Args(cls, parser, support_regional_security_policy, support_net_lb)" }, { "docstring": "Validates arguments and describes a security policy rule.", "name": "Run", "signature": "def Run(cls, ...
2
stack_v2_sparse_classes_30k_train_025480
Implement the Python class `DescribeHelper` described below. Class description: Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy Method signature...
Implement the Python class `DescribeHelper` described below. Class description: Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy Method signature...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class DescribeHelper: """Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy""" def Args(cls, parser, support_regional_security_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DescribeHelper: """Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy""" def Args(cls, parser, support_regional_security_policy, suppo...
the_stack_v2_python_sparse
lib/surface/compute/security_policies/rules/describe.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
3af62537bf8d7036650c4a3ea80b7c9bca68863d
[ "if S == T:\n return 0\nroutes = [set(e) for e in routes]\nG = defaultdict(set)\nfor i in range(len(routes)):\n for j in range(i + 1, len(routes)):\n stops_1, stops_2 = (routes[i], routes[j])\n for stop in stops_1:\n if stop in stops_2:\n G[i].add(j)\n G[...
<|body_start_0|> if S == T: return 0 routes = [set(e) for e in routes] G = defaultdict(set) for i in range(len(routes)): for j in range(i + 1, len(routes)): stops_1, stops_2 = (routes[i], routes[j]) for stop in stops_1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numBusesToDestination(self, routes: List[List[int]], S: int, T: int) -> int: """BFS bus based nodes rather than stop based nodes BFS = O(|V| + |E|) = O(N + N^2), where N is number of routes Construction = O (N^2 * S), where S is number of stops""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_067732
3,313
no_license
[ { "docstring": "BFS bus based nodes rather than stop based nodes BFS = O(|V| + |E|) = O(N + N^2), where N is number of routes Construction = O (N^2 * S), where S is number of stops", "name": "numBusesToDestination", "signature": "def numBusesToDestination(self, routes: List[List[int]], S: int, T: int) -...
2
stack_v2_sparse_classes_30k_val_002961
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numBusesToDestination(self, routes: List[List[int]], S: int, T: int) -> int: BFS bus based nodes rather than stop based nodes BFS = O(|V| + |E|) = O(N + N^2), where N is numb...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numBusesToDestination(self, routes: List[List[int]], S: int, T: int) -> int: BFS bus based nodes rather than stop based nodes BFS = O(|V| + |E|) = O(N + N^2), where N is numb...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def numBusesToDestination(self, routes: List[List[int]], S: int, T: int) -> int: """BFS bus based nodes rather than stop based nodes BFS = O(|V| + |E|) = O(N + N^2), where N is number of routes Construction = O (N^2 * S), where S is number of stops""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numBusesToDestination(self, routes: List[List[int]], S: int, T: int) -> int: """BFS bus based nodes rather than stop based nodes BFS = O(|V| + |E|) = O(N + N^2), where N is number of routes Construction = O (N^2 * S), where S is number of stops""" if S == T: return 0 ...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/815 Bus Routes.py
syurskyi/Algorithms_and_Data_Structure
train
4
c2598d3a1b7a16b110ae76777ecffbd95c93a49e
[ "super().initialize()\nself.listen_event(self.arrived_home, 'PRESENCE_CHANGE', new=self.presence_manager.HomeStates.just_arrived.value, first=True, constrain_input_boolean=self.enabled_entity_id)\nself.listen_event(self.proximity_changed, 'PROXIMITY_CHANGE', constrain_input_boolean=self.enabled_entity_id)", "if s...
<|body_start_0|> super().initialize() self.listen_event(self.arrived_home, 'PRESENCE_CHANGE', new=self.presence_manager.HomeStates.just_arrived.value, first=True, constrain_input_boolean=self.enabled_entity_id) self.listen_event(self.proximity_changed, 'PROXIMITY_CHANGE', constrain_input_boolean...
Define a feature to adjust climate based on proximity to home.
AdjustOnProximity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdjustOnProximity: """Define a feature to adjust climate based on proximity to home.""" def initialize(self) -> None: """Initialize.""" <|body_0|> def proximity_changed(self, event_name: str, data: dict, kwargs: dict) -> None: """Respond to "PROXIMITY_CHANGE" eve...
stack_v2_sparse_classes_75kplus_train_067733
7,845
no_license
[ { "docstring": "Initialize.", "name": "initialize", "signature": "def initialize(self) -> None" }, { "docstring": "Respond to \"PROXIMITY_CHANGE\" events.", "name": "proximity_changed", "signature": "def proximity_changed(self, event_name: str, data: dict, kwargs: dict) -> None" }, {...
3
null
Implement the Python class `AdjustOnProximity` described below. Class description: Define a feature to adjust climate based on proximity to home. Method signatures and docstrings: - def initialize(self) -> None: Initialize. - def proximity_changed(self, event_name: str, data: dict, kwargs: dict) -> None: Respond to "...
Implement the Python class `AdjustOnProximity` described below. Class description: Define a feature to adjust climate based on proximity to home. Method signatures and docstrings: - def initialize(self) -> None: Initialize. - def proximity_changed(self, event_name: str, data: dict, kwargs: dict) -> None: Respond to "...
ed6ab27170e400d1e46c455b85d3a274a7189c72
<|skeleton|> class AdjustOnProximity: """Define a feature to adjust climate based on proximity to home.""" def initialize(self) -> None: """Initialize.""" <|body_0|> def proximity_changed(self, event_name: str, data: dict, kwargs: dict) -> None: """Respond to "PROXIMITY_CHANGE" eve...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdjustOnProximity: """Define a feature to adjust climate based on proximity to home.""" def initialize(self) -> None: """Initialize.""" super().initialize() self.listen_event(self.arrived_home, 'PRESENCE_CHANGE', new=self.presence_manager.HomeStates.just_arrived.value, first=True,...
the_stack_v2_python_sparse
appdaemon/settings/apps/climate.py
dturgel/smart-home
train
0
c8e603f6b43399cc855cdcd85f745a157135b6a7
[ "if not head:\n return False\nslow = head\nfast = head.next\nwhile fast:\n if slow.val == fast.val:\n return True\n if not fast.next:\n break\n slow = slow.next\n fast = fast.next\nreturn False", "if not head:\n return False\nwhile head:\n if head.val == 'sb':\n return Tr...
<|body_start_0|> if not head: return False slow = head fast = head.next while fast: if slow.val == fast.val: return True if not fast.next: break slow = slow.next fast = fast.next return Fa...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环""" <|body_0|> def hasCycle1(self, head): """:type head: ListNode :rtype: bool 骚解法: 将头节点定义成一个固定值,判断是否会再遇到这个值""" <|body_1|> <...
stack_v2_sparse_classes_75kplus_train_067734
1,322
no_license
[ { "docstring": ":type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool 骚解法: 将头节点定义成一个固定值,判断是否会再遇到这个值", "name": "hasCycle1", "signatu...
2
stack_v2_sparse_classes_30k_train_018664
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环 - def hasCycle1(self, head): :type head: ListNode :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环 - def hasCycle1(self, head): :type head: ListNode :rtype...
a3a1556abc5adb9325de54d64f9814e64b96db0f
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环""" <|body_0|> def hasCycle1(self, head): """:type head: ListNode :rtype: bool 骚解法: 将头节点定义成一个固定值,判断是否会再遇到这个值""" <|body_1|> <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环""" if not head: return False slow = head fast = head.next while fast: if slow.val == fast.val: ...
the_stack_v2_python_sparse
DSD/linke_list/hascycle.py
BigerWANG/geek_algorithm
train
0
74ccfc06890c6d2002c08f8d7543e33196a5170d
[ "self.adult = -1\nself.children = 0\nself.infants = 0\ncurrent_year = datetime.now().year\ntry:\n for passenger in passengers:\n passenger_birth = passenger['birthday'].split('-')[0]\n passenger_age = int(current_year) - int(passenger_birth)\n if passenger_age >= 12:\n self.adult ...
<|body_start_0|> self.adult = -1 self.children = 0 self.infants = 0 current_year = datetime.now().year try: for passenger in passengers: passenger_birth = passenger['birthday'].split('-')[0] passenger_age = int(current_year) - int(passe...
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: def calculation_age(self, passengers): """计算乘客的年龄 passenger 是个包含每个乘客信息的列表 :param passenger: :return:""" <|body_0|> def calculation_luggage(self, baggageweight): """baggageweight:目标行李的重量 根据行李的重量,分配行李的选择方式 选择行李分为两个档次,一个是23KG,25块钱。一个是32KG,75块钱 :param baggageweight...
stack_v2_sparse_classes_75kplus_train_067735
33,129
no_license
[ { "docstring": "计算乘客的年龄 passenger 是个包含每个乘客信息的列表 :param passenger: :return:", "name": "calculation_age", "signature": "def calculation_age(self, passengers)" }, { "docstring": "baggageweight:目标行李的重量 根据行李的重量,分配行李的选择方式 选择行李分为两个档次,一个是23KG,25块钱。一个是32KG,75块钱 :param baggageweight: :return: 返回选择几个23KG和几...
2
stack_v2_sparse_classes_30k_train_015098
Implement the Python class `Base` described below. Class description: Implement the Base class. Method signatures and docstrings: - def calculation_age(self, passengers): 计算乘客的年龄 passenger 是个包含每个乘客信息的列表 :param passenger: :return: - def calculation_luggage(self, baggageweight): baggageweight:目标行李的重量 根据行李的重量,分配行李的选择方式 ...
Implement the Python class `Base` described below. Class description: Implement the Base class. Method signatures and docstrings: - def calculation_age(self, passengers): 计算乘客的年龄 passenger 是个包含每个乘客信息的列表 :param passenger: :return: - def calculation_luggage(self, baggageweight): baggageweight:目标行李的重量 根据行李的重量,分配行李的选择方式 ...
a322f4219fb269379bb9cd123e912d2d6ba11322
<|skeleton|> class Base: def calculation_age(self, passengers): """计算乘客的年龄 passenger 是个包含每个乘客信息的列表 :param passenger: :return:""" <|body_0|> def calculation_luggage(self, baggageweight): """baggageweight:目标行李的重量 根据行李的重量,分配行李的选择方式 选择行李分为两个档次,一个是23KG,25块钱。一个是32KG,75块钱 :param baggageweight...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Base: def calculation_age(self, passengers): """计算乘客的年龄 passenger 是个包含每个乘客信息的列表 :param passenger: :return:""" self.adult = -1 self.children = 0 self.infants = 0 current_year = datetime.now().year try: for passenger in passengers: pass...
the_stack_v2_python_sparse
eurowings/bin/purchase.py
chenrun666/work
train
0
0e691ac7febb18c3510ed79ef05ee2592ef4e926
[ "super(CBHG, self).__init__()\nself.hidden_size = hidden_size\nself.projection_size = projection_size\nself.convbank_list = nn.ModuleList()\nself.convbank_list.append(nn.Conv1d(in_channels=projection_size, out_channels=hidden_size, kernel_size=1, padding=int(np.floor(1 / 2))))\nfor i in range(2, K + 1):\n self.c...
<|body_start_0|> super(CBHG, self).__init__() self.hidden_size = hidden_size self.projection_size = projection_size self.convbank_list = nn.ModuleList() self.convbank_list.append(nn.Conv1d(in_channels=projection_size, out_channels=hidden_size, kernel_size=1, padding=int(np.floor(...
CBHG Module.
CBHG
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBHG: """CBHG Module.""" def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): """init.""" <|body_0|> def _conv_fit_dim(self, x, kernel_size=3): """_conv_fit_dim.""" <|body_1|> def forwar...
stack_v2_sparse_classes_75kplus_train_067736
17,934
permissive
[ { "docstring": "init.", "name": "__init__", "signature": "def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False)" }, { "docstring": "_conv_fit_dim.", "name": "_conv_fit_dim", "signature": "def _conv_fit_dim(self, x, kernel_size...
3
stack_v2_sparse_classes_30k_train_003934
Implement the Python class `CBHG` described below. Class description: CBHG Module. Method signatures and docstrings: - def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): init. - def _conv_fit_dim(self, x, kernel_size=3): _conv_fit_dim. - def forward(se...
Implement the Python class `CBHG` described below. Class description: CBHG Module. Method signatures and docstrings: - def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): init. - def _conv_fit_dim(self, x, kernel_size=3): _conv_fit_dim. - def forward(se...
31d50b1ea1dea92f4182c5b2b6fe9fe4c981ae39
<|skeleton|> class CBHG: """CBHG Module.""" def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): """init.""" <|body_0|> def _conv_fit_dim(self, x, kernel_size=3): """_conv_fit_dim.""" <|body_1|> def forwar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CBHG: """CBHG Module.""" def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): """init.""" super(CBHG, self).__init__() self.hidden_size = hidden_size self.projection_size = projection_size self.convban...
the_stack_v2_python_sparse
SVS/model/layers/pretrain_module.py
SJTMusicTeam/SVS_system
train
85
13c05fef3db715406db85195a601bcab42106676
[ "self.data = -1\nself.writeable = True\nself.condition = Condition()", "self.condition.acquire()\nwhile not self.writeable:\n self.condition.wait()\nprint('%s setting data to %d' % (currentThread().getName(), data))\nself.data = data\nself.writeable = False\nself.condition.notify()\nself.condition.release()", ...
<|body_start_0|> self.data = -1 self.writeable = True self.condition = Condition() <|end_body_0|> <|body_start_1|> self.condition.acquire() while not self.writeable: self.condition.wait() print('%s setting data to %d' % (currentThread().getName(), data)) ...
Shared data that sequences writing before reading.
SharedCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharedCell: """Shared data that sequences writing before reading.""" def __init__(self): """Can produce but not consume at startup.""" <|body_0|> def setData(self, data): """Second caller must wait until someone has consumed the data before resetting it.""" ...
stack_v2_sparse_classes_75kplus_train_067737
3,232
no_license
[ { "docstring": "Can produce but not consume at startup.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Second caller must wait until someone has consumed the data before resetting it.", "name": "setData", "signature": "def setData(self, data)" }, { "do...
3
stack_v2_sparse_classes_30k_train_046908
Implement the Python class `SharedCell` described below. Class description: Shared data that sequences writing before reading. Method signatures and docstrings: - def __init__(self): Can produce but not consume at startup. - def setData(self, data): Second caller must wait until someone has consumed the data before r...
Implement the Python class `SharedCell` described below. Class description: Shared data that sequences writing before reading. Method signatures and docstrings: - def __init__(self): Can produce but not consume at startup. - def setData(self, data): Second caller must wait until someone has consumed the data before r...
d0a79d91a51c76cbb75830f7a8d1ce72174ad220
<|skeleton|> class SharedCell: """Shared data that sequences writing before reading.""" def __init__(self): """Can produce but not consume at startup.""" <|body_0|> def setData(self, data): """Second caller must wait until someone has consumed the data before resetting it.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SharedCell: """Shared data that sequences writing before reading.""" def __init__(self): """Can produce but not consume at startup.""" self.data = -1 self.writeable = True self.condition = Condition() def setData(self, data): """Second caller must wait until s...
the_stack_v2_python_sparse
module-06/producerconsumer2.py
tjsaotome65/sec430-python
train
2
1d40a2dde3a05efe9b35fcefc5f1feb20fbcd916
[ "maxLen = 0\nlast = ''\np = [0] * len(s)\ns = s[s.find('('):]\nfor i, c in enumerate(s):\n if c == last:\n p[i] = 1\n else:\n p[i] = p[i - 1] + 1\n maxLen = max(p[i], maxLen)\n last = c\nreturn maxLen - 1 if maxLen % 2 == 1 else maxLen", "tmp, cp = ([], [0] * len(s))\nfor i, c in enumera...
<|body_start_0|> maxLen = 0 last = '' p = [0] * len(s) s = s[s.find('('):] for i, c in enumerate(s): if c == last: p[i] = 1 else: p[i] = p[i - 1] + 1 maxLen = max(p[i], maxLen) last = c return...
解决思路, 构建可以从栈中弹出的括号字符的**索引的辅助列表**
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """解决思路, 构建可以从栈中弹出的括号字符的**索引的辅助列表**""" def longestValidParenthes(self, s: 'str') -> 'int': """给定一个只包含 '(' 和 ')' 的字符串,找出'()'的最大有效长度""" <|body_0|> def longestValidParentheses1(self, s: 'str') -> 'int': """给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。 cp: cach...
stack_v2_sparse_classes_75kplus_train_067738
2,273
permissive
[ { "docstring": "给定一个只包含 '(' 和 ')' 的字符串,找出'()'的最大有效长度", "name": "longestValidParenthes", "signature": "def longestValidParenthes(self, s: 'str') -> 'int'" }, { "docstring": "给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。 cp: cache pop, 缓存可以匹配的索引, 均设置为1 ml: max length cl: continuous length", "name"...
3
stack_v2_sparse_classes_30k_train_009664
Implement the Python class `Solution` described below. Class description: 解决思路, 构建可以从栈中弹出的括号字符的**索引的辅助列表** Method signatures and docstrings: - def longestValidParenthes(self, s: 'str') -> 'int': 给定一个只包含 '(' 和 ')' 的字符串,找出'()'的最大有效长度 - def longestValidParentheses1(self, s: 'str') -> 'int': 给定一个只包含 '(' 和 ')' 的字符串,找出最长的包...
Implement the Python class `Solution` described below. Class description: 解决思路, 构建可以从栈中弹出的括号字符的**索引的辅助列表** Method signatures and docstrings: - def longestValidParenthes(self, s: 'str') -> 'int': 给定一个只包含 '(' 和 ')' 的字符串,找出'()'的最大有效长度 - def longestValidParentheses1(self, s: 'str') -> 'int': 给定一个只包含 '(' 和 ')' 的字符串,找出最长的包...
9f49766a2b375a6c65f7bfa96df513875ddd772d
<|skeleton|> class Solution: """解决思路, 构建可以从栈中弹出的括号字符的**索引的辅助列表**""" def longestValidParenthes(self, s: 'str') -> 'int': """给定一个只包含 '(' 和 ')' 的字符串,找出'()'的最大有效长度""" <|body_0|> def longestValidParentheses1(self, s: 'str') -> 'int': """给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。 cp: cach...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """解决思路, 构建可以从栈中弹出的括号字符的**索引的辅助列表**""" def longestValidParenthes(self, s: 'str') -> 'int': """给定一个只包含 '(' 和 ')' 的字符串,找出'()'的最大有效长度""" maxLen = 0 last = '' p = [0] * len(s) s = s[s.find('('):] for i, c in enumerate(s): if c == last: ...
the_stack_v2_python_sparse
LeetcodeView/32.longestValidParentheses.md
Song2017/Leetcode_python
train
1
877f672b77b03d6c4e6c3310a62f9bd590f5145e
[ "if type(typ) != str:\n raise TypeError('Paramètre doit être un string')\nelse:\n self.type = typ\n if typ.upper() in dictionnaire_extensions:\n self.description = dictionnaire_extensions[typ.upper()]\n else:\n self.description = 'Type de fichier invalide !'", "if self.type.upper() in di...
<|body_start_0|> if type(typ) != str: raise TypeError('Paramètre doit être un string') else: self.type = typ if typ.upper() in dictionnaire_extensions: self.description = dictionnaire_extensions[typ.upper()] else: self.descr...
Description
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Description: def __init__(self, typ: str): """:param typ: str: type dont il faut récupérer la description""" <|body_0|> def ajouter_description(self) -> str: """:return: str: présentation de la description""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_067739
922
no_license
[ { "docstring": ":param typ: str: type dont il faut récupérer la description", "name": "__init__", "signature": "def __init__(self, typ: str)" }, { "docstring": ":return: str: présentation de la description", "name": "ajouter_description", "signature": "def ajouter_description(self) -> st...
2
stack_v2_sparse_classes_30k_train_001296
Implement the Python class `Description` described below. Class description: Implement the Description class. Method signatures and docstrings: - def __init__(self, typ: str): :param typ: str: type dont il faut récupérer la description - def ajouter_description(self) -> str: :return: str: présentation de la descripti...
Implement the Python class `Description` described below. Class description: Implement the Description class. Method signatures and docstrings: - def __init__(self, typ: str): :param typ: str: type dont il faut récupérer la description - def ajouter_description(self) -> str: :return: str: présentation de la descripti...
418e193be7f40b4fb9303780be1313b479767221
<|skeleton|> class Description: def __init__(self, typ: str): """:param typ: str: type dont il faut récupérer la description""" <|body_0|> def ajouter_description(self) -> str: """:return: str: présentation de la description""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Description: def __init__(self, typ: str): """:param typ: str: type dont il faut récupérer la description""" if type(typ) != str: raise TypeError('Paramètre doit être un string') else: self.type = typ if typ.upper() in dictionnaire_extensions: ...
the_stack_v2_python_sparse
libs/classe_description.py
ArthurSchamroth/ProjetTri
train
1
131063fe699912e27c33fe66b721f9866fc8fea6
[ "if user_input is None:\n return self.async_show_form(step_id='user', data_schema=STEP_USER_DATA_SCHEMA)\nservice = await WyomingService.create(user_input[CONF_HOST], user_input[CONF_PORT])\nif service is None:\n return self.async_show_form(step_id='user', data_schema=STEP_USER_DATA_SCHEMA, errors={'base': 'c...
<|body_start_0|> if user_input is None: return self.async_show_form(step_id='user', data_schema=STEP_USER_DATA_SCHEMA) service = await WyomingService.create(user_input[CONF_HOST], user_input[CONF_PORT]) if service is None: return self.async_show_form(step_id='user', data_...
Handle a config flow for Wyoming integration.
ConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigFlow: """Handle a config flow for Wyoming integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle the initial step.""" <|body_0|> async def async_step_hassio(self, discovery_info: HassioServiceInfo) -> FlowRe...
stack_v2_sparse_classes_75kplus_train_067740
3,831
permissive
[ { "docstring": "Handle the initial step.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult" }, { "docstring": "Handle Supervisor add-on discovery.", "name": "async_step_hassio", "signature": "async def async_s...
3
stack_v2_sparse_classes_30k_train_047555
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for Wyoming integration. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle the initial step. - async def async_step_hassio(self, discovery_in...
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for Wyoming integration. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle the initial step. - async def async_step_hassio(self, discovery_in...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ConfigFlow: """Handle a config flow for Wyoming integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle the initial step.""" <|body_0|> async def async_step_hassio(self, discovery_info: HassioServiceInfo) -> FlowRe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigFlow: """Handle a config flow for Wyoming integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle the initial step.""" if user_input is None: return self.async_show_form(step_id='user', data_schema=STEP_USER_DATA_S...
the_stack_v2_python_sparse
homeassistant/components/wyoming/config_flow.py
home-assistant/core
train
35,501
acf96567c208484480fd8826de0a8cc841135fb1
[ "cardholder_name = card.name\ntransarmor_token = card.ta_token\ncredit_card_type = card.card_type\ncc_expiry = card.period\ntransaction = firstdata.FirstData(self.FIRST_DATA_KEY_ID, self.FIRST_DATA_HMAC_KEY, gateway_id=self.FIRST_DATA_GATEWAY_ID, password=self.FIRST_DATA_PASSWORD, transaction_type='00', cardholder_...
<|body_start_0|> cardholder_name = card.name transarmor_token = card.ta_token credit_card_type = card.card_type cc_expiry = card.period transaction = firstdata.FirstData(self.FIRST_DATA_KEY_ID, self.FIRST_DATA_HMAC_KEY, gateway_id=self.FIRST_DATA_GATEWAY_ID, password=self.FIRST_D...
TransArmorOperations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransArmorOperations: def ta_purchase(self, card, amount, reference_no='', customer_ref='', reference_3=''): """# Purchase - # The method by which an amount of funds moving from clients credit card to merchants account # Supports "Refund transaction", "Void transaction". # # :param cardh...
stack_v2_sparse_classes_75kplus_train_067741
22,151
no_license
[ { "docstring": "# Purchase - # The method by which an amount of funds moving from clients credit card to merchants account # Supports \"Refund transaction\", \"Void transaction\". # # :param cardholder_name: The customer's name. The following characters will be stripped from this field: # ; ` \" / % as well as ...
3
stack_v2_sparse_classes_30k_train_000881
Implement the Python class `TransArmorOperations` described below. Class description: Implement the TransArmorOperations class. Method signatures and docstrings: - def ta_purchase(self, card, amount, reference_no='', customer_ref='', reference_3=''): # Purchase - # The method by which an amount of funds moving from c...
Implement the Python class `TransArmorOperations` described below. Class description: Implement the TransArmorOperations class. Method signatures and docstrings: - def ta_purchase(self, card, amount, reference_no='', customer_ref='', reference_3=''): # Purchase - # The method by which an amount of funds moving from c...
a27cb847ea7698872b64f9c58e43ebf5aad5590d
<|skeleton|> class TransArmorOperations: def ta_purchase(self, card, amount, reference_no='', customer_ref='', reference_3=''): """# Purchase - # The method by which an amount of funds moving from clients credit card to merchants account # Supports "Refund transaction", "Void transaction". # # :param cardh...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransArmorOperations: def ta_purchase(self, card, amount, reference_no='', customer_ref='', reference_3=''): """# Purchase - # The method by which an amount of funds moving from clients credit card to merchants account # Supports "Refund transaction", "Void transaction". # # :param cardholder_name: Th...
the_stack_v2_python_sparse
payments/payment_operations.py
adam1978828/webapp1
train
1
478a11221eb3e26ef4fb53042ae055876d5bc868
[ "self.caps = Capability.NONE\nself.methods: List[Method] = []\nfor method_data in methods:\n try:\n method_cap = Capability._member_map_[method_data.get('type', 'WRONG').upper()]\n except KeyError:\n raise RuntimeError(f'invalid method type for {name}')\n method = Method(self, method_cap, met...
<|body_start_0|> self.caps = Capability.NONE self.methods: List[Method] = [] for method_data in methods: try: method_cap = Capability._member_map_[method_data.get('type', 'WRONG').upper()] except KeyError: raise RuntimeError(f'invalid metho...
Encapsulates a GTFOBin and it's methods for all capabilities
Binary
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binary: """Encapsulates a GTFOBin and it's methods for all capabilities""" def __init__(self, gtfo: 'GTFOBins', name: str, methods: List[Dict[str, Any]]): """Create a GTFOBin from the given list of capabilities""" <|body_0|> def iter_methods(self, binary_path: str, caps:...
stack_v2_sparse_classes_75kplus_train_067742
17,537
permissive
[ { "docstring": "Create a GTFOBin from the given list of capabilities", "name": "__init__", "signature": "def __init__(self, gtfo: 'GTFOBins', name: str, methods: List[Dict[str, Any]])" }, { "docstring": "Iterate over methods in this binary matching the capability and stream masks", "name": "...
2
stack_v2_sparse_classes_30k_train_024149
Implement the Python class `Binary` described below. Class description: Encapsulates a GTFOBin and it's methods for all capabilities Method signatures and docstrings: - def __init__(self, gtfo: 'GTFOBins', name: str, methods: List[Dict[str, Any]]): Create a GTFOBin from the given list of capabilities - def iter_metho...
Implement the Python class `Binary` described below. Class description: Encapsulates a GTFOBin and it's methods for all capabilities Method signatures and docstrings: - def __init__(self, gtfo: 'GTFOBins', name: str, methods: List[Dict[str, Any]]): Create a GTFOBin from the given list of capabilities - def iter_metho...
37f04d4e16ff47c7fd70e95162f9fccd327cca7e
<|skeleton|> class Binary: """Encapsulates a GTFOBin and it's methods for all capabilities""" def __init__(self, gtfo: 'GTFOBins', name: str, methods: List[Dict[str, Any]]): """Create a GTFOBin from the given list of capabilities""" <|body_0|> def iter_methods(self, binary_path: str, caps:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Binary: """Encapsulates a GTFOBin and it's methods for all capabilities""" def __init__(self, gtfo: 'GTFOBins', name: str, methods: List[Dict[str, Any]]): """Create a GTFOBin from the given list of capabilities""" self.caps = Capability.NONE self.methods: List[Method] = [] ...
the_stack_v2_python_sparse
pwncat/gtfobins.py
calebstewart/pwncat
train
2,177
da1c16b31a3b1e82d070848835f4754146eec7ff
[ "nodes = [('const_node', {'type': 'Const', 'kind': 'op'}), ('const_data', {'kind': 'data', 'value': np.array(5)}), ('result_node', {'type': 'Result', 'kind': 'op'}), ('placeholder_1', {'type': 'Parameter', 'kind': 'op', 'op': 'Parameter'}), ('placeholder_1_data', {'kind': 'data'}), ('relu_1', {'type': 'ReLU', 'kind...
<|body_start_0|> nodes = [('const_node', {'type': 'Const', 'kind': 'op'}), ('const_data', {'kind': 'data', 'value': np.array(5)}), ('result_node', {'type': 'Result', 'kind': 'op'}), ('placeholder_1', {'type': 'Parameter', 'kind': 'op', 'op': 'Parameter'}), ('placeholder_1_data', {'kind': 'data'}), ('relu_1', {'...
RemoveConstToResultReplacementTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoveConstToResultReplacementTest: def test_only_consumer(self): """Result node is only consumer of Const data node""" <|body_0|> def test_two_consumers(self): """Const data node has two consumers: Result and ReLu""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_067743
8,443
permissive
[ { "docstring": "Result node is only consumer of Const data node", "name": "test_only_consumer", "signature": "def test_only_consumer(self)" }, { "docstring": "Const data node has two consumers: Result and ReLu", "name": "test_two_consumers", "signature": "def test_two_consumers(self)" ...
2
stack_v2_sparse_classes_30k_train_052469
Implement the Python class `RemoveConstToResultReplacementTest` described below. Class description: Implement the RemoveConstToResultReplacementTest class. Method signatures and docstrings: - def test_only_consumer(self): Result node is only consumer of Const data node - def test_two_consumers(self): Const data node ...
Implement the Python class `RemoveConstToResultReplacementTest` described below. Class description: Implement the RemoveConstToResultReplacementTest class. Method signatures and docstrings: - def test_only_consumer(self): Result node is only consumer of Const data node - def test_two_consumers(self): Const data node ...
2e6c95f389b195f6d3ff8597147d1f817433cfb3
<|skeleton|> class RemoveConstToResultReplacementTest: def test_only_consumer(self): """Result node is only consumer of Const data node""" <|body_0|> def test_two_consumers(self): """Const data node has two consumers: Result and ReLu""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RemoveConstToResultReplacementTest: def test_only_consumer(self): """Result node is only consumer of Const data node""" nodes = [('const_node', {'type': 'Const', 'kind': 'op'}), ('const_data', {'kind': 'data', 'value': np.array(5)}), ('result_node', {'type': 'Result', 'kind': 'op'}), ('placeho...
the_stack_v2_python_sparse
model-optimizer/extensions/back/SpecialNodesFinalization_test.py
0xF6/openvino
train
2
3c1ae498137ca0bb073c5755c2674f823f34626c
[ "super().__init__(*args, category=CATEGORY_SENSOR)\nstate = self.hass.states.get(self.entity_id)\nserv_humidity = self.add_preload_service(SERV_HUMIDITY_SENSOR)\nself.char_humidity = serv_humidity.configure_char(CHAR_CURRENT_HUMIDITY, value=0)\nself.async_update_state(state)", "if (humidity := convert_to_float(ne...
<|body_start_0|> super().__init__(*args, category=CATEGORY_SENSOR) state = self.hass.states.get(self.entity_id) serv_humidity = self.add_preload_service(SERV_HUMIDITY_SENSOR) self.char_humidity = serv_humidity.configure_char(CHAR_CURRENT_HUMIDITY, value=0) self.async_update_state...
Generate a HumiditySensor accessory as humidity sensor.
HumiditySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HumiditySensor: """Generate a HumiditySensor accessory as humidity sensor.""" def __init__(self, *args): """Initialize a HumiditySensor accessory object.""" <|body_0|> def async_update_state(self, new_state): """Update accessory after state change.""" <|b...
stack_v2_sparse_classes_75kplus_train_067744
17,041
permissive
[ { "docstring": "Initialize a HumiditySensor accessory object.", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Update accessory after state change.", "name": "async_update_state", "signature": "def async_update_state(self, new_state)" } ]
2
stack_v2_sparse_classes_30k_train_026911
Implement the Python class `HumiditySensor` described below. Class description: Generate a HumiditySensor accessory as humidity sensor. Method signatures and docstrings: - def __init__(self, *args): Initialize a HumiditySensor accessory object. - def async_update_state(self, new_state): Update accessory after state c...
Implement the Python class `HumiditySensor` described below. Class description: Generate a HumiditySensor accessory as humidity sensor. Method signatures and docstrings: - def __init__(self, *args): Initialize a HumiditySensor accessory object. - def async_update_state(self, new_state): Update accessory after state c...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class HumiditySensor: """Generate a HumiditySensor accessory as humidity sensor.""" def __init__(self, *args): """Initialize a HumiditySensor accessory object.""" <|body_0|> def async_update_state(self, new_state): """Update accessory after state change.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HumiditySensor: """Generate a HumiditySensor accessory as humidity sensor.""" def __init__(self, *args): """Initialize a HumiditySensor accessory object.""" super().__init__(*args, category=CATEGORY_SENSOR) state = self.hass.states.get(self.entity_id) serv_humidity = self....
the_stack_v2_python_sparse
homeassistant/components/homekit/type_sensors.py
home-assistant/core
train
35,501
dd6c817209b7053dd265ac4a929759ab1900a1cd
[ "from __builtin__ import xrange\ncnt = 1\nrpc_idx = len(chars) - 1\nfor i in xrange(len(chars) - 2, -1, -1):\n if chars[i] == chars[i + 1]:\n cnt += 1\n continue\n if cnt == 1:\n chars[rpc_idx] = chars[i + 1]\n else:\n scnt = str(cnt)\n scnt_idx = len(scnt) - 1\n f...
<|body_start_0|> from __builtin__ import xrange cnt = 1 rpc_idx = len(chars) - 1 for i in xrange(len(chars) - 2, -1, -1): if chars[i] == chars[i + 1]: cnt += 1 continue if cnt == 1: chars[rpc_idx] = chars[i + 1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compress(self, chars): """:type chars: List[str] :rtype: int Could you solve it using only O(1) extra space?""" <|body_0|> def rewrite(self, chars): """:type chars: List[str] :rtype: int Could you solve it using only O(1) extra space?""" <|body_...
stack_v2_sparse_classes_75kplus_train_067745
3,877
no_license
[ { "docstring": ":type chars: List[str] :rtype: int Could you solve it using only O(1) extra space?", "name": "compress", "signature": "def compress(self, chars)" }, { "docstring": ":type chars: List[str] :rtype: int Could you solve it using only O(1) extra space?", "name": "rewrite", "si...
2
stack_v2_sparse_classes_30k_train_049271
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compress(self, chars): :type chars: List[str] :rtype: int Could you solve it using only O(1) extra space? - def rewrite(self, chars): :type chars: List[str] :rtype: int Could...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compress(self, chars): :type chars: List[str] :rtype: int Could you solve it using only O(1) extra space? - def rewrite(self, chars): :type chars: List[str] :rtype: int Could...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def compress(self, chars): """:type chars: List[str] :rtype: int Could you solve it using only O(1) extra space?""" <|body_0|> def rewrite(self, chars): """:type chars: List[str] :rtype: int Could you solve it using only O(1) extra space?""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def compress(self, chars): """:type chars: List[str] :rtype: int Could you solve it using only O(1) extra space?""" from __builtin__ import xrange cnt = 1 rpc_idx = len(chars) - 1 for i in xrange(len(chars) - 2, -1, -1): if chars[i] == chars[i + 1]...
the_stack_v2_python_sparse
co_lyft/443_String_Compression.py
vsdrun/lc_public
train
6
3a9a4fbfd4e3ba4552ae39f666267ba7cc5fed03
[ "for opclass in self.fetch():\n self[opclass.key()] = opclass\nopers = self.dbconn.fetchall(self.cls.opquery())\nself.dbconn.rollback()\nfor opdata in opers:\n sch = opdata['schema']\n opc = opdata['name']\n idx = opdata['index_method']\n strat = opdata['strategy']\n oper = opdata['operator']\n ...
<|body_start_0|> for opclass in self.fetch(): self[opclass.key()] = opclass opers = self.dbconn.fetchall(self.cls.opquery()) self.dbconn.rollback() for opdata in opers: sch = opdata['schema'] opc = opdata['name'] idx = opdata['index_method'...
The collection of operator classes in a database
OperatorClassDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OperatorClassDict: """The collection of operator classes in a database""" def _from_catalog(self): """Initialize the dictionary of operator classes from the catalogs""" <|body_0|> def from_map(self, schema, inopcls): """Initialize the dictionary of operator class...
stack_v2_sparse_classes_75kplus_train_067746
9,659
permissive
[ { "docstring": "Initialize the dictionary of operator classes from the catalogs", "name": "_from_catalog", "signature": "def _from_catalog(self)" }, { "docstring": "Initialize the dictionary of operator classes from the input map :param schema: schema owning the operator classes :param inopcls: ...
2
null
Implement the Python class `OperatorClassDict` described below. Class description: The collection of operator classes in a database Method signatures and docstrings: - def _from_catalog(self): Initialize the dictionary of operator classes from the catalogs - def from_map(self, schema, inopcls): Initialize the diction...
Implement the Python class `OperatorClassDict` described below. Class description: The collection of operator classes in a database Method signatures and docstrings: - def _from_catalog(self): Initialize the dictionary of operator classes from the catalogs - def from_map(self, schema, inopcls): Initialize the diction...
ec682513d5256e383647f38f7fba29530cfb9fbe
<|skeleton|> class OperatorClassDict: """The collection of operator classes in a database""" def _from_catalog(self): """Initialize the dictionary of operator classes from the catalogs""" <|body_0|> def from_map(self, schema, inopcls): """Initialize the dictionary of operator class...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OperatorClassDict: """The collection of operator classes in a database""" def _from_catalog(self): """Initialize the dictionary of operator classes from the catalogs""" for opclass in self.fetch(): self[opclass.key()] = opclass opers = self.dbconn.fetchall(self.cls.opq...
the_stack_v2_python_sparse
pyrseas/dbobject/operclass.py
perseas/Pyrseas
train
323
42b460e98d9f13e8ab346ccf25e739fcb8333e14
[ "response = self.images_client.create_image()\nimage_creation_time_in_sec = calendar.timegm(time.gmtime())\nself.assertEqual(response.status_code, 201)\nimage = response.entity\nself.resources.add(image.id_, self.images_client.delete_image)\nerrors = self._validate_core_image_properties(image, image_creation_time_i...
<|body_start_0|> response = self.images_client.create_image() image_creation_time_in_sec = calendar.timegm(time.gmtime()) self.assertEqual(response.status_code, 201) image = response.entity self.resources.add(image.id_, self.images_client.delete_image) errors = self._vali...
TestCreateImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCreateImage: def test_create_image(self): """@summary: Create image 1) Create image 2) Verify that the response code is 201 3) Add the image to the resource pool for deletion 4) Verify that the response contains the correct core properties 5) Verify that the response contains the cor...
stack_v2_sparse_classes_75kplus_train_067747
7,441
permissive
[ { "docstring": "@summary: Create image 1) Create image 2) Verify that the response code is 201 3) Add the image to the resource pool for deletion 4) Verify that the response contains the correct core properties 5) Verify that the response contains the correct remaining properties", "name": "test_create_imag...
4
null
Implement the Python class `TestCreateImage` described below. Class description: Implement the TestCreateImage class. Method signatures and docstrings: - def test_create_image(self): @summary: Create image 1) Create image 2) Verify that the response code is 201 3) Add the image to the resource pool for deletion 4) Ve...
Implement the Python class `TestCreateImage` described below. Class description: Implement the TestCreateImage class. Method signatures and docstrings: - def test_create_image(self): @summary: Create image 1) Create image 2) Verify that the response code is 201 3) Add the image to the resource pool for deletion 4) Ve...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class TestCreateImage: def test_create_image(self): """@summary: Create image 1) Create image 2) Verify that the response code is 201 3) Add the image to the resource pool for deletion 4) Verify that the response contains the correct core properties 5) Verify that the response contains the cor...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCreateImage: def test_create_image(self): """@summary: Create image 1) Create image 2) Verify that the response code is 201 3) Add the image to the resource pool for deletion 4) Verify that the response contains the correct core properties 5) Verify that the response contains the correct remaining...
the_stack_v2_python_sparse
cloudroast/images/v2/functional/test_create_image.py
RULCSoft/cloudroast
train
1
1e3c0d58b901105f8a9febeb0cfa48272742e4ea
[ "context = req.environ['nova.context']\ncontext.can(sg_policies.POLICY_NAME % 'show', target={'project_id': context.project_id})\ntry:\n id = security_group_api.validate_id(id)\n security_group = security_group_api.get(context, id)\nexcept exception.SecurityGroupNotFound as exp:\n raise exc.HTTPNotFound(ex...
<|body_start_0|> context = req.environ['nova.context'] context.can(sg_policies.POLICY_NAME % 'show', target={'project_id': context.project_id}) try: id = security_group_api.validate_id(id) security_group = security_group_api.get(context, id) except exception.Secur...
The Security group API controller for the OpenStack API.
SecurityGroupController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecurityGroupController: """The Security group API controller for the OpenStack API.""" def show(self, req, id): """Return data about the given security group.""" <|body_0|> def delete(self, req, id): """Delete a security group.""" <|body_1|> def ind...
stack_v2_sparse_classes_75kplus_train_067748
20,601
permissive
[ { "docstring": "Return data about the given security group.", "name": "show", "signature": "def show(self, req, id)" }, { "docstring": "Delete a security group.", "name": "delete", "signature": "def delete(self, req, id)" }, { "docstring": "Returns a list of security groups.", ...
5
stack_v2_sparse_classes_30k_train_031328
Implement the Python class `SecurityGroupController` described below. Class description: The Security group API controller for the OpenStack API. Method signatures and docstrings: - def show(self, req, id): Return data about the given security group. - def delete(self, req, id): Delete a security group. - def index(s...
Implement the Python class `SecurityGroupController` described below. Class description: The Security group API controller for the OpenStack API. Method signatures and docstrings: - def show(self, req, id): Return data about the given security group. - def delete(self, req, id): Delete a security group. - def index(s...
065c5906d2da3e2bb6eeb3a7a15d4cd8d98b35e9
<|skeleton|> class SecurityGroupController: """The Security group API controller for the OpenStack API.""" def show(self, req, id): """Return data about the given security group.""" <|body_0|> def delete(self, req, id): """Delete a security group.""" <|body_1|> def ind...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SecurityGroupController: """The Security group API controller for the OpenStack API.""" def show(self, req, id): """Return data about the given security group.""" context = req.environ['nova.context'] context.can(sg_policies.POLICY_NAME % 'show', target={'project_id': context.proj...
the_stack_v2_python_sparse
nova/api/openstack/compute/security_groups.py
openstack/nova
train
2,287
a7e55ac71a8cfb54711cc724f5fc8a03abb52f08
[ "letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19, 'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25, 'Z': 26}\ns = s.upper()\nret = 0\nb = 0\nfor c in reversed(s):\n ret += letters[c] * ...
<|body_start_0|> letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19, 'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25, 'Z': 26} s = s.upper() ret = 0 b = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def titleToNumber(self, s): """:type s: str :rtype: int""" <|body_0|> def titleToNumber2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': ...
stack_v2_sparse_classes_75kplus_train_067749
1,010
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "titleToNumber", "signature": "def titleToNumber(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "titleToNumber2", "signature": "def titleToNumber2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_027936
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def titleToNumber(self, s): :type s: str :rtype: int - def titleToNumber2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def titleToNumber(self, s): :type s: str :rtype: int - def titleToNumber2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def titleToNumber(self, s): ...
434889037fe3e405a8cbc71cd822eb1bda9aa606
<|skeleton|> class Solution: def titleToNumber(self, s): """:type s: str :rtype: int""" <|body_0|> def titleToNumber2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def titleToNumber(self, s): """:type s: str :rtype: int""" letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19, 'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25...
the_stack_v2_python_sparse
python/0171.excel-sheet-column-number/excel-sheet-column-number.py
ysmintor/leetcode
train
0
20c0b1a1a6675ba51d77b22bc5af292510d91d81
[ "tasks.sort()\nn = len(tasks)\nallOnes = (1 << n) - 1\n\n@lru_cache(None)\ndef backtrack(mask, currTime):\n if currTime > sessionTime:\n return float('inf')\n if mask == allOnes:\n return 1\n ans = float('inf')\n for i in range(n):\n if mask & 1 << i == 0:\n includeInCurr...
<|body_start_0|> tasks.sort() n = len(tasks) allOnes = (1 << n) - 1 @lru_cache(None) def backtrack(mask, currTime): if currTime > sessionTime: return float('inf') if mask == allOnes: return 1 ans = float('inf') ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSessions(self, tasks, sessionTime): """:type tasks: List[int] :type sessionTime: int :rtype: int""" <|body_0|> def minSessionsDpBit(self, tasks, sessionTime): """:type tasks: List[int] :type sessionTime: int :rtype: int""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_067750
3,725
no_license
[ { "docstring": ":type tasks: List[int] :type sessionTime: int :rtype: int", "name": "minSessions", "signature": "def minSessions(self, tasks, sessionTime)" }, { "docstring": ":type tasks: List[int] :type sessionTime: int :rtype: int", "name": "minSessionsDpBit", "signature": "def minSess...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSessions(self, tasks, sessionTime): :type tasks: List[int] :type sessionTime: int :rtype: int - def minSessionsDpBit(self, tasks, sessionTime): :type tasks: List[int] :typ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSessions(self, tasks, sessionTime): :type tasks: List[int] :type sessionTime: int :rtype: int - def minSessionsDpBit(self, tasks, sessionTime): :type tasks: List[int] :typ...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def minSessions(self, tasks, sessionTime): """:type tasks: List[int] :type sessionTime: int :rtype: int""" <|body_0|> def minSessionsDpBit(self, tasks, sessionTime): """:type tasks: List[int] :type sessionTime: int :rtype: int""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minSessions(self, tasks, sessionTime): """:type tasks: List[int] :type sessionTime: int :rtype: int""" tasks.sort() n = len(tasks) allOnes = (1 << n) - 1 @lru_cache(None) def backtrack(mask, currTime): if currTime > sessionTime: ...
the_stack_v2_python_sparse
M/MinimumNumberofWorkSessionstoFinishtheTasks.py
bssrdf/pyleet
train
2
76fd0f95bb57487e9e4e61a13e929363395056cd
[ "self.tab_entrada = tabuleiro.copy()\nself.tab_final = [self.tab_entrada.copy()]\nself.game_rounds = game_rounds\nself.largura = len(tabuleiro[0])\nself.altura = len(tabuleiro)", "cells = {}\nfor y_pos in range(self.altura):\n for x_pos in range(self.largura):\n elmt = self.tab_final[game_round][y_pos][...
<|body_start_0|> self.tab_entrada = tabuleiro.copy() self.tab_final = [self.tab_entrada.copy()] self.game_rounds = game_rounds self.largura = len(tabuleiro[0]) self.altura = len(tabuleiro) <|end_body_0|> <|body_start_1|> cells = {} for y_pos in range(self.altura)...
Classe para execução do Jogo da Vida
Jogo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Jogo: """Classe para execução do Jogo da Vida""" def __init__(self, tabuleiro, game_rounds): """Função para preparar atributos necessários ao jogo, como tabuleiro inicial e numero de game_rounds. Tambem são iniciados o tabuleiro final, de 3 dimensões, sendo a primeira delas o quadro ...
stack_v2_sparse_classes_75kplus_train_067751
5,159
no_license
[ { "docstring": "Função para preparar atributos necessários ao jogo, como tabuleiro inicial e numero de game_rounds. Tambem são iniciados o tabuleiro final, de 3 dimensões, sendo a primeira delas o quadro dado, a altura e largura de um determinado tabuleiro.", "name": "__init__", "signature": "def __init...
6
stack_v2_sparse_classes_30k_train_030182
Implement the Python class `Jogo` described below. Class description: Classe para execução do Jogo da Vida Method signatures and docstrings: - def __init__(self, tabuleiro, game_rounds): Função para preparar atributos necessários ao jogo, como tabuleiro inicial e numero de game_rounds. Tambem são iniciados o tabuleir...
Implement the Python class `Jogo` described below. Class description: Classe para execução do Jogo da Vida Method signatures and docstrings: - def __init__(self, tabuleiro, game_rounds): Função para preparar atributos necessários ao jogo, como tabuleiro inicial e numero de game_rounds. Tambem são iniciados o tabuleir...
b61f63d2396f8fa6e90b7d9c74830306988c6f64
<|skeleton|> class Jogo: """Classe para execução do Jogo da Vida""" def __init__(self, tabuleiro, game_rounds): """Função para preparar atributos necessários ao jogo, como tabuleiro inicial e numero de game_rounds. Tambem são iniciados o tabuleiro final, de 3 dimensões, sendo a primeira delas o quadro ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Jogo: """Classe para execução do Jogo da Vida""" def __init__(self, tabuleiro, game_rounds): """Função para preparar atributos necessários ao jogo, como tabuleiro inicial e numero de game_rounds. Tambem são iniciados o tabuleiro final, de 3 dimensões, sendo a primeira delas o quadro dado, a altur...
the_stack_v2_python_sparse
lab09/main.py
kinderferraz/mc102
train
0
09edf147777f1ff5956cb528ee35ae9c7e033b25
[ "super(DeviceTarget, self).__init__()\nself.region = region\nself.role = role\nself.network = network\nself.hostname = hostname\nself.realm = 'ACQ_CHROME'\nself.alertable = True\nself._fields = ('region', 'role', 'network', 'hostname')", "collection.network_device.metro = self.region\ncollection.network_device.ro...
<|body_start_0|> super(DeviceTarget, self).__init__() self.region = region self.role = role self.network = network self.hostname = hostname self.realm = 'ACQ_CHROME' self.alertable = True self._fields = ('region', 'role', 'network', 'hostname') <|end_body_...
Monitoring interface class for monitoring specific hosts or devices.
DeviceTarget
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceTarget: """Monitoring interface class for monitoring specific hosts or devices.""" def __init__(self, region, role, network, hostname): """Create a Target object exporting info about a specific device. Args: region (str): physical region in which the device is located. role (st...
stack_v2_sparse_classes_75kplus_train_067752
4,448
permissive
[ { "docstring": "Create a Target object exporting info about a specific device. Args: region (str): physical region in which the device is located. role (str): role of the device. network (str): virtual network on which the device is located. hostname (str): name by which the device self-identifies.", "name"...
2
stack_v2_sparse_classes_30k_train_029232
Implement the Python class `DeviceTarget` described below. Class description: Monitoring interface class for monitoring specific hosts or devices. Method signatures and docstrings: - def __init__(self, region, role, network, hostname): Create a Target object exporting info about a specific device. Args: region (str):...
Implement the Python class `DeviceTarget` described below. Class description: Monitoring interface class for monitoring specific hosts or devices. Method signatures and docstrings: - def __init__(self, region, role, network, hostname): Create a Target object exporting info about a specific device. Args: region (str):...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class DeviceTarget: """Monitoring interface class for monitoring specific hosts or devices.""" def __init__(self, region, role, network, hostname): """Create a Target object exporting info about a specific device. Args: region (str): physical region in which the device is located. role (st...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeviceTarget: """Monitoring interface class for monitoring specific hosts or devices.""" def __init__(self, region, role, network, hostname): """Create a Target object exporting info about a specific device. Args: region (str): physical region in which the device is located. role (str): role of t...
the_stack_v2_python_sparse
third_party/gae_ts_mon/gae_ts_mon/common/targets.py
catapult-project/catapult
train
2,032
6177e37be64b94b52bf5b0bf6e35181e92159170
[ "self.interval = interval\nthread = threading.Thread(target=self.update_information, args=())\nthread.setDaemon(True)\nthread.start()", "while True:\n full_weather = prediction_weather_funct()\n print(f'#### Updating Weather Information @ {datetime.now()} ####')\n self.update = Weatherforecast\n sle...
<|body_start_0|> self.interval = interval thread = threading.Thread(target=self.update_information, args=()) thread.setDaemon(True) thread.start() <|end_body_0|> <|body_start_1|> while True: full_weather = prediction_weather_funct() print(f'#### Updating...
Weatherforecast
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Weatherforecast: def __init__(self, interval): """Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function""" <|body_0|> def update_information(self): """Method that runs in b...
stack_v2_sparse_classes_75kplus_train_067753
5,735
no_license
[ { "docstring": "Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function", "name": "__init__", "signature": "def __init__(self, interval)" }, { "docstring": "Method that runs in background updating global...
2
stack_v2_sparse_classes_30k_train_000484
Implement the Python class `Weatherforecast` described below. Class description: Implement the Weatherforecast class. Method signatures and docstrings: - def __init__(self, interval): Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running u...
Implement the Python class `Weatherforecast` described below. Class description: Implement the Weatherforecast class. Method signatures and docstrings: - def __init__(self, interval): Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running u...
5efeebedd4695ef9d904beb707a1538ba049b187
<|skeleton|> class Weatherforecast: def __init__(self, interval): """Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function""" <|body_0|> def update_information(self): """Method that runs in b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Weatherforecast: def __init__(self, interval): """Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function""" self.interval = interval thread = threading.Thread(target=self.update_information, a...
the_stack_v2_python_sparse
dbbus/apps/prediction/get_prediction.py
mofiebiger/DublinBus
train
1
ff0079322c9c2cf6171813bc663a3b31c2aaa26c
[ "for entity in obj.entity_set.all():\n if user.has_perm('share_entity', entity):\n update_permission(entity, payload)\nfor data in obj.data.all():\n if user.has_perm('share_data', data):\n update_permission(data, payload)", "if not request.user.is_authenticated:\n raise exceptions.NotFound\...
<|body_start_0|> for entity in obj.entity_set.all(): if user.has_perm('share_entity', entity): update_permission(entity, payload) for data in obj.data.all(): if user.has_perm('share_data', data): update_permission(data, payload) <|end_body_0|> <|b...
Base API view for :class:`Collection` objects.
BaseCollectionViewSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseCollectionViewSet: """Base API view for :class:`Collection` objects.""" def set_content_permissions(self, user, obj, payload): """Apply permissions to data objects and entities in ``Collection``.""" <|body_0|> def create(self, request, *args, **kwargs): """On...
stack_v2_sparse_classes_75kplus_train_067754
3,589
permissive
[ { "docstring": "Apply permissions to data objects and entities in ``Collection``.", "name": "set_content_permissions", "signature": "def set_content_permissions(self, user, obj, payload)" }, { "docstring": "Only authenticated users can create new collections.", "name": "create", "signatu...
3
stack_v2_sparse_classes_30k_train_028757
Implement the Python class `BaseCollectionViewSet` described below. Class description: Base API view for :class:`Collection` objects. Method signatures and docstrings: - def set_content_permissions(self, user, obj, payload): Apply permissions to data objects and entities in ``Collection``. - def create(self, request,...
Implement the Python class `BaseCollectionViewSet` described below. Class description: Base API view for :class:`Collection` objects. Method signatures and docstrings: - def set_content_permissions(self, user, obj, payload): Apply permissions to data objects and entities in ``Collection``. - def create(self, request,...
11a06a9d741dcc999253246919a0abc12127fd2a
<|skeleton|> class BaseCollectionViewSet: """Base API view for :class:`Collection` objects.""" def set_content_permissions(self, user, obj, payload): """Apply permissions to data objects and entities in ``Collection``.""" <|body_0|> def create(self, request, *args, **kwargs): """On...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseCollectionViewSet: """Base API view for :class:`Collection` objects.""" def set_content_permissions(self, user, obj, payload): """Apply permissions to data objects and entities in ``Collection``.""" for entity in obj.entity_set.all(): if user.has_perm('share_entity', entit...
the_stack_v2_python_sparse
resolwe/flow/views/collection.py
romunov/resolwe
train
0
19f554cea5cb47ccc4ef7343ca148521649c8468
[ "def preorder(node: TreeNode, vals: List[str]):\n if node == None:\n vals.append('null')\n return\n vals.append(node.val)\n preorder(node.left, vals)\n preorder(node.right, vals)\nvals = []\npreorder(root, vals)\nreturn '#'.join(map(str, vals))", "vals = deque(data.split('#'))\n\ndef con...
<|body_start_0|> def preorder(node: TreeNode, vals: List[str]): if node == None: vals.append('null') return vals.append(node.val) preorder(node.left, vals) preorder(node.right, vals) vals = [] preorder(root, vals) ...
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|> <|end_skeleton|> <|body_start_0|> def preorder(n...
stack_v2_sparse_classes_75kplus_train_067755
1,012
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" } ]
2
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.
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. <|skeleton|> class Co...
4b1c76729576684331a8f1cdd7ced8b757c20fea
<|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|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def preorder(node: TreeNode, vals: List[str]): if node == None: vals.append('null') return vals.append(node.val) preorder(node.left, v...
the_stack_v2_python_sparse
0449_SerializeandDeserializeBST.py
ysonggit/leetcode_python
train
1
35e3dc56730612e0299c97f3686bb8e0ba37a776
[ "super().__init__(name=name)\nself.pool = pool\nself._queue = message_queue\nself.daemon = True\nself.idle = True\nself.started = time.time()", "if self.pool.name:\n time_in_queue = time.time() - queueing_time\n THREADPOOL_QUEUEING_TIME.RecordEvent(time_in_queue, fields=[self.pool.name])\n start_time = t...
<|body_start_0|> super().__init__(name=name) self.pool = pool self._queue = message_queue self.daemon = True self.idle = True self.started = time.time() <|end_body_0|> <|body_start_1|> if self.pool.name: time_in_queue = time.time() - queueing_time ...
The workers used in the ThreadPool class.
_WorkerThread
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _WorkerThread: """The workers used in the ThreadPool class.""" def __init__(self, message_queue, pool, name): """Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the work...
stack_v2_sparse_classes_75kplus_train_067756
18,809
permissive
[ { "docstring": "Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the workers. When a new task arrives, the ThreadPool notifies the workers by putting a message into this queue that has the format (t...
4
stack_v2_sparse_classes_30k_train_005530
Implement the Python class `_WorkerThread` described below. Class description: The workers used in the ThreadPool class. Method signatures and docstrings: - def __init__(self, message_queue, pool, name): Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object ...
Implement the Python class `_WorkerThread` described below. Class description: The workers used in the ThreadPool class. Method signatures and docstrings: - def __init__(self, message_queue, pool, name): Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object ...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class _WorkerThread: """The workers used in the ThreadPool class.""" def __init__(self, message_queue, pool, name): """Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the work...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _WorkerThread: """The workers used in the ThreadPool class.""" def __init__(self, message_queue, pool, name): """Initializer. This creates a new worker object for the ThreadPool class. Args: message_queue: A queue.Queue object used by the ThreadPool class to communicate with the workers. When a n...
the_stack_v2_python_sparse
grr/server/grr_response_server/threadpool.py
google/grr
train
4,683
716ef9c278520a0843fa7e35eab10fe209c1c948
[ "self.d = {}\nfor i in range(len(words)):\n w = words[i]\n if w in self.d:\n self.d[w].append(i)\n else:\n self.d[w] = [i]", "l1 = self.d[word1]\nl2 = self.d[word2]\nans = float('inf')\nfor i in l1:\n for j in l2:\n if abs(i - j) < ans:\n ans = abs(i - j)\nreturn ans" ]
<|body_start_0|> self.d = {} for i in range(len(words)): w = words[i] if w in self.d: self.d[w].append(i) else: self.d[w] = [i] <|end_body_0|> <|body_start_1|> l1 = self.d[word1] l2 = self.d[word2] ans = float('...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.d = {} for i in range(le...
stack_v2_sparse_classes_75kplus_train_067757
805
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_test_001740
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
70f16a872cb203f77eeddb812e734ad1d46df79d
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.d = {} for i in range(len(words)): w = words[i] if w in self.d: self.d[w].append(i) else: self.d[w] = [i] def shortest(self, word1, word2)...
the_stack_v2_python_sparse
shortest-word-distance-2.py
cannium/leetcode
train
0
74e321235641f5236347577cbaa23bf3cea9df40
[ "kwargs = {}\ndefault_style = self.get('default_style', None)\nif default_style is None or default_style == 'mpl':\n if artist == 'Patch':\n kwargs['fill'] = False\n elif artist == 'Line2D':\n kwargs['fillstyle'] = 'none'\n kwargs['marker'] = 'o'\n return kwargs\nelif default_style == ...
<|body_start_0|> kwargs = {} default_style = self.get('default_style', None) if default_style is None or default_style == 'mpl': if artist == 'Patch': kwargs['fill'] = False elif artist == 'Line2D': kwargs['fillstyle'] = 'none' ...
A dictionary subclass which holds the visual attributes of the region.
RegionVisual
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegionVisual: """A dictionary subclass which holds the visual attributes of the region.""" def _define_default_mpl_kwargs(self, artist): """Define the default matplotlib kwargs for the specified artist. The kwargs depend on the value of self.visual['default_style'], which can be set ...
stack_v2_sparse_classes_75kplus_train_067758
6,399
permissive
[ { "docstring": "Define the default matplotlib kwargs for the specified artist. The kwargs depend on the value of self.visual['default_style'], which can be set when reading region files. If this keywords is not set or set to 'mpl' or `None`, then the matplotlib defaults will be used, with the exception fill is ...
3
stack_v2_sparse_classes_30k_train_013742
Implement the Python class `RegionVisual` described below. Class description: A dictionary subclass which holds the visual attributes of the region. Method signatures and docstrings: - def _define_default_mpl_kwargs(self, artist): Define the default matplotlib kwargs for the specified artist. The kwargs depend on the...
Implement the Python class `RegionVisual` described below. Class description: A dictionary subclass which holds the visual attributes of the region. Method signatures and docstrings: - def _define_default_mpl_kwargs(self, artist): Define the default matplotlib kwargs for the specified artist. The kwargs depend on the...
3d469f7a33e5d674df99afa62094df183e69ac85
<|skeleton|> class RegionVisual: """A dictionary subclass which holds the visual attributes of the region.""" def _define_default_mpl_kwargs(self, artist): """Define the default matplotlib kwargs for the specified artist. The kwargs depend on the value of self.visual['default_style'], which can be set ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegionVisual: """A dictionary subclass which holds the visual attributes of the region.""" def _define_default_mpl_kwargs(self, artist): """Define the default matplotlib kwargs for the specified artist. The kwargs depend on the value of self.visual['default_style'], which can be set when reading ...
the_stack_v2_python_sparse
regions/core/metadata.py
simrit1/regions
train
0
8651b6bd2cbd75d9aba12ad4cab767cf2202e9af
[ "stakeholder_categories = set()\nfor stakeholder_category in self.stakeholdercategory_set.all():\n stakeholder_categories.add(stakeholder_category)\nreturn stakeholder_categories", "implementations = set()\nfor uic in self.userincasestudy_set.all():\n for implementation in uic.implementation_set.all():\n ...
<|body_start_0|> stakeholder_categories = set() for stakeholder_category in self.stakeholdercategory_set.all(): stakeholder_categories.add(stakeholder_category) return stakeholder_categories <|end_body_0|> <|body_start_1|> implementations = set() for uic in self.user...
CaseStudy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseStudy: def stakeholder_categories(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_0|> def implementations(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus_train_067759
3,398
no_license
[ { "docstring": "look for all stakeholder categories created by the users of the casestudy", "name": "stakeholder_categories", "signature": "def stakeholder_categories(self)" }, { "docstring": "look for all stakeholder categories created by the users of the casestudy", "name": "implementation...
2
stack_v2_sparse_classes_30k_train_021270
Implement the Python class `CaseStudy` described below. Class description: Implement the CaseStudy class. Method signatures and docstrings: - def stakeholder_categories(self): look for all stakeholder categories created by the users of the casestudy - def implementations(self): look for all stakeholder categories cre...
Implement the Python class `CaseStudy` described below. Class description: Implement the CaseStudy class. Method signatures and docstrings: - def stakeholder_categories(self): look for all stakeholder categories created by the users of the casestudy - def implementations(self): look for all stakeholder categories cre...
a5ba34f085f0d5af5ea3ded24706ea54ab39e7cb
<|skeleton|> class CaseStudy: def stakeholder_categories(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_0|> def implementations(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CaseStudy: def stakeholder_categories(self): """look for all stakeholder categories created by the users of the casestudy""" stakeholder_categories = set() for stakeholder_category in self.stakeholdercategory_set.all(): stakeholder_categories.add(stakeholder_category) ...
the_stack_v2_python_sparse
repair/apps/login/models/users.py
MaxBo/REPAiR-Web
train
9
9f2f7bdbe644fc84c68066666508221cd7e6e9bc
[ "super().__init__(**kwargs)\nself.fc1 = keras.layers.Dense(128, activation='relu')\nself.reshape = keras.layers.Reshape((4, 4, 8))\nself.conv1 = keras.layers.Conv2D(8, (3, 3), padding='same', activation='relu')\nself.up1 = keras.layers.UpSampling2D(size=(2, 2))\nself.conv2 = keras.layers.Conv2D(8, (3, 3), padding='...
<|body_start_0|> super().__init__(**kwargs) self.fc1 = keras.layers.Dense(128, activation='relu') self.reshape = keras.layers.Reshape((4, 4, 8)) self.conv1 = keras.layers.Conv2D(8, (3, 3), padding='same', activation='relu') self.up1 = keras.layers.UpSampling2D(size=(2, 2)) ...
MNIST decoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of a fully connected layer of 128 units with ReLU activation followed by a convolutional block. The convolutional block consists fo 4 convolutional layers having 8, 8, 8 and 1 channels and a kernel size of 3. Each convo...
MNISTDecoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MNISTDecoder: """MNIST decoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of a fully connected layer of 128 units with ReLU activation followed by a convolutional block. The convolutional block consists fo 4 convolutional layers having 8, 8, 8 and 1 cha...
stack_v2_sparse_classes_75kplus_train_067760
8,692
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, **kwargs) -> None" }, { "docstring": "Forward pass. Parameters ---------- x Input tensor **kwargs Other arguments. Not used. Returns ------- Decoded input having each component in the interval [0, 1].", "name...
2
stack_v2_sparse_classes_30k_train_043072
Implement the Python class `MNISTDecoder` described below. Class description: MNIST decoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of a fully connected layer of 128 units with ReLU activation followed by a convolutional block. The convolutional block consists fo 4 convol...
Implement the Python class `MNISTDecoder` described below. Class description: MNIST decoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of a fully connected layer of 128 units with ReLU activation followed by a convolutional block. The convolutional block consists fo 4 convol...
54d0c957fb01c7ebba4e2a0d28fcbde52d9c6718
<|skeleton|> class MNISTDecoder: """MNIST decoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of a fully connected layer of 128 units with ReLU activation followed by a convolutional block. The convolutional block consists fo 4 convolutional layers having 8, 8, 8 and 1 cha...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MNISTDecoder: """MNIST decoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of a fully connected layer of 128 units with ReLU activation followed by a convolutional block. The convolutional block consists fo 4 convolutional layers having 8, 8, 8 and 1 channels and a k...
the_stack_v2_python_sparse
alibi/models/tensorflow/cfrl_models.py
SeldonIO/alibi
train
2,143
b1ff2060acac96a8e9f2bc7cd650a942daa1ba20
[ "\"\"\"\n 解决方案:\n url:https://leetcode.com/problems/rle-iterator/discuss/176553/Python-simple-pointer-to-next-element\n 1. 不单独构建新的列表结构,只标记取数的位置,迭代读取返回结果\n url: https://leetcode.com/problems/rle-iterator/discuss/175683/Python-Binary-Search-Solution-beats-100\n 2. 组成取值列表和索引列表映射,next...
<|body_start_0|> """ 解决方案: url:https://leetcode.com/problems/rle-iterator/discuss/176553/Python-simple-pointer-to-next-element 1. 不单独构建新的列表结构,只标记取数的位置,迭代读取返回结果 url: https://leetcode.com/problems/rle-iterator/discuss/175683/Python-Binary-Search-Solu...
RLEIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ 解决方案: url:https://leetcode.com/problems/rle-it...
stack_v2_sparse_classes_75kplus_train_067761
1,523
no_license
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
stack_v2_sparse_classes_30k_val_000115
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
a39280ab6bbbf3b688a024a71ef952be5010d98e
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RLEIterator: def __init__(self, A): """:type A: List[int]""" """ 解决方案: url:https://leetcode.com/problems/rle-iterator/discuss/176553/Python-simple-pointer-to-next-element 1. 不单独构建新的列表结构,只标记取数的位置,迭代读取返回结果 url: https://leetcode.com/...
the_stack_v2_python_sparse
900_RLE_Iterator.py
MarcelArthur/leetcode_collection
train
0
369a3cd231756a93fc7429f5f6a144adbbac262b
[ "kwargs = {'bk_username': bk_username, 'bk_biz_id': bk_biz_id}\nkwargs.update(params)\nreturn JobApi.get_job_list(kwargs)", "kwargs = {'bk_username': bk_username, 'bk_biz_id': bk_biz_id, 'bk_job_id': bk_job_id}\nresponse = JobApi.get_job_detail(kwargs)\nreturn response", "kwargs = {'bk_username': bk_username, '...
<|body_start_0|> kwargs = {'bk_username': bk_username, 'bk_biz_id': bk_biz_id} kwargs.update(params) return JobApi.get_job_list(kwargs) <|end_body_0|> <|body_start_1|> kwargs = {'bk_username': bk_username, 'bk_biz_id': bk_biz_id, 'bk_job_id': bk_job_id} response = JobApi.get_job...
JOB3.0 接口
JOB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JOB: """JOB3.0 接口""" def get_job_list(self, bk_username, bk_biz_id, **params): """查询作业执行方案列表 :param bk_username: 用户 :param bk_biz_id: 业务ID :param params: 过滤条件 creator name create_time_start create_time_end last_modify_user last_modify_time_start last_modify_time_end start length :ret...
stack_v2_sparse_classes_75kplus_train_067762
4,972
permissive
[ { "docstring": "查询作业执行方案列表 :param bk_username: 用户 :param bk_biz_id: 业务ID :param params: 过滤条件 creator name create_time_start create_time_end last_modify_user last_modify_time_start last_modify_time_end start length :return: [ { \"bk_biz_id\": 1, \"bk_job_id\": 100, \"name\": \"test\", \"creator\": \"admin\", \"l...
6
stack_v2_sparse_classes_30k_train_039273
Implement the Python class `JOB` described below. Class description: JOB3.0 接口 Method signatures and docstrings: - def get_job_list(self, bk_username, bk_biz_id, **params): 查询作业执行方案列表 :param bk_username: 用户 :param bk_biz_id: 业务ID :param params: 过滤条件 creator name create_time_start create_time_end last_modify_user last...
Implement the Python class `JOB` described below. Class description: JOB3.0 接口 Method signatures and docstrings: - def get_job_list(self, bk_username, bk_biz_id, **params): 查询作业执行方案列表 :param bk_username: 用户 :param bk_biz_id: 业务ID :param params: 过滤条件 creator name create_time_start create_time_end last_modify_user last...
da37fb2197142eae32158cdb5c2b658100133fff
<|skeleton|> class JOB: """JOB3.0 接口""" def get_job_list(self, bk_username, bk_biz_id, **params): """查询作业执行方案列表 :param bk_username: 用户 :param bk_biz_id: 业务ID :param params: 过滤条件 creator name create_time_start create_time_end last_modify_user last_modify_time_start last_modify_time_end start length :ret...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JOB: """JOB3.0 接口""" def get_job_list(self, bk_username, bk_biz_id, **params): """查询作业执行方案列表 :param bk_username: 用户 :param bk_biz_id: 业务ID :param params: 过滤条件 creator name create_time_start create_time_end last_modify_user last_modify_time_start last_modify_time_end start length :return: [ { "bk_...
the_stack_v2_python_sparse
module_api/bk_esb/job.py
cz-qq/bk-chatbot
train
0
6c9978829790d426af95855e5b91d5b9275d2b6c
[ "super(FemAdapter, self).__init__(**kwargs)\nself.fem = Fem()\nlogging.debug('Fem Adapter loaded')", "try:\n response = self.fem.get(path)\n status_code = 200\nexcept ParameterTreeError as e:\n response = {'error': str(e)}\n status_code = 400\ncontent_type = 'application/json'\nreturn ApiAdapterRespon...
<|body_start_0|> super(FemAdapter, self).__init__(**kwargs) self.fem = Fem() logging.debug('Fem Adapter loaded') <|end_body_0|> <|body_start_1|> try: response = self.fem.get(path) status_code = 200 except ParameterTreeError as e: response = {'...
This is a comment
FemAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FemAdapter: """This is a comment""" def __init__(self, **kwargs): """Initialize the FemAdapter object. This constructor initializes the FemAdapter object. :param kwargs: keyword arguments specifying options""" <|body_0|> def get(self, path, request): """Handle an...
stack_v2_sparse_classes_75kplus_train_067763
15,356
no_license
[ { "docstring": "Initialize the FemAdapter object. This constructor initializes the FemAdapter object. :param kwargs: keyword arguments specifying options", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Handle an HTTP GET request. This method handles an HTTP G...
4
stack_v2_sparse_classes_30k_train_043995
Implement the Python class `FemAdapter` described below. Class description: This is a comment Method signatures and docstrings: - def __init__(self, **kwargs): Initialize the FemAdapter object. This constructor initializes the FemAdapter object. :param kwargs: keyword arguments specifying options - def get(self, path...
Implement the Python class `FemAdapter` described below. Class description: This is a comment Method signatures and docstrings: - def __init__(self, **kwargs): Initialize the FemAdapter object. This constructor initializes the FemAdapter object. :param kwargs: keyword arguments specifying options - def get(self, path...
e8a1adba28f2efe8ab6004cd70f05aebb1ee6349
<|skeleton|> class FemAdapter: """This is a comment""" def __init__(self, **kwargs): """Initialize the FemAdapter object. This constructor initializes the FemAdapter object. :param kwargs: keyword arguments specifying options""" <|body_0|> def get(self, path, request): """Handle an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FemAdapter: """This is a comment""" def __init__(self, **kwargs): """Initialize the FemAdapter object. This constructor initializes the FemAdapter object. :param kwargs: keyword arguments specifying options""" super(FemAdapter, self).__init__(**kwargs) self.fem = Fem() log...
the_stack_v2_python_sparse
control/src/qemii/fem/FemAdapter.py
stfc-aeg/qemii-detector
train
0
57e0c8cea5496712f21068a1f541a2f132dafed8
[ "await super().setup()\nlimits = {}\nfor auth_method in self.auth_methods:\n limit = await RateLimitCentral.get(app_data=self.app_data, auth_method=auth_method, endpoint=self.endpoint)\n self.log(f'{auth_method.name}: {limit}')\n if limit and limit.remaining == 0:\n limits[auth_method] = limit\n ...
<|body_start_0|> await super().setup() limits = {} for auth_method in self.auth_methods: limit = await RateLimitCentral.get(app_data=self.app_data, auth_method=auth_method, endpoint=self.endpoint) self.log(f'{auth_method.name}: {limit}') if limit and limit.rem...
Base class for production queries. These are queries that should have their rate limits counted.
ProductionRequestQuery
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductionRequestQuery: """Base class for production queries. These are queries that should have their rate limits counted.""" async def setup(self): """Method called immediately before the query runs.""" <|body_0|> async def finalise(self, response: httpx.Response): ...
stack_v2_sparse_classes_75kplus_train_067764
2,563
permissive
[ { "docstring": "Method called immediately before the query runs.", "name": "setup", "signature": "async def setup(self)" }, { "docstring": "Method called immediately after the query runs. Args: response: Response to query", "name": "finalise", "signature": "async def finalise(self, respo...
2
stack_v2_sparse_classes_30k_train_043403
Implement the Python class `ProductionRequestQuery` described below. Class description: Base class for production queries. These are queries that should have their rate limits counted. Method signatures and docstrings: - async def setup(self): Method called immediately before the query runs. - async def finalise(self...
Implement the Python class `ProductionRequestQuery` described below. Class description: Base class for production queries. These are queries that should have their rate limits counted. Method signatures and docstrings: - async def setup(self): Method called immediately before the query runs. - async def finalise(self...
387006356e10c0e1c9dad363cd927a67e3c48cde
<|skeleton|> class ProductionRequestQuery: """Base class for production queries. These are queries that should have their rate limits counted.""" async def setup(self): """Method called immediately before the query runs.""" <|body_0|> async def finalise(self, response: httpx.Response): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductionRequestQuery: """Base class for production queries. These are queries that should have their rate limits counted.""" async def setup(self): """Method called immediately before the query runs.""" await super().setup() limits = {} for auth_method in self.auth_metho...
the_stack_v2_python_sparse
src/twicorder/queries/request/production.py
thimic/twicorder-search
train
2
f7896a65c276f0bccef9d2e2fec950506b6fc2ea
[ "super().__init__()\nself._init_irreps(irreps_in=irreps_in, required_irreps_in=[AtomicDataDict.EDGE_EMBEDDING_KEY, AtomicDataDict.EDGE_ATTRS_KEY, AtomicDataDict.NODE_FEATURES_KEY, AtomicDataDict.NODE_ATTRS_KEY], my_irreps_in={AtomicDataDict.EDGE_EMBEDDING_KEY: o3.Irreps([(irreps_in[AtomicDataDict.EDGE_EMBEDDING_KEY...
<|body_start_0|> super().__init__() self._init_irreps(irreps_in=irreps_in, required_irreps_in=[AtomicDataDict.EDGE_EMBEDDING_KEY, AtomicDataDict.EDGE_ATTRS_KEY, AtomicDataDict.NODE_FEATURES_KEY, AtomicDataDict.NODE_ATTRS_KEY], my_irreps_in={AtomicDataDict.EDGE_EMBEDDING_KEY: o3.Irreps([(irreps_in[Atomic...
InteractionBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractionBlock: def __init__(self, irreps_in, irreps_out, invariant_layers=1, invariant_neurons=8, avg_num_neighbors=None, use_sc=False, nonlinearity_scalars: Dict[int, Callable]={'e': 'ssp'}) -> None: """InteractionBlock. :param irreps_node_attr: Nodes attribute irreps :param irreps_e...
stack_v2_sparse_classes_75kplus_train_067765
6,446
permissive
[ { "docstring": "InteractionBlock. :param irreps_node_attr: Nodes attribute irreps :param irreps_edge_attr: Edge attribute irreps :param irreps_out: Output irreps, in our case typically a single scalar :param radial_layers: Number of radial layers, default = 1 :param radial_neurons: Number of hidden neurons in r...
2
null
Implement the Python class `InteractionBlock` described below. Class description: Implement the InteractionBlock class. Method signatures and docstrings: - def __init__(self, irreps_in, irreps_out, invariant_layers=1, invariant_neurons=8, avg_num_neighbors=None, use_sc=False, nonlinearity_scalars: Dict[int, Callable]...
Implement the Python class `InteractionBlock` described below. Class description: Implement the InteractionBlock class. Method signatures and docstrings: - def __init__(self, irreps_in, irreps_out, invariant_layers=1, invariant_neurons=8, avg_num_neighbors=None, use_sc=False, nonlinearity_scalars: Dict[int, Callable]...
ae8e3c3689b13e8963c4dddded07235f0d16c7dc
<|skeleton|> class InteractionBlock: def __init__(self, irreps_in, irreps_out, invariant_layers=1, invariant_neurons=8, avg_num_neighbors=None, use_sc=False, nonlinearity_scalars: Dict[int, Callable]={'e': 'ssp'}) -> None: """InteractionBlock. :param irreps_node_attr: Nodes attribute irreps :param irreps_e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InteractionBlock: def __init__(self, irreps_in, irreps_out, invariant_layers=1, invariant_neurons=8, avg_num_neighbors=None, use_sc=False, nonlinearity_scalars: Dict[int, Callable]={'e': 'ssp'}) -> None: """InteractionBlock. :param irreps_node_attr: Nodes attribute irreps :param irreps_edge_attr: Edge...
the_stack_v2_python_sparse
nequip/nn/_interaction_block.py
shuaijiang-ustc/nequip
train
0
7e91913068ca03a16b79fe00df1382b9c87c1836
[ "if value < 0:\n raise serializers.ValidationError('A tag rate value must be nonnegative.')\nreturn str(value)", "usage_start = usage.get('usage_start')\nusage_end = usage.get('usage_end')\nif usage_start and usage_start < 0:\n raise serializers.ValidationError('A tag rate usage_start must be positive.')\ni...
<|body_start_0|> if value < 0: raise serializers.ValidationError('A tag rate value must be nonnegative.') return str(value) <|end_body_0|> <|body_start_1|> usage_start = usage.get('usage_start') usage_end = usage.get('usage_end') if usage_start and usage_start < 0: ...
Serializer for the Tag Values.
TagRateValueSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagRateValueSerializer: """Serializer for the Tag Values.""" def validate_value(self, value): """Check that value is a positive value.""" <|body_0|> def validate_usage(self, usage): """Check that usage_start is a positive value.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_067766
26,058
permissive
[ { "docstring": "Check that value is a positive value.", "name": "validate_value", "signature": "def validate_value(self, value)" }, { "docstring": "Check that usage_start is a positive value.", "name": "validate_usage", "signature": "def validate_usage(self, usage)" } ]
2
null
Implement the Python class `TagRateValueSerializer` described below. Class description: Serializer for the Tag Values. Method signatures and docstrings: - def validate_value(self, value): Check that value is a positive value. - def validate_usage(self, usage): Check that usage_start is a positive value.
Implement the Python class `TagRateValueSerializer` described below. Class description: Serializer for the Tag Values. Method signatures and docstrings: - def validate_value(self, value): Check that value is a positive value. - def validate_usage(self, usage): Check that usage_start is a positive value. <|skeleton|>...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class TagRateValueSerializer: """Serializer for the Tag Values.""" def validate_value(self, value): """Check that value is a positive value.""" <|body_0|> def validate_usage(self, usage): """Check that usage_start is a positive value.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TagRateValueSerializer: """Serializer for the Tag Values.""" def validate_value(self, value): """Check that value is a positive value.""" if value < 0: raise serializers.ValidationError('A tag rate value must be nonnegative.') return str(value) def validate_usage(...
the_stack_v2_python_sparse
koku/cost_models/serializers.py
project-koku/koku
train
225
6d83e3273401ebbafb25ea5d9be6f4f43936e9f6
[ "super(BaselineDNN, self).__init__()\n...\n...\n...\n...\n...", "embeddings = ...\nrepresentations = ...\nrepresentations = ...\nlogits = ...\nreturn logits" ]
<|body_start_0|> super(BaselineDNN, self).__init__() ... ... ... ... ... <|end_body_0|> <|body_start_1|> embeddings = ... representations = ... representations = ... logits = ... return logits <|end_body_1|>
1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth)
BaselineDNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaselineDNN: """1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth)"""...
stack_v2_sparse_classes_75kplus_train_067767
1,913
permissive
[ { "docstring": "Args: output_size(int): the number of classes embeddings(bool): the 2D matrix with the pretrained embeddings trainable_emb(bool): train (finetune) or freeze the weights the embedding layer", "name": "__init__", "signature": "def __init__(self, output_size, embeddings, trainable_emb=False...
2
stack_v2_sparse_classes_30k_train_024819
Implement the Python class `BaselineDNN` described below. Class description: 1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the represent...
Implement the Python class `BaselineDNN` described below. Class description: 1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the represent...
37b06ac0bff1e380335912d9b442f884aeb3476d
<|skeleton|> class BaselineDNN: """1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth)"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaselineDNN: """1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth)""" def __i...
the_stack_v2_python_sparse
lab3/models.py
DidoStoikou/slp-labs
train
0
709b7a281bac1f3d1f7541e5bddaa9a7e7cf4786
[ "super(DeepNieFineCoattention, self).__init__()\nwith self.init_scope():\n self.energy_layer = links.Bilinear(hidden_dim, hidden_dim, 1)\n self.attention_layer_1 = GraphLinear(head, 1, nobias=True)\n self.attention_layer_2 = GraphLinear(head, 1, nobias=True)\n self.prev_lt_layer_1 = GraphLinear(hidden_d...
<|body_start_0|> super(DeepNieFineCoattention, self).__init__() with self.init_scope(): self.energy_layer = links.Bilinear(hidden_dim, hidden_dim, 1) self.attention_layer_1 = GraphLinear(head, 1, nobias=True) self.attention_layer_2 = GraphLinear(head, 1, nobias=True) ...
TODO
DeepNieFineCoattention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepNieFineCoattention: """TODO""" def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism""" ...
stack_v2_sparse_classes_75kplus_train_067768
25,561
permissive
[ { "docstring": ":param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism", "name": "__init__", "signature": "def __init__(self, hidden_dim, out_dim, head, activation=functions.identity)" }, { "do...
3
stack_v2_sparse_classes_30k_train_044767
Implement the Python class `DeepNieFineCoattention` described below. Class description: TODO Method signatures and docstrings: - def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): :param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :para...
Implement the Python class `DeepNieFineCoattention` described below. Class description: TODO Method signatures and docstrings: - def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): :param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :para...
21b64a3c8cc9bc33718ae09c65aa917e575132eb
<|skeleton|> class DeepNieFineCoattention: """TODO""" def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeepNieFineCoattention: """TODO""" def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism""" super(DeepNi...
the_stack_v2_python_sparse
models/coattention/nie_coattention.py
Minys233/GCN-BMP
train
1
2ca896048ca7bd589f7b9e2c6683912333343845
[ "row = g.db.query(Machine).get(machine_id)\nif not row:\n log.warning('Requested a non-existant machine: %s', machine_id)\n abort(http_client.NOT_FOUND, description='Machine not found')\nrecord = row.as_dict()\nrecord['url'] = url_for('machines.entry', machine_id=machine_id, _external=True)\nrecord['servers_u...
<|body_start_0|> row = g.db.query(Machine).get(machine_id) if not row: log.warning('Requested a non-existant machine: %s', machine_id) abort(http_client.NOT_FOUND, description='Machine not found') record = row.as_dict() record['url'] = url_for('machines.entry', ma...
Information about specific machines
MachineAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineAPI: """Information about specific machines""" def get(self, machine_id): """Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json""" <|body_0|> def put(self, args, machine_id): """Update machine Heartbe...
stack_v2_sparse_classes_75kplus_train_067769
10,491
permissive
[ { "docstring": "Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json", "name": "get", "signature": "def get(self, machine_id)" }, { "docstring": "Update machine Heartbeat and update the machine reference", "name": "put", "signature": ...
2
stack_v2_sparse_classes_30k_train_008965
Implement the Python class `MachineAPI` described below. Class description: Information about specific machines Method signatures and docstrings: - def get(self, machine_id): Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json - def put(self, args, machine_id): U...
Implement the Python class `MachineAPI` described below. Class description: Information about specific machines Method signatures and docstrings: - def get(self, machine_id): Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json - def put(self, args, machine_id): U...
2771bb46db7fd331448f9db3cfb257fab7f89bcc
<|skeleton|> class MachineAPI: """Information about specific machines""" def get(self, machine_id): """Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json""" <|body_0|> def put(self, args, machine_id): """Update machine Heartbe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MachineAPI: """Information about specific machines""" def get(self, machine_id): """Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json""" row = g.db.query(Machine).get(machine_id) if not row: log.warning('Requeste...
the_stack_v2_python_sparse
driftbase/api/machines.py
directivegames/drift-base
train
1
603f0e245d347a0b66bd21a8d55c99d56806996b
[ "self.request = request\nself.corrected_query = corrected_query\nself.qid = qid\nself.engine_query = engine_query\nself.total_results = total_results\nself.total_pages = total_pages\nself.more_search_results_url = more_search_results_url\nself.search_results_map = search_results_map\nself.item = item\nself.search_b...
<|body_start_0|> self.request = request self.corrected_query = corrected_query self.qid = qid self.engine_query = engine_query self.total_results = total_results self.total_pages = total_pages self.more_search_results_url = more_search_results_url self.sea...
Implementation of the 'Items' model. TODO: type model description here. Attributes: request (Request): TODO: type description here. corrected_query (CorrectedQuery): TODO: type description here. qid (string): TODO: type description here. engine_query (string): TODO: type description here. total_results (int): TODO: typ...
Items
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Items: """Implementation of the 'Items' model. TODO: type model description here. Attributes: request (Request): TODO: type description here. corrected_query (CorrectedQuery): TODO: type description here. qid (string): TODO: type description here. engine_query (string): TODO: type description her...
stack_v2_sparse_classes_75kplus_train_067770
4,653
permissive
[ { "docstring": "Constructor for the Items class", "name": "__init__", "signature": "def __init__(self, request=None, corrected_query=None, qid=None, engine_query=None, total_results=None, total_pages=None, more_search_results_url=None, search_results_map=None, item=None, search_bin_sets=None)" }, { ...
2
stack_v2_sparse_classes_30k_train_026379
Implement the Python class `Items` described below. Class description: Implementation of the 'Items' model. TODO: type model description here. Attributes: request (Request): TODO: type description here. corrected_query (CorrectedQuery): TODO: type description here. qid (string): TODO: type description here. engine_que...
Implement the Python class `Items` described below. Class description: Implementation of the 'Items' model. TODO: type model description here. Attributes: request (Request): TODO: type description here. corrected_query (CorrectedQuery): TODO: type description here. qid (string): TODO: type description here. engine_que...
26ea1019115a1de3b1b37a4b830525e164ac55ce
<|skeleton|> class Items: """Implementation of the 'Items' model. TODO: type model description here. Attributes: request (Request): TODO: type description here. corrected_query (CorrectedQuery): TODO: type description here. qid (string): TODO: type description here. engine_query (string): TODO: type description her...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Items: """Implementation of the 'Items' model. TODO: type model description here. Attributes: request (Request): TODO: type description here. corrected_query (CorrectedQuery): TODO: type description here. qid (string): TODO: type description here. engine_query (string): TODO: type description here. total_resu...
the_stack_v2_python_sparse
awsecommerceservice/models/items.py
nidaizamir/Test-PY
train
0
45b9035f0c336e70acd4e0636e2f7f25b41f34b3
[ "if not citations:\n return 0\ncitations.sort()\nn = len(citations)\nleft, right = (0, n - 1)\nwhile left <= right:\n pivot = left + (right - left) // 2\n if citations[pivot] == n - pivot:\n return n - pivot\n elif citations[pivot] > n - pivot:\n right = pivot - 1\n else:\n left ...
<|body_start_0|> if not citations: return 0 citations.sort() n = len(citations) left, right = (0, n - 1) while left <= right: pivot = left + (right - left) // 2 if citations[pivot] == n - pivot: return n - pivot elif...
Array
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Array: def find_h_index(self, citations: List[int]) -> int: """Approach: Sorting + Binary Search Time Complexity: O(N log N) Space Complexity: O(1) :param citations: :return:""" <|body_0|> def h_index_optimized(self, citations: List[int]) -> int: """Approach: Counter...
stack_v2_sparse_classes_75kplus_train_067771
1,590
no_license
[ { "docstring": "Approach: Sorting + Binary Search Time Complexity: O(N log N) Space Complexity: O(1) :param citations: :return:", "name": "find_h_index", "signature": "def find_h_index(self, citations: List[int]) -> int" }, { "docstring": "Approach: Counter Time Complexity: O(N) Space Complexity...
2
stack_v2_sparse_classes_30k_train_026263
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def find_h_index(self, citations: List[int]) -> int: Approach: Sorting + Binary Search Time Complexity: O(N log N) Space Complexity: O(1) :param citations: :return: - def h_index_optim...
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def find_h_index(self, citations: List[int]) -> int: Approach: Sorting + Binary Search Time Complexity: O(N log N) Space Complexity: O(1) :param citations: :return: - def h_index_optim...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Array: def find_h_index(self, citations: List[int]) -> int: """Approach: Sorting + Binary Search Time Complexity: O(N log N) Space Complexity: O(1) :param citations: :return:""" <|body_0|> def h_index_optimized(self, citations: List[int]) -> int: """Approach: Counter...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Array: def find_h_index(self, citations: List[int]) -> int: """Approach: Sorting + Binary Search Time Complexity: O(N log N) Space Complexity: O(1) :param citations: :return:""" if not citations: return 0 citations.sort() n = len(citations) left, right = (0,...
the_stack_v2_python_sparse
goldman_sachs/h_index.py
Shiv2157k/leet_code
train
1
3ca9ed498b8c4ee00062889e80d79ef68b77e7c4
[ "for key, func in _default_parameters.iteritems():\n ids = not force and self.search(cr, SUPERUSER_ID, [('key', '=', key)])\n if not ids:\n value, groups = func()\n self.set_param(cr, SUPERUSER_ID, key, value, groups=groups)", "ids = self.search(cr, uid, [('key', '=', key)], context=context)\n...
<|body_start_0|> for key, func in _default_parameters.iteritems(): ids = not force and self.search(cr, SUPERUSER_ID, [('key', '=', key)]) if not ids: value, groups = func() self.set_param(cr, SUPERUSER_ID, key, value, groups=groups) <|end_body_0|> <|body_...
Per-database storage of configuration key-value pairs.
ir_config_parameter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ir_config_parameter: """Per-database storage of configuration key-value pairs.""" def init(self, cr, force=False): """Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.""" <|body_0|> def get_param(self, cr, ui...
stack_v2_sparse_classes_75kplus_train_067772
4,580
no_license
[ { "docstring": "Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.", "name": "init", "signature": "def init(self, cr, force=False)" }, { "docstring": "Retrieve the value for a given key. :param string key: The key of the parameter val...
3
stack_v2_sparse_classes_30k_train_025612
Implement the Python class `ir_config_parameter` described below. Class description: Per-database storage of configuration key-value pairs. Method signatures and docstrings: - def init(self, cr, force=False): Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True...
Implement the Python class `ir_config_parameter` described below. Class description: Per-database storage of configuration key-value pairs. Method signatures and docstrings: - def init(self, cr, force=False): Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True...
d8a531ae9ade5f3e1f49c7d1b21583fbe1b8c09e
<|skeleton|> class ir_config_parameter: """Per-database storage of configuration key-value pairs.""" def init(self, cr, force=False): """Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.""" <|body_0|> def get_param(self, cr, ui...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ir_config_parameter: """Per-database storage of configuration key-value pairs.""" def init(self, cr, force=False): """Initializes the parameters listed in _default_parameters. It overrides existing parameters if force is ``True``.""" for key, func in _default_parameters.iteritems(): ...
the_stack_v2_python_sparse
odoo/openerp/addons/base/ir/ir_config_parameter.py
ihyf/raspberry_pi
train
1
370282cfe5923af9b8812e4f7ba3477acb7a7766
[ "name_parts = value.split('-')\nfor index in range(len(name_parts)):\n name_part = name_parts[index]\n if len(name_part) < 4:\n name_part = name_part.upper()\n else:\n name_part = name_part.capitalize()\n name_parts[index] = name_part\nname = ' '.join(name_parts)\nself = object.__new__(cls...
<|body_start_0|> name_parts = value.split('-') for index in range(len(name_parts)): name_part = name_parts[index] if len(name_part) < 4: name_part = name_part.upper() else: name_part = name_part.capitalize() name_parts[index...
Represents Discord's voice regions. Attributes ---------- custom : `bool` Whether the voice region is custom (used for events, etc.). deprecated : `bool` Whether the voice region is deprecated. value : `str` The unique identifier of the voice region. name : `str` The name of the voice region. vip : `bool` Whether the v...
VoiceRegion
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoiceRegion: """Represents Discord's voice regions. Attributes ---------- custom : `bool` Whether the voice region is custom (used for events, etc.). deprecated : `bool` Whether the voice region is deprecated. value : `str` The unique identifier of the voice region. name : `str` The name of the v...
stack_v2_sparse_classes_75kplus_train_067773
15,278
permissive
[ { "docstring": "Creates a voice region from the given id and stores it at class's `.INSTANCES`. Called by `.get` when no voice region was found with the given id. Parameters ---------- value : `str` The identifier of the voice region. Returns ------- self : ``VoiceRegion``", "name": "_from_value", "sign...
3
stack_v2_sparse_classes_30k_train_045064
Implement the Python class `VoiceRegion` described below. Class description: Represents Discord's voice regions. Attributes ---------- custom : `bool` Whether the voice region is custom (used for events, etc.). deprecated : `bool` Whether the voice region is deprecated. value : `str` The unique identifier of the voice...
Implement the Python class `VoiceRegion` described below. Class description: Represents Discord's voice regions. Attributes ---------- custom : `bool` Whether the voice region is custom (used for events, etc.). deprecated : `bool` Whether the voice region is deprecated. value : `str` The unique identifier of the voice...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class VoiceRegion: """Represents Discord's voice regions. Attributes ---------- custom : `bool` Whether the voice region is custom (used for events, etc.). deprecated : `bool` Whether the voice region is deprecated. value : `str` The unique identifier of the voice region. name : `str` The name of the v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VoiceRegion: """Represents Discord's voice regions. Attributes ---------- custom : `bool` Whether the voice region is custom (used for events, etc.). deprecated : `bool` Whether the voice region is deprecated. value : `str` The unique identifier of the voice region. name : `str` The name of the voice region. ...
the_stack_v2_python_sparse
hata/discord/channel/channel_metadata/preinstanced.py
HuyaneMatsu/hata
train
3
3b3ee9358282c726bcfc0e91582a55c1bd53cfab
[ "search = self\nif document_pid:\n search = search.filter('term', document_pid=document_pid)\nelse:\n raise MissingRequiredParameterError(description='document_pid is required')\nif filter_states:\n search = search.filter('terms', state=filter_states)\nelif exclude_states:\n search = search.exclude('ter...
<|body_start_0|> search = self if document_pid: search = search.filter('term', document_pid=document_pid) else: raise MissingRequiredParameterError(description='document_pid is required') if filter_states: search = search.filter('terms', state=filter_s...
RecordsSearch for requests.
DocumentRequestSearch
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentRequestSearch: """RecordsSearch for requests.""" def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): """Retrieve requests based on the given document pid.""" <|body_0|> def search_by_patron_pid(self, patron_pid=None): ...
stack_v2_sparse_classes_75kplus_train_067774
1,495
permissive
[ { "docstring": "Retrieve requests based on the given document pid.", "name": "search_by_document_pid", "signature": "def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None)" }, { "docstring": "Search by patron pid.", "name": "search_by_patron_pid", "s...
2
stack_v2_sparse_classes_30k_val_000556
Implement the Python class `DocumentRequestSearch` described below. Class description: RecordsSearch for requests. Method signatures and docstrings: - def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): Retrieve requests based on the given document pid. - def search_by_patron...
Implement the Python class `DocumentRequestSearch` described below. Class description: RecordsSearch for requests. Method signatures and docstrings: - def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): Retrieve requests based on the given document pid. - def search_by_patron...
1c36526e85510100c5f64059518d1b716d87ac10
<|skeleton|> class DocumentRequestSearch: """RecordsSearch for requests.""" def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): """Retrieve requests based on the given document pid.""" <|body_0|> def search_by_patron_pid(self, patron_pid=None): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DocumentRequestSearch: """RecordsSearch for requests.""" def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): """Retrieve requests based on the given document pid.""" search = self if document_pid: search = search.filter('term',...
the_stack_v2_python_sparse
invenio_app_ils/document_requests/search.py
inveniosoftware/invenio-app-ils
train
64
82016bd00b709c43963faa5ce50b353dc0649541
[ "d = {}\nn = len(nums)\nif k == 10000 and t == 0:\n return False\nfor i in range(n):\n ns = {k for k in d.keys() if abs(nums[i] - k) <= t}\n for j in ns:\n if i - d[j] <= k:\n return True\n d[nums[i]] = i\nreturn False", "n = len(nums)\nnums = sorted([(nums[i], i) for i in range(n)],...
<|body_start_0|> d = {} n = len(nums) if k == 10000 and t == 0: return False for i in range(n): ns = {k for k in d.keys() if abs(nums[i] - k) <= t} for j in ns: if i - d[j] <= k: return True d[nums[i]] = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """字典键:nums[i] 值:nums[i]最近的索引 时间复杂度O(n^2) 40/41 遍历数组,找到字典中所有的与nums[i]差的绝对值不大于t的值,然后遍历一遍看值与i的绝对值是否<=k :type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate2(s...
stack_v2_sparse_classes_75kplus_train_067775
2,528
no_license
[ { "docstring": "字典键:nums[i] 值:nums[i]最近的索引 时间复杂度O(n^2) 40/41 遍历数组,找到字典中所有的与nums[i]差的绝对值不大于t的值,然后遍历一遍看值与i的绝对值是否<=k :type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearbyAlmostDuplicate", "signature": "def containsNearbyAlmostDuplicate(self, nums, k, t)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_007157
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): 字典键:nums[i] 值:nums[i]最近的索引 时间复杂度O(n^2) 40/41 遍历数组,找到字典中所有的与nums[i]差的绝对值不大于t的值,然后遍历一遍看值与i的绝对值是否<=k :type nums: List[int] :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): 字典键:nums[i] 值:nums[i]最近的索引 时间复杂度O(n^2) 40/41 遍历数组,找到字典中所有的与nums[i]差的绝对值不大于t的值,然后遍历一遍看值与i的绝对值是否<=k :type nums: List[int] :type...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """字典键:nums[i] 值:nums[i]最近的索引 时间复杂度O(n^2) 40/41 遍历数组,找到字典中所有的与nums[i]差的绝对值不大于t的值,然后遍历一遍看值与i的绝对值是否<=k :type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate2(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """字典键:nums[i] 值:nums[i]最近的索引 时间复杂度O(n^2) 40/41 遍历数组,找到字典中所有的与nums[i]差的绝对值不大于t的值,然后遍历一遍看值与i的绝对值是否<=k :type nums: List[int] :type k: int :type t: int :rtype: bool""" d = {} n = len(nums) if k == 10000 and t == 0: ...
the_stack_v2_python_sparse
220_存在重复元素 III.py
lovehhf/LeetCode
train
0
646fccdcac6912a3e58dd1f39eee9f75163fcba6
[ "super(ConvBPDNMask, self).__init__(D, S, lmbda, opt, dimK=dimK, dimN=dimN)\nif W is None:\n W = np.array([1.0], dtype=self.dtype)\nself.W = np.asarray(W.reshape(cr.mskWshape(W, self.cri)), dtype=self.dtype)\nself.WRy = sl.pyfftw_empty_aligned(self.S.shape, dtype=self.dtype)\nself.Ryf = sl.pyfftw_rfftn_empty_ali...
<|body_start_0|> super(ConvBPDNMask, self).__init__(D, S, lmbda, opt, dimK=dimK, dimN=dimN) if W is None: W = np.array([1.0], dtype=self.dtype) self.W = np.asarray(W.reshape(cr.mskWshape(W, self.cri)), dtype=self.dtype) self.WRy = sl.pyfftw_empty_aligned(self.S.shape, dtype=s...
FISTA algorithm for Convolutional BPDN with a spatial mask. | .. inheritance-diagram:: ConvBPDNMask :parts: 2 | Solve the optimisation problem .. math:: \\mathrm{argmin}_\\mathbf{x} \\; (1/2) \\left\\| W \\left(\\sum_m \\mathbf{d}_m * \\mathbf{x}_m - \\mathbf{s}\\right) \\right\\|_2^2 + \\lambda \\sum_m \\| \\mathbf{x}...
ConvBPDNMask
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvBPDNMask: """FISTA algorithm for Convolutional BPDN with a spatial mask. | .. inheritance-diagram:: ConvBPDNMask :parts: 2 | Solve the optimisation problem .. math:: \\mathrm{argmin}_\\mathbf{x} \\; (1/2) \\left\\| W \\left(\\sum_m \\mathbf{d}_m * \\mathbf{x}_m - \\mathbf{s}\\right) \\right\\...
stack_v2_sparse_classes_75kplus_train_067776
14,485
permissive
[ { "docstring": "| Parameters ---------- D : array_like Dictionary matrix S : array_like Signal vector or matrix lmbda : float Regularisation parameter W : array_like Mask array. The array shape must be such that the array is compatible for multiplication with input array S (see :func:`.cnvrep.mskWshape` for mor...
4
null
Implement the Python class `ConvBPDNMask` described below. Class description: FISTA algorithm for Convolutional BPDN with a spatial mask. | .. inheritance-diagram:: ConvBPDNMask :parts: 2 | Solve the optimisation problem .. math:: \\mathrm{argmin}_\\mathbf{x} \\; (1/2) \\left\\| W \\left(\\sum_m \\mathbf{d}_m * \\math...
Implement the Python class `ConvBPDNMask` described below. Class description: FISTA algorithm for Convolutional BPDN with a spatial mask. | .. inheritance-diagram:: ConvBPDNMask :parts: 2 | Solve the optimisation problem .. math:: \\mathrm{argmin}_\\mathbf{x} \\; (1/2) \\left\\| W \\left(\\sum_m \\mathbf{d}_m * \\math...
5a64fbe456f3a117275c45ee1f10c60d6e133915
<|skeleton|> class ConvBPDNMask: """FISTA algorithm for Convolutional BPDN with a spatial mask. | .. inheritance-diagram:: ConvBPDNMask :parts: 2 | Solve the optimisation problem .. math:: \\mathrm{argmin}_\\mathbf{x} \\; (1/2) \\left\\| W \\left(\\sum_m \\mathbf{d}_m * \\mathbf{x}_m - \\mathbf{s}\\right) \\right\\...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConvBPDNMask: """FISTA algorithm for Convolutional BPDN with a spatial mask. | .. inheritance-diagram:: ConvBPDNMask :parts: 2 | Solve the optimisation problem .. math:: \\mathrm{argmin}_\\mathbf{x} \\; (1/2) \\left\\| W \\left(\\sum_m \\mathbf{d}_m * \\mathbf{x}_m - \\mathbf{s}\\right) \\right\\|_2^2 + \\lam...
the_stack_v2_python_sparse
benchmarks/other/sporco/fista/cbpdn.py
tomMoral/dicodile
train
17
348afe50ba07b9f802e44f46d330c6f51a4e6e62
[ "try:\n return neuron.code(tranges=[self.trange], **kwargs)\nexcept AttributeError:\n return self.r.n[neuron].code(tranges=[self.trange], **kwargs)", "if nids == None:\n nids = self.r.get_nids()\ncodeso = self.r.codes(nids=nids, experiments=[self], **kwargs)\ncodeso.calc()\nreturn codeso", "code1 = sel...
<|body_start_0|> try: return neuron.code(tranges=[self.trange], **kwargs) except AttributeError: return self.r.n[neuron].code(tranges=[self.trange], **kwargs) <|end_body_0|> <|body_start_1|> if nids == None: nids = self.r.get_nids() codeso = self.r.co...
Mix-in class that defines the spike code related experiment methods
ExperimentCode
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExperimentCode: """Mix-in class that defines the spike code related experiment methods""" def code(self, neuron=None, **kwargs): """Returns a Neuron.Code object, constraining it to the time range of this experiment. Takes either a Neuron object or just a Neuron id""" <|body_0...
stack_v2_sparse_classes_75kplus_train_067777
45,008
permissive
[ { "docstring": "Returns a Neuron.Code object, constraining it to the time range of this experiment. Takes either a Neuron object or just a Neuron id", "name": "code", "signature": "def code(self, neuron=None, **kwargs)" }, { "docstring": "Returns a 2D array where each row is a neuron code constr...
3
stack_v2_sparse_classes_30k_train_031114
Implement the Python class `ExperimentCode` described below. Class description: Mix-in class that defines the spike code related experiment methods Method signatures and docstrings: - def code(self, neuron=None, **kwargs): Returns a Neuron.Code object, constraining it to the time range of this experiment. Takes eithe...
Implement the Python class `ExperimentCode` described below. Class description: Mix-in class that defines the spike code related experiment methods Method signatures and docstrings: - def code(self, neuron=None, **kwargs): Returns a Neuron.Code object, constraining it to the time range of this experiment. Takes eithe...
ab576a41ec00e3c126bca45c2504dd61bd1cda56
<|skeleton|> class ExperimentCode: """Mix-in class that defines the spike code related experiment methods""" def code(self, neuron=None, **kwargs): """Returns a Neuron.Code object, constraining it to the time range of this experiment. Takes either a Neuron object or just a Neuron id""" <|body_0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExperimentCode: """Mix-in class that defines the spike code related experiment methods""" def code(self, neuron=None, **kwargs): """Returns a Neuron.Code object, constraining it to the time range of this experiment. Takes either a Neuron object or just a Neuron id""" try: retu...
the_stack_v2_python_sparse
neuropy/experiment.py
node2319/neuropy-1
train
0
6f1163042be5963a01e3399930368ccb3fed3fc7
[ "return_map = {}\nfor key, value in boto_dict.items():\n return_map[key] = value.get('NumberValue', value.get('StringValue', None))\nreturn return_map", "boto_map = {}\nfor key, value in parameters.items():\n if isinstance(value, numbers.Number):\n boto_map[key] = {'NumberValue': value}\n else:\n ...
<|body_start_0|> return_map = {} for key, value in boto_dict.items(): return_map[key] = value.get('NumberValue', value.get('StringValue', None)) return return_map <|end_body_0|> <|body_start_1|> boto_map = {} for key, value in parameters.items(): if isins...
A dictionary of TrialComponentParameterValues
TrialComponentParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrialComponentParameters: """A dictionary of TrialComponentParameterValues""" def from_boto(cls, boto_dict, **kwargs): """Converts a boto dict to a dictionary of TrialComponentParameterValues Args: boto_dict (dict): boto response dictionary. **kwargs: Arbitrary keyword arguments. Ret...
stack_v2_sparse_classes_75kplus_train_067778
7,894
permissive
[ { "docstring": "Converts a boto dict to a dictionary of TrialComponentParameterValues Args: boto_dict (dict): boto response dictionary. **kwargs: Arbitrary keyword arguments. Returns: dict: Dictionary of parameter values.", "name": "from_boto", "signature": "def from_boto(cls, boto_dict, **kwargs)" },...
2
stack_v2_sparse_classes_30k_train_007512
Implement the Python class `TrialComponentParameters` described below. Class description: A dictionary of TrialComponentParameterValues Method signatures and docstrings: - def from_boto(cls, boto_dict, **kwargs): Converts a boto dict to a dictionary of TrialComponentParameterValues Args: boto_dict (dict): boto respon...
Implement the Python class `TrialComponentParameters` described below. Class description: A dictionary of TrialComponentParameterValues Method signatures and docstrings: - def from_boto(cls, boto_dict, **kwargs): Converts a boto dict to a dictionary of TrialComponentParameterValues Args: boto_dict (dict): boto respon...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class TrialComponentParameters: """A dictionary of TrialComponentParameterValues""" def from_boto(cls, boto_dict, **kwargs): """Converts a boto dict to a dictionary of TrialComponentParameterValues Args: boto_dict (dict): boto response dictionary. **kwargs: Arbitrary keyword arguments. Ret...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TrialComponentParameters: """A dictionary of TrialComponentParameterValues""" def from_boto(cls, boto_dict, **kwargs): """Converts a boto dict to a dictionary of TrialComponentParameterValues Args: boto_dict (dict): boto response dictionary. **kwargs: Arbitrary keyword arguments. Returns: dict: D...
the_stack_v2_python_sparse
src/sagemaker/experiments/_api_types.py
aws/sagemaker-python-sdk
train
2,050
b999c1898bc50136dc220fe1eb84a1ce78cc45fe
[ "data = {}\nfor key, value in request.GET.items():\n data[key] = value\nsignature = data.pop('sign', None)\nif alipay.verify(data, signature):\n order_num = data.get('out_trade_no', None)\n trade_no = data.get('trade_no', None)\n order_status = 'TRADE_FINISHED'\n order = Order.objects.filter(order_nu...
<|body_start_0|> data = {} for key, value in request.GET.items(): data[key] = value signature = data.pop('sign', None) if alipay.verify(data, signature): order_num = data.get('out_trade_no', None) trade_no = data.get('trade_no', None) order...
PayView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PayView: def get(request): """同步回调""" <|body_0|> def post(request): """异步回调""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = {} for key, value in request.GET.items(): data[key] = value signature = data.pop('sign', N...
stack_v2_sparse_classes_75kplus_train_067779
4,249
no_license
[ { "docstring": "同步回调", "name": "get", "signature": "def get(request)" }, { "docstring": "异步回调", "name": "post", "signature": "def post(request)" } ]
2
null
Implement the Python class `PayView` described below. Class description: Implement the PayView class. Method signatures and docstrings: - def get(request): 同步回调 - def post(request): 异步回调
Implement the Python class `PayView` described below. Class description: Implement the PayView class. Method signatures and docstrings: - def get(request): 同步回调 - def post(request): 异步回调 <|skeleton|> class PayView: def get(request): """同步回调""" <|body_0|> def post(request): """异步回调""...
da650450f86e0770e131ea0eb4b200fc952004ff
<|skeleton|> class PayView: def get(request): """同步回调""" <|body_0|> def post(request): """异步回调""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PayView: def get(request): """同步回调""" data = {} for key, value in request.GET.items(): data[key] = value signature = data.pop('sign', None) if alipay.verify(data, signature): order_num = data.get('out_trade_no', None) trade_no = data....
the_stack_v2_python_sparse
book_city/apps/trade/views.py
TingxieLi/YangBook
train
0
535ff6fd814744451aaa9d7517f5a18e1cdbb62b
[ "super(PointerAfterLogits, self).__init__(hidden_size, output_size, causal=causal, logits_per_slot=logits_per_slot, **kwargs)\nself.logits_embedding = logits_embedding\nself.logits_size = logits_size", "[queries, values, queries_mask, values_mask, ids, permutation, absolute_positions, relative_positions, pointer_...
<|body_start_0|> super(PointerAfterLogits, self).__init__(hidden_size, output_size, causal=causal, logits_per_slot=logits_per_slot, **kwargs) self.logits_embedding = logits_embedding self.logits_size = logits_size <|end_body_0|> <|body_start_1|> [queries, values, queries_mask, values_ma...
PointerAfterLogits
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointerAfterLogits: def __init__(self, hidden_size, output_size, logits_size, logits_embedding, causal=True, logits_per_slot=1, **kwargs): """Creates a pointer network using the first operation in the self attention mechanism Arguments: hidden_size: int the number of hidden units in the ...
stack_v2_sparse_classes_75kplus_train_067780
6,900
no_license
[ { "docstring": "Creates a pointer network using the first operation in the self attention mechanism Arguments: hidden_size: int the number of hidden units in the network blocks used by this layer output_size: int the number of output units used by the network blocks used by this layer logits_size: int the numbe...
3
stack_v2_sparse_classes_30k_train_001059
Implement the Python class `PointerAfterLogits` described below. Class description: Implement the PointerAfterLogits class. Method signatures and docstrings: - def __init__(self, hidden_size, output_size, logits_size, logits_embedding, causal=True, logits_per_slot=1, **kwargs): Creates a pointer network using the fir...
Implement the Python class `PointerAfterLogits` described below. Class description: Implement the PointerAfterLogits class. Method signatures and docstrings: - def __init__(self, hidden_size, output_size, logits_size, logits_embedding, causal=True, logits_per_slot=1, **kwargs): Creates a pointer network using the fir...
14860f55a5fd073145e8e063027ecdfb31feecd4
<|skeleton|> class PointerAfterLogits: def __init__(self, hidden_size, output_size, logits_size, logits_embedding, causal=True, logits_per_slot=1, **kwargs): """Creates a pointer network using the first operation in the self attention mechanism Arguments: hidden_size: int the number of hidden units in the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PointerAfterLogits: def __init__(self, hidden_size, output_size, logits_size, logits_embedding, causal=True, logits_per_slot=1, **kwargs): """Creates a pointer network using the first operation in the self attention mechanism Arguments: hidden_size: int the number of hidden units in the network blocks...
the_stack_v2_python_sparse
voi/nn/variables/pointer_after_logits.py
anonymouscode115/autoregressive_inference
train
0
75674ea2539bb7d4187e18d42c38398275d9421c
[ "if authorization_header is None:\n return None\nif not isinstance(authorization_header, str):\n return None\nif not authorization_header.startswith('Basic '):\n return None\nelse:\n return authorization_header.replace('Basic ', '', 1)", "if base64_authorization_header is None:\n return None\nif no...
<|body_start_0|> if authorization_header is None: return None if not isinstance(authorization_header, str): return None if not authorization_header.startswith('Basic '): return None else: return authorization_header.replace('Basic ', '', 1)...
Basic authentication class
BasicAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicAuth: """Basic authentication class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Extracts the base64 encoded authorization header""" <|body_0|> def decode_base64_authorization_header(self, base64_authorization_header: str) -...
stack_v2_sparse_classes_75kplus_train_067781
3,046
no_license
[ { "docstring": "Extracts the base64 encoded authorization header", "name": "extract_base64_authorization_header", "signature": "def extract_base64_authorization_header(self, authorization_header: str) -> str" }, { "docstring": "Decodes the base64 encoded authorization header", "name": "decod...
5
stack_v2_sparse_classes_30k_train_048343
Implement the Python class `BasicAuth` described below. Class description: Basic authentication class Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: Extracts the base64 encoded authorization header - def decode_base64_authorization_header(self, bas...
Implement the Python class `BasicAuth` described below. Class description: Basic authentication class Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: Extracts the base64 encoded authorization header - def decode_base64_authorization_header(self, bas...
3a9bf33a51033aba492586773b30cd234bc0e80d
<|skeleton|> class BasicAuth: """Basic authentication class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Extracts the base64 encoded authorization header""" <|body_0|> def decode_base64_authorization_header(self, base64_authorization_header: str) -...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicAuth: """Basic authentication class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Extracts the base64 encoded authorization header""" if authorization_header is None: return None if not isinstance(authorization_header, str)...
the_stack_v2_python_sparse
0x06-Basic_authentication/api/v1/auth/basic_auth.py
cort-robinson/holbertonschool-web_back_end
train
0
d08a973a22b40cced952ff5b908fba8ca3f29caf
[ "self.operating_system = os\nself.template = template\nself.installer_template = installer_template\nself.system_profile = system_profile\nself.installer_cmdline = installation_options.get('linux-kargs-installer')\nself.target_cmdline = installation_options.get('linux-kargs-target')\nself.ubuntu20_legacy_installer ...
<|body_start_0|> self.operating_system = os self.template = template self.installer_template = installer_template self.system_profile = system_profile self.installer_cmdline = installation_options.get('linux-kargs-installer') self.target_cmdline = installation_options.get...
Data model for autoinstall machine
AutoinstallMachineModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoinstallMachineModel: """Data model for autoinstall machine""" def __init__(self, os: OperatingSystem, os_repos: 'list[OsRepository]', template: Template, installer_template: Template, custom_os_repos: 'list[OsRepository]', custom_package_repos: 'list[PackageRepository]', system_profile: ...
stack_v2_sparse_classes_75kplus_train_067782
23,282
permissive
[ { "docstring": "Create model from controller data", "name": "__init__", "signature": "def __init__(self, os: OperatingSystem, os_repos: 'list[OsRepository]', template: Template, installer_template: Template, custom_os_repos: 'list[OsRepository]', custom_package_repos: 'list[PackageRepository]', system_p...
3
stack_v2_sparse_classes_30k_train_038150
Implement the Python class `AutoinstallMachineModel` described below. Class description: Data model for autoinstall machine Method signatures and docstrings: - def __init__(self, os: OperatingSystem, os_repos: 'list[OsRepository]', template: Template, installer_template: Template, custom_os_repos: 'list[OsRepository]...
Implement the Python class `AutoinstallMachineModel` described below. Class description: Data model for autoinstall machine Method signatures and docstrings: - def __init__(self, os: OperatingSystem, os_repos: 'list[OsRepository]', template: Template, installer_template: Template, custom_os_repos: 'list[OsRepository]...
9c9040f6a173af5c495f5447889e9349fa56f234
<|skeleton|> class AutoinstallMachineModel: """Data model for autoinstall machine""" def __init__(self, os: OperatingSystem, os_repos: 'list[OsRepository]', template: Template, installer_template: Template, custom_os_repos: 'list[OsRepository]', custom_package_repos: 'list[PackageRepository]', system_profile: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AutoinstallMachineModel: """Data model for autoinstall machine""" def __init__(self, os: OperatingSystem, os_repos: 'list[OsRepository]', template: Template, installer_template: Template, custom_os_repos: 'list[OsRepository]', custom_package_repos: 'list[PackageRepository]', system_profile: SystemProfile...
the_stack_v2_python_sparse
tessia/server/state_machines/autoinstall/model.py
tessia-project/tessia
train
10
678f7b003b243ded277e06c1997519b1a17f51f6
[ "self._client = client\nself._sdk_key = sdk_key\nself._metadata = headers_from_metadata(sdk_metadata)\nself._telemetry_runtime_producer = telemetry_runtime_producer", "start = get_current_epoch_time_ms()\ntry:\n response = self._client.get('auth', '/v2/auth', self._sdk_key, extra_headers=self._metadata)\n r...
<|body_start_0|> self._client = client self._sdk_key = sdk_key self._metadata = headers_from_metadata(sdk_metadata) self._telemetry_runtime_producer = telemetry_runtime_producer <|end_body_0|> <|body_start_1|> start = get_current_epoch_time_ms() try: response...
Class that uses an httpClient to communicate with the SDK Auth Service API.
AuthAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthAPI: """Class that uses an httpClient to communicate with the SDK Auth Service API.""" def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer): """Class constructor. :param client: HTTP Client responsble for issuing calls to the backend. :type client: HttpCl...
stack_v2_sparse_classes_75kplus_train_067783
2,430
permissive
[ { "docstring": "Class constructor. :param client: HTTP Client responsble for issuing calls to the backend. :type client: HttpClient :param sdk_key: User sdk key. :type sdk_key: string :param sdk_metadata: SDK version & machine name & IP. :type sdk_metadata: splitio.client.util.SdkMetadata", "name": "__init_...
2
stack_v2_sparse_classes_30k_train_044944
Implement the Python class `AuthAPI` described below. Class description: Class that uses an httpClient to communicate with the SDK Auth Service API. Method signatures and docstrings: - def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer): Class constructor. :param client: HTTP Client responsb...
Implement the Python class `AuthAPI` described below. Class description: Class that uses an httpClient to communicate with the SDK Auth Service API. Method signatures and docstrings: - def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer): Class constructor. :param client: HTTP Client responsb...
523d2395d39d189772b1db1c944db0cf4ca5769a
<|skeleton|> class AuthAPI: """Class that uses an httpClient to communicate with the SDK Auth Service API.""" def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer): """Class constructor. :param client: HTTP Client responsble for issuing calls to the backend. :type client: HttpCl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthAPI: """Class that uses an httpClient to communicate with the SDK Auth Service API.""" def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer): """Class constructor. :param client: HTTP Client responsble for issuing calls to the backend. :type client: HttpClient :param s...
the_stack_v2_python_sparse
splitio/api/auth.py
splitio/python-client
train
17
2a6e62639eac740ae3f63d1a6d2e31003f47e84b
[ "self.timeStep = 40\nself.RShoulderPitch = self.getDevice('RShoulderPitch')\nself.LShoulderPitch = self.getDevice('LShoulderPitch')\nself.RShoulderPitch.setPosition(1.1)\nself.LShoulderPitch.setPosition(1.1)", "walk = Motion('forward.motion')\nwalk.setLoop(True)\nwalk.play()\nwhile True:\n if walk.getTime() ==...
<|body_start_0|> self.timeStep = 40 self.RShoulderPitch = self.getDevice('RShoulderPitch') self.LShoulderPitch = self.getDevice('LShoulderPitch') self.RShoulderPitch.setPosition(1.1) self.LShoulderPitch.setPosition(1.1) <|end_body_0|> <|body_start_1|> walk = Motion('forw...
Make the NAO robot run as fast as possible.
Sprinter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sprinter: """Make the NAO robot run as fast as possible.""" def initialize(self): """Get device pointers, enable sensors and set robot initial pose.""" <|body_0|> def run(self): """Play the forward motion and loop on the walking cycle.""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus_train_067784
2,606
permissive
[ { "docstring": "Get device pointers, enable sensors and set robot initial pose.", "name": "initialize", "signature": "def initialize(self)" }, { "docstring": "Play the forward motion and loop on the walking cycle.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_040458
Implement the Python class `Sprinter` described below. Class description: Make the NAO robot run as fast as possible. Method signatures and docstrings: - def initialize(self): Get device pointers, enable sensors and set robot initial pose. - def run(self): Play the forward motion and loop on the walking cycle.
Implement the Python class `Sprinter` described below. Class description: Make the NAO robot run as fast as possible. Method signatures and docstrings: - def initialize(self): Get device pointers, enable sensors and set robot initial pose. - def run(self): Play the forward motion and loop on the walking cycle. <|ske...
8aba6eaae76989facf3442305c8089d3cc366bcf
<|skeleton|> class Sprinter: """Make the NAO robot run as fast as possible.""" def initialize(self): """Get device pointers, enable sensors and set robot initial pose.""" <|body_0|> def run(self): """Play the forward motion and loop on the walking cycle.""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sprinter: """Make the NAO robot run as fast as possible.""" def initialize(self): """Get device pointers, enable sensors and set robot initial pose.""" self.timeStep = 40 self.RShoulderPitch = self.getDevice('RShoulderPitch') self.LShoulderPitch = self.getDevice('LShoulder...
the_stack_v2_python_sparse
projects/samples/robotbenchmark/humanoid_sprint/controllers/sprinter/sprinter.py
cyberbotics/webots
train
2,495
8893d2536bd8822b6682a657af5a03b3e86467ec
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessPackageResource()", "from .access_package_resource_environment import AccessPackageResourceEnvironment\nfrom .access_package_resource_role import AccessPackageResourceRole\nfrom .access_package_resource_scope import AccessPackage...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessPackageResource() <|end_body_0|> <|body_start_1|> from .access_package_resource_environment import AccessPackageResourceEnvironment from .access_package_resource_role import Access...
AccessPackageResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessPackageResource: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageResource: """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 th...
stack_v2_sparse_classes_75kplus_train_067785
5,510
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: AccessPackageResource", "name": "create_from_discriminator_value", "signature": "def create_from_discriminat...
3
null
Implement the Python class `AccessPackageResource` described below. Class description: Implement the AccessPackageResource class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageResource: Creates a new instance of the appropriate class base...
Implement the Python class `AccessPackageResource` described below. Class description: Implement the AccessPackageResource class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageResource: Creates a new instance of the appropriate class base...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessPackageResource: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageResource: """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 th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccessPackageResource: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageResource: """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 Retur...
the_stack_v2_python_sparse
msgraph/generated/models/access_package_resource.py
microsoftgraph/msgraph-sdk-python
train
135
f4ebd6a04dd0e7e38500811f67912bbd771bde9f
[ "essential_keys = ['u0', 'mu', 'newton_maxiter', 'newton_tol']\nfor key in essential_keys:\n if key not in problem_params:\n msg = 'need %s to instantiate problem, only got %s' % (key, str(problem_params.keys()))\n raise ParameterError(msg)\nproblem_params['nvars'] = 2\nif 'stop_at_nan' not in prob...
<|body_start_0|> essential_keys = ['u0', 'mu', 'newton_maxiter', 'newton_tol'] for key in essential_keys: if key not in problem_params: msg = 'need %s to instantiate problem, only got %s' % (key, str(problem_params.keys())) raise ParameterError(msg) pr...
Example implementing the van der pol oscillator
vanderpol
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class vanderpol: """Example implementing the van der pol oscillator""" def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh): """Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed parent class) dtype_f: mes...
stack_v2_sparse_classes_75kplus_train_067786
4,353
permissive
[ { "docstring": "Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed parent class) dtype_f: mesh data type (will be passed parent class)", "name": "__init__", "signature": "def __init__(self, problem_params, dtype_u=mesh, dtype_f=m...
4
stack_v2_sparse_classes_30k_train_019321
Implement the Python class `vanderpol` described below. Class description: Example implementing the van der pol oscillator Method signatures and docstrings: - def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh): Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: ...
Implement the Python class `vanderpol` described below. Class description: Example implementing the van der pol oscillator Method signatures and docstrings: - def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh): Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: ...
de2cd523411276083355389d7e7993106cedf93d
<|skeleton|> class vanderpol: """Example implementing the van der pol oscillator""" def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh): """Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed parent class) dtype_f: mes...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class vanderpol: """Example implementing the van der pol oscillator""" def __init__(self, problem_params, dtype_u=mesh, dtype_f=mesh): """Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed parent class) dtype_f: mesh data type (...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/Van_der_Pol_implicit.py
ruthschoebel/pySDC
train
0
0f7e6d9799e06a282bb04b2357c7b7e71e6adbab
[ "if not root:\n return True\nif root.left:\n if not self.isValidBST(root.left):\n return False\n max_l = self.maxBST(root.left)\n if max_l >= root.val:\n return False\nif root.right:\n if not self.isValidBST(root.right):\n return False\n min_r = self.minBST(root.right)\n if...
<|body_start_0|> if not root: return True if root.left: if not self.isValidBST(root.left): return False max_l = self.maxBST(root.left) if max_l >= root.val: return False if root.right: if not self.isValid...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def minBST(self, root): """find min value of a BST, assume root not-None""" <|body_1|> def maxBST(self, root): """find max value of a BST, assume root not-No...
stack_v2_sparse_classes_75kplus_train_067787
1,076
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST", "signature": "def isValidBST(self, root)" }, { "docstring": "find min value of a BST, assume root not-None", "name": "minBST", "signature": "def minBST(self, root)" }, { "docstring": "find max value of a BS...
3
stack_v2_sparse_classes_30k_train_019087
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def minBST(self, root): find min value of a BST, assume root not-None - def maxBST(self, root): find max value of ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def minBST(self, root): find min value of a BST, assume root not-None - def maxBST(self, root): find max value of ...
e00cf94c5b86c8cca27e3bee69ad21e727b7679b
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def minBST(self, root): """find min value of a BST, assume root not-None""" <|body_1|> def maxBST(self, root): """find max value of a BST, assume root not-No...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" if not root: return True if root.left: if not self.isValidBST(root.left): return False max_l = self.maxBST(root.left) if max_l >= root.val: ...
the_stack_v2_python_sparse
interview/prob98.py
binchen15/leet-python
train
1
cd43ea9ebf98f1622082426ca6e3cf5863856fa2
[ "assert interrupt_handle or parent_handle\nsuper().__init__()\nif ctypes is None:\n msg = 'ParentPollerWindows requires ctypes'\n raise ImportError(msg)\nself.daemon = True\nself.interrupt_handle = interrupt_handle\nself.parent_handle = parent_handle", "try:\n from _winapi import INFINITE, WAIT_OBJECT_0\...
<|body_start_0|> assert interrupt_handle or parent_handle super().__init__() if ctypes is None: msg = 'ParentPollerWindows requires ctypes' raise ImportError(msg) self.daemon = True self.interrupt_handle = interrupt_handle self.parent_handle = pare...
A Windows-specific daemon thread that listens for a special event that signals an interrupt and, optionally, terminates the program immediately when the parent process no longer exists.
ParentPollerWindows
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParentPollerWindows: """A Windows-specific daemon thread that listens for a special event that signals an interrupt and, optionally, terminates the program immediately when the parent process no longer exists.""" def __init__(self, interrupt_handle=None, parent_handle=None): """Creat...
stack_v2_sparse_classes_75kplus_train_067788
4,249
permissive
[ { "docstring": "Create the poller. At least one of the optional parameters must be provided. Parameters ---------- interrupt_handle : HANDLE (int), optional If provided, the program will generate a Ctrl+C event when this handle is signaled. parent_handle : HANDLE (int), optional If provided, the program will te...
2
stack_v2_sparse_classes_30k_train_040788
Implement the Python class `ParentPollerWindows` described below. Class description: A Windows-specific daemon thread that listens for a special event that signals an interrupt and, optionally, terminates the program immediately when the parent process no longer exists. Method signatures and docstrings: - def __init_...
Implement the Python class `ParentPollerWindows` described below. Class description: A Windows-specific daemon thread that listens for a special event that signals an interrupt and, optionally, terminates the program immediately when the parent process no longer exists. Method signatures and docstrings: - def __init_...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class ParentPollerWindows: """A Windows-specific daemon thread that listens for a special event that signals an interrupt and, optionally, terminates the program immediately when the parent process no longer exists.""" def __init__(self, interrupt_handle=None, parent_handle=None): """Creat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParentPollerWindows: """A Windows-specific daemon thread that listens for a special event that signals an interrupt and, optionally, terminates the program immediately when the parent process no longer exists.""" def __init__(self, interrupt_handle=None, parent_handle=None): """Create the poller....
the_stack_v2_python_sparse
contrib/python/ipykernel/py3/ipykernel/parentpoller.py
catboost/catboost
train
8,012
9192d05768c17a08011946c8b55794d195f22761
[ "self.root = Node()\nfor i, word in enumerate(words):\n longw = word + '#' + word\n for j in range(len(word)):\n cur = self.root\n cur.index = i\n for c in longw[j:]:\n cur = cur[c]\n cur.index = i", "word = suffix + '#' + prefix\ncur = self.root\nfor c in word:\n ...
<|body_start_0|> self.root = Node() for i, word in enumerate(words): longw = word + '#' + word for j in range(len(word)): cur = self.root cur.index = i for c in longw[j:]: cur = cur[c] cur.ind...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.root = Node() for i, word in ...
stack_v2_sparse_classes_75kplus_train_067789
2,614
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
stack_v2_sparse_classes_30k_train_046890
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordFilter: def __init__(self, words): """:type words: List[str]""" self.root = Node() for i, word in enumerate(words): longw = word + '#' + word for j in range(len(word)): cur = self.root cur.index = i for c in lo...
the_stack_v2_python_sparse
P/PrefixandSuffixSearch.py
bssrdf/pyleet
train
2
4df18171bc79924d8bc07643a1fbf4a8de8b1120
[ "collisions, env_collisions, rigidbodies = PyImpact.get_collisions(resp)\nself.collisions: Dict[int, CollisionType] = dict()\nself.env_collision = CollisionType.none\nif rigidbodies is None:\n return\nfor i in range(rigidbodies.get_num()):\n if rigidbodies.get_id(i) == object_id:\n ang_vel = rigidbodie...
<|body_start_0|> collisions, env_collisions, rigidbodies = PyImpact.get_collisions(resp) self.collisions: Dict[int, CollisionType] = dict() self.env_collision = CollisionType.none if rigidbodies is None: return for i in range(rigidbodies.get_num()): if rig...
All types of collision (impact, scrape, roll, none) between an object and any other objects or the environment on this frame. Usage: ```python from tdw.controller import Controller from tdw.py_impact import CollisionTypesOnFrame object_id = c.get_unique_id() c = Controller() c.start() # Your code here. # Request the re...
CollisionTypesOnFrame
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollisionTypesOnFrame: """All types of collision (impact, scrape, roll, none) between an object and any other objects or the environment on this frame. Usage: ```python from tdw.controller import Controller from tdw.py_impact import CollisionTypesOnFrame object_id = c.get_unique_id() c = Controll...
stack_v2_sparse_classes_75kplus_train_067790
39,621
permissive
[ { "docstring": ":param object_id: The unique ID of the colliding object. :param resp: The response from the build.", "name": "__init__", "signature": "def __init__(self, object_id: int, resp: List[bytes])" }, { "docstring": ":param ang_vel: The angular velocity of this object. :param states: The...
2
null
Implement the Python class `CollisionTypesOnFrame` described below. Class description: All types of collision (impact, scrape, roll, none) between an object and any other objects or the environment on this frame. Usage: ```python from tdw.controller import Controller from tdw.py_impact import CollisionTypesOnFrame obj...
Implement the Python class `CollisionTypesOnFrame` described below. Class description: All types of collision (impact, scrape, roll, none) between an object and any other objects or the environment on this frame. Usage: ```python from tdw.controller import Controller from tdw.py_impact import CollisionTypesOnFrame obj...
5d98ce6e4629318403de84dfcc5edfe61498e12c
<|skeleton|> class CollisionTypesOnFrame: """All types of collision (impact, scrape, roll, none) between an object and any other objects or the environment on this frame. Usage: ```python from tdw.controller import Controller from tdw.py_impact import CollisionTypesOnFrame object_id = c.get_unique_id() c = Controll...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CollisionTypesOnFrame: """All types of collision (impact, scrape, roll, none) between an object and any other objects or the environment on this frame. Usage: ```python from tdw.controller import Controller from tdw.py_impact import CollisionTypesOnFrame object_id = c.get_unique_id() c = Controller() c.start(...
the_stack_v2_python_sparse
Python/tdw/py_impact.py
meier-johannes94/tdw
train
0
9786d654210c0adc1b38dee72c277cef9406f71c
[ "super().__init__(input_tensor_spec, input_preprocessors, preprocessing_combiner=preprocessing_combiner, name=name)\nif kernel_initializer is None:\n kernel_initializer = functools.partial(variance_scaling_init, mode='fan_in', distribution='truncated_normal', nonlinearity=activation)\nembedding_layers = nn.Modul...
<|body_start_0|> super().__init__(input_tensor_spec, input_preprocessors, preprocessing_combiner=preprocessing_combiner, name=name) if kernel_initializer is None: kernel_initializer = functools.partial(variance_scaling_init, mode='fan_in', distribution='truncated_normal', nonlinearity=activa...
Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250
SocialAttentionNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialAttentionNetwork: """Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250""" def __init__(self, input_tensor_spec, input...
stack_v2_sparse_classes_75kplus_train_067791
16,672
permissive
[ { "docstring": "Args: input_tensor_spec (nested TensorSpec): the (nested) tensor spec of the input. If nested, then ``preprocessing_combiner`` must not be None. input_preprocessors (nested InputPreprocessor): a nest of ``InputPreprocessor``, each of which will be applied to the corresponding input. If not None,...
2
stack_v2_sparse_classes_30k_val_002363
Implement the Python class `SocialAttentionNetwork` described below. Class description: Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250 Method sign...
Implement the Python class `SocialAttentionNetwork` described below. Class description: Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250 Method sign...
b00ff2fa5e660de31020338ba340263183fbeaa4
<|skeleton|> class SocialAttentionNetwork: """Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250""" def __init__(self, input_tensor_spec, input...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SocialAttentionNetwork: """Simple graph encoding network, which takes as input a set of objects and outputs one encoded feature vector. Reference: Leurent et al "Social Attention for Autonomous Decision-Making in Dense Traffic", arXiv:1911.12250""" def __init__(self, input_tensor_spec, input_preprocessor...
the_stack_v2_python_sparse
alf/networks/transformer_networks.py
HorizonRobotics/alf
train
288
d7125702e875706a00e0fdc28f1bf5aa713323a4
[ "super(KeepVelocity, self).__init__(name)\nself._vehicle = vehicle\nself._target_velocity = target_velocity\nself._control.steering = 0", "new_status = py_trees.common.Status.RUNNING\nif Tracker.get_velocity(self._vehicle) < self._target_velocity:\n self._control.throttle = 1.0\nelse:\n self._control.thrott...
<|body_start_0|> super(KeepVelocity, self).__init__(name) self._vehicle = vehicle self._target_velocity = target_velocity self._control.steering = 0 <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status.RUNNING if Tracker.get_velocity(self._vehicle) < self....
This class contains an atomic behavior to keep the provided velocity. The controlled traffic participant will accelerate as fast as possible until reaching a given _target_velocity_, which is then maintained for as long as this behavior is active. Note: In parallel to this behavior a termination behavior has to be used...
KeepVelocity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeepVelocity: """This class contains an atomic behavior to keep the provided velocity. The controlled traffic participant will accelerate as fast as possible until reaching a given _target_velocity_, which is then maintained for as long as this behavior is active. Note: In parallel to this behavi...
stack_v2_sparse_classes_75kplus_train_067792
3,916
no_license
[ { "docstring": "Setup parameters including acceleration value (via throttle_value) and target velocity", "name": "__init__", "signature": "def __init__(self, vehicle, target_velocity, name='KeepVelocity')" }, { "docstring": "Set throttle to throttle_value, as long as velocity is < target_velocit...
3
stack_v2_sparse_classes_30k_train_040850
Implement the Python class `KeepVelocity` described below. Class description: This class contains an atomic behavior to keep the provided velocity. The controlled traffic participant will accelerate as fast as possible until reaching a given _target_velocity_, which is then maintained for as long as this behavior is a...
Implement the Python class `KeepVelocity` described below. Class description: This class contains an atomic behavior to keep the provided velocity. The controlled traffic participant will accelerate as fast as possible until reaching a given _target_velocity_, which is then maintained for as long as this behavior is a...
63c1806939bfb35f1c90d39d835d97293199fd1d
<|skeleton|> class KeepVelocity: """This class contains an atomic behavior to keep the provided velocity. The controlled traffic participant will accelerate as fast as possible until reaching a given _target_velocity_, which is then maintained for as long as this behavior is active. Note: In parallel to this behavi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KeepVelocity: """This class contains an atomic behavior to keep the provided velocity. The controlled traffic participant will accelerate as fast as possible until reaching a given _target_velocity_, which is then maintained for as long as this behavior is active. Note: In parallel to this behavior a terminat...
the_stack_v2_python_sparse
scenario_management/scenario_definition/behaviours/vehicle.py
balakrishna-k/carmageddon
train
1
bed877936807c4ef341ab4bd0bbac28b5373ace9
[ "dup, missing = (-1, -1)\nfor n in nums:\n if nums[abs(n) - 1] < 0:\n dup = abs(n)\n else:\n nums[abs(n) - 1] *= -1\nfor i in xrange(len(nums)):\n if nums[i] > 0:\n missing = i + 1\n break\nreturn [dup, missing]", "S = set()\ndup, missing = (-1, -1)\nfor n in nums:\n if n n...
<|body_start_0|> dup, missing = (-1, -1) for n in nums: if nums[abs(n) - 1] < 0: dup = abs(n) else: nums[abs(n) - 1] *= -1 for i in xrange(len(nums)): if nums[i] > 0: missing = i + 1 break ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findErrorNums(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findErrorNumsFirstSolution(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> dup, missing = (...
stack_v2_sparse_classes_75kplus_train_067793
987
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findErrorNums", "signature": "def findErrorNums(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findErrorNumsFirstSolution", "signature": "def findErrorNumsFirstSolution(self, nums)" }...
2
stack_v2_sparse_classes_30k_train_016735
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findErrorNums(self, nums): :type nums: List[int] :rtype: List[int] - def findErrorNumsFirstSolution(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findErrorNums(self, nums): :type nums: List[int] :rtype: List[int] - def findErrorNumsFirstSolution(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class S...
25e5caf324e25edfdf0a7a3be1e572f5d4c88837
<|skeleton|> class Solution: def findErrorNums(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findErrorNumsFirstSolution(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findErrorNums(self, nums): """:type nums: List[int] :rtype: List[int]""" dup, missing = (-1, -1) for n in nums: if nums[abs(n) - 1] < 0: dup = abs(n) else: nums[abs(n) - 1] *= -1 for i in xrange(len(nums)): ...
the_stack_v2_python_sparse
Arrays/set_mismatch.py
msraju2009/CodingProblemsPractice
train
0
0d46f30349c23e17197d09ed31d1eb4a7673c7fd
[ "super(MeanShift, self).__init__()\nself.rgb_std = rgb_std\nself.rgb_mean = rgb_mean\nself.sign = sign\nself.rgb_range = rgb_range", "std = tf.convert_to_tensor(self.rgb_std, dtype=tf.float32)\nself.weight = tf.convert_to_tensor(np.eye(3).astype(np.float32))\nself.weight = tf.div(self.weight, std)\nself.bias = se...
<|body_start_0|> super(MeanShift, self).__init__() self.rgb_std = rgb_std self.rgb_mean = rgb_mean self.sign = sign self.rgb_range = rgb_range <|end_body_0|> <|body_start_1|> std = tf.convert_to_tensor(self.rgb_std, dtype=tf.float32) self.weight = tf.convert_to_t...
Subtract or add rgb_mean to the image.
MeanShift
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeanShift: """Subtract or add rgb_mean to the image.""" def __init__(self, rgb_range, rgb_mean, rgb_std=(1.0, 1.0, 1.0), sign=-1): """Construct the class MeanShift. :param rgb_range: range of tensor, usually 1.0 or 255.0 :param rgb_mean: mean of rgb value :param rgb_std: std of rgb v...
stack_v2_sparse_classes_75kplus_train_067794
33,272
permissive
[ { "docstring": "Construct the class MeanShift. :param rgb_range: range of tensor, usually 1.0 or 255.0 :param rgb_mean: mean of rgb value :param rgb_std: std of rgb value :param sign: -1 for subtract, 1 for add", "name": "__init__", "signature": "def __init__(self, rgb_range, rgb_mean, rgb_std=(1.0, 1.0...
2
stack_v2_sparse_classes_30k_train_007928
Implement the Python class `MeanShift` described below. Class description: Subtract or add rgb_mean to the image. Method signatures and docstrings: - def __init__(self, rgb_range, rgb_mean, rgb_std=(1.0, 1.0, 1.0), sign=-1): Construct the class MeanShift. :param rgb_range: range of tensor, usually 1.0 or 255.0 :param...
Implement the Python class `MeanShift` described below. Class description: Subtract or add rgb_mean to the image. Method signatures and docstrings: - def __init__(self, rgb_range, rgb_mean, rgb_std=(1.0, 1.0, 1.0), sign=-1): Construct the class MeanShift. :param rgb_range: range of tensor, usually 1.0 or 255.0 :param...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class MeanShift: """Subtract or add rgb_mean to the image.""" def __init__(self, rgb_range, rgb_mean, rgb_std=(1.0, 1.0, 1.0), sign=-1): """Construct the class MeanShift. :param rgb_range: range of tensor, usually 1.0 or 255.0 :param rgb_mean: mean of rgb value :param rgb_std: std of rgb v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MeanShift: """Subtract or add rgb_mean to the image.""" def __init__(self, rgb_range, rgb_mean, rgb_std=(1.0, 1.0, 1.0), sign=-1): """Construct the class MeanShift. :param rgb_range: range of tensor, usually 1.0 or 255.0 :param rgb_mean: mean of rgb value :param rgb_std: std of rgb value :param s...
the_stack_v2_python_sparse
zeus/modules/operators/functions/tensorflow_fn.py
huawei-noah/xingtian
train
308
51e036e4d90cdf58a1568336f39be8a2799f3469
[ "query = biz.g.session.query(biz.accounts.User)\norganization_id = flask.request.args.get('organization_id')\nif organization_id is not None:\n query = query.filter_by(organization_id=int(organization_id))\nmedia = CollectionMedia.from_request_and_query(query, UserMedia, sortable_columns={'username': biz.account...
<|body_start_0|> query = biz.g.session.query(biz.accounts.User) organization_id = flask.request.args.get('organization_id') if organization_id is not None: query = query.filter_by(organization_id=int(organization_id)) media = CollectionMedia.from_request_and_query(query, User...
HTTP methods for `User` entities.
UsersView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersView: """HTTP methods for `User` entities.""" def get(self, organization_id=None): """GET representation of a `UserMedia` collection.""" <|body_0|> def post(self): """POST new user according to request entity.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_067795
31,617
no_license
[ { "docstring": "GET representation of a `UserMedia` collection.", "name": "get", "signature": "def get(self, organization_id=None)" }, { "docstring": "POST new user according to request entity.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_005776
Implement the Python class `UsersView` described below. Class description: HTTP methods for `User` entities. Method signatures and docstrings: - def get(self, organization_id=None): GET representation of a `UserMedia` collection. - def post(self): POST new user according to request entity.
Implement the Python class `UsersView` described below. Class description: HTTP methods for `User` entities. Method signatures and docstrings: - def get(self, organization_id=None): GET representation of a `UserMedia` collection. - def post(self): POST new user according to request entity. <|skeleton|> class UsersVi...
b2053c1ede946d961ceae27dc393b5977332076c
<|skeleton|> class UsersView: """HTTP methods for `User` entities.""" def get(self, organization_id=None): """GET representation of a `UserMedia` collection.""" <|body_0|> def post(self): """POST new user according to request entity.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UsersView: """HTTP methods for `User` entities.""" def get(self, organization_id=None): """GET representation of a `UserMedia` collection.""" query = biz.g.session.query(biz.accounts.User) organization_id = flask.request.args.get('organization_id') if organization_id is no...
the_stack_v2_python_sparse
Angaza_ACME_Backend_SMS/backend/za/blueprints/biz_api.py
ebland/Interview-Challenges
train
0
b800923ace451f5793be39ee42413de6eb030af4
[ "self.data = data\nself.best_acc = best_acc\nself.file_weights = file_weights\nself.early_stopping = early_stopping\nself.epochs_since_improvement = 0\nself.epoch_best = 0\nself.considered_improvement = considered_improvement\nself.label_list = label_list", "results = evaluate_metrics(self.model, self.data, ['cla...
<|body_start_0|> self.data = data self.best_acc = best_acc self.file_weights = file_weights self.early_stopping = early_stopping self.epochs_since_improvement = 0 self.epoch_best = 0 self.considered_improvement = considered_improvement self.label_list = la...
Keras callback to calculate acc after each epoch and save file with the weights if the evaluation improves
ClassificationCallback
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationCallback: """Keras callback to calculate acc after each epoch and save file with the weights if the evaluation improves""" def __init__(self, data, file_weights=None, best_acc=0, early_stopping=0, considered_improvement=0.01, label_list=[]): """Initialize the keras call...
stack_v2_sparse_classes_75kplus_train_067796
8,596
permissive
[ { "docstring": "Initialize the keras callback Parameters ---------- data : tuple or KerasDataGenerator Validation data for model evaluation (X_val, Y_val) or KerasDataGenerator file_weights : string Path to the file with the weights best_acc : float Last accuracy value, only if continue early_stopping : int Num...
2
stack_v2_sparse_classes_30k_train_018045
Implement the Python class `ClassificationCallback` described below. Class description: Keras callback to calculate acc after each epoch and save file with the weights if the evaluation improves Method signatures and docstrings: - def __init__(self, data, file_weights=None, best_acc=0, early_stopping=0, considered_im...
Implement the Python class `ClassificationCallback` described below. Class description: Keras callback to calculate acc after each epoch and save file with the weights if the evaluation improves Method signatures and docstrings: - def __init__(self, data, file_weights=None, best_acc=0, early_stopping=0, considered_im...
61103493c55233a80f92f0f52639788b50ef2edd
<|skeleton|> class ClassificationCallback: """Keras callback to calculate acc after each epoch and save file with the weights if the evaluation improves""" def __init__(self, data, file_weights=None, best_acc=0, early_stopping=0, considered_improvement=0.01, label_list=[]): """Initialize the keras call...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassificationCallback: """Keras callback to calculate acc after each epoch and save file with the weights if the evaluation improves""" def __init__(self, data, file_weights=None, best_acc=0, early_stopping=0, considered_improvement=0.01, label_list=[]): """Initialize the keras callback Paramete...
the_stack_v2_python_sparse
dcase_models/util/callbacks.py
BilalAltundag/DCASE-models
train
0
6f0a1161c58a38699e3b31b86f68831b24bc9c89
[ "def dfs(node):\n if not node:\n return 0\n count = 1\n for child in (node.left, node.right):\n if not child:\n continue\n count_child = dfs(child)\n if child.val == node.val + 1:\n count = max(count, count_child + 1)\n self.max_count = max(self.max_coun...
<|body_start_0|> def dfs(node): if not node: return 0 count = 1 for child in (node.left, node.right): if not child: continue count_child = dfs(child) if child.val == node.val + 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def longestConsecutive_verbose(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(node): ...
stack_v2_sparse_classes_75kplus_train_067797
2,981
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "longestConsecutive_verbose", "signature": "def longestConsecutive_verbose(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_031870
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, root): :type root: TreeNode :rtype: int - def longestConsecutive_verbose(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, root): :type root: TreeNode :rtype: int - def longestConsecutive_verbose(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def longestConsecutive_verbose(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" def dfs(node): if not node: return 0 count = 1 for child in (node.left, node.right): if not child: continue ...
the_stack_v2_python_sparse
src/lt_298.py
oxhead/CodingYourWay
train
0
386e3f7e35652a26ed8ce5122c7deca74ea951ac
[ "self.entity_description = sensor\nself._attr_unique_id = f\"{coordinator.data['deviceID']}-{sensor.key}\"\nsuper().__init__(coordinator)", "if (value := self.coordinator.data.get(self.entity_description.key)) is None:\n return None\nif self.entity_description.state_fn is not None:\n return self.entity_desc...
<|body_start_0|> self.entity_description = sensor self._attr_unique_id = f"{coordinator.data['deviceID']}-{sensor.key}" super().__init__(coordinator) <|end_body_0|> <|body_start_1|> if (value := self.coordinator.data.get(self.entity_description.key)) is None: return None ...
Representation of a Fully Kiosk Browser sensor.
FullySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullySensor: """Representation of a Fully Kiosk Browser sensor.""" def __init__(self, coordinator: FullyKioskDataUpdateCoordinator, sensor: FullySensorEntityDescription) -> None: """Initialize the sensor entity.""" <|body_0|> def native_value(self) -> StateType: ...
stack_v2_sparse_classes_75kplus_train_067798
4,613
permissive
[ { "docstring": "Initialize the sensor entity.", "name": "__init__", "signature": "def __init__(self, coordinator: FullyKioskDataUpdateCoordinator, sensor: FullySensorEntityDescription) -> None" }, { "docstring": "Return the state of the sensor.", "name": "native_value", "signature": "def...
2
stack_v2_sparse_classes_30k_train_024369
Implement the Python class `FullySensor` described below. Class description: Representation of a Fully Kiosk Browser sensor. Method signatures and docstrings: - def __init__(self, coordinator: FullyKioskDataUpdateCoordinator, sensor: FullySensorEntityDescription) -> None: Initialize the sensor entity. - def native_va...
Implement the Python class `FullySensor` described below. Class description: Representation of a Fully Kiosk Browser sensor. Method signatures and docstrings: - def __init__(self, coordinator: FullyKioskDataUpdateCoordinator, sensor: FullySensorEntityDescription) -> None: Initialize the sensor entity. - def native_va...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class FullySensor: """Representation of a Fully Kiosk Browser sensor.""" def __init__(self, coordinator: FullyKioskDataUpdateCoordinator, sensor: FullySensorEntityDescription) -> None: """Initialize the sensor entity.""" <|body_0|> def native_value(self) -> StateType: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FullySensor: """Representation of a Fully Kiosk Browser sensor.""" def __init__(self, coordinator: FullyKioskDataUpdateCoordinator, sensor: FullySensorEntityDescription) -> None: """Initialize the sensor entity.""" self.entity_description = sensor self._attr_unique_id = f"{coordin...
the_stack_v2_python_sparse
homeassistant/components/fully_kiosk/sensor.py
konnected-io/home-assistant
train
24
01c38b26c3ce7de55647ad3b80725618699fe4f8
[ "self.timeLimit = timeLimit\nself.pid = pid\nself.exe = exe\nself.log = log\nself.extraTimer = None\nself.mainTimer = threading.Timer(timeLimit, self.MaybeDoKill)\nself.mainTimer.start()", "self.mainTimer.cancel()\nif self.extraTimer:\n self.extraTimer.cancel()\n self.extraTimer.join()\nself.mainTimer.join(...
<|body_start_0|> self.timeLimit = timeLimit self.pid = pid self.exe = exe self.log = log self.extraTimer = None self.mainTimer = threading.Timer(timeLimit, self.MaybeDoKill) self.mainTimer.start() <|end_body_0|> <|body_start_1|> self.mainTimer.cancel() ...
A specialised timer creator for killing running tests if they take too long.
TestKillerTimer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestKillerTimer: """A specialised timer creator for killing running tests if they take too long.""" def __init__(self, timeLimit, pid, exe, log): """Create a new timer.""" <|body_0|> def Stop(self): """Cancel the timer (if it hasn't already fired) and wait for it...
stack_v2_sparse_classes_75kplus_train_067799
11,407
permissive
[ { "docstring": "Create a new timer.", "name": "__init__", "signature": "def __init__(self, timeLimit, pid, exe, log)" }, { "docstring": "Cancel the timer (if it hasn't already fired) and wait for it to stop fully.", "name": "Stop", "signature": "def Stop(self)" }, { "docstring": ...
5
stack_v2_sparse_classes_30k_test_000471
Implement the Python class `TestKillerTimer` described below. Class description: A specialised timer creator for killing running tests if they take too long. Method signatures and docstrings: - def __init__(self, timeLimit, pid, exe, log): Create a new timer. - def Stop(self): Cancel the timer (if it hasn't already f...
Implement the Python class `TestKillerTimer` described below. Class description: A specialised timer creator for killing running tests if they take too long. Method signatures and docstrings: - def __init__(self, timeLimit, pid, exe, log): Create a new timer. - def Stop(self): Cancel the timer (if it hasn't already f...
f21282cbe6e3c644cba4c24e7a3fa9d55480d9b2
<|skeleton|> class TestKillerTimer: """A specialised timer creator for killing running tests if they take too long.""" def __init__(self, timeLimit, pid, exe, log): """Create a new timer.""" <|body_0|> def Stop(self): """Cancel the timer (if it hasn't already fired) and wait for it...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestKillerTimer: """A specialised timer creator for killing running tests if they take too long.""" def __init__(self, timeLimit, pid, exe, log): """Create a new timer.""" self.timeLimit = timeLimit self.pid = pid self.exe = exe self.log = log self.extraTim...
the_stack_v2_python_sparse
python/infra/TestRunner.py
Chaste/Chaste
train
116